/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./node_modules/mathador/dist/index.esm.min.js":
/*!*****************************************************!*\
  !*** ./node_modules/mathador/dist/index.esm.min.js ***!
  \*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"EulerAngles\": () => (/* binding */ _),\n/* harmony export */   \"Mat3\": () => (/* binding */ l),\n/* harmony export */   \"Mat4\": () => (/* binding */ m),\n/* harmony export */   \"Plane\": () => (/* binding */ w),\n/* harmony export */   \"Quaternion\": () => (/* binding */ c),\n/* harmony export */   \"Segment\": () => (/* binding */ d),\n/* harmony export */   \"Triangle\": () => (/* binding */ M),\n/* harmony export */   \"Vec2\": () => (/* binding */ u),\n/* harmony export */   \"Vec3\": () => (/* binding */ z),\n/* harmony export */   \"Vec4\": () => (/* binding */ g),\n/* harmony export */   \"clamp\": () => (/* binding */ n),\n/* harmony export */   \"degToRad\": () => (/* binding */ e),\n/* harmony export */   \"getDistance2D\": () => (/* binding */ h),\n/* harmony export */   \"getDistance3D\": () => (/* binding */ a),\n/* harmony export */   \"getRandomArrayElement\": () => (/* binding */ s),\n/* harmony export */   \"getRandomFloat\": () => (/* binding */ i),\n/* harmony export */   \"getRandomInt\": () => (/* binding */ t),\n/* harmony export */   \"isPowerOf2\": () => (/* binding */ y),\n/* harmony export */   \"lerp\": () => (/* binding */ x),\n/* harmony export */   \"radToDeg\": () => (/* binding */ r),\n/* harmony export */   \"smoothstep\": () => (/* binding */ o)\n/* harmony export */ });\nfunction t(t,i){return Math.round(Math.random()*(i-t))+t}function i(t,i){return Math.random()*(i-t)+t}function s(t){return t[Math.floor(Math.random()*t.length)]}function r(t){return 180*t/Math.PI}function e(t){return t*Math.PI/180}function h(t,i,s,r){const e=s-t,h=r-i;return Math.sqrt(e*e+h*h)}function a(t,i,s,r,e,h){const a=r-t,n=e-i,x=h-s;return Math.sqrt(a*a+n*n+x*x)}function n(t,i,s){return Math.max(i,Math.min(t,s))}function x(t,i,s){return t*(1-s)+i*s}function o(t,i,s,r){return t=n((t-i)/(s-i),0,1),r?t*t*t*(t*(6*t-15)+10):t*t*(3-2*t)}function y(t){return 0==(t&t-1)}class _{constructor(t=0,i=0,s=0,r=\"XYZ\"){this.x=t,this.y=i,this.z=s,this.order=r}static fromEuler(t){return(new _).setFromEuler(t)}static fromRotationMatrix(t,i){return(new _).setFromRotationMatrix(t,i)}static equals(t,i){return t.equals(i)}clone(){return new _(this.x,this.y,this.z,this.order)}set(t,i,s,r=\"XYZ\"){return this.x=t,this.y=i,this.z=s,this.order=r,this}setFromEuler(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.order===t.order}setFromRotationMatrix(t,i){const s=t.toArray();if(16!==s.length)throw new Error(\"Matrix must contain 16 elements\");const[r,e,h,a,x,o,y,_,u,l,c,z,m,w,d,M]=s;switch(i){case\"XYZ\":this.y=Math.asin(n(u,-1,1)),Math.abs(u)<.999999?(this.x=Math.atan2(-l,c),this.z=Math.atan2(-x,r)):(this.x=Math.atan2(y,o),this.z=0);break;case\"XZY\":this.z=Math.asin(-n(x,-1,1)),Math.abs(x)<.999999?(this.x=Math.atan2(y,o),this.y=Math.atan2(u,r)):(this.x=Math.atan2(-l,c),this.y=0);break;case\"YXZ\":this.x=Math.asin(-n(l,-1,1)),Math.abs(l)<.999999?(this.y=Math.atan2(u,c),this.z=Math.atan2(e,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case\"YZX\":this.z=Math.asin(n(e,-1,1)),Math.abs(e)<.999999?(this.x=Math.atan2(-l,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(u,c));break;case\"ZXY\":this.x=Math.asin(n(y,-1,1)),Math.abs(y)<.999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-x,o)):(this.y=0,this.z=Math.atan2(e,r));break;case\"ZYX\":this.y=Math.asin(-n(h,-1,1)),Math.abs(h)<.999999?(this.x=Math.atan2(y,c),this.z=Math.atan2(e,r)):(this.x=0,this.z=Math.atan2(-x,o))}return this.order=i,this}}class u{constructor(t=0,i=0){this.length=2,this.x=t,this.y=i}static multiplyByScalar(t,i){return new u(t.x*i,t.y*i)}static addScalar(t,i){return new u(t.x+i,t.y+i)}static normalize(t){return(new u).setFromVec2(t).normalize()}static add(t,i){return new u(t.x+i.x,t.y+i.y)}static subtract(t,i){return new u(t.x-i.x,t.y-i.y)}static dotProduct(t,i){return t.x*i.x+t.y*i.y}static applyMat3(t,i){return t.clone().applyMat3(i)}static lerp(t,i,s){return t.clone().lerp(i,s)}static rotate(t,i,s){return t.clone().rotate(i,s)}static equals(t,i,s=6){return!!t&&t.equals(i)}static getDistance(t,i){const s=i.x-t.x,r=i.y-t.y;return Math.sqrt(s*s+r*r)}static getAngle(t,i){return t.getAngle(i)}static minMax(...t){if(!(t=(t||[]).filter((t=>t))).length)return{min:new u,max:new u};return{min:new u(Math.min(...t.map((t=>t.x))),Math.min(...t.map((t=>t.y)))),max:new u(Math.max(...t.map((t=>t.x))),Math.max(...t.map((t=>t.y))))}}clone(){return new u(this.x,this.y)}set(t,i){return this.x=t,this.y=i,this}setFromVec2(t){return this.x=t.x,this.y=t.y,this}multiplyByScalar(t){return this.x*=t,this.y*=t,this}addScalar(t){return this.x+=t,this.y+=t,this}getMagnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)}getAngle(t){const i=Math.atan2(this.x,this.y);let s=Math.atan2(t.x,t.y)-i;return s>Math.PI?s-=2*Math.PI:s<=-Math.PI&&(s+=2*Math.PI),s}normalize(){const t=this.getMagnitude();return t&&(this.x/=t,this.y/=t),this}add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.x-=t.x,this.y-=t.y,this}dotProduct(t){return u.dotProduct(this,t)}applyMat3(t){if(9!==t.length)throw new Error(\"Matrix must contain 9 elements\");const{x:i,y:s}=this,[r,e,,h,a,,n,x]=t;return this.x=i*r+s*h+n,this.y=i*e+s*a+x,this}lerp(t,i){return this.x+=i*(t.x-this.x),this.y+=i*(t.y-this.y),this}rotate(t,i){const s=Math.sin(i),r=Math.cos(i),e=this.x-t.x,h=this.y-t.y;return this.x=e*r-h*s+t.x,this.y=e*s+h*r+t.y,this}truncate(t=5){return this.x=+this.x.toFixed(t),this.y=+this.y.toFixed(t),this}equals(t,i=6){return!!t&&(+this.x.toFixed(i)==+t.x.toFixed(i)&&+this.y.toFixed(i)==+t.y.toFixed(i))}toArray(){return[this.x,this.y]}toIntArray(){return new Int32Array(this)}toFloatArray(){return new Float32Array(this)}*[Symbol.iterator](){yield this.x,yield this.y}}class l{constructor(){this.length=9,this._matrix=new Array(this.length),this._matrix[0]=1,this._matrix[1]=0,this._matrix[2]=0,this._matrix[3]=0,this._matrix[4]=1,this._matrix[5]=0,this._matrix[6]=0,this._matrix[7]=0,this._matrix[8]=1}get x_x(){return this._matrix[0]}get x_y(){return this._matrix[1]}get x_z(){return this._matrix[2]}get y_x(){return this._matrix[3]}get y_y(){return this._matrix[4]}get y_z(){return this._matrix[5]}get z_x(){return this._matrix[6]}get z_y(){return this._matrix[7]}get z_z(){return this._matrix[8]}static fromMat3(t){return(new l).setFromMat3(t)}static fromMat4(t){return(new l).setFromMat4(t)}static from4Vec2(t,i,s,r,e=!1){const h=new l;h.applyTranslation(-t.x,-t.y);const a=u.subtract(i,t).getMagnitude(),n=u.subtract(r,s).getMagnitude()/a;if(h.applyScaling(n),!e){const e=Math.atan2(i.y-t.y,i.x-t.x)-Math.atan2(r.y-s.y,r.x-s.x);h.applyRotation(e)}return h.applyTranslation(s.x,s.y),h}static multiply(t,i){const[s,r,e,h,a,n,x,o,y]=t._matrix,[_,u,c,z,m,w,d,M,g]=i._matrix,p=new l;return p.set(s*_+r*z+e*d,s*u+r*m+e*M,s*c+r*w+e*g,h*_+a*z+n*d,h*u+a*m+n*M,h*c+a*w+n*g,x*_+o*z+y*d,x*u+o*m+y*M,x*c+o*w+y*g),p}static multiplyScalar(t,i){const s=new l;for(let r=0;r<this.length;r++)s._matrix[r]=t._matrix[r]*i;return s}static transpose(t){const i=new l;return i.set(t.x_x,t.y_x,t.z_x,t.x_y,t.y_y,t.z_y,t.x_z,t.y_z,t.z_z),i}static invert(t){const i=new l;i.set(t.y_y*t.z_z-t.z_y*t.y_z,t.y_x*t.z_z-t.z_x*t.y_z,t.y_x*t.z_y-t.z_x*t.y_y,t.x_y*t.z_z-t.z_y*t.x_z,t.x_x*t.z_z-t.z_x*t.x_z,t.x_x*t.z_y-t.z_x*t.x_y,t.x_y*t.y_z-t.y_y*t.x_z,t.x_x*t.y_z-t.y_x*t.x_z,t.x_x*t.y_y-t.y_x*t.x_y),i.set(i.x_x,-i.x_y,i.x_z,-i.y_x,i.y_y,-i.y_z,i.z_x,-i.z_y,i.z_z);const s=t.x_x*i.x_x+t.x_y*i.x_y+t.x_z*i.x_z,r=new l;if(s){const t=1/s;r.set(t*i.x_x,t*i.y_x,t*i.z_x,t*i.x_y,t*i.y_y,t*i.z_y,t*i.x_z,t*i.y_z,t*i.z_z)}else r.set(0,0,0,0,0,0,0,0,0);return r}static buildScale(t,i){return null!=i||(i=t),(new l).set(t,0,0,0,i,0,0,0,1)}static buildRotation(t){const i=Math.cos(t),s=Math.sin(t);return(new l).set(i,-s,0,s,i,0,0,0,1)}static buildTranslate(t,i){return(new l).set(1,0,0,0,1,0,t,i,1)}static equals(t,i,s=6){return t.equals(i,s)}clone(){return(new l).set(this.x_x,this.x_y,this.x_z,this.y_x,this.y_y,this.y_z,this.z_x,this.z_y,this.z_z)}set(t,i,s,r,e,h,a,n,x){return this._matrix[0]=t,this._matrix[1]=i,this._matrix[2]=s,this._matrix[3]=r,this._matrix[4]=e,this._matrix[5]=h,this._matrix[6]=a,this._matrix[7]=n,this._matrix[8]=x,this}reset(){return this._matrix[0]=1,this._matrix[1]=0,this._matrix[2]=0,this._matrix[3]=0,this._matrix[4]=1,this._matrix[5]=0,this._matrix[6]=0,this._matrix[7]=0,this._matrix[8]=1,this}setFromMat3(t){for(let i=0;i<this.length;i++)this._matrix[i]=t._matrix[i];return this}setFromMat4(t){const i=t.toArray();if(16!==i.length)throw new Error(\"Matrix must contain 16 elements\");const[s,r,e,,h,a,n,,x,o,y]=i;for(let t=0;t<this.length;t++)this._matrix[0]=s,this._matrix[1]=r,this._matrix[2]=e,this._matrix[3]=h,this._matrix[4]=a,this._matrix[5]=n,this._matrix[6]=x,this._matrix[7]=o,this._matrix[8]=y;return this}multiply(t){const[i,s,r,e,h,a,n,x,o]=this._matrix,[y,_,u,l,c,z,m,w,d]=t._matrix;return this._matrix[0]=i*y+s*l+r*m,this._matrix[1]=i*_+s*c+r*w,this._matrix[2]=i*u+s*z+r*d,this._matrix[3]=e*y+h*l+a*m,this._matrix[4]=e*_+h*c+a*w,this._matrix[5]=e*u+h*z+a*d,this._matrix[6]=n*y+x*l+o*m,this._matrix[7]=n*_+x*c+o*w,this._matrix[8]=n*u+x*z+o*d,this}multiplyScalar(t){for(let i=0;i<this.length;i++)this._matrix[i]*=t;return this}transpose(){const t=(new l).setFromMat3(this);return this.set(t.x_x,t.y_x,t.z_x,t.x_y,t.y_y,t.z_y,t.x_z,t.y_z,t.z_z),this}invert(){const t=new l;t.set(this.y_y*this.z_z-this.z_y*this.y_z,this.y_x*this.z_z-this.z_x*this.y_z,this.y_x*this.z_y-this.z_x*this.y_y,this.x_y*this.z_z-this.z_y*this.x_z,this.x_x*this.z_z-this.z_x*this.x_z,this.x_x*this.z_y-this.z_x*this.x_y,this.x_y*this.y_z-this.y_y*this.x_z,this.x_x*this.y_z-this.y_x*this.x_z,this.x_x*this.y_y-this.y_x*this.x_y),t.set(t.x_x,-t.x_y,t.x_z,-t.y_x,t.y_y,-t.y_z,t.z_x,-t.z_y,t.z_z);const i=this.x_x*t.x_x+this.x_y*t.x_y+this.x_z*t.x_z;if(i){const s=1/i;this.set(s*t.x_x,s*t.y_x,s*t.z_x,s*t.x_y,s*t.y_y,s*t.z_y,s*t.x_z,s*t.y_z,s*t.z_z)}else this.set(0,0,0,0,0,0,0,0,0);return this}getDeterminant(){const[t,i,s,r,e,h,a,n,x]=this._matrix;return t*e*x-t*h*n+i*h*a-i*r*x+s*r*n-s*e*a}getTRS(){const t=new u(this.z_x,this.z_y),i=Math.sqrt(this.x_x*this.x_x+this.x_y*this.x_y),s=Math.sqrt(this.y_x*this.y_x+this.y_y*this.y_y),r=new u(i,s),e=Math.atan(-this.x_y/this.x_x),h=Math.acos(this.x_x/i);let a;return a=h>Math.PI/2&&e>0||h<Math.PI/2&&e<0?2*Math.PI-h:h,{t:t,r:a,s:r}}truncate(t=5){for(let i=0;i<this.length;i++)this._matrix[i]=+this._matrix[i].toFixed(t);return this}equals(t,i=6){for(let s=0;s<this.length;s++)if(+this._matrix[s].toFixed(i)!=+t._matrix[s].toFixed(i))return!1;return!0}applyScaling(t,i){const s=l.buildScale(t,i);return this.multiply(s)}applyTranslation(t,i){const s=l.buildTranslate(t,i);return this.multiply(s)}applyRotation(t){const i=l.buildRotation(t);return this.multiply(i)}toArray(){return this._matrix.slice()}toIntArray(){return new Int32Array(this)}toFloatArray(){return new Float32Array(this)}toIntShortArray(){return new Int32Array([this._matrix[0],this._matrix[1],this._matrix[3],this._matrix[4],this._matrix[6],this._matrix[7]])}toFloatShortArray(){return new Float32Array([+this._matrix[0].toFixed(5),+this._matrix[1].toFixed(5),+this._matrix[3].toFixed(5),+this._matrix[4].toFixed(5),+this._matrix[6].toFixed(5),+this._matrix[7].toFixed(5)])}*[Symbol.iterator](){for(let t=0;t<9;t++)yield this._matrix[t]}}class c{constructor(t=0,i=0,s=0,r=1){this.x=t,this.y=i,this.z=s,this.w=r}static fromRotationMatrix(t){return(new c).setFromRotationMatrix(t)}static fromEuler(t){return(new c).setFromEuler(t)}static fromVec3Angle(t,i){return(new c).setFromVec3Angle(t,i)}static fromVec3s(t,i){return(new c).setFromVec3s(t,i)}static normalize(t){return t.clone().normalize()}static invert(t){return t.clone().normalize().invert()}static dotProduct(t,i){return t.x*i.x+t.y*i.y+t.z*i.z+t.w*i.w}static getAngle(t,i){return t.getAngle(i)}static multiply(t,i){return t.clone().multiply(i)}static slerp(t,i,s){return t.clone().slerp(i,s)}static equals(t,i,s=6){return t.equals(i,s)}clone(){return new c(this.x,this.y,this.z,this.w)}set(t,i,s,r){return this.x=t,this.y=i,this.z=s,this.w=r,this}setFromVec3s(t,i){t=t.clone().normalize(),i=i.clone().normalize();let s=t.dotProduct(i)+1;if(s<1e-6)s=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y);else{const{x:s,y:r,z:e}=t.crossProduct(i);this.x=s,this.y=r,this.z=e}return this.w=s,this.normalize()}setFromQ(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}setFromRotationMatrix(t){if(16!==t.length)throw new Error(\"Matrix must contain 16 elements\");const[i,s,r,e,h,a,n,x,o,y,_,u,l,c,z,m]=t,w=i+a+_;if(w>0){const t=.5/Math.sqrt(1+w);this.set((n-y)*t,(o-r)*t,(s-h)*t,.25/t)}else if(i>a&&i>_){const t=2*Math.sqrt(1+i-a-_);this.set(.25*t,(h+s)/t,(o+r)/t,(n-y)/t)}else if(a>_){const t=2*Math.sqrt(1+a-i-_);this.set((h+s)/t,.25*t,(y+n)/t,(o-r)/t)}else{const t=2*Math.sqrt(1+_-i-a);this.set((o+r)/t,(y+n)/t,.25*t,(s-h)/t)}return this}setFromEuler(t){const i=Math.cos(t.x/2),s=Math.cos(t.y/2),r=Math.cos(t.z/2),e=Math.sin(t.x/2),h=Math.sin(t.y/2),a=Math.sin(t.z/2);switch(t.order){case\"XYZ\":this.x=e*s*r+i*h*a,this.y=i*h*r-e*s*a,this.z=i*s*a+e*h*r,this.w=i*s*r-e*h*a;break;case\"XZY\":this.x=e*s*r-i*h*a,this.y=i*h*r-e*s*a,this.z=i*s*a+e*h*r,this.w=i*s*r+e*h*a;break;case\"YXZ\":this.x=e*s*r+i*h*a,this.y=i*h*r-e*s*a,this.z=i*s*a-e*h*r,this.w=i*s*r+e*h*a;break;case\"YZX\":this.x=e*s*r+i*h*a,this.y=i*h*r+e*s*a,this.z=i*s*a-e*h*r,this.w=i*s*r-e*h*a;break;case\"ZXY\":this.x=e*s*r-i*h*a,this.y=i*h*r+e*s*a,this.z=i*s*a+e*h*r,this.w=i*s*r-e*h*a;break;case\"ZYX\":this.x=e*s*r-i*h*a,this.y=i*h*r+e*s*a,this.z=i*s*a-e*h*r,this.w=i*s*r+e*h*a}return this}setFromVec3Angle(t,i){const s=t.clone().normalize(),r=i/2,e=Math.sin(r);return this.x=s.x*e,this.y=s.y*e,this.z=s.z*e,this.w=Math.cos(r),this}getMagnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}normalize(){const t=this.getMagnitude();return t&&(this.x/=t,this.y/=t,this.z/=t,this.w/=t),this}invert(){return this.normalize(),this.x*=-1,this.y*=-1,this.z*=-1,this}dotProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}getAngle(t){return 2*Math.acos(Math.abs(n(this.dotProduct(t),-1,1)))}multiply(t){const{x:i,y:s,z:r,w:e}=this,{x:h,y:a,z:n,w:x}=t;return this.x=i*x+e*h+s*n-r*a,this.y=s*x+e*a+r*h-i*n,this.z=r*x+e*n+i*a-s*h,this.w=e*x-i*h-s*a-r*n,this}slerp(t,i){if(!(i=n(i,0,1)))return this;if(1===i)return this.setFromQ(t);const{x:s,y:r,z:e,w:h}=this,{x:a,y:x,z:o,w:y}=t,_=s*a+r*x+e*o+h*y;if(Math.abs(_)>=1)return this;const u=Math.acos(_),l=Math.sin(u);if(Math.abs(l)<1e-6)return this.x=.5*(s+a),this.y=.5*(r+x),this.z=.5*(e+o),this.w=.5*(h+y),this;const c=Math.sin((1-i)*u)/l,z=Math.sin(i*u)/l;return this.x=c*s+z*a,this.y=c*r+z*x,this.z=c*e+z*o,this.w=c*h+z*y,this}equals(t,i=6){return+this.x.toFixed(i)==+t.x.toFixed(i)&&+this.y.toFixed(i)==+t.y.toFixed(i)&&+this.z.toFixed(i)==+t.z.toFixed(i)&&+this.w.toFixed(i)==+t.w.toFixed(i)}}class z{constructor(t=0,i=0,s=0){this.length=3,this.x=t,this.y=i,this.z=s}static multiplyByScalar(t,i){return new z(t.x*i,t.y*i,t.z*i)}static addScalar(t,i){return new z(t.x+i,t.y+i,t.z+i)}static normalize(t){return(new z).setFromVec3(t).normalize()}static add(t,i){return new z(t.x+i.x,t.y+i.y,t.z+i.z)}static subtract(t,i){return new z(t.x-i.x,t.y-i.y,t.z-i.z)}static dotProduct(t,i){return t.x*i.x+t.y*i.y+t.z*i.z}static crossProduct(t,i){return new z(t.y*i.z-t.z*i.y,t.z*i.x-t.x*i.z,t.x*i.y-t.y*i.x)}static onVector(t,i){return t.clone().onVector(i)}static onPlane(t,i){return t.clone().onPlane(i)}static applyMat3(t,i){return t.clone().applyMat3(i)}static applyMat4(t,i){return t.clone().applyMat4(i)}static lerp(t,i,s){return t.clone().lerp(i,s)}static equals(t,i,s=6){return!!t&&t.equals(i,s)}static getDistance(t,i){const s=i.x-t.x,r=i.y-t.y,e=i.z-t.z;return Math.sqrt(s*s+r*r+e*e)}static getAngle(t,i){return t.getAngle(i)}clone(){return new z(this.x,this.y,this.z)}set(t,i,s){return this.x=t,this.y=i,this.z=s,this}setFromVec3(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}multiplyByScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}getMagnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}getAngle(t){const i=this.getMagnitude()*t.getMagnitude();if(!i)return Math.PI/2;const s=this.dotProduct(t)/i;return Math.acos(n(s,-1,1))}normalize(){const t=this.getMagnitude();return t&&(this.x/=t,this.y/=t,this.z/=t),this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}dotProduct(t){return z.dotProduct(this,t)}crossProduct(t){return this.x=this.y*t.z-this.z*t.y,this.y=this.z*t.x-this.x*t.z,this.z=this.x*t.y-this.y*t.x,this}onVector(t){const i=this.getMagnitude();return i?t.clone().multiplyByScalar(t.clone().dotProduct(this)/(i*i)):this.set(0,0,0)}onPlane(t){return this.subtract(this.clone().onVector(t))}applyMat3(t){if(9!==t.length)throw new Error(\"Matrix must contain 9 elements\");const{x:i,y:s,z:r}=this,[e,h,a,n,x,o,y,_,u]=t;return this.x=i*e+s*n+r*y,this.y=i*h+s*x+r*_,this.z=i*a+s*o+r*u,this}applyMat4(t){if(16!==t.length)throw new Error(\"Matrix must contain 16 elements\");const{x:i,y:s,z:r}=this,[e,h,a,n,x,o,y,_,u,l,c,z,m,w,d,M]=t,g=1/(i*n+s*_+r*z+M);return this.x=(i*e+s*x+r*u+m)*g,this.y=(i*h+s*o+r*l+w)*g,this.z=(i*a+s*y+r*c+d)*g,this}lerp(t,i){return this.x+=i*(t.x-this.x),this.y+=i*(t.y-this.y),this.z+=i*(t.z-this.z),this}truncate(t=5){return this.x=+this.x.toFixed(t),this.y=+this.y.toFixed(t),this.z=+this.z.toFixed(t),this}equals(t,i=6){return!!t&&(+this.x.toFixed(i)==+t.x.toFixed(i)&&+this.y.toFixed(i)==+t.y.toFixed(i)&&+this.z.toFixed(i)==+t.z.toFixed(i))}toArray(){return[this.x,this.y,this.z]}toIntArray(){return new Int32Array(this)}toFloatArray(){return new Float32Array(this)}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}class m{constructor(){this.length=16,this._matrix=new Array(this.length),this._matrix[0]=1,this._matrix[1]=0,this._matrix[2]=0,this._matrix[3]=0,this._matrix[4]=0,this._matrix[5]=1,this._matrix[6]=0,this._matrix[7]=0,this._matrix[8]=0,this._matrix[9]=0,this._matrix[10]=1,this._matrix[11]=0,this._matrix[12]=0,this._matrix[13]=0,this._matrix[14]=0,this._matrix[15]=1}get x_x(){return this._matrix[0]}get x_y(){return this._matrix[1]}get x_z(){return this._matrix[2]}get x_w(){return this._matrix[3]}get y_x(){return this._matrix[4]}get y_y(){return this._matrix[5]}get y_z(){return this._matrix[6]}get y_w(){return this._matrix[7]}get z_x(){return this._matrix[8]}get z_y(){return this._matrix[9]}get z_z(){return this._matrix[10]}get z_w(){return this._matrix[11]}get w_x(){return this._matrix[12]}get w_y(){return this._matrix[13]}get w_z(){return this._matrix[14]}get w_w(){return this._matrix[15]}static fromMat4(t){return(new m).setFromMat4(t)}static fromTRS(t,i,s){return(new m).setFromTRS(t,i,s)}static fromQuaternion(t){return(new m).setFromQuaternion(t)}static multiply(t,i){const s=new m;return s.set(t.x_x*i.x_x+t.x_y*i.y_x+t.x_z*i.z_x+t.x_w*i.w_x,t.x_x*i.x_y+t.x_y*i.y_y+t.x_z*i.z_y+t.x_w*i.w_y,t.x_x*i.x_z+t.x_y*i.y_z+t.x_z*i.z_z+t.x_w*i.w_z,t.x_x*i.x_w+t.x_y*i.y_w+t.x_z*i.z_w+t.x_w*i.w_w,t.y_x*i.x_x+t.y_y*i.y_x+t.y_z*i.z_x+t.y_w*i.w_x,t.y_x*i.x_y+t.y_y*i.y_y+t.y_z*i.z_y+t.y_w*i.w_y,t.y_x*i.x_z+t.y_y*i.y_z+t.y_z*i.z_z+t.y_w*i.w_z,t.y_x*i.x_w+t.y_y*i.y_w+t.y_z*i.z_w+t.y_w*i.w_w,t.z_x*i.x_x+t.z_y*i.y_x+t.z_z*i.z_x+t.z_w*i.w_x,t.z_x*i.x_y+t.z_y*i.y_y+t.z_z*i.z_y+t.z_w*i.w_y,t.z_x*i.x_z+t.z_y*i.y_z+t.z_z*i.z_z+t.z_w*i.w_z,t.z_x*i.x_w+t.z_y*i.y_w+t.z_z*i.z_w+t.z_w*i.w_w,t.w_x*i.x_x+t.w_y*i.y_x+t.w_z*i.z_x+t.w_w*i.w_x,t.w_x*i.x_y+t.w_y*i.y_y+t.w_z*i.z_y+t.w_w*i.w_y,t.w_x*i.x_z+t.w_y*i.y_z+t.w_z*i.z_z+t.w_w*i.w_z,t.w_x*i.x_w+t.w_y*i.y_w+t.w_z*i.z_w+t.w_w*i.w_w),s}static multiplyScalar(t,i){const s=new m;for(let r=0;r<this.length;r++)s._matrix[r]=t._matrix[r]*i;return s}static transpose(t){const i=new m;return i.set(t.x_x,t.y_x,t.z_x,t.w_x,t.x_y,t.y_y,t.z_y,t.w_y,t.x_z,t.y_z,t.z_z,t.w_z,t.x_w,t.y_w,t.z_w,t.w_w),i}static invert(t){const i=1/t.getDeterminant(),[s,r,e,h,a,n,x,o,y,_,u,l,c,z,w,d]=t._matrix;return(new m).set((x*l*z-o*u*z+o*_*w-n*l*w-x*_*d+n*u*d)*i,(h*u*z-e*l*z-h*_*w+r*l*w+e*_*d-r*u*d)*i,(e*o*z-h*x*z+h*n*w-r*o*w-e*n*d+r*x*d)*i,(h*x*_-e*o*_-h*n*u+r*o*u+e*n*l-r*x*l)*i,(o*u*c-x*l*c-o*y*w+a*l*w+x*y*d-a*u*d)*i,(e*l*c-h*u*c+h*y*w-s*l*w-e*y*d+s*u*d)*i,(h*x*c-e*o*c-h*a*w+s*o*w+e*a*d-s*x*d)*i,(e*o*y-h*x*y+h*a*u-s*o*u-e*a*l+s*x*l)*i,(n*l*c-o*_*c+o*y*z-a*l*z-n*y*d+a*_*d)*i,(h*_*c-r*l*c-h*y*z+s*l*z+r*y*d-s*_*d)*i,(r*o*c-h*n*c+h*a*z-s*o*z-r*a*d+s*n*d)*i,(h*n*y-r*o*y-h*a*_+s*o*_+r*a*l-s*n*l)*i,(x*_*c-n*u*c-x*y*z+a*u*z+n*y*w-a*_*w)*i,(r*u*c-e*_*c+e*y*z-s*u*z-r*y*w+s*_*w)*i,(e*n*c-r*x*c-e*a*z+s*x*z+r*a*w-s*n*w)*i,(r*x*y-e*n*y+e*a*_-s*x*_-r*a*u+s*n*u)*i)}static lookAt(t,i,s){const r=z.equals(t,i)?new z(0,0,1):z.subtract(t,i).normalize();let e=z.crossProduct(s,r).normalize();e.getMagnitude()||(1===Math.abs(s.z)?r.x+=1e-5:r.z+=1e-5,r.normalize(),e=z.crossProduct(s,r).normalize());const h=z.crossProduct(r,e).normalize();return(new m).set(e.x,e.y,e.z,0,h.x,h.y,h.z,0,r.x,r.y,r.z,0,t.x,t.y,t.z,1)}static buildScale(t,i,s){return null!=i||(i=t),null!=s||(s=t),(new m).set(t,0,0,0,0,i,0,0,0,0,s,0,0,0,0,1)}static buildRotationX(t){const i=Math.cos(t),s=Math.sin(t);return(new m).set(1,0,0,0,0,i,s,0,0,-s,i,0,0,0,0,1)}static buildRotationY(t){const i=Math.cos(t),s=Math.sin(t);return(new m).set(i,0,-s,0,0,1,0,0,s,0,i,0,0,0,0,1)}static buildRotationZ(t){const i=Math.cos(t),s=Math.sin(t);return(new m).set(i,s,0,0,-s,i,0,0,0,0,1,0,0,0,0,1)}static buildTranslate(t,i,s){return(new m).set(1,0,0,0,0,1,0,0,0,0,1,0,t,i,s,1)}static buildOrthographic(t,i,s,r,e,h){return(new m).set(2/(r-s),0,0,0,0,2/(h-e),0,0,0,0,2/(t-i),0,(s+r)/(s-r),(e+h)/(e-h),(t+i)/(t-i),1)}static buildPerspective(t,i,...s){if(4===s.length){const[r,e,h,a]=s;return(new m).set(2*t/(e-r),0,0,0,0,2*t/(a-h),0,0,(e+r)/(e-r),(a+h)/(a-h),(t+i)/(t-i),-1,0,0,2*t*i/(t-i),0)}if(2===s.length){const[r,e]=s,h=Math.tan(.5*Math.PI-.5*r);return(new m).set(h/e,0,0,0,0,h,0,0,0,0,(t+i)/(t-i),-1,0,0,2*t*i/(t-i),0)}throw new Error(\"Incorrect args quantity\")}static equals(t,i,s=6){return t.equals(i,s)}clone(){return(new m).set(this.x_x,this.x_y,this.x_z,this.x_w,this.y_x,this.y_y,this.y_z,this.y_w,this.z_x,this.z_y,this.z_z,this.z_w,this.w_x,this.w_y,this.w_z,this.w_w)}set(t,i,s,r,e,h,a,n,x,o,y,_,u,l,c,z){return this._matrix[0]=t,this._matrix[1]=i,this._matrix[2]=s,this._matrix[3]=r,this._matrix[4]=e,this._matrix[5]=h,this._matrix[6]=a,this._matrix[7]=n,this._matrix[8]=x,this._matrix[9]=o,this._matrix[10]=y,this._matrix[11]=_,this._matrix[12]=u,this._matrix[13]=l,this._matrix[14]=c,this._matrix[15]=z,this}reset(){return this._matrix[0]=1,this._matrix[1]=0,this._matrix[2]=0,this._matrix[3]=0,this._matrix[4]=0,this._matrix[5]=1,this._matrix[6]=0,this._matrix[7]=0,this._matrix[8]=0,this._matrix[9]=0,this._matrix[10]=1,this._matrix[11]=0,this._matrix[12]=0,this._matrix[13]=0,this._matrix[14]=0,this._matrix[15]=1,this}setFromMat4(t){for(let i=0;i<this.length;i++)this._matrix[i]=t._matrix[i];return this}setFromTRS(t,i,s){const r=2*i.x*i.x,e=2*i.y*i.x,h=2*i.z*i.x,a=2*i.y*i.y,n=2*i.z*i.y,x=2*i.z*i.z,o=2*i.x*i.w,y=2*i.y*i.w,_=2*i.z*i.w;return this.set((1-a-x)*s.x,(e+_)*s.x,(h-y)*s.x,0,(e-_)*s.y,(1-r-x)*s.y,(n+o)*s.y,0,(h+y)*s.z,(n-o)*s.z,(1-r-a)*s.z,0,t.x,t.y,t.z,1),this}setFromQuaternion(t){return this.setFromTRS(new z(0,0,0),t,new z(1,1,1))}multiply(t){const[i,s,r,e,h,a,n,x,o,y,_,u,l,c,z,m]=this._matrix,[w,d,M,g,p,F,b,f,P,q,A,S,I,R,B,V]=t._matrix;return this._matrix[0]=i*w+s*p+r*P+e*I,this._matrix[1]=i*d+s*F+r*q+e*R,this._matrix[2]=i*M+s*b+r*A+e*B,this._matrix[3]=i*g+s*f+r*S+e*V,this._matrix[4]=h*w+a*p+n*P+x*I,this._matrix[5]=h*d+a*F+n*q+x*R,this._matrix[6]=h*M+a*b+n*A+x*B,this._matrix[7]=h*g+a*f+n*S+x*V,this._matrix[8]=o*w+y*p+_*P+u*I,this._matrix[9]=o*d+y*F+_*q+u*R,this._matrix[10]=o*M+y*b+_*A+u*B,this._matrix[11]=o*g+y*f+_*S+u*V,this._matrix[12]=l*w+c*p+z*P+m*I,this._matrix[13]=l*d+c*F+z*q+m*R,this._matrix[14]=l*M+c*b+z*A+m*B,this._matrix[15]=l*g+c*f+z*S+m*V,this}multiplyScalar(t){for(let i=0;i<this.length;i++)this._matrix[i]*=t;return this}transpose(){const t=(new m).setFromMat4(this);return this.set(t.x_x,t.y_x,t.z_x,t.w_x,t.x_y,t.y_y,t.z_y,t.w_y,t.x_z,t.y_z,t.z_z,t.w_z,t.x_w,t.y_w,t.z_w,t.w_w),this}invert(){const t=1/this.getDeterminant(),[i,s,r,e,h,a,n,x,o,y,_,u,l,c,z,m]=this._matrix;return this.set((n*u*c-x*_*c+x*y*z-a*u*z-n*y*m+a*_*m)*t,(e*_*c-r*u*c-e*y*z+s*u*z+r*y*m-s*_*m)*t,(r*x*c-e*n*c+e*a*z-s*x*z-r*a*m+s*n*m)*t,(e*n*y-r*x*y-e*a*_+s*x*_+r*a*u-s*n*u)*t,(x*_*l-n*u*l-x*o*z+h*u*z+n*o*m-h*_*m)*t,(r*u*l-e*_*l+e*o*z-i*u*z-r*o*m+i*_*m)*t,(e*n*l-r*x*l-e*h*z+i*x*z+r*h*m-i*n*m)*t,(r*x*o-e*n*o+e*h*_-i*x*_-r*h*u+i*n*u)*t,(a*u*l-x*y*l+x*o*c-h*u*c-a*o*m+h*y*m)*t,(e*y*l-s*u*l-e*o*c+i*u*c+s*o*m-i*y*m)*t,(s*x*l-e*a*l+e*h*c-i*x*c-s*h*m+i*a*m)*t,(e*a*o-s*x*o-e*h*y+i*x*y+s*h*u-i*a*u)*t,(n*y*l-a*_*l-n*o*c+h*_*c+a*o*z-h*y*z)*t,(s*_*l-r*y*l+r*o*c-i*_*c-s*o*z+i*y*z)*t,(r*a*l-s*n*l-r*h*c+i*n*c+s*h*z-i*a*z)*t,(s*n*o-r*a*o+r*h*y-i*n*y-s*h*_+i*a*_)*t),this}getDeterminant(){const[t,i,s,r,e,h,a,n,x,o,y,_,u,l,c,z]=this._matrix;return r*a*o*u-s*n*o*u-r*h*y*u+i*n*y*u+s*h*_*u-i*a*_*u-r*a*x*l+s*n*x*l+r*e*y*l-t*n*y*l-s*e*_*l+t*a*_*l+r*h*x*c-i*n*x*c-r*e*o*c+t*n*o*c+i*e*_*c-t*h*_*c-s*h*x*z+i*a*x*z+s*e*o*z-t*a*o*z-i*e*y*z+t*h*y*z}getTRS(){const t=new z(this.w_x,this.w_y,this.w_z),i=this.getDeterminant(),s=new z(this.x_x,this.x_y,this.x_z).getMagnitude()*(i<0?-1:1),r=new z(this.y_x,this.y_y,this.y_z).getMagnitude(),e=new z(this.z_x,this.z_y,this.z_z).getMagnitude(),h=new z(s,r,e),a=(new m).set(this.x_x/s,this.x_y/s,this.x_z/s,0,this.y_x/r,this.y_y/r,this.y_z/r,0,this.z_x/e,this.z_y/e,this.z_z/e,0,0,0,0,1);return{t:t,r:c.fromRotationMatrix(a),s:h}}truncate(t=5){for(let i=0;i<this.length;i++)this._matrix[i]=+this._matrix[i].toFixed(t);return this}equals(t,i=6){for(let s=0;s<this.length;s++)if(+this._matrix[s].toFixed(i)!=+t._matrix[s].toFixed(i))return!1;return!0}applyScaling(t,i,s){const r=m.buildScale(t,i,s);return this.multiply(r)}applyTranslation(t,i,s){const r=m.buildTranslate(t,i,s);return this.multiply(r)}applyRotation(t,i){let s;switch(t){case\"x\":default:s=m.buildRotationX(i);break;case\"y\":s=m.buildRotationY(i);break;case\"z\":s=m.buildRotationZ(i)}return this.multiply(s)}toArray(){return this._matrix.slice()}toIntArray(){return new Int32Array(this)}toFloatArray(){return new Float32Array(this)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this._matrix[t]}}class w{constructor(t=new z(0,0,1),i=0){if(!t.getMagnitude())throw new Error(\"Normal length is zero. Cannot define direction\");this.normal=t.clone().normalize(),this.d=i}get point(){return this.normal.clone().multiplyByScalar(-this.d)}static equals(t,i,s=6){return t.equals(i,s)}static fromNormalAndPoint(t,i){return(new w).setFromNormalAndPoint(t,i)}static fromVec3s(t,i,s){return(new w).setFromPoints(t,i,s)}static applyMat4(t,i){return t.clone().applyMat4(i)}static multiplyByScalar(t,i){return t.clone().multiplyByScalar(i)}static translate(t,i){return t.clone().translate(i)}static projectPoint(t,i){return t.projectPoint(i)}clone(){return new w(this.normal,this.d)}set(t,i){if(!t.getMagnitude())throw new Error(\"Normal length is zero. Cannot define direction\");return this.normal=t.clone().normalize(),this.d=i,this}setFromNormalAndPoint(t,i){if(!t.getMagnitude())throw new Error(\"Normal length is zero. Cannot define direction\");return this.normal.setFromVec3(t).normalize(),this.d=-i.dotProduct(t),this}setFromPoints(t,i,s){const r=z.subtract(i,t).crossProduct(z.subtract(s,t));if(!r.getMagnitude())throw new Error(\"Normal length is zero. Points are equal or collinear\");return this.setFromNormalAndPoint(r,t),this}applyMat4(t){const i=t.clone().invert().transpose(),s=this.point.applyMat4(t);return this.normal.applyMat4(i).normalize(),this.d=-s.dotProduct(this.normal),this}normalize(){const t=1/this.normal.getMagnitude();return this.multiplyByScalar(t)}multiplyByScalar(t){return this.normal.multiplyByScalar(t),this.d*=t,this}translate(t){return this.d-=t.dotProduct(this.normal),this}equals(t,i=6){return this.normal.equals(t.normal,i)&&+this.d.toFixed(i)==+t.d.toFixed(i)}getDistanceToPoint(t){return this.normal.dotProduct(t)+this.d}projectPoint(t){return z.multiplyByScalar(this.normal,-this.getDistanceToPoint(t)).add(t)}}class d{constructor(t,i){this.a=t.clone(),this.b=i.clone()}static fromLine(t){return new d(t.a,t.b)}static applyMat4(t,i){return new d(z.applyMat4(t.a,i),z.applyMat4(t.b,i))}static equals(t,i){return t.equals(i)}clone(){return new d(this.a,this.b)}set(t,i){return this.a=t.clone(),this.b=i.clone(),this}setFromLine(t){return this.a=t.a.clone(),this.b=t.b.clone(),this}getCenter(){return z.add(this.a,this.b).multiplyByScalar(.5)}getDelta(){return z.subtract(this.b,this.a)}getLength(){return a(this.a.x,this.a.y,this.a.z,this.b.x,this.b.y,this.b.z)}applyMat4(t){return this.a.applyMat4(t),this.b.applyMat4(t),this}equals(t,i=6){return!(!this.a.equals(t.a,i)||!this.b.equals(t.b,i))}}class M{constructor(t,i,s){this.a=t,this.b=i,this.c=s}static fromTriangle(t){return new M(t.a,t.b,t.c)}static equals(t,i,s=6){return t.equals(i,s)}clone(){return new M(this.a,this.b,this.c)}set(t,i,s){this.a=t,this.b=i,this.c=s}setFromTriangle(t){return this.a=t.a.clone(),this.b=t.b.clone(),this.c=t.c.clone(),this}getArea(){const t=this.b.clone().subtract(this.a),i=this.c.clone().subtract(this.a);return t.crossProduct(i).getMagnitude()/2}getCenter(){return this.a.clone().add(this.b).add(this.c).multiplyByScalar(1/3)}getNormal(){const t=this.b.clone().subtract(this.a),i=this.c.clone().subtract(this.a);return t.crossProduct(i).normalize()}getBary(t){const i=this.c.clone().subtract(this.a),s=this.b.clone().subtract(this.a),r=t.clone().subtract(this.a),e=i.dotProduct(i),h=i.dotProduct(s),a=i.dotProduct(r),n=s.dotProduct(s),x=s.dotProduct(r),o=e*n-h*h;if(!o)return null;const y=(e*x-h*a)/o,_=(n*a-h*x)/o;return new z(1-y-_,y,_)}getUV(t,i,s,r){const e=this.getBary(t);return(new u).add(i.clone().multiplyByScalar(e.x)).add(s.clone().multiplyByScalar(e.y)).add(r.clone().multiplyByScalar(e.z))}valid(t){return!!this.getBary(t)}contains(t){const i=this.getBary(t);return i.x>=0&&i.y>=0&&i.x+i.y<=1}equals(t,i=6){return!!(this.a.equals(t.a,i)&&this.b.equals(t.b,i)&&this.c.equals(t.c,i))}}class g{constructor(t=0,i=0,s=0,r=1){this.length=4,this.x=t,this.y=i,this.z=s,this.w=r}static fromVec3(t){return new g(t.x,t.y,t.z)}static multiplyByScalar(t,i){return new g(t.x*i,t.y*i,t.z*i,t.w*i)}static addScalar(t,i){return new g(t.x+i,t.y+i,t.z+i,t.w+i)}static normalize(t){return(new g).setFromVec4(t).normalize()}static add(t,i){return new g(t.x+i.x,t.y+i.y,t.z+i.z,t.w+i.w)}static subtract(t,i){return new g(t.x-i.x,t.y-i.y,t.z-i.z,t.w-i.w)}static dotProduct(t,i){return t.x*i.x+t.y*i.y+t.z*i.z+t.w*i.w}static applyMat4(t,i){return t.clone().applyMat4(i)}static lerp(t,i,s){return t.clone().lerp(i,s)}static equals(t,i,s=6){return!!t&&t.equals(i,s)}clone(){return new g(this.x,this.y,this.z,this.w)}set(t,i,s,r){return this.x=t,this.y=i,this.z=s,this.w=r,this}setFromVec3(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=1}setFromVec4(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}multiplyByScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}getMagnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}normalize(){const t=this.getMagnitude();return t&&(this.x/=t,this.y/=t,this.z/=t,this.w/=t),this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}subtract(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}dotProduct(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}applyMat4(t){if(16!==t.length)throw new Error(\"Matrix must contain 16 elements\");const{x:i,y:s,z:r,w:e}=this,[h,a,n,x,o,y,_,u,l,c,z,m,w,d,M,g]=t;return this.x=i*h+s*o+r*l+e*w,this.y=i*a+s*y+r*c+e*d,this.z=i*n+s*_+r*z+e*M,this.w=i*x+s*u+r*m+e*g,this}lerp(t,i){return this.x+=i*(t.x-this.x),this.y+=i*(t.y-this.y),this.z+=i*(t.z-this.z),this.w+=i*(t.w-this.w),this}truncate(t=5){return this.x=+this.x.toFixed(t),this.y=+this.y.toFixed(t),this.z=+this.z.toFixed(t),this.w=+this.w.toFixed(t),this}equals(t,i=6){return!!t&&(+this.x.toFixed(i)==+t.x.toFixed(i)&&+this.y.toFixed(i)==+t.y.toFixed(i)&&+this.z.toFixed(i)==+t.z.toFixed(i)&&+this.w.toFixed(i)==+t.w.toFixed(i))}toArray(){return[this.x,this.y,this.z,this.w]}toIntArray(){return new Int32Array(this)}toFloatArray(){return new Float32Array(this)}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/mathador/dist/index.esm.min.js?");

/***/ }),

/***/ "./src/UniversalUploaderInline.scss":
/*!******************************************!*\
  !*** ./src/UniversalUploaderInline.scss ***!
  \******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/UniversalUploaderInline.scss?");

/***/ }),

/***/ "./node_modules/pdfjs-dist/build/pdf.js":
/*!**********************************************!*\
  !*** ./node_modules/pdfjs-dist/build/pdf.js ***!
  \**********************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

eval("/**\n * @licstart The following is the entire license notice for the\n * Javascript code in this page\n *\n * Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @licend The above is the entire license notice for the\n * Javascript code in this page\n */\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})(this, function() {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \t\"use strict\";\n/******/ \tvar __webpack_modules__ = ([\n/* 0 */,\n/* 1 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;\nexports.arrayByteLength = arrayByteLength;\nexports.arraysToBytes = arraysToBytes;\nexports.assert = assert;\nexports.bytesToString = bytesToString;\nexports.createPromiseCapability = createPromiseCapability;\nexports.createValidAbsoluteUrl = createValidAbsoluteUrl;\nexports.escapeString = escapeString;\nexports.getModificationDate = getModificationDate;\nexports.getVerbosityLevel = getVerbosityLevel;\nexports.info = info;\nexports.isArrayBuffer = isArrayBuffer;\nexports.isArrayEqual = isArrayEqual;\nexports.isAscii = isAscii;\nexports.isSameOrigin = isSameOrigin;\nexports.objectFromMap = objectFromMap;\nexports.objectSize = objectSize;\nexports.setVerbosityLevel = setVerbosityLevel;\nexports.shadow = shadow;\nexports.string32 = string32;\nexports.stringToBytes = stringToBytes;\nexports.stringToPDFString = stringToPDFString;\nexports.stringToUTF16BEString = stringToUTF16BEString;\nexports.stringToUTF8String = stringToUTF8String;\nexports.unreachable = unreachable;\nexports.utf8StringToString = utf8StringToString;\nexports.warn = warn;\n\n__w_pdfjs_require__(2);\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nexports.IDENTITY_MATRIX = IDENTITY_MATRIX;\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\nexports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;\nconst RenderingIntentFlag = {\n  ANY: 0x01,\n  DISPLAY: 0x02,\n  PRINT: 0x04,\n  ANNOTATIONS_FORMS: 0x10,\n  ANNOTATIONS_STORAGE: 0x20,\n  ANNOTATIONS_DISABLE: 0x40,\n  OPLIST: 0x100\n};\nexports.RenderingIntentFlag = RenderingIntentFlag;\nconst AnnotationMode = {\n  DISABLE: 0,\n  ENABLE: 1,\n  ENABLE_FORMS: 2,\n  ENABLE_STORAGE: 3\n};\nexports.AnnotationMode = AnnotationMode;\nconst PermissionFlag = {\n  PRINT: 0x04,\n  MODIFY_CONTENTS: 0x08,\n  COPY: 0x10,\n  MODIFY_ANNOTATIONS: 0x20,\n  FILL_INTERACTIVE_FORMS: 0x100,\n  COPY_FOR_ACCESSIBILITY: 0x200,\n  ASSEMBLE: 0x400,\n  PRINT_HIGH_QUALITY: 0x800\n};\nexports.PermissionFlag = PermissionFlag;\nconst TextRenderingMode = {\n  FILL: 0,\n  STROKE: 1,\n  FILL_STROKE: 2,\n  INVISIBLE: 3,\n  FILL_ADD_TO_PATH: 4,\n  STROKE_ADD_TO_PATH: 5,\n  FILL_STROKE_ADD_TO_PATH: 6,\n  ADD_TO_PATH: 7,\n  FILL_STROKE_MASK: 3,\n  ADD_TO_PATH_FLAG: 4\n};\nexports.TextRenderingMode = TextRenderingMode;\nconst ImageKind = {\n  GRAYSCALE_1BPP: 1,\n  RGB_24BPP: 2,\n  RGBA_32BPP: 3\n};\nexports.ImageKind = ImageKind;\nconst AnnotationType = {\n  TEXT: 1,\n  LINK: 2,\n  FREETEXT: 3,\n  LINE: 4,\n  SQUARE: 5,\n  CIRCLE: 6,\n  POLYGON: 7,\n  POLYLINE: 8,\n  HIGHLIGHT: 9,\n  UNDERLINE: 10,\n  SQUIGGLY: 11,\n  STRIKEOUT: 12,\n  STAMP: 13,\n  CARET: 14,\n  INK: 15,\n  POPUP: 16,\n  FILEATTACHMENT: 17,\n  SOUND: 18,\n  MOVIE: 19,\n  WIDGET: 20,\n  SCREEN: 21,\n  PRINTERMARK: 22,\n  TRAPNET: 23,\n  WATERMARK: 24,\n  THREED: 25,\n  REDACT: 26\n};\nexports.AnnotationType = AnnotationType;\nconst AnnotationStateModelType = {\n  MARKED: \"Marked\",\n  REVIEW: \"Review\"\n};\nexports.AnnotationStateModelType = AnnotationStateModelType;\nconst AnnotationMarkedState = {\n  MARKED: \"Marked\",\n  UNMARKED: \"Unmarked\"\n};\nexports.AnnotationMarkedState = AnnotationMarkedState;\nconst AnnotationReviewState = {\n  ACCEPTED: \"Accepted\",\n  REJECTED: \"Rejected\",\n  CANCELLED: \"Cancelled\",\n  COMPLETED: \"Completed\",\n  NONE: \"None\"\n};\nexports.AnnotationReviewState = AnnotationReviewState;\nconst AnnotationReplyType = {\n  GROUP: \"Group\",\n  REPLY: \"R\"\n};\nexports.AnnotationReplyType = AnnotationReplyType;\nconst AnnotationFlag = {\n  INVISIBLE: 0x01,\n  HIDDEN: 0x02,\n  PRINT: 0x04,\n  NOZOOM: 0x08,\n  NOROTATE: 0x10,\n  NOVIEW: 0x20,\n  READONLY: 0x40,\n  LOCKED: 0x80,\n  TOGGLENOVIEW: 0x100,\n  LOCKEDCONTENTS: 0x200\n};\nexports.AnnotationFlag = AnnotationFlag;\nconst AnnotationFieldFlag = {\n  READONLY: 0x0000001,\n  REQUIRED: 0x0000002,\n  NOEXPORT: 0x0000004,\n  MULTILINE: 0x0001000,\n  PASSWORD: 0x0002000,\n  NOTOGGLETOOFF: 0x0004000,\n  RADIO: 0x0008000,\n  PUSHBUTTON: 0x0010000,\n  COMBO: 0x0020000,\n  EDIT: 0x0040000,\n  SORT: 0x0080000,\n  FILESELECT: 0x0100000,\n  MULTISELECT: 0x0200000,\n  DONOTSPELLCHECK: 0x0400000,\n  DONOTSCROLL: 0x0800000,\n  COMB: 0x1000000,\n  RICHTEXT: 0x2000000,\n  RADIOSINUNISON: 0x2000000,\n  COMMITONSELCHANGE: 0x4000000\n};\nexports.AnnotationFieldFlag = AnnotationFieldFlag;\nconst AnnotationBorderStyleType = {\n  SOLID: 1,\n  DASHED: 2,\n  BEVELED: 3,\n  INSET: 4,\n  UNDERLINE: 5\n};\nexports.AnnotationBorderStyleType = AnnotationBorderStyleType;\nconst AnnotationActionEventType = {\n  E: \"Mouse Enter\",\n  X: \"Mouse Exit\",\n  D: \"Mouse Down\",\n  U: \"Mouse Up\",\n  Fo: \"Focus\",\n  Bl: \"Blur\",\n  PO: \"PageOpen\",\n  PC: \"PageClose\",\n  PV: \"PageVisible\",\n  PI: \"PageInvisible\",\n  K: \"Keystroke\",\n  F: \"Format\",\n  V: \"Validate\",\n  C: \"Calculate\"\n};\nexports.AnnotationActionEventType = AnnotationActionEventType;\nconst DocumentActionEventType = {\n  WC: \"WillClose\",\n  WS: \"WillSave\",\n  DS: \"DidSave\",\n  WP: \"WillPrint\",\n  DP: \"DidPrint\"\n};\nexports.DocumentActionEventType = DocumentActionEventType;\nconst PageActionEventType = {\n  O: \"PageOpen\",\n  C: \"PageClose\"\n};\nexports.PageActionEventType = PageActionEventType;\nconst StreamType = {\n  UNKNOWN: \"UNKNOWN\",\n  FLATE: \"FLATE\",\n  LZW: \"LZW\",\n  DCT: \"DCT\",\n  JPX: \"JPX\",\n  JBIG: \"JBIG\",\n  A85: \"A85\",\n  AHX: \"AHX\",\n  CCF: \"CCF\",\n  RLX: \"RLX\"\n};\nexports.StreamType = StreamType;\nconst FontType = {\n  UNKNOWN: \"UNKNOWN\",\n  TYPE1: \"TYPE1\",\n  TYPE1STANDARD: \"TYPE1STANDARD\",\n  TYPE1C: \"TYPE1C\",\n  CIDFONTTYPE0: \"CIDFONTTYPE0\",\n  CIDFONTTYPE0C: \"CIDFONTTYPE0C\",\n  TRUETYPE: \"TRUETYPE\",\n  CIDFONTTYPE2: \"CIDFONTTYPE2\",\n  TYPE3: \"TYPE3\",\n  OPENTYPE: \"OPENTYPE\",\n  TYPE0: \"TYPE0\",\n  MMTYPE1: \"MMTYPE1\"\n};\nexports.FontType = FontType;\nconst VerbosityLevel = {\n  ERRORS: 0,\n  WARNINGS: 1,\n  INFOS: 5\n};\nexports.VerbosityLevel = VerbosityLevel;\nconst CMapCompressionType = {\n  NONE: 0,\n  BINARY: 1,\n  STREAM: 2\n};\nexports.CMapCompressionType = CMapCompressionType;\nconst OPS = {\n  dependency: 1,\n  setLineWidth: 2,\n  setLineCap: 3,\n  setLineJoin: 4,\n  setMiterLimit: 5,\n  setDash: 6,\n  setRenderingIntent: 7,\n  setFlatness: 8,\n  setGState: 9,\n  save: 10,\n  restore: 11,\n  transform: 12,\n  moveTo: 13,\n  lineTo: 14,\n  curveTo: 15,\n  curveTo2: 16,\n  curveTo3: 17,\n  closePath: 18,\n  rectangle: 19,\n  stroke: 20,\n  closeStroke: 21,\n  fill: 22,\n  eoFill: 23,\n  fillStroke: 24,\n  eoFillStroke: 25,\n  closeFillStroke: 26,\n  closeEOFillStroke: 27,\n  endPath: 28,\n  clip: 29,\n  eoClip: 30,\n  beginText: 31,\n  endText: 32,\n  setCharSpacing: 33,\n  setWordSpacing: 34,\n  setHScale: 35,\n  setLeading: 36,\n  setFont: 37,\n  setTextRenderingMode: 38,\n  setTextRise: 39,\n  moveText: 40,\n  setLeadingMoveText: 41,\n  setTextMatrix: 42,\n  nextLine: 43,\n  showText: 44,\n  showSpacedText: 45,\n  nextLineShowText: 46,\n  nextLineSetSpacingShowText: 47,\n  setCharWidth: 48,\n  setCharWidthAndBounds: 49,\n  setStrokeColorSpace: 50,\n  setFillColorSpace: 51,\n  setStrokeColor: 52,\n  setStrokeColorN: 53,\n  setFillColor: 54,\n  setFillColorN: 55,\n  setStrokeGray: 56,\n  setFillGray: 57,\n  setStrokeRGBColor: 58,\n  setFillRGBColor: 59,\n  setStrokeCMYKColor: 60,\n  setFillCMYKColor: 61,\n  shadingFill: 62,\n  beginInlineImage: 63,\n  beginImageData: 64,\n  endInlineImage: 65,\n  paintXObject: 66,\n  markPoint: 67,\n  markPointProps: 68,\n  beginMarkedContent: 69,\n  beginMarkedContentProps: 70,\n  endMarkedContent: 71,\n  beginCompat: 72,\n  endCompat: 73,\n  paintFormXObjectBegin: 74,\n  paintFormXObjectEnd: 75,\n  beginGroup: 76,\n  endGroup: 77,\n  beginAnnotations: 78,\n  endAnnotations: 79,\n  beginAnnotation: 80,\n  endAnnotation: 81,\n  paintJpegXObject: 82,\n  paintImageMaskXObject: 83,\n  paintImageMaskXObjectGroup: 84,\n  paintImageXObject: 85,\n  paintInlineImageXObject: 86,\n  paintInlineImageXObjectGroup: 87,\n  paintImageXObjectRepeat: 88,\n  paintImageMaskXObjectRepeat: 89,\n  paintSolidColorImageMask: 90,\n  constructPath: 91\n};\nexports.OPS = OPS;\nconst UNSUPPORTED_FEATURES = {\n  unknown: \"unknown\",\n  forms: \"forms\",\n  javaScript: \"javaScript\",\n  signatures: \"signatures\",\n  smask: \"smask\",\n  shadingPattern: \"shadingPattern\",\n  font: \"font\",\n  errorTilingPattern: \"errorTilingPattern\",\n  errorExtGState: \"errorExtGState\",\n  errorXObject: \"errorXObject\",\n  errorFontLoadType3: \"errorFontLoadType3\",\n  errorFontState: \"errorFontState\",\n  errorFontMissing: \"errorFontMissing\",\n  errorFontTranslate: \"errorFontTranslate\",\n  errorColorSpace: \"errorColorSpace\",\n  errorOperatorList: \"errorOperatorList\",\n  errorFontToUnicode: \"errorFontToUnicode\",\n  errorFontLoadNative: \"errorFontLoadNative\",\n  errorFontBuildPath: \"errorFontBuildPath\",\n  errorFontGetPath: \"errorFontGetPath\",\n  errorMarkedContent: \"errorMarkedContent\",\n  errorContentSubStream: \"errorContentSubStream\"\n};\nexports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;\nconst PasswordResponses = {\n  NEED_PASSWORD: 1,\n  INCORRECT_PASSWORD: 2\n};\nexports.PasswordResponses = PasswordResponses;\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n  if (Number.isInteger(level)) {\n    verbosity = level;\n  }\n}\n\nfunction getVerbosityLevel() {\n  return verbosity;\n}\n\nfunction info(msg) {\n  if (verbosity >= VerbosityLevel.INFOS) {\n    console.log(`Info: ${msg}`);\n  }\n}\n\nfunction warn(msg) {\n  if (verbosity >= VerbosityLevel.WARNINGS) {\n    console.log(`Warning: ${msg}`);\n  }\n}\n\nfunction unreachable(msg) {\n  throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n  if (!cond) {\n    unreachable(msg);\n  }\n}\n\nfunction isSameOrigin(baseUrl, otherUrl) {\n  let base;\n\n  try {\n    base = new URL(baseUrl);\n\n    if (!base.origin || base.origin === \"null\") {\n      return false;\n    }\n  } catch (e) {\n    return false;\n  }\n\n  const other = new URL(otherUrl, base);\n  return base.origin === other.origin;\n}\n\nfunction _isValidProtocol(url) {\n  if (!url) {\n    return false;\n  }\n\n  switch (url.protocol) {\n    case \"http:\":\n    case \"https:\":\n    case \"ftp:\":\n    case \"mailto:\":\n    case \"tel:\":\n      return true;\n\n    default:\n      return false;\n  }\n}\n\nfunction createValidAbsoluteUrl(url, baseUrl = null, options = null) {\n  if (!url) {\n    return null;\n  }\n\n  try {\n    if (options && typeof url === \"string\") {\n      if (options.addDefaultProtocol && url.startsWith(\"www.\")) {\n        const dots = url.match(/\\./g);\n\n        if (dots && dots.length >= 2) {\n          url = `http://${url}`;\n        }\n      }\n\n      if (options.tryConvertEncoding) {\n        try {\n          url = stringToUTF8String(url);\n        } catch (ex) {}\n      }\n    }\n\n    const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n\n    if (_isValidProtocol(absoluteUrl)) {\n      return absoluteUrl;\n    }\n  } catch (ex) {}\n\n  return null;\n}\n\nfunction shadow(obj, prop, value) {\n  Object.defineProperty(obj, prop, {\n    value,\n    enumerable: true,\n    configurable: true,\n    writable: false\n  });\n  return value;\n}\n\nconst BaseException = function BaseExceptionClosure() {\n  function BaseException(message, name) {\n    if (this.constructor === BaseException) {\n      unreachable(\"Cannot initialize BaseException.\");\n    }\n\n    this.message = message;\n    this.name = name;\n  }\n\n  BaseException.prototype = new Error();\n  BaseException.constructor = BaseException;\n  return BaseException;\n}();\n\nexports.BaseException = BaseException;\n\nclass PasswordException extends BaseException {\n  constructor(msg, code) {\n    super(msg, \"PasswordException\");\n    this.code = code;\n  }\n\n}\n\nexports.PasswordException = PasswordException;\n\nclass UnknownErrorException extends BaseException {\n  constructor(msg, details) {\n    super(msg, \"UnknownErrorException\");\n    this.details = details;\n  }\n\n}\n\nexports.UnknownErrorException = UnknownErrorException;\n\nclass InvalidPDFException extends BaseException {\n  constructor(msg) {\n    super(msg, \"InvalidPDFException\");\n  }\n\n}\n\nexports.InvalidPDFException = InvalidPDFException;\n\nclass MissingPDFException extends BaseException {\n  constructor(msg) {\n    super(msg, \"MissingPDFException\");\n  }\n\n}\n\nexports.MissingPDFException = MissingPDFException;\n\nclass UnexpectedResponseException extends BaseException {\n  constructor(msg, status) {\n    super(msg, \"UnexpectedResponseException\");\n    this.status = status;\n  }\n\n}\n\nexports.UnexpectedResponseException = UnexpectedResponseException;\n\nclass FormatError extends BaseException {\n  constructor(msg) {\n    super(msg, \"FormatError\");\n  }\n\n}\n\nexports.FormatError = FormatError;\n\nclass AbortException extends BaseException {\n  constructor(msg) {\n    super(msg, \"AbortException\");\n  }\n\n}\n\nexports.AbortException = AbortException;\n\nfunction bytesToString(bytes) {\n  if (typeof bytes !== \"object\" || bytes === null || bytes.length === undefined) {\n    unreachable(\"Invalid argument for bytesToString\");\n  }\n\n  const length = bytes.length;\n  const MAX_ARGUMENT_COUNT = 8192;\n\n  if (length < MAX_ARGUMENT_COUNT) {\n    return String.fromCharCode.apply(null, bytes);\n  }\n\n  const strBuf = [];\n\n  for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n    const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n    const chunk = bytes.subarray(i, chunkEnd);\n    strBuf.push(String.fromCharCode.apply(null, chunk));\n  }\n\n  return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n  if (typeof str !== \"string\") {\n    unreachable(\"Invalid argument for stringToBytes\");\n  }\n\n  const length = str.length;\n  const bytes = new Uint8Array(length);\n\n  for (let i = 0; i < length; ++i) {\n    bytes[i] = str.charCodeAt(i) & 0xff;\n  }\n\n  return bytes;\n}\n\nfunction arrayByteLength(arr) {\n  if (arr.length !== undefined) {\n    return arr.length;\n  }\n\n  if (arr.byteLength !== undefined) {\n    return arr.byteLength;\n  }\n\n  unreachable(\"Invalid argument for arrayByteLength\");\n}\n\nfunction arraysToBytes(arr) {\n  const length = arr.length;\n\n  if (length === 1 && arr[0] instanceof Uint8Array) {\n    return arr[0];\n  }\n\n  let resultLength = 0;\n\n  for (let i = 0; i < length; i++) {\n    resultLength += arrayByteLength(arr[i]);\n  }\n\n  let pos = 0;\n  const data = new Uint8Array(resultLength);\n\n  for (let i = 0; i < length; i++) {\n    let item = arr[i];\n\n    if (!(item instanceof Uint8Array)) {\n      if (typeof item === \"string\") {\n        item = stringToBytes(item);\n      } else {\n        item = new Uint8Array(item);\n      }\n    }\n\n    const itemLength = item.byteLength;\n    data.set(item, pos);\n    pos += itemLength;\n  }\n\n  return data;\n}\n\nfunction string32(value) {\n  return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);\n}\n\nfunction objectSize(obj) {\n  return Object.keys(obj).length;\n}\n\nfunction objectFromMap(map) {\n  const obj = Object.create(null);\n\n  for (const [key, value] of map) {\n    obj[key] = value;\n  }\n\n  return obj;\n}\n\nfunction isLittleEndian() {\n  const buffer8 = new Uint8Array(4);\n  buffer8[0] = 1;\n  const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n  return view32[0] === 1;\n}\n\nconst IsLittleEndianCached = {\n  get value() {\n    return shadow(this, \"value\", isLittleEndian());\n  }\n\n};\nexports.IsLittleEndianCached = IsLittleEndianCached;\n\nfunction isEvalSupported() {\n  try {\n    new Function(\"\");\n    return true;\n  } catch (e) {\n    return false;\n  }\n}\n\nconst IsEvalSupportedCached = {\n  get value() {\n    return shadow(this, \"value\", isEvalSupported());\n  }\n\n};\nexports.IsEvalSupportedCached = IsEvalSupportedCached;\nconst hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, \"0\"));\n\nclass Util {\n  static makeHexColor(r, g, b) {\n    return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;\n  }\n\n  static transform(m1, m2) {\n    return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];\n  }\n\n  static applyTransform(p, m) {\n    const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n    const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n    return [xt, yt];\n  }\n\n  static applyInverseTransform(p, m) {\n    const d = m[0] * m[3] - m[1] * m[2];\n    const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n    const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n    return [xt, yt];\n  }\n\n  static getAxialAlignedBoundingBox(r, m) {\n    const p1 = Util.applyTransform(r, m);\n    const p2 = Util.applyTransform(r.slice(2, 4), m);\n    const p3 = Util.applyTransform([r[0], r[3]], m);\n    const p4 = Util.applyTransform([r[2], r[1]], m);\n    return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];\n  }\n\n  static inverseTransform(m) {\n    const d = m[0] * m[3] - m[1] * m[2];\n    return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];\n  }\n\n  static apply3dTransform(m, v) {\n    return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];\n  }\n\n  static singularValueDecompose2dScale(m) {\n    const transpose = [m[0], m[2], m[1], m[3]];\n    const a = m[0] * transpose[0] + m[1] * transpose[2];\n    const b = m[0] * transpose[1] + m[1] * transpose[3];\n    const c = m[2] * transpose[0] + m[3] * transpose[2];\n    const d = m[2] * transpose[1] + m[3] * transpose[3];\n    const first = (a + d) / 2;\n    const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;\n    const sx = first + second || 1;\n    const sy = first - second || 1;\n    return [Math.sqrt(sx), Math.sqrt(sy)];\n  }\n\n  static normalizeRect(rect) {\n    const r = rect.slice(0);\n\n    if (rect[0] > rect[2]) {\n      r[0] = rect[2];\n      r[2] = rect[0];\n    }\n\n    if (rect[1] > rect[3]) {\n      r[1] = rect[3];\n      r[3] = rect[1];\n    }\n\n    return r;\n  }\n\n  static intersect(rect1, rect2) {\n    function compare(a, b) {\n      return a - b;\n    }\n\n    const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);\n    const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);\n    const result = [];\n    rect1 = Util.normalizeRect(rect1);\n    rect2 = Util.normalizeRect(rect2);\n\n    if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {\n      result[0] = orderedX[1];\n      result[2] = orderedX[2];\n    } else {\n      return null;\n    }\n\n    if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {\n      result[1] = orderedY[1];\n      result[3] = orderedY[2];\n    } else {\n      return null;\n    }\n\n    return result;\n  }\n\n  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {\n    const tvalues = [],\n          bounds = [[], []];\n    let a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n\n    for (let i = 0; i < 2; ++i) {\n      if (i === 0) {\n        b = 6 * x0 - 12 * x1 + 6 * x2;\n        a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n        c = 3 * x1 - 3 * x0;\n      } else {\n        b = 6 * y0 - 12 * y1 + 6 * y2;\n        a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n        c = 3 * y1 - 3 * y0;\n      }\n\n      if (Math.abs(a) < 1e-12) {\n        if (Math.abs(b) < 1e-12) {\n          continue;\n        }\n\n        t = -c / b;\n\n        if (0 < t && t < 1) {\n          tvalues.push(t);\n        }\n\n        continue;\n      }\n\n      b2ac = b * b - 4 * c * a;\n      sqrtb2ac = Math.sqrt(b2ac);\n\n      if (b2ac < 0) {\n        continue;\n      }\n\n      t1 = (-b + sqrtb2ac) / (2 * a);\n\n      if (0 < t1 && t1 < 1) {\n        tvalues.push(t1);\n      }\n\n      t2 = (-b - sqrtb2ac) / (2 * a);\n\n      if (0 < t2 && t2 < 1) {\n        tvalues.push(t2);\n      }\n    }\n\n    let j = tvalues.length,\n        mt;\n    const jlen = j;\n\n    while (j--) {\n      t = tvalues[j];\n      mt = 1 - t;\n      bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;\n      bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;\n    }\n\n    bounds[0][jlen] = x0;\n    bounds[1][jlen] = y0;\n    bounds[0][jlen + 1] = x3;\n    bounds[1][jlen + 1] = y3;\n    bounds[0].length = bounds[1].length = jlen + 2;\n    return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];\n  }\n\n}\n\nexports.Util = Util;\nconst PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];\n\nfunction stringToPDFString(str) {\n  if (str[0] >= \"\\xEF\") {\n    let encoding;\n\n    if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n      encoding = \"utf-16be\";\n    } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n      encoding = \"utf-16le\";\n    } else if (str[0] === \"\\xEF\" && str[1] === \"\\xBB\" && str[2] === \"\\xBF\") {\n      encoding = \"utf-8\";\n    }\n\n    if (encoding) {\n      try {\n        const decoder = new TextDecoder(encoding, {\n          fatal: true\n        });\n        const buffer = stringToBytes(str);\n        return decoder.decode(buffer);\n      } catch (ex) {\n        warn(`stringToPDFString: \"${ex}\".`);\n      }\n    }\n  }\n\n  const strBuf = [];\n\n  for (let i = 0, ii = str.length; i < ii; i++) {\n    const code = PDFStringTranslateTable[str.charCodeAt(i)];\n    strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n  }\n\n  return strBuf.join(\"\");\n}\n\nfunction escapeString(str) {\n  return str.replace(/([()\\\\\\n\\r])/g, match => {\n    if (match === \"\\n\") {\n      return \"\\\\n\";\n    } else if (match === \"\\r\") {\n      return \"\\\\r\";\n    }\n\n    return `\\\\${match}`;\n  });\n}\n\nfunction isAscii(str) {\n  return /^[\\x00-\\x7F]*$/.test(str);\n}\n\nfunction stringToUTF16BEString(str) {\n  const buf = [\"\\xFE\\xFF\"];\n\n  for (let i = 0, ii = str.length; i < ii; i++) {\n    const char = str.charCodeAt(i);\n    buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));\n  }\n\n  return buf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n  return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n  return unescape(encodeURIComponent(str));\n}\n\nfunction isArrayBuffer(v) {\n  return typeof v === \"object\" && v !== null && v.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n  if (arr1.length !== arr2.length) {\n    return false;\n  }\n\n  for (let i = 0, ii = arr1.length; i < ii; i++) {\n    if (arr1[i] !== arr2[i]) {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nfunction getModificationDate(date = new Date()) {\n  const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, \"0\"), date.getUTCDate().toString().padStart(2, \"0\"), date.getUTCHours().toString().padStart(2, \"0\"), date.getUTCMinutes().toString().padStart(2, \"0\"), date.getUTCSeconds().toString().padStart(2, \"0\")];\n  return buffer.join(\"\");\n}\n\nfunction createPromiseCapability() {\n  const capability = Object.create(null);\n  let isSettled = false;\n  Object.defineProperty(capability, \"settled\", {\n    get() {\n      return isSettled;\n    }\n\n  });\n  capability.promise = new Promise(function (resolve, reject) {\n    capability.resolve = function (data) {\n      isSettled = true;\n      resolve(data);\n    };\n\n    capability.reject = function (reason) {\n      isSettled = true;\n      reject(reason);\n    };\n  });\n  return capability;\n}\n\n/***/ }),\n/* 2 */\n/***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {\n\n\n\nvar _is_node = __w_pdfjs_require__(3);\n\n;\n\n/***/ }),\n/* 3 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.isNodeJS = void 0;\nconst isNodeJS = typeof process === \"object\" && process + \"\" === \"[object process]\" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== \"browser\");\nexports.isNodeJS = isNodeJS;\n\n/***/ }),\n/* 4 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.build = exports.RenderTask = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0;\nexports.getDocument = getDocument;\nexports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory;\nexports.version = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nvar _font_loader = __w_pdfjs_require__(7);\n\nvar _node_utils = __w_pdfjs_require__(8);\n\nvar _annotation_storage = __w_pdfjs_require__(9);\n\nvar _canvas = __w_pdfjs_require__(10);\n\nvar _worker_options = __w_pdfjs_require__(12);\n\nvar _is_node = __w_pdfjs_require__(3);\n\nvar _message_handler = __w_pdfjs_require__(13);\n\nvar _metadata = __w_pdfjs_require__(14);\n\nvar _optional_content_config = __w_pdfjs_require__(15);\n\nvar _transport_stream = __w_pdfjs_require__(16);\n\nvar _xfa_text = __w_pdfjs_require__(17);\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536;\nconst RENDERING_CANCELLED_TIMEOUT = 100;\nconst DefaultCanvasFactory = _is_node.isNodeJS ? _node_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory;\nexports.DefaultCanvasFactory = DefaultCanvasFactory;\nconst DefaultCMapReaderFactory = _is_node.isNodeJS ? _node_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory;\nexports.DefaultCMapReaderFactory = DefaultCMapReaderFactory;\nconst DefaultStandardFontDataFactory = _is_node.isNodeJS ? _node_utils.NodeStandardFontDataFactory : _display_utils.DOMStandardFontDataFactory;\nexports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory;\nlet createPDFNetworkStream;\n\nfunction setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {\n  createPDFNetworkStream = pdfNetworkStreamFactory;\n}\n\nfunction getDocument(src) {\n  const task = new PDFDocumentLoadingTask();\n  let source;\n\n  if (typeof src === \"string\" || src instanceof URL) {\n    source = {\n      url: src\n    };\n  } else if ((0, _util.isArrayBuffer)(src)) {\n    source = {\n      data: src\n    };\n  } else if (src instanceof PDFDataRangeTransport) {\n    source = {\n      range: src\n    };\n  } else {\n    if (typeof src !== \"object\") {\n      throw new Error(\"Invalid parameter in getDocument, \" + \"need either string, URL, Uint8Array, or parameter object.\");\n    }\n\n    if (!src.url && !src.data && !src.range) {\n      throw new Error(\"Invalid parameter object: need either .data, .range or .url\");\n    }\n\n    source = src;\n  }\n\n  const params = Object.create(null);\n  let rangeTransport = null,\n      worker = null;\n\n  for (const key in source) {\n    const value = source[key];\n\n    switch (key) {\n      case \"url\":\n        if (typeof window !== \"undefined\") {\n          try {\n            params[key] = new URL(value, window.location).href;\n            continue;\n          } catch (ex) {\n            (0, _util.warn)(`Cannot create valid URL: \"${ex}\".`);\n          }\n        } else if (typeof value === \"string\" || value instanceof URL) {\n          params[key] = value.toString();\n          continue;\n        }\n\n        throw new Error(\"Invalid PDF url data: \" + \"either string or URL-object is expected in the url property.\");\n\n      case \"range\":\n        rangeTransport = value;\n        continue;\n\n      case \"worker\":\n        worker = value;\n        continue;\n\n      case \"data\":\n        if (_is_node.isNodeJS && typeof Buffer !== \"undefined\" && value instanceof Buffer) {\n          params[key] = new Uint8Array(value);\n        } else if (value instanceof Uint8Array) {\n          break;\n        } else if (typeof value === \"string\") {\n          params[key] = (0, _util.stringToBytes)(value);\n        } else if (typeof value === \"object\" && value !== null && !isNaN(value.length)) {\n          params[key] = new Uint8Array(value);\n        } else if ((0, _util.isArrayBuffer)(value)) {\n          params[key] = new Uint8Array(value);\n        } else {\n          throw new Error(\"Invalid PDF binary data: either typed array, \" + \"string, or array-like object is expected in the data property.\");\n        }\n\n        continue;\n    }\n\n    params[key] = value;\n  }\n\n  params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;\n  params.CMapReaderFactory = params.CMapReaderFactory || DefaultCMapReaderFactory;\n  params.StandardFontDataFactory = params.StandardFontDataFactory || DefaultStandardFontDataFactory;\n  params.ignoreErrors = params.stopAtErrors !== true;\n  params.fontExtraProperties = params.fontExtraProperties === true;\n  params.pdfBug = params.pdfBug === true;\n  params.enableXfa = params.enableXfa === true;\n\n  if (typeof params.docBaseUrl !== \"string\" || (0, _display_utils.isDataScheme)(params.docBaseUrl)) {\n    params.docBaseUrl = null;\n  }\n\n  if (!Number.isInteger(params.maxImageSize)) {\n    params.maxImageSize = -1;\n  }\n\n  if (typeof params.useWorkerFetch !== \"boolean\") {\n    params.useWorkerFetch = params.CMapReaderFactory === _display_utils.DOMCMapReaderFactory && params.StandardFontDataFactory === _display_utils.DOMStandardFontDataFactory;\n  }\n\n  if (typeof params.isEvalSupported !== \"boolean\") {\n    params.isEvalSupported = true;\n  }\n\n  if (typeof params.disableFontFace !== \"boolean\") {\n    params.disableFontFace = _is_node.isNodeJS;\n  }\n\n  if (typeof params.useSystemFonts !== \"boolean\") {\n    params.useSystemFonts = !_is_node.isNodeJS && !params.disableFontFace;\n  }\n\n  if (typeof params.ownerDocument === \"undefined\") {\n    params.ownerDocument = globalThis.document;\n  }\n\n  if (typeof params.disableRange !== \"boolean\") {\n    params.disableRange = false;\n  }\n\n  if (typeof params.disableStream !== \"boolean\") {\n    params.disableStream = false;\n  }\n\n  if (typeof params.disableAutoFetch !== \"boolean\") {\n    params.disableAutoFetch = false;\n  }\n\n  (0, _util.setVerbosityLevel)(params.verbosity);\n\n  if (!worker) {\n    const workerParams = {\n      verbosity: params.verbosity,\n      port: _worker_options.GlobalWorkerOptions.workerPort\n    };\n    worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);\n    task._worker = worker;\n  }\n\n  const docId = task.docId;\n  worker.promise.then(function () {\n    if (task.destroyed) {\n      throw new Error(\"Loading aborted\");\n    }\n\n    const workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId);\n\n    const networkStreamPromise = new Promise(function (resolve) {\n      let networkStream;\n\n      if (rangeTransport) {\n        networkStream = new _transport_stream.PDFDataTransportStream({\n          length: params.length,\n          initialData: params.initialData,\n          progressiveDone: params.progressiveDone,\n          contentDispositionFilename: params.contentDispositionFilename,\n          disableRange: params.disableRange,\n          disableStream: params.disableStream\n        }, rangeTransport);\n      } else if (!params.data) {\n        networkStream = createPDFNetworkStream({\n          url: params.url,\n          length: params.length,\n          httpHeaders: params.httpHeaders,\n          withCredentials: params.withCredentials,\n          rangeChunkSize: params.rangeChunkSize,\n          disableRange: params.disableRange,\n          disableStream: params.disableStream\n        });\n      }\n\n      resolve(networkStream);\n    });\n    return Promise.all([workerIdPromise, networkStreamPromise]).then(function ([workerId, networkStream]) {\n      if (task.destroyed) {\n        throw new Error(\"Loading aborted\");\n      }\n\n      const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);\n      const transport = new WorkerTransport(messageHandler, task, networkStream, params);\n      task._transport = transport;\n      messageHandler.send(\"Ready\", null);\n    });\n  }).catch(task._capability.reject);\n  return task;\n}\n\nasync function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {\n  if (worker.destroyed) {\n    throw new Error(\"Worker was destroyed\");\n  }\n\n  if (pdfDataRangeTransport) {\n    source.length = pdfDataRangeTransport.length;\n    source.initialData = pdfDataRangeTransport.initialData;\n    source.progressiveDone = pdfDataRangeTransport.progressiveDone;\n    source.contentDispositionFilename = pdfDataRangeTransport.contentDispositionFilename;\n  }\n\n  const workerId = await worker.messageHandler.sendWithPromise(\"GetDocRequest\", {\n    docId,\n    apiVersion: '2.13.216',\n    source: {\n      data: source.data,\n      url: source.url,\n      password: source.password,\n      disableAutoFetch: source.disableAutoFetch,\n      rangeChunkSize: source.rangeChunkSize,\n      length: source.length\n    },\n    maxImageSize: source.maxImageSize,\n    disableFontFace: source.disableFontFace,\n    docBaseUrl: source.docBaseUrl,\n    ignoreErrors: source.ignoreErrors,\n    isEvalSupported: source.isEvalSupported,\n    fontExtraProperties: source.fontExtraProperties,\n    enableXfa: source.enableXfa,\n    useSystemFonts: source.useSystemFonts,\n    cMapUrl: source.useWorkerFetch ? source.cMapUrl : null,\n    standardFontDataUrl: source.useWorkerFetch ? source.standardFontDataUrl : null\n  });\n\n  if (worker.destroyed) {\n    throw new Error(\"Worker was destroyed\");\n  }\n\n  return workerId;\n}\n\nclass PDFDocumentLoadingTask {\n  static get idCounters() {\n    return (0, _util.shadow)(this, \"idCounters\", {\n      doc: 0\n    });\n  }\n\n  constructor() {\n    this._capability = (0, _util.createPromiseCapability)();\n    this._transport = null;\n    this._worker = null;\n    this.docId = `d${PDFDocumentLoadingTask.idCounters.doc++}`;\n    this.destroyed = false;\n    this.onPassword = null;\n    this.onProgress = null;\n    this.onUnsupportedFeature = null;\n  }\n\n  get promise() {\n    return this._capability.promise;\n  }\n\n  async destroy() {\n    this.destroyed = true;\n    await this._transport?.destroy();\n    this._transport = null;\n\n    if (this._worker) {\n      this._worker.destroy();\n\n      this._worker = null;\n    }\n  }\n\n}\n\nexports.PDFDocumentLoadingTask = PDFDocumentLoadingTask;\n\nclass PDFDataRangeTransport {\n  constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) {\n    this.length = length;\n    this.initialData = initialData;\n    this.progressiveDone = progressiveDone;\n    this.contentDispositionFilename = contentDispositionFilename;\n    this._rangeListeners = [];\n    this._progressListeners = [];\n    this._progressiveReadListeners = [];\n    this._progressiveDoneListeners = [];\n    this._readyCapability = (0, _util.createPromiseCapability)();\n  }\n\n  addRangeListener(listener) {\n    this._rangeListeners.push(listener);\n  }\n\n  addProgressListener(listener) {\n    this._progressListeners.push(listener);\n  }\n\n  addProgressiveReadListener(listener) {\n    this._progressiveReadListeners.push(listener);\n  }\n\n  addProgressiveDoneListener(listener) {\n    this._progressiveDoneListeners.push(listener);\n  }\n\n  onDataRange(begin, chunk) {\n    for (const listener of this._rangeListeners) {\n      listener(begin, chunk);\n    }\n  }\n\n  onDataProgress(loaded, total) {\n    this._readyCapability.promise.then(() => {\n      for (const listener of this._progressListeners) {\n        listener(loaded, total);\n      }\n    });\n  }\n\n  onDataProgressiveRead(chunk) {\n    this._readyCapability.promise.then(() => {\n      for (const listener of this._progressiveReadListeners) {\n        listener(chunk);\n      }\n    });\n  }\n\n  onDataProgressiveDone() {\n    this._readyCapability.promise.then(() => {\n      for (const listener of this._progressiveDoneListeners) {\n        listener();\n      }\n    });\n  }\n\n  transportReady() {\n    this._readyCapability.resolve();\n  }\n\n  requestDataRange(begin, end) {\n    (0, _util.unreachable)(\"Abstract method PDFDataRangeTransport.requestDataRange\");\n  }\n\n  abort() {}\n\n}\n\nexports.PDFDataRangeTransport = PDFDataRangeTransport;\n\nclass PDFDocumentProxy {\n  constructor(pdfInfo, transport) {\n    this._pdfInfo = pdfInfo;\n    this._transport = transport;\n    Object.defineProperty(this, \"fingerprint\", {\n      get() {\n        (0, _display_utils.deprecated)(\"`PDFDocumentProxy.fingerprint`, \" + \"please use `PDFDocumentProxy.fingerprints` instead.\");\n        return this.fingerprints[0];\n      }\n\n    });\n    Object.defineProperty(this, \"getStats\", {\n      value: async () => {\n        (0, _display_utils.deprecated)(\"`PDFDocumentProxy.getStats`, \" + \"please use the `PDFDocumentProxy.stats`-getter instead.\");\n        return this.stats || {\n          streamTypes: {},\n          fontTypes: {}\n        };\n      }\n    });\n  }\n\n  get annotationStorage() {\n    return this._transport.annotationStorage;\n  }\n\n  get numPages() {\n    return this._pdfInfo.numPages;\n  }\n\n  get fingerprints() {\n    return this._pdfInfo.fingerprints;\n  }\n\n  get stats() {\n    return this._transport.stats;\n  }\n\n  get isPureXfa() {\n    return !!this._transport._htmlForXfa;\n  }\n\n  get allXfaHtml() {\n    return this._transport._htmlForXfa;\n  }\n\n  getPage(pageNumber) {\n    return this._transport.getPage(pageNumber);\n  }\n\n  getPageIndex(ref) {\n    return this._transport.getPageIndex(ref);\n  }\n\n  getDestinations() {\n    return this._transport.getDestinations();\n  }\n\n  getDestination(id) {\n    return this._transport.getDestination(id);\n  }\n\n  getPageLabels() {\n    return this._transport.getPageLabels();\n  }\n\n  getPageLayout() {\n    return this._transport.getPageLayout();\n  }\n\n  getPageMode() {\n    return this._transport.getPageMode();\n  }\n\n  getViewerPreferences() {\n    return this._transport.getViewerPreferences();\n  }\n\n  getOpenAction() {\n    return this._transport.getOpenAction();\n  }\n\n  getAttachments() {\n    return this._transport.getAttachments();\n  }\n\n  getJavaScript() {\n    return this._transport.getJavaScript();\n  }\n\n  getJSActions() {\n    return this._transport.getDocJSActions();\n  }\n\n  getOutline() {\n    return this._transport.getOutline();\n  }\n\n  getOptionalContentConfig() {\n    return this._transport.getOptionalContentConfig();\n  }\n\n  getPermissions() {\n    return this._transport.getPermissions();\n  }\n\n  getMetadata() {\n    return this._transport.getMetadata();\n  }\n\n  getMarkInfo() {\n    return this._transport.getMarkInfo();\n  }\n\n  getData() {\n    return this._transport.getData();\n  }\n\n  getDownloadInfo() {\n    return this._transport.downloadInfoCapability.promise;\n  }\n\n  cleanup(keepLoadedFonts = false) {\n    return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);\n  }\n\n  destroy() {\n    return this.loadingTask.destroy();\n  }\n\n  get loadingParams() {\n    return this._transport.loadingParams;\n  }\n\n  get loadingTask() {\n    return this._transport.loadingTask;\n  }\n\n  saveDocument() {\n    if (this._transport.annotationStorage.size <= 0) {\n      (0, _display_utils.deprecated)(\"saveDocument called while `annotationStorage` is empty, \" + \"please use the getData-method instead.\");\n    }\n\n    return this._transport.saveDocument();\n  }\n\n  getFieldObjects() {\n    return this._transport.getFieldObjects();\n  }\n\n  hasJSActions() {\n    return this._transport.hasJSActions();\n  }\n\n  getCalculationOrderIds() {\n    return this._transport.getCalculationOrderIds();\n  }\n\n}\n\nexports.PDFDocumentProxy = PDFDocumentProxy;\n\nclass PDFPageProxy {\n  constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) {\n    this._pageIndex = pageIndex;\n    this._pageInfo = pageInfo;\n    this._ownerDocument = ownerDocument;\n    this._transport = transport;\n    this._stats = pdfBug ? new _display_utils.StatTimer() : null;\n    this._pdfBug = pdfBug;\n    this.commonObjs = transport.commonObjs;\n    this.objs = new PDFObjects();\n    this.cleanupAfterRender = false;\n    this.pendingCleanup = false;\n    this._intentStates = new Map();\n    this._annotationPromises = new Map();\n    this.destroyed = false;\n  }\n\n  get pageNumber() {\n    return this._pageIndex + 1;\n  }\n\n  get rotate() {\n    return this._pageInfo.rotate;\n  }\n\n  get ref() {\n    return this._pageInfo.ref;\n  }\n\n  get userUnit() {\n    return this._pageInfo.userUnit;\n  }\n\n  get view() {\n    return this._pageInfo.view;\n  }\n\n  getViewport({\n    scale,\n    rotation = this.rotate,\n    offsetX = 0,\n    offsetY = 0,\n    dontFlip = false\n  } = {}) {\n    return new _display_utils.PageViewport({\n      viewBox: this.view,\n      scale,\n      rotation,\n      offsetX,\n      offsetY,\n      dontFlip\n    });\n  }\n\n  getAnnotations({\n    intent = \"display\"\n  } = {}) {\n    const intentArgs = this._transport.getRenderingIntent(intent);\n\n    let promise = this._annotationPromises.get(intentArgs.cacheKey);\n\n    if (!promise) {\n      promise = this._transport.getAnnotations(this._pageIndex, intentArgs.renderingIntent);\n\n      this._annotationPromises.set(intentArgs.cacheKey, promise);\n\n      promise = promise.then(annotations => {\n        for (const annotation of annotations) {\n          if (annotation.titleObj !== undefined) {\n            Object.defineProperty(annotation, \"title\", {\n              get() {\n                (0, _display_utils.deprecated)(\"`title`-property on annotation, please use `titleObj` instead.\");\n                return annotation.titleObj.str;\n              }\n\n            });\n          }\n\n          if (annotation.contentsObj !== undefined) {\n            Object.defineProperty(annotation, \"contents\", {\n              get() {\n                (0, _display_utils.deprecated)(\"`contents`-property on annotation, please use `contentsObj` instead.\");\n                return annotation.contentsObj.str;\n              }\n\n            });\n          }\n        }\n\n        return annotations;\n      });\n    }\n\n    return promise;\n  }\n\n  getJSActions() {\n    return this._jsActionsPromise ||= this._transport.getPageJSActions(this._pageIndex);\n  }\n\n  async getXfa() {\n    return this._transport._htmlForXfa?.children[this._pageIndex] || null;\n  }\n\n  render({\n    canvasContext,\n    viewport,\n    intent = \"display\",\n    annotationMode = _util.AnnotationMode.ENABLE,\n    transform = null,\n    imageLayer = null,\n    canvasFactory = null,\n    background = null,\n    optionalContentConfigPromise = null,\n    annotationCanvasMap = null\n  }) {\n    if (arguments[0]?.renderInteractiveForms !== undefined) {\n      (0, _display_utils.deprecated)(\"render no longer accepts the `renderInteractiveForms`-option, \" + \"please use the `annotationMode`-option instead.\");\n\n      if (arguments[0].renderInteractiveForms === true && annotationMode === _util.AnnotationMode.ENABLE) {\n        annotationMode = _util.AnnotationMode.ENABLE_FORMS;\n      }\n    }\n\n    if (arguments[0]?.includeAnnotationStorage !== undefined) {\n      (0, _display_utils.deprecated)(\"render no longer accepts the `includeAnnotationStorage`-option, \" + \"please use the `annotationMode`-option instead.\");\n\n      if (arguments[0].includeAnnotationStorage === true && annotationMode === _util.AnnotationMode.ENABLE) {\n        annotationMode = _util.AnnotationMode.ENABLE_STORAGE;\n      }\n    }\n\n    if (this._stats) {\n      this._stats.time(\"Overall\");\n    }\n\n    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode);\n\n    this.pendingCleanup = false;\n\n    if (!optionalContentConfigPromise) {\n      optionalContentConfigPromise = this._transport.getOptionalContentConfig();\n    }\n\n    let intentState = this._intentStates.get(intentArgs.cacheKey);\n\n    if (!intentState) {\n      intentState = Object.create(null);\n\n      this._intentStates.set(intentArgs.cacheKey, intentState);\n    }\n\n    if (intentState.streamReaderCancelTimeout) {\n      clearTimeout(intentState.streamReaderCancelTimeout);\n      intentState.streamReaderCancelTimeout = null;\n    }\n\n    const canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory({\n      ownerDocument: this._ownerDocument\n    });\n    const intentPrint = !!(intentArgs.renderingIntent & _util.RenderingIntentFlag.PRINT);\n\n    if (!intentState.displayReadyCapability) {\n      intentState.displayReadyCapability = (0, _util.createPromiseCapability)();\n      intentState.operatorList = {\n        fnArray: [],\n        argsArray: [],\n        lastChunk: false\n      };\n\n      if (this._stats) {\n        this._stats.time(\"Page Request\");\n      }\n\n      this._pumpOperatorList(intentArgs);\n    }\n\n    const complete = error => {\n      intentState.renderTasks.delete(internalRenderTask);\n\n      if (this.cleanupAfterRender || intentPrint) {\n        this.pendingCleanup = true;\n      }\n\n      this._tryCleanup();\n\n      if (error) {\n        internalRenderTask.capability.reject(error);\n\n        this._abortOperatorList({\n          intentState,\n          reason: error instanceof Error ? error : new Error(error)\n        });\n      } else {\n        internalRenderTask.capability.resolve();\n      }\n\n      if (this._stats) {\n        this._stats.timeEnd(\"Rendering\");\n\n        this._stats.timeEnd(\"Overall\");\n      }\n    };\n\n    const internalRenderTask = new InternalRenderTask({\n      callback: complete,\n      params: {\n        canvasContext,\n        viewport,\n        transform,\n        imageLayer,\n        background\n      },\n      objs: this.objs,\n      commonObjs: this.commonObjs,\n      annotationCanvasMap,\n      operatorList: intentState.operatorList,\n      pageIndex: this._pageIndex,\n      canvasFactory: canvasFactoryInstance,\n      useRequestAnimationFrame: !intentPrint,\n      pdfBug: this._pdfBug\n    });\n    (intentState.renderTasks ||= new Set()).add(internalRenderTask);\n    const renderTask = internalRenderTask.task;\n    Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {\n      if (this.pendingCleanup) {\n        complete();\n        return;\n      }\n\n      if (this._stats) {\n        this._stats.time(\"Rendering\");\n      }\n\n      internalRenderTask.initializeGraphics({\n        transparency,\n        optionalContentConfig\n      });\n      internalRenderTask.operatorListChanged();\n    }).catch(complete);\n    return renderTask;\n  }\n\n  getOperatorList({\n    intent = \"display\",\n    annotationMode = _util.AnnotationMode.ENABLE\n  } = {}) {\n    function operatorListChanged() {\n      if (intentState.operatorList.lastChunk) {\n        intentState.opListReadCapability.resolve(intentState.operatorList);\n        intentState.renderTasks.delete(opListTask);\n      }\n    }\n\n    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, true);\n\n    let intentState = this._intentStates.get(intentArgs.cacheKey);\n\n    if (!intentState) {\n      intentState = Object.create(null);\n\n      this._intentStates.set(intentArgs.cacheKey, intentState);\n    }\n\n    let opListTask;\n\n    if (!intentState.opListReadCapability) {\n      opListTask = Object.create(null);\n      opListTask.operatorListChanged = operatorListChanged;\n      intentState.opListReadCapability = (0, _util.createPromiseCapability)();\n      (intentState.renderTasks ||= new Set()).add(opListTask);\n      intentState.operatorList = {\n        fnArray: [],\n        argsArray: [],\n        lastChunk: false\n      };\n\n      if (this._stats) {\n        this._stats.time(\"Page Request\");\n      }\n\n      this._pumpOperatorList(intentArgs);\n    }\n\n    return intentState.opListReadCapability.promise;\n  }\n\n  streamTextContent({\n    disableCombineTextItems = false,\n    includeMarkedContent = false\n  } = {}) {\n    const TEXT_CONTENT_CHUNK_SIZE = 100;\n    return this._transport.messageHandler.sendWithStream(\"GetTextContent\", {\n      pageIndex: this._pageIndex,\n      combineTextItems: disableCombineTextItems !== true,\n      includeMarkedContent: includeMarkedContent === true\n    }, {\n      highWaterMark: TEXT_CONTENT_CHUNK_SIZE,\n\n      size(textContent) {\n        return textContent.items.length;\n      }\n\n    });\n  }\n\n  getTextContent(params = {}) {\n    if (this._transport._htmlForXfa) {\n      return this.getXfa().then(xfa => {\n        return _xfa_text.XfaText.textContent(xfa);\n      });\n    }\n\n    const readableStream = this.streamTextContent(params);\n    return new Promise(function (resolve, reject) {\n      function pump() {\n        reader.read().then(function ({\n          value,\n          done\n        }) {\n          if (done) {\n            resolve(textContent);\n            return;\n          }\n\n          Object.assign(textContent.styles, value.styles);\n          textContent.items.push(...value.items);\n          pump();\n        }, reject);\n      }\n\n      const reader = readableStream.getReader();\n      const textContent = {\n        items: [],\n        styles: Object.create(null)\n      };\n      pump();\n    });\n  }\n\n  getStructTree() {\n    return this._structTreePromise ||= this._transport.getStructTree(this._pageIndex);\n  }\n\n  _destroy() {\n    this.destroyed = true;\n    const waitOn = [];\n\n    for (const intentState of this._intentStates.values()) {\n      this._abortOperatorList({\n        intentState,\n        reason: new Error(\"Page was destroyed.\"),\n        force: true\n      });\n\n      if (intentState.opListReadCapability) {\n        continue;\n      }\n\n      for (const internalRenderTask of intentState.renderTasks) {\n        waitOn.push(internalRenderTask.completed);\n        internalRenderTask.cancel();\n      }\n    }\n\n    this.objs.clear();\n\n    this._annotationPromises.clear();\n\n    this._jsActionsPromise = null;\n    this._structTreePromise = null;\n    this.pendingCleanup = false;\n    return Promise.all(waitOn);\n  }\n\n  cleanup(resetStats = false) {\n    this.pendingCleanup = true;\n    return this._tryCleanup(resetStats);\n  }\n\n  _tryCleanup(resetStats = false) {\n    if (!this.pendingCleanup) {\n      return false;\n    }\n\n    for (const {\n      renderTasks,\n      operatorList\n    } of this._intentStates.values()) {\n      if (renderTasks.size > 0 || !operatorList.lastChunk) {\n        return false;\n      }\n    }\n\n    this._intentStates.clear();\n\n    this.objs.clear();\n\n    this._annotationPromises.clear();\n\n    this._jsActionsPromise = null;\n    this._structTreePromise = null;\n\n    if (resetStats && this._stats) {\n      this._stats = new _display_utils.StatTimer();\n    }\n\n    this.pendingCleanup = false;\n    return true;\n  }\n\n  _startRenderPage(transparency, cacheKey) {\n    const intentState = this._intentStates.get(cacheKey);\n\n    if (!intentState) {\n      return;\n    }\n\n    if (this._stats) {\n      this._stats.timeEnd(\"Page Request\");\n    }\n\n    if (intentState.displayReadyCapability) {\n      intentState.displayReadyCapability.resolve(transparency);\n    }\n  }\n\n  _renderPageChunk(operatorListChunk, intentState) {\n    for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {\n      intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);\n      intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);\n    }\n\n    intentState.operatorList.lastChunk = operatorListChunk.lastChunk;\n\n    for (const internalRenderTask of intentState.renderTasks) {\n      internalRenderTask.operatorListChanged();\n    }\n\n    if (operatorListChunk.lastChunk) {\n      this._tryCleanup();\n    }\n  }\n\n  _pumpOperatorList({\n    renderingIntent,\n    cacheKey\n  }) {\n    const readableStream = this._transport.messageHandler.sendWithStream(\"GetOperatorList\", {\n      pageIndex: this._pageIndex,\n      intent: renderingIntent,\n      cacheKey,\n      annotationStorage: renderingIntent & _util.RenderingIntentFlag.ANNOTATIONS_STORAGE ? this._transport.annotationStorage.serializable : null\n    });\n\n    const reader = readableStream.getReader();\n\n    const intentState = this._intentStates.get(cacheKey);\n\n    intentState.streamReader = reader;\n\n    const pump = () => {\n      reader.read().then(({\n        value,\n        done\n      }) => {\n        if (done) {\n          intentState.streamReader = null;\n          return;\n        }\n\n        if (this._transport.destroyed) {\n          return;\n        }\n\n        this._renderPageChunk(value, intentState);\n\n        pump();\n      }, reason => {\n        intentState.streamReader = null;\n\n        if (this._transport.destroyed) {\n          return;\n        }\n\n        if (intentState.operatorList) {\n          intentState.operatorList.lastChunk = true;\n\n          for (const internalRenderTask of intentState.renderTasks) {\n            internalRenderTask.operatorListChanged();\n          }\n\n          this._tryCleanup();\n        }\n\n        if (intentState.displayReadyCapability) {\n          intentState.displayReadyCapability.reject(reason);\n        } else if (intentState.opListReadCapability) {\n          intentState.opListReadCapability.reject(reason);\n        } else {\n          throw reason;\n        }\n      });\n    };\n\n    pump();\n  }\n\n  _abortOperatorList({\n    intentState,\n    reason,\n    force = false\n  }) {\n    if (!intentState.streamReader) {\n      return;\n    }\n\n    if (!force) {\n      if (intentState.renderTasks.size > 0) {\n        return;\n      }\n\n      if (reason instanceof _display_utils.RenderingCancelledException) {\n        intentState.streamReaderCancelTimeout = setTimeout(() => {\n          this._abortOperatorList({\n            intentState,\n            reason,\n            force: true\n          });\n\n          intentState.streamReaderCancelTimeout = null;\n        }, RENDERING_CANCELLED_TIMEOUT);\n        return;\n      }\n    }\n\n    intentState.streamReader.cancel(new _util.AbortException(reason.message)).catch(() => {});\n    intentState.streamReader = null;\n\n    if (this._transport.destroyed) {\n      return;\n    }\n\n    for (const [curCacheKey, curIntentState] of this._intentStates) {\n      if (curIntentState === intentState) {\n        this._intentStates.delete(curCacheKey);\n\n        break;\n      }\n    }\n\n    this.cleanup();\n  }\n\n  get stats() {\n    return this._stats;\n  }\n\n}\n\nexports.PDFPageProxy = PDFPageProxy;\n\nclass LoopbackPort {\n  constructor() {\n    this._listeners = [];\n    this._deferred = Promise.resolve();\n  }\n\n  postMessage(obj, transfers) {\n    const event = {\n      data: structuredClone(obj, transfers)\n    };\n\n    this._deferred.then(() => {\n      for (const listener of this._listeners) {\n        listener.call(this, event);\n      }\n    });\n  }\n\n  addEventListener(name, listener) {\n    this._listeners.push(listener);\n  }\n\n  removeEventListener(name, listener) {\n    const i = this._listeners.indexOf(listener);\n\n    this._listeners.splice(i, 1);\n  }\n\n  terminate() {\n    this._listeners.length = 0;\n  }\n\n}\n\nexports.LoopbackPort = LoopbackPort;\nconst PDFWorkerUtil = {\n  isWorkerDisabled: false,\n  fallbackWorkerSrc: null,\n  fakeWorkerId: 0\n};\n{\n  if (_is_node.isNodeJS && \"function\" === \"function\") {\n    PDFWorkerUtil.isWorkerDisabled = true;\n    PDFWorkerUtil.fallbackWorkerSrc = \"./pdf.worker.js\";\n  } else if (typeof document === \"object\") {\n    const pdfjsFilePath = document?.currentScript?.src;\n\n    if (pdfjsFilePath) {\n      PDFWorkerUtil.fallbackWorkerSrc = pdfjsFilePath.replace(/(\\.(?:min\\.)?js)(\\?.*)?$/i, \".worker$1$2\");\n    }\n  }\n\n  PDFWorkerUtil.createCDNWrapper = function (url) {\n    const wrapper = `importScripts(\"${url}\");`;\n    return URL.createObjectURL(new Blob([wrapper]));\n  };\n}\n\nclass PDFWorker {\n  static get _workerPorts() {\n    return (0, _util.shadow)(this, \"_workerPorts\", new WeakMap());\n  }\n\n  constructor({\n    name = null,\n    port = null,\n    verbosity = (0, _util.getVerbosityLevel)()\n  } = {}) {\n    if (port && PDFWorker._workerPorts.has(port)) {\n      throw new Error(\"Cannot use more than one PDFWorker per port.\");\n    }\n\n    this.name = name;\n    this.destroyed = false;\n    this.verbosity = verbosity;\n    this._readyCapability = (0, _util.createPromiseCapability)();\n    this._port = null;\n    this._webWorker = null;\n    this._messageHandler = null;\n\n    if (port) {\n      PDFWorker._workerPorts.set(port, this);\n\n      this._initializeFromPort(port);\n\n      return;\n    }\n\n    this._initialize();\n  }\n\n  get promise() {\n    return this._readyCapability.promise;\n  }\n\n  get port() {\n    return this._port;\n  }\n\n  get messageHandler() {\n    return this._messageHandler;\n  }\n\n  _initializeFromPort(port) {\n    this._port = port;\n    this._messageHandler = new _message_handler.MessageHandler(\"main\", \"worker\", port);\n\n    this._messageHandler.on(\"ready\", function () {});\n\n    this._readyCapability.resolve();\n  }\n\n  _initialize() {\n    if (typeof Worker !== \"undefined\" && !PDFWorkerUtil.isWorkerDisabled && !PDFWorker._mainThreadWorkerMessageHandler) {\n      let workerSrc = PDFWorker.workerSrc;\n\n      try {\n        if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) {\n          workerSrc = PDFWorkerUtil.createCDNWrapper(new URL(workerSrc, window.location).href);\n        }\n\n        const worker = new Worker(workerSrc);\n        const messageHandler = new _message_handler.MessageHandler(\"main\", \"worker\", worker);\n\n        const terminateEarly = () => {\n          worker.removeEventListener(\"error\", onWorkerError);\n          messageHandler.destroy();\n          worker.terminate();\n\n          if (this.destroyed) {\n            this._readyCapability.reject(new Error(\"Worker was destroyed\"));\n          } else {\n            this._setupFakeWorker();\n          }\n        };\n\n        const onWorkerError = () => {\n          if (!this._webWorker) {\n            terminateEarly();\n          }\n        };\n\n        worker.addEventListener(\"error\", onWorkerError);\n        messageHandler.on(\"test\", data => {\n          worker.removeEventListener(\"error\", onWorkerError);\n\n          if (this.destroyed) {\n            terminateEarly();\n            return;\n          }\n\n          if (data) {\n            this._messageHandler = messageHandler;\n            this._port = worker;\n            this._webWorker = worker;\n\n            this._readyCapability.resolve();\n\n            messageHandler.send(\"configure\", {\n              verbosity: this.verbosity\n            });\n          } else {\n            this._setupFakeWorker();\n\n            messageHandler.destroy();\n            worker.terminate();\n          }\n        });\n        messageHandler.on(\"ready\", data => {\n          worker.removeEventListener(\"error\", onWorkerError);\n\n          if (this.destroyed) {\n            terminateEarly();\n            return;\n          }\n\n          try {\n            sendTest();\n          } catch (e) {\n            this._setupFakeWorker();\n          }\n        });\n\n        const sendTest = () => {\n          const testObj = new Uint8Array([255]);\n\n          try {\n            messageHandler.send(\"test\", testObj, [testObj.buffer]);\n          } catch (ex) {\n            (0, _util.warn)(\"Cannot use postMessage transfers.\");\n            testObj[0] = 0;\n            messageHandler.send(\"test\", testObj);\n          }\n        };\n\n        sendTest();\n        return;\n      } catch (e) {\n        (0, _util.info)(\"The worker has been disabled.\");\n      }\n    }\n\n    this._setupFakeWorker();\n  }\n\n  _setupFakeWorker() {\n    if (!PDFWorkerUtil.isWorkerDisabled) {\n      (0, _util.warn)(\"Setting up fake worker.\");\n      PDFWorkerUtil.isWorkerDisabled = true;\n    }\n\n    PDFWorker._setupFakeWorkerGlobal.then(WorkerMessageHandler => {\n      if (this.destroyed) {\n        this._readyCapability.reject(new Error(\"Worker was destroyed\"));\n\n        return;\n      }\n\n      const port = new LoopbackPort();\n      this._port = port;\n      const id = `fake${PDFWorkerUtil.fakeWorkerId++}`;\n      const workerHandler = new _message_handler.MessageHandler(id + \"_worker\", id, port);\n      WorkerMessageHandler.setup(workerHandler, port);\n      const messageHandler = new _message_handler.MessageHandler(id, id + \"_worker\", port);\n      this._messageHandler = messageHandler;\n\n      this._readyCapability.resolve();\n\n      messageHandler.send(\"configure\", {\n        verbosity: this.verbosity\n      });\n    }).catch(reason => {\n      this._readyCapability.reject(new Error(`Setting up fake worker failed: \"${reason.message}\".`));\n    });\n  }\n\n  destroy() {\n    this.destroyed = true;\n\n    if (this._webWorker) {\n      this._webWorker.terminate();\n\n      this._webWorker = null;\n    }\n\n    PDFWorker._workerPorts.delete(this._port);\n\n    this._port = null;\n\n    if (this._messageHandler) {\n      this._messageHandler.destroy();\n\n      this._messageHandler = null;\n    }\n  }\n\n  static fromPort(params) {\n    if (!params?.port) {\n      throw new Error(\"PDFWorker.fromPort - invalid method signature.\");\n    }\n\n    if (this._workerPorts.has(params.port)) {\n      return this._workerPorts.get(params.port);\n    }\n\n    return new PDFWorker(params);\n  }\n\n  static get workerSrc() {\n    if (_worker_options.GlobalWorkerOptions.workerSrc) {\n      return _worker_options.GlobalWorkerOptions.workerSrc;\n    }\n\n    if (PDFWorkerUtil.fallbackWorkerSrc !== null) {\n      if (!_is_node.isNodeJS) {\n        (0, _display_utils.deprecated)('No \"GlobalWorkerOptions.workerSrc\" specified.');\n      }\n\n      return PDFWorkerUtil.fallbackWorkerSrc;\n    }\n\n    throw new Error('No \"GlobalWorkerOptions.workerSrc\" specified.');\n  }\n\n  static get _mainThreadWorkerMessageHandler() {\n    try {\n      return globalThis.pdfjsWorker?.WorkerMessageHandler || null;\n    } catch (ex) {\n      return null;\n    }\n  }\n\n  static get _setupFakeWorkerGlobal() {\n    const loader = async () => {\n      const mainWorkerMessageHandler = this._mainThreadWorkerMessageHandler;\n\n      if (mainWorkerMessageHandler) {\n        return mainWorkerMessageHandler;\n      }\n\n      if (_is_node.isNodeJS && \"function\" === \"function\") {\n        const worker = eval(\"require\")(this.workerSrc);\n        return worker.WorkerMessageHandler;\n      }\n\n      await (0, _display_utils.loadScript)(this.workerSrc);\n      return window.pdfjsWorker.WorkerMessageHandler;\n    };\n\n    return (0, _util.shadow)(this, \"_setupFakeWorkerGlobal\", loader());\n  }\n\n}\n\nexports.PDFWorker = PDFWorker;\n{\n  PDFWorker.getWorkerSrc = function () {\n    (0, _display_utils.deprecated)(\"`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead.\");\n    return this.workerSrc;\n  };\n}\n\nclass WorkerTransport {\n  #docStats = null;\n  #pageCache = new Map();\n  #pagePromises = new Map();\n  #metadataPromise = null;\n\n  constructor(messageHandler, loadingTask, networkStream, params) {\n    this.messageHandler = messageHandler;\n    this.loadingTask = loadingTask;\n    this.commonObjs = new PDFObjects();\n    this.fontLoader = new _font_loader.FontLoader({\n      docId: loadingTask.docId,\n      onUnsupportedFeature: this._onUnsupportedFeature.bind(this),\n      ownerDocument: params.ownerDocument,\n      styleElement: params.styleElement\n    });\n    this._params = params;\n\n    if (!params.useWorkerFetch) {\n      this.CMapReaderFactory = new params.CMapReaderFactory({\n        baseUrl: params.cMapUrl,\n        isCompressed: params.cMapPacked\n      });\n      this.StandardFontDataFactory = new params.StandardFontDataFactory({\n        baseUrl: params.standardFontDataUrl\n      });\n    }\n\n    this.destroyed = false;\n    this.destroyCapability = null;\n    this._passwordCapability = null;\n    this._networkStream = networkStream;\n    this._fullReader = null;\n    this._lastProgress = null;\n    this.downloadInfoCapability = (0, _util.createPromiseCapability)();\n    this.setupMessageHandler();\n  }\n\n  get annotationStorage() {\n    return (0, _util.shadow)(this, \"annotationStorage\", new _annotation_storage.AnnotationStorage());\n  }\n\n  get stats() {\n    return this.#docStats;\n  }\n\n  getRenderingIntent(intent, annotationMode = _util.AnnotationMode.ENABLE, isOpList = false) {\n    let renderingIntent = _util.RenderingIntentFlag.DISPLAY;\n    let lastModified = \"\";\n\n    switch (intent) {\n      case \"any\":\n        renderingIntent = _util.RenderingIntentFlag.ANY;\n        break;\n\n      case \"display\":\n        break;\n\n      case \"print\":\n        renderingIntent = _util.RenderingIntentFlag.PRINT;\n        break;\n\n      default:\n        (0, _util.warn)(`getRenderingIntent - invalid intent: ${intent}`);\n    }\n\n    switch (annotationMode) {\n      case _util.AnnotationMode.DISABLE:\n        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_DISABLE;\n        break;\n\n      case _util.AnnotationMode.ENABLE:\n        break;\n\n      case _util.AnnotationMode.ENABLE_FORMS:\n        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_FORMS;\n        break;\n\n      case _util.AnnotationMode.ENABLE_STORAGE:\n        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE;\n        lastModified = this.annotationStorage.lastModified;\n        break;\n\n      default:\n        (0, _util.warn)(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);\n    }\n\n    if (isOpList) {\n      renderingIntent += _util.RenderingIntentFlag.OPLIST;\n    }\n\n    return {\n      renderingIntent,\n      cacheKey: `${renderingIntent}_${lastModified}`\n    };\n  }\n\n  destroy() {\n    if (this.destroyCapability) {\n      return this.destroyCapability.promise;\n    }\n\n    this.destroyed = true;\n    this.destroyCapability = (0, _util.createPromiseCapability)();\n\n    if (this._passwordCapability) {\n      this._passwordCapability.reject(new Error(\"Worker was destroyed during onPassword callback\"));\n    }\n\n    const waitOn = [];\n\n    for (const page of this.#pageCache.values()) {\n      waitOn.push(page._destroy());\n    }\n\n    this.#pageCache.clear();\n    this.#pagePromises.clear();\n\n    if (this.hasOwnProperty(\"annotationStorage\")) {\n      this.annotationStorage.resetModified();\n    }\n\n    const terminated = this.messageHandler.sendWithPromise(\"Terminate\", null);\n    waitOn.push(terminated);\n    Promise.all(waitOn).then(() => {\n      this.commonObjs.clear();\n      this.fontLoader.clear();\n      this.#metadataPromise = null;\n      this._getFieldObjectsPromise = null;\n      this._hasJSActionsPromise = null;\n\n      if (this._networkStream) {\n        this._networkStream.cancelAllRequests(new _util.AbortException(\"Worker was terminated.\"));\n      }\n\n      if (this.messageHandler) {\n        this.messageHandler.destroy();\n        this.messageHandler = null;\n      }\n\n      this.destroyCapability.resolve();\n    }, this.destroyCapability.reject);\n    return this.destroyCapability.promise;\n  }\n\n  setupMessageHandler() {\n    const {\n      messageHandler,\n      loadingTask\n    } = this;\n    messageHandler.on(\"GetReader\", (data, sink) => {\n      (0, _util.assert)(this._networkStream, \"GetReader - no `IPDFStream` instance available.\");\n      this._fullReader = this._networkStream.getFullReader();\n\n      this._fullReader.onProgress = evt => {\n        this._lastProgress = {\n          loaded: evt.loaded,\n          total: evt.total\n        };\n      };\n\n      sink.onPull = () => {\n        this._fullReader.read().then(function ({\n          value,\n          done\n        }) {\n          if (done) {\n            sink.close();\n            return;\n          }\n\n          (0, _util.assert)((0, _util.isArrayBuffer)(value), \"GetReader - expected an ArrayBuffer.\");\n          sink.enqueue(new Uint8Array(value), 1, [value]);\n        }).catch(reason => {\n          sink.error(reason);\n        });\n      };\n\n      sink.onCancel = reason => {\n        this._fullReader.cancel(reason);\n\n        sink.ready.catch(readyReason => {\n          if (this.destroyed) {\n            return;\n          }\n\n          throw readyReason;\n        });\n      };\n    });\n    messageHandler.on(\"ReaderHeadersReady\", data => {\n      const headersCapability = (0, _util.createPromiseCapability)();\n      const fullReader = this._fullReader;\n      fullReader.headersReady.then(() => {\n        if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {\n          if (this._lastProgress) {\n            loadingTask.onProgress?.(this._lastProgress);\n          }\n\n          fullReader.onProgress = evt => {\n            loadingTask.onProgress?.({\n              loaded: evt.loaded,\n              total: evt.total\n            });\n          };\n        }\n\n        headersCapability.resolve({\n          isStreamingSupported: fullReader.isStreamingSupported,\n          isRangeSupported: fullReader.isRangeSupported,\n          contentLength: fullReader.contentLength\n        });\n      }, headersCapability.reject);\n      return headersCapability.promise;\n    });\n    messageHandler.on(\"GetRangeReader\", (data, sink) => {\n      (0, _util.assert)(this._networkStream, \"GetRangeReader - no `IPDFStream` instance available.\");\n\n      const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);\n\n      if (!rangeReader) {\n        sink.close();\n        return;\n      }\n\n      sink.onPull = () => {\n        rangeReader.read().then(function ({\n          value,\n          done\n        }) {\n          if (done) {\n            sink.close();\n            return;\n          }\n\n          (0, _util.assert)((0, _util.isArrayBuffer)(value), \"GetRangeReader - expected an ArrayBuffer.\");\n          sink.enqueue(new Uint8Array(value), 1, [value]);\n        }).catch(reason => {\n          sink.error(reason);\n        });\n      };\n\n      sink.onCancel = reason => {\n        rangeReader.cancel(reason);\n        sink.ready.catch(readyReason => {\n          if (this.destroyed) {\n            return;\n          }\n\n          throw readyReason;\n        });\n      };\n    });\n    messageHandler.on(\"GetDoc\", ({\n      pdfInfo\n    }) => {\n      this._numPages = pdfInfo.numPages;\n      this._htmlForXfa = pdfInfo.htmlForXfa;\n      delete pdfInfo.htmlForXfa;\n\n      loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));\n    });\n    messageHandler.on(\"DocException\", function (ex) {\n      let reason;\n\n      switch (ex.name) {\n        case \"PasswordException\":\n          reason = new _util.PasswordException(ex.message, ex.code);\n          break;\n\n        case \"InvalidPDFException\":\n          reason = new _util.InvalidPDFException(ex.message);\n          break;\n\n        case \"MissingPDFException\":\n          reason = new _util.MissingPDFException(ex.message);\n          break;\n\n        case \"UnexpectedResponseException\":\n          reason = new _util.UnexpectedResponseException(ex.message, ex.status);\n          break;\n\n        case \"UnknownErrorException\":\n          reason = new _util.UnknownErrorException(ex.message, ex.details);\n          break;\n\n        default:\n          (0, _util.unreachable)(\"DocException - expected a valid Error.\");\n      }\n\n      loadingTask._capability.reject(reason);\n    });\n    messageHandler.on(\"PasswordRequest\", exception => {\n      this._passwordCapability = (0, _util.createPromiseCapability)();\n\n      if (loadingTask.onPassword) {\n        const updatePassword = password => {\n          if (password instanceof Error) {\n            this._passwordCapability.reject(password);\n          } else {\n            this._passwordCapability.resolve({\n              password\n            });\n          }\n        };\n\n        try {\n          loadingTask.onPassword(updatePassword, exception.code);\n        } catch (ex) {\n          this._passwordCapability.reject(ex);\n        }\n      } else {\n        this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));\n      }\n\n      return this._passwordCapability.promise;\n    });\n    messageHandler.on(\"DataLoaded\", data => {\n      loadingTask.onProgress?.({\n        loaded: data.length,\n        total: data.length\n      });\n      this.downloadInfoCapability.resolve(data);\n    });\n    messageHandler.on(\"StartRenderPage\", data => {\n      if (this.destroyed) {\n        return;\n      }\n\n      const page = this.#pageCache.get(data.pageIndex);\n\n      page._startRenderPage(data.transparency, data.cacheKey);\n    });\n    messageHandler.on(\"commonobj\", ([id, type, exportedData]) => {\n      if (this.destroyed) {\n        return;\n      }\n\n      if (this.commonObjs.has(id)) {\n        return;\n      }\n\n      switch (type) {\n        case \"Font\":\n          const params = this._params;\n\n          if (\"error\" in exportedData) {\n            const exportedError = exportedData.error;\n            (0, _util.warn)(`Error during font loading: ${exportedError}`);\n            this.commonObjs.resolve(id, exportedError);\n            break;\n          }\n\n          let fontRegistry = null;\n\n          if (params.pdfBug && globalThis.FontInspector?.enabled) {\n            fontRegistry = {\n              registerFont(font, url) {\n                globalThis.FontInspector.fontAdded(font, url);\n              }\n\n            };\n          }\n\n          const font = new _font_loader.FontFaceObject(exportedData, {\n            isEvalSupported: params.isEvalSupported,\n            disableFontFace: params.disableFontFace,\n            ignoreErrors: params.ignoreErrors,\n            onUnsupportedFeature: this._onUnsupportedFeature.bind(this),\n            fontRegistry\n          });\n          this.fontLoader.bind(font).catch(reason => {\n            return messageHandler.sendWithPromise(\"FontFallback\", {\n              id\n            });\n          }).finally(() => {\n            if (!params.fontExtraProperties && font.data) {\n              font.data = null;\n            }\n\n            this.commonObjs.resolve(id, font);\n          });\n          break;\n\n        case \"FontPath\":\n        case \"Image\":\n          this.commonObjs.resolve(id, exportedData);\n          break;\n\n        default:\n          throw new Error(`Got unknown common object type ${type}`);\n      }\n    });\n    messageHandler.on(\"obj\", ([id, pageIndex, type, imageData]) => {\n      if (this.destroyed) {\n        return;\n      }\n\n      const pageProxy = this.#pageCache.get(pageIndex);\n\n      if (pageProxy.objs.has(id)) {\n        return;\n      }\n\n      switch (type) {\n        case \"Image\":\n          pageProxy.objs.resolve(id, imageData);\n          const MAX_IMAGE_SIZE_TO_STORE = 8000000;\n\n          if (imageData?.data?.length > MAX_IMAGE_SIZE_TO_STORE) {\n            pageProxy.cleanupAfterRender = true;\n          }\n\n          break;\n\n        case \"Pattern\":\n          pageProxy.objs.resolve(id, imageData);\n          break;\n\n        default:\n          throw new Error(`Got unknown object type ${type}`);\n      }\n    });\n    messageHandler.on(\"DocProgress\", data => {\n      if (this.destroyed) {\n        return;\n      }\n\n      loadingTask.onProgress?.({\n        loaded: data.loaded,\n        total: data.total\n      });\n    });\n    messageHandler.on(\"DocStats\", data => {\n      if (this.destroyed) {\n        return;\n      }\n\n      this.#docStats = Object.freeze({\n        streamTypes: Object.freeze(data.streamTypes),\n        fontTypes: Object.freeze(data.fontTypes)\n      });\n    });\n    messageHandler.on(\"UnsupportedFeature\", this._onUnsupportedFeature.bind(this));\n    messageHandler.on(\"FetchBuiltInCMap\", data => {\n      if (this.destroyed) {\n        return Promise.reject(new Error(\"Worker was destroyed.\"));\n      }\n\n      if (!this.CMapReaderFactory) {\n        return Promise.reject(new Error(\"CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.\"));\n      }\n\n      return this.CMapReaderFactory.fetch(data);\n    });\n    messageHandler.on(\"FetchStandardFontData\", data => {\n      if (this.destroyed) {\n        return Promise.reject(new Error(\"Worker was destroyed.\"));\n      }\n\n      if (!this.StandardFontDataFactory) {\n        return Promise.reject(new Error(\"StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.\"));\n      }\n\n      return this.StandardFontDataFactory.fetch(data);\n    });\n  }\n\n  _onUnsupportedFeature({\n    featureId\n  }) {\n    if (this.destroyed) {\n      return;\n    }\n\n    this.loadingTask.onUnsupportedFeature?.(featureId);\n  }\n\n  getData() {\n    return this.messageHandler.sendWithPromise(\"GetData\", null);\n  }\n\n  getPage(pageNumber) {\n    if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {\n      return Promise.reject(new Error(\"Invalid page request.\"));\n    }\n\n    const pageIndex = pageNumber - 1,\n          cachedPromise = this.#pagePromises.get(pageIndex);\n\n    if (cachedPromise) {\n      return cachedPromise;\n    }\n\n    const promise = this.messageHandler.sendWithPromise(\"GetPage\", {\n      pageIndex\n    }).then(pageInfo => {\n      if (this.destroyed) {\n        throw new Error(\"Transport destroyed\");\n      }\n\n      const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.ownerDocument, this._params.pdfBug);\n      this.#pageCache.set(pageIndex, page);\n      return page;\n    });\n    this.#pagePromises.set(pageIndex, promise);\n    return promise;\n  }\n\n  getPageIndex(ref) {\n    if (typeof ref !== \"object\" || ref === null || !Number.isInteger(ref.num) || ref.num < 0 || !Number.isInteger(ref.gen) || ref.gen < 0) {\n      return Promise.reject(new Error(\"Invalid pageIndex request.\"));\n    }\n\n    return this.messageHandler.sendWithPromise(\"GetPageIndex\", {\n      num: ref.num,\n      gen: ref.gen\n    });\n  }\n\n  getAnnotations(pageIndex, intent) {\n    return this.messageHandler.sendWithPromise(\"GetAnnotations\", {\n      pageIndex,\n      intent\n    });\n  }\n\n  saveDocument() {\n    return this.messageHandler.sendWithPromise(\"SaveDocument\", {\n      isPureXfa: !!this._htmlForXfa,\n      numPages: this._numPages,\n      annotationStorage: this.annotationStorage.serializable,\n      filename: this._fullReader?.filename ?? null\n    }).finally(() => {\n      this.annotationStorage.resetModified();\n    });\n  }\n\n  getFieldObjects() {\n    return this._getFieldObjectsPromise ||= this.messageHandler.sendWithPromise(\"GetFieldObjects\", null);\n  }\n\n  hasJSActions() {\n    return this._hasJSActionsPromise ||= this.messageHandler.sendWithPromise(\"HasJSActions\", null);\n  }\n\n  getCalculationOrderIds() {\n    return this.messageHandler.sendWithPromise(\"GetCalculationOrderIds\", null);\n  }\n\n  getDestinations() {\n    return this.messageHandler.sendWithPromise(\"GetDestinations\", null);\n  }\n\n  getDestination(id) {\n    if (typeof id !== \"string\") {\n      return Promise.reject(new Error(\"Invalid destination request.\"));\n    }\n\n    return this.messageHandler.sendWithPromise(\"GetDestination\", {\n      id\n    });\n  }\n\n  getPageLabels() {\n    return this.messageHandler.sendWithPromise(\"GetPageLabels\", null);\n  }\n\n  getPageLayout() {\n    return this.messageHandler.sendWithPromise(\"GetPageLayout\", null);\n  }\n\n  getPageMode() {\n    return this.messageHandler.sendWithPromise(\"GetPageMode\", null);\n  }\n\n  getViewerPreferences() {\n    return this.messageHandler.sendWithPromise(\"GetViewerPreferences\", null);\n  }\n\n  getOpenAction() {\n    return this.messageHandler.sendWithPromise(\"GetOpenAction\", null);\n  }\n\n  getAttachments() {\n    return this.messageHandler.sendWithPromise(\"GetAttachments\", null);\n  }\n\n  getJavaScript() {\n    return this.messageHandler.sendWithPromise(\"GetJavaScript\", null);\n  }\n\n  getDocJSActions() {\n    return this.messageHandler.sendWithPromise(\"GetDocJSActions\", null);\n  }\n\n  getPageJSActions(pageIndex) {\n    return this.messageHandler.sendWithPromise(\"GetPageJSActions\", {\n      pageIndex\n    });\n  }\n\n  getStructTree(pageIndex) {\n    return this.messageHandler.sendWithPromise(\"GetStructTree\", {\n      pageIndex\n    });\n  }\n\n  getOutline() {\n    return this.messageHandler.sendWithPromise(\"GetOutline\", null);\n  }\n\n  getOptionalContentConfig() {\n    return this.messageHandler.sendWithPromise(\"GetOptionalContentConfig\", null).then(results => {\n      return new _optional_content_config.OptionalContentConfig(results);\n    });\n  }\n\n  getPermissions() {\n    return this.messageHandler.sendWithPromise(\"GetPermissions\", null);\n  }\n\n  getMetadata() {\n    return this.#metadataPromise ||= this.messageHandler.sendWithPromise(\"GetMetadata\", null).then(results => {\n      return {\n        info: results[0],\n        metadata: results[1] ? new _metadata.Metadata(results[1]) : null,\n        contentDispositionFilename: this._fullReader?.filename ?? null,\n        contentLength: this._fullReader?.contentLength ?? null\n      };\n    });\n  }\n\n  getMarkInfo() {\n    return this.messageHandler.sendWithPromise(\"GetMarkInfo\", null);\n  }\n\n  async startCleanup(keepLoadedFonts = false) {\n    await this.messageHandler.sendWithPromise(\"Cleanup\", null);\n\n    if (this.destroyed) {\n      return;\n    }\n\n    for (const page of this.#pageCache.values()) {\n      const cleanupSuccessful = page.cleanup();\n\n      if (!cleanupSuccessful) {\n        throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);\n      }\n    }\n\n    this.commonObjs.clear();\n\n    if (!keepLoadedFonts) {\n      this.fontLoader.clear();\n    }\n\n    this.#metadataPromise = null;\n    this._getFieldObjectsPromise = null;\n    this._hasJSActionsPromise = null;\n  }\n\n  get loadingParams() {\n    const params = this._params;\n    return (0, _util.shadow)(this, \"loadingParams\", {\n      disableAutoFetch: params.disableAutoFetch,\n      enableXfa: params.enableXfa\n    });\n  }\n\n}\n\nclass PDFObjects {\n  #objs = Object.create(null);\n\n  #ensureObj(objId) {\n    const obj = this.#objs[objId];\n\n    if (obj) {\n      return obj;\n    }\n\n    return this.#objs[objId] = {\n      capability: (0, _util.createPromiseCapability)(),\n      data: null\n    };\n  }\n\n  get(objId, callback = null) {\n    if (callback) {\n      const obj = this.#ensureObj(objId);\n      obj.capability.promise.then(() => callback(obj.data));\n      return null;\n    }\n\n    const obj = this.#objs[objId];\n\n    if (!obj?.capability.settled) {\n      throw new Error(`Requesting object that isn't resolved yet ${objId}.`);\n    }\n\n    return obj.data;\n  }\n\n  has(objId) {\n    const obj = this.#objs[objId];\n    return obj?.capability.settled || false;\n  }\n\n  resolve(objId, data = null) {\n    const obj = this.#ensureObj(objId);\n    obj.data = data;\n    obj.capability.resolve();\n  }\n\n  clear() {\n    this.#objs = Object.create(null);\n  }\n\n}\n\nclass RenderTask {\n  constructor(internalRenderTask) {\n    this._internalRenderTask = internalRenderTask;\n    this.onContinue = null;\n  }\n\n  get promise() {\n    return this._internalRenderTask.capability.promise;\n  }\n\n  cancel() {\n    this._internalRenderTask.cancel();\n  }\n\n}\n\nexports.RenderTask = RenderTask;\n\nclass InternalRenderTask {\n  static get canvasInUse() {\n    return (0, _util.shadow)(this, \"canvasInUse\", new WeakSet());\n  }\n\n  constructor({\n    callback,\n    params,\n    objs,\n    commonObjs,\n    annotationCanvasMap,\n    operatorList,\n    pageIndex,\n    canvasFactory,\n    useRequestAnimationFrame = false,\n    pdfBug = false\n  }) {\n    this.callback = callback;\n    this.params = params;\n    this.objs = objs;\n    this.commonObjs = commonObjs;\n    this.annotationCanvasMap = annotationCanvasMap;\n    this.operatorListIdx = null;\n    this.operatorList = operatorList;\n    this._pageIndex = pageIndex;\n    this.canvasFactory = canvasFactory;\n    this._pdfBug = pdfBug;\n    this.running = false;\n    this.graphicsReadyCallback = null;\n    this.graphicsReady = false;\n    this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== \"undefined\";\n    this.cancelled = false;\n    this.capability = (0, _util.createPromiseCapability)();\n    this.task = new RenderTask(this);\n    this._cancelBound = this.cancel.bind(this);\n    this._continueBound = this._continue.bind(this);\n    this._scheduleNextBound = this._scheduleNext.bind(this);\n    this._nextBound = this._next.bind(this);\n    this._canvas = params.canvasContext.canvas;\n  }\n\n  get completed() {\n    return this.capability.promise.catch(function () {});\n  }\n\n  initializeGraphics({\n    transparency = false,\n    optionalContentConfig\n  }) {\n    if (this.cancelled) {\n      return;\n    }\n\n    if (this._canvas) {\n      if (InternalRenderTask.canvasInUse.has(this._canvas)) {\n        throw new Error(\"Cannot use the same canvas during multiple render() operations. \" + \"Use different canvas or ensure previous operations were \" + \"cancelled or completed.\");\n      }\n\n      InternalRenderTask.canvasInUse.add(this._canvas);\n    }\n\n    if (this._pdfBug && globalThis.StepperManager?.enabled) {\n      this.stepper = globalThis.StepperManager.create(this._pageIndex);\n      this.stepper.init(this.operatorList);\n      this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();\n    }\n\n    const {\n      canvasContext,\n      viewport,\n      transform,\n      imageLayer,\n      background\n    } = this.params;\n    this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, imageLayer, optionalContentConfig, this.annotationCanvasMap);\n    this.gfx.beginDrawing({\n      transform,\n      viewport,\n      transparency,\n      background\n    });\n    this.operatorListIdx = 0;\n    this.graphicsReady = true;\n\n    if (this.graphicsReadyCallback) {\n      this.graphicsReadyCallback();\n    }\n  }\n\n  cancel(error = null) {\n    this.running = false;\n    this.cancelled = true;\n\n    if (this.gfx) {\n      this.gfx.endDrawing();\n    }\n\n    if (this._canvas) {\n      InternalRenderTask.canvasInUse.delete(this._canvas);\n    }\n\n    this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, \"canvas\"));\n  }\n\n  operatorListChanged() {\n    if (!this.graphicsReady) {\n      if (!this.graphicsReadyCallback) {\n        this.graphicsReadyCallback = this._continueBound;\n      }\n\n      return;\n    }\n\n    if (this.stepper) {\n      this.stepper.updateOperatorList(this.operatorList);\n    }\n\n    if (this.running) {\n      return;\n    }\n\n    this._continue();\n  }\n\n  _continue() {\n    this.running = true;\n\n    if (this.cancelled) {\n      return;\n    }\n\n    if (this.task.onContinue) {\n      this.task.onContinue(this._scheduleNextBound);\n    } else {\n      this._scheduleNext();\n    }\n  }\n\n  _scheduleNext() {\n    if (this._useRequestAnimationFrame) {\n      window.requestAnimationFrame(() => {\n        this._nextBound().catch(this._cancelBound);\n      });\n    } else {\n      Promise.resolve().then(this._nextBound).catch(this._cancelBound);\n    }\n  }\n\n  async _next() {\n    if (this.cancelled) {\n      return;\n    }\n\n    this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);\n\n    if (this.operatorListIdx === this.operatorList.argsArray.length) {\n      this.running = false;\n\n      if (this.operatorList.lastChunk) {\n        this.gfx.endDrawing();\n\n        if (this._canvas) {\n          InternalRenderTask.canvasInUse.delete(this._canvas);\n        }\n\n        this.callback();\n      }\n    }\n  }\n\n}\n\nconst version = '2.13.216';\nexports.version = version;\nconst build = '399a0ec60';\nexports.build = build;\n\n/***/ }),\n/* 5 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = exports.PDFDateString = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = void 0;\nexports.deprecated = deprecated;\nexports.getFilenameFromUrl = getFilenameFromUrl;\nexports.getPdfFilenameFromUrl = getPdfFilenameFromUrl;\nexports.getXfaPageViewport = getXfaPageViewport;\nexports.isDataScheme = isDataScheme;\nexports.isPdfFile = isPdfFile;\nexports.isValidFetchUrl = isValidFetchUrl;\nexports.loadScript = loadScript;\n\nvar _base_factory = __w_pdfjs_require__(6);\n\nvar _util = __w_pdfjs_require__(1);\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nclass PixelsPerInch {\n  static CSS = 96.0;\n  static PDF = 72.0;\n  static PDF_TO_CSS_UNITS = this.CSS / this.PDF;\n}\n\nexports.PixelsPerInch = PixelsPerInch;\n\nclass DOMCanvasFactory extends _base_factory.BaseCanvasFactory {\n  constructor({\n    ownerDocument = globalThis.document\n  } = {}) {\n    super();\n    this._document = ownerDocument;\n  }\n\n  _createCanvas(width, height) {\n    const canvas = this._document.createElement(\"canvas\");\n\n    canvas.width = width;\n    canvas.height = height;\n    return canvas;\n  }\n\n}\n\nexports.DOMCanvasFactory = DOMCanvasFactory;\n\nasync function fetchData(url, asTypedArray = false) {\n  if (isValidFetchUrl(url, document.baseURI)) {\n    const response = await fetch(url);\n\n    if (!response.ok) {\n      throw new Error(response.statusText);\n    }\n\n    return asTypedArray ? new Uint8Array(await response.arrayBuffer()) : (0, _util.stringToBytes)(await response.text());\n  }\n\n  return new Promise((resolve, reject) => {\n    const request = new XMLHttpRequest();\n    request.open(\"GET\", url, true);\n\n    if (asTypedArray) {\n      request.responseType = \"arraybuffer\";\n    }\n\n    request.onreadystatechange = () => {\n      if (request.readyState !== XMLHttpRequest.DONE) {\n        return;\n      }\n\n      if (request.status === 200 || request.status === 0) {\n        let data;\n\n        if (asTypedArray && request.response) {\n          data = new Uint8Array(request.response);\n        } else if (!asTypedArray && request.responseText) {\n          data = (0, _util.stringToBytes)(request.responseText);\n        }\n\n        if (data) {\n          resolve(data);\n          return;\n        }\n      }\n\n      reject(new Error(request.statusText));\n    };\n\n    request.send(null);\n  });\n}\n\nclass DOMCMapReaderFactory extends _base_factory.BaseCMapReaderFactory {\n  _fetchData(url, compressionType) {\n    return fetchData(url, this.isCompressed).then(data => {\n      return {\n        cMapData: data,\n        compressionType\n      };\n    });\n  }\n\n}\n\nexports.DOMCMapReaderFactory = DOMCMapReaderFactory;\n\nclass DOMStandardFontDataFactory extends _base_factory.BaseStandardFontDataFactory {\n  _fetchData(url) {\n    return fetchData(url, true);\n  }\n\n}\n\nexports.DOMStandardFontDataFactory = DOMStandardFontDataFactory;\n\nclass DOMSVGFactory extends _base_factory.BaseSVGFactory {\n  _createSVG(type) {\n    return document.createElementNS(SVG_NS, type);\n  }\n\n}\n\nexports.DOMSVGFactory = DOMSVGFactory;\n\nclass PageViewport {\n  constructor({\n    viewBox,\n    scale,\n    rotation,\n    offsetX = 0,\n    offsetY = 0,\n    dontFlip = false\n  }) {\n    this.viewBox = viewBox;\n    this.scale = scale;\n    this.rotation = rotation;\n    this.offsetX = offsetX;\n    this.offsetY = offsetY;\n    const centerX = (viewBox[2] + viewBox[0]) / 2;\n    const centerY = (viewBox[3] + viewBox[1]) / 2;\n    let rotateA, rotateB, rotateC, rotateD;\n    rotation %= 360;\n\n    if (rotation < 0) {\n      rotation += 360;\n    }\n\n    switch (rotation) {\n      case 180:\n        rotateA = -1;\n        rotateB = 0;\n        rotateC = 0;\n        rotateD = 1;\n        break;\n\n      case 90:\n        rotateA = 0;\n        rotateB = 1;\n        rotateC = 1;\n        rotateD = 0;\n        break;\n\n      case 270:\n        rotateA = 0;\n        rotateB = -1;\n        rotateC = -1;\n        rotateD = 0;\n        break;\n\n      case 0:\n        rotateA = 1;\n        rotateB = 0;\n        rotateC = 0;\n        rotateD = -1;\n        break;\n\n      default:\n        throw new Error(\"PageViewport: Invalid rotation, must be a multiple of 90 degrees.\");\n    }\n\n    if (dontFlip) {\n      rotateC = -rotateC;\n      rotateD = -rotateD;\n    }\n\n    let offsetCanvasX, offsetCanvasY;\n    let width, height;\n\n    if (rotateA === 0) {\n      offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;\n      offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;\n      width = Math.abs(viewBox[3] - viewBox[1]) * scale;\n      height = Math.abs(viewBox[2] - viewBox[0]) * scale;\n    } else {\n      offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;\n      offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;\n      width = Math.abs(viewBox[2] - viewBox[0]) * scale;\n      height = Math.abs(viewBox[3] - viewBox[1]) * scale;\n    }\n\n    this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];\n    this.width = width;\n    this.height = height;\n  }\n\n  clone({\n    scale = this.scale,\n    rotation = this.rotation,\n    offsetX = this.offsetX,\n    offsetY = this.offsetY,\n    dontFlip = false\n  } = {}) {\n    return new PageViewport({\n      viewBox: this.viewBox.slice(),\n      scale,\n      rotation,\n      offsetX,\n      offsetY,\n      dontFlip\n    });\n  }\n\n  convertToViewportPoint(x, y) {\n    return _util.Util.applyTransform([x, y], this.transform);\n  }\n\n  convertToViewportRectangle(rect) {\n    const topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform);\n\n    const bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform);\n\n    return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];\n  }\n\n  convertToPdfPoint(x, y) {\n    return _util.Util.applyInverseTransform([x, y], this.transform);\n  }\n\n}\n\nexports.PageViewport = PageViewport;\n\nclass RenderingCancelledException extends _util.BaseException {\n  constructor(msg, type) {\n    super(msg, \"RenderingCancelledException\");\n    this.type = type;\n  }\n\n}\n\nexports.RenderingCancelledException = RenderingCancelledException;\n\nfunction isDataScheme(url) {\n  const ii = url.length;\n  let i = 0;\n\n  while (i < ii && url[i].trim() === \"\") {\n    i++;\n  }\n\n  return url.substring(i, i + 5).toLowerCase() === \"data:\";\n}\n\nfunction isPdfFile(filename) {\n  return typeof filename === \"string\" && /\\.pdf$/i.test(filename);\n}\n\nfunction getFilenameFromUrl(url) {\n  const anchor = url.indexOf(\"#\");\n  const query = url.indexOf(\"?\");\n  const end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);\n  return url.substring(url.lastIndexOf(\"/\", end) + 1, end);\n}\n\nfunction getPdfFilenameFromUrl(url, defaultFilename = \"document.pdf\") {\n  if (typeof url !== \"string\") {\n    return defaultFilename;\n  }\n\n  if (isDataScheme(url)) {\n    (0, _util.warn)('getPdfFilenameFromUrl: ignore \"data:\"-URL for performance reasons.');\n    return defaultFilename;\n  }\n\n  const reURI = /^(?:(?:[^:]+:)?\\/\\/[^/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n  const reFilename = /[^/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n  const splitURI = reURI.exec(url);\n  let suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);\n\n  if (suggestedFilename) {\n    suggestedFilename = suggestedFilename[0];\n\n    if (suggestedFilename.includes(\"%\")) {\n      try {\n        suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];\n      } catch (ex) {}\n    }\n  }\n\n  return suggestedFilename || defaultFilename;\n}\n\nclass StatTimer {\n  constructor() {\n    this.started = Object.create(null);\n    this.times = [];\n  }\n\n  time(name) {\n    if (name in this.started) {\n      (0, _util.warn)(`Timer is already running for ${name}`);\n    }\n\n    this.started[name] = Date.now();\n  }\n\n  timeEnd(name) {\n    if (!(name in this.started)) {\n      (0, _util.warn)(`Timer has not been started for ${name}`);\n    }\n\n    this.times.push({\n      name,\n      start: this.started[name],\n      end: Date.now()\n    });\n    delete this.started[name];\n  }\n\n  toString() {\n    const outBuf = [];\n    let longest = 0;\n\n    for (const time of this.times) {\n      const name = time.name;\n\n      if (name.length > longest) {\n        longest = name.length;\n      }\n    }\n\n    for (const time of this.times) {\n      const duration = time.end - time.start;\n      outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\\n`);\n    }\n\n    return outBuf.join(\"\");\n  }\n\n}\n\nexports.StatTimer = StatTimer;\n\nfunction isValidFetchUrl(url, baseUrl) {\n  try {\n    const {\n      protocol\n    } = baseUrl ? new URL(url, baseUrl) : new URL(url);\n    return protocol === \"http:\" || protocol === \"https:\";\n  } catch (ex) {\n    return false;\n  }\n}\n\nfunction loadScript(src, removeScriptElement = false) {\n  return new Promise((resolve, reject) => {\n    const script = document.createElement(\"script\");\n    script.src = src;\n\n    script.onload = function (evt) {\n      if (removeScriptElement) {\n        script.remove();\n      }\n\n      resolve(evt);\n    };\n\n    script.onerror = function () {\n      reject(new Error(`Cannot load script at: ${script.src}`));\n    };\n\n    (document.head || document.documentElement).appendChild(script);\n  });\n}\n\nfunction deprecated(details) {\n  console.log(\"Deprecated API usage: \" + details);\n}\n\nlet pdfDateStringRegex;\n\nclass PDFDateString {\n  static toDateObject(input) {\n    if (!input || typeof input !== \"string\") {\n      return null;\n    }\n\n    if (!pdfDateStringRegex) {\n      pdfDateStringRegex = new RegExp(\"^D:\" + \"(\\\\d{4})\" + \"(\\\\d{2})?\" + \"(\\\\d{2})?\" + \"(\\\\d{2})?\" + \"(\\\\d{2})?\" + \"(\\\\d{2})?\" + \"([Z|+|-])?\" + \"(\\\\d{2})?\" + \"'?\" + \"(\\\\d{2})?\" + \"'?\");\n    }\n\n    const matches = pdfDateStringRegex.exec(input);\n\n    if (!matches) {\n      return null;\n    }\n\n    const year = parseInt(matches[1], 10);\n    let month = parseInt(matches[2], 10);\n    month = month >= 1 && month <= 12 ? month - 1 : 0;\n    let day = parseInt(matches[3], 10);\n    day = day >= 1 && day <= 31 ? day : 1;\n    let hour = parseInt(matches[4], 10);\n    hour = hour >= 0 && hour <= 23 ? hour : 0;\n    let minute = parseInt(matches[5], 10);\n    minute = minute >= 0 && minute <= 59 ? minute : 0;\n    let second = parseInt(matches[6], 10);\n    second = second >= 0 && second <= 59 ? second : 0;\n    const universalTimeRelation = matches[7] || \"Z\";\n    let offsetHour = parseInt(matches[8], 10);\n    offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;\n    let offsetMinute = parseInt(matches[9], 10) || 0;\n    offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;\n\n    if (universalTimeRelation === \"-\") {\n      hour += offsetHour;\n      minute += offsetMinute;\n    } else if (universalTimeRelation === \"+\") {\n      hour -= offsetHour;\n      minute -= offsetMinute;\n    }\n\n    return new Date(Date.UTC(year, month, day, hour, minute, second));\n  }\n\n}\n\nexports.PDFDateString = PDFDateString;\n\nfunction getXfaPageViewport(xfaPage, {\n  scale = 1,\n  rotation = 0\n}) {\n  const {\n    width,\n    height\n  } = xfaPage.attributes.style;\n  const viewBox = [0, 0, parseInt(width), parseInt(height)];\n  return new PageViewport({\n    viewBox,\n    scale,\n    rotation\n  });\n}\n\n/***/ }),\n/* 6 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseCanvasFactory = exports.BaseCMapReaderFactory = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nclass BaseCanvasFactory {\n  constructor() {\n    if (this.constructor === BaseCanvasFactory) {\n      (0, _util.unreachable)(\"Cannot initialize BaseCanvasFactory.\");\n    }\n  }\n\n  create(width, height) {\n    if (width <= 0 || height <= 0) {\n      throw new Error(\"Invalid canvas size\");\n    }\n\n    const canvas = this._createCanvas(width, height);\n\n    return {\n      canvas,\n      context: canvas.getContext(\"2d\")\n    };\n  }\n\n  reset(canvasAndContext, width, height) {\n    if (!canvasAndContext.canvas) {\n      throw new Error(\"Canvas is not specified\");\n    }\n\n    if (width <= 0 || height <= 0) {\n      throw new Error(\"Invalid canvas size\");\n    }\n\n    canvasAndContext.canvas.width = width;\n    canvasAndContext.canvas.height = height;\n  }\n\n  destroy(canvasAndContext) {\n    if (!canvasAndContext.canvas) {\n      throw new Error(\"Canvas is not specified\");\n    }\n\n    canvasAndContext.canvas.width = 0;\n    canvasAndContext.canvas.height = 0;\n    canvasAndContext.canvas = null;\n    canvasAndContext.context = null;\n  }\n\n  _createCanvas(width, height) {\n    (0, _util.unreachable)(\"Abstract method `_createCanvas` called.\");\n  }\n\n}\n\nexports.BaseCanvasFactory = BaseCanvasFactory;\n\nclass BaseCMapReaderFactory {\n  constructor({\n    baseUrl = null,\n    isCompressed = false\n  }) {\n    if (this.constructor === BaseCMapReaderFactory) {\n      (0, _util.unreachable)(\"Cannot initialize BaseCMapReaderFactory.\");\n    }\n\n    this.baseUrl = baseUrl;\n    this.isCompressed = isCompressed;\n  }\n\n  async fetch({\n    name\n  }) {\n    if (!this.baseUrl) {\n      throw new Error('The CMap \"baseUrl\" parameter must be specified, ensure that ' + 'the \"cMapUrl\" and \"cMapPacked\" API parameters are provided.');\n    }\n\n    if (!name) {\n      throw new Error(\"CMap name must be specified.\");\n    }\n\n    const url = this.baseUrl + name + (this.isCompressed ? \".bcmap\" : \"\");\n    const compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE;\n    return this._fetchData(url, compressionType).catch(reason => {\n      throw new Error(`Unable to load ${this.isCompressed ? \"binary \" : \"\"}CMap at: ${url}`);\n    });\n  }\n\n  _fetchData(url, compressionType) {\n    (0, _util.unreachable)(\"Abstract method `_fetchData` called.\");\n  }\n\n}\n\nexports.BaseCMapReaderFactory = BaseCMapReaderFactory;\n\nclass BaseStandardFontDataFactory {\n  constructor({\n    baseUrl = null\n  }) {\n    if (this.constructor === BaseStandardFontDataFactory) {\n      (0, _util.unreachable)(\"Cannot initialize BaseStandardFontDataFactory.\");\n    }\n\n    this.baseUrl = baseUrl;\n  }\n\n  async fetch({\n    filename\n  }) {\n    if (!this.baseUrl) {\n      throw new Error('The standard font \"baseUrl\" parameter must be specified, ensure that ' + 'the \"standardFontDataUrl\" API parameter is provided.');\n    }\n\n    if (!filename) {\n      throw new Error(\"Font filename must be specified.\");\n    }\n\n    const url = `${this.baseUrl}${filename}`;\n    return this._fetchData(url).catch(reason => {\n      throw new Error(`Unable to load font data at: ${url}`);\n    });\n  }\n\n  _fetchData(url) {\n    (0, _util.unreachable)(\"Abstract method `_fetchData` called.\");\n  }\n\n}\n\nexports.BaseStandardFontDataFactory = BaseStandardFontDataFactory;\n\nclass BaseSVGFactory {\n  constructor() {\n    if (this.constructor === BaseSVGFactory) {\n      (0, _util.unreachable)(\"Cannot initialize BaseSVGFactory.\");\n    }\n  }\n\n  create(width, height) {\n    if (width <= 0 || height <= 0) {\n      throw new Error(\"Invalid SVG dimensions\");\n    }\n\n    const svg = this._createSVG(\"svg:svg\");\n\n    svg.setAttribute(\"version\", \"1.1\");\n    svg.setAttribute(\"width\", `${width}px`);\n    svg.setAttribute(\"height\", `${height}px`);\n    svg.setAttribute(\"preserveAspectRatio\", \"none\");\n    svg.setAttribute(\"viewBox\", `0 0 ${width} ${height}`);\n    return svg;\n  }\n\n  createElement(type) {\n    if (typeof type !== \"string\") {\n      throw new Error(\"Invalid SVG element type\");\n    }\n\n    return this._createSVG(type);\n  }\n\n  _createSVG(type) {\n    (0, _util.unreachable)(\"Abstract method `_createSVG` called.\");\n  }\n\n}\n\nexports.BaseSVGFactory = BaseSVGFactory;\n\n/***/ }),\n/* 7 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.FontLoader = exports.FontFaceObject = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nclass BaseFontLoader {\n  constructor({\n    docId,\n    onUnsupportedFeature,\n    ownerDocument = globalThis.document,\n    styleElement = null\n  }) {\n    if (this.constructor === BaseFontLoader) {\n      (0, _util.unreachable)(\"Cannot initialize BaseFontLoader.\");\n    }\n\n    this.docId = docId;\n    this._onUnsupportedFeature = onUnsupportedFeature;\n    this._document = ownerDocument;\n    this.nativeFontFaces = [];\n    this.styleElement = null;\n  }\n\n  addNativeFontFace(nativeFontFace) {\n    this.nativeFontFaces.push(nativeFontFace);\n\n    this._document.fonts.add(nativeFontFace);\n  }\n\n  insertRule(rule) {\n    let styleElement = this.styleElement;\n\n    if (!styleElement) {\n      styleElement = this.styleElement = this._document.createElement(\"style\");\n      styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`;\n\n      this._document.documentElement.getElementsByTagName(\"head\")[0].appendChild(styleElement);\n    }\n\n    const styleSheet = styleElement.sheet;\n    styleSheet.insertRule(rule, styleSheet.cssRules.length);\n  }\n\n  clear() {\n    for (const nativeFontFace of this.nativeFontFaces) {\n      this._document.fonts.delete(nativeFontFace);\n    }\n\n    this.nativeFontFaces.length = 0;\n\n    if (this.styleElement) {\n      this.styleElement.remove();\n      this.styleElement = null;\n    }\n  }\n\n  async bind(font) {\n    if (font.attached || font.missingFile) {\n      return;\n    }\n\n    font.attached = true;\n\n    if (this.isFontLoadingAPISupported) {\n      const nativeFontFace = font.createNativeFontFace();\n\n      if (nativeFontFace) {\n        this.addNativeFontFace(nativeFontFace);\n\n        try {\n          await nativeFontFace.loaded;\n        } catch (ex) {\n          this._onUnsupportedFeature({\n            featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative\n          });\n\n          (0, _util.warn)(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);\n          font.disableFontFace = true;\n          throw ex;\n        }\n      }\n\n      return;\n    }\n\n    const rule = font.createFontFaceRule();\n\n    if (rule) {\n      this.insertRule(rule);\n\n      if (this.isSyncFontLoadingSupported) {\n        return;\n      }\n\n      await new Promise(resolve => {\n        const request = this._queueLoadingCallback(resolve);\n\n        this._prepareFontLoadEvent([rule], [font], request);\n      });\n    }\n  }\n\n  _queueLoadingCallback(callback) {\n    (0, _util.unreachable)(\"Abstract method `_queueLoadingCallback`.\");\n  }\n\n  get isFontLoadingAPISupported() {\n    const hasFonts = !!this._document?.fonts;\n    return (0, _util.shadow)(this, \"isFontLoadingAPISupported\", hasFonts);\n  }\n\n  get isSyncFontLoadingSupported() {\n    (0, _util.unreachable)(\"Abstract method `isSyncFontLoadingSupported`.\");\n  }\n\n  get _loadTestFont() {\n    (0, _util.unreachable)(\"Abstract method `_loadTestFont`.\");\n  }\n\n  _prepareFontLoadEvent(rules, fontsToLoad, request) {\n    (0, _util.unreachable)(\"Abstract method `_prepareFontLoadEvent`.\");\n  }\n\n}\n\nlet FontLoader;\nexports.FontLoader = FontLoader;\n{\n  exports.FontLoader = FontLoader = class GenericFontLoader extends BaseFontLoader {\n    constructor(params) {\n      super(params);\n      this.loadingContext = {\n        requests: [],\n        nextRequestId: 0\n      };\n      this.loadTestFontId = 0;\n    }\n\n    get isSyncFontLoadingSupported() {\n      let supported = false;\n\n      if (typeof navigator === \"undefined\") {\n        supported = true;\n      } else {\n        const m = /Mozilla\\/5.0.*?rv:(\\d+).*? Gecko/.exec(navigator.userAgent);\n\n        if (m?.[1] >= 14) {\n          supported = true;\n        }\n      }\n\n      return (0, _util.shadow)(this, \"isSyncFontLoadingSupported\", supported);\n    }\n\n    _queueLoadingCallback(callback) {\n      function completeRequest() {\n        (0, _util.assert)(!request.done, \"completeRequest() cannot be called twice.\");\n        request.done = true;\n\n        while (context.requests.length > 0 && context.requests[0].done) {\n          const otherRequest = context.requests.shift();\n          setTimeout(otherRequest.callback, 0);\n        }\n      }\n\n      const context = this.loadingContext;\n      const request = {\n        id: `pdfjs-font-loading-${context.nextRequestId++}`,\n        done: false,\n        complete: completeRequest,\n        callback\n      };\n      context.requests.push(request);\n      return request;\n    }\n\n    get _loadTestFont() {\n      const getLoadTestFont = function () {\n        return atob(\"T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA\" + \"FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA\" + \"ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA\" + \"AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1\" + \"AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD\" + \"6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM\" + \"AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D\" + \"IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA\" + \"AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA\" + \"AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB\" + \"AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY\" + \"AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA\" + \"AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" + \"AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" + \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" + \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" + \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" + \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA\" + \"AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC\" + \"AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3\" + \"Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj\" + \"FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==\");\n      };\n\n      return (0, _util.shadow)(this, \"_loadTestFont\", getLoadTestFont());\n    }\n\n    _prepareFontLoadEvent(rules, fonts, request) {\n      function int32(data, offset) {\n        return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;\n      }\n\n      function spliceString(s, offset, remove, insert) {\n        const chunk1 = s.substring(0, offset);\n        const chunk2 = s.substring(offset + remove);\n        return chunk1 + insert + chunk2;\n      }\n\n      let i, ii;\n\n      const canvas = this._document.createElement(\"canvas\");\n\n      canvas.width = 1;\n      canvas.height = 1;\n      const ctx = canvas.getContext(\"2d\");\n      let called = 0;\n\n      function isFontReady(name, callback) {\n        called++;\n\n        if (called > 30) {\n          (0, _util.warn)(\"Load test font never loaded.\");\n          callback();\n          return;\n        }\n\n        ctx.font = \"30px \" + name;\n        ctx.fillText(\".\", 0, 20);\n        const imageData = ctx.getImageData(0, 0, 1, 1);\n\n        if (imageData.data[3] > 0) {\n          callback();\n          return;\n        }\n\n        setTimeout(isFontReady.bind(null, name, callback));\n      }\n\n      const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;\n      let data = this._loadTestFont;\n      const COMMENT_OFFSET = 976;\n      data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);\n      const CFF_CHECKSUM_OFFSET = 16;\n      const XXXX_VALUE = 0x58585858;\n      let checksum = int32(data, CFF_CHECKSUM_OFFSET);\n\n      for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {\n        checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;\n      }\n\n      if (i < loadTestFontId.length) {\n        checksum = checksum - XXXX_VALUE + int32(loadTestFontId + \"XXX\", i) | 0;\n      }\n\n      data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));\n      const url = `url(data:font/opentype;base64,${btoa(data)});`;\n      const rule = `@font-face {font-family:\"${loadTestFontId}\";src:${url}}`;\n      this.insertRule(rule);\n      const names = [];\n\n      for (const font of fonts) {\n        names.push(font.loadedName);\n      }\n\n      names.push(loadTestFontId);\n\n      const div = this._document.createElement(\"div\");\n\n      div.style.visibility = \"hidden\";\n      div.style.width = div.style.height = \"10px\";\n      div.style.position = \"absolute\";\n      div.style.top = div.style.left = \"0px\";\n\n      for (const name of names) {\n        const span = this._document.createElement(\"span\");\n\n        span.textContent = \"Hi\";\n        span.style.fontFamily = name;\n        div.appendChild(span);\n      }\n\n      this._document.body.appendChild(div);\n\n      isFontReady(loadTestFontId, () => {\n        div.remove();\n        request.complete();\n      });\n    }\n\n  };\n}\n\nclass FontFaceObject {\n  constructor(translatedData, {\n    isEvalSupported = true,\n    disableFontFace = false,\n    ignoreErrors = false,\n    onUnsupportedFeature,\n    fontRegistry = null\n  }) {\n    this.compiledGlyphs = Object.create(null);\n\n    for (const i in translatedData) {\n      this[i] = translatedData[i];\n    }\n\n    this.isEvalSupported = isEvalSupported !== false;\n    this.disableFontFace = disableFontFace === true;\n    this.ignoreErrors = ignoreErrors === true;\n    this._onUnsupportedFeature = onUnsupportedFeature;\n    this.fontRegistry = fontRegistry;\n  }\n\n  createNativeFontFace() {\n    if (!this.data || this.disableFontFace) {\n      return null;\n    }\n\n    let nativeFontFace;\n\n    if (!this.cssFontInfo) {\n      nativeFontFace = new FontFace(this.loadedName, this.data, {});\n    } else {\n      const css = {\n        weight: this.cssFontInfo.fontWeight\n      };\n\n      if (this.cssFontInfo.italicAngle) {\n        css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;\n      }\n\n      nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);\n    }\n\n    if (this.fontRegistry) {\n      this.fontRegistry.registerFont(this);\n    }\n\n    return nativeFontFace;\n  }\n\n  createFontFaceRule() {\n    if (!this.data || this.disableFontFace) {\n      return null;\n    }\n\n    const data = (0, _util.bytesToString)(this.data);\n    const url = `url(data:${this.mimetype};base64,${btoa(data)});`;\n    let rule;\n\n    if (!this.cssFontInfo) {\n      rule = `@font-face {font-family:\"${this.loadedName}\";src:${url}}`;\n    } else {\n      let css = `font-weight: ${this.cssFontInfo.fontWeight};`;\n\n      if (this.cssFontInfo.italicAngle) {\n        css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;\n      }\n\n      rule = `@font-face {font-family:\"${this.cssFontInfo.fontFamily}\";${css}src:${url}}`;\n    }\n\n    if (this.fontRegistry) {\n      this.fontRegistry.registerFont(this, url);\n    }\n\n    return rule;\n  }\n\n  getPathGenerator(objs, character) {\n    if (this.compiledGlyphs[character] !== undefined) {\n      return this.compiledGlyphs[character];\n    }\n\n    let cmds;\n\n    try {\n      cmds = objs.get(this.loadedName + \"_path_\" + character);\n    } catch (ex) {\n      if (!this.ignoreErrors) {\n        throw ex;\n      }\n\n      this._onUnsupportedFeature({\n        featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath\n      });\n\n      (0, _util.warn)(`getPathGenerator - ignoring character: \"${ex}\".`);\n      return this.compiledGlyphs[character] = function (c, size) {};\n    }\n\n    if (this.isEvalSupported && _util.IsEvalSupportedCached.value) {\n      const jsBuf = [];\n\n      for (const current of cmds) {\n        const args = current.args !== undefined ? current.args.join(\",\") : \"\";\n        jsBuf.push(\"c.\", current.cmd, \"(\", args, \");\\n\");\n      }\n\n      return this.compiledGlyphs[character] = new Function(\"c\", \"size\", jsBuf.join(\"\"));\n    }\n\n    return this.compiledGlyphs[character] = function (c, size) {\n      for (const current of cmds) {\n        if (current.cmd === \"scale\") {\n          current.args = [size, -size];\n        }\n\n        c[current.cmd].apply(c, current.args);\n      }\n    };\n  }\n\n}\n\nexports.FontFaceObject = FontFaceObject;\n\n/***/ }),\n/* 8 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.NodeStandardFontDataFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;\n\nvar _base_factory = __w_pdfjs_require__(6);\n\nvar _is_node = __w_pdfjs_require__(3);\n\nvar _util = __w_pdfjs_require__(1);\n\nlet NodeCanvasFactory = class {\n  constructor() {\n    (0, _util.unreachable)(\"Not implemented: NodeCanvasFactory\");\n  }\n\n};\nexports.NodeCanvasFactory = NodeCanvasFactory;\nlet NodeCMapReaderFactory = class {\n  constructor() {\n    (0, _util.unreachable)(\"Not implemented: NodeCMapReaderFactory\");\n  }\n\n};\nexports.NodeCMapReaderFactory = NodeCMapReaderFactory;\nlet NodeStandardFontDataFactory = class {\n  constructor() {\n    (0, _util.unreachable)(\"Not implemented: NodeStandardFontDataFactory\");\n  }\n\n};\nexports.NodeStandardFontDataFactory = NodeStandardFontDataFactory;\n\nif (_is_node.isNodeJS) {\n  const fetchData = function (url) {\n    return new Promise((resolve, reject) => {\n      const fs = __webpack_require__(/*! fs */ \"?fe90\");\n\n      fs.readFile(url, (error, data) => {\n        if (error || !data) {\n          reject(new Error(error));\n          return;\n        }\n\n        resolve(new Uint8Array(data));\n      });\n    });\n  };\n\n  exports.NodeCanvasFactory = NodeCanvasFactory = class extends _base_factory.BaseCanvasFactory {\n    _createCanvas(width, height) {\n      const Canvas = __webpack_require__(/*! canvas */ \"?4a14\");\n\n      return Canvas.createCanvas(width, height);\n    }\n\n  };\n  exports.NodeCMapReaderFactory = NodeCMapReaderFactory = class extends _base_factory.BaseCMapReaderFactory {\n    _fetchData(url, compressionType) {\n      return fetchData(url).then(data => {\n        return {\n          cMapData: data,\n          compressionType\n        };\n      });\n    }\n\n  };\n  exports.NodeStandardFontDataFactory = NodeStandardFontDataFactory = class extends _base_factory.BaseStandardFontDataFactory {\n    _fetchData(url) {\n      return fetchData(url);\n    }\n\n  };\n}\n\n/***/ }),\n/* 9 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.AnnotationStorage = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nclass AnnotationStorage {\n  constructor() {\n    this._storage = new Map();\n    this._timeStamp = Date.now();\n    this._modified = false;\n    this.onSetModified = null;\n    this.onResetModified = null;\n  }\n\n  getValue(key, defaultValue) {\n    const value = this._storage.get(key);\n\n    if (value === undefined) {\n      return defaultValue;\n    }\n\n    return Object.assign(defaultValue, value);\n  }\n\n  setValue(key, value) {\n    const obj = this._storage.get(key);\n\n    let modified = false;\n\n    if (obj !== undefined) {\n      for (const [entry, val] of Object.entries(value)) {\n        if (obj[entry] !== val) {\n          modified = true;\n          obj[entry] = val;\n        }\n      }\n    } else {\n      modified = true;\n\n      this._storage.set(key, value);\n    }\n\n    if (modified) {\n      this._timeStamp = Date.now();\n\n      this._setModified();\n    }\n  }\n\n  getAll() {\n    return this._storage.size > 0 ? (0, _util.objectFromMap)(this._storage) : null;\n  }\n\n  get size() {\n    return this._storage.size;\n  }\n\n  _setModified() {\n    if (!this._modified) {\n      this._modified = true;\n\n      if (typeof this.onSetModified === \"function\") {\n        this.onSetModified();\n      }\n    }\n  }\n\n  resetModified() {\n    if (this._modified) {\n      this._modified = false;\n\n      if (typeof this.onResetModified === \"function\") {\n        this.onResetModified();\n      }\n    }\n  }\n\n  get serializable() {\n    return this._storage.size > 0 ? this._storage : null;\n  }\n\n  get lastModified() {\n    return this._timeStamp.toString();\n  }\n\n}\n\nexports.AnnotationStorage = AnnotationStorage;\n\n/***/ }),\n/* 10 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.CanvasGraphics = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _pattern_helper = __w_pdfjs_require__(11);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nconst MIN_FONT_SIZE = 16;\nconst MAX_FONT_SIZE = 100;\nconst MAX_GROUP_SIZE = 4096;\nconst EXECUTION_TIME = 15;\nconst EXECUTION_STEPS = 10;\nconst COMPILE_TYPE3_GLYPHS = true;\nconst MAX_SIZE_TO_COMPILE = 1000;\nconst FULL_CHUNK_HEIGHT = 16;\nconst LINEWIDTH_SCALE_FACTOR = 1.000001;\n\nfunction mirrorContextOperations(ctx, destCtx) {\n  if (ctx._removeMirroring) {\n    throw new Error(\"Context is already forwarding operations.\");\n  }\n\n  ctx.__originalSave = ctx.save;\n  ctx.__originalRestore = ctx.restore;\n  ctx.__originalRotate = ctx.rotate;\n  ctx.__originalScale = ctx.scale;\n  ctx.__originalTranslate = ctx.translate;\n  ctx.__originalTransform = ctx.transform;\n  ctx.__originalSetTransform = ctx.setTransform;\n  ctx.__originalResetTransform = ctx.resetTransform;\n  ctx.__originalClip = ctx.clip;\n  ctx.__originalMoveTo = ctx.moveTo;\n  ctx.__originalLineTo = ctx.lineTo;\n  ctx.__originalBezierCurveTo = ctx.bezierCurveTo;\n  ctx.__originalRect = ctx.rect;\n  ctx.__originalClosePath = ctx.closePath;\n  ctx.__originalBeginPath = ctx.beginPath;\n\n  ctx._removeMirroring = () => {\n    ctx.save = ctx.__originalSave;\n    ctx.restore = ctx.__originalRestore;\n    ctx.rotate = ctx.__originalRotate;\n    ctx.scale = ctx.__originalScale;\n    ctx.translate = ctx.__originalTranslate;\n    ctx.transform = ctx.__originalTransform;\n    ctx.setTransform = ctx.__originalSetTransform;\n    ctx.resetTransform = ctx.__originalResetTransform;\n    ctx.clip = ctx.__originalClip;\n    ctx.moveTo = ctx.__originalMoveTo;\n    ctx.lineTo = ctx.__originalLineTo;\n    ctx.bezierCurveTo = ctx.__originalBezierCurveTo;\n    ctx.rect = ctx.__originalRect;\n    ctx.closePath = ctx.__originalClosePath;\n    ctx.beginPath = ctx.__originalBeginPath;\n    delete ctx._removeMirroring;\n  };\n\n  ctx.save = function ctxSave() {\n    destCtx.save();\n\n    this.__originalSave();\n  };\n\n  ctx.restore = function ctxRestore() {\n    destCtx.restore();\n\n    this.__originalRestore();\n  };\n\n  ctx.translate = function ctxTranslate(x, y) {\n    destCtx.translate(x, y);\n\n    this.__originalTranslate(x, y);\n  };\n\n  ctx.scale = function ctxScale(x, y) {\n    destCtx.scale(x, y);\n\n    this.__originalScale(x, y);\n  };\n\n  ctx.transform = function ctxTransform(a, b, c, d, e, f) {\n    destCtx.transform(a, b, c, d, e, f);\n\n    this.__originalTransform(a, b, c, d, e, f);\n  };\n\n  ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {\n    destCtx.setTransform(a, b, c, d, e, f);\n\n    this.__originalSetTransform(a, b, c, d, e, f);\n  };\n\n  ctx.resetTransform = function ctxResetTransform() {\n    destCtx.resetTransform();\n\n    this.__originalResetTransform();\n  };\n\n  ctx.rotate = function ctxRotate(angle) {\n    destCtx.rotate(angle);\n\n    this.__originalRotate(angle);\n  };\n\n  ctx.clip = function ctxRotate(rule) {\n    destCtx.clip(rule);\n\n    this.__originalClip(rule);\n  };\n\n  ctx.moveTo = function (x, y) {\n    destCtx.moveTo(x, y);\n\n    this.__originalMoveTo(x, y);\n  };\n\n  ctx.lineTo = function (x, y) {\n    destCtx.lineTo(x, y);\n\n    this.__originalLineTo(x, y);\n  };\n\n  ctx.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {\n    destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);\n\n    this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);\n  };\n\n  ctx.rect = function (x, y, width, height) {\n    destCtx.rect(x, y, width, height);\n\n    this.__originalRect(x, y, width, height);\n  };\n\n  ctx.closePath = function () {\n    destCtx.closePath();\n\n    this.__originalClosePath();\n  };\n\n  ctx.beginPath = function () {\n    destCtx.beginPath();\n\n    this.__originalBeginPath();\n  };\n}\n\nfunction addContextCurrentTransform(ctx) {\n  if (ctx._transformStack) {\n    ctx._transformStack = [];\n  }\n\n  if (ctx.mozCurrentTransform) {\n    return;\n  }\n\n  ctx._originalSave = ctx.save;\n  ctx._originalRestore = ctx.restore;\n  ctx._originalRotate = ctx.rotate;\n  ctx._originalScale = ctx.scale;\n  ctx._originalTranslate = ctx.translate;\n  ctx._originalTransform = ctx.transform;\n  ctx._originalSetTransform = ctx.setTransform;\n  ctx._originalResetTransform = ctx.resetTransform;\n  ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];\n  ctx._transformStack = [];\n\n  try {\n    const desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(ctx), \"lineWidth\");\n    ctx._setLineWidth = desc.set;\n    ctx._getLineWidth = desc.get;\n    Object.defineProperty(ctx, \"lineWidth\", {\n      set: function setLineWidth(width) {\n        this._setLineWidth(width * LINEWIDTH_SCALE_FACTOR);\n      },\n      get: function getLineWidth() {\n        return this._getLineWidth();\n      }\n    });\n  } catch (_) {}\n\n  Object.defineProperty(ctx, \"mozCurrentTransform\", {\n    get: function getCurrentTransform() {\n      return this._transformMatrix;\n    }\n  });\n  Object.defineProperty(ctx, \"mozCurrentTransformInverse\", {\n    get: function getCurrentTransformInverse() {\n      const [a, b, c, d, e, f] = this._transformMatrix;\n      const ad_bc = a * d - b * c;\n      const bc_ad = b * c - a * d;\n      return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc];\n    }\n  });\n\n  ctx.save = function ctxSave() {\n    const old = this._transformMatrix;\n\n    this._transformStack.push(old);\n\n    this._transformMatrix = old.slice(0, 6);\n\n    this._originalSave();\n  };\n\n  ctx.restore = function ctxRestore() {\n    if (this._transformStack.length === 0) {\n      (0, _util.warn)(\"Tried to restore a ctx when the stack was already empty.\");\n    }\n\n    const prev = this._transformStack.pop();\n\n    if (prev) {\n      this._transformMatrix = prev;\n\n      this._originalRestore();\n    }\n  };\n\n  ctx.translate = function ctxTranslate(x, y) {\n    const m = this._transformMatrix;\n    m[4] = m[0] * x + m[2] * y + m[4];\n    m[5] = m[1] * x + m[3] * y + m[5];\n\n    this._originalTranslate(x, y);\n  };\n\n  ctx.scale = function ctxScale(x, y) {\n    const m = this._transformMatrix;\n    m[0] *= x;\n    m[1] *= x;\n    m[2] *= y;\n    m[3] *= y;\n\n    this._originalScale(x, y);\n  };\n\n  ctx.transform = function ctxTransform(a, b, c, d, e, f) {\n    const m = this._transformMatrix;\n    this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]];\n\n    ctx._originalTransform(a, b, c, d, e, f);\n  };\n\n  ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {\n    this._transformMatrix = [a, b, c, d, e, f];\n\n    ctx._originalSetTransform(a, b, c, d, e, f);\n  };\n\n  ctx.resetTransform = function ctxResetTransform() {\n    this._transformMatrix = [1, 0, 0, 1, 0, 0];\n\n    ctx._originalResetTransform();\n  };\n\n  ctx.rotate = function ctxRotate(angle) {\n    const cosValue = Math.cos(angle);\n    const sinValue = Math.sin(angle);\n    const m = this._transformMatrix;\n    this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]];\n\n    this._originalRotate(angle);\n  };\n}\n\nclass CachedCanvases {\n  constructor(canvasFactory) {\n    this.canvasFactory = canvasFactory;\n    this.cache = Object.create(null);\n  }\n\n  getCanvas(id, width, height, trackTransform) {\n    let canvasEntry;\n\n    if (this.cache[id] !== undefined) {\n      canvasEntry = this.cache[id];\n      this.canvasFactory.reset(canvasEntry, width, height);\n      canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);\n    } else {\n      canvasEntry = this.canvasFactory.create(width, height);\n      this.cache[id] = canvasEntry;\n    }\n\n    if (trackTransform) {\n      addContextCurrentTransform(canvasEntry.context);\n    }\n\n    return canvasEntry;\n  }\n\n  clear() {\n    for (const id in this.cache) {\n      const canvasEntry = this.cache[id];\n      this.canvasFactory.destroy(canvasEntry);\n      delete this.cache[id];\n    }\n  }\n\n}\n\nfunction compileType3Glyph(imgData) {\n  const POINT_TO_PROCESS_LIMIT = 1000;\n  const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);\n  const width = imgData.width,\n        height = imgData.height,\n        width1 = width + 1;\n  let i, ii, j, j0;\n  const points = new Uint8Array(width1 * (height + 1));\n  const lineSize = width + 7 & ~7,\n        data0 = imgData.data;\n  const data = new Uint8Array(lineSize * height);\n  let pos = 0;\n\n  for (i = 0, ii = data0.length; i < ii; i++) {\n    const elem = data0[i];\n    let mask = 128;\n\n    while (mask > 0) {\n      data[pos++] = elem & mask ? 0 : 255;\n      mask >>= 1;\n    }\n  }\n\n  let count = 0;\n  pos = 0;\n\n  if (data[pos] !== 0) {\n    points[0] = 1;\n    ++count;\n  }\n\n  for (j = 1; j < width; j++) {\n    if (data[pos] !== data[pos + 1]) {\n      points[j] = data[pos] ? 2 : 1;\n      ++count;\n    }\n\n    pos++;\n  }\n\n  if (data[pos] !== 0) {\n    points[j] = 2;\n    ++count;\n  }\n\n  for (i = 1; i < height; i++) {\n    pos = i * lineSize;\n    j0 = i * width1;\n\n    if (data[pos - lineSize] !== data[pos]) {\n      points[j0] = data[pos] ? 1 : 8;\n      ++count;\n    }\n\n    let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);\n\n    for (j = 1; j < width; j++) {\n      sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);\n\n      if (POINT_TYPES[sum]) {\n        points[j0 + j] = POINT_TYPES[sum];\n        ++count;\n      }\n\n      pos++;\n    }\n\n    if (data[pos - lineSize] !== data[pos]) {\n      points[j0 + j] = data[pos] ? 2 : 4;\n      ++count;\n    }\n\n    if (count > POINT_TO_PROCESS_LIMIT) {\n      return null;\n    }\n  }\n\n  pos = lineSize * (height - 1);\n  j0 = i * width1;\n\n  if (data[pos] !== 0) {\n    points[j0] = 8;\n    ++count;\n  }\n\n  for (j = 1; j < width; j++) {\n    if (data[pos] !== data[pos + 1]) {\n      points[j0 + j] = data[pos] ? 4 : 8;\n      ++count;\n    }\n\n    pos++;\n  }\n\n  if (data[pos] !== 0) {\n    points[j0 + j] = 4;\n    ++count;\n  }\n\n  if (count > POINT_TO_PROCESS_LIMIT) {\n    return null;\n  }\n\n  const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);\n  const outlines = [];\n\n  for (i = 0; count && i <= height; i++) {\n    let p = i * width1;\n    const end = p + width;\n\n    while (p < end && !points[p]) {\n      p++;\n    }\n\n    if (p === end) {\n      continue;\n    }\n\n    const coords = [p % width1, i];\n    const p0 = p;\n    let type = points[p];\n\n    do {\n      const step = steps[type];\n\n      do {\n        p += step;\n      } while (!points[p]);\n\n      const pp = points[p];\n\n      if (pp !== 5 && pp !== 10) {\n        type = pp;\n        points[p] = 0;\n      } else {\n        type = pp & 0x33 * type >> 4;\n        points[p] &= type >> 2 | type << 2;\n      }\n\n      coords.push(p % width1, p / width1 | 0);\n\n      if (!points[p]) {\n        --count;\n      }\n    } while (p0 !== p);\n\n    outlines.push(coords);\n    --i;\n  }\n\n  const drawOutline = function (c) {\n    c.save();\n    c.scale(1 / width, -1 / height);\n    c.translate(0, -height);\n    c.beginPath();\n\n    for (let k = 0, kk = outlines.length; k < kk; k++) {\n      const o = outlines[k];\n      c.moveTo(o[0], o[1]);\n\n      for (let l = 2, ll = o.length; l < ll; l += 2) {\n        c.lineTo(o[l], o[l + 1]);\n      }\n    }\n\n    c.fill();\n    c.beginPath();\n    c.restore();\n  };\n\n  return drawOutline;\n}\n\nclass CanvasExtraState {\n  constructor(width, height) {\n    this.alphaIsShape = false;\n    this.fontSize = 0;\n    this.fontSizeScale = 1;\n    this.textMatrix = _util.IDENTITY_MATRIX;\n    this.textMatrixScale = 1;\n    this.fontMatrix = _util.FONT_IDENTITY_MATRIX;\n    this.leading = 0;\n    this.x = 0;\n    this.y = 0;\n    this.lineX = 0;\n    this.lineY = 0;\n    this.charSpacing = 0;\n    this.wordSpacing = 0;\n    this.textHScale = 1;\n    this.textRenderingMode = _util.TextRenderingMode.FILL;\n    this.textRise = 0;\n    this.fillColor = \"#000000\";\n    this.strokeColor = \"#000000\";\n    this.patternFill = false;\n    this.fillAlpha = 1;\n    this.strokeAlpha = 1;\n    this.lineWidth = 1;\n    this.activeSMask = null;\n    this.transferMaps = null;\n    this.startNewPathAndClipBox([0, 0, width, height]);\n  }\n\n  clone() {\n    const clone = Object.create(this);\n    clone.clipBox = this.clipBox.slice();\n    return clone;\n  }\n\n  setCurrentPoint(x, y) {\n    this.x = x;\n    this.y = y;\n  }\n\n  updatePathMinMax(transform, x, y) {\n    [x, y] = _util.Util.applyTransform([x, y], transform);\n    this.minX = Math.min(this.minX, x);\n    this.minY = Math.min(this.minY, y);\n    this.maxX = Math.max(this.maxX, x);\n    this.maxY = Math.max(this.maxY, y);\n  }\n\n  updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3) {\n    const box = _util.Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3);\n\n    this.updatePathMinMax(transform, box[0], box[1]);\n    this.updatePathMinMax(transform, box[2], box[3]);\n  }\n\n  getPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {\n    const box = [this.minX, this.minY, this.maxX, this.maxY];\n\n    if (pathType === _pattern_helper.PathType.STROKE) {\n      if (!transform) {\n        (0, _util.unreachable)(\"Stroke bounding box must include transform.\");\n      }\n\n      const scale = _util.Util.singularValueDecompose2dScale(transform);\n\n      const xStrokePad = scale[0] * this.lineWidth / 2;\n      const yStrokePad = scale[1] * this.lineWidth / 2;\n      box[0] -= xStrokePad;\n      box[1] -= yStrokePad;\n      box[2] += xStrokePad;\n      box[3] += yStrokePad;\n    }\n\n    return box;\n  }\n\n  updateClipFromPath() {\n    const intersect = _util.Util.intersect(this.clipBox, this.getPathBoundingBox());\n\n    this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);\n  }\n\n  startNewPathAndClipBox(box) {\n    this.clipBox = box;\n    this.minX = Infinity;\n    this.minY = Infinity;\n    this.maxX = 0;\n    this.maxY = 0;\n  }\n\n  getClippedPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {\n    return _util.Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));\n  }\n\n}\n\nfunction putBinaryImageData(ctx, imgData, transferMaps = null) {\n  if (typeof ImageData !== \"undefined\" && imgData instanceof ImageData) {\n    ctx.putImageData(imgData, 0, 0);\n    return;\n  }\n\n  const height = imgData.height,\n        width = imgData.width;\n  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n  let srcPos = 0,\n      destPos;\n  const src = imgData.data;\n  const dest = chunkImgData.data;\n  let i, j, thisChunkHeight, elemsInThisChunk;\n  let transferMapRed, transferMapGreen, transferMapBlue, transferMapGray;\n\n  if (transferMaps) {\n    switch (transferMaps.length) {\n      case 1:\n        transferMapRed = transferMaps[0];\n        transferMapGreen = transferMaps[0];\n        transferMapBlue = transferMaps[0];\n        transferMapGray = transferMaps[0];\n        break;\n\n      case 4:\n        transferMapRed = transferMaps[0];\n        transferMapGreen = transferMaps[1];\n        transferMapBlue = transferMaps[2];\n        transferMapGray = transferMaps[3];\n        break;\n    }\n  }\n\n  if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {\n    const srcLength = src.byteLength;\n    const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);\n    const dest32DataLength = dest32.length;\n    const fullSrcDiff = width + 7 >> 3;\n    let white = 0xffffffff;\n    let black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;\n\n    if (transferMapGray) {\n      if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {\n        [white, black] = [black, white];\n      }\n    }\n\n    for (i = 0; i < totalChunks; i++) {\n      thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;\n      destPos = 0;\n\n      for (j = 0; j < thisChunkHeight; j++) {\n        const srcDiff = srcLength - srcPos;\n        let k = 0;\n        const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;\n        const kEndUnrolled = kEnd & ~7;\n        let mask = 0;\n        let srcByte = 0;\n\n        for (; k < kEndUnrolled; k += 8) {\n          srcByte = src[srcPos++];\n          dest32[destPos++] = srcByte & 128 ? white : black;\n          dest32[destPos++] = srcByte & 64 ? white : black;\n          dest32[destPos++] = srcByte & 32 ? white : black;\n          dest32[destPos++] = srcByte & 16 ? white : black;\n          dest32[destPos++] = srcByte & 8 ? white : black;\n          dest32[destPos++] = srcByte & 4 ? white : black;\n          dest32[destPos++] = srcByte & 2 ? white : black;\n          dest32[destPos++] = srcByte & 1 ? white : black;\n        }\n\n        for (; k < kEnd; k++) {\n          if (mask === 0) {\n            srcByte = src[srcPos++];\n            mask = 128;\n          }\n\n          dest32[destPos++] = srcByte & mask ? white : black;\n          mask >>= 1;\n        }\n      }\n\n      while (destPos < dest32DataLength) {\n        dest32[destPos++] = 0;\n      }\n\n      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n    }\n  } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {\n    const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);\n    j = 0;\n    elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;\n\n    for (i = 0; i < fullChunks; i++) {\n      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));\n      srcPos += elemsInThisChunk;\n\n      if (hasTransferMaps) {\n        for (let k = 0; k < elemsInThisChunk; k += 4) {\n          if (transferMapRed) {\n            dest[k + 0] = transferMapRed[dest[k + 0]];\n          }\n\n          if (transferMapGreen) {\n            dest[k + 1] = transferMapGreen[dest[k + 1]];\n          }\n\n          if (transferMapBlue) {\n            dest[k + 2] = transferMapBlue[dest[k + 2]];\n          }\n        }\n      }\n\n      ctx.putImageData(chunkImgData, 0, j);\n      j += FULL_CHUNK_HEIGHT;\n    }\n\n    if (i < totalChunks) {\n      elemsInThisChunk = width * partialChunkHeight * 4;\n      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));\n\n      if (hasTransferMaps) {\n        for (let k = 0; k < elemsInThisChunk; k += 4) {\n          if (transferMapRed) {\n            dest[k + 0] = transferMapRed[dest[k + 0]];\n          }\n\n          if (transferMapGreen) {\n            dest[k + 1] = transferMapGreen[dest[k + 1]];\n          }\n\n          if (transferMapBlue) {\n            dest[k + 2] = transferMapBlue[dest[k + 2]];\n          }\n        }\n      }\n\n      ctx.putImageData(chunkImgData, 0, j);\n    }\n  } else if (imgData.kind === _util.ImageKind.RGB_24BPP) {\n    const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);\n    thisChunkHeight = FULL_CHUNK_HEIGHT;\n    elemsInThisChunk = width * thisChunkHeight;\n\n    for (i = 0; i < totalChunks; i++) {\n      if (i >= fullChunks) {\n        thisChunkHeight = partialChunkHeight;\n        elemsInThisChunk = width * thisChunkHeight;\n      }\n\n      destPos = 0;\n\n      for (j = elemsInThisChunk; j--;) {\n        dest[destPos++] = src[srcPos++];\n        dest[destPos++] = src[srcPos++];\n        dest[destPos++] = src[srcPos++];\n        dest[destPos++] = 255;\n      }\n\n      if (hasTransferMaps) {\n        for (let k = 0; k < destPos; k += 4) {\n          if (transferMapRed) {\n            dest[k + 0] = transferMapRed[dest[k + 0]];\n          }\n\n          if (transferMapGreen) {\n            dest[k + 1] = transferMapGreen[dest[k + 1]];\n          }\n\n          if (transferMapBlue) {\n            dest[k + 2] = transferMapBlue[dest[k + 2]];\n          }\n        }\n      }\n\n      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n    }\n  } else {\n    throw new Error(`bad image kind: ${imgData.kind}`);\n  }\n}\n\nfunction putBinaryImageMask(ctx, imgData) {\n  const height = imgData.height,\n        width = imgData.width;\n  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n  let srcPos = 0;\n  const src = imgData.data;\n  const dest = chunkImgData.data;\n\n  for (let i = 0; i < totalChunks; i++) {\n    const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;\n    let destPos = 3;\n\n    for (let j = 0; j < thisChunkHeight; j++) {\n      let elem,\n          mask = 0;\n\n      for (let k = 0; k < width; k++) {\n        if (!mask) {\n          elem = src[srcPos++];\n          mask = 128;\n        }\n\n        dest[destPos] = elem & mask ? 0 : 255;\n        destPos += 4;\n        mask >>= 1;\n      }\n    }\n\n    ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n  }\n}\n\nfunction copyCtxState(sourceCtx, destCtx) {\n  const properties = [\"strokeStyle\", \"fillStyle\", \"fillRule\", \"globalAlpha\", \"lineWidth\", \"lineCap\", \"lineJoin\", \"miterLimit\", \"globalCompositeOperation\", \"font\"];\n\n  for (let i = 0, ii = properties.length; i < ii; i++) {\n    const property = properties[i];\n\n    if (sourceCtx[property] !== undefined) {\n      destCtx[property] = sourceCtx[property];\n    }\n  }\n\n  if (sourceCtx.setLineDash !== undefined) {\n    destCtx.setLineDash(sourceCtx.getLineDash());\n    destCtx.lineDashOffset = sourceCtx.lineDashOffset;\n  }\n}\n\nfunction resetCtxToDefault(ctx) {\n  ctx.strokeStyle = \"#000000\";\n  ctx.fillStyle = \"#000000\";\n  ctx.fillRule = \"nonzero\";\n  ctx.globalAlpha = 1;\n  ctx.lineWidth = 1;\n  ctx.lineCap = \"butt\";\n  ctx.lineJoin = \"miter\";\n  ctx.miterLimit = 10;\n  ctx.globalCompositeOperation = \"source-over\";\n  ctx.font = \"10px sans-serif\";\n\n  if (ctx.setLineDash !== undefined) {\n    ctx.setLineDash([]);\n    ctx.lineDashOffset = 0;\n  }\n}\n\nfunction composeSMaskBackdrop(bytes, r0, g0, b0) {\n  const length = bytes.length;\n\n  for (let i = 3; i < length; i += 4) {\n    const alpha = bytes[i];\n\n    if (alpha === 0) {\n      bytes[i - 3] = r0;\n      bytes[i - 2] = g0;\n      bytes[i - 1] = b0;\n    } else if (alpha < 255) {\n      const alpha_ = 255 - alpha;\n      bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8;\n      bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8;\n      bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8;\n    }\n  }\n}\n\nfunction composeSMaskAlpha(maskData, layerData, transferMap) {\n  const length = maskData.length;\n  const scale = 1 / 255;\n\n  for (let i = 3; i < length; i += 4) {\n    const alpha = transferMap ? transferMap[maskData[i]] : maskData[i];\n    layerData[i] = layerData[i] * alpha * scale | 0;\n  }\n}\n\nfunction composeSMaskLuminosity(maskData, layerData, transferMap) {\n  const length = maskData.length;\n\n  for (let i = 3; i < length; i += 4) {\n    const y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28;\n    layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16;\n  }\n}\n\nfunction genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, layerOffsetY, maskOffsetX, maskOffsetY) {\n  const hasBackdrop = !!backdrop;\n  const r0 = hasBackdrop ? backdrop[0] : 0;\n  const g0 = hasBackdrop ? backdrop[1] : 0;\n  const b0 = hasBackdrop ? backdrop[2] : 0;\n  let composeFn;\n\n  if (subtype === \"Luminosity\") {\n    composeFn = composeSMaskLuminosity;\n  } else {\n    composeFn = composeSMaskAlpha;\n  }\n\n  const PIXELS_TO_PROCESS = 1048576;\n  const chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));\n\n  for (let row = 0; row < height; row += chunkSize) {\n    const chunkHeight = Math.min(chunkSize, height - row);\n    const maskData = maskCtx.getImageData(layerOffsetX - maskOffsetX, row + (layerOffsetY - maskOffsetY), width, chunkHeight);\n    const layerData = layerCtx.getImageData(layerOffsetX, row + layerOffsetY, width, chunkHeight);\n\n    if (hasBackdrop) {\n      composeSMaskBackdrop(maskData.data, r0, g0, b0);\n    }\n\n    composeFn(maskData.data, layerData.data, transferMap);\n    layerCtx.putImageData(layerData, layerOffsetX, row + layerOffsetY);\n  }\n}\n\nfunction composeSMask(ctx, smask, layerCtx, layerBox) {\n  const layerOffsetX = layerBox[0];\n  const layerOffsetY = layerBox[1];\n  const layerWidth = layerBox[2] - layerOffsetX;\n  const layerHeight = layerBox[3] - layerOffsetY;\n\n  if (layerWidth === 0 || layerHeight === 0) {\n    return;\n  }\n\n  genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);\n  ctx.save();\n  ctx.globalAlpha = 1;\n  ctx.globalCompositeOperation = \"source-over\";\n  ctx.setTransform(1, 0, 0, 1, 0, 0);\n  ctx.drawImage(layerCtx.canvas, 0, 0);\n  ctx.restore();\n}\n\nfunction getImageSmoothingEnabled(transform, interpolate) {\n  const scale = _util.Util.singularValueDecompose2dScale(transform);\n\n  scale[0] = Math.fround(scale[0]);\n  scale[1] = Math.fround(scale[1]);\n  const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);\n\n  if (interpolate !== undefined) {\n    return interpolate;\n  } else if (scale[0] <= actualScale || scale[1] <= actualScale) {\n    return true;\n  }\n\n  return false;\n}\n\nconst LINE_CAP_STYLES = [\"butt\", \"round\", \"square\"];\nconst LINE_JOIN_STYLES = [\"miter\", \"round\", \"bevel\"];\nconst NORMAL_CLIP = {};\nconst EO_CLIP = {};\n\nclass CanvasGraphics {\n  constructor(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig, annotationCanvasMap) {\n    this.ctx = canvasCtx;\n    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);\n    this.stateStack = [];\n    this.pendingClip = null;\n    this.pendingEOFill = false;\n    this.res = null;\n    this.xobjs = null;\n    this.commonObjs = commonObjs;\n    this.objs = objs;\n    this.canvasFactory = canvasFactory;\n    this.imageLayer = imageLayer;\n    this.groupStack = [];\n    this.processingType3 = null;\n    this.baseTransform = null;\n    this.baseTransformStack = [];\n    this.groupLevel = 0;\n    this.smaskStack = [];\n    this.smaskCounter = 0;\n    this.tempSMask = null;\n    this.suspendedCtx = null;\n    this.contentVisible = true;\n    this.markedContentStack = [];\n    this.optionalContentConfig = optionalContentConfig;\n    this.cachedCanvases = new CachedCanvases(this.canvasFactory);\n    this.cachedPatterns = new Map();\n    this.annotationCanvasMap = annotationCanvasMap;\n    this.viewportScale = 1;\n    this.outputScaleX = 1;\n    this.outputScaleY = 1;\n\n    if (canvasCtx) {\n      addContextCurrentTransform(canvasCtx);\n    }\n\n    this._cachedGetSinglePixelWidth = null;\n  }\n\n  beginDrawing({\n    transform,\n    viewport,\n    transparency = false,\n    background = null\n  }) {\n    const width = this.ctx.canvas.width;\n    const height = this.ctx.canvas.height;\n    this.ctx.save();\n    this.ctx.fillStyle = background || \"rgb(255, 255, 255)\";\n    this.ctx.fillRect(0, 0, width, height);\n    this.ctx.restore();\n\n    if (transparency) {\n      const transparentCanvas = this.cachedCanvases.getCanvas(\"transparent\", width, height, true);\n      this.compositeCtx = this.ctx;\n      this.transparentCanvas = transparentCanvas.canvas;\n      this.ctx = transparentCanvas.context;\n      this.ctx.save();\n      this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform);\n    }\n\n    this.ctx.save();\n    resetCtxToDefault(this.ctx);\n\n    if (transform) {\n      this.ctx.transform.apply(this.ctx, transform);\n      this.outputScaleX = transform[0];\n      this.outputScaleY = transform[0];\n    }\n\n    this.ctx.transform.apply(this.ctx, viewport.transform);\n    this.viewportScale = viewport.scale;\n    this.baseTransform = this.ctx.mozCurrentTransform.slice();\n    this._combinedScaleFactor = Math.hypot(this.baseTransform[0], this.baseTransform[2]);\n\n    if (this.imageLayer) {\n      this.imageLayer.beginLayout();\n    }\n  }\n\n  executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {\n    const argsArray = operatorList.argsArray;\n    const fnArray = operatorList.fnArray;\n    let i = executionStartIdx || 0;\n    const argsArrayLen = argsArray.length;\n\n    if (argsArrayLen === i) {\n      return i;\n    }\n\n    const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === \"function\";\n    const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;\n    let steps = 0;\n    const commonObjs = this.commonObjs;\n    const objs = this.objs;\n    let fnId;\n\n    while (true) {\n      if (stepper !== undefined && i === stepper.nextBreakPoint) {\n        stepper.breakIt(i, continueCallback);\n        return i;\n      }\n\n      fnId = fnArray[i];\n\n      if (fnId !== _util.OPS.dependency) {\n        this[fnId].apply(this, argsArray[i]);\n      } else {\n        for (const depObjId of argsArray[i]) {\n          const objsPool = depObjId.startsWith(\"g_\") ? commonObjs : objs;\n\n          if (!objsPool.has(depObjId)) {\n            objsPool.get(depObjId, continueCallback);\n            return i;\n          }\n        }\n      }\n\n      i++;\n\n      if (i === argsArrayLen) {\n        return i;\n      }\n\n      if (chunkOperations && ++steps > EXECUTION_STEPS) {\n        if (Date.now() > endTime) {\n          continueCallback();\n          return i;\n        }\n\n        steps = 0;\n      }\n    }\n  }\n\n  endDrawing() {\n    while (this.stateStack.length || this.inSMaskMode) {\n      this.restore();\n    }\n\n    this.ctx.restore();\n\n    if (this.transparentCanvas) {\n      this.ctx = this.compositeCtx;\n      this.ctx.save();\n      this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n      this.ctx.drawImage(this.transparentCanvas, 0, 0);\n      this.ctx.restore();\n      this.transparentCanvas = null;\n    }\n\n    this.cachedCanvases.clear();\n    this.cachedPatterns.clear();\n\n    if (this.imageLayer) {\n      this.imageLayer.endLayout();\n    }\n  }\n\n  _scaleImage(img, inverseTransform) {\n    const width = img.width;\n    const height = img.height;\n    let widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);\n    let heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);\n    let paintWidth = width,\n        paintHeight = height;\n    let tmpCanvasId = \"prescale1\";\n    let tmpCanvas, tmpCtx;\n\n    while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {\n      let newWidth = paintWidth,\n          newHeight = paintHeight;\n\n      if (widthScale > 2 && paintWidth > 1) {\n        newWidth = Math.ceil(paintWidth / 2);\n        widthScale /= paintWidth / newWidth;\n      }\n\n      if (heightScale > 2 && paintHeight > 1) {\n        newHeight = Math.ceil(paintHeight / 2);\n        heightScale /= paintHeight / newHeight;\n      }\n\n      tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);\n      tmpCtx = tmpCanvas.context;\n      tmpCtx.clearRect(0, 0, newWidth, newHeight);\n      tmpCtx.drawImage(img, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);\n      img = tmpCanvas.canvas;\n      paintWidth = newWidth;\n      paintHeight = newHeight;\n      tmpCanvasId = tmpCanvasId === \"prescale1\" ? \"prescale2\" : \"prescale1\";\n    }\n\n    return {\n      img,\n      paintWidth,\n      paintHeight\n    };\n  }\n\n  _createMaskCanvas(img) {\n    const ctx = this.ctx;\n    const width = img.width,\n          height = img.height;\n    const fillColor = this.current.fillColor;\n    const isPatternFill = this.current.patternFill;\n    const maskCanvas = this.cachedCanvases.getCanvas(\"maskCanvas\", width, height);\n    const maskCtx = maskCanvas.context;\n    putBinaryImageMask(maskCtx, img);\n    const objToCanvas = ctx.mozCurrentTransform;\n\n    let maskToCanvas = _util.Util.transform(objToCanvas, [1 / width, 0, 0, -1 / height, 0, 0]);\n\n    maskToCanvas = _util.Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);\n\n    const cord1 = _util.Util.applyTransform([0, 0], maskToCanvas);\n\n    const cord2 = _util.Util.applyTransform([width, height], maskToCanvas);\n\n    const rect = _util.Util.normalizeRect([cord1[0], cord1[1], cord2[0], cord2[1]]);\n\n    const drawnWidth = Math.ceil(rect[2] - rect[0]);\n    const drawnHeight = Math.ceil(rect[3] - rect[1]);\n    const fillCanvas = this.cachedCanvases.getCanvas(\"fillCanvas\", drawnWidth, drawnHeight, true);\n    const fillCtx = fillCanvas.context;\n    const offsetX = Math.min(cord1[0], cord2[0]);\n    const offsetY = Math.min(cord1[1], cord2[1]);\n    fillCtx.translate(-offsetX, -offsetY);\n    fillCtx.transform.apply(fillCtx, maskToCanvas);\n\n    const scaled = this._scaleImage(maskCanvas.canvas, fillCtx.mozCurrentTransformInverse);\n\n    fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(fillCtx.mozCurrentTransform, img.interpolate);\n    fillCtx.drawImage(scaled.img, 0, 0, scaled.img.width, scaled.img.height, 0, 0, width, height);\n    fillCtx.globalCompositeOperation = \"source-in\";\n\n    const inverse = _util.Util.transform(fillCtx.mozCurrentTransformInverse, [1, 0, 0, 1, -offsetX, -offsetY]);\n\n    fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, _pattern_helper.PathType.FILL) : fillColor;\n    fillCtx.fillRect(0, 0, width, height);\n    return {\n      canvas: fillCanvas.canvas,\n      offsetX: Math.round(offsetX),\n      offsetY: Math.round(offsetY)\n    };\n  }\n\n  setLineWidth(width) {\n    this.current.lineWidth = width;\n    this.ctx.lineWidth = width;\n  }\n\n  setLineCap(style) {\n    this.ctx.lineCap = LINE_CAP_STYLES[style];\n  }\n\n  setLineJoin(style) {\n    this.ctx.lineJoin = LINE_JOIN_STYLES[style];\n  }\n\n  setMiterLimit(limit) {\n    this.ctx.miterLimit = limit;\n  }\n\n  setDash(dashArray, dashPhase) {\n    const ctx = this.ctx;\n\n    if (ctx.setLineDash !== undefined) {\n      ctx.setLineDash(dashArray);\n      ctx.lineDashOffset = dashPhase;\n    }\n  }\n\n  setRenderingIntent(intent) {}\n\n  setFlatness(flatness) {}\n\n  setGState(states) {\n    for (let i = 0, ii = states.length; i < ii; i++) {\n      const state = states[i];\n      const key = state[0];\n      const value = state[1];\n\n      switch (key) {\n        case \"LW\":\n          this.setLineWidth(value);\n          break;\n\n        case \"LC\":\n          this.setLineCap(value);\n          break;\n\n        case \"LJ\":\n          this.setLineJoin(value);\n          break;\n\n        case \"ML\":\n          this.setMiterLimit(value);\n          break;\n\n        case \"D\":\n          this.setDash(value[0], value[1]);\n          break;\n\n        case \"RI\":\n          this.setRenderingIntent(value);\n          break;\n\n        case \"FL\":\n          this.setFlatness(value);\n          break;\n\n        case \"Font\":\n          this.setFont(value[0], value[1]);\n          break;\n\n        case \"CA\":\n          this.current.strokeAlpha = state[1];\n          break;\n\n        case \"ca\":\n          this.current.fillAlpha = state[1];\n          this.ctx.globalAlpha = state[1];\n          break;\n\n        case \"BM\":\n          this.ctx.globalCompositeOperation = value;\n          break;\n\n        case \"SMask\":\n          this.current.activeSMask = value ? this.tempSMask : null;\n          this.tempSMask = null;\n          this.checkSMaskState();\n          break;\n\n        case \"TR\":\n          this.current.transferMaps = value;\n      }\n    }\n  }\n\n  get inSMaskMode() {\n    return !!this.suspendedCtx;\n  }\n\n  checkSMaskState() {\n    const inSMaskMode = this.inSMaskMode;\n\n    if (this.current.activeSMask && !inSMaskMode) {\n      this.beginSMaskMode();\n    } else if (!this.current.activeSMask && inSMaskMode) {\n      this.endSMaskMode();\n    }\n  }\n\n  beginSMaskMode() {\n    if (this.inSMaskMode) {\n      throw new Error(\"beginSMaskMode called while already in smask mode\");\n    }\n\n    const drawnWidth = this.ctx.canvas.width;\n    const drawnHeight = this.ctx.canvas.height;\n    const cacheId = \"smaskGroupAt\" + this.groupLevel;\n    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);\n    this.suspendedCtx = this.ctx;\n    this.ctx = scratchCanvas.context;\n    const ctx = this.ctx;\n    ctx.setTransform.apply(ctx, this.suspendedCtx.mozCurrentTransform);\n    copyCtxState(this.suspendedCtx, ctx);\n    mirrorContextOperations(ctx, this.suspendedCtx);\n    this.setGState([[\"BM\", \"source-over\"], [\"ca\", 1], [\"CA\", 1]]);\n  }\n\n  endSMaskMode() {\n    if (!this.inSMaskMode) {\n      throw new Error(\"endSMaskMode called while not in smask mode\");\n    }\n\n    this.ctx._removeMirroring();\n\n    copyCtxState(this.ctx, this.suspendedCtx);\n    this.ctx = this.suspendedCtx;\n    this.suspendedCtx = null;\n  }\n\n  compose(dirtyBox) {\n    if (!this.current.activeSMask) {\n      return;\n    }\n\n    if (!dirtyBox) {\n      dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];\n    } else {\n      dirtyBox[0] = Math.floor(dirtyBox[0]);\n      dirtyBox[1] = Math.floor(dirtyBox[1]);\n      dirtyBox[2] = Math.ceil(dirtyBox[2]);\n      dirtyBox[3] = Math.ceil(dirtyBox[3]);\n    }\n\n    const smask = this.current.activeSMask;\n    const suspendedCtx = this.suspendedCtx;\n    composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);\n    this.ctx.save();\n    this.ctx.setTransform(1, 0, 0, 1, 0, 0);\n    this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);\n    this.ctx.restore();\n  }\n\n  save() {\n    if (this.inSMaskMode) {\n      copyCtxState(this.ctx, this.suspendedCtx);\n      this.suspendedCtx.save();\n    } else {\n      this.ctx.save();\n    }\n\n    const old = this.current;\n    this.stateStack.push(old);\n    this.current = old.clone();\n  }\n\n  restore() {\n    if (this.stateStack.length === 0 && this.inSMaskMode) {\n      this.endSMaskMode();\n    }\n\n    if (this.stateStack.length !== 0) {\n      this.current = this.stateStack.pop();\n\n      if (this.inSMaskMode) {\n        this.suspendedCtx.restore();\n        copyCtxState(this.suspendedCtx, this.ctx);\n      } else {\n        this.ctx.restore();\n      }\n\n      this.checkSMaskState();\n      this.pendingClip = null;\n      this._cachedGetSinglePixelWidth = null;\n    }\n  }\n\n  transform(a, b, c, d, e, f) {\n    this.ctx.transform(a, b, c, d, e, f);\n    this._cachedGetSinglePixelWidth = null;\n  }\n\n  constructPath(ops, args) {\n    const ctx = this.ctx;\n    const current = this.current;\n    let x = current.x,\n        y = current.y;\n    let startX, startY;\n\n    for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {\n      switch (ops[i] | 0) {\n        case _util.OPS.rectangle:\n          x = args[j++];\n          y = args[j++];\n          const width = args[j++];\n          const height = args[j++];\n          const xw = x + width;\n          const yh = y + height;\n          ctx.moveTo(x, y);\n\n          if (width === 0 || height === 0) {\n            ctx.lineTo(xw, yh);\n          } else {\n            ctx.lineTo(xw, y);\n            ctx.lineTo(xw, yh);\n            ctx.lineTo(x, yh);\n          }\n\n          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);\n          current.updatePathMinMax(ctx.mozCurrentTransform, xw, yh);\n          ctx.closePath();\n          break;\n\n        case _util.OPS.moveTo:\n          x = args[j++];\n          y = args[j++];\n          ctx.moveTo(x, y);\n          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);\n          break;\n\n        case _util.OPS.lineTo:\n          x = args[j++];\n          y = args[j++];\n          ctx.lineTo(x, y);\n          current.updatePathMinMax(ctx.mozCurrentTransform, x, y);\n          break;\n\n        case _util.OPS.curveTo:\n          startX = x;\n          startY = y;\n          x = args[j + 4];\n          y = args[j + 5];\n          ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);\n          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, args[j], args[j + 1], args[j + 2], args[j + 3], x, y);\n          j += 6;\n          break;\n\n        case _util.OPS.curveTo2:\n          startX = x;\n          startY = y;\n          ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);\n          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);\n          x = args[j + 2];\n          y = args[j + 3];\n          j += 4;\n          break;\n\n        case _util.OPS.curveTo3:\n          startX = x;\n          startY = y;\n          x = args[j + 2];\n          y = args[j + 3];\n          ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);\n          current.updateCurvePathMinMax(ctx.mozCurrentTransform, startX, startY, args[j], args[j + 1], x, y, x, y);\n          j += 4;\n          break;\n\n        case _util.OPS.closePath:\n          ctx.closePath();\n          break;\n      }\n    }\n\n    current.setCurrentPoint(x, y);\n  }\n\n  closePath() {\n    this.ctx.closePath();\n  }\n\n  stroke(consumePath) {\n    consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n    const ctx = this.ctx;\n    const strokeColor = this.current.strokeColor;\n    ctx.globalAlpha = this.current.strokeAlpha;\n\n    if (this.contentVisible) {\n      if (typeof strokeColor === \"object\" && strokeColor?.getPattern) {\n        const lineWidth = this.getSinglePixelWidth();\n        ctx.save();\n        ctx.strokeStyle = strokeColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.STROKE);\n        ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth);\n        ctx.stroke();\n        ctx.restore();\n      } else {\n        const lineWidth = this.getSinglePixelWidth();\n\n        if (lineWidth < 0 && -lineWidth >= this.current.lineWidth) {\n          ctx.save();\n          ctx.resetTransform();\n          ctx.lineWidth = Math.floor(this._combinedScaleFactor);\n          ctx.stroke();\n          ctx.restore();\n        } else {\n          ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth);\n          ctx.stroke();\n        }\n      }\n    }\n\n    if (consumePath) {\n      this.consumePath(this.current.getClippedPathBoundingBox());\n    }\n\n    ctx.globalAlpha = this.current.fillAlpha;\n  }\n\n  closeStroke() {\n    this.closePath();\n    this.stroke();\n  }\n\n  fill(consumePath) {\n    consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n    const ctx = this.ctx;\n    const fillColor = this.current.fillColor;\n    const isPatternFill = this.current.patternFill;\n    let needRestore = false;\n\n    if (isPatternFill) {\n      ctx.save();\n      ctx.fillStyle = fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL);\n      needRestore = true;\n    }\n\n    const intersect = this.current.getClippedPathBoundingBox();\n\n    if (this.contentVisible && intersect !== null) {\n      if (this.pendingEOFill) {\n        ctx.fill(\"evenodd\");\n        this.pendingEOFill = false;\n      } else {\n        ctx.fill();\n      }\n    }\n\n    if (needRestore) {\n      ctx.restore();\n    }\n\n    if (consumePath) {\n      this.consumePath(intersect);\n    }\n  }\n\n  eoFill() {\n    this.pendingEOFill = true;\n    this.fill();\n  }\n\n  fillStroke() {\n    this.fill(false);\n    this.stroke(false);\n    this.consumePath();\n  }\n\n  eoFillStroke() {\n    this.pendingEOFill = true;\n    this.fillStroke();\n  }\n\n  closeFillStroke() {\n    this.closePath();\n    this.fillStroke();\n  }\n\n  closeEOFillStroke() {\n    this.pendingEOFill = true;\n    this.closePath();\n    this.fillStroke();\n  }\n\n  endPath() {\n    this.consumePath();\n  }\n\n  clip() {\n    this.pendingClip = NORMAL_CLIP;\n  }\n\n  eoClip() {\n    this.pendingClip = EO_CLIP;\n  }\n\n  beginText() {\n    this.current.textMatrix = _util.IDENTITY_MATRIX;\n    this.current.textMatrixScale = 1;\n    this.current.x = this.current.lineX = 0;\n    this.current.y = this.current.lineY = 0;\n  }\n\n  endText() {\n    const paths = this.pendingTextPaths;\n    const ctx = this.ctx;\n\n    if (paths === undefined) {\n      ctx.beginPath();\n      return;\n    }\n\n    ctx.save();\n    ctx.beginPath();\n\n    for (let i = 0; i < paths.length; i++) {\n      const path = paths[i];\n      ctx.setTransform.apply(ctx, path.transform);\n      ctx.translate(path.x, path.y);\n      path.addToPath(ctx, path.fontSize);\n    }\n\n    ctx.restore();\n    ctx.clip();\n    ctx.beginPath();\n    delete this.pendingTextPaths;\n  }\n\n  setCharSpacing(spacing) {\n    this.current.charSpacing = spacing;\n  }\n\n  setWordSpacing(spacing) {\n    this.current.wordSpacing = spacing;\n  }\n\n  setHScale(scale) {\n    this.current.textHScale = scale / 100;\n  }\n\n  setLeading(leading) {\n    this.current.leading = -leading;\n  }\n\n  setFont(fontRefName, size) {\n    const fontObj = this.commonObjs.get(fontRefName);\n    const current = this.current;\n\n    if (!fontObj) {\n      throw new Error(`Can't find font for ${fontRefName}`);\n    }\n\n    current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;\n\n    if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {\n      (0, _util.warn)(\"Invalid font matrix for font \" + fontRefName);\n    }\n\n    if (size < 0) {\n      size = -size;\n      current.fontDirection = -1;\n    } else {\n      current.fontDirection = 1;\n    }\n\n    this.current.font = fontObj;\n    this.current.fontSize = size;\n\n    if (fontObj.isType3Font) {\n      return;\n    }\n\n    const name = fontObj.loadedName || \"sans-serif\";\n    let bold = \"normal\";\n\n    if (fontObj.black) {\n      bold = \"900\";\n    } else if (fontObj.bold) {\n      bold = \"bold\";\n    }\n\n    const italic = fontObj.italic ? \"italic\" : \"normal\";\n    const typeface = `\"${name}\", ${fontObj.fallbackName}`;\n    let browserFontSize = size;\n\n    if (size < MIN_FONT_SIZE) {\n      browserFontSize = MIN_FONT_SIZE;\n    } else if (size > MAX_FONT_SIZE) {\n      browserFontSize = MAX_FONT_SIZE;\n    }\n\n    this.current.fontSizeScale = size / browserFontSize;\n    this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;\n  }\n\n  setTextRenderingMode(mode) {\n    this.current.textRenderingMode = mode;\n  }\n\n  setTextRise(rise) {\n    this.current.textRise = rise;\n  }\n\n  moveText(x, y) {\n    this.current.x = this.current.lineX += x;\n    this.current.y = this.current.lineY += y;\n  }\n\n  setLeadingMoveText(x, y) {\n    this.setLeading(-y);\n    this.moveText(x, y);\n  }\n\n  setTextMatrix(a, b, c, d, e, f) {\n    this.current.textMatrix = [a, b, c, d, e, f];\n    this.current.textMatrixScale = Math.hypot(a, b);\n    this.current.x = this.current.lineX = 0;\n    this.current.y = this.current.lineY = 0;\n  }\n\n  nextLine() {\n    this.moveText(0, this.current.leading);\n  }\n\n  paintChar(character, x, y, patternTransform, resetLineWidthToOne) {\n    const ctx = this.ctx;\n    const current = this.current;\n    const font = current.font;\n    const textRenderingMode = current.textRenderingMode;\n    const fontSize = current.fontSize / current.fontSizeScale;\n    const fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;\n    const isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);\n    const patternFill = current.patternFill && !font.missingFile;\n    let addToPath;\n\n    if (font.disableFontFace || isAddToPathSet || patternFill) {\n      addToPath = font.getPathGenerator(this.commonObjs, character);\n    }\n\n    if (font.disableFontFace || patternFill) {\n      ctx.save();\n      ctx.translate(x, y);\n      ctx.beginPath();\n      addToPath(ctx, fontSize);\n\n      if (patternTransform) {\n        ctx.setTransform.apply(ctx, patternTransform);\n      }\n\n      if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        ctx.fill();\n      }\n\n      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        if (resetLineWidthToOne) {\n          ctx.resetTransform();\n          ctx.lineWidth = Math.floor(this._combinedScaleFactor);\n        }\n\n        ctx.stroke();\n      }\n\n      ctx.restore();\n    } else {\n      if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        ctx.fillText(character, x, y);\n      }\n\n      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        if (resetLineWidthToOne) {\n          ctx.save();\n          ctx.moveTo(x, y);\n          ctx.resetTransform();\n          ctx.lineWidth = Math.floor(this._combinedScaleFactor);\n          ctx.strokeText(character, 0, 0);\n          ctx.restore();\n        } else {\n          ctx.strokeText(character, x, y);\n        }\n      }\n    }\n\n    if (isAddToPathSet) {\n      const paths = this.pendingTextPaths || (this.pendingTextPaths = []);\n      paths.push({\n        transform: ctx.mozCurrentTransform,\n        x,\n        y,\n        fontSize,\n        addToPath\n      });\n    }\n  }\n\n  get isFontSubpixelAAEnabled() {\n    const {\n      context: ctx\n    } = this.cachedCanvases.getCanvas(\"isFontSubpixelAAEnabled\", 10, 10);\n    ctx.scale(1.5, 1);\n    ctx.fillText(\"I\", 0, 10);\n    const data = ctx.getImageData(0, 0, 10, 10).data;\n    let enabled = false;\n\n    for (let i = 3; i < data.length; i += 4) {\n      if (data[i] > 0 && data[i] < 255) {\n        enabled = true;\n        break;\n      }\n    }\n\n    return (0, _util.shadow)(this, \"isFontSubpixelAAEnabled\", enabled);\n  }\n\n  showText(glyphs) {\n    const current = this.current;\n    const font = current.font;\n\n    if (font.isType3Font) {\n      return this.showType3Text(glyphs);\n    }\n\n    const fontSize = current.fontSize;\n\n    if (fontSize === 0) {\n      return undefined;\n    }\n\n    const ctx = this.ctx;\n    const fontSizeScale = current.fontSizeScale;\n    const charSpacing = current.charSpacing;\n    const wordSpacing = current.wordSpacing;\n    const fontDirection = current.fontDirection;\n    const textHScale = current.textHScale * fontDirection;\n    const glyphsLength = glyphs.length;\n    const vertical = font.vertical;\n    const spacingDir = vertical ? 1 : -1;\n    const defaultVMetrics = font.defaultVMetrics;\n    const widthAdvanceScale = fontSize * current.fontMatrix[0];\n    const simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;\n    ctx.save();\n    ctx.transform.apply(ctx, current.textMatrix);\n    ctx.translate(current.x, current.y + current.textRise);\n\n    if (fontDirection > 0) {\n      ctx.scale(textHScale, -1);\n    } else {\n      ctx.scale(textHScale, 1);\n    }\n\n    let patternTransform;\n\n    if (current.patternFill) {\n      ctx.save();\n      const pattern = current.fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL);\n      patternTransform = ctx.mozCurrentTransform;\n      ctx.restore();\n      ctx.fillStyle = pattern;\n    }\n\n    let lineWidth = current.lineWidth;\n    let resetLineWidthToOne = false;\n    const scale = current.textMatrixScale;\n\n    if (scale === 0 || lineWidth === 0) {\n      const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;\n\n      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        this._cachedGetSinglePixelWidth = null;\n        lineWidth = this.getSinglePixelWidth();\n        resetLineWidthToOne = lineWidth < 0;\n      }\n    } else {\n      lineWidth /= scale;\n    }\n\n    if (fontSizeScale !== 1.0) {\n      ctx.scale(fontSizeScale, fontSizeScale);\n      lineWidth /= fontSizeScale;\n    }\n\n    ctx.lineWidth = lineWidth;\n    let x = 0,\n        i;\n\n    for (i = 0; i < glyphsLength; ++i) {\n      const glyph = glyphs[i];\n\n      if (typeof glyph === \"number\") {\n        x += spacingDir * glyph * fontSize / 1000;\n        continue;\n      }\n\n      let restoreNeeded = false;\n      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n      const character = glyph.fontChar;\n      const accent = glyph.accent;\n      let scaledX, scaledY;\n      let width = glyph.width;\n\n      if (vertical) {\n        const vmetric = glyph.vmetric || defaultVMetrics;\n        const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;\n        const vy = vmetric[2] * widthAdvanceScale;\n        width = vmetric ? -vmetric[0] : width;\n        scaledX = vx / fontSizeScale;\n        scaledY = (x + vy) / fontSizeScale;\n      } else {\n        scaledX = x / fontSizeScale;\n        scaledY = 0;\n      }\n\n      if (font.remeasure && width > 0) {\n        const measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;\n\n        if (width < measuredWidth && this.isFontSubpixelAAEnabled) {\n          const characterScaleX = width / measuredWidth;\n          restoreNeeded = true;\n          ctx.save();\n          ctx.scale(characterScaleX, 1);\n          scaledX /= characterScaleX;\n        } else if (width !== measuredWidth) {\n          scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;\n        }\n      }\n\n      if (this.contentVisible && (glyph.isInFont || font.missingFile)) {\n        if (simpleFillText && !accent) {\n          ctx.fillText(character, scaledX, scaledY);\n        } else {\n          this.paintChar(character, scaledX, scaledY, patternTransform, resetLineWidthToOne);\n\n          if (accent) {\n            const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;\n            const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;\n            this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform, resetLineWidthToOne);\n          }\n        }\n      }\n\n      let charWidth;\n\n      if (vertical) {\n        charWidth = width * widthAdvanceScale - spacing * fontDirection;\n      } else {\n        charWidth = width * widthAdvanceScale + spacing * fontDirection;\n      }\n\n      x += charWidth;\n\n      if (restoreNeeded) {\n        ctx.restore();\n      }\n    }\n\n    if (vertical) {\n      current.y -= x;\n    } else {\n      current.x += x * textHScale;\n    }\n\n    ctx.restore();\n    this.compose();\n    return undefined;\n  }\n\n  showType3Text(glyphs) {\n    const ctx = this.ctx;\n    const current = this.current;\n    const font = current.font;\n    const fontSize = current.fontSize;\n    const fontDirection = current.fontDirection;\n    const spacingDir = font.vertical ? 1 : -1;\n    const charSpacing = current.charSpacing;\n    const wordSpacing = current.wordSpacing;\n    const textHScale = current.textHScale * fontDirection;\n    const fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX;\n    const glyphsLength = glyphs.length;\n    const isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE;\n    let i, glyph, width, spacingLength;\n\n    if (isTextInvisible || fontSize === 0) {\n      return;\n    }\n\n    this._cachedGetSinglePixelWidth = null;\n    ctx.save();\n    ctx.transform.apply(ctx, current.textMatrix);\n    ctx.translate(current.x, current.y);\n    ctx.scale(textHScale, fontDirection);\n\n    for (i = 0; i < glyphsLength; ++i) {\n      glyph = glyphs[i];\n\n      if (typeof glyph === \"number\") {\n        spacingLength = spacingDir * glyph * fontSize / 1000;\n        this.ctx.translate(spacingLength, 0);\n        current.x += spacingLength * textHScale;\n        continue;\n      }\n\n      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n      const operatorList = font.charProcOperatorList[glyph.operatorListId];\n\n      if (!operatorList) {\n        (0, _util.warn)(`Type3 character \"${glyph.operatorListId}\" is not available.`);\n        continue;\n      }\n\n      if (this.contentVisible) {\n        this.processingType3 = glyph;\n        this.save();\n        ctx.scale(fontSize, fontSize);\n        ctx.transform.apply(ctx, fontMatrix);\n        this.executeOperatorList(operatorList);\n        this.restore();\n      }\n\n      const transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix);\n\n      width = transformed[0] * fontSize + spacing;\n      ctx.translate(width, 0);\n      current.x += width * textHScale;\n    }\n\n    ctx.restore();\n    this.processingType3 = null;\n  }\n\n  setCharWidth(xWidth, yWidth) {}\n\n  setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {\n    this.ctx.rect(llx, lly, urx - llx, ury - lly);\n    this.clip();\n    this.endPath();\n  }\n\n  getColorN_Pattern(IR) {\n    let pattern;\n\n    if (IR[0] === \"TilingPattern\") {\n      const color = IR[1];\n      const baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice();\n      const canvasGraphicsFactory = {\n        createCanvasGraphics: ctx => {\n          return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory);\n        }\n      };\n      pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);\n    } else {\n      pattern = this._getPattern(IR[1], IR[2]);\n    }\n\n    return pattern;\n  }\n\n  setStrokeColorN() {\n    this.current.strokeColor = this.getColorN_Pattern(arguments);\n  }\n\n  setFillColorN() {\n    this.current.fillColor = this.getColorN_Pattern(arguments);\n    this.current.patternFill = true;\n  }\n\n  setStrokeRGBColor(r, g, b) {\n    const color = _util.Util.makeHexColor(r, g, b);\n\n    this.ctx.strokeStyle = color;\n    this.current.strokeColor = color;\n  }\n\n  setFillRGBColor(r, g, b) {\n    const color = _util.Util.makeHexColor(r, g, b);\n\n    this.ctx.fillStyle = color;\n    this.current.fillColor = color;\n    this.current.patternFill = false;\n  }\n\n  _getPattern(objId, matrix = null) {\n    let pattern;\n\n    if (this.cachedPatterns.has(objId)) {\n      pattern = this.cachedPatterns.get(objId);\n    } else {\n      pattern = (0, _pattern_helper.getShadingPattern)(this.objs.get(objId));\n      this.cachedPatterns.set(objId, pattern);\n    }\n\n    if (matrix) {\n      pattern.matrix = matrix;\n    }\n\n    return pattern;\n  }\n\n  shadingFill(objId) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const ctx = this.ctx;\n    this.save();\n\n    const pattern = this._getPattern(objId);\n\n    ctx.fillStyle = pattern.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.SHADING);\n    const inv = ctx.mozCurrentTransformInverse;\n\n    if (inv) {\n      const canvas = ctx.canvas;\n      const width = canvas.width;\n      const height = canvas.height;\n\n      const bl = _util.Util.applyTransform([0, 0], inv);\n\n      const br = _util.Util.applyTransform([0, height], inv);\n\n      const ul = _util.Util.applyTransform([width, 0], inv);\n\n      const ur = _util.Util.applyTransform([width, height], inv);\n\n      const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);\n      const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);\n      const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);\n      const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);\n      this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);\n    } else {\n      this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);\n    }\n\n    this.compose(this.current.getClippedPathBoundingBox());\n    this.restore();\n  }\n\n  beginInlineImage() {\n    (0, _util.unreachable)(\"Should not call beginInlineImage\");\n  }\n\n  beginImageData() {\n    (0, _util.unreachable)(\"Should not call beginImageData\");\n  }\n\n  paintFormXObjectBegin(matrix, bbox) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    this.save();\n    this.baseTransformStack.push(this.baseTransform);\n\n    if (Array.isArray(matrix) && matrix.length === 6) {\n      this.transform.apply(this, matrix);\n    }\n\n    this.baseTransform = this.ctx.mozCurrentTransform;\n\n    if (bbox) {\n      const width = bbox[2] - bbox[0];\n      const height = bbox[3] - bbox[1];\n      this.ctx.rect(bbox[0], bbox[1], width, height);\n      this.current.updatePathMinMax(this.ctx.mozCurrentTransform, bbox[0], bbox[1]);\n      this.current.updatePathMinMax(this.ctx.mozCurrentTransform, bbox[2], bbox[3]);\n      this.clip();\n      this.endPath();\n    }\n  }\n\n  paintFormXObjectEnd() {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    this.restore();\n    this.baseTransform = this.baseTransformStack.pop();\n  }\n\n  beginGroup(group) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    this.save();\n\n    if (this.inSMaskMode) {\n      this.endSMaskMode();\n      this.current.activeSMask = null;\n    }\n\n    const currentCtx = this.ctx;\n\n    if (!group.isolated) {\n      (0, _util.info)(\"TODO: Support non-isolated groups.\");\n    }\n\n    if (group.knockout) {\n      (0, _util.warn)(\"Knockout groups not supported.\");\n    }\n\n    const currentTransform = currentCtx.mozCurrentTransform;\n\n    if (group.matrix) {\n      currentCtx.transform.apply(currentCtx, group.matrix);\n    }\n\n    if (!group.bbox) {\n      throw new Error(\"Bounding box is required.\");\n    }\n\n    let bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform);\n\n    const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];\n    bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];\n    const offsetX = Math.floor(bounds[0]);\n    const offsetY = Math.floor(bounds[1]);\n    let drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);\n    let drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);\n    let scaleX = 1,\n        scaleY = 1;\n\n    if (drawnWidth > MAX_GROUP_SIZE) {\n      scaleX = drawnWidth / MAX_GROUP_SIZE;\n      drawnWidth = MAX_GROUP_SIZE;\n    }\n\n    if (drawnHeight > MAX_GROUP_SIZE) {\n      scaleY = drawnHeight / MAX_GROUP_SIZE;\n      drawnHeight = MAX_GROUP_SIZE;\n    }\n\n    this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);\n    let cacheId = \"groupAt\" + this.groupLevel;\n\n    if (group.smask) {\n      cacheId += \"_smask_\" + this.smaskCounter++ % 2;\n    }\n\n    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);\n    const groupCtx = scratchCanvas.context;\n    groupCtx.scale(1 / scaleX, 1 / scaleY);\n    groupCtx.translate(-offsetX, -offsetY);\n    groupCtx.transform.apply(groupCtx, currentTransform);\n\n    if (group.smask) {\n      this.smaskStack.push({\n        canvas: scratchCanvas.canvas,\n        context: groupCtx,\n        offsetX,\n        offsetY,\n        scaleX,\n        scaleY,\n        subtype: group.smask.subtype,\n        backdrop: group.smask.backdrop,\n        transferMap: group.smask.transferMap || null,\n        startTransformInverse: null\n      });\n    } else {\n      currentCtx.setTransform(1, 0, 0, 1, 0, 0);\n      currentCtx.translate(offsetX, offsetY);\n      currentCtx.scale(scaleX, scaleY);\n      currentCtx.save();\n    }\n\n    copyCtxState(currentCtx, groupCtx);\n    this.ctx = groupCtx;\n    this.setGState([[\"BM\", \"source-over\"], [\"ca\", 1], [\"CA\", 1]]);\n    this.groupStack.push(currentCtx);\n    this.groupLevel++;\n  }\n\n  endGroup(group) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    this.groupLevel--;\n    const groupCtx = this.ctx;\n    const ctx = this.groupStack.pop();\n    this.ctx = ctx;\n    this.ctx.imageSmoothingEnabled = false;\n\n    if (group.smask) {\n      this.tempSMask = this.smaskStack.pop();\n      this.restore();\n    } else {\n      this.ctx.restore();\n      const currentMtx = this.ctx.mozCurrentTransform;\n      this.restore();\n      this.ctx.save();\n      this.ctx.setTransform.apply(this.ctx, currentMtx);\n\n      const dirtyBox = _util.Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);\n\n      this.ctx.drawImage(groupCtx.canvas, 0, 0);\n      this.ctx.restore();\n      this.compose(dirtyBox);\n    }\n  }\n\n  beginAnnotations() {\n    this.save();\n\n    if (this.baseTransform) {\n      this.ctx.setTransform.apply(this.ctx, this.baseTransform);\n    }\n  }\n\n  endAnnotations() {\n    this.restore();\n  }\n\n  beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {\n    this.save();\n\n    if (Array.isArray(rect) && rect.length === 4) {\n      const width = rect[2] - rect[0];\n      const height = rect[3] - rect[1];\n\n      if (hasOwnCanvas && this.annotationCanvasMap) {\n        transform = transform.slice();\n        transform[4] -= rect[0];\n        transform[5] -= rect[1];\n        rect = rect.slice();\n        rect[0] = rect[1] = 0;\n        rect[2] = width;\n        rect[3] = height;\n\n        const [scaleX, scaleY] = _util.Util.singularValueDecompose2dScale(this.ctx.mozCurrentTransform);\n\n        const {\n          viewportScale\n        } = this;\n        const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);\n        const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);\n        this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);\n        const {\n          canvas,\n          context\n        } = this.annotationCanvas;\n        canvas.style.width = `calc(${width}px * var(--viewport-scale-factor))`;\n        canvas.style.height = `calc(${height}px * var(--viewport-scale-factor))`;\n        this.annotationCanvasMap.set(id, canvas);\n        this.annotationCanvas.savedCtx = this.ctx;\n        this.ctx = context;\n        this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);\n        addContextCurrentTransform(this.ctx);\n        resetCtxToDefault(this.ctx);\n      } else {\n        resetCtxToDefault(this.ctx);\n        this.ctx.rect(rect[0], rect[1], width, height);\n        this.clip();\n        this.endPath();\n      }\n    }\n\n    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);\n    this.transform.apply(this, transform);\n    this.transform.apply(this, matrix);\n  }\n\n  endAnnotation() {\n    if (this.annotationCanvas) {\n      this.ctx = this.annotationCanvas.savedCtx;\n      delete this.annotationCanvas.savedCtx;\n      delete this.annotationCanvas;\n    }\n\n    this.restore();\n  }\n\n  paintImageMaskXObject(img) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const ctx = this.ctx;\n    const width = img.width,\n          height = img.height;\n    const glyph = this.processingType3;\n\n    if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {\n      if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {\n        glyph.compiled = compileType3Glyph({\n          data: img.data,\n          width,\n          height\n        });\n      } else {\n        glyph.compiled = null;\n      }\n    }\n\n    if (glyph?.compiled) {\n      glyph.compiled(ctx);\n      return;\n    }\n\n    const mask = this._createMaskCanvas(img);\n\n    const maskCanvas = mask.canvas;\n    ctx.save();\n    ctx.setTransform(1, 0, 0, 1, 0, 0);\n    ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);\n    ctx.restore();\n    this.compose();\n  }\n\n  paintImageMaskXObjectRepeat(imgData, scaleX, skewX = 0, skewY = 0, scaleY, positions) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const ctx = this.ctx;\n    ctx.save();\n    const currentTransform = ctx.mozCurrentTransform;\n    ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);\n\n    const mask = this._createMaskCanvas(imgData);\n\n    ctx.setTransform(1, 0, 0, 1, 0, 0);\n\n    for (let i = 0, ii = positions.length; i < ii; i += 2) {\n      const trans = _util.Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);\n\n      const [x, y] = _util.Util.applyTransform([0, 0], trans);\n\n      ctx.drawImage(mask.canvas, x, y);\n    }\n\n    ctx.restore();\n    this.compose();\n  }\n\n  paintImageMaskXObjectGroup(images) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const ctx = this.ctx;\n    const fillColor = this.current.fillColor;\n    const isPatternFill = this.current.patternFill;\n\n    for (let i = 0, ii = images.length; i < ii; i++) {\n      const image = images[i];\n      const width = image.width,\n            height = image.height;\n      const maskCanvas = this.cachedCanvases.getCanvas(\"maskCanvas\", width, height);\n      const maskCtx = maskCanvas.context;\n      maskCtx.save();\n      putBinaryImageMask(maskCtx, image);\n      maskCtx.globalCompositeOperation = \"source-in\";\n      maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL) : fillColor;\n      maskCtx.fillRect(0, 0, width, height);\n      maskCtx.restore();\n      ctx.save();\n      ctx.transform.apply(ctx, image.transform);\n      ctx.scale(1, -1);\n      ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);\n      ctx.restore();\n    }\n\n    this.compose();\n  }\n\n  paintImageXObject(objId) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const imgData = objId.startsWith(\"g_\") ? this.commonObjs.get(objId) : this.objs.get(objId);\n\n    if (!imgData) {\n      (0, _util.warn)(\"Dependent image isn't ready yet\");\n      return;\n    }\n\n    this.paintInlineImageXObject(imgData);\n  }\n\n  paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const imgData = objId.startsWith(\"g_\") ? this.commonObjs.get(objId) : this.objs.get(objId);\n\n    if (!imgData) {\n      (0, _util.warn)(\"Dependent image isn't ready yet\");\n      return;\n    }\n\n    const width = imgData.width;\n    const height = imgData.height;\n    const map = [];\n\n    for (let i = 0, ii = positions.length; i < ii; i += 2) {\n      map.push({\n        transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],\n        x: 0,\n        y: 0,\n        w: width,\n        h: height\n      });\n    }\n\n    this.paintInlineImageXObjectGroup(imgData, map);\n  }\n\n  paintInlineImageXObject(imgData) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const width = imgData.width;\n    const height = imgData.height;\n    const ctx = this.ctx;\n    this.save();\n    ctx.scale(1 / width, -1 / height);\n    let imgToPaint;\n\n    if (typeof HTMLElement === \"function\" && imgData instanceof HTMLElement || !imgData.data) {\n      imgToPaint = imgData;\n    } else {\n      const tmpCanvas = this.cachedCanvases.getCanvas(\"inlineImage\", width, height);\n      const tmpCtx = tmpCanvas.context;\n      putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);\n      imgToPaint = tmpCanvas.canvas;\n    }\n\n    const scaled = this._scaleImage(imgToPaint, ctx.mozCurrentTransformInverse);\n\n    ctx.imageSmoothingEnabled = getImageSmoothingEnabled(ctx.mozCurrentTransform, imgData.interpolate);\n    ctx.drawImage(scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);\n\n    if (this.imageLayer) {\n      const position = this.getCanvasPosition(0, -height);\n      this.imageLayer.appendImage({\n        imgData,\n        left: position[0],\n        top: position[1],\n        width: width / ctx.mozCurrentTransformInverse[0],\n        height: height / ctx.mozCurrentTransformInverse[3]\n      });\n    }\n\n    this.compose();\n    this.restore();\n  }\n\n  paintInlineImageXObjectGroup(imgData, map) {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    const ctx = this.ctx;\n    const w = imgData.width;\n    const h = imgData.height;\n    const tmpCanvas = this.cachedCanvases.getCanvas(\"inlineImage\", w, h);\n    const tmpCtx = tmpCanvas.context;\n    putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);\n\n    for (let i = 0, ii = map.length; i < ii; i++) {\n      const entry = map[i];\n      ctx.save();\n      ctx.transform.apply(ctx, entry.transform);\n      ctx.scale(1, -1);\n      ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);\n\n      if (this.imageLayer) {\n        const position = this.getCanvasPosition(entry.x, entry.y);\n        this.imageLayer.appendImage({\n          imgData,\n          left: position[0],\n          top: position[1],\n          width: w,\n          height: h\n        });\n      }\n\n      ctx.restore();\n    }\n\n    this.compose();\n  }\n\n  paintSolidColorImageMask() {\n    if (!this.contentVisible) {\n      return;\n    }\n\n    this.ctx.fillRect(0, 0, 1, 1);\n    this.compose();\n  }\n\n  markPoint(tag) {}\n\n  markPointProps(tag, properties) {}\n\n  beginMarkedContent(tag) {\n    this.markedContentStack.push({\n      visible: true\n    });\n  }\n\n  beginMarkedContentProps(tag, properties) {\n    if (tag === \"OC\") {\n      this.markedContentStack.push({\n        visible: this.optionalContentConfig.isVisible(properties)\n      });\n    } else {\n      this.markedContentStack.push({\n        visible: true\n      });\n    }\n\n    this.contentVisible = this.isContentVisible();\n  }\n\n  endMarkedContent() {\n    this.markedContentStack.pop();\n    this.contentVisible = this.isContentVisible();\n  }\n\n  beginCompat() {}\n\n  endCompat() {}\n\n  consumePath(clipBox) {\n    if (this.pendingClip) {\n      this.current.updateClipFromPath();\n    }\n\n    if (!this.pendingClip) {\n      this.compose(clipBox);\n    }\n\n    const ctx = this.ctx;\n\n    if (this.pendingClip) {\n      if (this.pendingClip === EO_CLIP) {\n        ctx.clip(\"evenodd\");\n      } else {\n        ctx.clip();\n      }\n\n      this.pendingClip = null;\n    }\n\n    this.current.startNewPathAndClipBox(this.current.clipBox);\n    ctx.beginPath();\n  }\n\n  getSinglePixelWidth() {\n    if (this._cachedGetSinglePixelWidth === null) {\n      const m = this.ctx.mozCurrentTransform;\n      const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);\n      const sqNorm1 = m[0] ** 2 + m[2] ** 2;\n      const sqNorm2 = m[1] ** 2 + m[3] ** 2;\n      const pixelHeight = Math.sqrt(Math.max(sqNorm1, sqNorm2)) / absDet;\n\n      if (sqNorm1 !== sqNorm2 && this._combinedScaleFactor * pixelHeight > 1) {\n        this._cachedGetSinglePixelWidth = -(this._combinedScaleFactor * pixelHeight);\n      } else if (absDet > Number.EPSILON) {\n        this._cachedGetSinglePixelWidth = pixelHeight;\n      } else {\n        this._cachedGetSinglePixelWidth = 1;\n      }\n    }\n\n    return this._cachedGetSinglePixelWidth;\n  }\n\n  getCanvasPosition(x, y) {\n    const transform = this.ctx.mozCurrentTransform;\n    return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]];\n  }\n\n  isContentVisible() {\n    for (let i = this.markedContentStack.length - 1; i >= 0; i--) {\n      if (!this.markedContentStack[i].visible) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n\n}\n\nexports.CanvasGraphics = CanvasGraphics;\n\nfor (const op in _util.OPS) {\n  if (CanvasGraphics.prototype[op] !== undefined) {\n    CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op];\n  }\n}\n\n/***/ }),\n/* 11 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.TilingPattern = exports.PathType = void 0;\nexports.getShadingPattern = getShadingPattern;\n\nvar _util = __w_pdfjs_require__(1);\n\nconst PathType = {\n  FILL: \"Fill\",\n  STROKE: \"Stroke\",\n  SHADING: \"Shading\"\n};\nexports.PathType = PathType;\n\nfunction applyBoundingBox(ctx, bbox) {\n  if (!bbox || typeof Path2D === \"undefined\") {\n    return;\n  }\n\n  const width = bbox[2] - bbox[0];\n  const height = bbox[3] - bbox[1];\n  const region = new Path2D();\n  region.rect(bbox[0], bbox[1], width, height);\n  ctx.clip(region);\n}\n\nclass BaseShadingPattern {\n  constructor() {\n    if (this.constructor === BaseShadingPattern) {\n      (0, _util.unreachable)(\"Cannot initialize BaseShadingPattern.\");\n    }\n  }\n\n  getPattern() {\n    (0, _util.unreachable)(\"Abstract method `getPattern` called.\");\n  }\n\n}\n\nclass RadialAxialShadingPattern extends BaseShadingPattern {\n  constructor(IR) {\n    super();\n    this._type = IR[1];\n    this._bbox = IR[2];\n    this._colorStops = IR[3];\n    this._p0 = IR[4];\n    this._p1 = IR[5];\n    this._r0 = IR[6];\n    this._r1 = IR[7];\n    this.matrix = null;\n  }\n\n  _createGradient(ctx) {\n    let grad;\n\n    if (this._type === \"axial\") {\n      grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);\n    } else if (this._type === \"radial\") {\n      grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);\n    }\n\n    for (const colorStop of this._colorStops) {\n      grad.addColorStop(colorStop[0], colorStop[1]);\n    }\n\n    return grad;\n  }\n\n  getPattern(ctx, owner, inverse, pathType) {\n    let pattern;\n\n    if (pathType === PathType.STROKE || pathType === PathType.FILL) {\n      const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, ctx.mozCurrentTransform) || [0, 0, 0, 0];\n      const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;\n      const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;\n      const tmpCanvas = owner.cachedCanvases.getCanvas(\"pattern\", width, height, true);\n      const tmpCtx = tmpCanvas.context;\n      tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n      tmpCtx.beginPath();\n      tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n      tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);\n      inverse = _util.Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);\n      tmpCtx.transform.apply(tmpCtx, owner.baseTransform);\n\n      if (this.matrix) {\n        tmpCtx.transform.apply(tmpCtx, this.matrix);\n      }\n\n      applyBoundingBox(tmpCtx, this._bbox);\n      tmpCtx.fillStyle = this._createGradient(tmpCtx);\n      tmpCtx.fill();\n      pattern = ctx.createPattern(tmpCanvas.canvas, \"no-repeat\");\n      const domMatrix = new DOMMatrix(inverse);\n\n      try {\n        pattern.setTransform(domMatrix);\n      } catch (ex) {\n        (0, _util.warn)(`RadialAxialShadingPattern.getPattern: \"${ex?.message}\".`);\n      }\n    } else {\n      applyBoundingBox(ctx, this._bbox);\n      pattern = this._createGradient(ctx);\n    }\n\n    return pattern;\n  }\n\n}\n\nfunction drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {\n  const coords = context.coords,\n        colors = context.colors;\n  const bytes = data.data,\n        rowSize = data.width * 4;\n  let tmp;\n\n  if (coords[p1 + 1] > coords[p2 + 1]) {\n    tmp = p1;\n    p1 = p2;\n    p2 = tmp;\n    tmp = c1;\n    c1 = c2;\n    c2 = tmp;\n  }\n\n  if (coords[p2 + 1] > coords[p3 + 1]) {\n    tmp = p2;\n    p2 = p3;\n    p3 = tmp;\n    tmp = c2;\n    c2 = c3;\n    c3 = tmp;\n  }\n\n  if (coords[p1 + 1] > coords[p2 + 1]) {\n    tmp = p1;\n    p1 = p2;\n    p2 = tmp;\n    tmp = c1;\n    c1 = c2;\n    c2 = tmp;\n  }\n\n  const x1 = (coords[p1] + context.offsetX) * context.scaleX;\n  const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;\n  const x2 = (coords[p2] + context.offsetX) * context.scaleX;\n  const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;\n  const x3 = (coords[p3] + context.offsetX) * context.scaleX;\n  const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;\n\n  if (y1 >= y3) {\n    return;\n  }\n\n  const c1r = colors[c1],\n        c1g = colors[c1 + 1],\n        c1b = colors[c1 + 2];\n  const c2r = colors[c2],\n        c2g = colors[c2 + 1],\n        c2b = colors[c2 + 2];\n  const c3r = colors[c3],\n        c3g = colors[c3 + 1],\n        c3b = colors[c3 + 2];\n  const minY = Math.round(y1),\n        maxY = Math.round(y3);\n  let xa, car, cag, cab;\n  let xb, cbr, cbg, cbb;\n\n  for (let y = minY; y <= maxY; y++) {\n    if (y < y2) {\n      let k;\n\n      if (y < y1) {\n        k = 0;\n      } else {\n        k = (y1 - y) / (y1 - y2);\n      }\n\n      xa = x1 - (x1 - x2) * k;\n      car = c1r - (c1r - c2r) * k;\n      cag = c1g - (c1g - c2g) * k;\n      cab = c1b - (c1b - c2b) * k;\n    } else {\n      let k;\n\n      if (y > y3) {\n        k = 1;\n      } else if (y2 === y3) {\n        k = 0;\n      } else {\n        k = (y2 - y) / (y2 - y3);\n      }\n\n      xa = x2 - (x2 - x3) * k;\n      car = c2r - (c2r - c3r) * k;\n      cag = c2g - (c2g - c3g) * k;\n      cab = c2b - (c2b - c3b) * k;\n    }\n\n    let k;\n\n    if (y < y1) {\n      k = 0;\n    } else if (y > y3) {\n      k = 1;\n    } else {\n      k = (y1 - y) / (y1 - y3);\n    }\n\n    xb = x1 - (x1 - x3) * k;\n    cbr = c1r - (c1r - c3r) * k;\n    cbg = c1g - (c1g - c3g) * k;\n    cbb = c1b - (c1b - c3b) * k;\n    const x1_ = Math.round(Math.min(xa, xb));\n    const x2_ = Math.round(Math.max(xa, xb));\n    let j = rowSize * y + x1_ * 4;\n\n    for (let x = x1_; x <= x2_; x++) {\n      k = (xa - x) / (xa - xb);\n\n      if (k < 0) {\n        k = 0;\n      } else if (k > 1) {\n        k = 1;\n      }\n\n      bytes[j++] = car - (car - cbr) * k | 0;\n      bytes[j++] = cag - (cag - cbg) * k | 0;\n      bytes[j++] = cab - (cab - cbb) * k | 0;\n      bytes[j++] = 255;\n    }\n  }\n}\n\nfunction drawFigure(data, figure, context) {\n  const ps = figure.coords;\n  const cs = figure.colors;\n  let i, ii;\n\n  switch (figure.type) {\n    case \"lattice\":\n      const verticesPerRow = figure.verticesPerRow;\n      const rows = Math.floor(ps.length / verticesPerRow) - 1;\n      const cols = verticesPerRow - 1;\n\n      for (i = 0; i < rows; i++) {\n        let q = i * verticesPerRow;\n\n        for (let j = 0; j < cols; j++, q++) {\n          drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);\n          drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);\n        }\n      }\n\n      break;\n\n    case \"triangles\":\n      for (i = 0, ii = ps.length; i < ii; i += 3) {\n        drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);\n      }\n\n      break;\n\n    default:\n      throw new Error(\"illegal figure\");\n  }\n}\n\nclass MeshShadingPattern extends BaseShadingPattern {\n  constructor(IR) {\n    super();\n    this._coords = IR[2];\n    this._colors = IR[3];\n    this._figures = IR[4];\n    this._bounds = IR[5];\n    this._bbox = IR[7];\n    this._background = IR[8];\n    this.matrix = null;\n  }\n\n  _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {\n    const EXPECTED_SCALE = 1.1;\n    const MAX_PATTERN_SIZE = 3000;\n    const BORDER_SIZE = 2;\n    const offsetX = Math.floor(this._bounds[0]);\n    const offsetY = Math.floor(this._bounds[1]);\n    const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;\n    const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;\n    const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);\n    const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);\n    const scaleX = boundsWidth / width;\n    const scaleY = boundsHeight / height;\n    const context = {\n      coords: this._coords,\n      colors: this._colors,\n      offsetX: -offsetX,\n      offsetY: -offsetY,\n      scaleX: 1 / scaleX,\n      scaleY: 1 / scaleY\n    };\n    const paddedWidth = width + BORDER_SIZE * 2;\n    const paddedHeight = height + BORDER_SIZE * 2;\n    const tmpCanvas = cachedCanvases.getCanvas(\"mesh\", paddedWidth, paddedHeight, false);\n    const tmpCtx = tmpCanvas.context;\n    const data = tmpCtx.createImageData(width, height);\n\n    if (backgroundColor) {\n      const bytes = data.data;\n\n      for (let i = 0, ii = bytes.length; i < ii; i += 4) {\n        bytes[i] = backgroundColor[0];\n        bytes[i + 1] = backgroundColor[1];\n        bytes[i + 2] = backgroundColor[2];\n        bytes[i + 3] = 255;\n      }\n    }\n\n    for (const figure of this._figures) {\n      drawFigure(data, figure, context);\n    }\n\n    tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);\n    const canvas = tmpCanvas.canvas;\n    return {\n      canvas,\n      offsetX: offsetX - BORDER_SIZE * scaleX,\n      offsetY: offsetY - BORDER_SIZE * scaleY,\n      scaleX,\n      scaleY\n    };\n  }\n\n  getPattern(ctx, owner, inverse, pathType) {\n    applyBoundingBox(ctx, this._bbox);\n    let scale;\n\n    if (pathType === PathType.SHADING) {\n      scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);\n    } else {\n      scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);\n\n      if (this.matrix) {\n        const matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);\n\n        scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];\n      }\n    }\n\n    const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);\n\n    if (pathType !== PathType.SHADING) {\n      ctx.setTransform.apply(ctx, owner.baseTransform);\n\n      if (this.matrix) {\n        ctx.transform.apply(ctx, this.matrix);\n      }\n    }\n\n    ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);\n    ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);\n    return ctx.createPattern(temporaryPatternCanvas.canvas, \"no-repeat\");\n  }\n\n}\n\nclass DummyShadingPattern extends BaseShadingPattern {\n  getPattern() {\n    return \"hotpink\";\n  }\n\n}\n\nfunction getShadingPattern(IR) {\n  switch (IR[0]) {\n    case \"RadialAxial\":\n      return new RadialAxialShadingPattern(IR);\n\n    case \"Mesh\":\n      return new MeshShadingPattern(IR);\n\n    case \"Dummy\":\n      return new DummyShadingPattern();\n  }\n\n  throw new Error(`Unknown IR type: ${IR[0]}`);\n}\n\nconst PaintType = {\n  COLORED: 1,\n  UNCOLORED: 2\n};\n\nclass TilingPattern {\n  static get MAX_PATTERN_SIZE() {\n    return (0, _util.shadow)(this, \"MAX_PATTERN_SIZE\", 3000);\n  }\n\n  constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {\n    this.operatorList = IR[2];\n    this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];\n    this.bbox = IR[4];\n    this.xstep = IR[5];\n    this.ystep = IR[6];\n    this.paintType = IR[7];\n    this.tilingType = IR[8];\n    this.color = color;\n    this.ctx = ctx;\n    this.canvasGraphicsFactory = canvasGraphicsFactory;\n    this.baseTransform = baseTransform;\n  }\n\n  createPatternCanvas(owner) {\n    const operatorList = this.operatorList;\n    const bbox = this.bbox;\n    const xstep = this.xstep;\n    const ystep = this.ystep;\n    const paintType = this.paintType;\n    const tilingType = this.tilingType;\n    const color = this.color;\n    const canvasGraphicsFactory = this.canvasGraphicsFactory;\n    (0, _util.info)(\"TilingType: \" + tilingType);\n    const x0 = bbox[0],\n          y0 = bbox[1],\n          x1 = bbox[2],\n          y1 = bbox[3];\n\n    const matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);\n\n    const curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform);\n\n    const combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];\n    const dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);\n    const dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);\n    const tmpCanvas = owner.cachedCanvases.getCanvas(\"pattern\", dimx.size, dimy.size, true);\n    const tmpCtx = tmpCanvas.context;\n    const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);\n    graphics.groupLevel = owner.groupLevel;\n    this.setFillAndStrokeStyleToContext(graphics, paintType, color);\n    let adjustedX0 = x0;\n    let adjustedY0 = y0;\n    let adjustedX1 = x1;\n    let adjustedY1 = y1;\n\n    if (x0 < 0) {\n      adjustedX0 = 0;\n      adjustedX1 += Math.abs(x0);\n    }\n\n    if (y0 < 0) {\n      adjustedY0 = 0;\n      adjustedY1 += Math.abs(y0);\n    }\n\n    tmpCtx.translate(-(dimx.scale * adjustedX0), -(dimy.scale * adjustedY0));\n    graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);\n    tmpCtx.save();\n    this.clipBbox(graphics, adjustedX0, adjustedY0, adjustedX1, adjustedY1);\n    graphics.baseTransform = graphics.ctx.mozCurrentTransform.slice();\n    graphics.executeOperatorList(operatorList);\n    graphics.endDrawing();\n    return {\n      canvas: tmpCanvas.canvas,\n      scaleX: dimx.scale,\n      scaleY: dimy.scale,\n      offsetX: adjustedX0,\n      offsetY: adjustedY0\n    };\n  }\n\n  getSizeAndScale(step, realOutputSize, scale) {\n    step = Math.abs(step);\n    const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);\n    let size = Math.ceil(step * scale);\n\n    if (size >= maxSize) {\n      size = maxSize;\n    } else {\n      scale = size / step;\n    }\n\n    return {\n      scale,\n      size\n    };\n  }\n\n  clipBbox(graphics, x0, y0, x1, y1) {\n    const bboxWidth = x1 - x0;\n    const bboxHeight = y1 - y0;\n    graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);\n    graphics.clip();\n    graphics.endPath();\n  }\n\n  setFillAndStrokeStyleToContext(graphics, paintType, color) {\n    const context = graphics.ctx,\n          current = graphics.current;\n\n    switch (paintType) {\n      case PaintType.COLORED:\n        const ctx = this.ctx;\n        context.fillStyle = ctx.fillStyle;\n        context.strokeStyle = ctx.strokeStyle;\n        current.fillColor = ctx.fillStyle;\n        current.strokeColor = ctx.strokeStyle;\n        break;\n\n      case PaintType.UNCOLORED:\n        const cssColor = _util.Util.makeHexColor(color[0], color[1], color[2]);\n\n        context.fillStyle = cssColor;\n        context.strokeStyle = cssColor;\n        current.fillColor = cssColor;\n        current.strokeColor = cssColor;\n        break;\n\n      default:\n        throw new _util.FormatError(`Unsupported paint type: ${paintType}`);\n    }\n  }\n\n  getPattern(ctx, owner, inverse, pathType) {\n    let matrix = inverse;\n\n    if (pathType !== PathType.SHADING) {\n      matrix = _util.Util.transform(matrix, owner.baseTransform);\n\n      if (this.matrix) {\n        matrix = _util.Util.transform(matrix, this.matrix);\n      }\n    }\n\n    const temporaryPatternCanvas = this.createPatternCanvas(owner);\n    let domMatrix = new DOMMatrix(matrix);\n    domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);\n    domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);\n    const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, \"repeat\");\n\n    try {\n      pattern.setTransform(domMatrix);\n    } catch (ex) {\n      (0, _util.warn)(`TilingPattern.getPattern: \"${ex?.message}\".`);\n    }\n\n    return pattern;\n  }\n\n}\n\nexports.TilingPattern = TilingPattern;\n\n/***/ }),\n/* 12 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.GlobalWorkerOptions = void 0;\nconst GlobalWorkerOptions = Object.create(null);\nexports.GlobalWorkerOptions = GlobalWorkerOptions;\nGlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort;\nGlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? \"\" : GlobalWorkerOptions.workerSrc;\n\n/***/ }),\n/* 13 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.MessageHandler = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nconst CallbackKind = {\n  UNKNOWN: 0,\n  DATA: 1,\n  ERROR: 2\n};\nconst StreamKind = {\n  UNKNOWN: 0,\n  CANCEL: 1,\n  CANCEL_COMPLETE: 2,\n  CLOSE: 3,\n  ENQUEUE: 4,\n  ERROR: 5,\n  PULL: 6,\n  PULL_COMPLETE: 7,\n  START_COMPLETE: 8\n};\n\nfunction wrapReason(reason) {\n  if (!(reason instanceof Error || typeof reason === \"object\" && reason !== null)) {\n    (0, _util.unreachable)('wrapReason: Expected \"reason\" to be a (possibly cloned) Error.');\n  }\n\n  switch (reason.name) {\n    case \"AbortException\":\n      return new _util.AbortException(reason.message);\n\n    case \"MissingPDFException\":\n      return new _util.MissingPDFException(reason.message);\n\n    case \"PasswordException\":\n      return new _util.PasswordException(reason.message, reason.code);\n\n    case \"UnexpectedResponseException\":\n      return new _util.UnexpectedResponseException(reason.message, reason.status);\n\n    case \"UnknownErrorException\":\n      return new _util.UnknownErrorException(reason.message, reason.details);\n\n    default:\n      return new _util.UnknownErrorException(reason.message, reason.toString());\n  }\n}\n\nclass MessageHandler {\n  constructor(sourceName, targetName, comObj) {\n    this.sourceName = sourceName;\n    this.targetName = targetName;\n    this.comObj = comObj;\n    this.callbackId = 1;\n    this.streamId = 1;\n    this.streamSinks = Object.create(null);\n    this.streamControllers = Object.create(null);\n    this.callbackCapabilities = Object.create(null);\n    this.actionHandler = Object.create(null);\n\n    this._onComObjOnMessage = event => {\n      const data = event.data;\n\n      if (data.targetName !== this.sourceName) {\n        return;\n      }\n\n      if (data.stream) {\n        this._processStreamMessage(data);\n\n        return;\n      }\n\n      if (data.callback) {\n        const callbackId = data.callbackId;\n        const capability = this.callbackCapabilities[callbackId];\n\n        if (!capability) {\n          throw new Error(`Cannot resolve callback ${callbackId}`);\n        }\n\n        delete this.callbackCapabilities[callbackId];\n\n        if (data.callback === CallbackKind.DATA) {\n          capability.resolve(data.data);\n        } else if (data.callback === CallbackKind.ERROR) {\n          capability.reject(wrapReason(data.reason));\n        } else {\n          throw new Error(\"Unexpected callback case\");\n        }\n\n        return;\n      }\n\n      const action = this.actionHandler[data.action];\n\n      if (!action) {\n        throw new Error(`Unknown action from worker: ${data.action}`);\n      }\n\n      if (data.callbackId) {\n        const cbSourceName = this.sourceName;\n        const cbTargetName = data.sourceName;\n        new Promise(function (resolve) {\n          resolve(action(data.data));\n        }).then(function (result) {\n          comObj.postMessage({\n            sourceName: cbSourceName,\n            targetName: cbTargetName,\n            callback: CallbackKind.DATA,\n            callbackId: data.callbackId,\n            data: result\n          });\n        }, function (reason) {\n          comObj.postMessage({\n            sourceName: cbSourceName,\n            targetName: cbTargetName,\n            callback: CallbackKind.ERROR,\n            callbackId: data.callbackId,\n            reason: wrapReason(reason)\n          });\n        });\n        return;\n      }\n\n      if (data.streamId) {\n        this._createStreamSink(data);\n\n        return;\n      }\n\n      action(data.data);\n    };\n\n    comObj.addEventListener(\"message\", this._onComObjOnMessage);\n  }\n\n  on(actionName, handler) {\n    const ah = this.actionHandler;\n\n    if (ah[actionName]) {\n      throw new Error(`There is already an actionName called \"${actionName}\"`);\n    }\n\n    ah[actionName] = handler;\n  }\n\n  send(actionName, data, transfers) {\n    this.comObj.postMessage({\n      sourceName: this.sourceName,\n      targetName: this.targetName,\n      action: actionName,\n      data\n    }, transfers);\n  }\n\n  sendWithPromise(actionName, data, transfers) {\n    const callbackId = this.callbackId++;\n    const capability = (0, _util.createPromiseCapability)();\n    this.callbackCapabilities[callbackId] = capability;\n\n    try {\n      this.comObj.postMessage({\n        sourceName: this.sourceName,\n        targetName: this.targetName,\n        action: actionName,\n        callbackId,\n        data\n      }, transfers);\n    } catch (ex) {\n      capability.reject(ex);\n    }\n\n    return capability.promise;\n  }\n\n  sendWithStream(actionName, data, queueingStrategy, transfers) {\n    const streamId = this.streamId++,\n          sourceName = this.sourceName,\n          targetName = this.targetName,\n          comObj = this.comObj;\n    return new ReadableStream({\n      start: controller => {\n        const startCapability = (0, _util.createPromiseCapability)();\n        this.streamControllers[streamId] = {\n          controller,\n          startCall: startCapability,\n          pullCall: null,\n          cancelCall: null,\n          isClosed: false\n        };\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          action: actionName,\n          streamId,\n          data,\n          desiredSize: controller.desiredSize\n        }, transfers);\n        return startCapability.promise;\n      },\n      pull: controller => {\n        const pullCapability = (0, _util.createPromiseCapability)();\n        this.streamControllers[streamId].pullCall = pullCapability;\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          stream: StreamKind.PULL,\n          streamId,\n          desiredSize: controller.desiredSize\n        });\n        return pullCapability.promise;\n      },\n      cancel: reason => {\n        (0, _util.assert)(reason instanceof Error, \"cancel must have a valid reason\");\n        const cancelCapability = (0, _util.createPromiseCapability)();\n        this.streamControllers[streamId].cancelCall = cancelCapability;\n        this.streamControllers[streamId].isClosed = true;\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          stream: StreamKind.CANCEL,\n          streamId,\n          reason: wrapReason(reason)\n        });\n        return cancelCapability.promise;\n      }\n    }, queueingStrategy);\n  }\n\n  _createStreamSink(data) {\n    const streamId = data.streamId,\n          sourceName = this.sourceName,\n          targetName = data.sourceName,\n          comObj = this.comObj;\n    const self = this,\n          action = this.actionHandler[data.action];\n    const streamSink = {\n      enqueue(chunk, size = 1, transfers) {\n        if (this.isCancelled) {\n          return;\n        }\n\n        const lastDesiredSize = this.desiredSize;\n        this.desiredSize -= size;\n\n        if (lastDesiredSize > 0 && this.desiredSize <= 0) {\n          this.sinkCapability = (0, _util.createPromiseCapability)();\n          this.ready = this.sinkCapability.promise;\n        }\n\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          stream: StreamKind.ENQUEUE,\n          streamId,\n          chunk\n        }, transfers);\n      },\n\n      close() {\n        if (this.isCancelled) {\n          return;\n        }\n\n        this.isCancelled = true;\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          stream: StreamKind.CLOSE,\n          streamId\n        });\n        delete self.streamSinks[streamId];\n      },\n\n      error(reason) {\n        (0, _util.assert)(reason instanceof Error, \"error must have a valid reason\");\n\n        if (this.isCancelled) {\n          return;\n        }\n\n        this.isCancelled = true;\n        comObj.postMessage({\n          sourceName,\n          targetName,\n          stream: StreamKind.ERROR,\n          streamId,\n          reason: wrapReason(reason)\n        });\n      },\n\n      sinkCapability: (0, _util.createPromiseCapability)(),\n      onPull: null,\n      onCancel: null,\n      isCancelled: false,\n      desiredSize: data.desiredSize,\n      ready: null\n    };\n    streamSink.sinkCapability.resolve();\n    streamSink.ready = streamSink.sinkCapability.promise;\n    this.streamSinks[streamId] = streamSink;\n    new Promise(function (resolve) {\n      resolve(action(data.data, streamSink));\n    }).then(function () {\n      comObj.postMessage({\n        sourceName,\n        targetName,\n        stream: StreamKind.START_COMPLETE,\n        streamId,\n        success: true\n      });\n    }, function (reason) {\n      comObj.postMessage({\n        sourceName,\n        targetName,\n        stream: StreamKind.START_COMPLETE,\n        streamId,\n        reason: wrapReason(reason)\n      });\n    });\n  }\n\n  _processStreamMessage(data) {\n    const streamId = data.streamId,\n          sourceName = this.sourceName,\n          targetName = data.sourceName,\n          comObj = this.comObj;\n    const streamController = this.streamControllers[streamId],\n          streamSink = this.streamSinks[streamId];\n\n    switch (data.stream) {\n      case StreamKind.START_COMPLETE:\n        if (data.success) {\n          streamController.startCall.resolve();\n        } else {\n          streamController.startCall.reject(wrapReason(data.reason));\n        }\n\n        break;\n\n      case StreamKind.PULL_COMPLETE:\n        if (data.success) {\n          streamController.pullCall.resolve();\n        } else {\n          streamController.pullCall.reject(wrapReason(data.reason));\n        }\n\n        break;\n\n      case StreamKind.PULL:\n        if (!streamSink) {\n          comObj.postMessage({\n            sourceName,\n            targetName,\n            stream: StreamKind.PULL_COMPLETE,\n            streamId,\n            success: true\n          });\n          break;\n        }\n\n        if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {\n          streamSink.sinkCapability.resolve();\n        }\n\n        streamSink.desiredSize = data.desiredSize;\n        new Promise(function (resolve) {\n          resolve(streamSink.onPull && streamSink.onPull());\n        }).then(function () {\n          comObj.postMessage({\n            sourceName,\n            targetName,\n            stream: StreamKind.PULL_COMPLETE,\n            streamId,\n            success: true\n          });\n        }, function (reason) {\n          comObj.postMessage({\n            sourceName,\n            targetName,\n            stream: StreamKind.PULL_COMPLETE,\n            streamId,\n            reason: wrapReason(reason)\n          });\n        });\n        break;\n\n      case StreamKind.ENQUEUE:\n        (0, _util.assert)(streamController, \"enqueue should have stream controller\");\n\n        if (streamController.isClosed) {\n          break;\n        }\n\n        streamController.controller.enqueue(data.chunk);\n        break;\n\n      case StreamKind.CLOSE:\n        (0, _util.assert)(streamController, \"close should have stream controller\");\n\n        if (streamController.isClosed) {\n          break;\n        }\n\n        streamController.isClosed = true;\n        streamController.controller.close();\n\n        this._deleteStreamController(streamController, streamId);\n\n        break;\n\n      case StreamKind.ERROR:\n        (0, _util.assert)(streamController, \"error should have stream controller\");\n        streamController.controller.error(wrapReason(data.reason));\n\n        this._deleteStreamController(streamController, streamId);\n\n        break;\n\n      case StreamKind.CANCEL_COMPLETE:\n        if (data.success) {\n          streamController.cancelCall.resolve();\n        } else {\n          streamController.cancelCall.reject(wrapReason(data.reason));\n        }\n\n        this._deleteStreamController(streamController, streamId);\n\n        break;\n\n      case StreamKind.CANCEL:\n        if (!streamSink) {\n          break;\n        }\n\n        new Promise(function (resolve) {\n          resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));\n        }).then(function () {\n          comObj.postMessage({\n            sourceName,\n            targetName,\n            stream: StreamKind.CANCEL_COMPLETE,\n            streamId,\n            success: true\n          });\n        }, function (reason) {\n          comObj.postMessage({\n            sourceName,\n            targetName,\n            stream: StreamKind.CANCEL_COMPLETE,\n            streamId,\n            reason: wrapReason(reason)\n          });\n        });\n        streamSink.sinkCapability.reject(wrapReason(data.reason));\n        streamSink.isCancelled = true;\n        delete this.streamSinks[streamId];\n        break;\n\n      default:\n        throw new Error(\"Unexpected stream case\");\n    }\n  }\n\n  async _deleteStreamController(streamController, streamId) {\n    await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);\n    delete this.streamControllers[streamId];\n  }\n\n  destroy() {\n    this.comObj.removeEventListener(\"message\", this._onComObjOnMessage);\n  }\n\n}\n\nexports.MessageHandler = MessageHandler;\n\n/***/ }),\n/* 14 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.Metadata = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nclass Metadata {\n  #metadataMap;\n  #data;\n\n  constructor({\n    parsedData,\n    rawData\n  }) {\n    this.#metadataMap = parsedData;\n    this.#data = rawData;\n  }\n\n  getRaw() {\n    return this.#data;\n  }\n\n  get(name) {\n    return this.#metadataMap.get(name) ?? null;\n  }\n\n  getAll() {\n    return (0, _util.objectFromMap)(this.#metadataMap);\n  }\n\n  has(name) {\n    return this.#metadataMap.has(name);\n  }\n\n}\n\nexports.Metadata = Metadata;\n\n/***/ }),\n/* 15 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.OptionalContentConfig = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nclass OptionalContentGroup {\n  constructor(name, intent) {\n    this.visible = true;\n    this.name = name;\n    this.intent = intent;\n  }\n\n}\n\nclass OptionalContentConfig {\n  constructor(data) {\n    this.name = null;\n    this.creator = null;\n    this._order = null;\n    this._groups = new Map();\n\n    if (data === null) {\n      return;\n    }\n\n    this.name = data.name;\n    this.creator = data.creator;\n    this._order = data.order;\n\n    for (const group of data.groups) {\n      this._groups.set(group.id, new OptionalContentGroup(group.name, group.intent));\n    }\n\n    if (data.baseState === \"OFF\") {\n      for (const group of this._groups) {\n        group.visible = false;\n      }\n    }\n\n    for (const on of data.on) {\n      this._groups.get(on).visible = true;\n    }\n\n    for (const off of data.off) {\n      this._groups.get(off).visible = false;\n    }\n  }\n\n  _evaluateVisibilityExpression(array) {\n    const length = array.length;\n\n    if (length < 2) {\n      return true;\n    }\n\n    const operator = array[0];\n\n    for (let i = 1; i < length; i++) {\n      const element = array[i];\n      let state;\n\n      if (Array.isArray(element)) {\n        state = this._evaluateVisibilityExpression(element);\n      } else if (this._groups.has(element)) {\n        state = this._groups.get(element).visible;\n      } else {\n        (0, _util.warn)(`Optional content group not found: ${element}`);\n        return true;\n      }\n\n      switch (operator) {\n        case \"And\":\n          if (!state) {\n            return false;\n          }\n\n          break;\n\n        case \"Or\":\n          if (state) {\n            return true;\n          }\n\n          break;\n\n        case \"Not\":\n          return !state;\n\n        default:\n          return true;\n      }\n    }\n\n    return operator === \"And\";\n  }\n\n  isVisible(group) {\n    if (this._groups.size === 0) {\n      return true;\n    }\n\n    if (!group) {\n      (0, _util.warn)(\"Optional content group not defined.\");\n      return true;\n    }\n\n    if (group.type === \"OCG\") {\n      if (!this._groups.has(group.id)) {\n        (0, _util.warn)(`Optional content group not found: ${group.id}`);\n        return true;\n      }\n\n      return this._groups.get(group.id).visible;\n    } else if (group.type === \"OCMD\") {\n      if (group.expression) {\n        return this._evaluateVisibilityExpression(group.expression);\n      }\n\n      if (!group.policy || group.policy === \"AnyOn\") {\n        for (const id of group.ids) {\n          if (!this._groups.has(id)) {\n            (0, _util.warn)(`Optional content group not found: ${id}`);\n            return true;\n          }\n\n          if (this._groups.get(id).visible) {\n            return true;\n          }\n        }\n\n        return false;\n      } else if (group.policy === \"AllOn\") {\n        for (const id of group.ids) {\n          if (!this._groups.has(id)) {\n            (0, _util.warn)(`Optional content group not found: ${id}`);\n            return true;\n          }\n\n          if (!this._groups.get(id).visible) {\n            return false;\n          }\n        }\n\n        return true;\n      } else if (group.policy === \"AnyOff\") {\n        for (const id of group.ids) {\n          if (!this._groups.has(id)) {\n            (0, _util.warn)(`Optional content group not found: ${id}`);\n            return true;\n          }\n\n          if (!this._groups.get(id).visible) {\n            return true;\n          }\n        }\n\n        return false;\n      } else if (group.policy === \"AllOff\") {\n        for (const id of group.ids) {\n          if (!this._groups.has(id)) {\n            (0, _util.warn)(`Optional content group not found: ${id}`);\n            return true;\n          }\n\n          if (this._groups.get(id).visible) {\n            return false;\n          }\n        }\n\n        return true;\n      }\n\n      (0, _util.warn)(`Unknown optional content policy ${group.policy}.`);\n      return true;\n    }\n\n    (0, _util.warn)(`Unknown group type ${group.type}.`);\n    return true;\n  }\n\n  setVisibility(id, visible = true) {\n    if (!this._groups.has(id)) {\n      (0, _util.warn)(`Optional content group not found: ${id}`);\n      return;\n    }\n\n    this._groups.get(id).visible = !!visible;\n  }\n\n  getOrder() {\n    if (!this._groups.size) {\n      return null;\n    }\n\n    if (this._order) {\n      return this._order.slice();\n    }\n\n    return Array.from(this._groups.keys());\n  }\n\n  getGroups() {\n    return this._groups.size > 0 ? (0, _util.objectFromMap)(this._groups) : null;\n  }\n\n  getGroup(id) {\n    return this._groups.get(id) || null;\n  }\n\n}\n\nexports.OptionalContentConfig = OptionalContentConfig;\n\n/***/ }),\n/* 16 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.PDFDataTransportStream = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nclass PDFDataTransportStream {\n  constructor(params, pdfDataRangeTransport) {\n    (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required \"pdfDataRangeTransport\" argument.');\n    this._queuedChunks = [];\n    this._progressiveDone = params.progressiveDone || false;\n    this._contentDispositionFilename = params.contentDispositionFilename || null;\n    const initialData = params.initialData;\n\n    if (initialData?.length > 0) {\n      const buffer = new Uint8Array(initialData).buffer;\n\n      this._queuedChunks.push(buffer);\n    }\n\n    this._pdfDataRangeTransport = pdfDataRangeTransport;\n    this._isStreamingSupported = !params.disableStream;\n    this._isRangeSupported = !params.disableRange;\n    this._contentLength = params.length;\n    this._fullRequestReader = null;\n    this._rangeReaders = [];\n\n    this._pdfDataRangeTransport.addRangeListener((begin, chunk) => {\n      this._onReceiveData({\n        begin,\n        chunk\n      });\n    });\n\n    this._pdfDataRangeTransport.addProgressListener((loaded, total) => {\n      this._onProgress({\n        loaded,\n        total\n      });\n    });\n\n    this._pdfDataRangeTransport.addProgressiveReadListener(chunk => {\n      this._onReceiveData({\n        chunk\n      });\n    });\n\n    this._pdfDataRangeTransport.addProgressiveDoneListener(() => {\n      this._onProgressiveDone();\n    });\n\n    this._pdfDataRangeTransport.transportReady();\n  }\n\n  _onReceiveData(args) {\n    const buffer = new Uint8Array(args.chunk).buffer;\n\n    if (args.begin === undefined) {\n      if (this._fullRequestReader) {\n        this._fullRequestReader._enqueue(buffer);\n      } else {\n        this._queuedChunks.push(buffer);\n      }\n    } else {\n      const found = this._rangeReaders.some(function (rangeReader) {\n        if (rangeReader._begin !== args.begin) {\n          return false;\n        }\n\n        rangeReader._enqueue(buffer);\n\n        return true;\n      });\n\n      (0, _util.assert)(found, \"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.\");\n    }\n  }\n\n  get _progressiveDataLength() {\n    return this._fullRequestReader?._loaded ?? 0;\n  }\n\n  _onProgress(evt) {\n    if (evt.total === undefined) {\n      const firstReader = this._rangeReaders[0];\n\n      if (firstReader?.onProgress) {\n        firstReader.onProgress({\n          loaded: evt.loaded\n        });\n      }\n    } else {\n      const fullReader = this._fullRequestReader;\n\n      if (fullReader?.onProgress) {\n        fullReader.onProgress({\n          loaded: evt.loaded,\n          total: evt.total\n        });\n      }\n    }\n  }\n\n  _onProgressiveDone() {\n    if (this._fullRequestReader) {\n      this._fullRequestReader.progressiveDone();\n    }\n\n    this._progressiveDone = true;\n  }\n\n  _removeRangeReader(reader) {\n    const i = this._rangeReaders.indexOf(reader);\n\n    if (i >= 0) {\n      this._rangeReaders.splice(i, 1);\n    }\n  }\n\n  getFullReader() {\n    (0, _util.assert)(!this._fullRequestReader, \"PDFDataTransportStream.getFullReader can only be called once.\");\n    const queuedChunks = this._queuedChunks;\n    this._queuedChunks = null;\n    return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename);\n  }\n\n  getRangeReader(begin, end) {\n    if (end <= this._progressiveDataLength) {\n      return null;\n    }\n\n    const reader = new PDFDataTransportStreamRangeReader(this, begin, end);\n\n    this._pdfDataRangeTransport.requestDataRange(begin, end);\n\n    this._rangeReaders.push(reader);\n\n    return reader;\n  }\n\n  cancelAllRequests(reason) {\n    if (this._fullRequestReader) {\n      this._fullRequestReader.cancel(reason);\n    }\n\n    for (const reader of this._rangeReaders.slice(0)) {\n      reader.cancel(reason);\n    }\n\n    this._pdfDataRangeTransport.abort();\n  }\n\n}\n\nexports.PDFDataTransportStream = PDFDataTransportStream;\n\nclass PDFDataTransportStreamReader {\n  constructor(stream, queuedChunks, progressiveDone = false, contentDispositionFilename = null) {\n    this._stream = stream;\n    this._done = progressiveDone || false;\n    this._filename = (0, _display_utils.isPdfFile)(contentDispositionFilename) ? contentDispositionFilename : null;\n    this._queuedChunks = queuedChunks || [];\n    this._loaded = 0;\n\n    for (const chunk of this._queuedChunks) {\n      this._loaded += chunk.byteLength;\n    }\n\n    this._requests = [];\n    this._headersReady = Promise.resolve();\n    stream._fullRequestReader = this;\n    this.onProgress = null;\n  }\n\n  _enqueue(chunk) {\n    if (this._done) {\n      return;\n    }\n\n    if (this._requests.length > 0) {\n      const requestCapability = this._requests.shift();\n\n      requestCapability.resolve({\n        value: chunk,\n        done: false\n      });\n    } else {\n      this._queuedChunks.push(chunk);\n    }\n\n    this._loaded += chunk.byteLength;\n  }\n\n  get headersReady() {\n    return this._headersReady;\n  }\n\n  get filename() {\n    return this._filename;\n  }\n\n  get isRangeSupported() {\n    return this._stream._isRangeSupported;\n  }\n\n  get isStreamingSupported() {\n    return this._stream._isStreamingSupported;\n  }\n\n  get contentLength() {\n    return this._stream._contentLength;\n  }\n\n  async read() {\n    if (this._queuedChunks.length > 0) {\n      const chunk = this._queuedChunks.shift();\n\n      return {\n        value: chunk,\n        done: false\n      };\n    }\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    const requestCapability = (0, _util.createPromiseCapability)();\n\n    this._requests.push(requestCapability);\n\n    return requestCapability.promise;\n  }\n\n  cancel(reason) {\n    this._done = true;\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n  }\n\n  progressiveDone() {\n    if (this._done) {\n      return;\n    }\n\n    this._done = true;\n  }\n\n}\n\nclass PDFDataTransportStreamRangeReader {\n  constructor(stream, begin, end) {\n    this._stream = stream;\n    this._begin = begin;\n    this._end = end;\n    this._queuedChunk = null;\n    this._requests = [];\n    this._done = false;\n    this.onProgress = null;\n  }\n\n  _enqueue(chunk) {\n    if (this._done) {\n      return;\n    }\n\n    if (this._requests.length === 0) {\n      this._queuedChunk = chunk;\n    } else {\n      const requestsCapability = this._requests.shift();\n\n      requestsCapability.resolve({\n        value: chunk,\n        done: false\n      });\n\n      for (const requestCapability of this._requests) {\n        requestCapability.resolve({\n          value: undefined,\n          done: true\n        });\n      }\n\n      this._requests.length = 0;\n    }\n\n    this._done = true;\n\n    this._stream._removeRangeReader(this);\n  }\n\n  get isStreamingSupported() {\n    return false;\n  }\n\n  async read() {\n    if (this._queuedChunk) {\n      const chunk = this._queuedChunk;\n      this._queuedChunk = null;\n      return {\n        value: chunk,\n        done: false\n      };\n    }\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    const requestCapability = (0, _util.createPromiseCapability)();\n\n    this._requests.push(requestCapability);\n\n    return requestCapability.promise;\n  }\n\n  cancel(reason) {\n    this._done = true;\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n\n    this._stream._removeRangeReader(this);\n  }\n\n}\n\n/***/ }),\n/* 17 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.XfaText = void 0;\n\nclass XfaText {\n  static textContent(xfa) {\n    const items = [];\n    const output = {\n      items,\n      styles: Object.create(null)\n    };\n\n    function walk(node) {\n      if (!node) {\n        return;\n      }\n\n      let str = null;\n      const name = node.name;\n\n      if (name === \"#text\") {\n        str = node.value;\n      } else if (!XfaText.shouldBuildText(name)) {\n        return;\n      } else if (node?.attributes?.textContent) {\n        str = node.attributes.textContent;\n      } else if (node.value) {\n        str = node.value;\n      }\n\n      if (str !== null) {\n        items.push({\n          str\n        });\n      }\n\n      if (!node.children) {\n        return;\n      }\n\n      for (const child of node.children) {\n        walk(child);\n      }\n    }\n\n    walk(xfa);\n    return output;\n  }\n\n  static shouldBuildText(name) {\n    return !(name === \"textarea\" || name === \"input\" || name === \"option\" || name === \"select\");\n  }\n\n}\n\nexports.XfaText = XfaText;\n\n/***/ }),\n/* 18 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.AnnotationLayer = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nvar _annotation_storage = __w_pdfjs_require__(9);\n\nvar _scripting_utils = __w_pdfjs_require__(19);\n\nvar _xfa_layer = __w_pdfjs_require__(20);\n\nconst DEFAULT_TAB_INDEX = 1000;\nconst GetElementsByNameSet = new WeakSet();\n\nfunction getRectDims(rect) {\n  return {\n    width: rect[2] - rect[0],\n    height: rect[3] - rect[1]\n  };\n}\n\nclass AnnotationElementFactory {\n  static create(parameters) {\n    const subtype = parameters.data.annotationType;\n\n    switch (subtype) {\n      case _util.AnnotationType.LINK:\n        return new LinkAnnotationElement(parameters);\n\n      case _util.AnnotationType.TEXT:\n        return new TextAnnotationElement(parameters);\n\n      case _util.AnnotationType.WIDGET:\n        const fieldType = parameters.data.fieldType;\n\n        switch (fieldType) {\n          case \"Tx\":\n            return new TextWidgetAnnotationElement(parameters);\n\n          case \"Btn\":\n            if (parameters.data.radioButton) {\n              return new RadioButtonWidgetAnnotationElement(parameters);\n            } else if (parameters.data.checkBox) {\n              return new CheckboxWidgetAnnotationElement(parameters);\n            }\n\n            return new PushButtonWidgetAnnotationElement(parameters);\n\n          case \"Ch\":\n            return new ChoiceWidgetAnnotationElement(parameters);\n        }\n\n        return new WidgetAnnotationElement(parameters);\n\n      case _util.AnnotationType.POPUP:\n        return new PopupAnnotationElement(parameters);\n\n      case _util.AnnotationType.FREETEXT:\n        return new FreeTextAnnotationElement(parameters);\n\n      case _util.AnnotationType.LINE:\n        return new LineAnnotationElement(parameters);\n\n      case _util.AnnotationType.SQUARE:\n        return new SquareAnnotationElement(parameters);\n\n      case _util.AnnotationType.CIRCLE:\n        return new CircleAnnotationElement(parameters);\n\n      case _util.AnnotationType.POLYLINE:\n        return new PolylineAnnotationElement(parameters);\n\n      case _util.AnnotationType.CARET:\n        return new CaretAnnotationElement(parameters);\n\n      case _util.AnnotationType.INK:\n        return new InkAnnotationElement(parameters);\n\n      case _util.AnnotationType.POLYGON:\n        return new PolygonAnnotationElement(parameters);\n\n      case _util.AnnotationType.HIGHLIGHT:\n        return new HighlightAnnotationElement(parameters);\n\n      case _util.AnnotationType.UNDERLINE:\n        return new UnderlineAnnotationElement(parameters);\n\n      case _util.AnnotationType.SQUIGGLY:\n        return new SquigglyAnnotationElement(parameters);\n\n      case _util.AnnotationType.STRIKEOUT:\n        return new StrikeOutAnnotationElement(parameters);\n\n      case _util.AnnotationType.STAMP:\n        return new StampAnnotationElement(parameters);\n\n      case _util.AnnotationType.FILEATTACHMENT:\n        return new FileAttachmentAnnotationElement(parameters);\n\n      default:\n        return new AnnotationElement(parameters);\n    }\n  }\n\n}\n\nclass AnnotationElement {\n  constructor(parameters, {\n    isRenderable = false,\n    ignoreBorder = false,\n    createQuadrilaterals = false\n  } = {}) {\n    this.isRenderable = isRenderable;\n    this.data = parameters.data;\n    this.layer = parameters.layer;\n    this.page = parameters.page;\n    this.viewport = parameters.viewport;\n    this.linkService = parameters.linkService;\n    this.downloadManager = parameters.downloadManager;\n    this.imageResourcesPath = parameters.imageResourcesPath;\n    this.renderForms = parameters.renderForms;\n    this.svgFactory = parameters.svgFactory;\n    this.annotationStorage = parameters.annotationStorage;\n    this.enableScripting = parameters.enableScripting;\n    this.hasJSActions = parameters.hasJSActions;\n    this._fieldObjects = parameters.fieldObjects;\n    this._mouseState = parameters.mouseState;\n\n    if (isRenderable) {\n      this.container = this._createContainer(ignoreBorder);\n    }\n\n    if (createQuadrilaterals) {\n      this.quadrilaterals = this._createQuadrilaterals(ignoreBorder);\n    }\n  }\n\n  _createContainer(ignoreBorder = false) {\n    const data = this.data,\n          page = this.page,\n          viewport = this.viewport;\n    const container = document.createElement(\"section\");\n    let {\n      width,\n      height\n    } = getRectDims(data.rect);\n    container.setAttribute(\"data-annotation-id\", data.id);\n\n    const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);\n\n    if (data.hasOwnCanvas) {\n      const transform = viewport.transform.slice();\n\n      const [scaleX, scaleY] = _util.Util.singularValueDecompose2dScale(transform);\n\n      width = Math.ceil(width * scaleX);\n      height = Math.ceil(height * scaleY);\n      rect[0] *= scaleX;\n      rect[1] *= scaleY;\n\n      for (let i = 0; i < 4; i++) {\n        transform[i] = Math.sign(transform[i]);\n      }\n\n      container.style.transform = `matrix(${transform.join(\",\")})`;\n    } else {\n      container.style.transform = `matrix(${viewport.transform.join(\",\")})`;\n    }\n\n    container.style.transformOrigin = `${-rect[0]}px ${-rect[1]}px`;\n\n    if (!ignoreBorder && data.borderStyle.width > 0) {\n      container.style.borderWidth = `${data.borderStyle.width}px`;\n\n      if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {\n        width -= 2 * data.borderStyle.width;\n        height -= 2 * data.borderStyle.width;\n      }\n\n      const horizontalRadius = data.borderStyle.horizontalCornerRadius;\n      const verticalRadius = data.borderStyle.verticalCornerRadius;\n\n      if (horizontalRadius > 0 || verticalRadius > 0) {\n        const radius = `${horizontalRadius}px / ${verticalRadius}px`;\n        container.style.borderRadius = radius;\n      }\n\n      switch (data.borderStyle.style) {\n        case _util.AnnotationBorderStyleType.SOLID:\n          container.style.borderStyle = \"solid\";\n          break;\n\n        case _util.AnnotationBorderStyleType.DASHED:\n          container.style.borderStyle = \"dashed\";\n          break;\n\n        case _util.AnnotationBorderStyleType.BEVELED:\n          (0, _util.warn)(\"Unimplemented border style: beveled\");\n          break;\n\n        case _util.AnnotationBorderStyleType.INSET:\n          (0, _util.warn)(\"Unimplemented border style: inset\");\n          break;\n\n        case _util.AnnotationBorderStyleType.UNDERLINE:\n          container.style.borderBottomStyle = \"solid\";\n          break;\n\n        default:\n          break;\n      }\n\n      const borderColor = data.borderColor || data.color || null;\n\n      if (borderColor) {\n        container.style.borderColor = _util.Util.makeHexColor(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);\n      } else {\n        container.style.borderWidth = 0;\n      }\n    }\n\n    container.style.left = `${rect[0]}px`;\n    container.style.top = `${rect[1]}px`;\n\n    if (data.hasOwnCanvas) {\n      container.style.width = container.style.height = \"auto\";\n    } else {\n      container.style.width = `${width}px`;\n      container.style.height = `${height}px`;\n    }\n\n    return container;\n  }\n\n  _createQuadrilaterals(ignoreBorder = false) {\n    if (!this.data.quadPoints) {\n      return null;\n    }\n\n    const quadrilaterals = [];\n    const savedRect = this.data.rect;\n\n    for (const quadPoint of this.data.quadPoints) {\n      this.data.rect = [quadPoint[2].x, quadPoint[2].y, quadPoint[1].x, quadPoint[1].y];\n      quadrilaterals.push(this._createContainer(ignoreBorder));\n    }\n\n    this.data.rect = savedRect;\n    return quadrilaterals;\n  }\n\n  _createPopup(trigger, data) {\n    let container = this.container;\n\n    if (this.quadrilaterals) {\n      trigger = trigger || this.quadrilaterals;\n      container = this.quadrilaterals[0];\n    }\n\n    if (!trigger) {\n      trigger = document.createElement(\"div\");\n      trigger.style.height = container.style.height;\n      trigger.style.width = container.style.width;\n      container.appendChild(trigger);\n    }\n\n    const popupElement = new PopupElement({\n      container,\n      trigger,\n      color: data.color,\n      titleObj: data.titleObj,\n      modificationDate: data.modificationDate,\n      contentsObj: data.contentsObj,\n      richText: data.richText,\n      hideWrapper: true\n    });\n    const popup = popupElement.render();\n    popup.style.left = container.style.width;\n    container.appendChild(popup);\n  }\n\n  _renderQuadrilaterals(className) {\n    for (const quadrilateral of this.quadrilaterals) {\n      quadrilateral.className = className;\n    }\n\n    return this.quadrilaterals;\n  }\n\n  render() {\n    (0, _util.unreachable)(\"Abstract method `AnnotationElement.render` called\");\n  }\n\n  _getElementsByName(name, skipId = null) {\n    const fields = [];\n\n    if (this._fieldObjects) {\n      const fieldObj = this._fieldObjects[name];\n\n      if (fieldObj) {\n        for (const {\n          page,\n          id,\n          exportValues\n        } of fieldObj) {\n          if (page === -1) {\n            continue;\n          }\n\n          if (id === skipId) {\n            continue;\n          }\n\n          const exportValue = typeof exportValues === \"string\" ? exportValues : null;\n          const domElement = document.getElementById(id);\n\n          if (domElement && !GetElementsByNameSet.has(domElement)) {\n            (0, _util.warn)(`_getElementsByName - element not allowed: ${id}`);\n            continue;\n          }\n\n          fields.push({\n            id,\n            exportValue,\n            domElement\n          });\n        }\n      }\n\n      return fields;\n    }\n\n    for (const domElement of document.getElementsByName(name)) {\n      const {\n        id,\n        exportValue\n      } = domElement;\n\n      if (id === skipId) {\n        continue;\n      }\n\n      if (!GetElementsByNameSet.has(domElement)) {\n        continue;\n      }\n\n      fields.push({\n        id,\n        exportValue,\n        domElement\n      });\n    }\n\n    return fields;\n  }\n\n  static get platform() {\n    const platform = typeof navigator !== \"undefined\" ? navigator.platform : \"\";\n    return (0, _util.shadow)(this, \"platform\", {\n      isWin: platform.includes(\"Win\"),\n      isMac: platform.includes(\"Mac\")\n    });\n  }\n\n}\n\nclass LinkAnnotationElement extends AnnotationElement {\n  constructor(parameters, options = null) {\n    const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action || parameters.data.isTooltipOnly || parameters.data.resetForm || parameters.data.actions && (parameters.data.actions.Action || parameters.data.actions[\"Mouse Up\"] || parameters.data.actions[\"Mouse Down\"]));\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: !!options?.ignoreBorder,\n      createQuadrilaterals: true\n    });\n  }\n\n  render() {\n    const {\n      data,\n      linkService\n    } = this;\n    const link = document.createElement(\"a\");\n\n    if (data.url) {\n      if (!linkService.addLinkAttributes) {\n        (0, _util.warn)(\"LinkAnnotationElement.render - missing `addLinkAttributes`-method on the `linkService`-instance.\");\n      }\n\n      linkService.addLinkAttributes?.(link, data.url, data.newWindow);\n    } else if (data.action) {\n      this._bindNamedAction(link, data.action);\n    } else if (data.dest) {\n      this._bindLink(link, data.dest);\n    } else {\n      let hasClickAction = false;\n\n      if (data.actions && (data.actions.Action || data.actions[\"Mouse Up\"] || data.actions[\"Mouse Down\"]) && this.enableScripting && this.hasJSActions) {\n        hasClickAction = true;\n\n        this._bindJSAction(link, data);\n      }\n\n      if (data.resetForm) {\n        this._bindResetFormAction(link, data.resetForm);\n      } else if (!hasClickAction) {\n        this._bindLink(link, \"\");\n      }\n    }\n\n    if (this.quadrilaterals) {\n      return this._renderQuadrilaterals(\"linkAnnotation\").map((quadrilateral, index) => {\n        const linkElement = index === 0 ? link : link.cloneNode();\n        quadrilateral.appendChild(linkElement);\n        return quadrilateral;\n      });\n    }\n\n    this.container.className = \"linkAnnotation\";\n    this.container.appendChild(link);\n    return this.container;\n  }\n\n  _bindLink(link, destination) {\n    link.href = this.linkService.getDestinationHash(destination);\n\n    link.onclick = () => {\n      if (destination) {\n        this.linkService.goToDestination(destination);\n      }\n\n      return false;\n    };\n\n    if (destination || destination === \"\") {\n      link.className = \"internalLink\";\n    }\n  }\n\n  _bindNamedAction(link, action) {\n    link.href = this.linkService.getAnchorUrl(\"\");\n\n    link.onclick = () => {\n      this.linkService.executeNamedAction(action);\n      return false;\n    };\n\n    link.className = \"internalLink\";\n  }\n\n  _bindJSAction(link, data) {\n    link.href = this.linkService.getAnchorUrl(\"\");\n    const map = new Map([[\"Action\", \"onclick\"], [\"Mouse Up\", \"onmouseup\"], [\"Mouse Down\", \"onmousedown\"]]);\n\n    for (const name of Object.keys(data.actions)) {\n      const jsName = map.get(name);\n\n      if (!jsName) {\n        continue;\n      }\n\n      link[jsName] = () => {\n        this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n          source: this,\n          detail: {\n            id: data.id,\n            name\n          }\n        });\n        return false;\n      };\n    }\n\n    if (!link.onclick) {\n      link.onclick = () => false;\n    }\n\n    link.className = \"internalLink\";\n  }\n\n  _bindResetFormAction(link, resetForm) {\n    const otherClickAction = link.onclick;\n\n    if (!otherClickAction) {\n      link.href = this.linkService.getAnchorUrl(\"\");\n    }\n\n    link.className = \"internalLink\";\n\n    if (!this._fieldObjects) {\n      (0, _util.warn)(`_bindResetFormAction - \"resetForm\" action not supported, ` + \"ensure that the `fieldObjects` parameter is provided.\");\n\n      if (!otherClickAction) {\n        link.onclick = () => false;\n      }\n\n      return;\n    }\n\n    link.onclick = () => {\n      if (otherClickAction) {\n        otherClickAction();\n      }\n\n      const {\n        fields: resetFormFields,\n        refs: resetFormRefs,\n        include\n      } = resetForm;\n      const allFields = [];\n\n      if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {\n        const fieldIds = new Set(resetFormRefs);\n\n        for (const fieldName of resetFormFields) {\n          const fields = this._fieldObjects[fieldName] || [];\n\n          for (const {\n            id\n          } of fields) {\n            fieldIds.add(id);\n          }\n        }\n\n        for (const fields of Object.values(this._fieldObjects)) {\n          for (const field of fields) {\n            if (fieldIds.has(field.id) === include) {\n              allFields.push(field);\n            }\n          }\n        }\n      } else {\n        for (const fields of Object.values(this._fieldObjects)) {\n          allFields.push(...fields);\n        }\n      }\n\n      const storage = this.annotationStorage;\n      const allIds = [];\n\n      for (const field of allFields) {\n        const {\n          id\n        } = field;\n        allIds.push(id);\n\n        switch (field.type) {\n          case \"text\":\n            {\n              const value = field.defaultValue || \"\";\n              storage.setValue(id, {\n                value,\n                valueAsString: value\n              });\n              break;\n            }\n\n          case \"checkbox\":\n          case \"radiobutton\":\n            {\n              const value = field.defaultValue === field.exportValues;\n              storage.setValue(id, {\n                value\n              });\n              break;\n            }\n\n          case \"combobox\":\n          case \"listbox\":\n            {\n              const value = field.defaultValue || \"\";\n              storage.setValue(id, {\n                value\n              });\n              break;\n            }\n\n          default:\n            continue;\n        }\n\n        const domElement = document.getElementById(id);\n\n        if (!domElement || !GetElementsByNameSet.has(domElement)) {\n          continue;\n        }\n\n        domElement.dispatchEvent(new Event(\"resetform\"));\n      }\n\n      if (this.enableScripting) {\n        this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n          source: this,\n          detail: {\n            id: \"app\",\n            ids: allIds,\n            name: \"ResetForm\"\n          }\n        });\n      }\n\n      return false;\n    };\n  }\n\n}\n\nclass TextAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable\n    });\n  }\n\n  render() {\n    this.container.className = \"textAnnotation\";\n    const image = document.createElement(\"img\");\n    image.style.height = this.container.style.height;\n    image.style.width = this.container.style.width;\n    image.src = this.imageResourcesPath + \"annotation-\" + this.data.name.toLowerCase() + \".svg\";\n    image.alt = \"[{{type}} Annotation]\";\n    image.dataset.l10nId = \"text_annotation_type\";\n    image.dataset.l10nArgs = JSON.stringify({\n      type: this.data.name\n    });\n\n    if (!this.data.hasPopup) {\n      this._createPopup(image, this.data);\n    }\n\n    this.container.appendChild(image);\n    return this.container;\n  }\n\n}\n\nclass WidgetAnnotationElement extends AnnotationElement {\n  render() {\n    if (this.data.alternativeText) {\n      this.container.title = this.data.alternativeText;\n    }\n\n    return this.container;\n  }\n\n  _getKeyModifier(event) {\n    const {\n      isWin,\n      isMac\n    } = AnnotationElement.platform;\n    return isWin && event.ctrlKey || isMac && event.metaKey;\n  }\n\n  _setEventListener(element, baseName, eventName, valueGetter) {\n    if (baseName.includes(\"mouse\")) {\n      element.addEventListener(baseName, event => {\n        this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n          source: this,\n          detail: {\n            id: this.data.id,\n            name: eventName,\n            value: valueGetter(event),\n            shift: event.shiftKey,\n            modifier: this._getKeyModifier(event)\n          }\n        });\n      });\n    } else {\n      element.addEventListener(baseName, event => {\n        this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n          source: this,\n          detail: {\n            id: this.data.id,\n            name: eventName,\n            value: valueGetter(event)\n          }\n        });\n      });\n    }\n  }\n\n  _setEventListeners(element, names, getter) {\n    for (const [baseName, eventName] of names) {\n      if (eventName === \"Action\" || this.data.actions?.[eventName]) {\n        this._setEventListener(element, baseName, eventName, getter);\n      }\n    }\n  }\n\n  _setBackgroundColor(element) {\n    const color = this.data.backgroundColor || null;\n    element.style.backgroundColor = color === null ? \"transparent\" : _util.Util.makeHexColor(color[0], color[1], color[2]);\n  }\n\n  _dispatchEventFromSandbox(actions, jsEvent) {\n    const setColor = (jsName, styleName, event) => {\n      const color = event.detail[jsName];\n      event.target.style[styleName] = _scripting_utils.ColorConverters[`${color[0]}_HTML`](color.slice(1));\n    };\n\n    const commonActions = {\n      display: event => {\n        const hidden = event.detail.display % 2 === 1;\n        event.target.style.visibility = hidden ? \"hidden\" : \"visible\";\n        this.annotationStorage.setValue(this.data.id, {\n          hidden,\n          print: event.detail.display === 0 || event.detail.display === 3\n        });\n      },\n      print: event => {\n        this.annotationStorage.setValue(this.data.id, {\n          print: event.detail.print\n        });\n      },\n      hidden: event => {\n        event.target.style.visibility = event.detail.hidden ? \"hidden\" : \"visible\";\n        this.annotationStorage.setValue(this.data.id, {\n          hidden: event.detail.hidden\n        });\n      },\n      focus: event => {\n        setTimeout(() => event.target.focus({\n          preventScroll: false\n        }), 0);\n      },\n      userName: event => {\n        event.target.title = event.detail.userName;\n      },\n      readonly: event => {\n        if (event.detail.readonly) {\n          event.target.setAttribute(\"readonly\", \"\");\n        } else {\n          event.target.removeAttribute(\"readonly\");\n        }\n      },\n      required: event => {\n        if (event.detail.required) {\n          event.target.setAttribute(\"required\", \"\");\n        } else {\n          event.target.removeAttribute(\"required\");\n        }\n      },\n      bgColor: event => {\n        setColor(\"bgColor\", \"backgroundColor\", event);\n      },\n      fillColor: event => {\n        setColor(\"fillColor\", \"backgroundColor\", event);\n      },\n      fgColor: event => {\n        setColor(\"fgColor\", \"color\", event);\n      },\n      textColor: event => {\n        setColor(\"textColor\", \"color\", event);\n      },\n      borderColor: event => {\n        setColor(\"borderColor\", \"borderColor\", event);\n      },\n      strokeColor: event => {\n        setColor(\"strokeColor\", \"borderColor\", event);\n      }\n    };\n\n    for (const name of Object.keys(jsEvent.detail)) {\n      const action = actions[name] || commonActions[name];\n\n      if (action) {\n        action(jsEvent);\n      }\n    }\n  }\n\n}\n\nclass TextWidgetAnnotationElement extends WidgetAnnotationElement {\n  constructor(parameters) {\n    const isRenderable = parameters.renderForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;\n    super(parameters, {\n      isRenderable\n    });\n  }\n\n  setPropertyOnSiblings(base, key, value, keyInStorage) {\n    const storage = this.annotationStorage;\n\n    for (const element of this._getElementsByName(base.name, base.id)) {\n      if (element.domElement) {\n        element.domElement[key] = value;\n      }\n\n      storage.setValue(element.id, {\n        [keyInStorage]: value\n      });\n    }\n  }\n\n  render() {\n    const storage = this.annotationStorage;\n    const id = this.data.id;\n    this.container.className = \"textWidgetAnnotation\";\n    let element = null;\n\n    if (this.renderForms) {\n      const storedData = storage.getValue(id, {\n        value: this.data.fieldValue,\n        valueAsString: this.data.fieldValue\n      });\n      const textContent = storedData.valueAsString || storedData.value || \"\";\n      const elementData = {\n        userValue: null,\n        formattedValue: null\n      };\n\n      if (this.data.multiLine) {\n        element = document.createElement(\"textarea\");\n        element.textContent = textContent;\n      } else {\n        element = document.createElement(\"input\");\n        element.type = \"text\";\n        element.setAttribute(\"value\", textContent);\n      }\n\n      GetElementsByNameSet.add(element);\n      element.disabled = this.data.readOnly;\n      element.name = this.data.fieldName;\n      element.tabIndex = DEFAULT_TAB_INDEX;\n      elementData.userValue = textContent;\n      element.setAttribute(\"id\", id);\n      element.addEventListener(\"input\", event => {\n        storage.setValue(id, {\n          value: event.target.value\n        });\n        this.setPropertyOnSiblings(element, \"value\", event.target.value, \"value\");\n      });\n      element.addEventListener(\"resetform\", event => {\n        const defaultValue = this.data.defaultFieldValue || \"\";\n        element.value = elementData.userValue = defaultValue;\n        delete elementData.formattedValue;\n      });\n\n      let blurListener = event => {\n        if (elementData.formattedValue) {\n          event.target.value = elementData.formattedValue;\n        }\n\n        event.target.scrollLeft = 0;\n      };\n\n      if (this.enableScripting && this.hasJSActions) {\n        element.addEventListener(\"focus\", event => {\n          if (elementData.userValue) {\n            event.target.value = elementData.userValue;\n          }\n        });\n        element.addEventListener(\"updatefromsandbox\", jsEvent => {\n          const actions = {\n            value(event) {\n              elementData.userValue = event.detail.value || \"\";\n              storage.setValue(id, {\n                value: elementData.userValue.toString()\n              });\n\n              if (!elementData.formattedValue) {\n                event.target.value = elementData.userValue;\n              }\n            },\n\n            valueAsString(event) {\n              elementData.formattedValue = event.detail.valueAsString || \"\";\n\n              if (event.target !== document.activeElement) {\n                event.target.value = elementData.formattedValue;\n              }\n\n              storage.setValue(id, {\n                formattedValue: elementData.formattedValue\n              });\n            },\n\n            selRange(event) {\n              const [selStart, selEnd] = event.detail.selRange;\n\n              if (selStart >= 0 && selEnd < event.target.value.length) {\n                event.target.setSelectionRange(selStart, selEnd);\n              }\n            }\n\n          };\n\n          this._dispatchEventFromSandbox(actions, jsEvent);\n        });\n        element.addEventListener(\"keydown\", event => {\n          let commitKey = -1;\n\n          if (event.key === \"Escape\") {\n            commitKey = 0;\n          } else if (event.key === \"Enter\") {\n            commitKey = 2;\n          } else if (event.key === \"Tab\") {\n            commitKey = 3;\n          }\n\n          if (commitKey === -1) {\n            return;\n          }\n\n          elementData.userValue = event.target.value;\n          this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n            source: this,\n            detail: {\n              id,\n              name: \"Keystroke\",\n              value: event.target.value,\n              willCommit: true,\n              commitKey,\n              selStart: event.target.selectionStart,\n              selEnd: event.target.selectionEnd\n            }\n          });\n        });\n        const _blurListener = blurListener;\n        blurListener = null;\n        element.addEventListener(\"blur\", event => {\n          elementData.userValue = event.target.value;\n\n          if (this._mouseState.isDown) {\n            this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n              source: this,\n              detail: {\n                id,\n                name: \"Keystroke\",\n                value: event.target.value,\n                willCommit: true,\n                commitKey: 1,\n                selStart: event.target.selectionStart,\n                selEnd: event.target.selectionEnd\n              }\n            });\n          }\n\n          _blurListener(event);\n        });\n\n        if (this.data.actions?.Keystroke) {\n          element.addEventListener(\"beforeinput\", event => {\n            elementData.formattedValue = \"\";\n            const {\n              data,\n              target\n            } = event;\n            const {\n              value,\n              selectionStart,\n              selectionEnd\n            } = target;\n            this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n              source: this,\n              detail: {\n                id,\n                name: \"Keystroke\",\n                value,\n                change: data,\n                willCommit: false,\n                selStart: selectionStart,\n                selEnd: selectionEnd\n              }\n            });\n          });\n        }\n\n        this._setEventListeners(element, [[\"focus\", \"Focus\"], [\"blur\", \"Blur\"], [\"mousedown\", \"Mouse Down\"], [\"mouseenter\", \"Mouse Enter\"], [\"mouseleave\", \"Mouse Exit\"], [\"mouseup\", \"Mouse Up\"]], event => event.target.value);\n      }\n\n      if (blurListener) {\n        element.addEventListener(\"blur\", blurListener);\n      }\n\n      if (this.data.maxLen !== null) {\n        element.maxLength = this.data.maxLen;\n      }\n\n      if (this.data.comb) {\n        const fieldWidth = this.data.rect[2] - this.data.rect[0];\n        const combWidth = fieldWidth / this.data.maxLen;\n        element.classList.add(\"comb\");\n        element.style.letterSpacing = `calc(${combWidth}px - 1ch)`;\n      }\n    } else {\n      element = document.createElement(\"div\");\n      element.textContent = this.data.fieldValue;\n      element.style.verticalAlign = \"middle\";\n      element.style.display = \"table-cell\";\n    }\n\n    this._setTextStyle(element);\n\n    this._setBackgroundColor(element);\n\n    this.container.appendChild(element);\n    return this.container;\n  }\n\n  _setTextStyle(element) {\n    const TEXT_ALIGNMENT = [\"left\", \"center\", \"right\"];\n    const {\n      fontSize,\n      fontColor\n    } = this.data.defaultAppearanceData;\n    const style = element.style;\n\n    if (fontSize) {\n      style.fontSize = `${fontSize}px`;\n    }\n\n    style.color = _util.Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);\n\n    if (this.data.textAlignment !== null) {\n      style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];\n    }\n  }\n\n}\n\nclass CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {\n  constructor(parameters) {\n    super(parameters, {\n      isRenderable: parameters.renderForms\n    });\n  }\n\n  render() {\n    const storage = this.annotationStorage;\n    const data = this.data;\n    const id = data.id;\n    let value = storage.getValue(id, {\n      value: data.exportValue === data.fieldValue\n    }).value;\n\n    if (typeof value === \"string\") {\n      value = value !== \"Off\";\n      storage.setValue(id, {\n        value\n      });\n    }\n\n    this.container.className = \"buttonWidgetAnnotation checkBox\";\n    const element = document.createElement(\"input\");\n    GetElementsByNameSet.add(element);\n    element.disabled = data.readOnly;\n    element.type = \"checkbox\";\n    element.name = data.fieldName;\n\n    if (value) {\n      element.setAttribute(\"checked\", true);\n    }\n\n    element.setAttribute(\"id\", id);\n    element.setAttribute(\"exportValue\", data.exportValue);\n    element.tabIndex = DEFAULT_TAB_INDEX;\n    element.addEventListener(\"change\", event => {\n      const {\n        name,\n        checked\n      } = event.target;\n\n      for (const checkbox of this._getElementsByName(name, id)) {\n        const curChecked = checked && checkbox.exportValue === data.exportValue;\n\n        if (checkbox.domElement) {\n          checkbox.domElement.checked = curChecked;\n        }\n\n        storage.setValue(checkbox.id, {\n          value: curChecked\n        });\n      }\n\n      storage.setValue(id, {\n        value: checked\n      });\n    });\n    element.addEventListener(\"resetform\", event => {\n      const defaultValue = data.defaultFieldValue || \"Off\";\n      event.target.checked = defaultValue === data.exportValue;\n    });\n\n    if (this.enableScripting && this.hasJSActions) {\n      element.addEventListener(\"updatefromsandbox\", jsEvent => {\n        const actions = {\n          value(event) {\n            event.target.checked = event.detail.value !== \"Off\";\n            storage.setValue(id, {\n              value: event.target.checked\n            });\n          }\n\n        };\n\n        this._dispatchEventFromSandbox(actions, jsEvent);\n      });\n\n      this._setEventListeners(element, [[\"change\", \"Validate\"], [\"change\", \"Action\"], [\"focus\", \"Focus\"], [\"blur\", \"Blur\"], [\"mousedown\", \"Mouse Down\"], [\"mouseenter\", \"Mouse Enter\"], [\"mouseleave\", \"Mouse Exit\"], [\"mouseup\", \"Mouse Up\"]], event => event.target.checked);\n    }\n\n    this._setBackgroundColor(element);\n\n    this.container.appendChild(element);\n    return this.container;\n  }\n\n}\n\nclass RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {\n  constructor(parameters) {\n    super(parameters, {\n      isRenderable: parameters.renderForms\n    });\n  }\n\n  render() {\n    this.container.className = \"buttonWidgetAnnotation radioButton\";\n    const storage = this.annotationStorage;\n    const data = this.data;\n    const id = data.id;\n    let value = storage.getValue(id, {\n      value: data.fieldValue === data.buttonValue\n    }).value;\n\n    if (typeof value === \"string\") {\n      value = value !== data.buttonValue;\n      storage.setValue(id, {\n        value\n      });\n    }\n\n    const element = document.createElement(\"input\");\n    GetElementsByNameSet.add(element);\n    element.disabled = data.readOnly;\n    element.type = \"radio\";\n    element.name = data.fieldName;\n\n    if (value) {\n      element.setAttribute(\"checked\", true);\n    }\n\n    element.setAttribute(\"id\", id);\n    element.tabIndex = DEFAULT_TAB_INDEX;\n    element.addEventListener(\"change\", event => {\n      const {\n        name,\n        checked\n      } = event.target;\n\n      for (const radio of this._getElementsByName(name, id)) {\n        storage.setValue(radio.id, {\n          value: false\n        });\n      }\n\n      storage.setValue(id, {\n        value: checked\n      });\n    });\n    element.addEventListener(\"resetform\", event => {\n      const defaultValue = data.defaultFieldValue;\n      event.target.checked = defaultValue !== null && defaultValue !== undefined && defaultValue === data.buttonValue;\n    });\n\n    if (this.enableScripting && this.hasJSActions) {\n      const pdfButtonValue = data.buttonValue;\n      element.addEventListener(\"updatefromsandbox\", jsEvent => {\n        const actions = {\n          value: event => {\n            const checked = pdfButtonValue === event.detail.value;\n\n            for (const radio of this._getElementsByName(event.target.name)) {\n              const curChecked = checked && radio.id === id;\n\n              if (radio.domElement) {\n                radio.domElement.checked = curChecked;\n              }\n\n              storage.setValue(radio.id, {\n                value: curChecked\n              });\n            }\n          }\n        };\n\n        this._dispatchEventFromSandbox(actions, jsEvent);\n      });\n\n      this._setEventListeners(element, [[\"change\", \"Validate\"], [\"change\", \"Action\"], [\"focus\", \"Focus\"], [\"blur\", \"Blur\"], [\"mousedown\", \"Mouse Down\"], [\"mouseenter\", \"Mouse Enter\"], [\"mouseleave\", \"Mouse Exit\"], [\"mouseup\", \"Mouse Up\"]], event => event.target.checked);\n    }\n\n    this._setBackgroundColor(element);\n\n    this.container.appendChild(element);\n    return this.container;\n  }\n\n}\n\nclass PushButtonWidgetAnnotationElement extends LinkAnnotationElement {\n  constructor(parameters) {\n    super(parameters, {\n      ignoreBorder: parameters.data.hasAppearance\n    });\n  }\n\n  render() {\n    const container = super.render();\n    container.className = \"buttonWidgetAnnotation pushButton\";\n\n    if (this.data.alternativeText) {\n      container.title = this.data.alternativeText;\n    }\n\n    return container;\n  }\n\n}\n\nclass ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {\n  constructor(parameters) {\n    super(parameters, {\n      isRenderable: parameters.renderForms\n    });\n  }\n\n  render() {\n    this.container.className = \"choiceWidgetAnnotation\";\n    const storage = this.annotationStorage;\n    const id = this.data.id;\n    storage.getValue(id, {\n      value: this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined\n    });\n    let {\n      fontSize\n    } = this.data.defaultAppearanceData;\n\n    if (!fontSize) {\n      fontSize = 9;\n    }\n\n    const fontSizeStyle = `calc(${fontSize}px * var(--zoom-factor))`;\n    const selectElement = document.createElement(\"select\");\n    GetElementsByNameSet.add(selectElement);\n    selectElement.disabled = this.data.readOnly;\n    selectElement.name = this.data.fieldName;\n    selectElement.setAttribute(\"id\", id);\n    selectElement.tabIndex = DEFAULT_TAB_INDEX;\n    selectElement.style.fontSize = `${fontSize}px`;\n\n    if (!this.data.combo) {\n      selectElement.size = this.data.options.length;\n\n      if (this.data.multiSelect) {\n        selectElement.multiple = true;\n      }\n    }\n\n    selectElement.addEventListener(\"resetform\", event => {\n      const defaultValue = this.data.defaultFieldValue;\n\n      for (const option of selectElement.options) {\n        option.selected = option.value === defaultValue;\n      }\n    });\n\n    for (const option of this.data.options) {\n      const optionElement = document.createElement(\"option\");\n      optionElement.textContent = option.displayValue;\n      optionElement.value = option.exportValue;\n\n      if (this.data.combo) {\n        optionElement.style.fontSize = fontSizeStyle;\n      }\n\n      if (this.data.fieldValue.includes(option.exportValue)) {\n        optionElement.setAttribute(\"selected\", true);\n      }\n\n      selectElement.appendChild(optionElement);\n    }\n\n    const getValue = (event, isExport) => {\n      const name = isExport ? \"value\" : \"textContent\";\n      const options = event.target.options;\n\n      if (!event.target.multiple) {\n        return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];\n      }\n\n      return Array.prototype.filter.call(options, option => option.selected).map(option => option[name]);\n    };\n\n    const getItems = event => {\n      const options = event.target.options;\n      return Array.prototype.map.call(options, option => {\n        return {\n          displayValue: option.textContent,\n          exportValue: option.value\n        };\n      });\n    };\n\n    if (this.enableScripting && this.hasJSActions) {\n      selectElement.addEventListener(\"updatefromsandbox\", jsEvent => {\n        const actions = {\n          value(event) {\n            const value = event.detail.value;\n            const values = new Set(Array.isArray(value) ? value : [value]);\n\n            for (const option of selectElement.options) {\n              option.selected = values.has(option.value);\n            }\n\n            storage.setValue(id, {\n              value: getValue(event, true)\n            });\n          },\n\n          multipleSelection(event) {\n            selectElement.multiple = true;\n          },\n\n          remove(event) {\n            const options = selectElement.options;\n            const index = event.detail.remove;\n            options[index].selected = false;\n            selectElement.remove(index);\n\n            if (options.length > 0) {\n              const i = Array.prototype.findIndex.call(options, option => option.selected);\n\n              if (i === -1) {\n                options[0].selected = true;\n              }\n            }\n\n            storage.setValue(id, {\n              value: getValue(event, true),\n              items: getItems(event)\n            });\n          },\n\n          clear(event) {\n            while (selectElement.length !== 0) {\n              selectElement.remove(0);\n            }\n\n            storage.setValue(id, {\n              value: null,\n              items: []\n            });\n          },\n\n          insert(event) {\n            const {\n              index,\n              displayValue,\n              exportValue\n            } = event.detail.insert;\n            const optionElement = document.createElement(\"option\");\n            optionElement.textContent = displayValue;\n            optionElement.value = exportValue;\n            selectElement.insertBefore(optionElement, selectElement.children[index]);\n            storage.setValue(id, {\n              value: getValue(event, true),\n              items: getItems(event)\n            });\n          },\n\n          items(event) {\n            const {\n              items\n            } = event.detail;\n\n            while (selectElement.length !== 0) {\n              selectElement.remove(0);\n            }\n\n            for (const item of items) {\n              const {\n                displayValue,\n                exportValue\n              } = item;\n              const optionElement = document.createElement(\"option\");\n              optionElement.textContent = displayValue;\n              optionElement.value = exportValue;\n              selectElement.appendChild(optionElement);\n            }\n\n            if (selectElement.options.length > 0) {\n              selectElement.options[0].selected = true;\n            }\n\n            storage.setValue(id, {\n              value: getValue(event, true),\n              items: getItems(event)\n            });\n          },\n\n          indices(event) {\n            const indices = new Set(event.detail.indices);\n\n            for (const option of event.target.options) {\n              option.selected = indices.has(option.index);\n            }\n\n            storage.setValue(id, {\n              value: getValue(event, true)\n            });\n          },\n\n          editable(event) {\n            event.target.disabled = !event.detail.editable;\n          }\n\n        };\n\n        this._dispatchEventFromSandbox(actions, jsEvent);\n      });\n      selectElement.addEventListener(\"input\", event => {\n        const exportValue = getValue(event, true);\n        const value = getValue(event, false);\n        storage.setValue(id, {\n          value: exportValue\n        });\n        this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n          source: this,\n          detail: {\n            id,\n            name: \"Keystroke\",\n            value,\n            changeEx: exportValue,\n            willCommit: true,\n            commitKey: 1,\n            keyDown: false\n          }\n        });\n      });\n\n      this._setEventListeners(selectElement, [[\"focus\", \"Focus\"], [\"blur\", \"Blur\"], [\"mousedown\", \"Mouse Down\"], [\"mouseenter\", \"Mouse Enter\"], [\"mouseleave\", \"Mouse Exit\"], [\"mouseup\", \"Mouse Up\"], [\"input\", \"Action\"]], event => event.target.checked);\n    } else {\n      selectElement.addEventListener(\"input\", function (event) {\n        storage.setValue(id, {\n          value: getValue(event)\n        });\n      });\n    }\n\n    this._setBackgroundColor(selectElement);\n\n    this.container.appendChild(selectElement);\n    return this.container;\n  }\n\n}\n\nclass PopupAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable\n    });\n  }\n\n  render() {\n    const IGNORE_TYPES = [\"Line\", \"Square\", \"Circle\", \"PolyLine\", \"Polygon\", \"Ink\"];\n    this.container.className = \"popupAnnotation\";\n\n    if (IGNORE_TYPES.includes(this.data.parentType)) {\n      return this.container;\n    }\n\n    const selector = `[data-annotation-id=\"${this.data.parentId}\"]`;\n    const parentElements = this.layer.querySelectorAll(selector);\n\n    if (parentElements.length === 0) {\n      return this.container;\n    }\n\n    const popup = new PopupElement({\n      container: this.container,\n      trigger: Array.from(parentElements),\n      color: this.data.color,\n      titleObj: this.data.titleObj,\n      modificationDate: this.data.modificationDate,\n      contentsObj: this.data.contentsObj,\n      richText: this.data.richText\n    });\n    const page = this.page;\n\n    const rect = _util.Util.normalizeRect([this.data.parentRect[0], page.view[3] - this.data.parentRect[1] + page.view[1], this.data.parentRect[2], page.view[3] - this.data.parentRect[3] + page.view[1]]);\n\n    const popupLeft = rect[0] + this.data.parentRect[2] - this.data.parentRect[0];\n    const popupTop = rect[1];\n    this.container.style.transformOrigin = `${-popupLeft}px ${-popupTop}px`;\n    this.container.style.left = `${popupLeft}px`;\n    this.container.style.top = `${popupTop}px`;\n    this.container.appendChild(popup.render());\n    return this.container;\n  }\n\n}\n\nclass PopupElement {\n  constructor(parameters) {\n    this.container = parameters.container;\n    this.trigger = parameters.trigger;\n    this.color = parameters.color;\n    this.titleObj = parameters.titleObj;\n    this.modificationDate = parameters.modificationDate;\n    this.contentsObj = parameters.contentsObj;\n    this.richText = parameters.richText;\n    this.hideWrapper = parameters.hideWrapper || false;\n    this.pinned = false;\n  }\n\n  render() {\n    const BACKGROUND_ENLIGHT = 0.7;\n    const wrapper = document.createElement(\"div\");\n    wrapper.className = \"popupWrapper\";\n    this.hideElement = this.hideWrapper ? wrapper : this.container;\n    this.hideElement.hidden = true;\n    const popup = document.createElement(\"div\");\n    popup.className = \"popup\";\n    const color = this.color;\n\n    if (color) {\n      const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];\n      const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];\n      const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];\n      popup.style.backgroundColor = _util.Util.makeHexColor(r | 0, g | 0, b | 0);\n    }\n\n    const title = document.createElement(\"h1\");\n    title.dir = this.titleObj.dir;\n    title.textContent = this.titleObj.str;\n    popup.appendChild(title);\n\n    const dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);\n\n    if (dateObject) {\n      const modificationDate = document.createElement(\"span\");\n      modificationDate.className = \"popupDate\";\n      modificationDate.textContent = \"{{date}}, {{time}}\";\n      modificationDate.dataset.l10nId = \"annotation_date_string\";\n      modificationDate.dataset.l10nArgs = JSON.stringify({\n        date: dateObject.toLocaleDateString(),\n        time: dateObject.toLocaleTimeString()\n      });\n      popup.appendChild(modificationDate);\n    }\n\n    if (this.richText?.str && (!this.contentsObj?.str || this.contentsObj.str === this.richText.str)) {\n      _xfa_layer.XfaLayer.render({\n        xfaHtml: this.richText.html,\n        intent: \"richText\",\n        div: popup\n      });\n\n      popup.lastChild.className = \"richText popupContent\";\n    } else {\n      const contents = this._formatContents(this.contentsObj);\n\n      popup.appendChild(contents);\n    }\n\n    if (!Array.isArray(this.trigger)) {\n      this.trigger = [this.trigger];\n    }\n\n    for (const element of this.trigger) {\n      element.addEventListener(\"click\", this._toggle.bind(this));\n      element.addEventListener(\"mouseover\", this._show.bind(this, false));\n      element.addEventListener(\"mouseout\", this._hide.bind(this, false));\n    }\n\n    popup.addEventListener(\"click\", this._hide.bind(this, true));\n    wrapper.appendChild(popup);\n    return wrapper;\n  }\n\n  _formatContents({\n    str,\n    dir\n  }) {\n    const p = document.createElement(\"p\");\n    p.className = \"popupContent\";\n    p.dir = dir;\n    const lines = str.split(/(?:\\r\\n?|\\n)/);\n\n    for (let i = 0, ii = lines.length; i < ii; ++i) {\n      const line = lines[i];\n      p.appendChild(document.createTextNode(line));\n\n      if (i < ii - 1) {\n        p.appendChild(document.createElement(\"br\"));\n      }\n    }\n\n    return p;\n  }\n\n  _toggle() {\n    if (this.pinned) {\n      this._hide(true);\n    } else {\n      this._show(true);\n    }\n  }\n\n  _show(pin = false) {\n    if (pin) {\n      this.pinned = true;\n    }\n\n    if (this.hideElement.hidden) {\n      this.hideElement.hidden = false;\n      this.container.style.zIndex += 1;\n    }\n  }\n\n  _hide(unpin = true) {\n    if (unpin) {\n      this.pinned = false;\n    }\n\n    if (!this.hideElement.hidden && !this.pinned) {\n      this.hideElement.hidden = true;\n      this.container.style.zIndex -= 1;\n    }\n  }\n\n}\n\nclass FreeTextAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"freeTextAnnotation\";\n\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    return this.container;\n  }\n\n}\n\nclass LineAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"lineAnnotation\";\n    const data = this.data;\n    const {\n      width,\n      height\n    } = getRectDims(data.rect);\n    const svg = this.svgFactory.create(width, height);\n    const line = this.svgFactory.createElement(\"svg:line\");\n    line.setAttribute(\"x1\", data.rect[2] - data.lineCoordinates[0]);\n    line.setAttribute(\"y1\", data.rect[3] - data.lineCoordinates[1]);\n    line.setAttribute(\"x2\", data.rect[2] - data.lineCoordinates[2]);\n    line.setAttribute(\"y2\", data.rect[3] - data.lineCoordinates[3]);\n    line.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n    line.setAttribute(\"stroke\", \"transparent\");\n    line.setAttribute(\"fill\", \"transparent\");\n    svg.appendChild(line);\n    this.container.append(svg);\n\n    this._createPopup(line, data);\n\n    return this.container;\n  }\n\n}\n\nclass SquareAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"squareAnnotation\";\n    const data = this.data;\n    const {\n      width,\n      height\n    } = getRectDims(data.rect);\n    const svg = this.svgFactory.create(width, height);\n    const borderWidth = data.borderStyle.width;\n    const square = this.svgFactory.createElement(\"svg:rect\");\n    square.setAttribute(\"x\", borderWidth / 2);\n    square.setAttribute(\"y\", borderWidth / 2);\n    square.setAttribute(\"width\", width - borderWidth);\n    square.setAttribute(\"height\", height - borderWidth);\n    square.setAttribute(\"stroke-width\", borderWidth || 1);\n    square.setAttribute(\"stroke\", \"transparent\");\n    square.setAttribute(\"fill\", \"transparent\");\n    svg.appendChild(square);\n    this.container.append(svg);\n\n    this._createPopup(square, data);\n\n    return this.container;\n  }\n\n}\n\nclass CircleAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"circleAnnotation\";\n    const data = this.data;\n    const {\n      width,\n      height\n    } = getRectDims(data.rect);\n    const svg = this.svgFactory.create(width, height);\n    const borderWidth = data.borderStyle.width;\n    const circle = this.svgFactory.createElement(\"svg:ellipse\");\n    circle.setAttribute(\"cx\", width / 2);\n    circle.setAttribute(\"cy\", height / 2);\n    circle.setAttribute(\"rx\", width / 2 - borderWidth / 2);\n    circle.setAttribute(\"ry\", height / 2 - borderWidth / 2);\n    circle.setAttribute(\"stroke-width\", borderWidth || 1);\n    circle.setAttribute(\"stroke\", \"transparent\");\n    circle.setAttribute(\"fill\", \"transparent\");\n    svg.appendChild(circle);\n    this.container.append(svg);\n\n    this._createPopup(circle, data);\n\n    return this.container;\n  }\n\n}\n\nclass PolylineAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n    this.containerClassName = \"polylineAnnotation\";\n    this.svgElementName = \"svg:polyline\";\n  }\n\n  render() {\n    this.container.className = this.containerClassName;\n    const data = this.data;\n    const {\n      width,\n      height\n    } = getRectDims(data.rect);\n    const svg = this.svgFactory.create(width, height);\n    let points = [];\n\n    for (const coordinate of data.vertices) {\n      const x = coordinate.x - data.rect[0];\n      const y = data.rect[3] - coordinate.y;\n      points.push(x + \",\" + y);\n    }\n\n    points = points.join(\" \");\n    const polyline = this.svgFactory.createElement(this.svgElementName);\n    polyline.setAttribute(\"points\", points);\n    polyline.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n    polyline.setAttribute(\"stroke\", \"transparent\");\n    polyline.setAttribute(\"fill\", \"transparent\");\n    svg.appendChild(polyline);\n    this.container.append(svg);\n\n    this._createPopup(polyline, data);\n\n    return this.container;\n  }\n\n}\n\nclass PolygonAnnotationElement extends PolylineAnnotationElement {\n  constructor(parameters) {\n    super(parameters);\n    this.containerClassName = \"polygonAnnotation\";\n    this.svgElementName = \"svg:polygon\";\n  }\n\n}\n\nclass CaretAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"caretAnnotation\";\n\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    return this.container;\n  }\n\n}\n\nclass InkAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n    this.containerClassName = \"inkAnnotation\";\n    this.svgElementName = \"svg:polyline\";\n  }\n\n  render() {\n    this.container.className = this.containerClassName;\n    const data = this.data;\n    const {\n      width,\n      height\n    } = getRectDims(data.rect);\n    const svg = this.svgFactory.create(width, height);\n\n    for (const inkList of data.inkLists) {\n      let points = [];\n\n      for (const coordinate of inkList) {\n        const x = coordinate.x - data.rect[0];\n        const y = data.rect[3] - coordinate.y;\n        points.push(`${x},${y}`);\n      }\n\n      points = points.join(\" \");\n      const polyline = this.svgFactory.createElement(this.svgElementName);\n      polyline.setAttribute(\"points\", points);\n      polyline.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n      polyline.setAttribute(\"stroke\", \"transparent\");\n      polyline.setAttribute(\"fill\", \"transparent\");\n\n      this._createPopup(polyline, data);\n\n      svg.appendChild(polyline);\n    }\n\n    this.container.append(svg);\n    return this.container;\n  }\n\n}\n\nclass HighlightAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true,\n      createQuadrilaterals: true\n    });\n  }\n\n  render() {\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    if (this.quadrilaterals) {\n      return this._renderQuadrilaterals(\"highlightAnnotation\");\n    }\n\n    this.container.className = \"highlightAnnotation\";\n    return this.container;\n  }\n\n}\n\nclass UnderlineAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true,\n      createQuadrilaterals: true\n    });\n  }\n\n  render() {\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    if (this.quadrilaterals) {\n      return this._renderQuadrilaterals(\"underlineAnnotation\");\n    }\n\n    this.container.className = \"underlineAnnotation\";\n    return this.container;\n  }\n\n}\n\nclass SquigglyAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true,\n      createQuadrilaterals: true\n    });\n  }\n\n  render() {\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    if (this.quadrilaterals) {\n      return this._renderQuadrilaterals(\"squigglyAnnotation\");\n    }\n\n    this.container.className = \"squigglyAnnotation\";\n    return this.container;\n  }\n\n}\n\nclass StrikeOutAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true,\n      createQuadrilaterals: true\n    });\n  }\n\n  render() {\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    if (this.quadrilaterals) {\n      return this._renderQuadrilaterals(\"strikeoutAnnotation\");\n    }\n\n    this.container.className = \"strikeoutAnnotation\";\n    return this.container;\n  }\n\n}\n\nclass StampAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    const isRenderable = !!(parameters.data.hasPopup || parameters.data.titleObj?.str || parameters.data.contentsObj?.str || parameters.data.richText?.str);\n    super(parameters, {\n      isRenderable,\n      ignoreBorder: true\n    });\n  }\n\n  render() {\n    this.container.className = \"stampAnnotation\";\n\n    if (!this.data.hasPopup) {\n      this._createPopup(null, this.data);\n    }\n\n    return this.container;\n  }\n\n}\n\nclass FileAttachmentAnnotationElement extends AnnotationElement {\n  constructor(parameters) {\n    super(parameters, {\n      isRenderable: true\n    });\n    const {\n      filename,\n      content\n    } = this.data.file;\n    this.filename = (0, _display_utils.getFilenameFromUrl)(filename);\n    this.content = content;\n    this.linkService.eventBus?.dispatch(\"fileattachmentannotation\", {\n      source: this,\n      id: (0, _util.stringToPDFString)(filename),\n      filename,\n      content\n    });\n  }\n\n  render() {\n    this.container.className = \"fileAttachmentAnnotation\";\n    const trigger = document.createElement(\"div\");\n    trigger.style.height = this.container.style.height;\n    trigger.style.width = this.container.style.width;\n    trigger.addEventListener(\"dblclick\", this._download.bind(this));\n\n    if (!this.data.hasPopup && (this.data.titleObj?.str || this.data.contentsObj?.str || this.data.richText)) {\n      this._createPopup(trigger, this.data);\n    }\n\n    this.container.appendChild(trigger);\n    return this.container;\n  }\n\n  _download() {\n    this.downloadManager?.openOrDownloadData(this.container, this.content, this.filename);\n  }\n\n}\n\nclass AnnotationLayer {\n  static render(parameters) {\n    const sortedAnnotations = [],\n          popupAnnotations = [];\n\n    for (const data of parameters.annotations) {\n      if (!data) {\n        continue;\n      }\n\n      const {\n        width,\n        height\n      } = getRectDims(data.rect);\n\n      if (width <= 0 || height <= 0) {\n        continue;\n      }\n\n      if (data.annotationType === _util.AnnotationType.POPUP) {\n        popupAnnotations.push(data);\n        continue;\n      }\n\n      sortedAnnotations.push(data);\n    }\n\n    if (popupAnnotations.length) {\n      sortedAnnotations.push(...popupAnnotations);\n    }\n\n    const div = parameters.div;\n\n    for (const data of sortedAnnotations) {\n      const element = AnnotationElementFactory.create({\n        data,\n        layer: div,\n        page: parameters.page,\n        viewport: parameters.viewport,\n        linkService: parameters.linkService,\n        downloadManager: parameters.downloadManager,\n        imageResourcesPath: parameters.imageResourcesPath || \"\",\n        renderForms: parameters.renderForms !== false,\n        svgFactory: new _display_utils.DOMSVGFactory(),\n        annotationStorage: parameters.annotationStorage || new _annotation_storage.AnnotationStorage(),\n        enableScripting: parameters.enableScripting,\n        hasJSActions: parameters.hasJSActions,\n        fieldObjects: parameters.fieldObjects,\n        mouseState: parameters.mouseState || {\n          isDown: false\n        }\n      });\n\n      if (element.isRenderable) {\n        const rendered = element.render();\n\n        if (data.hidden) {\n          rendered.style.visibility = \"hidden\";\n        }\n\n        if (Array.isArray(rendered)) {\n          for (const renderedElement of rendered) {\n            div.appendChild(renderedElement);\n          }\n        } else {\n          if (element instanceof PopupAnnotationElement) {\n            div.prepend(rendered);\n          } else {\n            div.appendChild(rendered);\n          }\n        }\n      }\n    }\n\n    this.#setAnnotationCanvasMap(div, parameters.annotationCanvasMap);\n  }\n\n  static update(parameters) {\n    const {\n      page,\n      viewport,\n      annotations,\n      annotationCanvasMap,\n      div\n    } = parameters;\n    const transform = viewport.transform;\n    const matrix = `matrix(${transform.join(\",\")})`;\n    let scale, ownMatrix;\n\n    for (const data of annotations) {\n      const elements = div.querySelectorAll(`[data-annotation-id=\"${data.id}\"]`);\n\n      if (elements) {\n        for (const element of elements) {\n          if (data.hasOwnCanvas) {\n            const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);\n\n            if (!ownMatrix) {\n              scale = Math.abs(transform[0] || transform[1]);\n              const ownTransform = transform.slice();\n\n              for (let i = 0; i < 4; i++) {\n                ownTransform[i] = Math.sign(ownTransform[i]);\n              }\n\n              ownMatrix = `matrix(${ownTransform.join(\",\")})`;\n            }\n\n            const left = rect[0] * scale;\n            const top = rect[1] * scale;\n            element.style.left = `${left}px`;\n            element.style.top = `${top}px`;\n            element.style.transformOrigin = `${-left}px ${-top}px`;\n            element.style.transform = ownMatrix;\n          } else {\n            element.style.transform = matrix;\n          }\n        }\n      }\n    }\n\n    this.#setAnnotationCanvasMap(div, annotationCanvasMap);\n    div.hidden = false;\n  }\n\n  static #setAnnotationCanvasMap(div, annotationCanvasMap) {\n    if (!annotationCanvasMap) {\n      return;\n    }\n\n    for (const [id, canvas] of annotationCanvasMap) {\n      const element = div.querySelector(`[data-annotation-id=\"${id}\"]`);\n\n      if (!element) {\n        continue;\n      }\n\n      const {\n        firstChild\n      } = element;\n\n      if (firstChild.nodeName === \"CANVAS\") {\n        element.replaceChild(canvas, firstChild);\n      } else {\n        element.insertBefore(canvas, firstChild);\n      }\n    }\n\n    annotationCanvasMap.clear();\n  }\n\n}\n\nexports.AnnotationLayer = AnnotationLayer;\n\n/***/ }),\n/* 19 */\n/***/ ((__unused_webpack_module, exports) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.ColorConverters = void 0;\n\nfunction makeColorComp(n) {\n  return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, \"0\");\n}\n\nclass ColorConverters {\n  static CMYK_G([c, y, m, k]) {\n    return [\"G\", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];\n  }\n\n  static G_CMYK([g]) {\n    return [\"CMYK\", 0, 0, 0, 1 - g];\n  }\n\n  static G_RGB([g]) {\n    return [\"RGB\", g, g, g];\n  }\n\n  static G_HTML([g]) {\n    const G = makeColorComp(g);\n    return `#${G}${G}${G}`;\n  }\n\n  static RGB_G([r, g, b]) {\n    return [\"G\", 0.3 * r + 0.59 * g + 0.11 * b];\n  }\n\n  static RGB_HTML([r, g, b]) {\n    const R = makeColorComp(r);\n    const G = makeColorComp(g);\n    const B = makeColorComp(b);\n    return `#${R}${G}${B}`;\n  }\n\n  static T_HTML() {\n    return \"#00000000\";\n  }\n\n  static CMYK_RGB([c, y, m, k]) {\n    return [\"RGB\", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];\n  }\n\n  static CMYK_HTML(components) {\n    return this.RGB_HTML(this.CMYK_RGB(components));\n  }\n\n  static RGB_CMYK([r, g, b]) {\n    const c = 1 - r;\n    const m = 1 - g;\n    const y = 1 - b;\n    const k = Math.min(c, m, y);\n    return [\"CMYK\", c, m, y, k];\n  }\n\n}\n\nexports.ColorConverters = ColorConverters;\n\n/***/ }),\n/* 20 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.XfaLayer = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _xfa_text = __w_pdfjs_require__(17);\n\nclass XfaLayer {\n  static setupStorage(html, id, element, storage, intent) {\n    const storedData = storage.getValue(id, {\n      value: null\n    });\n\n    switch (element.name) {\n      case \"textarea\":\n        if (storedData.value !== null) {\n          html.textContent = storedData.value;\n        }\n\n        if (intent === \"print\") {\n          break;\n        }\n\n        html.addEventListener(\"input\", event => {\n          storage.setValue(id, {\n            value: event.target.value\n          });\n        });\n        break;\n\n      case \"input\":\n        if (element.attributes.type === \"radio\" || element.attributes.type === \"checkbox\") {\n          if (storedData.value === element.attributes.xfaOn) {\n            html.setAttribute(\"checked\", true);\n          } else if (storedData.value === element.attributes.xfaOff) {\n            html.removeAttribute(\"checked\");\n          }\n\n          if (intent === \"print\") {\n            break;\n          }\n\n          html.addEventListener(\"change\", event => {\n            storage.setValue(id, {\n              value: event.target.checked ? event.target.getAttribute(\"xfaOn\") : event.target.getAttribute(\"xfaOff\")\n            });\n          });\n        } else {\n          if (storedData.value !== null) {\n            html.setAttribute(\"value\", storedData.value);\n          }\n\n          if (intent === \"print\") {\n            break;\n          }\n\n          html.addEventListener(\"input\", event => {\n            storage.setValue(id, {\n              value: event.target.value\n            });\n          });\n        }\n\n        break;\n\n      case \"select\":\n        if (storedData.value !== null) {\n          for (const option of element.children) {\n            if (option.attributes.value === storedData.value) {\n              option.attributes.selected = true;\n            }\n          }\n        }\n\n        html.addEventListener(\"input\", event => {\n          const options = event.target.options;\n          const value = options.selectedIndex === -1 ? \"\" : options[options.selectedIndex].value;\n          storage.setValue(id, {\n            value\n          });\n        });\n        break;\n    }\n  }\n\n  static setAttributes({\n    html,\n    element,\n    storage = null,\n    intent,\n    linkService\n  }) {\n    const {\n      attributes\n    } = element;\n    const isHTMLAnchorElement = html instanceof HTMLAnchorElement;\n\n    if (attributes.type === \"radio\") {\n      attributes.name = `${attributes.name}-${intent}`;\n    }\n\n    for (const [key, value] of Object.entries(attributes)) {\n      if (value === null || value === undefined || key === \"dataId\") {\n        continue;\n      }\n\n      if (key !== \"style\") {\n        if (key === \"textContent\") {\n          html.textContent = value;\n        } else if (key === \"class\") {\n          if (value.length) {\n            html.setAttribute(key, value.join(\" \"));\n          }\n        } else {\n          if (isHTMLAnchorElement && (key === \"href\" || key === \"newWindow\")) {\n            continue;\n          }\n\n          html.setAttribute(key, value);\n        }\n      } else {\n        Object.assign(html.style, value);\n      }\n    }\n\n    if (isHTMLAnchorElement) {\n      if (!linkService.addLinkAttributes) {\n        (0, _util.warn)(\"XfaLayer.setAttribute - missing `addLinkAttributes`-method on the `linkService`-instance.\");\n      }\n\n      linkService.addLinkAttributes?.(html, attributes.href, attributes.newWindow);\n    }\n\n    if (storage && attributes.dataId) {\n      this.setupStorage(html, attributes.dataId, element, storage);\n    }\n  }\n\n  static render(parameters) {\n    const storage = parameters.annotationStorage;\n    const linkService = parameters.linkService;\n    const root = parameters.xfaHtml;\n    const intent = parameters.intent || \"display\";\n    const rootHtml = document.createElement(root.name);\n\n    if (root.attributes) {\n      this.setAttributes({\n        html: rootHtml,\n        element: root,\n        intent,\n        linkService\n      });\n    }\n\n    const stack = [[root, -1, rootHtml]];\n    const rootDiv = parameters.div;\n    rootDiv.appendChild(rootHtml);\n\n    if (parameters.viewport) {\n      const transform = `matrix(${parameters.viewport.transform.join(\",\")})`;\n      rootDiv.style.transform = transform;\n    }\n\n    if (intent !== \"richText\") {\n      rootDiv.setAttribute(\"class\", \"xfaLayer xfaFont\");\n    }\n\n    const textDivs = [];\n\n    while (stack.length > 0) {\n      const [parent, i, html] = stack[stack.length - 1];\n\n      if (i + 1 === parent.children.length) {\n        stack.pop();\n        continue;\n      }\n\n      const child = parent.children[++stack[stack.length - 1][1]];\n\n      if (child === null) {\n        continue;\n      }\n\n      const {\n        name\n      } = child;\n\n      if (name === \"#text\") {\n        const node = document.createTextNode(child.value);\n        textDivs.push(node);\n        html.appendChild(node);\n        continue;\n      }\n\n      let childHtml;\n\n      if (child?.attributes?.xmlns) {\n        childHtml = document.createElementNS(child.attributes.xmlns, name);\n      } else {\n        childHtml = document.createElement(name);\n      }\n\n      html.appendChild(childHtml);\n\n      if (child.attributes) {\n        this.setAttributes({\n          html: childHtml,\n          element: child,\n          storage,\n          intent,\n          linkService\n        });\n      }\n\n      if (child.children && child.children.length > 0) {\n        stack.push([child, -1, childHtml]);\n      } else if (child.value) {\n        const node = document.createTextNode(child.value);\n\n        if (_xfa_text.XfaText.shouldBuildText(name)) {\n          textDivs.push(node);\n        }\n\n        childHtml.appendChild(node);\n      }\n    }\n\n    for (const el of rootDiv.querySelectorAll(\".xfaNonInteractive input, .xfaNonInteractive textarea\")) {\n      el.setAttribute(\"readOnly\", true);\n    }\n\n    return {\n      textDivs\n    };\n  }\n\n  static update(parameters) {\n    const transform = `matrix(${parameters.viewport.transform.join(\",\")})`;\n    parameters.div.style.transform = transform;\n    parameters.div.hidden = false;\n  }\n\n}\n\nexports.XfaLayer = XfaLayer;\n\n/***/ }),\n/* 21 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.renderTextLayer = renderTextLayer;\n\nvar _util = __w_pdfjs_require__(1);\n\nconst MAX_TEXT_DIVS_TO_RENDER = 100000;\nconst DEFAULT_FONT_SIZE = 30;\nconst DEFAULT_FONT_ASCENT = 0.8;\nconst ascentCache = new Map();\nconst AllWhitespaceRegexp = /^\\s+$/g;\n\nfunction getAscent(fontFamily, ctx) {\n  const cachedAscent = ascentCache.get(fontFamily);\n\n  if (cachedAscent) {\n    return cachedAscent;\n  }\n\n  ctx.save();\n  ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;\n  const metrics = ctx.measureText(\"\");\n  let ascent = metrics.fontBoundingBoxAscent;\n  let descent = Math.abs(metrics.fontBoundingBoxDescent);\n\n  if (ascent) {\n    ctx.restore();\n    const ratio = ascent / (ascent + descent);\n    ascentCache.set(fontFamily, ratio);\n    return ratio;\n  }\n\n  ctx.strokeStyle = \"red\";\n  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);\n  ctx.strokeText(\"g\", 0, 0);\n  let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;\n  descent = 0;\n\n  for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {\n    if (pixels[i] > 0) {\n      descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);\n      break;\n    }\n  }\n\n  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);\n  ctx.strokeText(\"A\", 0, DEFAULT_FONT_SIZE);\n  pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;\n  ascent = 0;\n\n  for (let i = 0, ii = pixels.length; i < ii; i += 4) {\n    if (pixels[i] > 0) {\n      ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);\n      break;\n    }\n  }\n\n  ctx.restore();\n\n  if (ascent) {\n    const ratio = ascent / (ascent + descent);\n    ascentCache.set(fontFamily, ratio);\n    return ratio;\n  }\n\n  ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);\n  return DEFAULT_FONT_ASCENT;\n}\n\nfunction appendText(task, geom, styles, ctx) {\n  const textDiv = document.createElement(\"span\");\n  const textDivProperties = task._enhanceTextSelection ? {\n    angle: 0,\n    canvasWidth: 0,\n    hasText: geom.str !== \"\",\n    hasEOL: geom.hasEOL,\n    originalTransform: null,\n    paddingBottom: 0,\n    paddingLeft: 0,\n    paddingRight: 0,\n    paddingTop: 0,\n    scale: 1\n  } : {\n    angle: 0,\n    canvasWidth: 0,\n    hasText: geom.str !== \"\",\n    hasEOL: geom.hasEOL\n  };\n\n  task._textDivs.push(textDiv);\n\n  const tx = _util.Util.transform(task._viewport.transform, geom.transform);\n\n  let angle = Math.atan2(tx[1], tx[0]);\n  const style = styles[geom.fontName];\n\n  if (style.vertical) {\n    angle += Math.PI / 2;\n  }\n\n  const fontHeight = Math.hypot(tx[2], tx[3]);\n  const fontAscent = fontHeight * getAscent(style.fontFamily, ctx);\n  let left, top;\n\n  if (angle === 0) {\n    left = tx[4];\n    top = tx[5] - fontAscent;\n  } else {\n    left = tx[4] + fontAscent * Math.sin(angle);\n    top = tx[5] - fontAscent * Math.cos(angle);\n  }\n\n  textDiv.style.left = `${left}px`;\n  textDiv.style.top = `${top}px`;\n  textDiv.style.fontSize = `${fontHeight}px`;\n  textDiv.style.fontFamily = style.fontFamily;\n  textDiv.setAttribute(\"role\", \"presentation\");\n  textDiv.textContent = geom.str;\n  textDiv.dir = geom.dir;\n\n  if (task._fontInspectorEnabled) {\n    textDiv.dataset.fontName = geom.fontName;\n  }\n\n  if (angle !== 0) {\n    textDivProperties.angle = angle * (180 / Math.PI);\n  }\n\n  let shouldScaleText = false;\n\n  if (geom.str.length > 1 || task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str)) {\n    shouldScaleText = true;\n  } else if (geom.str !== \" \" && geom.transform[0] !== geom.transform[3]) {\n    const absScaleX = Math.abs(geom.transform[0]),\n          absScaleY = Math.abs(geom.transform[3]);\n\n    if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {\n      shouldScaleText = true;\n    }\n  }\n\n  if (shouldScaleText) {\n    if (style.vertical) {\n      textDivProperties.canvasWidth = geom.height * task._viewport.scale;\n    } else {\n      textDivProperties.canvasWidth = geom.width * task._viewport.scale;\n    }\n  }\n\n  task._textDivProperties.set(textDiv, textDivProperties);\n\n  if (task._textContentStream) {\n    task._layoutText(textDiv);\n  }\n\n  if (task._enhanceTextSelection && textDivProperties.hasText) {\n    let angleCos = 1,\n        angleSin = 0;\n\n    if (angle !== 0) {\n      angleCos = Math.cos(angle);\n      angleSin = Math.sin(angle);\n    }\n\n    const divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale;\n    const divHeight = fontHeight;\n    let m, b;\n\n    if (angle !== 0) {\n      m = [angleCos, angleSin, -angleSin, angleCos, left, top];\n      b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);\n    } else {\n      b = [left, top, left + divWidth, top + divHeight];\n    }\n\n    task._bounds.push({\n      left: b[0],\n      top: b[1],\n      right: b[2],\n      bottom: b[3],\n      div: textDiv,\n      size: [divWidth, divHeight],\n      m\n    });\n  }\n}\n\nfunction render(task) {\n  if (task._canceled) {\n    return;\n  }\n\n  const textDivs = task._textDivs;\n  const capability = task._capability;\n  const textDivsLength = textDivs.length;\n\n  if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {\n    task._renderingDone = true;\n    capability.resolve();\n    return;\n  }\n\n  if (!task._textContentStream) {\n    for (let i = 0; i < textDivsLength; i++) {\n      task._layoutText(textDivs[i]);\n    }\n  }\n\n  task._renderingDone = true;\n  capability.resolve();\n}\n\nfunction findPositiveMin(ts, offset, count) {\n  let result = 0;\n\n  for (let i = 0; i < count; i++) {\n    const t = ts[offset++];\n\n    if (t > 0) {\n      result = result ? Math.min(t, result) : t;\n    }\n  }\n\n  return result;\n}\n\nfunction expand(task) {\n  const bounds = task._bounds;\n  const viewport = task._viewport;\n  const expanded = expandBounds(viewport.width, viewport.height, bounds);\n\n  for (let i = 0; i < expanded.length; i++) {\n    const div = bounds[i].div;\n\n    const divProperties = task._textDivProperties.get(div);\n\n    if (divProperties.angle === 0) {\n      divProperties.paddingLeft = bounds[i].left - expanded[i].left;\n      divProperties.paddingTop = bounds[i].top - expanded[i].top;\n      divProperties.paddingRight = expanded[i].right - bounds[i].right;\n      divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom;\n\n      task._textDivProperties.set(div, divProperties);\n\n      continue;\n    }\n\n    const e = expanded[i],\n          b = bounds[i];\n    const m = b.m,\n          c = m[0],\n          s = m[1];\n    const points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];\n    const ts = new Float64Array(64);\n\n    for (let j = 0, jj = points.length; j < jj; j++) {\n      const t = _util.Util.applyTransform(points[j], m);\n\n      ts[j + 0] = c && (e.left - t[0]) / c;\n      ts[j + 4] = s && (e.top - t[1]) / s;\n      ts[j + 8] = c && (e.right - t[0]) / c;\n      ts[j + 12] = s && (e.bottom - t[1]) / s;\n      ts[j + 16] = s && (e.left - t[0]) / -s;\n      ts[j + 20] = c && (e.top - t[1]) / c;\n      ts[j + 24] = s && (e.right - t[0]) / -s;\n      ts[j + 28] = c && (e.bottom - t[1]) / c;\n      ts[j + 32] = c && (e.left - t[0]) / -c;\n      ts[j + 36] = s && (e.top - t[1]) / -s;\n      ts[j + 40] = c && (e.right - t[0]) / -c;\n      ts[j + 44] = s && (e.bottom - t[1]) / -s;\n      ts[j + 48] = s && (e.left - t[0]) / s;\n      ts[j + 52] = c && (e.top - t[1]) / -c;\n      ts[j + 56] = s && (e.right - t[0]) / s;\n      ts[j + 60] = c && (e.bottom - t[1]) / -c;\n    }\n\n    const boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));\n    divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;\n    divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;\n    divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;\n    divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;\n\n    task._textDivProperties.set(div, divProperties);\n  }\n}\n\nfunction expandBounds(width, height, boxes) {\n  const bounds = boxes.map(function (box, i) {\n    return {\n      x1: box.left,\n      y1: box.top,\n      x2: box.right,\n      y2: box.bottom,\n      index: i,\n      x1New: undefined,\n      x2New: undefined\n    };\n  });\n  expandBoundsLTR(width, bounds);\n  const expanded = new Array(boxes.length);\n\n  for (const b of bounds) {\n    const i = b.index;\n    expanded[i] = {\n      left: b.x1New,\n      top: 0,\n      right: b.x2New,\n      bottom: 0\n    };\n  }\n\n  boxes.map(function (box, i) {\n    const e = expanded[i],\n          b = bounds[i];\n    b.x1 = box.top;\n    b.y1 = width - e.right;\n    b.x2 = box.bottom;\n    b.y2 = width - e.left;\n    b.index = i;\n    b.x1New = undefined;\n    b.x2New = undefined;\n  });\n  expandBoundsLTR(height, bounds);\n\n  for (const b of bounds) {\n    const i = b.index;\n    expanded[i].top = b.x1New;\n    expanded[i].bottom = b.x2New;\n  }\n\n  return expanded;\n}\n\nfunction expandBoundsLTR(width, bounds) {\n  bounds.sort(function (a, b) {\n    return a.x1 - b.x1 || a.index - b.index;\n  });\n  const fakeBoundary = {\n    x1: -Infinity,\n    y1: -Infinity,\n    x2: 0,\n    y2: Infinity,\n    index: -1,\n    x1New: 0,\n    x2New: 0\n  };\n  const horizon = [{\n    start: -Infinity,\n    end: Infinity,\n    boundary: fakeBoundary\n  }];\n\n  for (const boundary of bounds) {\n    let i = 0;\n\n    while (i < horizon.length && horizon[i].end <= boundary.y1) {\n      i++;\n    }\n\n    let j = horizon.length - 1;\n\n    while (j >= 0 && horizon[j].start >= boundary.y2) {\n      j--;\n    }\n\n    let horizonPart, affectedBoundary;\n    let q,\n        k,\n        maxXNew = -Infinity;\n\n    for (q = i; q <= j; q++) {\n      horizonPart = horizon[q];\n      affectedBoundary = horizonPart.boundary;\n      let xNew;\n\n      if (affectedBoundary.x2 > boundary.x1) {\n        xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1;\n      } else if (affectedBoundary.x2New === undefined) {\n        xNew = (affectedBoundary.x2 + boundary.x1) / 2;\n      } else {\n        xNew = affectedBoundary.x2New;\n      }\n\n      if (xNew > maxXNew) {\n        maxXNew = xNew;\n      }\n    }\n\n    boundary.x1New = maxXNew;\n\n    for (q = i; q <= j; q++) {\n      horizonPart = horizon[q];\n      affectedBoundary = horizonPart.boundary;\n\n      if (affectedBoundary.x2New === undefined) {\n        if (affectedBoundary.x2 > boundary.x1) {\n          if (affectedBoundary.index > boundary.index) {\n            affectedBoundary.x2New = affectedBoundary.x2;\n          }\n        } else {\n          affectedBoundary.x2New = maxXNew;\n        }\n      } else if (affectedBoundary.x2New > maxXNew) {\n        affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2);\n      }\n    }\n\n    const changedHorizon = [];\n    let lastBoundary = null;\n\n    for (q = i; q <= j; q++) {\n      horizonPart = horizon[q];\n      affectedBoundary = horizonPart.boundary;\n      const useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;\n\n      if (lastBoundary === useBoundary) {\n        changedHorizon[changedHorizon.length - 1].end = horizonPart.end;\n      } else {\n        changedHorizon.push({\n          start: horizonPart.start,\n          end: horizonPart.end,\n          boundary: useBoundary\n        });\n        lastBoundary = useBoundary;\n      }\n    }\n\n    if (horizon[i].start < boundary.y1) {\n      changedHorizon[0].start = boundary.y1;\n      changedHorizon.unshift({\n        start: horizon[i].start,\n        end: boundary.y1,\n        boundary: horizon[i].boundary\n      });\n    }\n\n    if (boundary.y2 < horizon[j].end) {\n      changedHorizon[changedHorizon.length - 1].end = boundary.y2;\n      changedHorizon.push({\n        start: boundary.y2,\n        end: horizon[j].end,\n        boundary: horizon[j].boundary\n      });\n    }\n\n    for (q = i; q <= j; q++) {\n      horizonPart = horizon[q];\n      affectedBoundary = horizonPart.boundary;\n\n      if (affectedBoundary.x2New !== undefined) {\n        continue;\n      }\n\n      let used = false;\n\n      for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) {\n        used = horizon[k].boundary === affectedBoundary;\n      }\n\n      for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) {\n        used = horizon[k].boundary === affectedBoundary;\n      }\n\n      for (k = 0; !used && k < changedHorizon.length; k++) {\n        used = changedHorizon[k].boundary === affectedBoundary;\n      }\n\n      if (!used) {\n        affectedBoundary.x2New = maxXNew;\n      }\n    }\n\n    Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon));\n  }\n\n  for (const horizonPart of horizon) {\n    const affectedBoundary = horizonPart.boundary;\n\n    if (affectedBoundary.x2New === undefined) {\n      affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);\n    }\n  }\n}\n\nclass TextLayerRenderTask {\n  constructor({\n    textContent,\n    textContentStream,\n    container,\n    viewport,\n    textDivs,\n    textContentItemsStr,\n    enhanceTextSelection\n  }) {\n    this._textContent = textContent;\n    this._textContentStream = textContentStream;\n    this._container = container;\n    this._document = container.ownerDocument;\n    this._viewport = viewport;\n    this._textDivs = textDivs || [];\n    this._textContentItemsStr = textContentItemsStr || [];\n    this._enhanceTextSelection = !!enhanceTextSelection;\n    this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled;\n    this._reader = null;\n    this._layoutTextLastFontSize = null;\n    this._layoutTextLastFontFamily = null;\n    this._layoutTextCtx = null;\n    this._textDivProperties = new WeakMap();\n    this._renderingDone = false;\n    this._canceled = false;\n    this._capability = (0, _util.createPromiseCapability)();\n    this._renderTimer = null;\n    this._bounds = [];\n\n    this._capability.promise.finally(() => {\n      if (!this._enhanceTextSelection) {\n        this._textDivProperties = null;\n      }\n\n      if (this._layoutTextCtx) {\n        this._layoutTextCtx.canvas.width = 0;\n        this._layoutTextCtx.canvas.height = 0;\n        this._layoutTextCtx = null;\n      }\n    }).catch(() => {});\n  }\n\n  get promise() {\n    return this._capability.promise;\n  }\n\n  cancel() {\n    this._canceled = true;\n\n    if (this._reader) {\n      this._reader.cancel(new _util.AbortException(\"TextLayer task cancelled.\")).catch(() => {});\n\n      this._reader = null;\n    }\n\n    if (this._renderTimer !== null) {\n      clearTimeout(this._renderTimer);\n      this._renderTimer = null;\n    }\n\n    this._capability.reject(new Error(\"TextLayer task cancelled.\"));\n  }\n\n  _processItems(items, styleCache) {\n    for (let i = 0, len = items.length; i < len; i++) {\n      if (items[i].str === undefined) {\n        if (items[i].type === \"beginMarkedContentProps\" || items[i].type === \"beginMarkedContent\") {\n          const parent = this._container;\n          this._container = document.createElement(\"span\");\n\n          this._container.classList.add(\"markedContent\");\n\n          if (items[i].id !== null) {\n            this._container.setAttribute(\"id\", `${items[i].id}`);\n          }\n\n          parent.appendChild(this._container);\n        } else if (items[i].type === \"endMarkedContent\") {\n          this._container = this._container.parentNode;\n        }\n\n        continue;\n      }\n\n      this._textContentItemsStr.push(items[i].str);\n\n      appendText(this, items[i], styleCache, this._layoutTextCtx);\n    }\n  }\n\n  _layoutText(textDiv) {\n    const textDivProperties = this._textDivProperties.get(textDiv);\n\n    let transform = \"\";\n\n    if (textDivProperties.canvasWidth !== 0 && textDivProperties.hasText) {\n      const {\n        fontSize,\n        fontFamily\n      } = textDiv.style;\n\n      if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) {\n        this._layoutTextCtx.font = `${fontSize} ${fontFamily}`;\n        this._layoutTextLastFontSize = fontSize;\n        this._layoutTextLastFontFamily = fontFamily;\n      }\n\n      const {\n        width\n      } = this._layoutTextCtx.measureText(textDiv.textContent);\n\n      if (width > 0) {\n        const scale = textDivProperties.canvasWidth / width;\n\n        if (this._enhanceTextSelection) {\n          textDivProperties.scale = scale;\n        }\n\n        transform = `scaleX(${scale})`;\n      }\n    }\n\n    if (textDivProperties.angle !== 0) {\n      transform = `rotate(${textDivProperties.angle}deg) ${transform}`;\n    }\n\n    if (transform.length > 0) {\n      if (this._enhanceTextSelection) {\n        textDivProperties.originalTransform = transform;\n      }\n\n      textDiv.style.transform = transform;\n    }\n\n    if (textDivProperties.hasText) {\n      this._container.appendChild(textDiv);\n    }\n\n    if (textDivProperties.hasEOL) {\n      const br = document.createElement(\"br\");\n      br.setAttribute(\"role\", \"presentation\");\n\n      this._container.appendChild(br);\n    }\n  }\n\n  _render(timeout = 0) {\n    const capability = (0, _util.createPromiseCapability)();\n    let styleCache = Object.create(null);\n\n    const canvas = this._document.createElement(\"canvas\");\n\n    canvas.height = canvas.width = DEFAULT_FONT_SIZE;\n    canvas.mozOpaque = true;\n    this._layoutTextCtx = canvas.getContext(\"2d\", {\n      alpha: false\n    });\n\n    if (this._textContent) {\n      const textItems = this._textContent.items;\n      const textStyles = this._textContent.styles;\n\n      this._processItems(textItems, textStyles);\n\n      capability.resolve();\n    } else if (this._textContentStream) {\n      const pump = () => {\n        this._reader.read().then(({\n          value,\n          done\n        }) => {\n          if (done) {\n            capability.resolve();\n            return;\n          }\n\n          Object.assign(styleCache, value.styles);\n\n          this._processItems(value.items, styleCache);\n\n          pump();\n        }, capability.reject);\n      };\n\n      this._reader = this._textContentStream.getReader();\n      pump();\n    } else {\n      throw new Error('Neither \"textContent\" nor \"textContentStream\" parameters specified.');\n    }\n\n    capability.promise.then(() => {\n      styleCache = null;\n\n      if (!timeout) {\n        render(this);\n      } else {\n        this._renderTimer = setTimeout(() => {\n          render(this);\n          this._renderTimer = null;\n        }, timeout);\n      }\n    }, this._capability.reject);\n  }\n\n  expandTextDivs(expandDivs = false) {\n    if (!this._enhanceTextSelection || !this._renderingDone) {\n      return;\n    }\n\n    if (this._bounds !== null) {\n      expand(this);\n      this._bounds = null;\n    }\n\n    const transformBuf = [],\n          paddingBuf = [];\n\n    for (let i = 0, ii = this._textDivs.length; i < ii; i++) {\n      const div = this._textDivs[i];\n\n      const divProps = this._textDivProperties.get(div);\n\n      if (!divProps.hasText) {\n        continue;\n      }\n\n      if (expandDivs) {\n        transformBuf.length = 0;\n        paddingBuf.length = 0;\n\n        if (divProps.originalTransform) {\n          transformBuf.push(divProps.originalTransform);\n        }\n\n        if (divProps.paddingTop > 0) {\n          paddingBuf.push(`${divProps.paddingTop}px`);\n          transformBuf.push(`translateY(${-divProps.paddingTop}px)`);\n        } else {\n          paddingBuf.push(0);\n        }\n\n        if (divProps.paddingRight > 0) {\n          paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`);\n        } else {\n          paddingBuf.push(0);\n        }\n\n        if (divProps.paddingBottom > 0) {\n          paddingBuf.push(`${divProps.paddingBottom}px`);\n        } else {\n          paddingBuf.push(0);\n        }\n\n        if (divProps.paddingLeft > 0) {\n          paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`);\n          transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`);\n        } else {\n          paddingBuf.push(0);\n        }\n\n        div.style.padding = paddingBuf.join(\" \");\n\n        if (transformBuf.length) {\n          div.style.transform = transformBuf.join(\" \");\n        }\n      } else {\n        div.style.padding = null;\n        div.style.transform = divProps.originalTransform;\n      }\n    }\n  }\n\n}\n\nfunction renderTextLayer(renderParameters) {\n  const task = new TextLayerRenderTask({\n    textContent: renderParameters.textContent,\n    textContentStream: renderParameters.textContentStream,\n    container: renderParameters.container,\n    viewport: renderParameters.viewport,\n    textDivs: renderParameters.textDivs,\n    textContentItemsStr: renderParameters.textContentItemsStr,\n    enhanceTextSelection: renderParameters.enhanceTextSelection\n  });\n\n  task._render(renderParameters.timeout);\n\n  return task;\n}\n\n/***/ }),\n/* 22 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.SVGGraphics = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nvar _is_node = __w_pdfjs_require__(3);\n\nlet SVGGraphics = class {\n  constructor() {\n    (0, _util.unreachable)(\"Not implemented: SVGGraphics\");\n  }\n\n};\nexports.SVGGraphics = SVGGraphics;\n{\n  const SVG_DEFAULTS = {\n    fontStyle: \"normal\",\n    fontWeight: \"normal\",\n    fillColor: \"#000000\"\n  };\n  const XML_NS = \"http://www.w3.org/XML/1998/namespace\";\n  const XLINK_NS = \"http://www.w3.org/1999/xlink\";\n  const LINE_CAP_STYLES = [\"butt\", \"round\", \"square\"];\n  const LINE_JOIN_STYLES = [\"miter\", \"round\", \"bevel\"];\n\n  const createObjectURL = function (data, contentType = \"\", forceDataSchema = false) {\n    if (URL.createObjectURL && typeof Blob !== \"undefined\" && !forceDataSchema) {\n      return URL.createObjectURL(new Blob([data], {\n        type: contentType\n      }));\n    }\n\n    const digits = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    let buffer = `data:${contentType};base64,`;\n\n    for (let i = 0, ii = data.length; i < ii; i += 3) {\n      const b1 = data[i] & 0xff;\n      const b2 = data[i + 1] & 0xff;\n      const b3 = data[i + 2] & 0xff;\n      const d1 = b1 >> 2,\n            d2 = (b1 & 3) << 4 | b2 >> 4;\n      const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;\n      const d4 = i + 2 < ii ? b3 & 0x3f : 64;\n      buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];\n    }\n\n    return buffer;\n  };\n\n  const convertImgDataToPng = function () {\n    const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);\n    const CHUNK_WRAPPER_SIZE = 12;\n    const crcTable = new Int32Array(256);\n\n    for (let i = 0; i < 256; i++) {\n      let c = i;\n\n      for (let h = 0; h < 8; h++) {\n        if (c & 1) {\n          c = 0xedb88320 ^ c >> 1 & 0x7fffffff;\n        } else {\n          c = c >> 1 & 0x7fffffff;\n        }\n      }\n\n      crcTable[i] = c;\n    }\n\n    function crc32(data, start, end) {\n      let crc = -1;\n\n      for (let i = start; i < end; i++) {\n        const a = (crc ^ data[i]) & 0xff;\n        const b = crcTable[a];\n        crc = crc >>> 8 ^ b;\n      }\n\n      return crc ^ -1;\n    }\n\n    function writePngChunk(type, body, data, offset) {\n      let p = offset;\n      const len = body.length;\n      data[p] = len >> 24 & 0xff;\n      data[p + 1] = len >> 16 & 0xff;\n      data[p + 2] = len >> 8 & 0xff;\n      data[p + 3] = len & 0xff;\n      p += 4;\n      data[p] = type.charCodeAt(0) & 0xff;\n      data[p + 1] = type.charCodeAt(1) & 0xff;\n      data[p + 2] = type.charCodeAt(2) & 0xff;\n      data[p + 3] = type.charCodeAt(3) & 0xff;\n      p += 4;\n      data.set(body, p);\n      p += body.length;\n      const crc = crc32(data, offset + 4, p);\n      data[p] = crc >> 24 & 0xff;\n      data[p + 1] = crc >> 16 & 0xff;\n      data[p + 2] = crc >> 8 & 0xff;\n      data[p + 3] = crc & 0xff;\n    }\n\n    function adler32(data, start, end) {\n      let a = 1;\n      let b = 0;\n\n      for (let i = start; i < end; ++i) {\n        a = (a + (data[i] & 0xff)) % 65521;\n        b = (b + a) % 65521;\n      }\n\n      return b << 16 | a;\n    }\n\n    function deflateSync(literals) {\n      if (!_is_node.isNodeJS) {\n        return deflateSyncUncompressed(literals);\n      }\n\n      try {\n        let input;\n\n        if (parseInt(process.versions.node) >= 8) {\n          input = literals;\n        } else {\n          input = Buffer.from(literals);\n        }\n\n        const output = (__webpack_require__(/*! zlib */ \"?afbb\").deflateSync)(input, {\n          level: 9\n        });\n\n        return output instanceof Uint8Array ? output : new Uint8Array(output);\n      } catch (e) {\n        (0, _util.warn)(\"Not compressing PNG because zlib.deflateSync is unavailable: \" + e);\n      }\n\n      return deflateSyncUncompressed(literals);\n    }\n\n    function deflateSyncUncompressed(literals) {\n      let len = literals.length;\n      const maxBlockLength = 0xffff;\n      const deflateBlocks = Math.ceil(len / maxBlockLength);\n      const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);\n      let pi = 0;\n      idat[pi++] = 0x78;\n      idat[pi++] = 0x9c;\n      let pos = 0;\n\n      while (len > maxBlockLength) {\n        idat[pi++] = 0x00;\n        idat[pi++] = 0xff;\n        idat[pi++] = 0xff;\n        idat[pi++] = 0x00;\n        idat[pi++] = 0x00;\n        idat.set(literals.subarray(pos, pos + maxBlockLength), pi);\n        pi += maxBlockLength;\n        pos += maxBlockLength;\n        len -= maxBlockLength;\n      }\n\n      idat[pi++] = 0x01;\n      idat[pi++] = len & 0xff;\n      idat[pi++] = len >> 8 & 0xff;\n      idat[pi++] = ~len & 0xffff & 0xff;\n      idat[pi++] = (~len & 0xffff) >> 8 & 0xff;\n      idat.set(literals.subarray(pos), pi);\n      pi += literals.length - pos;\n      const adler = adler32(literals, 0, literals.length);\n      idat[pi++] = adler >> 24 & 0xff;\n      idat[pi++] = adler >> 16 & 0xff;\n      idat[pi++] = adler >> 8 & 0xff;\n      idat[pi++] = adler & 0xff;\n      return idat;\n    }\n\n    function encode(imgData, kind, forceDataSchema, isMask) {\n      const width = imgData.width;\n      const height = imgData.height;\n      let bitDepth, colorType, lineSize;\n      const bytes = imgData.data;\n\n      switch (kind) {\n        case _util.ImageKind.GRAYSCALE_1BPP:\n          colorType = 0;\n          bitDepth = 1;\n          lineSize = width + 7 >> 3;\n          break;\n\n        case _util.ImageKind.RGB_24BPP:\n          colorType = 2;\n          bitDepth = 8;\n          lineSize = width * 3;\n          break;\n\n        case _util.ImageKind.RGBA_32BPP:\n          colorType = 6;\n          bitDepth = 8;\n          lineSize = width * 4;\n          break;\n\n        default:\n          throw new Error(\"invalid format\");\n      }\n\n      const literals = new Uint8Array((1 + lineSize) * height);\n      let offsetLiterals = 0,\n          offsetBytes = 0;\n\n      for (let y = 0; y < height; ++y) {\n        literals[offsetLiterals++] = 0;\n        literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);\n        offsetBytes += lineSize;\n        offsetLiterals += lineSize;\n      }\n\n      if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {\n        offsetLiterals = 0;\n\n        for (let y = 0; y < height; y++) {\n          offsetLiterals++;\n\n          for (let i = 0; i < lineSize; i++) {\n            literals[offsetLiterals++] ^= 0xff;\n          }\n        }\n      }\n\n      const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);\n      const idat = deflateSync(literals);\n      const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;\n      const data = new Uint8Array(pngLength);\n      let offset = 0;\n      data.set(PNG_HEADER, offset);\n      offset += PNG_HEADER.length;\n      writePngChunk(\"IHDR\", ihdr, data, offset);\n      offset += CHUNK_WRAPPER_SIZE + ihdr.length;\n      writePngChunk(\"IDATA\", idat, data, offset);\n      offset += CHUNK_WRAPPER_SIZE + idat.length;\n      writePngChunk(\"IEND\", new Uint8Array(0), data, offset);\n      return createObjectURL(data, \"image/png\", forceDataSchema);\n    }\n\n    return function convertImgDataToPng(imgData, forceDataSchema, isMask) {\n      const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;\n      return encode(imgData, kind, forceDataSchema, isMask);\n    };\n  }();\n\n  class SVGExtraState {\n    constructor() {\n      this.fontSizeScale = 1;\n      this.fontWeight = SVG_DEFAULTS.fontWeight;\n      this.fontSize = 0;\n      this.textMatrix = _util.IDENTITY_MATRIX;\n      this.fontMatrix = _util.FONT_IDENTITY_MATRIX;\n      this.leading = 0;\n      this.textRenderingMode = _util.TextRenderingMode.FILL;\n      this.textMatrixScale = 1;\n      this.x = 0;\n      this.y = 0;\n      this.lineX = 0;\n      this.lineY = 0;\n      this.charSpacing = 0;\n      this.wordSpacing = 0;\n      this.textHScale = 1;\n      this.textRise = 0;\n      this.fillColor = SVG_DEFAULTS.fillColor;\n      this.strokeColor = \"#000000\";\n      this.fillAlpha = 1;\n      this.strokeAlpha = 1;\n      this.lineWidth = 1;\n      this.lineJoin = \"\";\n      this.lineCap = \"\";\n      this.miterLimit = 0;\n      this.dashArray = [];\n      this.dashPhase = 0;\n      this.dependencies = [];\n      this.activeClipUrl = null;\n      this.clipGroup = null;\n      this.maskId = \"\";\n    }\n\n    clone() {\n      return Object.create(this);\n    }\n\n    setCurrentPoint(x, y) {\n      this.x = x;\n      this.y = y;\n    }\n\n  }\n\n  function opListToTree(opList) {\n    let opTree = [];\n    const tmp = [];\n\n    for (const opListElement of opList) {\n      if (opListElement.fn === \"save\") {\n        opTree.push({\n          fnId: 92,\n          fn: \"group\",\n          items: []\n        });\n        tmp.push(opTree);\n        opTree = opTree[opTree.length - 1].items;\n        continue;\n      }\n\n      if (opListElement.fn === \"restore\") {\n        opTree = tmp.pop();\n      } else {\n        opTree.push(opListElement);\n      }\n    }\n\n    return opTree;\n  }\n\n  function pf(value) {\n    if (Number.isInteger(value)) {\n      return value.toString();\n    }\n\n    const s = value.toFixed(10);\n    let i = s.length - 1;\n\n    if (s[i] !== \"0\") {\n      return s;\n    }\n\n    do {\n      i--;\n    } while (s[i] === \"0\");\n\n    return s.substring(0, s[i] === \".\" ? i : i + 1);\n  }\n\n  function pm(m) {\n    if (m[4] === 0 && m[5] === 0) {\n      if (m[1] === 0 && m[2] === 0) {\n        if (m[0] === 1 && m[3] === 1) {\n          return \"\";\n        }\n\n        return `scale(${pf(m[0])} ${pf(m[3])})`;\n      }\n\n      if (m[0] === m[3] && m[1] === -m[2]) {\n        const a = Math.acos(m[0]) * 180 / Math.PI;\n        return `rotate(${pf(a)})`;\n      }\n    } else {\n      if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {\n        return `translate(${pf(m[4])} ${pf(m[5])})`;\n      }\n    }\n\n    return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`;\n  }\n\n  let clipCount = 0;\n  let maskCount = 0;\n  let shadingCount = 0;\n  exports.SVGGraphics = SVGGraphics = class {\n    constructor(commonObjs, objs, forceDataSchema = false) {\n      this.svgFactory = new _display_utils.DOMSVGFactory();\n      this.current = new SVGExtraState();\n      this.transformMatrix = _util.IDENTITY_MATRIX;\n      this.transformStack = [];\n      this.extraStack = [];\n      this.commonObjs = commonObjs;\n      this.objs = objs;\n      this.pendingClip = null;\n      this.pendingEOFill = false;\n      this.embedFonts = false;\n      this.embeddedFonts = Object.create(null);\n      this.cssStyle = null;\n      this.forceDataSchema = !!forceDataSchema;\n      this._operatorIdMapping = [];\n\n      for (const op in _util.OPS) {\n        this._operatorIdMapping[_util.OPS[op]] = op;\n      }\n    }\n\n    save() {\n      this.transformStack.push(this.transformMatrix);\n      const old = this.current;\n      this.extraStack.push(old);\n      this.current = old.clone();\n    }\n\n    restore() {\n      this.transformMatrix = this.transformStack.pop();\n      this.current = this.extraStack.pop();\n      this.pendingClip = null;\n      this.tgrp = null;\n    }\n\n    group(items) {\n      this.save();\n      this.executeOpTree(items);\n      this.restore();\n    }\n\n    loadDependencies(operatorList) {\n      const fnArray = operatorList.fnArray;\n      const argsArray = operatorList.argsArray;\n\n      for (let i = 0, ii = fnArray.length; i < ii; i++) {\n        if (fnArray[i] !== _util.OPS.dependency) {\n          continue;\n        }\n\n        for (const obj of argsArray[i]) {\n          const objsPool = obj.startsWith(\"g_\") ? this.commonObjs : this.objs;\n          const promise = new Promise(resolve => {\n            objsPool.get(obj, resolve);\n          });\n          this.current.dependencies.push(promise);\n        }\n      }\n\n      return Promise.all(this.current.dependencies);\n    }\n\n    transform(a, b, c, d, e, f) {\n      const transformMatrix = [a, b, c, d, e, f];\n      this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);\n      this.tgrp = null;\n    }\n\n    getSVG(operatorList, viewport) {\n      this.viewport = viewport;\n\n      const svgElement = this._initialize(viewport);\n\n      return this.loadDependencies(operatorList).then(() => {\n        this.transformMatrix = _util.IDENTITY_MATRIX;\n        this.executeOpTree(this.convertOpList(operatorList));\n        return svgElement;\n      });\n    }\n\n    convertOpList(operatorList) {\n      const operatorIdMapping = this._operatorIdMapping;\n      const argsArray = operatorList.argsArray;\n      const fnArray = operatorList.fnArray;\n      const opList = [];\n\n      for (let i = 0, ii = fnArray.length; i < ii; i++) {\n        const fnId = fnArray[i];\n        opList.push({\n          fnId,\n          fn: operatorIdMapping[fnId],\n          args: argsArray[i]\n        });\n      }\n\n      return opListToTree(opList);\n    }\n\n    executeOpTree(opTree) {\n      for (const opTreeElement of opTree) {\n        const fn = opTreeElement.fn;\n        const fnId = opTreeElement.fnId;\n        const args = opTreeElement.args;\n\n        switch (fnId | 0) {\n          case _util.OPS.beginText:\n            this.beginText();\n            break;\n\n          case _util.OPS.dependency:\n            break;\n\n          case _util.OPS.setLeading:\n            this.setLeading(args);\n            break;\n\n          case _util.OPS.setLeadingMoveText:\n            this.setLeadingMoveText(args[0], args[1]);\n            break;\n\n          case _util.OPS.setFont:\n            this.setFont(args);\n            break;\n\n          case _util.OPS.showText:\n            this.showText(args[0]);\n            break;\n\n          case _util.OPS.showSpacedText:\n            this.showText(args[0]);\n            break;\n\n          case _util.OPS.endText:\n            this.endText();\n            break;\n\n          case _util.OPS.moveText:\n            this.moveText(args[0], args[1]);\n            break;\n\n          case _util.OPS.setCharSpacing:\n            this.setCharSpacing(args[0]);\n            break;\n\n          case _util.OPS.setWordSpacing:\n            this.setWordSpacing(args[0]);\n            break;\n\n          case _util.OPS.setHScale:\n            this.setHScale(args[0]);\n            break;\n\n          case _util.OPS.setTextMatrix:\n            this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);\n            break;\n\n          case _util.OPS.setTextRise:\n            this.setTextRise(args[0]);\n            break;\n\n          case _util.OPS.setTextRenderingMode:\n            this.setTextRenderingMode(args[0]);\n            break;\n\n          case _util.OPS.setLineWidth:\n            this.setLineWidth(args[0]);\n            break;\n\n          case _util.OPS.setLineJoin:\n            this.setLineJoin(args[0]);\n            break;\n\n          case _util.OPS.setLineCap:\n            this.setLineCap(args[0]);\n            break;\n\n          case _util.OPS.setMiterLimit:\n            this.setMiterLimit(args[0]);\n            break;\n\n          case _util.OPS.setFillRGBColor:\n            this.setFillRGBColor(args[0], args[1], args[2]);\n            break;\n\n          case _util.OPS.setStrokeRGBColor:\n            this.setStrokeRGBColor(args[0], args[1], args[2]);\n            break;\n\n          case _util.OPS.setStrokeColorN:\n            this.setStrokeColorN(args);\n            break;\n\n          case _util.OPS.setFillColorN:\n            this.setFillColorN(args);\n            break;\n\n          case _util.OPS.shadingFill:\n            this.shadingFill(args[0]);\n            break;\n\n          case _util.OPS.setDash:\n            this.setDash(args[0], args[1]);\n            break;\n\n          case _util.OPS.setRenderingIntent:\n            this.setRenderingIntent(args[0]);\n            break;\n\n          case _util.OPS.setFlatness:\n            this.setFlatness(args[0]);\n            break;\n\n          case _util.OPS.setGState:\n            this.setGState(args[0]);\n            break;\n\n          case _util.OPS.fill:\n            this.fill();\n            break;\n\n          case _util.OPS.eoFill:\n            this.eoFill();\n            break;\n\n          case _util.OPS.stroke:\n            this.stroke();\n            break;\n\n          case _util.OPS.fillStroke:\n            this.fillStroke();\n            break;\n\n          case _util.OPS.eoFillStroke:\n            this.eoFillStroke();\n            break;\n\n          case _util.OPS.clip:\n            this.clip(\"nonzero\");\n            break;\n\n          case _util.OPS.eoClip:\n            this.clip(\"evenodd\");\n            break;\n\n          case _util.OPS.paintSolidColorImageMask:\n            this.paintSolidColorImageMask();\n            break;\n\n          case _util.OPS.paintImageXObject:\n            this.paintImageXObject(args[0]);\n            break;\n\n          case _util.OPS.paintInlineImageXObject:\n            this.paintInlineImageXObject(args[0]);\n            break;\n\n          case _util.OPS.paintImageMaskXObject:\n            this.paintImageMaskXObject(args[0]);\n            break;\n\n          case _util.OPS.paintFormXObjectBegin:\n            this.paintFormXObjectBegin(args[0], args[1]);\n            break;\n\n          case _util.OPS.paintFormXObjectEnd:\n            this.paintFormXObjectEnd();\n            break;\n\n          case _util.OPS.closePath:\n            this.closePath();\n            break;\n\n          case _util.OPS.closeStroke:\n            this.closeStroke();\n            break;\n\n          case _util.OPS.closeFillStroke:\n            this.closeFillStroke();\n            break;\n\n          case _util.OPS.closeEOFillStroke:\n            this.closeEOFillStroke();\n            break;\n\n          case _util.OPS.nextLine:\n            this.nextLine();\n            break;\n\n          case _util.OPS.transform:\n            this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);\n            break;\n\n          case _util.OPS.constructPath:\n            this.constructPath(args[0], args[1]);\n            break;\n\n          case _util.OPS.endPath:\n            this.endPath();\n            break;\n\n          case 92:\n            this.group(opTreeElement.items);\n            break;\n\n          default:\n            (0, _util.warn)(`Unimplemented operator ${fn}`);\n            break;\n        }\n      }\n    }\n\n    setWordSpacing(wordSpacing) {\n      this.current.wordSpacing = wordSpacing;\n    }\n\n    setCharSpacing(charSpacing) {\n      this.current.charSpacing = charSpacing;\n    }\n\n    nextLine() {\n      this.moveText(0, this.current.leading);\n    }\n\n    setTextMatrix(a, b, c, d, e, f) {\n      const current = this.current;\n      current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];\n      current.textMatrixScale = Math.hypot(a, b);\n      current.x = current.lineX = 0;\n      current.y = current.lineY = 0;\n      current.xcoords = [];\n      current.ycoords = [];\n      current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n      current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n      current.tspan.setAttributeNS(null, \"font-size\", `${pf(current.fontSize)}px`);\n      current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n      current.txtElement = this.svgFactory.createElement(\"svg:text\");\n      current.txtElement.appendChild(current.tspan);\n    }\n\n    beginText() {\n      const current = this.current;\n      current.x = current.lineX = 0;\n      current.y = current.lineY = 0;\n      current.textMatrix = _util.IDENTITY_MATRIX;\n      current.lineMatrix = _util.IDENTITY_MATRIX;\n      current.textMatrixScale = 1;\n      current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n      current.txtElement = this.svgFactory.createElement(\"svg:text\");\n      current.txtgrp = this.svgFactory.createElement(\"svg:g\");\n      current.xcoords = [];\n      current.ycoords = [];\n    }\n\n    moveText(x, y) {\n      const current = this.current;\n      current.x = current.lineX += x;\n      current.y = current.lineY += y;\n      current.xcoords = [];\n      current.ycoords = [];\n      current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n      current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n      current.tspan.setAttributeNS(null, \"font-size\", `${pf(current.fontSize)}px`);\n      current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n    }\n\n    showText(glyphs) {\n      const current = this.current;\n      const font = current.font;\n      const fontSize = current.fontSize;\n\n      if (fontSize === 0) {\n        return;\n      }\n\n      const fontSizeScale = current.fontSizeScale;\n      const charSpacing = current.charSpacing;\n      const wordSpacing = current.wordSpacing;\n      const fontDirection = current.fontDirection;\n      const textHScale = current.textHScale * fontDirection;\n      const vertical = font.vertical;\n      const spacingDir = vertical ? 1 : -1;\n      const defaultVMetrics = font.defaultVMetrics;\n      const widthAdvanceScale = fontSize * current.fontMatrix[0];\n      let x = 0;\n\n      for (const glyph of glyphs) {\n        if (glyph === null) {\n          x += fontDirection * wordSpacing;\n          continue;\n        } else if (typeof glyph === \"number\") {\n          x += spacingDir * glyph * fontSize / 1000;\n          continue;\n        }\n\n        const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n        const character = glyph.fontChar;\n        let scaledX, scaledY;\n        let width = glyph.width;\n\n        if (vertical) {\n          let vx;\n          const vmetric = glyph.vmetric || defaultVMetrics;\n          vx = glyph.vmetric ? vmetric[1] : width * 0.5;\n          vx = -vx * widthAdvanceScale;\n          const vy = vmetric[2] * widthAdvanceScale;\n          width = vmetric ? -vmetric[0] : width;\n          scaledX = vx / fontSizeScale;\n          scaledY = (x + vy) / fontSizeScale;\n        } else {\n          scaledX = x / fontSizeScale;\n          scaledY = 0;\n        }\n\n        if (glyph.isInFont || font.missingFile) {\n          current.xcoords.push(current.x + scaledX);\n\n          if (vertical) {\n            current.ycoords.push(-current.y + scaledY);\n          }\n\n          current.tspan.textContent += character;\n        } else {}\n\n        let charWidth;\n\n        if (vertical) {\n          charWidth = width * widthAdvanceScale - spacing * fontDirection;\n        } else {\n          charWidth = width * widthAdvanceScale + spacing * fontDirection;\n        }\n\n        x += charWidth;\n      }\n\n      current.tspan.setAttributeNS(null, \"x\", current.xcoords.map(pf).join(\" \"));\n\n      if (vertical) {\n        current.tspan.setAttributeNS(null, \"y\", current.ycoords.map(pf).join(\" \"));\n      } else {\n        current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n      }\n\n      if (vertical) {\n        current.y -= x;\n      } else {\n        current.x += x * textHScale;\n      }\n\n      current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n      current.tspan.setAttributeNS(null, \"font-size\", `${pf(current.fontSize)}px`);\n\n      if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {\n        current.tspan.setAttributeNS(null, \"font-style\", current.fontStyle);\n      }\n\n      if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {\n        current.tspan.setAttributeNS(null, \"font-weight\", current.fontWeight);\n      }\n\n      const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;\n\n      if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        if (current.fillColor !== SVG_DEFAULTS.fillColor) {\n          current.tspan.setAttributeNS(null, \"fill\", current.fillColor);\n        }\n\n        if (current.fillAlpha < 1) {\n          current.tspan.setAttributeNS(null, \"fill-opacity\", current.fillAlpha);\n        }\n      } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {\n        current.tspan.setAttributeNS(null, \"fill\", \"transparent\");\n      } else {\n        current.tspan.setAttributeNS(null, \"fill\", \"none\");\n      }\n\n      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {\n        const lineWidthScale = 1 / (current.textMatrixScale || 1);\n\n        this._setStrokeAttributes(current.tspan, lineWidthScale);\n      }\n\n      let textMatrix = current.textMatrix;\n\n      if (current.textRise !== 0) {\n        textMatrix = textMatrix.slice();\n        textMatrix[5] += current.textRise;\n      }\n\n      current.txtElement.setAttributeNS(null, \"transform\", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`);\n      current.txtElement.setAttributeNS(XML_NS, \"xml:space\", \"preserve\");\n      current.txtElement.appendChild(current.tspan);\n      current.txtgrp.appendChild(current.txtElement);\n\n      this._ensureTransformGroup().appendChild(current.txtElement);\n    }\n\n    setLeadingMoveText(x, y) {\n      this.setLeading(-y);\n      this.moveText(x, y);\n    }\n\n    addFontStyle(fontObj) {\n      if (!fontObj.data) {\n        throw new Error(\"addFontStyle: No font data available, \" + 'ensure that the \"fontExtraProperties\" API parameter is set.');\n      }\n\n      if (!this.cssStyle) {\n        this.cssStyle = this.svgFactory.createElement(\"svg:style\");\n        this.cssStyle.setAttributeNS(null, \"type\", \"text/css\");\n        this.defs.appendChild(this.cssStyle);\n      }\n\n      const url = createObjectURL(fontObj.data, fontObj.mimetype, this.forceDataSchema);\n      this.cssStyle.textContent += `@font-face { font-family: \"${fontObj.loadedName}\";` + ` src: url(${url}); }\\n`;\n    }\n\n    setFont(details) {\n      const current = this.current;\n      const fontObj = this.commonObjs.get(details[0]);\n      let size = details[1];\n      current.font = fontObj;\n\n      if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {\n        this.addFontStyle(fontObj);\n        this.embeddedFonts[fontObj.loadedName] = fontObj;\n      }\n\n      current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;\n      let bold = \"normal\";\n\n      if (fontObj.black) {\n        bold = \"900\";\n      } else if (fontObj.bold) {\n        bold = \"bold\";\n      }\n\n      const italic = fontObj.italic ? \"italic\" : \"normal\";\n\n      if (size < 0) {\n        size = -size;\n        current.fontDirection = -1;\n      } else {\n        current.fontDirection = 1;\n      }\n\n      current.fontSize = size;\n      current.fontFamily = fontObj.loadedName;\n      current.fontWeight = bold;\n      current.fontStyle = italic;\n      current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n      current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n      current.xcoords = [];\n      current.ycoords = [];\n    }\n\n    endText() {\n      const current = this.current;\n\n      if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement?.hasChildNodes()) {\n        current.element = current.txtElement;\n        this.clip(\"nonzero\");\n        this.endPath();\n      }\n    }\n\n    setLineWidth(width) {\n      if (width > 0) {\n        this.current.lineWidth = width;\n      }\n    }\n\n    setLineCap(style) {\n      this.current.lineCap = LINE_CAP_STYLES[style];\n    }\n\n    setLineJoin(style) {\n      this.current.lineJoin = LINE_JOIN_STYLES[style];\n    }\n\n    setMiterLimit(limit) {\n      this.current.miterLimit = limit;\n    }\n\n    setStrokeAlpha(strokeAlpha) {\n      this.current.strokeAlpha = strokeAlpha;\n    }\n\n    setStrokeRGBColor(r, g, b) {\n      this.current.strokeColor = _util.Util.makeHexColor(r, g, b);\n    }\n\n    setFillAlpha(fillAlpha) {\n      this.current.fillAlpha = fillAlpha;\n    }\n\n    setFillRGBColor(r, g, b) {\n      this.current.fillColor = _util.Util.makeHexColor(r, g, b);\n      this.current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n      this.current.xcoords = [];\n      this.current.ycoords = [];\n    }\n\n    setStrokeColorN(args) {\n      this.current.strokeColor = this._makeColorN_Pattern(args);\n    }\n\n    setFillColorN(args) {\n      this.current.fillColor = this._makeColorN_Pattern(args);\n    }\n\n    shadingFill(args) {\n      const width = this.viewport.width;\n      const height = this.viewport.height;\n\n      const inv = _util.Util.inverseTransform(this.transformMatrix);\n\n      const bl = _util.Util.applyTransform([0, 0], inv);\n\n      const br = _util.Util.applyTransform([0, height], inv);\n\n      const ul = _util.Util.applyTransform([width, 0], inv);\n\n      const ur = _util.Util.applyTransform([width, height], inv);\n\n      const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);\n      const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);\n      const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);\n      const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);\n      const rect = this.svgFactory.createElement(\"svg:rect\");\n      rect.setAttributeNS(null, \"x\", x0);\n      rect.setAttributeNS(null, \"y\", y0);\n      rect.setAttributeNS(null, \"width\", x1 - x0);\n      rect.setAttributeNS(null, \"height\", y1 - y0);\n      rect.setAttributeNS(null, \"fill\", this._makeShadingPattern(args));\n\n      if (this.current.fillAlpha < 1) {\n        rect.setAttributeNS(null, \"fill-opacity\", this.current.fillAlpha);\n      }\n\n      this._ensureTransformGroup().appendChild(rect);\n    }\n\n    _makeColorN_Pattern(args) {\n      if (args[0] === \"TilingPattern\") {\n        return this._makeTilingPattern(args);\n      }\n\n      return this._makeShadingPattern(args);\n    }\n\n    _makeTilingPattern(args) {\n      const color = args[1];\n      const operatorList = args[2];\n      const matrix = args[3] || _util.IDENTITY_MATRIX;\n      const [x0, y0, x1, y1] = args[4];\n      const xstep = args[5];\n      const ystep = args[6];\n      const paintType = args[7];\n      const tilingId = `shading${shadingCount++}`;\n\n      const [tx0, ty0, tx1, ty1] = _util.Util.normalizeRect([..._util.Util.applyTransform([x0, y0], matrix), ..._util.Util.applyTransform([x1, y1], matrix)]);\n\n      const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix);\n\n      const txstep = xstep * xscale;\n      const tystep = ystep * yscale;\n      const tiling = this.svgFactory.createElement(\"svg:pattern\");\n      tiling.setAttributeNS(null, \"id\", tilingId);\n      tiling.setAttributeNS(null, \"patternUnits\", \"userSpaceOnUse\");\n      tiling.setAttributeNS(null, \"width\", txstep);\n      tiling.setAttributeNS(null, \"height\", tystep);\n      tiling.setAttributeNS(null, \"x\", `${tx0}`);\n      tiling.setAttributeNS(null, \"y\", `${ty0}`);\n      const svg = this.svg;\n      const transformMatrix = this.transformMatrix;\n      const fillColor = this.current.fillColor;\n      const strokeColor = this.current.strokeColor;\n      const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);\n      this.svg = bbox;\n      this.transformMatrix = matrix;\n\n      if (paintType === 2) {\n        const cssColor = _util.Util.makeHexColor(...color);\n\n        this.current.fillColor = cssColor;\n        this.current.strokeColor = cssColor;\n      }\n\n      this.executeOpTree(this.convertOpList(operatorList));\n      this.svg = svg;\n      this.transformMatrix = transformMatrix;\n      this.current.fillColor = fillColor;\n      this.current.strokeColor = strokeColor;\n      tiling.appendChild(bbox.childNodes[0]);\n      this.defs.appendChild(tiling);\n      return `url(#${tilingId})`;\n    }\n\n    _makeShadingPattern(args) {\n      if (typeof args === \"string\") {\n        args = this.objs.get(args);\n      }\n\n      switch (args[0]) {\n        case \"RadialAxial\":\n          const shadingId = `shading${shadingCount++}`;\n          const colorStops = args[3];\n          let gradient;\n\n          switch (args[1]) {\n            case \"axial\":\n              const point0 = args[4];\n              const point1 = args[5];\n              gradient = this.svgFactory.createElement(\"svg:linearGradient\");\n              gradient.setAttributeNS(null, \"id\", shadingId);\n              gradient.setAttributeNS(null, \"gradientUnits\", \"userSpaceOnUse\");\n              gradient.setAttributeNS(null, \"x1\", point0[0]);\n              gradient.setAttributeNS(null, \"y1\", point0[1]);\n              gradient.setAttributeNS(null, \"x2\", point1[0]);\n              gradient.setAttributeNS(null, \"y2\", point1[1]);\n              break;\n\n            case \"radial\":\n              const focalPoint = args[4];\n              const circlePoint = args[5];\n              const focalRadius = args[6];\n              const circleRadius = args[7];\n              gradient = this.svgFactory.createElement(\"svg:radialGradient\");\n              gradient.setAttributeNS(null, \"id\", shadingId);\n              gradient.setAttributeNS(null, \"gradientUnits\", \"userSpaceOnUse\");\n              gradient.setAttributeNS(null, \"cx\", circlePoint[0]);\n              gradient.setAttributeNS(null, \"cy\", circlePoint[1]);\n              gradient.setAttributeNS(null, \"r\", circleRadius);\n              gradient.setAttributeNS(null, \"fx\", focalPoint[0]);\n              gradient.setAttributeNS(null, \"fy\", focalPoint[1]);\n              gradient.setAttributeNS(null, \"fr\", focalRadius);\n              break;\n\n            default:\n              throw new Error(`Unknown RadialAxial type: ${args[1]}`);\n          }\n\n          for (const colorStop of colorStops) {\n            const stop = this.svgFactory.createElement(\"svg:stop\");\n            stop.setAttributeNS(null, \"offset\", colorStop[0]);\n            stop.setAttributeNS(null, \"stop-color\", colorStop[1]);\n            gradient.appendChild(stop);\n          }\n\n          this.defs.appendChild(gradient);\n          return `url(#${shadingId})`;\n\n        case \"Mesh\":\n          (0, _util.warn)(\"Unimplemented pattern Mesh\");\n          return null;\n\n        case \"Dummy\":\n          return \"hotpink\";\n\n        default:\n          throw new Error(`Unknown IR type: ${args[0]}`);\n      }\n    }\n\n    setDash(dashArray, dashPhase) {\n      this.current.dashArray = dashArray;\n      this.current.dashPhase = dashPhase;\n    }\n\n    constructPath(ops, args) {\n      const current = this.current;\n      let x = current.x,\n          y = current.y;\n      let d = [];\n      let j = 0;\n\n      for (const op of ops) {\n        switch (op | 0) {\n          case _util.OPS.rectangle:\n            x = args[j++];\n            y = args[j++];\n            const width = args[j++];\n            const height = args[j++];\n            const xw = x + width;\n            const yh = y + height;\n            d.push(\"M\", pf(x), pf(y), \"L\", pf(xw), pf(y), \"L\", pf(xw), pf(yh), \"L\", pf(x), pf(yh), \"Z\");\n            break;\n\n          case _util.OPS.moveTo:\n            x = args[j++];\n            y = args[j++];\n            d.push(\"M\", pf(x), pf(y));\n            break;\n\n          case _util.OPS.lineTo:\n            x = args[j++];\n            y = args[j++];\n            d.push(\"L\", pf(x), pf(y));\n            break;\n\n          case _util.OPS.curveTo:\n            x = args[j + 4];\n            y = args[j + 5];\n            d.push(\"C\", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));\n            j += 6;\n            break;\n\n          case _util.OPS.curveTo2:\n            d.push(\"C\", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));\n            x = args[j + 2];\n            y = args[j + 3];\n            j += 4;\n            break;\n\n          case _util.OPS.curveTo3:\n            x = args[j + 2];\n            y = args[j + 3];\n            d.push(\"C\", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));\n            j += 4;\n            break;\n\n          case _util.OPS.closePath:\n            d.push(\"Z\");\n            break;\n        }\n      }\n\n      d = d.join(\" \");\n\n      if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {\n        d = current.path.getAttributeNS(null, \"d\") + d;\n      } else {\n        current.path = this.svgFactory.createElement(\"svg:path\");\n\n        this._ensureTransformGroup().appendChild(current.path);\n      }\n\n      current.path.setAttributeNS(null, \"d\", d);\n      current.path.setAttributeNS(null, \"fill\", \"none\");\n      current.element = current.path;\n      current.setCurrentPoint(x, y);\n    }\n\n    endPath() {\n      const current = this.current;\n      current.path = null;\n\n      if (!this.pendingClip) {\n        return;\n      }\n\n      if (!current.element) {\n        this.pendingClip = null;\n        return;\n      }\n\n      const clipId = `clippath${clipCount++}`;\n      const clipPath = this.svgFactory.createElement(\"svg:clipPath\");\n      clipPath.setAttributeNS(null, \"id\", clipId);\n      clipPath.setAttributeNS(null, \"transform\", pm(this.transformMatrix));\n      const clipElement = current.element.cloneNode(true);\n\n      if (this.pendingClip === \"evenodd\") {\n        clipElement.setAttributeNS(null, \"clip-rule\", \"evenodd\");\n      } else {\n        clipElement.setAttributeNS(null, \"clip-rule\", \"nonzero\");\n      }\n\n      this.pendingClip = null;\n      clipPath.appendChild(clipElement);\n      this.defs.appendChild(clipPath);\n\n      if (current.activeClipUrl) {\n        current.clipGroup = null;\n\n        for (const prev of this.extraStack) {\n          prev.clipGroup = null;\n        }\n\n        clipPath.setAttributeNS(null, \"clip-path\", current.activeClipUrl);\n      }\n\n      current.activeClipUrl = `url(#${clipId})`;\n      this.tgrp = null;\n    }\n\n    clip(type) {\n      this.pendingClip = type;\n    }\n\n    closePath() {\n      const current = this.current;\n\n      if (current.path) {\n        const d = `${current.path.getAttributeNS(null, \"d\")}Z`;\n        current.path.setAttributeNS(null, \"d\", d);\n      }\n    }\n\n    setLeading(leading) {\n      this.current.leading = -leading;\n    }\n\n    setTextRise(textRise) {\n      this.current.textRise = textRise;\n    }\n\n    setTextRenderingMode(textRenderingMode) {\n      this.current.textRenderingMode = textRenderingMode;\n    }\n\n    setHScale(scale) {\n      this.current.textHScale = scale / 100;\n    }\n\n    setRenderingIntent(intent) {}\n\n    setFlatness(flatness) {}\n\n    setGState(states) {\n      for (const [key, value] of states) {\n        switch (key) {\n          case \"LW\":\n            this.setLineWidth(value);\n            break;\n\n          case \"LC\":\n            this.setLineCap(value);\n            break;\n\n          case \"LJ\":\n            this.setLineJoin(value);\n            break;\n\n          case \"ML\":\n            this.setMiterLimit(value);\n            break;\n\n          case \"D\":\n            this.setDash(value[0], value[1]);\n            break;\n\n          case \"RI\":\n            this.setRenderingIntent(value);\n            break;\n\n          case \"FL\":\n            this.setFlatness(value);\n            break;\n\n          case \"Font\":\n            this.setFont(value);\n            break;\n\n          case \"CA\":\n            this.setStrokeAlpha(value);\n            break;\n\n          case \"ca\":\n            this.setFillAlpha(value);\n            break;\n\n          default:\n            (0, _util.warn)(`Unimplemented graphic state operator ${key}`);\n            break;\n        }\n      }\n    }\n\n    fill() {\n      const current = this.current;\n\n      if (current.element) {\n        current.element.setAttributeNS(null, \"fill\", current.fillColor);\n        current.element.setAttributeNS(null, \"fill-opacity\", current.fillAlpha);\n        this.endPath();\n      }\n    }\n\n    stroke() {\n      const current = this.current;\n\n      if (current.element) {\n        this._setStrokeAttributes(current.element);\n\n        current.element.setAttributeNS(null, \"fill\", \"none\");\n        this.endPath();\n      }\n    }\n\n    _setStrokeAttributes(element, lineWidthScale = 1) {\n      const current = this.current;\n      let dashArray = current.dashArray;\n\n      if (lineWidthScale !== 1 && dashArray.length > 0) {\n        dashArray = dashArray.map(function (value) {\n          return lineWidthScale * value;\n        });\n      }\n\n      element.setAttributeNS(null, \"stroke\", current.strokeColor);\n      element.setAttributeNS(null, \"stroke-opacity\", current.strokeAlpha);\n      element.setAttributeNS(null, \"stroke-miterlimit\", pf(current.miterLimit));\n      element.setAttributeNS(null, \"stroke-linecap\", current.lineCap);\n      element.setAttributeNS(null, \"stroke-linejoin\", current.lineJoin);\n      element.setAttributeNS(null, \"stroke-width\", pf(lineWidthScale * current.lineWidth) + \"px\");\n      element.setAttributeNS(null, \"stroke-dasharray\", dashArray.map(pf).join(\" \"));\n      element.setAttributeNS(null, \"stroke-dashoffset\", pf(lineWidthScale * current.dashPhase) + \"px\");\n    }\n\n    eoFill() {\n      if (this.current.element) {\n        this.current.element.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n      }\n\n      this.fill();\n    }\n\n    fillStroke() {\n      this.stroke();\n      this.fill();\n    }\n\n    eoFillStroke() {\n      if (this.current.element) {\n        this.current.element.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n      }\n\n      this.fillStroke();\n    }\n\n    closeStroke() {\n      this.closePath();\n      this.stroke();\n    }\n\n    closeFillStroke() {\n      this.closePath();\n      this.fillStroke();\n    }\n\n    closeEOFillStroke() {\n      this.closePath();\n      this.eoFillStroke();\n    }\n\n    paintSolidColorImageMask() {\n      const rect = this.svgFactory.createElement(\"svg:rect\");\n      rect.setAttributeNS(null, \"x\", \"0\");\n      rect.setAttributeNS(null, \"y\", \"0\");\n      rect.setAttributeNS(null, \"width\", \"1px\");\n      rect.setAttributeNS(null, \"height\", \"1px\");\n      rect.setAttributeNS(null, \"fill\", this.current.fillColor);\n\n      this._ensureTransformGroup().appendChild(rect);\n    }\n\n    paintImageXObject(objId) {\n      const imgData = objId.startsWith(\"g_\") ? this.commonObjs.get(objId) : this.objs.get(objId);\n\n      if (!imgData) {\n        (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`);\n        return;\n      }\n\n      this.paintInlineImageXObject(imgData);\n    }\n\n    paintInlineImageXObject(imgData, mask) {\n      const width = imgData.width;\n      const height = imgData.height;\n      const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);\n      const cliprect = this.svgFactory.createElement(\"svg:rect\");\n      cliprect.setAttributeNS(null, \"x\", \"0\");\n      cliprect.setAttributeNS(null, \"y\", \"0\");\n      cliprect.setAttributeNS(null, \"width\", pf(width));\n      cliprect.setAttributeNS(null, \"height\", pf(height));\n      this.current.element = cliprect;\n      this.clip(\"nonzero\");\n      const imgEl = this.svgFactory.createElement(\"svg:image\");\n      imgEl.setAttributeNS(XLINK_NS, \"xlink:href\", imgSrc);\n      imgEl.setAttributeNS(null, \"x\", \"0\");\n      imgEl.setAttributeNS(null, \"y\", pf(-height));\n      imgEl.setAttributeNS(null, \"width\", pf(width) + \"px\");\n      imgEl.setAttributeNS(null, \"height\", pf(height) + \"px\");\n      imgEl.setAttributeNS(null, \"transform\", `scale(${pf(1 / width)} ${pf(-1 / height)})`);\n\n      if (mask) {\n        mask.appendChild(imgEl);\n      } else {\n        this._ensureTransformGroup().appendChild(imgEl);\n      }\n    }\n\n    paintImageMaskXObject(imgData) {\n      const current = this.current;\n      const width = imgData.width;\n      const height = imgData.height;\n      const fillColor = current.fillColor;\n      current.maskId = `mask${maskCount++}`;\n      const mask = this.svgFactory.createElement(\"svg:mask\");\n      mask.setAttributeNS(null, \"id\", current.maskId);\n      const rect = this.svgFactory.createElement(\"svg:rect\");\n      rect.setAttributeNS(null, \"x\", \"0\");\n      rect.setAttributeNS(null, \"y\", \"0\");\n      rect.setAttributeNS(null, \"width\", pf(width));\n      rect.setAttributeNS(null, \"height\", pf(height));\n      rect.setAttributeNS(null, \"fill\", fillColor);\n      rect.setAttributeNS(null, \"mask\", `url(#${current.maskId})`);\n      this.defs.appendChild(mask);\n\n      this._ensureTransformGroup().appendChild(rect);\n\n      this.paintInlineImageXObject(imgData, mask);\n    }\n\n    paintFormXObjectBegin(matrix, bbox) {\n      if (Array.isArray(matrix) && matrix.length === 6) {\n        this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);\n      }\n\n      if (bbox) {\n        const width = bbox[2] - bbox[0];\n        const height = bbox[3] - bbox[1];\n        const cliprect = this.svgFactory.createElement(\"svg:rect\");\n        cliprect.setAttributeNS(null, \"x\", bbox[0]);\n        cliprect.setAttributeNS(null, \"y\", bbox[1]);\n        cliprect.setAttributeNS(null, \"width\", pf(width));\n        cliprect.setAttributeNS(null, \"height\", pf(height));\n        this.current.element = cliprect;\n        this.clip(\"nonzero\");\n        this.endPath();\n      }\n    }\n\n    paintFormXObjectEnd() {}\n\n    _initialize(viewport) {\n      const svg = this.svgFactory.create(viewport.width, viewport.height);\n      const definitions = this.svgFactory.createElement(\"svg:defs\");\n      svg.appendChild(definitions);\n      this.defs = definitions;\n      const rootGroup = this.svgFactory.createElement(\"svg:g\");\n      rootGroup.setAttributeNS(null, \"transform\", pm(viewport.transform));\n      svg.appendChild(rootGroup);\n      this.svg = rootGroup;\n      return svg;\n    }\n\n    _ensureClipGroup() {\n      if (!this.current.clipGroup) {\n        const clipGroup = this.svgFactory.createElement(\"svg:g\");\n        clipGroup.setAttributeNS(null, \"clip-path\", this.current.activeClipUrl);\n        this.svg.appendChild(clipGroup);\n        this.current.clipGroup = clipGroup;\n      }\n\n      return this.current.clipGroup;\n    }\n\n    _ensureTransformGroup() {\n      if (!this.tgrp) {\n        this.tgrp = this.svgFactory.createElement(\"svg:g\");\n        this.tgrp.setAttributeNS(null, \"transform\", pm(this.transformMatrix));\n\n        if (this.current.activeClipUrl) {\n          this._ensureClipGroup().appendChild(this.tgrp);\n        } else {\n          this.svg.appendChild(this.tgrp);\n        }\n      }\n\n      return this.tgrp;\n    }\n\n  };\n}\n\n/***/ }),\n/* 23 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.PDFNodeStream = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _network_utils = __w_pdfjs_require__(24);\n\n;\n\nconst fs = __webpack_require__(/*! fs */ \"?fe90\");\n\nconst http = __webpack_require__(/*! http */ \"?d446\");\n\nconst https = __webpack_require__(/*! https */ \"?4c38\");\n\nconst url = __webpack_require__(/*! url */ \"?9f5f\");\n\nconst fileUriRegex = /^file:\\/\\/\\/[a-zA-Z]:\\//;\n\nfunction parseUrl(sourceUrl) {\n  const parsedUrl = url.parse(sourceUrl);\n\n  if (parsedUrl.protocol === \"file:\" || parsedUrl.host) {\n    return parsedUrl;\n  }\n\n  if (/^[a-z]:[/\\\\]/i.test(sourceUrl)) {\n    return url.parse(`file:///${sourceUrl}`);\n  }\n\n  if (!parsedUrl.host) {\n    parsedUrl.protocol = \"file:\";\n  }\n\n  return parsedUrl;\n}\n\nclass PDFNodeStream {\n  constructor(source) {\n    this.source = source;\n    this.url = parseUrl(source.url);\n    this.isHttp = this.url.protocol === \"http:\" || this.url.protocol === \"https:\";\n    this.isFsUrl = this.url.protocol === \"file:\";\n    this.httpHeaders = this.isHttp && source.httpHeaders || {};\n    this._fullRequestReader = null;\n    this._rangeRequestReaders = [];\n  }\n\n  get _progressiveDataLength() {\n    return this._fullRequestReader?._loaded ?? 0;\n  }\n\n  getFullReader() {\n    (0, _util.assert)(!this._fullRequestReader, \"PDFNodeStream.getFullReader can only be called once.\");\n    this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);\n    return this._fullRequestReader;\n  }\n\n  getRangeReader(start, end) {\n    if (end <= this._progressiveDataLength) {\n      return null;\n    }\n\n    const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);\n\n    this._rangeRequestReaders.push(rangeReader);\n\n    return rangeReader;\n  }\n\n  cancelAllRequests(reason) {\n    if (this._fullRequestReader) {\n      this._fullRequestReader.cancel(reason);\n    }\n\n    for (const reader of this._rangeRequestReaders.slice(0)) {\n      reader.cancel(reason);\n    }\n  }\n\n}\n\nexports.PDFNodeStream = PDFNodeStream;\n\nclass BaseFullReader {\n  constructor(stream) {\n    this._url = stream.url;\n    this._done = false;\n    this._storedError = null;\n    this.onProgress = null;\n    const source = stream.source;\n    this._contentLength = source.length;\n    this._loaded = 0;\n    this._filename = null;\n    this._disableRange = source.disableRange || false;\n    this._rangeChunkSize = source.rangeChunkSize;\n\n    if (!this._rangeChunkSize && !this._disableRange) {\n      this._disableRange = true;\n    }\n\n    this._isStreamingSupported = !source.disableStream;\n    this._isRangeSupported = !source.disableRange;\n    this._readableStream = null;\n    this._readCapability = (0, _util.createPromiseCapability)();\n    this._headersCapability = (0, _util.createPromiseCapability)();\n  }\n\n  get headersReady() {\n    return this._headersCapability.promise;\n  }\n\n  get filename() {\n    return this._filename;\n  }\n\n  get contentLength() {\n    return this._contentLength;\n  }\n\n  get isRangeSupported() {\n    return this._isRangeSupported;\n  }\n\n  get isStreamingSupported() {\n    return this._isStreamingSupported;\n  }\n\n  async read() {\n    await this._readCapability.promise;\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    if (this._storedError) {\n      throw this._storedError;\n    }\n\n    const chunk = this._readableStream.read();\n\n    if (chunk === null) {\n      this._readCapability = (0, _util.createPromiseCapability)();\n      return this.read();\n    }\n\n    this._loaded += chunk.length;\n\n    if (this.onProgress) {\n      this.onProgress({\n        loaded: this._loaded,\n        total: this._contentLength\n      });\n    }\n\n    const buffer = new Uint8Array(chunk).buffer;\n    return {\n      value: buffer,\n      done: false\n    };\n  }\n\n  cancel(reason) {\n    if (!this._readableStream) {\n      this._error(reason);\n\n      return;\n    }\n\n    this._readableStream.destroy(reason);\n  }\n\n  _error(reason) {\n    this._storedError = reason;\n\n    this._readCapability.resolve();\n  }\n\n  _setReadableStream(readableStream) {\n    this._readableStream = readableStream;\n    readableStream.on(\"readable\", () => {\n      this._readCapability.resolve();\n    });\n    readableStream.on(\"end\", () => {\n      readableStream.destroy();\n      this._done = true;\n\n      this._readCapability.resolve();\n    });\n    readableStream.on(\"error\", reason => {\n      this._error(reason);\n    });\n\n    if (!this._isStreamingSupported && this._isRangeSupported) {\n      this._error(new _util.AbortException(\"streaming is disabled\"));\n    }\n\n    if (this._storedError) {\n      this._readableStream.destroy(this._storedError);\n    }\n  }\n\n}\n\nclass BaseRangeReader {\n  constructor(stream) {\n    this._url = stream.url;\n    this._done = false;\n    this._storedError = null;\n    this.onProgress = null;\n    this._loaded = 0;\n    this._readableStream = null;\n    this._readCapability = (0, _util.createPromiseCapability)();\n    const source = stream.source;\n    this._isStreamingSupported = !source.disableStream;\n  }\n\n  get isStreamingSupported() {\n    return this._isStreamingSupported;\n  }\n\n  async read() {\n    await this._readCapability.promise;\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    if (this._storedError) {\n      throw this._storedError;\n    }\n\n    const chunk = this._readableStream.read();\n\n    if (chunk === null) {\n      this._readCapability = (0, _util.createPromiseCapability)();\n      return this.read();\n    }\n\n    this._loaded += chunk.length;\n\n    if (this.onProgress) {\n      this.onProgress({\n        loaded: this._loaded\n      });\n    }\n\n    const buffer = new Uint8Array(chunk).buffer;\n    return {\n      value: buffer,\n      done: false\n    };\n  }\n\n  cancel(reason) {\n    if (!this._readableStream) {\n      this._error(reason);\n\n      return;\n    }\n\n    this._readableStream.destroy(reason);\n  }\n\n  _error(reason) {\n    this._storedError = reason;\n\n    this._readCapability.resolve();\n  }\n\n  _setReadableStream(readableStream) {\n    this._readableStream = readableStream;\n    readableStream.on(\"readable\", () => {\n      this._readCapability.resolve();\n    });\n    readableStream.on(\"end\", () => {\n      readableStream.destroy();\n      this._done = true;\n\n      this._readCapability.resolve();\n    });\n    readableStream.on(\"error\", reason => {\n      this._error(reason);\n    });\n\n    if (this._storedError) {\n      this._readableStream.destroy(this._storedError);\n    }\n  }\n\n}\n\nfunction createRequestOptions(parsedUrl, headers) {\n  return {\n    protocol: parsedUrl.protocol,\n    auth: parsedUrl.auth,\n    host: parsedUrl.hostname,\n    port: parsedUrl.port,\n    path: parsedUrl.path,\n    method: \"GET\",\n    headers\n  };\n}\n\nclass PDFNodeStreamFullReader extends BaseFullReader {\n  constructor(stream) {\n    super(stream);\n\n    const handleResponse = response => {\n      if (response.statusCode === 404) {\n        const error = new _util.MissingPDFException(`Missing PDF \"${this._url}\".`);\n        this._storedError = error;\n\n        this._headersCapability.reject(error);\n\n        return;\n      }\n\n      this._headersCapability.resolve();\n\n      this._setReadableStream(response);\n\n      const getResponseHeader = name => {\n        return this._readableStream.headers[name.toLowerCase()];\n      };\n\n      const {\n        allowRangeRequests,\n        suggestedLength\n      } = (0, _network_utils.validateRangeRequestCapabilities)({\n        getResponseHeader,\n        isHttp: stream.isHttp,\n        rangeChunkSize: this._rangeChunkSize,\n        disableRange: this._disableRange\n      });\n      this._isRangeSupported = allowRangeRequests;\n      this._contentLength = suggestedLength || this._contentLength;\n      this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);\n    };\n\n    this._request = null;\n\n    if (this._url.protocol === \"http:\") {\n      this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);\n    } else {\n      this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);\n    }\n\n    this._request.on(\"error\", reason => {\n      this._storedError = reason;\n\n      this._headersCapability.reject(reason);\n    });\n\n    this._request.end();\n  }\n\n}\n\nclass PDFNodeStreamRangeReader extends BaseRangeReader {\n  constructor(stream, start, end) {\n    super(stream);\n    this._httpHeaders = {};\n\n    for (const property in stream.httpHeaders) {\n      const value = stream.httpHeaders[property];\n\n      if (typeof value === \"undefined\") {\n        continue;\n      }\n\n      this._httpHeaders[property] = value;\n    }\n\n    this._httpHeaders.Range = `bytes=${start}-${end - 1}`;\n\n    const handleResponse = response => {\n      if (response.statusCode === 404) {\n        const error = new _util.MissingPDFException(`Missing PDF \"${this._url}\".`);\n        this._storedError = error;\n        return;\n      }\n\n      this._setReadableStream(response);\n    };\n\n    this._request = null;\n\n    if (this._url.protocol === \"http:\") {\n      this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);\n    } else {\n      this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);\n    }\n\n    this._request.on(\"error\", reason => {\n      this._storedError = reason;\n    });\n\n    this._request.end();\n  }\n\n}\n\nclass PDFNodeStreamFsFullReader extends BaseFullReader {\n  constructor(stream) {\n    super(stream);\n    let path = decodeURIComponent(this._url.path);\n\n    if (fileUriRegex.test(this._url.href)) {\n      path = path.replace(/^\\//, \"\");\n    }\n\n    fs.lstat(path, (error, stat) => {\n      if (error) {\n        if (error.code === \"ENOENT\") {\n          error = new _util.MissingPDFException(`Missing PDF \"${path}\".`);\n        }\n\n        this._storedError = error;\n\n        this._headersCapability.reject(error);\n\n        return;\n      }\n\n      this._contentLength = stat.size;\n\n      this._setReadableStream(fs.createReadStream(path));\n\n      this._headersCapability.resolve();\n    });\n  }\n\n}\n\nclass PDFNodeStreamFsRangeReader extends BaseRangeReader {\n  constructor(stream, start, end) {\n    super(stream);\n    let path = decodeURIComponent(this._url.path);\n\n    if (fileUriRegex.test(this._url.href)) {\n      path = path.replace(/^\\//, \"\");\n    }\n\n    this._setReadableStream(fs.createReadStream(path, {\n      start,\n      end: end - 1\n    }));\n  }\n\n}\n\n/***/ }),\n/* 24 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.createResponseStatusError = createResponseStatusError;\nexports.extractFilenameFromHeader = extractFilenameFromHeader;\nexports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;\nexports.validateResponseStatus = validateResponseStatus;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _content_disposition = __w_pdfjs_require__(25);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nfunction validateRangeRequestCapabilities({\n  getResponseHeader,\n  isHttp,\n  rangeChunkSize,\n  disableRange\n}) {\n  (0, _util.assert)(rangeChunkSize > 0, \"Range chunk size must be larger than zero\");\n  const returnValues = {\n    allowRangeRequests: false,\n    suggestedLength: undefined\n  };\n  const length = parseInt(getResponseHeader(\"Content-Length\"), 10);\n\n  if (!Number.isInteger(length)) {\n    return returnValues;\n  }\n\n  returnValues.suggestedLength = length;\n\n  if (length <= 2 * rangeChunkSize) {\n    return returnValues;\n  }\n\n  if (disableRange || !isHttp) {\n    return returnValues;\n  }\n\n  if (getResponseHeader(\"Accept-Ranges\") !== \"bytes\") {\n    return returnValues;\n  }\n\n  const contentEncoding = getResponseHeader(\"Content-Encoding\") || \"identity\";\n\n  if (contentEncoding !== \"identity\") {\n    return returnValues;\n  }\n\n  returnValues.allowRangeRequests = true;\n  return returnValues;\n}\n\nfunction extractFilenameFromHeader(getResponseHeader) {\n  const contentDisposition = getResponseHeader(\"Content-Disposition\");\n\n  if (contentDisposition) {\n    let filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);\n\n    if (filename.includes(\"%\")) {\n      try {\n        filename = decodeURIComponent(filename);\n      } catch (ex) {}\n    }\n\n    if ((0, _display_utils.isPdfFile)(filename)) {\n      return filename;\n    }\n  }\n\n  return null;\n}\n\nfunction createResponseStatusError(status, url) {\n  if (status === 404 || status === 0 && url.startsWith(\"file:\")) {\n    return new _util.MissingPDFException('Missing PDF \"' + url + '\".');\n  }\n\n  return new _util.UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF \"${url}\".`, status);\n}\n\nfunction validateResponseStatus(status) {\n  return status === 200 || status === 206;\n}\n\n/***/ }),\n/* 25 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;\n\nvar _util = __w_pdfjs_require__(1);\n\nfunction getFilenameFromContentDispositionHeader(contentDisposition) {\n  let needsEncodingFixup = true;\n  let tmp = toParamRegExp(\"filename\\\\*\", \"i\").exec(contentDisposition);\n\n  if (tmp) {\n    tmp = tmp[1];\n    let filename = rfc2616unquote(tmp);\n    filename = unescape(filename);\n    filename = rfc5987decode(filename);\n    filename = rfc2047decode(filename);\n    return fixupEncoding(filename);\n  }\n\n  tmp = rfc2231getparam(contentDisposition);\n\n  if (tmp) {\n    const filename = rfc2047decode(tmp);\n    return fixupEncoding(filename);\n  }\n\n  tmp = toParamRegExp(\"filename\", \"i\").exec(contentDisposition);\n\n  if (tmp) {\n    tmp = tmp[1];\n    let filename = rfc2616unquote(tmp);\n    filename = rfc2047decode(filename);\n    return fixupEncoding(filename);\n  }\n\n  function toParamRegExp(attributePattern, flags) {\n    return new RegExp(\"(?:^|;)\\\\s*\" + attributePattern + \"\\\\s*=\\\\s*\" + \"(\" + '[^\";\\\\s][^;\\\\s]*' + \"|\" + '\"(?:[^\"\\\\\\\\]|\\\\\\\\\"?)+\"?' + \")\", flags);\n  }\n\n  function textdecode(encoding, value) {\n    if (encoding) {\n      if (!/^[\\x00-\\xFF]+$/.test(value)) {\n        return value;\n      }\n\n      try {\n        const decoder = new TextDecoder(encoding, {\n          fatal: true\n        });\n        const buffer = (0, _util.stringToBytes)(value);\n        value = decoder.decode(buffer);\n        needsEncodingFixup = false;\n      } catch (e) {}\n    }\n\n    return value;\n  }\n\n  function fixupEncoding(value) {\n    if (needsEncodingFixup && /[\\x80-\\xff]/.test(value)) {\n      value = textdecode(\"utf-8\", value);\n\n      if (needsEncodingFixup) {\n        value = textdecode(\"iso-8859-1\", value);\n      }\n    }\n\n    return value;\n  }\n\n  function rfc2231getparam(contentDispositionStr) {\n    const matches = [];\n    let match;\n    const iter = toParamRegExp(\"filename\\\\*((?!0\\\\d)\\\\d+)(\\\\*?)\", \"ig\");\n\n    while ((match = iter.exec(contentDispositionStr)) !== null) {\n      let [, n, quot, part] = match;\n      n = parseInt(n, 10);\n\n      if (n in matches) {\n        if (n === 0) {\n          break;\n        }\n\n        continue;\n      }\n\n      matches[n] = [quot, part];\n    }\n\n    const parts = [];\n\n    for (let n = 0; n < matches.length; ++n) {\n      if (!(n in matches)) {\n        break;\n      }\n\n      let [quot, part] = matches[n];\n      part = rfc2616unquote(part);\n\n      if (quot) {\n        part = unescape(part);\n\n        if (n === 0) {\n          part = rfc5987decode(part);\n        }\n      }\n\n      parts.push(part);\n    }\n\n    return parts.join(\"\");\n  }\n\n  function rfc2616unquote(value) {\n    if (value.startsWith('\"')) {\n      const parts = value.slice(1).split('\\\\\"');\n\n      for (let i = 0; i < parts.length; ++i) {\n        const quotindex = parts[i].indexOf('\"');\n\n        if (quotindex !== -1) {\n          parts[i] = parts[i].slice(0, quotindex);\n          parts.length = i + 1;\n        }\n\n        parts[i] = parts[i].replace(/\\\\(.)/g, \"$1\");\n      }\n\n      value = parts.join('\"');\n    }\n\n    return value;\n  }\n\n  function rfc5987decode(extvalue) {\n    const encodingend = extvalue.indexOf(\"'\");\n\n    if (encodingend === -1) {\n      return extvalue;\n    }\n\n    const encoding = extvalue.slice(0, encodingend);\n    const langvalue = extvalue.slice(encodingend + 1);\n    const value = langvalue.replace(/^[^']*'/, \"\");\n    return textdecode(encoding, value);\n  }\n\n  function rfc2047decode(value) {\n    if (!value.startsWith(\"=?\") || /[\\x00-\\x19\\x80-\\xff]/.test(value)) {\n      return value;\n    }\n\n    return value.replace(/=\\?([\\w-]*)\\?([QqBb])\\?((?:[^?]|\\?(?!=))*)\\?=/g, function (matches, charset, encoding, text) {\n      if (encoding === \"q\" || encoding === \"Q\") {\n        text = text.replace(/_/g, \" \");\n        text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {\n          return String.fromCharCode(parseInt(hex, 16));\n        });\n        return textdecode(charset, text);\n      }\n\n      try {\n        text = atob(text);\n      } catch (e) {}\n\n      return textdecode(charset, text);\n    });\n  }\n\n  return \"\";\n}\n\n/***/ }),\n/* 26 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.PDFNetworkStream = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _network_utils = __w_pdfjs_require__(24);\n\n;\nconst OK_RESPONSE = 200;\nconst PARTIAL_CONTENT_RESPONSE = 206;\n\nfunction getArrayBuffer(xhr) {\n  const data = xhr.response;\n\n  if (typeof data !== \"string\") {\n    return data;\n  }\n\n  const array = (0, _util.stringToBytes)(data);\n  return array.buffer;\n}\n\nclass NetworkManager {\n  constructor(url, args = {}) {\n    this.url = url;\n    this.isHttp = /^https?:/i.test(url);\n    this.httpHeaders = this.isHttp && args.httpHeaders || Object.create(null);\n    this.withCredentials = args.withCredentials || false;\n\n    this.getXhr = args.getXhr || function NetworkManager_getXhr() {\n      return new XMLHttpRequest();\n    };\n\n    this.currXhrId = 0;\n    this.pendingRequests = Object.create(null);\n  }\n\n  requestRange(begin, end, listeners) {\n    const args = {\n      begin,\n      end\n    };\n\n    for (const prop in listeners) {\n      args[prop] = listeners[prop];\n    }\n\n    return this.request(args);\n  }\n\n  requestFull(listeners) {\n    return this.request(listeners);\n  }\n\n  request(args) {\n    const xhr = this.getXhr();\n    const xhrId = this.currXhrId++;\n    const pendingRequest = this.pendingRequests[xhrId] = {\n      xhr\n    };\n    xhr.open(\"GET\", this.url);\n    xhr.withCredentials = this.withCredentials;\n\n    for (const property in this.httpHeaders) {\n      const value = this.httpHeaders[property];\n\n      if (typeof value === \"undefined\") {\n        continue;\n      }\n\n      xhr.setRequestHeader(property, value);\n    }\n\n    if (this.isHttp && \"begin\" in args && \"end\" in args) {\n      xhr.setRequestHeader(\"Range\", `bytes=${args.begin}-${args.end - 1}`);\n      pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;\n    } else {\n      pendingRequest.expectedStatus = OK_RESPONSE;\n    }\n\n    xhr.responseType = \"arraybuffer\";\n\n    if (args.onError) {\n      xhr.onerror = function (evt) {\n        args.onError(xhr.status);\n      };\n    }\n\n    xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);\n    xhr.onprogress = this.onProgress.bind(this, xhrId);\n    pendingRequest.onHeadersReceived = args.onHeadersReceived;\n    pendingRequest.onDone = args.onDone;\n    pendingRequest.onError = args.onError;\n    pendingRequest.onProgress = args.onProgress;\n    xhr.send(null);\n    return xhrId;\n  }\n\n  onProgress(xhrId, evt) {\n    const pendingRequest = this.pendingRequests[xhrId];\n\n    if (!pendingRequest) {\n      return;\n    }\n\n    pendingRequest.onProgress?.(evt);\n  }\n\n  onStateChange(xhrId, evt) {\n    const pendingRequest = this.pendingRequests[xhrId];\n\n    if (!pendingRequest) {\n      return;\n    }\n\n    const xhr = pendingRequest.xhr;\n\n    if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {\n      pendingRequest.onHeadersReceived();\n      delete pendingRequest.onHeadersReceived;\n    }\n\n    if (xhr.readyState !== 4) {\n      return;\n    }\n\n    if (!(xhrId in this.pendingRequests)) {\n      return;\n    }\n\n    delete this.pendingRequests[xhrId];\n\n    if (xhr.status === 0 && this.isHttp) {\n      pendingRequest.onError?.(xhr.status);\n      return;\n    }\n\n    const xhrStatus = xhr.status || OK_RESPONSE;\n    const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;\n\n    if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {\n      pendingRequest.onError?.(xhr.status);\n      return;\n    }\n\n    const chunk = getArrayBuffer(xhr);\n\n    if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {\n      const rangeHeader = xhr.getResponseHeader(\"Content-Range\");\n      const matches = /bytes (\\d+)-(\\d+)\\/(\\d+)/.exec(rangeHeader);\n      pendingRequest.onDone({\n        begin: parseInt(matches[1], 10),\n        chunk\n      });\n    } else if (chunk) {\n      pendingRequest.onDone({\n        begin: 0,\n        chunk\n      });\n    } else {\n      pendingRequest.onError?.(xhr.status);\n    }\n  }\n\n  getRequestXhr(xhrId) {\n    return this.pendingRequests[xhrId].xhr;\n  }\n\n  isPendingRequest(xhrId) {\n    return xhrId in this.pendingRequests;\n  }\n\n  abortRequest(xhrId) {\n    const xhr = this.pendingRequests[xhrId].xhr;\n    delete this.pendingRequests[xhrId];\n    xhr.abort();\n  }\n\n}\n\nclass PDFNetworkStream {\n  constructor(source) {\n    this._source = source;\n    this._manager = new NetworkManager(source.url, {\n      httpHeaders: source.httpHeaders,\n      withCredentials: source.withCredentials\n    });\n    this._rangeChunkSize = source.rangeChunkSize;\n    this._fullRequestReader = null;\n    this._rangeRequestReaders = [];\n  }\n\n  _onRangeRequestReaderClosed(reader) {\n    const i = this._rangeRequestReaders.indexOf(reader);\n\n    if (i >= 0) {\n      this._rangeRequestReaders.splice(i, 1);\n    }\n  }\n\n  getFullReader() {\n    (0, _util.assert)(!this._fullRequestReader, \"PDFNetworkStream.getFullReader can only be called once.\");\n    this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);\n    return this._fullRequestReader;\n  }\n\n  getRangeReader(begin, end) {\n    const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);\n    reader.onClosed = this._onRangeRequestReaderClosed.bind(this);\n\n    this._rangeRequestReaders.push(reader);\n\n    return reader;\n  }\n\n  cancelAllRequests(reason) {\n    this._fullRequestReader?.cancel(reason);\n\n    for (const reader of this._rangeRequestReaders.slice(0)) {\n      reader.cancel(reason);\n    }\n  }\n\n}\n\nexports.PDFNetworkStream = PDFNetworkStream;\n\nclass PDFNetworkStreamFullRequestReader {\n  constructor(manager, source) {\n    this._manager = manager;\n    const args = {\n      onHeadersReceived: this._onHeadersReceived.bind(this),\n      onDone: this._onDone.bind(this),\n      onError: this._onError.bind(this),\n      onProgress: this._onProgress.bind(this)\n    };\n    this._url = source.url;\n    this._fullRequestId = manager.requestFull(args);\n    this._headersReceivedCapability = (0, _util.createPromiseCapability)();\n    this._disableRange = source.disableRange || false;\n    this._contentLength = source.length;\n    this._rangeChunkSize = source.rangeChunkSize;\n\n    if (!this._rangeChunkSize && !this._disableRange) {\n      this._disableRange = true;\n    }\n\n    this._isStreamingSupported = false;\n    this._isRangeSupported = false;\n    this._cachedChunks = [];\n    this._requests = [];\n    this._done = false;\n    this._storedError = undefined;\n    this._filename = null;\n    this.onProgress = null;\n  }\n\n  _onHeadersReceived() {\n    const fullRequestXhrId = this._fullRequestId;\n\n    const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);\n\n    const getResponseHeader = name => {\n      return fullRequestXhr.getResponseHeader(name);\n    };\n\n    const {\n      allowRangeRequests,\n      suggestedLength\n    } = (0, _network_utils.validateRangeRequestCapabilities)({\n      getResponseHeader,\n      isHttp: this._manager.isHttp,\n      rangeChunkSize: this._rangeChunkSize,\n      disableRange: this._disableRange\n    });\n\n    if (allowRangeRequests) {\n      this._isRangeSupported = true;\n    }\n\n    this._contentLength = suggestedLength || this._contentLength;\n    this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);\n\n    if (this._isRangeSupported) {\n      this._manager.abortRequest(fullRequestXhrId);\n    }\n\n    this._headersReceivedCapability.resolve();\n  }\n\n  _onDone(data) {\n    if (data) {\n      if (this._requests.length > 0) {\n        const requestCapability = this._requests.shift();\n\n        requestCapability.resolve({\n          value: data.chunk,\n          done: false\n        });\n      } else {\n        this._cachedChunks.push(data.chunk);\n      }\n    }\n\n    this._done = true;\n\n    if (this._cachedChunks.length > 0) {\n      return;\n    }\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n  }\n\n  _onError(status) {\n    this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);\n\n    this._headersReceivedCapability.reject(this._storedError);\n\n    for (const requestCapability of this._requests) {\n      requestCapability.reject(this._storedError);\n    }\n\n    this._requests.length = 0;\n    this._cachedChunks.length = 0;\n  }\n\n  _onProgress(evt) {\n    this.onProgress?.({\n      loaded: evt.loaded,\n      total: evt.lengthComputable ? evt.total : this._contentLength\n    });\n  }\n\n  get filename() {\n    return this._filename;\n  }\n\n  get isRangeSupported() {\n    return this._isRangeSupported;\n  }\n\n  get isStreamingSupported() {\n    return this._isStreamingSupported;\n  }\n\n  get contentLength() {\n    return this._contentLength;\n  }\n\n  get headersReady() {\n    return this._headersReceivedCapability.promise;\n  }\n\n  async read() {\n    if (this._storedError) {\n      throw this._storedError;\n    }\n\n    if (this._cachedChunks.length > 0) {\n      const chunk = this._cachedChunks.shift();\n\n      return {\n        value: chunk,\n        done: false\n      };\n    }\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    const requestCapability = (0, _util.createPromiseCapability)();\n\n    this._requests.push(requestCapability);\n\n    return requestCapability.promise;\n  }\n\n  cancel(reason) {\n    this._done = true;\n\n    this._headersReceivedCapability.reject(reason);\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n\n    if (this._manager.isPendingRequest(this._fullRequestId)) {\n      this._manager.abortRequest(this._fullRequestId);\n    }\n\n    this._fullRequestReader = null;\n  }\n\n}\n\nclass PDFNetworkStreamRangeRequestReader {\n  constructor(manager, begin, end) {\n    this._manager = manager;\n    const args = {\n      onDone: this._onDone.bind(this),\n      onError: this._onError.bind(this),\n      onProgress: this._onProgress.bind(this)\n    };\n    this._url = manager.url;\n    this._requestId = manager.requestRange(begin, end, args);\n    this._requests = [];\n    this._queuedChunk = null;\n    this._done = false;\n    this._storedError = undefined;\n    this.onProgress = null;\n    this.onClosed = null;\n  }\n\n  _close() {\n    this.onClosed?.(this);\n  }\n\n  _onDone(data) {\n    const chunk = data.chunk;\n\n    if (this._requests.length > 0) {\n      const requestCapability = this._requests.shift();\n\n      requestCapability.resolve({\n        value: chunk,\n        done: false\n      });\n    } else {\n      this._queuedChunk = chunk;\n    }\n\n    this._done = true;\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n\n    this._close();\n  }\n\n  _onError(status) {\n    this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);\n\n    for (const requestCapability of this._requests) {\n      requestCapability.reject(this._storedError);\n    }\n\n    this._requests.length = 0;\n    this._queuedChunk = null;\n  }\n\n  _onProgress(evt) {\n    if (!this.isStreamingSupported) {\n      this.onProgress?.({\n        loaded: evt.loaded\n      });\n    }\n  }\n\n  get isStreamingSupported() {\n    return false;\n  }\n\n  async read() {\n    if (this._storedError) {\n      throw this._storedError;\n    }\n\n    if (this._queuedChunk !== null) {\n      const chunk = this._queuedChunk;\n      this._queuedChunk = null;\n      return {\n        value: chunk,\n        done: false\n      };\n    }\n\n    if (this._done) {\n      return {\n        value: undefined,\n        done: true\n      };\n    }\n\n    const requestCapability = (0, _util.createPromiseCapability)();\n\n    this._requests.push(requestCapability);\n\n    return requestCapability.promise;\n  }\n\n  cancel(reason) {\n    this._done = true;\n\n    for (const requestCapability of this._requests) {\n      requestCapability.resolve({\n        value: undefined,\n        done: true\n      });\n    }\n\n    this._requests.length = 0;\n\n    if (this._manager.isPendingRequest(this._requestId)) {\n      this._manager.abortRequest(this._requestId);\n    }\n\n    this._close();\n  }\n\n}\n\n/***/ }),\n/* 27 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports.PDFFetchStream = void 0;\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _network_utils = __w_pdfjs_require__(24);\n\n;\n\nfunction createFetchOptions(headers, withCredentials, abortController) {\n  return {\n    method: \"GET\",\n    headers,\n    signal: abortController?.signal,\n    mode: \"cors\",\n    credentials: withCredentials ? \"include\" : \"same-origin\",\n    redirect: \"follow\"\n  };\n}\n\nfunction createHeaders(httpHeaders) {\n  const headers = new Headers();\n\n  for (const property in httpHeaders) {\n    const value = httpHeaders[property];\n\n    if (typeof value === \"undefined\") {\n      continue;\n    }\n\n    headers.append(property, value);\n  }\n\n  return headers;\n}\n\nclass PDFFetchStream {\n  constructor(source) {\n    this.source = source;\n    this.isHttp = /^https?:/i.test(source.url);\n    this.httpHeaders = this.isHttp && source.httpHeaders || {};\n    this._fullRequestReader = null;\n    this._rangeRequestReaders = [];\n  }\n\n  get _progressiveDataLength() {\n    return this._fullRequestReader?._loaded ?? 0;\n  }\n\n  getFullReader() {\n    (0, _util.assert)(!this._fullRequestReader, \"PDFFetchStream.getFullReader can only be called once.\");\n    this._fullRequestReader = new PDFFetchStreamReader(this);\n    return this._fullRequestReader;\n  }\n\n  getRangeReader(begin, end) {\n    if (end <= this._progressiveDataLength) {\n      return null;\n    }\n\n    const reader = new PDFFetchStreamRangeReader(this, begin, end);\n\n    this._rangeRequestReaders.push(reader);\n\n    return reader;\n  }\n\n  cancelAllRequests(reason) {\n    if (this._fullRequestReader) {\n      this._fullRequestReader.cancel(reason);\n    }\n\n    for (const reader of this._rangeRequestReaders.slice(0)) {\n      reader.cancel(reason);\n    }\n  }\n\n}\n\nexports.PDFFetchStream = PDFFetchStream;\n\nclass PDFFetchStreamReader {\n  constructor(stream) {\n    this._stream = stream;\n    this._reader = null;\n    this._loaded = 0;\n    this._filename = null;\n    const source = stream.source;\n    this._withCredentials = source.withCredentials || false;\n    this._contentLength = source.length;\n    this._headersCapability = (0, _util.createPromiseCapability)();\n    this._disableRange = source.disableRange || false;\n    this._rangeChunkSize = source.rangeChunkSize;\n\n    if (!this._rangeChunkSize && !this._disableRange) {\n      this._disableRange = true;\n    }\n\n    if (typeof AbortController !== \"undefined\") {\n      this._abortController = new AbortController();\n    }\n\n    this._isStreamingSupported = !source.disableStream;\n    this._isRangeSupported = !source.disableRange;\n    this._headers = createHeaders(this._stream.httpHeaders);\n    const url = source.url;\n    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {\n      if (!(0, _network_utils.validateResponseStatus)(response.status)) {\n        throw (0, _network_utils.createResponseStatusError)(response.status, url);\n      }\n\n      this._reader = response.body.getReader();\n\n      this._headersCapability.resolve();\n\n      const getResponseHeader = name => {\n        return response.headers.get(name);\n      };\n\n      const {\n        allowRangeRequests,\n        suggestedLength\n      } = (0, _network_utils.validateRangeRequestCapabilities)({\n        getResponseHeader,\n        isHttp: this._stream.isHttp,\n        rangeChunkSize: this._rangeChunkSize,\n        disableRange: this._disableRange\n      });\n      this._isRangeSupported = allowRangeRequests;\n      this._contentLength = suggestedLength || this._contentLength;\n      this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);\n\n      if (!this._isStreamingSupported && this._isRangeSupported) {\n        this.cancel(new _util.AbortException(\"Streaming is disabled.\"));\n      }\n    }).catch(this._headersCapability.reject);\n    this.onProgress = null;\n  }\n\n  get headersReady() {\n    return this._headersCapability.promise;\n  }\n\n  get filename() {\n    return this._filename;\n  }\n\n  get contentLength() {\n    return this._contentLength;\n  }\n\n  get isRangeSupported() {\n    return this._isRangeSupported;\n  }\n\n  get isStreamingSupported() {\n    return this._isStreamingSupported;\n  }\n\n  async read() {\n    await this._headersCapability.promise;\n    const {\n      value,\n      done\n    } = await this._reader.read();\n\n    if (done) {\n      return {\n        value,\n        done\n      };\n    }\n\n    this._loaded += value.byteLength;\n\n    if (this.onProgress) {\n      this.onProgress({\n        loaded: this._loaded,\n        total: this._contentLength\n      });\n    }\n\n    const buffer = new Uint8Array(value).buffer;\n    return {\n      value: buffer,\n      done: false\n    };\n  }\n\n  cancel(reason) {\n    if (this._reader) {\n      this._reader.cancel(reason);\n    }\n\n    if (this._abortController) {\n      this._abortController.abort();\n    }\n  }\n\n}\n\nclass PDFFetchStreamRangeReader {\n  constructor(stream, begin, end) {\n    this._stream = stream;\n    this._reader = null;\n    this._loaded = 0;\n    const source = stream.source;\n    this._withCredentials = source.withCredentials || false;\n    this._readCapability = (0, _util.createPromiseCapability)();\n    this._isStreamingSupported = !source.disableStream;\n\n    if (typeof AbortController !== \"undefined\") {\n      this._abortController = new AbortController();\n    }\n\n    this._headers = createHeaders(this._stream.httpHeaders);\n\n    this._headers.append(\"Range\", `bytes=${begin}-${end - 1}`);\n\n    const url = source.url;\n    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {\n      if (!(0, _network_utils.validateResponseStatus)(response.status)) {\n        throw (0, _network_utils.createResponseStatusError)(response.status, url);\n      }\n\n      this._readCapability.resolve();\n\n      this._reader = response.body.getReader();\n    }).catch(this._readCapability.reject);\n    this.onProgress = null;\n  }\n\n  get isStreamingSupported() {\n    return this._isStreamingSupported;\n  }\n\n  async read() {\n    await this._readCapability.promise;\n    const {\n      value,\n      done\n    } = await this._reader.read();\n\n    if (done) {\n      return {\n        value,\n        done\n      };\n    }\n\n    this._loaded += value.byteLength;\n\n    if (this.onProgress) {\n      this.onProgress({\n        loaded: this._loaded\n      });\n    }\n\n    const buffer = new Uint8Array(value).buffer;\n    return {\n      value: buffer,\n      done: false\n    };\n  }\n\n  cancel(reason) {\n    if (this._reader) {\n      this._reader.cancel(reason);\n    }\n\n    if (this._abortController) {\n      this._abortController.abort();\n    }\n  }\n\n}\n\n/***/ })\n/******/ \t]);\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __w_pdfjs_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.\n(() => {\nvar exports = __webpack_exports__;\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nObject.defineProperty(exports, \"AnnotationLayer\", ({\n  enumerable: true,\n  get: function () {\n    return _annotation_layer.AnnotationLayer;\n  }\n}));\nObject.defineProperty(exports, \"AnnotationMode\", ({\n  enumerable: true,\n  get: function () {\n    return _util.AnnotationMode;\n  }\n}));\nObject.defineProperty(exports, \"CMapCompressionType\", ({\n  enumerable: true,\n  get: function () {\n    return _util.CMapCompressionType;\n  }\n}));\nObject.defineProperty(exports, \"GlobalWorkerOptions\", ({\n  enumerable: true,\n  get: function () {\n    return _worker_options.GlobalWorkerOptions;\n  }\n}));\nObject.defineProperty(exports, \"InvalidPDFException\", ({\n  enumerable: true,\n  get: function () {\n    return _util.InvalidPDFException;\n  }\n}));\nObject.defineProperty(exports, \"LoopbackPort\", ({\n  enumerable: true,\n  get: function () {\n    return _api.LoopbackPort;\n  }\n}));\nObject.defineProperty(exports, \"MissingPDFException\", ({\n  enumerable: true,\n  get: function () {\n    return _util.MissingPDFException;\n  }\n}));\nObject.defineProperty(exports, \"OPS\", ({\n  enumerable: true,\n  get: function () {\n    return _util.OPS;\n  }\n}));\nObject.defineProperty(exports, \"PDFDataRangeTransport\", ({\n  enumerable: true,\n  get: function () {\n    return _api.PDFDataRangeTransport;\n  }\n}));\nObject.defineProperty(exports, \"PDFDateString\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.PDFDateString;\n  }\n}));\nObject.defineProperty(exports, \"PDFWorker\", ({\n  enumerable: true,\n  get: function () {\n    return _api.PDFWorker;\n  }\n}));\nObject.defineProperty(exports, \"PasswordResponses\", ({\n  enumerable: true,\n  get: function () {\n    return _util.PasswordResponses;\n  }\n}));\nObject.defineProperty(exports, \"PermissionFlag\", ({\n  enumerable: true,\n  get: function () {\n    return _util.PermissionFlag;\n  }\n}));\nObject.defineProperty(exports, \"PixelsPerInch\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.PixelsPerInch;\n  }\n}));\nObject.defineProperty(exports, \"RenderingCancelledException\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.RenderingCancelledException;\n  }\n}));\nObject.defineProperty(exports, \"SVGGraphics\", ({\n  enumerable: true,\n  get: function () {\n    return _svg.SVGGraphics;\n  }\n}));\nObject.defineProperty(exports, \"UNSUPPORTED_FEATURES\", ({\n  enumerable: true,\n  get: function () {\n    return _util.UNSUPPORTED_FEATURES;\n  }\n}));\nObject.defineProperty(exports, \"UnexpectedResponseException\", ({\n  enumerable: true,\n  get: function () {\n    return _util.UnexpectedResponseException;\n  }\n}));\nObject.defineProperty(exports, \"Util\", ({\n  enumerable: true,\n  get: function () {\n    return _util.Util;\n  }\n}));\nObject.defineProperty(exports, \"VerbosityLevel\", ({\n  enumerable: true,\n  get: function () {\n    return _util.VerbosityLevel;\n  }\n}));\nObject.defineProperty(exports, \"XfaLayer\", ({\n  enumerable: true,\n  get: function () {\n    return _xfa_layer.XfaLayer;\n  }\n}));\nObject.defineProperty(exports, \"build\", ({\n  enumerable: true,\n  get: function () {\n    return _api.build;\n  }\n}));\nObject.defineProperty(exports, \"createPromiseCapability\", ({\n  enumerable: true,\n  get: function () {\n    return _util.createPromiseCapability;\n  }\n}));\nObject.defineProperty(exports, \"createValidAbsoluteUrl\", ({\n  enumerable: true,\n  get: function () {\n    return _util.createValidAbsoluteUrl;\n  }\n}));\nObject.defineProperty(exports, \"getDocument\", ({\n  enumerable: true,\n  get: function () {\n    return _api.getDocument;\n  }\n}));\nObject.defineProperty(exports, \"getFilenameFromUrl\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.getFilenameFromUrl;\n  }\n}));\nObject.defineProperty(exports, \"getPdfFilenameFromUrl\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.getPdfFilenameFromUrl;\n  }\n}));\nObject.defineProperty(exports, \"getXfaPageViewport\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.getXfaPageViewport;\n  }\n}));\nObject.defineProperty(exports, \"isPdfFile\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.isPdfFile;\n  }\n}));\nObject.defineProperty(exports, \"loadScript\", ({\n  enumerable: true,\n  get: function () {\n    return _display_utils.loadScript;\n  }\n}));\nObject.defineProperty(exports, \"renderTextLayer\", ({\n  enumerable: true,\n  get: function () {\n    return _text_layer.renderTextLayer;\n  }\n}));\nObject.defineProperty(exports, \"shadow\", ({\n  enumerable: true,\n  get: function () {\n    return _util.shadow;\n  }\n}));\nObject.defineProperty(exports, \"version\", ({\n  enumerable: true,\n  get: function () {\n    return _api.version;\n  }\n}));\n\nvar _util = __w_pdfjs_require__(1);\n\nvar _api = __w_pdfjs_require__(4);\n\nvar _display_utils = __w_pdfjs_require__(5);\n\nvar _annotation_layer = __w_pdfjs_require__(18);\n\nvar _worker_options = __w_pdfjs_require__(12);\n\nvar _is_node = __w_pdfjs_require__(3);\n\nvar _text_layer = __w_pdfjs_require__(21);\n\nvar _svg = __w_pdfjs_require__(22);\n\nvar _xfa_layer = __w_pdfjs_require__(20);\n\nconst pdfjsVersion = '2.13.216';\nconst pdfjsBuild = '399a0ec60';\n{\n  if (_is_node.isNodeJS) {\n    const {\n      PDFNodeStream\n    } = __w_pdfjs_require__(23);\n\n    (0, _api.setPDFNetworkStreamFactory)(params => {\n      return new PDFNodeStream(params);\n    });\n  } else {\n    const {\n      PDFNetworkStream\n    } = __w_pdfjs_require__(26);\n\n    const {\n      PDFFetchStream\n    } = __w_pdfjs_require__(27);\n\n    (0, _api.setPDFNetworkStreamFactory)(params => {\n      if ((0, _display_utils.isValidFetchUrl)(params.url)) {\n        return new PDFFetchStream(params);\n      }\n\n      return new PDFNetworkStream(params);\n    });\n  }\n}\n})();\n\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});\n//# sourceMappingURL=pdf.js.map\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/pdfjs-dist/build/pdf.js?");

/***/ }),

/***/ "./src/Icons/DeleteIcon.ts":
/*!*********************************!*\
  !*** ./src/Icons/DeleteIcon.ts ***!
  \*********************************/
/***/ ((__unused_webpack_module, exports) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports[\"default\"] = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" width=\"100%\" height=\"100%\"><path xmlns=\"http://www.w3.org/2000/svg\" d=\"m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z\"></path></svg>';\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Icons/DeleteIcon.ts?");

/***/ }),

/***/ "./src/Icons/PreviewIcon.ts":
/*!**********************************!*\
  !*** ./src/Icons/PreviewIcon.ts ***!
  \**********************************/
/***/ ((__unused_webpack_module, exports) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports[\"default\"] = '<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-zoom-in\" viewBox=\"0 0 16 16\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" width=\"100%\" height=\"100%\"><path xmlns=\"http://www.w3.org/2000/svg\" fill-rule=\"evenodd\" d=\"M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z\"></path><path xmlns=\"http://www.w3.org/2000/svg\" d=\"M10.344 11.742c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1 6.538 6.538 0 0 1-1.398 1.4z\"></path><path xmlns=\"http://www.w3.org/2000/svg\" fill-rule=\"evenodd\" d=\"M6.5 3a.5.5 0 0 1 .5.5V6h2.5a.5.5 0 0 1 0 1H7v2.5a.5.5 0 0 1-1 0V7H3.5a.5.5 0 0 1 0-1H6V3.5a.5.5 0 0 1 .5-.5z\"></path></svg>';\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Icons/PreviewIcon.ts?");

/***/ }),

/***/ "./src/Inline/Audio/Editor.ts":
/*!************************************!*\
  !*** ./src/Inline/Audio/Editor.ts ***!
  \************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AudioUploaderInline = void 0;\nconst Utils_1 = __webpack_require__(/*! ../Utils */ \"./src/Inline/Utils.ts\");\nconst EditorAudio_1 = __webpack_require__(/*! ./EditorAudio */ \"./src/Inline/Audio/EditorAudio.ts\");\nclass AudioUploaderInline {\n    constructor(element) {\n        this.handleAudioDelete = (image) => {\n            var _a;\n            if (image.element.getAttribute('data-raw')) {\n                image.element.classList.add('deleted');\n                const checkboxInput = image.element.querySelector('input[type=checkbox]');\n                checkboxInput.checked = true;\n            }\n            else {\n                (_a = image.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(image.element);\n            }\n            this.audios = this.audios.filter((item) => item !== image);\n            this.updateEmpty();\n        };\n        this.handleDrop = (e) => {\n            var _a;\n            e.preventDefault();\n            this.element.classList.remove('drop-zone');\n            if ((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files.length) {\n                for (const file of e.dataTransfer.files) {\n                    this.addFile(file);\n                }\n            }\n        };\n        this.handleDragEnter = () => {\n            this.element.classList.add('drop-zone');\n        };\n        this.handleDragOver = (e) => {\n            if (e) {\n                e.preventDefault();\n            }\n        };\n        this.handleDragLeave = (e) => {\n            if (e.relatedTarget && e.relatedTarget.closest('.uuw-inline-root') === this.element) {\n                return;\n            }\n            this.element.classList.remove('drop-zone');\n        };\n        this.canPreview = false;\n        this.tempFileInput = null;\n        this.element = element;\n        this.inlineGroup = (0, Utils_1.getInlineGroupOrThrow)(this.element);\n        this.inlineFormset = (0, Utils_1.parseFormSet)(this.inlineGroup);\n        this.management = (0, Utils_1.getManagementInputs)(this.inlineFormset.options.prefix);\n        this.next = 0;\n        if (this.management.maxNumForms.value === '') {\n            this.maxCount = Number.MAX_SAFE_INTEGER;\n        }\n        else {\n            this.maxCount = parseInt(this.management.maxNumForms.value, 10);\n        }\n        this.addAudioButton = (0, Utils_1.getAddButton)(this.element);\n        this.updateEmpty();\n        this.updateAllIndexes();\n        this.audios = Array\n            .from(this.element.querySelectorAll('.inline-related'))\n            .map((item) => {\n            const editorAudio = new EditorAudio_1.EditorAudio(item, this.canPreview);\n            editorAudio.onDelete = this.handleAudioDelete;\n            return editorAudio;\n        });\n        this.bindVariables();\n        this.bindEvents();\n        this.element.addEventListener('dragenter', this.handleDragEnter);\n        this.element.addEventListener('dragover', this.handleDragOver);\n        this.element.addEventListener('dragleave', this.handleDragLeave);\n        this.element.addEventListener('dragend', this.handleDragLeave);\n        this.element.addEventListener('drop', this.handleDrop);\n    }\n    bindVariables() {\n        this.handleAddAudio = this.handleAddAudio.bind(this);\n        this.handleTempFileInputChange = this.handleTempFileInputChange.bind(this);\n    }\n    bindEvents() {\n        var _a;\n        this.addAudioButton.addEventListener('click', this.handleAddAudio);\n        (_a = this.element.querySelector('.uuw-empty')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', this.handleAddAudio);\n    }\n    updateEmpty() {\n        const { length } = this.element.querySelectorAll('.inline-related:not(.empty-form):not(.deleted)');\n        this.element.classList.toggle('non-empty', length > 0);\n    }\n    updateAllIndexes() {\n        const { prefix } = this.inlineFormset.options;\n        const { length: count } = Array\n            .from(this.element.querySelectorAll('.inline-related:not(.empty-form)'))\n            .map((item, index) => {\n            (0, Utils_1.updateAllElementsIndexes)(item, prefix, index);\n            return item;\n        });\n        this.next = count;\n        this.management.totalForms.value = String(this.next);\n        this.addAudioButton.classList.toggle('visible-by-number', this.maxCount - this.next > 0);\n    }\n    createFromEmptyTemplate() {\n        var _a;\n        const template = this.element.querySelector('.inline-related.empty-form');\n        if (!template) {\n            throw new Error('no-empty-template');\n        }\n        const row = template.cloneNode(true);\n        row.classList.remove('empty-form');\n        row.classList.remove('last-related');\n        row.setAttribute('data-candelete', 'true');\n        row.id = `${this.inlineFormset.options.prefix}-${this.next}`;\n        (_a = template.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(row, template);\n        return row;\n    }\n    addFile(fileToAdd = null) {\n        var _a;\n        const row = this.createFromEmptyTemplate();\n        let file = null;\n        if (fileToAdd) {\n            file = fileToAdd;\n            const rowFileInput = row.querySelector('input[type=file]');\n            const dataTransferList = new DataTransfer();\n            dataTransferList.items.add(file);\n            rowFileInput.files = dataTransferList.files;\n        }\n        else {\n            if (!this.tempFileInput) {\n                throw new Error('no-temp-input-for-upload');\n            }\n            file = (this.tempFileInput.files || [null])[0];\n            if (!file) {\n                throw new Error('no-file-in-input');\n            }\n            const rowFileInput = row.querySelector('input[type=file]');\n            const parent = rowFileInput.parentElement;\n            const className = rowFileInput.className;\n            const name = rowFileInput.getAttribute('name');\n            parent.removeChild(rowFileInput);\n            this.tempFileInput.className = className;\n            this.tempFileInput.setAttribute('name', name || '');\n            (_a = this.tempFileInput.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.tempFileInput);\n            parent.appendChild(this.tempFileInput);\n            this.tempFileInput = null;\n        }\n        const editorAudio = new EditorAudio_1.EditorAudio(row, true, URL.createObjectURL(file));\n        editorAudio.onDelete = this.handleAudioDelete;\n        this.audios.push(editorAudio);\n        this.updateEmpty();\n        this.updateAllIndexes();\n    }\n    handleTempFileInputChange() {\n        var _a;\n        const filesList = (_a = this.tempFileInput) === null || _a === void 0 ? void 0 : _a.files;\n        if (!filesList || filesList.length <= 0) {\n            return;\n        }\n        this.addFile();\n    }\n    handleAddAudio() {\n        if (!this.tempFileInput) {\n            this.tempFileInput = (0, Utils_1.createTempFileInput)('audio/*');\n            this.tempFileInput.addEventListener('change', this.handleTempFileInputChange);\n            this.element.appendChild(this.tempFileInput);\n        }\n        this.tempFileInput.click();\n    }\n}\nexports.AudioUploaderInline = AudioUploaderInline;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Audio/Editor.ts?");

/***/ }),

/***/ "./src/Inline/Audio/EditorAudio.ts":
/*!*****************************************!*\
  !*** ./src/Inline/Audio/EditorAudio.ts ***!
  \*****************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EditorAudio = void 0;\nconst DeleteIcon_1 = __importDefault(__webpack_require__(/*! ../../Icons/DeleteIcon */ \"./src/Icons/DeleteIcon.ts\"));\nclass EditorAudio {\n    constructor(element, canPreview, newAudio) {\n        this.element = element;\n        this.canPreview = canPreview;\n        this.onDelete = null;\n        this.handleClick = this.handleClick.bind(this);\n        this.handleInputChange = this.handleInputChange.bind(this);\n        if (!!newAudio) {\n            this.render(newAudio);\n        }\n        else {\n            const inputs = this.removeAndGetInputs();\n            const link = this.getAndUpdateRawAudio();\n            this.element.innerHTML = \"\";\n            inputs.forEach((item) => this.element.appendChild(item));\n            this.render(link);\n        }\n    }\n    removeAndGetInputs() {\n        return Array.from(this.element.querySelectorAll(\"input[type=hidden], input[type=checkbox], input[type=file]\")).map((item) => {\n            var _a;\n            (_a = item.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(item);\n            return item;\n        });\n    }\n    getAndUpdateRawAudio() {\n        let rawAudio = document.querySelector(\"p.file-upload a\");\n        if (this.element.classList.contains(\"empty-form\")) {\n            rawAudio = null;\n        }\n        let hrefAttr = null;\n        if (rawAudio) {\n            hrefAttr = rawAudio.getAttribute(\"href\");\n            if (hrefAttr) {\n                this.element.setAttribute(\"data-raw\", hrefAttr);\n            }\n        }\n        return hrefAttr;\n    }\n    render(link) {\n        var _a;\n        if (!link) {\n            return;\n        }\n        let delete_icon = null;\n        const related = this.element.closest(\".inline-related\");\n        related === null || related === void 0 ? void 0 : related.addEventListener(\"click\", this.handleClick);\n        (_a = related === null || related === void 0 ? void 0 : related.querySelector(\"input[type=file]\")) === null || _a === void 0 ? void 0 : _a.addEventListener(\"change\", this.handleInputChange);\n        if ((related === null || related === void 0 ? void 0 : related.getAttribute(\"data-candelete\")) === \"true\") {\n            delete_icon = document.createElement(\"span\");\n            delete_icon.classList.add(\"uuw-delete-icon\");\n            delete_icon.innerHTML = DeleteIcon_1.default;\n        }\n        const audio = document.createElement(\"audio\");\n        audio.src = link;\n        this.element.appendChild(audio);\n        if (delete_icon) {\n            this.element.appendChild(delete_icon);\n        }\n    }\n    handleClick(e) {\n        if (!e || !e.target) {\n            return;\n        }\n        const target = e.target;\n        const item = target.closest(\".inline-related\");\n        if (target.closest(\".uuw-delete-icon\") && !!this.onDelete) {\n            this.onDelete(this);\n            return;\n        }\n        const fileInput = item === null || item === void 0 ? void 0 : item.querySelector(\"input[type=file]\");\n        if (e.target === fileInput) {\n            return;\n        }\n        fileInput === null || fileInput === void 0 ? void 0 : fileInput.click();\n    }\n    handleInputChange(e) {\n        var _a;\n        if (!e || !e.target || e.target.tagName !== \"INPUT\") {\n            return;\n        }\n        const fileInput = e.target;\n        var files = fileInput.files;\n        if (!(files === null || files === void 0 ? void 0 : files.length)) {\n            return;\n        }\n        const audioTag = (_a = fileInput\n            .closest(\".inline-related\")) === null || _a === void 0 ? void 0 : _a.querySelector(\"audio\");\n        if (audioTag) {\n            audioTag.src = URL.createObjectURL(files[0]);\n        }\n    }\n}\nexports.EditorAudio = EditorAudio;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Audio/EditorAudio.ts?");

/***/ }),

/***/ "./src/Inline/Image/Editor.ts":
/*!************************************!*\
  !*** ./src/Inline/Image/Editor.ts ***!
  \************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ImageUploaderInline = void 0;\nconst Utils_1 = __webpack_require__(/*! ../Utils */ \"./src/Inline/Utils.ts\");\nconst EditorImage_1 = __webpack_require__(/*! ./EditorImage */ \"./src/Inline/Image/EditorImage.ts\");\nclass ImageUploaderInline {\n    constructor(element) {\n        this.handleImageDelete = (image) => {\n            var _a;\n            if (image.element.getAttribute(\"data-raw\")) {\n                image.element.classList.add(\"deleted\");\n                const checkboxInput = image.element.querySelector(\"input[type=checkbox]\");\n                checkboxInput.checked = true;\n            }\n            else {\n                (_a = image.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(image.element);\n            }\n            this.images = this.images.filter((item) => item !== image);\n            this.updateEmpty();\n        };\n        this.handleDrop = (e) => {\n            var _a;\n            e.preventDefault();\n            this.element.classList.remove(\"drop-zone\");\n            if ((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files.length) {\n                for (const file of e.dataTransfer.files) {\n                    this.addFile(file);\n                }\n            }\n        };\n        this.handleDragEnter = () => {\n            this.element.classList.add(\"drop-zone\");\n        };\n        this.handleDragOver = (e) => {\n            if (e) {\n                e.preventDefault();\n            }\n        };\n        this.handleDragLeave = (e) => {\n            if (e.relatedTarget &&\n                e.relatedTarget.closest(\".uuw-inline-root\") ===\n                    this.element) {\n                return;\n            }\n            this.element.classList.remove(\"drop-zone\");\n        };\n        this.canPreview = true;\n        this.tempFileInput = null;\n        this.element = element;\n        this.inlineGroup = (0, Utils_1.getInlineGroupOrThrow)(this.element);\n        this.inlineFormset = (0, Utils_1.parseFormSet)(this.inlineGroup);\n        this.management = (0, Utils_1.getManagementInputs)(this.inlineFormset.options.prefix);\n        this.next = 0;\n        if (this.management.maxNumForms.value === \"\") {\n            this.maxCount = Number.MAX_SAFE_INTEGER;\n        }\n        else {\n            this.maxCount = parseInt(this.management.maxNumForms.value, 10);\n        }\n        this.addImageButton = (0, Utils_1.getAddButton)(this.element);\n        this.updateEmpty();\n        this.updateAllIndexes();\n        this.images = Array.from(this.element.querySelectorAll(\".inline-related\")).map((item) => {\n            const editorImage = new EditorImage_1.EditorImage(item, this.canPreview);\n            editorImage.onDelete = this.handleImageDelete;\n            return editorImage;\n        });\n        this.bindVariables();\n        this.bindEvents();\n        this.element.addEventListener(\"dragenter\", this.handleDragEnter);\n        this.element.addEventListener(\"dragover\", this.handleDragOver);\n        this.element.addEventListener(\"dragleave\", this.handleDragLeave);\n        this.element.addEventListener(\"dragend\", this.handleDragLeave);\n        this.element.addEventListener(\"drop\", this.handleDrop);\n    }\n    bindVariables() {\n        this.handleAddImage = this.handleAddImage.bind(this);\n        this.handleTempFileInputChange = this.handleTempFileInputChange.bind(this);\n    }\n    bindEvents() {\n        var _a;\n        this.addImageButton.addEventListener(\"click\", this.handleAddImage);\n        (_a = this.element\n            .querySelector(\".uuw-empty\")) === null || _a === void 0 ? void 0 : _a.addEventListener(\"click\", this.handleAddImage);\n    }\n    updateEmpty() {\n        const { length } = this.element.querySelectorAll(\".inline-related:not(.empty-form):not(.deleted)\");\n        this.element.classList.toggle(\"non-empty\", length > 0);\n    }\n    updateAllIndexes() {\n        const { prefix } = this.inlineFormset.options;\n        const { length: count } = Array.from(this.element.querySelectorAll(\".inline-related:not(.empty-form)\")).map((item, index) => {\n            (0, Utils_1.updateAllElementsIndexes)(item, prefix, index);\n            return item;\n        });\n        this.next = count;\n        this.management.totalForms.value = String(this.next);\n        this.addImageButton.classList.toggle(\"visible-by-number\", this.maxCount - this.next > 0);\n    }\n    createFromEmptyTemplate() {\n        var _a;\n        const template = this.element.querySelector(\".inline-related.empty-form\");\n        if (!template) {\n            throw new Error(\"no-empty-template\");\n        }\n        const row = template.cloneNode(true);\n        row.classList.remove(\"empty-form\");\n        row.classList.remove(\"last-related\");\n        row.setAttribute(\"data-candelete\", \"true\");\n        row.id = `${this.inlineFormset.options.prefix}-${this.next}`;\n        (_a = template.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(row, template);\n        return row;\n    }\n    addFile(fileToAdd = null) {\n        var _a;\n        const row = this.createFromEmptyTemplate();\n        let file = null;\n        if (fileToAdd) {\n            file = fileToAdd;\n            const rowFileInput = row.querySelector(\"input[type=file]\");\n            const dataTransferList = new DataTransfer();\n            dataTransferList.items.add(file);\n            rowFileInput.files = dataTransferList.files;\n        }\n        else {\n            if (!this.tempFileInput) {\n                throw new Error(\"no-temp-input-for-upload\");\n            }\n            file = (this.tempFileInput.files || [null])[0];\n            if (!file) {\n                throw new Error(\"no-file-in-input\");\n            }\n            const rowFileInput = row.querySelector(\"input[type=file]\");\n            const parent = rowFileInput.parentElement;\n            const className = rowFileInput.className;\n            const name = rowFileInput.getAttribute(\"name\");\n            parent.removeChild(rowFileInput);\n            this.tempFileInput.className = className;\n            this.tempFileInput.setAttribute(\"name\", name || \"\");\n            (_a = this.tempFileInput.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.tempFileInput);\n            parent.appendChild(this.tempFileInput);\n            this.tempFileInput = null;\n        }\n        const editorImage = new EditorImage_1.EditorImage(row, true, URL.createObjectURL(file));\n        editorImage.onDelete = this.handleImageDelete;\n        this.images.push(editorImage);\n        this.updateEmpty();\n        this.updateAllIndexes();\n    }\n    handleTempFileInputChange() {\n        var _a;\n        const filesList = (_a = this.tempFileInput) === null || _a === void 0 ? void 0 : _a.files;\n        if (!filesList || filesList.length <= 0) {\n            return;\n        }\n        this.addFile();\n    }\n    handleAddImage() {\n        if (!this.tempFileInput) {\n            this.tempFileInput = (0, Utils_1.createTempFileInput)('image/*');\n            this.tempFileInput.addEventListener(\"change\", this.handleTempFileInputChange);\n            this.element.appendChild(this.tempFileInput);\n        }\n        this.tempFileInput.click();\n    }\n}\nexports.ImageUploaderInline = ImageUploaderInline;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Image/Editor.ts?");

/***/ }),

/***/ "./src/Inline/Image/EditorImage.ts":
/*!*****************************************!*\
  !*** ./src/Inline/Image/EditorImage.ts ***!
  \*****************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EditorImage = void 0;\nconst PreviewIcon_1 = __importDefault(__webpack_require__(/*! ../../Icons/PreviewIcon */ \"./src/Icons/PreviewIcon.ts\"));\nconst DeleteIcon_1 = __importDefault(__webpack_require__(/*! ../../Icons/DeleteIcon */ \"./src/Icons/DeleteIcon.ts\"));\nconst PreviewModal_1 = __webpack_require__(/*! ../../PreviewModal */ \"./src/PreviewModal/index.ts\");\nclass EditorImage {\n    constructor(element, canPreview, newImage) {\n        this.element = element;\n        this.canPreview = canPreview;\n        this.onDelete = null;\n        this.handleClick = this.handleClick.bind(this);\n        this.handleInputChange = this.handleInputChange.bind(this);\n        if (!!newImage) {\n            this.render(newImage);\n        }\n        else {\n            const inputs = this.removeAndGetInputs();\n            const link = this.getAndUpdateRawImage();\n            this.element.innerHTML = \"\";\n            inputs.forEach((item) => this.element.appendChild(item));\n            this.render(link);\n        }\n    }\n    removeAndGetInputs() {\n        return Array.from(this.element.querySelectorAll(\"input[type=hidden], input[type=checkbox], input[type=file]\")).map((item) => {\n            var _a;\n            (_a = item.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(item);\n            return item;\n        });\n    }\n    getAndUpdateRawImage() {\n        let rawImage = document.querySelector(\"p.file-upload a\");\n        if (this.element.classList.contains(\"empty-form\")) {\n            rawImage = null;\n        }\n        let hrefAttr = null;\n        if (rawImage) {\n            hrefAttr = rawImage.getAttribute(\"href\");\n            if (hrefAttr) {\n                this.element.setAttribute(\"data-raw\", hrefAttr);\n            }\n        }\n        return hrefAttr;\n    }\n    render(link) {\n        var _a;\n        if (!link) {\n            return;\n        }\n        let delete_icon = null;\n        const related = this.element.closest(\".inline-related\");\n        related === null || related === void 0 ? void 0 : related.addEventListener(\"click\", this.handleClick);\n        (_a = related === null || related === void 0 ? void 0 : related.querySelector(\"input[type=file]\")) === null || _a === void 0 ? void 0 : _a.addEventListener(\"change\", this.handleInputChange);\n        if ((related === null || related === void 0 ? void 0 : related.getAttribute(\"data-candelete\")) === \"true\") {\n            delete_icon = document.createElement(\"span\");\n            delete_icon.classList.add(\"uuw-delete-icon\");\n            delete_icon.innerHTML = DeleteIcon_1.default;\n        }\n        if (this.canPreview) {\n            const span = document.createElement(\"span\");\n            span.classList.add(\"uuw-preview-icon\");\n            if ((related === null || related === void 0 ? void 0 : related.getAttribute(\"data-candelete\")) !== \"true\") {\n                span.classList.add(\"uuw-only-preview\");\n            }\n            span.innerHTML = PreviewIcon_1.default;\n            this.element.appendChild(span);\n        }\n        const img = document.createElement(\"img\");\n        img.src = link;\n        this.element.appendChild(img);\n        if (delete_icon) {\n            this.element.appendChild(delete_icon);\n        }\n    }\n    handleClick(e) {\n        if (!e || !e.target) {\n            return;\n        }\n        const target = e.target;\n        const item = target.closest(\".inline-related\");\n        if (target.closest(\".uuw-delete-icon\") && !!this.onDelete) {\n            this.onDelete(this);\n            return;\n        }\n        if (target.closest(\".uuw-preview-icon\")) {\n            let image = item === null || item === void 0 ? void 0 : item.querySelector(\"img\");\n            if (image) {\n                image = image.cloneNode(true);\n                PreviewModal_1.PreviewModal.createPreviewModal(image);\n                PreviewModal_1.PreviewModal.openPreviewModal();\n                return;\n            }\n        }\n        const fileInput = item === null || item === void 0 ? void 0 : item.querySelector(\"input[type=file]\");\n        if (e.target === fileInput) {\n            return;\n        }\n        fileInput === null || fileInput === void 0 ? void 0 : fileInput.click();\n    }\n    handleInputChange(e) {\n        var _a;\n        if (!e || !e.target || e.target.tagName !== \"INPUT\") {\n            return;\n        }\n        const fileInput = e.target;\n        var files = fileInput.files;\n        if (!(files === null || files === void 0 ? void 0 : files.length)) {\n            return;\n        }\n        const imgTag = (_a = fileInput.closest(\".inline-related\")) === null || _a === void 0 ? void 0 : _a.querySelector(\"img\");\n        if (imgTag) {\n            imgTag.src = URL.createObjectURL(files[0]);\n        }\n    }\n}\nexports.EditorImage = EditorImage;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Image/EditorImage.ts?");

/***/ }),

/***/ "./src/Inline/Utils.ts":
/*!*****************************!*\
  !*** ./src/Inline/Utils.ts ***!
  \*****************************/
/***/ ((__unused_webpack_module, exports) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.createTempFileInput = exports.getAddButton = exports.getManagementInputs = exports.updateAllElementsIndexes = exports.updateElementIndex = exports.parseFormSet = exports.getInlineGroupOrThrow = void 0;\nfunction getInlineGroupOrThrow(element) {\n    const inlineGroup = element.closest(\".inline-group\");\n    if (!inlineGroup) {\n        throw new Error(\"no-inline-group-found\");\n    }\n    return inlineGroup;\n}\nexports.getInlineGroupOrThrow = getInlineGroupOrThrow;\nfunction parseFormSet(element) {\n    const formSetDataString = element.getAttribute(\"data-inline-formset\");\n    if (!formSetDataString) {\n        throw new Error(\"no-formset-data-found\");\n    }\n    return JSON.parse(formSetDataString);\n}\nexports.parseFormSet = parseFormSet;\nfunction updateElementIndex(element, prefix, index) {\n    const findRegex = new RegExp(`(${prefix}-(\\\\d+|__prefix__))`);\n    const replacement = `${prefix}-${index}`;\n    // replace at [for]\n    const forAttr = element.getAttribute(\"for\");\n    if (forAttr) {\n        element.setAttribute(\"for\", forAttr.replace(findRegex, replacement));\n    }\n    // replace at [id]\n    const idAttr = element.getAttribute(\"id\");\n    if (idAttr) {\n        element.setAttribute(\"id\", idAttr.replace(findRegex, replacement));\n    }\n    // replace at [name]\n    const nameAttr = element.getAttribute(\"name\");\n    if (nameAttr) {\n        element.setAttribute(\"name\", nameAttr.replace(findRegex, replacement));\n    }\n}\nexports.updateElementIndex = updateElementIndex;\nfunction updateAllElementsIndexes(element, prefix, index) {\n    updateElementIndex(element, prefix, index);\n    Array.from(element.querySelectorAll(\"*\")).forEach((childItem) => updateElementIndex(childItem, prefix, index));\n}\nexports.updateAllElementsIndexes = updateAllElementsIndexes;\nfunction getManagementInputs(prefix) {\n    const totalForms = document.querySelector(`#id_${prefix}-TOTAL_FORMS`);\n    const initialForms = document.querySelector(`#id_${prefix}-INITIAL_FORMS`);\n    const minNumForms = document.querySelector(`#id_${prefix}-MIN_NUM_FORMS`);\n    const maxNumForms = document.querySelector(`#id_${prefix}-MAX_NUM_FORMS`);\n    if (!totalForms || !initialForms || !minNumForms || !maxNumForms) {\n        throw new Error(\"management-forms-not-found\");\n    }\n    return { totalForms, initialForms, minNumForms, maxNumForms };\n}\nexports.getManagementInputs = getManagementInputs;\nfunction getAddButton(element) {\n    const addFileButton = element.querySelector(\".uuw-add-file-btn\");\n    if (!addFileButton) {\n        throw new Error(\"no-add-button-found\");\n    }\n    return addFileButton;\n}\nexports.getAddButton = getAddButton;\nfunction createTempFileInput(accept) {\n    const tempFileInput = document.createElement(\"input\");\n    tempFileInput.setAttribute(\"type\", \"file\");\n    tempFileInput.classList.add(\"temp_file\");\n    tempFileInput.setAttribute(\"accept\", accept);\n    tempFileInput.style.display = \"none\";\n    return tempFileInput;\n}\nexports.createTempFileInput = createTempFileInput;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Utils.ts?");

/***/ }),

/***/ "./src/Inline/Video/Editor.ts":
/*!************************************!*\
  !*** ./src/Inline/Video/Editor.ts ***!
  \************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.VideoUploaderInline = void 0;\nconst Utils_1 = __webpack_require__(/*! ../Utils */ \"./src/Inline/Utils.ts\");\nconst EditorVideo_1 = __webpack_require__(/*! ./EditorVideo */ \"./src/Inline/Video/EditorVideo.ts\");\nclass VideoUploaderInline {\n    constructor(element) {\n        this.handleVideoDelete = (image) => {\n            var _a;\n            if (image.element.getAttribute(\"data-raw\")) {\n                image.element.classList.add(\"deleted\");\n                const checkboxInput = image.element.querySelector(\"input[type=checkbox]\");\n                checkboxInput.checked = true;\n            }\n            else {\n                (_a = image.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(image.element);\n            }\n            this.videos = this.videos.filter((item) => item !== image);\n            this.updateEmpty();\n        };\n        this.handleDrop = (e) => {\n            var _a;\n            e.preventDefault();\n            this.element.classList.remove(\"drop-zone\");\n            if ((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files.length) {\n                for (const file of e.dataTransfer.files) {\n                    this.addFile(file);\n                }\n            }\n        };\n        this.handleDragEnter = () => {\n            this.element.classList.add(\"drop-zone\");\n        };\n        this.handleDragOver = (e) => {\n            if (e) {\n                e.preventDefault();\n            }\n        };\n        this.handleDragLeave = (e) => {\n            if (e.relatedTarget &&\n                e.relatedTarget.closest(\".uuw-inline-root\") ===\n                    this.element) {\n                return;\n            }\n            this.element.classList.remove(\"drop-zone\");\n        };\n        this.canPreview = true;\n        this.tempFileInput = null;\n        this.element = element;\n        this.inlineGroup = (0, Utils_1.getInlineGroupOrThrow)(this.element);\n        this.inlineFormset = (0, Utils_1.parseFormSet)(this.inlineGroup);\n        this.management = (0, Utils_1.getManagementInputs)(this.inlineFormset.options.prefix);\n        this.next = 0;\n        if (this.management.maxNumForms.value === \"\") {\n            this.maxCount = Number.MAX_SAFE_INTEGER;\n        }\n        else {\n            this.maxCount = parseInt(this.management.maxNumForms.value, 10);\n        }\n        this.addVideoButton = (0, Utils_1.getAddButton)(this.element);\n        this.updateEmpty();\n        this.updateAllIndexes();\n        this.videos = Array.from(this.element.querySelectorAll(\".inline-related\")).map((item) => {\n            const editorVideo = new EditorVideo_1.EditorVideo(item, this.canPreview);\n            editorVideo.onDelete = this.handleVideoDelete;\n            return editorVideo;\n        });\n        this.bindVariables();\n        this.bindEvents();\n        this.element.addEventListener(\"dragenter\", this.handleDragEnter);\n        this.element.addEventListener(\"dragover\", this.handleDragOver);\n        this.element.addEventListener(\"dragleave\", this.handleDragLeave);\n        this.element.addEventListener(\"dragend\", this.handleDragLeave);\n        this.element.addEventListener(\"drop\", this.handleDrop);\n    }\n    bindVariables() {\n        this.handleAddVideo = this.handleAddVideo.bind(this);\n        this.handleTempFileInputChange = this.handleTempFileInputChange.bind(this);\n    }\n    bindEvents() {\n        var _a;\n        this.addVideoButton.addEventListener(\"click\", this.handleAddVideo);\n        (_a = this.element\n            .querySelector(\".uuw-empty\")) === null || _a === void 0 ? void 0 : _a.addEventListener(\"click\", this.handleAddVideo);\n    }\n    updateEmpty() {\n        const { length } = this.element.querySelectorAll(\".inline-related:not(.empty-form):not(.deleted)\");\n        this.element.classList.toggle(\"non-empty\", length > 0);\n    }\n    updateAllIndexes() {\n        const { prefix } = this.inlineFormset.options;\n        const { length: count } = Array.from(this.element.querySelectorAll(\".inline-related:not(.empty-form)\")).map((item, index) => {\n            (0, Utils_1.updateAllElementsIndexes)(item, prefix, index);\n            return item;\n        });\n        this.next = count;\n        this.management.totalForms.value = String(this.next);\n        this.addVideoButton.classList.toggle(\"visible-by-number\", this.maxCount - this.next > 0);\n    }\n    createFromEmptyTemplate() {\n        var _a;\n        const template = this.element.querySelector(\".inline-related.empty-form\");\n        if (!template) {\n            throw new Error(\"no-empty-template\");\n        }\n        const row = template.cloneNode(true);\n        row.classList.remove(\"empty-form\");\n        row.classList.remove(\"last-related\");\n        row.setAttribute(\"data-candelete\", \"true\");\n        row.id = `${this.inlineFormset.options.prefix}-${this.next}`;\n        (_a = template.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(row, template);\n        return row;\n    }\n    addFile(fileToAdd = null) {\n        var _a;\n        const row = this.createFromEmptyTemplate();\n        let file = null;\n        if (fileToAdd) {\n            file = fileToAdd;\n            const rowFileInput = row.querySelector(\"input[type=file]\");\n            const dataTransferList = new DataTransfer();\n            dataTransferList.items.add(file);\n            rowFileInput.files = dataTransferList.files;\n        }\n        else {\n            if (!this.tempFileInput) {\n                throw new Error(\"no-temp-input-for-upload\");\n            }\n            file = (this.tempFileInput.files || [null])[0];\n            if (!file) {\n                throw new Error(\"no-file-in-input\");\n            }\n            const rowFileInput = row.querySelector(\"input[type=file]\");\n            const parent = rowFileInput.parentElement;\n            const className = rowFileInput.className;\n            const name = rowFileInput.getAttribute(\"name\");\n            parent.removeChild(rowFileInput);\n            this.tempFileInput.className = className;\n            this.tempFileInput.setAttribute(\"name\", name || \"\");\n            (_a = this.tempFileInput.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.tempFileInput);\n            parent.appendChild(this.tempFileInput);\n            this.tempFileInput = null;\n        }\n        const editorVideo = new EditorVideo_1.EditorVideo(row, true, URL.createObjectURL(file));\n        editorVideo.onDelete = this.handleVideoDelete;\n        this.videos.push(editorVideo);\n        this.updateEmpty();\n        this.updateAllIndexes();\n    }\n    handleTempFileInputChange() {\n        var _a;\n        const filesList = (_a = this.tempFileInput) === null || _a === void 0 ? void 0 : _a.files;\n        if (!filesList || filesList.length <= 0) {\n            return;\n        }\n        this.addFile();\n    }\n    handleAddVideo() {\n        if (!this.tempFileInput) {\n            this.tempFileInput = (0, Utils_1.createTempFileInput)(\"video/*\");\n            this.tempFileInput.addEventListener(\"change\", this.handleTempFileInputChange);\n            this.element.appendChild(this.tempFileInput);\n        }\n        this.tempFileInput.click();\n    }\n}\nexports.VideoUploaderInline = VideoUploaderInline;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Video/Editor.ts?");

/***/ }),

/***/ "./src/Inline/Video/EditorVideo.ts":
/*!*****************************************!*\
  !*** ./src/Inline/Video/EditorVideo.ts ***!
  \*****************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.EditorVideo = void 0;\nconst PreviewIcon_1 = __importDefault(__webpack_require__(/*! ../../Icons/PreviewIcon */ \"./src/Icons/PreviewIcon.ts\"));\nconst DeleteIcon_1 = __importDefault(__webpack_require__(/*! ../../Icons/DeleteIcon */ \"./src/Icons/DeleteIcon.ts\"));\nclass EditorVideo {\n    constructor(element, canPreview, newVideo) {\n        this.element = element;\n        this.canPreview = canPreview;\n        this.onDelete = null;\n        this.handleClick = this.handleClick.bind(this);\n        this.handleInputChange = this.handleInputChange.bind(this);\n        if (!!newVideo) {\n            this.render(newVideo);\n        }\n        else {\n            const inputs = this.removeAndGetInputs();\n            const link = this.getAndUpdateRawVideo();\n            this.element.innerHTML = \"\";\n            inputs.forEach((item) => this.element.appendChild(item));\n            this.render(link);\n        }\n    }\n    removeAndGetInputs() {\n        return Array.from(this.element.querySelectorAll(\"input[type=hidden], input[type=checkbox], input[type=file]\")).map((item) => {\n            var _a;\n            (_a = item.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(item);\n            return item;\n        });\n    }\n    getAndUpdateRawVideo() {\n        let rawVideo = document.querySelector(\"p.file-upload a\");\n        if (this.element.classList.contains(\"empty-form\")) {\n            rawVideo = null;\n        }\n        let hrefAttr = null;\n        if (rawVideo) {\n            hrefAttr = rawVideo.getAttribute(\"href\");\n            if (hrefAttr) {\n                this.element.setAttribute(\"data-raw\", hrefAttr);\n            }\n        }\n        return hrefAttr;\n    }\n    render(link) {\n        var _a;\n        if (!link) {\n            return;\n        }\n        let delete_icon = null;\n        const related = this.element.closest(\".inline-related\");\n        related === null || related === void 0 ? void 0 : related.addEventListener(\"click\", this.handleClick);\n        (_a = related === null || related === void 0 ? void 0 : related.querySelector(\"input[type=file]\")) === null || _a === void 0 ? void 0 : _a.addEventListener(\"change\", this.handleInputChange);\n        if ((related === null || related === void 0 ? void 0 : related.getAttribute(\"data-candelete\")) === \"true\") {\n            delete_icon = document.createElement(\"span\");\n            delete_icon.classList.add(\"uuw-delete-icon\");\n            delete_icon.innerHTML = DeleteIcon_1.default;\n        }\n        if (this.canPreview) {\n            const span = document.createElement(\"span\");\n            span.classList.add(\"uuw-preview-icon\");\n            if ((related === null || related === void 0 ? void 0 : related.getAttribute(\"data-candelete\")) !== \"true\") {\n                span.classList.add(\"uuw-only-preview\");\n            }\n            span.innerHTML = PreviewIcon_1.default;\n            this.element.appendChild(span);\n        }\n        const video = document.createElement(\"video\");\n        video.src = link;\n        this.element.appendChild(video);\n        if (delete_icon) {\n            this.element.appendChild(delete_icon);\n        }\n    }\n    handleClick(e) {\n        if (!e || !e.target) {\n            return;\n        }\n        const target = e.target;\n        const item = target.closest(\".inline-related\");\n        if (target.closest(\".uuw-delete-icon\") && !!this.onDelete) {\n            this.onDelete(this);\n            return;\n        }\n        const fileInput = item === null || item === void 0 ? void 0 : item.querySelector(\"input[type=file]\");\n        if (e.target === fileInput) {\n            return;\n        }\n        fileInput === null || fileInput === void 0 ? void 0 : fileInput.click();\n    }\n    handleInputChange(e) {\n        var _a;\n        if (!e || !e.target || e.target.tagName !== \"INPUT\") {\n            return;\n        }\n        const fileInput = e.target;\n        var files = fileInput.files;\n        if (!(files === null || files === void 0 ? void 0 : files.length)) {\n            return;\n        }\n        const videoTag = (_a = fileInput\n            .closest(\".inline-related\")) === null || _a === void 0 ? void 0 : _a.querySelector(\"video\");\n        if (videoTag) {\n            videoTag.src = URL.createObjectURL(files[0]);\n        }\n    }\n}\nexports.EditorVideo = EditorVideo;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/Inline/Video/EditorVideo.ts?");

/***/ }),

/***/ "./src/PreviewModal/PreviewModal.ts":
/*!******************************************!*\
  !*** ./src/PreviewModal/PreviewModal.ts ***!
  \******************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.PreviewModal = void 0;\nconst ts_pdf_1 = __webpack_require__(/*! ts-pdf */ \"./node_modules/ts-pdf/dist/ts-pdf.esm.js\");\nconst finder_1 = __webpack_require__(/*! @medv/finder */ \"./node_modules/@medv/finder/finder.js\");\nexports.PreviewModal = {\n    openPreviewModal: () => {\n        const modal = document.getElementById(\"uuw-modal-element\");\n        if (!modal) {\n            return;\n        }\n        setTimeout(() => {\n            modal.classList.add(\"visible\");\n            modal.classList.remove(\"hide\");\n            document.body.style.overflow = \"hidden\";\n        }, 50);\n    },\n    closePreviewModal: () => {\n        document.body.style.overflow = \"auto\";\n        const modal = document.getElementById(\"uuw-modal-element\");\n        if (modal) {\n            modal.classList.remove(\"visible\");\n            modal.classList.add(\"hide\");\n            setTimeout(() => {\n                var _a;\n                (_a = modal.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(modal);\n            }, 300);\n        }\n    },\n    onModalClick: (e) => {\n        if (e && e.target) {\n            const element = e.target;\n            if (element.closest(\"img.uuw-modal-file-preview-item, div.uuw-modal-file-preview-item\")) {\n                return;\n            }\n        }\n        exports.PreviewModal.closePreviewModal();\n    },\n    createPreviewModal: (file) => {\n        file.className = \"\";\n        file.classList.add(\"uuw-modal-file-preview-item\");\n        const modal = document.createElement(\"div\");\n        modal.id = \"uuw-modal-element\";\n        modal.classList.add(\"uuw-modal\", \"hide\");\n        modal.addEventListener(\"click\", exports.PreviewModal.onModalClick);\n        const preview = document.createElement(\"div\");\n        preview.classList.add(\"uuw-modal-file-preview\");\n        preview.innerHTML =\n            '<span class=\"uuw-modal-close\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" width=\"100%\" height=\"100%\"><path xmlns=\"http://www.w3.org/2000/svg\" d=\"m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z\"></path></svg></span>';\n        preview.appendChild(file);\n        modal.appendChild(preview);\n        document.body.appendChild(modal);\n        return modal;\n    },\n    createPdfPreviewModal: (url) => __awaiter(void 0, void 0, void 0, function* () {\n        const file = document.createElement(\"div\");\n        file.classList.add(\"uuw-modal-file-preview-item\");\n        file.classList.add(\"uuw-modal-pdf-preview-item\");\n        const modal = document.createElement(\"div\");\n        modal.id = \"uuw-modal-element\";\n        modal.classList.add(\"uuw-modal\", \"hide\");\n        modal.addEventListener(\"click\", exports.PreviewModal.onModalClick);\n        const preview = document.createElement(\"div\");\n        preview.classList.add(\"uuw-modal-file-preview\");\n        preview.innerHTML =\n            '<span class=\"uuw-modal-close\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" width=\"100%\" height=\"100%\"><path xmlns=\"http://www.w3.org/2000/svg\" d=\"m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z\"></path></svg></span>';\n        preview.appendChild(file);\n        modal.appendChild(preview);\n        document.body.appendChild(modal);\n        const options = {\n            containerSelector: (0, finder_1.finder)(file),\n            workerSource: \"/static/admin/vendor/pdf.worker.min.js\",\n            fileButtons: [],\n            disabledModes: [\"hand\", \"annotation\", \"comparison\"],\n        };\n        const viewer = new ts_pdf_1.TsPdfViewer(options);\n        yield viewer.openPdfAsync(url).then(() => {\n            var _a;\n            let style = document.createElement(\"style\");\n            style.innerHTML = `\n          #viewer { top: 0 !important; }\n          .page-container {\n              margin-top: 0 !important;\n          }\n  \n          #top-panel {\n              display: none !important;\n          }  \n\n          #rotator {\n            display: none !important;\n          }\n      `;\n            (_a = file.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(style);\n        });\n        return modal;\n    }),\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/PreviewModal/PreviewModal.ts?");

/***/ }),

/***/ "./src/PreviewModal/index.ts":
/*!***********************************!*\
  !*** ./src/PreviewModal/index.ts ***!
  \***********************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";
eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n    if (k2 === undefined) k2 = k;\n    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n    if (k2 === undefined) k2 = k;\n    o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n    for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n__exportStar(__webpack_require__(/*! ./PreviewModal */ \"./src/PreviewModal/PreviewModal.ts\"), exports);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/PreviewModal/index.ts?");

/***/ }),

/***/ "./src/UniversalUploaderInline.ts":
/*!****************************************!*\
  !*** ./src/UniversalUploaderInline.ts ***!
  \****************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Editor_1 = __webpack_require__(/*! ./Inline/Image/Editor */ \"./src/Inline/Image/Editor.ts\");\nconst Editor_2 = __webpack_require__(/*! ./Inline/Audio/Editor */ \"./src/Inline/Audio/Editor.ts\");\nconst Editor_3 = __webpack_require__(/*! ./Inline/Video/Editor */ \"./src/Inline/Video/Editor.ts\");\n// import { PdfUploaderInline } from \"./Inline/Pdf/Editor\";\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n    Array.from(document.querySelectorAll(\".uuw-inline-root\")).map((element) => {\n        if (element.classList.contains(\"uuw-image\")) {\n            return new Editor_1.ImageUploaderInline(element);\n        }\n        else if (element.classList.contains(\"uuw-audio\")) {\n            return new Editor_2.AudioUploaderInline(element);\n        }\n        else if (element.classList.contains(\"uuw-video\")) {\n            return new Editor_3.VideoUploaderInline(element);\n        }\n    });\n});\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./src/UniversalUploaderInline.ts?");

/***/ }),

/***/ "./node_modules/ts-pdf/dist/ts-pdf.esm.js":
/*!************************************************!*\
  !*** ./node_modules/ts-pdf/dist/ts-pdf.esm.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"AnnotEvent\": () => (/* binding */ AnnotEvent),\n/* harmony export */   \"TsPdfViewer\": () => (/* binding */ TsPdfViewer)\n/* harmony export */ });\n/* harmony import */ var pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! pdfjs-dist */ \"./node_modules/pdfjs-dist/build/pdf.js\");\n/* harmony import */ var pdfjs_dist__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var mathador__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mathador */ \"./node_modules/mathador/dist/index.esm.min.js\");\n/* harmony import */ var ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ts-viewers-core */ \"./node_modules/ts-viewers-core/dist/ts-viewers-core.esm.js\");\n/* harmony import */ var pako__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! pako */ \"./node_modules/pako/dist/pako.esm.mjs\");\n/* harmony import */ var crypto_es__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! crypto-es */ \"./node_modules/crypto-es/lib/index.js\");\n/**\n * ts-pdf (a PDF.js-based PDF viewer written in TypeScript)\n * Copyright (C) 2021-present Volodymyr Yermolenko (yermolim@gmail.com), Chemproject PJSC\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published\n * by the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Affero General Public License for more details.\n * \n * You should have received a copy of the GNU Affero General Public License\n * along with this program.  If not, see <https://www.gnu.org/licenses/>.\n * \n * You can be released from the requirements of the license by purchasing\n * a commercial license. Buying such a license is mandatory as soon as you\n * develop commercial activities involving this program without\n * disclosing the source code of your own applications.\n *\n * -//-//-//-//-//-//-//-//-//-//-//-//-//-//-\n * \n * FlateStream class is based on the corresponding one from PDF.js,\n * so the code of that class is also subject to the next license notice:\n * \n * Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Copyright 1996-2003 Glyph & Cog, LLC\n * \n * The flate stream implementation contained in this file is a JavaScript port\n * of XPDF's implementation, made available under the Apache 2.0 open source\n * license.\n *\n * -//-//-//-//-//-//-//-//-//-//-//-//-//-//-\n */\n\n\n\n\n\n\n\nconst mainHtml = `\r\n  <div id=\"main-container\" tabindex=\"0\" class=\"hide-previewer disabled\" \r\n    ondragstart=\"return false;\" ondrop=\"return false;\">\r\n    <div id=\"viewer\"></div>\r\n    <div id=\"previewer\"></div>\r\n    <div id=\"top-panel\"> \r\n      <div class=\"subpanel panel-item\">\r\n        <div id=\"toggle-previewer\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_sidebar}\"/>\r\n        </div> \r\n      </div>\r\n      <div id=\"modes\" class=\"subpanel panel-item\">\r\n        <div id=\"button-mode-text\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_caret}\"/>\r\n        </div> \r\n        <div id=\"button-mode-hand\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_hand}\"/>\r\n        </div> \r\n        <div id=\"button-mode-annotation\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_popup}\"/>\r\n        </div> \r\n        <div id=\"button-mode-comparison\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_compare}\"/>\r\n        </div> \r\n        <div class=\"panel-v-separator margin-s-5 panel-item\"></div>\r\n        <div id=\"button-open-file\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_load}\"/>\r\n        </div> \r\n        <div id=\"button-save-file\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_download}\"/>\r\n        </div> \r\n        <div id=\"button-close-file\" class=\"panel-button panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close2}\"/>\r\n        </div> \r\n      </div>\r\n    </div>\r\n    <div id=\"bottom-panel\">\r\n      <div id=\"paginator\" class=\"subpanel panel-item\">\r\n        <div id=\"paginator-prev\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_arrow_up}\"/>\r\n        </div>\r\n        <div id=\"paginator-next\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_arrow_down}\"/>\r\n        </div>\r\n        <input id=\"paginator-input\" type=\"text\">\r\n        <span>&nbsp/&nbsp</span>\r\n        <span id=\"paginator-total\">0</span>\r\n      </div>\r\n      <div class=\"panel-v-separator panel-item\"></div>\r\n      <div id=\"rotator\" class=\"subpanel panel-item\">\r\n        <div id=\"rotate-counter-clockwise\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_counter_clockwise}\"/>\r\n        </div>\r\n        <div id=\"rotate-clockwise\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_clockwise}\"/>\r\n        </div>\r\n      </div>\r\n      <div class=\"panel-v-separator panel-item\"></div>\r\n      <div id=\"zoomer\" class=\"subpanel panel-item\">\r\n        <div id=\"zoom-out\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_minus}\"/>\r\n        </div>\r\n        <div id=\"zoom-in\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_plus}\"/>\r\n        </div>\r\n        <div id=\"zoom-fit-viewer\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_fit_viewer}\"/>\r\n        </div>\r\n        <div id=\"zoom-fit-page\" class=\"panel-button\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_fit_page}\"/>\r\n        </div>\r\n      </div>\r\n    </div>\r\n    <div id=\"command-panel\">\r\n      <div class=\"command-panel-row\">\r\n        <div id=\"button-command-comparison-close\" \r\n          class=\"panel-button command-panel-subitem accent\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close2}\"/>\r\n        </div>\r\n        <div id=\"button-command-comparison-open\" \r\n          class=\"panel-button command-panel-subitem accent\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_load}\"/>\r\n        </div>\r\n        <div id=\"button-command-undo\" \r\n          class=\"panel-button command-panel-subitem accent\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_back}\"/>\r\n        </div>\r\n      </div>      \r\n    </div>\r\n    <div id=\"annotation-panel\">\r\n      <div class=\"annotation-panel-row\">\r\n        <div id=\"button-annotation-edit-text\" \r\n          class=\"panel-button annotation-panel-subitem\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_text}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-delete\" \r\n          class=\"panel-button annotation-panel-subitem\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-mode-select\" \r\n          class=\"panel-button annotation-panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_pointer}\"/>\r\n        </div> \r\n      </div>\r\n      <div class=\"annotation-panel-row\">\r\n        <div id=\"button-annotation-stamp-undo\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-undo\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_back}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-stamp-clear\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-clear\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div>\r\n        <div id=\"button-annotation-stamp-save\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-save\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_ok}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-mode-stamp\" \r\n          class=\"panel-button annotation-panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_stamp}\"/>\r\n        </div> \r\n      </div>\r\n      <div class=\"annotation-panel-row\">\r\n        <div id=\"button-annotation-pen-undo\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-undo\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_back}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-pen-clear\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-clear\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-pen-save\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-save\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_ok}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-mode-pen\" \r\n          class=\"panel-button annotation-panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_pen}\"/>\r\n        </div> \r\n      </div>\r\n      <div class=\"annotation-panel-row\">\r\n        <div id=\"button-annotation-geometric-undo\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-undo\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_back}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-geometric-clear\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-clear\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-geometric-save\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-save\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_ok}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-mode-geometric\" \r\n          class=\"panel-button annotation-panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_geometric}\"/>\r\n        </div>\r\n      </div>\r\n      <div class=\"annotation-panel-row\">\r\n        <div id=\"button-annotation-text-undo\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-undo\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_back}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-text-clear\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-clear\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-text-save\" \r\n          class=\"panel-button annotation-panel-subitem button-annotation-save\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_ok}\"/>\r\n        </div> \r\n        <div id=\"button-annotation-mode-text\" \r\n          class=\"panel-button annotation-panel-item\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_text2}\"/>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div id=\"focused-annotation-panel\">\r\n      <p id=\"focused-annotation-author\" class=\"line-clamp\"></p>\r\n      <p id=\"focused-annotation-date\" class=\"line-clamp\"></p>\r\n      <p id=\"focused-annotation-text\" class=\"line-clamp\"></p>\r\n    </div>\r\n\r\n    <input id=\"open-file-input\" class=\"abs-hidden\" type=\"file\" accept=\"application/pdf\">\r\n    <input id=\"open-comparable-file-input\" class=\"abs-hidden\" type=\"file\" accept=\"application/pdf\">\r\n  </div>\r\n`;\r\nconst passwordDialogHtml = `\r\n  <div class=\"abs-full-size-overlay password-dialog\">\r\n    <div class=\"form\">\r\n      <input class=\"password-input\" type=\"password\" maxlength=\"127\"/>\r\n      <div class=\"buttons\">\r\n        <div class=\"panel-button password-ok\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_ok}\"/>\r\n        </div>\r\n        <div class=\"panel-button password-cancel\">\r\n          <img src=\"${ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.icon_close}\"/>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  </div>\r\n`;\n\nconst appName = \"tspdf\";\r\nconst styles = `\r\n<style>\r\n  ${(0,ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.getCommonStyles)(appName)}\r\n  \r\n  #bottom-panel {\r\n    left: calc(50% - 200px);\r\n    width: 400px;\r\n  }\r\n  .compact #bottom-panel {  \r\n    left: calc(50% - 160px);  \r\n    width: 320px;\r\n  }\r\n\r\n  #viewer {\r\n    justify-content: flex-start;\r\n  }\r\n\r\n  #paginator-input {\r\n    text-align: center; \r\n    font-size: 16px;\r\n    width: 30px;\r\n    height: 30px;\r\n    margin: 2px;\r\n    padding: 0;\r\n    outline: none;\r\n    border: none;\r\n    color: var(--${appName}-color-fg-primary-final);\r\n    background-color: var(--${appName}-color-primary-final);\r\n  }\r\n  #paginator-total {\r\n    margin: 4px;\r\n  }\r\n\r\n  .page-container {\r\n    margin: 10px auto;\r\n  }  \r\n  \r\n  .page-text {\r\n    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    margin: 0;\r\n    padding: 0;\r\n    overflow: hidden;\r\n    line-height: 1;\r\n  }\r\n  .page-text span {\r\n    cursor: text;\r\n    position: absolute;\r\n    white-space: pre;\r\n    color: transparent;\r\n    transform-origin: 0% 0%;\r\n  }\r\n  .page-text ::selection {\r\n    background: var(--${appName}-color-text-selection-final);\r\n  }\r\n  .mode-hand .page-text span {\r\n    cursor: grab;\r\n  }\r\n  .dummy-corner {    \r\n    position: absolute;\r\n    width: 0;\r\n    height: 0;\r\n  }\r\n  .dummy-corner.bl {\r\n    bottom: 0;\r\n    left: 0;\r\n  }\r\n  .dummy-corner.br {\r\n    bottom: 0;\r\n    right: 0;\r\n  }\r\n  .dummy-corner.tr {\r\n    top: 0;\r\n    right: 0;\r\n  }\r\n  .dummy-corner.tl {\r\n    top: 0;\r\n    left: 0;\r\n  }\r\n\r\n  .password-dialog {\r\n    z-index: 10;\r\n    pointer-events: all !important;\r\n  }\r\n  .password-dialog .form {\r\n    position: absolute;\r\n    display: flex;\r\n    flex-direction: row;\r\n    justify-content: stretch;\r\n    align-items: stretch;\r\n    flex-grow: 0;\r\n    flex-shrink: 0;\r\n    left: calc(50% - 160px);\r\n    top: calc(50% - 25px);\r\n    width: 320px;\r\n    height: 50px;\r\n    background: var(--${appName}-color-primary-tr-final);\r\n    box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n  }\r\n  .password-dialog input {\r\n    width: 220px;\r\n    margin: 10px 0 10px 10px;\r\n    padding: 5px;\r\n    font-size: 16px;\r\n    outline: none;\r\n    border: none;\r\n    color: var(--${appName}-color-fg-primary-final);\r\n    background-color: var(--${appName}-color-primary-final);\r\n  }\r\n  .password-dialog input::placeholder {\r\n    font-size: 14px;\r\n    font-style: italic;\r\n    color: var(--${appName}-color-fg-primary-final);\r\n  }\r\n  .password-dialog .buttons {\r\n    display: flex;\r\n    flex-direction: row;\r\n    justify-content: center;\r\n    align-items: center;\r\n    flex-grow: 1;\r\n    flex-shrink: 1;\r\n    width: 100px;\r\n  }\r\n\r\n  <!-- .mode-hand .page-text {\r\n    visibility: hidden;\r\n  }\r\n  .mode-comparison .page-annotations,\r\n  .mode-comparison .page-text {\r\n    visibility: hidden;\r\n  }\r\n  .mode-text .page-comparison,\r\n  .mode-hand .page-comparison,\r\n  .mode-annotation .page-comparison {\r\n    visibility: hidden;\r\n  } -->\r\n  \r\n  #button-command-comparison-open,\r\n  #button-command-comparison-close {\r\n    position: absolute;\r\n    right: 0;\r\n    top: 0;\r\n  }\r\n  :not(.mode-comparison) #button-command-comparison-open,\r\n  .comparison-loaded #button-command-comparison-open,\r\n  :not(.comparison-loaded) #button-command-comparison-close {\r\n    cursor: default;\r\n    opacity: 0;\r\n    transform: scale(0);\r\n    transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n  }\r\n  .mode-comparison:not(.comparison-loaded) #button-command-comparison-open,\r\n  .mode-comparison.comparison-loaded #button-command-comparison-close { \r\n    cursor: pointer;\r\n    opacity: 100;\r\n    transform: scale(1);\r\n    transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n  }\r\n\r\n  .page-comparison {\r\n    width: 0;\r\n    height: 0;\r\n  }\r\n  .page-comparison-areas {\r\n    z-index: 2;\r\n    position: absolute;\r\n    left: 0;\r\n    top: 0;\r\n    width: 100%;\r\n    height: 100%;\r\n  }\r\n  .comparison-area-rect {\r\n    stroke: red;\r\n    stroke-width: 3px;\r\n    fill: none;\r\n  }\r\n  .comparison-area-image {\r\n    opacity: 0;\r\n  }\r\n  .transparent .comparison-area-image {\r\n    opacity: 0.5;\r\n  }\r\n  .opaque .comparison-area-image {\r\n    opacity: 1;\r\n  }\r\n\r\n</style>\r\n`;\n\nfunction getNextNode(node) {\r\n    if (node.hasChildNodes()) {\r\n        return node.firstChild;\r\n    }\r\n    else {\r\n        while (node && !node.nextSibling) {\r\n            node = node.parentNode;\r\n        }\r\n        if (!node) {\r\n            return null;\r\n        }\r\n        return node.nextSibling;\r\n    }\r\n}\r\nfunction getRangeNodes(range) {\r\n    let node = range.startContainer;\r\n    const endNode = range.endContainer;\r\n    if (node === endNode) {\r\n        return [node];\r\n    }\r\n    const rangeNodes = [];\r\n    while (node && node !== endNode) {\r\n        rangeNodes.push(node = getNextNode(node));\r\n    }\r\n    node = range.startContainer;\r\n    while (node && node !== range.commonAncestorContainer) {\r\n        rangeNodes.unshift(node);\r\n        node = node.parentNode;\r\n    }\r\n    return rangeNodes;\r\n}\r\nfunction getSelectionInfosFromRangeSpans(range) {\r\n    var _a;\r\n    const textNodes = getRangeNodes(range).filter(x => x.nodeType === 3);\r\n    const selectionInfos = [];\r\n    for (let i = 0; i < textNodes.length; i++) {\r\n        const node = textNodes[i];\r\n        const textContent = node.textContent;\r\n        if (!textContent) {\r\n            continue;\r\n        }\r\n        const textLength = ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length) || 0;\r\n        let startOffset = 0;\r\n        let endOffset = textLength;\r\n        if (i === 0) {\r\n            startOffset = range.startOffset;\r\n        }\r\n        if (i === textNodes.length - 1) {\r\n            endOffset = range.endOffset;\r\n        }\r\n        const text = textContent.slice(startOffset, endOffset);\r\n        if (!text) {\r\n            continue;\r\n        }\r\n        const parent = node.parentElement;\r\n        if (!parent || parent.tagName.toLowerCase() !== \"span\") {\r\n            continue;\r\n        }\r\n        const dummies = parent.querySelectorAll(\".dummy-corner\");\r\n        if (dummies.length !== 4) {\r\n            continue;\r\n        }\r\n        const spanBlVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const spanBrVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const spanTrVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const spanTlVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        dummies.forEach(dummy => {\r\n            const { x, y } = dummy.getBoundingClientRect();\r\n            if (dummy.classList.contains(\"bl\")) {\r\n                spanBlVec.set(x, y);\r\n            }\r\n            else if (dummy.classList.contains(\"br\")) {\r\n                spanBrVec.set(x, y);\r\n            }\r\n            else if (dummy.classList.contains(\"tr\")) {\r\n                spanTrVec.set(x, y);\r\n            }\r\n            else if (dummy.classList.contains(\"tl\")) {\r\n                spanTlVec.set(x, y);\r\n            }\r\n        });\r\n        const startOffsetRelative = startOffset / textLength;\r\n        const endOffsetRelative = endOffset / textLength;\r\n        const spanBottomVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(spanBrVec, spanBlVec);\r\n        const spanTopVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(spanTrVec, spanTlVec);\r\n        const selectionBlVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(spanBlVec, mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(spanBottomVec, startOffsetRelative));\r\n        const selectionBrVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(spanBlVec, mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(spanBottomVec, endOffsetRelative));\r\n        const selectionTrVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(spanTlVec, mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(spanTopVec, endOffsetRelative));\r\n        const selectionTlVec = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(spanTlVec, mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(spanTopVec, startOffsetRelative));\r\n        selectionInfos.push({\r\n            text,\r\n            bottomLeft: selectionBlVec,\r\n            bottomRight: selectionBrVec,\r\n            topRight: selectionTrVec,\r\n            topLeft: selectionTlVec,\r\n        });\r\n    }\r\n    return selectionInfos;\r\n}\r\nfunction getSelectionInfosFromSelection(selection) {\r\n    const selectionRange = selection.getRangeAt(0);\r\n    return getSelectionInfosFromRangeSpans(selectionRange);\r\n}\n\nvar __awaiter$1m = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageTextView {\r\n    constructor(pageProxy) {\r\n        this.onPointerDown = (e) => {\r\n            var _a;\r\n            if (this._divModeTimer) {\r\n                clearTimeout(this._divModeTimer);\r\n                this._divModeTimer = null;\r\n            }\r\n            (_a = this._renderTask) === null || _a === void 0 ? void 0 : _a.expandTextDivs(true);\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            this._divModeTimer = setTimeout(() => {\r\n                var _a;\r\n                (_a = this._renderTask) === null || _a === void 0 ? void 0 : _a.expandTextDivs(false);\r\n                this._divModeTimer = null;\r\n            }, 300);\r\n        };\r\n        if (!pageProxy) {\r\n            throw new Error(\"Page proxy is not defined\");\r\n        }\r\n        this._pageProxy = pageProxy;\r\n        this._container = document.createElement(\"div\");\r\n        this._container.classList.add(\"page-text\");\r\n        this._container.addEventListener(\"pointerdown\", this.onPointerDown);\r\n        this._container.addEventListener(\"pointerup\", this.onPointerUp);\r\n    }\r\n    static appendPageTextAsync(pageProxy, parent, scale) {\r\n        return __awaiter$1m(this, void 0, void 0, function* () {\r\n            const textObj = new PageTextView(pageProxy);\r\n            try {\r\n                const result = yield textObj.renderTextLayerAsync(scale);\r\n                if (!result || textObj._destroyed) {\r\n                    return null;\r\n                }\r\n            }\r\n            catch (e) {\r\n                console.error(e);\r\n                return null;\r\n            }\r\n            parent.append(textObj._container);\r\n            return textObj;\r\n        });\r\n    }\r\n    destroy() {\r\n        this.remove();\r\n        this._container = null;\r\n        this._destroyed = true;\r\n    }\r\n    remove() {\r\n        this.destroyRenderTask();\r\n        if (this._container) {\r\n            this._container.remove();\r\n        }\r\n    }\r\n    renderTextLayerAsync(scale) {\r\n        return __awaiter$1m(this, void 0, void 0, function* () {\r\n            this.destroyRenderTask();\r\n            this.clear();\r\n            const viewport = this._pageProxy.getViewport({ scale });\r\n            const textContentStream = this._pageProxy.streamTextContent();\r\n            this._renderTask = (0,pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__.renderTextLayer)({\r\n                container: this._container,\r\n                textContentStream,\r\n                viewport,\r\n                enhanceTextSelection: false,\r\n            });\r\n            try {\r\n                yield this._renderTask.promise;\r\n            }\r\n            catch (error) {\r\n                if (error.message === \"TextLayer task cancelled.\") {\r\n                    return false;\r\n                }\r\n                else {\r\n                    throw error;\r\n                }\r\n            }\r\n            const spans = this._container.querySelectorAll(\"span\");\r\n            spans.forEach(x => {\r\n                const blCornerSpan = document.createElement(\"span\");\r\n                blCornerSpan.classList.add(\"dummy-corner\", \"bl\");\r\n                const brCornerSpan = document.createElement(\"span\");\r\n                brCornerSpan.classList.add(\"dummy-corner\", \"br\");\r\n                const trCornerSpan = document.createElement(\"span\");\r\n                trCornerSpan.classList.add(\"dummy-corner\", \"tr\");\r\n                const tlCornerSpan = document.createElement(\"span\");\r\n                tlCornerSpan.classList.add(\"dummy-corner\", \"tl\");\r\n                x.append(blCornerSpan, brCornerSpan, trCornerSpan, tlCornerSpan);\r\n            });\r\n            return true;\r\n        });\r\n    }\r\n    clear() {\r\n        this._container.innerHTML = \"\";\r\n    }\r\n    destroyRenderTask() {\r\n        if (this._renderTask) {\r\n            this._renderTask.cancel();\r\n            this._renderTask = null;\r\n        }\r\n    }\r\n}\n\nconst maxGeneration = 65535;\r\nconst objectTypes = {\r\n    UNKNOWN: 0,\r\n    NULL: 1,\r\n    BOOLEAN: 2,\r\n    NUMBER: 3,\r\n    STRING_LITERAL: 4,\r\n    STRING_HEX: 5,\r\n    NAME: 6,\r\n    ARRAY: 7,\r\n    DICTIONARY: 8,\r\n    STREAM: 9,\r\n};\r\nconst valueTypes = {\r\n    UNKNOWN: 0,\r\n    NULL: 1,\r\n    BOOLEAN: 2,\r\n    NUMBER: 3,\r\n    STRING_LITERAL: 4,\r\n    STRING_HEX: 5,\r\n    NAME: 6,\r\n    ARRAY: 7,\r\n    DICTIONARY: 8,\r\n    STREAM: 9,\r\n    REF: 10,\r\n    COMMENT: 11,\r\n};\r\nconst dictTypes = {\r\n    XREF: \"/XRef\",\r\n    XOBJECT: \"/XObject\",\r\n    CATALOG: \"/Catalog\",\r\n    PAGE_TREE: \"/Pages\",\r\n    PAGE: \"/Page\",\r\n    ANNOTATION: \"/Annot\",\r\n    BORDER_STYLE: \"/Border\",\r\n    OPTIONAL_CONTENT_GROUP: \"/OCG\",\r\n    OPTIONAL_CONTENT_MD: \"/OCMD\",\r\n    EXTERNAL_DATA: \"/ExDATA\",\r\n    ACTION: \"/Action\",\r\n    MEASURE: \"/Measure\",\r\n    DEV_EXTENSIONS: \"/DeveloperExtensions\",\r\n    GRAPHICS_STATE: \"/ExtGState\",\r\n    CRYPT_FILTER: \"/CryptFilter\",\r\n    SOFT_MASK: \"/Mask\",\r\n    GROUP: \"/Group\",\r\n    FONT: \"/Font\",\r\n    FONT_DESCRIPTOR: \"/FontDescriptor\",\r\n    ENCODING: \"/Encoding\",\r\n    EMPTY: \"\",\r\n};\r\nconst xRefTypes = {\r\n    TABLE: 0,\r\n    STREAM: 1,\r\n    HYBRID: 2,\r\n};\r\nconst xRefEntryTypes = {\r\n    FREE: 0,\r\n    NORMAL: 1,\r\n    COMPRESSED: 2,\r\n};\r\nconst streamFilters = {\r\n    ASCII85: \"/ASCII85Decode\",\r\n    ASCIIHEX: \"/ASCIIHexDecode\",\r\n    CCF: \"/CCITTFaxDecode\",\r\n    CRYPT: \"/Crypt\",\r\n    DCT: \"/DCTDecode\",\r\n    FLATE: \"/FlateDecode\",\r\n    JBIG2: \"/JBIG2Decode\",\r\n    JPX: \"/JPXDecode\",\r\n    LZW: \"/LZWDecode\",\r\n    RLX: \"/RunLengthDecode\",\r\n};\r\nconst flatePredictors = {\r\n    NONE: 1,\r\n    TIFF: 2,\r\n    PNG_NONE: 10,\r\n    PNG_SUB: 11,\r\n    PNG_UP: 12,\r\n    PNG_AVERAGE: 13,\r\n    PNG_PAETH: 14,\r\n    PNG_OPTIMUM: 15,\r\n};\r\nconst streamTypes = {\r\n    XREF: \"/XRef\",\r\n    OBJECT_STREAM: \"/ObjStm\",\r\n    FORM_XOBJECT: \"/XObject\",\r\n    METADATA_STREAM: \"/Metadata\",\r\n};\r\nconst supportedFilters = new Set([\r\n    streamFilters.FLATE,\r\n    streamFilters.DCT,\r\n    streamFilters.JBIG2,\r\n    streamFilters.JPX,\r\n]);\r\nconst cryptVersions = {\r\n    RC4_40: 1,\r\n    RC4_128: 2,\r\n    AES_128: 4,\r\n    AES_256: 5,\r\n};\r\nconst cryptRevisions = {\r\n    RC4_40: 2,\r\n    RC4_128: 3,\r\n    AES_128: 4,\r\n    AES_256: 5,\r\n    AES_256_V2: 6,\r\n};\r\nconst cryptMethods = {\r\n    NONE: \"/None\",\r\n    RC4: \"/V2\",\r\n    AES_128: \"/AESV2\",\r\n    AES_256: \"/AESV3\",\r\n};\r\nconst authEvents = {\r\n    DOC_OPEN: \"/DocOpen\",\r\n    EMBEDDED_OPEN: \"/EFOpen\",\r\n};\r\nconst annotationTypes = {\r\n    TEXT: \"/Text\",\r\n    LINK: \"/Link\",\r\n    FREE_TEXT: \"/FreeText\",\r\n    LINE: \"/Line\",\r\n    SQUARE: \"/Square\",\r\n    CIRCLE: \"/Circle\",\r\n    POLYGON: \"/Polygon\",\r\n    POLYLINE: \"/PolyLine\",\r\n    HIGHLIGHT: \"/Highlight\",\r\n    UNDERLINE: \"/Underline\",\r\n    SQUIGGLY: \"/Squiggly\",\r\n    STRIKEOUT: \"/StrikeOut\",\r\n    STAMP: \"/Stamp\",\r\n    CARET: \"/Caret\",\r\n    INK: \"/Ink\",\r\n    POPUP: \"/Popup\",\r\n    FILE_ATTACHMENT: \"/FileAttachment\",\r\n    SOUND: \"/Sound\",\r\n    MOVIE: \"/Movie\",\r\n    WIDGET: \"/Widget\",\r\n    SCREEN: \"/Screen\",\r\n    PRINTER_MARK: \"/PrinterMark\",\r\n    TRAPNET: \"/TrapNet\",\r\n    WATERMARK: \"/Watermark\",\r\n    THREED: \"/3D\",\r\n    REDACT: \"/Redact\",\r\n    PROJECTION: \"/Projection\",\r\n    RICH_MEDIA: \"/RichMedia\",\r\n};\r\nconst annotationStateModelTypes = {\r\n    MARKED: \"/Marked\",\r\n    REVIEW: \"/Review\",\r\n};\r\nconst annotationMarkedStates = {\r\n    MARKED: \"/Marked\",\r\n    UNMARKED: \"/Unmarked\",\r\n};\r\nconst annotationReviewStates = {\r\n    ACCEPTED: \"/Accepted\",\r\n    REJECTED: \"/Rejected\",\r\n    CANCELLED: \"/Cancelled\",\r\n    COMPLETED: \"/Completed\",\r\n    NONE: \"/None\",\r\n};\r\nconst annotationIconTypes = {\r\n    COMMENT: \"/Comment\",\r\n    KEY: \"/Key\",\r\n    NOTE: \"/Note\",\r\n    HELP: \"/Help\",\r\n    NEW_PARAGRAPH: \"/NewParagraph\",\r\n    PARAGRAPH: \"/Paragraph\",\r\n    INSERT: \"/Insert\",\r\n};\r\nconst freeTextIntents = {\r\n    PLAIN_TEXT: \"/FreeText\",\r\n    WITH_CALLOUT: \"/FreeTextCallout\",\r\n    CLICK_TO_TYPE: \"/FreeTextTypeWriter\",\r\n};\r\nconst markupAnnotationReplyTypes = {\r\n    REPLY: \"/R\",\r\n    GROUP: \"/Group\",\r\n};\r\nconst stampTypes = {\r\n    DRAFT: \"/Draft\",\r\n    NOT_APPROVED: \"/NotApproved\",\r\n    APPROVED: \"/Approved\",\r\n    AS_IS: \"/AsIs\",\r\n    FOR_COMMENT: \"/ForComment\",\r\n    EXPERIMENTAL: \"/Experimental\",\r\n    FINAL: \"/Final\",\r\n    SOLD: \"/Sold\",\r\n    EXPIRED: \"/Expired\",\r\n    PUBLIC: \"/ForPublicRelease\",\r\n    NOT_PUBLIC: \"/NotForPublicRelease\",\r\n    DEPARTMENTAL: \"/Departmental\",\r\n    CONFIDENTIAL: \"/Confidential\",\r\n    SECRET: \"/TopSecret\",\r\n};\r\nconst polyIntents = {\r\n    CLOUD: \"/PolygonCloud\",\r\n    POLYGON_DIMENSION: \"/PolygonDimension\",\r\n    POLYLINE_DIMENSION: \"/PolyLineDimension\",\r\n};\r\nconst lineIntents = {\r\n    ARROW: \"/LineArrow\",\r\n    DIMENSION: \"/LineDimension\",\r\n};\r\nconst lineCaptionPositions = {\r\n    INLINE: \"/Inline\",\r\n    TOP: \"/Top\",\r\n};\r\nconst lineEndingTypes = {\r\n    SQUARE: \"/Square\",\r\n    CIRCLE: \"/Circle\",\r\n    DIAMOND: \"/Diamond\",\r\n    ARROW_OPEN: \"/OpenArrow\",\r\n    ARROW_CLOSED: \"/ClosedArrow\",\r\n    NONE: \"/None\",\r\n    BUTT: \"/Butt\",\r\n    ARROW_OPEN_R: \"/ROpenArrow\",\r\n    ARROW_CLOSED_R: \"/RClosedArrow\",\r\n    SLASH: \"/Slash\",\r\n};\r\nconst lineCapStyles = {\r\n    BUTT: 0,\r\n    ROUND: 1,\r\n    SQUARE: 2,\r\n};\r\nconst lineJoinStyles = {\r\n    MITER: 0,\r\n    ROUND: 1,\r\n    BEVEL: 2,\r\n};\r\nconst justificationTypes = {\r\n    LEFT: 0,\r\n    CENTER: 1,\r\n    RIGHT: 2,\r\n};\r\nconst renderingIntents = {\r\n    ABSOLUTE: \"/AbsoluteColorimetric\",\r\n    RELATIVE: \"/RelativeColorimetric\",\r\n    SATURATION: \"/Saturation\",\r\n    PERCEPTUAL: \"/Perceptual\",\r\n};\r\nconst blendModes = {\r\n    NORMAL: \"/Normal\",\r\n    COMPATIBLE: \"/Compatible\",\r\n    MULTIPLY: \"/Multiply\",\r\n    SCREEN: \"/Screen\",\r\n    OVERLAY: \"/Overlay\",\r\n    DARKEN: \"/Darken\",\r\n    LIGHTEN: \"/Lighten\",\r\n    COLOR_DODGE: \"/ColorDodge\",\r\n    COLOR_BURN: \"/ColorBurn\",\r\n    HARD_LIGHT: \"/HardLight\",\r\n    SOFT_LIGHT: \"/SoftLight\",\r\n    DIFFERENCE: \"/Difference\",\r\n    EXCLUSION: \"/Exclusion\",\r\n};\r\nconst textRenderModes = {\r\n    FILL: 0,\r\n    STROKE: 1,\r\n    FILL_STROKE: 2,\r\n    INVISIBLE: 3,\r\n    FILL_USE_AS_CLIP: 4,\r\n    STROKE_USE_AS_CLIP: 5,\r\n    FILL_STROKE_USE_AS_CLIP: 6,\r\n    USE_AS_CLIP: 7,\r\n};\r\nconst colorSpaces = {\r\n    GRAYSCALE: \"/DeviceGray\",\r\n    RGB: \"/DeviceRGB\",\r\n    CMYK: \"/DeviceCMYK\",\r\n    SPECIAL: \"/DeviceN\",\r\n    SPECIAL_INDEXED: \"/Indexed\",\r\n    SPECIAL_PATTERN: \"/Pattern\",\r\n    SPECIAL_SEPARATION: \"/Separation\",\r\n};\r\nconst softMaskTypes = {\r\n    ALPHA: \"/Alpha\",\r\n    LUMINOSITY: \"/Luminosity\",\r\n};\r\nconst borderEffects = {\r\n    NONE: \"/S\",\r\n    CLOUDY: \"/C\",\r\n};\r\nconst borderStyles = {\r\n    SOLID: \"/S\",\r\n    DASHED: \"/D\",\r\n    BEVELED: \"/B\",\r\n    INSET: \"/I\",\r\n    UNDERLINE: \"/U\",\r\n    NONE: \"/N\",\r\n};\r\nconst groupDictTypes = {\r\n    TRANSPARENCY: \"/Transparency\",\r\n};\n\nconst workerSrc = `\r\n/**the most used char codes from the ASCII set */\r\nconst codes = {\r\n  NULL: 0,\r\n  BACKSPACE: 8,\r\n  HORIZONTAL_TAB: 9,\r\n  LINE_FEED: 10,\r\n  VERTICAL_TAB: 11,\r\n  FORM_FEED: 12,\r\n  CARRIAGE_RETURN: 13,\r\n  WHITESPACE: 32,\r\n  EXCLAMATION_MARK: 33,\r\n  DOUBLE_QUOTE: 34,\r\n  HASH: 35,\r\n  DOLLAR: 36,\r\n  PERCENT: 37,\r\n  AMPERSAND: 38,\r\n  QUOTE: 39,\r\n  L_PARENTHESE: 40,\r\n  R_PARENTHESE: 41,\r\n  ASTERISK: 42,\r\n  PLUS: 43,\r\n  COMMA: 44,\r\n  MINUS: 45,\r\n  DOT: 46,\r\n  SLASH: 47,\r\n  D_0: 48,\r\n  D_1: 49,\r\n  D_2: 50,\r\n  D_3: 51,\r\n  D_4: 52,\r\n  D_5: 53,\r\n  D_6: 54,\r\n  D_7: 55,\r\n  D_8: 56,\r\n  D_9: 57,\r\n  COLON: 58,\r\n  SEMICOLON: 59,\r\n  LESS: 60,\r\n  EQUAL: 61,\r\n  GREATER: 62,\r\n  QUESTION_MARK: 63,\r\n  AT: 64,\r\n  A: 65,\r\n  B: 66,\r\n  C: 67,\r\n  D: 68,\r\n  E: 69,\r\n  F: 70,\r\n  G: 71,\r\n  H: 72,\r\n  I: 73,\r\n  J: 74,\r\n  K: 75,\r\n  L: 76,\r\n  M: 77,\r\n  N: 78,\r\n  O: 79,\r\n  P: 80,\r\n  Q: 81,\r\n  R: 82,\r\n  S: 83,\r\n  T: 84,\r\n  U: 85,\r\n  V: 86,\r\n  W: 87,\r\n  X: 88,\r\n  Y: 89,\r\n  Z: 90,\r\n  L_BRACKET: 91,\r\n  BACKSLASH: 92,\r\n  R_BRACKET: 93,\r\n  CARET: 94,\r\n  UNDERSCORE: 95,\r\n  BACKTICK: 96,\r\n  a: 97,\r\n  b: 98,\r\n  c: 99,\r\n  d: 100,\r\n  e: 101,\r\n  f: 102,\r\n  g: 103,\r\n  h: 104,\r\n  i: 105,\r\n  j: 106,\r\n  k: 107,\r\n  l: 108,\r\n  m: 109,\r\n  n: 110,\r\n  o: 111,\r\n  p: 112,\r\n  q: 113,\r\n  r: 114,\r\n  s: 115,\r\n  t: 116,\r\n  u: 117,\r\n  v: 118,\r\n  w: 119,\r\n  x: 120,\r\n  y: 121,\r\n  z: 122,\r\n  L_BRACE: 123,\r\n  VERTICAL_LINE: 124,\r\n  R_BRACE: 125,\r\n  TILDE: 126,\r\n};\r\n\r\n/**char code sequences commonly used in PDF data */\r\nconst keywordCodes = {\r\n  NULL: [codes.n, codes.u, codes.l, codes.l],\r\n\r\n  OBJ: [codes.o, codes.b, codes.j],\r\n  OBJ_END: [codes.e, codes.n, codes.d, codes.o, codes.b, codes.j],\r\n\r\n  STREAM_START: [codes.s, codes.t, codes.r, codes.e, codes.a, codes.m],\r\n  STREAM_END: [codes.e, codes.n, codes.d,\r\n    codes.s, codes.t, codes.r, codes.e, codes.a, codes.m],\r\n\r\n  DICT_START: [codes.LESS, codes.LESS],\r\n  DICT_END: [codes.GREATER, codes.GREATER],\r\n\r\n  ARRAY_START: [codes.L_BRACKET],\r\n  ARRAY_END: [codes.R_BRACKET],\r\n  \r\n  STR_LITERAL_START: [codes.L_PARENTHESE],\r\n  STR_LITERAL_END: [codes.R_PARENTHESE],\r\n\r\n  STR_HEX_START: [codes.LESS],\r\n  STR_HEX_END: [codes.GREATER],\r\n\r\n  VERSION: [codes.PERCENT, codes.P, codes.D, codes.F, codes.MINUS],\r\n\r\n  PREV: [codes.SLASH, codes.P, codes.r, codes.e, codes.v],\r\n  TYPE: [codes.SLASH, codes.T, codes.y, codes.p, codes.e],\r\n  SUBTYPE: [codes.SLASH, codes.S, codes.u, codes.b, codes.t, codes.y, codes.p, codes.e],\r\n  FORM: [codes.SLASH, codes.F, codes.o, codes.r, codes.m],\r\n  \r\n  XREF_TABLE: [codes.x, codes.r, codes.e, codes.f],\r\n  XREF_STREAM: [codes.SLASH, codes.X, codes.R, codes.e, codes.f],\r\n  XREF_HYBRID: [codes.X, codes.R, codes.e, codes.f, codes.S, codes.t, codes.m],\r\n    \r\n  XREF_START: [codes.s, codes.t, codes.a, codes.r, codes.t, \r\n    codes.x, codes.r, codes.e, codes.f],\r\n  TRAILER: [codes.t, codes.r, codes.a, codes.i, codes.l, codes.e, codes.r],\r\n  END_OF_FILE: [codes.PERCENT, codes.PERCENT, codes.E, codes.O, codes.F],\r\n\r\n  END_OF_LINE: [codes.CARRIAGE_RETURN, codes.LINE_FEED],\r\n\r\n  TRUE: [codes.t, codes.r, codes.u, codes.e],\r\n  FALSE: [codes.f, codes.a, codes.l, codes.s, codes.e],\r\n\r\n  CMAP_BEGIN: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n    codes.c, codes.m, codes.a, codes.p],\r\n  CMAP_END: [codes.e, codes.n, codes.d,\r\n    codes.c, codes.m, codes.a, codes.p],\r\n  CMAP_BEGIN_CODE_RANGE: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n    codes.c, codes.o, codes.d, codes.e, codes.s, codes.p, codes.a, codes.c, codes.e,\r\n    codes.r, codes.a, codes.n, codes.g, codes.e],\r\n  CMAP_END_CODE_RANGE: [codes.e, codes.n, codes.d,\r\n    codes.c, codes.o, codes.d, codes.e, codes.s, codes.p, codes.a, codes.c, codes.e,\r\n    codes.r, codes.a, codes.n, codes.g, codes.e],\r\n  CMAP_BEGIN_CHAR: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n    codes.b, codes.f, codes.c, codes.h, codes.a, codes.r],\r\n  CMAP_END_CHAR: [codes.e, codes.n, codes.d,\r\n    codes.b, codes.f, codes.c, codes.h, codes.a, codes.r],\r\n  CMAP_BEGIN_RANGE: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n    codes.b, codes.f, codes.r, codes.a, codes.n, codes.g, codes.e],\r\n  CMAP_END_RANGE: [codes.e, codes.n, codes.d,\r\n    codes.b, codes.f, codes.r, codes.a, codes.n, codes.g, codes.e],\r\n\r\n  AP_STREAM_TEXT_END: [codes.E, codes.T],\r\n};\r\n\r\n/**value types that can be found in PDF file data */\r\nconst valueTypes = {\r\n  UNKNOWN: 0,\r\n  NULL: 1,\r\n  BOOLEAN: 2,\r\n  NUMBER: 3,\r\n  STRING_LITERAL: 4,\r\n  STRING_HEX: 5,\r\n  NAME: 6,\r\n  ARRAY: 7,\r\n  DICTIONARY: 8,\r\n  STREAM: 9,\r\n  REF: 10,\r\n  COMMENT: 11,\r\n};\r\n\r\n//#region static collections\r\n/**\r\n * Each line is terminated by an end-of-line (EOL) marker\r\n */\r\n// const EOL = [\r\n//   codes.CARRIAGE_RETURN, \r\n//   codes.LINE_FEED,\r\n// ];\r\n  \r\n/**\r\n * The delimiter  characters (, ), <, >, [, ], {, }, /,  and  %  are  special.  \r\n * They delimit syntactic entities such as strings, arrays, names, and comments.  \r\n * Any of these characters terminates the entity preceding it and is not included in the entity. \r\n */\r\nconst delimiterChars = new Set([\r\n  codes.PERCENT,\r\n  codes.L_PARENTHESE,\r\n  codes.R_PARENTHESE,\r\n  codes.SLASH,\r\n  codes.LESS,\r\n  codes.GREATER,\r\n  codes.L_BRACKET,\r\n  codes.R_BRACKET,\r\n  codes.L_BRACE,\r\n  codes.R_BRACE,\r\n]);\r\n  \r\n/**\r\n * White-space characters separate syntactic constructs such as names and numbers from each other.  \r\n * All white-space characters are  equivalent, except in comments, strings, and streams. \r\n * In all other contexts, PDF treats any sequence of consecutive white-space characters as one character.\r\n */\r\nconst spaceChars = new Set([\r\n  codes.NULL,\r\n  codes.HORIZONTAL_TAB,\r\n  codes.LINE_FEED,\r\n  codes.FORM_FEED,\r\n  codes.CARRIAGE_RETURN,\r\n  codes.WHITESPACE,\r\n]);\r\n  \r\nconst digitChars = new Set([\r\n  codes.D_0,\r\n  codes.D_1,\r\n  codes.D_2,\r\n  codes.D_3,\r\n  codes.D_4,\r\n  codes.D_5,\r\n  codes.D_6,\r\n  codes.D_7,\r\n  codes.D_8,\r\n  codes.D_9,\r\n]);\r\n\r\nconst newLineChars = new Set([\r\n  codes.CARRIAGE_RETURN,\r\n  codes.LINE_FEED,\r\n]);\r\n//#endregion\r\n\r\n//#region static check functions\r\n/**\r\n * check if the char is not a space char or a delimiter char\r\n * @param code char code\r\n * @returns \r\n */\r\nfunction isRegularChar(code) {\r\n  if (isNaN(code)) {\r\n    return false;\r\n  }\r\n  return !delimiterChars.has(code) && !spaceChars.has(code);\r\n}\r\n\r\n/**\r\n * check if the char is a space char or a delimiter char\r\n * @param code char code\r\n * @returns \r\n */\r\nfunction isNotRegularChar(code) {\r\n  if (isNaN(code)) {\r\n    return true;\r\n  }\r\n  return delimiterChars.has(code) || spaceChars.has(code);\r\n}\r\n\r\nfunction isDigit(code) {\r\n  return digitChars.has(code);\r\n}\r\n\r\nfunction isNewLineChar(code) {\r\n  return newLineChars.has(code);\r\n}\r\n\r\nfunction isSpaceChar(code) {\r\n  return spaceChars.has(code);\r\n}\r\n\r\nfunction isNotSpaceChar(code) {\r\n  return !spaceChars.has(code);\r\n}\r\n\r\nfunction isDelimiterChar(code) {\r\n  return delimiterChars.has(code);\r\n}\r\n\r\nfunction isNotDelimiterChar(code) {\r\n  return !delimiterChars.has(code);\r\n}\r\n//#endregion\r\n\r\nlet _data = new Uint8Array();\r\nlet _maxIndex = 0;\r\n\r\nconst _messageQueue = [];\r\nlet _busy = false;\r\n\r\nself.onmessage = (event) => {\r\n  if (_busy) {\r\n    _messageQueue.push(event);\r\n  } else {\r\n    _busy = true;\r\n    processData(event.data);\r\n  }\r\n};\r\n\r\nfunction sendResponse(response) {\r\n  self.postMessage(response);\r\n  if (_messageQueue.length) {\r\n    processData(_messageQueue.shift().data);\r\n  } else {\r\n    _busy = false;\r\n  }\r\n}\r\n\r\nfunction processData(data) {\r\n  const id = data.id;\r\n  const name = data.name;\r\n\r\n  if (name === \"data-set\") {\r\n    if (data.bytes) {      \r\n      const dataBytesArray = new Uint8Array(data.bytes);\r\n      if (dataBytesArray?.length) {\r\n        _data = dataBytesArray;\r\n        _maxIndex = dataBytesArray.length - 1;\r\n        sendResponse({id, name, type: \"success\"});\r\n        return;\r\n      }\r\n    }\r\n    sendResponse({id, name, type: \"error\", \r\n      message: \"data-set: byte array is null or empty\"});\r\n    return; \r\n  }\r\n  \r\n  if (name === \"data-reset\") {\r\n    const buffer = _data.buffer;\r\n    _data = new Uint8Array();\r\n    _maxIndex = 0;\r\n    sendResponse({id, name, type: \"success\", bytes: buffer}, [buffer]);\r\n    return; \r\n  }\r\n\r\n  // console.log(JSON.stringify(data));\r\n  try {\r\n    let result;\r\n    switch (name) { \r\n    // common cases\r\n    case \"is-outside\":\r\n      result = isOutside(...data.args);\r\n      break;\r\n    case \"is-code-at\":\r\n      result = isCodeAt(...data.args);\r\n      break;\r\n    case \"get-value-type-at\":\r\n      result = getValueTypeAt(...data.args);\r\n      break;\r\n    // search cases\r\n    case \"find-subarray-index\":\r\n      result = findSubarrayIndex(...data.args);\r\n      break;\r\n    case \"find-char-index\":\r\n      result = findCharIndex(...data.args);\r\n      break;\r\n    case \"find-new-line-index\":\r\n      result = findNewLineIndex(...data.args);\r\n      break;\r\n    case \"find-space-index\":result = findSpaceIndex(...data.args);\r\n      break;\r\n    case \"find-non-space-index\":\r\n      result = findNonSpaceIndex(...data.args);\r\n      break;\r\n    case \"find-delimiter-index\":\r\n      result = findDelimiterIndex(...data.args);\r\n      break;\r\n    case \"find-non-delimiter-index\":\r\n      result = findNonDelimiterIndex(...data.args);\r\n      break;\r\n    case \"find-regular-index\":\r\n      result = findRegularIndex(...data.args);\r\n      break;\r\n    case \"find-irregular-index\":\r\n      result = findIrregularIndex(...data.args);\r\n      break;\r\n    // getting bounds cases  \r\n    case \"get-indirect-object-bounds\":\r\n      result = getIndirectObjectBoundsAt(...data.args);\r\n      break;\r\n    case \"get-xref-table-bounds\":\r\n      result = getXrefTableBoundsAt(...data.args);\r\n      break;\r\n    case \"get-dict-bounds\":\r\n      result = getDictBoundsAt(...data.args);\r\n      break;\r\n    case \"get-array-bounds\":\r\n      result = getArrayBoundsAt(...data.args);\r\n      break;\r\n    case \"get-hex-bounds\":\r\n      result = getHexBoundsAt(...data.args);\r\n      break;\r\n    case \"get-literal-bounds\":\r\n      result = getLiteralBoundsAt(...data.args);\r\n      break;\r\n    // parsing cases\r\n    case \"parse-number\":\r\n      result = parseNumberAt(...data.args);\r\n      break;\r\n    case \"parse-name\":\r\n      result = parseNameAt(...data.args);\r\n      break;\r\n    case \"parse-string\":\r\n      result = parseStringAt(...data.args);\r\n      break;\r\n    case \"parse-bool\":\r\n      result = parseBoolAt(...data.args);\r\n      break;\r\n    case \"parse-number-array\":\r\n      result = parseNumberArrayAt(...data.args);\r\n      break;\r\n    case \"parse-name-array\":\r\n      result = parseNameArrayAt(...data.args);\r\n      break;\r\n    case \"parse-dict-type\":\r\n      result = parseDictType(...data.args);\r\n      break;\r\n    case \"parse-dict-subtype\":\r\n      result = parseDictSubtype(...data.args);\r\n      break;\r\n    case \"parse-dict-property-by-name\":\r\n      result = parseDictPropertyByName(...data.args);\r\n      break;\r\n    // skip cases\r\n    case \"skip-empty\":\r\n      result = skipEmptyChars(...data.args);\r\n      break;\r\n    case \"skip-to-next-name\":\r\n      result = skipToNextName(...data.args);\r\n      break;\r\n    // getting char/codes cases\r\n    case \"slice-char-codes\":\r\n      result = sliceCharCodes(...data.args);\r\n      break;\r\n    case \"slice-chars\":\r\n      result = sliceChars(...data.args);\r\n      break;\r\n    case \"get-char-code\":\r\n      result = getCharCode(...data.args);\r\n      break;\r\n    default:\r\n      throw new Error(\"Unknown command name: \" + name);\r\n    }    \r\n    // console.log(JSON.stringify(result));\r\n    sendResponse({id, name, type: \"success\", result});\r\n  } catch (e) {\r\n    // console.log(JSON.stringify(e));\r\n    sendResponse({id, name, type: \"error\", message: e.message});\r\n  }\r\n}\r\n\r\n//#region common functions  \r\nfunction isOutside(index) {\r\n  return (index < 0 || index > _maxIndex);\r\n}\r\n\r\nfunction isCodeAt(index, code) {\r\n  return getCharCode(index) === code;\r\n}\r\n\r\nfunction getValueTypeAt(start, skipEmpty = true)  {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start)) {\r\n    return null;\r\n  }\r\n\r\n  const arr = _data;\r\n  const i = start;\r\n  const charCode = arr[i];\r\n\r\n  let tempIndex;\r\n  switch (charCode) {\r\n  case codes.SLASH:\r\n    if (isRegularChar(arr[i + 1])) {\r\n      return valueTypes.NAME;\r\n    } \r\n    return valueTypes.UNKNOWN;\r\n  case codes.L_BRACKET:\r\n    return valueTypes.ARRAY;\r\n  case codes.L_PARENTHESE:\r\n    return valueTypes.STRING_LITERAL;\r\n  case codes.LESS:\r\n    if (codes.LESS === arr[i + 1]) {          \r\n      return valueTypes.DICTIONARY;\r\n    }\r\n    return valueTypes.STRING_HEX;\r\n  case codes.PERCENT:\r\n    return valueTypes.COMMENT;\r\n  case codes.D_0:\r\n  case codes.D_1:\r\n  case codes.D_2:\r\n  case codes.D_3:\r\n  case codes.D_4:\r\n  case codes.D_5:\r\n  case codes.D_6:\r\n  case codes.D_7:\r\n  case codes.D_8:\r\n  case codes.D_9:\r\n    tempIndex = findDelimiterIndex(true, i + 1);\r\n    if (tempIndex !== -1) {\r\n      const refEndIndex = findCharIndex(codes.R, false, tempIndex - 1);\r\n      if (refEndIndex !== -1 && refEndIndex > i && !isRegularChar(arr[refEndIndex + 1])) {\r\n        return valueTypes.REF;\r\n      }\r\n    }\r\n    return valueTypes.NUMBER;\r\n  case codes.DOT:\r\n  case codes.MINUS:\r\n    if (isDigit(arr[i + 1])) {          \r\n      return valueTypes.NUMBER;\r\n    }\r\n    return valueTypes.UNKNOWN;\r\n  case codes.s:\r\n    if (arr[i + 1] === codes.t\r\n        && arr[i + 2] === codes.r\r\n        && arr[i + 3] === codes.e\r\n        && arr[i + 4] === codes.a\r\n        && arr[i + 5] === codes.m) {\r\n      return valueTypes.STREAM;\r\n    }\r\n    return valueTypes.UNKNOWN;\r\n  case codes.t:\r\n    if (arr[i + 1] === codes.r\r\n        && arr[i + 2] === codes.u\r\n        && arr[i + 3] === codes.e) {\r\n      return valueTypes.BOOLEAN;\r\n    }\r\n    return valueTypes.UNKNOWN;\r\n  case codes.f:\r\n    if (arr[i + 1] === codes.a\r\n        && arr[i + 2] === codes.l\r\n        && arr[i + 3] === codes.s\r\n        && arr[i + 4] === codes.e) {\r\n      return valueTypes.BOOLEAN;\r\n    }\r\n    return valueTypes.UNKNOWN;\r\n  default:\r\n    return valueTypes.UNKNOWN;\r\n  }\r\n} \r\n//#endregion\r\n\r\n//#region search functions\r\nfunction findSubarrayIndex(sub, options) {\r\n  const arr = _data;\r\n  if (!sub?.length) {\r\n    return null;\r\n  }\r\n\r\n  const direction = options?.direction ?? true;\r\n  const minIndex = Math.max(Math.min(options?.minIndex ?? 0, _maxIndex), 0);\r\n  const maxIndex = Math.max(Math.min(options?.maxIndex ?? _maxIndex, _maxIndex), 0);\r\n  const allowOpened = !options?.closedOnly;\r\n\r\n  let i = direction\r\n    ? minIndex\r\n    : maxIndex; \r\n\r\n  let j; \r\n  if (direction) { \r\n    outer_loop:\r\n    for (i; i <= maxIndex; i++) {\r\n      for (j = 0; j < sub.length; j++) {\r\n        if (arr[i + j] !== sub[j]) {\r\n          continue outer_loop;\r\n        }\r\n      }\r\n      if (allowOpened || !isRegularChar(arr[i + j])) {\r\n        return {start: i, end: i + j - 1};\r\n      }\r\n    }\r\n  } else {\r\n    const subMaxIndex = sub.length - 1;\r\n    outer_loop:\r\n    for (i; i >= minIndex; i--) {\r\n      for (j = 0; j < sub.length; j++) {\r\n        if (arr[i - j] !== sub[subMaxIndex - j]) {\r\n          continue outer_loop;\r\n        }\r\n      }\r\n      if (allowOpened || !isRegularChar(arr[i - j])) {\r\n        return {start: i - j + 1, end: i};\r\n      }\r\n    }\r\n  }\r\n\r\n  return null;\r\n}\r\n\r\nfunction findCharIndex(charCode, direction = true, start = undefined) {    \r\n\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n\r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (arr[i] === charCode) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (arr[i] === charCode) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n\r\n  return -1; \r\n}\r\n\r\nfunction findNewLineIndex(direction = true, start = undefined) {\r\n  let lineBreakIndex;     \r\n\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isNewLineChar(arr[i])) {\r\n        lineBreakIndex = i;\r\n        break;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isNewLineChar(arr[i])) {\r\n        lineBreakIndex = i;\r\n        break;\r\n      }\r\n    }\r\n  }\r\n\r\n  if (lineBreakIndex === undefined) {\r\n    return -1;\r\n  }\r\n\r\n  if (direction) {  \r\n    if (_data[lineBreakIndex] === codes.CARRIAGE_RETURN \r\n      && _data[lineBreakIndex + 1] === codes.LINE_FEED) {\r\n      lineBreakIndex++;\r\n    }  \r\n    return Math.min(lineBreakIndex + 1, _maxIndex);\r\n  } else {        \r\n    if (_data[lineBreakIndex] === codes.LINE_FEED \r\n      && _data[lineBreakIndex - 1] === codes.CARRIAGE_RETURN) {\r\n      lineBreakIndex--;\r\n    }  \r\n    return Math.max(lineBreakIndex - 1, 0);\r\n  }\r\n}\r\n\r\nfunction findSpaceIndex(direction = true, start = undefined) {\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isSpaceChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isSpaceChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1;\r\n}\r\n\r\nfunction findNonSpaceIndex(direction = true, start = undefined) {\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isNotSpaceChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isNotSpaceChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1;\r\n}\r\n\r\nfunction findDelimiterIndex(direction = true, start = undefined) {\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isDelimiterChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isDelimiterChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1; \r\n}\r\n\r\nfunction findNonDelimiterIndex(direction = true, start = undefined) {    \r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isNotDelimiterChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isNotDelimiterChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1;\r\n}\r\n\r\nfunction findRegularIndex(direction = true, start = undefined) {\r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isRegularChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isRegularChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1;\r\n}\r\n\r\nfunction findIrregularIndex(direction = true, start = undefined) {  \r\n  const arr = _data;\r\n  let i = isNaN(start)\r\n    ? direction\r\n      ? 0\r\n      : _maxIndex\r\n    : start; \r\n    \r\n  if (direction) {        \r\n    for (i; i <= _maxIndex; i++) {\r\n      if (isNotRegularChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }    \r\n  } else {        \r\n    for (i; i >= 0; i--) {\r\n      if (isNotRegularChar(arr[i])) {\r\n        return i;\r\n      }\r\n    }\r\n  }\r\n  \r\n  return -1;\r\n}\r\n//#endregion\r\n\r\n//#region get bounds functions  \r\nfunction getIndirectObjectBoundsAt(start, skipEmpty = true) {   \r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start)) {\r\n    return null;\r\n  }    \r\n\r\n  const objStartIndex = findSubarrayIndex(keywordCodes.OBJ, \r\n    {minIndex: start, closedOnly: true});\r\n  if (!objStartIndex) {\r\n    return null;\r\n  }      \r\n\r\n  let contentStart = findNonSpaceIndex(true, objStartIndex.end + 1);\r\n  if (contentStart === -1){\r\n    return null;\r\n  }    \r\n  const objEndIndex = findSubarrayIndex(keywordCodes.OBJ_END, \r\n    {minIndex: contentStart, closedOnly: true});\r\n  if (!objEndIndex) {\r\n    return null;\r\n  }\r\n  let contentEnd = findNonSpaceIndex(false, objEndIndex.start - 1);\r\n\r\n  if (getCharCode(contentStart) === codes.LESS\r\n      && getCharCode(contentStart + 1) === codes.LESS\r\n      && getCharCode(contentEnd - 1) === codes.GREATER\r\n      && getCharCode(contentEnd) === codes.GREATER) {\r\n    // object is dict. exclude bounds from content\r\n    contentStart += 2;\r\n    contentEnd -=2;\r\n  }\r\n\r\n  return {\r\n    start: objStartIndex.start, \r\n    end: objEndIndex.end,\r\n    contentStart,\r\n    contentEnd,\r\n  };\r\n} \r\n  \r\nfunction getXrefTableBoundsAt(start, skipEmpty = true) {   \r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || _data[start] !== codes.x) {\r\n    return null;\r\n  }\r\n\r\n  const xrefStart = findSubarrayIndex(keywordCodes.XREF_TABLE, \r\n    {minIndex: start});\r\n  if (!xrefStart) {\r\n    return null;\r\n  }     \r\n  const contentStart = findNonSpaceIndex(true, xrefStart.end + 1);\r\n  if (contentStart === -1){\r\n    return null;\r\n  }   \r\n  const xrefEnd = findSubarrayIndex(keywordCodes.TRAILER, \r\n    {minIndex: xrefStart.end + 1});\r\n  if (!xrefEnd) {\r\n    return null;\r\n  } \r\n  const contentEnd = findNonSpaceIndex(false, xrefEnd.start - 1);\r\n\r\n  if (contentEnd < contentStart) {\r\n    // should be only possible in an empty xref, which is not allowed\r\n    return null;\r\n  }\r\n\r\n  return {\r\n    start: xrefStart.start, \r\n    end: xrefEnd.end,\r\n    contentStart,\r\n    contentEnd,\r\n  };\r\n}\r\n\r\nfunction getDictBoundsAt(start, skipEmpty = true) {   \r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) \r\n      || _data[start] !== codes.LESS\r\n      || _data[start + 1] !== codes.LESS) {\r\n    return null;\r\n  }\r\n     \r\n  const contentStart = findNonSpaceIndex(true, start + 2);\r\n  if (contentStart === -1){\r\n    return null;\r\n  }  \r\n    \r\n  let dictOpened = 1;\r\n  let dictBound = true;\r\n  let literalOpened = 0;\r\n  let i = contentStart;    \r\n  let code;\r\n  let prevCode;\r\n  while (dictOpened) {\r\n    prevCode = code;\r\n    code = _data[i++];\r\n\r\n    if (code === codes.L_PARENTHESE\r\n        && (!literalOpened || prevCode !== codes.BACKSLASH)) {\r\n      // increase string literal nesting\r\n      literalOpened++;\r\n    }\r\n\r\n    if (code === codes.R_PARENTHESE\r\n        && (literalOpened && prevCode !== codes.BACKSLASH)) {\r\n      // decrease string literal nesting\r\n      literalOpened--;\r\n    }\r\n\r\n    if (literalOpened) {\r\n      // ignore 'less' and 'greater' signs while being inside a literal\r\n      continue;\r\n    }\r\n\r\n    if (!dictBound) {\r\n      if (code === codes.LESS && code === prevCode) {\r\n        dictOpened++;\r\n        dictBound = true;\r\n      } else if (code === codes.GREATER && code === prevCode) {\r\n        dictOpened--;\r\n        dictBound = true;\r\n      }\r\n    } else {        \r\n      dictBound = false;\r\n    }\r\n  }\r\n  const end = i - 1;\r\n \r\n  const contentEnd = findNonSpaceIndex(false, end - 2);\r\n  if (contentEnd < contentStart) {\r\n    // should be possible only in an empty dict\r\n    return {\r\n      start, \r\n      end,\r\n    };\r\n  }\r\n\r\n  return {\r\n    start, \r\n    end,\r\n    contentStart,\r\n    contentEnd,\r\n  };\r\n}\r\n  \r\nfunction getArrayBoundsAt(start, skipEmpty = true) {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || _data[start] !== codes.L_BRACKET) {\r\n    return null;\r\n  }\r\n\r\n  let arraysOpened = 1;\r\n  let i = start + 1;    \r\n  let code;\r\n  while (arraysOpened) {\r\n    code = _data[i++];\r\n    if (code === codes.L_BRACKET) {\r\n      arraysOpened++;\r\n    } else if (code === codes.R_BRACKET) {\r\n      arraysOpened--;\r\n    }\r\n  }\r\n  const arrayEnd = i - 1;\r\n  if (arrayEnd - start < 1) {\r\n    return null;\r\n  }\r\n\r\n  return {start, end: arrayEnd};\r\n}\r\n      \r\nfunction getHexBoundsAt(start, skipEmpty = true) {   \r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || getCharCode(start) !== codes.LESS) {\r\n    return null;\r\n  }\r\n\r\n  const end = findCharIndex(codes.GREATER, true, start + 1);\r\n  if (end === -1) {\r\n    return null;\r\n  }\r\n\r\n  return {start, end};\r\n}  \r\n\r\nfunction getLiteralBoundsAt(start, skipEmpty = true) {       \r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || getCharCode(start) !== codes.L_PARENTHESE) {\r\n    return null;\r\n  }\r\n\r\n  let i = start;\r\n  let code;\r\n  let escaped = false;\r\n  let opened = 0;\r\n\r\n  while (opened || code !== codes.R_PARENTHESE || escaped) {\r\n    if (i > _maxIndex) {\r\n      return null;\r\n    }\r\n\r\n    code = getCharCode(i++);\r\n\r\n    if (!escaped) {\r\n      if (code === codes.L_PARENTHESE) {\r\n        opened += 1;\r\n      } else if (opened && code === codes.R_PARENTHESE) {\r\n        opened -= 1;\r\n      }\r\n    }\r\n      \r\n    if (!escaped && code === codes.BACKSLASH) {\r\n      escaped = true;\r\n    } else {\r\n      escaped = false;\r\n    }\r\n  }\r\n\r\n  return {start, end: i - 1};\r\n}\r\n//#endregion\r\n\r\n//#region parse functions \r\nfunction parseNumberAt(start, float = false, skipEmpty = true) {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || !isRegularChar(_data[start])) {\r\n    return null;\r\n  }\r\n\r\n  let i = start;\r\n  let numberStr = \"\";\r\n  let value = _data[i];\r\n  if (value === codes.MINUS) {\r\n    numberStr += \"-\";\r\n    value = _data[++i];\r\n  } else if (value === codes.DOT) {\r\n    numberStr += \"0.\";\r\n    value = _data[++i];\r\n  }\r\n  while (isDigit(value)\r\n      || (float && value === codes.DOT)) {\r\n    numberStr += String.fromCharCode(value);\r\n    value = _data[++i];\r\n  }\r\n\r\n  return numberStr \r\n    ? {value: +numberStr, start, end: i - 1}\r\n    : null;\r\n}\r\n  \r\nfunction parseNameAt(start, includeSlash = true, skipEmpty = true) {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start) || _data[start] !== codes.SLASH) {\r\n    return null;\r\n  }\r\n\r\n  let i = start + 1;\r\n  let result = includeSlash\r\n    ? \"/\"\r\n    : \"\";\r\n  let value = _data[i];\r\n  while (isRegularChar(value)) {\r\n    result += String.fromCharCode(value);\r\n    value = _data[++i];\r\n  }\r\n\r\n  return result.length > 1 \r\n    ? {value: result, start, end: i - 1}\r\n    : null;\r\n} \r\n  \r\nfunction parseStringAt(start, skipEmpty = true) {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }\r\n  if (isOutside(start)) {\r\n    return null;\r\n  }\r\n\r\n  let i = start;\r\n  let result = \"\";\r\n  let value = _data[i];\r\n  while (isRegularChar(value)) {\r\n    result += String.fromCharCode(value);\r\n    value = _data[++i];\r\n  }\r\n\r\n  return result.length !== 0 \r\n    ? {value: result, start, end: i - 1}\r\n    : null;\r\n} \r\n  \r\nfunction parseBoolAt(start, skipEmpty = true)  {\r\n  if (skipEmpty) {\r\n    start = skipEmptyChars(start);\r\n  }    \r\n\r\n  if (isOutside(start)) {\r\n    return null;\r\n  }\r\n\r\n  const nearestDelimiter = findDelimiterIndex(true, start);\r\n\r\n  const isTrue = findSubarrayIndex(keywordCodes.TRUE, {\r\n    minIndex: start, \r\n    maxIndex: nearestDelimiter === -1 ? _maxIndex : nearestDelimiter,\r\n  });\r\n  if (isTrue) {\r\n    return {value: true, start, end: isTrue.end};\r\n  }    \r\n    \r\n  const isFalse = findSubarrayIndex(keywordCodes.FALSE, {\r\n    minIndex: start,      \r\n    maxIndex: nearestDelimiter === -1 ? _maxIndex : nearestDelimiter,\r\n  });\r\n  if (isFalse) {\r\n    return {value: false, start, end: isFalse.end};\r\n  }\r\n\r\n  return null;\r\n} \r\n  \r\nfunction parseNumberArrayAt(start, float = true, skipEmpty = true) {\r\n  const arrayBounds = getArrayBoundsAt(start, skipEmpty);\r\n  if (!arrayBounds) {\r\n    return null;\r\n  }\r\n\r\n  const numbers = [];\r\n  let current;\r\n  let i = arrayBounds.start + 1;\r\n  while(i < arrayBounds.end) {\r\n    current = parseNumberAt(i, float, true);\r\n    if (!current) {\r\n      break;\r\n    }\r\n    numbers.push(current.value);\r\n    i = current.end + 1;\r\n  }\r\n\r\n  return {value: numbers, start: arrayBounds.start, end: arrayBounds.end};\r\n}  \r\n  \r\nfunction parseNameArrayAt(start, includeSlash = true, \r\n  skipEmpty = true) {\r\n  const arrayBounds = getArrayBoundsAt(start, skipEmpty);\r\n  if (!arrayBounds) {\r\n    return null;\r\n  }\r\n\r\n  const names = [];\r\n  let current;\r\n  let i = arrayBounds.start + 1;\r\n  while(i < arrayBounds.end) {\r\n    current = parseNameAt(i, includeSlash, true);\r\n    if (!current) {\r\n      break;\r\n    }\r\n    names.push(current.value);\r\n    i = current.end + 1;\r\n  }\r\n\r\n  return {value: names, start: arrayBounds.start, end: arrayBounds.end};\r\n}  \r\n  \r\nfunction parseDictType(bounds) {\r\n  return parseDictPropertyByName(keywordCodes.TYPE, bounds);   \r\n} \r\n  \r\nfunction parseDictSubtype(bounds) {\r\n  return parseDictPropertyByName(keywordCodes.SUBTYPE, bounds);   \r\n} \r\n  \r\nfunction parseDictPropertyByName(propName, bounds) {\r\n  const arr = _data;\r\n  if (!propName?.length) {\r\n    return null;\r\n  }\r\n\r\n  const minIndex = Math.max(Math.min(bounds.start ?? 0, _maxIndex), 0);\r\n  const maxIndex = Math.max(Math.min(bounds.end ?? _maxIndex, _maxIndex), 0);\r\n\r\n  let propNameBounds;\r\n  let i = minIndex;\r\n  let j;\r\n  let code;\r\n  let prevCode;\r\n  let dictOpened = 0;\r\n  let dictBound = true;\r\n  let literalOpened = 0;\r\n  outer_loop:\r\n  for (i; i <= maxIndex; i++) {\r\n    prevCode = code;\r\n    code = arr[i];\r\n      \r\n    // check if literal opens\r\n    if (code === codes.L_PARENTHESE\r\n        && (!literalOpened || prevCode !== codes.BACKSLASH)) {\r\n      // increase string literal nesting\r\n      literalOpened++;\r\n    }\r\n\r\n    // check if literal closes\r\n    if (code === codes.R_PARENTHESE\r\n        && (literalOpened && prevCode !== codes.BACKSLASH)) {\r\n      // decrease string literal nesting\r\n      literalOpened--;\r\n    }\r\n\r\n    if (literalOpened) {\r\n      // ignore all bytes while being inside a literal\r\n      continue;\r\n    }\r\n\r\n    // check if dict opens or closes\r\n    if (!dictBound) {\r\n      if (code === codes.LESS && code === prevCode) {\r\n        dictOpened++;\r\n        dictBound = true;\r\n      } else if (code === codes.GREATER && code === prevCode) {\r\n        dictOpened--;\r\n        dictBound = true;\r\n      }\r\n    } else {        \r\n      dictBound = false;\r\n    }\r\n\r\n    // compare next j values to the corresponding values of the sought name\r\n    for (j = 0; j < propName.length; j++) {\r\n      if (arr[i + j] !== propName[j]) {\r\n        continue outer_loop;\r\n      }\r\n    }\r\n\r\n    if (dictOpened !== 1) {\r\n      // the found property name is not inside the topmost dict\r\n      continue;\r\n    }\r\n\r\n    // check if name is closed\r\n    if (!isRegularChar(arr[i + j])) {\r\n      propNameBounds = {start: i, end: i + j - 1};\r\n      break;\r\n    }\r\n  }\r\n    \r\n  if (!propNameBounds) {\r\n    // the property name is not found\r\n    return null;\r\n  }\r\n\r\n  // parse the property value\r\n  const type = parseNameAt(propNameBounds.end + 1);\r\n  if (!type) {\r\n    return null;\r\n  }\r\n\r\n  return type.value;     \r\n} \r\n//#endregion \r\n\r\n//#region skip functions\r\nfunction skipEmptyChars(start) {\r\n  let index = findNonSpaceIndex(true, start);\r\n  if (index === -1) {\r\n    return -1;\r\n  }\r\n  if (_data[index] === codes.PERCENT) {\r\n    // it's a comment. skip it\r\n    const afterComment = findNewLineIndex(true, index + 1);\r\n    if (afterComment === -1) {\r\n      return -1;\r\n    }\r\n    index = findNonSpaceIndex(true, afterComment);\r\n  }\r\n  return index;\r\n}\r\n\r\nfunction skipToNextName(start, max) {\r\n  start ||= 0;\r\n  max = max \r\n    ? Math.min(max, _maxIndex)\r\n    : 0;\r\n  if (max < start) {\r\n    return -1;\r\n  }\r\n\r\n  let i = start;\r\n  while (i <= max) {      \r\n    const value = getValueTypeAt(i, true);\r\n    if (value) {\r\n      let skipValueBounds;\r\n      let parseResult;\r\n      switch (value) {\r\n      case valueTypes.DICTIONARY:\r\n        skipValueBounds = getDictBoundsAt(i, false);\r\n        break;\r\n      case valueTypes.ARRAY:\r\n        skipValueBounds = getArrayBoundsAt(i, false);\r\n        break;\r\n      case valueTypes.STRING_LITERAL:            \r\n        skipValueBounds = getLiteralBoundsAt(i, false);\r\n        break; \r\n      case valueTypes.STRING_HEX: \r\n        skipValueBounds = getHexBoundsAt(i, false);\r\n        break; \r\n      case valueTypes.NUMBER:\r\n        parseResult = parseNumberAt(i, true, false);\r\n        if (parseResult) {\r\n          skipValueBounds = parseResult;\r\n        }\r\n        break; \r\n      case valueTypes.BOOLEAN:\r\n        parseResult = parseBoolAt(i, false);\r\n        if (parseResult) {\r\n          skipValueBounds = parseResult;\r\n        }\r\n        break;\r\n      case valueTypes.COMMENT:\r\n        // TODO: Add skip comment\r\n        break;\r\n      case valueTypes.NAME:\r\n        return i;\r\n      default:\r\n        i++;\r\n        continue;\r\n      }   \r\n      if (skipValueBounds) {\r\n        i = skipValueBounds.end + 1;\r\n        skipValueBounds = null;     \r\n        continue;\r\n      }\r\n    }\r\n    i++;\r\n  }\r\n  return -1;\r\n}\r\n//#endregion\r\n\r\n//#region get chars/codes functions\r\nfunction sliceCharCodes(start, end = undefined) {\r\n  return _data.slice(start, (end || start) + 1);\r\n}\r\n\r\nfunction sliceChars(start, end = undefined) {\r\n  return String.fromCharCode(..._data.slice(start, (end || start) + 1));\r\n}\r\n\r\nfunction getCharCode(index) {    \r\n  return _data[index];\r\n}  \r\n//#endregion\r\n`;\n\nvar __awaiter$1l = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass BgDataParser {\r\n    constructor(data) {\r\n        this._workerOnMessageHandlers = new Set();\r\n        this._commandsInProgress = 0;\r\n        this.onWorkerMessage = (e) => {\r\n            for (const handler of this._workerOnMessageHandlers) {\r\n                handler(e);\r\n            }\r\n        };\r\n        this.onWorkerError = (e) => {\r\n            throw new Error(`Background worker error: ${e.message}`);\r\n        };\r\n        if (!(data === null || data === void 0 ? void 0 : data.length)) {\r\n            throw new Error(\"Data is empty\");\r\n        }\r\n        if (!BgDataParser._workerSrc) {\r\n            throw new Error(\"Worker source is not initialized\");\r\n        }\r\n        this._data = data.buffer;\r\n        this._maxIndex = data.length - 1;\r\n    }\r\n    get maxIndex() {\r\n        return this._maxIndex;\r\n    }\r\n    static tryGetParser(data) {\r\n        try {\r\n            const parser = new BgDataParser(data);\r\n            return parser;\r\n        }\r\n        catch (e) {\r\n            console.error(e);\r\n            return null;\r\n        }\r\n    }\r\n    static destroy() {\r\n        this._freeWorkers.clear();\r\n        this._workerPool.forEach(x => x.terminate());\r\n        this._workerPool.length = 0;\r\n    }\r\n    static getFreeWorkerFromPoolAsync() {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            if (this._freeWorkers.size) {\r\n                const worker = this._freeWorkers.values().next().value;\r\n                this._freeWorkers.delete(worker);\r\n                return worker;\r\n            }\r\n            if (this._workerPool.length < this._maxWorkersCount) {\r\n                const worker = new Worker(this._workerSrc);\r\n                this._workerPool.push(worker);\r\n                return worker;\r\n            }\r\n            const freeWorkerPromise = new Promise((resolve, reject) => {\r\n                const start = performance.now();\r\n                const interval = setInterval(() => {\r\n                    if (this._freeWorkers.size) {\r\n                        const worker = this._freeWorkers.values().next().value;\r\n                        this._freeWorkers.delete(worker);\r\n                        clearInterval(interval);\r\n                        resolve(worker);\r\n                    }\r\n                    if (performance.now() - start > this._workerTimeout) {\r\n                        clearInterval(interval);\r\n                        reject(\"Free worker waiting timeout exceeded\");\r\n                    }\r\n                }, 20);\r\n            });\r\n            return yield freeWorkerPromise;\r\n        });\r\n    }\r\n    static returnWorkerToPool(worker) {\r\n        this._freeWorkers.add(worker);\r\n    }\r\n    static transferDataToWorker(worker, buffer) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const workerPromise = new Promise((resolve, reject) => {\r\n                worker.onmessage = (e) => {\r\n                    if (e.data.type === \"success\") {\r\n                        resolve();\r\n                    }\r\n                    else {\r\n                        console.log(e);\r\n                        console.log(e.data);\r\n                        reject(e);\r\n                    }\r\n                };\r\n                worker.onerror = (e) => {\r\n                    console.log(e);\r\n                    console.log(e.message);\r\n                    reject(e);\r\n                };\r\n                worker.postMessage({ name: \"data-set\", bytes: buffer }, [buffer]);\r\n            });\r\n            try {\r\n                yield workerPromise;\r\n            }\r\n            catch (e) {\r\n                console.error(e);\r\n                throw new Error(\"Error while transfering parser data to worker\");\r\n            }\r\n        });\r\n    }\r\n    static transferDataFromWorker(worker) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const workerPromise = new Promise((resolve, reject) => {\r\n                worker.onmessage = (e) => {\r\n                    if (e.data.type === \"success\") {\r\n                        const buffer = e.data.bytes;\r\n                        resolve(buffer);\r\n                    }\r\n                    else {\r\n                        reject(e);\r\n                    }\r\n                };\r\n                worker.onerror = (e) => reject(e);\r\n                worker.postMessage({ name: \"data-reset\" });\r\n            });\r\n            try {\r\n                const buffer = yield workerPromise;\r\n                return buffer;\r\n            }\r\n            catch (_a) {\r\n                throw new Error(\"Error while transfering parser data from worker\");\r\n            }\r\n        });\r\n    }\r\n    destroy() {\r\n    }\r\n    getSubParserAsync(start, end) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const data = yield this.execCommandAsync(\"slice-char-codes\", [start, end]);\r\n            const parser = BgDataParser.tryGetParser(data);\r\n            return parser;\r\n        });\r\n    }\r\n    isOutside(index) {\r\n        return (index < 0 || index > this._maxIndex);\r\n    }\r\n    isCodeAtAsync(index, code) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"is-code-at\", [index, code]);\r\n            return result;\r\n        });\r\n    }\r\n    getValueTypeAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-value-type-at\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    findSubarrayIndexAsync(sub, options) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-subarray-index\", [sub, options]);\r\n            return result;\r\n        });\r\n    }\r\n    findCharIndexAsync(charCode, direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-char-index\", [charCode, direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findNewLineIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-new-line-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findSpaceIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-space-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findNonSpaceIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-non-space-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findDelimiterIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-delimiter-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findNonDelimiterIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-non-delimiter-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findRegularIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-regular-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    findIrregularIndexAsync(direction = true, start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"find-irregular-index\", [direction, start]);\r\n            return result;\r\n        });\r\n    }\r\n    getIndirectObjectBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-indirect-object-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    getXrefTableBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-xref-table-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    getDictBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-dict-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    getArrayBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-array-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    getHexBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-hex-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    getLiteralBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"get-literal-bounds\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseNumberAtAsync(start, float = false, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-number\", [start, float, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseNameAtAsync(start, includeSlash = true, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-name\", [start, includeSlash, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseStringAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-string\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseBoolAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-bool\", [start, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseNumberArrayAtAsync(start, float = true, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-number-array\", [start, float, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseNameArrayAtAsync(start, includeSlash = true, skipEmpty = true) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-name-array\", [start, includeSlash, skipEmpty]);\r\n            return result;\r\n        });\r\n    }\r\n    parseDictTypeAsync(bounds) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-dict-type\", [bounds]);\r\n            return result;\r\n        });\r\n    }\r\n    parseDictSubtypeAsync(bounds) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-dict-subtype\", [bounds]);\r\n            return result;\r\n        });\r\n    }\r\n    parseDictPropertyByNameAsync(propName, bounds) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"parse-dict-property-by-name\", [propName, bounds]);\r\n            return result;\r\n        });\r\n    }\r\n    skipEmptyAsync(start) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"skip-empty\", [start]);\r\n            return result;\r\n        });\r\n    }\r\n    skipToNextNameAsync(start, max) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"skip-to-next-name\", [start, max]);\r\n            return result;\r\n        });\r\n    }\r\n    sliceCharCodesAsync(start, end) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"slice-char-codes\", [start, end]);\r\n            return result;\r\n        });\r\n    }\r\n    sliceCharsAsync(start, end) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            const result = yield this.execCommandAsync(\"slice-chars\", [start, end]);\r\n            return result;\r\n        });\r\n    }\r\n    releaseWorkerAsync(worker) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            this._workerPromise = null;\r\n            const returnedBuffer = yield BgDataParser.transferDataFromWorker(worker);\r\n            this._data = returnedBuffer;\r\n            worker.onmessage = null;\r\n            worker.onerror = null;\r\n            BgDataParser.returnWorkerToPool(worker);\r\n            this._prevWorkerReleasePromise = null;\r\n        });\r\n    }\r\n    getWorkerAsync() {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            if (this._prevWorkerReleasePromise) {\r\n                yield this._prevWorkerReleasePromise;\r\n            }\r\n            if (!this._workerPromise) {\r\n                this._workerPromise = new Promise((resolve, reject) => __awaiter$1l(this, void 0, void 0, function* () {\r\n                    const dataBuffer = this._data;\r\n                    const freeWorker = yield BgDataParser.getFreeWorkerFromPoolAsync();\r\n                    yield BgDataParser.transferDataToWorker(freeWorker, dataBuffer);\r\n                    freeWorker.onmessage = this.onWorkerMessage;\r\n                    freeWorker.onerror = this.onWorkerError;\r\n                    const workerReleaseInterval = setInterval(() => __awaiter$1l(this, void 0, void 0, function* () {\r\n                        if (this._commandsInProgress > 0 || this._workerOnMessageHandlers.size) {\r\n                            return;\r\n                        }\r\n                        clearInterval(workerReleaseInterval);\r\n                        this._prevWorkerReleasePromise = this.releaseWorkerAsync(freeWorker);\r\n                    }), 50);\r\n                    resolve(freeWorker);\r\n                }));\r\n            }\r\n            const worker = yield this._workerPromise;\r\n            return worker;\r\n        });\r\n    }\r\n    execCommandAsync(commandName, commandArgs = []) {\r\n        return __awaiter$1l(this, void 0, void 0, function* () {\r\n            this._commandsInProgress++;\r\n            const worker = yield this.getWorkerAsync();\r\n            const commandId = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid();\r\n            const commandResultPromise = new Promise((resolve, reject) => {\r\n                const onMessage = (e) => {\r\n                    if (e.data.id !== commandId) {\r\n                        return;\r\n                    }\r\n                    this._workerOnMessageHandlers.delete(onMessage);\r\n                    if (e.data.type === \"error\") {\r\n                        reject(`Background worker error: ${e.data.message}`);\r\n                    }\r\n                    else {\r\n                        resolve(e.data.result);\r\n                    }\r\n                };\r\n                this._workerOnMessageHandlers.add(onMessage);\r\n            });\r\n            worker.postMessage({ id: commandId, name: commandName, args: commandArgs });\r\n            const result = yield commandResultPromise;\r\n            this._commandsInProgress--;\r\n            return result;\r\n        });\r\n    }\r\n}\r\nBgDataParser._maxWorkersCount = navigator.hardwareConcurrency || 4;\r\nBgDataParser._workerTimeout = 60 * 1000;\r\nBgDataParser._workerSrc = (() => {\r\n    const srcBlob = new Blob([workerSrc], { type: \"text/plain;charset=utf-8;\" });\r\n    const srcUri = URL.createObjectURL(srcBlob);\r\n    return srcUri;\r\n})();\r\nBgDataParser._workerPool = [];\r\nBgDataParser._freeWorkers = new Set();\n\nconst codes = {\r\n    NULL: 0,\r\n    BACKSPACE: 8,\r\n    HORIZONTAL_TAB: 9,\r\n    LINE_FEED: 10,\r\n    VERTICAL_TAB: 11,\r\n    FORM_FEED: 12,\r\n    CARRIAGE_RETURN: 13,\r\n    WHITESPACE: 32,\r\n    EXCLAMATION_MARK: 33,\r\n    DOUBLE_QUOTE: 34,\r\n    HASH: 35,\r\n    DOLLAR: 36,\r\n    PERCENT: 37,\r\n    AMPERSAND: 38,\r\n    QUOTE: 39,\r\n    L_PARENTHESE: 40,\r\n    R_PARENTHESE: 41,\r\n    ASTERISK: 42,\r\n    PLUS: 43,\r\n    COMMA: 44,\r\n    MINUS: 45,\r\n    DOT: 46,\r\n    SLASH: 47,\r\n    D_0: 48,\r\n    D_1: 49,\r\n    D_2: 50,\r\n    D_3: 51,\r\n    D_4: 52,\r\n    D_5: 53,\r\n    D_6: 54,\r\n    D_7: 55,\r\n    D_8: 56,\r\n    D_9: 57,\r\n    COLON: 58,\r\n    SEMICOLON: 59,\r\n    LESS: 60,\r\n    EQUAL: 61,\r\n    GREATER: 62,\r\n    QUESTION_MARK: 63,\r\n    AT: 64,\r\n    A: 65,\r\n    B: 66,\r\n    C: 67,\r\n    D: 68,\r\n    E: 69,\r\n    F: 70,\r\n    G: 71,\r\n    H: 72,\r\n    I: 73,\r\n    J: 74,\r\n    K: 75,\r\n    L: 76,\r\n    M: 77,\r\n    N: 78,\r\n    O: 79,\r\n    P: 80,\r\n    Q: 81,\r\n    R: 82,\r\n    S: 83,\r\n    T: 84,\r\n    U: 85,\r\n    V: 86,\r\n    W: 87,\r\n    X: 88,\r\n    Y: 89,\r\n    Z: 90,\r\n    L_BRACKET: 91,\r\n    BACKSLASH: 92,\r\n    R_BRACKET: 93,\r\n    CARET: 94,\r\n    UNDERSCORE: 95,\r\n    BACKTICK: 96,\r\n    a: 97,\r\n    b: 98,\r\n    c: 99,\r\n    d: 100,\r\n    e: 101,\r\n    f: 102,\r\n    g: 103,\r\n    h: 104,\r\n    i: 105,\r\n    j: 106,\r\n    k: 107,\r\n    l: 108,\r\n    m: 109,\r\n    n: 110,\r\n    o: 111,\r\n    p: 112,\r\n    q: 113,\r\n    r: 114,\r\n    s: 115,\r\n    t: 116,\r\n    u: 117,\r\n    v: 118,\r\n    w: 119,\r\n    x: 120,\r\n    y: 121,\r\n    z: 122,\r\n    L_BRACE: 123,\r\n    VERTICAL_LINE: 124,\r\n    R_BRACE: 125,\r\n    TILDE: 126,\r\n};\r\nconst keywordCodes = {\r\n    NULL: [codes.n, codes.u, codes.l, codes.l],\r\n    OBJ: [codes.o, codes.b, codes.j],\r\n    OBJ_END: [codes.e, codes.n, codes.d, codes.o, codes.b, codes.j],\r\n    STREAM_START: [codes.s, codes.t, codes.r, codes.e, codes.a, codes.m],\r\n    STREAM_END: [codes.e, codes.n, codes.d,\r\n        codes.s, codes.t, codes.r, codes.e, codes.a, codes.m],\r\n    DICT_START: [codes.LESS, codes.LESS],\r\n    DICT_END: [codes.GREATER, codes.GREATER],\r\n    ARRAY_START: [codes.L_BRACKET],\r\n    ARRAY_END: [codes.R_BRACKET],\r\n    STR_LITERAL_START: [codes.L_PARENTHESE],\r\n    STR_LITERAL_END: [codes.R_PARENTHESE],\r\n    STR_HEX_START: [codes.LESS],\r\n    STR_HEX_END: [codes.GREATER],\r\n    VERSION: [codes.PERCENT, codes.P, codes.D, codes.F, codes.MINUS],\r\n    PREV: [codes.SLASH, codes.P, codes.r, codes.e, codes.v],\r\n    TYPE: [codes.SLASH, codes.T, codes.y, codes.p, codes.e],\r\n    SUBTYPE: [codes.SLASH, codes.S, codes.u, codes.b, codes.t, codes.y, codes.p, codes.e],\r\n    FORM: [codes.SLASH, codes.F, codes.o, codes.r, codes.m],\r\n    XREF_TABLE: [codes.x, codes.r, codes.e, codes.f],\r\n    XREF_STREAM: [codes.SLASH, codes.X, codes.R, codes.e, codes.f],\r\n    XREF_HYBRID: [codes.X, codes.R, codes.e, codes.f, codes.S, codes.t, codes.m],\r\n    XREF_START: [codes.s, codes.t, codes.a, codes.r, codes.t,\r\n        codes.x, codes.r, codes.e, codes.f],\r\n    TRAILER: [codes.t, codes.r, codes.a, codes.i, codes.l, codes.e, codes.r],\r\n    END_OF_FILE: [codes.PERCENT, codes.PERCENT, codes.E, codes.O, codes.F],\r\n    END_OF_LINE: [codes.CARRIAGE_RETURN, codes.LINE_FEED],\r\n    TRUE: [codes.t, codes.r, codes.u, codes.e],\r\n    FALSE: [codes.f, codes.a, codes.l, codes.s, codes.e],\r\n    CMAP_BEGIN: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n        codes.c, codes.m, codes.a, codes.p],\r\n    CMAP_END: [codes.e, codes.n, codes.d,\r\n        codes.c, codes.m, codes.a, codes.p],\r\n    CMAP_BEGIN_CODE_RANGE: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n        codes.c, codes.o, codes.d, codes.e, codes.s, codes.p, codes.a, codes.c, codes.e,\r\n        codes.r, codes.a, codes.n, codes.g, codes.e],\r\n    CMAP_END_CODE_RANGE: [codes.e, codes.n, codes.d,\r\n        codes.c, codes.o, codes.d, codes.e, codes.s, codes.p, codes.a, codes.c, codes.e,\r\n        codes.r, codes.a, codes.n, codes.g, codes.e],\r\n    CMAP_BEGIN_CHAR: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n        codes.b, codes.f, codes.c, codes.h, codes.a, codes.r],\r\n    CMAP_END_CHAR: [codes.e, codes.n, codes.d,\r\n        codes.b, codes.f, codes.c, codes.h, codes.a, codes.r],\r\n    CMAP_BEGIN_RANGE: [codes.b, codes.e, codes.g, codes.i, codes.n,\r\n        codes.b, codes.f, codes.r, codes.a, codes.n, codes.g, codes.e],\r\n    CMAP_END_RANGE: [codes.e, codes.n, codes.d,\r\n        codes.b, codes.f, codes.r, codes.a, codes.n, codes.g, codes.e],\r\n    AP_STREAM_TEXT_END: [codes.E, codes.T],\r\n};\n\nvar __awaiter$1k = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass SyncDataParser {\r\n    constructor(data) {\r\n        if (!(data === null || data === void 0 ? void 0 : data.length)) {\r\n            throw new Error(\"Data is empty\");\r\n        }\r\n        this._data = data;\r\n        this._maxIndex = data.length - 1;\r\n    }\r\n    get maxIndex() {\r\n        return this._maxIndex;\r\n    }\r\n    static tryGetParser(data) {\r\n        try {\r\n            const parser = new SyncDataParser(data);\r\n            return parser;\r\n        }\r\n        catch (e) {\r\n            console.error(e);\r\n            return null;\r\n        }\r\n    }\r\n    static isRegularChar(code) {\r\n        if (isNaN(code)) {\r\n            return false;\r\n        }\r\n        return !this.delimiterChars.has(code) && !this.spaceChars.has(code);\r\n    }\r\n    static isNotRegularChar(code) {\r\n        if (isNaN(code)) {\r\n            return true;\r\n        }\r\n        return this.delimiterChars.has(code) || this.spaceChars.has(code);\r\n    }\r\n    static isDigit(code) {\r\n        return this.digitChars.has(code);\r\n    }\r\n    static isNewLineChar(code) {\r\n        return this.newLineChars.has(code);\r\n    }\r\n    static isSpaceChar(code) {\r\n        return this.spaceChars.has(code);\r\n    }\r\n    static isNotSpaceChar(code) {\r\n        return !this.spaceChars.has(code);\r\n    }\r\n    static isDelimiterChar(code) {\r\n        return this.delimiterChars.has(code);\r\n    }\r\n    static isNotDelimiterChar(code) {\r\n        return !this.delimiterChars.has(code);\r\n    }\r\n    destroy() {\r\n    }\r\n    getSubParserAsync(start, end) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return new SyncDataParser(yield this.sliceCharCodesAsync(start, end));\r\n        });\r\n    }\r\n    isOutside(index) {\r\n        return (index < 0 || index > this._maxIndex);\r\n    }\r\n    isCodeAtAsync(index, code) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return this.getCharCode(index) === code;\r\n        });\r\n    }\r\n    getValueTypeAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start)) {\r\n                return null;\r\n            }\r\n            const arr = this._data;\r\n            const i = start;\r\n            const charCode = arr[i];\r\n            switch (charCode) {\r\n                case codes.SLASH:\r\n                    if (SyncDataParser.isRegularChar(arr[i + 1])) {\r\n                        return valueTypes.NAME;\r\n                    }\r\n                    return valueTypes.UNKNOWN;\r\n                case codes.L_BRACKET:\r\n                    return valueTypes.ARRAY;\r\n                case codes.L_PARENTHESE:\r\n                    return valueTypes.STRING_LITERAL;\r\n                case codes.LESS:\r\n                    if (codes.LESS === arr[i + 1]) {\r\n                        return valueTypes.DICTIONARY;\r\n                    }\r\n                    return valueTypes.STRING_HEX;\r\n                case codes.PERCENT:\r\n                    return valueTypes.COMMENT;\r\n                case codes.D_0:\r\n                case codes.D_1:\r\n                case codes.D_2:\r\n                case codes.D_3:\r\n                case codes.D_4:\r\n                case codes.D_5:\r\n                case codes.D_6:\r\n                case codes.D_7:\r\n                case codes.D_8:\r\n                case codes.D_9:\r\n                    const nextDelimIndex = yield this.findDelimiterIndexAsync(true, i + 1);\r\n                    if (nextDelimIndex !== -1) {\r\n                        const refEndIndex = yield this.findCharIndexAsync(codes.R, false, nextDelimIndex - 1);\r\n                        if (refEndIndex !== -1 && refEndIndex > i && !SyncDataParser.isRegularChar(arr[refEndIndex + 1])) {\r\n                            return valueTypes.REF;\r\n                        }\r\n                    }\r\n                    return valueTypes.NUMBER;\r\n                case codes.DOT:\r\n                case codes.MINUS:\r\n                    if (SyncDataParser.isDigit(arr[i + 1])) {\r\n                        return valueTypes.NUMBER;\r\n                    }\r\n                    return valueTypes.UNKNOWN;\r\n                case codes.s:\r\n                    if (arr[i + 1] === codes.t\r\n                        && arr[i + 2] === codes.r\r\n                        && arr[i + 3] === codes.e\r\n                        && arr[i + 4] === codes.a\r\n                        && arr[i + 5] === codes.m) {\r\n                        return valueTypes.STREAM;\r\n                    }\r\n                    return valueTypes.UNKNOWN;\r\n                case codes.t:\r\n                    if (arr[i + 1] === codes.r\r\n                        && arr[i + 2] === codes.u\r\n                        && arr[i + 3] === codes.e) {\r\n                        return valueTypes.BOOLEAN;\r\n                    }\r\n                    return valueTypes.UNKNOWN;\r\n                case codes.f:\r\n                    if (arr[i + 1] === codes.a\r\n                        && arr[i + 2] === codes.l\r\n                        && arr[i + 3] === codes.s\r\n                        && arr[i + 4] === codes.e) {\r\n                        return valueTypes.BOOLEAN;\r\n                    }\r\n                    return valueTypes.UNKNOWN;\r\n                default:\r\n                    return valueTypes.UNKNOWN;\r\n            }\r\n        });\r\n    }\r\n    findSubarrayIndexAsync(sub, options) {\r\n        var _a, _b, _c;\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            if (!(sub === null || sub === void 0 ? void 0 : sub.length)) {\r\n                return null;\r\n            }\r\n            const direction = (_a = options === null || options === void 0 ? void 0 : options.direction) !== null && _a !== void 0 ? _a : true;\r\n            const minIndex = Math.max(Math.min((_b = options === null || options === void 0 ? void 0 : options.minIndex) !== null && _b !== void 0 ? _b : 0, this._maxIndex), 0);\r\n            const maxIndex = Math.max(Math.min((_c = options === null || options === void 0 ? void 0 : options.maxIndex) !== null && _c !== void 0 ? _c : this._maxIndex, this._maxIndex), 0);\r\n            const allowOpened = !(options === null || options === void 0 ? void 0 : options.closedOnly);\r\n            let i = direction\r\n                ? minIndex\r\n                : maxIndex;\r\n            let j;\r\n            if (direction) {\r\n                outer_loop: for (i; i <= maxIndex; i++) {\r\n                    for (j = 0; j < sub.length; j++) {\r\n                        if (arr[i + j] !== sub[j]) {\r\n                            continue outer_loop;\r\n                        }\r\n                    }\r\n                    if (allowOpened || !SyncDataParser.isRegularChar(arr[i + j])) {\r\n                        return { start: i, end: i + j - 1 };\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                const subMaxIndex = sub.length - 1;\r\n                outer_loop: for (i; i >= minIndex; i--) {\r\n                    for (j = 0; j < sub.length; j++) {\r\n                        if (arr[i - j] !== sub[subMaxIndex - j]) {\r\n                            continue outer_loop;\r\n                        }\r\n                    }\r\n                    if (allowOpened || !SyncDataParser.isRegularChar(arr[i - j])) {\r\n                        return { start: i - j + 1, end: i };\r\n                    }\r\n                }\r\n            }\r\n            return null;\r\n        });\r\n    }\r\n    findCharIndexAsync(charCode, direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (arr[i] === charCode) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (arr[i] === charCode) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findNewLineIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            let lineBreakIndex;\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isNewLineChar(arr[i])) {\r\n                        lineBreakIndex = i;\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isNewLineChar(arr[i])) {\r\n                        lineBreakIndex = i;\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n            if (lineBreakIndex === undefined) {\r\n                return -1;\r\n            }\r\n            if (direction) {\r\n                if (this._data[lineBreakIndex] === codes.CARRIAGE_RETURN\r\n                    && this._data[lineBreakIndex + 1] === codes.LINE_FEED) {\r\n                    lineBreakIndex++;\r\n                }\r\n                return Math.min(lineBreakIndex + 1, this._maxIndex);\r\n            }\r\n            else {\r\n                if (this._data[lineBreakIndex] === codes.LINE_FEED\r\n                    && this._data[lineBreakIndex - 1] === codes.CARRIAGE_RETURN) {\r\n                    lineBreakIndex--;\r\n                }\r\n                return Math.max(lineBreakIndex - 1, 0);\r\n            }\r\n        });\r\n    }\r\n    findSpaceIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isSpaceChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isSpaceChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findNonSpaceIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isNotSpaceChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isNotSpaceChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findDelimiterIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isDelimiterChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isDelimiterChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findNonDelimiterIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isNotDelimiterChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isNotDelimiterChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findRegularIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isRegularChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isRegularChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    findIrregularIndexAsync(direction = true, start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            let i = isNaN(start)\r\n                ? direction\r\n                    ? 0\r\n                    : this._maxIndex\r\n                : start;\r\n            if (direction) {\r\n                for (i; i <= this._maxIndex; i++) {\r\n                    if (SyncDataParser.isNotRegularChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            else {\r\n                for (i; i >= 0; i--) {\r\n                    if (SyncDataParser.isNotRegularChar(arr[i])) {\r\n                        return i;\r\n                    }\r\n                }\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    getIndirectObjectBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start)) {\r\n                return null;\r\n            }\r\n            const objStartIndex = yield this.findSubarrayIndexAsync(keywordCodes.OBJ, { minIndex: start, closedOnly: true });\r\n            if (!objStartIndex) {\r\n                return null;\r\n            }\r\n            let contentStart = yield this.findNonSpaceIndexAsync(true, objStartIndex.end + 1);\r\n            if (contentStart === -1) {\r\n                return null;\r\n            }\r\n            const objEndIndex = yield this.findSubarrayIndexAsync(keywordCodes.OBJ_END, { minIndex: contentStart, closedOnly: true });\r\n            if (!objEndIndex) {\r\n                return null;\r\n            }\r\n            let contentEnd = yield this.findNonSpaceIndexAsync(false, objEndIndex.start - 1);\r\n            if (this.getCharCode(contentStart) === codes.LESS\r\n                && this.getCharCode(contentStart + 1) === codes.LESS\r\n                && this.getCharCode(contentEnd - 1) === codes.GREATER\r\n                && this.getCharCode(contentEnd) === codes.GREATER) {\r\n                contentStart += 2;\r\n                contentEnd -= 2;\r\n            }\r\n            return {\r\n                start: objStartIndex.start,\r\n                end: objEndIndex.end,\r\n                contentStart,\r\n                contentEnd,\r\n            };\r\n        });\r\n    }\r\n    getXrefTableBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || this._data[start] !== codes.x) {\r\n                return null;\r\n            }\r\n            const xrefStart = yield this.findSubarrayIndexAsync(keywordCodes.XREF_TABLE, { minIndex: start });\r\n            if (!xrefStart) {\r\n                return null;\r\n            }\r\n            const contentStart = yield this.findNonSpaceIndexAsync(true, xrefStart.end + 1);\r\n            if (contentStart === -1) {\r\n                return null;\r\n            }\r\n            const xrefEnd = yield this.findSubarrayIndexAsync(keywordCodes.TRAILER, { minIndex: xrefStart.end + 1 });\r\n            if (!xrefEnd) {\r\n                return null;\r\n            }\r\n            const contentEnd = yield this.findNonSpaceIndexAsync(false, xrefEnd.start - 1);\r\n            if (contentEnd < contentStart) {\r\n                return null;\r\n            }\r\n            return {\r\n                start: xrefStart.start,\r\n                end: xrefEnd.end,\r\n                contentStart,\r\n                contentEnd,\r\n            };\r\n        });\r\n    }\r\n    getDictBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start)\r\n                || this._data[start] !== codes.LESS\r\n                || this._data[start + 1] !== codes.LESS) {\r\n                return null;\r\n            }\r\n            const contentStart = yield this.findNonSpaceIndexAsync(true, start + 2);\r\n            if (contentStart === -1) {\r\n                return null;\r\n            }\r\n            let dictOpened = 1;\r\n            let dictBound = true;\r\n            let literalOpened = 0;\r\n            let i = contentStart;\r\n            let code;\r\n            let prevCode;\r\n            while (dictOpened) {\r\n                prevCode = code;\r\n                code = this._data[i++];\r\n                if (code === codes.L_PARENTHESE\r\n                    && (!literalOpened || prevCode !== codes.BACKSLASH)) {\r\n                    literalOpened++;\r\n                }\r\n                if (code === codes.R_PARENTHESE\r\n                    && (literalOpened && prevCode !== codes.BACKSLASH)) {\r\n                    literalOpened--;\r\n                }\r\n                if (literalOpened) {\r\n                    continue;\r\n                }\r\n                if (!dictBound) {\r\n                    if (code === codes.LESS && code === prevCode) {\r\n                        dictOpened++;\r\n                        dictBound = true;\r\n                    }\r\n                    else if (code === codes.GREATER && code === prevCode) {\r\n                        dictOpened--;\r\n                        dictBound = true;\r\n                    }\r\n                }\r\n                else {\r\n                    dictBound = false;\r\n                }\r\n            }\r\n            const end = i - 1;\r\n            const contentEnd = yield this.findNonSpaceIndexAsync(false, end - 2);\r\n            if (contentEnd < contentStart) {\r\n                return {\r\n                    start,\r\n                    end,\r\n                };\r\n            }\r\n            return {\r\n                start,\r\n                end,\r\n                contentStart,\r\n                contentEnd,\r\n            };\r\n        });\r\n    }\r\n    getArrayBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || this._data[start] !== codes.L_BRACKET) {\r\n                return null;\r\n            }\r\n            let arraysOpened = 1;\r\n            let i = start + 1;\r\n            let code;\r\n            while (arraysOpened) {\r\n                code = this._data[i++];\r\n                if (code === codes.L_BRACKET) {\r\n                    arraysOpened++;\r\n                }\r\n                else if (code === codes.R_BRACKET) {\r\n                    arraysOpened--;\r\n                }\r\n            }\r\n            const arrayEnd = i - 1;\r\n            if (arrayEnd - start < 1) {\r\n                return null;\r\n            }\r\n            return { start, end: arrayEnd };\r\n        });\r\n    }\r\n    getHexBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || this.getCharCode(start) !== codes.LESS) {\r\n                return null;\r\n            }\r\n            const end = yield this.findCharIndexAsync(codes.GREATER, true, start + 1);\r\n            if (end === -1) {\r\n                return null;\r\n            }\r\n            return { start, end };\r\n        });\r\n    }\r\n    getLiteralBoundsAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || this.getCharCode(start) !== codes.L_PARENTHESE) {\r\n                return null;\r\n            }\r\n            let i = start;\r\n            let code;\r\n            let escaped = false;\r\n            let opened = 0;\r\n            while (opened || code !== codes.R_PARENTHESE || escaped) {\r\n                if (i > this._maxIndex) {\r\n                    return null;\r\n                }\r\n                code = this.getCharCode(i++);\r\n                if (!escaped) {\r\n                    if (code === codes.L_PARENTHESE) {\r\n                        opened += 1;\r\n                    }\r\n                    else if (opened && code === codes.R_PARENTHESE) {\r\n                        opened -= 1;\r\n                    }\r\n                }\r\n                if (!escaped && code === codes.BACKSLASH) {\r\n                    escaped = true;\r\n                }\r\n                else {\r\n                    escaped = false;\r\n                }\r\n            }\r\n            return { start, end: i - 1 };\r\n        });\r\n    }\r\n    parseNumberAtAsync(start, float = false, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || !SyncDataParser.isRegularChar(this._data[start])) {\r\n                return null;\r\n            }\r\n            let i = start;\r\n            let numberStr = \"\";\r\n            let value = this._data[i];\r\n            if (value === codes.MINUS) {\r\n                numberStr += \"-\";\r\n                value = this._data[++i];\r\n            }\r\n            else if (value === codes.DOT) {\r\n                numberStr += \"0.\";\r\n                value = this._data[++i];\r\n            }\r\n            while (SyncDataParser.isDigit(value)\r\n                || (float && value === codes.DOT)) {\r\n                numberStr += String.fromCharCode(value);\r\n                value = this._data[++i];\r\n            }\r\n            return numberStr\r\n                ? { value: +numberStr, start, end: i - 1 }\r\n                : null;\r\n        });\r\n    }\r\n    parseNameAtAsync(start, includeSlash = true, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start) || this._data[start] !== codes.SLASH) {\r\n                return null;\r\n            }\r\n            let i = start + 1;\r\n            let result = includeSlash\r\n                ? \"/\"\r\n                : \"\";\r\n            let value = this._data[i];\r\n            while (SyncDataParser.isRegularChar(value)) {\r\n                result += String.fromCharCode(value);\r\n                value = this._data[++i];\r\n            }\r\n            return result.length > 1\r\n                ? { value: result, start, end: i - 1 }\r\n                : null;\r\n        });\r\n    }\r\n    parseStringAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start)) {\r\n                return null;\r\n            }\r\n            let i = start;\r\n            let result = \"\";\r\n            let value = this._data[i];\r\n            while (SyncDataParser.isRegularChar(value)) {\r\n                result += String.fromCharCode(value);\r\n                value = this._data[++i];\r\n            }\r\n            return result.length !== 0\r\n                ? { value: result, start, end: i - 1 }\r\n                : null;\r\n        });\r\n    }\r\n    parseBoolAtAsync(start, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield this.skipEmptyAsync(start);\r\n            }\r\n            if (this.isOutside(start)) {\r\n                return null;\r\n            }\r\n            const nearestDelimiter = yield this.findDelimiterIndexAsync(true, start);\r\n            const isTrue = yield this.findSubarrayIndexAsync(keywordCodes.TRUE, {\r\n                minIndex: start,\r\n                maxIndex: nearestDelimiter === -1 ? this._maxIndex : nearestDelimiter,\r\n            });\r\n            if (isTrue) {\r\n                return { value: true, start, end: isTrue.end };\r\n            }\r\n            const isFalse = yield this.findSubarrayIndexAsync(keywordCodes.FALSE, {\r\n                minIndex: start,\r\n                maxIndex: nearestDelimiter === -1 ? this._maxIndex : nearestDelimiter,\r\n            });\r\n            if (isFalse) {\r\n                return { value: false, start, end: isFalse.end };\r\n            }\r\n            return null;\r\n        });\r\n    }\r\n    parseNumberArrayAtAsync(start, float = true, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield this.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const numbers = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                current = yield this.parseNumberAtAsync(i, float, true);\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                numbers.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: numbers, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    parseNameArrayAtAsync(start, includeSlash = true, skipEmpty = true) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield this.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const names = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                current = yield this.parseNameAtAsync(i, includeSlash, true);\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                names.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: names, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    parseDictTypeAsync(bounds) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return yield this.parseDictPropertyByNameAsync(keywordCodes.TYPE, bounds);\r\n        });\r\n    }\r\n    parseDictSubtypeAsync(bounds) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return yield this.parseDictPropertyByNameAsync(keywordCodes.SUBTYPE, bounds);\r\n        });\r\n    }\r\n    parseDictPropertyByNameAsync(propName, bounds) {\r\n        var _a, _b;\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            const arr = this._data;\r\n            if (!(propName === null || propName === void 0 ? void 0 : propName.length)) {\r\n                return null;\r\n            }\r\n            const minIndex = Math.max(Math.min((_a = bounds.start) !== null && _a !== void 0 ? _a : 0, this._maxIndex), 0);\r\n            const maxIndex = Math.max(Math.min((_b = bounds.end) !== null && _b !== void 0 ? _b : this._maxIndex, this._maxIndex), 0);\r\n            let propNameBounds;\r\n            let i = minIndex;\r\n            let j;\r\n            let code;\r\n            let prevCode;\r\n            let dictOpened = 0;\r\n            let dictBound = true;\r\n            let literalOpened = 0;\r\n            outer_loop: for (i; i <= maxIndex; i++) {\r\n                prevCode = code;\r\n                code = arr[i];\r\n                if (code === codes.L_PARENTHESE\r\n                    && (!literalOpened || prevCode !== codes.BACKSLASH)) {\r\n                    literalOpened++;\r\n                }\r\n                if (code === codes.R_PARENTHESE\r\n                    && (literalOpened && prevCode !== codes.BACKSLASH)) {\r\n                    literalOpened--;\r\n                }\r\n                if (literalOpened) {\r\n                    continue;\r\n                }\r\n                if (!dictBound) {\r\n                    if (code === codes.LESS && code === prevCode) {\r\n                        dictOpened++;\r\n                        dictBound = true;\r\n                    }\r\n                    else if (code === codes.GREATER && code === prevCode) {\r\n                        dictOpened--;\r\n                        dictBound = true;\r\n                    }\r\n                }\r\n                else {\r\n                    dictBound = false;\r\n                }\r\n                for (j = 0; j < propName.length; j++) {\r\n                    if (arr[i + j] !== propName[j]) {\r\n                        continue outer_loop;\r\n                    }\r\n                }\r\n                if (dictOpened !== 1) {\r\n                    continue;\r\n                }\r\n                if (!SyncDataParser.isRegularChar(arr[i + j])) {\r\n                    propNameBounds = { start: i, end: i + j - 1 };\r\n                    break;\r\n                }\r\n            }\r\n            if (!propNameBounds) {\r\n                return null;\r\n            }\r\n            const type = yield this.parseNameAtAsync(propNameBounds.end + 1);\r\n            if (!type) {\r\n                return null;\r\n            }\r\n            return type.value;\r\n        });\r\n    }\r\n    skipEmptyAsync(start) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            let index = yield this.findNonSpaceIndexAsync(true, start);\r\n            if (index === -1) {\r\n                return -1;\r\n            }\r\n            if (this._data[index] === codes.PERCENT) {\r\n                const afterComment = yield this.findNewLineIndexAsync(true, index + 1);\r\n                if (afterComment === -1) {\r\n                    return -1;\r\n                }\r\n                index = yield this.findNonSpaceIndexAsync(true, afterComment);\r\n            }\r\n            return index;\r\n        });\r\n    }\r\n    skipToNextNameAsync(start, max) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            start || (start = 0);\r\n            max = max\r\n                ? Math.min(max, this._maxIndex)\r\n                : 0;\r\n            if (max < start) {\r\n                return -1;\r\n            }\r\n            let i = start;\r\n            while (i <= max) {\r\n                const value = yield this.getValueTypeAtAsync(i, true);\r\n                if (value) {\r\n                    let skipValueBounds;\r\n                    switch (value) {\r\n                        case valueTypes.DICTIONARY:\r\n                            skipValueBounds = yield this.getDictBoundsAtAsync(i, false);\r\n                            break;\r\n                        case valueTypes.ARRAY:\r\n                            skipValueBounds = yield this.getArrayBoundsAtAsync(i, false);\r\n                            break;\r\n                        case valueTypes.STRING_LITERAL:\r\n                            skipValueBounds = yield this.getLiteralBoundsAtAsync(i, false);\r\n                            break;\r\n                        case valueTypes.STRING_HEX:\r\n                            skipValueBounds = yield this.getHexBoundsAtAsync(i, false);\r\n                            break;\r\n                        case valueTypes.NUMBER:\r\n                            const numberParseResult = yield this.parseNumberAtAsync(i, true, false);\r\n                            if (numberParseResult) {\r\n                                skipValueBounds = numberParseResult;\r\n                            }\r\n                            break;\r\n                        case valueTypes.BOOLEAN:\r\n                            const boolParseResult = yield this.parseBoolAtAsync(i, false);\r\n                            if (boolParseResult) {\r\n                                skipValueBounds = boolParseResult;\r\n                            }\r\n                            break;\r\n                        case valueTypes.COMMENT:\r\n                            break;\r\n                        case valueTypes.NAME:\r\n                            return i;\r\n                        default:\r\n                            i++;\r\n                            continue;\r\n                    }\r\n                    if (skipValueBounds) {\r\n                        i = skipValueBounds.end + 1;\r\n                        skipValueBounds = null;\r\n                        continue;\r\n                    }\r\n                }\r\n                i++;\r\n            }\r\n            return -1;\r\n        });\r\n    }\r\n    sliceCharCodesAsync(start, end) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return this._data.slice(start, (end || start) + 1);\r\n        });\r\n    }\r\n    sliceCharsAsync(start, end) {\r\n        return __awaiter$1k(this, void 0, void 0, function* () {\r\n            return String.fromCharCode(...this._data.slice(start, (end || start) + 1));\r\n        });\r\n    }\r\n    getCharCode(index) {\r\n        return this._data[index];\r\n    }\r\n}\r\nSyncDataParser.EOL = [\r\n    codes.CARRIAGE_RETURN,\r\n    codes.LINE_FEED,\r\n];\r\nSyncDataParser.delimiterChars = new Set([\r\n    codes.PERCENT,\r\n    codes.L_PARENTHESE,\r\n    codes.R_PARENTHESE,\r\n    codes.SLASH,\r\n    codes.LESS,\r\n    codes.GREATER,\r\n    codes.L_BRACKET,\r\n    codes.R_BRACKET,\r\n    codes.L_BRACE,\r\n    codes.R_BRACE,\r\n]);\r\nSyncDataParser.spaceChars = new Set([\r\n    codes.NULL,\r\n    codes.HORIZONTAL_TAB,\r\n    codes.LINE_FEED,\r\n    codes.FORM_FEED,\r\n    codes.CARRIAGE_RETURN,\r\n    codes.WHITESPACE,\r\n]);\r\nSyncDataParser.digitChars = new Set([\r\n    codes.D_0,\r\n    codes.D_1,\r\n    codes.D_2,\r\n    codes.D_3,\r\n    codes.D_4,\r\n    codes.D_5,\r\n    codes.D_6,\r\n    codes.D_7,\r\n    codes.D_8,\r\n    codes.D_9,\r\n]);\r\nSyncDataParser.newLineChars = new Set([\r\n    codes.CARRIAGE_RETURN,\r\n    codes.LINE_FEED,\r\n]);\n\nclass DataWriter {\r\n    constructor(data) {\r\n        this._dataToAppend = [];\r\n        if (!(data === null || data === void 0 ? void 0 : data.length)) {\r\n            throw new Error(\"Data is empty\");\r\n        }\r\n        this._encoder = new TextEncoder();\r\n        this._sourceData = data.slice(0);\r\n        this._pointer = data.length;\r\n        this.fixEof();\r\n    }\r\n    get offset() {\r\n        return this._pointer;\r\n    }\r\n    getCurrentData() {\r\n        const result = new Uint8Array(this._sourceData.length + this._dataToAppend.length);\r\n        result.set(this._sourceData, 0);\r\n        result.set(this._dataToAppend, this._sourceData.length);\r\n        return result;\r\n    }\r\n    writeBytes(bytes) {\r\n        if (!(bytes === null || bytes === void 0 ? void 0 : bytes.length)) {\r\n            return;\r\n        }\r\n        for (let i = 0; i < bytes.length; i++) {\r\n            this._dataToAppend.push(bytes[i]);\r\n        }\r\n        this._pointer += bytes.length;\r\n    }\r\n    writeIndirectObject(cryptInfo, obj) {\r\n        if (!(cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) || !obj) {\r\n            return;\r\n        }\r\n        const objBytes = [\r\n            ...this._encoder.encode(`${cryptInfo.ref.id} ${cryptInfo.ref.generation} `),\r\n            ...keywordCodes.OBJ, ...keywordCodes.END_OF_LINE,\r\n            ...obj.toArray(cryptInfo), ...keywordCodes.END_OF_LINE,\r\n            ...keywordCodes.OBJ_END, ...keywordCodes.END_OF_LINE,\r\n        ];\r\n        this.writeBytes(objBytes);\r\n    }\r\n    writeIndirectArray(cryptInfo, objs) {\r\n        if (!(cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) || !objs) {\r\n            return;\r\n        }\r\n        const objBytes = [\r\n            ...this._encoder.encode(`${cryptInfo.ref.id} ${cryptInfo.ref.generation} `),\r\n            ...keywordCodes.OBJ, ...keywordCodes.END_OF_LINE,\r\n            codes.L_BRACKET,\r\n        ];\r\n        for (const obj of objs) {\r\n            objBytes.push(codes.WHITESPACE, ...obj.toArray(cryptInfo));\r\n        }\r\n        objBytes.push(codes.R_BRACKET, ...keywordCodes.END_OF_LINE, ...keywordCodes.OBJ_END, ...keywordCodes.END_OF_LINE);\r\n        this.writeBytes(objBytes);\r\n    }\r\n    writeEof(xrefOffset) {\r\n        const eof = [\r\n            ...keywordCodes.XREF_START, ...keywordCodes.END_OF_LINE,\r\n            ...this._encoder.encode(xrefOffset + \"\"), ...keywordCodes.END_OF_LINE,\r\n            ...keywordCodes.END_OF_FILE, ...keywordCodes.END_OF_LINE\r\n        ];\r\n        this.writeBytes(eof);\r\n    }\r\n    fixEof() {\r\n        if (this._sourceData[this._pointer - 1] !== codes.LINE_FEED) {\r\n            if (this._sourceData[this._pointer - 2] !== codes.CARRIAGE_RETURN) {\r\n                this._dataToAppend.push(codes.CARRIAGE_RETURN, codes.LINE_FEED);\r\n                this._pointer += 2;\r\n            }\r\n            else {\r\n                this._dataToAppend.push(codes.LINE_FEED);\r\n                this._pointer += 1;\r\n            }\r\n        }\r\n    }\r\n}\n\nclass XRefEntry {\r\n    constructor(type, id, generation, byteOffset, nextFreeId, streamId, streamIndex) {\r\n        this.type = type;\r\n        this.id = id;\r\n        this.generation = generation;\r\n        this.byteOffset = byteOffset;\r\n        this.nextFreeId = nextFreeId;\r\n        this.streamId = streamId;\r\n        this.streamIndex = streamIndex;\r\n    }\r\n    static isDigit(code) {\r\n        return this.digitChars.has(code);\r\n    }\r\n    static *fromTableBytes(bytes) {\r\n        let i = 0;\r\n        let j = 0;\r\n        while (i < bytes.length) {\r\n            const firstIndexBytes = [];\r\n            let firstIndexDigit = bytes[i++];\r\n            while (XRefEntry.isDigit(firstIndexDigit)) {\r\n                firstIndexBytes.push(firstIndexDigit);\r\n                firstIndexDigit = bytes[i++];\r\n            }\r\n            let firstIndex = parseInt(firstIndexBytes.map(x => String.fromCharCode(x)).join(\"\"), 10);\r\n            const countBytes = [];\r\n            let countDigit = bytes[i++];\r\n            while (XRefEntry.isDigit(countDigit)) {\r\n                countBytes.push(countDigit);\r\n                countDigit = bytes[i++];\r\n            }\r\n            const count = parseInt(countBytes.map(x => String.fromCharCode(x)).join(\"\"), 10);\r\n            while (!XRefEntry.isDigit(bytes[i])) {\r\n                i++;\r\n            }\r\n            for (j = 0; j < count; j++) {\r\n                const value = parseInt(Array.from(bytes.subarray(i, i + 10))\r\n                    .map(x => String.fromCharCode(x)).join(\"\"), 10);\r\n                i += 11;\r\n                const gen = parseInt(Array.from(bytes.subarray(i, i + 5))\r\n                    .map(x => String.fromCharCode(x)).join(\"\"), 10);\r\n                i += 6;\r\n                const typeByte = bytes[i];\r\n                if (typeByte === codes.f) {\r\n                    yield new XRefEntry(xRefEntryTypes.FREE, firstIndex++, gen, null, value);\r\n                }\r\n                else if (typeByte === codes.n) {\r\n                    yield new XRefEntry(xRefEntryTypes.NORMAL, firstIndex++, gen, value);\r\n                }\r\n                i += 3;\r\n            }\r\n        }\r\n        return;\r\n    }\r\n    static *fromStreamBytes(bytes, w, index) {\r\n        const [w1, w2, w3] = w;\r\n        const entryLength = w1 + w2 + w3;\r\n        if (bytes.length % entryLength) {\r\n            throw new Error(\"Incorrect stream length\");\r\n        }\r\n        const count = bytes.length / entryLength;\r\n        const ids = new Array(count);\r\n        if (index === null || index === void 0 ? void 0 : index.length) {\r\n            let id;\r\n            let n;\r\n            let m = 0;\r\n            for (let k = 0; k < index.length; k++) {\r\n                if (!(k % 2)) {\r\n                    id = index[k];\r\n                }\r\n                else {\r\n                    for (n = 0; n < index[k]; n++) {\r\n                        ids[m++] = id + n;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        else {\r\n            let l = 0;\r\n            while (l < count) {\r\n                ids[l++] = l;\r\n            }\r\n        }\r\n        let i = 0;\r\n        let j = 0;\r\n        let type;\r\n        let value1;\r\n        let value2;\r\n        while (i < bytes.length) {\r\n            type = w1\r\n                ? ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(bytes.slice(i, i + w1))\r\n                : 1;\r\n            i += w1;\r\n            value1 = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(bytes.slice(i, i + w2));\r\n            i += w2;\r\n            value2 = w3\r\n                ? ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(bytes.slice(i, i + w3))\r\n                : null;\r\n            i += w3;\r\n            switch (type) {\r\n                case xRefEntryTypes.FREE:\r\n                    yield new XRefEntry(xRefEntryTypes.FREE, ids[j++], value2 !== null && value2 !== void 0 ? value2 : maxGeneration, null, value1);\r\n                    break;\r\n                case xRefEntryTypes.NORMAL:\r\n                    yield new XRefEntry(xRefEntryTypes.NORMAL, ids[j++], value2 !== null && value2 !== void 0 ? value2 : 0, value1);\r\n                    break;\r\n                case xRefEntryTypes.COMPRESSED:\r\n                    yield new XRefEntry(xRefEntryTypes.COMPRESSED, ids[j++], 0, null, null, value1, value2);\r\n                    break;\r\n            }\r\n        }\r\n        return;\r\n    }\r\n    static toTableBytes(entries) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length)) {\r\n            return null;\r\n        }\r\n        const encoder = new TextEncoder();\r\n        const groups = this.groupEntries(entries);\r\n        let bytes = new Uint8Array();\r\n        let temp;\r\n        let line;\r\n        for (const group of groups) {\r\n            line = `${group[0]} ${group[1].length}\\r\\n`;\r\n            temp = new Uint8Array(bytes.length + line.length);\r\n            temp.set(bytes);\r\n            temp.set(encoder.encode(line), bytes.length);\r\n            bytes = temp;\r\n            for (const entry of group[1]) {\r\n                switch (entry.type) {\r\n                    case xRefEntryTypes.FREE:\r\n                        line = `${entry.nextFreeId.toString().padStart(10, \"0\")} ${entry.generation.toString().padStart(5, \"0\")} f\\r\\n`;\r\n                        break;\r\n                    case xRefEntryTypes.NORMAL:\r\n                        line = `${entry.byteOffset.toString().padStart(10, \"0\")} ${entry.generation.toString().padStart(5, \"0\")} n\\r\\n`;\r\n                        break;\r\n                    default:\r\n                        continue;\r\n                }\r\n                temp = new Uint8Array(bytes.length + line.length);\r\n                temp.set(bytes);\r\n                temp.set(encoder.encode(line), bytes.length);\r\n                bytes = temp;\r\n            }\r\n        }\r\n        return bytes;\r\n    }\r\n    static toStreamBytes(entries, w = [1, 4, 2]) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length)) {\r\n            return null;\r\n        }\r\n        if (Math.min(...w) < 0) {\r\n            throw new Error(\"Negative length values are not permitted\");\r\n        }\r\n        let [w1, w2, w3] = w;\r\n        w1 !== null && w1 !== void 0 ? w1 : (w1 = 0);\r\n        w2 !== null && w2 !== void 0 ? w2 : (w2 = 4);\r\n        w3 !== null && w3 !== void 0 ? w3 : (w3 = 0);\r\n        const entryLength = w1 + w2 + w3;\r\n        let w1ToBytesFunc;\r\n        let w2ToBytesFunc;\r\n        let w3ToBytesFunc;\r\n        switch (w1) {\r\n            case 0:\r\n                w1ToBytesFunc = () => new Uint8Array();\r\n                break;\r\n            case 1:\r\n                w1ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int8ToBytes;\r\n                break;\r\n            case 2:\r\n                w1ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes;\r\n                break;\r\n            default:\r\n                w2ToBytesFunc = (n) => new Uint8Array([...new Array(w1 - 2)\r\n                        .fill(0), ...ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes(n)]);\r\n                break;\r\n        }\r\n        switch (w2) {\r\n            case 1:\r\n                w2ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int8ToBytes;\r\n                break;\r\n            case 2:\r\n                w2ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes;\r\n                break;\r\n            case 3:\r\n                w2ToBytesFunc = (n) => new Uint8Array([0, ...ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes(n)]);\r\n                break;\r\n            case 4:\r\n                w2ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes;\r\n                break;\r\n            default:\r\n                w2ToBytesFunc = (n) => new Uint8Array([...new Array(w1 - 4)\r\n                        .fill(0), ...ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(n)]);\r\n                break;\r\n        }\r\n        switch (w3) {\r\n            case 0:\r\n                w3ToBytesFunc = () => new Uint8Array();\r\n                break;\r\n            case 1:\r\n                w3ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int8ToBytes;\r\n                break;\r\n            case 2:\r\n                w3ToBytesFunc = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes;\r\n                break;\r\n            default:\r\n                w2ToBytesFunc = (n) => new Uint8Array([...new Array(w1 - 2)\r\n                        .fill(0), ...ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int16ToBytes(n)]);\r\n                break;\r\n        }\r\n        new TextEncoder();\r\n        const groups = this.groupEntries(entries);\r\n        const index = [];\r\n        let bytes = new Uint8Array();\r\n        let temp;\r\n        let entryV1;\r\n        let entryV2;\r\n        let entryV3;\r\n        for (const group of groups) {\r\n            index.push(group[0], group[1].length);\r\n            for (const entry of group[1]) {\r\n                switch (entry.type) {\r\n                    case xRefEntryTypes.FREE:\r\n                        entryV1 = w1ToBytesFunc(0);\r\n                        entryV2 = w2ToBytesFunc(entry.nextFreeId);\r\n                        entryV3 = w3ToBytesFunc(entry.generation);\r\n                        break;\r\n                    case xRefEntryTypes.NORMAL:\r\n                        entryV1 = w1ToBytesFunc(1);\r\n                        entryV2 = w2ToBytesFunc(entry.byteOffset);\r\n                        entryV3 = w3ToBytesFunc(entry.generation);\r\n                        break;\r\n                    case xRefEntryTypes.COMPRESSED:\r\n                        entryV1 = w1ToBytesFunc(2);\r\n                        entryV2 = w2ToBytesFunc(entry.streamId);\r\n                        entryV3 = w3ToBytesFunc(entry.streamIndex);\r\n                        break;\r\n                    default:\r\n                        continue;\r\n                }\r\n                temp = new Uint8Array(bytes.length + entryLength);\r\n                temp.set(bytes);\r\n                temp.set(entryV1, bytes.length);\r\n                temp.set(entryV2, bytes.length + w1);\r\n                temp.set(entryV3, bytes.length + w1 + w2);\r\n                bytes = temp;\r\n            }\r\n        }\r\n        return { bytes, index };\r\n    }\r\n    static groupEntries(entries) {\r\n        entries.sort((a, b) => a.id - b.id);\r\n        const groups = [];\r\n        let groupStart;\r\n        let groupEntries;\r\n        let last;\r\n        for (const entry of entries) {\r\n            if (entry.id !== last + 1) {\r\n                if (groupEntries === null || groupEntries === void 0 ? void 0 : groupEntries.length) {\r\n                    groups.push([groupStart, groupEntries]);\r\n                }\r\n                groupStart = entry.id;\r\n                groupEntries = [entry];\r\n            }\r\n            else {\r\n                groupEntries.push(entry);\r\n            }\r\n            last = entry.id;\r\n        }\r\n        if (groupEntries === null || groupEntries === void 0 ? void 0 : groupEntries.length) {\r\n            groups.push([groupStart, groupEntries]);\r\n        }\r\n        return groups;\r\n    }\r\n}\r\nXRefEntry.digitChars = new Set([\r\n    codes.D_0,\r\n    codes.D_1,\r\n    codes.D_2,\r\n    codes.D_3,\r\n    codes.D_4,\r\n    codes.D_5,\r\n    codes.D_6,\r\n    codes.D_7,\r\n    codes.D_8,\r\n    codes.D_9,\r\n]);\n\nclass ReferenceDataChange {\r\n    constructor(refData) {\r\n        this._refData = refData;\r\n        this._size = refData.size;\r\n        const freeLinkedList = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.LinkedList();\r\n        for (const freeRef of refData.freeLinkedList) {\r\n            freeLinkedList.push(Object.assign({}, freeRef));\r\n        }\r\n        this._freeLinkedList = freeLinkedList;\r\n        this._usedMap = new Map();\r\n    }\r\n    get size() {\r\n        return this._size;\r\n    }\r\n    getUsedRef(id) {\r\n        return this._usedMap.get(id);\r\n    }\r\n    takeFreeRef(byteOffset, forceNew = false) {\r\n        let ref;\r\n        if (!forceNew && this._freeLinkedList.length > 1) {\r\n            const freeRef = this._freeLinkedList.pop();\r\n            this._freeLinkedList.tail.nextFreeId = 0;\r\n            ref = {\r\n                id: freeRef.id,\r\n                generation: freeRef.generation,\r\n                byteOffset,\r\n            };\r\n        }\r\n        else {\r\n            ref = {\r\n                id: this._size++,\r\n                generation: 0,\r\n                byteOffset,\r\n            };\r\n        }\r\n        this._usedMap.set(ref.id, ref);\r\n        return ref;\r\n    }\r\n    setRefFree(id) {\r\n        if (this._usedMap.has(id)) {\r\n            this._usedMap.delete(id);\r\n            if (this._size > this._refData.size && this._size === id + 1) {\r\n                this._size--;\r\n            }\r\n        }\r\n        if (this._refData.isUsed(id)) {\r\n            const gen = this._refData.getGeneration(id);\r\n            const ref = { id: id, generation: gen + 1, nextFreeId: 0 };\r\n            const index = this._freeLinkedList.findIndex(ref, (a, b) => a.id === b.id && a.generation <= b.generation);\r\n            if (index !== -1) {\r\n                return;\r\n            }\r\n            const lastFreeRef = this._freeLinkedList.tail;\r\n            lastFreeRef.nextFreeId = id;\r\n            this._freeLinkedList.push(ref);\r\n        }\r\n    }\r\n    updateUsedRef(ref) {\r\n        if (ref.compressed && ref.generation) {\r\n            throw new Error(`Compressed ref generation can't be greater than zero: '${ref.id} ${ref.generation} R'`);\r\n        }\r\n        if (this.isFreed(ref)) {\r\n            throw new Error(`The reference is freed: '${ref.id} ${ref.generation} R'`);\r\n        }\r\n        const current = this._usedMap.get(ref.id);\r\n        if (current) {\r\n            throw new Error(`Same reference has been issued twice: '${current.id} ${current.generation} R'`);\r\n        }\r\n        if (this._refData.isUsed(ref.id)) {\r\n            const gen = this._refData.getGeneration(ref.id);\r\n            if (ref.generation >= gen) {\r\n                this._usedMap.set(ref.id, ref);\r\n                return true;\r\n            }\r\n            throw new Error(`The reference has an old generation: '${current.id} ${current.generation} R'`);\r\n        }\r\n        throw new Error(`The reference is not used: '${current.id} ${current.generation} R'`);\r\n    }\r\n    exportEntries() {\r\n        const entries = [];\r\n        for (const entry of this._freeLinkedList) {\r\n            entries.push(new XRefEntry(xRefEntryTypes.FREE, entry.id, entry.generation, null, entry.nextFreeId));\r\n        }\r\n        this._usedMap.forEach(v => {\r\n            if (v.compressed) {\r\n                entries.push(new XRefEntry(xRefEntryTypes.COMPRESSED, v.id, 0, null, null, v.streamId, v.streamIndex));\r\n            }\r\n            else {\r\n                entries.push(new XRefEntry(xRefEntryTypes.NORMAL, v.id, v.generation, v.byteOffset));\r\n            }\r\n        });\r\n        return entries;\r\n    }\r\n    isFreed(ref) {\r\n        return this._freeLinkedList.has(ref, (a, b) => a.id === b.id && a.generation < b.generation);\r\n    }\r\n    isUsedInSource(id) {\r\n        return this._refData.isUsed(id);\r\n    }\r\n}\n\nvar __awaiter$1j = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ObjectId {\r\n    constructor(id, generation) {\r\n        this.id = id !== null && id !== void 0 ? id : 0;\r\n        this.generation = generation !== null && generation !== void 0 ? generation : 0;\r\n    }\r\n    static parseAsync(parser, start, skipEmpty = true) {\r\n        return __awaiter$1j(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield parser.findRegularIndexAsync(true, start);\r\n            }\r\n            if (start < 0 || start > parser.maxIndex) {\r\n                return null;\r\n            }\r\n            const id = yield parser.parseNumberAtAsync(start, false, false);\r\n            if (!id || isNaN(id.value)) {\r\n                return null;\r\n            }\r\n            const generation = yield parser.parseNumberAtAsync(id.end + 2, false, false);\r\n            if (!generation || isNaN(generation.value)) {\r\n                return null;\r\n            }\r\n            return {\r\n                value: new ObjectId(id.value, generation.value),\r\n                start,\r\n                end: generation.end,\r\n            };\r\n        });\r\n    }\r\n    static parseRefAsync(parser, start, skipEmpty = true) {\r\n        return __awaiter$1j(this, void 0, void 0, function* () {\r\n            const id = yield ObjectId.parseAsync(parser, start, skipEmpty);\r\n            if (!id) {\r\n                return null;\r\n            }\r\n            const rIndexSupposed = id.end + 2;\r\n            const rIndex = yield parser.findSubarrayIndexAsync([codes.R], { minIndex: rIndexSupposed, closedOnly: true });\r\n            if (!rIndex || rIndex.start !== rIndexSupposed) {\r\n                return null;\r\n            }\r\n            return {\r\n                value: id.value,\r\n                start: id.start,\r\n                end: rIndex.end,\r\n            };\r\n        });\r\n    }\r\n    static parseRefArrayAsync(parser, start, skipEmpty = true) {\r\n        return __awaiter$1j(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield parser.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const ids = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                current = yield ObjectId.parseRefAsync(parser, i, true);\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                ids.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: ids, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    static fromRef(ref) {\r\n        return new ObjectId(ref.id, ref.generation);\r\n    }\r\n    equals(other) {\r\n        return this.id === other.id\r\n            && this.generation === other.generation;\r\n    }\r\n    toArray(cryptInfo) {\r\n        return new TextEncoder().encode(`${this.id} ${this.generation} R`);\r\n    }\r\n    toString() {\r\n        return this.id + \"|\" + this.generation;\r\n    }\r\n}\n\nvar __awaiter$1i = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass DateString {\r\n    constructor(source, date) {\r\n        this._source = source;\r\n        this._date = new Date(date);\r\n    }\r\n    get source() {\r\n        return this._source;\r\n    }\r\n    get date() {\r\n        return new Date(this._date);\r\n    }\r\n    static parseAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1i(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield parser.skipEmptyAsync(start);\r\n            }\r\n            if (parser.isOutside(start) || !(yield parser.isCodeAtAsync(start, codes.L_PARENTHESE))) {\r\n                return null;\r\n            }\r\n            const end = yield parser.findCharIndexAsync(codes.R_PARENTHESE, true, start);\r\n            if (end === -1) {\r\n                return null;\r\n            }\r\n            let bytes = yield parser.sliceCharCodesAsync(start + 1, end - 1);\r\n            if ((cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.stringCryptor) {\r\n                bytes = cryptInfo.stringCryptor.decrypt(bytes, cryptInfo.ref);\r\n            }\r\n            try {\r\n                const date = DateString.fromArray(bytes);\r\n                return { value: date, start, end };\r\n            }\r\n            catch (_a) {\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    static fromDate(date) {\r\n        const year = date.getFullYear();\r\n        const month = String(date.getMonth() + 1).padStart(2, \"0\");\r\n        const day = String(date.getDate()).padStart(2, \"0\");\r\n        const hours = String(date.getHours()).padStart(2, \"0\");\r\n        const minutes = String(date.getMinutes()).padStart(2, \"0\");\r\n        const seconds = String(date.getSeconds()).padStart(2, \"0\");\r\n        const source = `D:${year}${month}${day}${hours}${minutes}${seconds}`;\r\n        return new DateString(source, date);\r\n    }\r\n    static fromString(source) {\r\n        const result = /D:(?<Y>\\d{4})(?<M>\\d{2})(?<D>\\d{2})(?<h>\\d{2})(?<m>\\d{2})(?<s>\\d{2})/.exec(source);\r\n        const date = new Date(+result.groups.Y, +result.groups.M - 1, +result.groups.D, +result.groups.h, +result.groups.m, +result.groups.s);\r\n        return new DateString(source, date);\r\n    }\r\n    static fromArray(arr) {\r\n        const source = new TextDecoder().decode(arr);\r\n        return DateString.fromString(source);\r\n    }\r\n    toArray(cryptInfo) {\r\n        let bytes = new TextEncoder().encode(this._source);\r\n        if ((cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.stringCryptor) {\r\n            bytes = cryptInfo.stringCryptor.encrypt(bytes, cryptInfo.ref);\r\n        }\r\n        return new Uint8Array([\r\n            ...keywordCodes.STR_LITERAL_START,\r\n            ...bytes,\r\n            ...keywordCodes.STR_LITERAL_END,\r\n        ]);\r\n    }\r\n}\n\nvar __awaiter$1h = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass HexString {\r\n    constructor(literal, hex, bytes) {\r\n        this._literal = literal;\r\n        this._hex = hex;\r\n        this._bytes = bytes;\r\n    }\r\n    get literal() {\r\n        return this._literal;\r\n    }\r\n    get hex() {\r\n        return this._hex.slice();\r\n    }\r\n    get bytes() {\r\n        return this._bytes.slice();\r\n    }\r\n    static parseAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1h(this, void 0, void 0, function* () {\r\n            const bounds = yield parser.getHexBoundsAtAsync(start, skipEmpty);\r\n            if (!bounds) {\r\n                return null;\r\n            }\r\n            let bytes = yield parser.sliceCharCodesAsync(bounds.start + 1, bounds.end - 1);\r\n            if ((cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.stringCryptor) {\r\n                bytes = cryptInfo.stringCryptor.decrypt(bytes, cryptInfo.ref);\r\n            }\r\n            const hex = HexString.fromBytes(bytes);\r\n            return { value: hex, start: bounds.start, end: bounds.end };\r\n        });\r\n    }\r\n    static parseArrayAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1h(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield parser.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const hexes = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                current = yield HexString.parseAsync(parser, i, cryptInfo, skipEmpty);\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                hexes.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: hexes, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    static fromBytes(bytes) {\r\n        const literal = new TextDecoder().decode(bytes);\r\n        const hex = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.hexStringToBytes(literal);\r\n        return new HexString(literal, hex, bytes);\r\n    }\r\n    static fromHexBytes(hex) {\r\n        let literal = \"\";\r\n        hex.forEach(x => literal += x.toString(16).padStart(2, \"0\"));\r\n        const bytes = new TextEncoder().encode(literal);\r\n        return new HexString(literal, hex, bytes);\r\n    }\r\n    static fromString(literal) {\r\n        const hex = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.hexStringToBytes(literal);\r\n        const bytes = new TextEncoder().encode(literal);\r\n        return new HexString(literal, hex, bytes);\r\n    }\r\n    ;\r\n    toArray(cryptInfo) {\r\n        return new Uint8Array([\r\n            ...keywordCodes.STR_HEX_START,\r\n            ...this._bytes,\r\n            ...keywordCodes.STR_HEX_END,\r\n        ]);\r\n    }\r\n}\n\nvar __awaiter$1g = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass LiteralString {\r\n    constructor(literal, bytes) {\r\n        this._literal = literal;\r\n        this._bytes = bytes;\r\n    }\r\n    get literal() {\r\n        return this._literal;\r\n    }\r\n    get bytes() {\r\n        return this._bytes.slice();\r\n    }\r\n    static parseAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1g(this, void 0, void 0, function* () {\r\n            const bounds = yield parser.getLiteralBoundsAtAsync(start, skipEmpty);\r\n            if (!bounds) {\r\n                return;\r\n            }\r\n            let bytes = LiteralString.unescape(yield parser.sliceCharCodesAsync(bounds.start + 1, bounds.end - 1));\r\n            if ((cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.stringCryptor) {\r\n                bytes = cryptInfo.stringCryptor.decrypt(bytes, cryptInfo.ref);\r\n            }\r\n            const result = LiteralString.fromBytes(bytes);\r\n            return { value: result, start: bounds.start, end: bounds.end };\r\n        });\r\n    }\r\n    static parseArrayAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1g(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield parser.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const strings = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                current = yield LiteralString.parseAsync(parser, i, cryptInfo, skipEmpty);\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                strings.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: strings, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    static fromBytes(bytes) {\r\n        const decoder = bytes[0] === 254 && bytes[1] === 255\r\n            ? new TextDecoder(\"utf-16be\")\r\n            : new TextDecoder();\r\n        const literal = decoder.decode(bytes);\r\n        return new LiteralString(literal, bytes);\r\n    }\r\n    static fromString(source) {\r\n        const bytes = [];\r\n        bytes.push(254, 255);\r\n        for (let i = 0; i < source.length; i++) {\r\n            const charCode = source.charCodeAt(i);\r\n            bytes.push((charCode & 0xFF00) >>> 8);\r\n            bytes.push(charCode & 0xFF);\r\n        }\r\n        return new LiteralString(source, new Uint8Array(bytes));\r\n    }\r\n    static escape(bytes) {\r\n        const result = [];\r\n        for (let i = 0; i < bytes.length; i++) {\r\n            switch (bytes[i]) {\r\n                case codes.LINE_FEED:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.n);\r\n                    break;\r\n                case codes.CARRIAGE_RETURN:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.r);\r\n                    break;\r\n                case codes.HORIZONTAL_TAB:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.t);\r\n                    break;\r\n                case codes.BACKSPACE:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.b);\r\n                    break;\r\n                case codes.FORM_FEED:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.f);\r\n                    break;\r\n                case codes.L_PARENTHESE:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.L_PARENTHESE);\r\n                    break;\r\n                case codes.R_PARENTHESE:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.R_PARENTHESE);\r\n                    break;\r\n                case codes.BACKSLASH:\r\n                    result.push(codes.BACKSLASH);\r\n                    result.push(codes.BACKSLASH);\r\n                    break;\r\n                default:\r\n                    result.push(bytes[i]);\r\n                    break;\r\n            }\r\n        }\r\n        return new Uint8Array(result);\r\n    }\r\n    static unescape(bytes) {\r\n        const result = [];\r\n        let escaped = false;\r\n        for (let i = 0; i < bytes.length; i++) {\r\n            if (escaped) {\r\n                switch (bytes[i]) {\r\n                    case codes.n:\r\n                        result.push(codes.LINE_FEED);\r\n                        break;\r\n                    case codes.r:\r\n                        result.push(codes.CARRIAGE_RETURN);\r\n                        break;\r\n                    case codes.t:\r\n                        result.push(codes.HORIZONTAL_TAB);\r\n                        break;\r\n                    case codes.b:\r\n                        result.push(codes.BACKSPACE);\r\n                        break;\r\n                    case codes.f:\r\n                        result.push(codes.FORM_FEED);\r\n                        break;\r\n                    case codes.L_PARENTHESE:\r\n                        result.push(codes.L_PARENTHESE);\r\n                        break;\r\n                    case codes.R_PARENTHESE:\r\n                        result.push(codes.R_PARENTHESE);\r\n                        break;\r\n                    case codes.BACKSLASH:\r\n                        result.push(codes.BACKSLASH);\r\n                        break;\r\n                    default:\r\n                        result.push(bytes[i]);\r\n                        break;\r\n                }\r\n                escaped = false;\r\n                continue;\r\n            }\r\n            if (bytes[i] === codes.BACKSLASH) {\r\n                escaped = true;\r\n                continue;\r\n            }\r\n            result.push(bytes[i]);\r\n        }\r\n        return new Uint8Array(result);\r\n    }\r\n    toArray(cryptInfo) {\r\n        const bytes = (cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.stringCryptor\r\n            ? cryptInfo.stringCryptor.encrypt(this._bytes, cryptInfo.ref)\r\n            : this._bytes;\r\n        return new Uint8Array([\r\n            ...keywordCodes.STR_LITERAL_START,\r\n            ...LiteralString.escape(bytes),\r\n            ...keywordCodes.STR_LITERAL_END,\r\n        ]);\r\n    }\r\n}\n\nvar __awaiter$1f = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PdfObject {\r\n    constructor() {\r\n        this._added = false;\r\n        this._edited = false;\r\n        this._deleted = false;\r\n        this.onChange = {\r\n            set: (target, prop, value) => {\r\n                if (prop[0] !== \"_\" && prop[0] !== \"$\") {\r\n                    this._edited || (this._edited = true);\r\n                    if (this.$onChangeAction) {\r\n                        this.$onChangeAction();\r\n                    }\r\n                }\r\n                target[prop] = value;\r\n                return true;\r\n            },\r\n        };\r\n    }\r\n    get sourceBytes() {\r\n        var _a;\r\n        return (_a = this._sourceBytes) === null || _a === void 0 ? void 0 : _a.slice();\r\n    }\r\n    get sourceChars() {\r\n        return this._sourceBytes\r\n            ? String.fromCharCode(...this._sourceBytes.slice(0, this._sourceBytes.length))\r\n            : \"\";\r\n    }\r\n    get ref() {\r\n        return this._ref;\r\n    }\r\n    set ref(ref) {\r\n        this._ref = ref;\r\n    }\r\n    get id() {\r\n        var _a;\r\n        return (_a = this._ref) === null || _a === void 0 ? void 0 : _a.id;\r\n    }\r\n    get generation() {\r\n        var _a;\r\n        return (_a = this._ref) === null || _a === void 0 ? void 0 : _a.generation;\r\n    }\r\n    get added() {\r\n        return this._added;\r\n    }\r\n    get edited() {\r\n        return this._edited;\r\n    }\r\n    get deleted() {\r\n        return this._deleted;\r\n    }\r\n    static getDataParserAsync(data) {\r\n        var _a;\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parser = (_a = BgDataParser.tryGetParser(data.slice())) !== null && _a !== void 0 ? _a : SyncDataParser.tryGetParser(data);\r\n            return parser;\r\n        });\r\n    }\r\n    markAsDeleted(value = true) {\r\n        this._deleted = value;\r\n    }\r\n    initProxy() {\r\n        const proxy = new Proxy(this, this.onChange);\r\n        this._proxy = proxy;\r\n        return proxy;\r\n    }\r\n    getProxy() {\r\n        return this._proxy || this;\r\n    }\r\n    encodePrimitiveArray(array, encoder) {\r\n        encoder || (encoder = new TextEncoder());\r\n        const bytes = [codes.L_BRACKET];\r\n        array.forEach(x => bytes.push(...encoder.encode(\" \" + x)));\r\n        bytes.push(codes.R_BRACKET);\r\n        return bytes;\r\n    }\r\n    encodeNestedPrimitiveArray(array, encoder) {\r\n        encoder || (encoder = new TextEncoder());\r\n        const bytes = [codes.L_BRACKET];\r\n        array.forEach(x => {\r\n            bytes.push(codes.L_BRACKET);\r\n            x.forEach(y => bytes.push(...encoder.encode(\" \" + y)));\r\n            bytes.push(codes.R_BRACKET);\r\n        });\r\n        bytes.push(codes.R_BRACKET);\r\n        return bytes;\r\n    }\r\n    encodeSerializableArray(array, cryptInfo) {\r\n        const bytes = [codes.L_BRACKET];\r\n        array.forEach(x => bytes.push(codes.WHITESPACE, ...x.toArray(cryptInfo)));\r\n        bytes.push(codes.R_BRACKET);\r\n        return bytes;\r\n    }\r\n    parseRefPropAsync(propName, parser, index) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield ObjectId.parseRefAsync(parser, index);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseRefArrayPropAsync(propName, parser, index) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield ObjectId.parseRefArrayAsync(parser, index);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseBoolPropAsync(propName, parser, index) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield parser.parseBoolAtAsync(index);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseNamePropAsync(propName, parser, index, includeSlash = true) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield parser.parseNameAtAsync(index, includeSlash);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseNameArrayPropAsync(propName, parser, index, includeSlash = true) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield parser.parseNameArrayAtAsync(index, includeSlash);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseNumberPropAsync(propName, parser, index, float = true) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield parser.parseNumberAtAsync(index, float);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseNumberArrayPropAsync(propName, parser, index, float = true) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield parser.parseNumberArrayAtAsync(index, float);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseDatePropAsync(propName, parser, index, cryptInfo) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield DateString.parseAsync(parser, index, cryptInfo);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseLiteralPropAsync(propName, parser, index, cryptInfo) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield LiteralString.parseAsync(parser, index, cryptInfo);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    parseHexPropAsync(propName, parser, index, cryptInfo) {\r\n        return __awaiter$1f(this, void 0, void 0, function* () {\r\n            const parsed = yield HexString.parseAsync(parser, index, cryptInfo);\r\n            return this.setParsedProp(propName, parsed);\r\n        });\r\n    }\r\n    setParsedProp(propName, parsed) {\r\n        if (!parsed) {\r\n            throw new Error(`Can't parse ${propName} property value`);\r\n        }\r\n        this[propName.slice(1)] = parsed.value;\r\n        return parsed.end + 1;\r\n    }\r\n}\n\nvar __awaiter$1e = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PdfDict extends PdfObject {\r\n    constructor(type) {\r\n        super();\r\n        this.Type = type;\r\n    }\r\n    get streamId() {\r\n        return this._streamId;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const encoder = new TextEncoder();\r\n        const bytes = [...keywordCodes.DICT_START];\r\n        if (this.Type) {\r\n            bytes.push(...keywordCodes.TYPE, ...encoder.encode(this.Type));\r\n        }\r\n        bytes.push(...keywordCodes.DICT_END);\r\n        return new Uint8Array(bytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        var _a;\r\n        return __awaiter$1e(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parse info is empty\");\r\n            }\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            this._ref = (_a = parseInfo.cryptInfo) === null || _a === void 0 ? void 0 : _a.ref;\r\n            this._streamId = parseInfo.streamId;\r\n            this._sourceBytes = yield parser.sliceCharCodesAsync(start, end);\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            if (i === -1) {\r\n                throw new Error(\"Dict is empty (has no properties)\");\r\n            }\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Type\":\r\n                            const type = yield parser.parseNameAtAsync(i);\r\n                            if (type) {\r\n                                if (this.Type && this.Type !== type.value) {\r\n                                    throw new Error(`Ivalid dict type: '${type.value}' instead of '${this.Type}'`);\r\n                                }\r\n                                return;\r\n                            }\r\n                            throw new Error(\"Can't parse /Type property value\");\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$1d = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass DecodeParamsDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.EMPTY);\r\n        this._intPropMap = new Map();\r\n        this._boolPropMap = new Map();\r\n        this._namePropMap = new Map();\r\n        this._refPropMap = new Map();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$1d(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new DecodeParamsDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    static parseArrayAsync(parser, start, cryptInfo = null, skipEmpty = true) {\r\n        return __awaiter$1d(this, void 0, void 0, function* () {\r\n            const arrayBounds = yield parser.getArrayBoundsAtAsync(start, skipEmpty);\r\n            if (!arrayBounds) {\r\n                return null;\r\n            }\r\n            const paramsDicts = [];\r\n            let current;\r\n            let i = arrayBounds.start + 1;\r\n            while (i < arrayBounds.end) {\r\n                const paramsBounds = yield parser.getDictBoundsAtAsync(i);\r\n                current = yield DecodeParamsDict.parseAsync({ parser, bounds: paramsBounds, cryptInfo });\r\n                if (!current) {\r\n                    break;\r\n                }\r\n                paramsDicts.push(current.value);\r\n                i = current.end + 1;\r\n            }\r\n            return { value: paramsDicts, start: arrayBounds.start, end: arrayBounds.end };\r\n        });\r\n    }\r\n    getIntProp(name) {\r\n        return this._intPropMap.get(name);\r\n    }\r\n    getBoolProp(name) {\r\n        return this._boolPropMap.get(name);\r\n    }\r\n    getNameProp(name) {\r\n        return this._namePropMap.get(name);\r\n    }\r\n    getRefProp(name) {\r\n        return this._refPropMap.get(name);\r\n    }\r\n    setIntProp(name, value) {\r\n        return this._intPropMap.set(name, value);\r\n    }\r\n    setBoolProp(name, value) {\r\n        return this._boolPropMap.set(name, value);\r\n    }\r\n    setNameProp(name, value) {\r\n        return this._namePropMap.set(name, value);\r\n    }\r\n    setRefProp(name, value) {\r\n        return this._refPropMap.set(name, value);\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        this._intPropMap.forEach((v, k) => bytes.push(...encoder.encode(k), ...encoder.encode(\" \" + v)));\r\n        this._boolPropMap.forEach((v, k) => bytes.push(...encoder.encode(k), ...encoder.encode(\" \" + v)));\r\n        this._namePropMap.forEach((v, k) => bytes.push(...encoder.encode(k), ...encoder.encode(v)));\r\n        this._refPropMap.forEach((v, k) => bytes.push(...encoder.encode(k), ...v.toArray(cryptInfo)));\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$1d(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    const valueType = yield parser.getValueTypeAtAsync(i);\r\n                    switch (valueType) {\r\n                        case valueTypes.NUMBER:\r\n                            const intValue = yield parser.parseNumberAtAsync(i, false);\r\n                            if (intValue) {\r\n                                this._intPropMap.set(name, intValue.value);\r\n                                i = intValue.end + 1;\r\n                                continue;\r\n                            }\r\n                            break;\r\n                        case valueTypes.BOOLEAN:\r\n                            const boolValue = yield parser.parseBoolAtAsync(i);\r\n                            if (boolValue) {\r\n                                this._boolPropMap.set(name, boolValue.value);\r\n                                i = boolValue.end + 1;\r\n                                continue;\r\n                            }\r\n                            break;\r\n                        case valueTypes.NAME:\r\n                            const nameValue = yield parser.parseNameAtAsync(i);\r\n                            if (nameValue) {\r\n                                this._namePropMap.set(name, nameValue.value);\r\n                                i = nameValue.end + 1;\r\n                                continue;\r\n                            }\r\n                            break;\r\n                        case valueTypes.REF:\r\n                            const refValue = yield ObjectId.parseRefAsync(parser, i);\r\n                            if (refValue) {\r\n                                this._refPropMap.set(name, refValue.value);\r\n                                i = refValue.end + 1;\r\n                                continue;\r\n                            }\r\n                            break;\r\n                    }\r\n                    i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nclass DecodedStream {\r\n    constructor(encodedStream) {\r\n        this._minBufferLength = 512;\r\n        this._bufferLength = 0;\r\n        this._current = 0;\r\n        this._ended = false;\r\n        this._sourceStream = encodedStream;\r\n    }\r\n    get length() {\r\n        return this._buffer.length;\r\n    }\r\n    ensureBuffer(size) {\r\n        const buffer = this._buffer;\r\n        if (buffer && size <= buffer.byteLength) {\r\n            return buffer;\r\n        }\r\n        let length = this._minBufferLength;\r\n        while (length < size) {\r\n            length *= 2;\r\n        }\r\n        const enlargedBuffer = new Uint8Array(length);\r\n        if (buffer) {\r\n            enlargedBuffer.set(buffer);\r\n        }\r\n        return (this._buffer = enlargedBuffer);\r\n    }\r\n    takeByte() {\r\n        const current = this._current;\r\n        while (this._bufferLength <= current) {\r\n            if (this._ended) {\r\n                return -1;\r\n            }\r\n            this._readBlock();\r\n        }\r\n        return this._buffer[this._current++];\r\n    }\r\n    takeBytes(length) {\r\n        let end;\r\n        const position = this._current;\r\n        if (length) {\r\n            this.ensureBuffer(position + length);\r\n            end = position + length;\r\n            while (!this._ended && this._bufferLength < end) {\r\n                this._readBlock();\r\n            }\r\n            if (end > this._bufferLength) {\r\n                end = this._bufferLength;\r\n            }\r\n        }\r\n        else {\r\n            while (!this._ended) {\r\n                this._readBlock();\r\n            }\r\n            end = this._bufferLength;\r\n        }\r\n        this._current = end;\r\n        const subarray = this._buffer.subarray(position, end);\r\n        return subarray;\r\n    }\r\n    takeUint16() {\r\n        const byte_0 = this.takeByte();\r\n        const byte_1 = this.takeByte();\r\n        if (byte_0 === -1 || byte_1 === -1) {\r\n            return -1;\r\n        }\r\n        return (byte_0 << 8) + byte_1;\r\n    }\r\n    takeInt32() {\r\n        const byte_0 = this.takeByte();\r\n        const byte_1 = this.takeByte();\r\n        const byte_2 = this.takeByte();\r\n        const byte_3 = this.takeByte();\r\n        return (byte_0 << 24) + (byte_1 << 16) + (byte_2 << 8) + byte_3;\r\n    }\r\n    peekByte() {\r\n        const peekedByte = this.takeByte();\r\n        if (peekedByte !== -1) {\r\n            this._current--;\r\n        }\r\n        return peekedByte;\r\n    }\r\n    peekBytes(length) {\r\n        const bytes = this.takeBytes(length);\r\n        this._current -= bytes.length;\r\n        return bytes;\r\n    }\r\n    skip(n) {\r\n        this._current += n || 1;\r\n    }\r\n    reset() {\r\n        this._current = 0;\r\n    }\r\n}\n\nclass FlateStream extends DecodedStream {\r\n    constructor(encodedStream) {\r\n        super(encodedStream);\r\n        this._codeSize = 0;\r\n        this._codeBuf = 0;\r\n        const cmf = encodedStream.takeByte();\r\n        const flg = encodedStream.takeByte();\r\n        if (cmf === -1 || flg === -1) {\r\n            throw new Error(`Invalid header in flate stream: ${cmf}, ${flg}`);\r\n        }\r\n        if ((cmf & 0x0f) !== 0x08) {\r\n            throw new Error(`Unknown compression method in flate stream: ${cmf}, ${flg}`);\r\n        }\r\n        if (((cmf << 8) + flg) % 31 !== 0) {\r\n            throw new Error(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);\r\n        }\r\n        if (flg & 0x20) {\r\n            throw new Error(`FDICT bit set in flate stream: ${cmf}, ${flg}`);\r\n        }\r\n        this._codeSize = 0;\r\n        this._codeBuf = 0;\r\n    }\r\n    _readBlock() {\r\n        let buffer;\r\n        let len;\r\n        const str = this._sourceStream;\r\n        let header = this.getBits(3);\r\n        if (header & 1) {\r\n            this._ended = true;\r\n        }\r\n        header >>= 1;\r\n        if (header === 0) {\r\n            let b;\r\n            if ((b = str.takeByte()) === -1) {\r\n                throw new Error(\"Bad block header in flate stream\");\r\n            }\r\n            let blockLen = b;\r\n            if ((b = str.takeByte()) === -1) {\r\n                throw new Error(\"Bad block header in flate stream\");\r\n            }\r\n            blockLen |= b << 8;\r\n            if ((b = str.takeByte()) === -1) {\r\n                throw new Error(\"Bad block header in flate stream\");\r\n            }\r\n            let check = b;\r\n            if ((b = str.takeByte()) === -1) {\r\n                throw new Error(\"Bad block header in flate stream\");\r\n            }\r\n            check |= b << 8;\r\n            if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {\r\n                throw new Error(\"Bad uncompressed block length in flate stream\");\r\n            }\r\n            this._codeBuf = 0;\r\n            this._codeSize = 0;\r\n            const bufferLength = this._bufferLength, end = bufferLength + blockLen;\r\n            buffer = this.ensureBuffer(end);\r\n            this._bufferLength = end;\r\n            if (blockLen === 0) {\r\n                if (str.peekByte() === -1) {\r\n                    this._ended = true;\r\n                }\r\n            }\r\n            else {\r\n                const block = str.takeBytes(blockLen);\r\n                buffer.set(block, bufferLength);\r\n                if (block.length < blockLen) {\r\n                    this._ended = true;\r\n                }\r\n            }\r\n            return;\r\n        }\r\n        let litCodeTable;\r\n        let distCodeTable;\r\n        if (header === 1) {\r\n            litCodeTable = FlateStream.fixedLitCodeTab;\r\n            distCodeTable = FlateStream.fixedDistCodeTab;\r\n        }\r\n        else if (header === 2) {\r\n            const numLitCodes = this.getBits(5) + 257;\r\n            const numDistCodes = this.getBits(5) + 1;\r\n            const numCodeLenCodes = this.getBits(4) + 4;\r\n            const codeLenCodeLengths = new Uint8Array(FlateStream.codeLenCodeMap.length);\r\n            let i;\r\n            for (i = 0; i < numCodeLenCodes; i++) {\r\n                codeLenCodeLengths[FlateStream.codeLenCodeMap[i]] = this.getBits(3);\r\n            }\r\n            const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);\r\n            len = 0;\r\n            i = 0;\r\n            const codes = numLitCodes + numDistCodes;\r\n            const codeLengths = new Uint8Array(codes);\r\n            let bitsLength;\r\n            let bitsOffset;\r\n            let what;\r\n            while (i < codes) {\r\n                const code = this.getCode(codeLenCodeTab);\r\n                if (code === 16) {\r\n                    bitsLength = 2;\r\n                    bitsOffset = 3;\r\n                    what = len;\r\n                }\r\n                else if (code === 17) {\r\n                    bitsLength = 3;\r\n                    bitsOffset = 3;\r\n                    what = len = 0;\r\n                }\r\n                else if (code === 18) {\r\n                    bitsLength = 7;\r\n                    bitsOffset = 11;\r\n                    what = len = 0;\r\n                }\r\n                else {\r\n                    codeLengths[i++] = len = code;\r\n                    continue;\r\n                }\r\n                let repeatLength = this.getBits(bitsLength) + bitsOffset;\r\n                while (repeatLength-- > 0) {\r\n                    codeLengths[i++] = what;\r\n                }\r\n            }\r\n            litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));\r\n            distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));\r\n        }\r\n        else {\r\n            throw new Error(\"Unknown block type in flate stream\");\r\n        }\r\n        buffer = this._buffer;\r\n        let limit = buffer ? buffer.length : 0;\r\n        let pos = this._bufferLength;\r\n        while (true) {\r\n            let code1 = this.getCode(litCodeTable);\r\n            if (code1 < 256) {\r\n                if (pos + 1 >= limit) {\r\n                    buffer = this.ensureBuffer(pos + 1);\r\n                    limit = buffer.length;\r\n                }\r\n                buffer[pos++] = code1;\r\n                continue;\r\n            }\r\n            if (code1 === 256) {\r\n                this._bufferLength = pos;\r\n                return;\r\n            }\r\n            code1 -= 257;\r\n            code1 = FlateStream.lengthDecode[code1];\r\n            let code2 = code1 >> 16;\r\n            if (code2 > 0) {\r\n                code2 = this.getBits(code2);\r\n            }\r\n            len = (code1 & 0xffff) + code2;\r\n            code1 = this.getCode(distCodeTable);\r\n            code1 = FlateStream.distDecode[code1];\r\n            code2 = code1 >> 16;\r\n            if (code2 > 0) {\r\n                code2 = this.getBits(code2);\r\n            }\r\n            const dist = (code1 & 0xffff) + code2;\r\n            if (pos + len >= limit) {\r\n                buffer = this.ensureBuffer(pos + len);\r\n                limit = buffer.length;\r\n            }\r\n            for (let k = 0; k < len; ++k, ++pos) {\r\n                buffer[pos] = buffer[pos - dist];\r\n            }\r\n        }\r\n    }\r\n    ;\r\n    getBits(n) {\r\n        const stream = this._sourceStream;\r\n        let size = this._codeSize;\r\n        let buf = this._codeBuf;\r\n        let value;\r\n        while (size < n) {\r\n            if ((value = stream.takeByte()) === -1) {\r\n                throw new Error(\"Bad encoding in flate stream\");\r\n            }\r\n            buf |= value << size;\r\n            size += 8;\r\n        }\r\n        value = buf & ((1 << n) - 1);\r\n        this._codeBuf = buf >> n;\r\n        this._codeSize = size -= n;\r\n        return value;\r\n    }\r\n    ;\r\n    getCode(table) {\r\n        const stream = this._sourceStream;\r\n        const [codes, maxLength] = table;\r\n        let size = this._codeSize;\r\n        let buf = this._codeBuf;\r\n        let value;\r\n        while (size < maxLength) {\r\n            if ((value = stream.takeByte()) === -1) {\r\n                break;\r\n            }\r\n            buf |= value << size;\r\n            size += 8;\r\n        }\r\n        const code = codes[buf & ((1 << maxLength) - 1)];\r\n        const codeLen = code >> 16;\r\n        const codeVal = code & 0xffff;\r\n        if (codeLen < 1 || size < codeLen) {\r\n            throw new Error(\"Bad encoding in flate stream\");\r\n        }\r\n        this._codeBuf = buf >> codeLen;\r\n        this._codeSize = size - codeLen;\r\n        return codeVal;\r\n    }\r\n    ;\r\n    generateHuffmanTable(lengths) {\r\n        const n = lengths.length;\r\n        let maxLength = 0;\r\n        let i;\r\n        for (i = 0; i < n; i++) {\r\n            if (lengths[i] > maxLength) {\r\n                maxLength = lengths[i];\r\n            }\r\n        }\r\n        const size = 1 << maxLength;\r\n        const codes = new Int32Array(size);\r\n        for (let length = 1, code = 0, skip = 2; length <= maxLength; length++, code <<= 1, skip <<= 1) {\r\n            for (let value = 0; value < n; value++) {\r\n                if (lengths[value] === length) {\r\n                    let code2 = 0;\r\n                    let t = code;\r\n                    for (i = 0; i < length; i++) {\r\n                        code2 = (code2 << 1) | (t & 1);\r\n                        t >>= 1;\r\n                    }\r\n                    for (i = code2; i < size; i += skip) {\r\n                        codes[i] = (length << 16) | value;\r\n                    }\r\n                    code++;\r\n                }\r\n            }\r\n        }\r\n        return [codes, maxLength];\r\n    }\r\n    ;\r\n}\r\nFlateStream.codeLenCodeMap = new Int32Array([\r\n    16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15\r\n]);\r\nFlateStream.lengthDecode = new Int32Array([\r\n    0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,\r\n    0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,\r\n    0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073,\r\n    0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102\r\n]);\r\nFlateStream.distDecode = new Int32Array([\r\n    0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,\r\n    0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,\r\n    0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01,\r\n    0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001\r\n]);\r\nFlateStream.fixedLitCodeTab = [new Int32Array([\r\n        0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,\r\n        0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,\r\n        0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,\r\n        0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,\r\n        0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,\r\n        0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,\r\n        0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,\r\n        0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,\r\n        0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,\r\n        0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,\r\n        0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,\r\n        0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,\r\n        0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,\r\n        0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,\r\n        0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,\r\n        0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,\r\n        0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,\r\n        0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,\r\n        0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,\r\n        0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,\r\n        0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,\r\n        0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,\r\n        0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,\r\n        0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,\r\n        0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,\r\n        0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,\r\n        0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,\r\n        0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,\r\n        0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,\r\n        0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,\r\n        0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,\r\n        0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,\r\n        0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,\r\n        0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,\r\n        0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,\r\n        0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,\r\n        0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,\r\n        0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,\r\n        0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,\r\n        0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,\r\n        0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,\r\n        0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,\r\n        0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,\r\n        0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,\r\n        0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,\r\n        0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,\r\n        0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,\r\n        0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,\r\n        0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,\r\n        0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,\r\n        0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,\r\n        0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,\r\n        0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,\r\n        0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,\r\n        0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,\r\n        0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,\r\n        0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,\r\n        0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,\r\n        0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,\r\n        0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,\r\n        0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,\r\n        0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,\r\n        0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,\r\n        0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff\r\n    ]), 9];\r\nFlateStream.fixedDistCodeTab = [new Int32Array([\r\n        0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,\r\n        0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,\r\n        0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,\r\n        0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000\r\n    ]), 5];\n\nclass Stream {\r\n    constructor(bytes, start = 0, length) {\r\n        if (length && length < 0) {\r\n            throw new Error(\"Stream length can't be negative\");\r\n        }\r\n        this._bytes = bytes instanceof Uint8Array\r\n            ? bytes\r\n            : new Uint8Array(bytes);\r\n        this._start = start;\r\n        this._current = start;\r\n        this._end = start + length || bytes.length;\r\n    }\r\n    get length() {\r\n        return this._end - this._start;\r\n    }\r\n    takeByte() {\r\n        if (this._current >= this._end) {\r\n            return -1;\r\n        }\r\n        return this._bytes[this._current++];\r\n    }\r\n    takeBytes(length) {\r\n        const bytes = this._bytes;\r\n        const position = this._current;\r\n        const bytesEnd = this._end;\r\n        if (!length) {\r\n            const subarray = bytes.subarray(position, bytesEnd);\r\n            return subarray;\r\n        }\r\n        else {\r\n            let end = position + length;\r\n            if (end > bytesEnd) {\r\n                end = bytesEnd;\r\n            }\r\n            this._current = end;\r\n            const subarray = bytes.subarray(position, end);\r\n            return subarray;\r\n        }\r\n    }\r\n    takeUint16() {\r\n        const b0 = this.takeByte();\r\n        const b1 = this.takeByte();\r\n        if (b0 === -1 || b1 === -1) {\r\n            return -1;\r\n        }\r\n        return (b0 << 8) + b1;\r\n    }\r\n    takeInt32() {\r\n        const b0 = this.takeByte();\r\n        const b1 = this.takeByte();\r\n        const b2 = this.takeByte();\r\n        const b3 = this.takeByte();\r\n        return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\r\n    }\r\n    peekByte() {\r\n        const peekedByte = this.takeByte();\r\n        if (peekedByte !== -1) {\r\n            this._current--;\r\n        }\r\n        return peekedByte;\r\n    }\r\n    peekBytes(length) {\r\n        const bytes = this.takeBytes(length);\r\n        this._current -= bytes.length;\r\n        return bytes;\r\n    }\r\n    getByte(index) {\r\n        return this._bytes[index];\r\n    }\r\n    getByteRange(start, end) {\r\n        return this._bytes.subarray(Math.max(start, 0), Math.min(end, this._end));\r\n    }\r\n    skip(n) {\r\n        this._current += n || 1;\r\n    }\r\n    reset() {\r\n        this._current = this._start;\r\n    }\r\n}\n\nclass FlateDecoder {\r\n    static Decode(input, predictor = flatePredictors.NONE, columns = 1, components = 1, bpc = 8) {\r\n        const stream = new Stream(input, 0, input.length);\r\n        const flate = new FlateStream(stream);\r\n        const inflated = flate.takeBytes(null);\r\n        switch (predictor) {\r\n            case (flatePredictors.NONE):\r\n                return inflated;\r\n            case (flatePredictors.PNG_NONE):\r\n            case (flatePredictors.PNG_SUB):\r\n            case (flatePredictors.PNG_UP):\r\n            case (flatePredictors.PNG_AVERAGE):\r\n            case (flatePredictors.PNG_PAETH):\r\n            case (flatePredictors.PNG_OPTIMUM):\r\n                const unfiltered = FlateDecoder.removePngFilter(inflated, columns, components, bpc);\r\n                return unfiltered;\r\n            case (flatePredictors.TIFF):\r\n                throw new Error(\"Unsupported filter predictor\");\r\n        }\r\n    }\r\n    static Encode(input, predictor = flatePredictors.PNG_UP, columns = 5, components = 1, bpc = 8) {\r\n        let filtered;\r\n        switch (predictor) {\r\n            case (flatePredictors.NONE):\r\n                filtered = input;\r\n                break;\r\n            case (flatePredictors.PNG_NONE):\r\n            case (flatePredictors.PNG_SUB):\r\n            case (flatePredictors.PNG_UP):\r\n            case (flatePredictors.PNG_AVERAGE):\r\n            case (flatePredictors.PNG_PAETH):\r\n            case (flatePredictors.PNG_OPTIMUM):\r\n                filtered = FlateDecoder.applyPngFilter(input, predictor, columns, components, bpc);\r\n                break;\r\n            case (flatePredictors.TIFF):\r\n                throw new Error(\"Unsupported filter predictor\");\r\n        }\r\n        const deflated = pako__WEBPACK_IMPORTED_MODULE_3__.deflate(filtered);\r\n        return deflated;\r\n    }\r\n    static removePngFilter(input, columns, components, bpc) {\r\n        const interval = Math.ceil(components * bpc / 8);\r\n        const lineLen = columns * interval;\r\n        const lineLen_filtered = lineLen + 1;\r\n        if (!!(input.length % lineLen_filtered)) {\r\n            throw new Error(`Data length doesn't match filter columns: ${input.length} % ${lineLen_filtered}`);\r\n        }\r\n        const output = new Uint8Array(input.length / lineLen_filtered * lineLen);\r\n        const previous = new Array(lineLen).fill(0);\r\n        const current = new Array(lineLen).fill(0);\r\n        const getLeft = (j) => j - interval < 0\r\n            ? 0\r\n            : current[j - interval];\r\n        const getAbove = (j) => previous[j];\r\n        const getUpperLeft = (j) => j - interval < 0\r\n            ? 0\r\n            : previous[j - interval];\r\n        let x = 0;\r\n        let y = 0;\r\n        let k = 0;\r\n        let rowStart = 0;\r\n        let filterType = 0;\r\n        let result = 0;\r\n        for (let i = 0; i < input.length; i++) {\r\n            if (i % lineLen_filtered === 0) {\r\n                filterType = input[i];\r\n                x = 0;\r\n                if (i) {\r\n                    for (k = 0; k < lineLen; k++) {\r\n                        previous[k] = output[rowStart + k];\r\n                    }\r\n                }\r\n                rowStart = y;\r\n            }\r\n            else {\r\n                current[x] = input[i];\r\n                switch (filterType) {\r\n                    case 0:\r\n                        result = current[x];\r\n                        break;\r\n                    case 1:\r\n                        result = (current[x] + getLeft(x)) % 256;\r\n                        break;\r\n                    case 2:\r\n                        result = (current[x] + getAbove(x)) % 256;\r\n                        break;\r\n                    case 3:\r\n                        result = (current[x] + Math.floor((getAbove(x) + getLeft(x)) / 2)) % 256;\r\n                        break;\r\n                    case 4:\r\n                        result = (current[x] + this.paethPredictor(getLeft(x), getAbove(x), getUpperLeft(x))) % 256;\r\n                        break;\r\n                }\r\n                output[y++] = result;\r\n                x++;\r\n            }\r\n        }\r\n        return output;\r\n    }\r\n    static applyPngFilter(input, predictor = 12, columns = 5, components = 1, bpc = 8) {\r\n        let filterType;\r\n        switch (predictor) {\r\n            case flatePredictors.PNG_NONE:\r\n                filterType = 0;\r\n                break;\r\n            case flatePredictors.PNG_SUB:\r\n                filterType = 1;\r\n                break;\r\n            case flatePredictors.PNG_UP:\r\n                filterType = 2;\r\n                break;\r\n            case flatePredictors.PNG_AVERAGE:\r\n                filterType = 3;\r\n                break;\r\n            case flatePredictors.PNG_PAETH:\r\n                filterType = 4;\r\n                break;\r\n            default:\r\n                throw new Error(\"Invalid PNG filter type\");\r\n        }\r\n        const interval = Math.ceil(components * bpc / 8);\r\n        const lineLen = columns * interval;\r\n        const lineLen_filtered = lineLen + 1;\r\n        const lineCount = Math.ceil(input.length / lineLen);\r\n        const lenFiltered = lineCount * lineLen_filtered;\r\n        const output = new Uint8Array(lenFiltered);\r\n        const previous = new Array(lineLen).fill(0);\r\n        const current = new Array(lineLen).fill(0);\r\n        const getLeft = (j) => j - interval < 0\r\n            ? 0\r\n            : current[j - interval];\r\n        const getAbove = (j) => previous[j];\r\n        const getUpperLeft = (j) => j - interval < 0\r\n            ? 0\r\n            : previous[j - interval];\r\n        let x = 0;\r\n        let y = 0;\r\n        let k = 0;\r\n        let rowStart = 0;\r\n        let result = 0;\r\n        for (let i = 0; i < lenFiltered; i++) {\r\n            if (i % lineLen_filtered === 0) {\r\n                x = 0;\r\n                if (i) {\r\n                    for (k = 0; k < lineLen; k++) {\r\n                        previous[k] = input[rowStart + k];\r\n                    }\r\n                }\r\n                rowStart = y;\r\n                output[i] = filterType;\r\n            }\r\n            else {\r\n                current[x] = input[y++] || 0;\r\n                switch (filterType) {\r\n                    case 0:\r\n                        result = current[x];\r\n                        break;\r\n                    case 1:\r\n                        result = (current[x] - getLeft(x)) % 256;\r\n                        break;\r\n                    case 2:\r\n                        result = (current[x] - getAbove(x)) % 256;\r\n                        break;\r\n                    case 3:\r\n                        result = (current[x] - Math.floor((getAbove(x) + getLeft(x)) / 2)) % 256;\r\n                        break;\r\n                    case 4:\r\n                        result = (current[x] - this.paethPredictor(getLeft(x), getAbove(x), getUpperLeft(x))) % 256;\r\n                        break;\r\n                }\r\n                output[i] = result;\r\n                x++;\r\n            }\r\n        }\r\n        return output;\r\n    }\r\n    static paethPredictor(a, b, c) {\r\n        const p = a + b - c;\r\n        const pa = Math.abs(p - a);\r\n        const pb = Math.abs(p - b);\r\n        const pc = Math.abs(p - c);\r\n        if (pa <= pb && pa <= pc) {\r\n            return a;\r\n        }\r\n        else if (pb <= pc) {\r\n            return b;\r\n        }\r\n        else {\r\n            return c;\r\n        }\r\n    }\r\n}\n\nvar __awaiter$1c = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PdfStream extends PdfObject {\r\n    constructor(type) {\r\n        super();\r\n        this.Type = type;\r\n    }\r\n    get streamData() {\r\n        return this._streamData;\r\n    }\r\n    set streamData(data) {\r\n        this.setStreamData(data);\r\n        this._edited = true;\r\n    }\r\n    get decodedStreamData() {\r\n        if (!this._decodedStreamData) {\r\n            this.decodeStreamData();\r\n        }\r\n        return this._decodedStreamData;\r\n    }\r\n    get decodedStreamDataChars() {\r\n        const decoder = new TextDecoder();\r\n        return decoder.decode(this.decodedStreamData);\r\n    }\r\n    getStreamDataParserAsync() {\r\n        return __awaiter$1c(this, void 0, void 0, function* () {\r\n            return yield PdfStream.getDataParserAsync(this.decodedStreamData);\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const streamData = (cryptInfo === null || cryptInfo === void 0 ? void 0 : cryptInfo.ref) && cryptInfo.streamCryptor\r\n            ? cryptInfo.streamCryptor.encrypt(this.streamData, cryptInfo.ref)\r\n            : this.streamData;\r\n        const encoder = new TextEncoder();\r\n        const bytes = [...keywordCodes.DICT_START];\r\n        bytes.push(...encoder.encode(\"/Length \"), ...encoder.encode(\" \" + streamData.length));\r\n        if (this.Type) {\r\n            bytes.push(...keywordCodes.TYPE, ...encoder.encode(this.Type));\r\n        }\r\n        if (this.Filter) {\r\n            bytes.push(...encoder.encode(\"/Filter \"), ...encoder.encode(this.Filter));\r\n        }\r\n        if (this.DecodeParms) {\r\n            bytes.push(...encoder.encode(\"/DecodeParms \"), ...this.DecodeParms.toArray(cryptInfo));\r\n        }\r\n        bytes.push(...keywordCodes.DICT_END, ...keywordCodes.END_OF_LINE, ...keywordCodes.STREAM_START, ...keywordCodes.END_OF_LINE);\r\n        for (let i = 0; i < streamData.length; i++) {\r\n            bytes.push(streamData[i]);\r\n        }\r\n        bytes.push(...keywordCodes.END_OF_LINE, ...keywordCodes.STREAM_END);\r\n        return new Uint8Array(bytes);\r\n    }\r\n    setTextStreamData(text) {\r\n        const encoder = new TextEncoder();\r\n        const bytes = encoder.encode(text);\r\n        this.streamData = bytes;\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        var _a, _b;\r\n        return __awaiter$1c(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parse info is empty\");\r\n            }\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            this._ref = (_a = parseInfo.cryptInfo) === null || _a === void 0 ? void 0 : _a.ref;\r\n            this._sourceBytes = yield parser.sliceCharCodesAsync(start, end);\r\n            const streamEndIndex = yield parser.findSubarrayIndexAsync(keywordCodes.STREAM_END, {\r\n                direction: false,\r\n                minIndex: start,\r\n                maxIndex: end,\r\n                closedOnly: true,\r\n            });\r\n            if (!streamEndIndex) {\r\n                throw new Error(\"Object is not a stream\");\r\n            }\r\n            const streamStartIndex = yield parser.findSubarrayIndexAsync(keywordCodes.STREAM_START, {\r\n                direction: false,\r\n                minIndex: start,\r\n                maxIndex: streamEndIndex.start - 1,\r\n                closedOnly: true\r\n            });\r\n            if (!streamStartIndex) {\r\n                throw new Error(\"Stream start is out of the data bounds\");\r\n            }\r\n            const dictBounds = yield parser.getDictBoundsAtAsync(start);\r\n            let i = yield parser.skipToNextNameAsync(dictBounds.contentStart, dictBounds.contentEnd);\r\n            if (i === -1) {\r\n                throw new Error(\"Dict is empty (has no properties)\");\r\n            }\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Type\":\r\n                            const type = yield parser.parseNameAtAsync(i);\r\n                            if (type) {\r\n                                if (this.Type && this.Type !== type.value) {\r\n                                    throw new Error(`Ivalid dict type: '${type.value}' instead of '${this.Type}'`);\r\n                                }\r\n                                i = type.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Type property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Length\":\r\n                        case \"/DL\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Filter\":\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.NAME) {\r\n                                const filter = yield parser.parseNameAtAsync(i);\r\n                                if (filter && supportedFilters.has(filter.value)) {\r\n                                    this.Filter = filter.value;\r\n                                    i = filter.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(`Unsupported /Filter property value: ${filter.value}`);\r\n                                }\r\n                            }\r\n                            else if (entryType === valueTypes.ARRAY) {\r\n                                const filterNames = yield parser.parseNameArrayAtAsync(i);\r\n                                if (filterNames) {\r\n                                    const filterArray = filterNames.value;\r\n                                    if (filterArray.length === 1 && supportedFilters.has(filterArray[0])) {\r\n                                        this.Filter = filterArray[0];\r\n                                        i = filterNames.end + 1;\r\n                                        break;\r\n                                    }\r\n                                    else {\r\n                                        throw new Error(`Unsupported /Filter property value: ${filterArray.toString()}`);\r\n                                    }\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /Filter property value type: ${entryType}`);\r\n                        case \"/DecodeParms\":\r\n                            const paramsEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (paramsEntryType === valueTypes.DICTIONARY) {\r\n                                const decodeParamsBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (decodeParamsBounds) {\r\n                                    const params = yield DecodeParamsDict.parseAsync({ parser,\r\n                                        bounds: decodeParamsBounds, cryptInfo: parseInfo.cryptInfo });\r\n                                    if (params) {\r\n                                        this.DecodeParms = params.value;\r\n                                        i = decodeParamsBounds.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /DecodeParms property value\");\r\n                            }\r\n                            else if (paramsEntryType === valueTypes.ARRAY) {\r\n                                const paramsDicts = yield DecodeParamsDict.parseArrayAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (paramsDicts) {\r\n                                    const paramsArray = paramsDicts.value;\r\n                                    if (paramsArray.length === 1) {\r\n                                        this.DecodeParms = paramsArray[0];\r\n                                        i = paramsDicts.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /DecodeParms property value\");\r\n                            }\r\n                            throw new Error(`Unsupported /DecodeParms property value type: ${paramsEntryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, dictBounds.contentEnd);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            const streamStart = yield parser.findNewLineIndexAsync(true, streamStartIndex.end + 1);\r\n            const streamEnd = yield parser.findNewLineIndexAsync(false, streamEndIndex.start - 1);\r\n            const streamBytes = yield parser.sliceCharCodesAsync(streamStart, streamEnd);\r\n            const encodedData = ((_b = parseInfo.cryptInfo) === null || _b === void 0 ? void 0 : _b.ref) && parseInfo.cryptInfo.streamCryptor\r\n                ? parseInfo.cryptInfo.streamCryptor.decrypt(streamBytes, parseInfo.cryptInfo.ref)\r\n                : streamBytes;\r\n            this._streamData = encodedData;\r\n        });\r\n    }\r\n    setStreamData(data) {\r\n        if (!(data === null || data === void 0 ? void 0 : data.length)) {\r\n            throw new Error(\"Can't set emprty stream data\");\r\n        }\r\n        let params;\r\n        if (this.DecodeParms) {\r\n            params = this.DecodeParms;\r\n        }\r\n        else {\r\n            let columns;\r\n            let i = 10;\r\n            while (true) {\r\n                if (data.length % i === 0) {\r\n                    columns = i;\r\n                    break;\r\n                }\r\n                i--;\r\n            }\r\n            params = new DecodeParamsDict();\r\n            params.setIntProp(\"/Predictor\", flatePredictors.PNG_UP);\r\n            params.setIntProp(\"/Columns\", columns);\r\n            this.DecodeParms = params;\r\n        }\r\n        const encodedData = FlateDecoder.Encode(data, (params === null || params === void 0 ? void 0 : params.getIntProp(\"/Predictor\")) || flatePredictors.NONE, (params === null || params === void 0 ? void 0 : params.getIntProp(\"/Columns\")) || 1, (params === null || params === void 0 ? void 0 : params.getIntProp(\"/Colors\")) || 1, (params === null || params === void 0 ? void 0 : params.getIntProp(\"/BitsPerComponent\")) || 8);\r\n        this._streamData = encodedData;\r\n        this.Length = encodedData.length;\r\n        this.DL = data.length;\r\n        this._decodedStreamData = data;\r\n    }\r\n    decodeStreamData() {\r\n        let decodedData;\r\n        switch (this.Filter) {\r\n            case streamFilters.FLATE:\r\n                if (this.DecodeParms) {\r\n                    const params = this.DecodeParms;\r\n                    decodedData = FlateDecoder.Decode(this._streamData, params.getIntProp(\"/Predictor\") || flatePredictors.NONE, params.getIntProp(\"/Columns\") || 1, params.getIntProp(\"/Colors\") || 1, params.getIntProp(\"/BitsPerComponent\") || 8);\r\n                }\r\n                else {\r\n                    decodedData = FlateDecoder.Decode(this._streamData);\r\n                }\r\n                break;\r\n            default:\r\n                decodedData = new Uint8Array(this._streamData);\r\n                break;\r\n        }\r\n        this._decodedStreamData = decodedData;\r\n    }\r\n}\n\nvar __awaiter$1b = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TrailerStream extends PdfStream {\r\n    constructor() {\r\n        super(streamTypes.XREF);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$1b(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new TrailerStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Size) {\r\n            bytes.push(...encoder.encode(\"/Size \"), ...encoder.encode(\" \" + this.Size));\r\n        }\r\n        if (this.Prev) {\r\n            bytes.push(...encoder.encode(\"/Prev \"), ...encoder.encode(\" \" + this.Prev));\r\n        }\r\n        if (this.Root) {\r\n            bytes.push(...encoder.encode(\"/Root \"), ...this.Root.toArray(cryptInfo));\r\n        }\r\n        if (this.Encrypt) {\r\n            bytes.push(...encoder.encode(\"/Encrypt \"), ...this.Encrypt.toArray(cryptInfo));\r\n        }\r\n        if (this.Info) {\r\n            bytes.push(...encoder.encode(\"/Info \"), ...this.Info.toArray(cryptInfo));\r\n        }\r\n        if (this.ID) {\r\n            bytes.push(...encoder.encode(\"/ID \"), ...this.encodeSerializableArray(this.ID, cryptInfo));\r\n        }\r\n        if (this.Index) {\r\n            bytes.push(...encoder.encode(\"/Index \"), ...this.encodePrimitiveArray(this.Index, encoder));\r\n        }\r\n        if (this.W) {\r\n            bytes.push(...encoder.encode(\"/W \"), ...this.encodePrimitiveArray(this.W, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a;\r\n        return __awaiter$1b(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const dictBounds = yield parser.getDictBoundsAtAsync(start);\r\n            let i = yield parser.skipToNextNameAsync(dictBounds.contentStart, dictBounds.contentEnd);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Size\":\r\n                        case \"/Prev\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Root\":\r\n                        case \"/Info\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Encrypt\":\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.REF) {\r\n                                const encryptId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (encryptId) {\r\n                                    this.Encrypt = encryptId.value;\r\n                                    i = encryptId.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Encrypt property value\");\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /Encrypt property value type: ${entryType}`);\r\n                        case \"/ID\":\r\n                            const hexIds = yield HexString.parseArrayAsync(parser, i);\r\n                            if (hexIds && hexIds.value[0] && hexIds.value[1]) {\r\n                                this.ID = [\r\n                                    hexIds.value[0],\r\n                                    hexIds.value[1],\r\n                                ];\r\n                                i = hexIds.end + 1;\r\n                                break;\r\n                            }\r\n                            const literalIds = yield LiteralString.parseArrayAsync(parser, i);\r\n                            if (literalIds && literalIds.value[0] && literalIds.value[1]) {\r\n                                this.ID = [\r\n                                    HexString.fromHexBytes(literalIds.value[0].bytes),\r\n                                    HexString.fromHexBytes(literalIds.value[1].bytes),\r\n                                ];\r\n                                i = literalIds.end + 1;\r\n                                break;\r\n                            }\r\n                            throw new Error(\"Can't parse /ID property value\");\r\n                        case \"/Index\":\r\n                        case \"/W\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, false);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, dictBounds.contentEnd);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.W || !this.Size || !this.Root || (this.Encrypt && !this.ID)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (!((_a = this.Index) === null || _a === void 0 ? void 0 : _a.length)) {\r\n                this.Index = [0, this.Size];\r\n            }\r\n        });\r\n    }\r\n}\n\nclass XRef {\r\n    constructor(type) {\r\n        this._type = type;\r\n    }\r\n    get type() {\r\n        return this._type;\r\n    }\r\n    get offset() {\r\n        return this._offset;\r\n    }\r\n}\n\nvar __awaiter$1a = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass XRefStream extends XRef {\r\n    constructor(trailer, offset) {\r\n        super(xRefTypes.STREAM);\r\n        this._trailerStream = trailer;\r\n        this._offset = offset;\r\n    }\r\n    get prev() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.Prev;\r\n    }\r\n    get size() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.Size;\r\n    }\r\n    get root() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.Root;\r\n    }\r\n    get info() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.Info;\r\n    }\r\n    get encrypt() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.Encrypt;\r\n    }\r\n    get id() {\r\n        var _a;\r\n        return (_a = this._trailerStream) === null || _a === void 0 ? void 0 : _a.ID;\r\n    }\r\n    static createFrom(base, entries, offset) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length) || !base) {\r\n            return null;\r\n        }\r\n        const entriesSize = Math.max(...entries.map(x => x.id)) + 2;\r\n        const size = Math.max(entriesSize, base.size);\r\n        return XRefStream.create(entries, size, offset, base.root, base.offset, base.info, base.encrypt, base.id);\r\n    }\r\n    static create(entries, size, offset, root, prev, info, encrypt, id) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length) || !size || !offset || !root) {\r\n            return null;\r\n        }\r\n        const trailer = new TrailerStream();\r\n        trailer.Size = size;\r\n        trailer.Root = root;\r\n        trailer.Prev = prev;\r\n        trailer.Info = info;\r\n        trailer.Encrypt = encrypt;\r\n        trailer.ID = id;\r\n        const w = [1, 4, 2];\r\n        const wSum = w[0] + w[1] + w[2];\r\n        const params = new DecodeParamsDict();\r\n        params.setIntProp(\"/Predictor\", flatePredictors.PNG_UP);\r\n        params.setIntProp(\"/Columns\", wSum);\r\n        params.setIntProp(\"/Colors\", 1);\r\n        params.setIntProp(\"/BitsPerComponent\", 8);\r\n        const data = XRefEntry.toStreamBytes(entries, w);\r\n        const stream = new XRefStream(trailer, offset);\r\n        stream._trailerStream.Filter = streamFilters.FLATE;\r\n        stream._trailerStream.DecodeParms = params;\r\n        stream._trailerStream.W = w;\r\n        stream._trailerStream.Index = data.index;\r\n        stream._trailerStream.streamData = data.bytes;\r\n        return stream;\r\n    }\r\n    static parseAsync(parseInfo, offset) {\r\n        return __awaiter$1a(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                return null;\r\n            }\r\n            const trailerStream = yield TrailerStream.parseAsync(parseInfo);\r\n            if (!trailerStream) {\r\n                return null;\r\n            }\r\n            const xrefStream = new XRefStream(trailerStream.value, offset);\r\n            return {\r\n                value: xrefStream,\r\n                start: null,\r\n                end: null,\r\n            };\r\n        });\r\n    }\r\n    createUpdate(entries, offset) {\r\n        return XRefStream.createFrom(this, entries, offset);\r\n    }\r\n    getEntries() {\r\n        if (!this._trailerStream) {\r\n            return [];\r\n        }\r\n        const entries = XRefEntry.fromStreamBytes(this._trailerStream.decodedStreamData, this._trailerStream.W, this._trailerStream.Index);\r\n        return entries;\r\n    }\r\n    toArray(cryptInfo) {\r\n        return this._trailerStream.toArray(cryptInfo);\r\n    }\r\n}\n\nvar __awaiter$19 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextStream extends PdfStream {\r\n    constructor(type = null) {\r\n        super(type);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$19(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new TextStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    getText() {\r\n        return null;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$19(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n        });\r\n    }\r\n}\n\nvar __awaiter$18 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass IndexedColorSpaceArray {\r\n    constructor(baseColorSpace, highestValue, lookupArray) {\r\n        switch (baseColorSpace) {\r\n            case colorSpaces.GRAYSCALE:\r\n                this.componentsNumber = 1;\r\n                break;\r\n            case colorSpaces.RGB:\r\n                this.componentsNumber = 3;\r\n                break;\r\n            case colorSpaces.CMYK:\r\n                this.componentsNumber = 4;\r\n                break;\r\n            default:\r\n                throw new Error(`Unsupported base color space for indexed color space: ${baseColorSpace}`);\r\n        }\r\n        this.baseColorSpace = baseColorSpace;\r\n        if (lookupArray.length !== this.componentsNumber * (highestValue + 1)) {\r\n            throw new Error(`Invalid lookup array length: ${lookupArray.length}`);\r\n        }\r\n        this.highestValue = highestValue;\r\n        this.lookupArray = lookupArray;\r\n    }\r\n    static parseAsync(parseInfo, skipEmpty = true) {\r\n        return __awaiter$18(this, void 0, void 0, function* () {\r\n            const { parser, bounds, cryptInfo } = parseInfo;\r\n            let i;\r\n            if (skipEmpty) {\r\n                i = yield parser.findNonSpaceIndexAsync(true, bounds.start);\r\n            }\r\n            const start = i;\r\n            if (i < 0 || i > parser.maxIndex\r\n                || !(yield parser.isCodeAtAsync(start, codes.L_BRACKET))) {\r\n                console.log(\"Color space array start not found\");\r\n                return null;\r\n            }\r\n            i++;\r\n            const type = yield parser.parseNameAtAsync(i);\r\n            if (!type || type.value !== \"/Indexed\") {\r\n                console.log(\"Array is not representing an indexed color space\");\r\n                return null;\r\n            }\r\n            i = type.end + 1;\r\n            const base = yield parser.parseNameAtAsync(i);\r\n            if (!base) {\r\n                console.log(\"Can't parse base color space name of the indexed color space\");\r\n                return null;\r\n            }\r\n            i = base.end + 2;\r\n            const highestValue = yield parser.parseNumberAtAsync(i);\r\n            if (!highestValue || isNaN(highestValue.value)) {\r\n                console.log(\"Can't parse the highest value of the indexed color space\");\r\n                return null;\r\n            }\r\n            i = highestValue.end + 1;\r\n            let lookupArray;\r\n            const lookupEntryType = yield parser.getValueTypeAtAsync(i);\r\n            if (lookupEntryType === valueTypes.REF) {\r\n                try {\r\n                    const lookupId = yield ObjectId.parseRefAsync(parser, i);\r\n                    const lookupParseInfo = yield parseInfo.parseInfoGetterAsync(lookupId.value.id);\r\n                    const lookupStream = yield TextStream.parseAsync(lookupParseInfo);\r\n                    lookupArray = lookupStream.value.decodedStreamData;\r\n                    i = lookupId.end + 1;\r\n                }\r\n                catch (e) {\r\n                    throw new Error(`Can't parse indexed color array lookup ref: ${e.message}`);\r\n                }\r\n            }\r\n            else if (lookupEntryType === valueTypes.STRING_HEX) {\r\n                const lookupHex = yield HexString.parseAsync(parser, i, cryptInfo);\r\n                if (lookupHex) {\r\n                    lookupArray = lookupHex.value.hex;\r\n                    i = lookupHex.end + 1;\r\n                }\r\n                else {\r\n                    throw new Error(\"Can't parse indexed color array lookup hex string\");\r\n                }\r\n            }\r\n            try {\r\n                const colorSpace = new IndexedColorSpaceArray(base.value, highestValue.value, lookupArray);\r\n                return {\r\n                    value: colorSpace,\r\n                    start,\r\n                    end: i - 1,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        bytes.push(codes.L_BRACKET, ...encoder.encode(\"/Indexed \"), ...encoder.encode(this.baseColorSpace + \" \"), ...encoder.encode(this.highestValue + \" \"), ...HexString.fromHexBytes(this.lookupArray).toArray(cryptInfo), codes.R_BRACKET);\r\n        return new Uint8Array(bytes);\r\n    }\r\n    getColor(index) {\r\n        switch (this.baseColorSpace) {\r\n            case colorSpaces.GRAYSCALE:\r\n                const gray = this.lookupArray[index];\r\n                return [gray, gray, gray];\r\n            case colorSpaces.RGB:\r\n                return [\r\n                    this.lookupArray[index * 3],\r\n                    this.lookupArray[index * 3 + 1],\r\n                    this.lookupArray[index * 3 + 2],\r\n                ];\r\n            case colorSpaces.CMYK:\r\n                const c = this.lookupArray[index * 4] / 255;\r\n                const m = this.lookupArray[index * 4 + 1] / 255;\r\n                const y = this.lookupArray[index * 4 + 2] / 255;\r\n                const k = this.lookupArray[index * 4 + 3] / 255;\r\n                return [\r\n                    255 * (1 - c) * (1 - k),\r\n                    255 * (1 - m) * (1 - k),\r\n                    255 * (1 - y) * (1 - k),\r\n                ];\r\n        }\r\n    }\r\n}\n\nvar __awaiter$17 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ImageStream extends PdfStream {\r\n    constructor() {\r\n        super(streamTypes.FORM_XOBJECT);\r\n        this.Subtype = \"/Image\";\r\n        this.ImageMask = false;\r\n        this.Interpolate = false;\r\n        this.SMaskInData = 0;\r\n    }\r\n    get sMask() {\r\n        return this._sMask;\r\n    }\r\n    set sMask(value) {\r\n        this._sMask = value;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$17(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new ImageStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Subtype) {\r\n            bytes.push(...encoder.encode(\"/Subtype \"), ...encoder.encode(this.Subtype));\r\n        }\r\n        if (this.Width) {\r\n            bytes.push(...encoder.encode(\"/Width \"), ...encoder.encode(\" \" + this.Width));\r\n        }\r\n        if (this.Height) {\r\n            bytes.push(...encoder.encode(\"/Height \"), ...encoder.encode(\" \" + this.Height));\r\n        }\r\n        if (this.ColorSpace) {\r\n            if (this._indexedColorSpace) {\r\n                bytes.push(...encoder.encode(\"/ColorSpace \"), ...this._indexedColorSpace.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/ColorSpace \"), ...encoder.encode(this.ColorSpace));\r\n            }\r\n        }\r\n        if (this.BitsPerComponent) {\r\n            bytes.push(...encoder.encode(\"/BitsPerComponent \"), ...encoder.encode(\" \" + this.BitsPerComponent));\r\n        }\r\n        bytes.push(...encoder.encode(\"/ImageMask \"), ...encoder.encode(\" \" + !!this.ImageMask));\r\n        if (this.Mask) {\r\n            bytes.push(...encoder.encode(\"/Mask \"), ...this.encodePrimitiveArray(this.Mask, encoder));\r\n        }\r\n        if (this.Decode) {\r\n            bytes.push(...encoder.encode(\"/Decode \"), ...this.encodePrimitiveArray(this.Decode, encoder));\r\n        }\r\n        bytes.push(...encoder.encode(\"/Interpolate \"), ...encoder.encode(\" \" + !!this.Interpolate));\r\n        if (this.SMask) {\r\n            bytes.push(...encoder.encode(\"/SMask \"), ...this.SMask.toArray(cryptInfo));\r\n        }\r\n        if (this.SMaskInData) {\r\n            bytes.push(...encoder.encode(\"/SMaskInData \"), ...encoder.encode(\" \" + this.SMaskInData));\r\n        }\r\n        if (this.Matte) {\r\n            bytes.push(...encoder.encode(\"/Matte \"), ...this.encodePrimitiveArray(this.Matte, encoder));\r\n        }\r\n        if (this.StructParent) {\r\n            bytes.push(...encoder.encode(\"/StructParent \"), ...encoder.encode(\" \" + this.StructParent));\r\n        }\r\n        if (this.Metadata) {\r\n            bytes.push(...encoder.encode(\"/Metadata \"), ...this.Metadata.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    getImageUrlAsync() {\r\n        return __awaiter$17(this, void 0, void 0, function* () {\r\n            if (this._imageUrl) {\r\n                URL.revokeObjectURL(this._imageUrl);\r\n            }\r\n            if (this.Filter === streamFilters.DCT\r\n                || this.Filter === streamFilters.JBIG2\r\n                || this.Filter === streamFilters.JPX) {\r\n                const blob = new Blob([this.decodedStreamData], {\r\n                    type: \"application/octet-binary\",\r\n                });\r\n                const imageUrl = URL.createObjectURL(blob);\r\n                this._imageUrl = imageUrl;\r\n                return imageUrl;\r\n            }\r\n            if (this.Filter === streamFilters.FLATE) {\r\n                const length = this.Width * this.Height;\r\n                let alpha;\r\n                if (this.sMask) {\r\n                    alpha = this.sMask.decodedStreamData;\r\n                    if (alpha.length !== length) {\r\n                        throw new Error(`Invalid alpha mask data length: ${alpha.length} (must be ${length})`);\r\n                    }\r\n                }\r\n                else {\r\n                    alpha = new Uint8Array(length).fill(255);\r\n                }\r\n                const imageBytes = new Uint8ClampedArray(length * 4);\r\n                const colors = this.getRgbColors();\r\n                let j;\r\n                let k;\r\n                for (let i = 0; i < length; i++) {\r\n                    j = i * 4;\r\n                    k = i * 3;\r\n                    imageBytes[j] = colors[k];\r\n                    imageBytes[j + 1] = colors[k + 1];\r\n                    imageBytes[j + 2] = colors[k + 2];\r\n                    imageBytes[j + 3] = alpha[i];\r\n                }\r\n                const imageData = new ImageData(imageBytes, this.Width, this.Height);\r\n                const urlPromise = new Promise((resolve, reject) => {\r\n                    const canvas = document.createElement(\"canvas\");\r\n                    canvas.width = this.Width;\r\n                    canvas.height = this.Height;\r\n                    canvas.getContext(\"2d\").putImageData(imageData, 0, 0);\r\n                    canvas.toBlob((blob) => {\r\n                        const url = URL.createObjectURL(blob);\r\n                        resolve(url);\r\n                    });\r\n                });\r\n                const imageUrl = yield urlPromise;\r\n                this._imageUrl = imageUrl;\r\n                return imageUrl;\r\n            }\r\n            throw new Error(`Unsupported image filter type: ${this.Filter}`);\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$17(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const dictBounds = yield parser.getDictBoundsAtAsync(start);\r\n            let i = yield parser.skipToNextNameAsync(dictBounds.contentStart, dictBounds.contentEnd);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Subtype\":\r\n                            const subtype = yield parser.parseNameAtAsync(i);\r\n                            if (subtype) {\r\n                                if (this.Subtype && this.Subtype !== subtype.value) {\r\n                                    throw new Error(`Invalid dict subtype: '${subtype.value}' instead of '${this.Subtype}'`);\r\n                                }\r\n                                i = subtype.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Subtype property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Width\":\r\n                        case \"/Height\":\r\n                        case \"/BitsPerComponent\":\r\n                        case \"/SMaskInData\":\r\n                        case \"/StructParent\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Decode\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Matte\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/Interpolate\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/SMask\":\r\n                        case \"/Metadata\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/ColorSpace\":\r\n                            const colorSpaceEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (colorSpaceEntryType === valueTypes.NAME) {\r\n                                const colorSpaceName = yield parser.parseNameAtAsync(i);\r\n                                if (colorSpaceName) {\r\n                                    this.ColorSpace = colorSpaceName.value;\r\n                                    i = colorSpaceName.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /ColorSpace name\");\r\n                            }\r\n                            else if (colorSpaceEntryType === valueTypes.ARRAY) {\r\n                                const colorSpaceArrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                                if (colorSpaceArrayBounds) {\r\n                                    const indexedColorSpace = yield IndexedColorSpaceArray.parseAsync({\r\n                                        parser,\r\n                                        bounds: colorSpaceArrayBounds,\r\n                                        cryptInfo: parseInfo.cryptInfo,\r\n                                        parseInfoGetterAsync: parseInfo.parseInfoGetterAsync,\r\n                                    });\r\n                                    if (indexedColorSpace) {\r\n                                        this.ColorSpace = colorSpaces.SPECIAL_INDEXED;\r\n                                        this._indexedColorSpace = indexedColorSpace.value;\r\n                                        i = colorSpaceArrayBounds.end + 1;\r\n                                        break;\r\n                                    }\r\n                                    throw new Error(\"Can't parse /ColorSpace object:\" +\r\n                                        parser.sliceCharsAsync(colorSpaceArrayBounds.start, colorSpaceArrayBounds.end));\r\n                                }\r\n                                throw new Error(\"Can't parse /ColorSpace value array\");\r\n                            }\r\n                            else if (colorSpaceEntryType === valueTypes.REF) {\r\n                                const colorSpaceRef = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (colorSpaceRef) {\r\n                                    const colorSpaceParseInfo = yield parseInfo.parseInfoGetterAsync(colorSpaceRef.value.id);\r\n                                    if (colorSpaceParseInfo) {\r\n                                        const indexedColorSpace = yield IndexedColorSpaceArray.parseAsync(colorSpaceParseInfo);\r\n                                        if (indexedColorSpace) {\r\n                                            this.ColorSpace = colorSpaces.SPECIAL_INDEXED;\r\n                                            this._indexedColorSpace = indexedColorSpace.value;\r\n                                            i = colorSpaceRef.end + 1;\r\n                                            break;\r\n                                        }\r\n                                        throw new Error(\"Can't parse /ColorSpace object:\" +\r\n                                            (yield colorSpaceParseInfo.parser.sliceCharsAsync(colorSpaceParseInfo.bounds.start, colorSpaceParseInfo.bounds.end)));\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /ColorSpace ref\");\r\n                            }\r\n                            throw new Error(`Unsupported /ColorSpace property value type: ${colorSpaceEntryType}`);\r\n                        case \"/ImageMask\":\r\n                            const imageMask = yield parser.parseBoolAtAsync(i, false);\r\n                            if (imageMask) {\r\n                                this.ImageMask = imageMask.value;\r\n                                i = imageMask.end + 1;\r\n                                if (this.ImageMask) {\r\n                                    this.BitsPerComponent = 1;\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /ImageMask property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Mask\":\r\n                            const maskEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (maskEntryType === valueTypes.REF) {\r\n                                const maskStreamId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (!maskStreamId) {\r\n                                    throw new Error(\"Can't parse /Mask value reference: failed to parse ref\");\r\n                                }\r\n                                const maskParseInfo = yield parseInfo.parseInfoGetterAsync(maskStreamId.value.id);\r\n                                if (!maskParseInfo) {\r\n                                    throw new Error(\"Can't parse /Mask value reference: failed to get image parse info\");\r\n                                }\r\n                                const maskStream = yield ImageStream.parseAsync(maskParseInfo);\r\n                                if (!maskStream) {\r\n                                    throw new Error(\"Can't parse /Mask value reference: failed to parse image stream\");\r\n                                }\r\n                                const maskParser = yield maskStream.value.getStreamDataParserAsync();\r\n                                const maskValues = [];\r\n                                let j = 0;\r\n                                let value;\r\n                                while (j <= maskParser.maxIndex) {\r\n                                    value = yield maskParser.parseNumberAtAsync(j, true, true);\r\n                                    if (!value) {\r\n                                        break;\r\n                                    }\r\n                                    maskValues.push(value.value);\r\n                                    j = value.end + 1;\r\n                                }\r\n                                if (!maskValues.length) {\r\n                                    throw new Error(\"Can't parse /Mask value reference: failed to parse decoded image data\");\r\n                                }\r\n                                this.Mask = maskValues;\r\n                                i = maskStreamId.end + 1;\r\n                                break;\r\n                            }\r\n                            else if (maskEntryType === valueTypes.ARRAY) {\r\n                                const maskArray = yield parser.parseNumberArrayAtAsync(i, false);\r\n                                if (maskArray) {\r\n                                    this.Mask = maskArray.value;\r\n                                    i = maskArray.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /Mask property value\");\r\n                            }\r\n                            throw new Error(`Unsupported /Mask property value type: ${maskEntryType}`);\r\n                        case \"/OC\":\r\n                        case \"/Intent\":\r\n                        case \"/Alternates\":\r\n                        case \"/ID\":\r\n                        case \"/OPI\":\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, dictBounds.contentEnd);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Width && !this.Height) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (this.ImageMask && (this.BitsPerComponent !== 1 || this.ColorSpace)) {\r\n                throw new Error(\"Mutually exclusive properties found\");\r\n            }\r\n            if (!this.Decode && !(this.Filter === streamFilters.JPX && !this.ImageMask)) {\r\n                switch (this.ColorSpace) {\r\n                    case colorSpaces.GRAYSCALE:\r\n                        this.Decode = [0, 1];\r\n                        break;\r\n                    case colorSpaces.RGB:\r\n                        this.Decode = [0, 1, 0, 1, 0, 1];\r\n                        break;\r\n                    case colorSpaces.CMYK:\r\n                        this.Decode = [0, 1, 0, 1, 0, 1, 0, 1];\r\n                        break;\r\n                    case colorSpaces.SPECIAL_INDEXED:\r\n                        this.Decode = [0, Math.pow(2, this.BitsPerComponent || 1) - 1];\r\n                        break;\r\n                    default:\r\n                        this.Decode = [0, 1];\r\n                        break;\r\n                }\r\n            }\r\n            if (!this.DecodeParms) {\r\n                this.DecodeParms = new DecodeParamsDict();\r\n            }\r\n            if (!this.DecodeParms.getIntProp(\"/BitsPerComponent\")) {\r\n                this.DecodeParms.setIntProp(\"/BitsPerComponent\", this.BitsPerComponent);\r\n            }\r\n            if (!this.DecodeParms.getIntProp(\"/Columns\")) {\r\n                this.DecodeParms.setIntProp(\"/Columns\", this.Width);\r\n            }\r\n            if (!this.DecodeParms.getIntProp(\"/Colors\")) {\r\n                switch (this.ColorSpace) {\r\n                    case colorSpaces.GRAYSCALE:\r\n                    case colorSpaces.SPECIAL_INDEXED:\r\n                        this.DecodeParms.setIntProp(\"/Colors\", 1);\r\n                        break;\r\n                    case colorSpaces.RGB:\r\n                        this.DecodeParms.setIntProp(\"/Colors\", 3);\r\n                        break;\r\n                    case colorSpaces.CMYK:\r\n                        this.DecodeParms.setIntProp(\"/Colors\", 4);\r\n                        break;\r\n                    default:\r\n                        this.DecodeParms.setIntProp(\"/Colors\", 1);\r\n                        break;\r\n                }\r\n            }\r\n            if (this.SMask) {\r\n                const sMaskParseInfo = yield parseInfo.parseInfoGetterAsync(this.SMask.id);\r\n                if (!sMaskParseInfo) {\r\n                    throw new Error(`Can't get parse info for ref: ${this.SMask.id} ${this.sMask.generation} R`);\r\n                }\r\n                const sMask = yield ImageStream.parseAsync(sMaskParseInfo);\r\n                if (!sMask) {\r\n                    throw new Error(`Can't parse SMask: ${this.SMask.id} ${this.sMask.generation} R`);\r\n                }\r\n                this._sMask = sMask.value;\r\n            }\r\n        });\r\n    }\r\n    getRgbColor(index) {\r\n        var _a;\r\n        const data = this.decodedStreamData;\r\n        switch (this.ColorSpace) {\r\n            case colorSpaces.GRAYSCALE:\r\n                const gray = data[index];\r\n                return [gray, gray, gray];\r\n            case colorSpaces.RGB:\r\n                return [\r\n                    data[index * 3],\r\n                    data[index * 3 + 1],\r\n                    data[index * 3 + 2],\r\n                ];\r\n            case colorSpaces.CMYK:\r\n                const c = data[index * 4] / 255;\r\n                const m = data[index * 4 + 1] / 255;\r\n                const y = data[index * 4 + 2] / 255;\r\n                const k = data[index * 4 + 3] / 255;\r\n                return [\r\n                    255 * (1 - c) * (1 - k),\r\n                    255 * (1 - m) * (1 - k),\r\n                    255 * (1 - y) * (1 - k),\r\n                ];\r\n            case colorSpaces.SPECIAL_INDEXED:\r\n                return ((_a = this._indexedColorSpace) === null || _a === void 0 ? void 0 : _a.getColor(index)) || [0, 0, 0];\r\n        }\r\n    }\r\n    getRgbColors() {\r\n        var _a;\r\n        const data = this.decodedStreamData;\r\n        const pixels = this.Width * this.Height;\r\n        const length = pixels * 3;\r\n        const result = new Uint8ClampedArray(length);\r\n        let i;\r\n        let j;\r\n        let n;\r\n        switch (this.ColorSpace) {\r\n            case colorSpaces.GRAYSCALE:\r\n                let gray;\r\n                for (i = 0; i < pixels; i++) {\r\n                    gray = data[i];\r\n                    j = i * 3;\r\n                    result[j] = gray;\r\n                    result[j + 1] = gray;\r\n                    result[j + 2] = gray;\r\n                }\r\n                break;\r\n            case colorSpaces.RGB:\r\n                for (i = 0; i < length; i++) {\r\n                    result[i] = data[i];\r\n                }\r\n                break;\r\n            case colorSpaces.CMYK:\r\n                let c;\r\n                let m;\r\n                let y;\r\n                let k;\r\n                for (i = 0; i < pixels; i++) {\r\n                    j = i * 3;\r\n                    n = i * 4;\r\n                    c = data[n] / 255;\r\n                    m = data[n + 1] / 255;\r\n                    y = data[n + 2] / 255;\r\n                    k = data[n + 3] / 255;\r\n                    result[j] = 255 * (1 - c) * (1 - k);\r\n                    result[j + 1] = 255 * (1 - m) * (1 - k);\r\n                    result[j + 2] = 255 * (1 - y) * (1 - k);\r\n                }\r\n                break;\r\n            case colorSpaces.SPECIAL_INDEXED:\r\n                let r;\r\n                let g;\r\n                let b;\r\n                for (i = 0; i < pixels; i++) {\r\n                    [r, g, b] = ((_a = this._indexedColorSpace) === null || _a === void 0 ? void 0 : _a.getColor(i)) || [0, 0, 0];\r\n                    j = i * 3;\r\n                    result[j] = r;\r\n                    result[j + 1] = g;\r\n                    result[j + 2] = b;\r\n                }\r\n                break;\r\n        }\r\n        return result;\r\n    }\r\n}\n\nvar __awaiter$16 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ObjectMapDict extends PdfDict {\r\n    constructor() {\r\n        super(null);\r\n        this._objectIdMap = new Map();\r\n        this._dictParserMap = new Map();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$16(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new ObjectMapDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    getObjectId(name) {\r\n        return this._objectIdMap.get(name);\r\n    }\r\n    *getObjectIds() {\r\n        for (const pair of this._objectIdMap) {\r\n            yield pair;\r\n        }\r\n        return;\r\n    }\r\n    getDictParser(name) {\r\n        return this._dictParserMap.get(name);\r\n    }\r\n    *getDictParsers() {\r\n        for (const pair of this._dictParserMap) {\r\n            yield pair;\r\n        }\r\n        return;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        this._objectIdMap.forEach((v, k) => {\r\n            bytes.push(...encoder.encode(k + \" \"), ...v.toArray(cryptInfo));\r\n        });\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$16(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        default:\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.REF) {\r\n                                const id = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (id) {\r\n                                    this._objectIdMap.set(name, id.value);\r\n                                    i = id.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            else if (entryType === valueTypes.DICTIONARY) {\r\n                                const dictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (dictBounds) {\r\n                                    const dictParseInfo = {\r\n                                        parser: yield PdfDict.getDataParserAsync(yield parser.sliceCharCodesAsync(dictBounds.start, dictBounds.end)),\r\n                                        bounds: {\r\n                                            start: 0,\r\n                                            end: dictBounds.end - dictBounds.start,\r\n                                            contentStart: dictBounds.contentStart - dictBounds.start,\r\n                                            contentEnd: dictBounds.contentEnd - dictBounds.start,\r\n                                        },\r\n                                        cryptInfo: parseInfo.cryptInfo,\r\n                                    };\r\n                                    this._dictParserMap.set(name, dictParseInfo);\r\n                                    i = dictBounds.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$15 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass UnicodeCmapStream extends PdfStream {\r\n    constructor(type = null) {\r\n        super(type);\r\n        this._codeRanges = [];\r\n        this._map = new Map();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new UnicodeCmapStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    hexBytesToUtfString(bytes) {\r\n        let result = \"\";\r\n        outer: for (let i = 0; i < bytes.length; i++) {\r\n            for (let j = 1; i + j <= bytes.length && j <= 4; j++) {\r\n                const sub = bytes.subarray(i, i + j);\r\n                if (this.isInsideAnyRange(sub)) {\r\n                    result += this._map.get(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(sub)) || \"\";\r\n                    continue outer;\r\n                }\r\n            }\r\n        }\r\n        return result;\r\n    }\r\n    isInsideAnyRange(bytes) {\r\n        outer: for (const range of this._codeRanges) {\r\n            if (bytes.length !== range.length) {\r\n                continue;\r\n            }\r\n            for (let i = 0; i < range.length; i++) {\r\n                if (bytes[i] < range.start[i]\r\n                    || bytes[i] > range.end[i]) {\r\n                    continue outer;\r\n                }\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n    parseCodeRangesAsync(parser) {\r\n        var _a, _b;\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            let i = 0;\r\n            const codeRangeStart = (_a = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_BEGIN_CODE_RANGE, { closedOnly: true }))) === null || _a === void 0 ? void 0 : _a.end;\r\n            if (!codeRangeStart) {\r\n                return;\r\n            }\r\n            i = codeRangeStart + 1;\r\n            const codeRangeEnd = (_b = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_END_CODE_RANGE, { closedOnly: true, minIndex: i }))) === null || _b === void 0 ? void 0 : _b.start;\r\n            while (i < codeRangeEnd - 1) {\r\n                const rangeStart = yield HexString.parseAsync(parser, i);\r\n                i = rangeStart.end + 1;\r\n                const rangeEnd = yield HexString.parseAsync(parser, i);\r\n                i = rangeEnd.end + 1;\r\n                this._codeRanges.push({\r\n                    length: rangeStart.value.hex.length,\r\n                    start: rangeStart.value.hex,\r\n                    end: rangeEnd.value.hex,\r\n                });\r\n            }\r\n        });\r\n    }\r\n    parseCharMapAsync(parser, decoder) {\r\n        var _a, _b;\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            let i = 0;\r\n            while (true) {\r\n                const charMapStart = (_a = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_BEGIN_CHAR, { closedOnly: true, minIndex: i }))) === null || _a === void 0 ? void 0 : _a.end;\r\n                if (!charMapStart) {\r\n                    break;\r\n                }\r\n                i = charMapStart + 1;\r\n                const charMapEnd = (_b = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_END_CHAR, { closedOnly: true, minIndex: i }))) === null || _b === void 0 ? void 0 : _b.start;\r\n                while (i < charMapEnd - 1) {\r\n                    const hexKey = yield HexString.parseAsync(parser, i);\r\n                    i = hexKey.end + 1;\r\n                    const unicodeValue = yield HexString.parseAsync(parser, i);\r\n                    i = unicodeValue.end + 1;\r\n                    this._map.set(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(hexKey.value.hex), decoder.decode(unicodeValue.value.hex));\r\n                }\r\n            }\r\n        });\r\n    }\r\n    parseCharRangesMapAsync(parser, decoder) {\r\n        var _a, _b;\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            let i = 0;\r\n            while (true) {\r\n                const rangeMapStart = (_a = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_BEGIN_RANGE, { closedOnly: true, minIndex: i }))) === null || _a === void 0 ? void 0 : _a.end;\r\n                if (!rangeMapStart) {\r\n                    break;\r\n                }\r\n                i = rangeMapStart + 1;\r\n                const rangeMapEnd = (_b = (yield parser.findSubarrayIndexAsync(keywordCodes.CMAP_END_RANGE, { closedOnly: true, minIndex: i }))) === null || _b === void 0 ? void 0 : _b.start;\r\n                while (i < rangeMapEnd - 1) {\r\n                    const keyRangeStart = yield HexString.parseAsync(parser, i);\r\n                    i = keyRangeStart.end + 1;\r\n                    const keyRangeEnd = yield HexString.parseAsync(parser, i);\r\n                    i = keyRangeEnd.end + 1;\r\n                    let key = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(keyRangeStart.value.hex);\r\n                    const nextValueType = yield parser.getValueTypeAtAsync(i, true);\r\n                    if (nextValueType === valueTypes.ARRAY) {\r\n                        const valueArray = yield HexString.parseArrayAsync(parser, i);\r\n                        i = valueArray.end + 1;\r\n                        for (const value of valueArray.value) {\r\n                            this._map.set(key++, decoder.decode(value.hex));\r\n                        }\r\n                    }\r\n                    else {\r\n                        const startingValue = yield HexString.parseAsync(parser, i);\r\n                        i = startingValue.end + 1;\r\n                        let startingUtf = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(startingValue.value.hex);\r\n                        while (key <= ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.parseIntFromBytes(keyRangeEnd.value.hex)) {\r\n                            const hexStringUnpadded = (startingUtf++).toString(16);\r\n                            const padding = hexStringUnpadded.length % 2\r\n                                ? \"0\"\r\n                                : \"\";\r\n                            const hexString = padding + hexStringUnpadded;\r\n                            this._map.set(key++, decoder.decode(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.hexStringToBytes(hexString)));\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    }\r\n    fillMapAsync() {\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            this._codeRanges.length = 0;\r\n            this._map.clear();\r\n            const parser = yield this.getStreamDataParserAsync();\r\n            const decoder = new TextDecoder(\"utf-16be\");\r\n            yield this.parseCodeRangesAsync(parser);\r\n            yield this.parseCharMapAsync(parser, decoder);\r\n            yield this.parseCharRangesMapAsync(parser, decoder);\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$15(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            yield this.fillMapAsync();\r\n        });\r\n    }\r\n}\n\nconst pdfCharCodesByName = {\r\n    A: {\r\n        name: \"A\",\r\n        char: \"A\",\r\n        stdCode: 65,\r\n        macCode: 65,\r\n        winCode: 65,\r\n        pdfCode: 65,\r\n        utfCode: 65\r\n    },\r\n    AE: {\r\n        name: \"AE\",\r\n        char: \"Æ\",\r\n        stdCode: 225,\r\n        macCode: 174,\r\n        winCode: 198,\r\n        pdfCode: 198,\r\n        utfCode: 198\r\n    },\r\n    Aacute: {\r\n        name: \"Aacute\",\r\n        char: \"Á\",\r\n        stdCode: null,\r\n        macCode: 231,\r\n        winCode: 193,\r\n        pdfCode: 193,\r\n        utfCode: 193\r\n    },\r\n    Acircumflex: {\r\n        name: \"Acircumflex\",\r\n        char: \"Â\",\r\n        stdCode: null,\r\n        macCode: 229,\r\n        winCode: 194,\r\n        pdfCode: 194,\r\n        utfCode: 194\r\n    },\r\n    Adieresis: {\r\n        name: \"Adieresis\",\r\n        char: \"Ä\",\r\n        stdCode: null,\r\n        macCode: 128,\r\n        winCode: 196,\r\n        pdfCode: 196,\r\n        utfCode: 196\r\n    },\r\n    Agrave: {\r\n        name: \"Agrave\",\r\n        char: \"À\",\r\n        stdCode: null,\r\n        macCode: 203,\r\n        winCode: 192,\r\n        pdfCode: 192,\r\n        utfCode: 192\r\n    },\r\n    Aring: {\r\n        name: \"Aring\",\r\n        char: \"Å\",\r\n        stdCode: null,\r\n        macCode: 129,\r\n        winCode: 197,\r\n        pdfCode: 197,\r\n        utfCode: 197\r\n    },\r\n    Atilde: {\r\n        name: \"Atilde\",\r\n        char: \"Ã\",\r\n        stdCode: null,\r\n        macCode: 204,\r\n        winCode: 195,\r\n        pdfCode: 195,\r\n        utfCode: 195\r\n    },\r\n    B: {\r\n        name: \"B\",\r\n        char: \"B\",\r\n        stdCode: 66,\r\n        macCode: 66,\r\n        winCode: 66,\r\n        pdfCode: 66,\r\n        utfCode: 66\r\n    },\r\n    C: {\r\n        name: \"C\",\r\n        char: \"C\",\r\n        stdCode: 67,\r\n        macCode: 67,\r\n        winCode: 67,\r\n        pdfCode: 67,\r\n        utfCode: 67\r\n    },\r\n    Ccedilla: {\r\n        name: \"Ccedilla\",\r\n        char: \"Ç\",\r\n        stdCode: null,\r\n        macCode: 130,\r\n        winCode: 199,\r\n        pdfCode: 199,\r\n        utfCode: 199\r\n    },\r\n    D: {\r\n        name: \"D\",\r\n        char: \"D\",\r\n        stdCode: 68,\r\n        macCode: 68,\r\n        winCode: 68,\r\n        pdfCode: 68,\r\n        utfCode: 68\r\n    },\r\n    E: {\r\n        name: \"E\",\r\n        char: \"E\",\r\n        stdCode: 69,\r\n        macCode: 69,\r\n        winCode: 69,\r\n        pdfCode: 69,\r\n        utfCode: 69\r\n    },\r\n    Eacute: {\r\n        name: \"Eacute\",\r\n        char: \"É\",\r\n        stdCode: null,\r\n        macCode: 131,\r\n        winCode: 201,\r\n        pdfCode: 201,\r\n        utfCode: 201\r\n    },\r\n    Ecircumflex: {\r\n        name: \"Ecircumflex\",\r\n        char: \"Ê\",\r\n        stdCode: null,\r\n        macCode: 230,\r\n        winCode: 202,\r\n        pdfCode: 202,\r\n        utfCode: 202\r\n    },\r\n    Edieresis: {\r\n        name: \"Edieresis\",\r\n        char: \"Ë\",\r\n        stdCode: null,\r\n        macCode: 232,\r\n        winCode: 203,\r\n        pdfCode: 203,\r\n        utfCode: 203\r\n    },\r\n    Egrave: {\r\n        name: \"Egrave\",\r\n        char: \"È\",\r\n        stdCode: null,\r\n        macCode: 233,\r\n        winCode: 200,\r\n        pdfCode: 200,\r\n        utfCode: 200\r\n    },\r\n    Eth: {\r\n        name: \"Eth\",\r\n        char: \"Ð\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 208,\r\n        pdfCode: 208,\r\n        utfCode: 208\r\n    },\r\n    Euro: {\r\n        name: \"Euro\",\r\n        char: \"€\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 128,\r\n        pdfCode: 160,\r\n        utfCode: 8364,\r\n    },\r\n    F: {\r\n        name: \"F\",\r\n        char: \"F\",\r\n        stdCode: 70,\r\n        macCode: 70,\r\n        winCode: 70,\r\n        pdfCode: 70,\r\n        utfCode: 70\r\n    },\r\n    G: {\r\n        name: \"G\",\r\n        char: \"G\",\r\n        stdCode: 71,\r\n        macCode: 71,\r\n        winCode: 71,\r\n        pdfCode: 71,\r\n        utfCode: 71\r\n    },\r\n    H: {\r\n        name: \"H\",\r\n        char: \"H\",\r\n        stdCode: 72,\r\n        macCode: 72,\r\n        winCode: 72,\r\n        pdfCode: 72,\r\n        utfCode: 72\r\n    },\r\n    I: {\r\n        name: \"I\",\r\n        char: \"I\",\r\n        stdCode: 73,\r\n        macCode: 73,\r\n        winCode: 73,\r\n        pdfCode: 73,\r\n        utfCode: 73\r\n    },\r\n    Iacute: {\r\n        name: \"Iacute\",\r\n        char: \"Í\",\r\n        stdCode: null,\r\n        macCode: 234,\r\n        winCode: 205,\r\n        pdfCode: 205,\r\n        utfCode: 205\r\n    },\r\n    Icircumflex: {\r\n        name: \"Icircumflex\",\r\n        char: \"Î\",\r\n        stdCode: null,\r\n        macCode: 235,\r\n        winCode: 206,\r\n        pdfCode: 206,\r\n        utfCode: 206\r\n    },\r\n    Idieresis: {\r\n        name: \"Idieresis\",\r\n        char: \"Ï\",\r\n        stdCode: null,\r\n        macCode: 236,\r\n        winCode: 207,\r\n        pdfCode: 207,\r\n        utfCode: 207\r\n    },\r\n    Igrave: {\r\n        name: \"Igrave\",\r\n        char: \"Ì\",\r\n        stdCode: null,\r\n        macCode: 237,\r\n        winCode: 204,\r\n        pdfCode: 204,\r\n        utfCode: 204\r\n    },\r\n    J: {\r\n        name: \"J\",\r\n        char: \"J\",\r\n        stdCode: 74,\r\n        macCode: 74,\r\n        winCode: 74,\r\n        pdfCode: 74,\r\n        utfCode: 74\r\n    },\r\n    K: {\r\n        name: \"K\",\r\n        char: \"K\",\r\n        stdCode: 75,\r\n        macCode: 75,\r\n        winCode: 75,\r\n        pdfCode: 75,\r\n        utfCode: 75\r\n    },\r\n    L: {\r\n        name: \"L\",\r\n        char: \"L\",\r\n        stdCode: 76,\r\n        macCode: 76,\r\n        winCode: 76,\r\n        pdfCode: 76,\r\n        utfCode: 76\r\n    },\r\n    Lslash: {\r\n        name: \"Lslash\",\r\n        char: \"Ł\",\r\n        stdCode: 232,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: 149,\r\n        utfCode: 321\r\n    },\r\n    M: {\r\n        name: \"M\",\r\n        char: \"M\",\r\n        stdCode: 77,\r\n        macCode: 77,\r\n        winCode: 77,\r\n        pdfCode: 77,\r\n        utfCode: 77\r\n    },\r\n    N: {\r\n        name: \"N\",\r\n        char: \"N\",\r\n        stdCode: 78,\r\n        macCode: 78,\r\n        winCode: 78,\r\n        pdfCode: 78,\r\n        utfCode: 78\r\n    },\r\n    Ntilde: {\r\n        name: \"Ntilde\",\r\n        char: \"Ñ\",\r\n        stdCode: null,\r\n        macCode: 132,\r\n        winCode: 209,\r\n        pdfCode: 209,\r\n        utfCode: 209\r\n    },\r\n    O: {\r\n        name: \"O\",\r\n        char: \"O\",\r\n        stdCode: 79,\r\n        macCode: 79,\r\n        winCode: 79,\r\n        pdfCode: 79,\r\n        utfCode: 79\r\n    },\r\n    OE: {\r\n        name: \"OE\",\r\n        char: \"OE\",\r\n        stdCode: 234,\r\n        macCode: 206,\r\n        winCode: 140,\r\n        pdfCode: 150,\r\n        utfCode: 338\r\n    },\r\n    Oacute: {\r\n        name: \"Oacute\",\r\n        char: \"Ó\",\r\n        stdCode: null,\r\n        macCode: 238,\r\n        winCode: 211,\r\n        pdfCode: 211,\r\n        utfCode: 211\r\n    },\r\n    Ocircumflex: {\r\n        name: \"Ocircumflex\",\r\n        char: \"Ô\",\r\n        stdCode: null,\r\n        macCode: 239,\r\n        winCode: 212,\r\n        pdfCode: 212,\r\n        utfCode: 212\r\n    },\r\n    Odieresis: {\r\n        name: \"Odieresis\",\r\n        char: \"Ö\",\r\n        stdCode: null,\r\n        macCode: 133,\r\n        winCode: 214,\r\n        pdfCode: 214,\r\n        utfCode: 214\r\n    },\r\n    Ograve: {\r\n        name: \"Ograve\",\r\n        char: \"Ò\",\r\n        stdCode: null,\r\n        macCode: 241,\r\n        winCode: 210,\r\n        pdfCode: 210,\r\n        utfCode: 210\r\n    },\r\n    Oslash: {\r\n        name: \"Oslash\",\r\n        char: \"Ø\",\r\n        stdCode: 233,\r\n        macCode: 175,\r\n        winCode: 216,\r\n        pdfCode: 216,\r\n        utfCode: 216\r\n    },\r\n    Otilde: {\r\n        name: \"Otilde\",\r\n        char: \"Õ\",\r\n        stdCode: null,\r\n        macCode: 205,\r\n        winCode: 213,\r\n        pdfCode: 213,\r\n        utfCode: 213\r\n    },\r\n    P: {\r\n        name: \"P\",\r\n        char: \"P\",\r\n        stdCode: 80,\r\n        macCode: 80,\r\n        winCode: 80,\r\n        pdfCode: 80,\r\n        utfCode: 80\r\n    },\r\n    Q: {\r\n        name: \"Q\",\r\n        char: \"Q\",\r\n        stdCode: 81,\r\n        macCode: 81,\r\n        winCode: 81,\r\n        pdfCode: 81,\r\n        utfCode: 81\r\n    },\r\n    R: {\r\n        name: \"R\",\r\n        char: \"R\",\r\n        stdCode: 82,\r\n        macCode: 82,\r\n        winCode: 82,\r\n        pdfCode: 82,\r\n        utfCode: 82\r\n    },\r\n    S: {\r\n        name: \"S\",\r\n        char: \"S\",\r\n        stdCode: 83,\r\n        macCode: 83,\r\n        winCode: 83,\r\n        pdfCode: 83,\r\n        utfCode: 83\r\n    },\r\n    Scaron: {\r\n        name: \"Scaron\",\r\n        char: \"Š\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 138,\r\n        pdfCode: 151,\r\n        utfCode: 352\r\n    },\r\n    T: {\r\n        name: \"T\",\r\n        char: \"T\",\r\n        stdCode: 84,\r\n        macCode: 84,\r\n        winCode: 84,\r\n        pdfCode: 84,\r\n        utfCode: 84\r\n    },\r\n    Thorn: {\r\n        name: \"Thorn\",\r\n        char: \"Þ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 222,\r\n        pdfCode: 222,\r\n        utfCode: 222\r\n    },\r\n    U: {\r\n        name: \"U\",\r\n        char: \"U\",\r\n        stdCode: 85,\r\n        macCode: 85,\r\n        winCode: 85,\r\n        pdfCode: 85,\r\n        utfCode: 85\r\n    },\r\n    Uacute: {\r\n        name: \"Uacute\",\r\n        char: \"Ú\",\r\n        stdCode: null,\r\n        macCode: 242,\r\n        winCode: 218,\r\n        pdfCode: 218,\r\n        utfCode: 218\r\n    },\r\n    Ucircumflex: {\r\n        name: \"Ucircumflex\",\r\n        char: \"Û\",\r\n        stdCode: null,\r\n        macCode: 243,\r\n        winCode: 219,\r\n        pdfCode: 219,\r\n        utfCode: 219\r\n    },\r\n    Udieresis: {\r\n        name: \"Udieresis\",\r\n        char: \"Ü\",\r\n        stdCode: null,\r\n        macCode: 134,\r\n        winCode: 220,\r\n        pdfCode: 220,\r\n        utfCode: 220\r\n    },\r\n    Ugrave: {\r\n        name: \"Ugrave\",\r\n        char: \"Ù\",\r\n        stdCode: null,\r\n        macCode: 244,\r\n        winCode: 217,\r\n        pdfCode: 217,\r\n        utfCode: 217\r\n    },\r\n    V: {\r\n        name: \"V\",\r\n        char: \"V\",\r\n        stdCode: 86,\r\n        macCode: 86,\r\n        winCode: 86,\r\n        pdfCode: 86,\r\n        utfCode: 86\r\n    },\r\n    W: {\r\n        name: \"W\",\r\n        char: \"W\",\r\n        stdCode: 87,\r\n        macCode: 87,\r\n        winCode: 87,\r\n        pdfCode: 87,\r\n        utfCode: 87\r\n    },\r\n    X: {\r\n        name: \"X\",\r\n        char: \"X\",\r\n        stdCode: 88,\r\n        macCode: 88,\r\n        winCode: 88,\r\n        pdfCode: 88,\r\n        utfCode: 88\r\n    },\r\n    Y: {\r\n        name: \"Y\",\r\n        char: \"Y\",\r\n        stdCode: 89,\r\n        macCode: 89,\r\n        winCode: 89,\r\n        pdfCode: 89,\r\n        utfCode: 89\r\n    },\r\n    Yacute: {\r\n        name: \"Yacute\",\r\n        char: \"Ý\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 221,\r\n        pdfCode: 221,\r\n        utfCode: 221\r\n    },\r\n    Ydieresis: {\r\n        name: \"Ydieresis\",\r\n        char: \"Ÿ\",\r\n        stdCode: null,\r\n        macCode: 217,\r\n        winCode: 159,\r\n        pdfCode: 152,\r\n        utfCode: 376\r\n    },\r\n    Z: {\r\n        name: \"Z\",\r\n        char: \"Z\",\r\n        stdCode: 90,\r\n        macCode: 90,\r\n        winCode: 90,\r\n        pdfCode: 90,\r\n        utfCode: 90\r\n    },\r\n    Zcaron: {\r\n        name: \"Zcaron\",\r\n        char: \"Ž\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 142,\r\n        pdfCode: 153,\r\n        utfCode: 381\r\n    },\r\n    a: {\r\n        name: \"a\",\r\n        char: \"a\",\r\n        stdCode: 97,\r\n        macCode: 97,\r\n        winCode: 97,\r\n        pdfCode: 97,\r\n        utfCode: 97\r\n    },\r\n    aacute: {\r\n        name: \"aacute\",\r\n        char: \"á\",\r\n        stdCode: null,\r\n        macCode: 135,\r\n        winCode: 225,\r\n        pdfCode: 225,\r\n        utfCode: 225\r\n    },\r\n    acircumflex: {\r\n        name: \"acircumflex\",\r\n        char: \"â\",\r\n        stdCode: null,\r\n        macCode: 137,\r\n        winCode: 226,\r\n        pdfCode: 226,\r\n        utfCode: 226\r\n    },\r\n    acute: {\r\n        name: \"acute\",\r\n        char: \"´\",\r\n        stdCode: 194,\r\n        macCode: 171,\r\n        winCode: 180,\r\n        pdfCode: 180,\r\n        utfCode: 180\r\n    },\r\n    adieresis: {\r\n        name: \"adieresis\",\r\n        char: \"ä\",\r\n        stdCode: null,\r\n        macCode: 138,\r\n        winCode: 228,\r\n        pdfCode: 228,\r\n        utfCode: 228\r\n    },\r\n    ae: {\r\n        name: \"ae\",\r\n        char: \"æ\",\r\n        stdCode: 241,\r\n        macCode: 190,\r\n        winCode: 230,\r\n        pdfCode: 230,\r\n        utfCode: 230\r\n    },\r\n    agrave: {\r\n        name: \"agrave\",\r\n        char: \"à\",\r\n        stdCode: null,\r\n        macCode: 136,\r\n        winCode: 224,\r\n        pdfCode: 224,\r\n        utfCode: 224\r\n    },\r\n    ampersand: {\r\n        name: \"ampersand\",\r\n        char: \"&\",\r\n        stdCode: 38,\r\n        macCode: 38,\r\n        winCode: 38,\r\n        pdfCode: 38,\r\n        utfCode: 38\r\n    },\r\n    aring: {\r\n        name: \"aring\",\r\n        char: \"å\",\r\n        stdCode: null,\r\n        macCode: 140,\r\n        winCode: 229,\r\n        pdfCode: 229,\r\n        utfCode: 229\r\n    },\r\n    asciicircum: {\r\n        name: \"asciicircum\",\r\n        char: \"^\",\r\n        stdCode: 94,\r\n        macCode: 94,\r\n        winCode: 94,\r\n        pdfCode: 94,\r\n        utfCode: 94\r\n    },\r\n    asciitilde: {\r\n        name: \"asciitilde\",\r\n        char: \"~\",\r\n        stdCode: 126,\r\n        macCode: 126,\r\n        winCode: 126,\r\n        pdfCode: 126,\r\n        utfCode: 126\r\n    },\r\n    asterisk: {\r\n        name: \"asterisk\",\r\n        char: \"*\",\r\n        stdCode: 42,\r\n        macCode: 42,\r\n        winCode: 42,\r\n        pdfCode: 42,\r\n        utfCode: 42\r\n    },\r\n    at: {\r\n        name: \"at\",\r\n        char: \"@\",\r\n        stdCode: 64,\r\n        macCode: 64,\r\n        winCode: 64,\r\n        pdfCode: 64,\r\n        utfCode: 64\r\n    },\r\n    atilde: {\r\n        name: \"atilde\",\r\n        char: \"ã\",\r\n        stdCode: null,\r\n        macCode: 139,\r\n        winCode: 227,\r\n        pdfCode: 227,\r\n        utfCode: 227\r\n    },\r\n    b: {\r\n        name: \"b\",\r\n        char: \"b\",\r\n        stdCode: 98,\r\n        macCode: 98,\r\n        winCode: 98,\r\n        pdfCode: 98,\r\n        utfCode: 98\r\n    },\r\n    backslash: {\r\n        name: \"backslash\",\r\n        char: \"\\\"\",\r\n        stdCode: 92,\r\n        macCode: 92,\r\n        winCode: 92,\r\n        pdfCode: 92,\r\n        utfCode: 92\r\n    },\r\n    bar: {\r\n        name: \"bar\",\r\n        char: \"|\",\r\n        stdCode: 124,\r\n        macCode: 124,\r\n        winCode: 124,\r\n        pdfCode: 124,\r\n        utfCode: 124\r\n    },\r\n    braceleft: {\r\n        name: \"braceleft\",\r\n        char: \"{\",\r\n        stdCode: 123,\r\n        macCode: 123,\r\n        winCode: 123,\r\n        pdfCode: 123,\r\n        utfCode: 123\r\n    },\r\n    braceright: {\r\n        name: \"braceright\",\r\n        char: \"}\",\r\n        stdCode: 125,\r\n        macCode: 125,\r\n        winCode: 125,\r\n        pdfCode: 125,\r\n        utfCode: 125\r\n    },\r\n    bracketleft: {\r\n        name: \"bracketleft\",\r\n        char: \"[\",\r\n        stdCode: 91,\r\n        macCode: 91,\r\n        winCode: 91,\r\n        pdfCode: 91,\r\n        utfCode: 91\r\n    },\r\n    bracketright: {\r\n        name: \"bracketright\",\r\n        char: \"]\",\r\n        stdCode: 93,\r\n        macCode: 93,\r\n        winCode: 93,\r\n        pdfCode: 93,\r\n        utfCode: 93\r\n    },\r\n    breve: {\r\n        name: \"breve\",\r\n        char: \"˘\",\r\n        stdCode: 198,\r\n        macCode: 249,\r\n        winCode: null,\r\n        pdfCode: 24,\r\n        utfCode: 728\r\n    },\r\n    brokenbar: {\r\n        name: \"brokenbar\",\r\n        char: \"¦\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 166,\r\n        pdfCode: 166,\r\n        utfCode: 166\r\n    },\r\n    bullet: {\r\n        name: \"bullet\",\r\n        char: \"•\",\r\n        stdCode: 183,\r\n        macCode: 165,\r\n        winCode: 149,\r\n        pdfCode: 128,\r\n        utfCode: 8226\r\n    },\r\n    c: {\r\n        name: \"c\",\r\n        char: \"c\",\r\n        stdCode: 99,\r\n        macCode: 99,\r\n        winCode: 99,\r\n        pdfCode: 99,\r\n        utfCode: 99\r\n    },\r\n    caron: {\r\n        name: \"caron\",\r\n        char: \"ˇ\",\r\n        stdCode: 207,\r\n        macCode: 255,\r\n        winCode: null,\r\n        pdfCode: 25,\r\n        utfCode: 711\r\n    },\r\n    ccedilla: {\r\n        name: \"ccedilla\",\r\n        char: \"ç\",\r\n        stdCode: null,\r\n        macCode: 141,\r\n        winCode: 231,\r\n        pdfCode: 231,\r\n        utfCode: 231\r\n    },\r\n    cedilla: {\r\n        name: \"cedilla\",\r\n        char: \"¸\",\r\n        stdCode: 203,\r\n        macCode: 252,\r\n        winCode: 184,\r\n        pdfCode: 184,\r\n        utfCode: 184\r\n    },\r\n    cent: {\r\n        name: \"cent\",\r\n        char: \"¢\",\r\n        stdCode: 162,\r\n        macCode: 162,\r\n        winCode: 162,\r\n        pdfCode: 162,\r\n        utfCode: 162\r\n    },\r\n    circumflex: {\r\n        name: \"circumflex\",\r\n        char: \"ˆ\",\r\n        stdCode: 195,\r\n        macCode: 246,\r\n        winCode: 136,\r\n        pdfCode: 26,\r\n        utfCode: 710\r\n    },\r\n    colon: {\r\n        name: \"colon\",\r\n        char: \":\",\r\n        stdCode: 58,\r\n        macCode: 58,\r\n        winCode: 58,\r\n        pdfCode: 58,\r\n        utfCode: 58\r\n    },\r\n    comma: {\r\n        name: \"comma\",\r\n        char: \",\",\r\n        stdCode: 44,\r\n        macCode: 44,\r\n        winCode: 44,\r\n        pdfCode: 44,\r\n        utfCode: 44\r\n    },\r\n    copyright: {\r\n        name: \"copyright\",\r\n        char: \"©\",\r\n        stdCode: null,\r\n        macCode: 169,\r\n        winCode: 169,\r\n        pdfCode: 169,\r\n        utfCode: 169\r\n    },\r\n    currency1: {\r\n        name: \"currency1\",\r\n        char: \"¤\",\r\n        stdCode: 168,\r\n        macCode: 219,\r\n        winCode: 164,\r\n        pdfCode: 164,\r\n        utfCode: 164\r\n    },\r\n    d: {\r\n        name: \"d\",\r\n        char: \"d\",\r\n        stdCode: 100,\r\n        macCode: 100,\r\n        winCode: 100,\r\n        pdfCode: 100,\r\n        utfCode: 100\r\n    },\r\n    dagger: {\r\n        name: \"dagger\",\r\n        char: \"†\",\r\n        stdCode: 178,\r\n        macCode: 160,\r\n        winCode: 134,\r\n        pdfCode: 129,\r\n        utfCode: 8224\r\n    },\r\n    daggerdbl: {\r\n        name: \"daggerdbl\",\r\n        char: \"‡\",\r\n        stdCode: 179,\r\n        macCode: 224,\r\n        winCode: 135,\r\n        pdfCode: 130,\r\n        utfCode: 8225\r\n    },\r\n    degree: {\r\n        name: \"degree\",\r\n        char: \"°\",\r\n        stdCode: null,\r\n        macCode: 161,\r\n        winCode: 176,\r\n        pdfCode: 176,\r\n        utfCode: 176\r\n    },\r\n    dieresis: {\r\n        name: \"dieresis\",\r\n        char: \"¨\",\r\n        stdCode: 200,\r\n        macCode: 172,\r\n        winCode: 168,\r\n        pdfCode: 168,\r\n        utfCode: 168\r\n    },\r\n    divide: {\r\n        name: \"divide\",\r\n        char: \"÷\",\r\n        stdCode: null,\r\n        macCode: 214,\r\n        winCode: 247,\r\n        pdfCode: 247,\r\n        utfCode: 247\r\n    },\r\n    dollar: {\r\n        name: \"dollar\",\r\n        char: \"$\",\r\n        stdCode: 36,\r\n        macCode: 36,\r\n        winCode: 36,\r\n        pdfCode: 36,\r\n        utfCode: 36\r\n    },\r\n    dotaccent: {\r\n        name: \"dotaccent\",\r\n        char: \"˙\",\r\n        stdCode: 199,\r\n        macCode: 250,\r\n        winCode: null,\r\n        pdfCode: 27,\r\n        utfCode: 729\r\n    },\r\n    dotlessi: {\r\n        name: \"dotlessi\",\r\n        char: \"ı\",\r\n        stdCode: 245,\r\n        macCode: 245,\r\n        winCode: null,\r\n        pdfCode: 154,\r\n        utfCode: 305\r\n    },\r\n    e: {\r\n        name: \"e\",\r\n        char: \"e\",\r\n        stdCode: 101,\r\n        macCode: 101,\r\n        winCode: 101,\r\n        pdfCode: 101,\r\n        utfCode: 101\r\n    },\r\n    eacute: {\r\n        name: \"eacute\",\r\n        char: \"é\",\r\n        stdCode: null,\r\n        macCode: 142,\r\n        winCode: 233,\r\n        pdfCode: 233,\r\n        utfCode: 233\r\n    },\r\n    ecircumflex: {\r\n        name: \"ecircumflex\",\r\n        char: \"ê\",\r\n        stdCode: null,\r\n        macCode: 144,\r\n        winCode: 234,\r\n        pdfCode: 234,\r\n        utfCode: 234\r\n    },\r\n    edieresis: {\r\n        name: \"edieresis\",\r\n        char: \"ë\",\r\n        stdCode: null,\r\n        macCode: 145,\r\n        winCode: 235,\r\n        pdfCode: 235,\r\n        utfCode: 235\r\n    },\r\n    egrave: {\r\n        name: \"egrave\",\r\n        char: \"è\",\r\n        stdCode: null,\r\n        macCode: 143,\r\n        winCode: 232,\r\n        pdfCode: 232,\r\n        utfCode: 232\r\n    },\r\n    eight: {\r\n        name: \"eight\",\r\n        char: \"8\",\r\n        stdCode: 56,\r\n        macCode: 56,\r\n        winCode: 56,\r\n        pdfCode: 56,\r\n        utfCode: 56\r\n    },\r\n    ellipsis: {\r\n        name: \"ellipsis\",\r\n        char: \"…\",\r\n        stdCode: 188,\r\n        macCode: 201,\r\n        winCode: 133,\r\n        pdfCode: 131,\r\n        utfCode: 8230\r\n    },\r\n    emdash: {\r\n        name: \"emdash\",\r\n        char: \"—\",\r\n        stdCode: 208,\r\n        macCode: 209,\r\n        winCode: 151,\r\n        pdfCode: 132,\r\n        utfCode: 8212\r\n    },\r\n    endash: {\r\n        name: \"endash\",\r\n        char: \"–\",\r\n        stdCode: 177,\r\n        macCode: 208,\r\n        winCode: 150,\r\n        pdfCode: 133,\r\n        utfCode: 8211\r\n    },\r\n    equal: {\r\n        name: \"equal\",\r\n        char: \"=\",\r\n        stdCode: 61,\r\n        macCode: 61,\r\n        winCode: 61,\r\n        pdfCode: 61,\r\n        utfCode: 61\r\n    },\r\n    eth: {\r\n        name: \"eth\",\r\n        char: \"ð\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 240,\r\n        pdfCode: 240,\r\n        utfCode: 240\r\n    },\r\n    exclam: {\r\n        name: \"exclam\",\r\n        char: \"!\",\r\n        stdCode: 33,\r\n        macCode: 33,\r\n        winCode: 33,\r\n        pdfCode: 33,\r\n        utfCode: 33\r\n    },\r\n    exclamdown: {\r\n        name: \"exclamdown\",\r\n        char: \"¡\",\r\n        stdCode: 161,\r\n        macCode: 193,\r\n        winCode: 161,\r\n        pdfCode: 161,\r\n        utfCode: 161\r\n    },\r\n    f: {\r\n        name: \"f\",\r\n        char: \"f\",\r\n        stdCode: 102,\r\n        macCode: 102,\r\n        winCode: 102,\r\n        pdfCode: 102,\r\n        utfCode: 102\r\n    },\r\n    fi: {\r\n        name: \"fi\",\r\n        char: \"fi\",\r\n        stdCode: 174,\r\n        macCode: 222,\r\n        winCode: null,\r\n        pdfCode: 147,\r\n        utfCode: 64257\r\n    },\r\n    five: {\r\n        name: \"five\",\r\n        char: \"5\",\r\n        stdCode: 53,\r\n        macCode: 53,\r\n        winCode: 53,\r\n        pdfCode: 53,\r\n        utfCode: 53\r\n    },\r\n    fl: {\r\n        name: \"fl\",\r\n        char: \"fl\",\r\n        stdCode: 175,\r\n        macCode: 223,\r\n        winCode: null,\r\n        pdfCode: 148,\r\n        utfCode: 64258\r\n    },\r\n    florin: {\r\n        name: \"florin\",\r\n        char: \"ƒ\",\r\n        stdCode: 166,\r\n        macCode: 196,\r\n        winCode: 131,\r\n        pdfCode: 134,\r\n        utfCode: 402\r\n    },\r\n    four: {\r\n        name: \"four\",\r\n        char: \"4\",\r\n        stdCode: 52,\r\n        macCode: 52,\r\n        winCode: 52,\r\n        pdfCode: 52,\r\n        utfCode: 52\r\n    },\r\n    fraction: {\r\n        name: \"fraction\",\r\n        char: \"⁄\",\r\n        stdCode: 164,\r\n        macCode: 218,\r\n        winCode: null,\r\n        pdfCode: 135,\r\n        utfCode: 8260\r\n    },\r\n    g: {\r\n        name: \"g\",\r\n        char: \"g\",\r\n        stdCode: 103,\r\n        macCode: 103,\r\n        winCode: 103,\r\n        pdfCode: 103,\r\n        utfCode: 103\r\n    },\r\n    germandbls: {\r\n        name: \"germandbls\",\r\n        char: \"ß\",\r\n        stdCode: 251,\r\n        macCode: 167,\r\n        winCode: 223,\r\n        pdfCode: 223,\r\n        utfCode: 223\r\n    },\r\n    grave: {\r\n        name: \"grave\",\r\n        char: \"`\",\r\n        stdCode: 193,\r\n        macCode: 96,\r\n        winCode: 96,\r\n        pdfCode: 96,\r\n        utfCode: 96\r\n    },\r\n    greater: {\r\n        name: \"greater\",\r\n        char: \">\",\r\n        stdCode: 62,\r\n        macCode: 62,\r\n        winCode: 62,\r\n        pdfCode: 62,\r\n        utfCode: 62\r\n    },\r\n    guillemotleft: {\r\n        name: \"guillemotleft\",\r\n        char: \"«\",\r\n        stdCode: 171,\r\n        macCode: 199,\r\n        winCode: 171,\r\n        pdfCode: 171,\r\n        utfCode: 171\r\n    },\r\n    guillemotright: {\r\n        name: \"guillemotright\",\r\n        char: \"»\",\r\n        stdCode: 187,\r\n        macCode: 200,\r\n        winCode: 187,\r\n        pdfCode: 187,\r\n        utfCode: 187\r\n    },\r\n    guilsinglleft: {\r\n        name: \"guilsinglleft\",\r\n        char: \"‹\",\r\n        stdCode: 172,\r\n        macCode: 220,\r\n        winCode: 139,\r\n        pdfCode: 136,\r\n        utfCode: 8249\r\n    },\r\n    guilsinglright: {\r\n        name: \"guilsinglright\",\r\n        char: \"›\",\r\n        stdCode: 173,\r\n        macCode: 221,\r\n        winCode: 155,\r\n        pdfCode: 137,\r\n        utfCode: 8250\r\n    },\r\n    h: {\r\n        name: \"h\",\r\n        char: \"h\",\r\n        stdCode: 104,\r\n        macCode: 104,\r\n        winCode: 104,\r\n        pdfCode: 104,\r\n        utfCode: 104\r\n    },\r\n    hungarumlaut: {\r\n        name: \"hungarumlaut\",\r\n        char: \"˝\",\r\n        stdCode: 205,\r\n        macCode: 253,\r\n        winCode: null,\r\n        pdfCode: 28,\r\n        utfCode: 733\r\n    },\r\n    hyphen: {\r\n        name: \"hyphen\",\r\n        char: \"-\",\r\n        stdCode: 45,\r\n        macCode: 45,\r\n        winCode: 45,\r\n        pdfCode: 45,\r\n        utfCode: 45\r\n    },\r\n    i: {\r\n        name: \"i\",\r\n        char: \"i\",\r\n        stdCode: 105,\r\n        macCode: 105,\r\n        winCode: 105,\r\n        pdfCode: 105,\r\n        utfCode: 105\r\n    },\r\n    iacute: {\r\n        name: \"iacute\",\r\n        char: \"í\",\r\n        stdCode: null,\r\n        macCode: 146,\r\n        winCode: 237,\r\n        pdfCode: 237,\r\n        utfCode: 237\r\n    },\r\n    icircumflex: {\r\n        name: \"icircumflex\",\r\n        char: \"î\",\r\n        stdCode: null,\r\n        macCode: 148,\r\n        winCode: 238,\r\n        pdfCode: 238,\r\n        utfCode: 238\r\n    },\r\n    idieresis: {\r\n        name: \"idieresis\",\r\n        char: \"ï\",\r\n        stdCode: null,\r\n        macCode: 149,\r\n        winCode: 239,\r\n        pdfCode: 239,\r\n        utfCode: 239\r\n    },\r\n    igrave: {\r\n        name: \"igrave\",\r\n        char: \"ì\",\r\n        stdCode: null,\r\n        macCode: 147,\r\n        winCode: 236,\r\n        pdfCode: 236,\r\n        utfCode: 236\r\n    },\r\n    j: {\r\n        name: \"j\",\r\n        char: \"j\",\r\n        stdCode: 106,\r\n        macCode: 106,\r\n        winCode: 106,\r\n        pdfCode: 106,\r\n        utfCode: 106\r\n    },\r\n    k: {\r\n        name: \"k\",\r\n        char: \"k\",\r\n        stdCode: 107,\r\n        macCode: 107,\r\n        winCode: 107,\r\n        pdfCode: 107,\r\n        utfCode: 107\r\n    },\r\n    l: {\r\n        name: \"l\",\r\n        char: \"l\",\r\n        stdCode: 108,\r\n        macCode: 108,\r\n        winCode: 108,\r\n        pdfCode: 108,\r\n        utfCode: 108\r\n    },\r\n    less: {\r\n        name: \"less\",\r\n        char: \"<\",\r\n        stdCode: 60,\r\n        macCode: 60,\r\n        winCode: 60,\r\n        pdfCode: 60,\r\n        utfCode: 60\r\n    },\r\n    logicalnot: {\r\n        name: \"logicalnot\",\r\n        char: \"¬\",\r\n        stdCode: null,\r\n        macCode: 194,\r\n        winCode: 172,\r\n        pdfCode: 172,\r\n        utfCode: 172\r\n    },\r\n    lslash: {\r\n        name: \"lslash\",\r\n        char: \"ł\",\r\n        stdCode: 248,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: 155,\r\n        utfCode: 322\r\n    },\r\n    m: {\r\n        name: \"m\",\r\n        char: \"m\",\r\n        stdCode: 109,\r\n        macCode: 109,\r\n        winCode: 109,\r\n        pdfCode: 109,\r\n        utfCode: 109\r\n    },\r\n    macron: {\r\n        name: \"macron\",\r\n        char: \"¯\",\r\n        stdCode: 197,\r\n        macCode: 248,\r\n        winCode: 175,\r\n        pdfCode: 175,\r\n        utfCode: 175\r\n    },\r\n    minus: {\r\n        name: \"minus\",\r\n        char: \"−\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: 138,\r\n        utfCode: 8722\r\n    },\r\n    mu: {\r\n        name: \"mu\",\r\n        char: \"μ\",\r\n        stdCode: null,\r\n        macCode: 181,\r\n        winCode: 181,\r\n        pdfCode: 181,\r\n        utfCode: 181\r\n    },\r\n    multiply: {\r\n        name: \"multiply\",\r\n        char: \"×\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 215,\r\n        pdfCode: 215,\r\n        utfCode: 215\r\n    },\r\n    n: {\r\n        name: \"n\",\r\n        char: \"n\",\r\n        stdCode: 110,\r\n        macCode: 110,\r\n        winCode: 110,\r\n        pdfCode: 110,\r\n        utfCode: 110\r\n    },\r\n    nine: {\r\n        name: \"nine\",\r\n        char: \"9\",\r\n        stdCode: 57,\r\n        macCode: 57,\r\n        winCode: 57,\r\n        pdfCode: 57,\r\n        utfCode: 57\r\n    },\r\n    ntilde: {\r\n        name: \"ntilde\",\r\n        char: \"ñ\",\r\n        stdCode: null,\r\n        macCode: 150,\r\n        winCode: 241,\r\n        pdfCode: 241,\r\n        utfCode: 241\r\n    },\r\n    numbersign: {\r\n        name: \"numbersign\",\r\n        char: \"#\",\r\n        stdCode: 35,\r\n        macCode: 35,\r\n        winCode: 35,\r\n        pdfCode: 35,\r\n        utfCode: 35\r\n    },\r\n    o: {\r\n        name: \"o\",\r\n        char: \"o\",\r\n        stdCode: 111,\r\n        macCode: 111,\r\n        winCode: 111,\r\n        pdfCode: 111,\r\n        utfCode: 111\r\n    },\r\n    oacute: {\r\n        name: \"oacute\",\r\n        char: \"ó\",\r\n        stdCode: null,\r\n        macCode: 151,\r\n        winCode: 243,\r\n        pdfCode: 243,\r\n        utfCode: 243\r\n    },\r\n    ocircumflex: {\r\n        name: \"ocircumflex\",\r\n        char: \"ô\",\r\n        stdCode: null,\r\n        macCode: 153,\r\n        winCode: 244,\r\n        pdfCode: 244,\r\n        utfCode: 244\r\n    },\r\n    odieresis: {\r\n        name: \"odieresis\",\r\n        char: \"ö\",\r\n        stdCode: null,\r\n        macCode: 154,\r\n        winCode: 246,\r\n        pdfCode: 246,\r\n        utfCode: 246\r\n    },\r\n    oe: {\r\n        name: \"oe\",\r\n        char: \"oe\",\r\n        stdCode: 250,\r\n        macCode: 207,\r\n        winCode: 156,\r\n        pdfCode: 156,\r\n        utfCode: 339\r\n    },\r\n    ogonek: {\r\n        name: \"ogonek\",\r\n        char: \"˛\",\r\n        stdCode: 206,\r\n        macCode: 254,\r\n        winCode: null,\r\n        pdfCode: 29,\r\n        utfCode: 731\r\n    },\r\n    ograve: {\r\n        name: \"ograve\",\r\n        char: \"ò\",\r\n        stdCode: null,\r\n        macCode: 152,\r\n        winCode: 242,\r\n        pdfCode: 242,\r\n        utfCode: 242\r\n    },\r\n    one: {\r\n        name: \"one\",\r\n        char: \"1\",\r\n        stdCode: 49,\r\n        macCode: 49,\r\n        winCode: 49,\r\n        pdfCode: 49,\r\n        utfCode: 49\r\n    },\r\n    onehalf: {\r\n        name: \"onehalf\",\r\n        char: \"½\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 189,\r\n        pdfCode: 189,\r\n        utfCode: 189\r\n    },\r\n    onequarter: {\r\n        name: \"onequarter\",\r\n        char: \"¼\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 188,\r\n        pdfCode: 188,\r\n        utfCode: 188\r\n    },\r\n    onesuperior: {\r\n        name: \"onesuperior\",\r\n        char: \"¹\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 185,\r\n        pdfCode: 185,\r\n        utfCode: 185\r\n    },\r\n    ordfeminine: {\r\n        name: \"ordfeminine\",\r\n        char: \"ª\",\r\n        stdCode: 227,\r\n        macCode: 187,\r\n        winCode: 170,\r\n        pdfCode: 170,\r\n        utfCode: 170\r\n    },\r\n    ordmasculine: {\r\n        name: \"ordmasculine\",\r\n        char: \"º\",\r\n        stdCode: 235,\r\n        macCode: 188,\r\n        winCode: 186,\r\n        pdfCode: 186,\r\n        utfCode: 186\r\n    },\r\n    oslash: {\r\n        name: \"oslash\",\r\n        char: \"ø\",\r\n        stdCode: 249,\r\n        macCode: 191,\r\n        winCode: 248,\r\n        pdfCode: 248,\r\n        utfCode: 248\r\n    },\r\n    otilde: {\r\n        name: \"otilde\",\r\n        char: \"õ\",\r\n        stdCode: null,\r\n        macCode: 155,\r\n        winCode: 245,\r\n        pdfCode: 245,\r\n        utfCode: 245\r\n    },\r\n    p: {\r\n        name: \"p\",\r\n        char: \"p\",\r\n        stdCode: 112,\r\n        macCode: 112,\r\n        winCode: 112,\r\n        pdfCode: 112,\r\n        utfCode: 112\r\n    },\r\n    paragraph: {\r\n        name: \"paragraph\",\r\n        char: \"¶\",\r\n        stdCode: 182,\r\n        macCode: 166,\r\n        winCode: 182,\r\n        pdfCode: 182,\r\n        utfCode: 182\r\n    },\r\n    parenleft: {\r\n        name: \"parenleft\",\r\n        char: \"(\",\r\n        stdCode: 40,\r\n        macCode: 40,\r\n        winCode: 40,\r\n        pdfCode: 40,\r\n        utfCode: 40\r\n    },\r\n    parenright: {\r\n        name: \"parenright\",\r\n        char: \")\",\r\n        stdCode: 41,\r\n        macCode: 41,\r\n        winCode: 41,\r\n        pdfCode: 41,\r\n        utfCode: 41\r\n    },\r\n    percent: {\r\n        name: \"percent\",\r\n        char: \"%\",\r\n        stdCode: 37,\r\n        macCode: 37,\r\n        winCode: 37,\r\n        pdfCode: 37,\r\n        utfCode: 37\r\n    },\r\n    period: {\r\n        name: \"period\",\r\n        char: \".\",\r\n        stdCode: 46,\r\n        macCode: 46,\r\n        winCode: 46,\r\n        pdfCode: 46,\r\n        utfCode: 46\r\n    },\r\n    periodcentered: {\r\n        name: \"periodcentered\",\r\n        char: \"·\",\r\n        stdCode: 180,\r\n        macCode: 225,\r\n        winCode: 183,\r\n        pdfCode: 183,\r\n        utfCode: 183\r\n    },\r\n    perthousand: {\r\n        name: \"perthousand\",\r\n        char: \"‰\",\r\n        stdCode: 189,\r\n        macCode: 228,\r\n        winCode: 137,\r\n        pdfCode: 139,\r\n        utfCode: 8240\r\n    },\r\n    plus: {\r\n        name: \"plus\",\r\n        char: \"+\",\r\n        stdCode: 43,\r\n        macCode: 43,\r\n        winCode: 43,\r\n        pdfCode: 43,\r\n        utfCode: 43\r\n    },\r\n    plusminus: {\r\n        name: \"plusminus\",\r\n        char: \"±\",\r\n        stdCode: null,\r\n        macCode: 177,\r\n        winCode: 177,\r\n        pdfCode: 177,\r\n        utfCode: 177\r\n    },\r\n    q: {\r\n        name: \"q\",\r\n        char: \"q\",\r\n        stdCode: 113,\r\n        macCode: 113,\r\n        winCode: 113,\r\n        pdfCode: 113,\r\n        utfCode: 113\r\n    },\r\n    question: {\r\n        name: \"question\",\r\n        char: \"?\",\r\n        stdCode: 63,\r\n        macCode: 63,\r\n        winCode: 63,\r\n        pdfCode: 63,\r\n        utfCode: 63\r\n    },\r\n    questiondown: {\r\n        name: \"questiondown\",\r\n        char: \"¿\",\r\n        stdCode: 191,\r\n        macCode: 192,\r\n        winCode: 191,\r\n        pdfCode: 191,\r\n        utfCode: 191\r\n    },\r\n    quotedbl: {\r\n        name: \"quotedbl\",\r\n        char: \"\\\"\",\r\n        stdCode: 34,\r\n        macCode: 34,\r\n        winCode: 34,\r\n        pdfCode: 34,\r\n        utfCode: 34\r\n    },\r\n    quotedblbase: {\r\n        name: \"quotedblbase\",\r\n        char: \"„\",\r\n        stdCode: 185,\r\n        macCode: 227,\r\n        winCode: 132,\r\n        pdfCode: 140,\r\n        utfCode: 8222\r\n    },\r\n    quotedblleft: {\r\n        name: \"quotedblleft\",\r\n        char: \"“\",\r\n        stdCode: 170,\r\n        macCode: 210,\r\n        winCode: 147,\r\n        pdfCode: 141,\r\n        utfCode: 8220\r\n    },\r\n    quotedblright: {\r\n        name: \"quotedblright\",\r\n        char: \"”\",\r\n        stdCode: 186,\r\n        macCode: 211,\r\n        winCode: 148,\r\n        pdfCode: 142,\r\n        utfCode: 8221\r\n    },\r\n    quoteleft: {\r\n        name: \"quoteleft\",\r\n        char: \"‘\",\r\n        stdCode: 96,\r\n        macCode: 212,\r\n        winCode: 145,\r\n        pdfCode: 143,\r\n        utfCode: 8216\r\n    },\r\n    quoteright: {\r\n        name: \"quoteright\",\r\n        char: \"’\",\r\n        stdCode: 39,\r\n        macCode: 213,\r\n        winCode: 146,\r\n        pdfCode: 144,\r\n        utfCode: 8217\r\n    },\r\n    quotesinglbase: {\r\n        name: \"quotesinglbase\",\r\n        char: \"‚\",\r\n        stdCode: 184,\r\n        macCode: 226,\r\n        winCode: 130,\r\n        pdfCode: 145,\r\n        utfCode: 8218\r\n    },\r\n    quotesingle: {\r\n        name: \"quotesingle\",\r\n        char: \"'\",\r\n        stdCode: 169,\r\n        macCode: 39,\r\n        winCode: 39,\r\n        pdfCode: 39,\r\n        utfCode: 39\r\n    },\r\n    r: {\r\n        name: \"r\",\r\n        char: \"r\",\r\n        stdCode: 114,\r\n        macCode: 114,\r\n        winCode: 114,\r\n        pdfCode: 114,\r\n        utfCode: 114\r\n    },\r\n    registered: {\r\n        name: \"registered\",\r\n        char: \"®\",\r\n        stdCode: null,\r\n        macCode: 168,\r\n        winCode: 174,\r\n        pdfCode: 174,\r\n        utfCode: 174\r\n    },\r\n    ring: {\r\n        name: \"ring\",\r\n        char: \"°\",\r\n        stdCode: 202,\r\n        macCode: 251,\r\n        winCode: null,\r\n        pdfCode: 30,\r\n        utfCode: 730\r\n    },\r\n    s: {\r\n        name: \"s\",\r\n        char: \"s\",\r\n        stdCode: 115,\r\n        macCode: 115,\r\n        winCode: 115,\r\n        pdfCode: 115,\r\n        utfCode: 115\r\n    },\r\n    scaron: {\r\n        name: \"scaron\",\r\n        char: \"š\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 154,\r\n        pdfCode: 157,\r\n        utfCode: 353\r\n    },\r\n    section: {\r\n        name: \"section\",\r\n        char: \"§\",\r\n        stdCode: 167,\r\n        macCode: 164,\r\n        winCode: 167,\r\n        pdfCode: 167,\r\n        utfCode: 167\r\n    },\r\n    semicolon: {\r\n        name: \"semicolon\",\r\n        char: \";\",\r\n        stdCode: 59,\r\n        macCode: 59,\r\n        winCode: 59,\r\n        pdfCode: 59,\r\n        utfCode: 59\r\n    },\r\n    seven: {\r\n        name: \"seven\",\r\n        char: \"7\",\r\n        stdCode: 55,\r\n        macCode: 55,\r\n        winCode: 55,\r\n        pdfCode: 55,\r\n        utfCode: 55\r\n    },\r\n    six: {\r\n        name: \"six\",\r\n        char: \"6\",\r\n        stdCode: 54,\r\n        macCode: 54,\r\n        winCode: 54,\r\n        pdfCode: 54,\r\n        utfCode: 54\r\n    },\r\n    slash: {\r\n        name: \"slash\",\r\n        char: \"/\",\r\n        stdCode: 47,\r\n        macCode: 47,\r\n        winCode: 47,\r\n        pdfCode: 47,\r\n        utfCode: 47\r\n    },\r\n    sterling: {\r\n        name: \"sterling\",\r\n        char: \"£\",\r\n        stdCode: 163,\r\n        macCode: 163,\r\n        winCode: 163,\r\n        pdfCode: 163,\r\n        utfCode: 163\r\n    },\r\n    t: {\r\n        name: \"t\",\r\n        char: \"t\",\r\n        stdCode: 116,\r\n        macCode: 116,\r\n        winCode: 116,\r\n        pdfCode: 116,\r\n        utfCode: 116\r\n    },\r\n    thorn: {\r\n        name: \"thorn\",\r\n        char: \"þ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 254,\r\n        pdfCode: 254,\r\n        utfCode: 254\r\n    },\r\n    three: {\r\n        name: \"three\",\r\n        char: \"3\",\r\n        stdCode: 51,\r\n        macCode: 51,\r\n        winCode: 51,\r\n        pdfCode: 51,\r\n        utfCode: 51\r\n    },\r\n    threequarters: {\r\n        name: \"threequarters\",\r\n        char: \"¾\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 190,\r\n        pdfCode: 190,\r\n        utfCode: 190\r\n    },\r\n    threesuperior: {\r\n        name: \"threesuperior\",\r\n        char: \"³\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 179,\r\n        pdfCode: 179,\r\n        utfCode: 179\r\n    },\r\n    tilde: {\r\n        name: \"tilde\",\r\n        char: \"˜\",\r\n        stdCode: 196,\r\n        macCode: 247,\r\n        winCode: 152,\r\n        pdfCode: 31,\r\n        utfCode: 732\r\n    },\r\n    trademark: {\r\n        name: \"trademark\",\r\n        char: \"™\",\r\n        stdCode: null,\r\n        macCode: 170,\r\n        winCode: 153,\r\n        pdfCode: 146,\r\n        utfCode: 8482\r\n    },\r\n    two: {\r\n        name: \"two\",\r\n        char: \"2\",\r\n        stdCode: 50,\r\n        macCode: 50,\r\n        winCode: 50,\r\n        pdfCode: 50,\r\n        utfCode: 50\r\n    },\r\n    twosuperior: {\r\n        name: \"twosuperior\",\r\n        char: \"²\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 178,\r\n        pdfCode: 178,\r\n        utfCode: 178\r\n    },\r\n    u: {\r\n        name: \"u\",\r\n        char: \"u\",\r\n        stdCode: 117,\r\n        macCode: 117,\r\n        winCode: 117,\r\n        pdfCode: 117,\r\n        utfCode: 117\r\n    },\r\n    uacute: {\r\n        name: \"uacute\",\r\n        char: \"ú\",\r\n        stdCode: null,\r\n        macCode: 156,\r\n        winCode: 250,\r\n        pdfCode: 250,\r\n        utfCode: 250\r\n    },\r\n    ucircumflex: {\r\n        name: \"ucircumflex\",\r\n        char: \"û\",\r\n        stdCode: null,\r\n        macCode: 158,\r\n        winCode: 251,\r\n        pdfCode: 251,\r\n        utfCode: 251\r\n    },\r\n    udieresis: {\r\n        name: \"udieresis\",\r\n        char: \"ü\",\r\n        stdCode: null,\r\n        macCode: 159,\r\n        winCode: 252,\r\n        pdfCode: 252,\r\n        utfCode: 252\r\n    },\r\n    ugrave: {\r\n        name: \"ugrave\",\r\n        char: \"ù\",\r\n        stdCode: null,\r\n        macCode: 157,\r\n        winCode: 249,\r\n        pdfCode: 249,\r\n        utfCode: 249\r\n    },\r\n    underscore: {\r\n        name: \"underscore\",\r\n        char: \"_\",\r\n        stdCode: 95,\r\n        macCode: 95,\r\n        winCode: 95,\r\n        pdfCode: 95,\r\n        utfCode: 95\r\n    },\r\n    v: {\r\n        name: \"v\",\r\n        char: \"v\",\r\n        stdCode: 118,\r\n        macCode: 118,\r\n        winCode: 118,\r\n        pdfCode: 118,\r\n        utfCode: 118\r\n    },\r\n    w: {\r\n        name: \"w\",\r\n        char: \"w\",\r\n        stdCode: 119,\r\n        macCode: 119,\r\n        winCode: 119,\r\n        pdfCode: 119,\r\n        utfCode: 119\r\n    },\r\n    x: {\r\n        name: \"x\",\r\n        char: \"x\",\r\n        stdCode: 120,\r\n        macCode: 120,\r\n        winCode: 120,\r\n        pdfCode: 120,\r\n        utfCode: 120\r\n    },\r\n    y: {\r\n        name: \"y\",\r\n        char: \"y\",\r\n        stdCode: 121,\r\n        macCode: 121,\r\n        winCode: 121,\r\n        pdfCode: 121,\r\n        utfCode: 121\r\n    },\r\n    yacute: {\r\n        name: \"yacute\",\r\n        char: \"ý\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 253,\r\n        pdfCode: 253,\r\n        utfCode: 253\r\n    },\r\n    ydieresis: {\r\n        name: \"ydieresis\",\r\n        char: \"ÿ\",\r\n        stdCode: null,\r\n        macCode: 216,\r\n        winCode: 255,\r\n        pdfCode: 255,\r\n        utfCode: 255\r\n    },\r\n    yen: {\r\n        name: \"yen\",\r\n        char: \"¥\",\r\n        stdCode: 165,\r\n        macCode: 180,\r\n        winCode: 165,\r\n        pdfCode: 165,\r\n        utfCode: 165\r\n    },\r\n    z: {\r\n        name: \"z\",\r\n        char: \"z\",\r\n        stdCode: 122,\r\n        macCode: 122,\r\n        winCode: 122,\r\n        pdfCode: 122,\r\n        utfCode: 122\r\n    },\r\n    zcaron: {\r\n        name: \"zcaron\",\r\n        char: \"ž\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: 158,\r\n        pdfCode: 158,\r\n        utfCode: 382\r\n    },\r\n    zero: {\r\n        name: \"zero\",\r\n        char: \"0\",\r\n        stdCode: 48,\r\n        macCode: 48,\r\n        winCode: 48,\r\n        pdfCode: 48,\r\n        utfCode: 48\r\n    },\r\n    Djecyrillic: {\r\n        name: \"Djecyrillic\",\r\n        char: \"Ђ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1026\r\n    },\r\n    afii10051: {\r\n        name: \"afii10051\",\r\n        char: \"Ђ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1026\r\n    },\r\n    Gjecyrillic: {\r\n        name: \"Gjecyrillic\",\r\n        char: \"Ѓ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1027\r\n    },\r\n    afii10052: {\r\n        name: \"afii10052\",\r\n        char: \"Ѓ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1027\r\n    },\r\n    Ljecyrillic: {\r\n        name: \"Ljecyrillic\",\r\n        char: \"Љ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1033\r\n    },\r\n    afii10058: {\r\n        name: \"afii10058\",\r\n        char: \"Љ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1033\r\n    },\r\n    Njecyrillic: {\r\n        name: \"Njecyrillic\",\r\n        char: \"Њ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1034\r\n    },\r\n    afii10059: {\r\n        name: \"afii10059\",\r\n        char: \"Њ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1034\r\n    },\r\n    Kjecyrillic: {\r\n        name: \"Kjecyrillic\",\r\n        char: \"Ќ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1036\r\n    },\r\n    afii10061: {\r\n        name: \"afii10061\",\r\n        char: \"Ќ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1036\r\n    },\r\n    Tshecyrillic: {\r\n        name: \"Tshecyrillic\",\r\n        char: \"Ћ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1035\r\n    },\r\n    afii10060: {\r\n        name: \"afii10060\",\r\n        char: \"Ћ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1035\r\n    },\r\n    Dzhecyrillic: {\r\n        name: \"Dzhecyrillic\",\r\n        char: \"Џ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1039\r\n    },\r\n    afii10145: {\r\n        name: \"afii10145\",\r\n        char: \"Џ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1039\r\n    },\r\n    afii10100: {\r\n        name: \"afii10100\",\r\n        char: \"ѓ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1107\r\n    },\r\n    gjecyrillic: {\r\n        name: \"gjecyrillic\",\r\n        char: \"ѓ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1107\r\n    },\r\n    afii10099: {\r\n        name: \"afii10099\",\r\n        char: \"ђ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1106\r\n    },\r\n    djecyrillic: {\r\n        name: \"djecyrillic\",\r\n        char: \"ђ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1106\r\n    },\r\n    afii10106: {\r\n        name: \"afii10106\",\r\n        char: \"љ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1113\r\n    },\r\n    ljecyrillic: {\r\n        name: \"ljecyrillic\",\r\n        char: \"љ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1113\r\n    },\r\n    afii10107: {\r\n        name: \"afii10107\",\r\n        char: \"њ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1114\r\n    },\r\n    njecyrillic: {\r\n        name: \"njecyrillic\",\r\n        char: \"њ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1114\r\n    },\r\n    afii10109: {\r\n        name: \"afii10109\",\r\n        char: \"ќ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1116\r\n    },\r\n    kjecyrillic: {\r\n        name: \"kjecyrillic\",\r\n        char: \"ќ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1116\r\n    },\r\n    afii10108: {\r\n        name: \"afii10108\",\r\n        char: \"ћ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1115\r\n    },\r\n    tshecyrillic: {\r\n        name: \"tshecyrillic\",\r\n        char: \"ћ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1115\r\n    },\r\n    afii10193: {\r\n        name: \"afii10193\",\r\n        char: \"џ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1119\r\n    },\r\n    dzhecyrillic: {\r\n        name: \"dzhecyrillic\",\r\n        char: \"џ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1119\r\n    },\r\n    Ushortcyrillic: {\r\n        name: \"Ushortcyrillic\",\r\n        char: \"Ў\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1038\r\n    },\r\n    afii10062: {\r\n        name: \"afii10062\",\r\n        char: \"Ў\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1038\r\n    },\r\n    afii10110: {\r\n        name: \"afii10110\",\r\n        char: \"ў\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1118\r\n    },\r\n    ushortcyrillic: {\r\n        name: \"ushortcyrillic\",\r\n        char: \"ў\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1118\r\n    },\r\n    Jecyrillic: {\r\n        name: \"Jecyrillic\",\r\n        char: \"Ј\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1032\r\n    },\r\n    afii10057: {\r\n        name: \"afii10057\",\r\n        char: \"Ј\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1032\r\n    },\r\n    Gheupturncyrillic: {\r\n        name: \"Gheupturncyrillic\",\r\n        char: \"Ґ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1168\r\n    },\r\n    afii10050: {\r\n        name: \"afii10050\",\r\n        char: \"Ґ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1168\r\n    },\r\n    Iocyrillic: {\r\n        name: \"Iocyrillic\",\r\n        char: \"Ё\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1025\r\n    },\r\n    afii10023: {\r\n        name: \"afii10023\",\r\n        char: \"Ё\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1025\r\n    },\r\n    Ecyrillic: {\r\n        name: \"Ecyrillic\",\r\n        char: \"Є\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1028\r\n    },\r\n    afii10053: {\r\n        name: \"afii10053\",\r\n        char: \"Є\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1028\r\n    },\r\n    Yicyrillic: {\r\n        name: \"Yicyrillic\",\r\n        char: \"Ї\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1031\r\n    },\r\n    afii10056: {\r\n        name: \"afii10056\",\r\n        char: \"Ї\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1031\r\n    },\r\n    Icyrillic: {\r\n        name: \"Icyrillic\",\r\n        char: \"І\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1030\r\n    },\r\n    afii10055: {\r\n        name: \"afii10055\",\r\n        char: \"І\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1030\r\n    },\r\n    afii10103: {\r\n        name: \"afii10103\",\r\n        char: \"і\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1110\r\n    },\r\n    icyrillic: {\r\n        name: \"icyrillic\",\r\n        char: \"і\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1110\r\n    },\r\n    afii10098: {\r\n        name: \"afii10098\",\r\n        char: \"ґ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1169\r\n    },\r\n    gheupturncyrillic: {\r\n        name: \"gheupturncyrillic\",\r\n        char: \"ґ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1169\r\n    },\r\n    afii10071: {\r\n        name: \"afii10071\",\r\n        char: \"ё\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1105\r\n    },\r\n    iocyrillic: {\r\n        name: \"iocyrillic\",\r\n        char: \"ё\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1105\r\n    },\r\n    afii10101: {\r\n        name: \"afii10101\",\r\n        char: \"є\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1108\r\n    },\r\n    ecyrillic: {\r\n        name: \"ecyrillic\",\r\n        char: \"є\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1108\r\n    },\r\n    afii10105: {\r\n        name: \"afii10105\",\r\n        char: \"ј\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1112\r\n    },\r\n    jecyrillic: {\r\n        name: \"jecyrillic\",\r\n        char: \"ј\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1112\r\n    },\r\n    Dzecyrillic: {\r\n        name: \"Dzecyrillic\",\r\n        char: \"Ѕ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1029\r\n    },\r\n    afii10054: {\r\n        name: \"afii10054\",\r\n        char: \"Ѕ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1029\r\n    },\r\n    afii10102: {\r\n        name: \"afii10102\",\r\n        char: \"ѕ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1109\r\n    },\r\n    dzecyrillic: {\r\n        name: \"dzecyrillic\",\r\n        char: \"ѕ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1109\r\n    },\r\n    afii10104: {\r\n        name: \"afii10104\",\r\n        char: \"ї\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1111\r\n    },\r\n    yicyrillic: {\r\n        name: \"yicyrillic\",\r\n        char: \"ї\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1111\r\n    },\r\n    Acyrillic: {\r\n        name: \"Acyrillic\",\r\n        char: \"А\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1040\r\n    },\r\n    afii10017: {\r\n        name: \"afii10017\",\r\n        char: \"А\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1040\r\n    },\r\n    Becyrillic: {\r\n        name: \"Becyrillic\",\r\n        char: \"Б\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1041\r\n    },\r\n    afii10018: {\r\n        name: \"afii10018\",\r\n        char: \"Б\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1041\r\n    },\r\n    Vecyrillic: {\r\n        name: \"Vecyrillic\",\r\n        char: \"В\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1042\r\n    },\r\n    afii10019: {\r\n        name: \"afii10019\",\r\n        char: \"В\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1042\r\n    },\r\n    Gecyrillic: {\r\n        name: \"Gecyrillic\",\r\n        char: \"Г\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1043\r\n    },\r\n    afii10020: {\r\n        name: \"afii10020\",\r\n        char: \"Г\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1043\r\n    },\r\n    Decyrillic: {\r\n        name: \"Decyrillic\",\r\n        char: \"Д\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1044\r\n    },\r\n    afii10021: {\r\n        name: \"afii10021\",\r\n        char: \"Д\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1044\r\n    },\r\n    Iecyrillic: {\r\n        name: \"Iecyrillic\",\r\n        char: \"Е\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1045\r\n    },\r\n    afii10022: {\r\n        name: \"afii10022\",\r\n        char: \"Е\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1045\r\n    },\r\n    Zhecyrillic: {\r\n        name: \"Zhecyrillic\",\r\n        char: \"Ж\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1046\r\n    },\r\n    afii10024: {\r\n        name: \"afii10024\",\r\n        char: \"Ж\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1046\r\n    },\r\n    Zecyrillic: {\r\n        name: \"Zecyrillic\",\r\n        char: \"З\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1047\r\n    },\r\n    afii10025: {\r\n        name: \"afii10025\",\r\n        char: \"З\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1047\r\n    },\r\n    Iicyrillic: {\r\n        name: \"Iicyrillic\",\r\n        char: \"И\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1048\r\n    },\r\n    afii10026: {\r\n        name: \"afii10026\",\r\n        char: \"И\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1048\r\n    },\r\n    Iishortcyrillic: {\r\n        name: \"Iishortcyrillic\",\r\n        char: \"Й\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1049\r\n    },\r\n    afii10027: {\r\n        name: \"afii10027\",\r\n        char: \"Й\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1049\r\n    },\r\n    Kacyrillic: {\r\n        name: \"Kacyrillic\",\r\n        char: \"К\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1050\r\n    },\r\n    afii10028: {\r\n        name: \"afii10028\",\r\n        char: \"К\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1050\r\n    },\r\n    Elcyrillic: {\r\n        name: \"Elcyrillic\",\r\n        char: \"Л\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1051\r\n    },\r\n    afii10029: {\r\n        name: \"afii10029\",\r\n        char: \"Л\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1051\r\n    },\r\n    Emcyrillic: {\r\n        name: \"Emcyrillic\",\r\n        char: \"М\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1052\r\n    },\r\n    afii10030: {\r\n        name: \"afii10030\",\r\n        char: \"М\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1052\r\n    },\r\n    Encyrillic: {\r\n        name: \"Encyrillic\",\r\n        char: \"Н\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1053\r\n    },\r\n    afii10031: {\r\n        name: \"afii10031\",\r\n        char: \"Н\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1053\r\n    },\r\n    Ocyrillic: {\r\n        name: \"Ocyrillic\",\r\n        char: \"О\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1054\r\n    },\r\n    afii10032: {\r\n        name: \"afii10032\",\r\n        char: \"О\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1054\r\n    },\r\n    Pecyrillic: {\r\n        name: \"Pecyrillic\",\r\n        char: \"П\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1055\r\n    },\r\n    afii10033: {\r\n        name: \"afii10033\",\r\n        char: \"П\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1055\r\n    },\r\n    Ercyrillic: {\r\n        name: \"Ercyrillic\",\r\n        char: \"Р\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1056\r\n    },\r\n    afii10034: {\r\n        name: \"afii10034\",\r\n        char: \"Р\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1056\r\n    },\r\n    Escyrillic: {\r\n        name: \"Escyrillic\",\r\n        char: \"С\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1057\r\n    },\r\n    afii10035: {\r\n        name: \"afii10035\",\r\n        char: \"С\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1057\r\n    },\r\n    Tecyrillic: {\r\n        name: \"Tecyrillic\",\r\n        char: \"Т\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1058\r\n    },\r\n    afii10036: {\r\n        name: \"afii10036\",\r\n        char: \"Т\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1058\r\n    },\r\n    Ucyrillic: {\r\n        name: \"Ucyrillic\",\r\n        char: \"У\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1059\r\n    },\r\n    afii10037: {\r\n        name: \"afii10037\",\r\n        char: \"У\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1059\r\n    },\r\n    Efcyrillic: {\r\n        name: \"Efcyrillic\",\r\n        char: \"Ф\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1060\r\n    },\r\n    afii10038: {\r\n        name: \"afii10038\",\r\n        char: \"Ф\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1060\r\n    },\r\n    Khacyrillic: {\r\n        name: \"Khacyrillic\",\r\n        char: \"Х\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1061\r\n    },\r\n    afii10039: {\r\n        name: \"afii10039\",\r\n        char: \"Х\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1061\r\n    },\r\n    Tsecyrillic: {\r\n        name: \"Tsecyrillic\",\r\n        char: \"Ц\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1062\r\n    },\r\n    afii10040: {\r\n        name: \"afii10040\",\r\n        char: \"Ц\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1062\r\n    },\r\n    Checyrillic: {\r\n        name: \"Checyrillic\",\r\n        char: \"Ч\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1063\r\n    },\r\n    afii10041: {\r\n        name: \"afii10041\",\r\n        char: \"Ч\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1063\r\n    },\r\n    Shacyrillic: {\r\n        name: \"Shacyrillic\",\r\n        char: \"Ш\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1064\r\n    },\r\n    afii10042: {\r\n        name: \"afii10042\",\r\n        char: \"Ш\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1064\r\n    },\r\n    Shchacyrillic: {\r\n        name: \"Shchacyrillic\",\r\n        char: \"Щ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1065\r\n    },\r\n    afii10043: {\r\n        name: \"afii10043\",\r\n        char: \"Щ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1065\r\n    },\r\n    Hardsigncyrillic: {\r\n        name: \"Hardsigncyrillic\",\r\n        char: \"Ъ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1066\r\n    },\r\n    afii10044: {\r\n        name: \"afii10044\",\r\n        char: \"Ъ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1066\r\n    },\r\n    Yericyrillic: {\r\n        name: \"Yericyrillic\",\r\n        char: \"Ы\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1067\r\n    },\r\n    afii10045: {\r\n        name: \"afii10045\",\r\n        char: \"Ы\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1067\r\n    },\r\n    Softsigncyrillic: {\r\n        name: \"Softsigncyrillic\",\r\n        char: \"Ь\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1068\r\n    },\r\n    afii10046: {\r\n        name: \"afii10046\",\r\n        char: \"Ь\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1068\r\n    },\r\n    Ereversedcyrillic: {\r\n        name: \"Ereversedcyrillic\",\r\n        char: \"Э\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1069\r\n    },\r\n    afii10047: {\r\n        name: \"afii10047\",\r\n        char: \"Э\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1069\r\n    },\r\n    IUcyrillic: {\r\n        name: \"IUcyrillic\",\r\n        char: \"Ю\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1070\r\n    },\r\n    afii10048: {\r\n        name: \"afii10048\",\r\n        char: \"Ю\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1070\r\n    },\r\n    IAcyrillic: {\r\n        name: \"IAcyrillic\",\r\n        char: \"Я\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1071\r\n    },\r\n    afii10049: {\r\n        name: \"afii10049\",\r\n        char: \"Я\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1071\r\n    },\r\n    afii10065: {\r\n        name: \"afii10065\",\r\n        char: \"а\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1072\r\n    },\r\n    acyrillic: {\r\n        name: \"acyrillic\",\r\n        char: \"а\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1072\r\n    },\r\n    afii10066: {\r\n        name: \"afii10066\",\r\n        char: \"б\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1073\r\n    },\r\n    becyrillic: {\r\n        name: \"becyrillic\",\r\n        char: \"б\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1073\r\n    },\r\n    afii10067: {\r\n        name: \"afii10067\",\r\n        char: \"в\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1074\r\n    },\r\n    vecyrillic: {\r\n        name: \"vecyrillic\",\r\n        char: \"в\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1074\r\n    },\r\n    afii10068: {\r\n        name: \"afii10068\",\r\n        char: \"г\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1075\r\n    },\r\n    gecyrillic: {\r\n        name: \"gecyrillic\",\r\n        char: \"г\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1075\r\n    },\r\n    afii10069: {\r\n        name: \"afii10069\",\r\n        char: \"д\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1076\r\n    },\r\n    decyrillic: {\r\n        name: \"decyrillic\",\r\n        char: \"д\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1076\r\n    },\r\n    afii10070: {\r\n        name: \"afii10070\",\r\n        char: \"е\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1077\r\n    },\r\n    iecyrillic: {\r\n        name: \"iecyrillic\",\r\n        char: \"е\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1077\r\n    },\r\n    afii10072: {\r\n        name: \"afii10072\",\r\n        char: \"ж\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1078\r\n    },\r\n    zhecyrillic: {\r\n        name: \"zhecyrillic\",\r\n        char: \"ж\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1078\r\n    },\r\n    afii10073: {\r\n        name: \"afii10073\",\r\n        char: \"з\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1079\r\n    },\r\n    zecyrillic: {\r\n        name: \"zecyrillic\",\r\n        char: \"з\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1079\r\n    },\r\n    afii10074: {\r\n        name: \"afii10074\",\r\n        char: \"и\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1080\r\n    },\r\n    iicyrillic: {\r\n        name: \"iicyrillic\",\r\n        char: \"и\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1080\r\n    },\r\n    afii10075: {\r\n        name: \"afii10075\",\r\n        char: \"й\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1081\r\n    },\r\n    iishortcyrillic: {\r\n        name: \"iishortcyrillic\",\r\n        char: \"й\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1081\r\n    },\r\n    afii10076: {\r\n        name: \"afii10076\",\r\n        char: \"к\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1082\r\n    },\r\n    kacyrillic: {\r\n        name: \"kacyrillic\",\r\n        char: \"к\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1082\r\n    },\r\n    afii10077: {\r\n        name: \"afii10077\",\r\n        char: \"л\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1083\r\n    },\r\n    elcyrillic: {\r\n        name: \"elcyrillic\",\r\n        char: \"л\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1083\r\n    },\r\n    afii10078: {\r\n        name: \"afii10078\",\r\n        char: \"м\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1084\r\n    },\r\n    emcyrillic: {\r\n        name: \"emcyrillic\",\r\n        char: \"м\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1084\r\n    },\r\n    afii10079: {\r\n        name: \"afii10079\",\r\n        char: \"н\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1085\r\n    },\r\n    encyrillic: {\r\n        name: \"encyrillic\",\r\n        char: \"н\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1085\r\n    },\r\n    afii10080: {\r\n        name: \"afii10080\",\r\n        char: \"о\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1086\r\n    },\r\n    ocyrillic: {\r\n        name: \"ocyrillic\",\r\n        char: \"о\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1086\r\n    },\r\n    afii10081: {\r\n        name: \"afii10081\",\r\n        char: \"п\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1087\r\n    },\r\n    pecyrillic: {\r\n        name: \"pecyrillic\",\r\n        char: \"п\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1087\r\n    },\r\n    afii10082: {\r\n        name: \"afii10082\",\r\n        char: \"р\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1088\r\n    },\r\n    ercyrillic: {\r\n        name: \"ercyrillic\",\r\n        char: \"р\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1088\r\n    },\r\n    afii10083: {\r\n        name: \"afii10083\",\r\n        char: \"с\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1089\r\n    },\r\n    escyrillic: {\r\n        name: \"escyrillic\",\r\n        char: \"с\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1089\r\n    },\r\n    afii10084: {\r\n        name: \"afii10084\",\r\n        char: \"т\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1090\r\n    },\r\n    tecyrillic: {\r\n        name: \"tecyrillic\",\r\n        char: \"т\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1090\r\n    },\r\n    afii10085: {\r\n        name: \"afii10085\",\r\n        char: \"у\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1091\r\n    },\r\n    ucyrillic: {\r\n        name: \"ucyrillic\",\r\n        char: \"у\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1091\r\n    },\r\n    afii10086: {\r\n        name: \"afii10086\",\r\n        char: \"ф\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1092\r\n    },\r\n    efcyrillic: {\r\n        name: \"efcyrillic\",\r\n        char: \"ф\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1092\r\n    },\r\n    afii10087: {\r\n        name: \"afii10087\",\r\n        char: \"х\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1093\r\n    },\r\n    khacyrillic: {\r\n        name: \"khacyrillic\",\r\n        char: \"х\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1093\r\n    },\r\n    afii10088: {\r\n        name: \"afii10088\",\r\n        char: \"ц\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1094\r\n    },\r\n    tsecyrillic: {\r\n        name: \"tsecyrillic\",\r\n        char: \"ц\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1094\r\n    },\r\n    afii10089: {\r\n        name: \"afii10089\",\r\n        char: \"ч\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1095\r\n    },\r\n    checyrillic: {\r\n        name: \"checyrillic\",\r\n        char: \"ч\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1095\r\n    },\r\n    afii10090: {\r\n        name: \"afii10090\",\r\n        char: \"ш\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1096\r\n    },\r\n    shacyrillic: {\r\n        name: \"shacyrillic\",\r\n        char: \"ш\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1096\r\n    },\r\n    afii10091: {\r\n        name: \"afii10091\",\r\n        char: \"щ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1097\r\n    },\r\n    shchacyrillic: {\r\n        name: \"shchacyrillic\",\r\n        char: \"щ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1097\r\n    },\r\n    afii10092: {\r\n        name: \"afii10092\",\r\n        char: \"ъ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1098\r\n    },\r\n    hardsigncyrillic: {\r\n        name: \"hardsigncyrillic\",\r\n        char: \"ъ\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1098\r\n    },\r\n    afii10093: {\r\n        name: \"afii10093\",\r\n        char: \"ы\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1099\r\n    },\r\n    yericyrillic: {\r\n        name: \"yericyrillic\",\r\n        char: \"ы\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1099\r\n    },\r\n    afii10094: {\r\n        name: \"afii10094\",\r\n        char: \"ь\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1100\r\n    },\r\n    softsigncyrillic: {\r\n        name: \"softsigncyrillic\",\r\n        char: \"ь\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1100\r\n    },\r\n    afii10095: {\r\n        name: \"afii10095\",\r\n        char: \"э\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1101\r\n    },\r\n    ereversedcyrillic: {\r\n        name: \"ereversedcyrillic\",\r\n        char: \"э\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1101\r\n    },\r\n    afii10096: {\r\n        name: \"afii10096\",\r\n        char: \"ю\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1102\r\n    },\r\n    iucyrillic: {\r\n        name: \"iucyrillic\",\r\n        char: \"ю\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1102\r\n    },\r\n    afii10097: {\r\n        name: \"afii10097\",\r\n        char: \"я\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1103\r\n    },\r\n    iacyrillic: {\r\n        name: \"iacyrillic\",\r\n        char: \"я\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 1103\r\n    },\r\n    afii61352: {\r\n        name: \"afii61352\",\r\n        char: \"№\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 8470\r\n    },\r\n    numero: {\r\n        name: \"numero\",\r\n        char: \"№\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 8470\r\n    },\r\n    nbspace: {\r\n        name: \"nbspace\",\r\n        char: \"\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 160\r\n    },\r\n    currency: {\r\n        name: \"currency\",\r\n        char: \"¤\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 164\r\n    },\r\n    sfthyphen: {\r\n        name: \"sfthyphen\",\r\n        char: \"\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 173\r\n    },\r\n    middot: {\r\n        name: \"middot\",\r\n        char: \"·\",\r\n        stdCode: null,\r\n        macCode: null,\r\n        winCode: null,\r\n        pdfCode: null,\r\n        utfCode: 183\r\n    },\r\n    \".notdef\": {\r\n        name: \".notdef\",\r\n        char: \" \",\r\n        stdCode: 32,\r\n        macCode: 32,\r\n        winCode: 32,\r\n        pdfCode: 32,\r\n        utfCode: 32\r\n    },\r\n    space: {\r\n        name: \"space\",\r\n        char: \" \",\r\n        stdCode: 32,\r\n        macCode: 32,\r\n        winCode: 32,\r\n        pdfCode: 32,\r\n        utfCode: 32\r\n    },\r\n};\r\nfunction getCharCodesMapByCode(encoding) {\r\n    const map = new Map();\r\n    let prop;\r\n    switch (encoding) {\r\n        case \"StandardEncoding\":\r\n            prop = \"stdCode\";\r\n            break;\r\n        case \"WinAnsiEncoding\":\r\n            prop = \"winCode\";\r\n            break;\r\n        case \"MacRomanEncoding\":\r\n            prop = \"macCode\";\r\n            break;\r\n        case \"PDFDocEncoding\":\r\n            prop = \"pdfCode\";\r\n            break;\r\n        case \"Utf-16\":\r\n            prop = \"utfCode\";\r\n            break;\r\n        default:\r\n            console.log(`Unsupported encoding: '${encoding}'`);\r\n            return map;\r\n    }\r\n    for (const [, info] of Object.entries(pdfCharCodesByName)) {\r\n        if (info[prop]) {\r\n            map.set(info[prop], info);\r\n        }\r\n    }\r\n    return map;\r\n}\n\nvar __awaiter$14 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass EncodingDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.ENCODING);\r\n    }\r\n    get charMap() {\r\n        if (!this._charMap) {\r\n            this.refreshCharMaps();\r\n        }\r\n        return this._charMap;\r\n    }\r\n    get codeMap() {\r\n        if (!this._codeMap) {\r\n            this.refreshCharMaps();\r\n        }\r\n        return this._codeMap;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$14(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new EncodingDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.BaseEncoding) {\r\n            bytes.push(...encoder.encode(\"/BaseEncoding \"), ...encoder.encode(\" \" + this.BaseEncoding));\r\n        }\r\n        if (this.Differences) {\r\n            bytes.push(...encoder.encode(\"/Differences \"), ...this.encodePrimitiveArray(this.Differences, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$14(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/BaseEncoding\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Differences\":\r\n                            const differencesValueType = yield parser.getValueTypeAtAsync(i, true);\r\n                            if (differencesValueType === valueTypes.ARRAY) {\r\n                                this.Differences = [];\r\n                                const arrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                                let j = arrayBounds.start + 1;\r\n                                while (j < arrayBounds.end - 1 && j !== -1) {\r\n                                    const nextArrayValueType = yield parser.getValueTypeAtAsync(j, true);\r\n                                    switch (nextArrayValueType) {\r\n                                        case valueTypes.NAME:\r\n                                            const arrayNameResult = yield parser.parseNameAtAsync(j, true);\r\n                                            this.Differences.push(arrayNameResult.value);\r\n                                            j = arrayNameResult.end + 1;\r\n                                            break;\r\n                                        case valueTypes.NUMBER:\r\n                                            const arrayNumberResult = yield parser.parseNumberAtAsync(j, true);\r\n                                            this.Differences.push(arrayNumberResult.value);\r\n                                            j = arrayNumberResult.end + 1;\r\n                                            break;\r\n                                        default:\r\n                                            throw new Error(`Invalid differences array value type: ${nextArrayValueType}`);\r\n                                    }\r\n                                }\r\n                                i = arrayBounds.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(`Invalid differences value type: ${differencesValueType}`);\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n    refreshCharMaps() {\r\n        if (this.Differences) {\r\n            if (typeof this.Differences[0] !== \"number\") {\r\n                throw new Error(\"First element of encoding difference array must be a number\");\r\n            }\r\n            let code;\r\n            const charInfoMap = getCharCodesMapByCode(this.BaseEncoding.substring(1));\r\n            for (const diff of this.Differences) {\r\n                if (typeof diff === \"number\") {\r\n                    code = diff;\r\n                    continue;\r\n                }\r\n                const charInfo = pdfCharCodesByName[diff.substring(1)];\r\n                if (charInfo) {\r\n                    charInfoMap.set(code++, charInfo);\r\n                }\r\n            }\r\n            this._charMap = new Map();\r\n            this._codeMap = new Map();\r\n            charInfoMap.forEach((v, k) => {\r\n                this.charMap.set(k, v.char);\r\n                this._codeMap.set(v.char, k);\r\n            });\r\n        }\r\n    }\r\n}\n\nvar __awaiter$13 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass FontDescriptorDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.FONT_DESCRIPTOR);\r\n        this.StemH = 0;\r\n        this.Leading = 0;\r\n        this.AvgWidth = 0;\r\n        this.MaxWidth = 0;\r\n        this.MissingWidth = 0;\r\n        this.XHeight = 0;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$13(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new FontDescriptorDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.FontName) {\r\n            bytes.push(...encoder.encode(\"/FontName \"), ...encoder.encode(\" \" + this.FontName));\r\n        }\r\n        if (this.FontFamily) {\r\n            bytes.push(...encoder.encode(\"/FontFamily \"), ...this.FontFamily.toArray(cryptInfo));\r\n        }\r\n        if (this.FontStretch) {\r\n            bytes.push(...encoder.encode(\"/FontStretch \"), ...encoder.encode(\" \" + this.FontStretch));\r\n        }\r\n        if (this.FontWeight) {\r\n            bytes.push(...encoder.encode(\"/FontWeight \"), ...encoder.encode(\" \" + this.FontWeight));\r\n        }\r\n        if (this.Flags) {\r\n            bytes.push(...encoder.encode(\"/Flags \"), ...encoder.encode(\" \" + this.Flags));\r\n        }\r\n        if (this.FontBBox) {\r\n            bytes.push(...encoder.encode(\"/FontBBox \"), ...this.encodePrimitiveArray(this.FontBBox, encoder));\r\n        }\r\n        if (this.ItalicAngle || this.ItalicAngle === 0) {\r\n            bytes.push(...encoder.encode(\"/ItalicAngle \"), ...encoder.encode(\" \" + (this.ItalicAngle)));\r\n        }\r\n        if (this.Ascent) {\r\n            bytes.push(...encoder.encode(\"/Ascent \"), ...encoder.encode(\" \" + this.Ascent));\r\n        }\r\n        if (this.Descent) {\r\n            bytes.push(...encoder.encode(\"/Descent \"), ...encoder.encode(\" \" + this.Descent));\r\n        }\r\n        if (this.CapHeight) {\r\n            bytes.push(...encoder.encode(\"/CapHeight \"), ...encoder.encode(\" \" + this.CapHeight));\r\n        }\r\n        if (this.StemV) {\r\n            bytes.push(...encoder.encode(\"/StemV \"), ...encoder.encode(\" \" + this.StemV));\r\n        }\r\n        if (this.StemH) {\r\n            bytes.push(...encoder.encode(\"/StemV \"), ...encoder.encode(\" \" + this.StemH));\r\n        }\r\n        if (this.Leading) {\r\n            bytes.push(...encoder.encode(\"/Leading \"), ...encoder.encode(\" \" + this.Leading));\r\n        }\r\n        if (this.AvgWidth) {\r\n            bytes.push(...encoder.encode(\"/AvgWidth \"), ...encoder.encode(\" \" + this.AvgWidth));\r\n        }\r\n        if (this.MaxWidth) {\r\n            bytes.push(...encoder.encode(\"/MaxWidth \"), ...encoder.encode(\" \" + this.MaxWidth));\r\n        }\r\n        if (this.MissingWidth) {\r\n            bytes.push(...encoder.encode(\"/MissingWidth \"), ...encoder.encode(\" \" + this.MissingWidth));\r\n        }\r\n        if (this.XHeight) {\r\n            bytes.push(...encoder.encode(\"/XHeight \"), ...encoder.encode(\" \" + this.XHeight));\r\n        }\r\n        if (this.CharSet) {\r\n            bytes.push(...encoder.encode(\"/CharSet \"), ...this.CharSet.toArray(cryptInfo));\r\n        }\r\n        if (this.FontFile) {\r\n            bytes.push(...encoder.encode(\"/FontFile \"), ...this.FontFile.toArray(cryptInfo));\r\n        }\r\n        if (this.FontFile2) {\r\n            bytes.push(...encoder.encode(\"/FontFile2 \"), ...this.FontFile2.toArray(cryptInfo));\r\n        }\r\n        if (this.FontFile3) {\r\n            bytes.push(...encoder.encode(\"/FontFile3 \"), ...this.FontFile3.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$13(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/FontName\":\r\n                        case \"/FontStretch\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/FontFile\":\r\n                        case \"/FontFile2\":\r\n                        case \"/FontFile3\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Flags\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/FontWeight\":\r\n                        case \"/ItalicAngle\":\r\n                        case \"/Ascent\":\r\n                        case \"/Descent\":\r\n                        case \"/Leading\":\r\n                        case \"/CapHeight\":\r\n                        case \"/XHeight\":\r\n                        case \"/StemV\":\r\n                        case \"/StemH\":\r\n                        case \"/AvgWidth\":\r\n                        case \"/MaxWidth\":\r\n                        case \"/MissingWidth\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/FontBBox\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/CharSet\":\r\n                        case \"/FontFamily\":\r\n                            const propType = yield parser.getValueTypeAtAsync(i);\r\n                            if (propType === valueTypes.STRING_HEX) {\r\n                                i = yield this.parseHexPropAsync(name, parser, i);\r\n                            }\r\n                            else if (propType === valueTypes.STRING_LITERAL) {\r\n                                i = yield this.parseLiteralPropAsync(name, parser, i);\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported '${name}' property value type: '${propType}'`);\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.FontName\r\n                || (!this.Flags && this.Flags !== 0)\r\n                || (!this.ItalicAngle && this.ItalicAngle !== 0)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$12 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst cyrillicEncodingDifferences = [\r\n    128,\r\n    \"/Djecyrillic\",\r\n    \"/Gjecyrillic\",\r\n    \"/quotesinglbase\",\r\n    \"/afii10100\",\r\n    \"/quotedblbase\",\r\n    \"/ellipsis\",\r\n    \"/dagger\",\r\n    \"/daggerdbl\",\r\n    \"/Euro\",\r\n    \"/perthousand\",\r\n    \"/Ljecyrillic\",\r\n    \"/guilsinglleft\",\r\n    \"/Njecyrillic\",\r\n    \"/Kjecyrillic\",\r\n    \"/Tshecyrillic\",\r\n    \"/Dzhecyrillic\",\r\n    \"/afii10099\",\r\n    \"/quoteleft\",\r\n    \"/quoteright\",\r\n    \"/quotedblleft\",\r\n    \"/quotedblright\",\r\n    \"/bullet\",\r\n    \"/endash\",\r\n    \"/emdash\",\r\n    \"/.notdef\",\r\n    \"/trademark\",\r\n    \"/afii10106\",\r\n    \"/guilsinglright\",\r\n    \"/afii10107\",\r\n    \"/afii10109\",\r\n    \"/afii10108\",\r\n    \"/afii10193\",\r\n    \"/nbspace\",\r\n    \"/Ushortcyrillic\",\r\n    \"/afii10110\",\r\n    \"/Jecyrillic\",\r\n    \"/currency\",\r\n    \"/Gheupturncyrillic\",\r\n    \"/brokenbar\",\r\n    \"/section\",\r\n    \"/Iocyrillic\",\r\n    \"/copyright\",\r\n    \"/Ecyrillic\",\r\n    \"/guillemotleft\",\r\n    \"/logicalnot\",\r\n    \"/sfthyphen\",\r\n    \"/registered\",\r\n    \"/Yicyrillic\",\r\n    \"/degree\",\r\n    \"/plusminus\",\r\n    \"/Icyrillic\",\r\n    \"/afii10103\",\r\n    \"/afii10098\",\r\n    \"/mu\",\r\n    \"/paragraph\",\r\n    \"/middot\",\r\n    \"/afii10071\",\r\n    \"/afii61352\",\r\n    \"/afii10101\",\r\n    \"/guillemotright\",\r\n    \"/afii10105\",\r\n    \"/Dzecyrillic\",\r\n    \"/afii10102\",\r\n    \"/afii10104\",\r\n    \"/Acyrillic\",\r\n    \"/Becyrillic\",\r\n    \"/Vecyrillic\",\r\n    \"/Gecyrillic\",\r\n    \"/Decyrillic\",\r\n    \"/Iecyrillic\",\r\n    \"/Zhecyrillic\",\r\n    \"/Zecyrillic\",\r\n    \"/Iicyrillic\",\r\n    \"/Iishortcyrillic\",\r\n    \"/Kacyrillic\",\r\n    \"/Elcyrillic\",\r\n    \"/Emcyrillic\",\r\n    \"/Encyrillic\",\r\n    \"/Ocyrillic\",\r\n    \"/Pecyrillic\",\r\n    \"/Ercyrillic\",\r\n    \"/Escyrillic\",\r\n    \"/Tecyrillic\",\r\n    \"/Ucyrillic\",\r\n    \"/Efcyrillic\",\r\n    \"/Khacyrillic\",\r\n    \"/Tsecyrillic\",\r\n    \"/Checyrillic\",\r\n    \"/Shacyrillic\",\r\n    \"/Shchacyrillic\",\r\n    \"/Hardsigncyrillic\",\r\n    \"/Yericyrillic\",\r\n    \"/Softsigncyrillic\",\r\n    \"/Ereversedcyrillic\",\r\n    \"/IUcyrillic\",\r\n    \"/IAcyrillic\",\r\n    \"/acyrillic\",\r\n    \"/afii10066\",\r\n    \"/afii10067\",\r\n    \"/afii10068\",\r\n    \"/afii10069\",\r\n    \"/afii10070\",\r\n    \"/afii10072\",\r\n    \"/afii10073\",\r\n    \"/afii10074\",\r\n    \"/afii10075\",\r\n    \"/afii10076\",\r\n    \"/afii10077\",\r\n    \"/afii10078\",\r\n    \"/afii10079\",\r\n    \"/afii10080\",\r\n    \"/afii10081\",\r\n    \"/afii10082\",\r\n    \"/afii10083\",\r\n    \"/afii10084\",\r\n    \"/afii10085\",\r\n    \"/afii10086\",\r\n    \"/afii10087\",\r\n    \"/afii10088\",\r\n    \"/afii10089\",\r\n    \"/afii10090\",\r\n    \"/afii10091\",\r\n    \"/afii10092\",\r\n    \"/afii10093\",\r\n    \"/afii10094\",\r\n    \"/afii10095\",\r\n    \"/afii10096\",\r\n    \"/afii10097\"\r\n];\r\nclass FontDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.FONT);\r\n    }\r\n    get name() {\r\n        return this._name;\r\n    }\r\n    get encoding() {\r\n        return this._encoding;\r\n    }\r\n    set encoding(value) {\r\n        this._encoding = value;\r\n        this.Encoding = value.ref\r\n            ? new ObjectId(value.ref.id, value.ref.generation)\r\n            : null;\r\n    }\r\n    get encodingValue() {\r\n        var _a;\r\n        if (!this.Encoding && ((_a = this._encoding) === null || _a === void 0 ? void 0 : _a.ref)) {\r\n            this.Encoding = new ObjectId(this._encoding.ref.id, this._encoding.ref.generation);\r\n        }\r\n        return this.Encoding;\r\n    }\r\n    get descriptor() {\r\n        return this._descriptor;\r\n    }\r\n    set descriptor(value) {\r\n        this._descriptor = value;\r\n        this.FontDescriptor = value.ref\r\n            ? new ObjectId(value.ref.id, value.ref.generation)\r\n            : null;\r\n    }\r\n    get descriptorValue() {\r\n        var _a;\r\n        if (!this.FontDescriptor && ((_a = this._descriptor) === null || _a === void 0 ? void 0 : _a.ref)) {\r\n            this.FontDescriptor = new ObjectId(this._descriptor.ref.id, this._descriptor.ref.generation);\r\n        }\r\n        return this.FontDescriptor;\r\n    }\r\n    get toUtfCmap() {\r\n        return this._toUtfCmap;\r\n    }\r\n    get isMonospace() {\r\n        var _a;\r\n        if (!this._descriptor) {\r\n            return false;\r\n        }\r\n        const flags = (_a = this._descriptor) === null || _a === void 0 ? void 0 : _a.Flags;\r\n        return !!ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.getBit(flags, 0);\r\n    }\r\n    get isSerif() {\r\n        var _a;\r\n        if (!this._descriptor) {\r\n            return false;\r\n        }\r\n        const flags = (_a = this._descriptor) === null || _a === void 0 ? void 0 : _a.Flags;\r\n        return !!ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.getBit(flags, 1);\r\n    }\r\n    get isScript() {\r\n        var _a;\r\n        if (!this._descriptor) {\r\n            return false;\r\n        }\r\n        const flags = (_a = this._descriptor) === null || _a === void 0 ? void 0 : _a.Flags;\r\n        return !!ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.getBit(flags, 3);\r\n    }\r\n    get isItalic() {\r\n        var _a;\r\n        if (!this._descriptor) {\r\n            return false;\r\n        }\r\n        const flags = (_a = this._descriptor) === null || _a === void 0 ? void 0 : _a.Flags;\r\n        return !!ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.getBit(flags, 6);\r\n    }\r\n    static newFontMap() {\r\n        const map = new Map();\r\n        const encoding = new EncodingDict();\r\n        encoding.BaseEncoding = \"/WinAnsiEncoding\";\r\n        encoding.Differences = cyrillicEncodingDifferences.slice();\r\n        map.set(\"arial\", FontDict.createArialFont(encoding));\r\n        map.set(\"calibri\", FontDict.createCalibriFont(encoding));\r\n        map.set(\"cambria\", FontDict.createCambriaFont(encoding));\r\n        map.set(\"courier\", FontDict.createCourierFont(encoding));\r\n        map.set(\"tnr\", FontDict.createTnrFont(encoding));\r\n        map.set(\"verdana\", FontDict.createVerdanaFont(encoding));\r\n        return map;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$12(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new FontDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    static createArialFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/ArialMT\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 905;\r\n        descriptor.Descent = -211;\r\n        descriptor.FontBBox = [-664, -324, 2000, 1039];\r\n        descriptor.CapHeight = 716;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/ArialMT\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [277, 277, 354, 556, 556, 889, 666, 190, 333, 333, 389, 583, 277, 333,\r\n            277, 277, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 277, 277, 583, 583,\r\n            583, 556, 925, 666, 666, 722, 722, 666, 610, 777, 722, 277, 500, 666, 556, 833,\r\n            722, 777, 666, 777, 722, 666, 610, 722, 666, 943, 666, 666, 610, 277, 277, 277,\r\n            469, 556, 333, 556, 556, 500, 556, 556, 277, 556, 556, 222, 222, 500, 222, 833,\r\n            556, 556, 556, 556, 333, 500, 277, 556, 500, 722, 500, 500, 500, 333, 259, 333,\r\n            583, 750, 864, 541, 222, 364, 333, 1000, 556, 556, 556, 1000, 1014, 333, 893,\r\n            582, 854, 718, 556, 222, 222, 333, 333, 350, 556, 1000, 750, 1000, 906, 333,\r\n            812, 437, 556, 552, 277, 635, 500, 500, 556, 488, 259, 556, 666, 736, 718, 556,\r\n            583, 333, 736, 277, 399, 548, 277, 222, 411, 576, 537, 333, 556, 953, 510, 556,\r\n            222, 666, 500, 277, 666, 656, 666, 541, 677, 666, 923, 604, 718, 718, 582, 656,\r\n            833, 722, 777, 718, 666, 722, 610, 635, 760, 666, 739, 666, 916, 937, 791, 885,\r\n            656, 718, 879, 722, 556, 572, 531, 364, 583, 556, 668, 458, 558, 558, 437, 583,\r\n            687, 552, 556, 541, 556, 500, 458, 500, 822, 500, 572, 520, 802, 822, 625, 718,\r\n            520, 510, 750, 541,];\r\n        font._name = \"/tspdfFarial\";\r\n        return font;\r\n    }\r\n    static createCalibriFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/Calibri\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 750;\r\n        descriptor.Descent = -250;\r\n        descriptor.FontBBox = [-502, -312, 1240, 1026];\r\n        descriptor.CapHeight = 631;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/Calibri\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [226, 325, 400, 498, 506, 714, 682, 220, 303, 303, 498, 498, 249, 306,\r\n            252, 386, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 267, 267, 498, 498, 498,\r\n            463, 894, 578, 543, 533, 615, 488, 459, 630, 623, 251, 318, 519, 420, 854, 645, 662,\r\n            516, 672, 542, 459, 487, 641, 567, 889, 519, 487, 468, 306, 386, 306, 498, 498, 291,\r\n            479, 525, 422, 525, 497, 305, 470, 525, 229, 239, 454, 229, 798, 525, 527, 525, 525,\r\n            348, 391, 334, 525, 451, 714, 433, 452, 395, 314, 460, 314, 498, 506, 624, 429, 249,\r\n            345, 418, 690, 498, 498, 506, 967, 872, 338, 876, 542, 618, 619, 540, 249, 249, 418,\r\n            418, 498, 498, 905, 0, 705, 750, 338, 769, 463, 532, 524, 226, 527, 452, 318, 498,\r\n            432, 498, 498, 488, 834, 547, 512, 498, 306, 506, 251, 338, 498, 251, 229, 354, 549,\r\n            585, 252, 497, 890, 443, 512, 239, 459, 391, 229, 578, 537, 543, 429, 644, 488, 800,\r\n            473, 641, 641, 542, 610, 854, 623, 662, 621, 516, 533, 487, 527, 697, 519, 638, 555,\r\n            868, 889, 614, 761, 531, 547, 878, 555, 479, 532, 479, 345, 558, 497, 688, 422, 540,\r\n            540, 463, 510, 676, 534, 527, 520, 525, 422, 387, 452, 624, 433, 541, 468, 728, 749,\r\n            536, 666, 469, 442, 721, 474,];\r\n        font._name = \"/tspdfFcalibri\";\r\n        return font;\r\n    }\r\n    static createCambriaFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/Cambria\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 950;\r\n        descriptor.Descent = -222;\r\n        descriptor.FontBBox = [-1474, -2463, 2867, 3116];\r\n        descriptor.CapHeight = 666;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/Cambria\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [220, 285, 393, 619, 505, 889, 687, 236, 381, 381, 427, 553, 205, 332,\r\n            205, 490, 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, 263, 263, 553, 553,\r\n            553, 422, 885, 623, 611, 562, 661, 575, 536, 610, 686, 324, 306, 629, 536, 815,\r\n            680, 653, 567, 653, 621, 496, 592, 647, 603, 921, 571, 570, 537, 350, 490, 350,\r\n            553, 370, 284, 488, 547, 440, 554, 487, 302, 494, 551, 277, 266, 524, 271, 832,\r\n            558, 530, 556, 546, 413, 429, 338, 552, 503, 774, 483, 503, 454, 387, 316, 387,\r\n            712, 658, 738, 534, 205, 446, 360, 751, 516, 516, 628, 1160, 935, 302, 932, 649,\r\n            752, 666, 538, 221, 221, 375, 375, 443, 500, 1000, 0, 679, 763, 302, 797, 540,\r\n            551, 566, 220, 600, 503, 306, 543, 501, 316, 500, 575, 850, 569, 487, 553, 332,\r\n            850, 324, 375, 553, 324, 277, 416, 543, 587, 282, 487, 927, 470, 487, 266, 496,\r\n            429, 277, 623, 599, 611, 534, 654, 575, 922, 542, 691, 691, 649, 677, 815, 686,\r\n            653, 674, 567, 562, 592, 600, 778, 571, 671, 625, 926, 926, 731, 850, 597, 573,\r\n            920, 630, 488, 541, 522, 446, 558, 487, 713, 458, 589, 589, 540, 559, 672, 588,\r\n            530, 566, 556, 440, 511, 503, 685, 483, 569, 530, 800, 800, 617, 748,\r\n            514, 470, 767, 530,];\r\n        font._name = \"/tspdfFcambria\";\r\n        return font;\r\n    }\r\n    static createCourierFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/CourierNewPSMT\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 832;\r\n        descriptor.Descent = -300;\r\n        descriptor.FontBBox = [-121, -679, 622, 1020];\r\n        descriptor.CapHeight = 571;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/CourierNewPSMT\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\r\n            600, 600, 600, 600,];\r\n        font._name = \"/tspdfFcourier\";\r\n        return font;\r\n    }\r\n    static createTnrFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/TimesNewRomanPSMT\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 891;\r\n        descriptor.Descent = -216;\r\n        descriptor.FontBBox = [-568, -306, 2045, 1039];\r\n        descriptor.CapHeight = 662;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/TimesNewRomanPSMT\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [250, 333, 408, 500, 500, 833, 777, 180, 333, 333, 500, 563, 250, 333,\r\n            250, 277, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 277, 277, 563, 563,\r\n            563, 443, 920, 722, 666, 666, 722, 610, 556, 722, 722, 333, 389, 722, 610, 889,\r\n            722, 722, 556, 722, 666, 556, 610, 722, 722, 943, 722, 722, 610, 333, 277, 333,\r\n            469, 500, 333, 443, 500, 443, 500, 443, 333, 500, 500, 277, 277, 500, 277, 777,\r\n            500, 500, 500, 500, 333, 389, 277, 500, 500, 722, 500, 500, 443, 479, 200, 479,\r\n            541, 777, 751, 578, 333, 410, 443, 1000, 500, 500, 500, 1000, 872, 333, 872, 666,\r\n            741, 722, 482, 333, 333, 443, 443, 350, 500, 1000, 777, 979, 727, 333, 723, 485,\r\n            500, 535, 250, 708, 500, 389, 500, 450, 200, 500, 610, 759, 660, 500, 563, 333,\r\n            759, 333, 399, 548, 333, 277, 351, 576, 453, 333, 443, 954, 429, 500, 277, 556,\r\n            389, 277, 722, 574, 666, 578, 682, 610, 895, 500, 722, 722, 666, 678, 889, 722,\r\n            722, 722, 556, 666, 610, 708, 790, 722, 722, 649, 953, 953, 706, 872, 574, 660,\r\n            973, 666, 443, 508, 472, 410, 508, 443, 690, 395, 535, 535, 485, 499, 632, 535,\r\n            500, 535, 500, 443, 437, 500, 647, 500, 535, 502, 770, 770, 517, 671,\r\n            456, 429, 747, 459,];\r\n        font._name = \"/tspdfFtnr\";\r\n        return font;\r\n    }\r\n    static createVerdanaFont(encoding) {\r\n        const descriptor = new FontDescriptorDict();\r\n        descriptor.FontName = \"/Verdana\";\r\n        descriptor.Flags = 32;\r\n        descriptor.ItalicAngle = 0;\r\n        descriptor.Ascent = 1005;\r\n        descriptor.Descent = -209;\r\n        descriptor.FontBBox = [-559, -303, 1522, 1050];\r\n        descriptor.CapHeight = 727;\r\n        descriptor.StemV = 0;\r\n        const font = new FontDict();\r\n        font.encoding = encoding;\r\n        font.descriptor = descriptor;\r\n        font.Subtype = \"/TrueType\";\r\n        font.BaseFont = \"/Verdana\";\r\n        font.FirstChar = 32;\r\n        font.LastChar = 255;\r\n        font.Widths = [351, 393, 458, 818, 635, 931, 726, 268, 454, 454, 635, 818, 363, 454,\r\n            363, 454, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 454, 454, 818, 818, 818,\r\n            545, 1000, 683, 685, 698, 770, 632, 574, 775, 751, 420, 454, 692, 556, 842, 748, 787,\r\n            603, 787, 695, 683, 616, 731, 683, 988, 685, 615, 685, 454, 454, 454, 818, 635, 635,\r\n            600, 623, 520, 623, 595, 351, 623, 632, 274, 344, 591, 274, 972, 632, 606, 623, 623,\r\n            426, 520, 394, 632, 591, 818, 591, 591, 525, 634, 454, 634, 818, 1000, 792, 566, 268,\r\n            471, 458, 818, 635, 635, 635, 1374, 1071, 454, 966, 692, 817, 751, 632, 268, 268, 458,\r\n            458, 545, 635, 1000, 1000, 976, 914, 454, 914, 591, 632, 637, 351, 615, 591, 454, 635,\r\n            566, 454, 635, 632, 1000, 700, 644, 818, 454, 1000, 420, 541, 818, 420, 274, 471, 641,\r\n            635, 363, 595, 993, 546, 644, 344, 683, 520, 274, 683, 685, 685, 566, 745, 632, 973,\r\n            615, 750, 750, 692, 734, 842, 751, 787, 751, 603, 698, 616, 615, 818, 685, 761, 711,\r\n            835, 904, 783, 920, 680, 701, 881, 706, 600, 614, 594, 471, 621, 595, 797, 524, 640,\r\n            640, 591, 620, 696, 637, 606, 637, 623, 534, 496, 591, 840, 591, 644, 605, 875, 887,\r\n            640, 794, 570, 546, 838, 599,];\r\n        font._name = \"/tspdfFverdana\";\r\n        return font;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Subtype) {\r\n            bytes.push(...encoder.encode(\"/Subtype \"), ...encoder.encode(\" \" + this.Subtype));\r\n        }\r\n        if (this.BaseFont) {\r\n            bytes.push(...encoder.encode(\"/BaseFont \"), ...encoder.encode(\" \" + this.BaseFont));\r\n        }\r\n        if (this.ToUnicode) {\r\n            bytes.push(...encoder.encode(\"/G \"), ...this.ToUnicode.toArray(cryptInfo));\r\n        }\r\n        if (this.FirstChar) {\r\n            bytes.push(...encoder.encode(\"/FirstChar \"), ...encoder.encode(\" \" + this.FirstChar));\r\n        }\r\n        if (this.LastChar) {\r\n            bytes.push(...encoder.encode(\"/LastChar \"), ...encoder.encode(\" \" + this.LastChar));\r\n        }\r\n        if (this.Widths) {\r\n            if (this.Widths instanceof ObjectId) {\r\n                bytes.push(...encoder.encode(\"/Widths \"), ...this.Widths.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Widths \"), ...this.encodePrimitiveArray(this.Widths, encoder));\r\n            }\r\n        }\r\n        if (this.Encoding || this.encodingValue) {\r\n            if (this.Encoding instanceof ObjectId) {\r\n                bytes.push(...encoder.encode(\"/Encoding \"), ...this.Encoding.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Encoding \"), ...encoder.encode(\" \" + this.Encoding));\r\n            }\r\n        }\r\n        if (this.descriptorValue) {\r\n            bytes.push(...encoder.encode(\"/FontDescriptor \"), ...this.descriptorValue.toArray(cryptInfo));\r\n        }\r\n        if (this.Resources) {\r\n            bytes.push(...encoder.encode(\"/Resources \"), ...this.Resources);\r\n        }\r\n        if (this.CharProcs) {\r\n            bytes.push(...encoder.encode(\"/CharProcs \"), ...this.CharProcs);\r\n        }\r\n        if (this.FontBBox) {\r\n            bytes.push(...encoder.encode(\"/FontBBox \"), ...this.encodePrimitiveArray(this.FontBBox, encoder));\r\n        }\r\n        if (this.FontMatrix) {\r\n            bytes.push(...encoder.encode(\"/FontMatrix \"), ...this.encodePrimitiveArray(this.FontMatrix, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    decodeText(bytes) {\r\n        var _a;\r\n        if (this.toUtfCmap) {\r\n            return this.toUtfCmap.hexBytesToUtfString(bytes);\r\n        }\r\n        if ((_a = this.encoding) === null || _a === void 0 ? void 0 : _a.charMap) {\r\n            const charMap = this.encoding.charMap;\r\n            let text = \"\";\r\n            bytes.forEach(byte => { var _a; return text += (_a = charMap.get(byte)) !== null && _a !== void 0 ? _a : \" \"; });\r\n            return text;\r\n        }\r\n        const decoder = bytes[0] === 254 && bytes[1] === 255\r\n            ? new TextDecoder(\"utf-16be\")\r\n            : new TextDecoder();\r\n        const literal = decoder.decode(bytes);\r\n        return literal || \"\";\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$12(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Subtype\":\r\n                            const subtype = yield parser.parseNameAtAsync(i, true);\r\n                            if (subtype) {\r\n                                this.Subtype = subtype.value;\r\n                                i = subtype.end + 1;\r\n                                break;\r\n                            }\r\n                            throw new Error(\"Can't parse /Subtype property value\");\r\n                        case \"/BaseFont\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Encoding\":\r\n                            const encodingPropType = yield parser.getValueTypeAtAsync(i);\r\n                            if (encodingPropType === valueTypes.NAME) {\r\n                                i = yield this.parseNamePropAsync(name, parser, i);\r\n                            }\r\n                            else if (encodingPropType === valueTypes.REF) {\r\n                                i = yield this.parseRefPropAsync(name, parser, i);\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported '${name}' property value type: '${encodingPropType}'`);\r\n                            }\r\n                            break;\r\n                        case \"/ToUnicode\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/FirstChar\":\r\n                        case \"/LastChar\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/FontBBox\":\r\n                        case \"/FontMatrix\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/Widths\":\r\n                            const widthPropType = yield parser.getValueTypeAtAsync(i);\r\n                            if (widthPropType === valueTypes.ARRAY) {\r\n                                i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            }\r\n                            else if (widthPropType === valueTypes.REF) {\r\n                                i = yield this.parseRefPropAsync(name, parser, i);\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported '${name}' property value type: '${encodingPropType}'`);\r\n                            }\r\n                            break;\r\n                        case \"/FontDescriptor\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Resources\":\r\n                        case \"/CharProcs\":\r\n                            const excludedEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (excludedEntryType === valueTypes.REF) {\r\n                                const excludedDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (excludedDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    this[name.slice(1)] = yield parser.sliceCharCodesAsync(excludedDictId.start, excludedDictId.end);\r\n                                    i = excludedDictId.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(`Can't parse ${name} value reference`);\r\n                            }\r\n                            else if (excludedEntryType === valueTypes.DICTIONARY) {\r\n                                const excludedDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (excludedDictBounds) {\r\n                                    this[name.slice(1)] = yield parser.sliceCharCodesAsync(excludedDictBounds.start, excludedDictBounds.end);\r\n                                    i = excludedDictBounds.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(`Can't parse ${name} dictionary bounds`);\r\n                            }\r\n                            throw new Error(`Unsupported ${name} property value type: ${excludedEntryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (this.Encoding && this.Encoding instanceof ObjectId) {\r\n                const encodingParseInfo = yield parseInfo.parseInfoGetterAsync(this.Encoding.id);\r\n                const encodingDict = yield EncodingDict.parseAsync(encodingParseInfo);\r\n                this._encoding = encodingDict === null || encodingDict === void 0 ? void 0 : encodingDict.value;\r\n            }\r\n            if (this.ToUnicode) {\r\n                const toUtfParseInfo = yield parseInfo.parseInfoGetterAsync(this.ToUnicode.id);\r\n                const cmap = yield UnicodeCmapStream.parseAsync(toUtfParseInfo);\r\n                this._toUtfCmap = cmap === null || cmap === void 0 ? void 0 : cmap.value;\r\n            }\r\n            if (this.FontDescriptor) {\r\n                const descriptorParseInfo = yield parseInfo.parseInfoGetterAsync(this.FontDescriptor.id);\r\n                const descriptor = yield FontDescriptorDict.parseAsync(descriptorParseInfo);\r\n                this._descriptor = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value;\r\n            }\r\n            if (this.Subtype !== \"/Type1\"\r\n                && this.Subtype !== \"/Type3\"\r\n                && this.Subtype !== \"/TrueType\"\r\n                && !(this.Subtype === \"/Type0\" && this._toUtfCmap)) {\r\n                throw new Error(`Font type is not supported: ${this.Subtype}`);\r\n            }\r\n            if (this.Subtype === \"/Type3\"\r\n                && (!this.FontBBox\r\n                    || !this.FontMatrix\r\n                    || !this.Encoding\r\n                    || !this.FirstChar\r\n                    || !this.LastChar\r\n                    || !this.Widths\r\n                    || !this.CharProcs)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$11 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass SoftMaskDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.SOFT_MASK);\r\n        this.TR = \"/Identity\";\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$11(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new SoftMaskDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.S) {\r\n            bytes.push(...encoder.encode(\"/S \"), ...encoder.encode(this.S));\r\n        }\r\n        if (this.G) {\r\n            bytes.push(...encoder.encode(\"/G \"), ...this.G.toArray(cryptInfo));\r\n        }\r\n        if (this.BC) {\r\n            bytes.push(...encoder.encode(\"/BC \"), ...this.encodePrimitiveArray(this.BC, encoder));\r\n        }\r\n        if (this.TR) {\r\n            bytes.push(...encoder.encode(\"/TR \"), ...encoder.encode(\" \" + this.TR));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$11(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/S\":\r\n                            const softMaskType = yield parser.parseNameAtAsync(i, true);\r\n                            if (softMaskType && Object.values(softMaskTypes)\r\n                                .includes(softMaskType.value)) {\r\n                                this.S = softMaskType.value;\r\n                                i = softMaskType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /S property value\");\r\n                            }\r\n                            break;\r\n                        case \"/G\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/BC\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/TR\":\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$10 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GraphicsStateDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.GRAPHICS_STATE);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$10(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new GraphicsStateDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.LW) {\r\n            bytes.push(...encoder.encode(\"/LW \"), ...encoder.encode(\" \" + this.LW));\r\n        }\r\n        if (this.LC) {\r\n            bytes.push(...encoder.encode(\"/LC \"), ...encoder.encode(\" \" + this.LC));\r\n        }\r\n        if (this.LJ) {\r\n            bytes.push(...encoder.encode(\"/LJ \"), ...encoder.encode(\" \" + this.LJ));\r\n        }\r\n        if (this.ML) {\r\n            bytes.push(...encoder.encode(\"/ML \"), ...encoder.encode(\" \" + this.ML));\r\n        }\r\n        if (this.D) {\r\n            bytes.push(...encoder.encode(\"/D \"), codes.L_BRACKET, codes.L_BRACKET, ...encoder.encode(\"\" + this.D[0][0]), ...encoder.encode(\" \" + this.D[0][1]), codes.R_BRACKET, ...encoder.encode(\" \" + this.D[1]), codes.R_BRACKET);\r\n        }\r\n        if (this.RI) {\r\n            bytes.push(...encoder.encode(\"/RI \"), ...encoder.encode(this.RI));\r\n        }\r\n        if (this.OP) {\r\n            bytes.push(...encoder.encode(\"/OP \"), ...encoder.encode(\" \" + this.OP));\r\n        }\r\n        if (this.op) {\r\n            bytes.push(...encoder.encode(\"/op \"), ...encoder.encode(\" \" + this.op));\r\n        }\r\n        if (this.OPM) {\r\n            bytes.push(...encoder.encode(\"/OPM \"), ...encoder.encode(\" \" + this.OPM));\r\n        }\r\n        if (this.Font) {\r\n            bytes.push(...encoder.encode(\"/Font \"), codes.L_BRACKET, ...this.Font[0].toArray(cryptInfo), ...encoder.encode(\" \" + this.Font[1]), codes.R_BRACKET);\r\n        }\r\n        if (this.FL) {\r\n            bytes.push(...encoder.encode(\"/FL \"), ...encoder.encode(\" \" + this.FL));\r\n        }\r\n        if (this.SM) {\r\n            bytes.push(...encoder.encode(\"/SM \"), ...encoder.encode(\" \" + this.SM));\r\n        }\r\n        if (this.SA) {\r\n            bytes.push(...encoder.encode(\"/SA \"), ...encoder.encode(\" \" + this.SA));\r\n        }\r\n        if (this.BM) {\r\n            bytes.push(...encoder.encode(\"/BM \"), ...encoder.encode(this.BM));\r\n        }\r\n        if (this.SMask) {\r\n            if (this.SMask instanceof SoftMaskDict) {\r\n                bytes.push(...encoder.encode(\"/SMask \"), ...this.SMask.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/SMask \"), ...encoder.encode(this.SMask));\r\n            }\r\n        }\r\n        if (this.CA) {\r\n            bytes.push(...encoder.encode(\"/CA \"), ...encoder.encode(\" \" + this.CA));\r\n        }\r\n        if (this.ca) {\r\n            bytes.push(...encoder.encode(\"/ca \"), ...encoder.encode(\" \" + this.ca));\r\n        }\r\n        if (this.AIS) {\r\n            bytes.push(...encoder.encode(\"/AIS \"), ...encoder.encode(\" \" + this.AIS));\r\n        }\r\n        if (this.TK) {\r\n            bytes.push(...encoder.encode(\"/TK \"), ...encoder.encode(\" \" + this.TK));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toParams() {\r\n        const params = {};\r\n        if (!isNaN(this.LW)) {\r\n            params.strokeWidth = this.LW;\r\n        }\r\n        if (!isNaN(this.LC)) {\r\n            switch (this.LC) {\r\n                case lineCapStyles.BUTT:\r\n                    params.strokeLineCap = \"butt\";\r\n                    break;\r\n                case lineCapStyles.ROUND:\r\n                    params.strokeLineCap = \"round\";\r\n                    break;\r\n                case lineCapStyles.SQUARE:\r\n                    params.strokeLineCap = \"square\";\r\n                    break;\r\n            }\r\n        }\r\n        if (!isNaN(this.LJ)) {\r\n            switch (this.LJ) {\r\n                case lineJoinStyles.BEVEL:\r\n                    params.strokeLineJoin = \"bevel\";\r\n                    break;\r\n                case lineJoinStyles.ROUND:\r\n                    params.strokeLineJoin = \"round\";\r\n                    break;\r\n                case lineJoinStyles.MITER:\r\n                    params.strokeLineJoin = \"miter\";\r\n                    break;\r\n            }\r\n        }\r\n        if (this.ML) {\r\n            params.strokeMiterLimit = this.ML;\r\n        }\r\n        if (this.D) {\r\n            params.strokeDashArray = `${this.D[0][0]} ${this.D[0][1]}`;\r\n            params.strokeDashOffset = this.D[1];\r\n        }\r\n        if (this.Font) ;\r\n        if (this.BM) {\r\n            switch (this.BM) {\r\n                case \"/Normal\":\r\n                    params.mixBlendMode = \"normal\";\r\n                    break;\r\n                case \"/Multiply\":\r\n                    params.mixBlendMode = \"multiply\";\r\n                    break;\r\n                case \"/Screen\":\r\n                    params.mixBlendMode = \"screen\";\r\n                    break;\r\n                case \"/Overlay\":\r\n                    params.mixBlendMode = \"overlay\";\r\n                    break;\r\n                case \"/Darken\":\r\n                    params.mixBlendMode = \"darken\";\r\n                    break;\r\n                case \"/Lighten\":\r\n                    params.mixBlendMode = \"lighten\";\r\n                    break;\r\n                case \"/ColorDodge\":\r\n                    params.mixBlendMode = \"color-dodge\";\r\n                    break;\r\n                case \"/ColorBurn\":\r\n                    params.mixBlendMode = \"color-burn\";\r\n                    break;\r\n                case \"/HardLight\":\r\n                    params.mixBlendMode = \"hard-light\";\r\n                    break;\r\n                case \"/SoftLight\":\r\n                    params.mixBlendMode = \"soft-light\";\r\n                    break;\r\n                case \"/Difference\":\r\n                    params.mixBlendMode = \"difference\";\r\n                    break;\r\n                case \"/Exclusion\":\r\n                    params.mixBlendMode = \"exclusion\";\r\n                    break;\r\n                default:\r\n                    throw new Error(`Unsupported blend mode: ${this.BM}`);\r\n            }\r\n        }\r\n        if (this.SMask) ;\r\n        if (this.CA) {\r\n            params.strokeAlpha = this.CA;\r\n        }\r\n        if (this.ca) {\r\n            params.fillAlpha = this.ca;\r\n        }\r\n        if (this.AIS) ;\r\n        return params;\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$10(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/LC\":\r\n                            const lineCap = yield parser.parseNumberAtAsync(i, true);\r\n                            if (lineCap && Object.values(lineCapStyles)\r\n                                .includes(lineCap.value)) {\r\n                                this.LC = lineCap.value;\r\n                                i = lineCap.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /LC property value\");\r\n                            }\r\n                            break;\r\n                        case \"/OPM\":\r\n                            const overprintMode = yield parser.parseNumberAtAsync(i, true);\r\n                            if (overprintMode && ([0, 1].includes(overprintMode.value))) {\r\n                                this.OPM = overprintMode.value;\r\n                                i = overprintMode.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /OPM property value\");\r\n                            }\r\n                            break;\r\n                        case \"/LJ\":\r\n                            const lineJoin = yield parser.parseNumberAtAsync(i, true);\r\n                            if (lineJoin && Object.values(lineJoinStyles)\r\n                                .includes(lineJoin.value)) {\r\n                                this.LJ = lineJoin.value;\r\n                                i = lineJoin.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /LJ property value\");\r\n                            }\r\n                            break;\r\n                        case \"/RI\":\r\n                            const intent = yield parser.parseNameAtAsync(i, true);\r\n                            if (intent && Object.values(renderingIntents)\r\n                                .includes(intent.value)) {\r\n                                this.RI = intent.value;\r\n                                i = intent.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /RI property value\");\r\n                            }\r\n                            break;\r\n                        case \"/BM\":\r\n                            const blendMode = yield parser.parseNameAtAsync(i, true);\r\n                            if (blendMode && Object.values(blendModes)\r\n                                .includes(blendMode.value)) {\r\n                                this.BM = blendMode.value;\r\n                                i = blendMode.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /BM property value\");\r\n                            }\r\n                            break;\r\n                        case \"/SMask\":\r\n                            const sMaskEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (sMaskEntryType === valueTypes.NAME) {\r\n                                const sMaskName = yield parser.parseNameAtAsync(i);\r\n                                if (sMaskName) {\r\n                                    this.SMask = sMaskName.value;\r\n                                    i = sMaskName.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /SMask property name\");\r\n                            }\r\n                            else if (sMaskEntryType === valueTypes.DICTIONARY) {\r\n                                const sMaskDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (sMaskDictBounds) {\r\n                                    const sMaskDict = yield SoftMaskDict.parseAsync({ parser, bounds: sMaskDictBounds });\r\n                                    if (sMaskDict) {\r\n                                        this.SMask = sMaskDict.value;\r\n                                        i = sMaskDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /SMask value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /SMask property value type: ${sMaskEntryType}`);\r\n                        case \"/Font\":\r\n                            const fontEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (fontEntryType === valueTypes.ARRAY) {\r\n                                const fontArrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                                if (fontArrayBounds) {\r\n                                    const fontRef = yield ObjectId.parseAsync(parser, fontArrayBounds.start + 1);\r\n                                    if (fontRef) {\r\n                                        const fontSize = yield parser.parseNumberAtAsync(fontRef.end + 1);\r\n                                        if (fontSize) {\r\n                                            this.Font = [fontRef.value, fontSize.value];\r\n                                            i = fontArrayBounds.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported /Font property value type: ${fontEntryType}`);\r\n                            }\r\n                            throw new Error(\"Can't parse /Font property value\");\r\n                        case \"/D\":\r\n                            const dashEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (dashEntryType === valueTypes.ARRAY) {\r\n                                const dashArrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                                if (dashArrayBounds) {\r\n                                    const dashArray = yield parser.parseNumberArrayAtAsync(dashArrayBounds.start + 1);\r\n                                    if (dashArray) {\r\n                                        const dashPhase = yield parser.parseNumberAtAsync(dashArray.end + 1);\r\n                                        if (dashPhase) {\r\n                                            this.D = [[dashArray.value[0], dashArray.value[1]], dashPhase.value];\r\n                                            i = dashArrayBounds.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported /D property value type: ${dashEntryType}`);\r\n                            }\r\n                            throw new Error(\"Can't parse /D property value\");\r\n                        case \"/OP\":\r\n                        case \"/op\":\r\n                        case \"/SA\":\r\n                        case \"/AIS\":\r\n                        case \"/TK\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/LW\":\r\n                        case \"/ML\":\r\n                        case \"/FL\":\r\n                        case \"/SM\":\r\n                        case \"/CA\":\r\n                        case \"/ca\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$$ = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ResourceDict extends PdfDict {\r\n    constructor(streamParsers) {\r\n        super(null);\r\n        this._gsMap = new Map();\r\n        this._fontsMap = new Map();\r\n        this._xObjectsMap = new Map();\r\n        this._streamParsers = streamParsers;\r\n    }\r\n    static parseAsync(parseInfo, streamParsers) {\r\n        return __awaiter$$(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new ResourceDict(streamParsers);\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this._gsMap.size) {\r\n            bytes.push(...encoder.encode(\"/ExtGState \"));\r\n            bytes.push(...keywordCodes.DICT_START);\r\n            for (const [name, gsDict] of this._gsMap) {\r\n                bytes.push(...encoder.encode(name.slice(10)), codes.WHITESPACE);\r\n                if (gsDict.ref) {\r\n                    bytes.push(...ObjectId.fromRef(gsDict.ref).toArray(cryptInfo));\r\n                }\r\n                else {\r\n                    bytes.push(...gsDict.toArray(cryptInfo));\r\n                }\r\n            }\r\n            bytes.push(...keywordCodes.DICT_END);\r\n        }\r\n        if (this._fontsMap.size) {\r\n            bytes.push(...encoder.encode(\"/Font \"));\r\n            bytes.push(...keywordCodes.DICT_START);\r\n            for (const [name, fontDict] of this._fontsMap) {\r\n                bytes.push(...encoder.encode(name.slice(5)), codes.WHITESPACE);\r\n                if (fontDict.ref) {\r\n                    bytes.push(...ObjectId.fromRef(fontDict.ref).toArray(cryptInfo));\r\n                }\r\n                else {\r\n                    bytes.push(...fontDict.toArray(cryptInfo));\r\n                }\r\n            }\r\n            bytes.push(...keywordCodes.DICT_END);\r\n        }\r\n        if (this._xObjectsMap.size) {\r\n            bytes.push(...encoder.encode(\"/XObject \"), ...keywordCodes.DICT_START);\r\n            for (const [name, xObject] of this._xObjectsMap) {\r\n                const ref = xObject.ref;\r\n                if (!ref) {\r\n                    throw new Error(\"XObject has no reference\");\r\n                }\r\n                bytes.push(...encoder.encode(name.slice(8)), codes.WHITESPACE);\r\n                bytes.push(...ObjectId.fromRef(ref).toArray(cryptInfo));\r\n            }\r\n            bytes.push(...keywordCodes.DICT_END);\r\n        }\r\n        if (this.ColorSpace) {\r\n            bytes.push(...encoder.encode(\"/ColorSpace \"), ...this.ColorSpace.toArray(cryptInfo));\r\n        }\r\n        if (this.Pattern) {\r\n            bytes.push(...encoder.encode(\"/Pattern \"), ...this.Pattern.toArray(cryptInfo));\r\n        }\r\n        if (this.Shading) {\r\n            bytes.push(...encoder.encode(\"/Shading \"), ...this.Shading.toArray(cryptInfo));\r\n        }\r\n        if (this.Properties) {\r\n            bytes.push(...encoder.encode(\"/Properties \"), ...this.Properties.toArray(cryptInfo));\r\n        }\r\n        if (this.ProcSet) {\r\n            bytes.push(...encoder.encode(\"/ProcSet \"), ...this.encodePrimitiveArray(this.ProcSet, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    getGraphicsState(name) {\r\n        return this._gsMap.get(name);\r\n    }\r\n    *getGraphicsStates() {\r\n        for (const pair of this._gsMap) {\r\n            yield pair;\r\n        }\r\n        return;\r\n    }\r\n    setGraphicsState(name, state) {\r\n        this._gsMap.set(`/ExtGState${name}`, state);\r\n        this._edited = true;\r\n    }\r\n    getFont(name) {\r\n        return this._fontsMap.get(\"/Font\" + name);\r\n    }\r\n    *getFonts() {\r\n        for (const pair of this._fontsMap) {\r\n            yield pair;\r\n        }\r\n        return;\r\n    }\r\n    setFont(name, font) {\r\n        this._fontsMap.set(`/Font${name}`, font);\r\n        this._edited = true;\r\n    }\r\n    getXObject(name) {\r\n        return this._xObjectsMap.get(name);\r\n    }\r\n    *getXObjects() {\r\n        for (const pair of this._xObjectsMap) {\r\n            yield pair;\r\n        }\r\n        return;\r\n    }\r\n    setXObject(name, xObject) {\r\n        this._xObjectsMap.set(`/XObject${name}`, xObject);\r\n        this._edited = true;\r\n    }\r\n    fillMapsAsync(parseInfoGetterAsync, cryptInfo) {\r\n        return __awaiter$$(this, void 0, void 0, function* () {\r\n            this._gsMap.clear();\r\n            this._fontsMap.clear();\r\n            this._xObjectsMap.clear();\r\n            if (this.ExtGState) {\r\n                for (const [name, objectId] of this.ExtGState.getObjectIds()) {\r\n                    const streamParseInfo = yield parseInfoGetterAsync(objectId.id);\r\n                    if (!streamParseInfo) {\r\n                        continue;\r\n                    }\r\n                    const stream = yield GraphicsStateDict.parseAsync(streamParseInfo);\r\n                    if (stream) {\r\n                        this._gsMap.set(`/ExtGState${name}`, stream.value);\r\n                    }\r\n                }\r\n                for (const [name, parseInfo] of this.ExtGState.getDictParsers()) {\r\n                    const dict = yield GraphicsStateDict.parseAsync(parseInfo);\r\n                    if (dict) {\r\n                        this._gsMap.set(`/ExtGState${name}`, dict.value);\r\n                    }\r\n                }\r\n            }\r\n            if (this.XObject && this._streamParsers) {\r\n                for (const [name, objectId] of this.XObject.getObjectIds()) {\r\n                    const streamParseInfo = yield parseInfoGetterAsync(objectId.id);\r\n                    if (!streamParseInfo) {\r\n                        continue;\r\n                    }\r\n                    const stream = (yield streamParseInfo.parser.findSubarrayIndexAsync(keywordCodes.FORM, {\r\n                        direction: true,\r\n                        minIndex: streamParseInfo.bounds.start,\r\n                        maxIndex: streamParseInfo.bounds.end,\r\n                    }))\r\n                        ? yield this._streamParsers.xform(streamParseInfo)\r\n                        : yield this._streamParsers.image(streamParseInfo);\r\n                    if (stream) {\r\n                        this._xObjectsMap.set(`/XObject${name}`, stream.value);\r\n                    }\r\n                }\r\n            }\r\n            if (this.Font) {\r\n                for (const [name, objectId] of this.Font.getObjectIds()) {\r\n                    const dictParseInfo = yield parseInfoGetterAsync(objectId.id);\r\n                    if (!dictParseInfo) {\r\n                        continue;\r\n                    }\r\n                    const dict = yield FontDict.parseAsync(dictParseInfo);\r\n                    if (dict) {\r\n                        this._fontsMap.set(`/Font${name}`, dict.value);\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$$(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/ExtGState\":\r\n                        case \"/ColorSpace\":\r\n                        case \"/Pattern\":\r\n                        case \"/Shading\":\r\n                        case \"/XObject\":\r\n                        case \"/Font\":\r\n                        case \"/Properties\":\r\n                            const mapEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (mapEntryType === valueTypes.REF) {\r\n                                const mapDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (mapDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const mapParseInfo = yield parseInfo.parseInfoGetterAsync(mapDictId.value.id);\r\n                                    if (mapParseInfo) {\r\n                                        const mapDict = yield ObjectMapDict.parseAsync(mapParseInfo);\r\n                                        if (mapDict) {\r\n                                            this[name.slice(1)] = mapDict.value;\r\n                                            i = mapDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(`Can't parse ${name} value reference`);\r\n                            }\r\n                            else if (mapEntryType === valueTypes.DICTIONARY) {\r\n                                const mapBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (mapBounds) {\r\n                                    const map = yield ObjectMapDict.parseAsync({ parser, bounds: mapBounds });\r\n                                    if (map) {\r\n                                        this[name.slice(1)] = map.value;\r\n                                        i = mapBounds.end + 1;\r\n                                        break;\r\n                                    }\r\n                                    else {\r\n                                        throw new Error(`Can't parse ${name} value dictionary`);\r\n                                    }\r\n                                }\r\n                                throw new Error(`Can't parse ${name} dictionary bounds`);\r\n                            }\r\n                            throw new Error(`Unsupported /Resources property value type: ${mapEntryType}`);\r\n                        case \"/ProcSet\":\r\n                            i = yield this.parseNameArrayPropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (parseInfo.parseInfoGetterAsync) {\r\n                yield this.fillMapsAsync(parseInfo.parseInfoGetterAsync, parseInfo.cryptInfo);\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$_ = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass MeasureDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.MEASURE);\r\n        this.Subtype = \"/RL\";\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$_(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new MeasureDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Subtype) {\r\n            bytes.push(...encoder.encode(\"/Subtype \"), ...encoder.encode(this.Subtype));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$_(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Subtype\":\r\n                            const subtype = yield parser.parseNameAtAsync(i);\r\n                            if (subtype) {\r\n                                if (this.Subtype && this.Subtype !== subtype.value) {\r\n                                    throw new Error(`Invalid dict subtype: '${subtype.value}' instead of '${this.Subtype}'`);\r\n                                }\r\n                                i = subtype.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Subtype property value\");\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$Z = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GroupDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.GROUP);\r\n        this.S = \"/Transparency\";\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.S) {\r\n            bytes.push(...encoder.encode(\"/S \"), ...encoder.encode(this.S));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$Z(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/S\":\r\n                            const intent = yield parser.parseNameAtAsync(i, true);\r\n                            if (intent) {\r\n                                if (Object.values(groupDictTypes).includes(intent.value)) {\r\n                                    this.S = intent.value;\r\n                                    i = intent.end + 1;\r\n                                }\r\n                                else {\r\n                                    throw new Error(`Invalid dict subtype: '${intent.value}'`);\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /S property value\");\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$Y = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TransparencyGroupDict extends GroupDict {\r\n    constructor() {\r\n        super();\r\n        this.I = false;\r\n        this.K = false;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$Y(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new TransparencyGroupDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.CS) {\r\n            bytes.push(...encoder.encode(\"/CS \"), ...encoder.encode(this.CS));\r\n        }\r\n        if (this.I) {\r\n            bytes.push(...encoder.encode(\"/I \"), ...encoder.encode(\" \" + this.I));\r\n        }\r\n        if (this.K) {\r\n            bytes.push(...encoder.encode(\"/K \"), ...encoder.encode(\" \" + this.K));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$Y(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            if (this.S !== \"/Transparency\") {\r\n                throw new Error(\"Not a transparency dict\");\r\n            }\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/CS\":\r\n                            const colorSpaceEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (colorSpaceEntryType === valueTypes.NAME) {\r\n                                const colorSpaceName = yield parser.parseNameAtAsync(i);\r\n                                if (colorSpaceName) {\r\n                                    this.CS = colorSpaceName.value;\r\n                                    i = colorSpaceName.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /CS property name\");\r\n                            }\r\n                            else if (colorSpaceEntryType === valueTypes.ARRAY) {\r\n                                const colorSpaceArrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                                if (colorSpaceArrayBounds) {\r\n                                    i = colorSpaceArrayBounds.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /CS value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /CS property value type: ${colorSpaceEntryType}`);\r\n                        case \"/I\":\r\n                        case \"/K\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$X = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass XFormStream extends PdfStream {\r\n    constructor() {\r\n        super(streamTypes.FORM_XOBJECT);\r\n        this.Subtype = \"/Form\";\r\n        this.FormType = 1;\r\n        this.Matrix = [1, 0, 0, 1, 0, 0];\r\n    }\r\n    get matrix() {\r\n        const apMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3();\r\n        if (this.Matrix) {\r\n            const [m0, m1, m3, m4, m6, m7] = this.Matrix;\r\n            apMatrix.set(m0, m1, 0, m3, m4, 0, m6, m7, 1);\r\n        }\r\n        return apMatrix;\r\n    }\r\n    set matrix(matrix) {\r\n        if (!matrix) {\r\n            return;\r\n        }\r\n        this.Matrix = [...matrix.toFloatShortArray()];\r\n    }\r\n    get bBox() {\r\n        return {\r\n            ll: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[0], this.BBox[1]),\r\n            lr: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[2], this.BBox[1]),\r\n            ur: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[2], this.BBox[3]),\r\n            ul: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[0], this.BBox[3]),\r\n        };\r\n    }\r\n    get transformedBBox() {\r\n        const matrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3();\r\n        if (this.Matrix) {\r\n            const [m0, m1, m3, m4, m6, m7] = this.Matrix;\r\n            matrix.set(m0, m1, 0, m3, m4, 0, m6, m7, 1);\r\n        }\r\n        const bBoxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[0], this.BBox[1]);\r\n        const bBoxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[2], this.BBox[1]);\r\n        const bBoxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[2], this.BBox[3]);\r\n        const bBoxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.BBox[0], this.BBox[3]);\r\n        return {\r\n            ll: mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxLL, matrix),\r\n            lr: mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxLR, matrix),\r\n            ur: mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxUR, matrix),\r\n            ul: mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxUL, matrix),\r\n        };\r\n    }\r\n    get edited() {\r\n        return this._edited || this.Resources.edited;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$X(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new XFormStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Subtype) {\r\n            bytes.push(...encoder.encode(\"/Subtype \"), ...encoder.encode(this.Subtype));\r\n        }\r\n        if (this.FormType) {\r\n            bytes.push(...encoder.encode(\"/FormType \"), ...encoder.encode(\" \" + this.FormType));\r\n        }\r\n        if (this.BBox) {\r\n            bytes.push(...encoder.encode(\"/BBox \"), ...this.encodePrimitiveArray(this.BBox, encoder));\r\n        }\r\n        if (this.Matrix) {\r\n            bytes.push(...encoder.encode(\"/Matrix \"), ...this.encodePrimitiveArray(this.Matrix, encoder));\r\n        }\r\n        if (this.Resources) {\r\n            bytes.push(...encoder.encode(\"/Resources \"), ...this.Resources.toArray(cryptInfo));\r\n        }\r\n        if (this.Metadata) {\r\n            bytes.push(...encoder.encode(\"/Metadata \"), ...this.Metadata.toArray(cryptInfo));\r\n        }\r\n        if (this.LastModified) {\r\n            bytes.push(...encoder.encode(\"/LastModified \"), ...this.LastModified.toArray(cryptInfo));\r\n        }\r\n        if (this.StructParent) {\r\n            bytes.push(...encoder.encode(\"/StructParent \"), ...encoder.encode(\" \" + this.StructParent));\r\n        }\r\n        if (this.StructParents) {\r\n            bytes.push(...encoder.encode(\"/StructParents \"), ...encoder.encode(\" \" + this.StructParents));\r\n        }\r\n        if (this.Measure) {\r\n            bytes.push(...encoder.encode(\"/Measure \"), ...this.Measure.toArray(cryptInfo));\r\n        }\r\n        if (this.Group) {\r\n            bytes.push(...encoder.encode(\"/Group \"), ...this.Group.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$X(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const dictBounds = yield parser.getDictBoundsAtAsync(start);\r\n            let i = yield parser.skipToNextNameAsync(dictBounds.contentStart, dictBounds.contentEnd);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Subtype\":\r\n                            const subtype = yield parser.parseNameAtAsync(i);\r\n                            if (subtype) {\r\n                                if (this.Subtype && this.Subtype !== subtype.value) {\r\n                                    throw new Error(`Invalid dict subtype: '${subtype.value}' instead of '${this.Subtype}'`);\r\n                                }\r\n                                i = subtype.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Subtype property value\");\r\n                            }\r\n                            break;\r\n                        case \"/FormType\":\r\n                            const formType = yield parser.parseNumberAtAsync(i, false);\r\n                            if (formType) {\r\n                                if (formType.value !== 1) {\r\n                                    throw new Error(`Ivalid form type: '${formType.value}' instead of '1'`);\r\n                                }\r\n                                i = formType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /FormType property value\");\r\n                            }\r\n                            break;\r\n                        case \"/BBox\":\r\n                        case \"/Matrix\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/LastModified\":\r\n                            i = yield this.parseDatePropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/Metadata\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/StructParent\":\r\n                        case \"/StructParents\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Resources\":\r\n                            const resEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (resEntryType === valueTypes.REF) {\r\n                                const resDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (resDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const resParseInfo = yield parseInfo.parseInfoGetterAsync(resDictId.value.id);\r\n                                    if (resParseInfo) {\r\n                                        const resDict = yield ResourceDict.parseAsync(resParseInfo, { xform: XFormStream.parseAsync, image: ImageStream.parseAsync });\r\n                                        if (resDict) {\r\n                                            this.Resources = resDict.value;\r\n                                            i = resDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Resources value reference\");\r\n                            }\r\n                            else if (resEntryType === valueTypes.DICTIONARY) {\r\n                                const resDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (resDictBounds) {\r\n                                    if (resDictBounds.contentStart) {\r\n                                        const resDict = yield ResourceDict.parseAsync({\r\n                                            parser,\r\n                                            bounds: resDictBounds,\r\n                                            parseInfoGetterAsync: parseInfo.parseInfoGetterAsync,\r\n                                        }, { xform: XFormStream.parseAsync, image: ImageStream.parseAsync });\r\n                                        if (resDict) {\r\n                                            this.Resources = resDict.value;\r\n                                        }\r\n                                        else {\r\n                                            throw new Error(\"Can't parse /Resources value dictionary\");\r\n                                        }\r\n                                    }\r\n                                    i = resDictBounds.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /Resources dictionary bounds\");\r\n                            }\r\n                            throw new Error(`Unsupported /Resources property value type: ${resEntryType}`);\r\n                        case \"/Measure\":\r\n                            const measureEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (measureEntryType === valueTypes.REF) {\r\n                                const measureDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (measureDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const measureParseInfo = yield parseInfo.parseInfoGetterAsync(measureDictId.value.id);\r\n                                    if (measureParseInfo) {\r\n                                        const measureDict = yield MeasureDict.parseAsync(measureParseInfo);\r\n                                        if (measureDict) {\r\n                                            this.Measure = measureDict.value;\r\n                                            i = measureDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Measure value reference\");\r\n                            }\r\n                            else if (measureEntryType === valueTypes.DICTIONARY) {\r\n                                const measureDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (measureDictBounds) {\r\n                                    const measureDict = yield MeasureDict.parseAsync({ parser, bounds: measureDictBounds, cryptInfo: parseInfo.cryptInfo });\r\n                                    if (measureDict) {\r\n                                        this.Measure = measureDict.value;\r\n                                        i = measureDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Measure value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /Measure property value type: ${measureEntryType}`);\r\n                        case \"/Group\":\r\n                            const groupEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (groupEntryType === valueTypes.REF) {\r\n                                const groupDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (groupDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const groupParseInfo = yield parseInfo.parseInfoGetterAsync(groupDictId.value.id);\r\n                                    if (groupParseInfo) {\r\n                                        const groupDict = yield TransparencyGroupDict.parseAsync(groupParseInfo);\r\n                                        if (groupDict) {\r\n                                            this.Group = groupDict.value;\r\n                                            i = groupDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Group value reference\");\r\n                            }\r\n                            else if (groupEntryType === valueTypes.DICTIONARY) {\r\n                                const groupDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (groupDictBounds) {\r\n                                    const groupDict = yield TransparencyGroupDict.parseAsync({ parser, bounds: groupDictBounds, cryptInfo: parseInfo.cryptInfo });\r\n                                    if (groupDict) {\r\n                                        this.Group = groupDict.value;\r\n                                        i = groupDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Group value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /Group property value type: ${groupEntryType}`);\r\n                        case \"/OC\":\r\n                        case \"/OPI\":\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, dictBounds.contentEnd);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.BBox) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$W = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextData {\r\n    static buildAsync(text, options) {\r\n        return __awaiter$W(this, void 0, void 0, function* () {\r\n            let result;\r\n            if (text) {\r\n                const pTemp = document.createElement(\"p\");\r\n                pTemp.style.color = \"black\";\r\n                pTemp.style.fontSize = options.fontSize + \"px\";\r\n                pTemp.style.fontFamily = \"arial\";\r\n                pTemp.style.fontWeight = \"normal\";\r\n                pTemp.style.fontStyle = \"normal\";\r\n                pTemp.style.lineHeight = \"normal\";\r\n                pTemp.style.overflowWrap = \"normal\";\r\n                pTemp.style.textAlign = options.textAlign;\r\n                pTemp.style.textDecoration = \"none\";\r\n                pTemp.style.verticalAlign = \"top\";\r\n                pTemp.style.whiteSpace = \"pre-wrap\";\r\n                pTemp.style.wordBreak = \"normal\";\r\n                pTemp.style.position = \"fixed\";\r\n                pTemp.style.left = \"0\";\r\n                pTemp.style.top = \"0\";\r\n                pTemp.style.margin = \"0\";\r\n                pTemp.style.padding = \"0\";\r\n                pTemp.style.maxWidth = options.maxWidth.toFixed() + \"px\";\r\n                pTemp.style.visibility = \"hidden\";\r\n                pTemp.style.transform = \"scale(0.1)\";\r\n                pTemp.style.transformOrigin = \"top left\";\r\n                document.body.append(pTemp);\r\n                const words = text.split(/([- \\n\\r])/u);\r\n                const lines = [];\r\n                let currentLineText = \"\";\r\n                let previousHeight = 0;\r\n                for (let i = 0; i < words.length; i++) {\r\n                    const word = words[i];\r\n                    pTemp.textContent += word;\r\n                    yield ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.runEmptyTimeout();\r\n                    const currentHeight = pTemp.offsetHeight;\r\n                    previousHeight || (previousHeight = currentHeight);\r\n                    if (currentHeight > previousHeight) {\r\n                        lines.push(currentLineText);\r\n                        currentLineText = word;\r\n                        previousHeight = currentHeight;\r\n                    }\r\n                    else {\r\n                        currentLineText += word;\r\n                    }\r\n                }\r\n                lines.push(currentLineText);\r\n                pTemp.innerHTML = \"\";\r\n                const lineSpans = [];\r\n                for (const line of lines) {\r\n                    const lineSpan = document.createElement(\"span\");\r\n                    lineSpan.style.position = \"relative\";\r\n                    lineSpan.textContent = line;\r\n                    lineSpans.push(lineSpan);\r\n                    pTemp.append(lineSpan);\r\n                }\r\n                yield ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.runEmptyTimeout();\r\n                const textWidth = pTemp.offsetWidth;\r\n                const textHeight = pTemp.offsetHeight;\r\n                let pivotPoint;\r\n                switch (options.pivotPoint) {\r\n                    case \"top-left\":\r\n                        pivotPoint = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(0, textHeight);\r\n                        break;\r\n                    case \"bottom-margin\":\r\n                        pivotPoint = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(textWidth / 2, options.strokeWidth);\r\n                        break;\r\n                    case \"center\":\r\n                    default:\r\n                        pivotPoint = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(textWidth / 2, textHeight / 2);\r\n                        break;\r\n                }\r\n                const lineData = [];\r\n                for (let i = 0; i < lines.length; i++) {\r\n                    const span = lineSpans[i];\r\n                    const x = span.offsetLeft;\r\n                    const y = span.offsetTop;\r\n                    const width = span.offsetWidth;\r\n                    const height = span.offsetHeight;\r\n                    const lineBottomLeftPdf = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x, textHeight - (y + height));\r\n                    const lineTopRightPdf = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x + width, textHeight - y);\r\n                    const lineRect = [\r\n                        lineBottomLeftPdf.x, lineBottomLeftPdf.y,\r\n                        lineTopRightPdf.x, lineTopRightPdf.y\r\n                    ];\r\n                    const lineBottomLeftPdfRel = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(lineBottomLeftPdf, pivotPoint);\r\n                    const lineTopRightPdfRel = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(lineTopRightPdf, pivotPoint);\r\n                    const lineRelativeRect = [\r\n                        lineBottomLeftPdfRel.x, lineBottomLeftPdfRel.y,\r\n                        lineTopRightPdfRel.x, lineTopRightPdfRel.y\r\n                    ];\r\n                    lineData.push({\r\n                        text: lines[i],\r\n                        rect: lineRect,\r\n                        relativeRect: lineRelativeRect,\r\n                    });\r\n                }\r\n                const textRect = [0, 0, textWidth, textHeight];\r\n                const textRelativeRect = [\r\n                    0 - pivotPoint.x, 0 - pivotPoint.y,\r\n                    textWidth - pivotPoint.x, textHeight - pivotPoint.y\r\n                ];\r\n                const textData = {\r\n                    width: textWidth,\r\n                    height: textHeight,\r\n                    rect: textRect,\r\n                    relativeRect: textRelativeRect,\r\n                    lines: lineData,\r\n                };\r\n                pTemp.remove();\r\n                result = textData;\r\n            }\r\n            else {\r\n                result = null;\r\n            }\r\n            return result;\r\n        });\r\n    }\r\n}\n\nconst SELECTION_STROKE_WIDTH = 20;\r\nconst BEZIER_CONSTANT = 0.551915;\r\nconst LINE_END_MULTIPLIER = 3;\r\nconst LINE_END_MIN_SIZE = 10;\r\nfunction buildSquigglyLine(start, end, maxWaveSize) {\r\n    if (!start || !end) {\r\n        return null;\r\n    }\r\n    if (isNaN(maxWaveSize) || maxWaveSize <= 0) {\r\n        throw new Error(`Invalid maximal squiggle size ${maxWaveSize}`);\r\n    }\r\n    const lineLength = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(start, end).getMagnitude();\r\n    if (!lineLength) {\r\n        return null;\r\n    }\r\n    const resultPoints = [start.clone()];\r\n    const zeroVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n    const lengthVec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(lineLength, 0);\r\n    const matrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(zeroVec, lengthVec, start, end);\r\n    const waveCount = Math.ceil(lineLength / maxWaveSize);\r\n    const waveSize = lineLength / waveCount;\r\n    const halfWaveSize = waveSize / 2;\r\n    for (let i = 0; i < waveCount; i++) {\r\n        resultPoints.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(i * waveSize + halfWaveSize, -halfWaveSize).applyMat3(matrix).truncate(2), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2((i + 1) * waveSize, 0).applyMat3(matrix).truncate(2));\r\n    }\r\n    return resultPoints;\r\n}\r\nfunction calcPdfBBoxToRectMatrices(bBox, rect, matrix) {\r\n    const matAP = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3();\r\n    if (matrix) {\r\n        const [m0, m1, m3, m4, m6, m7] = matrix;\r\n        matAP.set(m0, m1, 0, m3, m4, 0, m6, m7, 1);\r\n    }\r\n    const bBoxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bBox[0], bBox[1]);\r\n    const bBoxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bBox[2], bBox[1]);\r\n    const bBoxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bBox[2], bBox[3]);\r\n    const bBoxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bBox[0], bBox[3]);\r\n    const { min: appBoxMin, max: appBoxMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxLL, matAP), mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxLR, matAP), mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxUR, matAP), mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(bBoxUL, matAP));\r\n    const rectMin = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(rect[0], rect[1]);\r\n    const rectMax = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(rect[2], rect[3]);\r\n    const matA = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(appBoxMin, appBoxMax, rectMin, rectMax);\r\n    const matAA = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.fromMat3(matAP).multiply(matA);\r\n    return { matAP, matA, matAA };\r\n}\n\nclass TextState {\r\n    constructor(params) {\r\n        Object.assign(this, TextState.defaultParams, params);\r\n    }\r\n    clone(params) {\r\n        const copy = new TextState(this);\r\n        if (params) {\r\n            return Object.assign(copy, params);\r\n        }\r\n        return copy;\r\n    }\r\n    setWordSpacing(value) {\r\n        this.wordSpacing = !value\r\n            ? \"normal\"\r\n            : value + \"px\";\r\n    }\r\n    setLetterSpacing(value) {\r\n        this.letterSpacing = !value\r\n            ? \"normal\"\r\n            : value + \"px\";\r\n    }\r\n    setScale(value) {\r\n        this.horizontalScale = !value\r\n            ? 1\r\n            : value / 100;\r\n    }\r\n    setLeading(value) {\r\n        if (value) {\r\n            this.leading = value;\r\n            this.lineHeight = Math.abs(this.leading) + \"px\";\r\n        }\r\n        else {\r\n            this.leading = parseInt(this.fontSize, 10) * -1.2;\r\n            this.lineHeight = \"1\";\r\n        }\r\n    }\r\n    setFontSize(value) {\r\n        this.fontSize = (value || 12) + \"px\";\r\n    }\r\n    setVerticalAlign(value) {\r\n        this.verticalAlign = !value\r\n            ? \"0\"\r\n            : value / 10 + \"em\";\r\n    }\r\n    moveAlongPx(value) {\r\n        const tx = value;\r\n        const transformationMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(1, 0, 0, 0, 1, 0, tx, 0, 1);\r\n        this.matrix = transformationMatrix.multiply(this.matrix);\r\n    }\r\n    moveAlongPdfUnits(value) {\r\n        const tx = (-value / 1000) * parseInt(this.fontSize, 10);\r\n        const transformationMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(1, 0, 0, 0, 1, 0, tx, 0, 1);\r\n        this.matrix = transformationMatrix.multiply(this.matrix);\r\n    }\r\n    nextLine(tx, ty) {\r\n        tx !== null && tx !== void 0 ? tx : (tx = 0);\r\n        ty !== null && ty !== void 0 ? ty : (ty = this.leading || parseInt(this.fontSize, 10) * -1.2);\r\n        const translationMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(1, 0, 0, 0, 1, 0, tx, ty, 1);\r\n        this.lineMatrix = translationMatrix.multiply(this.lineMatrix);\r\n        this.matrix = this.lineMatrix.clone();\r\n    }\r\n}\r\nTextState.defaultParams = {\r\n    matrix: new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3(),\r\n    lineMatrix: new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3(),\r\n    leading: 12 * -1.2,\r\n    renderMode: textRenderModes.FILL,\r\n    fontFamily: \"helvetica, arial, sans-serif\",\r\n    fontSize: \"10px\",\r\n    lineHeight: \"1\",\r\n    letterSpacing: \"normal\",\r\n    wordSpacing: \"normal\",\r\n    horizontalScale: 1,\r\n    verticalAlign: \"0\",\r\n    knockOut: true,\r\n};\n\nclass GraphicsState {\r\n    constructor(params) {\r\n        var _a, _b, _c, _d;\r\n        Object.assign(this, GraphicsState.defaultParams, params);\r\n        this.matrix = (_a = this.matrix) === null || _a === void 0 ? void 0 : _a.clone();\r\n        this.textState = (_b = this.textState) === null || _b === void 0 ? void 0 : _b.clone();\r\n        this.strokeColor = (_c = this.strokeColor) === null || _c === void 0 ? void 0 : _c.clone();\r\n        this.fillColor = (_d = this.fillColor) === null || _d === void 0 ? void 0 : _d.clone();\r\n    }\r\n    get stroke() {\r\n        const { x: r, y: g, z: b } = this.strokeColor;\r\n        const a = this.strokeAlpha;\r\n        return `rgba(${r},${g},${b},${a})`;\r\n    }\r\n    get fill() {\r\n        const { x: r, y: g, z: b } = this.fillColor;\r\n        const a = this.fillAlpha;\r\n        return `rgba(${r},${g},${b},${a})`;\r\n    }\r\n    clone(params) {\r\n        const copy = new GraphicsState(this);\r\n        if (params) {\r\n            return Object.assign(copy, params);\r\n        }\r\n        return copy;\r\n    }\r\n    setColor(type, ...params) {\r\n        let r, g, b;\r\n        switch (params.length) {\r\n            case 1:\r\n                r = g = b = params[0] * 255;\r\n                break;\r\n            case 3:\r\n                r = params[0] * 255;\r\n                g = params[1] * 255;\r\n                b = params[2] * 255;\r\n                break;\r\n            case 4:\r\n                const [c, m, y, k] = params;\r\n                r = 255 * (1 - c) * (1 - k);\r\n                g = 255 * (1 - m) * (1 - k);\r\n                b = 255 * (1 - y) * (1 - k);\r\n                break;\r\n        }\r\n        if (type === \"stroke\") {\r\n            this.strokeColor.set(r, g, b);\r\n        }\r\n        else {\r\n            this.fillColor.set(r, g, b);\r\n        }\r\n    }\r\n}\r\nGraphicsState.defaultParams = {\r\n    matrix: new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3(),\r\n    textState: new TextState(),\r\n    strokeColorSpace: \"rgb\",\r\n    strokeAlpha: 1,\r\n    strokeColor: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec3(),\r\n    fillColorSpace: \"rgb\",\r\n    fillAlpha: 1,\r\n    fillColor: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec3(),\r\n    strokeWidth: 1,\r\n    strokeMiterLimit: 10,\r\n    strokeLineCap: \"square\",\r\n    strokeLineJoin: \"miter\",\r\n};\n\nvar __awaiter$V = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass AppearanceStreamRenderer {\r\n    constructor(stream, rect, objectName) {\r\n        this._clipPaths = [];\r\n        this._selectionCopies = [];\r\n        this._graphicsStates = [];\r\n        if (!stream) {\r\n            throw new Error(\"Stream is not defined\");\r\n        }\r\n        this._stream = stream;\r\n        this._objectName = objectName;\r\n        const { matAA } = calcPdfBBoxToRectMatrices(stream.BBox, rect, stream.Matrix);\r\n        const [xMin, yMin, xMax, yMax] = stream.BBox;\r\n        const clipBottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMin, yMin).applyMat3(matAA);\r\n        const clipBottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMax, yMin).applyMat3(matAA);\r\n        const clipTopRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMax, yMax).applyMat3(matAA);\r\n        const clipTopLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMin, yMax).applyMat3(matAA);\r\n        const clipPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"clipPath\");\r\n        clipPath.id = `clip0_${objectName}`;\r\n        clipPath.innerHTML = \"<path d=\\\"\"\r\n            + `M${clipBottomLeft.x},${clipBottomLeft.y} `\r\n            + `L${clipBottomRight.x},${clipBottomRight.y} `\r\n            + `L${clipTopRight.x},${clipTopRight.y} `\r\n            + `L${clipTopLeft.x},${clipTopLeft.y} `\r\n            + \"z\"\r\n            + \"\\\"/>\";\r\n        this._clipPaths.push(clipPath);\r\n        this._graphicsStates.push(new GraphicsState({ matrix: matAA, clipPath }));\r\n    }\r\n    get state() {\r\n        return this._graphicsStates[this._graphicsStates.length - 1];\r\n    }\r\n    static parseNextCommandAsync(parser, i) {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            const parameters = [];\r\n            let operator;\r\n            command: while (!operator) {\r\n                const nextValueType = yield parser.getValueTypeAtAsync(i, true);\r\n                switch (nextValueType) {\r\n                    case valueTypes.NUMBER:\r\n                        const numberResult = yield parser.parseNumberAtAsync(i, true);\r\n                        parameters.push(numberResult.value);\r\n                        i = numberResult.end + 1;\r\n                        break;\r\n                    case valueTypes.NAME:\r\n                        const nameResult = yield parser.parseNameAtAsync(i, true);\r\n                        parameters.push(nameResult.value);\r\n                        i = nameResult.end + 1;\r\n                        break;\r\n                    case valueTypes.ARRAY:\r\n                        const arrayBounds = yield parser.getArrayBoundsAtAsync(i);\r\n                        let j = arrayBounds.start + 1;\r\n                        while (j < arrayBounds.end - 1 && j !== -1) {\r\n                            const nextArrayValueType = yield parser.getValueTypeAtAsync(j, true);\r\n                            switch (nextArrayValueType) {\r\n                                case valueTypes.STRING_LITERAL:\r\n                                    const arrayLiteralResult = yield LiteralString.parseAsync(parser, j);\r\n                                    parameters.push(arrayLiteralResult.value.bytes);\r\n                                    j = arrayLiteralResult.end + 1;\r\n                                    break;\r\n                                case valueTypes.NUMBER:\r\n                                    const arrayNumberResult = yield parser.parseNumberAtAsync(j, true);\r\n                                    parameters.push(arrayNumberResult.value);\r\n                                    j = arrayNumberResult.end + 1;\r\n                                    break;\r\n                                default:\r\n                                    console.log(`Unsupported value type in AP stream parameter array: ${nextArrayValueType}`);\r\n                                    j = yield parser.findDelimiterIndexAsync(true, j + 1);\r\n                                    break;\r\n                            }\r\n                        }\r\n                        i = arrayBounds.end + 1;\r\n                        break;\r\n                    case valueTypes.STRING_LITERAL:\r\n                        const literalResult = yield LiteralString.parseAsync(parser, i);\r\n                        parameters.push(literalResult.value.literal);\r\n                        i = literalResult.end + 1;\r\n                        break;\r\n                    case valueTypes.STRING_HEX:\r\n                        const hexResult = yield HexString.parseAsync(parser, i);\r\n                        parameters.push(hexResult.value.hex);\r\n                        i = hexResult.end + 1;\r\n                        break;\r\n                    case valueTypes.UNKNOWN:\r\n                        const operatorResult = yield parser.parseStringAtAsync(i);\r\n                        operator = operatorResult.value;\r\n                        i = operatorResult.end + 1;\r\n                        break command;\r\n                    default:\r\n                        throw new Error(`Invalid appearance stream value type: ${nextValueType}`);\r\n                }\r\n            }\r\n            return { nextIndex: i, parameters, operator };\r\n        });\r\n    }\r\n    renderAsync() {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            this.reset();\r\n            const elements = yield this.drawStreamAsync(this._stream);\r\n            return {\r\n                elements,\r\n                clipPaths: this._clipPaths.slice(),\r\n                pickHelpers: this._selectionCopies.slice(),\r\n            };\r\n        });\r\n    }\r\n    reset() {\r\n        this._graphicsStates.length = 1;\r\n        this._clipPaths.length = 1;\r\n        this._selectionCopies.length = 0;\r\n    }\r\n    pushState(params) {\r\n        const lastState = this._graphicsStates[this._graphicsStates.length - 1];\r\n        const newState = lastState.clone(params);\r\n        this._graphicsStates.push(newState);\r\n    }\r\n    popState() {\r\n        if (this._graphicsStates.length === 1) {\r\n            return null;\r\n        }\r\n        return this._graphicsStates.pop();\r\n    }\r\n    pushClipPath(clippingElement, nonzero) {\r\n        const lastCpIndex = this._clipPaths.length - 1;\r\n        const clipPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"clipPath\");\r\n        clipPath.setAttribute(\"clip-rule\", nonzero ? \"nonzero\" : \"evenodd\");\r\n        clipPath.setAttribute(\"clip-path\", `url(#${this._clipPaths[lastCpIndex]})`);\r\n        clipPath.id = `clip${lastCpIndex + 1}_${this._objectName}`;\r\n        clipPath.append(clippingElement);\r\n        this._clipPaths.push(clipPath);\r\n        this.state.clipPath = clipPath;\r\n    }\r\n    tryApplyingStateOperator(operator, parameters) {\r\n        switch (operator) {\r\n            case \"q\":\r\n                this.pushState();\r\n                break;\r\n            case \"Q\":\r\n                this.popState();\r\n                break;\r\n            case \"gs\":\r\n                const externalState = this._stream.Resources.getGraphicsState(`/ExtGState${parameters[0]}`);\r\n                if (!externalState) {\r\n                    throw new Error(\"External state specified in appearance stream not found\");\r\n                }\r\n                const params = externalState.toParams();\r\n                Object.assign(this.state, params);\r\n                break;\r\n            case \"cm\":\r\n                const [m0, m1, m3, m4, m6, m7] = parameters;\r\n                const matrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(m0, m1, 0, m3, m4, 0, m6, m7, 1);\r\n                this.state.matrix = matrix.multiply(this.state.matrix);\r\n                break;\r\n            case \"w\":\r\n                this.state.strokeWidth = +parameters[0] || 1;\r\n                break;\r\n            case \"J\":\r\n                switch (parameters[0]) {\r\n                    case lineCapStyles.ROUND:\r\n                        this.state.strokeLineCap = \"round\";\r\n                        break;\r\n                    case lineCapStyles.SQUARE:\r\n                        this.state.strokeLineCap = \"square\";\r\n                        break;\r\n                    case lineCapStyles.BUTT:\r\n                    default:\r\n                        this.state.strokeLineCap = \"butt\";\r\n                        break;\r\n                }\r\n                break;\r\n            case \"j\":\r\n                switch (parameters[0]) {\r\n                    case lineJoinStyles.BEVEL:\r\n                        this.state.strokeLineJoin = \"bevel\";\r\n                        break;\r\n                    case lineJoinStyles.ROUND:\r\n                        this.state.strokeLineJoin = \"round\";\r\n                        break;\r\n                    case lineJoinStyles.MITER:\r\n                    default:\r\n                        this.state.strokeLineJoin = \"miter\";\r\n                        break;\r\n                }\r\n                break;\r\n            case \"M\":\r\n                this.state.strokeMiterLimit = +parameters[0] || 10;\r\n                break;\r\n            case \"d\":\r\n                let a = 3;\r\n                let b = 0;\r\n                let c = 0;\r\n                if (parameters.length === 3) {\r\n                    a = +parameters[0];\r\n                    b = +parameters[1];\r\n                    c = +parameters[2];\r\n                }\r\n                else if (parameters.length === 2) {\r\n                    a = +parameters[0];\r\n                    c = +parameters[1];\r\n                }\r\n                else if (parameters.length === 1) {\r\n                    c = +parameters[0];\r\n                }\r\n                this.state.strokeDashArray = `${a} ${b}`;\r\n                this.state.strokeDashOffset = c;\r\n                break;\r\n            case \"CS\":\r\n                switch (parameters[0]) {\r\n                    case colorSpaces.GRAYSCALE:\r\n                        this.state.strokeColorSpace = \"grayscale\";\r\n                        break;\r\n                    case colorSpaces.RGB:\r\n                        this.state.strokeColorSpace = \"rgb\";\r\n                        break;\r\n                    case colorSpaces.CMYK:\r\n                        this.state.strokeColorSpace = \"cmyk\";\r\n                        break;\r\n                    default:\r\n                        throw new Error(\"Unsupported color space in appearance stream\");\r\n                }\r\n                break;\r\n            case \"cs\":\r\n                switch (parameters[0]) {\r\n                    case colorSpaces.GRAYSCALE:\r\n                        this.state.fillColorSpace = \"grayscale\";\r\n                        break;\r\n                    case colorSpaces.RGB:\r\n                        this.state.fillColorSpace = \"rgb\";\r\n                        break;\r\n                    case colorSpaces.CMYK:\r\n                        this.state.fillColorSpace = \"cmyk\";\r\n                        break;\r\n                    default:\r\n                        throw new Error(\"Unsupported color space in appearance stream\");\r\n                }\r\n                break;\r\n            case \"G\":\r\n                this.state.strokeColorSpace = \"grayscale\";\r\n                this.state.setColor(\"stroke\", ...parameters);\r\n                break;\r\n            case \"g\":\r\n                this.state.fillColorSpace = \"grayscale\";\r\n                this.state.setColor(\"fill\", ...parameters);\r\n                break;\r\n            case \"RG\":\r\n                this.state.strokeColorSpace = \"rgb\";\r\n                this.state.setColor(\"stroke\", ...parameters);\r\n                break;\r\n            case \"rg\":\r\n                this.state.fillColorSpace = \"rgb\";\r\n                this.state.setColor(\"fill\", ...parameters);\r\n                break;\r\n            case \"K\":\r\n                this.state.strokeColorSpace = \"cmyk\";\r\n                this.state.setColor(\"stroke\", ...parameters);\r\n                break;\r\n            case \"k\":\r\n                this.state.fillColorSpace = \"cmyk\";\r\n                this.state.setColor(\"fill\", ...parameters);\r\n                break;\r\n            case \"SC\":\r\n                this.state.setColor(\"stroke\", ...parameters);\r\n                break;\r\n            case \"cs\":\r\n                this.state.setColor(\"fill\", ...parameters);\r\n                break;\r\n            case \"ri\":\r\n            case \"i\":\r\n                break;\r\n            case \"Tc\":\r\n                this.state.textState.setLetterSpacing(+parameters[0]);\r\n                break;\r\n            case \"Tw\":\r\n                this.state.textState.setWordSpacing(+parameters[0]);\r\n                break;\r\n            case \"Tz\":\r\n                this.state.textState.setScale(+parameters[0]);\r\n                break;\r\n            case \"TL\":\r\n                this.state.textState.setLeading(+parameters[0]);\r\n                break;\r\n            case \"Tf\":\r\n                this.state.textState.customFontName = parameters[0] || \"\";\r\n                this.state.textState.setFontSize(+parameters[1]);\r\n                break;\r\n            case \"Tr\":\r\n                switch (parameters[0]) {\r\n                    case 0:\r\n                    default:\r\n                        this.state.textState.renderMode = textRenderModes.FILL;\r\n                        break;\r\n                    case 1:\r\n                        this.state.textState.renderMode = textRenderModes.STROKE;\r\n                        break;\r\n                    case 2:\r\n                        this.state.textState.renderMode = textRenderModes.FILL_STROKE;\r\n                        break;\r\n                    case 3:\r\n                        this.state.textState.renderMode = textRenderModes.INVISIBLE;\r\n                        break;\r\n                    case 4:\r\n                        this.state.textState.renderMode = textRenderModes.FILL_USE_AS_CLIP;\r\n                        break;\r\n                    case 5:\r\n                        this.state.textState.renderMode = textRenderModes.STROKE_USE_AS_CLIP;\r\n                        break;\r\n                    case 6:\r\n                        this.state.textState.renderMode = textRenderModes.FILL_STROKE_USE_AS_CLIP;\r\n                        break;\r\n                    case 7:\r\n                        this.state.textState.renderMode = textRenderModes.USE_AS_CLIP;\r\n                        break;\r\n                }\r\n                break;\r\n            case \"Ts\":\r\n                this.state.textState.setVerticalAlign(+parameters[0]);\r\n                break;\r\n            case \"Td\":\r\n                if (parameters.length > 1) {\r\n                    const [tx, ty] = parameters;\r\n                    this.state.textState.nextLine(tx, ty);\r\n                }\r\n                break;\r\n            case \"TD\":\r\n                if (parameters.length > 1) {\r\n                    const [tx, ty] = parameters;\r\n                    this.state.textState.setLeading(-ty);\r\n                    this.state.textState.nextLine(tx, ty);\r\n                }\r\n                break;\r\n            case \"Tm\":\r\n                if (parameters.length > 5) {\r\n                    const [tm0, tm1, tm3, tm4, tm6, tm7] = parameters;\r\n                    const transformationMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(tm0, tm1, 0, tm3, tm4, 0, tm6, tm7, 1);\r\n                    this.state.textState.matrix = transformationMatrix;\r\n                    this.state.textState.lineMatrix = transformationMatrix.clone();\r\n                }\r\n                break;\r\n            case \"T*\":\r\n                this.state.textState.nextLine();\r\n                break;\r\n            default:\r\n                return false;\r\n        }\r\n        return true;\r\n    }\r\n    setTextStateFont(fontDict) {\r\n        var _a;\r\n        const state = this.state.textState;\r\n        if (!fontDict) {\r\n            state.fontFamily = \"arial, sans-serif\";\r\n            return;\r\n        }\r\n        let fallbackFont;\r\n        if (fontDict.isMonospace) {\r\n            fallbackFont = \"courier, monospace\";\r\n        }\r\n        else if (fontDict.isScript) {\r\n            fallbackFont = \"cursive\";\r\n        }\r\n        else if (fontDict.isSerif) {\r\n            fallbackFont = \"times new roman, serif\";\r\n        }\r\n        else {\r\n            fallbackFont = \"arial, sans-serif\";\r\n        }\r\n        const baseFont = (_a = fontDict.BaseFont) === null || _a === void 0 ? void 0 : _a.substring(1).toLowerCase();\r\n        if (!baseFont) {\r\n            state.fontFamily = fallbackFont;\r\n            return;\r\n        }\r\n        if (baseFont.includes(\"times\")) {\r\n            state.fontFamily = \"times new roman, serif\";\r\n        }\r\n        else if (baseFont.includes(\"arial\")) {\r\n            state.fontFamily = \"arial, sans-serif\";\r\n        }\r\n        else if (baseFont.includes(\"courier\")) {\r\n            state.fontFamily = \"courier new, monospace\";\r\n        }\r\n        else {\r\n            state.fontFamily = `${baseFont}, ${fallbackFont}`;\r\n        }\r\n    }\r\n    decodeTextParam(textParam, fontDict) {\r\n        if (textParam instanceof Uint8Array) {\r\n            return fontDict.decodeText(textParam);\r\n        }\r\n        return textParam + \"\";\r\n    }\r\n    createSvgElement() {\r\n        const element = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n        return element;\r\n    }\r\n    drawPath(d, stroke, fill, close = false, evenOdd = false) {\r\n        if (close && d[d.length - 1] !== \"Z\") {\r\n            d += \" Z\";\r\n        }\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"transform\", `matrix(${this.state.matrix.toFloatShortArray().join(\" \")})`);\r\n        path.setAttribute(\"d\", d);\r\n        if (fill) {\r\n            path.setAttribute(\"fill\", this.state.fill);\r\n            path.setAttribute(\"fill-rule\", evenOdd ? \"evenodd\" : \"nonzero\");\r\n        }\r\n        else {\r\n            path.setAttribute(\"fill\", \"none\");\r\n        }\r\n        if (stroke) {\r\n            path.setAttribute(\"stroke\", this.state.stroke);\r\n            path.setAttribute(\"stroke-width\", this.state.strokeWidth + \"\");\r\n            path.setAttribute(\"stroke-miterlimit\", this.state.strokeMiterLimit + \"\");\r\n            path.setAttribute(\"stroke-linecap\", this.state.strokeLineCap);\r\n            path.setAttribute(\"stroke-linejoin\", this.state.strokeLineJoin);\r\n            if (this.state.strokeDashArray) {\r\n                path.setAttribute(\"stroke-dasharray\", this.state.strokeDashArray);\r\n            }\r\n            if (this.state.strokeDashOffset) {\r\n                path.setAttribute(\"stroke-dashoffset\", this.state.strokeDashOffset + \"\");\r\n            }\r\n        }\r\n        else {\r\n            path.setAttribute(\"stroke\", \"none\");\r\n        }\r\n        const svg = this.createSvgElement();\r\n        svg.setAttribute(\"clip-path\", `url(#${this._clipPaths[this._clipPaths.length - 1].id})`);\r\n        svg.append(path);\r\n        const clonedSvg = this.createSvgElement();\r\n        clonedSvg.classList.add(\"annotation-pick-helper\");\r\n        const clonedPath = path.cloneNode(true);\r\n        const clonedPathStrokeWidth = !stroke || this.state.strokeWidth < SELECTION_STROKE_WIDTH\r\n            ? SELECTION_STROKE_WIDTH\r\n            : this.state.strokeWidth;\r\n        clonedPath.setAttribute(\"stroke-width\", clonedPathStrokeWidth + \"\");\r\n        clonedPath.setAttribute(\"stroke\", \"transparent\");\r\n        clonedPath.setAttribute(\"fill\", fill ? \"transparent\" : \"none\");\r\n        clonedSvg.append(clonedPath);\r\n        this._selectionCopies.push(clonedPath);\r\n        return { element: svg, blendMode: this.state.mixBlendMode || \"normal\" };\r\n    }\r\n    drawImageAsync(imageStream) {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            const url = yield imageStream.getImageUrlAsync();\r\n            if (!url) {\r\n                throw new Error(\"Can't get image url from external image stream\");\r\n            }\r\n            const image = document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\r\n            image.onerror = e => {\r\n                console.log(`Loading external image stream failed: ${e}`);\r\n            };\r\n            image.setAttribute(\"href\", url);\r\n            image.setAttribute(\"width\", imageStream.Width + \"\");\r\n            image.setAttribute(\"height\", imageStream.Height + \"\");\r\n            const imageMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-imageStream.Width / 2, -imageStream.Height / 2)\r\n                .applyScaling(1, -1)\r\n                .applyTranslation(imageStream.Width / 2, imageStream.Height / 2)\r\n                .applyScaling(1 / imageStream.Width, 1 / imageStream.Height)\r\n                .multiply(this.state.matrix);\r\n            const imageMatrixString = imageMatrix.toFloatShortArray().join(\" \");\r\n            image.setAttribute(\"transform\", `matrix(${imageMatrixString})`);\r\n            const imageWrapper = this.createSvgElement();\r\n            imageWrapper.setAttribute(\"clip-path\", `url(#${this._clipPaths[this._clipPaths.length - 1].id})`);\r\n            imageWrapper.append(image);\r\n            const clonedSvg = this.createSvgElement();\r\n            clonedSvg.classList.add(\"annotation-pick-helper\");\r\n            const clonedRect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n            clonedRect.setAttribute(\"width\", imageStream.Width + \"\");\r\n            clonedRect.setAttribute(\"height\", imageStream.Height + \"\");\r\n            clonedRect.setAttribute(\"fill\", \"transparent\");\r\n            clonedRect.setAttribute(\"transform\", `matrix(${imageMatrixString})`);\r\n            clonedSvg.append(clonedRect);\r\n            this._selectionCopies.push(clonedRect);\r\n            return imageWrapper;\r\n        });\r\n    }\r\n    drawTextAsync(textParam, resources) {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            const textState = this.state.textState;\r\n            const fontDict = resources.getFont(textState.customFontName);\r\n            const text = this.decodeTextParam(textParam, fontDict);\r\n            this.setTextStateFont(fontDict);\r\n            if (!text) {\r\n                console.log(`Can't decode the stream text parameter: '${textParam}'`);\r\n                return null;\r\n            }\r\n            const svgText = document.createElementNS(\"http://www.w3.org/2000/svg\", \"text\");\r\n            svgText.setAttribute(\"transform\", `matrix(${new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyScaling(1, -1)\r\n                .applyScaling(textState.horizontalScale, 1)\r\n                .multiply(mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.multiply(textState.matrix, this.state.matrix))\r\n                .toFloatShortArray().join(\" \")})`);\r\n            svgText.setAttribute(\"x\", \"0\");\r\n            svgText.setAttribute(\"y\", \"0\");\r\n            svgText.textContent = text;\r\n            svgText.style.fontFamily = textState.fontFamily;\r\n            svgText.style.fontSize = textState.fontSize;\r\n            svgText.style.lineHeight = textState.lineHeight;\r\n            svgText.style.letterSpacing = textState.letterSpacing;\r\n            svgText.style.wordSpacing = textState.wordSpacing;\r\n            svgText.style.verticalAlign = textState.verticalAlign;\r\n            svgText.style.whiteSpace = \"pre\";\r\n            svgText.style.userSelect = \"none\";\r\n            let fill;\r\n            let stroke;\r\n            let clip;\r\n            switch (textState.renderMode) {\r\n                case textRenderModes.FILL:\r\n                default:\r\n                    fill = this.state.fill;\r\n                    break;\r\n                case textRenderModes.STROKE:\r\n                    stroke = true;\r\n                    break;\r\n                case textRenderModes.FILL_STROKE:\r\n                    fill = this.state.fill;\r\n                    stroke = true;\r\n                    break;\r\n                case textRenderModes.INVISIBLE:\r\n                    break;\r\n                case textRenderModes.FILL_USE_AS_CLIP:\r\n                    fill = this.state.fill;\r\n                    clip = true;\r\n                    break;\r\n                case textRenderModes.STROKE_USE_AS_CLIP:\r\n                    stroke = true;\r\n                    clip = true;\r\n                    break;\r\n                case textRenderModes.FILL_STROKE_USE_AS_CLIP:\r\n                    fill = this.state.fill;\r\n                    stroke = true;\r\n                    clip = true;\r\n                    break;\r\n                case textRenderModes.USE_AS_CLIP:\r\n                    fill = \"transparent\";\r\n                    clip = true;\r\n                    break;\r\n            }\r\n            svgText.style.fill = fill || \"none\";\r\n            if (stroke) {\r\n                svgText.style.stroke = this.state.stroke;\r\n                svgText.style.strokeWidth = this.state.strokeWidth + \"\";\r\n                svgText.style.strokeMiterlimit = this.state.strokeMiterLimit + \"\";\r\n                svgText.style.strokeLinecap = this.state.strokeLineCap;\r\n                svgText.style.strokeLinejoin = this.state.strokeLineJoin;\r\n                if (this.state.strokeDashArray) {\r\n                    svgText.style.strokeDasharray = this.state.strokeDashArray;\r\n                }\r\n                if (this.state.strokeDashOffset) {\r\n                    svgText.style.strokeDashoffset = this.state.strokeDashOffset + \"\";\r\n                }\r\n            }\r\n            else {\r\n                svgText.style.stroke = \"none\";\r\n            }\r\n            if (clip) {\r\n                this.pushClipPath(svgText.cloneNode(), true);\r\n            }\r\n            yield new Promise((resolve, reject) => {\r\n                const tempContainer = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n                tempContainer.classList.add(\"annotation-content-element\");\r\n                tempContainer.setAttribute(\"viewBox\", \"0 0 100 100\");\r\n                tempContainer.style.width = \"100px\";\r\n                tempContainer.style.height = \"100px\";\r\n                tempContainer.style.zIndex = \"-99\";\r\n                tempContainer.style.position = \"fixed\";\r\n                tempContainer.style.left = \"0\";\r\n                tempContainer.style.top = \"0\";\r\n                tempContainer.append(svgText);\r\n                document.body.append(tempContainer);\r\n                setTimeout(() => {\r\n                    const width = svgText.getBBox().width;\r\n                    this.state.textState.moveAlongPx(width);\r\n                    svgText.remove();\r\n                    tempContainer.remove();\r\n                    resolve(true);\r\n                }, 0);\r\n            });\r\n            const clonedSvg = this.createSvgElement();\r\n            clonedSvg.classList.add(\"annotation-pick-helper\");\r\n            const clonedPath = svgText.cloneNode(true);\r\n            const clonedPathStrokeWidth = !stroke || this.state.strokeWidth < SELECTION_STROKE_WIDTH\r\n                ? SELECTION_STROKE_WIDTH\r\n                : this.state.strokeWidth;\r\n            clonedPath.style.strokeWidth = clonedPathStrokeWidth + \"\";\r\n            clonedPath.style.stroke = \"transparent\";\r\n            clonedPath.style.fill = fill ? \"transparent\" : \"none\";\r\n            clonedSvg.append(clonedPath);\r\n            this._selectionCopies.push(clonedPath);\r\n            return { element: svgText, blendMode: this.state.mixBlendMode || \"normal\" };\r\n        });\r\n    }\r\n    drawTextGroupAsync(parser, resources) {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            const svgElements = [];\r\n            const textState = this.state.textState;\r\n            let i = 0;\r\n            while (i !== -1) {\r\n                const { nextIndex, parameters, operator } = yield AppearanceStreamRenderer.parseNextCommandAsync(parser, i);\r\n                i = yield parser.skipEmptyAsync(nextIndex);\r\n                switch (operator) {\r\n                    case \"Tj\":\r\n                        svgElements.push(yield this.drawTextAsync(parameters[0], resources));\r\n                        break;\r\n                    case \"'\":\r\n                        textState.nextLine();\r\n                        svgElements.push(yield this.drawTextAsync(parameters[0], resources));\r\n                        break;\r\n                    case \"\\\"\":\r\n                        const [a, b, c] = parameters;\r\n                        textState.setWordSpacing(+a);\r\n                        textState.setLetterSpacing(+b);\r\n                        textState.nextLine();\r\n                        svgElements.push(yield this.drawTextAsync(c, resources));\r\n                        break;\r\n                    case \"TJ\":\r\n                        for (const param of parameters) {\r\n                            if (param instanceof Uint8Array) {\r\n                                svgElements.push(yield this.drawTextAsync(param, resources));\r\n                            }\r\n                            else if (typeof param === \"number\") {\r\n                                if (+(param.toFixed(0))) {\r\n                                    textState.moveAlongPdfUnits(param);\r\n                                }\r\n                            }\r\n                        }\r\n                        break;\r\n                    default:\r\n                        const operatorIsGraphicState = this.tryApplyingStateOperator(operator, parameters);\r\n                        if (!operatorIsGraphicState) {\r\n                            throw new Error(`Unsupported appearance stream operator: ${operator}`);\r\n                        }\r\n                }\r\n            }\r\n            return svgElements.filter(x => x);\r\n        });\r\n    }\r\n    drawStreamAsync(stream) {\r\n        return __awaiter$V(this, void 0, void 0, function* () {\r\n            const parser = yield stream.getStreamDataParserAsync();\r\n            const svgElements = [];\r\n            const lastCoord = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            let lastOperator;\r\n            let d = \"\";\r\n            let i = 0;\r\n            while (i !== -1) {\r\n                const { nextIndex, parameters, operator } = yield AppearanceStreamRenderer.parseNextCommandAsync(parser, i);\r\n                i = yield parser.skipEmptyAsync(nextIndex + 1);\r\n                switch (operator) {\r\n                    case \"m\":\r\n                        const move = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        d += ` M ${move.x} ${move.y}`;\r\n                        lastCoord.setFromVec2(move);\r\n                        break;\r\n                    case \"l\":\r\n                        const line = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        d += ` L ${line.x} ${line.y}`;\r\n                        lastCoord.setFromVec2(line);\r\n                        break;\r\n                    case \"re\":\r\n                        const rMin = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        const rMax = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[2], +parameters[3]).add(rMin);\r\n                        d += ` M ${rMin.x} ${rMin.y} L ${rMax.x} ${rMin.y} L ${rMax.x} ${rMax.y} L ${rMin.x} ${rMax.y} L ${rMin.x} ${rMin.y}`;\r\n                        lastCoord.setFromVec2(rMin);\r\n                        break;\r\n                    case \"c\":\r\n                        const cControl1 = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        const cControl2 = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[2], +parameters[3]);\r\n                        const cEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[4], +parameters[5]);\r\n                        d += ` C ${cControl1.x} ${cControl1.y}, ${cControl2.x} ${cControl2.y}, ${cEnd.x} ${cEnd.y}`;\r\n                        lastCoord.setFromVec2(cEnd);\r\n                        break;\r\n                    case \"v\":\r\n                        const vControl2 = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        const vEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[2], +parameters[3]);\r\n                        d += ` C ${lastCoord.x} ${lastCoord.y}, ${vControl2.x} ${vControl2.y}, ${vEnd.x} ${vEnd.y}`;\r\n                        lastCoord.setFromVec2(vEnd);\r\n                        break;\r\n                    case \"y\":\r\n                        const yControl1 = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[0], +parameters[1]);\r\n                        const yEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(+parameters[2], +parameters[3]);\r\n                        d += ` C ${yControl1.x} ${yControl1.y}, ${yEnd.x} ${yEnd.y}, ${yEnd.x} ${yEnd.y}`;\r\n                        lastCoord.setFromVec2(yEnd);\r\n                        break;\r\n                    case \"h\":\r\n                        d += \" Z\";\r\n                        break;\r\n                    case \"S\":\r\n                        svgElements.push(this.drawPath(d, true, false));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"s\":\r\n                        svgElements.push(this.drawPath(d, true, false, true));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"F\":\r\n                    case \"f\":\r\n                        svgElements.push(this.drawPath(d, false, true, true));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"F*\":\r\n                    case \"f*\":\r\n                        svgElements.push(this.drawPath(d, false, true, true, true));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"B\":\r\n                        svgElements.push(this.drawPath(d, true, true, false, false));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"B*\":\r\n                        svgElements.push(this.drawPath(d, true, true, false, true));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"b\":\r\n                        svgElements.push(this.drawPath(d, true, true, true, false));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"b*\":\r\n                        svgElements.push(this.drawPath(d, true, true, true, true));\r\n                        d = \"\";\r\n                        break;\r\n                    case \"n\":\r\n                        if (lastOperator === \"W\" || lastOperator === \"W*\") {\r\n                            if (d[d.length - 1] !== \"Z\") {\r\n                                d += \" Z\";\r\n                            }\r\n                            const clippingPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n                            clippingPath.setAttribute(\"d\", d);\r\n                            this.pushClipPath(clippingPath, lastOperator === \"W\");\r\n                        }\r\n                        d = \"\";\r\n                        break;\r\n                    case \"W\":\r\n                        break;\r\n                    case \"W*\":\r\n                        break;\r\n                    case \"BT\":\r\n                        const textObjectEnd = yield parser.findSubarrayIndexAsync(keywordCodes.AP_STREAM_TEXT_END, {\r\n                            closedOnly: true,\r\n                            minIndex: i,\r\n                        });\r\n                        if (textObjectEnd) {\r\n                            const textParser = yield parser.getSubParserAsync(i, textObjectEnd.start - 1);\r\n                            const textGroup = yield this.drawTextGroupAsync(textParser, stream.Resources);\r\n                            svgElements.push(...textGroup);\r\n                            i = yield parser.skipEmptyAsync(textObjectEnd.end + 1);\r\n                            break;\r\n                        }\r\n                        throw new Error(\"Can't find the appearance stream text object end\");\r\n                    case \"Do\":\r\n                        const innerStream = stream.Resources.getXObject((`/XObject${parameters[0]}`));\r\n                        if (!innerStream) {\r\n                            throw new Error(`External object not found in the appearance stream resources: ${parameters[0]}`);\r\n                        }\r\n                        if (innerStream instanceof XFormStream) {\r\n                            const [im0, im1, im3, im4, im6, im7] = innerStream.Matrix;\r\n                            const innerMat = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().set(im0, im1, 0, im3, im4, 0, im6, im7, 1);\r\n                            this.pushState();\r\n                            this.state.matrix = innerMat.multiply(this.state.matrix);\r\n                            const innerStreamSvgElements = yield this.drawStreamAsync(innerStream);\r\n                            svgElements.push(...innerStreamSvgElements);\r\n                            this.popState();\r\n                        }\r\n                        else if (innerStream instanceof ImageStream) {\r\n                            const image = yield this.drawImageAsync(innerStream);\r\n                            svgElements.push({\r\n                                element: image,\r\n                                blendMode: this.state.mixBlendMode || \"normal\"\r\n                            });\r\n                        }\r\n                        else {\r\n                            throw new Error(`Unsupported appearance stream external object: ${parameters[0]}`);\r\n                        }\r\n                        break;\r\n                    default:\r\n                        const operatorIsGraphicState = this.tryApplyingStateOperator(operator, parameters);\r\n                        if (!operatorIsGraphicState) {\r\n                            throw new Error(`Unsupported appearance stream operator: ${operator}`);\r\n                        }\r\n                }\r\n                lastOperator = operator;\r\n            }\r\n            return svgElements;\r\n        });\r\n    }\r\n}\n\nvar __awaiter$U = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass BorderStyleDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.BORDER_STYLE);\r\n        this.W = 1;\r\n        this.S = borderStyles.SOLID;\r\n        this.D = [3, 0];\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$U(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new BorderStyleDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.W) {\r\n            bytes.push(...encoder.encode(\"/W \"), ...encoder.encode(\" \" + this.W));\r\n        }\r\n        if (this.S) {\r\n            bytes.push(...encoder.encode(\"/S \"), ...encoder.encode(this.S));\r\n        }\r\n        if (this.D) {\r\n            bytes.push(...encoder.encode(\"/D \"), ...this.encodePrimitiveArray(this.D, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a, _b;\r\n        return __awaiter$U(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/W\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/S\":\r\n                            const style = yield parser.parseNameAtAsync(i, true);\r\n                            if (style && Object.values(borderStyles).includes(style.value)) {\r\n                                this.S = style.value;\r\n                                i = style.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /S property value\");\r\n                            }\r\n                            break;\r\n                        case \"/D\":\r\n                            const dashGap = yield parser.parseNumberArrayAtAsync(i, true);\r\n                            if (dashGap) {\r\n                                this.D = [\r\n                                    (_a = dashGap.value[0]) !== null && _a !== void 0 ? _a : 3,\r\n                                    (_b = dashGap.value[1]) !== null && _b !== void 0 ? _b : 0,\r\n                                ];\r\n                                i = dashGap.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /D property value\");\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$T = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass AppearanceDict extends PdfDict {\r\n    constructor() {\r\n        super(null);\r\n        this._streamsMap = new Map();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$T(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new AppearanceDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    getStream(key) {\r\n        return this._streamsMap.get(key);\r\n    }\r\n    *getStreams() {\r\n        for (const pair of this._streamsMap) {\r\n            yield pair[1];\r\n        }\r\n        return;\r\n    }\r\n    setStream(key, stream) {\r\n        this._streamsMap.set(key, stream);\r\n        this._edited = true;\r\n    }\r\n    clearStreams() {\r\n        this._streamsMap.clear();\r\n        this._edited = true;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        const nStream = this._streamsMap.get(\"/N\");\r\n        if (nStream) {\r\n            bytes.push(...encoder.encode(\"/N \"));\r\n            bytes.push(...ObjectId.fromRef(nStream.ref).toArray(cryptInfo));\r\n        }\r\n        else if (this.N) {\r\n            bytes.push(...encoder.encode(\"/N \"));\r\n            if (this.N instanceof ObjectMapDict) {\r\n                bytes.push(...this.N.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...this.N.toArray(cryptInfo));\r\n            }\r\n        }\r\n        const rStream = this._streamsMap.get(\"/R\");\r\n        if (rStream) {\r\n            bytes.push(...encoder.encode(\"/R \"));\r\n            bytes.push(...ObjectId.fromRef(rStream.ref).toArray(cryptInfo));\r\n        }\r\n        else if (this.R) {\r\n            bytes.push(...encoder.encode(\"/R \"));\r\n            if (this.R instanceof ObjectMapDict) {\r\n                bytes.push(...this.R.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...this.R.toArray(cryptInfo));\r\n            }\r\n        }\r\n        const dStream = this._streamsMap.get(\"/D\");\r\n        if (dStream) {\r\n            bytes.push(...encoder.encode(\"/D \"));\r\n            bytes.push(...ObjectId.fromRef(dStream.ref).toArray(cryptInfo));\r\n        }\r\n        else if (this.D) {\r\n            bytes.push(...encoder.encode(\"/D \"));\r\n            if (this.D instanceof ObjectMapDict) {\r\n                bytes.push(...this.D.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...this.D.toArray(cryptInfo));\r\n            }\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    fillStreamsMapAsync(parseInfoGetterAsync) {\r\n        return __awaiter$T(this, void 0, void 0, function* () {\r\n            this._streamsMap.clear();\r\n            for (const prop of [\"N\", \"R\", \"D\"]) {\r\n                if (this[prop]) {\r\n                    if (this[prop] instanceof ObjectId) {\r\n                        const streamParseInfo = yield parseInfoGetterAsync(this[prop].id);\r\n                        if (!streamParseInfo) {\r\n                            continue;\r\n                        }\r\n                        const stream = yield XFormStream.parseAsync(streamParseInfo);\r\n                        if (!stream) {\r\n                            continue;\r\n                        }\r\n                        if (stream) {\r\n                            this._streamsMap.set(`/${prop}`, stream.value);\r\n                        }\r\n                    }\r\n                    else {\r\n                        for (const [name, objectId] of this[prop].getProps()) {\r\n                            const streamParseInfo = yield parseInfoGetterAsync(objectId.id);\r\n                            if (!streamParseInfo) {\r\n                                continue;\r\n                            }\r\n                            const stream = yield XFormStream.parseAsync(streamParseInfo);\r\n                            if (stream) {\r\n                                this._streamsMap.set(`/${prop}${name}`, stream.value);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$T(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/N\":\r\n                            const nEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (nEntryType === valueTypes.REF) {\r\n                                const nRefId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (nRefId) {\r\n                                    this.N = nRefId.value;\r\n                                    i = nRefId.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            else if (nEntryType === valueTypes.DICTIONARY) {\r\n                                const nDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (nDictBounds) {\r\n                                    const nSubDict = yield ObjectMapDict.parseAsync({ parser, bounds: nDictBounds });\r\n                                    if (nSubDict) {\r\n                                        this.N = nSubDict.value;\r\n                                        i = nSubDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported /N property value type: ${nEntryType}`);\r\n                            }\r\n                            throw new Error(\"Can't parse /N property value\");\r\n                        case \"/R\":\r\n                            const rEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (rEntryType === valueTypes.REF) {\r\n                                const rRefId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (rRefId) {\r\n                                    this.R = rRefId.value;\r\n                                    i = rRefId.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            else if (rEntryType === valueTypes.DICTIONARY) {\r\n                                const rDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (rDictBounds) {\r\n                                    const rSubDict = yield ObjectMapDict.parseAsync({ parser, bounds: rDictBounds });\r\n                                    if (rSubDict) {\r\n                                        this.R = rSubDict.value;\r\n                                        i = rSubDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported /R property value type: ${rEntryType}`);\r\n                            }\r\n                            throw new Error(\"Can't parse /R property value\");\r\n                        case \"/D\":\r\n                            const dEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (dEntryType === valueTypes.REF) {\r\n                                const dRefId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (dRefId) {\r\n                                    this.D = dRefId.value;\r\n                                    i = dRefId.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            else if (dEntryType === valueTypes.DICTIONARY) {\r\n                                const dDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (dDictBounds) {\r\n                                    const dSubDict = yield ObjectMapDict.parseAsync({ parser, bounds: dDictBounds });\r\n                                    if (dSubDict) {\r\n                                        this.D = dSubDict.value;\r\n                                        i = dSubDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(`Unsupported /D property value type: ${dEntryType}`);\r\n                            }\r\n                            throw new Error(\"Can't parse /D property value\");\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.N) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (parseInfo.parseInfoGetterAsync) {\r\n                yield this.fillStreamsMapAsync(parseInfo.parseInfoGetterAsync);\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$S = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass BorderEffectDict extends PdfDict {\r\n    constructor() {\r\n        super(null);\r\n        this.S = borderEffects.NONE;\r\n        this.L = 0;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$S(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new BorderEffectDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.S) {\r\n            bytes.push(...encoder.encode(\"/S \"), ...encoder.encode(this.S));\r\n        }\r\n        if (this.L) {\r\n            bytes.push(...encoder.encode(\"/L \"), ...encoder.encode(\" \" + this.L));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$S(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/S\":\r\n                            const style = yield parser.parseNameAtAsync(i, true);\r\n                            if (style && Object.values(borderEffects).includes(style.value)) {\r\n                                this.S = style.value;\r\n                                i = style.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /S property value\");\r\n                            }\r\n                            break;\r\n                        case \"/L\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$R = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass BorderArray {\r\n    constructor(hCornerR, vCornerR, width, dash, gap) {\r\n        this.hCornerR = hCornerR !== null && hCornerR !== void 0 ? hCornerR : 0;\r\n        this.vCornerR = vCornerR !== null && vCornerR !== void 0 ? vCornerR : 0;\r\n        this.width = width !== null && width !== void 0 ? width : 1;\r\n        this.dash = dash !== null && dash !== void 0 ? dash : 3;\r\n        this.gap = gap !== null && gap !== void 0 ? gap : 0;\r\n    }\r\n    static parseAsync(parser, start, skipEmpty = true) {\r\n        return __awaiter$R(this, void 0, void 0, function* () {\r\n            if (skipEmpty) {\r\n                start = yield parser.findNonSpaceIndexAsync(true, start);\r\n            }\r\n            if (start < 0 || start > parser.maxIndex\r\n                || !(yield parser.isCodeAtAsync(start, codes.L_BRACKET))) {\r\n                return null;\r\n            }\r\n            const hCornerR = yield parser.parseNumberAtAsync(start + 1);\r\n            if (!hCornerR || isNaN(hCornerR.value)) {\r\n                return null;\r\n            }\r\n            const vCornerR = yield parser.parseNumberAtAsync(hCornerR.end + 2);\r\n            if (!vCornerR || isNaN(vCornerR.value)) {\r\n                return null;\r\n            }\r\n            const width = yield parser.parseNumberAtAsync(vCornerR.end + 2);\r\n            if (!width || isNaN(width.value)) {\r\n                return null;\r\n            }\r\n            const next = yield parser.findNonSpaceIndexAsync(true, width.end + 1);\r\n            if (!next) {\r\n                return null;\r\n            }\r\n            else if (yield parser.isCodeAtAsync(next, codes.R_BRACKET)) {\r\n                return {\r\n                    value: new BorderArray(hCornerR.value, vCornerR.value, width.value),\r\n                    start,\r\n                    end: next,\r\n                };\r\n            }\r\n            else if (yield parser.isCodeAtAsync(next, codes.L_BRACKET)) {\r\n                const dash = yield parser.parseNumberAtAsync(next + 1);\r\n                if (!dash || isNaN(dash.value)) {\r\n                    return null;\r\n                }\r\n                const gap = yield parser.parseNumberAtAsync(dash.end + 2);\r\n                if (!gap || isNaN(gap.value)) {\r\n                    return null;\r\n                }\r\n                const dashEnd = yield parser.findNonSpaceIndexAsync(true, gap.end + 1);\r\n                if (!dashEnd || !(yield parser.isCodeAtAsync(dashEnd, codes.R_BRACKET))) {\r\n                    return null;\r\n                }\r\n                const arrayEnd = yield parser.findNonSpaceIndexAsync(true, dashEnd + 1);\r\n                if (!arrayEnd || !(yield parser.isCodeAtAsync(arrayEnd, codes.R_BRACKET))) {\r\n                    return null;\r\n                }\r\n                return {\r\n                    value: new BorderArray(hCornerR.value, vCornerR.value, width.value, dash.value, gap.value),\r\n                    start,\r\n                    end: arrayEnd,\r\n                };\r\n            }\r\n            return null;\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const source = this.dash && this.gap\r\n            ? `[${this.hCornerR} ${this.vCornerR} ${this.width}]`\r\n            : `[${this.hCornerR} ${this.vCornerR} ${this.width} [${this.dash} ${this.gap}]]`;\r\n        return new TextEncoder().encode(source);\r\n    }\r\n}\n\nvar __awaiter$Q = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass AnnotationDict extends PdfDict {\r\n    constructor(subType) {\r\n        super(dictTypes.ANNOTATION);\r\n        this.F = 4;\r\n        this.Border = new BorderArray(0, 0, 1);\r\n        this._currentAngle = 0;\r\n        this._tempTransformationMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3();\r\n        this._tempStartPoint = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        this._tempVecX = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        this._tempVecY = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        this._svgId = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid();\r\n        this.onSvgPointerEnter = (e) => {\r\n            if (this.$onPointerEnterAction) {\r\n                this.$onPointerEnterAction(e);\r\n            }\r\n        };\r\n        this.onSvgPointerLeave = (e) => {\r\n            if (this.$onPointerLeaveAction) {\r\n                this.$onPointerLeaveAction(e);\r\n            }\r\n        };\r\n        this.onSvgPointerDown = (e) => {\r\n            if (!this.$pageId) {\r\n                return;\r\n            }\r\n            if (this.$onPointerDownAction) {\r\n                this.$onPointerDownAction(e);\r\n            }\r\n            this.onTranslationPointerDown(e);\r\n        };\r\n        this.onTranslationPointerDown = (e) => {\r\n            if (!this.$translationEnabled || !e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onTranslationPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onTranslationPointerUp);\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._renderedControls.after(this._svgContentCopy);\r\n                this._tempStartPoint.setFromVec2(this.convertClientCoordsToPage(e.clientX, e.clientY));\r\n                target.addEventListener(\"pointermove\", this.onTranslationPointerMove);\r\n            }, 200);\r\n        };\r\n        this.onTranslationPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const current = this.convertClientCoordsToPage(e.clientX, e.clientY);\r\n            this._tempTransformationMatrix.reset()\r\n                .applyTranslation(current.x - this._tempStartPoint.x, current.y - this._tempStartPoint.y);\r\n            this._svgContentCopy.setAttribute(\"transform\", `matrix(${this._tempTransformationMatrix.toFloatShortArray().join(\" \")})`);\r\n            this._moved = true;\r\n        };\r\n        this.onTranslationPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onTranslationPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onTranslationPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onTranslationPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.applyTempTransformAsync();\r\n        };\r\n        this.onRotationHandlePointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onRotationHandlePointerUp);\r\n            target.addEventListener(\"pointerout\", this.onRotationHandlePointerUp);\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._renderedControls.after(this._svgContentCopy);\r\n                target.addEventListener(\"pointermove\", this.onRotationHandlePointerMove);\r\n            }, 200);\r\n            e.stopPropagation();\r\n        };\r\n        this.onRotationHandlePointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const centerX = (this.Rect[0] + this.Rect[2]) / 2;\r\n            const centerY = (this.Rect[1] + this.Rect[3]) / 2;\r\n            const clientCenter = this.convertPageCoordsToClient(centerX, centerY);\r\n            const currentRotation = this.getCurrentRotation();\r\n            const angle = Math.atan2(e.clientY - clientCenter.y, e.clientX - clientCenter.x) + Math.PI / 2 - currentRotation;\r\n            this._currentAngle = angle;\r\n            this._tempTransformationMatrix.reset()\r\n                .applyTranslation(-centerX, -centerY)\r\n                .applyRotation(angle)\r\n                .applyTranslation(centerX, centerY);\r\n            this._svgContentCopy.setAttribute(\"transform\", `matrix(${this._tempTransformationMatrix.toFloatShortArray().join(\" \")})`);\r\n            this._moved = true;\r\n        };\r\n        this.onRotationHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onRotationHandlePointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onRotationHandlePointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onRotationHandlePointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.applyTempTransformAsync();\r\n        };\r\n        this.onScaleHandlePointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onScaleHandlePointerUp);\r\n            target.addEventListener(\"pointerout\", this.onScaleHandlePointerUp);\r\n            const { ll, lr, ur, ul } = this.getLocalBB();\r\n            const handleName = target.dataset[\"handleName\"];\r\n            switch (handleName) {\r\n                case \"ll\":\r\n                    this._tempStartPoint.setFromVec2(ur);\r\n                    this._tempVecX.setFromVec2(ul).subtract(ur);\r\n                    this._tempVecY.setFromVec2(lr).subtract(ur);\r\n                    break;\r\n                case \"lr\":\r\n                    this._tempStartPoint.setFromVec2(ul);\r\n                    this._tempVecX.setFromVec2(ur).subtract(ul);\r\n                    this._tempVecY.setFromVec2(ll).subtract(ul);\r\n                    break;\r\n                case \"ur\":\r\n                    this._tempStartPoint.setFromVec2(ll);\r\n                    this._tempVecX.setFromVec2(lr).subtract(ll);\r\n                    this._tempVecY.setFromVec2(ul).subtract(ll);\r\n                    break;\r\n                case \"ul\":\r\n                    this._tempStartPoint.setFromVec2(lr);\r\n                    this._tempVecX.setFromVec2(ll).subtract(lr);\r\n                    this._tempVecY.setFromVec2(ur).subtract(lr);\r\n                    break;\r\n                default:\r\n                    throw new Error(`Invalid handle name: ${handleName}`);\r\n            }\r\n            this._tempX = this._tempVecX.getMagnitude();\r\n            this._tempY = this._tempVecY.getMagnitude();\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._renderedControls.after(this._svgContentCopy);\r\n                target.addEventListener(\"pointermove\", this.onScaleHandlePointerMove);\r\n            }, 200);\r\n            e.stopPropagation();\r\n        };\r\n        this.onScaleHandlePointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const currentBoxDiagonal = this.convertClientCoordsToPage(e.clientX, e.clientY)\r\n                .subtract(this._tempStartPoint);\r\n            const currentBoxDiagonalLength = currentBoxDiagonal.getMagnitude();\r\n            const cos = Math.abs(currentBoxDiagonal.dotProduct(this._tempVecX))\r\n                / currentBoxDiagonalLength / this._tempX;\r\n            const currentXSideLength = cos * currentBoxDiagonalLength;\r\n            const currentYSideLength = Math.sqrt(currentBoxDiagonalLength * currentBoxDiagonalLength\r\n                - currentXSideLength * currentXSideLength);\r\n            const scaleX = currentXSideLength / this._tempX;\r\n            const scaleY = currentYSideLength / this._tempY;\r\n            const annotCenterX = (this.Rect[0] + this.Rect[2]) / 2;\r\n            const annotCenterY = (this.Rect[1] + this.Rect[3]) / 2;\r\n            const currentRotation = this.getCurrentRotation();\r\n            this._tempTransformationMatrix.reset()\r\n                .applyTranslation(-annotCenterX, -annotCenterY)\r\n                .applyRotation(-currentRotation)\r\n                .applyScaling(scaleX, scaleY)\r\n                .applyRotation(currentRotation)\r\n                .applyTranslation(annotCenterX, annotCenterY);\r\n            const translation = this._tempStartPoint.clone().subtract(this._tempStartPoint.clone().applyMat3(this._tempTransformationMatrix));\r\n            this._tempTransformationMatrix.applyTranslation(translation.x, translation.y);\r\n            this._svgContentCopy.setAttribute(\"transform\", `matrix(${this._tempTransformationMatrix.toFloatShortArray().join(\" \")})`);\r\n            this._moved = true;\r\n        };\r\n        this.onScaleHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onScaleHandlePointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onScaleHandlePointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onScaleHandlePointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.applyTempTransformAsync();\r\n        };\r\n        this.Subtype = subType;\r\n    }\r\n    get apStream() {\r\n        var _a;\r\n        if (!this._apStream) {\r\n            const streams = (_a = this.AP) === null || _a === void 0 ? void 0 : _a.getStreams();\r\n            if (streams) {\r\n                this._apStream = [...streams][0];\r\n            }\r\n        }\r\n        return this._apStream;\r\n    }\r\n    set apStream(value) {\r\n        this._apStream = value;\r\n        this._edited = true;\r\n    }\r\n    get lastRenderResult() {\r\n        if (!this._renderedControls || !this._renderedContent) {\r\n            return null;\r\n        }\r\n        return {\r\n            controls: this._renderedControls,\r\n            content: this._renderedContent,\r\n        };\r\n    }\r\n    get strokeWidth() {\r\n        var _a, _b, _c, _d;\r\n        return (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.W) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 1;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Subtype) {\r\n            bytes.push(...encoder.encode(\"/Subtype \"), ...encoder.encode(this.Subtype));\r\n        }\r\n        if (this.Rect) {\r\n            bytes.push(...encoder.encode(\"/Rect \"), ...this.encodePrimitiveArray(this.Rect, encoder));\r\n        }\r\n        if (this.Contents) {\r\n            bytes.push(...encoder.encode(\"/Contents \"), ...this.Contents.toArray(cryptInfo));\r\n        }\r\n        if (this.P) {\r\n            bytes.push(...encoder.encode(\"/P \"), ...this.P.toArray(cryptInfo));\r\n        }\r\n        if (this.NM) {\r\n            bytes.push(...encoder.encode(\"/NM \"), ...this.NM.toArray(cryptInfo));\r\n        }\r\n        if (this.M) {\r\n            bytes.push(...encoder.encode(\"/M \"), ...this.M.toArray(cryptInfo));\r\n        }\r\n        if (this.F) {\r\n            bytes.push(...encoder.encode(\"/F \"), ...encoder.encode(\" \" + this.F));\r\n        }\r\n        if (this.AS) {\r\n            bytes.push(...encoder.encode(\"/AS \"), ...encoder.encode(this.AS));\r\n        }\r\n        if (this.Border) {\r\n            bytes.push(...encoder.encode(\"/Border \"), ...this.Border.toArray(cryptInfo));\r\n        }\r\n        if (this.BS) {\r\n            bytes.push(...encoder.encode(\"/BS \"), ...this.BS.toArray(cryptInfo));\r\n        }\r\n        if (this.BE) {\r\n            bytes.push(...encoder.encode(\"/BE \"), ...this.BE.toArray(cryptInfo));\r\n        }\r\n        if (this.C) {\r\n            bytes.push(...encoder.encode(\"/C \"), ...this.encodePrimitiveArray(this.C, encoder));\r\n        }\r\n        if (this.StructParent) {\r\n            bytes.push(...encoder.encode(\"/StructParent \"), ...encoder.encode(\" \" + this.StructParent));\r\n        }\r\n        if (this.apStream) {\r\n            if (!this.AP) {\r\n                this.AP = new AppearanceDict();\r\n            }\r\n            const apStreamRef = this.apStream.ref;\r\n            if (!apStreamRef) {\r\n                throw new Error(\"Appearance stream has no reference\");\r\n            }\r\n            this.AP.N = ObjectId.fromRef(apStreamRef);\r\n            this.AP.R = null;\r\n            this.AP.D = null;\r\n            this.AP.clearStreams();\r\n            this.AP.setStream(\"/N\", this.apStream);\r\n            bytes.push(...encoder.encode(\"/AP \"), ...this.AP.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    renderAsync(pageInfo) {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            if (!pageInfo) {\r\n                throw new Error(\"Can't render the annotation: view box is not defined\");\r\n            }\r\n            this._pageInfo = pageInfo;\r\n            if (!this._renderedControls) {\r\n                this._renderedControls = this.renderControls();\r\n            }\r\n            yield new Promise((resolve, reject) => {\r\n                setTimeout(() => __awaiter$Q(this, void 0, void 0, function* () {\r\n                    yield this.updateRenderAsync();\r\n                    resolve();\r\n                }), 0);\r\n            });\r\n            return this.lastRenderResult;\r\n        });\r\n    }\r\n    renderApStreamAsync() {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            const stream = this.apStream;\r\n            if (stream) {\r\n                try {\r\n                    const renderer = new AppearanceStreamRenderer(stream, this.Rect, this.$name);\r\n                    return yield renderer.renderAsync();\r\n                }\r\n                catch (e) {\r\n                    console.log(`Annotation stream render error: ${e.message}`);\r\n                }\r\n            }\r\n            return null;\r\n        });\r\n    }\r\n    moveToAsync(point) {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            const width = this.Rect[2] - this.Rect[0];\r\n            const height = this.Rect[3] - this.Rect[1];\r\n            const x = point.x - width / 2;\r\n            const y = point.y - height / 2;\r\n            const mat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.buildTranslate(x, y);\r\n            yield this.applyCommonTransformAsync(mat);\r\n        });\r\n    }\r\n    rotateByAsync(angle, center) {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            if (!center) {\r\n                const [x0, y0, x1, y1] = this.Rect;\r\n                center = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2((x0 + x1) / 2, (y0 + y1) / 2);\r\n            }\r\n            const mat = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-center.x, -center.y)\r\n                .applyRotation(angle)\r\n                .applyTranslation(center.x, center.y);\r\n            yield this.applyCommonTransformAsync(mat);\r\n        });\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e;\r\n        return {\r\n            annotationType: this.Type,\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_b = (_a = this[\"CreationDate\"]) === null || _a === void 0 ? void 0 : _a.date) === null || _b === void 0 ? void 0 : _b.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_c = this[\"T\"]) === null || _c === void 0 ? void 0 : _c.literal,\r\n            textContent: (_d = this.Contents) === null || _d === void 0 ? void 0 : _d.literal,\r\n            rect: this.Rect,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n        };\r\n    }\r\n    setTextContentAsync(text, undoable = true) {\r\n        var _a;\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            const oldText = (_a = dict.Contents) === null || _a === void 0 ? void 0 : _a.literal;\r\n            if (!text) {\r\n                dict.Contents = null;\r\n            }\r\n            else {\r\n                const literalString = LiteralString.fromString(text);\r\n                dict.Contents = literalString;\r\n            }\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$Q(this, void 0, void 0, function* () {\r\n                        yield dict.setTextContentAsync(oldText, false);\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a;\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Subtype\":\r\n                            const subtype = yield parser.parseNameAtAsync(i);\r\n                            if (subtype) {\r\n                                if (this.Subtype && this.Subtype !== subtype.value) {\r\n                                    throw new Error(`Invalid dict subtype: '${subtype.value}' instead of '${this.Subtype}'`);\r\n                                }\r\n                                i = subtype.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Subtype property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Rect\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/P\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Contents\":\r\n                        case \"/NM\":\r\n                            const contentsEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (contentsEntryType === valueTypes.STRING_LITERAL) {\r\n                                i = yield this.parseLiteralPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            }\r\n                            else if (contentsEntryType === valueTypes.STRING_HEX) {\r\n                                i = yield this.parseHexPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            }\r\n                            else {\r\n                                i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            }\r\n                            break;\r\n                        case \"/M\":\r\n                            const date = yield DateString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                            if (date) {\r\n                                this.M = date.value;\r\n                                i = date.end + 1;\r\n                                break;\r\n                            }\r\n                            else {\r\n                                const dateLiteral = yield LiteralString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (dateLiteral) {\r\n                                    this.M = dateLiteral.value;\r\n                                    i = dateLiteral.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(\"Can't parse /M property value\");\r\n                        case \"/C\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/F\":\r\n                        case \"/StructParent\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Border\":\r\n                            const borderArray = yield BorderArray.parseAsync(parser, i);\r\n                            if (borderArray) {\r\n                                this.Border = borderArray.value;\r\n                                i = borderArray.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Border property value\");\r\n                            }\r\n                            break;\r\n                        case \"/BS\":\r\n                            const bsEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (bsEntryType === valueTypes.REF) {\r\n                                const bsDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (bsDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const bsParseInfo = yield parseInfo.parseInfoGetterAsync(bsDictId.value.id);\r\n                                    if (bsParseInfo) {\r\n                                        const bsDict = yield BorderStyleDict.parseAsync(bsParseInfo);\r\n                                        if (bsDict) {\r\n                                            this.BS = bsDict.value;\r\n                                            i = bsDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /BS value reference\");\r\n                            }\r\n                            else if (bsEntryType === valueTypes.DICTIONARY) {\r\n                                const bsDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (bsDictBounds) {\r\n                                    const bsDict = yield BorderStyleDict.parseAsync({ parser, bounds: bsDictBounds });\r\n                                    if (bsDict) {\r\n                                        this.BS = bsDict.value;\r\n                                        i = bsDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /BS value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /BS property value type: ${bsEntryType}`);\r\n                        case \"/BE\":\r\n                            const beEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (beEntryType === valueTypes.REF) {\r\n                                const bsDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (bsDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const bsParseInfo = yield parseInfo.parseInfoGetterAsync(bsDictId.value.id);\r\n                                    if (bsParseInfo) {\r\n                                        const bsDict = yield BorderEffectDict.parseAsync(bsParseInfo);\r\n                                        if (bsDict) {\r\n                                            this.BE = bsDict.value;\r\n                                            i = bsDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /BE value reference\");\r\n                            }\r\n                            else if (beEntryType === valueTypes.DICTIONARY) {\r\n                                const bsDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (bsDictBounds) {\r\n                                    const bsDict = yield BorderEffectDict.parseAsync({ parser, bounds: bsDictBounds });\r\n                                    if (bsDict) {\r\n                                        this.BE = bsDict.value;\r\n                                        i = bsDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /BE value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /BE property value type: ${beEntryType}`);\r\n                        case \"/AP\":\r\n                            const apEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (apEntryType === valueTypes.REF) {\r\n                                const apDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (apDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const apParseInfo = yield parseInfo.parseInfoGetterAsync(apDictId.value.id);\r\n                                    if (apParseInfo) {\r\n                                        const apDict = yield AppearanceDict.parseAsync(apParseInfo);\r\n                                        if (apDict) {\r\n                                            this.AP = apDict.value;\r\n                                            i = apDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /AP value reference\");\r\n                            }\r\n                            else if (apEntryType === valueTypes.DICTIONARY) {\r\n                                const apDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (apDictBounds) {\r\n                                    const apDict = yield AppearanceDict.parseAsync({\r\n                                        parser,\r\n                                        bounds: apDictBounds,\r\n                                        parseInfoGetterAsync: parseInfo.parseInfoGetterAsync,\r\n                                    });\r\n                                    if (apDict) {\r\n                                        this.AP = apDict.value;\r\n                                        i = apDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /AP value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /AP property value type: ${apEntryType}`);\r\n                        case \"/AS\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/OC\":\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Subtype || !this.Rect) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            this.$name = ((_a = this.NM) === null || _a === void 0 ? void 0 : _a.literal) || ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid();\r\n        });\r\n    }\r\n    getColorString() {\r\n        var _a;\r\n        let colorString;\r\n        if (!((_a = this.C) === null || _a === void 0 ? void 0 : _a.length)) {\r\n            colorString = \"0 G 0 g\";\r\n        }\r\n        else if (this.C.length < 3) {\r\n            const g = this.C[0];\r\n            colorString = `${g} G ${g} g`;\r\n        }\r\n        else if (this.C.length === 3) {\r\n            const [r, g, b] = this.C;\r\n            colorString = `${r} ${g} ${b} RG ${r} ${g} ${b} rg`;\r\n        }\r\n        else {\r\n            const [c, m, y, k] = this.C;\r\n            colorString = `${c} ${m} ${y} ${k} K ${c} ${m} ${y} ${k} k`;\r\n        }\r\n        return colorString;\r\n    }\r\n    getCurrentRotation() {\r\n        var _a;\r\n        const matrix = (_a = this.apStream) === null || _a === void 0 ? void 0 : _a.matrix;\r\n        if (!matrix) {\r\n            return 0;\r\n        }\r\n        const { r } = matrix.getTRS();\r\n        return r;\r\n    }\r\n    getLocalBB() {\r\n        let bBoxLL;\r\n        let bBoxLR;\r\n        let bBoxUR;\r\n        let bBoxUL;\r\n        if (this._bBox) {\r\n            return this._bBox;\r\n        }\r\n        else if (this.apStream) {\r\n            const { ll: apTrBoxLL, lr: apTrBoxLR, ur: apTrBoxUR, ul: apTrBoxUL } = this.apStream.transformedBBox;\r\n            const { min: boxMin, max: boxMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(apTrBoxLL, apTrBoxLR, apTrBoxUR, apTrBoxUL);\r\n            const rectMin = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[0], this.Rect[1]);\r\n            const rectMax = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[2], this.Rect[3]);\r\n            const mat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(boxMin, boxMax, rectMin, rectMax, true);\r\n            bBoxLL = apTrBoxLL.applyMat3(mat);\r\n            bBoxLR = apTrBoxLR.applyMat3(mat);\r\n            bBoxUR = apTrBoxUR.applyMat3(mat);\r\n            bBoxUL = apTrBoxUL.applyMat3(mat);\r\n        }\r\n        else if (this.Rect) {\r\n            bBoxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[0], this.Rect[1]);\r\n            bBoxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[2], this.Rect[1]);\r\n            bBoxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[2], this.Rect[3]);\r\n            bBoxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.Rect[0], this.Rect[3]);\r\n        }\r\n        else {\r\n            bBoxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            bBoxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            bBoxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            bBoxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        }\r\n        this._bBox = {\r\n            ll: bBoxLL,\r\n            lr: bBoxLR,\r\n            ur: bBoxUR,\r\n            ul: bBoxUL,\r\n        };\r\n        return this._bBox;\r\n    }\r\n    convertClientCoordsToPage(clientX, clientY) {\r\n        if (!this._pageInfo) {\r\n            throw new Error(\"Can't get exact page coords without page info\");\r\n        }\r\n        const scale = this._pageInfo.scale;\r\n        const rotation = this._pageInfo.rotation;\r\n        const [annotPageXMin, annotPageYMin] = this.Rect;\r\n        const { x: annotClientXMin, y: annotClientYMin, width: annotClientHorLength, height: annotClientVertLength } = this._renderedBox.getBoundingClientRect();\r\n        const clientPageZero = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const pageResult = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        switch (rotation) {\r\n            case 0:\r\n                clientPageZero.set(annotClientXMin - annotPageXMin * scale, annotClientYMin + annotClientVertLength + annotPageYMin * scale);\r\n                pageResult.set((clientX - clientPageZero.x) / scale, (clientPageZero.y - clientY) / scale);\r\n                break;\r\n            case 90:\r\n                clientPageZero.set(annotClientXMin - annotPageYMin * scale, annotClientYMin - annotPageXMin * scale);\r\n                pageResult.set((clientY - clientPageZero.y) / scale, (clientX - clientPageZero.x) / scale);\r\n                break;\r\n            case 180:\r\n                clientPageZero.set(annotClientXMin + annotClientHorLength + annotPageXMin * scale, annotClientYMin - annotPageYMin * scale);\r\n                pageResult.set((clientPageZero.x - clientX) / scale, (clientY - clientPageZero.y) / scale);\r\n                break;\r\n            case 270:\r\n                clientPageZero.set(annotClientXMin + annotClientHorLength + annotPageYMin * scale, annotClientYMin + annotClientVertLength + annotPageXMin * scale);\r\n                pageResult.set((clientPageZero.y - clientY) / scale, (clientPageZero.x - clientX) / scale);\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid page rotation value: ${rotation}`);\r\n        }\r\n        return pageResult;\r\n    }\r\n    convertPageCoordsToClient(pageX, pageY) {\r\n        if (!this._pageInfo) {\r\n            throw new Error(\"Can't get exact page coords without page info\");\r\n        }\r\n        const scale = this._pageInfo.scale;\r\n        const rotation = this._pageInfo.rotation;\r\n        const [annotPageXMin, annotPageYMin] = this.Rect;\r\n        const { x: annotClientXMin, y: annotClientYMin, width: annotClientHorLength, height: annotClientVertLength } = this._renderedBox.getBoundingClientRect();\r\n        const clientPageZero = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const clientResult = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        switch (rotation) {\r\n            case 0:\r\n                clientPageZero.set(annotClientXMin - annotPageXMin * scale, annotClientYMin + annotClientVertLength + annotPageYMin * scale);\r\n                clientResult.set(pageX * scale + clientPageZero.x, clientPageZero.y - pageY * scale);\r\n                break;\r\n            case 90:\r\n                clientPageZero.set(annotClientXMin - annotPageYMin * scale, annotClientYMin - annotPageXMin * scale);\r\n                clientResult.set(pageY * scale + clientPageZero.x, pageX * scale + clientPageZero.y);\r\n                break;\r\n            case 180:\r\n                clientPageZero.set(annotClientXMin + annotClientHorLength + annotPageXMin * scale, annotClientYMin - annotPageYMin * scale);\r\n                clientResult.set(clientPageZero.x - pageX * scale, pageY * scale + clientPageZero.y);\r\n                break;\r\n            case 270:\r\n                clientPageZero.set(annotClientXMin + annotClientHorLength + annotPageYMin * scale, annotClientYMin + annotClientVertLength + annotPageXMin * scale);\r\n                clientResult.set(clientPageZero.x - pageY * scale, clientPageZero.y - pageX * scale);\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid page rotation value: ${rotation}`);\r\n        }\r\n        return clientResult;\r\n    }\r\n    applyRectTransform(matrix) {\r\n        const bBox = this.getLocalBB();\r\n        bBox.ll.applyMat3(matrix);\r\n        bBox.lr.applyMat3(matrix);\r\n        bBox.ur.applyMat3(matrix);\r\n        bBox.ul.applyMat3(matrix);\r\n        const { min: newRectMin, max: newRectMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(bBox.ll, bBox.lr, bBox.ur, bBox.ul);\r\n        this.Rect = [newRectMin.x, newRectMin.y, newRectMax.x, newRectMax.y];\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            dict.applyRectTransform(matrix);\r\n            const stream = dict.apStream;\r\n            if (stream) {\r\n                const newApMatrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.multiply(stream.matrix, matrix);\r\n                dict.apStream.matrix = newApMatrix;\r\n            }\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$Q(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    applyTempTransformAsync() {\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            if (this._transformationTimer) {\r\n                clearTimeout(this._transformationTimer);\r\n                this._transformationTimer = null;\r\n                return;\r\n            }\r\n            if (this._transformationPromise) {\r\n                yield this._transformationPromise;\r\n            }\r\n            this._transformationPromise = new Promise((resolve) => __awaiter$Q(this, void 0, void 0, function* () {\r\n                this._svgContentCopy.remove();\r\n                this._svgContentCopy.setAttribute(\"transform\", \"matrix(1 0 0 1 0 0)\");\r\n                if (this._moved) {\r\n                    yield this.applyCommonTransformAsync(this._tempTransformationMatrix);\r\n                    yield this.updateRenderAsync();\r\n                }\r\n                this._tempTransformationMatrix.reset();\r\n                resolve();\r\n            }));\r\n            yield this._transformationPromise;\r\n        });\r\n    }\r\n    renderAppearance() {\r\n        return null;\r\n    }\r\n    renderRect() {\r\n        const rect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n        rect.classList.add(\"annotation-rect\");\r\n        rect.setAttribute(\"data-annotation-name\", this.$name);\r\n        rect.setAttribute(\"x\", this.Rect[0] + \"\");\r\n        rect.setAttribute(\"y\", this.Rect[1] + \"\");\r\n        rect.setAttribute(\"width\", this.Rect[2] - this.Rect[0] + \"\");\r\n        rect.setAttribute(\"height\", this.Rect[3] - this.Rect[1] + \"\");\r\n        return rect;\r\n    }\r\n    renderBox() {\r\n        const { ll, lr, ur, ul } = this.getLocalBB();\r\n        const boxPath = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        boxPath.classList.add(\"annotation-bbox\");\r\n        boxPath.setAttribute(\"data-annotation-name\", this.$name);\r\n        boxPath.setAttribute(\"d\", `M ${ll.x} ${ll.y} L ${lr.x} ${lr.y} L ${ur.x} ${ur.y} L ${ul.x} ${ul.y} Z`);\r\n        return boxPath;\r\n    }\r\n    renderControls() {\r\n        const controlsGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n        controlsGroup.classList.add(\"annotation-controls\");\r\n        controlsGroup.setAttribute(\"data-annotation-name\", this.$name);\r\n        controlsGroup.addEventListener(\"pointerdown\", this.onSvgPointerDown);\r\n        controlsGroup.addEventListener(\"pointerenter\", this.onSvgPointerEnter);\r\n        controlsGroup.addEventListener(\"pointerleave\", this.onSvgPointerLeave);\r\n        return controlsGroup;\r\n    }\r\n    buildRenderedContentStructure(renderResult) {\r\n        var _a;\r\n        const content = document.createElement(\"div\");\r\n        content.id = this._svgId;\r\n        content.classList.add(\"annotation-content\");\r\n        content.setAttribute(\"data-annotation-name\", this.$name);\r\n        const { width, height } = this._pageInfo;\r\n        if ((_a = renderResult.clipPaths) === null || _a === void 0 ? void 0 : _a.length) {\r\n            const clipPathsContainer = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n            clipPathsContainer.append(...renderResult.clipPaths);\r\n            clipPathsContainer.setAttribute(\"viewBox\", `0 0 ${width} ${height}`);\r\n            clipPathsContainer.setAttribute(\"transform\", \"scale(1, -1)\");\r\n            content.append(clipPathsContainer);\r\n        }\r\n        renderResult.elements.forEach(x => {\r\n            const elementContainer = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n            elementContainer.classList.add(\"annotation-content-element\");\r\n            elementContainer.setAttribute(\"viewBox\", `0 0 ${width} ${height}`);\r\n            elementContainer.setAttribute(\"transform\", \"scale(1, -1)\");\r\n            elementContainer.style[\"mixBlendMode\"] = x.blendMode;\r\n            elementContainer.append(x.element);\r\n            content.append(elementContainer);\r\n        });\r\n        return content;\r\n    }\r\n    buildRenderContentCopy(contentRenderResult) {\r\n        const copy = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n        contentRenderResult.elements.forEach(x => {\r\n            copy.append(x.element.cloneNode(true));\r\n        });\r\n        copy.classList.add(\"annotation-temp-copy\");\r\n        return copy;\r\n    }\r\n    renderScaleHandles() {\r\n        const bBox = this.getLocalBB();\r\n        const handles = [];\r\n        [\"ll\", \"lr\", \"ur\", \"ul\"].forEach(x => {\r\n            const handle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n            handle.classList.add(\"annotation-handle\", \"scale\");\r\n            handle.setAttribute(\"data-handle-name\", x);\r\n            handle.setAttribute(\"x1\", bBox[x].x + \"\");\r\n            handle.setAttribute(\"y1\", bBox[x].y + \"\");\r\n            handle.setAttribute(\"x2\", bBox[x].x + \"\");\r\n            handle.setAttribute(\"y2\", bBox[x].y + 0.1 + \"\");\r\n            handle.addEventListener(\"pointerdown\", this.onScaleHandlePointerDown);\r\n            handles.push(handle);\r\n        });\r\n        return handles;\r\n    }\r\n    renderRotationHandle() {\r\n        const centerX = (this.Rect[0] + this.Rect[2]) / 2;\r\n        const centerY = (this.Rect[1] + this.Rect[3]) / 2;\r\n        const currentRotation = this.getCurrentRotation();\r\n        const rotationGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n        rotationGroup.classList.add(\"annotation-rotator\");\r\n        rotationGroup.setAttribute(\"data-handle-name\", \"center\");\r\n        const rotationGroupCircle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"circle\");\r\n        rotationGroupCircle.classList.add(\"circle\", \"dashed\");\r\n        rotationGroupCircle.setAttribute(\"cx\", centerX + \"\");\r\n        rotationGroupCircle.setAttribute(\"cy\", centerY + \"\");\r\n        const handleMatrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n            .applyTranslation(-centerX, -centerY + 35)\r\n            .applyRotation(currentRotation)\r\n            .applyTranslation(centerX, centerY);\r\n        const handleCenter = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(centerX, centerY).applyMat3(handleMatrix);\r\n        const rotationGroupLine = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n        rotationGroupLine.classList.add(\"dashed\");\r\n        rotationGroupLine.setAttribute(\"x1\", centerX + \"\");\r\n        rotationGroupLine.setAttribute(\"y1\", centerY + \"\");\r\n        rotationGroupLine.setAttribute(\"x2\", handleCenter.x + \"\");\r\n        rotationGroupLine.setAttribute(\"y2\", handleCenter.y + \"\");\r\n        const centerRectHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n        centerRectHandle.classList.add(\"annotation-handle\", \"rotation\");\r\n        centerRectHandle.setAttribute(\"data-handle-name\", \"center\");\r\n        centerRectHandle.setAttribute(\"x1\", handleCenter.x + \"\");\r\n        centerRectHandle.setAttribute(\"y1\", handleCenter.y + \"\");\r\n        centerRectHandle.setAttribute(\"x2\", handleCenter.x + \"\");\r\n        centerRectHandle.setAttribute(\"y2\", handleCenter.y + 0.1 + \"\");\r\n        centerRectHandle.addEventListener(\"pointerdown\", this.onRotationHandlePointerDown);\r\n        rotationGroup.append(rotationGroupCircle, rotationGroupLine, centerRectHandle);\r\n        return rotationGroup;\r\n    }\r\n    renderHandles() {\r\n        return [...this.renderScaleHandles(), this.renderRotationHandle()];\r\n    }\r\n    updateRenderAsync() {\r\n        var _a;\r\n        return __awaiter$Q(this, void 0, void 0, function* () {\r\n            if (!this._renderedControls) {\r\n                return;\r\n            }\r\n            this._renderedControls.innerHTML = \"\";\r\n            const contentRenderResult = this.renderAppearance() || (yield this.renderApStreamAsync());\r\n            if (!contentRenderResult || !((_a = contentRenderResult.elements) === null || _a === void 0 ? void 0 : _a.length)) {\r\n                this._renderedBox = null;\r\n                this._svgContentCopy = null;\r\n                return null;\r\n            }\r\n            const content = this.buildRenderedContentStructure(contentRenderResult);\r\n            this._renderedContent = content;\r\n            const rect = this.renderRect();\r\n            const box = this.renderBox();\r\n            const handles = this.renderHandles();\r\n            this._renderedBox = box;\r\n            this._renderedControls.append(rect, box, ...contentRenderResult.pickHelpers, ...handles);\r\n            const copy = this.buildRenderContentCopy(contentRenderResult);\r\n            this._svgContentCopy = copy;\r\n            if (this.$onRenderUpdatedAction) {\r\n                this.$onRenderUpdatedAction();\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$P = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass MarkupAnnotation extends AnnotationDict {\r\n    constructor(subType) {\r\n        super(subType);\r\n        this.RT = markupAnnotationReplyTypes.REPLY;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.T) {\r\n            bytes.push(...encoder.encode(\"/T \"), ...this.T.toArray(cryptInfo));\r\n        }\r\n        if (this.Popup) {\r\n            bytes.push(...encoder.encode(\"/Popup \"), ...this.Popup.toArray(cryptInfo));\r\n        }\r\n        if (this.RC) {\r\n            bytes.push(...encoder.encode(\"/RC \"), ...this.RC.toArray(cryptInfo));\r\n        }\r\n        if (this.CA) {\r\n            bytes.push(...encoder.encode(\"/CA \"), ...encoder.encode(\" \" + this.CA));\r\n        }\r\n        if (this.CreationDate) {\r\n            bytes.push(...encoder.encode(\"/CreationDate \"), ...this.CreationDate.toArray(cryptInfo));\r\n        }\r\n        if (this.Subj) {\r\n            bytes.push(...encoder.encode(\"/Subj \"), ...this.Subj.toArray(cryptInfo));\r\n        }\r\n        if (this.IRT) {\r\n            bytes.push(...encoder.encode(\"/IRT \"), ...this.IRT.toArray(cryptInfo));\r\n        }\r\n        if (this.RT) {\r\n            bytes.push(...encoder.encode(\"/RT \"), ...encoder.encode(this.RT));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$P(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/T\":\r\n                        case \"/Subj\":\r\n                            i = yield this.parseLiteralPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/Popup\":\r\n                        case \"/IRT\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/RC\":\r\n                            const rcEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (rcEntryType === valueTypes.REF) {\r\n                                const rsObjectId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (rsObjectId && parseInfo.parseInfoGetterAsync) {\r\n                                    const rcParseInfo = yield parseInfo.parseInfoGetterAsync(rsObjectId.value.id);\r\n                                    if (rcParseInfo) {\r\n                                        const rcObjectType = rcParseInfo.type\r\n                                            || rcParseInfo.parser.getValueTypeAtAsync(rcParseInfo.bounds.contentStart);\r\n                                        if (rcObjectType === valueTypes.STRING_LITERAL) {\r\n                                            const popupTextFromIndirectLiteral = yield LiteralString.parseAsync(rcParseInfo.parser, rcParseInfo.bounds.contentStart);\r\n                                            if (popupTextFromIndirectLiteral) {\r\n                                                this.RC = popupTextFromIndirectLiteral.value;\r\n                                                i = rsObjectId.end + 1;\r\n                                                break;\r\n                                            }\r\n                                        }\r\n                                        else if (rcObjectType === valueTypes.DICTIONARY) {\r\n                                            const popupTextStream = yield TextStream.parseAsync(rcParseInfo);\r\n                                            if (popupTextStream) {\r\n                                                const popupTextFromStream = popupTextStream.value.getText();\r\n                                                this.RC = LiteralString.fromString(popupTextFromStream);\r\n                                                i = rsObjectId.end + 1;\r\n                                                break;\r\n                                            }\r\n                                        }\r\n                                        else {\r\n                                            throw new Error(`Unsupported /RC property value type: ${rcObjectType}`);\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /RC value reference\");\r\n                            }\r\n                            else if (rcEntryType === valueTypes.STRING_LITERAL) {\r\n                                const popupTextFromLiteral = yield LiteralString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (popupTextFromLiteral) {\r\n                                    this.RC = popupTextFromLiteral.value;\r\n                                    i = popupTextFromLiteral.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /RC property value\");\r\n                            }\r\n                            throw new Error(`Unsupported /RC property value type: ${rcEntryType}`);\r\n                        case \"/CA\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/CreationDate\":\r\n                            i = yield this.parseDatePropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/RT\":\r\n                            const replyType = yield parser.parseNameAtAsync(i, true);\r\n                            if (replyType && Object.values(markupAnnotationReplyTypes)\r\n                                .includes(replyType.value)) {\r\n                                this.RT = replyType.value;\r\n                                i = replyType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /RT property value\");\r\n                            }\r\n                            break;\r\n                        case \"/ExData\":\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Subtype || !this.Rect) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n    getColorRect() {\r\n        let r = 0;\r\n        let g = 0;\r\n        let b = 0;\r\n        let a = 1;\r\n        if (this.C) {\r\n            if (this.C.length === 1) {\r\n                const gray = this.C[0];\r\n                r = g = b = gray;\r\n            }\r\n            else if (this.C.length === 3) {\r\n                [r, g, b] = this.C;\r\n            }\r\n            else if (this.C.length === 4) {\r\n                const [c, m, y, k] = this.C;\r\n                r = (1 - c) * (1 - k);\r\n                g = (1 - m) * (1 - k);\r\n                b = (1 - y) * (1 - k);\r\n            }\r\n        }\r\n        if (!isNaN(this.CA)) {\r\n            a = this.CA;\r\n        }\r\n        const color = [r, g, b, a];\r\n        return color;\r\n    }\r\n    updateTextDataAsync(options) {\r\n        var _a;\r\n        return __awaiter$P(this, void 0, void 0, function* () {\r\n            const text = (_a = this.Contents) === null || _a === void 0 ? void 0 : _a.literal;\r\n            const textData = yield TextData.buildAsync(text, options);\r\n            this._textData = textData;\r\n            return this._textData;\r\n        });\r\n    }\r\n    getLineEndingStreamPart(point, type, strokeWidth, side) {\r\n        const size = Math.max(strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n        let text = \"\";\r\n        switch (type) {\r\n            case lineEndingTypes.ARROW_OPEN:\r\n                if (side === \"left\") {\r\n                    text += `\\n${point.x + size} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x} ${point.y} l`;\r\n                    text += `\\n${point.x + size} ${point.y - size / 2} l`;\r\n                }\r\n                else {\r\n                    text += `\\n${point.x - size} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x} ${point.y} l`;\r\n                    text += `\\n${point.x - size} ${point.y - size / 2} l`;\r\n                }\r\n                text += \"\\nS\";\r\n                return text;\r\n            case lineEndingTypes.ARROW_OPEN_R:\r\n                if (side === \"left\") {\r\n                    text += `\\n${point.x} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x + size} ${point.y} l`;\r\n                    text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                }\r\n                else {\r\n                    text += `\\n${point.x} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x - size} ${point.y} l`;\r\n                    text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                }\r\n                text += \"\\nS\";\r\n                return text;\r\n            case lineEndingTypes.ARROW_CLOSED:\r\n                if (side === \"left\") {\r\n                    text += `\\n${point.x + size} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x} ${point.y} l`;\r\n                    text += `\\n${point.x + size} ${point.y - size / 2} l`;\r\n                }\r\n                else {\r\n                    text += `\\n${point.x - size} ${point.y + size / 2} m`;\r\n                    text += `\\n${point.x} ${point.y} l`;\r\n                    text += `\\n${point.x - size} ${point.y - size / 2} l`;\r\n                }\r\n                text += \"\\ns\";\r\n                return text;\r\n            case lineEndingTypes.ARROW_CLOSED_R:\r\n                if (side === \"left\") {\r\n                    text += `\\n${point.x + size} ${point.y} m`;\r\n                    text += `\\n${point.x} ${point.y + size / 2} l`;\r\n                    text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                }\r\n                else {\r\n                    text += `\\n${point.x - size} ${point.y} m`;\r\n                    text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                    text += `\\n${point.x} ${point.y + size / 2} l`;\r\n                }\r\n                text += \"\\ns\";\r\n                return text;\r\n            case lineEndingTypes.BUTT:\r\n                text += `\\n${point.x} ${point.y + size / 2} m`;\r\n                text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                text += \"\\nS\";\r\n                return text;\r\n            case lineEndingTypes.SLASH:\r\n                text += `\\n${point.x + size / 2} ${point.y + size / 2} m`;\r\n                text += `\\n${point.x - size / 2} ${point.y - size / 2} l`;\r\n                text += \"\\nS\";\r\n                return text;\r\n            case lineEndingTypes.DIAMOND:\r\n                text += `\\n${point.x} ${point.y + size / 2} m`;\r\n                text += `\\n${point.x + size / 2} ${point.y} l`;\r\n                text += `\\n${point.x} ${point.y - size / 2} l`;\r\n                text += `\\n${point.x - size / 2} ${point.y} l`;\r\n                text += \"\\ns\";\r\n                return text;\r\n            case lineEndingTypes.SQUARE:\r\n                text += `\\n${point.x - size / 2} ${point.y + size / 2} m`;\r\n                text += `\\n${point.x + size / 2} ${point.y + size / 2} l`;\r\n                text += `\\n${point.x + size / 2} ${point.y - size / 2} l`;\r\n                text += `\\n${point.x - size / 2} ${point.y - size / 2} l`;\r\n                text += \"\\ns\";\r\n                return text;\r\n            case lineEndingTypes.CIRCLE:\r\n                const c = BEZIER_CONSTANT;\r\n                const r = size / 2;\r\n                const cw = c * r;\r\n                const xmin = point.x - r;\r\n                const ymin = point.y - r;\r\n                const xmax = point.x + r;\r\n                const ymax = point.y + r;\r\n                text += `\\n${point.x} ${ymax} m`;\r\n                text += `\\n${point.x + cw} ${ymax} ${xmax} ${point.y + cw} ${xmax} ${point.y} c`;\r\n                text += `\\n${xmax} ${point.y - cw} ${point.x + cw} ${ymin} ${point.x} ${ymin} c`;\r\n                text += `\\n${point.x - cw} ${ymin} ${xmin} ${point.y - cw} ${xmin} ${point.y} c`;\r\n                text += `\\n${xmin} ${point.y + cw} ${point.x - cw} ${ymax} ${point.x} ${ymax} c`;\r\n                text += \"\\nS\";\r\n                return text;\r\n            case lineEndingTypes.NONE:\r\n            default:\r\n                return \"\";\r\n        }\r\n    }\r\n}\n\nclass DataUpdater {\r\n    constructor(sourceBytes, lastXref, referenceData, authResult) {\r\n        this._writtenIds = new Set();\r\n        this.writeImageXObject = (obj) => {\r\n            const sMask = obj.sMask;\r\n            if (this.isNew(sMask)) {\r\n                const newMaskRef = this.writeIndirectObject(sMask);\r\n                obj.SMask = ObjectId.fromRef(newMaskRef);\r\n            }\r\n            else if (sMask.edited) {\r\n                this.writeUpdatedIndirectObject(sMask);\r\n            }\r\n            if (this.isNew(obj)) {\r\n                return this.writeIndirectObject(obj);\r\n            }\r\n            else if (obj.edited) {\r\n                return this.writeUpdatedIndirectObject(obj);\r\n            }\r\n            else {\r\n                return {\r\n                    id: obj.id,\r\n                    generation: obj.generation,\r\n                    byteOffset: this._refData.getOffset(obj.id)\r\n                };\r\n            }\r\n        };\r\n        this._lastXref = lastXref;\r\n        this._refData = referenceData;\r\n        this._changeData = new ReferenceDataChange(referenceData);\r\n        this._writer = new DataWriter(sourceBytes);\r\n        this._stringCryptor = authResult === null || authResult === void 0 ? void 0 : authResult.stringCryptor;\r\n        this._streamCryptor = authResult === null || authResult === void 0 ? void 0 : authResult.streamCryptor;\r\n    }\r\n    getDataWithUpdatedAnnotations(data) {\r\n        for (const { page, supportedAnnotations: annotations, allAnnotationIds: refArray } of data) {\r\n            if (!(annotations === null || annotations === void 0 ? void 0 : annotations.length)) {\r\n                continue;\r\n            }\r\n            for (const annotation of annotations) {\r\n                if (annotation.deleted) {\r\n                    if (!annotation.ref) {\r\n                        continue;\r\n                    }\r\n                    const refIndex = refArray.findIndex(x => x.id === annotation.id);\r\n                    refArray.splice(refIndex, 1);\r\n                    this._changeData.setRefFree(annotation.id);\r\n                    if (annotation instanceof MarkupAnnotation && annotation.Popup) {\r\n                        this._changeData.setRefFree(annotation.Popup.id);\r\n                    }\r\n                }\r\n                else if (!annotation.ref || annotation.edited) {\r\n                    const apStream = annotation.apStream;\r\n                    if (apStream) {\r\n                        this.writeFormXObject(apStream);\r\n                    }\r\n                    if (this.isNew(annotation)) {\r\n                        const newAnnotRef = this.writeIndirectObject(annotation);\r\n                        refArray.push(ObjectId.fromRef(newAnnotRef));\r\n                    }\r\n                    else {\r\n                        this.writeUpdatedIndirectObject(annotation);\r\n                    }\r\n                }\r\n            }\r\n            if (page.Annots instanceof ObjectId\r\n                && this._changeData.isUsedInSource(page.Annots.id)) {\r\n                const annotsRef = {\r\n                    id: page.Annots.id,\r\n                    generation: page.Annots.generation,\r\n                    byteOffset: this._writer.offset\r\n                };\r\n                const annotsCryptInfo = {\r\n                    ref: annotsRef,\r\n                    streamCryptor: this._streamCryptor,\r\n                    stringCryptor: this._stringCryptor,\r\n                };\r\n                this._changeData.updateUsedRef(annotsRef);\r\n                this._writer.writeIndirectArray(annotsCryptInfo, refArray);\r\n            }\r\n            else {\r\n                const newAnnotsRef = this._changeData.takeFreeRef(this._writer.offset, true);\r\n                const annotsCryptInfo = {\r\n                    ref: newAnnotsRef,\r\n                    streamCryptor: this._streamCryptor,\r\n                    stringCryptor: this._stringCryptor,\r\n                };\r\n                this._writer.writeIndirectArray(annotsCryptInfo, refArray);\r\n                page.Annots = ObjectId.fromRef(newAnnotsRef);\r\n            }\r\n            this.writeUpdatedIndirectObject(page);\r\n        }\r\n        this.writeXref();\r\n        const bytes = this._writer.getCurrentData();\r\n        return bytes;\r\n    }\r\n    isNew(obj) {\r\n        return !obj.ref || !this._changeData.isUsedInSource(obj.id);\r\n    }\r\n    writeIndirectObject(obj) {\r\n        if (this._writtenIds.has(obj.id)) {\r\n            return this._changeData.getUsedRef(obj.id);\r\n        }\r\n        const newRef = this._changeData.takeFreeRef(this._writer.offset, true);\r\n        const newObjCryptInfo = {\r\n            ref: newRef,\r\n            streamCryptor: this._streamCryptor,\r\n            stringCryptor: this._stringCryptor,\r\n        };\r\n        this._writer.writeIndirectObject(newObjCryptInfo, obj);\r\n        obj.ref = newRef;\r\n        this._writtenIds.add(newRef.id);\r\n        return newRef;\r\n    }\r\n    writeUpdatedIndirectObject(obj) {\r\n        const objRef = {\r\n            id: obj.id,\r\n            generation: obj.generation,\r\n            byteOffset: this._writer.offset\r\n        };\r\n        const objCryptInfo = {\r\n            ref: objRef,\r\n            streamCryptor: this._streamCryptor,\r\n            stringCryptor: this._stringCryptor,\r\n        };\r\n        this._changeData.updateUsedRef(objRef);\r\n        this._writer.writeIndirectObject(objCryptInfo, obj);\r\n        return objRef;\r\n    }\r\n    writeFormXObject(obj) {\r\n        const resources = obj.Resources;\r\n        if (resources && resources.edited) {\r\n            [...resources.getXObjects()].forEach(([name, xObj]) => {\r\n                if (xObj instanceof ImageStream) {\r\n                    this.writeImageXObject(xObj);\r\n                }\r\n                else if (xObj instanceof XFormStream) {\r\n                    this.writeFormXObject(xObj);\r\n                }\r\n            });\r\n            [...resources.getFonts()].forEach(([name, font]) => {\r\n                if (font.encoding && this.isNew(font.encoding)) {\r\n                    this.writeIndirectObject(font.encoding);\r\n                }\r\n                if (font.descriptor && this.isNew(font.descriptor)) {\r\n                    this.writeIndirectObject(font.descriptor);\r\n                }\r\n                if (this.isNew(font)) {\r\n                    this.writeIndirectObject(font);\r\n                }\r\n                else if (font.edited) {\r\n                    this.writeUpdatedIndirectObject(font);\r\n                }\r\n            });\r\n        }\r\n        if (this.isNew(obj)) {\r\n            return this.writeIndirectObject(obj);\r\n        }\r\n        else if (obj.edited) {\r\n            return this.writeUpdatedIndirectObject(obj);\r\n        }\r\n        else {\r\n            return {\r\n                id: obj.id,\r\n                generation: obj.generation,\r\n                byteOffset: this._refData.getOffset(obj.id)\r\n            };\r\n        }\r\n    }\r\n    writeXref() {\r\n        const newXrefOffset = this._writer.offset;\r\n        const newXrefEntries = this._changeData.exportEntries();\r\n        const newXref = this._lastXref.createUpdate(newXrefEntries, newXrefOffset);\r\n        if (this._lastXref instanceof XRefStream) {\r\n            const newXrefRef = this._changeData.takeFreeRef(newXrefOffset, true);\r\n            this._writer.writeIndirectObject({ ref: newXrefRef }, newXref);\r\n        }\r\n        else {\r\n            this._writer.writeBytes(newXref.toArray());\r\n        }\r\n        this._writer.writeEof(newXrefOffset);\r\n        return newXrefOffset;\r\n    }\r\n}\n\nfunction bytesToWordArray(data) {\r\n    return crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].lib.WordArray.create(data);\r\n}\r\nfunction wordArrayToBytes(wordArray) {\r\n    return ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ArrayToBytes(wordArray.words).slice(0, wordArray.sigBytes);\r\n}\r\nfunction md5(data) {\r\n    if (data instanceof Uint8Array) {\r\n        data = bytesToWordArray(data);\r\n    }\r\n    const result = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].MD5(data);\r\n    return result;\r\n}\r\nfunction rc4(data, key) {\r\n    if (data instanceof Uint8Array) {\r\n        data = bytesToWordArray(data);\r\n    }\r\n    if (key instanceof Uint8Array) {\r\n        key = bytesToWordArray(key);\r\n    }\r\n    const result = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].RC4.encrypt(data, key).ciphertext;\r\n    return result;\r\n}\r\nfunction aes(data, key, decrypt = false) {\r\n    if (data instanceof Uint8Array) {\r\n        data = bytesToWordArray(data);\r\n    }\r\n    if (key instanceof Uint8Array) {\r\n        key = bytesToWordArray(key);\r\n    }\r\n    if (decrypt) {\r\n        const ivWordArray = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].lib.WordArray.create(data.words.slice(0, 4));\r\n        const d = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].algo.AES.createDecryptor(key, {\r\n            mode: crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].mode.CBC,\r\n            iv: ivWordArray,\r\n            padding: crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].pad.Pkcs7,\r\n        });\r\n        const result = d.finalize(data);\r\n        return result;\r\n    }\r\n    else {\r\n        const ivWordArray = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].lib.WordArray.random(16);\r\n        const e = crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].algo.AES.createEncryptor(key, {\r\n            mode: crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].mode.CBC,\r\n            iv: ivWordArray,\r\n            padding: crypto_es__WEBPACK_IMPORTED_MODULE_4__[\"default\"].pad.Pkcs7,\r\n        });\r\n        const result = e.finalize(data);\r\n        return result;\r\n    }\r\n}\n\nconst AESV2_KEY_PADDING = [\r\n    0x73, 0x41, 0x6C, 0x54,\r\n];\r\nclass AESV2DataCryptor {\r\n    constructor(key) {\r\n        if (!key) {\r\n            throw new Error(\"Empty key\");\r\n        }\r\n        if (key.length !== 16) {\r\n            throw new Error(`Invalid key length: ${key.length} (shall be 16)`);\r\n        }\r\n        this._n = key.length;\r\n        this._key = key;\r\n        this._tempKey = new Uint8Array(key.length + 9);\r\n    }\r\n    encrypt(data, ref) {\r\n        return this.run(data, ref.id, ref.generation);\r\n    }\r\n    decrypt(data, ref) {\r\n        return this.run(data, ref.id, ref.generation, true);\r\n    }\r\n    run(data, id, generation, decrypt = false) {\r\n        const idBytes = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(id, true);\r\n        const genBytes = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(generation, true);\r\n        this._tempKey.set(this._key, 0);\r\n        this._tempKey.set(idBytes.subarray(0, 3), this._n);\r\n        this._tempKey.set(genBytes.subarray(0, 2), this._n + 3);\r\n        this._tempKey.set(AESV2_KEY_PADDING, this._n + 5);\r\n        const hash = wordArrayToBytes(md5(this._tempKey));\r\n        const n = Math.min(this._n + 5, 16);\r\n        const key = hash.slice(0, n);\r\n        const result = wordArrayToBytes(aes(data, key, decrypt));\r\n        return decrypt\r\n            ? result.slice(16)\r\n            : result;\r\n    }\r\n}\n\nclass AESV3DataCryptor {\r\n    constructor(key) {\r\n        if (!key) {\r\n            throw new Error(\"Empty key\");\r\n        }\r\n        if (key.length !== 32) {\r\n            throw new Error(`Invalid key length: ${key.length} (shall be 32)`);\r\n        }\r\n        this._n = key.length;\r\n        this._key = key;\r\n    }\r\n    encrypt(data, ref) {\r\n        return this.run(data, ref.id, ref.generation);\r\n    }\r\n    decrypt(data, ref) {\r\n        return this.run(data, ref.id, ref.generation, true);\r\n    }\r\n    run(data, id, generation, decrypt = false) {\r\n        const result = wordArrayToBytes(aes(data, this._key, decrypt));\r\n        return decrypt\r\n            ? result.slice(16)\r\n            : result;\r\n    }\r\n}\n\nclass IdentityDataCryptor {\r\n    constructor() {\r\n    }\r\n    encrypt(data, ref) {\r\n        return data;\r\n    }\r\n    decrypt(data, ref) {\r\n        return data;\r\n    }\r\n}\n\nclass RC4DataCryptor {\r\n    constructor(key) {\r\n        if (!key) {\r\n            throw new Error(\"Empty key\");\r\n        }\r\n        if (key.length < 5 || key.length > 16) {\r\n            throw new Error(`Invalid key length: ${key.length} (shall be a multiple of 8 in the range from 40 to 128)`);\r\n        }\r\n        this._n = key.length;\r\n        this._key = key;\r\n        this._tempKey = new Uint8Array(key.length + 5);\r\n    }\r\n    encrypt(data, ref) {\r\n        const idBytes = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(ref.id, true);\r\n        const genBytes = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(ref.generation, true);\r\n        this._tempKey.set(this._key, 0);\r\n        this._tempKey.set(idBytes.slice(0, 3), this._n);\r\n        this._tempKey.set(genBytes.slice(0, 2), this._n + 3);\r\n        const hash = wordArrayToBytes(md5(this._tempKey));\r\n        const n = Math.min(this._n + 5, 16);\r\n        const key = hash.slice(0, n);\r\n        const encrypted = wordArrayToBytes(rc4(data, key));\r\n        return encrypted;\r\n    }\r\n    decrypt(data, ref) {\r\n        return this.encrypt(data, ref);\r\n    }\r\n}\n\nconst PASSWORD_32_PADDING = [\r\n    0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,\r\n    0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,\r\n    0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80,\r\n    0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A,\r\n];\r\nclass DataCryptHandler {\r\n    constructor(options, fileId) {\r\n        const { filter, version, revision, permissions, encryptMetadata, keyLength, stringKeyLength, streamKeyLength, stringMethod, streamMethod, oPasswordHash, uPasswordHash, oEncPasswordHash, uEncPasswordHash, perms } = options;\r\n        if (filter !== \"/Standard\") {\r\n            throw new Error(`Unsupported filter name: ${filter}`);\r\n        }\r\n        if (![1, 2, 4, 5].includes(version)) {\r\n            throw new Error(`Unsupported algorithm version: ${version}`);\r\n        }\r\n        if (![2, 3, 4, 5, 6].includes(revision)) {\r\n            throw new Error(`Unsupported algorithm revision: ${revision}`);\r\n        }\r\n        if (isNaN(permissions)) {\r\n            throw new Error(\"Permissions not provided\");\r\n        }\r\n        if (!oPasswordHash || !uPasswordHash) {\r\n            throw new Error(\"Password hash not provided\");\r\n        }\r\n        this._filter = filter;\r\n        this._version = version;\r\n        this._revision = revision;\r\n        this._permissions = permissions;\r\n        this._keyLength = keyLength;\r\n        this._encryptMetadata = encryptMetadata;\r\n        this._stringKeyLength = stringKeyLength;\r\n        this._streamKeyLength = streamKeyLength;\r\n        this._stringMethod = stringMethod;\r\n        this._streamMethod = streamMethod;\r\n        this._oPasswordHash = oPasswordHash;\r\n        this._uPasswordHash = uPasswordHash;\r\n        this._oEncPasswordHash = oEncPasswordHash;\r\n        this._uEncPasswordHash = uEncPasswordHash;\r\n        this._perms = perms;\r\n        this._fileId = fileId;\r\n    }\r\n    authenticate(password) {\r\n        const version = this._version;\r\n        const stringMethod = this._stringMethod;\r\n        const streamMethod = this._streamMethod;\r\n        let owner = false;\r\n        const ownerAuthenticated = this.authOwnerPassword(password);\r\n        if (ownerAuthenticated) {\r\n            owner = true;\r\n        }\r\n        else {\r\n            const userAuthenticated = this.authUserPassword(password);\r\n            if (!userAuthenticated) {\r\n                return null;\r\n            }\r\n        }\r\n        const key = this._lastEncryptionKey;\r\n        switch (version) {\r\n            case 1:\r\n                const rc4_40 = new RC4DataCryptor(key);\r\n                return {\r\n                    owner,\r\n                    stringCryptor: rc4_40,\r\n                    streamCryptor: rc4_40,\r\n                };\r\n            case 2:\r\n                const rc4_128 = new RC4DataCryptor(key);\r\n                return {\r\n                    owner,\r\n                    stringCryptor: rc4_128,\r\n                    streamCryptor: rc4_128,\r\n                };\r\n            case 4:\r\n                let v4stringCryptor;\r\n                if (!stringMethod || stringMethod === cryptMethods.NONE) {\r\n                    v4stringCryptor = new IdentityDataCryptor();\r\n                }\r\n                else if (stringMethod === cryptMethods.RC4) {\r\n                    v4stringCryptor = new RC4DataCryptor(key);\r\n                }\r\n                else if (stringMethod === cryptMethods.AES_128) {\r\n                    v4stringCryptor = new AESV2DataCryptor(key);\r\n                }\r\n                else {\r\n                    throw new Error(`Invalid crypt method: ${stringMethod}`);\r\n                }\r\n                let v4streamCryptor;\r\n                if (!streamMethod || streamMethod === cryptMethods.NONE) {\r\n                    v4streamCryptor = new IdentityDataCryptor();\r\n                }\r\n                else if (streamMethod === cryptMethods.RC4) {\r\n                    v4streamCryptor = new RC4DataCryptor(key);\r\n                }\r\n                else if (streamMethod === cryptMethods.AES_128) {\r\n                    v4streamCryptor = new AESV2DataCryptor(key);\r\n                }\r\n                else {\r\n                    throw new Error(`Invalid crypt method: ${streamMethod}`);\r\n                }\r\n                return {\r\n                    owner,\r\n                    stringCryptor: v4stringCryptor,\r\n                    streamCryptor: v4streamCryptor,\r\n                };\r\n            case 5:\r\n                let v5stringCryptor;\r\n                if (!stringMethod || stringMethod === cryptMethods.NONE) {\r\n                    v4stringCryptor = new IdentityDataCryptor();\r\n                }\r\n                else if (stringMethod === cryptMethods.AES_256) {\r\n                    v4stringCryptor = new AESV3DataCryptor(key);\r\n                }\r\n                else {\r\n                    throw new Error(`Invalid crypt method: ${stringMethod}`);\r\n                }\r\n                let v5streamCryptor;\r\n                if (!streamMethod || streamMethod === cryptMethods.NONE) {\r\n                    v4streamCryptor = new IdentityDataCryptor();\r\n                }\r\n                else if (streamMethod === cryptMethods.AES_256) {\r\n                    v4streamCryptor = new AESV3DataCryptor(key);\r\n                }\r\n                else {\r\n                    throw new Error(`Invalid crypt method: ${streamMethod}`);\r\n                }\r\n                return {\r\n                    owner,\r\n                    stringCryptor: v5stringCryptor,\r\n                    streamCryptor: v5streamCryptor,\r\n                };\r\n        }\r\n    }\r\n    padPassword32(password) {\r\n        if (!password) {\r\n            return new Uint8Array(PASSWORD_32_PADDING);\r\n        }\r\n        const bytes = new TextEncoder().encode(password);\r\n        const padded = new Uint8Array(32);\r\n        padded.set(bytes.slice(0, 32));\r\n        if (bytes.length < 32) {\r\n            padded.set(PASSWORD_32_PADDING.slice(0, 32 - bytes.length), bytes.length);\r\n        }\r\n        return padded;\r\n    }\r\n    computeEncryptionKey(password) {\r\n        if ([2, 3, 4].includes(this._revision)) {\r\n            const paddedPassword = this.padPassword32(password);\r\n            const permissionsLe = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.int32ToBytes(this._permissions, true);\r\n            const metadata = this._revision >= 4 && !this._encryptMetadata\r\n                ? new Uint8Array([255, 255, 255, 255])\r\n                : new Uint8Array(0);\r\n            const dataToHash = new Uint8Array([\r\n                ...paddedPassword,\r\n                ...this._oPasswordHash,\r\n                ...permissionsLe,\r\n                ...this._fileId,\r\n                ...metadata,\r\n            ]);\r\n            let hash = wordArrayToBytes(md5(dataToHash));\r\n            const keyLength = this._keyLength >> 3;\r\n            if (this._revision >= 3) {\r\n                for (let i = 0; i < 50; i++) {\r\n                    hash = wordArrayToBytes(md5(hash.slice(0, keyLength)));\r\n                }\r\n            }\r\n            const encryptionKey = hash.slice(0, keyLength);\r\n            this._lastEncryptionKey = encryptionKey;\r\n            return encryptionKey;\r\n        }\r\n        else if (this._revision === 5) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n        else if (this._revision === 6) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n    }\r\n    computeOHashEncryptionKey_R2R3R4(password) {\r\n        const paddedPassword = this.padPassword32(password);\r\n        let hash = md5(paddedPassword);\r\n        if (this._revision >= 3) {\r\n            for (let i = 0; i < 50; i++) {\r\n                hash = md5(hash);\r\n            }\r\n        }\r\n        const hashArray = wordArrayToBytes(hash);\r\n        const keyLength = this._keyLength >> 3;\r\n        return hashArray.slice(0, keyLength);\r\n    }\r\n    computeOHash_R2R3R4(oPassword, uPassword) {\r\n        const key = this.computeOHashEncryptionKey_R2R3R4(oPassword || uPassword);\r\n        const paddedUPassword = this.padPassword32(uPassword);\r\n        let hash = rc4(paddedUPassword, key);\r\n        if (this._revision >= 3) {\r\n            for (let i = 1; i < 20; i++) {\r\n                hash = rc4(hash, ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.xorBytes(key, i));\r\n            }\r\n        }\r\n        return wordArrayToBytes(hash);\r\n    }\r\n    computeUHash_R2(password) {\r\n        const key = this.computeEncryptionKey(password);\r\n        const padding = new Uint8Array(PASSWORD_32_PADDING);\r\n        const u = wordArrayToBytes(rc4(padding, key));\r\n        return u;\r\n    }\r\n    computeUHash_R3R4(password) {\r\n        const key = this.computeEncryptionKey(password);\r\n        const dataToHash = new Uint8Array([\r\n            ...PASSWORD_32_PADDING,\r\n            ...this._fileId,\r\n        ]);\r\n        let hash = md5(dataToHash);\r\n        hash = rc4(hash, key);\r\n        for (let i = 1; i < 20; i++) {\r\n            hash = rc4(hash, ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.xorBytes(key, i));\r\n        }\r\n        return wordArrayToBytes(hash);\r\n    }\r\n    authOwnerPassword(password) {\r\n        if ([2, 3, 4].includes(this._revision)) {\r\n            const ownerEncryptionKey = this.computeOHashEncryptionKey_R2R3R4(password);\r\n            let userPasswordPadded;\r\n            if (this._revision === 2) {\r\n                userPasswordPadded = wordArrayToBytes(rc4(this._oPasswordHash, ownerEncryptionKey));\r\n            }\r\n            else {\r\n                let hash = bytesToWordArray(this._oPasswordHash);\r\n                for (let i = 19; i >= 0; i--) {\r\n                    hash = rc4(hash, ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.xorBytes(ownerEncryptionKey, i));\r\n                }\r\n                userPasswordPadded = wordArrayToBytes(hash);\r\n            }\r\n            const j = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.findSubarrayIndex(userPasswordPadded, new Uint8Array(PASSWORD_32_PADDING));\r\n            const userPassword = new TextDecoder().decode(j === -1\r\n                ? userPasswordPadded\r\n                : userPasswordPadded.subarray(0, j));\r\n            return this.authUserPassword(userPassword);\r\n        }\r\n        else if (this._revision === 5) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n        else if (this._revision === 6) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n    }\r\n    authUserPassword(password) {\r\n        let u;\r\n        if (this._revision === 2) {\r\n            u = this.computeUHash_R2(password);\r\n            return ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.arraysEqual(this._uPasswordHash, u);\r\n        }\r\n        else if (this._revision === 3 || this._revision === 4) {\r\n            u = this.computeUHash_R3R4(password);\r\n            return ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ByteUtils.arraysEqual(this._uPasswordHash.subarray(0, 16), u);\r\n        }\r\n        else if (this._revision === 5) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n        else if (this._revision === 6) {\r\n            throw new Error(\"Not implemented yet\");\r\n        }\r\n    }\r\n}\n\nvar __awaiter$O = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ObjectStream extends PdfStream {\r\n    constructor() {\r\n        super(streamTypes.OBJECT_STREAM);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$O(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new ObjectStream();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    getObjectDataAsync(id) {\r\n        return __awaiter$O(this, void 0, void 0, function* () {\r\n            if (!this._streamData || !this.N || !this.First) {\r\n                return null;\r\n            }\r\n            const parser = yield this.getStreamDataParserAsync();\r\n            const offsetMap = new Map();\r\n            let temp;\r\n            let objectId;\r\n            let byteOffset;\r\n            let position = 0;\r\n            for (let n = 0; n < this.N; n++) {\r\n                temp = yield parser.parseNumberAtAsync(position, false, false);\r\n                objectId = temp.value;\r\n                position = temp.end + 2;\r\n                temp = yield parser.parseNumberAtAsync(position, false, false);\r\n                byteOffset = temp.value;\r\n                position = temp.end + 2;\r\n                offsetMap.set(objectId, byteOffset);\r\n            }\r\n            if (!offsetMap.has(id)) {\r\n                return null;\r\n            }\r\n            const objectStart = this.First + offsetMap.get(id);\r\n            const objectType = yield parser.getValueTypeAtAsync(objectStart);\r\n            if (objectType === null) {\r\n                return;\r\n            }\r\n            let bounds;\r\n            let value;\r\n            switch (objectType) {\r\n                case objectTypes.DICTIONARY:\r\n                    bounds = yield parser.getDictBoundsAtAsync(objectStart, false);\r\n                    break;\r\n                case objectTypes.ARRAY:\r\n                    bounds = yield parser.getArrayBoundsAtAsync(objectStart, false);\r\n                    break;\r\n                case objectTypes.STRING_LITERAL:\r\n                    const literalValue = yield LiteralString.parseAsync(parser, objectStart);\r\n                    if (literalValue) {\r\n                        bounds = { start: literalValue.start, end: literalValue.end };\r\n                        value = literalValue;\r\n                    }\r\n                    break;\r\n                case objectTypes.STRING_HEX:\r\n                    const hexValue = yield HexString.parseAsync(parser, objectStart);\r\n                    if (hexValue) {\r\n                        bounds = { start: hexValue.start, end: hexValue.end };\r\n                        value = hexValue;\r\n                    }\r\n                    break;\r\n                case objectTypes.NUMBER:\r\n                    const numValue = yield parser.parseNumberAtAsync(objectStart);\r\n                    if (numValue) {\r\n                        bounds = { start: numValue.start, end: numValue.end };\r\n                        value = numValue;\r\n                    }\r\n                    break;\r\n            }\r\n            if (!bounds) {\r\n                return null;\r\n            }\r\n            const bytes = yield parser.sliceCharCodesAsync(bounds.start, bounds.end);\r\n            if (!bytes.length) {\r\n                throw new Error(\"Object byte array is empty\");\r\n            }\r\n            return {\r\n                parser: yield PdfStream.getDataParserAsync(bytes),\r\n                bounds: {\r\n                    start: 0,\r\n                    end: bytes.length - 1,\r\n                    contentStart: bounds.contentStart\r\n                        ? bounds.contentStart - bounds.start\r\n                        : undefined,\r\n                    contentEnd: bounds.contentEnd\r\n                        ? bytes.length - 1 - (bounds.end - bounds.contentEnd)\r\n                        : undefined,\r\n                },\r\n                type: objectType,\r\n                value,\r\n                cryptInfo: { ref: { id, generation: 0 } },\r\n                streamId: this.id,\r\n            };\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.N) {\r\n            bytes.push(...encoder.encode(\"/N \"), ...encoder.encode(\" \" + this.N));\r\n        }\r\n        if (this.First) {\r\n            bytes.push(...encoder.encode(\"/First \"), ...encoder.encode(\" \" + this.First));\r\n        }\r\n        if (this.Extends) {\r\n            bytes.push(...encoder.encode(\"/Extends \"), ...this.Extends.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$O(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const dictBounds = yield parser.getDictBoundsAtAsync(start);\r\n            let i = yield parser.skipToNextNameAsync(dictBounds.contentStart, dictBounds.contentEnd);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/N\":\r\n                        case \"/First\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Extends\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, dictBounds.contentEnd);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$N = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass CryptFilterDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.CRYPT_FILTER);\r\n        this.CFM = cryptMethods.NONE;\r\n        this.AuthEvent = authEvents.DOC_OPEN;\r\n        this.Length = 40;\r\n        this.EncryptMetadata = true;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$N(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new CryptFilterDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.CFM) {\r\n            bytes.push(...encoder.encode(\"/CFM \"), ...encoder.encode(this.CFM));\r\n        }\r\n        if (this.AuthEvent) {\r\n            bytes.push(...encoder.encode(\"/AuthEvent \"), ...encoder.encode(this.AuthEvent));\r\n        }\r\n        if (this.Length) {\r\n            bytes.push(...encoder.encode(\"/Length \"), ...encoder.encode(\" \" + this.Length));\r\n        }\r\n        if (this.EncryptMetadata) {\r\n            bytes.push(...encoder.encode(\"/EncryptMetadata \"), ...encoder.encode(\" \" + this.EncryptMetadata));\r\n        }\r\n        if (this.Recipients) {\r\n            if (this.Recipients instanceof HexString) {\r\n                bytes.push(...encoder.encode(\"/Recipients \"), ...this.Recipients.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Recipients \"), ...this.encodeSerializableArray(this.Recipients, cryptInfo));\r\n            }\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$N(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/CFM\":\r\n                            const method = yield parser.parseNameAtAsync(i, true);\r\n                            if (method && Object.values(cryptMethods)\r\n                                .includes(method.value)) {\r\n                                this.CFM = method.value;\r\n                                i = method.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /CFM property value\");\r\n                            }\r\n                            break;\r\n                        case \"/AuthEvent\":\r\n                            const authEvent = yield parser.parseNameAtAsync(i, true);\r\n                            if (authEvent && Object.values(authEvents)\r\n                                .includes(authEvent.value)) {\r\n                                this.AuthEvent = authEvent.value;\r\n                                i = authEvent.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /AuthEvent property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Length\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/EncryptMetadata\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Recipients\":\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.STRING_HEX) {\r\n                                const recipient = yield HexString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (recipient) {\r\n                                    this.Recipients = recipient.value;\r\n                                    i = recipient.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Recipients property value\");\r\n                                }\r\n                            }\r\n                            else if (entryType === valueTypes.ARRAY) {\r\n                                const recipients = yield HexString.parseArrayAsync(parser, i);\r\n                                if (recipients) {\r\n                                    this.Recipients = recipients.value;\r\n                                    i = recipients.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Recipients property value\");\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /Filter property value type: ${entryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$M = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass CryptMapDict extends PdfDict {\r\n    constructor() {\r\n        super(null);\r\n        this._filtersMap = new Map();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$M(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new CryptMapDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    getProp(name) {\r\n        return this._filtersMap.get(name);\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this._filtersMap.size) {\r\n            this._filtersMap.forEach((v, k) => bytes.push(...encoder.encode(k), ...v.toArray(cryptInfo)));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$M(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        default:\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.DICTIONARY) {\r\n                                const dictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (dictBounds) {\r\n                                    const filter = yield CryptFilterDict.parseAsync({ parser, bounds: dictBounds });\r\n                                    if (filter) {\r\n                                        this._filtersMap.set(name, filter.value);\r\n                                        i = filter.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                            }\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$L = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass EncryptionDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.EMPTY);\r\n        this.Filter = \"/Standard\";\r\n        this.Length = 40;\r\n        this.StmF = \"/Identity\";\r\n        this.StrF = \"/Identity\";\r\n        this.EncryptMetadata = true;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$L(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new EncryptionDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Filter) {\r\n            bytes.push(...encoder.encode(\"/Filter \"), ...encoder.encode(this.Filter));\r\n        }\r\n        if (this.SubFilter) {\r\n            bytes.push(...encoder.encode(\"/SubFilter \"), ...encoder.encode(this.SubFilter));\r\n        }\r\n        if (this.V) {\r\n            bytes.push(...encoder.encode(\"/V \"), ...encoder.encode(\" \" + this.V));\r\n        }\r\n        if (this.Length) {\r\n            bytes.push(...encoder.encode(\"/Length \"), ...encoder.encode(\" \" + this.Length));\r\n        }\r\n        if (this.CF) {\r\n            bytes.push(...encoder.encode(\"/CF \"), ...this.CF.toArray(cryptInfo));\r\n        }\r\n        if (this.StmF) {\r\n            bytes.push(...encoder.encode(\"/StmF \"), ...encoder.encode(this.StmF));\r\n        }\r\n        if (this.StrF) {\r\n            bytes.push(...encoder.encode(\"/StrF \"), ...encoder.encode(this.StrF));\r\n        }\r\n        if (this.EFF) {\r\n            bytes.push(...encoder.encode(\"/EFF \"), ...encoder.encode(this.EFF));\r\n        }\r\n        if (this.R) {\r\n            bytes.push(...encoder.encode(\"/R \"), ...encoder.encode(\" \" + this.R));\r\n        }\r\n        if (this.O) {\r\n            bytes.push(...encoder.encode(\"/O \"), ...this.O.toArray(cryptInfo));\r\n        }\r\n        if (this.U) {\r\n            bytes.push(...encoder.encode(\"/U \"), ...this.U.toArray(cryptInfo));\r\n        }\r\n        if (this.OE) {\r\n            bytes.push(...encoder.encode(\"/OE \"), ...this.OE.toArray(cryptInfo));\r\n        }\r\n        if (this.UE) {\r\n            bytes.push(...encoder.encode(\"/UE \"), ...this.UE.toArray(cryptInfo));\r\n        }\r\n        if (this.P) {\r\n            bytes.push(...encoder.encode(\"/P \"), ...encoder.encode(\" \" + this.P));\r\n        }\r\n        if (this.Perms) {\r\n            bytes.push(...encoder.encode(\"/Perms \"), ...this.Perms.toArray(cryptInfo));\r\n        }\r\n        if (this.U) {\r\n            bytes.push(...encoder.encode(\"/U \"), ...this.U.toArray(cryptInfo));\r\n        }\r\n        if (this.EncryptMetadata) {\r\n            bytes.push(...encoder.encode(\"/EncryptMetadata \"), ...encoder.encode(\" \" + this.EncryptMetadata));\r\n        }\r\n        if (this.Recipients) {\r\n            if (this.Recipients instanceof HexString) {\r\n                bytes.push(...encoder.encode(\"/Recipients \"), ...this.Recipients.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Recipients \"), ...this.encodeSerializableArray(this.Recipients, cryptInfo));\r\n            }\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toCryptOptions() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!this.V) {\r\n            return null;\r\n        }\r\n        return {\r\n            filter: this.Filter,\r\n            version: this.V,\r\n            revision: this.R,\r\n            permissions: this.P,\r\n            keyLength: this.Length,\r\n            encryptMetadata: this.EncryptMetadata,\r\n            stringKeyLength: (_a = this.stringFilter) === null || _a === void 0 ? void 0 : _a.Length,\r\n            streamKeyLength: (_b = this.streamFilter) === null || _b === void 0 ? void 0 : _b.Length,\r\n            stringMethod: (_c = this.stringFilter) === null || _c === void 0 ? void 0 : _c.CFM,\r\n            streamMethod: (_d = this.streamFilter) === null || _d === void 0 ? void 0 : _d.CFM,\r\n            oPasswordHash: (_e = this.O) === null || _e === void 0 ? void 0 : _e.bytes,\r\n            uPasswordHash: (_f = this.U) === null || _f === void 0 ? void 0 : _f.bytes,\r\n            oEncPasswordHash: (_g = this.OE) === null || _g === void 0 ? void 0 : _g.bytes,\r\n            uEncPasswordHash: (_h = this.UE) === null || _h === void 0 ? void 0 : _h.bytes,\r\n            perms: (_j = this.Perms) === null || _j === void 0 ? void 0 : _j.bytes,\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a, _b;\r\n        return __awaiter$L(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Filter\":\r\n                        case \"/SubFilter\":\r\n                        case \"/StmF\":\r\n                        case \"/StrF\":\r\n                        case \"/EFF\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/V\":\r\n                            const algorithm = yield parser.parseNumberAtAsync(i, false);\r\n                            if (algorithm && Object.values(cryptVersions)\r\n                                .includes(algorithm.value)) {\r\n                                this.V = algorithm.value;\r\n                                i = algorithm.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /V property value\");\r\n                            }\r\n                            break;\r\n                        case \"/R\":\r\n                            const revision = yield parser.parseNumberAtAsync(i, false);\r\n                            if (revision && Object.values(cryptRevisions)\r\n                                .includes(revision.value)) {\r\n                                this.R = revision.value;\r\n                                i = revision.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /R property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Length\":\r\n                        case \"/P\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/O\":\r\n                        case \"/U\":\r\n                        case \"/OE\":\r\n                        case \"/UE\":\r\n                        case \"/Perms\":\r\n                            i = yield this.parseLiteralPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/EncryptMetadata\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/CF\":\r\n                            const dictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                            if (bounds) {\r\n                                const cryptMap = yield CryptMapDict.parseAsync({ parser, bounds: dictBounds });\r\n                                if (cryptMap) {\r\n                                    this.CF = cryptMap.value;\r\n                                    i = cryptMap.end + 1;\r\n                                }\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /CF property value\");\r\n                            }\r\n                            break;\r\n                        case \"/Recipients\":\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.STRING_HEX) {\r\n                                const recipient = yield HexString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (recipient) {\r\n                                    this.Recipients = recipient.value;\r\n                                    i = recipient.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Recipients property value\");\r\n                                }\r\n                            }\r\n                            else if (entryType === valueTypes.ARRAY) {\r\n                                const recipients = yield HexString.parseArrayAsync(parser, i);\r\n                                if (recipients) {\r\n                                    this.Recipients = recipients.value;\r\n                                    i = recipients.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Recipients property value\");\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /Filter property value type: ${entryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Filter) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (this.Filter === \"/Standard\"\r\n                && (!this.R\r\n                    || !this.O\r\n                    || !this.U\r\n                    || isNaN(this.P)\r\n                    || (this.V === 5 && (this.R < 5 || !this.OE || !this.UE || !this.Perms)))) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if ((this.SubFilter === \"adbe.pkcs7.s3\" || this.SubFilter === \"adbe.pkcs7.s4\")\r\n                && !this.Recipients) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (this.StrF !== \"/Identity\") {\r\n                this.stringFilter = (_a = this.CF) === null || _a === void 0 ? void 0 : _a.getProp(this.StrF);\r\n            }\r\n            if (this.StmF !== \"/Identity\") {\r\n                this.streamFilter = (_b = this.CF) === null || _b === void 0 ? void 0 : _b.getProp(this.StmF);\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$K = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TrailerDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.EMPTY);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$K(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new TrailerDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Size) {\r\n            bytes.push(...encoder.encode(\"/Size \"), ...encoder.encode(\" \" + this.Size));\r\n        }\r\n        if (this.Prev) {\r\n            bytes.push(...encoder.encode(\"/Prev \"), ...encoder.encode(\" \" + this.Prev));\r\n        }\r\n        if (this.Root) {\r\n            bytes.push(...encoder.encode(\"/Root \"), ...this.Root.toArray(cryptInfo));\r\n        }\r\n        if (this.Encrypt) {\r\n            bytes.push(...encoder.encode(\"/Encrypt \"), ...this.Encrypt.toArray(cryptInfo));\r\n        }\r\n        if (this.Info) {\r\n            bytes.push(...encoder.encode(\"/Info \"), ...this.Info.toArray(cryptInfo));\r\n        }\r\n        if (this.ID) {\r\n            bytes.push(...encoder.encode(\"/ID \"), ...this.encodeSerializableArray(this.ID, cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$K(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Size\":\r\n                        case \"/Prev\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Root\":\r\n                        case \"/Info\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Encrypt\":\r\n                            const entryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (entryType === valueTypes.REF) {\r\n                                const encryptId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (encryptId) {\r\n                                    this.Encrypt = encryptId.value;\r\n                                    i = encryptId.end + 1;\r\n                                    break;\r\n                                }\r\n                                else {\r\n                                    throw new Error(\"Can't parse /Encrypt property value\");\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /Encrypt property value type: ${entryType}`);\r\n                        case \"/ID\":\r\n                            const hexIds = yield HexString.parseArrayAsync(parser, i);\r\n                            if (hexIds && hexIds.value[0] && hexIds.value[1]) {\r\n                                this.ID = [\r\n                                    hexIds.value[0],\r\n                                    hexIds.value[1],\r\n                                ];\r\n                                i = hexIds.end + 1;\r\n                                break;\r\n                            }\r\n                            const literalIds = yield LiteralString.parseArrayAsync(parser, i);\r\n                            if (literalIds && literalIds.value[0] && literalIds.value[1]) {\r\n                                this.ID = [\r\n                                    HexString.fromHexBytes(literalIds.value[0].bytes),\r\n                                    HexString.fromHexBytes(literalIds.value[1].bytes),\r\n                                ];\r\n                                i = literalIds.end + 1;\r\n                                break;\r\n                            }\r\n                            throw new Error(\"Can't parse /ID property value\");\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Size || !this.Root || (this.Encrypt && !this.ID)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$J = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass XRefTable extends XRef {\r\n    constructor(table, trailer, offset) {\r\n        super(xRefTypes.TABLE);\r\n        this._table = table;\r\n        this._trailerDict = trailer;\r\n        this._offset = offset;\r\n    }\r\n    get prev() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.Prev;\r\n    }\r\n    get size() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.Size;\r\n    }\r\n    get root() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.Root;\r\n    }\r\n    get info() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.Root;\r\n    }\r\n    get encrypt() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.Encrypt;\r\n    }\r\n    get id() {\r\n        var _a;\r\n        return (_a = this._trailerDict) === null || _a === void 0 ? void 0 : _a.ID;\r\n    }\r\n    static createFrom(base, entries, offset) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length) || !base) {\r\n            return null;\r\n        }\r\n        const entriesSize = Math.max(...entries.map(x => x.id)) + 1;\r\n        const size = Math.max(entriesSize, base.size);\r\n        return XRefTable.create(entries, size, offset, base.root, base.offset, base.info, base.encrypt, base.id);\r\n    }\r\n    static create(entries, size, offset, root, prev, info, encrypt, id) {\r\n        if (!(entries === null || entries === void 0 ? void 0 : entries.length) || !size || !offset || !root) {\r\n            return null;\r\n        }\r\n        const trailer = new TrailerDict();\r\n        trailer.Size = size;\r\n        trailer.Prev = prev;\r\n        trailer.Root = root;\r\n        trailer.Info = info;\r\n        trailer.Encrypt = encrypt;\r\n        trailer.ID = id;\r\n        const data = XRefEntry.toTableBytes(entries);\r\n        const table = new XRefTable(data, trailer, offset);\r\n        return table;\r\n    }\r\n    static parseAsync(parser, start, offset) {\r\n        return __awaiter$J(this, void 0, void 0, function* () {\r\n            if (!parser || isNaN(start)) {\r\n                return null;\r\n            }\r\n            const xrefTableBounds = yield parser.getXrefTableBoundsAtAsync(start);\r\n            if (!xrefTableBounds) {\r\n                return null;\r\n            }\r\n            const trailerDictBounds = yield parser.getDictBoundsAtAsync(xrefTableBounds.end + 1);\r\n            if (!trailerDictBounds) {\r\n                return null;\r\n            }\r\n            const table = yield parser.sliceCharCodesAsync(xrefTableBounds.contentStart, xrefTableBounds.contentEnd);\r\n            const trailerDict = yield TrailerDict.parseAsync({ parser, bounds: trailerDictBounds });\r\n            if (!trailerDict) {\r\n                return null;\r\n            }\r\n            const xrefTable = new XRefTable(table, trailerDict.value, offset);\r\n            return {\r\n                value: xrefTable,\r\n                start: null,\r\n                end: null,\r\n            };\r\n        });\r\n    }\r\n    createUpdate(entries, offset) {\r\n        return XRefTable.createFrom(this, entries, offset);\r\n    }\r\n    getEntries() {\r\n        if (!this._table.length) {\r\n            return [];\r\n        }\r\n        const entries = XRefEntry.fromTableBytes(this._table);\r\n        return entries;\r\n    }\r\n    toArray(cryptInfo) {\r\n        const trailerBytes = this._trailerDict.toArray(cryptInfo);\r\n        const bytes = [\r\n            ...keywordCodes.XREF_TABLE, ...keywordCodes.END_OF_LINE,\r\n            ...this._table,\r\n            ...keywordCodes.TRAILER, ...keywordCodes.END_OF_LINE,\r\n            ...trailerBytes, ...keywordCodes.END_OF_LINE,\r\n        ];\r\n        return new Uint8Array(bytes);\r\n    }\r\n}\n\nvar __awaiter$I = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass XrefParser {\r\n    constructor(parser) {\r\n        if (!parser) {\r\n            throw new Error(\"Parser is not defined\");\r\n        }\r\n        this._dataParser = parser;\r\n    }\r\n    getPdfVersionAsync() {\r\n        var _a;\r\n        return __awaiter$I(this, void 0, void 0, function* () {\r\n            const i = yield this._dataParser.findSubarrayIndexAsync(keywordCodes.VERSION);\r\n            if (!i) {\r\n                return null;\r\n            }\r\n            const version = (_a = (yield this._dataParser.parseNumberAtAsync(i.end + 1, true))) === null || _a === void 0 ? void 0 : _a.value;\r\n            if (!version) {\r\n                return null;\r\n            }\r\n            return version.toFixed(1);\r\n        });\r\n    }\r\n    getLastXrefIndexAsync() {\r\n        return __awaiter$I(this, void 0, void 0, function* () {\r\n            const xrefStartIndex = yield this._dataParser.findSubarrayIndexAsync(keywordCodes.XREF_START, { maxIndex: this._dataParser.maxIndex, direction: false });\r\n            if (!xrefStartIndex) {\r\n                return null;\r\n            }\r\n            const xrefIndex = this._dataParser.parseNumberAtAsync(xrefStartIndex.end + 1);\r\n            if (!xrefIndex) {\r\n                return null;\r\n            }\r\n            return xrefIndex;\r\n        });\r\n    }\r\n    parseXrefAsync(start, max) {\r\n        return __awaiter$I(this, void 0, void 0, function* () {\r\n            if (!start) {\r\n                return null;\r\n            }\r\n            const offset = start;\r\n            const xrefTableIndex = yield this._dataParser.findSubarrayIndexAsync(keywordCodes.XREF_TABLE, { minIndex: start, closedOnly: true });\r\n            if (xrefTableIndex && xrefTableIndex.start === start) {\r\n                const xrefStmIndexProp = yield this._dataParser.findSubarrayIndexAsync(keywordCodes.XREF_HYBRID, { minIndex: start, maxIndex: max, closedOnly: true });\r\n                if (xrefStmIndexProp) {\r\n                    const streamXrefIndex = yield this._dataParser.parseNumberAtAsync(xrefStmIndexProp.end + 1);\r\n                    if (!streamXrefIndex) {\r\n                        return null;\r\n                    }\r\n                    start = streamXrefIndex.value;\r\n                }\r\n                else {\r\n                    const xrefTable = yield XRefTable.parseAsync(this._dataParser, start, offset);\r\n                    return xrefTable === null || xrefTable === void 0 ? void 0 : xrefTable.value;\r\n                }\r\n            }\r\n            const id = yield ObjectId.parseAsync(this._dataParser, start, false);\r\n            if (!id) {\r\n                return null;\r\n            }\r\n            const xrefStreamBounds = yield this._dataParser.getIndirectObjectBoundsAtAsync(id.end + 1);\r\n            if (!xrefStreamBounds) {\r\n                return null;\r\n            }\r\n            const xrefStream = yield XRefStream.parseAsync({ parser: this._dataParser, bounds: xrefStreamBounds }, offset);\r\n            return xrefStream === null || xrefStream === void 0 ? void 0 : xrefStream.value;\r\n        });\r\n    }\r\n    parseAllXrefsAsync(start) {\r\n        return __awaiter$I(this, void 0, void 0, function* () {\r\n            const xrefs = [];\r\n            let max = this._dataParser.maxIndex;\r\n            let xref;\r\n            while (start) {\r\n                xref = yield this.parseXrefAsync(start, max);\r\n                if (xref) {\r\n                    xrefs.push(xref);\r\n                    max = start;\r\n                    start = xref.prev;\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            return xrefs;\r\n        });\r\n    }\r\n}\n\nclass ReferenceData {\r\n    constructor(xrefs) {\r\n        var _a;\r\n        const allFreeEntries = [];\r\n        const allNormalEntries = [];\r\n        const allCompressedEntries = [];\r\n        let maxId = 0;\r\n        xrefs.forEach(x => {\r\n            for (const entry of x.getEntries()) {\r\n                switch (entry.type) {\r\n                    case xRefEntryTypes.FREE:\r\n                        allFreeEntries.push(entry);\r\n                        break;\r\n                    case xRefEntryTypes.NORMAL:\r\n                        allNormalEntries.push(entry);\r\n                        break;\r\n                    case xRefEntryTypes.COMPRESSED:\r\n                        allCompressedEntries.push(entry);\r\n                        break;\r\n                    default:\r\n                        continue;\r\n                }\r\n                if (entry.id > maxId) {\r\n                    maxId = entry.id;\r\n                }\r\n            }\r\n        });\r\n        this.size = maxId + 1;\r\n        const zeroFreeRef = {\r\n            id: 0,\r\n            generation: maxGeneration,\r\n            nextFreeId: 0,\r\n        };\r\n        const freeLinkedList = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.LinkedList(zeroFreeRef);\r\n        const freeOutsideListMap = new Map();\r\n        const freeMap = new Map();\r\n        let zeroFound = false;\r\n        for (const entry of allFreeEntries) {\r\n            if (!zeroFound && entry.id === 0) {\r\n                zeroFound = true;\r\n                zeroFreeRef.nextFreeId = entry.nextFreeId;\r\n                continue;\r\n            }\r\n            const valueFromMap = freeMap.get(entry.id);\r\n            if (!valueFromMap || valueFromMap.generation < entry.generation) {\r\n                freeMap.set(entry.id, {\r\n                    id: entry.id,\r\n                    generation: entry.generation,\r\n                    nextFreeId: entry.nextFreeId\r\n                });\r\n            }\r\n        }\r\n        let nextId = zeroFreeRef.nextFreeId;\r\n        let next;\r\n        while (nextId) {\r\n            next = freeMap.get(nextId);\r\n            freeMap.delete(nextId);\r\n            freeLinkedList.push(next);\r\n            nextId = next.nextFreeId;\r\n        }\r\n        [...freeMap].forEach(x => {\r\n            const value = x[1];\r\n            if (value.generation === maxGeneration && value.nextFreeId === 0) {\r\n                freeOutsideListMap.set(value.id, value);\r\n            }\r\n        });\r\n        this.freeLinkedList = freeLinkedList;\r\n        this.freeOutsideListMap = freeOutsideListMap;\r\n        const normalRefs = new Map();\r\n        for (const entry of allNormalEntries) {\r\n            if (this.isFreed(entry)) {\r\n                continue;\r\n            }\r\n            const valueFromMap = normalRefs.get(entry.id);\r\n            if (valueFromMap && valueFromMap.generation >= entry.generation) {\r\n                continue;\r\n            }\r\n            normalRefs.set(entry.id, {\r\n                id: entry.id,\r\n                generation: entry.generation,\r\n                byteOffset: entry.byteOffset,\r\n            });\r\n        }\r\n        for (const entry of allCompressedEntries) {\r\n            if (this.isFreed(entry)) {\r\n                continue;\r\n            }\r\n            const valueFromMap = normalRefs.get(entry.id);\r\n            if (valueFromMap) {\r\n                continue;\r\n            }\r\n            const offset = (_a = normalRefs.get(entry.streamId)) === null || _a === void 0 ? void 0 : _a.byteOffset;\r\n            if (offset) {\r\n                normalRefs.set(entry.id, {\r\n                    id: entry.id,\r\n                    generation: entry.generation,\r\n                    byteOffset: offset,\r\n                    compressed: true,\r\n                    streamId: entry.streamId,\r\n                    streamIndex: entry.streamIndex,\r\n                });\r\n            }\r\n        }\r\n        this.usedMap = normalRefs;\r\n    }\r\n    getOffset(id) {\r\n        var _a;\r\n        return (_a = this.usedMap.get(id)) === null || _a === void 0 ? void 0 : _a.byteOffset;\r\n    }\r\n    getGeneration(id) {\r\n        var _a;\r\n        return (_a = this.usedMap.get(id)) === null || _a === void 0 ? void 0 : _a.generation;\r\n    }\r\n    isFreed(ref) {\r\n        return this.freeOutsideListMap.has(ref.id)\r\n            || this.freeLinkedList.has(ref, (a, b) => a.id === b.id && a.generation < b.generation);\r\n    }\r\n    isUsed(id) {\r\n        return this.usedMap.has(id);\r\n    }\r\n}\n\nvar __awaiter$H = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass CatalogDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.CATALOG);\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$H(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new CatalogDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Version) {\r\n            bytes.push(...encoder.encode(\"/Version \"), ...encoder.encode(this.Version));\r\n        }\r\n        if (this.Pages) {\r\n            bytes.push(...encoder.encode(\"/Pages \"), ...this.Pages.toArray(cryptInfo));\r\n        }\r\n        if (this.Lang) {\r\n            bytes.push(...encoder.encode(\"/Lang \"), ...this.Lang.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$H(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Version\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Pages\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Lang\":\r\n                            i = yield this.parseLiteralPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Pages) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$G = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.PAGE);\r\n        this.Rotate = 0;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$G(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new PageDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Parent) {\r\n            bytes.push(...encoder.encode(\"/Parent \"), ...this.Parent.toArray(cryptInfo));\r\n        }\r\n        if (this.LastModified) {\r\n            bytes.push(...encoder.encode(\"/LastModified \"), ...this.LastModified.toArray(cryptInfo));\r\n        }\r\n        if (this.Resources) {\r\n            bytes.push(...encoder.encode(\"/Resources \"), ...this.Resources);\r\n        }\r\n        if (this.MediaBox) {\r\n            bytes.push(...encoder.encode(\"/MediaBox \"), ...this.encodePrimitiveArray(this.MediaBox, encoder));\r\n        }\r\n        if (this.CropBox) {\r\n            bytes.push(...encoder.encode(\"/CropBox \"), ...this.encodePrimitiveArray(this.CropBox, encoder));\r\n        }\r\n        if (this.BleedBox) {\r\n            bytes.push(...encoder.encode(\"/BleedBox \"), ...this.encodePrimitiveArray(this.BleedBox, encoder));\r\n        }\r\n        if (this.TrimBox) {\r\n            bytes.push(...encoder.encode(\"/TrimBox \"), ...this.encodePrimitiveArray(this.TrimBox, encoder));\r\n        }\r\n        if (this.ArtBox) {\r\n            bytes.push(...encoder.encode(\"/ArtBox \"), ...this.encodePrimitiveArray(this.ArtBox, encoder));\r\n        }\r\n        if (this.Contents) {\r\n            if (this.Contents instanceof ObjectId) {\r\n                bytes.push(...encoder.encode(\"/Contents \"), ...this.Contents.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Contents \"), ...this.encodeSerializableArray(this.Contents, cryptInfo));\r\n            }\r\n        }\r\n        if (this.Rotate) {\r\n            bytes.push(...encoder.encode(\"/Rotate \"), ...encoder.encode(\" \" + this.Rotate));\r\n        }\r\n        if (this.Thumb) {\r\n            bytes.push(...encoder.encode(\"/Thumb \"), ...this.Thumb.toArray(cryptInfo));\r\n        }\r\n        if (this.B) {\r\n            if (this.B instanceof ObjectId) {\r\n                bytes.push(...encoder.encode(\"/B \"), ...this.B.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/B \"), ...this.encodeSerializableArray(this.B, cryptInfo));\r\n            }\r\n        }\r\n        if (this.Dur) {\r\n            bytes.push(...encoder.encode(\"/Dur \"), ...encoder.encode(\" \" + this.Dur));\r\n        }\r\n        if (this.Annots) {\r\n            if (this.Annots instanceof ObjectId) {\r\n                bytes.push(...encoder.encode(\"/Annots \"), ...this.Annots.toArray(cryptInfo));\r\n            }\r\n            else {\r\n                bytes.push(...encoder.encode(\"/Annots \"), ...this.encodeSerializableArray(this.Annots, cryptInfo));\r\n            }\r\n        }\r\n        if (this.Metadata) {\r\n            bytes.push(...encoder.encode(\"/Metadata \"), ...this.Metadata.toArray(cryptInfo));\r\n        }\r\n        if (this.StructParent) {\r\n            bytes.push(...encoder.encode(\"/StructParent \"), ...encoder.encode(\" \" + this.StructParent));\r\n        }\r\n        if (this.ID) {\r\n            bytes.push(...encoder.encode(\"/ID \"), ...this.ID.toArray(cryptInfo));\r\n        }\r\n        if (this.PZ) {\r\n            bytes.push(...encoder.encode(\"/PZ \"), ...encoder.encode(\" \" + this.PZ));\r\n        }\r\n        if (this.Tabs) {\r\n            bytes.push(...encoder.encode(\"/Tabs \"), ...encoder.encode(this.Tabs));\r\n        }\r\n        if (this.TemplateInstantiated) {\r\n            bytes.push(...encoder.encode(\"/TemplateInstantiated \"), ...encoder.encode(this.TemplateInstantiated));\r\n        }\r\n        if (this.UserUnit) {\r\n            bytes.push(...encoder.encode(\"/UserUnit \"), ...encoder.encode(\" \" + this.UserUnit));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$G(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Parent\":\r\n                        case \"/Thumb\":\r\n                        case \"/Metadata\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/LastModified\":\r\n                            i = yield this.parseDatePropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/Resources\":\r\n                            const resEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (resEntryType === valueTypes.REF) {\r\n                                const resDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (resDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    this.Resources = yield parser.sliceCharCodesAsync(resDictId.start, resDictId.end);\r\n                                    i = resDictId.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /Resources value reference\");\r\n                            }\r\n                            else if (resEntryType === valueTypes.DICTIONARY) {\r\n                                const resDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (resDictBounds) {\r\n                                    this.Resources = yield parser.sliceCharCodesAsync(resDictBounds.start, resDictBounds.end);\r\n                                    i = resDictBounds.end + 1;\r\n                                    break;\r\n                                }\r\n                                throw new Error(\"Can't parse /Resources dictionary bounds\");\r\n                            }\r\n                            throw new Error(`Unsupported /Resources property value type: ${resEntryType}`);\r\n                        case \"/MediaBox\":\r\n                        case \"/CropBox\":\r\n                        case \"/BleedBox\":\r\n                        case \"/TrimBox\":\r\n                        case \"/ArtBox\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/Contents\":\r\n                        case \"/B\":\r\n                        case \"/Annots\":\r\n                            const refEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (refEntryType === valueTypes.REF) {\r\n                                const refArrayId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (refArrayId) {\r\n                                    this[name.slice(1)] = refArrayId.value;\r\n                                    i = refArrayId.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            else if (refEntryType === valueTypes.ARRAY) {\r\n                                const refIds = yield ObjectId.parseRefArrayAsync(parser, i);\r\n                                if (refIds) {\r\n                                    this[name.slice(1)] = refIds.value;\r\n                                    i = refIds.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported ${name} property value type: ${refEntryType}`);\r\n                        case \"/Rotate\":\r\n                        case \"/Dur\":\r\n                        case \"/StructParent\":\r\n                        case \"/PZ\":\r\n                        case \"/UserUnit\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/ID\":\r\n                            const webCaptureIdEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (webCaptureIdEntryType === valueTypes.REF) {\r\n                                const webCaptureRefId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (webCaptureRefId) {\r\n                                    if (webCaptureRefId && parseInfo.parseInfoGetterAsync) {\r\n                                        const webCaptureIdParseInfo = yield parseInfo.parseInfoGetterAsync(webCaptureRefId.value.id);\r\n                                        if (webCaptureIdParseInfo) {\r\n                                            const webCaptureId = yield HexString.parseAsync(webCaptureIdParseInfo.parser, webCaptureIdParseInfo.bounds.start, webCaptureIdParseInfo.cryptInfo);\r\n                                            if (webCaptureId) {\r\n                                                this.ID = webCaptureId.value;\r\n                                                i = webCaptureRefId.end + 1;\r\n                                                break;\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /ID property value\");\r\n                            }\r\n                            else if (webCaptureIdEntryType === valueTypes.STRING_HEX) {\r\n                                const webCaptureId = yield HexString.parseAsync(parser, i, parseInfo.cryptInfo);\r\n                                if (webCaptureId) {\r\n                                    this.ID = webCaptureId.value;\r\n                                    i = webCaptureId.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(`Unsupported /ID property value type: ${webCaptureIdEntryType}`);\r\n                        case \"/Tabs\":\r\n                        case \"/TemplateInstantiated\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Parent) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$F = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageTreeDict extends PdfDict {\r\n    constructor() {\r\n        super(dictTypes.PAGE_TREE);\r\n        this.Rotate = 0;\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$F(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new PageTreeDict();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return { value: pdfObject, start: parseInfo.bounds.start, end: parseInfo.bounds.end };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Parent) {\r\n            bytes.push(...encoder.encode(\"/Parent \"), ...this.Parent.toArray(cryptInfo));\r\n        }\r\n        if (this.Kids) {\r\n            bytes.push(...encoder.encode(\"/Kids \"), ...this.encodeSerializableArray(this.Kids, cryptInfo));\r\n        }\r\n        if (this.Count) {\r\n            bytes.push(...encoder.encode(\"/Count \"), ...encoder.encode(\" \" + this.Count));\r\n        }\r\n        if (this.MediaBox) {\r\n            bytes.push(...encoder.encode(\"/MediaBox \"), ...this.encodePrimitiveArray(this.MediaBox, encoder));\r\n        }\r\n        if (this.Rotate) {\r\n            bytes.push(...encoder.encode(\"/Rotate \"), ...encoder.encode(\" \" + this.Rotate));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$F(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Parent\":\r\n                            i = yield this.parseRefPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Kids\":\r\n                            i = yield this.parseRefArrayPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Count\":\r\n                        case \"/Rotate\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/MediaBox\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Kids || isNaN(this.Count)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nconst standardStampColors = {\r\n    redColor: [0.804, 0, 0],\r\n    greenColor: [0, 0.804, 0],\r\n    blueColor: [0, 0, 0.804],\r\n};\r\nconst standardStampBBox = [0, 0, 440, 120];\r\nconst standardStampRect = [0, 0, 220, 60];\r\nconst standardStampForms = {\r\n    DRAFT: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  150 61 m\r\n  150.047 65.947 149.114 70.413 147.2 74.4 c\r\n  145.287 78.333 142.853 81.373 139.9 83.52 c\r\n  137.68 85.127 135.24 86.263 132.58 86.93 c\r\n  129.92 87.593 126.763 87.957 123.11 88.02 c\r\n  106.91 88.29 l\r\n  106.401 35.19 l\r\n  123.001 34.912 l\r\n  126.734 34.85 129.961 35.165 132.681 35.857 c\r\n  135.394 36.524 137.681 37.507 139.541 38.807 c\r\n  142.721 40.994 145.234 43.974 147.081 47.747 c\r\n  148.941 51.5 149.898 55.934 149.951 61.047 c\r\n  h\r\n  137.8 61.097 m\r\n  137.767 57.597 137.183 54.621 136.05 52.167 c\r\n  134.937 49.687 133.183 47.764 130.79 46.397 c\r\n  129.57 45.731 128.323 45.287 127.05 45.067 c\r\n  125.797 44.827 123.897 44.728 121.35 44.77 c\r\n  118.36 44.82 l\r\n  118.678 78.12 l\r\n  121.668 78.07 l\r\n  124.481 78.023 126.541 77.846 127.848 77.538 c\r\n  129.161 77.207 130.438 76.637 131.678 75.828 c\r\n  133.818 74.362 135.381 72.432 136.368 70.038 c\r\n  137.348 67.618 137.821 64.648 137.788 61.128 c\r\n  f\r\n  185 50 m\r\n  184.987 48.667 184.74 47.53 184.259 46.59 c\r\n  183.778 45.643 182.961 44.907 181.809 44.38 c\r\n  181.002 44.013 180.066 43.802 178.999 43.749 c\r\n  177.932 43.672 176.689 43.645 175.269 43.669 c\r\n  170.989 43.74 l\r\n  171.126 58.04 l\r\n  174.756 57.979 l\r\n  176.643 57.948 178.223 57.814 179.496 57.579 c\r\n  180.769 57.344 181.833 56.837 182.686 56.059 c\r\n  183.499 55.306 184.086 54.486 184.446 53.599 c\r\n  184.827 52.686 185.011 51.483 184.996 49.989 c\r\n  h\r\n  203.8 86.6 m\r\n  189.4 86.841 l\r\n  176.7 67.541 l\r\n  171.25 67.632 l\r\n  171.437 87.132 l\r\n  159.637 87.329 l\r\n  159.128 34.229 l\r\n  178.928 33.897 l\r\n  181.635 33.852 183.965 33.991 185.918 34.315 c\r\n  187.871 34.639 189.705 35.382 191.418 36.545 c\r\n  193.151 37.705 194.531 39.228 195.558 41.115 c\r\n  196.605 42.975 197.141 45.335 197.168 48.195 c\r\n  197.206 52.122 196.446 55.335 194.888 57.835 c\r\n  193.355 60.335 191.138 62.432 188.238 64.125 c\r\n  f\r\n  251 85.8 m\r\n  238.8 86.004 l\r\n  235.53 75.304 l\r\n  218.53 75.588 l\r\n  215.46 86.388 l\r\n  203.56 86.587 l\r\n  219.96 33.187 l\r\n  233.56 32.959 l\r\n  h\r\n  232.6 65.6 m\r\n  226.78 46.6 l\r\n  221.33 65.8 l\r\n  f\r\n  290 42.3 m\r\n  268.9 42.653 l\r\n  268.995 52.543 l\r\n  288.495 52.216 l\r\n  288.593 62.516 l\r\n  269.093 62.843 l\r\n  269.31 85.543 l\r\n  257.51 85.74 l\r\n  257.001 32.64 l\r\n  289.801 32.091 l\r\n  f\r\n  334 41.5 m\r\n  319.7 41.739 l\r\n  320.11 84.639 l\r\n  308.31 84.837 l\r\n  307.9 41.937 l\r\n  293.6 42.176 l\r\n  293.502 31.876 l\r\n  333.902 31.199 l\r\n  f\r\n  `,\r\n    APPROVED: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  88.9 86.4 m\r\n  78 86.585 l\r\n  75.08 76.895 l\r\n  59.88 77.153 l\r\n  57.14 86.933 l\r\n  46.54 87.114 l\r\n  61.24 38.714 l\r\n  73.34 38.508 l\r\n  h\r\n  72.4 68.1 m\r\n  67.21 50.9 l\r\n  62.35 68.3 l\r\n  f\r\n  128 52.8 m\r\n  128.02 54.953 127.72 57.073 127.098 59.16 c\r\n  126.477 61.22 125.577 62.96 124.398 64.38 c\r\n  122.785 66.307 120.975 67.77 118.968 68.77 c\r\n  116.981 69.777 114.495 70.303 111.508 70.35 c\r\n  104.938 70.462 l\r\n  105.086 86.162 l\r\n  94.586 86.341 l\r\n  94.132 38.141 l\r\n  111.532 37.846 l\r\n  114.132 37.802 116.322 38.034 118.102 38.543 c\r\n  119.902 39.03 121.492 39.79 122.872 40.823 c\r\n  124.532 42.07 125.802 43.676 126.682 45.643 c\r\n  127.582 47.61 128.045 49.986 128.072 52.773 c\r\n  h\r\n  117.1 53.276 m\r\n  117.087 51.916 116.765 50.756 116.133 49.796 c\r\n  115.501 48.816 114.771 48.139 113.943 47.766 c\r\n  112.836 47.267 111.763 47.005 110.723 46.98 c\r\n  109.676 46.933 108.283 46.924 106.543 46.954 c\r\n  104.733 46.985 l\r\n  104.869 61.385 l\r\n  107.889 61.333 l\r\n  109.682 61.303 111.156 61.149 112.309 60.87 c\r\n  113.476 60.592 114.449 60.058 115.229 59.27 c\r\n  115.902 58.57 116.379 57.744 116.659 56.79 c\r\n  116.961 55.817 117.106 54.64 117.093 53.26 c\r\n  f\r\n  170 52.1 m\r\n  170.02 54.253 169.72 56.373 169.098 58.46 c\r\n  168.477 60.52 167.577 62.26 166.398 63.68 c\r\n  164.785 65.607 162.975 67.07 160.968 68.07 c\r\n  158.981 69.077 156.495 69.603 153.508 69.65 c\r\n  146.938 69.762 l\r\n  147.086 85.462 l\r\n  136.586 85.641 l\r\n  136.132 37.441 l\r\n  153.532 37.146 l\r\n  156.132 37.102 158.322 37.334 160.102 37.843 c\r\n  161.902 38.33 163.492 39.09 164.872 40.123 c\r\n  166.532 41.37 167.802 42.976 168.682 44.943 c\r\n  169.582 46.91 170.045 49.286 170.072 52.073 c\r\n  h\r\n  159.1 52.576 m\r\n  159.087 51.216 158.765 50.056 158.133 49.096 c\r\n  157.501 48.116 156.771 47.439 155.943 47.066 c\r\n  154.836 46.567 153.763 46.305 152.723 46.28 c\r\n  151.676 46.233 150.283 46.224 148.543 46.254 c\r\n  146.733 46.285 l\r\n  146.869 60.685 l\r\n  149.889 60.633 l\r\n  151.682 60.603 153.156 60.449 154.309 60.17 c\r\n  155.476 59.892 156.449 59.358 157.229 58.57 c\r\n  157.902 57.87 158.379 57.044 158.659 56.09 c\r\n  158.961 55.117 159.106 53.94 159.093 52.56 c\r\n  f\r\n  200 51.1 m\r\n  199.989 49.893 199.768 48.863 199.339 48.01 c\r\n  198.91 47.157 198.18 46.49 197.149 46.01 c\r\n  196.429 45.677 195.592 45.487 194.639 45.438 c\r\n  193.686 45.368 192.576 45.344 191.309 45.365 c\r\n  187.489 45.43 l\r\n  187.611 58.43 l\r\n  190.851 58.375 l\r\n  192.538 58.346 193.948 58.225 195.081 58.012 c\r\n  196.214 57.799 197.161 57.342 197.921 56.642 c\r\n  198.648 55.962 199.171 55.219 199.491 54.412 c\r\n  199.831 53.585 199.995 52.492 199.982 51.132 c\r\n  h\r\n  216.8 84.2 m\r\n  203.9 84.419 l\r\n  192.6 66.919 l\r\n  187.74 67.002 l\r\n  187.906 84.702 l\r\n  177.406 84.88 l\r\n  176.952 36.68 l\r\n  194.652 36.379 l\r\n  197.072 36.338 199.152 36.464 200.892 36.758 c\r\n  202.632 37.052 204.269 37.725 205.802 38.778 c\r\n  207.349 39.831 208.579 41.211 209.492 42.918 c\r\n  210.425 44.604 210.902 46.741 210.922 49.328 c\r\n  210.956 52.888 210.279 55.801 208.892 58.068 c\r\n  207.519 60.334 205.539 62.234 202.952 63.768 c\r\n  f\r\n  261 59.4 m\r\n  261.073 67.067 259.263 73.2 255.57 77.8 c\r\n  251.877 82.373 246.743 84.713 240.17 84.82 c\r\n  233.597 84.932 228.43 82.765 224.67 78.32 c\r\n  220.89 73.853 218.963 67.787 218.89 60.12 c\r\n  218.817 52.387 220.627 46.253 224.32 41.72 c\r\n  228.013 37.147 233.147 34.807 239.72 34.7 c\r\n  246.273 34.589 251.44 36.755 255.22 41.2 c\r\n  259.013 45.62 260.947 51.687 261.02 59.4 c\r\n  h\r\n  247.1 71.8 m\r\n  248.113 70.313 248.857 68.577 249.33 66.59 c\r\n  249.805 64.577 250.03 62.223 250.005 59.53 c\r\n  249.978 56.643 249.671 54.19 249.084 52.17 c\r\n  248.497 50.15 247.741 48.523 246.814 47.29 c\r\n  245.867 46.01 244.777 45.09 243.544 44.53 c\r\n  242.331 43.968 241.064 43.698 239.744 43.721 c\r\n  238.404 43.744 237.144 44.045 235.964 44.626 c\r\n  234.797 45.207 233.724 46.153 232.744 47.466 c\r\n  231.837 48.686 231.101 50.369 230.534 52.516 c\r\n  229.986 54.636 229.725 57.099 229.752 59.906 c\r\n  229.779 62.773 230.077 65.216 230.645 67.236 c\r\n  231.232 69.229 231.988 70.856 232.915 72.116 c\r\n  233.842 73.376 234.922 74.296 236.155 74.876 c\r\n  237.388 75.459 238.682 75.739 240.035 75.716 c\r\n  241.388 75.693 242.675 75.369 243.895 74.745 c\r\n  245.115 74.099 246.178 73.122 247.085 71.815 c\r\n  f\r\n  306 34.6 m\r\n  291.5 83 l\r\n  279.7 83.201 l\r\n  264.3 35.301 l\r\n  275.4 35.113 l\r\n  285.6 68.813 l\r\n  295.17 34.813 l\r\n  f\r\n  342 82.1 m\r\n  312.4 82.603 l\r\n  311.946 34.403 l\r\n  341.546 33.9 l\r\n  341.634 43.22 l\r\n  322.534 43.544 l\r\n  322.612 51.854 l\r\n  340.312 51.553 l\r\n  340.4 60.873 l\r\n  322.7 61.174 l\r\n  322.812 73.074 l\r\n  341.912 72.75 l\r\n  f\r\n  389 57.3 m\r\n  389.042 61.787 388.209 65.82 386.5 69.4 c\r\n  384.793 72.967 382.62 75.72 379.98 77.66 c\r\n  378 79.12 375.82 80.15 373.44 80.75 c\r\n  371.067 81.351 368.25 81.68 364.99 81.735 c\r\n  350.59 81.98 l\r\n  350.136 33.78 l\r\n  364.936 33.528 l\r\n  368.269 33.471 371.146 33.757 373.566 34.384 c\r\n  375.993 34.99 378.033 35.883 379.686 37.064 c\r\n  382.526 39.044 384.769 41.744 386.416 45.164 c\r\n  388.076 48.564 388.929 52.597 388.976 57.264 c\r\n  h\r\n  378.1 57.388 m\r\n  378.07 54.222 377.55 51.525 376.54 49.298 c\r\n  375.547 47.052 373.983 45.308 371.85 44.068 c\r\n  370.763 43.461 369.65 43.058 368.51 42.858 c\r\n  367.39 42.64 365.693 42.551 363.42 42.589 c\r\n  360.76 42.634 l\r\n  361.044 72.734 l\r\n  363.704 72.689 l\r\n  366.211 72.647 368.051 72.486 369.224 72.207 c\r\n  370.391 71.907 371.531 71.391 372.644 70.657 c\r\n  374.557 69.331 375.951 67.581 376.824 65.407 c\r\n  377.704 63.214 378.127 60.521 378.094 57.327 c\r\n  f\r\n  `,\r\n    NOT_APPROVED: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  57.1 85.5 m\r\n  49.12 85.636 l\r\n  35.32 55.036 l\r\n  35.469 85.936 l\r\n  27.879 86.066 l\r\n  27.662 41.066 l\r\n  37.562 40.897 l\r\n  49.362 66.497 l\r\n  49.238 40.697 l\r\n  56.828 40.567 l\r\n  f\r\n  96.4 62.4 m\r\n  96.435 69.533 94.995 75.267 92.08 79.6 c\r\n  89.167 83.86 85.133 86.033 79.98 86.12 c\r\n  74.82 86.208 70.753 84.175 67.78 80.02 c\r\n  64.827 75.84 63.333 70.173 63.3 63.02 c\r\n  63.265 55.82 64.705 50.087 67.62 45.82 c\r\n  70.533 41.56 74.567 39.387 79.72 39.3 c\r\n  84.867 39.212 88.933 41.245 91.92 45.4 c\r\n  94.887 49.533 96.387 55.2 96.42 62.4 c\r\n  h\r\n  85.5 74 m\r\n  86.3 72.62 86.89 71 87.27 69.14 c\r\n  87.649 67.26 87.833 65.063 87.82 62.55 c\r\n  87.807 59.85 87.573 57.56 87.118 55.68 c\r\n  86.663 53.793 86.073 52.273 85.348 51.12 c\r\n  84.608 49.927 83.755 49.067 82.788 48.54 c\r\n  81.835 48.013 80.841 47.758 79.808 47.776 c\r\n  78.761 47.794 77.771 48.073 76.838 48.612 c\r\n  75.918 49.151 75.075 50.031 74.308 51.252 c\r\n  73.595 52.392 73.011 53.962 72.558 55.962 c\r\n  72.122 57.942 71.91 60.242 71.923 62.862 c\r\n  71.936 65.542 72.163 67.822 72.603 69.702 c\r\n  73.058 71.569 73.648 73.089 74.373 74.262 c\r\n  75.1 75.435 75.946 76.295 76.913 76.842 c\r\n  77.88 77.389 78.893 77.654 79.953 77.635 c\r\n  81.02 77.617 82.033 77.318 82.993 76.738 c\r\n  83.953 76.138 84.79 75.228 85.503 74.008 c\r\n  f\r\n  128 48 m\r\n  118 48.172 l\r\n  118.175 84.472 l\r\n  109.895 84.614 l\r\n  109.72 48.314 l\r\n  99.72 48.486 l\r\n  99.678 39.786 l\r\n  127.978 39.301 l\r\n  f\r\n  178 83.4 m\r\n  169.44 83.546 l\r\n  167.18 74.496 l\r\n  155.28 74.7 l\r\n  153.1 83.83 l\r\n  144.76 83.973 l\r\n  156.36 38.773 l\r\n  165.89 38.61 l\r\n  h\r\n  165.1 66.3 m\r\n  161.08 50.2 l\r\n  157.21 66.4 l\r\n  f\r\n  209 52.1 m\r\n  209.01 54.113 208.768 56.09 208.274 58.03 c\r\n  207.78 59.95 207.07 61.573 206.144 62.9 c\r\n  204.871 64.693 203.447 66.057 201.874 66.99 c\r\n  200.314 67.923 198.361 68.41 196.014 68.45 c\r\n  190.864 68.538 l\r\n  190.935 83.138 l\r\n  182.655 83.28 l\r\n  182.438 38.28 l\r\n  196.038 38.047 l\r\n  198.078 38.012 199.798 38.235 201.198 38.714 c\r\n  202.611 39.173 203.858 39.886 204.938 40.854 c\r\n  206.238 42.021 207.231 43.524 207.918 45.364 c\r\n  208.618 47.204 208.974 49.421 208.988 52.014 c\r\n  h\r\n  200.44 52.518 m\r\n  200.434 51.251 200.184 50.168 199.691 49.268 c\r\n  199.198 48.348 198.628 47.715 197.981 47.368 c\r\n  197.114 46.9 196.271 46.653 195.451 46.626 c\r\n  194.631 46.58 193.538 46.568 192.171 46.592 c\r\n  190.751 46.616 l\r\n  190.816 60.116 l\r\n  193.186 60.075 l\r\n  194.593 60.051 195.749 59.911 196.656 59.653 c\r\n  197.576 59.396 198.343 58.899 198.956 58.163 c\r\n  199.485 57.51 199.861 56.74 200.086 55.853 c\r\n  200.326 54.947 200.443 53.847 200.437 52.553 c\r\n  f\r\n  241 51.6 m\r\n  241.01 53.613 240.768 55.59 240.274 57.53 c\r\n  239.78 59.45 239.07 61.073 238.144 62.4 c\r\n  236.871 64.193 235.447 65.557 233.874 66.49 c\r\n  232.314 67.423 230.361 67.91 228.014 67.95 c\r\n  222.864 68.038 l\r\n  222.935 82.638 l\r\n  214.655 82.78 l\r\n  214.438 37.78 l\r\n  228.038 37.547 l\r\n  230.078 37.512 231.798 37.735 233.198 38.214 c\r\n  234.611 38.673 235.858 39.386 236.938 40.354 c\r\n  238.238 41.521 239.231 43.024 239.918 44.864 c\r\n  240.618 46.704 240.974 48.921 240.988 51.514 c\r\n  h\r\n  232.44 52.018 m\r\n  232.434 50.751 232.184 49.668 231.691 48.768 c\r\n  231.198 47.848 230.628 47.215 229.981 46.868 c\r\n  229.114 46.4 228.271 46.153 227.451 46.126 c\r\n  226.631 46.08 225.538 46.068 224.171 46.092 c\r\n  222.751 46.116 l\r\n  222.816 59.616 l\r\n  225.186 59.575 l\r\n  226.593 59.551 227.749 59.411 228.656 59.153 c\r\n  229.576 58.896 230.343 58.399 230.956 57.663 c\r\n  231.485 57.01 231.861 56.24 232.086 55.353 c\r\n  232.326 54.447 232.443 53.347 232.437 52.053 c\r\n  f\r\n  265 50.7 m\r\n  264.995 49.573 264.825 48.61 264.49 47.81 c\r\n  264.155 47.01 263.585 46.387 262.78 45.94 c\r\n  262.218 45.627 261.565 45.447 260.82 45.4 c\r\n  260.073 45.332 259.203 45.307 258.21 45.324 c\r\n  255.21 45.375 l\r\n  255.269 57.475 l\r\n  257.809 57.432 l\r\n  259.129 57.409 260.235 57.299 261.129 57.103 c\r\n  262.022 56.906 262.769 56.479 263.369 55.823 c\r\n  263.941 55.189 264.354 54.499 264.609 53.753 c\r\n  264.878 52.986 265.01 51.966 265.004 50.693 c\r\n  h\r\n  278.1 81.7 m\r\n  268 81.873 l\r\n  259.17 65.573 l\r\n  255.35 65.638 l\r\n  255.43 82.138 l\r\n  247.19 82.279 l\r\n  246.973 37.279 l\r\n  260.873 37.041 l\r\n  262.773 37.009 264.406 37.132 265.773 37.41 c\r\n  267.139 37.689 268.423 38.322 269.623 39.31 c\r\n  270.836 40.297 271.799 41.59 272.513 43.19 c\r\n  273.239 44.77 273.609 46.767 273.623 49.18 c\r\n  273.639 52.5 273.099 55.217 272.003 57.33 c\r\n  270.923 59.444 269.366 61.21 267.333 62.63 c\r\n  f\r\n  313 58.7 m\r\n  313.035 65.833 311.595 71.567 308.68 75.9 c\r\n  305.767 80.16 301.733 82.333 296.58 82.42 c\r\n  291.42 82.508 287.353 80.475 284.38 76.32 c\r\n  281.427 72.14 279.933 66.473 279.9 59.32 c\r\n  279.865 52.12 281.305 46.387 284.22 42.12 c\r\n  287.133 37.86 291.167 35.687 296.32 35.6 c\r\n  301.467 35.512 305.533 37.545 308.52 41.7 c\r\n  311.487 45.833 312.987 51.5 313.02 58.7 c\r\n  h\r\n  302.1 70.3 m\r\n  302.9 68.92 303.49 67.3 303.87 65.44 c\r\n  304.249 63.56 304.433 61.363 304.42 58.85 c\r\n  304.407 56.15 304.173 53.86 303.718 51.98 c\r\n  303.263 50.093 302.673 48.573 301.948 47.42 c\r\n  301.208 46.227 300.355 45.367 299.388 44.84 c\r\n  298.435 44.313 297.441 44.058 296.408 44.076 c\r\n  295.361 44.094 294.371 44.373 293.438 44.912 c\r\n  292.518 45.451 291.675 46.331 290.908 47.552 c\r\n  290.195 48.692 289.611 50.262 289.158 52.262 c\r\n  288.722 54.242 288.51 56.542 288.523 59.162 c\r\n  288.536 61.842 288.763 64.122 289.203 66.002 c\r\n  289.658 67.869 290.248 69.389 290.973 70.562 c\r\n  291.7 71.735 292.546 72.595 293.513 73.142 c\r\n  297.62 73.917 298.633 73.618 299.593 73.038 c\r\n  300.553 72.438 301.39 71.528 302.103 70.308 c\r\n  f\r\n  348 35.6 m\r\n  336.5 80.8 l\r\n  327.23 80.959 l\r\n  315.33 36.159 l\r\n  324.02 36.01 l\r\n  331.93 67.41 l\r\n  339.54 35.71 l\r\n  f\r\n  376 80 m\r\n  352.8 80.397 l\r\n  352.583 35.397 l\r\n  375.783 35 l\r\n  375.825 43.7 l\r\n  360.825 43.956 l\r\n  360.863 51.716 l\r\n  374.762 51.478 l\r\n  374.804 60.178 l\r\n  360.904 60.416 l\r\n  360.958 71.516 l\r\n  375.958 71.26 l\r\n  f\r\n  413 57 m\r\n  413.02 61.187 412.357 64.953 411.01 68.3 c\r\n  409.663 71.627 407.95 74.193 405.87 76 c\r\n  404.31 77.353 402.597 78.31 400.73 78.87 c\r\n  398.863 79.425 396.65 79.725 394.09 79.769 c\r\n  382.79 79.963 l\r\n  382.573 34.963 l\r\n  394.173 34.764 l\r\n  396.786 34.719 399.043 34.993 400.943 35.584 c\r\n  402.843 36.155 404.443 36.992 405.743 38.094 c\r\n  407.963 39.947 409.713 42.474 410.993 45.674 c\r\n  412.286 48.854 412.943 52.621 412.963 56.974 c\r\n  h\r\n  404.44 57.056 m\r\n  404.426 54.096 404.026 51.576 403.24 49.496 c\r\n  402.467 47.396 401.243 45.766 399.57 44.606 c\r\n  398.717 44.037 397.847 43.66 396.96 43.476 c\r\n  396.08 43.269 394.75 43.181 392.97 43.212 c\r\n  390.88 43.248 l\r\n  391.016 71.348 l\r\n  393.106 71.312 l\r\n  395.073 71.278 396.516 71.133 397.436 70.876 c\r\n  398.356 70.599 399.253 70.122 400.126 69.446 c\r\n  401.626 68.213 402.726 66.583 403.426 64.556 c\r\n  404.119 62.509 404.459 59.996 404.446 57.016 c\r\n  f\r\n  `,\r\n    DEPARTMENTAL: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  56.4 63.1 m\r\n  56.412 67.46 55.746 71.393 54.4 74.9 c\r\n  53.06 78.36 51.36 81.03 49.3 82.91 c\r\n  47.753 84.317 46.053 85.31 44.2 85.89 c\r\n  26.42 86.996 l\r\n  26.286 40.196 l\r\n  37.786 40.009 l\r\n  40.379 39.967 42.616 40.256 44.496 40.875 c\r\n  46.376 41.474 47.959 42.35 49.246 43.505 c\r\n  51.446 45.438 53.176 48.072 54.436 51.405 c\r\n  55.709 54.718 56.353 58.652 56.366 63.205 c\r\n  h\r\n  47.92 63.143 m\r\n  47.911 60.063 47.518 57.437 46.74 55.263 c\r\n  45.98 53.077 44.773 51.377 43.12 50.163 c\r\n  42.28 49.569 41.417 49.175 40.53 48.983 c\r\n  39.663 48.767 38.347 48.673 36.58 48.701 c\r\n  34.51 48.735 l\r\n  34.594 78.035 l\r\n  36.664 78.001 l\r\n  38.617 77.97 40.047 77.821 40.954 77.554 c\r\n  41.867 77.267 42.757 76.77 43.624 76.064 c\r\n  45.117 74.784 46.207 73.088 46.894 70.974 c\r\n  47.587 68.848 47.927 66.231 47.914 63.124 c\r\n  f\r\n  85.8 86 m\r\n  62.8 86.373 l\r\n  62.666 39.573 l\r\n  85.666 39.2 l\r\n  85.692 48.26 l\r\n  70.892 48.501 l\r\n  70.915 56.581 l\r\n  84.715 56.357 l\r\n  84.741 65.417 l\r\n  70.941 65.641 l\r\n  70.974 77.241 l\r\n  85.774 77 l\r\n  f\r\n  119 53.4 m\r\n  119.006 55.493 118.763 57.553 118.27 59.58 c\r\n  117.777 61.58 117.071 63.27 116.15 64.65 c\r\n  114.89 66.517 113.477 67.933 111.91 68.9 c\r\n  110.363 69.867 108.43 70.37 106.11 70.41 c\r\n  101.01 70.493 l\r\n  101.054 85.793 l\r\n  92.854 85.926 l\r\n  92.72 39.126 l\r\n  106.22 38.907 l\r\n  108.24 38.874 109.943 39.108 111.33 39.61 c\r\n  112.723 40.091 113.956 40.837 115.03 41.85 c\r\n  116.316 43.063 117.296 44.63 117.97 46.55 c\r\n  118.656 48.47 119.003 50.78 119.01 53.48 c\r\n  h\r\n  110.52 53.821 m\r\n  110.516 52.501 110.271 51.374 109.784 50.441 c\r\n  109.297 49.488 108.734 48.824 108.094 48.451 c\r\n  107.241 47.962 106.407 47.703 105.594 47.674 c\r\n  104.781 47.624 103.697 47.61 102.344 47.632 c\r\n  100.934 47.655 l\r\n  100.974 61.655 l\r\n  103.324 61.617 l\r\n  104.717 61.595 105.864 61.45 106.764 61.184 c\r\n  107.677 60.918 108.437 60.401 109.044 59.634 c\r\n  109.569 58.954 109.945 58.151 110.174 57.224 c\r\n  110.413 56.278 110.531 55.134 110.527 53.794 c\r\n  f\r\n  154 84.9 m\r\n  145.52 85.038 l\r\n  143.29 75.608 l\r\n  131.49 75.799 l\r\n  129.32 85.299 l\r\n  121.06 85.433 l\r\n  132.66 38.433 l\r\n  142.1 38.28 l\r\n  h\r\n  141.3 67.1 m\r\n  137.34 50.4 l\r\n  133.48 67.3 l\r\n  f\r\n  176 52 m\r\n  175.997 50.827 175.83 49.823 175.5 48.99 c\r\n  175.17 48.157 174.607 47.507 173.81 47.04 c\r\n  173.254 46.713 172.604 46.525 171.86 46.474 c\r\n  171.12 46.402 170.26 46.374 169.28 46.39 c\r\n  166.31 46.438 l\r\n  166.346 59.038 l\r\n  168.866 58.998 l\r\n  170.173 58.976 171.269 58.864 172.156 58.662 c\r\n  173.036 58.458 173.776 58.015 174.376 57.332 c\r\n  174.943 56.672 175.353 55.952 175.606 55.172 c\r\n  175.874 54.372 176.006 53.312 176.003 51.992 c\r\n  h\r\n  188.9 84.3 m\r\n  178.9 84.463 l\r\n  170.18 67.463 l\r\n  166.4 67.524 l\r\n  166.449 84.724 l\r\n  158.289 84.856 l\r\n  158.155 38.056 l\r\n  171.955 37.833 l\r\n  173.835 37.803 175.452 37.934 176.805 38.226 c\r\n  178.158 38.519 179.428 39.179 180.615 40.206 c\r\n  181.815 41.233 182.765 42.58 183.465 44.246 c\r\n  184.178 45.893 184.542 47.973 184.555 50.486 c\r\n  184.565 53.946 184.025 56.776 182.935 58.976 c\r\n  181.862 61.176 180.315 63.016 178.295 64.496 c\r\n  f\r\n  218 46.1 m\r\n  208.07 46.261 l\r\n  208.178 84.061 l\r\n  199.978 84.194 l\r\n  199.87 46.394 l\r\n  189.94 46.555 l\r\n  189.914 37.495 l\r\n  218.014 37.039 l\r\n  f\r\n  256 83.2 m\r\n  247.84 83.332 l\r\n  247.75 51.932 l\r\n  241.91 72.332 l\r\n  236.25 72.424 l\r\n  230.3 52.124 l\r\n  230.39 83.524 l\r\n  222.66 83.65 l\r\n  222.526 36.85 l\r\n  232.046 36.695 l\r\n  239.266 60.095 l\r\n  246.336 36.495 l\r\n  255.856 36.34 l\r\n  f\r\n  287 82.7 m\r\n  264 83.073 l\r\n  263.866 36.273 l\r\n  286.866 35.9 l\r\n  286.892 44.96 l\r\n  272.092 45.201 l\r\n  272.115 53.281 l\r\n  285.915 53.057 l\r\n  285.941 62.117 l\r\n  272.141 62.341 l\r\n  272.174 73.941 l\r\n  286.974 73.7 l\r\n  f\r\n  323 82.2 m\r\n  315.1 82.328 l\r\n  301.5 50.428 l\r\n  301.592 82.528 l\r\n  294.072 82.65 l\r\n  293.938 35.85 l\r\n  303.738 35.691 l\r\n  315.438 62.291 l\r\n  315.361 35.491 l\r\n  322.881 35.369 l\r\n  f\r\n  356 43.9 m\r\n  346.07 44.061 l\r\n  346.178 81.861 l\r\n  337.978 81.994 l\r\n  337.87 44.194 l\r\n  327.94 44.355 l\r\n  327.914 35.295 l\r\n  356.014 34.839 l\r\n  f\r\n  390 81.1 m\r\n  381.52 81.238 l\r\n  379.29 71.808 l\r\n  367.49 71.999 l\r\n  365.32 81.499 l\r\n  357.06 81.633 l\r\n  368.66 34.633 l\r\n  378.1 34.48 l\r\n  h\r\n  377.3 63.3 m\r\n  373.34 46.6 l\r\n  369.48 63.5 l\r\n  f\r\n  418 80.6 m\r\n  395.1 80.972 l\r\n  394.966 34.172 l\r\n  403.166 34.039 l\r\n  403.274 71.839 l\r\n  417.974 71.6 l\r\n  f\r\n  `,\r\n    CONFIDENTIAL: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  48 86.5 m\r\n  45.613 86.541 43.403 86.084 41.37 85.13 c\r\n  39.35 84.177 37.61 82.737 36.15 80.81 c\r\n  34.69 78.883 33.55 76.467 32.73 73.56 c\r\n  31.923 70.653 31.513 67.287 31.5 63.46 c\r\n  31.483 59.9 31.849 56.663 32.6 53.75 c\r\n  33.347 50.837 34.44 48.333 35.88 46.24 c\r\n  37.267 44.227 38.983 42.657 41.03 41.53 c\r\n  43.097 40.41 45.35 39.827 47.79 39.78 c\r\n  49.143 39.757 50.36 39.847 51.44 40.05 c\r\n  52.533 40.233 53.54 40.487 54.46 40.814 c\r\n  55.427 41.18 56.297 41.597 57.07 42.064 c\r\n  57.863 42.513 58.557 42.933 59.15 43.324 c\r\n  59.203 54.224 l\r\n  58.254 54.24 l\r\n  57.849 53.764 57.336 53.201 56.714 52.55 c\r\n  56.107 51.896 55.414 51.253 54.634 50.62 c\r\n  53.84 49.99 52.984 49.46 52.064 49.03 c\r\n  51.144 48.603 50.157 48.398 49.104 48.416 c\r\n  47.937 48.436 46.83 48.717 45.784 49.258 c\r\n  44.737 49.78 43.77 50.643 42.884 51.848 c\r\n  42.044 53.008 41.36 54.538 40.834 56.438 c\r\n  40.326 58.338 40.078 60.638 40.091 63.338 c\r\n  40.104 66.158 40.396 68.508 40.966 70.388 c\r\n  41.55 72.268 42.276 73.745 43.146 74.818 c\r\n  44.026 75.912 45.006 76.692 46.086 77.158 c\r\n  47.166 77.603 48.229 77.816 49.276 77.798 c\r\n  50.282 77.781 51.272 77.553 52.246 77.113 c\r\n  53.232 76.674 54.142 76.084 54.976 75.343 c\r\n  55.676 74.747 56.326 74.111 56.926 73.433 c\r\n  57.526 72.76 58.02 72.177 58.406 71.683 c\r\n  59.268 71.668 l\r\n  59.32 82.368 l\r\n  58.52 82.885 57.753 83.372 57.02 83.828 c\r\n  56.286 84.284 55.52 84.68 54.72 85.018 c\r\n  53.673 85.459 52.69 85.799 51.77 86.038 c\r\n  f\r\n  96.6 62.3 m\r\n  96.635 69.433 95.195 75.167 92.28 79.5 c\r\n  89.367 83.76 85.333 85.933 80.18 86.02 c\r\n  75.02 86.108 70.953 84.075 67.98 79.92 c\r\n  65.027 75.74 63.533 70.073 63.5 62.92 c\r\n  63.465 55.72 64.905 49.987 67.82 45.72 c\r\n  70.733 41.46 74.767 39.287 79.92 39.2 c\r\n  85.067 39.112 89.133 41.145 92.12 45.3 c\r\n  95.087 49.433 96.587 55.1 96.62 62.3 c\r\n  h\r\n  85.7 73.9 m\r\n  86.5 72.52 87.09 70.9 87.47 69.04 c\r\n  87.849 67.16 88.033 64.963 88.02 62.45 c\r\n  88.007 59.75 87.773 57.46 87.318 55.58 c\r\n  86.863 53.693 86.273 52.173 85.548 51.02 c\r\n  84.808 49.827 83.955 48.967 82.988 48.44 c\r\n  82.035 47.913 81.041 47.658 80.008 47.676 c\r\n  78.961 47.694 77.971 47.973 77.038 48.512 c\r\n  76.118 49.051 75.275 49.931 74.508 51.152 c\r\n  73.795 52.292 73.211 53.862 72.758 55.862 c\r\n  72.322 57.842 72.11 60.142 72.123 62.762 c\r\n  72.136 65.442 72.363 67.722 72.803 69.602 c\r\n  73.258 71.469 73.848 72.989 74.573 74.162 c\r\n  75.3 75.335 76.146 76.195 77.113 76.742 c\r\n  78.08 77.289 79.093 77.554 80.153 77.535 c\r\n  81.22 77.517 82.233 77.218 83.193 76.638 c\r\n  84.153 76.038 84.99 75.128 85.703 73.908 c\r\n  f\r\n  132 84.2 m\r\n  124.02 84.336 l\r\n  110.22 53.736 l\r\n  110.369 84.636 l\r\n  102.779 84.766 l\r\n  102.562 39.766 l\r\n  112.462 39.597 l\r\n  124.262 65.197 l\r\n  124.138 39.397 l\r\n  131.728 39.267 l\r\n  f\r\n  163 47.4 m\r\n  148.2 47.653 l\r\n  148.24 56.013 l\r\n  161.94 55.779 l\r\n  161.982 64.479 l\r\n  148.282 64.713 l\r\n  148.375 83.913 l\r\n  140.135 84.054 l\r\n  139.918 39.054 l\r\n  162.918 38.66 l\r\n  f\r\n  186 83.3 m\r\n  167.2 83.622 l\r\n  167.161 75.652 l\r\n  172.421 75.562 l\r\n  172.281 46.562 l\r\n  167.022 46.652 l\r\n  166.983 38.682 l\r\n  185.783 38.36 l\r\n  185.822 46.33 l\r\n  180.562 46.42 l\r\n  180.702 75.42 l\r\n  185.962 75.33 l\r\n  f\r\n  223 60.2 m\r\n  223.02 64.387 222.357 68.153 221.01 71.5 c\r\n  219.663 74.827 217.95 77.393 215.87 79.2 c\r\n  214.31 80.553 212.597 81.51 210.73 82.07 c\r\n  208.863 82.625 206.65 82.925 204.09 82.969 c\r\n  192.79 83.163 l\r\n  192.573 38.163 l\r\n  204.173 37.964 l\r\n  206.786 37.919 209.043 38.193 210.943 38.784 c\r\n  212.843 39.355 214.443 40.192 215.743 41.294 c\r\n  217.963 43.147 219.713 45.674 220.993 48.874 c\r\n  222.286 52.054 222.943 55.821 222.963 60.174 c\r\n  h\r\n  214.44 60.256 m\r\n  214.426 57.296 214.026 54.776 213.24 52.696 c\r\n  212.467 50.596 211.243 48.966 209.57 47.806 c\r\n  208.717 47.237 207.847 46.86 206.96 46.676 c\r\n  206.08 46.469 204.75 46.381 202.97 46.412 c\r\n  200.88 46.448 l\r\n  201.016 74.548 l\r\n  203.106 74.512 l\r\n  205.073 74.478 206.516 74.333 207.436 74.076 c\r\n  208.356 73.799 209.253 73.322 210.126 72.646 c\r\n  211.626 71.413 212.726 69.783 213.426 67.756 c\r\n  214.119 65.709 214.459 63.196 214.446 60.216 c\r\n  f\r\n  253 82.1 m\r\n  229.8 82.497 l\r\n  229.583 37.497 l\r\n  252.783 37.1 l\r\n  252.825 45.8 l\r\n  237.825 46.056 l\r\n  237.862 53.816 l\r\n  251.762 53.578 l\r\n  251.804 62.278 l\r\n  237.904 62.516 l\r\n  237.958 73.616 l\r\n  252.958 73.36 l\r\n  f\r\n  289 81.5 m\r\n  281.02 81.636 l\r\n  267.22 51.036 l\r\n  267.369 81.936 l\r\n  259.779 82.066 l\r\n  259.562 37.066 l\r\n  269.462 36.897 l\r\n  281.262 62.497 l\r\n  281.138 36.697 l\r\n  288.728 36.567 l\r\n  f\r\n  322 44.7 m\r\n  312 44.872 l\r\n  312.175 81.172 l\r\n  303.895 81.314 l\r\n  303.72 45.014 l\r\n  293.72 45.186 l\r\n  293.678 36.486 l\r\n  321.978 36.001 l\r\n  f\r\n  345 80.6 m\r\n  326.2 80.922 l\r\n  326.161 72.952 l\r\n  331.421 72.862 l\r\n  331.281 43.862 l\r\n  326.022 43.952 l\r\n  325.983 35.982 l\r\n  344.783 35.66 l\r\n  344.822 43.63 l\r\n  339.562 43.72 l\r\n  339.702 72.72 l\r\n  344.962 72.63 l\r\n  f\r\n  381 79.9 m\r\n  372.44 80.046 l\r\n  370.18 70.996 l\r\n  358.28 71.2 l\r\n  356.1 80.33 l\r\n  347.76 80.473 l\r\n  359.36 35.273 l\r\n  368.89 35.11 l\r\n  h\r\n  368.1 62.8 m\r\n  364.08 46.7 l\r\n  360.21 62.9 l\r\n  f\r\n  409 79.5 m\r\n  385.8 79.896 l\r\n  385.583 34.896 l\r\n  393.863 34.754 l\r\n  394.038 71.054 l\r\n  408.938 70.799 l\r\n  f\r\n  `,\r\n    FINAL: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  148 44.7 m\r\n  126.9 45.053 l\r\n  126.995 54.943 l\r\n  146.495 54.616 l\r\n  146.593 64.916 l\r\n  127.093 65.243 l\r\n  127.31 87.943 l\r\n  115.51 88.14 l\r\n  115.001 35.04 l\r\n  147.801 34.491 l\r\n  f\r\n  181 87 m\r\n  154.2 87.449 l\r\n  154.11 78.029 l\r\n  161.62 77.903 l\r\n  161.292 43.603 l\r\n  153.782 43.729 l\r\n  153.692 34.309 l\r\n  180.492 33.86 l\r\n  180.582 43.28 l\r\n  173.072 43.406 l\r\n  173.4 77.706 l\r\n  180.91 77.58 l\r\n  f\r\n  233 86.1 m\r\n  221.6 86.291 l\r\n  201.8 50.191 l\r\n  202.149 86.691 l\r\n  191.349 86.872 l\r\n  190.84 33.772 l\r\n  204.94 33.536 l\r\n  221.94 63.736 l\r\n  221.649 33.336 l\r\n  232.449 33.155 l\r\n  f\r\n  287 85.2 m\r\n  274.8 85.404 l\r\n  271.53 74.704 l\r\n  254.53 74.988 l\r\n  251.46 85.788 l\r\n  239.56 85.987 l\r\n  255.96 32.587 l\r\n  269.56 32.359 l\r\n  h\r\n  268.6 65 m\r\n  262.78 46 l\r\n  257.33 65.2 l\r\n  f\r\n  326 84.5 m\r\n  292.9 85.053 l\r\n  292.391 31.953 l\r\n  304.191 31.755 l\r\n  304.601 74.655 l\r\n  325.801 74.3 l\r\n  f\r\n  `,\r\n    EXPIRED: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  99.4 88.3 m\r\n  66.3 88.855 l\r\n  65.791 35.755 l\r\n  98.891 35.2 l\r\n  98.989 45.5 l\r\n  77.589 45.858 l\r\n  77.677 55.028 l\r\n  97.577 54.696 l\r\n  97.676 64.996 l\r\n  77.776 65.328 l\r\n  77.902 78.428 l\r\n  99.302 78.07 l\r\n  f\r\n  151 87.5 m\r\n  137.3 87.729 l\r\n  127.3 70.429 l\r\n  117.4 88.129 l\r\n  104.3 88.347 l\r\n  120.3 61.347 l\r\n  104.1 35.247 l\r\n  117.7 35.019 l\r\n  127.4 51.419 l\r\n  137.06 34.719 l\r\n  150.16 34.5 l\r\n  134.36 60.6 l\r\n  f\r\n  195 50.4 m\r\n  195.023 52.78 194.686 55.117 193.99 57.41 c\r\n  193.297 59.683 192.29 61.603 190.97 63.17 c\r\n  189.163 65.297 187.137 66.913 184.89 68.02 c\r\n  182.663 69.127 179.877 69.71 176.53 69.77 c\r\n  169.17 69.893 l\r\n  169.336 87.193 l\r\n  157.536 87.391 l\r\n  157.027 34.291 l\r\n  176.527 33.966 l\r\n  179.44 33.917 181.894 34.174 183.887 34.735 c\r\n  185.9 35.272 187.684 36.112 189.237 37.255 c\r\n  191.097 38.628 192.52 40.402 193.507 42.575 c\r\n  194.514 44.748 195.03 47.368 195.057 50.435 c\r\n  h\r\n  182.8 50.926 m\r\n  182.786 49.426 182.426 48.146 181.72 47.086 c\r\n  181.013 46.006 180.197 45.259 179.27 44.846 c\r\n  178.037 44.295 176.833 44.006 175.66 43.978 c\r\n  174.487 43.926 172.927 43.917 170.98 43.949 c\r\n  168.95 43.983 l\r\n  169.102 59.883 l\r\n  172.492 59.827 l\r\n  174.505 59.793 176.155 59.623 177.442 59.316 c\r\n  178.755 59.008 179.849 58.418 180.722 57.546 c\r\n  181.475 56.772 182.012 55.859 182.332 54.806 c\r\n  182.671 53.732 182.833 52.432 182.818 50.906 c\r\n  f\r\n  228 86.2 m\r\n  201.2 86.649 l\r\n  201.11 77.229 l\r\n  208.62 77.103 l\r\n  208.292 42.803 l\r\n  200.782 42.929 l\r\n  200.692 33.509 l\r\n  227.492 33.06 l\r\n  227.582 42.48 l\r\n  220.072 42.606 l\r\n  220.4 76.906 l\r\n  227.91 76.78 l\r\n  f\r\n  263 48.7 m\r\n  262.987 47.367 262.74 46.23 262.259 45.29 c\r\n  261.778 44.343 260.961 43.607 259.809 43.08 c\r\n  259.002 42.713 258.066 42.502 256.999 42.449 c\r\n  255.932 42.372 254.689 42.345 253.269 42.369 c\r\n  248.989 42.44 l\r\n  249.126 56.74 l\r\n  252.756 56.679 l\r\n  254.643 56.648 256.223 56.514 257.496 56.279 c\r\n  258.769 56.044 259.833 55.537 260.686 54.759 c\r\n  261.499 54.006 262.086 53.186 262.446 52.299 c\r\n  262.827 51.386 263.011 50.183 262.996 48.689 c\r\n  h\r\n  281.8 85.3 m\r\n  267.4 85.541 l\r\n  254.7 66.241 l\r\n  249.25 66.332 l\r\n  249.437 85.832 l\r\n  237.637 86.029 l\r\n  237.128 32.929 l\r\n  256.928 32.597 l\r\n  259.635 32.552 261.965 32.691 263.918 33.015 c\r\n  265.871 33.339 267.705 34.082 269.418 35.245 c\r\n  271.151 36.405 272.531 37.928 273.558 39.815 c\r\n  274.605 41.675 275.141 44.035 275.168 46.895 c\r\n  275.206 50.822 274.446 54.035 272.888 56.535 c\r\n  271.355 59.035 269.138 61.132 266.238 62.825 c\r\n  f\r\n  321 84.6 m\r\n  287.9 85.155 l\r\n  287.391 32.055 l\r\n  320.491 31.5 l\r\n  320.589 41.8 l\r\n  299.189 42.158 l\r\n  299.277 51.328 l\r\n  319.177 50.996 l\r\n  319.276 61.296 l\r\n  299.376 61.628 l\r\n  299.502 74.728 l\r\n  320.902 74.37 l\r\n  f\r\n  373 57.2 m\r\n  373.047 62.147 372.114 66.613 370.2 70.6 c\r\n  368.287 74.533 365.853 77.573 362.9 79.72 c\r\n  360.68 81.327 358.24 82.463 355.58 83.13 c\r\n  352.92 83.793 349.763 84.157 346.11 84.22 c\r\n  329.91 84.49 l\r\n  329.401 31.39 l\r\n  346.001 31.112 l\r\n  349.734 31.05 352.961 31.365 355.681 32.057 c\r\n  358.394 32.724 360.681 33.707 362.541 35.007 c\r\n  365.721 37.194 368.234 40.174 370.081 43.947 c\r\n  371.941 47.7 372.898 52.134 372.951 57.247 c\r\n  h\r\n  360.8 57.297 m\r\n  360.767 53.797 360.183 50.821 359.05 48.367 c\r\n  357.937 45.887 356.183 43.964 353.79 42.597 c\r\n  352.57 41.931 351.323 41.487 350.05 41.267 c\r\n  348.797 41.027 346.897 40.928 344.35 40.97 c\r\n  341.36 41.02 l\r\n  341.678 74.32 l\r\n  344.668 74.27 l\r\n  347.481 74.223 349.541 74.046 350.848 73.738 c\r\n  352.161 73.407 353.438 72.837 354.678 72.028 c\r\n  356.818 70.562 358.381 68.632 359.368 66.238 c\r\n  360.348 63.818 360.821 60.848 360.788 57.328 c\r\n  f\r\n  `,\r\n    AS_IS: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  170 87.2 m\r\n  157.8 87.404 l\r\n  154.53 76.704 l\r\n  137.53 76.988 l\r\n  134.46 87.788 l\r\n  122.56 87.987 l\r\n  138.96 34.587 l\r\n  152.56 34.359 l\r\n  h\r\n  151.6 67 m\r\n  145.78 48 l\r\n  140.33 67.2 l\r\n  f\r\n  213 69.7 m\r\n  213.05 74.933 211.173 79.233 207.37 82.6 c\r\n  203.583 85.927 198.417 87.643 191.87 87.75 c\r\n  188.077 87.813 184.76 87.488 181.92 86.774 c\r\n  179.1 86.034 176.453 85.091 173.98 83.944 c\r\n  173.858 71.244 l\r\n  175.148 71.222 l\r\n  177.615 73.442 180.361 75.132 183.388 76.292 c\r\n  186.435 77.452 189.355 78.009 192.148 77.962 c\r\n  192.868 77.95 193.811 77.863 194.978 77.7 c\r\n  196.145 77.538 197.098 77.284 197.838 76.938 c\r\n  198.738 76.495 199.471 75.948 200.038 75.298 c\r\n  200.627 74.646 200.915 73.689 200.903 72.428 c\r\n  200.892 71.262 200.452 70.268 199.583 69.448 c\r\n  198.736 68.608 197.49 67.975 195.843 67.548 c\r\n  194.116 67.101 192.286 66.691 190.353 66.318 c\r\n  188.44 65.922 186.64 65.415 184.953 64.798 c\r\n  181.08 63.412 178.28 61.495 176.553 59.048 c\r\n  174.846 56.575 173.976 53.495 173.943 49.808 c\r\n  173.896 44.862 175.766 40.795 179.553 37.608 c\r\n  183.36 34.402 188.26 32.748 194.253 32.648 c\r\n  197.266 32.598 200.246 32.893 203.193 33.534 c\r\n  206.153 34.151 208.716 34.954 210.883 35.944 c\r\n  211 48.144 l\r\n  209.74 48.166 l\r\n  207.88 46.486 205.6 45.095 202.9 43.995 c\r\n  200.22 42.875 197.487 42.339 194.7 42.386 c\r\n  193.713 42.402 192.73 42.502 191.75 42.684 c\r\n  190.79 42.843 189.86 43.144 188.96 43.587 c\r\n  188.16 43.958 187.477 44.518 186.91 45.267 c\r\n  186.342 45.994 186.063 46.821 186.072 47.747 c\r\n  186.085 49.154 186.559 50.227 187.492 50.967 c\r\n  188.425 51.687 190.175 52.337 192.742 52.917 c\r\n  194.429 53.293 196.042 53.66 197.582 54.017 c\r\n  199.142 54.372 200.819 54.869 202.612 55.508 c\r\n  206.132 56.781 208.735 58.557 210.422 60.837 c\r\n  212.129 63.091 212.999 66.051 213.032 69.718 c\r\n  f\r\n  267 85.5 m\r\n  240.2 85.949 l\r\n  240.11 76.529 l\r\n  247.62 76.403 l\r\n  247.292 42.103 l\r\n  239.782 42.229 l\r\n  239.692 32.809 l\r\n  266.492 32.36 l\r\n  266.582 41.78 l\r\n  259.072 41.906 l\r\n  259.4 76.206 l\r\n  266.91 76.08 l\r\n  f\r\n  313 68.1 m\r\n  313.05 73.333 311.173 77.633 307.37 81 c\r\n  303.583 84.327 298.417 86.043 291.87 86.15 c\r\n  288.077 86.213 284.76 85.888 281.92 85.174 c\r\n  279.1 84.434 276.453 83.491 273.98 82.344 c\r\n  273.858 69.644 l\r\n  275.148 69.622 l\r\n  277.615 71.842 280.361 73.532 283.388 74.692 c\r\n  286.435 75.852 289.355 76.409 292.148 76.362 c\r\n  292.868 76.35 293.811 76.263 294.978 76.1 c\r\n  298.738 74.895 299.471 74.348 300.038 73.698 c\r\n  300.627 73.046 300.915 72.089 300.903 70.828 c\r\n  300.892 69.662 300.452 68.668 299.583 67.848 c\r\n  298.736 67.008 297.49 66.375 295.843 65.948 c\r\n  294.116 65.501 292.286 65.091 290.353 64.718 c\r\n  288.44 64.322 286.64 63.815 284.953 63.198 c\r\n  281.08 61.812 278.28 59.895 276.553 57.448 c\r\n  274.846 54.975 273.976 51.895 273.943 48.208 c\r\n  273.896 43.262 275.766 39.195 279.553 36.008 c\r\n  283.36 32.802 288.26 31.148 294.253 31.048 c\r\n  297.266 30.998 300.246 31.293 303.193 31.934 c\r\n  306.153 32.551 308.716 33.354 310.883 34.344 c\r\n  311 46.544 l\r\n  309.74 46.565 l\r\n  307.88 44.885 305.6 43.495 302.9 42.395 c\r\n  300.22 41.275 297.487 40.739 294.7 40.785 c\r\n  293.713 40.802 292.73 40.902 291.75 41.084 c\r\n  290.79 41.243 289.86 41.544 288.96 41.987 c\r\n  288.16 42.357 287.477 42.917 286.91 43.667 c\r\n  286.342 44.394 286.063 45.221 286.072 46.147 c\r\n  286.085 47.554 286.559 48.627 287.492 49.367 c\r\n  288.425 50.087 290.175 50.737 292.742 51.317 c\r\n  294.429 51.693 296.042 52.06 297.582 52.417 c\r\n  299.142 52.772 300.819 53.269 302.612 53.907 c\r\n  306.132 55.181 308.735 56.957 310.422 59.237 c\r\n  312.129 61.491 312.999 64.451 313.032 68.117 c\r\n  f  \r\n  `,\r\n    SOLD: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  166 70.5 m\r\n  166.05 75.733 164.173 80.033 160.37 83.4 c\r\n  156.583 86.727 151.417 88.443 144.87 88.55 c\r\n  141.077 88.613 137.76 88.288 134.92 87.574 c\r\n  132.1 86.834 129.453 85.891 126.98 84.744 c\r\n  126.858 72.044 l\r\n  128.148 72.022 l\r\n  130.615 74.242 133.361 75.932 136.388 77.092 c\r\n  139.435 78.252 142.355 78.809 145.148 78.762 c\r\n  145.868 78.75 146.811 78.663 147.978 78.5 c\r\n  149.145 78.338 150.098 78.084 150.838 77.738 c\r\n  151.738 77.295 152.471 76.748 153.038 76.098 c\r\n  153.627 75.446 153.915 74.489 153.903 73.228 c\r\n  153.892 72.062 153.452 71.068 152.583 70.248 c\r\n  151.736 69.408 150.49 68.775 148.843 68.348 c\r\n  147.116 67.901 145.286 67.491 143.353 67.118 c\r\n  141.44 66.722 139.64 66.215 137.953 65.598 c\r\n  134.08 64.212 131.28 62.295 129.553 59.848 c\r\n  127.846 57.375 126.976 54.295 126.943 50.608 c\r\n  126.896 45.662 128.766 41.595 132.553 38.408 c\r\n  136.36 35.202 141.26 33.548 147.253 33.448 c\r\n  150.266 33.398 153.246 33.693 156.193 34.334 c\r\n  159.153 34.951 161.716 35.754 163.883 36.744 c\r\n  164 48.944 l\r\n  162.74 48.965 l\r\n  160.88 47.285 158.6 45.895 155.9 44.795 c\r\n  153.22 43.675 150.487 43.139 147.7 43.185 c\r\n  146.713 43.202 145.73 43.302 144.75 43.484 c\r\n  143.79 43.643 142.86 43.944 141.96 44.387 c\r\n  141.16 44.757 140.477 45.317 139.91 46.067 c\r\n  139.342 46.794 139.063 47.621 139.072 48.547 c\r\n  139.085 49.954 139.559 51.027 140.492 51.767 c\r\n  141.425 52.487 143.175 53.137 145.742 53.717 c\r\n  147.429 54.093 149.042 54.46 150.582 54.817 c\r\n  152.142 55.172 153.819 55.669 155.612 56.307 c\r\n  159.132 57.581 161.735 59.357 163.422 61.637 c\r\n  165.129 63.891 165.999 66.851 166.032 70.517 c\r\n  f\r\n  218 59.8 m\r\n  218.081 68.267 216.051 75.033 211.91 80.1 c\r\n  207.77 85.14 202.003 87.723 194.61 87.85 c\r\n  187.277 87.973 181.477 85.583 177.21 80.68 c\r\n  172.977 75.753 170.82 69.053 170.74 60.58 c\r\n  170.658 52.047 172.688 45.28 176.83 40.28 c\r\n  180.97 35.24 186.737 32.657 194.13 32.53 c\r\n  201.463 32.407 207.263 34.797 211.53 39.7 c\r\n  215.783 44.58 217.95 51.28 218.03 59.8 c\r\n  h\r\n  202.5 73.5 m\r\n  203.633 71.86 204.467 69.943 205 67.75 c\r\n  205.533 65.53 205.785 62.933 205.757 59.96 c\r\n  205.726 56.773 205.383 54.067 204.727 51.84 c\r\n  204.07 49.613 203.22 47.82 202.177 46.46 c\r\n  201.117 45.047 199.897 44.033 198.517 43.42 c\r\n  197.157 42.8 195.737 42.502 194.257 42.527 c\r\n  192.757 42.552 191.344 42.885 190.017 43.526 c\r\n  188.71 44.167 187.51 45.21 186.417 46.656 c\r\n  185.404 48.003 184.58 49.859 183.947 52.226 c\r\n  183.333 54.566 183.041 57.283 183.071 60.376 c\r\n  183.101 63.543 183.435 66.239 184.071 68.466 c\r\n  184.728 70.666 185.578 72.459 186.621 73.846 c\r\n  187.661 75.233 188.871 76.246 190.251 76.886 c\r\n  191.631 77.529 193.081 77.838 194.601 77.813 c\r\n  196.121 77.788 197.564 77.431 198.931 76.743 c\r\n  200.298 76.03 201.488 74.95 202.501 73.503 c\r\n  f\r\n  261 85.6 m\r\n  227.9 86.153 l\r\n  227.391 33.053 l\r\n  239.191 32.855 l\r\n  239.601 75.755 l\r\n  260.801 75.4 l\r\n  f\r\n  311 58.3 m\r\n  311.047 63.247 310.114 67.713 308.2 71.7 c\r\n  306.287 75.633 303.853 78.673 300.9 80.82 c\r\n  298.68 82.427 296.24 83.563 293.58 84.23 c\r\n  267.91 85.59 l\r\n  267.401 32.49 l\r\n  284.001 32.212 l\r\n  287.734 32.15 290.961 32.465 293.681 33.157 c\r\n  296.394 33.824 298.681 34.807 300.541 36.107 c\r\n  303.721 38.294 306.234 41.274 308.081 45.047 c\r\n  309.941 48.8 310.898 53.234 310.951 58.347 c\r\n  h\r\n  298.8 58.397 m\r\n  298.767 54.897 298.183 51.921 297.05 49.467 c\r\n  295.937 46.987 294.183 45.064 291.79 43.697 c\r\n  290.57 43.031 289.323 42.587 288.05 42.367 c\r\n  286.797 42.127 284.897 42.028 282.35 42.07 c\r\n  279.36 42.12 l\r\n  279.678 75.42 l\r\n  282.668 75.37 l\r\n  285.481 75.323 287.541 75.146 288.848 74.838 c\r\n  290.161 74.507 291.438 73.937 292.678 73.128 c\r\n  294.818 71.662 296.381 69.732 297.368 67.338 c\r\n  298.348 64.918 298.821 61.948 298.788 58.428 c\r\n  f\r\n  `,\r\n    EXPERIMENTAL: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  55.9 86.5 m\r\n  32.9 86.873 l\r\n  32.766 40.073 l\r\n  55.766 39.7 l\r\n  55.792 48.76 l\r\n  40.992 49.001 l\r\n  41.015 57.081 l\r\n  54.815 56.857 l\r\n  54.841 65.917 l\r\n  41.041 66.141 l\r\n  41.074 77.741 l\r\n  55.874 77.5 l\r\n  f\r\n  91.6 85.9 m\r\n  82.12 86.054 l\r\n  75.22 70.754 l\r\n  68.28 86.254 l\r\n  59.23 86.401 l\r\n  70.43 62.601 l\r\n  59.33 39.501 l\r\n  68.79 39.347 l\r\n  75.45 53.847 l\r\n  82.22 39.147 l\r\n  91.3 39 l\r\n  80.3 61.9 l\r\n  f\r\n  122 53.4 m\r\n  122 55.493 121.757 57.553 121.27 59.58 c\r\n  120.777 61.58 120.071 63.27 119.15 64.65 c\r\n  117.89 66.517 116.477 67.933 114.91 68.9 c\r\n  113.363 69.867 111.43 70.37 109.11 70.41 c\r\n  104.01 70.493 l\r\n  104.054 85.793 l\r\n  95.854 85.926 l\r\n  95.72 39.126 l\r\n  109.22 38.907 l\r\n  111.24 38.874 112.943 39.108 114.33 39.61 c\r\n  115.723 40.091 116.956 40.837 118.03 41.85 c\r\n  119.316 43.063 120.296 44.63 120.97 46.55 c\r\n  121.656 48.47 122.003 50.78 122.01 53.48 c\r\n  h\r\n  113.52 53.821 m\r\n  113.52 52.501 113.275 51.374 112.784 50.441 c\r\n  112.297 49.488 111.734 48.824 111.094 48.451 c\r\n  110.241 47.962 109.407 47.703 108.594 47.674 c\r\n  107.781 47.624 106.697 47.61 105.344 47.632 c\r\n  103.934 47.655 l\r\n  103.974 61.655 l\r\n  106.324 61.617 l\r\n  107.717 61.595 108.864 61.45 109.764 61.184 c\r\n  110.677 60.918 111.437 60.401 112.044 59.634 c\r\n  112.569 58.954 112.945 58.151 113.174 57.224 c\r\n  113.413 56.278 113.531 55.134 113.527 53.794 c\r\n  f\r\n  151 84.9 m\r\n  128 85.273 l\r\n  127.866 38.473 l\r\n  150.866 38.1 l\r\n  150.892 47.16 l\r\n  136.092 47.401 l\r\n  136.115 55.481 l\r\n  149.915 55.257 l\r\n  149.941 64.317 l\r\n  136.141 64.541 l\r\n  136.174 76.141 l\r\n  150.974 75.9 l\r\n  f\r\n  176 52.1 m\r\n  176 50.927 175.833 49.923 175.5 49.09 c\r\n  175.17 48.257 174.607 47.607 173.81 47.14 c\r\n  173.254 46.813 172.604 46.625 171.86 46.574 c\r\n  171.12 46.502 170.26 46.474 169.28 46.49 c\r\n  166.31 46.538 l\r\n  166.346 59.138 l\r\n  168.866 59.098 l\r\n  170.173 59.076 171.269 58.964 172.156 58.762 c\r\n  173.036 58.558 173.776 58.115 174.376 57.432 c\r\n  174.943 56.772 175.353 56.052 175.606 55.272 c\r\n  175.874 54.471 176.006 53.411 176.003 52.092 c\r\n  h\r\n  188.9 84.4 m\r\n  178.9 84.563 l\r\n  170.18 67.563 l\r\n  166.4 67.624 l\r\n  166.449 84.824 l\r\n  158.289 84.956 l\r\n  158.155 38.156 l\r\n  171.955 37.933 l\r\n  173.835 37.903 175.452 38.034 176.805 38.326 c\r\n  178.158 38.619 179.428 39.279 180.615 40.306 c\r\n  181.815 41.333 182.765 42.68 183.465 44.346 c\r\n  184.178 45.993 184.542 48.073 184.555 50.586 c\r\n  184.565 54.046 184.025 56.876 182.935 59.076 c\r\n  181.862 61.276 180.315 63.116 178.295 64.596 c\r\n  f\r\n  210 84 m\r\n  191.4 84.302 l\r\n  191.376 76.002 l\r\n  196.586 75.917 l\r\n  196.5 45.717 l\r\n  191.29 45.802 l\r\n  191.266 37.502 l\r\n  209.866 37.2 l\r\n  209.89 45.5 l\r\n  204.68 45.585 l\r\n  204.766 75.785 l\r\n  209.976 75.7 l\r\n  f\r\n  250 83.3 m\r\n  241.84 83.432 l\r\n  241.75 52.032 l\r\n  235.91 72.432 l\r\n  230.25 72.524 l\r\n  224.3 52.224 l\r\n  224.39 83.624 l\r\n  216.66 83.75 l\r\n  216.526 36.95 l\r\n  226.046 36.795 l\r\n  233.266 60.195 l\r\n  240.336 36.595 l\r\n  249.856 36.44 l\r\n  f\r\n  281 82.8 m\r\n  258 83.173 l\r\n  257.866 36.373 l\r\n  280.866 36 l\r\n  280.892 45.06 l\r\n  266.092 45.301 l\r\n  266.115 53.381 l\r\n  279.915 53.157 l\r\n  279.941 62.217 l\r\n  266.141 62.441 l\r\n  266.174 74.041 l\r\n  280.974 73.8 l\r\n  f\r\n  316 82.3 m\r\n  308.1 82.428 l\r\n  294.5 50.528 l\r\n  294.592 82.628 l\r\n  287.072 82.75 l\r\n  286.938 35.95 l\r\n  296.738 35.791 l\r\n  308.438 62.391 l\r\n  308.361 35.591 l\r\n  315.881 35.469 l\r\n  f\r\n  349 44 m\r\n  339.07 44.161 l\r\n  339.178 81.961 l\r\n  330.978 82.094 l\r\n  330.87 44.294 l\r\n  320.94 44.455 l\r\n  320.914 35.395 l\r\n  349.014 34.939 l\r\n  f\r\n  384 81.2 m\r\n  375.52 81.338 l\r\n  373.29 71.908 l\r\n  361.49 72.099 l\r\n  359.32 81.599 l\r\n  351.06 81.733 l\r\n  362.66 34.733 l\r\n  372.1 34.58 l\r\n  h\r\n  371.3 63.4 m\r\n  367.34 46.7 l\r\n  363.48 63.6 l\r\n  f\r\n  411 80.7 m\r\n  388.1 81.072 l\r\n  387.966 34.272 l\r\n  396.166 34.139 l\r\n  396.274 71.939 l\r\n  410.974 71.7 l\r\n  f\r\n  `,\r\n    FOR_COMMENT: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  61.6 49.9 m\r\n  46.8 50.184 l\r\n  46.866 58.134 l\r\n  60.566 57.871 l\r\n  60.635 66.141 l\r\n  46.935 66.404 l\r\n  47.087 84.704 l\r\n  38.837 84.862 l\r\n  38.48 42.162 l\r\n  61.48 41.72 l\r\n  f\r\n  98.7 62.3 m\r\n  98.757 69.1 97.334 74.533 94.43 78.6 c\r\n  91.523 82.653 87.49 84.73 82.33 84.83 c\r\n  77.163 84.929 73.097 83.006 70.13 79.06 c\r\n  67.157 75.1 65.643 69.7 65.59 62.86 c\r\n  65.533 55.993 66.956 50.527 69.86 46.46 c\r\n  72.767 42.407 76.8 40.33 81.96 40.23 c\r\n  87.113 40.131 91.18 42.055 94.16 46 c\r\n  97.147 49.927 98.667 55.327 98.72 62.2 c\r\n  h\r\n  87.8 73.3 m\r\n  88.593 71.98 89.177 70.437 89.55 68.67 c\r\n  89.924 66.883 90.101 64.793 90.081 62.4 c\r\n  90.06 59.833 89.818 57.657 89.357 55.87 c\r\n  88.896 54.077 88.299 52.633 87.567 51.54 c\r\n  86.82 50.407 85.964 49.59 84.997 49.09 c\r\n  84.044 48.591 83.047 48.352 82.007 48.372 c\r\n  80.954 48.392 79.964 48.66 79.037 49.176 c\r\n  78.117 49.691 77.274 50.531 76.507 51.696 c\r\n  75.794 52.783 75.217 54.276 74.777 56.176 c\r\n  74.346 58.063 74.141 60.249 74.162 62.736 c\r\n  74.183 65.283 74.417 67.449 74.864 69.236 c\r\n  75.325 71.009 75.922 72.453 76.654 73.566 c\r\n  80.171 76.533 81.187 76.782 82.254 76.761 c\r\n  83.321 76.741 84.334 76.453 85.294 75.899 c\r\n  86.254 75.326 87.091 74.459 87.804 73.299 c\r\n  f\r\n  123 53.6 m\r\n  122.991 52.527 122.818 51.61 122.48 50.85 c\r\n  122.143 50.09 121.569 49.497 120.76 49.07 c\r\n  120.196 48.775 119.539 48.605 118.79 48.562 c\r\n  118.043 48.5 117.173 48.478 116.18 48.497 c\r\n  113.18 48.555 l\r\n  113.276 60.055 l\r\n  115.826 60.006 l\r\n  117.153 59.981 118.259 59.873 119.146 59.684 c\r\n  120.039 59.495 120.786 59.088 121.386 58.464 c\r\n  121.957 57.86 122.37 57.2 122.626 56.484 c\r\n  122.893 55.751 123.022 54.781 123.012 53.574 c\r\n  h\r\n  136.2 83 m\r\n  126.1 83.194 l\r\n  117.2 67.694 l\r\n  113.38 67.767 l\r\n  113.511 83.467 l\r\n  105.261 83.625 l\r\n  104.904 40.925 l\r\n  118.804 40.658 l\r\n  120.704 40.622 122.341 40.734 123.714 40.995 c\r\n  125.087 41.256 126.374 41.853 127.574 42.785 c\r\n  128.794 43.719 129.761 44.945 130.474 46.465 c\r\n  131.207 47.965 131.584 49.862 131.604 52.155 c\r\n  131.63 55.315 131.097 57.899 130.004 59.905 c\r\n  128.924 61.919 127.367 63.605 125.334 64.965 c\r\n  f\r\n  169 83.2 m\r\n  166.607 83.246 164.393 82.819 162.36 81.92 c\r\n  160.333 81.02 158.587 79.657 157.12 77.83 c\r\n  155.653 76.003 154.503 73.71 153.67 70.95 c\r\n  152.857 68.19 152.433 64.993 152.4 61.36 c\r\n  152.372 57.973 152.728 54.893 153.47 52.12 c\r\n  154.21 49.347 155.3 46.963 156.74 44.97 c\r\n  158.12 43.05 159.837 41.553 161.89 40.48 c\r\n  163.957 39.407 166.213 38.847 168.66 38.8 c\r\n  170.013 38.774 171.23 38.856 172.31 39.046 c\r\n  173.403 39.217 174.413 39.456 175.34 39.763 c\r\n  176.307 40.108 177.18 40.502 177.96 40.943 c\r\n  178.753 41.368 179.447 41.764 180.04 42.133 c\r\n  180.127 52.533 l\r\n  179.177 52.551 l\r\n  178.77 52.1 178.253 51.563 177.627 50.941 c\r\n  177.017 50.321 176.32 49.711 175.537 49.111 c\r\n  174.737 48.514 173.877 48.014 172.957 47.611 c\r\n  168.83 47.059 167.723 47.329 166.677 47.846 c\r\n  165.63 48.345 164.663 49.168 163.777 50.316 c\r\n  162.937 51.423 162.257 52.88 161.737 54.686 c\r\n  161.233 56.493 160.992 58.68 161.014 61.246 c\r\n  161.036 63.926 161.335 66.16 161.912 67.946 c\r\n  162.502 69.733 163.236 71.136 164.112 72.156 c\r\n  164.998 73.19 165.985 73.926 167.072 74.366 c\r\n  168.158 74.786 169.225 74.985 170.272 74.965 c\r\n  171.278 74.946 172.271 74.726 173.251 74.305 c\r\n  174.245 73.885 175.155 73.321 175.981 72.615 c\r\n  176.681 72.047 177.332 71.44 177.931 70.795 c\r\n  178.531 70.152 179.024 69.599 179.411 69.135 c\r\n  180.275 69.119 l\r\n  180.361 79.319 l\r\n  179.561 79.813 178.794 80.276 178.061 80.709 c\r\n  177.327 81.144 176.561 81.524 175.761 81.849 c\r\n  174.714 82.271 173.731 82.596 172.811 82.824 c\r\n  171.891 83.052 170.624 83.181 169.011 83.213 c\r\n  f\r\n  218 60 m\r\n  218.057 66.8 216.634 72.233 213.73 76.3 c\r\n  210.823 80.353 206.79 82.43 201.63 82.53 c\r\n  196.463 82.629 192.397 80.706 189.43 76.76 c\r\n  186.457 72.8 184.943 67.4 184.89 60.56 c\r\n  184.833 53.693 186.256 48.227 189.16 44.16 c\r\n  192.067 40.107 196.1 38.03 201.26 37.93 c\r\n  206.413 37.831 210.48 39.755 213.46 43.7 c\r\n  216.447 47.627 217.967 53.027 218.02 59.9 c\r\n  h\r\n  207.1 71 m\r\n  207.893 69.68 208.477 68.137 208.85 66.37 c\r\n  209.224 64.583 209.401 62.493 209.381 60.1 c\r\n  209.36 57.533 209.118 55.357 208.657 53.57 c\r\n  208.196 51.777 207.599 50.333 206.867 49.24 c\r\n  206.12 48.107 205.264 47.29 204.297 46.79 c\r\n  203.344 46.291 202.347 46.052 201.307 46.072 c\r\n  200.254 46.092 199.264 46.36 198.337 46.876 c\r\n  197.417 47.391 196.574 48.231 195.807 49.396 c\r\n  195.094 50.483 194.517 51.976 194.077 53.876 c\r\n  193.646 55.763 193.441 57.949 193.462 60.436 c\r\n  193.483 62.983 193.717 65.149 194.164 66.936 c\r\n  194.625 68.709 195.222 70.153 195.954 71.266 c\r\n  199.471 74.233 200.487 74.482 201.554 74.461 c\r\n  202.621 74.441 203.634 74.153 204.594 73.599 c\r\n  205.554 73.026 206.391 72.159 207.104 70.999 c\r\n  f\r\n  258 80.6 m\r\n  249.75 80.758 l\r\n  249.511 52.158 l\r\n  243.701 70.858 l\r\n  237.981 70.968 l\r\n  231.861 52.468 l\r\n  232.1 81.068 l\r\n  224.28 81.218 l\r\n  223.923 38.518 l\r\n  233.553 38.333 l\r\n  240.963 59.633 l\r\n  247.993 38.033 l\r\n  257.623 37.848 l\r\n  f\r\n  300 79.8 m\r\n  291.75 79.958 l\r\n  291.511 51.358 l\r\n  285.701 70.058 l\r\n  279.981 70.168 l\r\n  273.861 51.668 l\r\n  274.1 80.268 l\r\n  266.28 80.418 l\r\n  265.923 37.718 l\r\n  275.553 37.533 l\r\n  282.963 58.833 l\r\n  289.993 37.233 l\r\n  299.623 37.048 l\r\n  f\r\n  332 79.2 m\r\n  308.7 79.646 l\r\n  308.343 36.946 l\r\n  331.643 36.5 l\r\n  331.712 44.77 l\r\n  316.712 45.058 l\r\n  316.774 52.438 l\r\n  330.674 52.171 l\r\n  330.743 60.441 l\r\n  316.843 60.708 l\r\n  316.931 71.308 l\r\n  331.931 71.02 l\r\n  f\r\n  368 78.5 m\r\n  360.01 78.653 l\r\n  346.11 49.553 l\r\n  346.355 78.853 l\r\n  338.755 78.999 l\r\n  338.398 36.299 l\r\n  348.308 36.109 l\r\n  360.208 60.409 l\r\n  360.004 35.909 l\r\n  367.604 35.763 l\r\n  f\r\n  401 43.4 m\r\n  391 43.593 l\r\n  391.288 78.093 l\r\n  382.998 78.252 l\r\n  382.71 43.752 l\r\n  372.71 43.945 l\r\n  372.641 35.675 l\r\n  401.041 35.131 l\r\n  f  \r\n  `,\r\n    TOP_SECRET: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  67.5 47.4 m\r\n  55 47.623 l\r\n  55.357 87.423 l\r\n  45.057 87.607 l\r\n  44.7 47.807 l\r\n  32.2 48.03 l\r\n  32.114 38.48 l\r\n  67.314 37.851 l\r\n  f\r\n  113 61.7 m\r\n  113.071 69.567 111.304 75.867 107.7 80.6 c\r\n  104.093 85.287 99.06 87.687 92.6 87.8 c\r\n  86.187 87.915 81.12 85.695 77.4 81.14 c\r\n  73.713 76.56 71.833 70.327 71.76 62.44 c\r\n  71.689 54.507 73.455 48.207 77.06 43.54 c\r\n  80.667 38.853 85.667 36.453 92.06 36.34 c\r\n  98.453 36.226 103.52 38.446 107.26 43 c\r\n  110.967 47.533 112.853 53.767 112.92 61.7 c\r\n  h\r\n  99.5 74.4 m\r\n  100.487 72.88 101.213 71.097 101.68 69.05 c\r\n  102.144 66.983 102.364 64.57 102.339 61.81 c\r\n  102.312 58.85 102.013 56.333 101.44 54.26 c\r\n  100.867 52.193 100.127 50.527 99.22 49.26 c\r\n  98.3 47.947 97.237 47.003 96.03 46.43 c\r\n  94.843 45.854 93.607 45.577 92.32 45.6 c\r\n  91.013 45.623 89.783 45.933 88.63 46.528 c\r\n  87.49 47.123 86.443 48.093 85.49 49.438 c\r\n  84.61 50.691 83.893 52.418 83.34 54.618 c\r\n  82.805 56.798 82.551 59.325 82.577 62.198 c\r\n  82.603 65.138 82.894 67.645 83.449 69.718 c\r\n  84.022 71.765 84.762 73.431 85.669 74.718 c\r\n  86.576 76.005 87.629 76.948 88.829 77.548 c\r\n  90.029 78.146 91.292 78.433 92.619 78.409 c\r\n  93.939 78.385 95.196 78.053 96.389 77.413 c\r\n  97.582 76.75 98.619 75.747 99.499 74.403 c\r\n  f\r\n  153 51.9 m\r\n  153.02 54.113 152.726 56.287 152.12 58.42 c\r\n  151.513 60.533 150.637 62.317 149.49 63.77 c\r\n  147.917 65.743 146.153 67.247 144.2 68.28 c\r\n  142.26 69.307 139.833 69.847 136.92 69.9 c\r\n  130.51 70.014 l\r\n  130.654 86.114 l\r\n  120.354 86.298 l\r\n  119.911 36.898 l\r\n  136.811 36.596 l\r\n  139.351 36.551 141.488 36.789 143.221 37.311 c\r\n  144.974 37.81 146.528 38.59 147.881 39.651 c\r\n  149.501 40.924 150.741 42.571 151.601 44.591 c\r\n  152.474 46.611 152.924 49.048 152.951 51.901 c\r\n  h\r\n  142.4 52.388 m\r\n  142.388 50.995 142.073 49.805 141.457 48.818 c\r\n  140.84 47.811 140.127 47.115 139.317 46.728 c\r\n  138.237 46.217 137.19 45.948 136.177 45.922 c\r\n  135.157 45.874 133.8 45.865 132.107 45.895 c\r\n  130.337 45.927 l\r\n  130.47 60.727 l\r\n  133.42 60.674 l\r\n  135.173 60.643 136.61 60.485 137.73 60.199 c\r\n  138.87 59.913 139.82 59.367 140.58 58.559 c\r\n  141.235 57.839 141.701 56.989 141.98 56.009 c\r\n  142.275 55.009 142.416 53.803 142.403 52.389 c\r\n  f\r\n  211 69.1 m\r\n  211.044 73.967 209.407 77.967 206.09 81.1 c\r\n  202.797 84.187 198.297 85.783 192.59 85.89 c\r\n  189.283 85.949 186.393 85.647 183.92 84.983 c\r\n  181.467 84.296 179.163 83.42 177.01 82.353 c\r\n  176.904 70.553 l\r\n  178.034 70.533 l\r\n  180.181 72.593 182.571 74.166 185.204 75.253 c\r\n  187.857 76.333 190.401 76.853 192.834 76.813 c\r\n  193.459 76.802 194.279 76.721 195.294 76.57 c\r\n  196.314 76.419 197.144 76.183 197.784 75.862 c\r\n  198.564 75.45 199.204 74.94 199.704 74.332 c\r\n  200.217 73.726 200.468 72.836 200.457 71.662 c\r\n  200.447 70.575 200.064 69.652 199.307 68.892 c\r\n  198.567 68.112 197.48 67.522 196.047 67.122 c\r\n  194.54 66.707 192.947 66.327 191.267 65.982 c\r\n  189.6 65.613 188.034 65.143 186.567 64.572 c\r\n  183.194 63.285 180.757 61.505 179.257 59.232 c\r\n  177.77 56.939 177.01 54.079 176.977 50.652 c\r\n  176.936 46.052 178.562 42.285 181.857 39.352 c\r\n  185.17 36.372 189.437 34.835 194.657 34.742 c\r\n  197.284 34.695 199.877 34.969 202.437 35.565 c\r\n  205.017 36.138 207.247 36.885 209.127 37.805 c\r\n  209.229 49.205 l\r\n  208.129 49.225 l\r\n  206.509 47.658 204.522 46.368 202.169 45.355 c\r\n  199.836 44.315 197.456 43.815 195.029 43.855 c\r\n  194.169 43.87 193.312 43.963 192.459 44.133 c\r\n  191.619 44.281 190.809 44.561 190.029 44.973 c\r\n  189.336 45.317 188.742 45.837 188.249 46.533 c\r\n  187.754 47.206 187.511 47.973 187.519 48.833 c\r\n  187.531 50.139 187.941 51.139 188.749 51.833 c\r\n  189.562 52.506 191.086 53.109 193.319 53.643 c\r\n  194.786 53.993 196.192 54.333 197.539 54.663 c\r\n  198.899 54.992 200.359 55.452 201.919 56.043 c\r\n  204.986 57.229 207.252 58.879 208.719 60.993 c\r\n  210.206 63.086 210.962 65.836 210.989 69.243 c\r\n  f\r\n  248 84 m\r\n  219.1 84.515 l\r\n  218.657 35.115 l\r\n  247.557 34.6 l\r\n  247.643 44.15 l\r\n  229.043 44.483 l\r\n  229.119 53.003 l\r\n  246.419 52.694 l\r\n  246.505 62.244 l\r\n  229.205 62.553 l\r\n  229.314 74.753 l\r\n  247.914 74.42 l\r\n  f\r\n  274 84.5 m\r\n  271.033 84.553 268.287 84.06 265.76 83.02 c\r\n  263.247 81.98 261.08 80.403 259.26 78.29 c\r\n  257.433 76.177 256.007 73.527 254.98 70.34 c\r\n  253.967 67.153 253.443 63.453 253.41 59.24 c\r\n  253.375 55.327 253.815 51.76 254.73 48.54 c\r\n  255.65 45.34 257 42.583 258.78 40.27 c\r\n  260.493 38.05 262.623 36.32 265.17 35.08 c\r\n  267.73 33.84 270.53 33.193 273.57 33.14 c\r\n  275.25 33.11 276.76 33.205 278.1 33.424 c\r\n  279.46 33.621 280.713 33.897 281.86 34.253 c\r\n  283.06 34.652 284.147 35.108 285.12 35.623 c\r\n  286.107 36.114 286.97 36.574 287.71 37.003 c\r\n  287.817 49.003 l\r\n  286.637 49.024 l\r\n  286.132 48.502 285.492 47.882 284.717 47.164 c\r\n  283.957 46.451 283.094 45.747 282.127 45.054 c\r\n  281.14 44.361 280.07 43.784 278.917 43.324 c\r\n  277.77 42.858 276.544 42.637 275.237 42.66 c\r\n  273.79 42.686 272.417 42.998 271.117 43.596 c\r\n  269.817 44.172 268.62 45.122 267.527 46.446 c\r\n  266.487 47.726 265.644 49.409 264.997 51.496 c\r\n  264.372 53.589 264.073 56.116 264.1 59.076 c\r\n  264.128 62.169 264.498 64.749 265.21 66.816 c\r\n  265.943 68.883 266.85 70.503 267.93 71.676 c\r\n  269.03 72.876 270.253 73.729 271.6 74.236 c\r\n  272.947 74.721 274.27 74.951 275.57 74.928 c\r\n  276.823 74.906 278.053 74.651 279.26 74.165 c\r\n  280.487 73.678 281.617 73.028 282.65 72.215 c\r\n  283.517 71.558 284.323 70.858 285.07 70.115 c\r\n  285.817 69.375 286.427 68.735 286.9 68.195 c\r\n  287.97 68.176 l\r\n  288.076 79.976 l\r\n  287.083 80.547 286.133 81.083 285.226 81.586 c\r\n  284.319 82.089 283.366 82.525 282.366 82.896 c\r\n  281.066 83.383 279.846 83.76 278.706 84.026 c\r\n  277.566 84.289 275.996 84.439 273.996 84.475 c\r\n  f\r\n  318 48.5 m\r\n  317.989 47.26 317.774 46.203 317.355 45.33 c\r\n  316.936 44.45 316.223 43.767 315.215 43.28 c\r\n  314.515 42.939 313.702 42.743 312.775 42.693 c\r\n  311.848 42.621 310.768 42.596 309.535 42.618 c\r\n  305.805 42.685 l\r\n  305.924 55.985 l\r\n  309.084 55.928 l\r\n  310.731 55.899 312.104 55.775 313.204 55.556 c\r\n  314.311 55.338 315.237 54.868 315.984 54.146 c\r\n  316.691 53.446 317.201 52.686 317.514 51.866 c\r\n  317.846 51.02 318.006 49.9 317.993 48.506 c\r\n  h\r\n  334.4 82.5 m\r\n  321.8 82.724 l\r\n  310.8 64.824 l\r\n  306.06 64.909 l\r\n  306.222 83.009 l\r\n  296.022 83.192 l\r\n  295.579 33.792 l\r\n  312.879 33.484 l\r\n  315.239 33.442 317.269 33.571 318.969 33.873 c\r\n  320.669 34.174 322.266 34.864 323.759 35.943 c\r\n  325.272 37.023 326.472 38.439 327.359 40.193 c\r\n  328.266 41.926 328.732 44.119 328.759 46.773 c\r\n  328.792 50.419 328.132 53.406 326.779 55.733 c\r\n  325.439 58.059 323.509 60.006 320.989 61.573 c\r\n  f\r\n  368 81.9 m\r\n  339.1 82.415 l\r\n  338.657 33.015 l\r\n  367.557 32.5 l\r\n  367.643 42.05 l\r\n  349.043 42.383 l\r\n  349.119 50.903 l\r\n  366.419 50.594 l\r\n  366.505 60.144 l\r\n  349.205 60.453 l\r\n  349.314 72.653 l\r\n  367.914 72.32 l\r\n  f\r\n  407 41.3 m\r\n  394.5 41.523 l\r\n  394.857 81.323 l\r\n  384.557 81.507 l\r\n  384.2 41.707 l\r\n  371.7 41.93 l\r\n  371.614 32.38 l\r\n  406.814 31.751 l\r\n  f  \r\n  `,\r\n    FOR_PUBLIC_RELEASE: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  93.2 32.1 m\r\n  78.5 32.323 l\r\n  78.566 38.583 l\r\n  92.166 38.376 l\r\n  92.234 44.886 l\r\n  78.634 45.093 l\r\n  78.785 59.493 l\r\n  70.605 59.618 l\r\n  70.251 25.918 l\r\n  93.151 25.57 l\r\n  f\r\n  130 41.8 m\r\n  130.056 47.167 128.646 51.467 125.77 54.7 c\r\n  122.89 57.893 118.89 59.53 113.77 59.61 c\r\n  108.643 59.688 104.61 58.175 101.67 55.07 c\r\n  98.723 51.95 97.223 47.717 97.17 42.37 c\r\n  97.113 36.957 98.523 32.657 101.4 29.47 c\r\n  104.28 26.277 108.28 24.64 113.4 24.56 c\r\n  118.513 24.482 122.547 25.995 125.5 29.1 c\r\n  128.46 32.187 129.97 36.453 130.03 41.9 c\r\n  h\r\n  119.2 50.49 m\r\n  119.987 49.45 120.567 48.237 120.94 46.85 c\r\n  121.311 45.443 121.486 43.797 121.466 41.91 c\r\n  121.445 39.89 121.205 38.177 120.748 36.77 c\r\n  120.291 35.363 119.701 34.227 118.978 33.36 c\r\n  118.238 32.467 117.388 31.823 116.428 31.43 c\r\n  115.481 31.037 114.495 30.849 113.468 30.865 c\r\n  112.428 30.881 111.445 31.092 110.518 31.498 c\r\n  109.611 31.904 108.775 32.564 108.008 33.478 c\r\n  107.301 34.331 106.728 35.508 106.288 37.008 c\r\n  105.861 38.495 105.657 40.215 105.678 42.168 c\r\n  105.699 44.175 105.931 45.881 106.375 47.288 c\r\n  106.832 48.681 107.422 49.818 108.145 50.698 c\r\n  108.865 51.578 109.708 52.221 110.675 52.628 c\r\n  111.635 53.035 112.645 53.231 113.705 53.215 c\r\n  114.758 53.199 115.762 52.973 116.715 52.536 c\r\n  117.668 52.085 118.495 51.401 119.195 50.486 c\r\n  f\r\n  154 34.9 m\r\n  153.991 34.053 153.819 33.333 153.485 32.74 c\r\n  153.15 32.142 152.58 31.675 151.775 31.34 c\r\n  151.216 31.107 150.566 30.974 149.825 30.94 c\r\n  149.085 30.891 148.222 30.874 147.235 30.889 c\r\n  144.255 30.934 l\r\n  144.35 39.994 l\r\n  146.88 39.956 l\r\n  148.194 39.936 149.294 39.851 150.18 39.702 c\r\n  151.067 39.552 151.807 39.232 152.4 38.741 c\r\n  152.966 38.265 153.376 37.745 153.63 37.181 c\r\n  153.896 36.604 154.023 35.841 154.013 34.891 c\r\n  h\r\n  167.1 58.1 m\r\n  157.1 58.253 l\r\n  148.27 46.053 l\r\n  144.48 46.111 l\r\n  144.61 58.411 l\r\n  136.43 58.536 l\r\n  136.076 24.836 l\r\n  149.876 24.626 l\r\n  151.763 24.597 153.386 24.685 154.746 24.891 c\r\n  156.106 25.096 157.383 25.566 158.576 26.301 c\r\n  159.783 27.034 160.743 28.001 161.456 29.201 c\r\n  162.183 30.381 162.556 31.874 162.576 33.681 c\r\n  162.602 36.167 162.072 38.204 160.986 39.791 c\r\n  159.919 41.377 158.376 42.704 156.356 43.771 c\r\n  f\r\n  212 34.4 m\r\n  212.016 35.907 211.782 37.387 211.297 38.84 c\r\n  210.812 40.28 210.112 41.497 209.197 42.49 c\r\n  207.937 43.837 206.527 44.86 204.967 45.56 c\r\n  203.42 46.26 201.48 46.63 199.147 46.67 c\r\n  194.027 46.748 l\r\n  194.142 57.748 l\r\n  185.922 57.873 l\r\n  185.568 24.173 l\r\n  199.068 23.967 l\r\n  201.095 23.936 202.801 24.098 204.188 24.454 c\r\n  205.588 24.795 206.828 25.325 207.908 26.044 c\r\n  209.201 26.911 210.191 28.034 210.878 29.414 c\r\n  211.578 30.787 211.938 32.447 211.958 34.394 c\r\n  h\r\n  203.5 34.733 m\r\n  203.49 33.786 203.239 32.976 202.746 32.303 c\r\n  202.253 31.616 201.683 31.143 201.036 30.883 c\r\n  200.176 30.534 199.339 30.351 198.526 30.333 c\r\n  197.713 30.3 196.626 30.294 195.266 30.315 c\r\n  193.856 30.336 l\r\n  193.962 40.436 l\r\n  196.322 40.4 l\r\n  197.722 40.379 198.872 40.271 199.772 40.076 c\r\n  200.685 39.882 201.445 39.508 202.052 38.956 c\r\n  202.575 38.466 202.949 37.886 203.172 37.216 c\r\n  203.407 36.536 203.52 35.713 203.51 34.746 c\r\n  f\r\n  246 44.7 m\r\n  246.044 48.86 244.877 52.067 242.5 54.32 c\r\n  240.127 56.573 236.593 57.733 231.9 57.8 c\r\n  227.233 57.871 223.7 56.818 221.3 54.64 c\r\n  218.893 52.46 217.667 49.3 217.62 45.16 c\r\n  217.394 23.66 l\r\n  225.664 23.534 l\r\n  225.885 44.534 l\r\n  225.91 46.867 226.393 48.601 227.335 49.734 c\r\n  228.275 50.867 229.788 51.417 231.875 51.384 c\r\n  233.928 51.353 235.422 50.779 236.355 49.664 c\r\n  237.302 48.551 237.762 46.781 237.735 44.354 c\r\n  237.514 23.354 l\r\n  245.784 23.228 l\r\n  f\r\n  281 46.1 m\r\n  281.017 47.727 280.718 49.187 280.103 50.48 c\r\n  279.502 51.773 278.662 52.85 277.583 53.71 c\r\n  276.336 54.723 274.96 55.453 273.453 55.9 c\r\n  271.96 56.345 270.056 56.585 267.743 56.62 c\r\n  253.843 56.832 l\r\n  253.489 23.132 l\r\n  265.889 22.944 l\r\n  268.462 22.905 270.342 22.967 271.529 23.129 c\r\n  272.729 23.292 273.919 23.672 275.099 24.269 c\r\n  276.319 24.898 277.229 25.758 277.829 26.849 c\r\n  278.44 27.922 278.753 29.162 278.768 30.569 c\r\n  278.785 32.196 278.392 33.642 277.588 34.909 c\r\n  276.788 36.156 275.648 36.156 274.168 34.909 c\r\n  276.255 35.314 277.915 36.194 279.148 37.549 c\r\n  280.388 38.902 281.021 40.702 281.048 42.949 c\r\n  h\r\n  270.3 32.4 m\r\n  270.3 31.843 270.158 31.286 269.875 30.73 c\r\n  269.612 30.176 269.142 29.769 268.465 29.51 c\r\n  267.863 29.278 267.113 29.161 266.215 29.16 c\r\n  265.328 29.143 264.078 29.147 262.465 29.172 c\r\n  261.694 29.184 l\r\n  261.769 36.304 l\r\n  263.059 36.284 l\r\n  264.359 36.264 265.466 36.225 266.379 36.166 c\r\n  267.292 36.107 268.012 35.945 268.539 35.681 c\r\n  269.279 35.323 269.759 34.87 269.979 34.321 c\r\n  270.202 33.76 270.309 33.116 270.301 32.391 c\r\n  h\r\n  272.46 46.1 m\r\n  272.449 45.033 272.24 44.217 271.834 43.65 c\r\n  271.442 43.068 270.772 42.641 269.824 42.37 c\r\n  269.179 42.184 268.293 42.092 267.164 42.094 c\r\n  266.037 42.096 264.861 42.107 263.634 42.125 c\r\n  261.834 42.153 l\r\n  261.922 50.543 l\r\n  262.522 50.534 l\r\n  264.836 50.498 266.492 50.466 267.492 50.435 c\r\n  268.492 50.405 269.412 50.195 270.252 49.805 c\r\n  271.106 49.415 271.686 48.909 271.992 48.285 c\r\n  272.314 47.647 272.471 46.921 272.462 46.105 c\r\n  f\r\n  310 55.9 m\r\n  287 56.25 l\r\n  286.646 22.55 l\r\n  294.866 22.425 l\r\n  295.152 49.525 l\r\n  309.952 49.3 l\r\n  f\r\n  332 55.6 m\r\n  313.3 55.884 l\r\n  313.237 49.914 l\r\n  318.467 49.834 l\r\n  318.239 28.134 l\r\n  313.009 28.214 l\r\n  312.946 22.244 l\r\n  331.646 21.96 l\r\n  331.709 27.93 l\r\n  326.479 28.01 l\r\n  326.707 49.71 l\r\n  331.937 49.63 l\r\n  f\r\n  353 55.9 m\r\n  350.627 55.936 348.43 55.599 346.41 54.89 c\r\n  344.403 54.183 342.67 53.11 341.21 51.67 c\r\n  339.75 50.23 338.61 48.423 337.79 46.25 c\r\n  336.983 44.077 336.563 41.56 336.53 38.7 c\r\n  336.502 36.033 336.855 33.61 337.59 31.43 c\r\n  338.323 29.25 339.403 27.373 340.83 25.8 c\r\n  342.197 24.287 343.897 23.107 345.93 22.26 c\r\n  347.977 21.413 350.213 20.973 352.64 20.94 c\r\n  353.98 20.92 355.187 20.984 356.26 21.134 c\r\n  357.347 21.268 358.347 21.456 359.26 21.699 c\r\n  360.22 21.971 361.087 22.282 361.86 22.632 c\r\n  362.647 22.967 363.337 23.28 363.93 23.573 c\r\n  364.016 31.733 l\r\n  363.074 31.747 l\r\n  362.67 31.392 362.16 30.969 361.544 30.477 c\r\n  360.939 29.989 360.249 29.509 359.474 29.037 c\r\n  358.68 28.567 357.827 28.174 356.914 27.857 c\r\n  355.994 27.54 355.014 27.389 353.974 27.404 c\r\n  352.82 27.422 351.724 27.635 350.684 28.042 c\r\n  349.644 28.435 348.687 29.082 347.814 29.982 c\r\n  346.98 30.856 346.307 32.002 345.794 33.422 c\r\n  345.294 34.849 345.055 36.572 345.077 38.592 c\r\n  345.099 40.699 345.396 42.459 345.968 43.872 c\r\n  346.554 45.279 347.28 46.382 348.148 47.182 c\r\n  349.028 47.996 350.004 48.576 351.078 48.922 c\r\n  352.151 49.252 353.211 49.41 354.258 49.394 c\r\n  355.258 49.379 356.241 49.206 357.208 48.874 c\r\n  358.188 48.543 359.091 48.1 359.918 47.544 c\r\n  360.611 47.096 361.254 46.62 361.848 46.114 c\r\n  362.442 45.608 362.929 45.171 363.308 44.804 c\r\n  364.165 44.791 l\r\n  364.249 52.841 l\r\n  363.456 53.23 362.696 53.597 361.969 53.941 c\r\n  361.243 54.284 360.483 54.582 359.689 54.835 c\r\n  358.649 55.168 357.673 55.424 356.759 55.603 c\r\n  355.846 55.783 354.589 55.885 352.989 55.909 c\r\n  f\r\n  130 74.7 m\r\n  129.991 73.853 129.819 73.133 129.485 72.54 c\r\n  129.15 71.942 128.58 71.475 127.775 71.14 c\r\n  127.216 70.907 126.566 70.774 125.825 70.74 c\r\n  125.085 70.691 124.222 70.674 123.235 70.689 c\r\n  120.255 70.734 l\r\n  120.35 79.794 l\r\n  122.88 79.756 l\r\n  124.194 79.736 125.294 79.651 126.18 79.502 c\r\n  127.067 79.352 127.807 79.032 128.4 78.541 c\r\n  128.966 78.065 129.376 77.545 129.63 76.981 c\r\n  129.896 76.404 130.023 75.641 130.013 74.691 c\r\n  h\r\n  143.1 97.9 m\r\n  133.1 98.053 l\r\n  124.27 85.853 l\r\n  120.48 85.911 l\r\n  120.61 98.211 l\r\n  112.43 98.336 l\r\n  112.076 64.636 l\r\n  125.876 64.426 l\r\n  127.763 64.397 129.386 64.485 130.746 64.691 c\r\n  132.106 64.896 133.383 65.366 134.576 66.101 c\r\n  135.783 66.834 136.743 67.801 137.456 69.001 c\r\n  138.183 70.181 138.556 71.674 138.576 73.481 c\r\n  138.602 75.967 138.072 78.004 136.986 79.591 c\r\n  135.919 81.177 134.376 82.504 132.356 83.571 c\r\n  f\r\n  170 97.4 m\r\n  146.9 97.751 l\r\n  146.546 64.051 l\r\n  169.646 63.7 l\r\n  169.714 70.21 l\r\n  154.814 70.437 l\r\n  154.876 76.247 l\r\n  168.676 76.037 l\r\n  168.744 82.547 l\r\n  154.944 82.757 l\r\n  155.032 91.077 l\r\n  169.932 90.85 l\r\n  f\r\n  200 97 m\r\n  177 97.35 l\r\n  176.646 63.65 l\r\n  184.866 63.525 l\r\n  185.152 90.625 l\r\n  199.952 90.4 l\r\n  f\r\n  228 96.5 m\r\n  204.9 96.851 l\r\n  204.546 63.151 l\r\n  227.646 62.8 l\r\n  227.714 69.31 l\r\n  212.814 69.537 l\r\n  212.876 75.347 l\r\n  226.676 75.137 l\r\n  226.744 81.647 l\r\n  212.944 81.857 l\r\n  213.032 90.177 l\r\n  227.932 89.95 l\r\n  f\r\n  264 96 m\r\n  255.5 96.129 l\r\n  253.22 89.359 l\r\n  241.42 89.539 l\r\n  239.29 96.379 l\r\n  231 96.505 l\r\n  242.4 62.705 l\r\n  251.87 62.561 l\r\n  h\r\n  251.2 83.2 m\r\n  247.15 71.2 l\r\n  243.36 83.3 l\r\n  f\r\n  294 84.9 m\r\n  294.035 88.213 292.728 90.93 290.08 93.05 c\r\n  287.447 95.157 283.847 96.243 279.28 96.31 c\r\n  276.64 96.35 274.33 96.144 272.35 95.692 c\r\n  270.39 95.225 268.55 94.628 266.83 93.902 c\r\n  266.745 85.832 l\r\n  267.645 85.818 l\r\n  269.358 87.225 271.268 88.295 273.375 89.028 c\r\n  275.495 89.762 277.525 90.115 279.465 90.088 c\r\n  279.965 90.081 280.622 90.025 281.435 89.922 c\r\n  282.248 89.82 282.912 89.659 283.425 89.44 c\r\n  284.05 89.16 284.56 88.813 284.955 88.4 c\r\n  285.365 87.987 285.566 87.38 285.557 86.58 c\r\n  285.549 85.84 285.243 85.21 284.637 84.69 c\r\n  284.046 84.157 283.179 83.757 282.037 83.49 c\r\n  280.837 83.207 279.564 82.948 278.217 82.712 c\r\n  276.884 82.461 275.63 82.141 274.457 81.752 c\r\n  271.764 80.872 269.817 79.659 268.617 78.112 c\r\n  267.43 76.546 266.824 74.596 266.797 72.262 c\r\n  266.764 69.129 268.064 66.556 270.697 64.542 c\r\n  273.344 62.516 276.744 61.469 280.897 61.402 c\r\n  282.997 61.37 285.07 61.557 287.117 61.963 c\r\n  289.177 62.354 290.96 62.861 292.467 63.483 c\r\n  292.549 71.233 l\r\n  291.671 71.247 l\r\n  290.377 70.18 288.791 69.3 286.911 68.607 c\r\n  285.044 67.893 283.141 67.553 281.201 67.587 c\r\n  280.514 67.597 279.831 67.66 279.151 67.777 c\r\n  278.477 67.877 277.831 68.068 277.211 68.349 c\r\n  276.656 68.583 276.183 68.937 275.791 69.409 c\r\n  275.395 69.867 275.201 70.39 275.208 70.979 c\r\n  275.217 71.865 275.545 72.545 276.193 73.019 c\r\n  276.84 73.476 278.057 73.886 279.843 74.249 c\r\n  281.016 74.487 282.139 74.719 283.213 74.944 c\r\n  284.299 75.168 285.466 75.482 286.713 75.885 c\r\n  289.166 76.691 290.976 77.818 292.143 79.265 c\r\n  293.329 80.691 293.936 82.565 293.963 84.885 c\r\n  f\r\n  323 95.1 m\r\n  299.9 95.451 l\r\n  299.546 61.751 l\r\n  322.646 61.4 l\r\n  322.714 67.91 l\r\n  307.815 68.137 l\r\n  307.876 73.947 l\r\n  321.676 73.737 l\r\n  321.744 80.247 l\r\n  307.944 80.457 l\r\n  308.032 88.777 l\r\n  322.932 88.55 l\r\n  f  \r\n  `,\r\n    NOT_FOR_PUBLIC_RELEASE: `33.5 13.4 m\r\n  404.5 6.92 l\r\n  419.6 6.657 431.9 18.52 432.1 33.62 c\r\n  432.89 78.92 l\r\n  433.153 94.02 421.29 106.32 406.19 106.52 c\r\n  35.19 113 l\r\n  20.09 113.263 7.79 101.4 7.59 86.3 c\r\n  6.8 41 l\r\n  6.537 25.9 18.4 13.6 33.5 13.4 c\r\n  s\r\n  140 57.9 m\r\n  132.53 58.021 l\r\n  119.53 35.121 l\r\n  119.759 58.221 l\r\n  112.649 58.336 l\r\n  112.315 24.636 l\r\n  121.585 24.486 l\r\n  132.785 43.586 l\r\n  132.594 24.286 l\r\n  139.704 24.171 l\r\n  f\r\n  177 40.5 m\r\n  177.053 45.867 175.723 50.167 173.01 53.4 c\r\n  170.297 56.593 166.53 58.23 161.71 58.31 c\r\n  156.877 58.388 153.077 56.875 150.31 53.77 c\r\n  147.53 50.65 146.113 46.417 146.06 41.07 c\r\n  146.006 35.657 147.336 31.357 150.05 28.17 c\r\n  152.763 24.977 156.53 23.34 161.35 23.26 c\r\n  166.17 23.182 169.97 24.695 172.75 27.8 c\r\n  175.543 30.887 176.967 35.153 177.02 40.6 c\r\n  h\r\n  166.8 49.19 m\r\n  167.547 48.15 168.093 46.937 168.44 45.55 c\r\n  168.789 44.143 168.955 42.497 168.936 40.61 c\r\n  168.916 38.59 168.69 36.877 168.259 35.47 c\r\n  167.828 34.063 167.271 32.927 166.589 32.06 c\r\n  165.896 31.167 165.096 30.523 164.189 30.13 c\r\n  163.296 29.737 162.366 29.549 161.399 29.565 c\r\n  160.419 29.581 159.492 29.792 158.619 30.198 c\r\n  157.759 30.604 156.972 31.264 156.259 32.178 c\r\n  155.594 33.031 155.054 34.208 154.639 35.708 c\r\n  154.236 37.195 154.045 38.915 154.064 40.868 c\r\n  154.084 42.875 154.303 44.581 154.721 45.988 c\r\n  155.152 47.381 155.709 48.518 156.391 49.398 c\r\n  157.071 50.278 157.864 50.921 158.771 51.328 c\r\n  159.678 51.735 160.628 51.931 161.621 51.915 c\r\n  162.614 51.899 163.561 51.673 164.461 51.236 c\r\n  165.361 50.785 166.141 50.101 166.801 49.186 c\r\n  f\r\n  207 29.7 m\r\n  197.61 29.852 l\r\n  197.879 56.952 l\r\n  190.129 57.077 l\r\n  189.86 29.977 l\r\n  180.47 30.129 l\r\n  180.406 23.619 l\r\n  206.906 23.19 l\r\n  f\r\n  247 29 m\r\n  233.2 29.223 l\r\n  233.262 35.483 l\r\n  246.062 35.276 l\r\n  246.127 41.786 l\r\n  233.327 41.993 l\r\n  233.47 56.393 l\r\n  225.76 56.518 l\r\n  225.426 22.818 l\r\n  246.926 22.47 l\r\n  f\r\n  282 38.8 m\r\n  282.053 44.167 280.723 48.467 278.01 51.7 c\r\n  275.297 54.893 271.53 56.53 266.71 56.61 c\r\n  261.877 56.688 258.077 55.175 255.31 52.07 c\r\n  252.53 48.95 251.113 44.717 251.06 39.37 c\r\n  251.006 33.957 252.336 29.657 255.05 26.47 c\r\n  257.763 23.277 261.53 21.64 266.35 21.56 c\r\n  271.17 21.482 274.97 22.995 277.75 26.1 c\r\n  280.543 29.187 281.967 33.453 282.02 38.9 c\r\n  h\r\n  271.8 47.49 m\r\n  272.547 46.45 273.093 45.237 273.44 43.85 c\r\n  273.789 42.443 273.955 40.797 273.936 38.91 c\r\n  273.916 36.89 273.69 35.177 273.259 33.77 c\r\n  272.828 32.363 272.271 31.227 271.589 30.36 c\r\n  270.896 29.467 270.096 28.823 269.189 28.43 c\r\n  268.296 28.037 267.366 27.849 266.399 27.865 c\r\n  265.419 27.881 264.492 28.092 263.619 28.498 c\r\n  262.759 28.904 261.972 29.564 261.259 30.478 c\r\n  260.594 31.331 260.054 32.508 259.639 34.008 c\r\n  259.236 35.495 259.045 37.215 259.064 39.168 c\r\n  259.084 41.175 259.303 42.881 259.721 44.288 c\r\n  260.152 45.681 260.709 46.818 261.391 47.698 c\r\n  262.071 48.578 262.864 49.221 263.771 49.628 c\r\n  264.678 50.035 265.628 50.231 266.621 50.215 c\r\n  267.614 50.199 268.561 49.973 269.461 49.536 c\r\n  270.361 49.085 271.141 48.401 271.801 47.486 c\r\n  f\r\n  304 31.9 m\r\n  303.992 31.053 303.83 30.333 303.514 29.74 c\r\n  303.199 29.142 302.662 28.675 301.904 28.34 c\r\n  301.377 28.107 300.763 27.974 300.064 27.94 c\r\n  299.364 27.891 298.551 27.874 297.624 27.889 c\r\n  294.814 27.934 l\r\n  294.904 36.994 l\r\n  297.284 36.956 l\r\n  298.524 36.936 299.561 36.851 300.394 36.702 c\r\n  301.227 36.552 301.924 36.232 302.484 35.741 c\r\n  303.018 35.265 303.405 34.745 303.644 34.181 c\r\n  303.894 33.604 304.014 32.841 304.005 31.891 c\r\n  h\r\n  316.3 55.1 m\r\n  306.83 55.253 l\r\n  298.51 43.053 l\r\n  294.94 43.111 l\r\n  295.062 55.411 l\r\n  287.352 55.536 l\r\n  287.018 21.836 l\r\n  300.018 21.626 l\r\n  301.791 21.597 303.321 21.685 304.608 21.891 c\r\n  305.888 22.096 307.091 22.566 308.218 23.301 c\r\n  309.358 24.034 310.261 25.001 310.928 26.201 c\r\n  311.615 27.381 311.965 28.874 311.978 30.681 c\r\n  312.003 33.167 311.506 35.204 310.488 36.791 c\r\n  309.481 38.377 308.028 39.704 306.128 40.771 c\r\n  f\r\n  52 75.7 m\r\n  52.015 77.207 51.794 78.687 51.337 80.14 c\r\n  50.88 81.58 50.22 82.797 49.357 83.79 c\r\n  48.17 85.137 46.84 86.16 45.367 86.86 c\r\n  43.907 87.56 42.08 87.93 39.887 87.97 c\r\n  35.057 88.048 l\r\n  35.166 99.048 l\r\n  27.416 99.173 l\r\n  27.082 65.473 l\r\n  39.882 65.267 l\r\n  41.795 65.236 43.405 65.398 44.712 65.754 c\r\n  46.032 66.095 47.202 66.625 48.222 67.344 c\r\n  49.442 68.211 50.375 69.334 51.022 70.714 c\r\n  51.682 72.087 52.022 73.747 52.042 75.694 c\r\n  h\r\n  43.99 76.033 m\r\n  43.981 75.086 43.744 74.276 43.279 73.603 c\r\n  42.814 72.916 42.278 72.443 41.669 72.183 c\r\n  40.856 71.834 40.066 71.651 39.299 71.633 c\r\n  38.532 71.6 37.509 71.594 36.229 71.615 c\r\n  34.899 71.636 l\r\n  34.999 81.736 l\r\n  37.219 81.7 l\r\n  38.539 81.679 39.622 81.571 40.469 81.376 c\r\n  41.329 81.182 42.046 80.808 42.619 80.256 c\r\n  43.112 79.766 43.462 79.186 43.669 78.516 c\r\n  43.891 77.836 43.997 77.013 43.988 76.046 c\r\n  f\r\n  83.9 86 m\r\n  83.941 90.16 82.841 93.367 80.6 95.62 c\r\n  78.36 97.873 75.04 99.033 70.64 99.1 c\r\n  66.24 99.171 62.907 98.118 60.64 95.94 c\r\n  58.373 93.76 57.217 90.6 57.17 86.46 c\r\n  56.957 64.96 l\r\n  64.747 64.834 l\r\n  64.955 85.834 l\r\n  64.978 88.167 65.431 89.901 66.315 91.034 c\r\n  67.202 92.167 68.628 92.717 70.595 92.684 c\r\n  72.535 92.653 73.942 92.079 74.815 90.964 c\r\n  75.708 89.851 76.142 88.081 76.115 85.654 c\r\n  75.907 64.654 l\r\n  83.697 64.528 l\r\n  f\r\n  117 87.3 m\r\n  117.016 88.927 116.734 90.387 116.155 91.68 c\r\n  115.589 92.973 114.799 94.05 113.785 94.91 c\r\n  112.612 95.923 111.312 96.653 109.885 97.1 c\r\n  108.478 97.545 106.685 97.785 104.505 97.82 c\r\n  91.405 98.032 l\r\n  91.071 64.332 l\r\n  102.771 64.144 l\r\n  105.191 64.105 106.961 64.167 108.081 64.329 c\r\n  109.214 64.492 110.334 64.872 111.441 65.469 c\r\n  112.594 66.098 113.451 66.958 114.011 68.049 c\r\n  114.587 69.122 114.882 70.362 114.896 71.769 c\r\n  114.912 73.396 114.542 74.842 113.786 76.109 c\r\n  113.033 77.356 111.959 77.356 110.566 76.109 c\r\n  112.533 76.514 114.096 77.394 115.256 78.749 c\r\n  116.429 80.102 117.026 81.902 117.046 84.149 c\r\n  h\r\n  106.9 73.6 m\r\n  106.9 73.043 106.767 72.486 106.5 71.93 c\r\n  106.252 71.376 105.812 70.969 105.18 70.71 c\r\n  104.612 70.478 103.905 70.361 103.06 70.36 c\r\n  102.227 70.343 101.05 70.347 99.53 70.372 c\r\n  98.803 70.384 l\r\n  98.874 77.504 l\r\n  100.084 77.484 l\r\n  101.31 77.464 102.354 77.425 103.214 77.366 c\r\n  104.074 77.307 104.75 77.145 105.244 76.881 c\r\n  105.937 76.523 106.39 76.07 106.604 75.521 c\r\n  106.814 74.96 106.915 74.316 106.908 73.591 c\r\n  h\r\n  108.93 87.3 m\r\n  108.919 86.233 108.723 85.417 108.34 84.85 c\r\n  107.971 84.268 107.341 83.841 106.45 83.57 c\r\n  105.843 83.384 105.006 83.292 103.94 83.294 c\r\n  102.873 83.296 101.763 83.307 100.61 83.325 c\r\n  98.91 83.353 l\r\n  98.993 91.743 l\r\n  99.558 91.733 l\r\n  101.738 91.698 103.298 91.666 104.238 91.635 c\r\n  105.178 91.605 106.045 91.395 106.838 91.005 c\r\n  107.645 90.615 108.191 90.109 108.478 89.485 c\r\n  108.781 88.847 108.929 88.121 108.921 87.305 c\r\n  f\r\n  144 97.2 m\r\n  122.3 97.55 l\r\n  121.966 63.85 l\r\n  129.716 63.725 l\r\n  129.985 90.825 l\r\n  143.885 90.6 l\r\n  f\r\n  165 96.9 m\r\n  147.4 97.184 l\r\n  147.341 91.214 l\r\n  152.271 91.134 l\r\n  152.056 69.434 l\r\n  147.126 69.514 l\r\n  147.067 63.544 l\r\n  164.667 63.26 l\r\n  164.726 69.23 l\r\n  159.796 69.31 l\r\n  160.011 91.01 l\r\n  164.941 90.93 l\r\n  f\r\n  185 97.2 m\r\n  182.767 97.236 180.697 96.899 178.79 96.19 c\r\n  176.897 95.483 175.263 94.41 173.89 92.97 c\r\n  172.517 91.53 171.443 89.723 170.67 87.55 c\r\n  169.91 85.377 169.513 82.86 169.48 80 c\r\n  169.454 77.333 169.786 74.91 170.478 72.73 c\r\n  171.171 70.55 172.188 68.673 173.528 67.1 c\r\n  174.821 65.587 176.425 64.407 178.338 63.56 c\r\n  180.271 62.713 182.381 62.273 184.668 62.24 c\r\n  185.935 62.22 187.071 62.284 188.078 62.434 c\r\n  189.105 62.568 190.048 62.756 190.908 62.999 c\r\n  191.815 63.271 192.631 63.582 193.358 63.932 c\r\n  194.105 64.267 194.755 64.58 195.308 64.873 c\r\n  195.389 73.033 l\r\n  194.501 73.047 l\r\n  194.12 72.692 193.637 72.269 193.051 71.777 c\r\n  192.481 71.289 191.831 70.809 191.101 70.337 c\r\n  190.354 69.867 189.551 69.474 188.691 69.157 c\r\n  187.824 68.84 186.901 68.689 185.921 68.704 c\r\n  184.828 68.722 183.794 68.935 182.821 69.342 c\r\n  181.841 69.735 180.938 70.382 180.111 71.282 c\r\n  179.324 72.156 178.691 73.302 178.211 74.722 c\r\n  177.74 76.149 177.515 77.872 177.535 79.892 c\r\n  177.556 81.999 177.836 83.759 178.375 85.172 c\r\n  178.928 86.579 179.611 87.682 180.425 88.482 c\r\n  181.252 89.296 182.172 89.876 183.185 90.222 c\r\n  184.198 90.552 185.195 90.71 186.175 90.694 c\r\n  187.115 90.679 188.042 90.506 188.955 90.174 c\r\n  189.882 89.843 190.732 89.4 191.505 88.844 c\r\n  192.16 88.396 192.767 87.92 193.325 87.414 c\r\n  193.886 86.908 194.346 86.471 194.705 86.104 c\r\n  195.513 86.091 l\r\n  195.593 94.141 l\r\n  194.846 94.53 194.129 94.897 193.443 95.241 c\r\n  192.763 95.584 192.046 95.882 191.293 96.135 c\r\n  190.313 96.468 189.393 96.724 188.533 96.903 c\r\n  f\r\n  232 72.4 m\r\n  231.992 71.553 231.83 70.833 231.514 70.24 c\r\n  231.199 69.642 230.662 69.175 229.904 68.84 c\r\n  229.377 68.607 228.763 68.474 228.064 68.44 c\r\n  227.364 68.391 226.551 68.374 225.624 68.389 c\r\n  222.814 68.434 l\r\n  222.904 77.494 l\r\n  225.284 77.456 l\r\n  226.524 77.436 227.56 77.351 228.394 77.202 c\r\n  229.227 77.052 229.924 76.732 230.484 76.241 c\r\n  231.018 75.765 231.404 75.245 231.644 74.681 c\r\n  231.894 74.104 232.014 73.341 232.005 72.391 c\r\n  h\r\n  244.3 95.6 m\r\n  234.83 95.753 l\r\n  226.51 83.553 l\r\n  222.94 83.611 l\r\n  223.062 95.911 l\r\n  215.352 96.036 l\r\n  215.018 62.336 l\r\n  228.018 62.126 l\r\n  229.791 62.097 231.321 62.185 232.608 62.391 c\r\n  233.888 62.596 235.091 63.066 236.218 63.801 c\r\n  237.358 64.534 238.261 65.501 238.928 66.701 c\r\n  239.615 67.881 239.965 69.374 239.978 71.181 c\r\n  240.003 73.667 239.506 75.704 238.488 77.291 c\r\n  237.481 78.877 236.028 80.204 234.128 81.271 c\r\n  f\r\n  270 95.2 m\r\n  248.3 95.551 l\r\n  247.966 61.851 l\r\n  269.666 61.5 l\r\n  269.731 68.01 l\r\n  255.731 68.237 l\r\n  255.788 74.047 l\r\n  268.788 73.837 l\r\n  268.853 80.347 l\r\n  255.853 80.557 l\r\n  255.935 88.877 l\r\n  269.935 88.65 l\r\n  f\r\n  298 94.7 m\r\n  276.3 95.05 l\r\n  275.966 61.35 l\r\n  283.716 61.225 l\r\n  283.985 88.325 l\r\n  297.885 88.1 l\r\n  f\r\n  324 94.3 m\r\n  302.3 94.651 l\r\n  301.966 60.951 l\r\n  323.666 60.6 l\r\n  323.731 67.11 l\r\n  309.731 67.337 l\r\n  309.788 73.147 l\r\n  322.788 72.937 l\r\n  322.853 79.447 l\r\n  309.853 79.657 l\r\n  309.935 87.977 l\r\n  323.935 87.75 l\r\n  f\r\n  359 93.7 m\r\n  350.99 93.829 l\r\n  348.84 87.059 l\r\n  337.74 87.239 l\r\n  335.73 94.079 l\r\n  327.92 94.205 l\r\n  338.72 60.405 l\r\n  347.64 60.261 l\r\n  h\r\n  346.9 80.9 m\r\n  343.09 68.9 l\r\n  339.52 81 l\r\n  f\r\n  387 82.7 m\r\n  387.033 86.013 385.8 88.73 383.3 90.85 c\r\n  380.82 92.957 377.42 94.043 373.1 94.11 c\r\n  370.613 94.15 368.437 93.944 366.57 93.492 c\r\n  364.723 93.025 362.987 92.428 361.36 91.702 c\r\n  361.28 83.632 l\r\n  362.128 83.618 l\r\n  363.741 85.025 365.541 86.095 367.528 86.828 c\r\n  369.528 87.562 371.445 87.915 373.278 87.888 c\r\n  373.749 87.881 374.369 87.825 375.138 87.722 c\r\n  375.905 87.62 376.528 87.459 377.008 87.24 c\r\n  377.597 86.96 378.077 86.613 378.448 86.2 c\r\n  378.834 85.787 379.023 85.18 379.016 84.38 c\r\n  379.009 83.64 378.72 83.01 378.149 82.49 c\r\n  377.592 81.957 376.772 81.557 375.689 81.29 c\r\n  374.556 81.007 373.356 80.748 372.089 80.512 c\r\n  370.836 80.261 369.656 79.941 368.549 79.552 c\r\n  366.009 78.672 364.172 77.459 363.039 75.912 c\r\n  361.919 74.346 361.349 72.396 361.329 70.062 c\r\n  361.298 66.929 362.525 64.356 365.009 62.342 c\r\n  367.509 60.316 370.729 59.269 374.669 59.202 c\r\n  376.649 59.17 378.602 59.357 380.529 59.763 c\r\n  382.469 60.154 384.149 60.661 385.569 61.283 c\r\n  385.646 69.033 l\r\n  384.818 69.047 l\r\n  383.598 67.98 382.101 67.1 380.328 66.407 c\r\n  378.568 65.693 376.775 65.353 374.948 65.387 c\r\n  374.302 65.397 373.655 65.46 373.008 65.577 c\r\n  372.376 65.677 371.766 65.868 371.178 66.149 c\r\n  370.655 66.383 370.209 66.737 369.838 67.209 c\r\n  369.465 67.667 369.282 68.19 369.288 68.779 c\r\n  369.297 69.665 369.606 70.345 370.217 70.819 c\r\n  370.827 71.276 371.974 71.686 373.657 72.049 c\r\n  374.764 72.287 375.824 72.519 376.837 72.744 c\r\n  377.864 72.968 378.964 73.282 380.137 73.685 c\r\n  382.444 74.491 384.15 75.618 385.257 77.065 c\r\n  386.377 78.491 386.947 80.365 386.967 82.685 c\r\n  f\r\n  414 92.9 m\r\n  392.3 93.251 l\r\n  391.966 59.551 l\r\n  413.666 59.2 l\r\n  413.731 65.71 l\r\n  399.731 65.937 l\r\n  399.788 71.747 l\r\n  412.788 71.537 l\r\n  412.853 78.047 l\r\n  399.853 78.257 l\r\n  399.935 86.577 l\r\n  413.935 86.35 l\r\n  f\r\n  `,\r\n};\r\nconst standardStampCreationInfos = {\r\n    \"/Draft\": {\r\n        textStreamData: standardStampForms.DRAFT,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Draft\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Approved\": {\r\n        textStreamData: standardStampForms.APPROVED,\r\n        color: standardStampColors.greenColor,\r\n        subject: \"Approved\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/NotApproved\": {\r\n        textStreamData: standardStampForms.NOT_APPROVED,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Not Approved\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Departmental\": {\r\n        textStreamData: standardStampForms.DEPARTMENTAL,\r\n        color: standardStampColors.blueColor,\r\n        subject: \"Departmental\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Confidential\": {\r\n        textStreamData: standardStampForms.CONFIDENTIAL,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Confidential\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Final\": {\r\n        textStreamData: standardStampForms.FINAL,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Final\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Expired\": {\r\n        textStreamData: standardStampForms.EXPIRED,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Expired\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/AsIs\": {\r\n        textStreamData: standardStampForms.AS_IS,\r\n        color: standardStampColors.redColor,\r\n        subject: \"As Is\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Sold\": {\r\n        textStreamData: standardStampForms.SOLD,\r\n        color: standardStampColors.blueColor,\r\n        subject: \"Sold\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/Experimental\": {\r\n        textStreamData: standardStampForms.EXPERIMENTAL,\r\n        color: standardStampColors.blueColor,\r\n        subject: \"Experimental\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/ForComment\": {\r\n        textStreamData: standardStampForms.FOR_COMMENT,\r\n        color: standardStampColors.greenColor,\r\n        subject: \"For Comment\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/TopSecret\": {\r\n        textStreamData: standardStampForms.TOP_SECRET,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Top Secret\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/ForPublicRelease\": {\r\n        textStreamData: standardStampForms.FOR_PUBLIC_RELEASE,\r\n        color: standardStampColors.greenColor,\r\n        subject: \"For Public Release\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n    \"/NotForPublicRelease\": {\r\n        textStreamData: standardStampForms.NOT_FOR_PUBLIC_RELEASE,\r\n        color: standardStampColors.redColor,\r\n        subject: \"Not For Public Release\",\r\n        bbox: standardStampBBox,\r\n        rect: standardStampRect,\r\n    },\r\n};\n\nvar __awaiter$E = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass StampAnnotation extends MarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.STAMP);\r\n        this.Name = stampTypes.DRAFT;\r\n        this.IT = \"/Stamp\";\r\n    }\r\n    static createFromDto(dto) {\r\n        var _a;\r\n        if (dto.annotationType !== \"/Stamp\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const created = DateString.fromDate(new Date(dto.dateCreated));\r\n        const modified = DateString.fromDate(new Date(dto.dateModified));\r\n        const apStream = new XFormStream();\r\n        apStream.LastModified = modified;\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Matrix = dto.matrix || [1, 0, 0, 1, 0, 0];\r\n        const annotation = new StampAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author || \"unknown\");\r\n        annotation.M = modified;\r\n        annotation.CreationDate = created;\r\n        annotation.Name = dto.stampType;\r\n        annotation.apStream = apStream;\r\n        const stampCreationInfo = standardStampCreationInfos[dto.stampType];\r\n        if (stampCreationInfo) {\r\n            const stampForm = new XFormStream();\r\n            stampForm.LastModified = modified;\r\n            stampForm.Filter = \"/FlateDecode\";\r\n            stampForm.setTextStreamData(stampCreationInfo.textStreamData);\r\n            const color = stampCreationInfo.color;\r\n            const subject = stampCreationInfo.subject;\r\n            const bBox = stampCreationInfo.bbox;\r\n            const rect = dto.rect || stampCreationInfo.rect || stampCreationInfo.bbox;\r\n            stampForm.BBox = bBox;\r\n            const r = color[0].toFixed(3);\r\n            const g = color[1].toFixed(3);\r\n            const b = color[2].toFixed(3);\r\n            const colorString = `${r} ${g} ${b} rg ${r} ${g} ${b} RG`;\r\n            apStream.BBox = bBox;\r\n            apStream.Resources.setXObject(\"/Fm\", stampForm);\r\n            apStream.setTextStreamData(`q 1 0 0 -1 0 ${bBox[3]} cm ${colorString} 1 j 8.58 w /Fm Do Q`);\r\n            annotation.Rect = rect;\r\n            annotation.Subj = LiteralString.fromString(subject);\r\n            annotation.Contents = dto.textContent\r\n                ? LiteralString.fromString(dto.textContent)\r\n                : annotation.Subj;\r\n            annotation.C = color;\r\n            annotation.CA = 1;\r\n        }\r\n        else if (((_a = dto.stampImageData) === null || _a === void 0 ? void 0 : _a.length) && !(dto.stampImageData.length % 4)) {\r\n            const data = new Uint8Array(dto.stampImageData);\r\n            annotation._customImageData = data;\r\n            const stampMask = new ImageStream();\r\n            const stampMaskDecodeParams = new DecodeParamsDict();\r\n            stampMaskDecodeParams.setIntProp(\"/Predictor\", 12);\r\n            stampMaskDecodeParams.setIntProp(\"/Colors\", 1);\r\n            stampMaskDecodeParams.setIntProp(\"/BitsPerComponent\", 8);\r\n            stampMaskDecodeParams.setIntProp(\"/Columns\", dto.bbox[2]);\r\n            stampMask.DecodeParms = stampMaskDecodeParams;\r\n            stampMask.Filter = \"/FlateDecode\";\r\n            stampMask.BitsPerComponent = 8;\r\n            stampMask.Width = dto.bbox[2];\r\n            stampMask.Height = dto.bbox[3];\r\n            stampMask.ColorSpace = colorSpaces.GRAYSCALE;\r\n            stampMask.streamData = data.filter((v, i) => (i + 1) % 4 === 0);\r\n            const stampImage = new ImageStream();\r\n            const stampImageDecodeParams = new DecodeParamsDict();\r\n            stampImageDecodeParams.setIntProp(\"/Predictor\", 12);\r\n            stampImageDecodeParams.setIntProp(\"/Colors\", 3);\r\n            stampImageDecodeParams.setIntProp(\"/BitsPerComponent\", 8);\r\n            stampImageDecodeParams.setIntProp(\"/Columns\", dto.bbox[2]);\r\n            stampImage.DecodeParms = stampImageDecodeParams;\r\n            stampImage.Filter = \"/FlateDecode\";\r\n            stampImage.BitsPerComponent = 8;\r\n            stampImage.Width = dto.bbox[2];\r\n            stampImage.Height = dto.bbox[3];\r\n            stampImage.ColorSpace = colorSpaces.RGB;\r\n            stampImage.streamData = data.filter((v, i) => (i + 1) % 4 !== 0);\r\n            stampImage.sMask = stampMask;\r\n            apStream.BBox = dto.bbox;\r\n            apStream.Resources.setXObject(\"/Im\", stampImage);\r\n            apStream.setTextStreamData(`q ${dto.bbox[2]} 0 0 ${dto.bbox[3]} 0 0 cm /Im Do Q`);\r\n            annotation.Rect = dto.rect;\r\n            annotation.Subj = dto.stampSubject\r\n                ? LiteralString.fromString(dto.stampSubject)\r\n                : LiteralString.fromString(dto.stampType);\r\n            annotation.Contents = dto.textContent\r\n                ? LiteralString.fromString(dto.textContent)\r\n                : annotation.Subj;\r\n        }\r\n        else {\r\n            throw new Error(\"Custom stamp has no valid image data\");\r\n        }\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$E(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new StampAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Name) {\r\n            bytes.push(...encoder.encode(\"/Name \"), ...encoder.encode(this.Name));\r\n        }\r\n        if (this.IT) {\r\n            bytes.push(...encoder.encode(\"/IT \"), ...encoder.encode(this.IT));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f;\r\n        return {\r\n            annotationType: \"/Stamp\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            stampType: this.Name,\r\n            stampSubject: (_f = this.Subj) === null || _f === void 0 ? void 0 : _f.literal,\r\n            stampImageData: this._customImageData ? [...this._customImageData] : null,\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$E(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Name\":\r\n                            i = yield this.parseNamePropAsync(name, parser, i);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Name) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$D = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst textNoteForms = {\r\n    NOTE: `25 10 m\r\n  175 10 l\r\n  175 10 190 10 190 25 c\r\n  190 135 l\r\n  190 135 190 150 175 150 c\r\n  95 150 l\r\n  10 190 l\r\n  35 150 l\r\n  25 150 l\r\n  25 150 10 150 10 135 c\r\n  10 25 l\r\n  10 25 10 10 25 10 c\r\n  b  \r\n  35 35 m\r\n  165 35 l\r\n  S  \r\n  35 55 m\r\n  165 55 l\r\n  S\r\n  35 75 m\r\n  125 75 l\r\n  S\r\n  35 95 m\r\n  165 95 l\r\n  S\r\n  35 115 m\r\n  115 115 l\r\n  S\r\n  `,\r\n};\r\nconst textNoteCreationInfos = {\r\n    \"/Note\": {\r\n        textStreamData: textNoteForms.NOTE,\r\n        fillColor: [1, 1, 0.4],\r\n        subject: \"Note\",\r\n        bBox: [0, 0, 200, 200],\r\n        rect: [0, 0, 25, 25],\r\n    },\r\n};\r\nclass TextAnnotation extends MarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.TEXT);\r\n        this.Open = false;\r\n        this.Name = annotationIconTypes.NOTE;\r\n    }\r\n    static createStandard(userName, color, type = annotationIconTypes.NOTE) {\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Text\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: userName || \"unknown\",\r\n            textContent: null,\r\n            rect: null,\r\n            matrix: null,\r\n            color,\r\n            textNoteType: type,\r\n        };\r\n        return this.createFromDto(dto);\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Text\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const created = DateString.fromDate(new Date(dto.dateCreated));\r\n        const modified = DateString.fromDate(new Date(dto.dateModified));\r\n        const stampForm = new XFormStream();\r\n        stampForm.LastModified = modified;\r\n        stampForm.Filter = \"/FlateDecode\";\r\n        const stampCreationInfo = textNoteCreationInfos[dto.textNoteType];\r\n        if (!stampCreationInfo) {\r\n            throw new Error(`Stamp type '${dto.textNoteType}' is not supported`);\r\n        }\r\n        stampForm.setTextStreamData(stampCreationInfo.textStreamData);\r\n        const strokeColor = dto.color;\r\n        const fillColor = stampCreationInfo.fillColor;\r\n        const subject = stampCreationInfo.subject;\r\n        const bBox = stampCreationInfo.bBox;\r\n        stampForm.BBox = bBox;\r\n        const strokeR = strokeColor[0].toFixed(3);\r\n        const strokeG = strokeColor[1].toFixed(3);\r\n        const strokeB = strokeColor[2].toFixed(3);\r\n        const fillR = fillColor[0].toFixed(3);\r\n        const fillG = fillColor[1].toFixed(3);\r\n        const fillB = fillColor[2].toFixed(3);\r\n        const strokeString = `${fillR} ${fillG} ${fillB} rg ${strokeR} ${strokeG} ${strokeB} RG`;\r\n        const apStream = new XFormStream();\r\n        apStream.LastModified = modified;\r\n        apStream.BBox = bBox;\r\n        apStream.Matrix = dto.matrix || [1, 0, 0, 1, 0, 0];\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setXObject(\"/Fm\", stampForm);\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.setTextStreamData(`q 1 0 0 -1 0 ${bBox[3]} cm ${strokeString} 1 j 8.58 w /Fm Do Q`);\r\n        const annotation = new TextAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author || \"unknown\");\r\n        annotation.M = modified;\r\n        annotation.CreationDate = created;\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : LiteralString.fromString(subject);\r\n        annotation.Subj = LiteralString.fromString(subject);\r\n        annotation.Name = dto.textNoteType;\r\n        annotation.State = dto.textNoteState;\r\n        annotation.StateModel = dto.textNoteStateModel;\r\n        annotation.Rect = dto.rect || stampCreationInfo.rect;\r\n        annotation.C = strokeColor;\r\n        annotation.CA = 1;\r\n        annotation.apStream = apStream;\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$D(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new TextAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Open) {\r\n            bytes.push(...encoder.encode(\"/Open \"), ...encoder.encode(\" \" + this.Open));\r\n        }\r\n        if (this.Name) {\r\n            bytes.push(...encoder.encode(\"/Name \"), ...encoder.encode(this.Name));\r\n        }\r\n        if (this.State) {\r\n            bytes.push(...encoder.encode(\"/State \"), ...encoder.encode(this.State));\r\n        }\r\n        if (this.StateModel) {\r\n            bytes.push(...encoder.encode(\"/StateModel \"), ...encoder.encode(this.StateModel));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Text\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            color,\r\n            textNoteType: this.Name,\r\n            textNoteState: this.State,\r\n            textNoteStateModel: this.StateModel,\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$D(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Open\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Name\":\r\n                            const iconType = yield parser.parseNameAtAsync(i, true);\r\n                            if (iconType && Object.values(annotationIconTypes)\r\n                                .includes(iconType.value)) {\r\n                                this.Name = iconType.value;\r\n                                i = iconType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Name property value\");\r\n                            }\r\n                            break;\r\n                        case \"/State\":\r\n                            const state = yield parser.parseNameAtAsync(i, true);\r\n                            if (state && Object.values(annotationMarkedStates)\r\n                                .concat(Object.values(annotationReviewStates))\r\n                                .includes(state.value)) {\r\n                                this.State = state.value;\r\n                                i = state.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /State property value\");\r\n                            }\r\n                            break;\r\n                        case \"/StateModel\":\r\n                            const stateModelType = yield parser.parseNameAtAsync(i, true);\r\n                            if (stateModelType && Object.values(annotationStateModelTypes)\r\n                                .includes(stateModelType.value)) {\r\n                                this.StateModel = stateModelType.value;\r\n                                i = stateModelType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /StateModel property value\");\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n    renderHandles() {\r\n        return [];\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$C = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass InkAnnotation extends MarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.INK);\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Ink\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new InkAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        annotation.InkList = dto.inkList;\r\n        annotation.Rect = dto.rect;\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$C(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new InkAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.InkList) {\r\n            bytes.push(...encoder.encode(\"/InkList \"), ...this.encodeNestedPrimitiveArray(this.InkList));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Ink\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            inkList: this.InkList,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a;\r\n        return __awaiter$C(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/InkList\":\r\n                            i = yield parser.skipEmptyAsync(i);\r\n                            const inkType = yield parser.getValueTypeAtAsync(i);\r\n                            if (inkType === valueTypes.ARRAY) {\r\n                                const inkList = [];\r\n                                let inkArrayPos = ++i;\r\n                                while (true) {\r\n                                    const sublist = yield parser.parseNumberArrayAtAsync(inkArrayPos);\r\n                                    if (!sublist) {\r\n                                        break;\r\n                                    }\r\n                                    inkList.push(sublist.value);\r\n                                    inkArrayPos = sublist.end + 1;\r\n                                }\r\n                                this.InkList = inkList;\r\n                                break;\r\n                            }\r\n                            throw new Error(\"Can't parse /InkList property value\");\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!((_a = this.InkList) === null || _a === void 0 ? void 0 : _a.length)) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            yield this.bakeRotationAsync();\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h;\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.D[0]) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.dash) !== null && _d !== void 0 ? _d : 3;\r\n        const strokeGap = (_h = (_f = (_e = this.BS) === null || _e === void 0 ? void 0 : _e.D[1]) !== null && _f !== void 0 ? _f : (_g = this.Border) === null || _g === void 0 ? void 0 : _g.gap) !== null && _h !== void 0 ? _h : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.LJ = lineJoinStyles.ROUND;\r\n        gs.LC = lineCapStyles.ROUND;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        let px;\r\n        let py;\r\n        this.InkList.forEach(list => {\r\n            px = list[0];\r\n            py = list[1];\r\n            streamTextData += `\\n${px} ${py} m`;\r\n            for (let i = 2; i < list.length; i = i + 2) {\r\n                px = list[i];\r\n                py = list[i + 1];\r\n                streamTextData += `\\n${px} ${py} l`;\r\n            }\r\n            streamTextData += \"\\nS\";\r\n        });\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        var _a, _b, _c, _d;\r\n        return __awaiter$C(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            let x;\r\n            let y;\r\n            let xMin;\r\n            let yMin;\r\n            let xMax;\r\n            let yMax;\r\n            const vec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            dict.InkList.forEach(list => {\r\n                for (let i = 0; i < list.length; i = i + 2) {\r\n                    x = list[i];\r\n                    y = list[i + 1];\r\n                    vec.set(x, y).applyMat3(matrix);\r\n                    list[i] = vec.x;\r\n                    list[i + 1] = vec.y;\r\n                    if (!xMin || vec.x < xMin) {\r\n                        xMin = vec.x;\r\n                    }\r\n                    if (!yMin || vec.y < yMin) {\r\n                        yMin = vec.y;\r\n                    }\r\n                    if (!xMax || vec.x > xMax) {\r\n                        xMax = vec.x;\r\n                    }\r\n                    if (!yMax || vec.y > yMax) {\r\n                        yMax = vec.y;\r\n                    }\r\n                }\r\n            });\r\n            const margin = ((_d = (_b = (_a = dict.BS) === null || _a === void 0 ? void 0 : _a.W) !== null && _b !== void 0 ? _b : (_c = dict.Border) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 1) / 2;\r\n            xMin -= margin;\r\n            yMin -= margin;\r\n            xMax += margin;\r\n            yMax += margin;\r\n            this.Rect = [xMin, yMin, xMax, yMax];\r\n            if (this._bBox) {\r\n                const bBox = dict.getLocalBB();\r\n                bBox.ll.set(xMin, yMin);\r\n                bBox.lr.set(xMax, yMin);\r\n                bBox.ur.set(xMax, yMax);\r\n                bBox.ul.set(xMin, yMax);\r\n            }\r\n            this.generateApStream();\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$C(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    bakeRotationAsync() {\r\n        return __awaiter$C(this, void 0, void 0, function* () {\r\n            const angle = this.getCurrentRotation();\r\n            const centerX = (this.Rect[0] + this.Rect[2]) / 2;\r\n            const centerY = (this.Rect[1] + this.Rect[3]) / 2;\r\n            const matrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-centerX, -centerY)\r\n                .applyRotation(angle)\r\n                .applyTranslation(centerX, centerY);\r\n            yield this.applyCommonTransformAsync(matrix);\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$B = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricAnnotation extends MarkupAnnotation {\r\n    constructor(type) {\r\n        super(type);\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.IC) {\r\n            bytes.push(...encoder.encode(\"/IC \"), ...this.encodePrimitiveArray(this.IC, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$B(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/IC\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$A = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass SquareAnnotation extends GeometricAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.SQUARE);\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Square\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new SquareAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        annotation.Rect = dto.rect;\r\n        annotation.RD = dto.rectMargins;\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation._cloud = dto.cloud;\r\n        annotation.generateApStream(dto.bbox, dto.matrix);\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$A(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new SquareAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.RD) {\r\n            bytes.push(...encoder.encode(\"/RD \"), ...this.encodePrimitiveArray(this.RD, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Square\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            rectMargins: this.RD,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            cloud: this._cloud,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$A(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/RD\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n    generateApStream(bbox, matrix) {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h;\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        const streamBbox = bbox\r\n            ? [bbox[0], bbox[1], bbox[2], bbox[3]]\r\n            : [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        apStream.BBox = streamBbox;\r\n        const streamMatrix = matrix\r\n            ? [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]]\r\n            : [1, 0, 0, 1, 0, 0];\r\n        apStream.Matrix = streamMatrix;\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.D[0]) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.dash) !== null && _d !== void 0 ? _d : 3;\r\n        const strokeGap = (_h = (_f = (_e = this.BS) === null || _e === void 0 ? void 0 : _e.D[1]) !== null && _f !== void 0 ? _f : (_g = this.Border) === null || _g === void 0 ? void 0 : _g.gap) !== null && _h !== void 0 ? _h : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        if (!this.RD) {\r\n            const defaultMargin = this._cloud\r\n                ? SquareAnnotation.cloudArcSize / 2\r\n                : strokeWidth / 2;\r\n            this.RD || (this.RD = [defaultMargin, defaultMargin, defaultMargin, defaultMargin]);\r\n        }\r\n        const bBoxToRectMat = calcPdfBBoxToRectMatrices(streamBbox, this.Rect, streamMatrix).matAA;\r\n        const invMatArray = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(bBoxToRectMat).toFloatShortArray();\r\n        const { r: rotation } = apStream.matrix.getTRS();\r\n        const marginsRotationMat = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().applyRotation(rotation);\r\n        const boxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[0], streamBbox[1]);\r\n        const boxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[2], streamBbox[1]);\r\n        const boxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[2], streamBbox[3]);\r\n        const boxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[0], streamBbox[3]);\r\n        const [marginLeft, marginTop, marginRight, marginBottom] = this.RD;\r\n        const marginLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(marginLeft, marginBottom).applyMat3(marginsRotationMat);\r\n        const marginLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(-marginRight, marginBottom).applyMat3(marginsRotationMat);\r\n        const marginUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(-marginRight, -marginTop).applyMat3(marginsRotationMat);\r\n        const marginUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(marginLeft, -marginTop).applyMat3(marginsRotationMat);\r\n        const trBoxLL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxLL, bBoxToRectMat).add(marginLL);\r\n        const trBoxLR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxLR, bBoxToRectMat).add(marginLR);\r\n        const trBoxUR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxUR, bBoxToRectMat).add(marginUR);\r\n        const trBoxUL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxUL, bBoxToRectMat).add(marginUL);\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        streamTextData += `\\n${invMatArray[0]} ${invMatArray[1]} ${invMatArray[2]} ${invMatArray[3]} ${invMatArray[4]} ${invMatArray[5]} cm`;\r\n        if (this._cloud) {\r\n            gs.LC = lineCapStyles.ROUND;\r\n            gs.LJ = lineJoinStyles.ROUND;\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromPolyline([\r\n                trBoxLL.clone(),\r\n                trBoxLR.clone(),\r\n                trBoxUR.clone(),\r\n                trBoxUL.clone(),\r\n                trBoxLL.clone(),\r\n            ], SquareAnnotation.cloudArcSize);\r\n            streamTextData += `\\n${curveData.start.x} ${curveData.start.y} m`;\r\n            curveData.curves.forEach(x => {\r\n                streamTextData += `\\n${x[0].x} ${x[0].y} ${x[1].x} ${x[1].y} ${x[2].x} ${x[2].y} c`;\r\n            });\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        else {\r\n            gs.LC = lineCapStyles.SQUARE;\r\n            gs.LJ = lineJoinStyles.MITER;\r\n            streamTextData += `\\n${trBoxLL.x} ${trBoxLL.y} m`;\r\n            streamTextData += `\\n${trBoxLR.x} ${trBoxLR.y} l`;\r\n            streamTextData += `\\n${trBoxUR.x} ${trBoxUR.y} l`;\r\n            streamTextData += `\\n${trBoxUL.x} ${trBoxUL.y} l`;\r\n            streamTextData += \"\\ns\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        return __awaiter$A(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            dict.applyRectTransform(matrix);\r\n            const stream = dict.apStream;\r\n            if (stream) {\r\n                const newApMatrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.multiply(stream.matrix, matrix);\r\n                dict.generateApStream(stream.BBox, newApMatrix.toFloatShortArray());\r\n            }\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$A(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\r\nSquareAnnotation.cloudArcSize = 20;\n\nvar __awaiter$z = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass CircleAnnotation extends GeometricAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.CIRCLE);\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Circle\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new CircleAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        annotation.Rect = dto.rect;\r\n        annotation.RD = dto.rectMargins;\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation._cloud = dto.cloud;\r\n        annotation.generateApStream(dto.bbox, dto.matrix);\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$z(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new CircleAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.RD) {\r\n            bytes.push(...encoder.encode(\"/RD \"), ...this.encodePrimitiveArray(this.RD, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Circle\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            rectMargins: this.RD,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            cloud: this._cloud,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$z(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/RD\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n        });\r\n    }\r\n    generateApStream(bbox, matrix) {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h;\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        const streamBbox = bbox\r\n            ? [bbox[0], bbox[1], bbox[2], bbox[3]]\r\n            : [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        apStream.BBox = streamBbox;\r\n        const streamMatrix = matrix\r\n            ? [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]]\r\n            : [1, 0, 0, 1, 0, 0];\r\n        apStream.Matrix = streamMatrix;\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.D[0]) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.dash) !== null && _d !== void 0 ? _d : 3;\r\n        const strokeGap = (_h = (_f = (_e = this.BS) === null || _e === void 0 ? void 0 : _e.D[1]) !== null && _f !== void 0 ? _f : (_g = this.Border) === null || _g === void 0 ? void 0 : _g.gap) !== null && _h !== void 0 ? _h : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        gs.LC = lineCapStyles.ROUND;\r\n        gs.LJ = lineJoinStyles.ROUND;\r\n        if (!this.RD) {\r\n            const defaultMargin = this._cloud\r\n                ? CircleAnnotation.cloudArcSize / 2\r\n                : strokeWidth / 2;\r\n            this.RD || (this.RD = [defaultMargin, defaultMargin, defaultMargin, defaultMargin]);\r\n        }\r\n        const bBoxToRectMat = calcPdfBBoxToRectMatrices(streamBbox, this.Rect, streamMatrix).matAA;\r\n        const invMatArray = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(bBoxToRectMat).toFloatShortArray();\r\n        const { r: rotation } = apStream.matrix.getTRS();\r\n        const marginsRotationMat = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().applyRotation(rotation);\r\n        const boxLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[0], streamBbox[1]);\r\n        const boxLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[2], streamBbox[1]);\r\n        const boxUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[2], streamBbox[3]);\r\n        const boxUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(streamBbox[0], streamBbox[3]);\r\n        const [marginLeft, marginTop, marginRight, marginBottom] = this.RD;\r\n        const marginLL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(marginLeft, marginBottom).applyMat3(marginsRotationMat);\r\n        const marginLR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(-marginRight, marginBottom).applyMat3(marginsRotationMat);\r\n        const marginUR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(-marginRight, -marginTop).applyMat3(marginsRotationMat);\r\n        const marginUL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(marginLeft, -marginTop).applyMat3(marginsRotationMat);\r\n        const trBoxLL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxLL, bBoxToRectMat).add(marginLL);\r\n        const trBoxLR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxLR, bBoxToRectMat).add(marginLR);\r\n        const trBoxUR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxUR, bBoxToRectMat).add(marginUR);\r\n        const trBoxUL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(boxUL, bBoxToRectMat).add(marginUL);\r\n        const trBoxCenter = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxLL, trBoxUR).multiplyByScalar(0.5);\r\n        const trBoxLeft = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxLL, trBoxUL).multiplyByScalar(0.5);\r\n        const trBoxTop = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxUL, trBoxUR).multiplyByScalar(0.5);\r\n        const trBoxRight = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxLR, trBoxUR).multiplyByScalar(0.5);\r\n        const trBoxBottom = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxLL, trBoxLR).multiplyByScalar(0.5);\r\n        const rx = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxRight, trBoxLeft).multiplyByScalar(0.5);\r\n        const ry = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxTop, trBoxBottom).multiplyByScalar(0.5);\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        streamTextData += `\\n${invMatArray[0]} ${invMatArray[1]} ${invMatArray[2]} ${invMatArray[3]} ${invMatArray[4]} ${invMatArray[5]} cm`;\r\n        if (this._cloud) {\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromEllipse(rx.getMagnitude(), ry.getMagnitude(), CircleAnnotation.cloudArcSize, new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().applyRotation(rotation).applyTranslation(trBoxCenter.x, trBoxCenter.y));\r\n            streamTextData += `\\n${curveData.start.x} ${curveData.start.y} m`;\r\n            curveData.curves.forEach(x => {\r\n                streamTextData += `\\n${x[0].x} ${x[0].y} ${x[1].x} ${x[1].y} ${x[2].x} ${x[2].y} c`;\r\n            });\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        else {\r\n            const c = BEZIER_CONSTANT;\r\n            const cx = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(rx, c);\r\n            const cy = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.multiplyByScalar(ry, c);\r\n            const controlTR1 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxCenter, ry), cx);\r\n            const controlTR2 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxCenter, cy), rx);\r\n            const controlRB1 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxCenter, cy), rx);\r\n            const controlRB2 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxCenter, ry), cx);\r\n            const controlBL1 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxCenter, ry), cx);\r\n            const controlBL2 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(trBoxCenter, cy), rx);\r\n            const controlLT1 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxCenter, cy), rx);\r\n            const controlLT2 = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(trBoxCenter, ry), cx);\r\n            streamTextData += `\\n${trBoxTop.x} ${trBoxTop.y} m`;\r\n            streamTextData += `\\n${controlTR1.x} ${controlTR1.y} ${controlTR2.x} ${controlTR2.y} ${trBoxRight.x} ${trBoxRight.y} c`;\r\n            streamTextData += `\\n${controlRB1.x} ${controlRB1.y} ${controlRB2.x} ${controlRB2.y} ${trBoxBottom.x} ${trBoxBottom.y} c`;\r\n            streamTextData += `\\n${controlBL1.x} ${controlBL1.y} ${controlBL2.x} ${controlBL2.y} ${trBoxLeft.x} ${trBoxLeft.y} c`;\r\n            streamTextData += `\\n${controlLT1.x} ${controlLT1.y} ${controlLT2.x} ${controlLT2.y} ${trBoxTop.x} ${trBoxTop.y} c`;\r\n            streamTextData += \"\\ns\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        return __awaiter$z(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            dict.applyRectTransform(matrix);\r\n            const stream = dict.apStream;\r\n            if (stream) {\r\n                const newApMatrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.multiply(stream.matrix, matrix);\r\n                dict.generateApStream(stream.BBox, newApMatrix.toFloatShortArray());\r\n            }\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$z(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\r\nCircleAnnotation.cloudArcSize = 20;\n\nvar __awaiter$y = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PolyAnnotation extends GeometricAnnotation {\r\n    constructor(type) {\r\n        super(type);\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.Vertices) {\r\n            bytes.push(...encoder.encode(\"/Vertices \"), ...this.encodePrimitiveArray(this.Vertices, encoder));\r\n        }\r\n        if (this.IT) {\r\n            bytes.push(...encoder.encode(\"/IT \"), ...encoder.encode(this.IT));\r\n        }\r\n        if (this.Measure) {\r\n            bytes.push(...encoder.encode(\"/Measure \"), ...this.Measure.toArray(cryptInfo));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$y(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/Vertices\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/IT\":\r\n                            const intent = yield parser.parseNameAtAsync(i, true);\r\n                            if (intent) {\r\n                                if (Object.values(polyIntents).includes(intent.value)) {\r\n                                    this.IT = intent.value;\r\n                                    i = intent.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(\"Can't parse /IT property value\");\r\n                        case \"/Measure\":\r\n                            const measureEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (measureEntryType === valueTypes.REF) {\r\n                                const measureDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (measureDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const measureParseInfo = yield parseInfo.parseInfoGetterAsync(measureDictId.value.id);\r\n                                    if (measureParseInfo) {\r\n                                        const measureDict = yield MeasureDict.parseAsync(measureParseInfo);\r\n                                        if (measureDict) {\r\n                                            this.Measure = measureDict.value;\r\n                                            i = measureDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Measure value reference\");\r\n                            }\r\n                            else if (measureEntryType === valueTypes.DICTIONARY) {\r\n                                const measureDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (measureDictBounds) {\r\n                                    const measureDict = yield MeasureDict.parseAsync({ parser, bounds: measureDictBounds });\r\n                                    if (measureDict) {\r\n                                        this.Measure = measureDict.value;\r\n                                        i = measureDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Measure value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /Measure property value type: ${measureEntryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.Vertices) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$x = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PolygonAnnotation extends PolyAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.POLYGON);\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Polygon\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new PolygonAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        annotation.Rect = dto.rect;\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.IT = dto.cloud\r\n            ? polyIntents.CLOUD\r\n            : polyIntents.POLYGON_DIMENSION;\r\n        annotation.Vertices = dto.vertices;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$x(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new PolygonAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Polygon\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            vertices: this.Vertices,\r\n            cloud: this.IT === polyIntents.CLOUD,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$x(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            yield this.bakeRotationAsync();\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.Vertices) === null || _a === void 0 ? void 0 : _a.length) || this.Vertices.length < 6) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        const colorString = this.getColorString();\r\n        const list = this.Vertices;\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        if (this.IT === polyIntents.CLOUD) {\r\n            gs.LC = lineCapStyles.ROUND;\r\n            gs.LJ = lineJoinStyles.ROUND;\r\n            const vertices = [];\r\n            for (let i = 0; i < list.length; i = i + 2) {\r\n                vertices.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(list[i], list[i + 1]));\r\n            }\r\n            vertices.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(list[0], list[1]));\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromPolyline(vertices, PolygonAnnotation.cloudArcSize);\r\n            streamTextData += `\\n${curveData.start.x} ${curveData.start.y} m`;\r\n            curveData.curves.forEach(x => {\r\n                streamTextData += `\\n${x[0].x} ${x[0].y} ${x[1].x} ${x[1].y} ${x[2].x} ${x[2].y} c`;\r\n            });\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        else {\r\n            gs.LC = lineCapStyles.SQUARE;\r\n            gs.LJ = lineJoinStyles.MITER;\r\n            let px;\r\n            let py;\r\n            streamTextData += `\\n${list[0]} ${list[1]} m`;\r\n            for (let i = 2; i < list.length; i = i + 2) {\r\n                px = list[i];\r\n                py = list[i + 1];\r\n                streamTextData += `\\n${px} ${py} l`;\r\n            }\r\n            streamTextData += \"\\ns\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        var _a, _b, _c, _d;\r\n        return __awaiter$x(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            let x;\r\n            let y;\r\n            let xMin;\r\n            let yMin;\r\n            let xMax;\r\n            let yMax;\r\n            const vec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const list = dict.Vertices;\r\n            for (let i = 0; i < list.length; i = i + 2) {\r\n                x = list[i];\r\n                y = list[i + 1];\r\n                vec.set(x, y).applyMat3(matrix);\r\n                list[i] = vec.x;\r\n                list[i + 1] = vec.y;\r\n                if (!xMin || vec.x < xMin) {\r\n                    xMin = vec.x;\r\n                }\r\n                if (!yMin || vec.y < yMin) {\r\n                    yMin = vec.y;\r\n                }\r\n                if (!xMax || vec.x > xMax) {\r\n                    xMax = vec.x;\r\n                }\r\n                if (!yMax || vec.y > yMax) {\r\n                    yMax = vec.y;\r\n                }\r\n            }\r\n            const halfStrokeWidth = ((_d = (_b = (_a = dict.BS) === null || _a === void 0 ? void 0 : _a.W) !== null && _b !== void 0 ? _b : (_c = dict.Border) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 1) / 2;\r\n            const margin = dict.IT === polyIntents.CLOUD\r\n                ? PolygonAnnotation.cloudArcSize / 2 + halfStrokeWidth\r\n                : halfStrokeWidth;\r\n            xMin -= margin;\r\n            yMin -= margin;\r\n            xMax += margin;\r\n            yMax += margin;\r\n            dict.Rect = [xMin, yMin, xMax, yMax];\r\n            if (dict._bBox) {\r\n                const bBox = dict.getLocalBB();\r\n                bBox.ll.set(xMin, yMin);\r\n                bBox.lr.set(xMax, yMin);\r\n                bBox.ur.set(xMax, yMax);\r\n                bBox.ul.set(xMin, yMax);\r\n            }\r\n            dict.generateApStream();\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$x(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    bakeRotationAsync() {\r\n        return __awaiter$x(this, void 0, void 0, function* () {\r\n            const angle = this.getCurrentRotation();\r\n            const centerX = (this.Rect[0] + this.Rect[2]) / 2;\r\n            const centerY = (this.Rect[1] + this.Rect[3]) / 2;\r\n            const matrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-centerX, -centerY)\r\n                .applyRotation(angle)\r\n                .applyTranslation(centerX, centerY);\r\n            yield this.applyCommonTransformAsync(matrix);\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\r\nPolygonAnnotation.cloudArcSize = 20;\n\nvar __awaiter$w = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PolylineAnnotation extends PolyAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.POLYLINE);\r\n        this.LE = [lineEndingTypes.NONE, lineEndingTypes.NONE];\r\n    }\r\n    static createFromDto(dto) {\r\n        if (dto.annotationType !== \"/Polyline\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new PolylineAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        annotation.Rect = dto.rect;\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.IT = polyIntents.POLYLINE_DIMENSION;\r\n        annotation.LE = dto.endingType || [lineEndingTypes.NONE, lineEndingTypes.NONE];\r\n        annotation.Vertices = dto.vertices;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$w(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new PolylineAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.LE) {\r\n            bytes.push(...encoder.encode(\"/LE \"), ...this.encodePrimitiveArray(this.LE, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/PolyLine\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            vertices: this.Vertices,\r\n            endingType: this.LE,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$w(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/LE\":\r\n                            const lineEndings = yield parser.parseNameArrayAtAsync(i, true);\r\n                            if (lineEndings\r\n                                && Object.values(lineEndingTypes).includes(lineEndings.value[0])\r\n                                && Object.values(lineEndingTypes).includes(lineEndings.value[1])) {\r\n                                this.LE = [\r\n                                    lineEndings.value[0],\r\n                                    lineEndings.value[1],\r\n                                ];\r\n                                i = lineEndings.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /LE property value\");\r\n                            }\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            yield this.bakeRotationAsync();\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.Vertices) === null || _a === void 0 ? void 0 : _a.length) || this.Vertices.length < 4) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        gs.LC = lineCapStyles.SQUARE;\r\n        gs.LJ = lineJoinStyles.MITER;\r\n        const colorString = this.getColorString();\r\n        const list = this.Vertices;\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        let px;\r\n        let py;\r\n        streamTextData += `\\n${list[0]} ${list[1]} m`;\r\n        for (let i = 2; i < list.length; i = i + 2) {\r\n            px = list[i];\r\n            py = list[i + 1];\r\n            streamTextData += `\\n${px} ${py} l`;\r\n        }\r\n        streamTextData += \"\\nS\";\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        var _a, _b, _c, _d;\r\n        return __awaiter$w(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            let x;\r\n            let y;\r\n            let xMin;\r\n            let yMin;\r\n            let xMax;\r\n            let yMax;\r\n            const vec = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const list = dict.Vertices;\r\n            for (let i = 0; i < list.length; i = i + 2) {\r\n                x = list[i];\r\n                y = list[i + 1];\r\n                vec.set(x, y).applyMat3(matrix);\r\n                list[i] = vec.x;\r\n                list[i + 1] = vec.y;\r\n                if (!xMin || vec.x < xMin) {\r\n                    xMin = vec.x;\r\n                }\r\n                if (!yMin || vec.y < yMin) {\r\n                    yMin = vec.y;\r\n                }\r\n                if (!xMax || vec.x > xMax) {\r\n                    xMax = vec.x;\r\n                }\r\n                if (!yMax || vec.y > yMax) {\r\n                    yMax = vec.y;\r\n                }\r\n            }\r\n            const margin = ((_d = (_b = (_a = dict.BS) === null || _a === void 0 ? void 0 : _a.W) !== null && _b !== void 0 ? _b : (_c = dict.Border) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 1) / 2;\r\n            xMin -= margin;\r\n            yMin -= margin;\r\n            xMax += margin;\r\n            yMax += margin;\r\n            dict.Rect = [xMin, yMin, xMax, yMax];\r\n            if (dict._bBox) {\r\n                const bBox = dict.getLocalBB();\r\n                bBox.ll.set(xMin, yMin);\r\n                bBox.lr.set(xMax, yMin);\r\n                bBox.ur.set(xMax, yMax);\r\n                bBox.ul.set(xMin, yMax);\r\n            }\r\n            dict.generateApStream();\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$w(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    bakeRotationAsync() {\r\n        return __awaiter$w(this, void 0, void 0, function* () {\r\n            const angle = this.getCurrentRotation();\r\n            const centerX = (this.Rect[0] + this.Rect[2]) / 2;\r\n            const centerY = (this.Rect[1] + this.Rect[3]) / 2;\r\n            const matrix = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-centerX, -centerY)\r\n                .applyRotation(angle)\r\n                .applyTranslation(centerX, centerY);\r\n            yield this.applyCommonTransformAsync(matrix);\r\n        });\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$v = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass LineAnnotation extends GeometricAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.LINE);\r\n        this.IT = lineIntents.DIMENSION;\r\n        this.LE = [lineEndingTypes.NONE, lineEndingTypes.NONE];\r\n        this.LLE = 0;\r\n        this.LL = 0;\r\n        this.LLO = 0;\r\n        this.Cap = false;\r\n        this.CP = lineCaptionPositions.INLINE;\r\n        this.CO = [0, 0];\r\n        this._svgTemp = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.SvgTempPath();\r\n        this.onLineEndHandlePointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onLineEndHandlePointerUp);\r\n            target.addEventListener(\"pointerout\", this.onLineEndHandlePointerUp);\r\n            const handleName = target.dataset.handleName;\r\n            switch (handleName) {\r\n                case \"start\":\r\n                    this._scaleHandleActive = \"start\";\r\n                    break;\r\n                case \"end\":\r\n                    this._scaleHandleActive = \"end\";\r\n                    break;\r\n                default:\r\n                    throw new Error(`Invalid handle name: ${handleName}`);\r\n            }\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._svgTemp.insertAfter(this._renderedControls);\r\n                target.addEventListener(\"pointermove\", this.onLineEndHandlePointerMove);\r\n            }, 200);\r\n            e.stopPropagation();\r\n        };\r\n        this.onLineEndHandlePointerMove = (e) => {\r\n            if (!e.isPrimary || !this._scaleHandleActive) {\r\n                return;\r\n            }\r\n            const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.L[0], this.L[1]);\r\n            const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.L[2], this.L[3]);\r\n            let startTemp;\r\n            let endTemp;\r\n            if (this._scaleHandleActive === \"start\") {\r\n                startTemp = this.convertClientCoordsToPage(e.clientX, e.clientY);\r\n                endTemp = end.clone();\r\n            }\r\n            else {\r\n                startTemp = start.clone();\r\n                endTemp = this.convertClientCoordsToPage(e.clientX, e.clientY);\r\n            }\r\n            this._tempTransformationMatrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(start, end, startTemp, endTemp);\r\n            this._svgTemp.set(\"none\", \"blue\", this.strokeWidth, [startTemp, endTemp]);\r\n            this._moved = true;\r\n        };\r\n        this.onLineEndHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onLineEndHandlePointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onLineEndHandlePointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onLineEndHandlePointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this._svgTemp.remove();\r\n            this.applyTempTransformAsync();\r\n        };\r\n    }\r\n    get offsetY() {\r\n        return (Math.abs(this.LL || 0) + (this.LLO || 0)) * (this.LL < 0 ? -1 : 1);\r\n    }\r\n    get minMargin() {\r\n        const strokeWidth = this.strokeWidth;\r\n        const halfStrokeWidth = strokeWidth / 2;\r\n        let marginMin = 0;\r\n        if (this.LE[0] !== lineEndingTypes.NONE || this.LE[1] !== lineEndingTypes.NONE) {\r\n            const endingSizeInner = Math.max(strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n            const endingSize = endingSizeInner + strokeWidth;\r\n            marginMin = endingSize / 2;\r\n        }\r\n        else {\r\n            marginMin = halfStrokeWidth;\r\n        }\r\n        return marginMin;\r\n    }\r\n    static createFromDtoAsync(dto, fontMap) {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            if (dto.annotationType !== \"/Line\") {\r\n                throw new Error(\"Invalid annotation type\");\r\n            }\r\n            const bs = new BorderStyleDict();\r\n            bs.W = dto.strokeWidth;\r\n            if (dto.strokeDashGap) {\r\n                bs.D = dto.strokeDashGap;\r\n            }\r\n            const annotation = new LineAnnotation();\r\n            annotation.$name = dto.uuid;\r\n            annotation.NM = LiteralString.fromString(dto.uuid);\r\n            annotation.T = LiteralString.fromString(dto.author);\r\n            annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n            annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n            annotation.Contents = dto.textContent\r\n                ? LiteralString.fromString(dto.textContent)\r\n                : null;\r\n            annotation.Rect = dto.rect;\r\n            annotation.C = dto.color.slice(0, 3);\r\n            annotation.CA = dto.color[3];\r\n            annotation.BS = bs;\r\n            annotation.IT = dto.intent || lineIntents.DIMENSION;\r\n            annotation.LE = dto.endingType || [lineEndingTypes.NONE, lineEndingTypes.NONE];\r\n            annotation.L = dto.vertices;\r\n            annotation.LL = dto.leaderLineLength || 0;\r\n            annotation.LLE = dto.leaderLineExtension || 0;\r\n            annotation.LLO = dto.leaderLineOffset || 0;\r\n            annotation.Cap = dto.caption;\r\n            annotation.CP = dto.captionPosition || lineCaptionPositions.INLINE;\r\n            annotation.CO = dto.captionOffset || [0, 0];\r\n            annotation._fontMap = fontMap;\r\n            yield annotation.generateApStreamAsync();\r\n            annotation._added = true;\r\n            return annotation.initProxy();\r\n        });\r\n    }\r\n    static parseAsync(parseInfo, fontMap) {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new LineAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                pdfObject._fontMap = fontMap;\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.L) {\r\n            bytes.push(...encoder.encode(\"/L \"), ...this.encodePrimitiveArray(this.L, encoder));\r\n        }\r\n        if (this.LE) {\r\n            bytes.push(...encoder.encode(\"/LE \"), ...this.encodePrimitiveArray(this.LE, encoder));\r\n        }\r\n        if (this.LL) {\r\n            bytes.push(...encoder.encode(\"/LL \"), ...encoder.encode(\" \" + this.LL));\r\n        }\r\n        if (this.LLE) {\r\n            bytes.push(...encoder.encode(\"/LLE \"), ...encoder.encode(\" \" + this.LLE));\r\n        }\r\n        if (this.Cap) {\r\n            bytes.push(...encoder.encode(\"/Cap \"), ...encoder.encode(\" \" + this.Cap));\r\n        }\r\n        if (this.IT) {\r\n            bytes.push(...encoder.encode(\"/IT \"), ...encoder.encode(this.IT));\r\n        }\r\n        if (this.LLO) {\r\n            bytes.push(...encoder.encode(\"/LLO \"), ...encoder.encode(\" \" + this.LLO));\r\n        }\r\n        if (this.CP) {\r\n            bytes.push(...encoder.encode(\"/CP \"), ...encoder.encode(this.CP));\r\n        }\r\n        if (this.Measure) {\r\n            bytes.push(...encoder.encode(\"/Measure \"), ...this.Measure.toArray(cryptInfo));\r\n        }\r\n        if (this.CO) {\r\n            bytes.push(...encoder.encode(\"/CO \"), ...this.encodePrimitiveArray(this.CO, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Line\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            vertices: this.L,\r\n            intent: this.IT,\r\n            endingType: this.LE,\r\n            leaderLineLength: this.LL,\r\n            leaderLineExtension: this.LLE,\r\n            leaderLineOffset: this.LLO,\r\n            caption: this.Cap,\r\n            captionPosition: this.CP,\r\n            captionOffset: this.CO,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    setTextContentAsync(text, undoable = true) {\r\n        const _super = Object.create(null, {\r\n            setTextContentAsync: { get: () => super.setTextContentAsync }\r\n        });\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            yield _super.setTextContentAsync.call(this, text, undoable);\r\n            yield this.updateStreamAsync();\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a;\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/L\":\r\n                        case \"/CO\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/LE\":\r\n                            const lineEndings = yield parser.parseNameArrayAtAsync(i, true);\r\n                            if (lineEndings\r\n                                && Object.values(lineEndingTypes).includes(lineEndings.value[0])\r\n                                && Object.values(lineEndingTypes).includes(lineEndings.value[1])) {\r\n                                this.LE = [\r\n                                    lineEndings.value[0],\r\n                                    lineEndings.value[1],\r\n                                ];\r\n                                i = lineEndings.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /LE property value\");\r\n                            }\r\n                            break;\r\n                        case \"/IT\":\r\n                            const intent = yield parser.parseNameAtAsync(i, true);\r\n                            if (intent) {\r\n                                if (Object.values(lineIntents).includes(intent.value)) {\r\n                                    this.IT = intent.value;\r\n                                    i = intent.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(\"Can't parse /IT property value\");\r\n                        case \"/CP\":\r\n                            const captionPosition = yield parser.parseNameAtAsync(i, true);\r\n                            if (captionPosition && Object.values(lineCaptionPositions)\r\n                                .includes(captionPosition.value)) {\r\n                                this.CP = captionPosition.value;\r\n                                i = captionPosition.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /CP property value\");\r\n                            }\r\n                            break;\r\n                        case \"/LL\":\r\n                        case \"/LLE\":\r\n                        case \"/LLO\":\r\n                            i = yield this.parseNumberPropAsync(name, parser, i, false);\r\n                            break;\r\n                        case \"/Cap\":\r\n                            i = yield this.parseBoolPropAsync(name, parser, i);\r\n                            break;\r\n                        case \"/Measure\":\r\n                            const measureEntryType = yield parser.getValueTypeAtAsync(i);\r\n                            if (measureEntryType === valueTypes.REF) {\r\n                                const measureDictId = yield ObjectId.parseRefAsync(parser, i);\r\n                                if (measureDictId && parseInfo.parseInfoGetterAsync) {\r\n                                    const measureParseInfo = yield parseInfo.parseInfoGetterAsync(measureDictId.value.id);\r\n                                    if (measureParseInfo) {\r\n                                        const measureDict = yield MeasureDict.parseAsync(measureParseInfo);\r\n                                        if (measureDict) {\r\n                                            this.Measure = measureDict.value;\r\n                                            i = measureDict.end + 1;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /BS value reference\");\r\n                            }\r\n                            else if (measureEntryType === valueTypes.DICTIONARY) {\r\n                                const measureDictBounds = yield parser.getDictBoundsAtAsync(i);\r\n                                if (measureDictBounds) {\r\n                                    const measureDict = yield MeasureDict.parseAsync({ parser, bounds: measureDictBounds });\r\n                                    if (measureDict) {\r\n                                        this.Measure = measureDict.value;\r\n                                        i = measureDict.end + 1;\r\n                                        break;\r\n                                    }\r\n                                }\r\n                                throw new Error(\"Can't parse /Measure value dictionary\");\r\n                            }\r\n                            throw new Error(`Unsupported /Measure property value type: ${measureEntryType}`);\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (this.RC) {\r\n                const domParser = new DOMParser();\r\n                const body = (_a = domParser.parseFromString(this.RC.literal, \"text/xml\")) === null || _a === void 0 ? void 0 : _a.querySelector(\"body\");\r\n                if (body) {\r\n                    const style = body.getAttribute(\"style\");\r\n                    const p = body.querySelector(\"p\");\r\n                    this._rtStyle = style || \"\";\r\n                    this._rtText = (p === null || p === void 0 ? void 0 : p.textContent) || \"\";\r\n                }\r\n            }\r\n        });\r\n    }\r\n    applyCommonTransformAsync(matrix, undoable = true) {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            const [x1, y1, x2, y2] = dict.L;\r\n            const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x1, y1).applyMat3(matrix);\r\n            const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x2, y2).applyMat3(matrix);\r\n            dict.L = [start.x, start.y, end.x, end.y];\r\n            yield dict.generateApStreamAsync();\r\n            dict.M = DateString.fromDate(new Date());\r\n            if (dict.$onEditAction) {\r\n                const invertedMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$v(this, void 0, void 0, function* () {\r\n                        yield dict.applyCommonTransformAsync(invertedMat, false);\r\n                        yield dict.updateRenderAsync();\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    updateStreamAsync() {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            yield dict.generateApStreamAsync();\r\n            yield dict.updateRenderAsync();\r\n        });\r\n    }\r\n    calculateStreamBboxAsync() {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            const [x1, y1, x2, y2] = this.L;\r\n            const length = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x2 - x1, y2 - y1).getMagnitude();\r\n            const strokeWidth = this.strokeWidth;\r\n            const halfStrokeWidth = strokeWidth / 2;\r\n            const marginMin = this.minMargin;\r\n            const textMargin = 4 * marginMin;\r\n            const textMaxWidth = length > textMargin\r\n                ? length - textMargin\r\n                : length;\r\n            const textData = yield this.updateTextDataAsync({\r\n                maxWidth: textMaxWidth,\r\n                fontSize: 9,\r\n                strokeWidth,\r\n                textAlign: \"center\",\r\n                pivotPoint: this.CP === lineCaptionPositions.INLINE\r\n                    ? \"center\"\r\n                    : \"bottom-margin\",\r\n            });\r\n            const marginFront = Math.max(Math.abs(this.LL || 0) + (this.LLO || 0) + halfStrokeWidth, marginMin);\r\n            const marginBack = Math.max((this.LLE || 0) + halfStrokeWidth, marginMin);\r\n            const height = marginFront + marginBack;\r\n            const top = this.LL < 0\r\n                ? marginMin\r\n                : height;\r\n            const bottom = this.LL < 0\r\n                ? height\r\n                : marginMin;\r\n            let xMin = -marginMin;\r\n            let yMin = -bottom;\r\n            let xMax = length + marginMin;\r\n            let yMax = top;\r\n            if (textData) {\r\n                const offsetY = this.offsetY;\r\n                const [textXMin, textYMin, textXMax, textYMax] = textData.relativeRect;\r\n                xMin = Math.min(xMin, textXMin + length / 2);\r\n                yMin = Math.min(yMin, textYMin + offsetY);\r\n                xMax = Math.max(xMax, textXMax + length / 2);\r\n                yMax = Math.max(yMax, textYMax + offsetY);\r\n            }\r\n            const bbox = [new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMin, yMin), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMax, yMax)];\r\n            return bbox;\r\n        });\r\n    }\r\n    calculateStreamMatrix() {\r\n        const [x1, y1, x2, y2] = this.L;\r\n        const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x1, y1);\r\n        const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x2, y2);\r\n        const length = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(end, start).getMagnitude();\r\n        const xAlignedStart = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const xAlignedEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(length, 0);\r\n        const matrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(xAlignedStart, xAlignedEnd, start, end);\r\n        return matrix;\r\n    }\r\n    updateRect(bbox, matrix) {\r\n        const localBox = this.getLocalBB();\r\n        localBox.ll.set(bbox[0].x, bbox[0].y).applyMat3(matrix);\r\n        localBox.lr.set(bbox[1].x, bbox[0].y).applyMat3(matrix);\r\n        localBox.ur.set(bbox[1].x, bbox[1].y).applyMat3(matrix);\r\n        localBox.ul.set(bbox[0].x, bbox[1].y).applyMat3(matrix);\r\n        const { min: rectMin, max: rectMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(localBox.ll, localBox.lr, localBox.ur, localBox.ul);\r\n        this.Rect = [rectMin.x, rectMin.y, rectMax.x, rectMax.y];\r\n    }\r\n    getLineEndsStreamCoords(matrix) {\r\n        const matrixInv = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrix);\r\n        const apStart = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.L[0], this.L[1])\r\n            .applyMat3(matrixInv)\r\n            .truncate();\r\n        const apEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this.L[2], this.L[3])\r\n            .applyMat3(matrixInv)\r\n            .truncate();\r\n        const offsetY = this.offsetY;\r\n        apStart.y += offsetY;\r\n        apEnd.y += offsetY;\r\n        return [apStart, apEnd];\r\n    }\r\n    getLineStreamPart(start, end) {\r\n        let lineStream = \"\";\r\n        lineStream += `\\n${start.x} ${start.y} m`;\r\n        lineStream += `\\n${end.x} ${end.y} l`;\r\n        lineStream += \"\\nS\";\r\n        if (this.LL) {\r\n            if (this.LL > 0) {\r\n                lineStream += `\\n${start.x} ${start.y - Math.abs(this.LL)} m`;\r\n                lineStream += `\\n${start.x} ${start.y + this.LLE} l`;\r\n                lineStream += \"\\nS\";\r\n                lineStream += `\\n${end.x} ${end.y - Math.abs(this.LL)} m`;\r\n                lineStream += `\\n${end.x} ${end.y + this.LLE} l`;\r\n                lineStream += \"\\nS\";\r\n            }\r\n            else {\r\n                lineStream += `\\n${start.x} ${start.y + Math.abs(this.LL)} m`;\r\n                lineStream += `\\n${start.x} ${start.y - this.LLE} l`;\r\n                lineStream += \"\\nS\";\r\n                lineStream += `\\n${end.x} ${end.y + Math.abs(this.LL)} m`;\r\n                lineStream += `\\n${end.x} ${end.y - this.LLE} l`;\r\n                lineStream += \"\\nS\";\r\n            }\r\n        }\r\n        return lineStream;\r\n    }\r\n    getTextStreamPartAsync(pivotPoint, font) {\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            const textData = this._textData;\r\n            if (!textData) {\r\n                return \"\";\r\n            }\r\n            const [xMin, yMin, xMax, yMax] = textData.relativeRect;\r\n            const bottomLeftLCS = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMin, yMin).add(pivotPoint);\r\n            const topRightLCS = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(xMax, yMax).add(pivotPoint);\r\n            const textBgRectStream = \"\\nq 1 g 1 G\"\r\n                + `\\n${bottomLeftLCS.x} ${bottomLeftLCS.y} m`\r\n                + `\\n${bottomLeftLCS.x} ${topRightLCS.y} l`\r\n                + `\\n${topRightLCS.x} ${topRightLCS.y} l`\r\n                + `\\n${topRightLCS.x} ${bottomLeftLCS.y} l`\r\n                + \"\\nf\"\r\n                + \"\\nQ\";\r\n            let textStream = \"\\nq 0 g 0 G\";\r\n            const fontSize = 9;\r\n            for (const line of textData.lines) {\r\n                if (!line.text) {\r\n                    continue;\r\n                }\r\n                const lineStart = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(line.relativeRect[0], line.relativeRect[1]).add(pivotPoint);\r\n                let lineHex = \"\";\r\n                for (const char of line.text) {\r\n                    const code = font.encoding.codeMap.get(char);\r\n                    if (code) {\r\n                        lineHex += code.toString(16).padStart(2, \"0\");\r\n                    }\r\n                }\r\n                textStream += `\\nBT 0 Tc 0 Tw 100 Tz ${font.name} ${fontSize} Tf 0 Tr`;\r\n                textStream += `\\n1 0 0 1 ${lineStart.x} ${lineStart.y + fontSize * 0.2} Tm`;\r\n                textStream += `\\n<${lineHex}> Tj`;\r\n                textStream += \"\\nET\";\r\n            }\r\n            textStream += \"\\nQ\";\r\n            return textBgRectStream + textStream;\r\n        });\r\n    }\r\n    generateApStreamAsync() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\r\n        return __awaiter$v(this, void 0, void 0, function* () {\r\n            if (!this.L) {\r\n                return;\r\n            }\r\n            const bbox = yield this.calculateStreamBboxAsync();\r\n            const matrix = this.calculateStreamMatrix();\r\n            this.updateRect(bbox, matrix);\r\n            const apStream = new XFormStream();\r\n            apStream.Filter = \"/FlateDecode\";\r\n            apStream.LastModified = DateString.fromDate(new Date());\r\n            apStream.BBox = [bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y];\r\n            apStream.Matrix = matrix.toFloatShortArray();\r\n            apStream.Resources = new ResourceDict();\r\n            const opacity = this.CA || 1;\r\n            const strokeWidth = this.strokeWidth;\r\n            const strokeDash = (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.D[0]) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.dash) !== null && _d !== void 0 ? _d : 3;\r\n            const strokeGap = (_h = (_f = (_e = this.BS) === null || _e === void 0 ? void 0 : _e.D[1]) !== null && _f !== void 0 ? _f : (_g = this.Border) === null || _g === void 0 ? void 0 : _g.gap) !== null && _h !== void 0 ? _h : 0;\r\n            const gs = new GraphicsStateDict();\r\n            gs.AIS = true;\r\n            gs.BM = \"/Normal\";\r\n            gs.CA = opacity;\r\n            gs.ca = opacity;\r\n            gs.LW = strokeWidth;\r\n            gs.D = [[strokeDash, strokeGap], 0];\r\n            gs.LC = lineCapStyles.SQUARE;\r\n            gs.LJ = lineJoinStyles.MITER;\r\n            apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n            const fontFamily = \"arial\";\r\n            const font = (_j = this._fontMap) === null || _j === void 0 ? void 0 : _j.get(fontFamily);\r\n            if (!font || !((_k = font.encoding) === null || _k === void 0 ? void 0 : _k.codeMap)) {\r\n                throw new Error(`Suitable font is not found in the font map: '${fontFamily}'`);\r\n            }\r\n            apStream.Resources.setFont(font.name, font);\r\n            const colorString = this.getColorString();\r\n            const [apStart, apEnd] = this.getLineEndsStreamCoords(matrix);\r\n            const lineStreamPart = this.getLineStreamPart(apStart, apEnd);\r\n            const leftEndingStreamPart = this.getLineEndingStreamPart(apStart, this.LE[0], strokeWidth, \"left\");\r\n            const rightEndingStreamPart = this.getLineEndingStreamPart(apEnd, this.LE[1], strokeWidth, \"right\");\r\n            const textStreamPart = yield this.getTextStreamPartAsync(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(apStart, apEnd).multiplyByScalar(0.5), font);\r\n            const streamTextData = `q ${colorString} /GS0 gs`\r\n                + lineStreamPart\r\n                + leftEndingStreamPart\r\n                + rightEndingStreamPart\r\n                + textStreamPart\r\n                + \"\\nQ\";\r\n            apStream.setTextStreamData(streamTextData);\r\n            this.apStream = apStream;\r\n        });\r\n    }\r\n    renderHandles() {\r\n        return [...this.renderLineEndHandles(), this.renderRotationHandle()];\r\n    }\r\n    renderLineEndHandles() {\r\n        const startHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n        startHandle.classList.add(\"annotation-handle\", \"scale\");\r\n        startHandle.setAttribute(\"data-handle-name\", \"start\");\r\n        startHandle.setAttribute(\"x1\", this.L[0] + \"\");\r\n        startHandle.setAttribute(\"y1\", this.L[1] + \"\");\r\n        startHandle.setAttribute(\"x2\", this.L[0] + \"\");\r\n        startHandle.setAttribute(\"y2\", this.L[1] + 0.1 + \"\");\r\n        startHandle.addEventListener(\"pointerdown\", this.onLineEndHandlePointerDown);\r\n        const endHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n        endHandle.classList.add(\"annotation-handle\", \"scale\");\r\n        endHandle.setAttribute(\"data-handle-name\", \"end\");\r\n        endHandle.setAttribute(\"x1\", this.L[2] + \"\");\r\n        endHandle.setAttribute(\"y1\", this.L[3] + \"\");\r\n        endHandle.setAttribute(\"x2\", this.L[2] + \"\");\r\n        endHandle.setAttribute(\"y2\", this.L[3] + 0.1 + \"\");\r\n        endHandle.addEventListener(\"pointerdown\", this.onLineEndHandlePointerDown);\r\n        return [startHandle, endHandle];\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$u = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextMarkupAnnotation extends MarkupAnnotation {\r\n    constructor(type) {\r\n        super(type);\r\n        this.onTranslationPointerDown = (e) => { };\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.QuadPoints) {\r\n            bytes.push(...encoder.encode(\"/QuadPoints \"), ...this.encodePrimitiveArray(this.QuadPoints, encoder));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$u(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/QuadPoints\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (!this.QuadPoints) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n        });\r\n    }\r\n    renderHandles() {\r\n        return [];\r\n    }\r\n}\n\nvar __awaiter$t = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass HighlightAnnotation extends TextMarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.HIGHLIGHT);\r\n    }\r\n    static createFromDto(dto) {\r\n        var _a;\r\n        if (dto.annotationType !== \"/Highlight\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        if (!((_a = dto === null || dto === void 0 ? void 0 : dto.quadPoints) === null || _a === void 0 ? void 0 : _a.length) || dto.quadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new HighlightAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        if (dto.rect) {\r\n            annotation.Rect = dto.rect;\r\n        }\r\n        else {\r\n            const vectors = [];\r\n            for (let i = 0; i < dto.quadPoints.length; i += 2) {\r\n                vectors.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(dto.quadPoints[i], dto.quadPoints[i + 1]));\r\n            }\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...vectors);\r\n            annotation.Rect = [min.x, min.y, max.x, max.y];\r\n        }\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.QuadPoints = dto.quadPoints;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$t(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new HighlightAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Highlight\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            quadPoints: this.QuadPoints,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$t(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.QuadPoints) === null || _a === void 0 ? void 0 : _a.length) || this.QuadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.LC = lineCapStyles.SQUARE;\r\n        gs.LJ = lineJoinStyles.MITER;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        gs.BM = blendModes.MULTIPLY;\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        const bottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const bottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const topRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const topLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const q = this.QuadPoints;\r\n        for (let i = 0; i < q.length; i += 8) {\r\n            bottomLeft.set(q[i + 4], q[i + 5]);\r\n            bottomRight.set(q[i + 6], q[i + 7]);\r\n            topRight.set(q[i + 2], q[i + 3]);\r\n            topLeft.set(q[i + 0], q[i + 1]);\r\n            streamTextData += `\\n${bottomLeft.x} ${bottomLeft.y} m`;\r\n            streamTextData += `\\n${bottomRight.x} ${bottomRight.y} l`;\r\n            streamTextData += `\\n${topRight.x} ${topRight.y} l`;\r\n            streamTextData += `\\n${topLeft.x} ${topLeft.y} l`;\r\n            streamTextData += \"\\nf\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$s = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass UnderlineAnnotation extends TextMarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.UNDERLINE);\r\n    }\r\n    static createFromDto(dto) {\r\n        var _a;\r\n        if (dto.annotationType !== \"/Underline\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        if (!((_a = dto === null || dto === void 0 ? void 0 : dto.quadPoints) === null || _a === void 0 ? void 0 : _a.length) || dto.quadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new UnderlineAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        if (dto.rect) {\r\n            annotation.Rect = dto.rect;\r\n        }\r\n        else {\r\n            const vectors = [];\r\n            for (let i = 0; i < dto.quadPoints.length; i += 2) {\r\n                vectors.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(dto.quadPoints[i], dto.quadPoints[i + 1]));\r\n            }\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...vectors);\r\n            const margin = dto.strokeWidth\r\n                ? dto.strokeWidth / 2\r\n                : 1;\r\n            annotation.Rect = [min.x - margin, min.y - margin, max.x + margin, max.y + margin];\r\n        }\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.QuadPoints = dto.quadPoints;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$s(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new UnderlineAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Underline\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            quadPoints: this.QuadPoints,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$s(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.QuadPoints) === null || _a === void 0 ? void 0 : _a.length) || this.QuadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.LC = lineCapStyles.SQUARE;\r\n        gs.LJ = lineJoinStyles.MITER;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        const bottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const bottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const q = this.QuadPoints;\r\n        for (let i = 0; i < q.length; i += 8) {\r\n            bottomLeft.set(q[i + 4], q[i + 5]);\r\n            bottomRight.set(q[i + 6], q[i + 7]);\r\n            streamTextData += `\\n${bottomLeft.x} ${bottomLeft.y} m`;\r\n            streamTextData += `\\n${bottomRight.x} ${bottomRight.y} l`;\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$r = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass StrikeoutAnnotation extends TextMarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.STRIKEOUT);\r\n    }\r\n    static createFromDto(dto) {\r\n        var _a;\r\n        if (dto.annotationType !== \"/Strikeout\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        if (!((_a = dto === null || dto === void 0 ? void 0 : dto.quadPoints) === null || _a === void 0 ? void 0 : _a.length) || dto.quadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new StrikeoutAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        if (dto.rect) {\r\n            annotation.Rect = dto.rect;\r\n        }\r\n        else {\r\n            const vectors = [];\r\n            for (let i = 0; i < dto.quadPoints.length; i += 2) {\r\n                vectors.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(dto.quadPoints[i], dto.quadPoints[i + 1]));\r\n            }\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...vectors);\r\n            annotation.Rect = [min.x, min.y, max.x, max.y];\r\n        }\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.QuadPoints = dto.quadPoints;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$r(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new StrikeoutAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Strikeout\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            quadPoints: this.QuadPoints,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$r(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.QuadPoints) === null || _a === void 0 ? void 0 : _a.length) || this.QuadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.LC = lineCapStyles.SQUARE;\r\n        gs.LJ = lineJoinStyles.MITER;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        const bottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const bottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const topRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const topLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const q = this.QuadPoints;\r\n        for (let i = 0; i < q.length; i += 8) {\r\n            bottomLeft.set(q[i + 4], q[i + 5]);\r\n            bottomRight.set(q[i + 6], q[i + 7]);\r\n            topRight.set(q[i + 2], q[i + 3]);\r\n            topLeft.set(q[i + 0], q[i + 1]);\r\n            start.setFromVec2(bottomLeft).add(topLeft).multiplyByScalar(0.5);\r\n            end.setFromVec2(bottomRight).add(topRight).multiplyByScalar(0.5);\r\n            streamTextData += `\\n${start.x} ${start.y} m`;\r\n            streamTextData += `\\n${end.x} ${end.y} l`;\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$q = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass SquigglyAnnotation extends TextMarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.SQUIGGLY);\r\n    }\r\n    static createFromDto(dto) {\r\n        var _a;\r\n        if (dto.annotationType !== \"/Squiggly\") {\r\n            throw new Error(\"Invalid annotation type\");\r\n        }\r\n        if (!((_a = dto === null || dto === void 0 ? void 0 : dto.quadPoints) === null || _a === void 0 ? void 0 : _a.length) || dto.quadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const bs = new BorderStyleDict();\r\n        bs.W = dto.strokeWidth;\r\n        if (dto.strokeDashGap) {\r\n            bs.D = dto.strokeDashGap;\r\n        }\r\n        const annotation = new SquigglyAnnotation();\r\n        annotation.$name = dto.uuid;\r\n        annotation.NM = LiteralString.fromString(dto.uuid);\r\n        annotation.T = LiteralString.fromString(dto.author);\r\n        annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n        annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n        annotation.Contents = dto.textContent\r\n            ? LiteralString.fromString(dto.textContent)\r\n            : null;\r\n        if (dto.rect) {\r\n            annotation.Rect = dto.rect;\r\n        }\r\n        else {\r\n            const vectors = [];\r\n            for (let i = 0; i < dto.quadPoints.length; i += 2) {\r\n                vectors.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(dto.quadPoints[i], dto.quadPoints[i + 1]));\r\n            }\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...vectors);\r\n            const margin = this.squiggleSize / 2 + (dto.strokeWidth || 2) / 2;\r\n            annotation.Rect = [min.x - margin, min.y - margin, max.x + margin, max.y + margin];\r\n        }\r\n        annotation.C = dto.color.slice(0, 3);\r\n        annotation.CA = dto.color[3];\r\n        annotation.BS = bs;\r\n        annotation.QuadPoints = dto.quadPoints;\r\n        annotation.generateApStream();\r\n        annotation._added = true;\r\n        return annotation.initProxy();\r\n    }\r\n    static parseAsync(parseInfo) {\r\n        return __awaiter$q(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new SquigglyAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        return superBytes;\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\r\n        const color = this.getColorRect();\r\n        return {\r\n            annotationType: \"/Squiggly\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_a = this.CreationDate) === null || _a === void 0 ? void 0 : _a.date.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_b = this.T) === null || _b === void 0 ? void 0 : _b.literal,\r\n            textContent: (_c = this.Contents) === null || _c === void 0 ? void 0 : _c.literal,\r\n            rect: this.Rect,\r\n            bbox: (_d = this.apStream) === null || _d === void 0 ? void 0 : _d.BBox,\r\n            matrix: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.Matrix,\r\n            quadPoints: this.QuadPoints,\r\n            color,\r\n            strokeWidth: (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.W) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 1,\r\n            strokeDashGap: (_l = (_k = this.BS) === null || _k === void 0 ? void 0 : _k.D) !== null && _l !== void 0 ? _l : [3, 0],\r\n        };\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        return __awaiter$q(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n        });\r\n    }\r\n    generateApStream() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n        if (!((_a = this.QuadPoints) === null || _a === void 0 ? void 0 : _a.length) || this.QuadPoints.length % 8) {\r\n            return;\r\n        }\r\n        const apStream = new XFormStream();\r\n        apStream.Filter = \"/FlateDecode\";\r\n        apStream.LastModified = DateString.fromDate(new Date());\r\n        apStream.BBox = [this.Rect[0], this.Rect[1], this.Rect[2], this.Rect[3]];\r\n        const opacity = this.CA || 1;\r\n        const strokeWidth = this.strokeWidth;\r\n        const strokeDash = (_e = (_c = (_b = this.BS) === null || _b === void 0 ? void 0 : _b.D[0]) !== null && _c !== void 0 ? _c : (_d = this.Border) === null || _d === void 0 ? void 0 : _d.dash) !== null && _e !== void 0 ? _e : 3;\r\n        const strokeGap = (_j = (_g = (_f = this.BS) === null || _f === void 0 ? void 0 : _f.D[1]) !== null && _g !== void 0 ? _g : (_h = this.Border) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : 0;\r\n        const gs = new GraphicsStateDict();\r\n        gs.AIS = true;\r\n        gs.BM = \"/Normal\";\r\n        gs.CA = opacity;\r\n        gs.ca = opacity;\r\n        gs.LW = strokeWidth;\r\n        gs.LC = lineCapStyles.SQUARE;\r\n        gs.LJ = lineJoinStyles.MITER;\r\n        gs.D = [[strokeDash, strokeGap], 0];\r\n        const colorString = this.getColorString();\r\n        let streamTextData = `q ${colorString} /GS0 gs`;\r\n        const bottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const bottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const q = this.QuadPoints;\r\n        for (let i = 0; i < q.length; i += 8) {\r\n            bottomLeft.set(q[i + 4], q[i + 5]);\r\n            bottomRight.set(q[i + 6], q[i + 7]);\r\n            const squigglyLinePoints = buildSquigglyLine(bottomLeft, bottomRight, SquigglyAnnotation.squiggleSize);\r\n            if (!(squigglyLinePoints === null || squigglyLinePoints === void 0 ? void 0 : squigglyLinePoints.length)) {\r\n                continue;\r\n            }\r\n            streamTextData += `\\n${squigglyLinePoints[0].x} ${squigglyLinePoints[0].y} m`;\r\n            for (let j = 1; j < squigglyLinePoints.length; j++) {\r\n                streamTextData += `\\n${squigglyLinePoints[j].x} ${squigglyLinePoints[j].y} l`;\r\n            }\r\n            streamTextData += \"\\nS\";\r\n        }\r\n        streamTextData += \"\\nQ\";\r\n        apStream.Resources = new ResourceDict();\r\n        apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n        apStream.setTextStreamData(streamTextData);\r\n        this.apStream = apStream;\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\r\nSquigglyAnnotation.squiggleSize = 6;\n\nvar __awaiter$p = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass FreeTextAnnotation extends MarkupAnnotation {\r\n    constructor() {\r\n        super(annotationTypes.FREE_TEXT);\r\n        this.Q = justificationTypes.LEFT;\r\n        this.IT = freeTextIntents.PLAIN_TEXT;\r\n        this.LE = lineEndingTypes.NONE;\r\n        this._svgTemp = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.SvgTempPath();\r\n        this.onTextBoxCornerHandlePointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onTextBoxCornerHandlePointerUp);\r\n            target.addEventListener(\"pointerout\", this.onTextBoxCornerHandlePointerUp);\r\n            this._pointsTemp = this.pointsPageCS;\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._svgTemp.insertAfter(this._renderedControls);\r\n                target.addEventListener(\"pointermove\", this.onTextBoxCornerHandlePointerMove);\r\n            }, 200);\r\n            e.stopPropagation();\r\n        };\r\n        this.onTextBoxCornerHandlePointerMove = (e) => {\r\n            var _a;\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            const handleName = target.dataset.handleName;\r\n            const points = this._pointsTemp;\r\n            const p = this.convertClientCoordsToPage(e.clientX, e.clientY);\r\n            const horLength = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(points.br, points.bl).getMagnitude();\r\n            const vertLength = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(points.tl, points.bl).getMagnitude();\r\n            const matToAligned = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(points.bl, points.br, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(horLength, 0));\r\n            let oppositeP;\r\n            switch (handleName) {\r\n                case \"tb-bl\":\r\n                    oppositeP = points.tr;\r\n                    break;\r\n                case \"tb-br\":\r\n                    oppositeP = points.tl;\r\n                    break;\r\n                case \"tb-tr\":\r\n                    oppositeP = points.bl;\r\n                    break;\r\n                case \"tb-tl\":\r\n                    oppositeP = points.br;\r\n                    break;\r\n                default:\r\n                    return;\r\n            }\r\n            const pAligned = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(p, matToAligned);\r\n            const oppositePAligned = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(oppositeP, matToAligned);\r\n            const transformedHorLength = Math.abs(pAligned.x - oppositePAligned.x);\r\n            const transformedVertLength = Math.abs(pAligned.y - oppositePAligned.y);\r\n            const scaleX = transformedHorLength / horLength;\r\n            const scaleY = transformedVertLength / vertLength;\r\n            const { r: rotation } = matToAligned.getTRS();\r\n            const mat = new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3()\r\n                .applyTranslation(-oppositeP.x, -oppositeP.y)\r\n                .applyRotation(rotation)\r\n                .applyScaling(scaleX, scaleY)\r\n                .applyRotation(-rotation)\r\n                .applyTranslation(oppositeP.x, oppositeP.y);\r\n            points.bl.applyMat3(mat);\r\n            points.br.applyMat3(mat);\r\n            points.tr.applyMat3(mat);\r\n            points.tl.applyMat3(mat);\r\n            points.l.applyMat3(mat);\r\n            points.t.applyMat3(mat);\r\n            points.r.applyMat3(mat);\r\n            points.b.applyMat3(mat);\r\n            (_a = points.cob) === null || _a === void 0 ? void 0 : _a.applyMat3(mat);\r\n            this._svgTemp.set(\"lightblue\", \"blue\", this.strokeWidth, [points.bl, points.br, points.tr, points.tl], true);\r\n            this._moved = true;\r\n        };\r\n        this.onTextBoxCornerHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onTextBoxCornerHandlePointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onTextBoxCornerHandlePointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onTextBoxCornerHandlePointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this._svgTemp.remove();\r\n            if (this._moved) {\r\n                this.updateStreamAsync(this._pointsTemp);\r\n            }\r\n        };\r\n        this.onSideHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            const handleName = target.dataset.handleName;\r\n            const points = this.pointsPageCS;\r\n            switch (handleName) {\r\n                case \"co-pivot-l\":\r\n                    if (mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.equals(points.cob, points.l)) {\r\n                        return;\r\n                    }\r\n                    points.cob.setFromVec2(points.l);\r\n                    break;\r\n                case \"co-pivot-t\":\r\n                    if (mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.equals(points.cob, points.t)) {\r\n                        return;\r\n                    }\r\n                    points.cob.setFromVec2(points.t);\r\n                    break;\r\n                case \"co-pivot-r\":\r\n                    if (mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.equals(points.cob, points.r)) {\r\n                        return;\r\n                    }\r\n                    points.cob.setFromVec2(points.r);\r\n                    break;\r\n                case \"co-pivot-b\":\r\n                    if (mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.equals(points.cob, points.b)) {\r\n                        return;\r\n                    }\r\n                    points.cob.setFromVec2(points.b);\r\n                    break;\r\n                default:\r\n                    return;\r\n            }\r\n            this.updateStreamAsync(points);\r\n        };\r\n        this.onCalloutHandlePointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointerup\", this.onCalloutHandlePointerUp);\r\n            target.addEventListener(\"pointerout\", this.onCalloutHandlePointerUp);\r\n            this._pointsTemp = this.pointsPageCS;\r\n            this._moved = false;\r\n            this._transformationTimer = setTimeout(() => {\r\n                this._transformationTimer = null;\r\n                this._svgTemp.insertAfter(this._renderedControls);\r\n                target.addEventListener(\"pointermove\", this.onCalloutHandlePointerMove);\r\n            }, 200);\r\n            e.stopPropagation();\r\n        };\r\n        this.onCalloutHandlePointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            const handleName = target.dataset.handleName;\r\n            switch (handleName) {\r\n                case \"co-knee\":\r\n                    this._pointsTemp.cok.setFromVec2(this.convertClientCoordsToPage(e.clientX, e.clientY));\r\n                    break;\r\n                case \"co-pointer\":\r\n                    this._pointsTemp.cop.setFromVec2(this.convertClientCoordsToPage(e.clientX, e.clientY));\r\n                    break;\r\n                default:\r\n                    return;\r\n            }\r\n            this._svgTemp.set(\"none\", \"blue\", this.strokeWidth, this._pointsTemp.cok\r\n                ? [this._pointsTemp.cob, this._pointsTemp.cok, this._pointsTemp.cop]\r\n                : [this._pointsTemp.cob, this._pointsTemp.cop]);\r\n            this._moved = true;\r\n        };\r\n        this.onCalloutHandlePointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onCalloutHandlePointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onCalloutHandlePointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onCalloutHandlePointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this._svgTemp.remove();\r\n            if (this._moved) {\r\n                this.updateStreamAsync(this._pointsTemp);\r\n            }\r\n        };\r\n    }\r\n    get pointsStreamCS() {\r\n        const stroke = this.strokeWidth;\r\n        const halfStroke = stroke / 2;\r\n        const [apXMin, apYMin, apXMax, apYMax] = this.apStream.BBox;\r\n        const [mLeft, mBottom, mRight, mTop] = this.RD || [halfStroke, halfStroke, halfStroke, halfStroke];\r\n        const apBL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(apXMin + mLeft, apYMin + mBottom);\r\n        const apTR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(apXMax - mRight, apYMax - mTop);\r\n        const apBR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(apTR.x, apBL.y);\r\n        const apTL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(apBL.x, apTR.y);\r\n        const apL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(apBL, apTL).multiplyByScalar(0.5);\r\n        const apT = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(apTL, apTR).multiplyByScalar(0.5);\r\n        const apR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(apBR, apTR).multiplyByScalar(0.5);\r\n        const apB = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.add(apBL, apBR).multiplyByScalar(0.5);\r\n        const cl = this.CL;\r\n        let apCoBase;\r\n        let apCoPointer;\r\n        let apCoKnee;\r\n        if (cl) {\r\n            if (cl.length === 6) {\r\n                apCoBase = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cl[4], cl[5]);\r\n                apCoKnee = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cl[2], cl[3]);\r\n                apCoPointer = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cl[0], cl[1]);\r\n            }\r\n            else if (cl.length === 4) {\r\n                apCoBase = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cl[2], cl[3]);\r\n                apCoPointer = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cl[0], cl[1]);\r\n            }\r\n        }\r\n        return {\r\n            bl: apBL, tr: apTR, br: apBR, tl: apTL,\r\n            l: apL, t: apT, r: apR, b: apB,\r\n            cob: apCoBase, cok: apCoKnee, cop: apCoPointer,\r\n        };\r\n    }\r\n    get pointsPageCS() {\r\n        const points = this.pointsStreamCS;\r\n        const { matAA: mat } = calcPdfBBoxToRectMatrices(this.apStream.BBox, this.Rect, this.apStream.Matrix);\r\n        return {\r\n            bl: points.bl.applyMat3(mat),\r\n            tr: points.tr.applyMat3(mat),\r\n            br: points.br.applyMat3(mat),\r\n            tl: points.tl.applyMat3(mat),\r\n            l: points.l.applyMat3(mat),\r\n            t: points.t.applyMat3(mat),\r\n            r: points.r.applyMat3(mat),\r\n            b: points.b.applyMat3(mat),\r\n            cob: points.cob ? points.cob.applyMat3(mat) : null,\r\n            cok: points.cok ? points.cok.applyMat3(mat) : null,\r\n            cop: points.cop ? points.cop.applyMat3(mat) : null,\r\n        };\r\n    }\r\n    get minMargin() {\r\n        const strokeWidth = this.strokeWidth;\r\n        const halfStrokeWidth = strokeWidth / 2;\r\n        let marginMin;\r\n        if (this.LE && this.LE !== lineEndingTypes.NONE) {\r\n            const endingSizeWoStroke = Math.max(strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n            const endingSize = endingSizeWoStroke + strokeWidth;\r\n            marginMin = endingSize / 2;\r\n        }\r\n        else {\r\n            marginMin = halfStrokeWidth;\r\n        }\r\n        return marginMin;\r\n    }\r\n    static createFromDtoAsync(dto, fontMap) {\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            if (dto.annotationType !== \"/FreeText\") {\r\n                throw new Error(\"Invalid annotation type\");\r\n            }\r\n            const bs = new BorderStyleDict();\r\n            bs.W = dto.strokeWidth;\r\n            if (dto.strokeDashGap) {\r\n                bs.D = dto.strokeDashGap;\r\n            }\r\n            const annotation = new FreeTextAnnotation();\r\n            annotation.$name = dto.uuid;\r\n            annotation.NM = LiteralString.fromString(dto.uuid);\r\n            annotation.T = LiteralString.fromString(dto.author);\r\n            annotation.M = DateString.fromDate(new Date(dto.dateModified));\r\n            annotation.CreationDate = DateString.fromDate(new Date(dto.dateCreated));\r\n            annotation.Contents = dto.textContent\r\n                ? LiteralString.fromString(dto.textContent)\r\n                : null;\r\n            annotation.Rect = dto.rect;\r\n            annotation.C = dto.color.slice(0, 3);\r\n            annotation.CA = dto.color[3];\r\n            annotation.BS = bs;\r\n            annotation.IT = dto.intent || freeTextIntents.PLAIN_TEXT;\r\n            annotation.LE = dto.calloutEndingType || lineEndingTypes.NONE;\r\n            annotation.Q = dto.justification || justificationTypes.LEFT;\r\n            annotation._fontMap = fontMap;\r\n            const { bl, tr, br, tl, l, t, r, b, cob, cok, cop } = dto.points;\r\n            const points = {\r\n                bl: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bl[0], bl[1]),\r\n                tr: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(tr[0], tr[1]),\r\n                br: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(br[0], br[1]),\r\n                tl: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(tl[0], tl[1]),\r\n                l: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(l[0], l[1]),\r\n                t: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(t[0], t[1]),\r\n                r: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(r[0], r[1]),\r\n                b: new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(b[0], b[1]),\r\n                cob: cob ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cob[0], cob[1]) : null,\r\n                cok: cok ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cok[0], cok[1]) : null,\r\n                cop: cop ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cop[0], cop[1]) : null,\r\n            };\r\n            yield annotation.generateApStreamAsync(points);\r\n            annotation._added = true;\r\n            return annotation.initProxy();\r\n        });\r\n    }\r\n    static parseAsync(parseInfo, fontMap) {\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            if (!parseInfo) {\r\n                throw new Error(\"Parsing information not passed\");\r\n            }\r\n            try {\r\n                const pdfObject = new FreeTextAnnotation();\r\n                yield pdfObject.parsePropsAsync(parseInfo);\r\n                pdfObject._fontMap = fontMap;\r\n                return {\r\n                    value: pdfObject.initProxy(),\r\n                    start: parseInfo.bounds.start,\r\n                    end: parseInfo.bounds.end,\r\n                };\r\n            }\r\n            catch (e) {\r\n                console.log(e.message);\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n    toArray(cryptInfo) {\r\n        const superBytes = super.toArray(cryptInfo);\r\n        const encoder = new TextEncoder();\r\n        const bytes = [];\r\n        if (this.DA) {\r\n            bytes.push(...encoder.encode(\"/DA \"), ...this.DA.toArray(cryptInfo));\r\n        }\r\n        if (this.Q) {\r\n            bytes.push(...encoder.encode(\"/Q \"), ...encoder.encode(\" \" + this.Q));\r\n        }\r\n        if (this.DS) {\r\n            bytes.push(...encoder.encode(\"/DS \"), ...this.DS.toArray(cryptInfo));\r\n        }\r\n        if (this.RC) {\r\n            bytes.push(...encoder.encode(\"/RC \"), ...this.RC.toArray(cryptInfo));\r\n        }\r\n        if (this.CL) {\r\n            bytes.push(...encoder.encode(\"/CL \"), ...this.encodePrimitiveArray(this.CL, encoder));\r\n        }\r\n        if (this.IT) {\r\n            bytes.push(...encoder.encode(\"/IT \"), ...encoder.encode(this.IT));\r\n        }\r\n        if (this.RD) {\r\n            bytes.push(...encoder.encode(\"/RD \"), ...this.encodePrimitiveArray(this.RD, encoder));\r\n        }\r\n        if (this.LE) {\r\n            bytes.push(...encoder.encode(\"/LE \"), ...encoder.encode(this.LE));\r\n        }\r\n        const totalBytes = [\r\n            ...superBytes.subarray(0, 2),\r\n            ...bytes,\r\n            ...superBytes.subarray(2, superBytes.length)\r\n        ];\r\n        return new Uint8Array(totalBytes);\r\n    }\r\n    toDto() {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;\r\n        const color = this.getColorRect();\r\n        const { bl, tr, br, tl, l, t, r, b, cob, cok, cop } = this.pointsPageCS;\r\n        const points = {\r\n            bl: bl.truncate().toFloatArray(),\r\n            tr: tr.truncate().toFloatArray(),\r\n            br: br.truncate().toFloatArray(),\r\n            tl: tl.truncate().toFloatArray(),\r\n            l: l.truncate().toFloatArray(),\r\n            t: t.truncate().toFloatArray(),\r\n            r: r.truncate().toFloatArray(),\r\n            b: b.truncate().toFloatArray(),\r\n            cob: cob ? cob.truncate().toFloatArray() : null,\r\n            cok: cok ? cok.truncate().toFloatArray() : null,\r\n            cop: cop ? cop.truncate().toFloatArray() : null,\r\n        };\r\n        return {\r\n            annotationType: \"/FreeText\",\r\n            uuid: this.$name,\r\n            pageId: this.$pageId,\r\n            dateCreated: ((_b = (_a = this[\"CreationDate\"]) === null || _a === void 0 ? void 0 : _a.date) === null || _b === void 0 ? void 0 : _b.toISOString()) || new Date().toISOString(),\r\n            dateModified: this.M\r\n                ? this.M instanceof LiteralString\r\n                    ? this.M.literal\r\n                    : this.M.date.toISOString()\r\n                : new Date().toISOString(),\r\n            author: (_c = this[\"T\"]) === null || _c === void 0 ? void 0 : _c.literal,\r\n            textContent: (_d = this.Contents) === null || _d === void 0 ? void 0 : _d.literal,\r\n            rect: this.Rect,\r\n            bbox: (_e = this.apStream) === null || _e === void 0 ? void 0 : _e.BBox,\r\n            matrix: (_f = this.apStream) === null || _f === void 0 ? void 0 : _f.Matrix,\r\n            points,\r\n            color,\r\n            strokeWidth: (_k = (_h = (_g = this.BS) === null || _g === void 0 ? void 0 : _g.W) !== null && _h !== void 0 ? _h : (_j = this.Border) === null || _j === void 0 ? void 0 : _j.width) !== null && _k !== void 0 ? _k : 1,\r\n            strokeDashGap: (_m = (_l = this.BS) === null || _l === void 0 ? void 0 : _l.D) !== null && _m !== void 0 ? _m : [3, 0],\r\n            intent: this.IT,\r\n            justification: this.Q,\r\n            calloutEndingType: this.LE,\r\n        };\r\n    }\r\n    setTextContentAsync(text, undoable = true) {\r\n        const _super = Object.create(null, {\r\n            setTextContentAsync: { get: () => super.setTextContentAsync }\r\n        });\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            yield _super.setTextContentAsync.call(this, text, undoable);\r\n            yield this.updateStreamAsync(null);\r\n        });\r\n    }\r\n    parsePropsAsync(parseInfo) {\r\n        const _super = Object.create(null, {\r\n            parsePropsAsync: { get: () => super.parsePropsAsync }\r\n        });\r\n        var _a;\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            yield _super.parsePropsAsync.call(this, parseInfo);\r\n            const { parser, bounds } = parseInfo;\r\n            const start = bounds.contentStart || bounds.start;\r\n            const end = bounds.contentEnd || bounds.end;\r\n            let i = yield parser.skipToNextNameAsync(start, end - 1);\r\n            let name;\r\n            let parseResult;\r\n            while (true) {\r\n                parseResult = yield parser.parseNameAtAsync(i);\r\n                if (parseResult) {\r\n                    i = parseResult.end + 1;\r\n                    name = parseResult.value;\r\n                    switch (name) {\r\n                        case \"/DA\":\r\n                        case \"/DS\":\r\n                        case \"/RC\":\r\n                            i = yield this.parseLiteralPropAsync(name, parser, i, parseInfo.cryptInfo);\r\n                            break;\r\n                        case \"/Q\":\r\n                            const justification = yield parser.parseNumberAtAsync(i, true);\r\n                            if (justification && Object.values(justificationTypes)\r\n                                .includes(justification.value)) {\r\n                                this.Q = justification.value;\r\n                                i = justification.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /Q property value\");\r\n                            }\r\n                            break;\r\n                        case \"/LE\":\r\n                            const lineEndingType = yield parser.parseNameAtAsync(i, true);\r\n                            if (lineEndingType && Object.values(lineEndingTypes)\r\n                                .includes(lineEndingType.value)) {\r\n                                this.LE = lineEndingType.value;\r\n                                i = lineEndingType.end + 1;\r\n                            }\r\n                            else {\r\n                                throw new Error(\"Can't parse /LE property value\");\r\n                            }\r\n                            break;\r\n                        case \"/CL\":\r\n                        case \"/RD\":\r\n                            i = yield this.parseNumberArrayPropAsync(name, parser, i, true);\r\n                            break;\r\n                        case \"/IT\":\r\n                            const intent = yield parser.parseNameAtAsync(i, true);\r\n                            if (intent) {\r\n                                if (intent.value === \"/FreeTextTypewriter\") {\r\n                                    this.IT = freeTextIntents.CLICK_TO_TYPE;\r\n                                    i = intent.end + 1;\r\n                                    break;\r\n                                }\r\n                                else if (Object.values(freeTextIntents).includes(intent.value)) {\r\n                                    this.IT = intent.value;\r\n                                    i = intent.end + 1;\r\n                                    break;\r\n                                }\r\n                            }\r\n                            throw new Error(\"Can't parse /IT property value\");\r\n                        default:\r\n                            i = yield parser.skipToNextNameAsync(i, end - 1);\r\n                            break;\r\n                    }\r\n                }\r\n                else {\r\n                    break;\r\n                }\r\n            }\r\n            if (this.DS) {\r\n                this._defaultStyle = this.DS.literal;\r\n            }\r\n            if (this.RC) {\r\n                const domParser = new DOMParser();\r\n                const body = (_a = domParser.parseFromString(this.RC.literal, \"text/xml\")) === null || _a === void 0 ? void 0 : _a.querySelector(\"body\");\r\n                if (body) {\r\n                    const style = body.getAttribute(\"style\");\r\n                    const p = body.querySelector(\"p\");\r\n                    this._rtStyle = style || \"\";\r\n                    this._rtText = (p === null || p === void 0 ? void 0 : p.textContent) || \"\";\r\n                }\r\n            }\r\n            if (!this.DA) {\r\n                throw new Error(\"Not all required properties parsed\");\r\n            }\r\n            if (!this.C || (this.C[0] === 1 && this.C[1] === 1 && this.C[2] === 1)) {\r\n                this.C = [1, 0, 0];\r\n            }\r\n        });\r\n    }\r\n    calculateStreamMatrix(tbTopLeftPage, tbTopRightPage) {\r\n        const length = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(tbTopRightPage, tbTopLeftPage).getMagnitude();\r\n        const alignedTL = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const alignedTR = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(length, 0);\r\n        const matrix = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(alignedTL, alignedTR, tbTopLeftPage, tbTopRightPage);\r\n        return matrix;\r\n    }\r\n    calculateStreamBbox(pPoints, matrixStreamToPage) {\r\n        const { bl: pBL, tr: pTR, br: pBR, tl: pTL, l: pL, t: pT, r: pR, b: pB, cob: pCoBase, cok: pCoKnee, cop: pCoPointer } = pPoints;\r\n        const minMargin = this.minMargin;\r\n        const matrixPageToStream = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.invert(matrixStreamToPage);\r\n        const sBL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pBL, matrixPageToStream).truncate();\r\n        const sTR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pTR, matrixPageToStream).truncate();\r\n        const sBR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pBR, matrixPageToStream).truncate();\r\n        const sTL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pTL, matrixPageToStream).truncate();\r\n        const sL = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pL, matrixPageToStream).truncate();\r\n        const sT = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pT, matrixPageToStream).truncate();\r\n        const sR = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pR, matrixPageToStream).truncate();\r\n        const sB = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pB, matrixPageToStream).truncate();\r\n        const sCoBase = pCoBase ? mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pCoBase, matrixPageToStream).truncate() : null;\r\n        const sCoKnee = pCoKnee ? mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pCoKnee, matrixPageToStream).truncate() : null;\r\n        const sCoPointer = pCoPointer ? mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.applyMat3(pCoPointer, matrixPageToStream).truncate() : null;\r\n        const actualPoints = [sBL, sTR, sBR, sTL, sCoKnee, sCoPointer].filter(x => x);\r\n        const { min: boxMinNoMargin, max: boxMaxNoMargin } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...actualPoints);\r\n        const boxMin = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(boxMinNoMargin.x - minMargin, boxMinNoMargin.y - minMargin);\r\n        const boxMax = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(boxMaxNoMargin.x + minMargin, boxMaxNoMargin.y + minMargin);\r\n        return {\r\n            bbox: [boxMin, boxMax],\r\n            points: {\r\n                bl: sBL,\r\n                tr: sTR,\r\n                br: sBR,\r\n                tl: sTL,\r\n                l: sL,\r\n                t: sT,\r\n                r: sR,\r\n                b: sB,\r\n                cob: sCoBase,\r\n                cok: sCoKnee,\r\n                cop: sCoPointer,\r\n            },\r\n        };\r\n    }\r\n    updateAnnotCoords(sPoints, matrixStreamToPage, bbox) {\r\n        const { bl: sBL, tr: sTR, cob: sCoBase, cok: sCoKnee, cop: sCoPointer } = sPoints;\r\n        const [boxMin, boxMax] = bbox;\r\n        const localBox = this.getLocalBB();\r\n        localBox.ll.set(boxMin.x, boxMin.y).applyMat3(matrixStreamToPage).truncate();\r\n        localBox.lr.set(boxMax.x, boxMin.y).applyMat3(matrixStreamToPage).truncate();\r\n        localBox.ur.set(boxMax.x, boxMax.y).applyMat3(matrixStreamToPage).truncate();\r\n        localBox.ul.set(boxMin.x, boxMax.y).applyMat3(matrixStreamToPage).truncate();\r\n        const { min: rectMin, max: rectMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(localBox.ll, localBox.lr, localBox.ur, localBox.ul);\r\n        this.Rect = [rectMin.x, rectMin.y, rectMax.x, rectMax.y];\r\n        if (sCoPointer && sCoBase) {\r\n            if (sCoKnee) {\r\n                this.CL = [sCoPointer.x, sCoPointer.y, sCoKnee.x, sCoKnee.y, sCoBase.x, sCoBase.y];\r\n            }\r\n            else {\r\n                this.CL = [sCoPointer.x, sCoPointer.y, sCoBase.x, sCoBase.y];\r\n            }\r\n            this.IT = freeTextIntents.WITH_CALLOUT;\r\n        }\r\n        else {\r\n            this.CL = undefined;\r\n            this.IT = freeTextIntents.PLAIN_TEXT;\r\n        }\r\n        this.RD = [\r\n            sBL.x - boxMin.x,\r\n            sBL.y - boxMin.y,\r\n            boxMax.x - sTR.x,\r\n            boxMax.y - sTR.y,\r\n        ];\r\n    }\r\n    getColorString() {\r\n        const [r, g, b] = this.getColorRect();\r\n        return `${r} ${g} ${b} RG 1 g`;\r\n    }\r\n    getCalloutStreamPart(sPoints) {\r\n        let calloutStream = \"\";\r\n        if (sPoints.cop && sPoints.cob) {\r\n            calloutStream += `\\n${sPoints.cob.x} ${sPoints.cob.y} m`;\r\n            if (sPoints.cok) {\r\n                calloutStream += `\\n${sPoints.cok.x} ${sPoints.cok.y} l`;\r\n            }\r\n            calloutStream += `\\n${sPoints.cop.x} ${sPoints.cop.y} l`;\r\n            calloutStream += \"\\nS\";\r\n            const coEnds = sPoints.cok\r\n                ? [sPoints.cok, sPoints.cop]\r\n                : [sPoints.cob, sPoints.cop];\r\n            const [coStart, coEnd] = coEnds;\r\n            const coStartAligned = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(0, 0);\r\n            const coEndAligned = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(coEnd, coStart).getMagnitude());\r\n            const coMat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(coStartAligned, coEndAligned, coStart, coEnd);\r\n            const calloutPointerStream = this.getLineEndingStreamPart(coEndAligned, this.LE, this.strokeWidth, \"right\");\r\n            const coMatShort = coMat.toFloatShortArray();\r\n            calloutStream += \"\\nq \"\r\n                + `${coMatShort[0].toFixed(5)} `\r\n                + `${coMatShort[1].toFixed(5)} `\r\n                + `${coMatShort[2].toFixed(5)} `\r\n                + `${coMatShort[3].toFixed(5)} `\r\n                + `${coMatShort[4].toFixed(5)} `\r\n                + `${coMatShort[5].toFixed(5)} `\r\n                + \"cm\";\r\n            calloutStream += calloutPointerStream;\r\n            calloutStream += \"\\nQ\";\r\n        }\r\n        return calloutStream;\r\n    }\r\n    getTextStreamPartAsync(sPoints, font) {\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            const w = this.strokeWidth;\r\n            const textMaxWidth = sPoints.br.x - sPoints.bl.x - 2 * w;\r\n            if (textMaxWidth <= 0) {\r\n                return \"\";\r\n            }\r\n            const fontSize = 12;\r\n            let textAlign;\r\n            if (this.Q) {\r\n                textAlign = this.Q === justificationTypes.CENTER\r\n                    ? \"center\"\r\n                    : \"right\";\r\n            }\r\n            else {\r\n                textAlign = \"left\";\r\n            }\r\n            const textData = yield this.updateTextDataAsync({\r\n                maxWidth: textMaxWidth,\r\n                fontSize,\r\n                strokeWidth: w,\r\n                textAlign: textAlign,\r\n                pivotPoint: \"top-left\",\r\n            });\r\n            if (!textData) {\r\n                return \"\";\r\n            }\r\n            let textStream = \"\\nq 0 g 0 G\";\r\n            const codeMap = font.encoding.codeMap;\r\n            for (const line of textData.lines) {\r\n                if (!line.text) {\r\n                    continue;\r\n                }\r\n                const lineStart = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(line.relativeRect[0], line.relativeRect[1])\r\n                    .add(sPoints.tl)\r\n                    .add(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(w, -w))\r\n                    .truncate();\r\n                let lineHex = \"\";\r\n                for (const char of line.text) {\r\n                    const code = codeMap.get(char);\r\n                    if (code) {\r\n                        lineHex += code.toString(16).padStart(2, \"0\");\r\n                    }\r\n                }\r\n                textStream += `\\nBT 0 Tc 0 Tw 100 Tz ${font.name} ${fontSize} Tf 0 Tr`;\r\n                textStream += `\\n1 0 0 1 ${lineStart.x} ${lineStart.y + fontSize * 0.2} Tm`;\r\n                textStream += `\\n<${lineHex}> Tj`;\r\n                textStream += \"\\nET\";\r\n            }\r\n            textStream += \"\\nQ\";\r\n            return textStream;\r\n        });\r\n    }\r\n    generateApStreamAsync(pPoints) {\r\n        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            if (!pPoints) {\r\n                throw new Error(\"No key annotation point coordinates passed\");\r\n            }\r\n            const matrix = this.calculateStreamMatrix(pPoints.tl, pPoints.tr);\r\n            const { bbox, points: sPoints } = this.calculateStreamBbox(pPoints, matrix);\r\n            this.updateAnnotCoords(sPoints, matrix, bbox);\r\n            const apStream = new XFormStream();\r\n            apStream.Filter = \"/FlateDecode\";\r\n            apStream.LastModified = DateString.fromDate(new Date());\r\n            apStream.BBox = [bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y];\r\n            apStream.Matrix = matrix.toFloatShortArray();\r\n            apStream.Resources = new ResourceDict();\r\n            const opacity = this.CA || 1;\r\n            const strokeWidth = this.strokeWidth;\r\n            const strokeDash = (_d = (_b = (_a = this.BS) === null || _a === void 0 ? void 0 : _a.D[0]) !== null && _b !== void 0 ? _b : (_c = this.Border) === null || _c === void 0 ? void 0 : _c.dash) !== null && _d !== void 0 ? _d : 3;\r\n            const strokeGap = (_h = (_f = (_e = this.BS) === null || _e === void 0 ? void 0 : _e.D[1]) !== null && _f !== void 0 ? _f : (_g = this.Border) === null || _g === void 0 ? void 0 : _g.gap) !== null && _h !== void 0 ? _h : 0;\r\n            const gs = new GraphicsStateDict();\r\n            gs.AIS = true;\r\n            gs.BM = \"/Normal\";\r\n            gs.CA = opacity;\r\n            gs.ca = opacity;\r\n            gs.LW = strokeWidth;\r\n            gs.D = [[strokeDash, strokeGap], 0];\r\n            gs.LC = lineCapStyles.SQUARE;\r\n            gs.LJ = lineJoinStyles.MITER;\r\n            apStream.Resources.setGraphicsState(\"/GS0\", gs);\r\n            const fontFamily = \"arial\";\r\n            const font = (_j = this._fontMap) === null || _j === void 0 ? void 0 : _j.get(fontFamily);\r\n            if (!font || !((_k = font.encoding) === null || _k === void 0 ? void 0 : _k.codeMap)) {\r\n                throw new Error(`Suitable font is not found in the font map: '${fontFamily}'`);\r\n            }\r\n            apStream.Resources.setFont(font.name, font);\r\n            const colorString = this.getColorString();\r\n            const calloutStreamPart = this.getCalloutStreamPart(sPoints);\r\n            const textBoxStreamPart = `\\n${sPoints.bl.x} ${sPoints.bl.y} m`\r\n                + `\\n${sPoints.br.x} ${sPoints.br.y} l`\r\n                + `\\n${sPoints.tr.x} ${sPoints.tr.y} l`\r\n                + `\\n${sPoints.tl.x} ${sPoints.tl.y} l`\r\n                + \"\\nb\";\r\n            const textStreamPart = yield this.getTextStreamPartAsync(sPoints, font);\r\n            const streamTextData = `q ${colorString} /GS0 gs`\r\n                + calloutStreamPart\r\n                + textBoxStreamPart\r\n                + textStreamPart\r\n                + \"\\nQ\";\r\n            apStream.setTextStreamData(streamTextData);\r\n            this.apStream = apStream;\r\n        });\r\n    }\r\n    updateStreamAsync(points, undoable = true) {\r\n        return __awaiter$p(this, void 0, void 0, function* () {\r\n            const dict = this.getProxy();\r\n            const oldPoints = dict.pointsPageCS;\r\n            yield dict.generateApStreamAsync(points || oldPoints);\r\n            yield dict.updateRenderAsync();\r\n            if (points && dict.$onEditAction) {\r\n                dict.$onEditAction(undoable\r\n                    ? () => __awaiter$p(this, void 0, void 0, function* () {\r\n                        yield dict.updateStreamAsync(oldPoints, false);\r\n                    })\r\n                    : undefined);\r\n            }\r\n        });\r\n    }\r\n    renderHandles() {\r\n        const points = this.pointsPageCS;\r\n        return [\r\n            ...this.renderTextBoxCornerHandles(points),\r\n            ...this.renderCalloutHandles(points),\r\n            this.renderRotationHandle()\r\n        ];\r\n    }\r\n    renderTextBoxCornerHandles(points) {\r\n        const { bl: pBL, br: pBR, tr: pTR, tl: pTL } = points;\r\n        const cornerMap = new Map();\r\n        cornerMap.set(\"tb-bl\", pBL);\r\n        cornerMap.set(\"tb-br\", pBR);\r\n        cornerMap.set(\"tb-tr\", pTR);\r\n        cornerMap.set(\"tb-tl\", pTL);\r\n        const handles = [];\r\n        [\"tb-bl\", \"tb-br\", \"tb-tr\", \"tb-tl\"].forEach(x => {\r\n            const { x: cx, y: cy } = cornerMap.get(x);\r\n            const handle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n            handle.classList.add(\"annotation-handle\", \"scale\");\r\n            handle.setAttribute(\"data-handle-name\", x);\r\n            handle.setAttribute(\"x1\", cx + \"\");\r\n            handle.setAttribute(\"y1\", cy + \"\");\r\n            handle.setAttribute(\"x2\", cx + \"\");\r\n            handle.setAttribute(\"y2\", cy + 0.1 + \"\");\r\n            handle.addEventListener(\"pointerdown\", this.onTextBoxCornerHandlePointerDown);\r\n            handles.push(handle);\r\n        });\r\n        return handles;\r\n    }\r\n    renderCalloutHandles(points) {\r\n        const handles = [];\r\n        if (!points.cop) {\r\n            return handles;\r\n        }\r\n        [\"l\", \"t\", \"r\", \"b\"].forEach(x => {\r\n            const side = points[x];\r\n            const sideHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n            sideHandle.classList.add(\"annotation-handle\", \"helper\");\r\n            sideHandle.setAttribute(\"data-handle-name\", `co-pivot-${x}`);\r\n            sideHandle.setAttribute(\"x1\", side.x + \"\");\r\n            sideHandle.setAttribute(\"y1\", side.y + \"\");\r\n            sideHandle.setAttribute(\"x2\", side.x + \"\");\r\n            sideHandle.setAttribute(\"y2\", side.y + 0.1 + \"\");\r\n            sideHandle.addEventListener(\"pointerdown\", this.onSideHandlePointerUp);\r\n            handles.push(sideHandle);\r\n        });\r\n        if (points.cok) {\r\n            const pCoKnee = points.cok;\r\n            const kneeHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n            kneeHandle.classList.add(\"annotation-handle\", \"translation\");\r\n            kneeHandle.setAttribute(\"data-handle-name\", \"co-knee\");\r\n            kneeHandle.setAttribute(\"x1\", pCoKnee.x + \"\");\r\n            kneeHandle.setAttribute(\"y1\", pCoKnee.y + \"\");\r\n            kneeHandle.setAttribute(\"x2\", pCoKnee.x + \"\");\r\n            kneeHandle.setAttribute(\"y2\", pCoKnee.y + 0.1 + \"\");\r\n            kneeHandle.addEventListener(\"pointerdown\", this.onCalloutHandlePointerDown);\r\n            handles.push(kneeHandle);\r\n        }\r\n        const pCoPointer = points.cop;\r\n        const pointerHandle = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\r\n        pointerHandle.classList.add(\"annotation-handle\", \"translation\");\r\n        pointerHandle.setAttribute(\"data-handle-name\", \"co-pointer\");\r\n        pointerHandle.setAttribute(\"x1\", pCoPointer.x + \"\");\r\n        pointerHandle.setAttribute(\"y1\", pCoPointer.y + \"\");\r\n        pointerHandle.setAttribute(\"x2\", pCoPointer.x + \"\");\r\n        pointerHandle.setAttribute(\"y2\", pCoPointer.y + 0.1 + \"\");\r\n        pointerHandle.addEventListener(\"pointerdown\", this.onCalloutHandlePointerDown);\r\n        handles.push(pointerHandle);\r\n        return handles;\r\n    }\r\n    initProxy() {\r\n        return super.initProxy();\r\n    }\r\n    getProxy() {\r\n        return super.getProxy();\r\n    }\r\n}\n\nvar __awaiter$o = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass AnnotationParser {\r\n    static ParseAnnotationFromInfoAsync(info, fontMap) {\r\n        return __awaiter$o(this, void 0, void 0, function* () {\r\n            const annotationType = yield info.parser.parseDictSubtypeAsync(info.bounds);\r\n            let annot;\r\n            switch (annotationType) {\r\n                case annotationTypes.STAMP:\r\n                    annot = yield StampAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.TEXT:\r\n                    annot = yield TextAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.INK:\r\n                    annot = yield InkAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.SQUARE:\r\n                    annot = yield SquareAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.CIRCLE:\r\n                    annot = yield CircleAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.POLYGON:\r\n                    annot = yield PolygonAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.POLYLINE:\r\n                    annot = yield PolylineAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.LINE:\r\n                    annot = yield LineAnnotation.parseAsync(info, fontMap);\r\n                    break;\r\n                case annotationTypes.HIGHLIGHT:\r\n                    annot = yield HighlightAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.SQUIGGLY:\r\n                    annot = yield SquigglyAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.STRIKEOUT:\r\n                    annot = yield StrikeoutAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.UNDERLINE:\r\n                    annot = yield UnderlineAnnotation.parseAsync(info);\r\n                    break;\r\n                case annotationTypes.FREE_TEXT:\r\n                    annot = yield FreeTextAnnotation.parseAsync(info, fontMap);\r\n                    break;\r\n            }\r\n            return annot === null || annot === void 0 ? void 0 : annot.value;\r\n        });\r\n    }\r\n    static ParseAnnotationFromDtoAsync(dto, fontMap) {\r\n        return __awaiter$o(this, void 0, void 0, function* () {\r\n            let annotation;\r\n            switch (dto.annotationType) {\r\n                case \"/Stamp\":\r\n                    annotation = StampAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Text\":\r\n                    annotation = TextAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Ink\":\r\n                    annotation = InkAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Square\":\r\n                    annotation = SquareAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Circle\":\r\n                    annotation = CircleAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Polygon\":\r\n                    annotation = PolygonAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Polyline\":\r\n                    annotation = PolylineAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Line\":\r\n                    annotation = yield LineAnnotation.createFromDtoAsync(dto, fontMap);\r\n                    break;\r\n                case \"/Highlight\":\r\n                    annotation = HighlightAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Squiggly\":\r\n                    annotation = SquigglyAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Strikeout\":\r\n                    annotation = StrikeoutAnnotation.createFromDto(dto);\r\n                    break;\r\n                case \"/Underline\":\r\n                    annotation = UnderlineAnnotation.createFromDto(dto);\r\n                    break;\r\n                default:\r\n                    throw new Error(`Unsupported annotation type: ${dto.annotationType}`);\r\n            }\r\n            return annotation;\r\n        });\r\n    }\r\n}\n\nvar __awaiter$n = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst annotSelectionRequestEvent = \"tspdf-annotselectionrequest\";\r\nconst annotFocusRequestEvent = \"tspdf-annotfocusrequest\";\r\nconst annotChangeEvent = \"tspdf-annotchange\";\r\nconst docServiceStateChangeEvent = \"tspdf-docservicechange\";\r\nclass AnnotSelectionRequestEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(annotSelectionRequestEvent, { detail });\r\n    }\r\n}\r\nclass AnnotFocusRequestEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(annotFocusRequestEvent, { detail });\r\n    }\r\n}\r\nclass AnnotEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(annotChangeEvent, { detail });\r\n    }\r\n}\r\nclass DocServiceStateChangeEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(docServiceStateChangeEvent, { detail });\r\n    }\r\n}\r\nclass DocumentService {\r\n    constructor(eventService, data, userName) {\r\n        this._pageById = new Map();\r\n        this._annotIdsByPageId = new Map();\r\n        this._lastCommands = [];\r\n        this.getObjectParseInfoAsync = (id) => __awaiter$n(this, void 0, void 0, function* () {\r\n            var _a, _b, _c;\r\n            if (!id) {\r\n                return null;\r\n            }\r\n            const offset = (_a = this._referenceData) === null || _a === void 0 ? void 0 : _a.getOffset(id);\r\n            if (isNaN(offset)) {\r\n                return null;\r\n            }\r\n            const objectId = yield ObjectId.parseAsync(this._docParser, offset);\r\n            if (!objectId) {\r\n                return null;\r\n            }\r\n            const bounds = yield this._docParser.getIndirectObjectBoundsAtAsync(objectId.end + 1, true);\r\n            if (!bounds) {\r\n                return null;\r\n            }\r\n            const parseInfoGetterAsync = this.getObjectParseInfoAsync;\r\n            const info = {\r\n                parser: this._docParser,\r\n                bounds,\r\n                parseInfoGetterAsync: parseInfoGetterAsync,\r\n                cryptInfo: {\r\n                    ref: { id: objectId.value.id, generation: objectId.value.generation },\r\n                    stringCryptor: (_b = this._authResult) === null || _b === void 0 ? void 0 : _b.stringCryptor,\r\n                    streamCryptor: (_c = this._authResult) === null || _c === void 0 ? void 0 : _c.streamCryptor,\r\n                },\r\n            };\r\n            if (objectId.value.id === id) {\r\n                return info;\r\n            }\r\n            const stream = yield ObjectStream.parseAsync(info);\r\n            if (!stream) {\r\n                return;\r\n            }\r\n            const objectParseInfo = yield stream.value.getObjectDataAsync(id);\r\n            if (objectParseInfo) {\r\n                objectParseInfo.parseInfoGetterAsync = parseInfoGetterAsync;\r\n                return objectParseInfo;\r\n            }\r\n            return null;\r\n        });\r\n        this.onAnnotationSelectionRequest = (e) => {\r\n            var _a;\r\n            if ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.annotation) {\r\n                this.setSelectedAnnotation(e.detail.annotation);\r\n            }\r\n            else {\r\n                this.setSelectedAnnotation(null);\r\n            }\r\n        };\r\n        this.onAnnotationFocusRequest = (e) => {\r\n            var _a;\r\n            if ((_a = e.detail) === null || _a === void 0 ? void 0 : _a.annotation) {\r\n                this.setFocusedAnnotation(e.detail.annotation);\r\n            }\r\n            else {\r\n                this.setFocusedAnnotation(null);\r\n            }\r\n        };\r\n        if (!eventService) {\r\n            throw new Error(\"Event controller is not defined\");\r\n        }\r\n        this._data = data;\r\n        this._userName = userName;\r\n        this._fontMap = FontDict.newFontMap();\r\n        this._eventService = eventService;\r\n        this._eventService.addListener(annotSelectionRequestEvent, this.onAnnotationSelectionRequest);\r\n        this._eventService.addListener(annotFocusRequestEvent, this.onAnnotationFocusRequest);\r\n        this._initPromise = this.initAsync();\r\n    }\r\n    get eventService() {\r\n        return this._eventService;\r\n    }\r\n    get userName() {\r\n        return this._userName;\r\n    }\r\n    get focusedAnnotation() {\r\n        return this._focusedAnnotation;\r\n    }\r\n    get selectedAnnotation() {\r\n        return this._selectedAnnotation;\r\n    }\r\n    get fontMap() {\r\n        return this._fontMap;\r\n    }\r\n    get size() {\r\n        var _a;\r\n        if ((_a = this._xrefs) === null || _a === void 0 ? void 0 : _a.length) {\r\n            return this._xrefs[0].size;\r\n        }\r\n        else {\r\n            return 0;\r\n        }\r\n    }\r\n    get encrypted() {\r\n        return !!this._encryption;\r\n    }\r\n    get authenticated() {\r\n        return !this._encryption || !!this._authResult;\r\n    }\r\n    static createNewAsync(eventService, data, userName) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const service = new DocumentService(eventService, data, userName);\r\n            yield service._initPromise;\r\n            return service;\r\n        });\r\n    }\r\n    destroy() {\r\n        this._initPromise.then(() => {\r\n            var _a;\r\n            this._lastCommands.length = 0;\r\n            this.emitStateChanged();\r\n            this.getAllSupportedAnnotationsAsync().then(map => map.forEach(x => {\r\n                x.$onEditAction = null;\r\n                x.$onRenderUpdatedAction = null;\r\n            }));\r\n            this._eventService.removeListener(annotSelectionRequestEvent, this.onAnnotationSelectionRequest);\r\n            this._eventService.removeListener(annotFocusRequestEvent, this.onAnnotationFocusRequest);\r\n            (_a = this._docParser) === null || _a === void 0 ? void 0 : _a.destroy();\r\n            BgDataParser.destroy();\r\n        });\r\n    }\r\n    tryAuthenticate(password = \"\") {\r\n        if (!this.authenticated) {\r\n            return this.authenticate(password);\r\n        }\r\n        return true;\r\n    }\r\n    getPlainData() {\r\n        return this._data.slice();\r\n    }\r\n    undoAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            yield this.undoCommandAsync();\r\n        });\r\n    }\r\n    getDataWithoutSupportedAnnotationsAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            const annotationMarkedToDelete = [];\r\n            if (annotationMap === null || annotationMap === void 0 ? void 0 : annotationMap.size) {\r\n                annotationMap.forEach((v, k) => {\r\n                    const annotations = v.slice();\r\n                    annotations.forEach(x => {\r\n                        if (!x.deleted) {\r\n                            x.markAsDeleted(true);\r\n                            annotationMarkedToDelete.push(x);\r\n                        }\r\n                    });\r\n                });\r\n            }\r\n            const refined = yield this.getDataWithUpdatedAnnotationsAsync();\r\n            annotationMarkedToDelete.forEach(x => x.markAsDeleted(false));\r\n            return refined;\r\n        });\r\n    }\r\n    getDataWithUpdatedAnnotationsAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            const updaterData = [];\r\n            annotationMap.forEach((pageAnnotations, pageId) => {\r\n                const page = this._pageById.get(pageId);\r\n                if (page) {\r\n                    const allAnnotationIds = this._annotIdsByPageId.get(pageId).slice() || [];\r\n                    updaterData.push({\r\n                        page,\r\n                        allAnnotationIds,\r\n                        supportedAnnotations: pageAnnotations || [],\r\n                    });\r\n                }\r\n                else {\r\n                    console.log(`Page with id '${pageId}' not found`);\r\n                }\r\n            });\r\n            const updater = new DataUpdater(this._data, this._xrefs[0], this._referenceData, this._authResult);\r\n            const updatedBytes = updater.getDataWithUpdatedAnnotations(updaterData);\r\n            return updatedBytes;\r\n        });\r\n    }\r\n    getPageAnnotationsAsync(pageId) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            const annotations = annotationMap.get(pageId);\r\n            return annotations || [];\r\n        });\r\n    }\r\n    serializeAnnotationsAsync(addedOnly = false) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const result = [];\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            annotationMap.forEach((v, k) => {\r\n                v.forEach(x => {\r\n                    if (!addedOnly || x.added) {\r\n                        result.push(x.toDto());\r\n                    }\r\n                });\r\n            });\r\n            return result;\r\n        });\r\n    }\r\n    appendAnnotationToPageAsync(pageId, annotation) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            yield this.appendAnnotationAsync(pageId, annotation, true, \"add\");\r\n        });\r\n    }\r\n    appendSerializedAnnotationsAsync(dtos) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            let annotation;\r\n            for (const dto of dtos) {\r\n                annotation = yield AnnotationParser.ParseAnnotationFromDtoAsync(dto, this._fontMap);\r\n                yield this.appendAnnotationAsync(dto.pageId, annotation, false, \"import\");\r\n            }\r\n        });\r\n    }\r\n    removeAnnotationFromPage(annotation) {\r\n        this.removeAnnotation(annotation, true);\r\n    }\r\n    removeSelectedAnnotation() {\r\n        const annotation = this._selectedAnnotation;\r\n        if (annotation) {\r\n            this.removeAnnotation(annotation, true);\r\n        }\r\n    }\r\n    setSelectedAnnotation(annotation) {\r\n        var _a, _b, _c;\r\n        if (annotation === this._selectedAnnotation) {\r\n            return;\r\n        }\r\n        if (this._selectedAnnotation) {\r\n            this._selectedAnnotation.$translationEnabled = false;\r\n            const oldSelectedSvg = (_b = (_a = this._selectedAnnotation) === null || _a === void 0 ? void 0 : _a.lastRenderResult) === null || _b === void 0 ? void 0 : _b.controls;\r\n            oldSelectedSvg === null || oldSelectedSvg === void 0 ? void 0 : oldSelectedSvg.classList.remove(\"selected\");\r\n        }\r\n        const newSelectedSvg = (_c = annotation === null || annotation === void 0 ? void 0 : annotation.lastRenderResult) === null || _c === void 0 ? void 0 : _c.controls;\r\n        if (!newSelectedSvg) {\r\n            this._selectedAnnotation = null;\r\n        }\r\n        else {\r\n            annotation.$translationEnabled = true;\r\n            newSelectedSvg.classList.add(\"selected\");\r\n            this._selectedAnnotation = annotation;\r\n        }\r\n        this._eventService.dispatchEvent(new AnnotEvent({\r\n            type: \"select\",\r\n            annotations: this._selectedAnnotation\r\n                ? [this._selectedAnnotation.toDto()]\r\n                : [],\r\n        }));\r\n        return this._selectedAnnotation;\r\n    }\r\n    setFocusedAnnotation(annotation) {\r\n        var _a, _b, _c;\r\n        if (annotation === this._focusedAnnotation) {\r\n            return;\r\n        }\r\n        if (this._focusedAnnotation) {\r\n            this._focusedAnnotation.$translationEnabled = false;\r\n            const oldFocusedSvg = (_b = (_a = this._focusedAnnotation) === null || _a === void 0 ? void 0 : _a.lastRenderResult) === null || _b === void 0 ? void 0 : _b.controls;\r\n            oldFocusedSvg === null || oldFocusedSvg === void 0 ? void 0 : oldFocusedSvg.classList.remove(\"focused\");\r\n        }\r\n        const newFocusedSvg = (_c = annotation === null || annotation === void 0 ? void 0 : annotation.lastRenderResult) === null || _c === void 0 ? void 0 : _c.controls;\r\n        if (!newFocusedSvg) {\r\n            this._focusedAnnotation = null;\r\n        }\r\n        else {\r\n            annotation.$translationEnabled = true;\r\n            newFocusedSvg.classList.add(\"focused\");\r\n            this._focusedAnnotation = annotation;\r\n        }\r\n        this._eventService.dispatchEvent(new AnnotEvent({\r\n            type: \"focus\",\r\n            annotations: this._focusedAnnotation\r\n                ? [this._focusedAnnotation.toDto()]\r\n                : [],\r\n        }));\r\n        return this._focusedAnnotation;\r\n    }\r\n    getSelectedAnnotationTextContent() {\r\n        var _a, _b;\r\n        return (_b = (_a = this._selectedAnnotation) === null || _a === void 0 ? void 0 : _a.Contents) === null || _b === void 0 ? void 0 : _b.literal;\r\n    }\r\n    setSelectedAnnotationTextContentAsync(text) {\r\n        var _a;\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            yield ((_a = this._selectedAnnotation) === null || _a === void 0 ? void 0 : _a.setTextContentAsync(text));\r\n        });\r\n    }\r\n    parseXrefsAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const xrefParser = new XrefParser(this._docParser);\r\n            this._version = yield xrefParser.getPdfVersionAsync();\r\n            if (!this._version) {\r\n                throw new Error(\"Error parsing PDF version number\");\r\n            }\r\n            const lastXrefIndex = yield xrefParser.getLastXrefIndexAsync();\r\n            if (!lastXrefIndex) {\r\n                {\r\n                    throw new Error(\"File doesn't contain update section\");\r\n                }\r\n            }\r\n            const xrefs = yield xrefParser.parseAllXrefsAsync(lastXrefIndex.value);\r\n            if (!xrefs.length) {\r\n                {\r\n                    throw new Error(\"Failed to parse cross-reference sections\");\r\n                }\r\n            }\r\n            this._xrefs = xrefs;\r\n            this._referenceData = new ReferenceData(xrefs);\r\n        });\r\n    }\r\n    initAsync() {\r\n        var _a;\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            this._docParser = (_a = BgDataParser.tryGetParser(this._data.slice())) !== null && _a !== void 0 ? _a : SyncDataParser.tryGetParser(this._data);\r\n            yield this.parseXrefsAsync();\r\n            yield this.parseEncryptionAsync();\r\n        });\r\n    }\r\n    pushCommand(command) {\r\n        this._lastCommands.push(command);\r\n        this.emitStateChanged();\r\n    }\r\n    undoCommandAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            if (!this._lastCommands.length) {\r\n                return;\r\n            }\r\n            const lastCommand = this._lastCommands.pop();\r\n            yield lastCommand.undo();\r\n            this.emitStateChanged();\r\n        });\r\n    }\r\n    emitStateChanged() {\r\n        this._eventService.dispatchEvent(new DocServiceStateChangeEvent({\r\n            undoableCount: this._lastCommands.length,\r\n        }));\r\n    }\r\n    appendAnnotationAsync(pageId, annotation, undoable, raiseEvent) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            if (!annotation) {\r\n                throw new Error(\"Annotation is not defined\");\r\n            }\r\n            const page = this._pageById.get(pageId);\r\n            if (!page) {\r\n                throw new Error(`Page with id ${pageId} is not found`);\r\n            }\r\n            annotation.markAsDeleted(false);\r\n            annotation.$pageId = page.id;\r\n            annotation.$onEditAction = this.getOnAnnotEditAction(annotation);\r\n            annotation.$onRenderUpdatedAction = this.getOnAnnotRenderUpdatedAction(annotation);\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            const pageAnnotations = annotationMap.get(pageId);\r\n            if (pageAnnotations) {\r\n                pageAnnotations.push(annotation);\r\n            }\r\n            else {\r\n                annotationMap.set(pageId, [annotation]);\r\n            }\r\n            if (undoable) {\r\n                this.pushCommand({\r\n                    timestamp: Date.now(),\r\n                    undo: () => __awaiter$n(this, void 0, void 0, function* () {\r\n                        this.removeAnnotation(annotation, false);\r\n                        if (this.selectedAnnotation === annotation) {\r\n                            this.setSelectedAnnotation(null);\r\n                        }\r\n                    })\r\n                });\r\n            }\r\n            this._eventService.dispatchEvent(new AnnotEvent({\r\n                type: raiseEvent,\r\n                annotations: [annotation.toDto()],\r\n            }));\r\n        });\r\n    }\r\n    removeAnnotation(annotation, undoable) {\r\n        if (!annotation) {\r\n            return;\r\n        }\r\n        annotation.markAsDeleted(true);\r\n        this.setSelectedAnnotation(null);\r\n        if (undoable) {\r\n            this.pushCommand({\r\n                timestamp: Date.now(),\r\n                undo: () => __awaiter$n(this, void 0, void 0, function* () {\r\n                    yield this.appendAnnotationAsync(annotation.$pageId, annotation, false, \"add\");\r\n                })\r\n            });\r\n        }\r\n        this._eventService.dispatchEvent(new AnnotEvent({\r\n            type: \"delete\",\r\n            annotations: [annotation.toDto()],\r\n        }));\r\n    }\r\n    getOnAnnotEditAction(annotation) {\r\n        if (!annotation) {\r\n            return null;\r\n        }\r\n        return (undo) => {\r\n            if (!annotation.$pageId) {\r\n                return;\r\n            }\r\n            if (undo) {\r\n                this.pushCommand({ timestamp: Date.now(), undo });\r\n            }\r\n            this._eventService.dispatchEvent(new AnnotEvent({\r\n                type: \"edit\",\r\n                annotations: [annotation.toDto()],\r\n            }));\r\n        };\r\n    }\r\n    getOnAnnotRenderUpdatedAction(annotation) {\r\n        if (!annotation) {\r\n            return null;\r\n        }\r\n        return () => this._eventService.dispatchEvent(new AnnotEvent({\r\n            type: \"render\",\r\n            annotations: [annotation.toDto()],\r\n        }));\r\n    }\r\n    authenticate(password) {\r\n        if (this.authenticated) {\r\n            return true;\r\n        }\r\n        const cryptOptions = this._encryption.toCryptOptions();\r\n        const fileId = this._xrefs[0].id[0].hex;\r\n        const cryptorSource = new DataCryptHandler(cryptOptions, fileId);\r\n        this._authResult = cryptorSource.authenticate(password);\r\n        return this.authenticated;\r\n    }\r\n    checkAuthentication() {\r\n        if (!this.authenticated) {\r\n            throw new Error(\"Unauthorized access to file data\");\r\n        }\r\n    }\r\n    parseEncryptionAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const encryptionId = this._xrefs[0].encrypt;\r\n            if (!encryptionId) {\r\n                return;\r\n            }\r\n            const encryptionParseInfo = yield this.getObjectParseInfoAsync(encryptionId.id);\r\n            const encryption = yield EncryptionDict.parseAsync(encryptionParseInfo);\r\n            if (!encryption) {\r\n                throw new Error(\"Encryption dict can't be parsed\");\r\n            }\r\n            this._encryption = encryption.value;\r\n        });\r\n    }\r\n    parsePagesAsync(output, tree) {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            if (!tree.Kids.length) {\r\n                return;\r\n            }\r\n            for (const kid of tree.Kids) {\r\n                const parseInfo = yield this.getObjectParseInfoAsync(kid.id);\r\n                if (!parseInfo) {\r\n                    continue;\r\n                }\r\n                const type = yield parseInfo.parser.parseDictTypeAsync(parseInfo.bounds);\r\n                if (type === dictTypes.PAGE_TREE) {\r\n                    const kidTree = yield PageTreeDict.parseAsync(parseInfo);\r\n                    if (kidTree) {\r\n                        yield this.parsePagesAsync(output, kidTree.value);\r\n                    }\r\n                }\r\n                else if (type === dictTypes.PAGE) {\r\n                    const kidPage = yield PageDict.parseAsync(parseInfo);\r\n                    if (kidPage) {\r\n                        output.push(kidPage.value);\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    }\r\n    ;\r\n    parsePageTreeAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const catalogId = this._xrefs[0].root;\r\n            const catalogParseInfo = yield this.getObjectParseInfoAsync(catalogId.id);\r\n            const catalog = yield CatalogDict.parseAsync(catalogParseInfo);\r\n            if (!catalog) {\r\n                throw new Error(\"Document root catalog not found\");\r\n            }\r\n            this._catalog = catalog.value;\r\n            const pageRootId = catalog.value.Pages;\r\n            const pageRootParseInfo = yield this.getObjectParseInfoAsync(pageRootId.id);\r\n            const pageRootTree = yield PageTreeDict.parseAsync(pageRootParseInfo);\r\n            if (!pageRootTree) {\r\n                throw new Error(\"Document root page tree not found\");\r\n            }\r\n            const pages = [];\r\n            yield this.parsePagesAsync(pages, pageRootTree.value);\r\n            this._pages = pages;\r\n            this._pageById.clear();\r\n            pages.forEach(x => this._pageById.set(x.ref.id, x));\r\n        });\r\n    }\r\n    parseSupportedAnnotationsAsync() {\r\n        var _a;\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            this.checkAuthentication();\r\n            if (!this._catalog) {\r\n                yield this.parsePageTreeAsync();\r\n            }\r\n            const annotIdsByPageId = new Map();\r\n            const annotationMap = new Map();\r\n            for (const page of this._pages) {\r\n                const annotationIds = [];\r\n                if (Array.isArray(page.Annots)) {\r\n                    annotationIds.push(...page.Annots);\r\n                }\r\n                else if (page.Annots instanceof ObjectId) {\r\n                    const parseInfo = yield this.getObjectParseInfoAsync(page.Annots.id);\r\n                    if (parseInfo) {\r\n                        const annotationRefs = yield ObjectId.parseRefArrayAsync(parseInfo.parser, parseInfo.bounds.contentStart);\r\n                        if ((_a = annotationRefs === null || annotationRefs === void 0 ? void 0 : annotationRefs.value) === null || _a === void 0 ? void 0 : _a.length) {\r\n                            annotationIds.push(...annotationRefs.value);\r\n                        }\r\n                    }\r\n                }\r\n                annotIdsByPageId.set(page.ref.id, annotationIds);\r\n                const processAnnotation = (objectId) => __awaiter$n(this, void 0, void 0, function* () {\r\n                    const info = yield this.getObjectParseInfoAsync(objectId.id);\r\n                    info.rect = page.MediaBox;\r\n                    const annot = yield AnnotationParser.ParseAnnotationFromInfoAsync(info, this._fontMap);\r\n                    if (annot) {\r\n                        annot.$pageId = page.id;\r\n                        annot.$onEditAction = this.getOnAnnotEditAction(annot);\r\n                        annot.$onRenderUpdatedAction = this.getOnAnnotRenderUpdatedAction(annot);\r\n                    }\r\n                    return annot;\r\n                });\r\n                const annotations = (yield Promise.all(annotationIds.map(x => processAnnotation(x))))\r\n                    .filter(x => x);\r\n                annotationMap.set(page.id, annotations);\r\n            }\r\n            this._annotIdsByPageId = annotIdsByPageId;\r\n            this._supportedAnnotsByPageId = annotationMap;\r\n        });\r\n    }\r\n    getSupportedAnnotationMapAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            this.checkAuthentication();\r\n            if (this._supportedAnnotsByPageId) {\r\n                return this._supportedAnnotsByPageId;\r\n            }\r\n            yield this.parseSupportedAnnotationsAsync();\r\n            return this._supportedAnnotsByPageId;\r\n        });\r\n    }\r\n    getAllSupportedAnnotationsAsync() {\r\n        return __awaiter$n(this, void 0, void 0, function* () {\r\n            const result = [];\r\n            const annotationMap = yield this.getSupportedAnnotationMapAsync();\r\n            annotationMap.forEach((v, k) => {\r\n                result.push(...v);\r\n            });\r\n            return result;\r\n        });\r\n    }\r\n}\n\nvar __awaiter$m = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageAnnotationView {\r\n    constructor(docService, pageInfo, pageDimensions) {\r\n        this._rendered = new Set();\r\n        this.onAnnotationSelectionChange = (e) => {\r\n            var _a;\r\n            if (!this._destroyed && e.detail.type === \"select\") {\r\n                if ((_a = e.detail.annotations) === null || _a === void 0 ? void 0 : _a.length) {\r\n                    this._container.style.touchAction = \"none\";\r\n                }\r\n                else {\r\n                    this._container.style.touchAction = \"\";\r\n                }\r\n            }\r\n        };\r\n        if (!docService || !pageInfo || !pageDimensions) {\r\n            throw new Error(\"Required argument not found\");\r\n        }\r\n        this._pageInfo = pageInfo;\r\n        this._viewbox = [0, 0, pageDimensions.x, pageDimensions.y];\r\n        this._docService = docService;\r\n        this._container = document.createElement(\"div\");\r\n        this._container.classList.add(\"page-annotations\");\r\n        this._svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n        this._svg.classList.add(\"page-annotations-controls\");\r\n        this._svg.setAttribute(\"data-page-id\", pageInfo.id + \"\");\r\n        this._svg.setAttribute(\"viewBox\", `0 0 ${pageDimensions.x} ${pageDimensions.y}`);\r\n        this._svg.setAttribute(\"transform\", \"scale(1, -1)\");\r\n        this._svg.addEventListener(\"pointerdown\", (e) => {\r\n            if (e.target === this._svg) {\r\n                docService.setSelectedAnnotation(null);\r\n            }\r\n        });\r\n    }\r\n    destroy() {\r\n        this._destroyed = true;\r\n        this.remove();\r\n        this._container = null;\r\n        this._rendered.forEach(x => {\r\n            x.$onPointerDownAction = null;\r\n            x.$onPointerEnterAction = null;\r\n            x.$onPointerLeaveAction = null;\r\n        });\r\n        this._rendered.clear();\r\n    }\r\n    remove() {\r\n        var _a;\r\n        (_a = this._container) === null || _a === void 0 ? void 0 : _a.remove();\r\n        this._docService.eventService.removeListener(annotChangeEvent, this.onAnnotationSelectionChange);\r\n    }\r\n    appendAsync(parent) {\r\n        var _a;\r\n        return __awaiter$m(this, void 0, void 0, function* () {\r\n            if (this._destroyed) {\r\n                return;\r\n            }\r\n            parent.append(this._container);\r\n            const renderResult = yield this.renderAnnotationsAsync();\r\n            if (!renderResult) {\r\n                (_a = this._container) === null || _a === void 0 ? void 0 : _a.remove();\r\n                return;\r\n            }\r\n            this._docService.eventService.addListener(annotChangeEvent, this.onAnnotationSelectionChange);\r\n        });\r\n    }\r\n    renderAnnotationsAsync() {\r\n        return __awaiter$m(this, void 0, void 0, function* () {\r\n            if (this._destroyed) {\r\n                return false;\r\n            }\r\n            this.clear();\r\n            const annotations = (yield this._docService\r\n                .getPageAnnotationsAsync(this._pageInfo.id))\r\n                .filter(x => !x.deleted)\r\n                || [];\r\n            const processAnnotation = (annotation) => __awaiter$m(this, void 0, void 0, function* () {\r\n                let renderResult;\r\n                if (!this._rendered.has(annotation)) {\r\n                    annotation.$onPointerDownAction = (e) => {\r\n                        this._docService.eventService.dispatchEvent(new AnnotSelectionRequestEvent({ annotation }));\r\n                    };\r\n                    annotation.$onPointerEnterAction = (e) => {\r\n                        this._docService.eventService.dispatchEvent(new AnnotFocusRequestEvent({ annotation }));\r\n                    };\r\n                    annotation.$onPointerLeaveAction = (e) => {\r\n                        this._docService.eventService.dispatchEvent(new AnnotFocusRequestEvent({ annotation: null }));\r\n                    };\r\n                    renderResult = yield annotation.renderAsync(this._pageInfo);\r\n                }\r\n                else {\r\n                    renderResult = annotation.lastRenderResult || (yield annotation.renderAsync(this._pageInfo));\r\n                }\r\n                if (renderResult && !this._destroyed) {\r\n                    this._rendered.add(annotation);\r\n                    this._svg.append(renderResult.controls);\r\n                    this._container.append(renderResult.content);\r\n                }\r\n            });\r\n            yield Promise.all(annotations.map(x => processAnnotation(x)));\r\n            if (this._destroyed) {\r\n                return false;\r\n            }\r\n            this._container.append(this._svg);\r\n            return true;\r\n        });\r\n    }\r\n    clear() {\r\n        this._container.innerHTML = \"\";\r\n        this._svg.innerHTML = \"\";\r\n    }\r\n}\n\nvar __awaiter$l = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageComparisonView {\r\n    constructor(comparisonService, subjectPageInfo, pageDimensions) {\r\n        this.onAreaPointerDown = (e) => {\r\n            const area = e.target.closest(\".comparison-area\");\r\n            if (!area) {\r\n                return;\r\n            }\r\n            if (area.classList.contains(\"transparent\")) {\r\n                area.classList.remove(\"transparent\");\r\n                area.classList.add(\"opaque\");\r\n            }\r\n            else if (area.classList.contains(\"opaque\")) {\r\n                area.classList.remove(\"opaque\");\r\n            }\r\n            else {\r\n                area.classList.add(\"transparent\");\r\n            }\r\n        };\r\n        this.onAreaPointerEnter = (e) => {\r\n            const area = e.target;\r\n            area.classList.remove(\"opaque\");\r\n            area.classList.add(\"transparent\");\r\n        };\r\n        this.onAreaPointerLeave = (e) => {\r\n            const area = e.target;\r\n            area.classList.remove(\"opaque\");\r\n            area.classList.remove(\"transparent\");\r\n        };\r\n        if (!comparisonService || !subjectPageInfo || !pageDimensions) {\r\n            throw new Error(\"Required argument not found\");\r\n        }\r\n        this._comparisonService = comparisonService;\r\n        this._subjectPageInfo = subjectPageInfo;\r\n        this._subjectPageHeight = pageDimensions.y;\r\n        this._container = document.createElement(\"div\");\r\n        this._container.classList.add(\"page-comparison\");\r\n        this._svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n        this._svg.classList.add(\"page-comparison-areas\");\r\n        this._svg.setAttribute(\"data-page-id\", subjectPageInfo.id + \"\");\r\n        this._svg.setAttribute(\"viewBox\", `0 0 ${pageDimensions.x} ${pageDimensions.y}`);\r\n        this._svg.setAttribute(\"transform\", \"scale(1, -1)\");\r\n        this._container.append(this._svg);\r\n    }\r\n    destroy() {\r\n        this._destroyed = true;\r\n        this.remove();\r\n        this._container = null;\r\n        this._lastRenderResult = null;\r\n    }\r\n    remove() {\r\n        var _a;\r\n        (_a = this._container) === null || _a === void 0 ? void 0 : _a.remove();\r\n    }\r\n    appendAsync(parent, agentPageProxy, scale) {\r\n        return __awaiter$l(this, void 0, void 0, function* () {\r\n            this.remove();\r\n            if (this._destroyed || !agentPageProxy) {\r\n                return;\r\n            }\r\n            const comparisonResult = this._comparisonService\r\n                .getComparisonResultForPage(this._subjectPageInfo.index);\r\n            if (!(comparisonResult === null || comparisonResult === void 0 ? void 0 : comparisonResult.length)) {\r\n                return;\r\n            }\r\n            let rerendered = false;\r\n            if (!this._lastRenderResult\r\n                || this._lastRenderResult.pageProxy !== agentPageProxy\r\n                || this._lastRenderResult.scale !== scale) {\r\n                this._lastRenderResult = yield this.renderPageAsync(agentPageProxy, scale);\r\n                rerendered = true;\r\n            }\r\n            if (rerendered) {\r\n                this.clear();\r\n            }\r\n            if (!this._lastRenderResult) {\r\n                return;\r\n            }\r\n            parent.append(this._container);\r\n            for (const comparisonEntry of comparisonResult) {\r\n                const changedAreaGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n                changedAreaGroup.classList.add(\"comparison-area\");\r\n                changedAreaGroup.addEventListener(\"pointerdown\", this.onAreaPointerDown);\r\n                changedAreaGroup.addEventListener(\"pointerenter\", this.onAreaPointerEnter);\r\n                changedAreaGroup.addEventListener(\"pointerleave\", this.onAreaPointerLeave);\r\n                const x = comparisonEntry[0];\r\n                const y = comparisonEntry[1];\r\n                const yPdf = this._subjectPageHeight - Math.max(comparisonEntry[1], comparisonEntry[3]);\r\n                const w = Math.max(Math.abs(comparisonEntry[2] - comparisonEntry[0]), 1);\r\n                const h = Math.max(Math.abs(comparisonEntry[3] - comparisonEntry[1]), 1);\r\n                const scaledW = w * scale;\r\n                const scaledH = h * scale;\r\n                const tmpCanvas = document.createElement(\"canvas\");\r\n                tmpCanvas.width = scaledW;\r\n                tmpCanvas.height = scaledH;\r\n                tmpCanvas.getContext(\"2d\").scale(1, -1);\r\n                tmpCanvas.getContext(\"2d\").drawImage(this._lastRenderResult.canvas, x * scale, y * scale, scaledW, scaledH, 0, 0, scaledW, -scaledH);\r\n                const imageUrl = tmpCanvas.toDataURL(\"image/png\");\r\n                const image = document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\r\n                image.classList.add(\"comparison-area-image\");\r\n                image.setAttribute(\"x\", x + \"\");\r\n                image.setAttribute(\"y\", yPdf + \"\");\r\n                image.setAttribute(\"width\", w + \"\");\r\n                image.setAttribute(\"height\", h + \"\");\r\n                image.setAttribute(\"href\", imageUrl);\r\n                const area = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n                area.classList.add(\"comparison-area-rect\");\r\n                area.setAttribute(\"x\", x + \"\");\r\n                area.setAttribute(\"y\", yPdf + \"\");\r\n                area.setAttribute(\"width\", w + \"\");\r\n                area.setAttribute(\"height\", h + \"\");\r\n                changedAreaGroup.append(image);\r\n                changedAreaGroup.append(area);\r\n                this._svg.append(changedAreaGroup);\r\n            }\r\n        });\r\n    }\r\n    clear() {\r\n        this._svg.innerHTML = \"\";\r\n    }\r\n    renderPageAsync(pageProxy, scale) {\r\n        return __awaiter$l(this, void 0, void 0, function* () {\r\n            if (!pageProxy) {\r\n                return null;\r\n            }\r\n            const viewport = pageProxy.getViewport({ scale, rotation: 0 });\r\n            const { width, height } = viewport;\r\n            const canvas = document.createElement(\"canvas\");\r\n            canvas.width = width;\r\n            canvas.height = height;\r\n            const canvasCtx = canvas.getContext(\"2d\");\r\n            const params = {\r\n                canvasContext: canvasCtx,\r\n                viewport: viewport,\r\n                enableWebGL: true,\r\n            };\r\n            const renderTask = pageProxy.render(params);\r\n            yield renderTask.promise;\r\n            return {\r\n                canvas,\r\n                pageProxy,\r\n                scale,\r\n            };\r\n        });\r\n    }\r\n}\n\nvar __awaiter$k = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PageView {\r\n    constructor(modeService, docManagerService, pageIndex, previewWidth) {\r\n        this._rotation = 0;\r\n        this._scale = 1;\r\n        if (!modeService) {\r\n            throw new Error(\"Mode service is not defined\");\r\n        }\r\n        if (!docManagerService) {\r\n            throw new Error(\"Loader service is not defined\");\r\n        }\r\n        this._modeService = modeService;\r\n        this._docManagerService = docManagerService;\r\n        const pageProxy = docManagerService.getPageProxy(\"main\", pageIndex);\r\n        if (!pageProxy) {\r\n            throw new Error(\"Page proxy is not defined\");\r\n        }\r\n        this._pageProxy = pageProxy;\r\n        this._defaultViewport = pageProxy.getViewport({ scale: 1, rotation: 0 });\r\n        this._rotation = pageProxy.rotate;\r\n        this.index = pageIndex;\r\n        this.number = pageProxy.pageNumber;\r\n        this.id = pageProxy.ref[\"num\"];\r\n        this.generation = pageProxy.ref[\"gen\"];\r\n        this.initDom(previewWidth);\r\n    }\r\n    get previewContainer() {\r\n        return this._previewContainer;\r\n    }\r\n    get viewContainer() {\r\n        return this._viewOuterContainer;\r\n    }\r\n    set _viewRendered(value) {\r\n        this.$viewRendered = value;\r\n        this._viewOuterContainer.setAttribute(\"data-loaded\", value + \"\");\r\n    }\r\n    get _viewRendered() {\r\n        return this.$viewRendered;\r\n    }\r\n    get rotation() {\r\n        return this._rotation;\r\n    }\r\n    set rotation(value) {\r\n        if (!PageView.validRotationValues.includes(value)\r\n            || this._rotation === value) {\r\n            return;\r\n        }\r\n        this._rotation = value;\r\n        this.refreshDimensions();\r\n    }\r\n    get scale() {\r\n        return this._scale;\r\n    }\r\n    set scale(value) {\r\n        if (value <= 0 || this._scale === value) {\r\n            return;\r\n        }\r\n        this._scale = value;\r\n        this.refreshDimensions();\r\n    }\r\n    get width() {\r\n        return this._dimensions.width;\r\n    }\r\n    get height() {\r\n        return this._dimensions.height;\r\n    }\r\n    get modeNotChanged() {\r\n        return this._lastRenderMode === this._modeService.mode;\r\n    }\r\n    get viewValid() {\r\n        return this._dimensionsIsValid && this._viewRendered;\r\n    }\r\n    destroy() {\r\n        this._destroyed = true;\r\n        this._previewContainer.remove();\r\n        this._viewOuterContainer.remove();\r\n        this._pageProxy.cleanup();\r\n    }\r\n    renderPreviewAsync(force = false) {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (this._renderPromise) {\r\n                if (force) {\r\n                    this.cancelRenderTask();\r\n                }\r\n                yield this._renderPromise;\r\n            }\r\n            if (!force && this._previewRendered) {\r\n                return;\r\n            }\r\n            this._renderPromise = this.runPreviewRenderAsync();\r\n            return this._renderPromise;\r\n        });\r\n    }\r\n    renderViewAsync(force = false) {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (this._renderPromise) {\r\n                if (force) {\r\n                    this.cancelRenderTask();\r\n                }\r\n                yield this._renderPromise;\r\n            }\r\n            if (!force && this.viewValid && this.modeNotChanged) {\r\n                return;\r\n            }\r\n            this._renderPromise = this.runViewRenderAsync(force);\r\n            return this._renderPromise;\r\n        });\r\n    }\r\n    clearPreview() {\r\n        this._previewContainer.innerHTML = \"\";\r\n    }\r\n    clearView() {\r\n        var _a, _b, _c, _d;\r\n        (_a = this._comparison) === null || _a === void 0 ? void 0 : _a.destroy();\r\n        this._comparison = null;\r\n        (_b = this._annotations) === null || _b === void 0 ? void 0 : _b.destroy();\r\n        this._annotations = null;\r\n        (_c = this._text) === null || _c === void 0 ? void 0 : _c.destroy();\r\n        this._text = null;\r\n        (_d = this._viewCanvas) === null || _d === void 0 ? void 0 : _d.remove();\r\n        this._viewRendered = false;\r\n    }\r\n    rotateClockwise() {\r\n        if (!this._rotation) {\r\n            this.rotation = 270;\r\n        }\r\n        else {\r\n            this.rotation = this._rotation - 90;\r\n        }\r\n    }\r\n    rotateCounterClockwise() {\r\n        if (this._rotation === 270) {\r\n            this.rotation = 0;\r\n        }\r\n        else {\r\n            this.rotation = (this._rotation || 0) + 90;\r\n        }\r\n    }\r\n    initDom(previewWidth) {\r\n        const { width, height } = this._defaultViewport;\r\n        previewWidth = Math.max(previewWidth !== null && previewWidth !== void 0 ? previewWidth : 0, 50);\r\n        const previewHeight = previewWidth * (height / width);\r\n        this._dimensions = { width, height, previewWidth, previewHeight };\r\n        this._previewContainer = document.createElement(\"div\");\r\n        this._previewContainer.classList.add(\"page-preview\");\r\n        this._previewContainer.setAttribute(\"data-page-number\", this.number + \"\");\r\n        this._previewContainer.setAttribute(\"data-page-id\", this.id + \"\");\r\n        this._previewContainer.setAttribute(\"data-page-gen\", this.generation + \"\");\r\n        this._previewContainer.style.width = this._dimensions.previewWidth + \"px\";\r\n        this._previewContainer.style.height = this._dimensions.previewHeight + \"px\";\r\n        this._viewOuterContainer = document.createElement(\"div\");\r\n        this._viewOuterContainer.classList.add(\"page-container\");\r\n        this._viewOuterContainer.setAttribute(\"data-page-number\", this.number + \"\");\r\n        this._viewOuterContainer.setAttribute(\"data-page-id\", this.id + \"\");\r\n        this._viewOuterContainer.setAttribute(\"data-page-gen\", this.generation + \"\");\r\n        this._viewInnerContainer = document.createElement(\"div\");\r\n        this._viewInnerContainer.classList.add(\"page\");\r\n        this._viewInnerContainer.setAttribute(\"data-page-number\", this.number + \"\");\r\n        this._viewInnerContainer.setAttribute(\"data-page-id\", this.id + \"\");\r\n        this._viewInnerContainer.setAttribute(\"data-page-gen\", this.generation + \"\");\r\n        this._viewOuterContainer.append(this._viewInnerContainer);\r\n        this.refreshDimensions();\r\n    }\r\n    refreshDimensions() {\r\n        const dpr = window.devicePixelRatio;\r\n        this._currentViewport = this._defaultViewport.clone({\r\n            scale: this.scale * dpr,\r\n        });\r\n        this._dimensions.scaledWidth = this._dimensions.width * this._scale;\r\n        this._dimensions.scaledHeight = this._dimensions.height * this._scale;\r\n        this._dimensions.scaledDprWidth = this._dimensions.scaledWidth * dpr;\r\n        this._dimensions.scaledDprHeight = this._dimensions.scaledHeight * dpr;\r\n        const w = this._dimensions.scaledWidth + \"px\";\r\n        const h = this._dimensions.scaledHeight + \"px\";\r\n        if (this._viewCanvas) {\r\n            this._viewCanvas.style.width = w;\r\n            this._viewCanvas.style.height = h;\r\n        }\r\n        this._viewInnerContainer.style.width = w;\r\n        this._viewInnerContainer.style.height = h;\r\n        switch (this.rotation) {\r\n            case 0:\r\n                this._viewOuterContainer.style.width = w;\r\n                this._viewOuterContainer.style.height = h;\r\n                this._viewInnerContainer.style.transform = \"\";\r\n                break;\r\n            case 90:\r\n                this._viewOuterContainer.style.width = h;\r\n                this._viewOuterContainer.style.height = w;\r\n                this._viewInnerContainer.style.transform = \"rotate(90deg) translateY(-100%)\";\r\n                break;\r\n            case 180:\r\n                this._viewOuterContainer.style.width = w;\r\n                this._viewOuterContainer.style.height = h;\r\n                this._viewInnerContainer.style.transform = \"rotate(180deg) translateX(-100%) translateY(-100%)\";\r\n                break;\r\n            case 270:\r\n                this._viewOuterContainer.style.width = h;\r\n                this._viewOuterContainer.style.height = w;\r\n                this._viewInnerContainer.style.transform = \"rotate(270deg) translateX(-100%)\";\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid rotation degree: ${this.rotation}`);\r\n        }\r\n        this._dimensionsIsValid = false;\r\n    }\r\n    cancelRenderTask() {\r\n        if (this._renderTask) {\r\n            this._renderTask.cancel();\r\n            this._renderTask = null;\r\n        }\r\n    }\r\n    runRenderTaskAsync(renderParams) {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (this._destroyed) {\r\n                return false;\r\n            }\r\n            this.cancelRenderTask();\r\n            try {\r\n                this._renderTask = this._pageProxy.render(renderParams);\r\n                yield this._renderTask.promise;\r\n            }\r\n            catch (error) {\r\n                if (error instanceof pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__.RenderingCancelledException) {\r\n                    return false;\r\n                }\r\n                else {\r\n                    console.log(error.message);\r\n                }\r\n            }\r\n            finally {\r\n                this._renderTask = null;\r\n            }\r\n            return true;\r\n        });\r\n    }\r\n    createPreviewCanvas() {\r\n        const canvas = document.createElement(\"canvas\");\r\n        canvas.classList.add(\"page-canvas\");\r\n        const dpr = window.devicePixelRatio;\r\n        const { previewWidth: width, previewHeight: height } = this._dimensions;\r\n        canvas.style.width = width + \"px\";\r\n        canvas.style.height = height + \"px\";\r\n        canvas.width = width * dpr;\r\n        canvas.height = height * dpr;\r\n        return canvas;\r\n    }\r\n    createViewCanvas() {\r\n        const canvas = document.createElement(\"canvas\");\r\n        canvas.classList.add(\"page-canvas\");\r\n        canvas.style.width = this._dimensions.scaledWidth + \"px\";\r\n        canvas.style.height = this._dimensions.scaledHeight + \"px\";\r\n        canvas.width = this._dimensions.scaledDprWidth;\r\n        canvas.height = this._dimensions.scaledDprHeight;\r\n        return canvas;\r\n    }\r\n    runPreviewRenderAsync() {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (this._destroyed) {\r\n                return;\r\n            }\r\n            const canvas = this.createPreviewCanvas();\r\n            const params = {\r\n                canvasContext: canvas.getContext(\"2d\"),\r\n                viewport: this._defaultViewport.clone({ scale: canvas.width / this._dimensions.width, rotation: 0 }),\r\n            };\r\n            const result = yield this.runRenderTaskAsync(params);\r\n            if (!result) {\r\n                this._previewRendered = false;\r\n                return;\r\n            }\r\n            this._previewContainer.innerHTML = \"\";\r\n            this._previewContainer.append(canvas);\r\n            this._previewRendered = true;\r\n        });\r\n    }\r\n    runViewRenderAsync(force) {\r\n        var _a;\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (this._destroyed) {\r\n                return;\r\n            }\r\n            const mode = this._modeService.mode;\r\n            const scale = this._scale;\r\n            this.clearTextLayer();\r\n            if (force || !this.viewValid) {\r\n                const canvasRendered = yield this.renderCanvasLayerAsync(scale);\r\n                if (!canvasRendered) {\r\n                    return;\r\n                }\r\n            }\r\n            if (mode === \"text\"\r\n                || mode === \"annotation\") {\r\n                yield this.renderTextLayerAsync(scale);\r\n            }\r\n            if (mode !== \"comparison\") {\r\n                yield this.renderAnnotationLayerAsync();\r\n            }\r\n            else {\r\n                (_a = this._annotations) === null || _a === void 0 ? void 0 : _a.remove();\r\n                yield this.renderComparisonLayerAsync();\r\n            }\r\n            this._lastRenderMode = mode;\r\n            if (scale === this._scale) {\r\n                this._dimensionsIsValid = true;\r\n            }\r\n        });\r\n    }\r\n    clearTextLayer() {\r\n        var _a, _b;\r\n        (_a = this._text) === null || _a === void 0 ? void 0 : _a.destroy();\r\n        (_b = this._text) === null || _b === void 0 ? void 0 : _b.remove();\r\n    }\r\n    renderCanvasLayerAsync(scale) {\r\n        var _a;\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            const canvas = this.createViewCanvas();\r\n            const params = {\r\n                canvasContext: canvas.getContext(\"2d\"),\r\n                viewport: this._currentViewport,\r\n                enableWebGL: true,\r\n            };\r\n            const result = yield this.runRenderTaskAsync(params);\r\n            if (!result || scale !== this._scale) {\r\n                return false;\r\n            }\r\n            (_a = this._viewCanvas) === null || _a === void 0 ? void 0 : _a.remove();\r\n            this._viewInnerContainer.append(canvas);\r\n            this._viewCanvas = canvas;\r\n            this._viewRendered = true;\r\n            return true;\r\n        });\r\n    }\r\n    renderTextLayerAsync(scale) {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            this._text = yield PageTextView.appendPageTextAsync(this._pageProxy, this._viewInnerContainer, scale);\r\n        });\r\n    }\r\n    renderAnnotationLayerAsync() {\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            if (!this._annotations) {\r\n                const { width: x, height: y } = this._dimensions;\r\n                this._annotations = new PageAnnotationView(this._docManagerService.docService, this, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x, y));\r\n            }\r\n            yield this._annotations.appendAsync(this._viewInnerContainer);\r\n        });\r\n    }\r\n    renderComparisonLayerAsync() {\r\n        var _a;\r\n        return __awaiter$k(this, void 0, void 0, function* () {\r\n            const comparisonPageProxy = this._docManagerService.getPageProxy(\"compared\", this.index);\r\n            if (!comparisonPageProxy) {\r\n                (_a = this._comparison) === null || _a === void 0 ? void 0 : _a.remove();\r\n                return;\r\n            }\r\n            if (!this._comparison) {\r\n                const { width: x, height: y } = this._dimensions;\r\n                this._comparison = new PageComparisonView(this._docManagerService.comparisonService, this, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x, y));\r\n            }\r\n            yield this._comparison.appendAsync(this._viewInnerContainer, comparisonPageProxy, this._scale);\r\n        });\r\n    }\r\n}\r\nPageView.validRotationValues = [0, 90, 180, 270];\n\nvar __awaiter$j = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst currentPageChangeRequestEvent = \"tspdf-currentpagechangerequest\";\r\nclass CurrentPageChangeRequestEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(currentPageChangeRequestEvent, { detail });\r\n    }\r\n}\r\nconst currentPageChangeEvent = \"tspdf-currentpagechange\";\r\nclass CurrentPageChangeEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(currentPageChangeEvent, { detail });\r\n    }\r\n}\r\nconst pagesLoadedEvent = \"tspdf-pagesloaded\";\r\nclass PagesLoadedEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(pagesLoadedEvent, { detail });\r\n    }\r\n}\r\nconst pagesRenderedEvent = \"tspdf-pagesrendered\";\r\nclass PagesRenderedEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(pagesRenderedEvent, { detail });\r\n    }\r\n}\r\nconst scaleChangedEvent = \"tspdf-scalechanged\";\r\nclass ScaleChangedEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(scaleChangedEvent, { detail });\r\n    }\r\n}\r\nclass PageService {\r\n    constructor(eventService, modeService, docManagerService, options) {\r\n        this._pages = [];\r\n        this._renderedPages = [];\r\n        if (!eventService) {\r\n            throw new Error(\"Event service is not defined\");\r\n        }\r\n        if (!modeService) {\r\n            throw new Error(\"Mode service is not defined\");\r\n        }\r\n        if (!docManagerService) {\r\n            throw new Error(\"Doc manager service is not defined\");\r\n        }\r\n        this._modeService = modeService;\r\n        this._eventService = eventService;\r\n        this._docManagerService = docManagerService;\r\n        this._previewCanvasWidth = (options === null || options === void 0 ? void 0 : options.previewCanvasWidth) || 100;\r\n        this._visibleAdjPages = (options === null || options === void 0 ? void 0 : options.visibleAdjPages) || 0;\r\n    }\r\n    get eventService() {\r\n        return this._eventService;\r\n    }\r\n    get currentPageIndex() {\r\n        return this._currentPageIndex || 0;\r\n    }\r\n    get pages() {\r\n        return this._pages.slice();\r\n    }\r\n    set pages(value) {\r\n        this._pages.forEach(x => x.destroy());\r\n        this._pages = value.slice();\r\n        this._eventService.dispatchEvent(new PagesLoadedEvent({ pages: value.slice() }));\r\n        this.setCurrentPageIndex(0);\r\n    }\r\n    get renderedPages() {\r\n        return this._renderedPages.slice();\r\n    }\r\n    get length() {\r\n        return this._pages.length || 0;\r\n    }\r\n    get scale() {\r\n        var _a;\r\n        return ((_a = this._renderedPages[0]) === null || _a === void 0 ? void 0 : _a.scale) || 1;\r\n    }\r\n    set scale(value) {\r\n        if (!value || isNaN(value)) {\r\n            value = 1;\r\n        }\r\n        this._pages.forEach(x => x.scale = value);\r\n        this._eventService.dispatchEvent(new ScaleChangedEvent({ scale: value }));\r\n    }\r\n    destroy() {\r\n        this._pages.forEach(x => x.destroy);\r\n    }\r\n    getPage(index) {\r\n        return this._pages[index];\r\n    }\r\n    getCurrentPage() {\r\n        return this._pages[this._currentPageIndex];\r\n    }\r\n    reloadPagesAsync() {\r\n        return __awaiter$j(this, void 0, void 0, function* () {\r\n            const docPagesNumber = this._docManagerService.pageCount;\r\n            const pages = [];\r\n            if (docPagesNumber) {\r\n                for (let i = 0; i < docPagesNumber; i++) {\r\n                    const page = new PageView(this._modeService, this._docManagerService, i, this._previewCanvasWidth);\r\n                    pages.push(page);\r\n                }\r\n            }\r\n            this.pages = pages;\r\n        });\r\n    }\r\n    requestSetCurrentPageIndex(index) {\r\n        index = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)(index || 0, 0, this._pages.length - 1);\r\n        if (index !== this._currentPageIndex) {\r\n            this._eventService.dispatchEvent(new CurrentPageChangeRequestEvent({ pageIndex: index }));\r\n        }\r\n    }\r\n    renderVisiblePages(container, force) {\r\n        const pages = this._pages;\r\n        const { minFinal: minPageNumber, maxFinal: maxPageNumber } = this.getVisiblePageIndices(container);\r\n        const renderedPages = [];\r\n        for (let i = 0; i < pages.length; i++) {\r\n            const page = pages[i];\r\n            if (i >= minPageNumber && i <= maxPageNumber) {\r\n                renderedPages.push(page);\r\n                page.renderViewAsync(force);\r\n            }\r\n            else {\r\n                page.clearView();\r\n            }\r\n        }\r\n        this._renderedPages = renderedPages;\r\n        this._eventService.dispatchEvent(new PagesRenderedEvent({ pages: renderedPages.slice() }));\r\n        this.updateCurrentPage(container);\r\n    }\r\n    renderVisiblePreviews(container) {\r\n        const pages = this._pages;\r\n        const visible = this.getVisiblePageIndices(container, true);\r\n        for (let i = 0; i < pages.length; i++) {\r\n            const page = pages[i];\r\n            if (i >= visible.minFinal && i <= visible.maxFinal) {\r\n                page.renderPreviewAsync();\r\n            }\r\n        }\r\n    }\r\n    renderSpecifiedPages(pageIdSet) {\r\n        if (!(pageIdSet === null || pageIdSet === void 0 ? void 0 : pageIdSet.size)) {\r\n            return;\r\n        }\r\n        this._renderedPages.forEach(x => {\r\n            if (pageIdSet.has(x.id)) {\r\n                x.renderViewAsync(true);\r\n            }\r\n        });\r\n    }\r\n    getPageCoordsUnderPointer(pointerX, pointerY) {\r\n        for (const page of this._renderedPages) {\r\n            const { left: pageRectMinX, top: pageRectMinY, width: pageRectWidth, height: pageRectHeight } = page.viewContainer.getBoundingClientRect();\r\n            const pageRectMaxX = pageRectMinX + pageRectWidth;\r\n            const pageRectMaxY = pageRectMinY + pageRectHeight;\r\n            if (pointerX < pageRectMinX || pointerX > pageRectMaxX) {\r\n                continue;\r\n            }\r\n            if (pointerY < pageRectMinY || pointerY > pageRectMaxY) {\r\n                continue;\r\n            }\r\n            let x;\r\n            let y;\r\n            const scale = this.scale;\r\n            const rotation = page.rotation;\r\n            switch (rotation) {\r\n                case 0:\r\n                    x = (pointerX - pageRectMinX) / scale;\r\n                    y = (pageRectMaxY - pointerY) / scale;\r\n                    break;\r\n                case 90:\r\n                    x = (pointerY - pageRectMinY) / scale;\r\n                    y = (pointerX - pageRectMinX) / scale;\r\n                    break;\r\n                case 180:\r\n                    x = (pageRectMaxX - pointerX) / scale;\r\n                    y = (pointerY - pageRectMinY) / scale;\r\n                    break;\r\n                case 270:\r\n                    x = (pageRectMaxY - pointerY) / scale;\r\n                    y = (pageRectMaxX - pointerX) / scale;\r\n                    break;\r\n                default:\r\n                    throw new Error(`Invalid rotation degree: ${rotation}`);\r\n            }\r\n            return {\r\n                pageId: page.id,\r\n                pageX: x,\r\n                pageY: y,\r\n                pageRotation: rotation,\r\n            };\r\n        }\r\n        return null;\r\n    }\r\n    setCurrentPageIndex(index) {\r\n        var _a, _b;\r\n        const newIndex = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)(index || 0, 0, this._pages.length - 1);\r\n        if (newIndex !== this._currentPageIndex) {\r\n            const oldIndex = this._currentPageIndex;\r\n            this._currentPageIndex = newIndex;\r\n            (_a = this._pages[oldIndex]) === null || _a === void 0 ? void 0 : _a.previewContainer.classList.remove(\"current\");\r\n            (_b = this._pages[newIndex]) === null || _b === void 0 ? void 0 : _b.previewContainer.classList.add(\"current\");\r\n            this._eventService.dispatchEvent(new CurrentPageChangeEvent({ oldIndex, newIndex }));\r\n        }\r\n    }\r\n    getVisiblePageIndices(container, preview = false) {\r\n        const pages = this._pages;\r\n        if (!pages.length) {\r\n            return {\r\n                actual: [],\r\n                minFinal: null,\r\n                maxFinal: null,\r\n            };\r\n        }\r\n        const indices = new Set();\r\n        const cRect = container.getBoundingClientRect();\r\n        const cTop = cRect.top;\r\n        const cBottom = cRect.top + cRect.height;\r\n        for (let i = 0; i < pages.length; i++) {\r\n            const page = pages[i];\r\n            const pRect = preview\r\n                ? page.previewContainer.getBoundingClientRect()\r\n                : page.viewContainer.getBoundingClientRect();\r\n            const pTop = pRect.top;\r\n            const pBottom = pRect.top + pRect.height;\r\n            if (pTop < cBottom && pBottom > cTop) {\r\n                indices.add(i);\r\n            }\r\n            else if (indices.size) {\r\n                break;\r\n            }\r\n        }\r\n        const indicesArray = [...indices];\r\n        return {\r\n            actual: indicesArray,\r\n            minFinal: Math.max(Math.min(...indicesArray) - this._visibleAdjPages, 0),\r\n            maxFinal: Math.min(Math.max(...indicesArray) + this._visibleAdjPages, pages.length - 1),\r\n        };\r\n    }\r\n    updateCurrentPage(container) {\r\n        const pages = this._pages;\r\n        const visible = this.getVisiblePageIndices(container);\r\n        const { actual: indices } = visible;\r\n        if (!indices.length) {\r\n            this.setCurrentPageIndex(0);\r\n            return;\r\n        }\r\n        else if (indices.length === 1) {\r\n            this.setCurrentPageIndex(indices[0]);\r\n            return;\r\n        }\r\n        const cRect = container.getBoundingClientRect();\r\n        const cTop = cRect.top;\r\n        const cMiddle = cRect.top + cRect.height / 2;\r\n        for (const i of indices) {\r\n            const pRect = pages[i].viewContainer.getBoundingClientRect();\r\n            const pTop = pRect.top;\r\n            if (pTop > cTop) {\r\n                if (pTop > cMiddle) {\r\n                    this.setCurrentPageIndex(i - 1);\r\n                    return;\r\n                }\r\n                else {\r\n                    this.setCurrentPageIndex(i);\r\n                    return;\r\n                }\r\n            }\r\n        }\r\n        throw new Error(\"Incorrect argument\");\r\n    }\r\n}\n\nconst annotatorTypes = [\"geom\", \"pen\", \"stamp\", \"text\"];\r\nconst annotatorDataChangeEvent = \"tspdf-annotatordatachange\";\r\nclass AnnotatorDataChangeEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(annotatorDataChangeEvent, { detail });\r\n    }\r\n}\r\nconst textSelectionChangeEvent = \"tspdf-textselectionchange\";\r\nclass TextSelectionChangeEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(textSelectionChangeEvent, { detail });\r\n    }\r\n}\r\nclass Annotator {\r\n    constructor(docService, pageService, parent) {\r\n        this.onPagesRendered = (event) => {\r\n            this.refreshViewBox();\r\n        };\r\n        this.onParentScroll = () => {\r\n            this.refreshViewBox();\r\n        };\r\n        this.onOverlayPointerDown = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            this._lastPointerDownInfo = {\r\n                timestamp: performance.now(),\r\n                clientX: e.clientX,\r\n                clientY: e.clientY,\r\n            };\r\n        };\r\n        if (!docService) {\r\n            throw new Error(\"Document service not defined\");\r\n        }\r\n        if (!pageService) {\r\n            throw new Error(\"Page service not defined\");\r\n        }\r\n        if (!parent) {\r\n            throw new Error(\"Parent container not defined\");\r\n        }\r\n        this._docService = docService;\r\n        this._parent = parent;\r\n        this._pageService = pageService;\r\n    }\r\n    get overlayContainer() {\r\n        return this._overlayContainer;\r\n    }\r\n    destroy() {\r\n        var _a, _b, _c;\r\n        this._docService.eventService.removeListener(pagesRenderedEvent, this.onPagesRendered);\r\n        (_a = this._parent) === null || _a === void 0 ? void 0 : _a.removeEventListener(\"scroll\", this.onParentScroll);\r\n        (_b = this._parentMutationObserver) === null || _b === void 0 ? void 0 : _b.disconnect();\r\n        (_c = this._parentResizeObserver) === null || _c === void 0 ? void 0 : _c.disconnect();\r\n        this._overlayContainer.remove();\r\n    }\r\n    refreshViewBox() {\r\n        const { width: w, height: h } = this._overlay.getBoundingClientRect();\r\n        if (!w || !h) {\r\n            return;\r\n        }\r\n        this._overlay.style.left = this._parent.scrollLeft + \"px\";\r\n        this._overlay.style.top = this._parent.scrollTop + \"px\";\r\n        const viewBoxWidth = w / this._pageService.scale;\r\n        const viewBoxHeight = h / this._pageService.scale;\r\n        this._svgWrapper.setAttribute(\"viewBox\", `0 0 ${viewBoxWidth} ${viewBoxHeight}`);\r\n        this.refreshGroupPosition();\r\n    }\r\n    init() {\r\n        const annotationOverlayContainer = document.createElement(\"div\");\r\n        annotationOverlayContainer.id = \"annotation-overlay-container\";\r\n        const annotationOverlay = document.createElement(\"div\");\r\n        annotationOverlay.id = \"annotation-overlay\";\r\n        const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n        svg.classList.add(\"abs-stretch\", \"no-margin\", \"no-padding\");\r\n        svg.setAttribute(\"transform\", \"matrix(1 0 0 -1 0 0)\");\r\n        svg.setAttribute(\"opacity\", \"0.5\");\r\n        const g = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n        svg.append(g);\r\n        annotationOverlay.append(svg);\r\n        annotationOverlayContainer.append(annotationOverlay);\r\n        this._overlayContainer = annotationOverlayContainer;\r\n        this._overlay = annotationOverlay;\r\n        this._svgWrapper = svg;\r\n        this._svgGroup = g;\r\n        this._parent.append(this._overlayContainer);\r\n        this.refreshViewBox();\r\n        this.initEventHandlers();\r\n    }\r\n    initEventHandlers() {\r\n        this._overlay.addEventListener(\"pointerdown\", this.onOverlayPointerDown);\r\n        this._parent.addEventListener(\"scroll\", this.onParentScroll);\r\n        const parentRObserver = new ResizeObserver((entries) => {\r\n            this.refreshViewBox();\r\n        });\r\n        const parentMObserver = new MutationObserver((mutations) => {\r\n            const record = mutations[0];\r\n            if (!record) {\r\n                return;\r\n            }\r\n            record.addedNodes.forEach(x => {\r\n                const element = x;\r\n                if (element.classList.contains(\"page\")) {\r\n                    parentRObserver.observe(x);\r\n                }\r\n            });\r\n            record.removedNodes.forEach(x => parentRObserver.unobserve(x));\r\n            this.refreshViewBox();\r\n        });\r\n        parentRObserver.observe(this._parent);\r\n        parentMObserver.observe(this._parent, {\r\n            attributes: false,\r\n            childList: true,\r\n            subtree: false,\r\n        });\r\n        this._parentMutationObserver = parentMObserver;\r\n        this._parentResizeObserver = parentRObserver;\r\n        this._docService.eventService.addListener(pagesRenderedEvent, this.onPagesRendered);\r\n    }\r\n    updatePointerCoords(clientX, clientY) {\r\n        const pageCoords = this._pageService.getPageCoordsUnderPointer(clientX, clientY);\r\n        if (!pageCoords) {\r\n            this._svgGroup.classList.add(\"annotation-out-of-page\");\r\n        }\r\n        else {\r\n            this._svgGroup.classList.remove(\"annotation-out-of-page\");\r\n        }\r\n        this._pointerCoordsInPageCS = pageCoords;\r\n    }\r\n}\n\nclass GeometricAnnotator extends Annotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent);\r\n        this._color = (options === null || options === void 0 ? void 0 : options.color) || [0, 0, 0, 1];\r\n        this._strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || 3;\r\n        this._cloudMode = (options === null || options === void 0 ? void 0 : options.cloudMode) || false;\r\n    }\r\n    destroy() {\r\n        this.clearGroup();\r\n        super.destroy();\r\n    }\r\n    init() {\r\n        super.init();\r\n    }\r\n    emitDataChanged(count, saveable, clearable, undoable) {\r\n        this._docService.eventService.dispatchEvent(new AnnotatorDataChangeEvent({\r\n            annotatorType: \"geom\",\r\n            elementCount: count,\r\n            undoable,\r\n            clearable,\r\n            saveable,\r\n        }));\r\n    }\r\n    clearGroup() {\r\n        this._svgGroup.innerHTML = \"\";\r\n        this.emitDataChanged(0);\r\n    }\r\n    refreshGroupPosition() {\r\n        if (!this._pageId && this._pageId !== 0) {\r\n            return;\r\n        }\r\n        const page = this._pageService.renderedPages.find(x => x.id === this._pageId);\r\n        if (!page) {\r\n            this._svgGroup.setAttribute(\"transform\", \"scale(0)\");\r\n            return;\r\n        }\r\n        const { height: pageHeight, width: pageWidth, top: pageTop, left: pageLeft } = page.viewContainer.getBoundingClientRect();\r\n        const pageBottom = pageTop + pageHeight;\r\n        const pageRight = pageLeft + pageWidth;\r\n        const { height: overlayHeight, top: overlayTop, left: overlayLeft } = this._overlay.getBoundingClientRect();\r\n        const overlayBottom = overlayTop + overlayHeight;\r\n        const rotation = page.rotation;\r\n        const scale = page.scale;\r\n        let offsetX;\r\n        let offsetY;\r\n        switch (rotation) {\r\n            case 0:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            case 90:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 180:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 270:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid rotation degree: ${rotation}`);\r\n        }\r\n        this._svgGroup.setAttribute(\"transform\", `translate(${offsetX} ${offsetY}) rotate(${-rotation})`);\r\n    }\r\n    buildLineEndingPath(point, type, strokeWidth, side) {\r\n        const size = Math.max(strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n        let text = \"\";\r\n        switch (type) {\r\n            case lineEndingTypes.ARROW_OPEN:\r\n                if (side === \"left\") {\r\n                    text += `M${point.x + size},${point.y + size / 2}`;\r\n                    text += ` L${point.x},${point.y}`;\r\n                    text += ` L${point.x + size},${point.y - size / 2}`;\r\n                }\r\n                else {\r\n                    text += `M${point.x - size},${point.y + size / 2}`;\r\n                    text += ` L${point.x},${point.y}`;\r\n                    text += ` L${point.x - size},${point.y - size / 2}`;\r\n                }\r\n                return text;\r\n            case lineEndingTypes.ARROW_OPEN_R:\r\n                if (side === \"left\") {\r\n                    text += `M${point.x},${point.y + size / 2}`;\r\n                    text += ` L${point.x + size},${point.y}`;\r\n                    text += ` L${point.x},${point.y - size / 2}`;\r\n                }\r\n                else {\r\n                    text += `M${point.x},${point.y + size / 2}`;\r\n                    text += ` L${point.x - size},${point.y}`;\r\n                    text += ` L${point.x},${point.y - size / 2}`;\r\n                }\r\n                return text;\r\n            case lineEndingTypes.ARROW_CLOSED:\r\n                if (side === \"left\") {\r\n                    text += `M${point.x + size},${point.y + size / 2}`;\r\n                    text += ` L${point.x},${point.y}`;\r\n                    text += ` L${point.x + size},${point.y - size / 2}`;\r\n                }\r\n                else {\r\n                    text += `M${point.x - size},${point.y + size / 2}`;\r\n                    text += ` L${point.x},${point.y}`;\r\n                    text += ` L${point.x - size},${point.y - size / 2}`;\r\n                }\r\n                text += \" Z\";\r\n                return text;\r\n            case lineEndingTypes.ARROW_CLOSED_R:\r\n                if (side === \"left\") {\r\n                    text += `M${point.x + size},${point.y}`;\r\n                    text += ` L${point.x},${point.y + size / 2}`;\r\n                    text += ` L${point.x},${point.y - size / 2}`;\r\n                }\r\n                else {\r\n                    text += `M${point.x - size},${point.y}`;\r\n                    text += ` L${point.x},${point.y - size / 2}`;\r\n                    text += ` L${point.x},${point.y + size / 2}`;\r\n                }\r\n                text += \" Z\";\r\n                return text;\r\n            case lineEndingTypes.BUTT:\r\n                text += `M${point.x},${point.y + size / 2}`;\r\n                text += ` L${point.x},${point.y - size / 2}`;\r\n                return text;\r\n            case lineEndingTypes.SLASH:\r\n                text += `M${point.x + size / 2},${point.y + size / 2}`;\r\n                text += ` L${point.x - size / 2},${point.y - size / 2}`;\r\n                return text;\r\n            case lineEndingTypes.DIAMOND:\r\n                text += `M${point.x},${point.y + size / 2}`;\r\n                text += ` L${point.x + size / 2},${point.y}`;\r\n                text += ` L${point.x},${point.y - size / 2}`;\r\n                text += ` L${point.x - size / 2},${point.y}`;\r\n                text += \" Z\";\r\n                return text;\r\n            case lineEndingTypes.SQUARE:\r\n                text += `M${point.x - size / 2},${point.y + size / 2}`;\r\n                text += ` L${point.x + size / 2},${point.y + size / 2}`;\r\n                text += ` L${point.x + size / 2},${point.y - size / 2}`;\r\n                text += ` L${point.x - size / 2},${point.y - size / 2}`;\r\n                text += \" Z\";\r\n                return text;\r\n            case lineEndingTypes.CIRCLE:\r\n                const c = BEZIER_CONSTANT;\r\n                const r = size / 2;\r\n                const cw = c * r;\r\n                const xmin = point.x - r;\r\n                const ymin = point.y - r;\r\n                const xmax = point.x + r;\r\n                const ymax = point.y + r;\r\n                text += `M${point.x},${ymax}`;\r\n                text += ` C${point.x + cw},${ymax} ${xmax},${point.y + cw} ${xmax},${point.y}`;\r\n                text += ` C${xmax},${point.y - cw} ${point.x + cw},${ymin} ${point.x},${ymin}`;\r\n                text += ` C${point.x - cw},${ymin} ${xmin},${point.y - cw} ${xmin},${point.y}`;\r\n                text += ` C${xmin},${point.y + cw} ${point.x - cw},${ymax} ${point.x},${ymax}`;\r\n                text += \" Z\";\r\n                return text;\r\n            case lineEndingTypes.NONE:\r\n            default:\r\n                return \"\";\r\n        }\r\n    }\r\n}\n\nvar __awaiter$i = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricLineAnnotator extends GeometricAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this._down = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.clear();\r\n            this.refreshGroupPosition();\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary\r\n                || !this._down) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.redrawLine(this._down, end);\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            if (this._vertices) {\r\n                this.emitDataChanged(2, true, true);\r\n            }\r\n        };\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._vertices = null;\r\n        this.clearGroup();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$i(this, void 0, void 0, function* () {\r\n            if (!this._vertices) {\r\n                return;\r\n            }\r\n            const pageId = this._pageId;\r\n            const dto = this.buildAnnotationDto();\r\n            const annotation = yield LineAnnotation.createFromDtoAsync(dto, this._docService.fontMap);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    redrawLine(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._vertices = [min.x, min.y, max.x, max.y];\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        path.setAttribute(\"stroke-linecap\", \"square\");\r\n        const pathString = `M ${min.x},${min.y} L ${max.x},${max.y}`;\r\n        path.setAttribute(\"d\", pathString);\r\n        this._svgGroup.append(path);\r\n    }\r\n    buildAnnotationDto() {\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Line\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: null,\r\n            vertices: this._vertices,\r\n            intent: lineIntents.DIMENSION,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nclass GeometricArrowAnnotator extends GeometricLineAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n    }\r\n    redrawLine(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._vertices = [min.x, min.y, max.x, max.y];\r\n        const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(min.x, min.y);\r\n        const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(max.x, max.y);\r\n        const xAlignedStart = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n        const xAlignedEnd = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(end, start).getMagnitude(), 0);\r\n        const mat = mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3.from4Vec2(xAlignedStart, xAlignedEnd, start, end);\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        path.setAttribute(\"stroke-linecap\", \"square\");\r\n        let pathString = `M ${xAlignedStart.x},${xAlignedStart.y} L ${xAlignedEnd.x},${xAlignedEnd.y}`;\r\n        const arrowSize = Math.max(this._strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n        pathString += ` M ${xAlignedEnd.x - arrowSize},${xAlignedEnd.y + arrowSize / 2}`;\r\n        pathString += ` L ${xAlignedEnd.x},${xAlignedEnd.y}`;\r\n        pathString += ` L ${xAlignedEnd.x - arrowSize},${xAlignedEnd.y - arrowSize / 2}`;\r\n        path.setAttribute(\"d\", pathString);\r\n        path.setAttribute(\"transform\", `matrix(${mat.toFloatShortArray().join(\" \")})`);\r\n        this._svgGroup.append(path);\r\n    }\r\n    buildAnnotationDto() {\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Line\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: null,\r\n            vertices: this._vertices,\r\n            intent: lineIntents.ARROW,\r\n            endingType: [lineEndingTypes.NONE, lineEndingTypes.ARROW_OPEN],\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$h = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricCircleAnnotator extends GeometricAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this._down = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.clear();\r\n            this.refreshGroupPosition();\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary\r\n                || !this._down) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(this._down, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            this.redrawCircle(min, max);\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            if (this._rect) {\r\n                this.emitDataChanged(2, true, true);\r\n            }\r\n        };\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._rect = null;\r\n        this.clearGroup();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$h(this, void 0, void 0, function* () {\r\n            if (!this._rect) {\r\n                return;\r\n            }\r\n            const pageId = this._pageId;\r\n            const dto = this.buildAnnotationDto();\r\n            const annotation = CircleAnnotation.createFromDto(dto);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    redrawCircle(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const minSize = this._strokeWidth * 2;\r\n        if (max.x - min.x <= minSize || max.y - min.y <= minSize) {\r\n            this._rect = null;\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._rect = [min.x, min.y, max.x, max.y];\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        path.setAttribute(\"stroke-linecap\", \"round\");\r\n        path.setAttribute(\"stroke-linejoin\", \"round\");\r\n        let pathString;\r\n        const rx = (max.x - min.x) / 2;\r\n        const ry = (max.y - min.y) / 2;\r\n        const center = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(min.x + rx, min.y + ry);\r\n        if (this._cloudMode) {\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromEllipse(rx, ry, CircleAnnotation.cloudArcSize, new mathador__WEBPACK_IMPORTED_MODULE_1__.Mat3().applyTranslation(center.x, center.y));\r\n            pathString = \"M\" + curveData.start.x + \",\" + curveData.start.y;\r\n            curveData.curves.forEach(x => {\r\n                pathString += ` C${x[0].x},${x[0].y} ${x[1].x},${x[1].y} ${x[2].x},${x[2].y}`;\r\n            });\r\n        }\r\n        else {\r\n            const c = BEZIER_CONSTANT;\r\n            const cw = c * rx;\r\n            const ch = c * ry;\r\n            pathString = \"M\" + center.x + \",\" + max.y;\r\n            pathString += ` C${center.x + cw},${max.y} ${max.x},${center.y + ch} ${max.x},${center.y}`;\r\n            pathString += ` C${max.x},${center.y - ch} ${center.x + cw},${min.y} ${center.x},${min.y}`;\r\n            pathString += ` C${center.x - cw},${min.y} ${min.x},${center.y - ch} ${min.x},${center.y}`;\r\n            pathString += ` C${min.x},${center.y + ch} ${center.x - cw},${max.y} ${center.x},${max.y}`;\r\n        }\r\n        path.setAttribute(\"d\", pathString);\r\n        this._svgGroup.append(path);\r\n    }\r\n    buildAnnotationDto() {\r\n        const margin = this._strokeWidth / 2 + (this._cloudMode ? CircleAnnotation.cloudArcSize / 2 : 0);\r\n        const lm = margin;\r\n        const tm = margin;\r\n        const rm = margin;\r\n        const bm = margin;\r\n        const rectMargins = [lm, tm, rm, bm];\r\n        const [xmin, ymin, xmax, ymax] = this._rect;\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Circle\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: [xmin - lm, ymin - bm, xmax + rm, ymax + tm],\r\n            rectMargins,\r\n            cloud: this._cloudMode,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$g = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricPolygonAnnotator extends GeometricAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this._points = [];\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this.refreshGroupPosition();\r\n            if (!this._points.length) {\r\n                this._points.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            }\r\n            this._points.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            this._points[this._points.length - 1].set(px, py);\r\n            this.redraw();\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.emitPointsDataChanged();\r\n        };\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        if (this._points.length) {\r\n            this._points.pop();\r\n            this.redraw();\r\n            this.emitPointsDataChanged();\r\n        }\r\n    }\r\n    clear() {\r\n        var _a;\r\n        if ((_a = this._points) === null || _a === void 0 ? void 0 : _a.length) {\r\n            this._points.length = 0;\r\n            this.clearGroup();\r\n        }\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$g(this, void 0, void 0, function* () {\r\n            if (this._points.length < 3) {\r\n                return;\r\n            }\r\n            const pageId = this._pageId;\r\n            const dto = this.buildAnnotationDto();\r\n            const annotation = PolygonAnnotation.createFromDto(dto);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    emitPointsDataChanged() {\r\n        const count = this._points.length;\r\n        this.emitDataChanged(count, count > 1, count > 0, count > 2);\r\n    }\r\n    redraw() {\r\n        this._svgGroup.innerHTML = \"\";\r\n        if (this._points.length < 2) {\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        let pathString;\r\n        if (this._cloudMode) {\r\n            path.setAttribute(\"stroke-linecap\", \"round\");\r\n            path.setAttribute(\"stroke-linejoin\", \"round\");\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromPolyline([...this._points, this._points[0]], PolygonAnnotation.cloudArcSize);\r\n            pathString = \"M\" + curveData.start.x + \",\" + curveData.start.y;\r\n            curveData.curves.forEach(x => {\r\n                pathString += ` C${x[0].x},${x[0].y} ${x[1].x},${x[1].y} ${x[2].x},${x[2].y}`;\r\n            });\r\n            path.setAttribute(\"d\", pathString);\r\n        }\r\n        else {\r\n            path.setAttribute(\"stroke-linecap\", \"square\");\r\n            path.setAttribute(\"stroke-linejoin\", \"miter\");\r\n            const start = this._points[0];\r\n            pathString = \"M\" + start.x + \",\" + start.y;\r\n            for (let i = 1; i < this._points.length; i++) {\r\n                const point = this._points[i];\r\n                pathString += \" L\" + point.x + \",\" + point.y;\r\n            }\r\n            pathString += \" Z\";\r\n        }\r\n        path.setAttribute(\"d\", pathString);\r\n        this._svgGroup.append(path);\r\n    }\r\n    buildAnnotationDto() {\r\n        const margin = this._strokeWidth / 2 + (this._cloudMode ? PolygonAnnotation.cloudArcSize / 2 : 0);\r\n        let xmin;\r\n        let ymin;\r\n        let xmax;\r\n        let ymax;\r\n        let vec;\r\n        const points = this._points;\r\n        const vertices = [];\r\n        for (let i = 0; i < points.length; i++) {\r\n            vec = points[i];\r\n            if (!xmin || vec.x < xmin) {\r\n                xmin = vec.x;\r\n            }\r\n            if (!ymin || vec.y < ymin) {\r\n                ymin = vec.y;\r\n            }\r\n            if (!xmax || vec.x > xmax) {\r\n                xmax = vec.x;\r\n            }\r\n            if (!ymax || vec.y > ymax) {\r\n                ymax = vec.y;\r\n            }\r\n            vertices.push(vec.x, vec.y);\r\n        }\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Polygon\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: [xmin - margin, ymin - margin, xmax + margin, ymax + margin],\r\n            vertices,\r\n            cloud: this._cloudMode,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$f = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricPolylineAnnotator extends GeometricAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this._points = [];\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this.refreshGroupPosition();\r\n            if (!this._points.length) {\r\n                this._points.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            }\r\n            this._points.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            this._points[this._points.length - 1].set(px, py);\r\n            this.redraw();\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.emitPointsDataChanged();\r\n        };\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        if (this._points.length) {\r\n            this._points.pop();\r\n            this.redraw();\r\n            this.emitPointsDataChanged();\r\n        }\r\n    }\r\n    clear() {\r\n        var _a;\r\n        if ((_a = this._points) === null || _a === void 0 ? void 0 : _a.length) {\r\n            this._points.length = 0;\r\n            this.clearGroup();\r\n        }\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$f(this, void 0, void 0, function* () {\r\n            if (this._points.length < 2) {\r\n                return;\r\n            }\r\n            const pageId = this._pageId;\r\n            const dto = this.buildAnnotationDto();\r\n            const annotation = PolylineAnnotation.createFromDto(dto);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    emitPointsDataChanged() {\r\n        const count = this._points.length;\r\n        this.emitDataChanged(count, count > 1, count > 0, count > 2);\r\n    }\r\n    redraw() {\r\n        this._svgGroup.innerHTML = \"\";\r\n        if (this._points.length < 2) {\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        path.setAttribute(\"stroke-linecap\", \"square\");\r\n        path.setAttribute(\"stroke-linejoin\", \"miter\");\r\n        const start = this._points[0];\r\n        let pathString = \"M\" + start.x + \",\" + start.y;\r\n        for (let i = 1; i < this._points.length; i++) {\r\n            const point = this._points[i];\r\n            pathString += \" L\" + point.x + \",\" + point.y;\r\n        }\r\n        path.setAttribute(\"d\", pathString);\r\n        this._svgGroup.append(path);\r\n    }\r\n    buildAnnotationDto() {\r\n        const margin = this._strokeWidth / 2;\r\n        let xmin;\r\n        let ymin;\r\n        let xmax;\r\n        let ymax;\r\n        let vec;\r\n        const points = this._points;\r\n        const vertices = [];\r\n        for (let i = 0; i < points.length; i++) {\r\n            vec = points[i];\r\n            if (!xmin || vec.x < xmin) {\r\n                xmin = vec.x;\r\n            }\r\n            if (!ymin || vec.y < ymin) {\r\n                ymin = vec.y;\r\n            }\r\n            if (!xmax || vec.x > xmax) {\r\n                xmax = vec.x;\r\n            }\r\n            if (!ymax || vec.y > ymax) {\r\n                ymax = vec.y;\r\n            }\r\n            vertices.push(vec.x, vec.y);\r\n        }\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Polyline\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: [xmin - margin, ymin - margin, xmax + margin, ymax + margin],\r\n            vertices,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$e = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass GeometricSquareAnnotator extends GeometricAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this._down = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.clear();\r\n            this.refreshGroupPosition();\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary\r\n                || !this._down) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(this._down, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            this.redrawRect(min, max);\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            if (this._rect) {\r\n                this.emitDataChanged(2, true, true);\r\n            }\r\n        };\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._rect = null;\r\n        this.clearGroup();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$e(this, void 0, void 0, function* () {\r\n            if (!this._rect) {\r\n                return;\r\n            }\r\n            const pageId = this._pageId;\r\n            const dto = this.buildAnnotationDto();\r\n            const annotation = SquareAnnotation.createFromDto(dto);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    redrawRect(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const minSize = this._strokeWidth * 2;\r\n        if (max.x - min.x <= minSize || max.y - min.y <= minSize) {\r\n            this._rect = null;\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._rect = [min.x, min.y, max.x, max.y];\r\n        if (this._cloudMode) {\r\n            const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n            path.setAttribute(\"fill\", \"none\");\r\n            path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n            path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n            path.setAttribute(\"stroke-linecap\", \"round\");\r\n            path.setAttribute(\"stroke-linejoin\", \"round\");\r\n            const curveData = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CloudCurveData.buildFromPolyline([\r\n                new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(min.x, min.y),\r\n                new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(max.x, min.y),\r\n                new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(max.x, max.y),\r\n                new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(min.x, max.y),\r\n                new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(min.x, min.y),\r\n            ], SquareAnnotation.cloudArcSize);\r\n            let pathString = \"M\" + curveData.start.x + \",\" + curveData.start.y;\r\n            curveData.curves.forEach(x => {\r\n                pathString += ` C${x[0].x},${x[0].y} ${x[1].x},${x[1].y} ${x[2].x},${x[2].y}`;\r\n            });\r\n            path.setAttribute(\"d\", pathString);\r\n            this._svgGroup.append(path);\r\n        }\r\n        else {\r\n            const rect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n            rect.setAttribute(\"fill\", \"none\");\r\n            rect.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n            rect.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n            rect.setAttribute(\"x\", min.x + \"\");\r\n            rect.setAttribute(\"y\", min.y + \"\");\r\n            rect.setAttribute(\"width\", max.x - min.x + \"\");\r\n            rect.setAttribute(\"height\", max.y - min.y + \"\");\r\n            this._svgGroup.append(rect);\r\n        }\r\n    }\r\n    buildAnnotationDto() {\r\n        const margin = this._strokeWidth / 2 + (this._cloudMode ? SquareAnnotation.cloudArcSize / 2 : 0);\r\n        const lm = margin;\r\n        const tm = margin;\r\n        const rm = margin;\r\n        const bm = margin;\r\n        const rectMargins = [lm, tm, rm, bm];\r\n        const [xmin, ymin, xmax, ymax] = this._rect;\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Square\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect: [xmin - lm, ymin - bm, xmax + rm, ymax + tm],\r\n            rectMargins,\r\n            cloud: this._cloudMode,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nconst geometricAnnotatorTypes = [\"square\", \"circle\", \"line\", \"arrow\", \"polyline\", \"polygon\"];\r\nclass GeometricAnnotatorFactory {\r\n    createAnnotator(docService, pageService, parent, options, type) {\r\n        var _a, _b;\r\n        if (!docService) {\r\n            throw new Error(\"Document service is not defined\");\r\n        }\r\n        if (!pageService) {\r\n            throw new Error(\"Page service is not defined\");\r\n        }\r\n        if (!parent) {\r\n            throw new Error(\"Parent container is not defined\");\r\n        }\r\n        type || (type = this._lastType || \"square\");\r\n        this._lastType = type;\r\n        const color = (options === null || options === void 0 ? void 0 : options.color) || this._lastColor || [0, 0, 0, 0.9];\r\n        this._lastColor = color;\r\n        const strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || this._lastStrokeWidth || 3;\r\n        this._lastStrokeWidth = strokeWidth;\r\n        const cloudMode = (_b = (_a = options === null || options === void 0 ? void 0 : options.cloudMode) !== null && _a !== void 0 ? _a : this._lastCloudMode) !== null && _b !== void 0 ? _b : false;\r\n        this._lastCloudMode = cloudMode;\r\n        const combinedOptions = {\r\n            color,\r\n            strokeWidth,\r\n            cloudMode,\r\n        };\r\n        switch (type) {\r\n            case \"square\":\r\n                return new GeometricSquareAnnotator(docService, pageService, parent, combinedOptions);\r\n            case \"circle\":\r\n                return new GeometricCircleAnnotator(docService, pageService, parent, combinedOptions);\r\n            case \"line\":\r\n                return new GeometricLineAnnotator(docService, pageService, parent, combinedOptions);\r\n            case \"arrow\":\r\n                return new GeometricArrowAnnotator(docService, pageService, parent, combinedOptions);\r\n            case \"polyline\":\r\n                return new GeometricPolylineAnnotator(docService, pageService, parent, combinedOptions);\r\n            case \"polygon\":\r\n                return new GeometricPolygonAnnotator(docService, pageService, parent, combinedOptions);\r\n            default:\r\n                throw new Error(`Invalid geometric annotator type: ${type}`);\r\n        }\r\n    }\r\n}\n\nvar __awaiter$d = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PenAnnotator extends Annotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent);\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            if (!this._annotationPathData || pageId !== this._annotationPathData.id) {\r\n                this.resetTempPenData(pageId);\r\n            }\r\n            this._annotationPathData.newPath(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary || !this._annotationPathData) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._annotationPathData.id) {\r\n                return;\r\n            }\r\n            this._annotationPathData.addPosition(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(pageCoords.pageX, pageCoords.pageY));\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            var _a;\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            (_a = this._annotationPathData) === null || _a === void 0 ? void 0 : _a.endPath();\r\n            this.emitDataChanged();\r\n        };\r\n        this.init();\r\n        this._color = (options === null || options === void 0 ? void 0 : options.color) || [0, 0, 0, 0.9];\r\n        this._strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || 3;\r\n    }\r\n    destroy() {\r\n        this.removeTempPenData();\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        var _a;\r\n        (_a = this._annotationPathData) === null || _a === void 0 ? void 0 : _a.removeLastPath();\r\n        this.emitDataChanged();\r\n    }\r\n    clear() {\r\n        this.removeTempPenData();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$d(this, void 0, void 0, function* () {\r\n            if (!this._annotationPathData) {\r\n                return;\r\n            }\r\n            const pageId = this._annotationPathData.id;\r\n            const dto = this.buildAnnotationDto(this._annotationPathData);\r\n            const annotation = InkAnnotation.createFromDto(dto);\r\n            yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    refreshGroupPosition() {\r\n        if (!this._annotationPathData) {\r\n            return;\r\n        }\r\n        const page = this._pageService.renderedPages.find(x => x.id === this._annotationPathData.id);\r\n        if (!page) {\r\n            this._annotationPathData.group.setAttribute(\"transform\", \"scale(0)\");\r\n            return;\r\n        }\r\n        const { height: pageHeight, width: pageWidth, top: pageTop, left: pageLeft } = page.viewContainer.getBoundingClientRect();\r\n        const pageBottom = pageTop + pageHeight;\r\n        const pageRight = pageLeft + pageWidth;\r\n        const { height: overlayHeight, top: overlayTop, left: overlayLeft } = this._overlay.getBoundingClientRect();\r\n        const overlayBottom = overlayTop + overlayHeight;\r\n        const rotation = page.rotation;\r\n        const scale = page.scale;\r\n        let offsetX;\r\n        let offsetY;\r\n        switch (rotation) {\r\n            case 0:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            case 90:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 180:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 270:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid rotation degree: ${rotation}`);\r\n        }\r\n        this._annotationPathData.group.setAttribute(\"transform\", `translate(${offsetX} ${offsetY}) rotate(${-rotation})`);\r\n    }\r\n    removeTempPenData() {\r\n        if (this._annotationPathData) {\r\n            this._annotationPathData.group.remove();\r\n            this._annotationPathData = null;\r\n            this.emitDataChanged();\r\n        }\r\n    }\r\n    resetTempPenData(pageId) {\r\n        this.removeTempPenData();\r\n        this._annotationPathData = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.SvgSmoothPath({\r\n            id: pageId,\r\n            color: this._color,\r\n            strokeWidth: this._strokeWidth,\r\n        });\r\n        this._svgGroup.append(this._annotationPathData.group);\r\n        this.refreshGroupPosition();\r\n    }\r\n    emitDataChanged() {\r\n        var _a;\r\n        const count = ((_a = this._annotationPathData) === null || _a === void 0 ? void 0 : _a.pathCount) || 0;\r\n        this._docService.eventService.dispatchEvent(new AnnotatorDataChangeEvent({\r\n            annotatorType: \"pen\",\r\n            elementCount: count,\r\n            undoable: count > 1,\r\n            clearable: count > 0,\r\n            saveable: count > 0,\r\n        }));\r\n    }\r\n    buildAnnotationDto(data) {\r\n        const positions = [];\r\n        const inkList = [];\r\n        data.paths.forEach(path => {\r\n            const ink = [];\r\n            path.positions.forEach(pos => {\r\n                positions.push(pos);\r\n                ink.push(pos.x, pos.y);\r\n            });\r\n            inkList.push(ink);\r\n        });\r\n        const { min: newRectMin, max: newRectMax } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(...positions);\r\n        const halfW = data.strokeWidth / 2;\r\n        const rect = [\r\n            newRectMin.x - halfW,\r\n            newRectMin.y - halfW,\r\n            newRectMax.x + halfW,\r\n            newRectMax.y + halfW,\r\n        ];\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Ink\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: null,\r\n            rect,\r\n            matrix: [1, 0, 0, 1, 0, 0],\r\n            inkList,\r\n            color: data.color,\r\n            strokeWidth: data.strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$c = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst supportedStampTypes = [\r\n    { type: \"/Draft\", name: \"Draft\" },\r\n    { type: \"/Approved\", name: \"Approved\" },\r\n    { type: \"/NotApproved\", name: \"Not Approved\" },\r\n    { type: \"/Departmental\", name: \"Departmental\" },\r\n    { type: \"/Confidential\", name: \"Confidential\" },\r\n    { type: \"/Final\", name: \"Final\" },\r\n    { type: \"/Expired\", name: \"Expired\" },\r\n    { type: \"/AsIs\", name: \"As Is\" },\r\n    { type: \"/Sold\", name: \"Sold\" },\r\n    { type: \"/Experimental\", name: \"Experimental\" },\r\n    { type: \"/ForComment\", name: \"For Comment\" },\r\n    { type: \"/TopSecret\", name: \"Top Secret\" },\r\n    { type: \"/ForPublicRelease\", name: \"For Public\" },\r\n    { type: \"/NotForPublicRelease\", name: \"Not For Public\" },\r\n];\r\nclass StampAnnotator extends Annotator {\r\n    constructor(docService, pageService, parent, type, creationInfo) {\r\n        super(docService, pageService, parent);\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            const { height: oh, top, left: ox } = this._parent.getBoundingClientRect();\r\n            const oy = top + oh;\r\n            const offsetX = (cx - ox) / this._pageService.scale;\r\n            const offsetY = (oy - cy) / this._pageService.scale;\r\n            if (this._tempAnnotation) {\r\n                const [x1, y1, x2, y2] = this._tempAnnotation.Rect;\r\n                this._svgGroup.setAttribute(\"transform\", `translate(${offsetX - (x2 - x1) / 2} ${offsetY - (y2 - y1) / 2})`);\r\n            }\r\n            this.updatePointerCoords(cx, cy);\r\n        };\r\n        this.onPointerUp = (e) => __awaiter$c(this, void 0, void 0, function* () {\r\n            var _a, _b, _c;\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            if (e.pointerType === \"touch\") {\r\n                const longTap = performance.now() - ((_a = this._lastPointerDownInfo) === null || _a === void 0 ? void 0 : _a.timestamp) > 700;\r\n                if (longTap) {\r\n                    const downX = ((_b = this._lastPointerDownInfo) === null || _b === void 0 ? void 0 : _b.clientX) || 0;\r\n                    const downY = ((_c = this._lastPointerDownInfo) === null || _c === void 0 ? void 0 : _c.clientY) || 0;\r\n                    const displacement = Math.abs((0,mathador__WEBPACK_IMPORTED_MODULE_1__.getDistance2D)(cx, cy, downX, downY));\r\n                    const displaced = displacement > 7.5;\r\n                    if (!displaced) {\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n            const pageCoords = this._pageService.getPageCoordsUnderPointer(cx, cy);\r\n            this._pointerCoordsInPageCS = pageCoords;\r\n            if (!pageCoords || !this._tempAnnotation) {\r\n                return;\r\n            }\r\n            const { pageId, pageX, pageY, pageRotation } = this._pointerCoordsInPageCS;\r\n            yield this._tempAnnotation.moveToAsync(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(pageX, pageY));\r\n            if (pageRotation) {\r\n                yield this._tempAnnotation.rotateByAsync(-pageRotation / 180 * Math.PI);\r\n            }\r\n            this._pageId = pageId;\r\n            yield this.saveAnnotationAsync();\r\n        });\r\n        if (!type) {\r\n            throw new Error(\"Stamp type is not defined\");\r\n        }\r\n        this._type = type;\r\n        this._creationInfo = creationInfo;\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        this._tempAnnotation = null;\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._tempAnnotation = null;\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$c(this, void 0, void 0, function* () {\r\n            if (!this._pageId || !this._tempAnnotation) {\r\n                return;\r\n            }\r\n            yield this._docService.appendAnnotationToPageAsync(this._pageId, this._tempAnnotation);\r\n            yield this.createTempStampAnnotationAsync();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointermove\", this.onPointerMove);\r\n        this._overlay.addEventListener(\"pointerup\", this.onPointerUp);\r\n        this.createTempStampAnnotationAsync();\r\n    }\r\n    createStandardStamp(type, userName) {\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Stamp\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: userName || \"unknown\",\r\n            textContent: null,\r\n            rect: null,\r\n            matrix: null,\r\n            stampType: type,\r\n            stampSubject: null,\r\n            stampImageData: null,\r\n        };\r\n        return StampAnnotation.createFromDto(dto);\r\n    }\r\n    createCustomStamp(creationInfo, userName) {\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/Stamp\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: userName || \"unknown\",\r\n            textContent: null,\r\n            rect: creationInfo.rect || creationInfo.bbox,\r\n            bbox: creationInfo.bbox,\r\n            matrix: null,\r\n            stampType: creationInfo.type,\r\n            stampSubject: creationInfo.subject,\r\n            stampImageData: [...creationInfo.imageData],\r\n        };\r\n        return StampAnnotation.createFromDto(dto);\r\n    }\r\n    createTempStampAnnotationAsync() {\r\n        return __awaiter$c(this, void 0, void 0, function* () {\r\n            let stamp;\r\n            if (standardStampCreationInfos[this._type]) {\r\n                stamp = this.createStandardStamp(this._type, this._docService.userName);\r\n            }\r\n            else if (this._creationInfo) {\r\n                stamp = this.createCustomStamp(this._creationInfo, this._docService.userName);\r\n            }\r\n            else {\r\n                throw new Error(`Unsupported stamp type: ${this._type}`);\r\n            }\r\n            const renderResult = yield stamp.renderApStreamAsync();\r\n            this._svgGroup.innerHTML = \"\";\r\n            this._svgGroup.append(...renderResult.clipPaths);\r\n            this._svgGroup.append(...renderResult.elements.map(x => x.element));\r\n            this._tempAnnotation = stamp;\r\n        });\r\n    }\r\n    refreshGroupPosition() {\r\n    }\r\n}\n\nclass TextAnnotator extends Annotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent);\r\n        this._color = (options === null || options === void 0 ? void 0 : options.color) || [0, 0, 0, 1];\r\n        this._strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || 3;\r\n    }\r\n    emitDataChanged(count, saveable, clearable, undoable) {\r\n        this._docService.eventService.dispatchEvent(new AnnotatorDataChangeEvent({\r\n            annotatorType: \"text\",\r\n            elementCount: count,\r\n            undoable,\r\n            clearable,\r\n            saveable,\r\n        }));\r\n    }\r\n}\n\nclass TextMarkupAnnotator extends TextAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options);\r\n        this._svgGroupByPageId = new Map();\r\n        this._coordsByPageId = new Map();\r\n        this.onTextSelectionChange = (e) => {\r\n            var _a;\r\n            this.updateCoords(((_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.selectionInfos) || []);\r\n        };\r\n    }\r\n    destroy() {\r\n        this._docService.eventService.removeListener(textSelectionChangeEvent, this.onTextSelectionChange);\r\n        this.clearGroup();\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._coordsByPageId.clear();\r\n        this.clearGroup();\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._docService.eventService.addListener(textSelectionChangeEvent, this.onTextSelectionChange);\r\n    }\r\n    clearGroup() {\r\n        this._svgGroupByPageId.forEach(x => x.innerHTML = \"\");\r\n        this.emitDataChanged(0);\r\n    }\r\n    refreshGroupPosition() {\r\n        const { height: overlayHeight, top: overlayTop, left: overlayLeft } = this._overlay.getBoundingClientRect();\r\n        const overlayBottom = overlayTop + overlayHeight;\r\n        const scale = this._pageService.scale;\r\n        this._pageService.renderedPages.forEach(x => {\r\n            const { height: pageHeight, width: pageWidth, top: pageTop, left: pageLeft } = x.viewContainer.getBoundingClientRect();\r\n            const pageBottom = pageTop + pageHeight;\r\n            const pageRight = pageLeft + pageWidth;\r\n            const rotation = x.rotation;\r\n            let offsetX;\r\n            let offsetY;\r\n            switch (rotation) {\r\n                case 0:\r\n                    offsetX = (pageLeft - overlayLeft) / scale;\r\n                    offsetY = (overlayBottom - pageBottom) / scale;\r\n                    break;\r\n                case 90:\r\n                    offsetX = (pageLeft - overlayLeft) / scale;\r\n                    offsetY = (overlayBottom - pageTop) / scale;\r\n                    break;\r\n                case 180:\r\n                    offsetX = (pageRight - overlayLeft) / scale;\r\n                    offsetY = (overlayBottom - pageTop) / scale;\r\n                    break;\r\n                case 270:\r\n                    offsetX = (pageRight - overlayLeft) / scale;\r\n                    offsetY = (overlayBottom - pageBottom) / scale;\r\n                    break;\r\n                default:\r\n                    throw new Error(`Invalid rotation degree: ${rotation}`);\r\n            }\r\n            let svg;\r\n            if (this._svgGroupByPageId.has(x.id)) {\r\n                svg = this._svgGroupByPageId.get(x.id);\r\n            }\r\n            else {\r\n                svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n                this._svgGroupByPageId.set(x.id, svg);\r\n                this._svgGroup.append(svg);\r\n            }\r\n            svg.setAttribute(\"transform\", `translate(${offsetX} ${offsetY}) rotate(${-rotation})`);\r\n        });\r\n    }\r\n    updateCoords(selections) {\r\n        var _a;\r\n        this._coordsByPageId.clear();\r\n        for (const selection of selections) {\r\n            const bl = this._pageService.getPageCoordsUnderPointer(selection.bottomLeft.x, selection.bottomLeft.y);\r\n            const br = this._pageService.getPageCoordsUnderPointer(selection.bottomRight.x, selection.bottomRight.y);\r\n            const tr = this._pageService.getPageCoordsUnderPointer(selection.topRight.x, selection.topRight.y);\r\n            const tl = this._pageService.getPageCoordsUnderPointer(selection.topLeft.x, selection.topLeft.y);\r\n            if (!bl || !br || !tr || !tl) {\r\n                continue;\r\n            }\r\n            if (new Set([bl.pageId, br.pageId, tr.pageId, tl.pageId]).size > 1) {\r\n                throw new Error(\"Not all the text selection corners are inside the same page\");\r\n            }\r\n            const quadPoints = [\r\n                tl.pageX, tl.pageY,\r\n                tr.pageX, tr.pageY,\r\n                bl.pageX, bl.pageY,\r\n                br.pageX, br.pageY,\r\n            ];\r\n            const pageId = bl.pageId;\r\n            if (this._coordsByPageId.has(pageId)) {\r\n                this._coordsByPageId.get(pageId).push(quadPoints);\r\n            }\r\n            else {\r\n                this._coordsByPageId.set(pageId, [quadPoints]);\r\n            }\r\n        }\r\n        this.redraw();\r\n        if ((_a = this._coordsByPageId) === null || _a === void 0 ? void 0 : _a.size) {\r\n            this.emitDataChanged(this._coordsByPageId.size, true, true);\r\n        }\r\n        else {\r\n            this.emitDataChanged(0);\r\n        }\r\n    }\r\n    buildAnnotationDtos(type) {\r\n        const nowString = new Date().toISOString();\r\n        const dtos = [];\r\n        this._coordsByPageId.forEach((quads, pageId) => {\r\n            const dto = {\r\n                uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n                annotationType: type,\r\n                pageId,\r\n                dateCreated: nowString,\r\n                dateModified: nowString,\r\n                author: this._docService.userName || \"unknown\",\r\n                textContent: null,\r\n                rect: null,\r\n                quadPoints: quads.flat(),\r\n                color: this._color,\r\n                strokeWidth: this._strokeWidth,\r\n                strokeDashGap: null,\r\n            };\r\n            dtos.push(dto);\r\n        });\r\n        return dtos;\r\n    }\r\n}\n\nvar __awaiter$b = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextHighlightAnnotator extends TextMarkupAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.init();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$b(this, void 0, void 0, function* () {\r\n            if (!this._coordsByPageId.size) {\r\n                return;\r\n            }\r\n            const dtos = this.buildAnnotationDtos(\"/Highlight\");\r\n            for (const dto of dtos) {\r\n                const annotation = HighlightAnnotation.createFromDto(dto);\r\n                yield this._docService.appendAnnotationToPageAsync(dto.pageId, annotation);\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    redraw() {\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._svgGroupByPageId.forEach((group, pageId) => {\r\n            group.innerHTML = \"\";\r\n            const quads = this._coordsByPageId.get(pageId);\r\n            if (quads === null || quads === void 0 ? void 0 : quads.length) {\r\n                quads.forEach(quad => {\r\n                    const [x3, y3, x2, y2, x0, y0, x1, y1] = quad;\r\n                    const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n                    path.setAttribute(\"fill\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n                    path.setAttribute(\"stroke\", \"none\");\r\n                    path.setAttribute(\"d\", `M ${x0},${y0} L ${x1},${y1} L ${x2},${y2} L ${x3},${y3} Z`);\r\n                    group.append(path);\r\n                });\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$a = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextSquigglyAnnotator extends TextMarkupAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.init();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$a(this, void 0, void 0, function* () {\r\n            if (!this._coordsByPageId.size) {\r\n                return;\r\n            }\r\n            const dtos = this.buildAnnotationDtos(\"/Squiggly\");\r\n            for (const dto of dtos) {\r\n                const annotation = SquigglyAnnotation.createFromDto(dto);\r\n                yield this._docService.appendAnnotationToPageAsync(dto.pageId, annotation);\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    redraw() {\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._svgGroupByPageId.forEach((group, pageId) => {\r\n            group.innerHTML = \"\";\r\n            const quads = this._coordsByPageId.get(pageId);\r\n            if (quads === null || quads === void 0 ? void 0 : quads.length) {\r\n                quads.forEach(quad => {\r\n                    const [, , , , x0, y0, x1, y1] = quad;\r\n                    const squigglyLinePoints = buildSquigglyLine(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x0, y0), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x1, y1), SquigglyAnnotation.squiggleSize);\r\n                    if (squigglyLinePoints === null || squigglyLinePoints === void 0 ? void 0 : squigglyLinePoints.length) {\r\n                        let pathTextData = `M ${squigglyLinePoints[0].x},${squigglyLinePoints[0].y} `;\r\n                        for (let j = 1; j < squigglyLinePoints.length; j++) {\r\n                            pathTextData += `L ${squigglyLinePoints[j].x},${squigglyLinePoints[j].y} `;\r\n                        }\r\n                        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n                        path.setAttribute(\"fill\", \"none\");\r\n                        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n                        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n                        path.setAttribute(\"stroke-linecap\", \"square\");\r\n                        path.setAttribute(\"d\", pathTextData);\r\n                        group.append(path);\r\n                    }\r\n                });\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$9 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextStrikeoutAnnotator extends TextMarkupAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.init();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$9(this, void 0, void 0, function* () {\r\n            if (!this._coordsByPageId.size) {\r\n                return;\r\n            }\r\n            const dtos = this.buildAnnotationDtos(\"/Strikeout\");\r\n            for (const dto of dtos) {\r\n                const annotation = StrikeoutAnnotation.createFromDto(dto);\r\n                yield this._docService.appendAnnotationToPageAsync(dto.pageId, annotation);\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    redraw() {\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._svgGroupByPageId.forEach((group, pageId) => {\r\n            group.innerHTML = \"\";\r\n            const quads = this._coordsByPageId.get(pageId);\r\n            const bottomLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const bottomRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const topRight = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const topLeft = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const start = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            const end = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2();\r\n            if (quads === null || quads === void 0 ? void 0 : quads.length) {\r\n                quads.forEach(quad => {\r\n                    const [x3, y3, x2, y2, x0, y0, x1, y1] = quad;\r\n                    bottomLeft.set(x0, y0);\r\n                    bottomRight.set(x1, y1);\r\n                    topRight.set(x2, y2);\r\n                    topLeft.set(x3, y3);\r\n                    start.setFromVec2(bottomLeft).add(topLeft).multiplyByScalar(0.5);\r\n                    end.setFromVec2(bottomRight).add(topRight).multiplyByScalar(0.5);\r\n                    const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n                    path.setAttribute(\"fill\", \"none\");\r\n                    path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n                    path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n                    path.setAttribute(\"stroke-linecap\", \"square\");\r\n                    path.setAttribute(\"d\", `M ${start.x},${start.y} L ${end.x},${end.y}`);\r\n                    group.append(path);\r\n                });\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$8 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextUnderlineAnnotator extends TextMarkupAnnotator {\r\n    constructor(docService, pageService, parent, options) {\r\n        super(docService, pageService, parent, options || {});\r\n        this.init();\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$8(this, void 0, void 0, function* () {\r\n            if (!this._coordsByPageId.size) {\r\n                return;\r\n            }\r\n            const dtos = this.buildAnnotationDtos(\"/Underline\");\r\n            for (const dto of dtos) {\r\n                const annotation = UnderlineAnnotation.createFromDto(dto);\r\n                yield this._docService.appendAnnotationToPageAsync(dto.pageId, annotation);\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    redraw() {\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._svgGroupByPageId.forEach((group, pageId) => {\r\n            group.innerHTML = \"\";\r\n            const quads = this._coordsByPageId.get(pageId);\r\n            if (quads === null || quads === void 0 ? void 0 : quads.length) {\r\n                quads.forEach(quad => {\r\n                    const [, , , , x0, y0, x1, y1] = quad;\r\n                    const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n                    path.setAttribute(\"fill\", \"none\");\r\n                    path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n                    path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n                    path.setAttribute(\"stroke-linecap\", \"square\");\r\n                    path.setAttribute(\"d\", `M ${x0},${y0} L ${x1},${y1}`);\r\n                    group.append(path);\r\n                });\r\n            }\r\n        });\r\n    }\r\n}\n\nvar __awaiter$7 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TextNoteAnnotator extends TextAnnotator {\r\n    constructor(docService, pageService, viewer, options) {\r\n        super(docService, pageService, viewer.container, options || {});\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            const { height: oh, top, left: ox } = this._parent.getBoundingClientRect();\r\n            const oy = top + oh;\r\n            const offsetX = (cx - ox) / this._pageService.scale;\r\n            const offsetY = (oy - cy) / this._pageService.scale;\r\n            const [x1, y1, x2, y2] = this._tempAnnotation.Rect;\r\n            this._svgGroup.setAttribute(\"transform\", `translate(${offsetX - (x2 - x1) / 4} ${offsetY - (y2 - y1) / 4})`);\r\n            this.updatePointerCoords(cx, cy);\r\n        };\r\n        this.onPointerUp = (e) => __awaiter$7(this, void 0, void 0, function* () {\r\n            var _a, _b, _c;\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            if (e.pointerType === \"touch\") {\r\n                const longTap = performance.now() - ((_a = this._lastPointerDownInfo) === null || _a === void 0 ? void 0 : _a.timestamp) > 700;\r\n                if (longTap) {\r\n                    const downX = ((_b = this._lastPointerDownInfo) === null || _b === void 0 ? void 0 : _b.clientX) || 0;\r\n                    const downY = ((_c = this._lastPointerDownInfo) === null || _c === void 0 ? void 0 : _c.clientY) || 0;\r\n                    const displacement = Math.abs((0,mathador__WEBPACK_IMPORTED_MODULE_1__.getDistance2D)(cx, cy, downX, downY));\r\n                    const displaced = displacement > 7.5;\r\n                    if (!displaced) {\r\n                        return;\r\n                    }\r\n                }\r\n            }\r\n            const pageCoords = this._pageService.getPageCoordsUnderPointer(cx, cy);\r\n            this._pointerCoordsInPageCS = pageCoords;\r\n            if (!pageCoords || !this._tempAnnotation) {\r\n                return;\r\n            }\r\n            const { pageId, pageX, pageY, pageRotation } = this._pointerCoordsInPageCS;\r\n            const [x1, y1, x2, y2] = this._tempAnnotation.Rect;\r\n            yield this._tempAnnotation.moveToAsync(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(pageX + (x2 - x1) / 4, pageY + (y2 - y1) / 4));\r\n            if (pageRotation) {\r\n                yield this._tempAnnotation.rotateByAsync(-pageRotation / 180 * Math.PI, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(pageX, pageY));\r\n            }\r\n            this._pageId = pageId;\r\n            yield this.saveAnnotationAsync();\r\n        });\r\n        this._viewer = viewer;\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        this._tempAnnotation = null;\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._tempAnnotation = null;\r\n    }\r\n    saveAnnotationAsync() {\r\n        var _a, _b;\r\n        return __awaiter$7(this, void 0, void 0, function* () {\r\n            if (!this._pageId || !this._tempAnnotation) {\r\n                return;\r\n            }\r\n            const initialText = (_b = (_a = this._tempAnnotation) === null || _a === void 0 ? void 0 : _a.Contents) === null || _b === void 0 ? void 0 : _b.literal;\r\n            const text = yield this._viewer.showTextDialogAsync(initialText);\r\n            if (text !== null) {\r\n                yield this._tempAnnotation.setTextContentAsync(text);\r\n                yield this._docService.appendAnnotationToPageAsync(this._pageId, this._tempAnnotation);\r\n            }\r\n            yield this.createTempNoteAnnotationAsync();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointermove\", this.onPointerMove);\r\n        this._overlay.addEventListener(\"pointerup\", this.onPointerUp);\r\n        this.createTempNoteAnnotationAsync();\r\n    }\r\n    createTempNoteAnnotationAsync() {\r\n        return __awaiter$7(this, void 0, void 0, function* () {\r\n            const note = TextAnnotation.createStandard(this._docService.userName, this._color);\r\n            const renderResult = yield note.renderApStreamAsync();\r\n            this._svgGroup.innerHTML = \"\";\r\n            this._svgGroup.append(...renderResult.clipPaths);\r\n            this._svgGroup.append(...renderResult.elements.map(x => x.element));\r\n            this._tempAnnotation = note;\r\n        });\r\n    }\r\n    refreshGroupPosition() {\r\n    }\r\n}\n\nvar __awaiter$6 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass FreeTextAnnotator extends TextAnnotator {\r\n    constructor(docService, pageService, viewer, options) {\r\n        super(docService, pageService, viewer.container, options || {});\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            this._pageId = pageId;\r\n            this._down = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.clear();\r\n            this.refreshGroupPosition();\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary\r\n                || !this._down) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(this._down, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n            this.redrawRect(min, max);\r\n        };\r\n        this.onPointerUp = (e) => __awaiter$6(this, void 0, void 0, function* () {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            if (this._rect) {\r\n                yield this.saveAnnotationAsync();\r\n            }\r\n        });\r\n        this._viewer = viewer;\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        this.emitDataChanged(0);\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._rect = null;\r\n        this._svgGroup.innerHTML = \"\";\r\n        this.emitDataChanged(0);\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$6(this, void 0, void 0, function* () {\r\n            if (!this._pageId || !this._rect) {\r\n                return;\r\n            }\r\n            const text = yield this._viewer.showTextDialogAsync(\"\");\r\n            if (text !== null) {\r\n                const pageId = this._pageId;\r\n                const dto = this.buildAnnotationDto(text);\r\n                if (dto) {\r\n                    const annotation = yield FreeTextAnnotation.createFromDtoAsync(dto, this._docService.fontMap);\r\n                    yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n                }\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    redrawRect(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const minSize = this._strokeWidth * 2;\r\n        if (max.x - min.x <= minSize || max.y - min.y <= minSize) {\r\n            this._rect = null;\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._rect = [min.x, min.y, max.x, max.y];\r\n        const rect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n        rect.setAttribute(\"fill\", \"white\");\r\n        rect.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        rect.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        rect.setAttribute(\"x\", min.x + \"\");\r\n        rect.setAttribute(\"y\", min.y + \"\");\r\n        rect.setAttribute(\"width\", max.x - min.x + \"\");\r\n        rect.setAttribute(\"height\", max.y - min.y + \"\");\r\n        this._svgGroup.append(rect);\r\n    }\r\n    refreshGroupPosition() {\r\n        if (!this._pageId && this._pageId !== 0) {\r\n            return;\r\n        }\r\n        const page = this._pageService.renderedPages.find(x => x.id === this._pageId);\r\n        if (!page) {\r\n            this._svgGroup.setAttribute(\"transform\", \"scale(0)\");\r\n            return;\r\n        }\r\n        const { height: pageHeight, width: pageWidth, top: pageTop, left: pageLeft } = page.viewContainer.getBoundingClientRect();\r\n        const pageBottom = pageTop + pageHeight;\r\n        const pageRight = pageLeft + pageWidth;\r\n        const { height: overlayHeight, top: overlayTop, left: overlayLeft } = this._overlay.getBoundingClientRect();\r\n        const overlayBottom = overlayTop + overlayHeight;\r\n        const rotation = page.rotation;\r\n        const scale = page.scale;\r\n        let offsetX;\r\n        let offsetY;\r\n        switch (rotation) {\r\n            case 0:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            case 90:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 180:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 270:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid rotation degree: ${rotation}`);\r\n        }\r\n        this._svgGroup.setAttribute(\"transform\", `translate(${offsetX} ${offsetY}) rotate(${-rotation})`);\r\n    }\r\n    buildAnnotationDto(text) {\r\n        const margin = this._strokeWidth / 2;\r\n        const lm = margin;\r\n        const tm = margin;\r\n        const rm = margin;\r\n        const bm = margin;\r\n        const [xmin, ymin, xmax, ymax] = this._rect;\r\n        const horCenterX = (xmin + xmax) / 2;\r\n        const vertCenterY = (ymin + ymax) / 2;\r\n        const points = {\r\n            bl: [xmin, ymin],\r\n            tr: [xmax, ymax],\r\n            br: [xmax, ymin],\r\n            tl: [xmin, ymax],\r\n            l: [xmin, vertCenterY],\r\n            t: [horCenterX, ymax],\r\n            r: [xmax, vertCenterY],\r\n            b: [horCenterX, ymin],\r\n        };\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/FreeText\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: text,\r\n            rect: [xmin - lm, ymin - bm, xmax + rm, ymax + tm],\r\n            points,\r\n            color: [this._color[0], this._color[1], this._color[2], 1],\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nvar __awaiter$5 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass FreeTextCalloutAnnotator extends TextAnnotator {\r\n    constructor(docService, pageService, viewer, options) {\r\n        super(docService, pageService, viewer.container, options || {});\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py, pageId } = pageCoords;\r\n            if (pageId !== this._pageId) {\r\n                this.clear();\r\n            }\r\n            this._pageId = pageId;\r\n            this._down = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            this.refreshGroupPosition();\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary\r\n                || !this._down) {\r\n                return;\r\n            }\r\n            const { clientX: cx, clientY: cy } = e;\r\n            this.updatePointerCoords(cx, cy);\r\n            if (!this._points) {\r\n                const pageCoords = this._pointerCoordsInPageCS;\r\n                if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                    return;\r\n                }\r\n                const { pageX: px, pageY: py } = pageCoords;\r\n                const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(this._down, new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py));\r\n                this.redrawRect(min, max);\r\n            }\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            if (!this._rect) {\r\n                return;\r\n            }\r\n            if (!this._points) {\r\n                this.initPoints();\r\n                return;\r\n            }\r\n            const pageCoords = this._pointerCoordsInPageCS;\r\n            if (!pageCoords || pageCoords.pageId !== this._pageId) {\r\n                return;\r\n            }\r\n            const { pageX: px, pageY: py } = pageCoords;\r\n            const p = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(px, py);\r\n            const { l, b, r, t } = this._points;\r\n            const lv = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(l[0], l[1]);\r\n            const bv = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(b[0], b[1]);\r\n            const rv = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(r[0], r[1]);\r\n            const tv = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(t[0], t[1]);\r\n            let cob = lv;\r\n            let minDistance = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(p, lv).getMagnitude();\r\n            const bvToP = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(p, bv).getMagnitude();\r\n            if (bvToP < minDistance) {\r\n                minDistance = bvToP;\r\n                cob = bv;\r\n            }\r\n            const rvToP = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(p, rv).getMagnitude();\r\n            if (rvToP < minDistance) {\r\n                minDistance = rvToP;\r\n                cob = rv;\r\n            }\r\n            const tvToP = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.subtract(p, tv).getMagnitude();\r\n            if (tvToP < minDistance) {\r\n                minDistance = tvToP;\r\n                cob = tv;\r\n            }\r\n            this._points.cob = cob.toFloatArray();\r\n            if (!this._points.cop) {\r\n                this._points.cop = p.toFloatArray();\r\n            }\r\n            else {\r\n                this._points.cok = p.toFloatArray();\r\n            }\r\n            this.redrawCallout();\r\n        };\r\n        this._viewer = viewer;\r\n        this.init();\r\n    }\r\n    destroy() {\r\n        this.emitDataChanged(0);\r\n        super.destroy();\r\n    }\r\n    undo() {\r\n        this.clear();\r\n    }\r\n    clear() {\r\n        this._rect = null;\r\n        this._points = null;\r\n        this._svgGroup.innerHTML = \"\";\r\n        this.emitDataChanged(0);\r\n    }\r\n    saveAnnotationAsync() {\r\n        return __awaiter$5(this, void 0, void 0, function* () {\r\n            if (!this._pageId || !this._rect) {\r\n                return;\r\n            }\r\n            const text = yield this._viewer.showTextDialogAsync(\"\");\r\n            if (text !== null) {\r\n                const pageId = this._pageId;\r\n                const dto = this.buildAnnotationDto(text);\r\n                if (dto) {\r\n                    const annotation = yield FreeTextAnnotation.createFromDtoAsync(dto, this._docService.fontMap);\r\n                    yield this._docService.appendAnnotationToPageAsync(pageId, annotation);\r\n                }\r\n            }\r\n            this.clear();\r\n        });\r\n    }\r\n    init() {\r\n        super.init();\r\n        this._overlay.addEventListener(\"pointerdown\", this.onPointerDown);\r\n    }\r\n    initPoints() {\r\n        const [xmin, ymin, xmax, ymax] = this._rect;\r\n        const horCenterX = (xmin + xmax) / 2;\r\n        const vertCenterY = (ymin + ymax) / 2;\r\n        const points = {\r\n            bl: [xmin, ymin],\r\n            tr: [xmax, ymax],\r\n            br: [xmax, ymin],\r\n            tl: [xmin, ymax],\r\n            l: [xmin, vertCenterY],\r\n            t: [horCenterX, ymax],\r\n            r: [xmax, vertCenterY],\r\n            b: [horCenterX, ymin],\r\n        };\r\n        this._points = points;\r\n        this.emitDataChanged(2, true, true);\r\n    }\r\n    redrawRect(min, max) {\r\n        this._svgGroup.innerHTML = \"\";\r\n        const minSize = this._strokeWidth * 2;\r\n        if (max.x - min.x <= minSize || max.y - min.y <= minSize) {\r\n            this._rect = null;\r\n            return;\r\n        }\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        this._rect = [min.x, min.y, max.x, max.y];\r\n        const rect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\r\n        rect.setAttribute(\"fill\", \"white\");\r\n        rect.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        rect.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        rect.setAttribute(\"x\", min.x + \"\");\r\n        rect.setAttribute(\"y\", min.y + \"\");\r\n        rect.setAttribute(\"width\", max.x - min.x + \"\");\r\n        rect.setAttribute(\"height\", max.y - min.y + \"\");\r\n        this._svgGroup.append(rect);\r\n    }\r\n    redrawCallout() {\r\n        const svgRect = this._svgGroup.lastChild;\r\n        svgRect.remove();\r\n        this._svgGroup.innerHTML = \"\";\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        const callout = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        callout.setAttribute(\"fill\", \"none\");\r\n        callout.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        callout.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        let d = `M${this._points.cob[0]},${this._points.cob[1]} `;\r\n        if (this._points.cok) {\r\n            d += `L${this._points.cok[0]},${this._points.cok[1]} `;\r\n        }\r\n        d += `L${this._points.cop[0]},${this._points.cop[1]}`;\r\n        callout.setAttribute(\"d\", d);\r\n        this._svgGroup.append(callout);\r\n        this._svgGroup.append(svgRect);\r\n    }\r\n    refreshGroupPosition() {\r\n        if (!this._pageId && this._pageId !== 0) {\r\n            return;\r\n        }\r\n        const page = this._pageService.renderedPages.find(x => x.id === this._pageId);\r\n        if (!page) {\r\n            this._svgGroup.setAttribute(\"transform\", \"scale(0)\");\r\n            return;\r\n        }\r\n        const { height: pageHeight, width: pageWidth, top: pageTop, left: pageLeft } = page.viewContainer.getBoundingClientRect();\r\n        const pageBottom = pageTop + pageHeight;\r\n        const pageRight = pageLeft + pageWidth;\r\n        const { height: overlayHeight, top: overlayTop, left: overlayLeft } = this._overlay.getBoundingClientRect();\r\n        const overlayBottom = overlayTop + overlayHeight;\r\n        const rotation = page.rotation;\r\n        const scale = page.scale;\r\n        let offsetX;\r\n        let offsetY;\r\n        switch (rotation) {\r\n            case 0:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            case 90:\r\n                offsetX = (pageLeft - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 180:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageTop) / scale;\r\n                break;\r\n            case 270:\r\n                offsetX = (pageRight - overlayLeft) / scale;\r\n                offsetY = (overlayBottom - pageBottom) / scale;\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid rotation degree: ${rotation}`);\r\n        }\r\n        this._svgGroup.setAttribute(\"transform\", `translate(${offsetX} ${offsetY}) rotate(${-rotation})`);\r\n    }\r\n    buildAnnotationDto(text) {\r\n        let margin;\r\n        if (this._points.cob) {\r\n            const endingSizeWoStroke = Math.max(this._strokeWidth * LINE_END_MULTIPLIER, LINE_END_MIN_SIZE);\r\n            const endingSize = endingSizeWoStroke + this._strokeWidth;\r\n            margin = endingSize / 2;\r\n        }\r\n        else {\r\n            margin = this._strokeWidth / 2;\r\n        }\r\n        const lm = margin;\r\n        const tm = margin;\r\n        const rm = margin;\r\n        const bm = margin;\r\n        const { bl, tr, br, tl, l, t, r, b, cob, cok, cop } = this._points;\r\n        const { min, max } = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.minMax(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bl[0], bl[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(tr[0], tr[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(br[0], br[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(tl[0], tl[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(l[0], l[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(t[0], t[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(r[0], r[1]), new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(b[0], b[1]), cob ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cob[0], cob[1]) : new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bl[0], bl[1]), cok ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cok[0], cok[1]) : new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bl[0], bl[1]), cop ? new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(cop[0], cop[1]) : new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(bl[0], bl[1]));\r\n        const nowString = new Date().toISOString();\r\n        const dto = {\r\n            uuid: ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.UUID.getRandomUuid(),\r\n            annotationType: \"/FreeText\",\r\n            pageId: null,\r\n            dateCreated: nowString,\r\n            dateModified: nowString,\r\n            author: this._docService.userName || \"unknown\",\r\n            textContent: text,\r\n            rect: [min.x - lm, min.y - bm, max.x + rm, max.y + tm],\r\n            points: this._points,\r\n            intent: this._points.cob ? freeTextIntents.WITH_CALLOUT : freeTextIntents.PLAIN_TEXT,\r\n            calloutEndingType: this._points.cob ? lineEndingTypes.ARROW_OPEN : null,\r\n            color: [this._color[0], this._color[1], this._color[2], 1],\r\n            strokeWidth: this._strokeWidth,\r\n            strokeDashGap: null,\r\n        };\r\n        return dto;\r\n    }\r\n}\n\nconst textAnnotatorTypes = [\"highlight\", \"strikeout\", \"squiggly\", \"underline\",\r\n    \"note\", \"freeText\", \"freeTextCallout\"];\r\nclass TextAnnotatorFactory {\r\n    createAnnotator(docService, pageService, viewer, options, type) {\r\n        if (!docService) {\r\n            throw new Error(\"Document service is not defined\");\r\n        }\r\n        if (!pageService) {\r\n            throw new Error(\"Page service is not defined\");\r\n        }\r\n        if (!viewer) {\r\n            throw new Error(\"Viewer is not defined\");\r\n        }\r\n        type || (type = this._lastType || \"highlight\");\r\n        this._lastType = type;\r\n        const color = (options === null || options === void 0 ? void 0 : options.color) || this._lastColor || [0, 0, 0, 0.9];\r\n        this._lastColor = color;\r\n        const strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || this._lastStrokeWidth || 2;\r\n        this._lastStrokeWidth = strokeWidth;\r\n        const combinedOptions = {\r\n            color,\r\n            strokeWidth,\r\n        };\r\n        switch (type) {\r\n            case \"note\":\r\n                return new TextNoteAnnotator(docService, pageService, viewer, combinedOptions);\r\n            case \"freeText\":\r\n                return new FreeTextAnnotator(docService, pageService, viewer, combinedOptions);\r\n            case \"freeTextCallout\":\r\n                return new FreeTextCalloutAnnotator(docService, pageService, viewer, combinedOptions);\r\n            case \"highlight\":\r\n                return new TextHighlightAnnotator(docService, pageService, viewer.container, combinedOptions);\r\n            case \"squiggly\":\r\n                return new TextSquigglyAnnotator(docService, pageService, viewer.container, combinedOptions);\r\n            case \"strikeout\":\r\n                return new TextStrikeoutAnnotator(docService, pageService, viewer.container, combinedOptions);\r\n            case \"underline\":\r\n                return new TextUnderlineAnnotator(docService, pageService, viewer.container, combinedOptions);\r\n            default:\r\n                throw new Error(`Invalid geometric annotator type: ${type}`);\r\n        }\r\n    }\r\n}\n\nclass AnnotatorService {\r\n    constructor(docService, pageService, customStampService, viewer) {\r\n        this._annotationColors = [\r\n            [0, 0, 0, 0.5],\r\n            [0.804, 0, 0, 0.5],\r\n            [0, 0.804, 0, 0.5],\r\n            [0, 0, 0.804, 0.5],\r\n            [1, 0.5, 0, 0.5],\r\n            [1, 0.2, 1, 0.5],\r\n        ];\r\n        this._strokeColor = this._annotationColors[0];\r\n        this._strokeWidth = 3;\r\n        this._stampType = supportedStampTypes[0].type;\r\n        this._geometricCloudMode = false;\r\n        this._geometricSubmode = geometricAnnotatorTypes[0];\r\n        this._textSubmode = textAnnotatorTypes[0];\r\n        this.onContextMenu = (event) => {\r\n            if (this._contextMenu.enabled) {\r\n                event.preventDefault();\r\n                this._contextMenu.show(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(event.clientX, event.clientY), this._viewer.container);\r\n            }\r\n        };\r\n        this.onPagesRendered = (event) => {\r\n            this._contextMenu.hide();\r\n        };\r\n        if (!docService) {\r\n            throw new Error(\"Document service is not defined\");\r\n        }\r\n        if (!pageService) {\r\n            throw new Error(\"Page service is not defined\");\r\n        }\r\n        if (!customStampService) {\r\n            throw new Error(\"Custom stamp service is not defined\");\r\n        }\r\n        if (!viewer) {\r\n            throw new Error(\"Viewer is not defined\");\r\n        }\r\n        this._docService = docService;\r\n        this._pageService = pageService;\r\n        this._customStampService = customStampService;\r\n        this._viewer = viewer;\r\n        this.init();\r\n    }\r\n    get mode() {\r\n        return this._mode;\r\n    }\r\n    set mode(value) {\r\n        this.setMode(value);\r\n    }\r\n    get annotator() {\r\n        return this._annotator;\r\n    }\r\n    destroy() {\r\n        var _a, _b, _c;\r\n        this._docService.eventService.removeListener(pagesRenderedEvent, this.onPagesRendered);\r\n        this._viewer.container.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n        (_a = this._viewerResizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();\r\n        (_b = this._contextMenu) === null || _b === void 0 ? void 0 : _b.destroy();\r\n        (_c = this._annotator) === null || _c === void 0 ? void 0 : _c.destroy();\r\n    }\r\n    init() {\r\n        this._docService.eventService.addListener(pagesRenderedEvent, this.onPagesRendered);\r\n        this._viewer.container.addEventListener(\"contextmenu\", this.onContextMenu);\r\n        const viewerRObserver = new ResizeObserver((entries) => {\r\n            var _a;\r\n            (_a = this._contextMenu) === null || _a === void 0 ? void 0 : _a.hide();\r\n        });\r\n        viewerRObserver.observe(this._viewer.container);\r\n        this._viewerResizeObserver = viewerRObserver;\r\n        this._contextMenu = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.ContextMenu();\r\n        this._geometricFactory = new GeometricAnnotatorFactory();\r\n        this._textFactory = new TextAnnotatorFactory();\r\n    }\r\n    setMode(mode) {\r\n        var _a;\r\n        mode || (mode = this._mode);\r\n        this._contextMenu.content = [];\r\n        (_a = this._annotator) === null || _a === void 0 ? void 0 : _a.destroy();\r\n        this._docService.setSelectedAnnotation(null);\r\n        this._mode = mode;\r\n        if (this._mode === \"text\"\r\n            && (this._textSubmode === \"highlight\"\r\n                || this._textSubmode === \"squiggly\"\r\n                || this._textSubmode === \"strikeout\"\r\n                || this._textSubmode === \"underline\")) {\r\n            this._viewer.container.classList.add(\"mode-text-markup\");\r\n        }\r\n        else {\r\n            this._viewer.container.classList.remove(\"mode-text-markup\");\r\n        }\r\n        switch (mode) {\r\n            case \"select\":\r\n                this._contextMenu.enabled = false;\r\n                return;\r\n            case \"stamp\":\r\n                this._annotator = new StampAnnotator(this._docService, this._pageService, this._viewer.container, this._stampType, this._stampCreationInfo);\r\n                break;\r\n            case \"pen\":\r\n                this._annotator = new PenAnnotator(this._docService, this._pageService, this._viewer.container, {\r\n                    strokeWidth: this._strokeWidth,\r\n                    color: this._strokeColor,\r\n                });\r\n                break;\r\n            case \"geometric\":\r\n                this._annotator = this._geometricFactory.createAnnotator(this._docService, this._pageService, this._viewer.container, {\r\n                    strokeWidth: this._strokeWidth,\r\n                    color: this._strokeColor,\r\n                    cloudMode: this._geometricCloudMode,\r\n                }, this._geometricSubmode);\r\n                break;\r\n            case \"text\":\r\n                this._strokeWidth = 2;\r\n                this._annotator = this._textFactory.createAnnotator(this._docService, this._pageService, this._viewer, {\r\n                    strokeWidth: this._strokeWidth,\r\n                    color: this._strokeColor,\r\n                }, this._textSubmode);\r\n                break;\r\n            default:\r\n                throw new Error(`Invalid annotation mode: ${mode}`);\r\n        }\r\n        const cmContent = this.buildContextMenuContent();\r\n        this._contextMenu.content = cmContent;\r\n        this._contextMenu.enabled = true;\r\n    }\r\n    buildContextMenuContent() {\r\n        switch (this._mode) {\r\n            case \"select\":\r\n                return [];\r\n            case \"stamp\":\r\n                return [\r\n                    this.buildCustomStampButtons(),\r\n                    this.buildStampTypePicker(),\r\n                ];\r\n            case \"pen\":\r\n                return [\r\n                    this.buildStrokeColorPicker(),\r\n                    this.buildStrokeWidthSlider(false),\r\n                ];\r\n            case \"geometric\":\r\n                return [\r\n                    this.buildGeometricSubmodePicker(),\r\n                    this.buildStrokeColorPicker(),\r\n                    this.buildStrokeWidthSlider(true),\r\n                ];\r\n            case \"text\":\r\n                return [\r\n                    this.buildTextSubmodePicker(),\r\n                    this.buildStrokeColorPicker(),\r\n                ];\r\n            default:\r\n                throw new Error(`Invalid annotation mode: ${this._mode}`);\r\n        }\r\n    }\r\n    buildCustomStampButtons() {\r\n        const buttonsContainer = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.htmlToElements(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.HtmlTemplates.stampContextButtonsHtml)[0];\r\n        buttonsContainer.querySelector(\".stamp-load-image\").addEventListener(\"click\", () => {\r\n            this._customStampService.startLoadingImage();\r\n        });\r\n        buttonsContainer.querySelector(\".stamp-draw-image\").addEventListener(\"click\", () => {\r\n            this._customStampService.startDrawing();\r\n        });\r\n        if (this._stampCreationInfo) {\r\n            const deleteButton = buttonsContainer.querySelector(\".stamp-delete\");\r\n            deleteButton.addEventListener(\"click\", () => {\r\n                this._customStampService.removeCustomStamp(this._stampType);\r\n            });\r\n            deleteButton.classList.remove(\"disabled\");\r\n        }\r\n        return buttonsContainer;\r\n    }\r\n    buildStampTypePicker() {\r\n        const stampTypes = supportedStampTypes;\r\n        const pickerDiv = document.createElement(\"div\");\r\n        pickerDiv.classList.add(\"context-menu-content\", \"column\");\r\n        [...stampTypes, ...this._customStampService.getCustomStamps()].forEach(x => {\r\n            const item = document.createElement(\"div\");\r\n            item.classList.add(\"context-menu-stamp-select-button\");\r\n            if (x.type === this._stampType) {\r\n                item.classList.add(\"on\");\r\n            }\r\n            item.addEventListener(\"click\", () => {\r\n                this._stampType = x.type;\r\n                if (x[\"imageData\"]) {\r\n                    this._stampCreationInfo = x;\r\n                }\r\n                else {\r\n                    this._stampCreationInfo = null;\r\n                }\r\n                this.setMode();\r\n            });\r\n            const stampName = document.createElement(\"div\");\r\n            stampName.innerHTML = x.name;\r\n            item.append(stampName);\r\n            pickerDiv.append(item);\r\n        });\r\n        return pickerDiv;\r\n    }\r\n    buildGeometricSubmodePicker() {\r\n        const submodePicker = document.createElement(\"div\");\r\n        submodePicker.classList.add(\"context-menu-content\", \"row\");\r\n        geometricAnnotatorTypes.forEach(x => {\r\n            const item = document.createElement(\"div\");\r\n            item.classList.add(\"panel-button\");\r\n            if (x === this._geometricSubmode) {\r\n                item.classList.add(\"on\");\r\n            }\r\n            item.addEventListener(\"click\", () => {\r\n                this._geometricSubmode = x;\r\n                this.setMode();\r\n            });\r\n            item.innerHTML = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.geometricIcons[x];\r\n            submodePicker.append(item);\r\n        });\r\n        return submodePicker;\r\n    }\r\n    buildTextSubmodePicker() {\r\n        const submodePicker = document.createElement(\"div\");\r\n        submodePicker.classList.add(\"context-menu-content\", \"row\");\r\n        textAnnotatorTypes.forEach(x => {\r\n            const item = document.createElement(\"div\");\r\n            item.classList.add(\"panel-button\");\r\n            if (x === this._textSubmode) {\r\n                item.classList.add(\"on\");\r\n            }\r\n            item.addEventListener(\"click\", () => {\r\n                this._textSubmode = x;\r\n                this.setMode();\r\n            });\r\n            item.innerHTML = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.textIcons[x];\r\n            submodePicker.append(item);\r\n        });\r\n        return submodePicker;\r\n    }\r\n    buildStrokeColorPicker() {\r\n        const colorPickerDiv = document.createElement(\"div\");\r\n        colorPickerDiv.classList.add(\"context-menu-content\", \"row\");\r\n        this._annotationColors.forEach(x => {\r\n            const item = document.createElement(\"div\");\r\n            item.classList.add(\"panel-button\");\r\n            if (x === this._strokeColor) {\r\n                item.classList.add(\"on\");\r\n            }\r\n            item.addEventListener(\"click\", () => {\r\n                this._strokeColor = x;\r\n                this.setMode();\r\n            });\r\n            const colorIcon = document.createElement(\"div\");\r\n            colorIcon.classList.add(\"context-menu-color-icon\");\r\n            colorIcon.style.backgroundColor = `rgb(${x[0] * 255},${x[1] * 255},${x[2] * 255})`;\r\n            item.append(colorIcon);\r\n            colorPickerDiv.append(item);\r\n        });\r\n        return colorPickerDiv;\r\n    }\r\n    buildStrokeWidthSlider(cloudButtons) {\r\n        const disableLineTypeButtons = !cloudButtons\r\n            || this._geometricSubmode === \"polyline\"\r\n            || this._geometricSubmode === \"line\"\r\n            || this._geometricSubmode === \"arrow\";\r\n        const div = document.createElement(\"div\");\r\n        div.classList.add(\"context-menu-content\", \"row\");\r\n        const cloudyLineButton = document.createElement(\"div\");\r\n        cloudyLineButton.classList.add(\"panel-button\");\r\n        if (disableLineTypeButtons) {\r\n            cloudyLineButton.classList.add(\"disabled\");\r\n        }\r\n        else {\r\n            if (this._geometricCloudMode) {\r\n                cloudyLineButton.classList.add(\"on\");\r\n            }\r\n            cloudyLineButton.addEventListener(\"click\", () => {\r\n                this._geometricCloudMode = true;\r\n                this.setMode();\r\n            });\r\n        }\r\n        cloudyLineButton.innerHTML = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.lineTypeIcons.cloudy;\r\n        div.append(cloudyLineButton);\r\n        const straightLineButton = document.createElement(\"div\");\r\n        straightLineButton.classList.add(\"panel-button\");\r\n        if (disableLineTypeButtons) {\r\n            straightLineButton.classList.add(\"disabled\");\r\n        }\r\n        else {\r\n            if (!this._geometricCloudMode) {\r\n                straightLineButton.classList.add(\"on\");\r\n            }\r\n            straightLineButton.addEventListener(\"click\", () => {\r\n                this._geometricCloudMode = false;\r\n                this.setMode();\r\n            });\r\n        }\r\n        straightLineButton.innerHTML = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Icons.lineTypeIcons.straight;\r\n        div.append(straightLineButton);\r\n        const slider = document.createElement(\"input\");\r\n        slider.setAttribute(\"type\", \"range\");\r\n        slider.setAttribute(\"min\", \"1\");\r\n        slider.setAttribute(\"max\", \"32\");\r\n        slider.setAttribute(\"step\", \"1\");\r\n        slider.setAttribute(\"value\", this._strokeWidth + \"\");\r\n        slider.classList.add(\"context-menu-slider\");\r\n        slider.addEventListener(\"change\", () => {\r\n            this._strokeWidth = slider.valueAsNumber;\r\n            this.setMode();\r\n        });\r\n        div.append(slider);\r\n        return div;\r\n    }\r\n}\n\nconst viewerModes = [\"text\", \"hand\", \"annotation\", \"comparison\"];\r\nclass ModeService {\r\n    constructor(options) {\r\n        this._onModeChangeStarted = new Set();\r\n        const modes = [];\r\n        viewerModes.forEach(x => {\r\n            var _a;\r\n            if (!((_a = options === null || options === void 0 ? void 0 : options.disabledModes) === null || _a === void 0 ? void 0 : _a.length)\r\n                || !options.disabledModes.includes(x)) {\r\n                modes.push(x);\r\n            }\r\n        });\r\n        if (!modes.length) {\r\n            throw new Error(\"All viewer modes are disabled\");\r\n        }\r\n        this.enabledModes = modes;\r\n    }\r\n    get mode() {\r\n        return this._mode;\r\n    }\r\n    set mode(value) {\r\n        var _a;\r\n        if ((_a = this._onModeChangeStarted) === null || _a === void 0 ? void 0 : _a.size) {\r\n            this._onModeChangeStarted.forEach(x => x());\r\n        }\r\n        if (!value || value === this._mode) {\r\n            return;\r\n        }\r\n        this._mode = value;\r\n    }\r\n    addOnModeChangeStarted(action) {\r\n        this._onModeChangeStarted.add(action);\r\n    }\r\n    removeOnModeChangeStarted(action) {\r\n        this._onModeChangeStarted.delete(action);\r\n    }\r\n}\n\nvar __awaiter$4 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass PdfLoaderService {\r\n    constructor(eventService) {\r\n        if (!eventService) {\r\n            throw new Error(\"Event controller is not defined\");\r\n        }\r\n        this._eventService = eventService;\r\n    }\r\n    get pageCount() {\r\n        var _a;\r\n        return ((_a = this._pdfDocument) === null || _a === void 0 ? void 0 : _a.numPages) || 0;\r\n    }\r\n    get docLoaded() {\r\n        return !!this._pdfDocument;\r\n    }\r\n    get docService() {\r\n        return this._docService;\r\n    }\r\n    get docProxy() {\r\n        return this._pdfDocument;\r\n    }\r\n    get fileName() {\r\n        return this._fileName;\r\n    }\r\n    destroy() {\r\n        var _a, _b;\r\n        (_a = this._pdfLoadingTask) === null || _a === void 0 ? void 0 : _a.destroy();\r\n        if (this._pdfDocument) {\r\n            this._pdfDocument.cleanup();\r\n            this._pdfDocument.destroy();\r\n        }\r\n        (_b = this._docService) === null || _b === void 0 ? void 0 : _b.destroy();\r\n    }\r\n    openPdfAsync(src, fileName, userName, getPasswordAsync, onProgress) {\r\n        var _a;\r\n        return __awaiter$4(this, void 0, void 0, function* () {\r\n            yield this.closePdfAsync();\r\n            let data;\r\n            let doc;\r\n            try {\r\n                data = yield ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.loadFileDataAsync(src);\r\n            }\r\n            catch (e) {\r\n                throw new Error(`Cannot load file data: ${e.message}`);\r\n            }\r\n            const docService = yield DocumentService.createNewAsync(this._eventService, data, userName);\r\n            let password;\r\n            while (true) {\r\n                const authenticated = docService.tryAuthenticate(password);\r\n                if (!authenticated) {\r\n                    password = yield getPasswordAsync();\r\n                    if (password === null) {\r\n                        throw new Error(\"File loading cancelled: authentication aborted\");\r\n                    }\r\n                    continue;\r\n                }\r\n                break;\r\n            }\r\n            try {\r\n                if (this._pdfLoadingTask) {\r\n                    yield this.closePdfAsync();\r\n                    return this.openPdfAsync(data, userName, fileName, getPasswordAsync, onProgress);\r\n                }\r\n                const dataWithoutAnnotations = yield docService.getDataWithoutSupportedAnnotationsAsync();\r\n                this._pdfLoadingTask = (0,pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__.getDocument)({\r\n                    data: dataWithoutAnnotations,\r\n                    password,\r\n                });\r\n                if (onProgress) {\r\n                    this._pdfLoadingTask.onProgress = onProgress;\r\n                }\r\n                doc = yield this._pdfLoadingTask.promise;\r\n                this._pdfLoadingTask = null;\r\n            }\r\n            catch (e) {\r\n                throw new Error(`Cannot open PDF: ${e.message}`);\r\n            }\r\n            this._pdfDocument = doc;\r\n            const pageMap = new Map();\r\n            for (let i = 0; i < doc.numPages; i++) {\r\n                const pageProxy = yield ((_a = this._pdfDocument) === null || _a === void 0 ? void 0 : _a.getPage(i + 1));\r\n                pageMap.set(i, pageProxy);\r\n            }\r\n            this._pdfPageProxies = pageMap;\r\n            this._docService = docService;\r\n            this._fileName = fileName;\r\n        });\r\n    }\r\n    closePdfAsync() {\r\n        var _a, _b;\r\n        return __awaiter$4(this, void 0, void 0, function* () {\r\n            if (this._pdfLoadingTask) {\r\n                if (!this._pdfLoadingTask.destroyed) {\r\n                    yield this._pdfLoadingTask.destroy();\r\n                }\r\n                this._pdfLoadingTask = null;\r\n            }\r\n            this._pdfPageProxies = null;\r\n            (_a = this._pdfDocument) === null || _a === void 0 ? void 0 : _a.destroy();\r\n            this._pdfDocument = null;\r\n            (_b = this._docService) === null || _b === void 0 ? void 0 : _b.destroy();\r\n            this._docService = null;\r\n            this._fileName = null;\r\n        });\r\n    }\r\n    getPage(pageIndex) {\r\n        var _a;\r\n        if (!((_a = this._pdfPageProxies) === null || _a === void 0 ? void 0 : _a.size)) {\r\n            return null;\r\n        }\r\n        return this._pdfPageProxies.get(pageIndex);\r\n    }\r\n}\n\nvar __awaiter$3 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass ComparisonService {\r\n    constructor() { }\r\n    destroy() { }\r\n    getComparisonResult() {\r\n        return this._comparisonResult;\r\n    }\r\n    getComparisonResultForPage(pageIndex) {\r\n        const comparisonResult = this.getComparisonResult();\r\n        return comparisonResult === null || comparisonResult === void 0 ? void 0 : comparisonResult.get(pageIndex);\r\n    }\r\n    clearComparisonResult() {\r\n        return this._comparisonResult = null;\r\n    }\r\n    compareAsync(subjectDocProxy, agentDocProxy) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            const result = new Map();\r\n            if (!subjectDocProxy || !agentDocProxy) {\r\n                return result;\r\n            }\r\n            const subjectPagesCount = subjectDocProxy.numPages;\r\n            const agentPagesCount = agentDocProxy.numPages;\r\n            for (let i = 0; i < subjectPagesCount; i++) {\r\n                const subjectPage = yield subjectDocProxy.getPage(i + 1);\r\n                const agentPage = i < agentPagesCount\r\n                    ? yield agentDocProxy.getPage(i + 1)\r\n                    : null;\r\n                const pageComparisonResult = yield this.comparePagesAsync(subjectPage, agentPage);\r\n                result.set(i, pageComparisonResult);\r\n            }\r\n            this._comparisonResult = result;\r\n            return this._comparisonResult;\r\n        });\r\n    }\r\n    comparePagesAsync(subjectPageProxy, agentPageProxy) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            const subjectImageData = yield this.renderPageAsync(subjectPageProxy);\r\n            const agentImageData = yield this.renderPageAsync(agentPageProxy);\r\n            const pageComparisonResult = yield this.compareImageDataAsync(subjectImageData, agentImageData);\r\n            return pageComparisonResult;\r\n        });\r\n    }\r\n    renderPageAsync(pageProxy) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            if (!pageProxy) {\r\n                return null;\r\n            }\r\n            const viewport = pageProxy.getViewport({ scale: 1, rotation: 0 });\r\n            const { width, height } = viewport;\r\n            const canvas = document.createElement(\"canvas\");\r\n            canvas.width = width;\r\n            canvas.height = height;\r\n            const canvasCtx = canvas.getContext(\"2d\");\r\n            const params = {\r\n                canvasContext: canvasCtx,\r\n                viewport: viewport,\r\n                enableWebGL: true,\r\n            };\r\n            const renderTask = pageProxy.render(params);\r\n            yield renderTask.promise;\r\n            const imageData = canvasCtx.getImageData(0, 0, width, height);\r\n            return imageData;\r\n        });\r\n    }\r\n    compareImageDataAsync(subjectImageData, agentImageData, threshold = 5) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            if (!subjectImageData) {\r\n                return [];\r\n            }\r\n            if (!agentImageData) {\r\n                return [[0, 0, subjectImageData.width, subjectImageData.height]];\r\n            }\r\n            const aabbs = [];\r\n            const sw = subjectImageData.width;\r\n            const sh = subjectImageData.height;\r\n            const aw = agentImageData.width;\r\n            const ah = agentImageData.height;\r\n            const sBytes = subjectImageData.data;\r\n            const aBytes = agentImageData.data;\r\n            let si;\r\n            let ai;\r\n            for (let x = 0; x < sw; x++) {\r\n                for (let y = 0; y < sh; y++) {\r\n                    if (x >= aw || y >= ah) {\r\n                        this.addPixelToAabbs(aabbs, x, y, threshold, sw, sh);\r\n                        continue;\r\n                    }\r\n                    si = (sw * y + x) * 4;\r\n                    ai = (aw * y + x) * 4;\r\n                    if (sBytes[si] !== aBytes[ai]\r\n                        || sBytes[si + 1] !== aBytes[ai + 1]\r\n                        || sBytes[si + 2] !== aBytes[ai + 2]\r\n                        || sBytes[si + 3] !== aBytes[ai + 3]) {\r\n                        this.addPixelToAabbs(aabbs, x, y, threshold, sw, sh);\r\n                    }\r\n                }\r\n            }\r\n            const mergedAabbs = this.mergeIntersectingAabbs(aabbs);\r\n            return mergedAabbs;\r\n        });\r\n    }\r\n    addPixelToAabbs(aabbs, x, y, threshold, pageWidth, pageHeight) {\r\n        let merged;\r\n        const cxmin = Math.max(x - threshold, 0);\r\n        const cymin = Math.max(y - threshold, 0);\r\n        const cxmax = Math.min(x + threshold, pageWidth);\r\n        const cymax = Math.min(y + threshold, pageHeight);\r\n        for (let j = 0; j < aabbs.length; j++) {\r\n            const [mxmin, mymin, mxmax, mymax] = aabbs[j];\r\n            if (Math.max(cxmin, mxmin) < Math.min(cxmax, mxmax)\r\n                && Math.max(cymin, mymin) < Math.min(cymax, mymax)) {\r\n                aabbs[j] = [Math.min(cxmin, mxmin), Math.min(cymin, mymin),\r\n                    Math.max(cxmax, mxmax), Math.max(cymax, mymax)];\r\n                merged = true;\r\n                break;\r\n            }\r\n        }\r\n        if (!merged) {\r\n            aabbs.push([cxmin, cymin, cxmax, cymax]);\r\n        }\r\n    }\r\n    compareImageDataDbscanAsync(subjectImageData, agentImageData, threshold = 10) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            if (!subjectImageData) {\r\n                return [];\r\n            }\r\n            if (!agentImageData) {\r\n                return [[0, 0, subjectImageData.width, subjectImageData.height]];\r\n            }\r\n            const changedPixels = this.getChangedPixels(subjectImageData, agentImageData);\r\n            if (changedPixels.length > this._maxChangedPixels) {\r\n                return [[0, 0, subjectImageData.width, subjectImageData.height]];\r\n            }\r\n            const clusters = yield DBSCAN.runAsync(changedPixels, threshold, 1);\r\n            const aabbs = this.convertClustersToAabbs(clusters);\r\n            const mergedAabbs = this.mergeIntersectingAabbs(aabbs);\r\n            return mergedAabbs;\r\n        });\r\n    }\r\n    getChangedPixels(subjectImageData, agentImageData) {\r\n        const sw = subjectImageData.width;\r\n        const sh = subjectImageData.height;\r\n        const aw = agentImageData.width;\r\n        const ah = agentImageData.height;\r\n        const sBytes = subjectImageData.data;\r\n        const aBytes = agentImageData.data;\r\n        const changedPixels = [];\r\n        let si;\r\n        let ai;\r\n        for (let x = 0; x < sw; x++) {\r\n            for (let y = 0; y < sh; y++) {\r\n                if (x >= aw || y >= ah) {\r\n                    changedPixels.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x, y));\r\n                    continue;\r\n                }\r\n                si = (sw * y + x) * 4;\r\n                ai = (aw * y + x) * 4;\r\n                if (sBytes[si] !== aBytes[ai]\r\n                    || sBytes[si + 1] !== aBytes[ai + 1]\r\n                    || sBytes[si + 2] !== aBytes[ai + 2]\r\n                    || sBytes[si + 3] !== aBytes[ai + 3]) {\r\n                    changedPixels.push(new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x, y));\r\n                }\r\n            }\r\n        }\r\n        return changedPixels;\r\n    }\r\n    convertClustersToAabbs(clusters) {\r\n        const aabbs = [];\r\n        for (const cluster of clusters) {\r\n            if (!(cluster === null || cluster === void 0 ? void 0 : cluster.length)) {\r\n                continue;\r\n            }\r\n            let aabb;\r\n            for (const vec of cluster) {\r\n                if (!aabb) {\r\n                    aabb = [vec.x, vec.y, vec.x, vec.y];\r\n                    continue;\r\n                }\r\n                if (vec.x < aabb[0]) {\r\n                    aabb[0] = vec.x;\r\n                }\r\n                else if (vec.x > aabb[2]) {\r\n                    aabb[2] = vec.x;\r\n                }\r\n                if (vec.y < aabb[1]) {\r\n                    aabb[1] = vec.y;\r\n                }\r\n                else if (vec.y > aabb[3]) {\r\n                    aabb[3] = vec.y;\r\n                }\r\n            }\r\n            aabbs.push(aabb);\r\n        }\r\n        return aabbs;\r\n    }\r\n    mergeIntersectingAabbs(aabbs) {\r\n        const mergedAabbs = [];\r\n        for (const [cxmin, cymin, cxmax, cymax] of aabbs) {\r\n            let merged;\r\n            for (let j = 0; j < mergedAabbs.length; j++) {\r\n                const [mxmin, mymin, mxmax, mymax] = mergedAabbs[j];\r\n                if (Math.max(cxmin, mxmin) < Math.min(cxmax, mxmax)\r\n                    && Math.max(cymin, mymin) < Math.min(cymax, mymax)) {\r\n                    mergedAabbs[j] = [Math.min(cxmin, mxmin), Math.min(cymin, mymin),\r\n                        Math.max(cxmax, mxmax), Math.max(cymax, mymax)];\r\n                    merged = true;\r\n                    break;\r\n                }\r\n            }\r\n            if (!merged) {\r\n                mergedAabbs.push([cxmin, cymin, cxmax, cymax]);\r\n            }\r\n        }\r\n        return mergedAabbs;\r\n    }\r\n}\r\nclass DBSCAN {\r\n    constructor(points, distance, minPoints) {\r\n        this._clusters = [];\r\n        this._noise = [];\r\n        this._points = points !== null && points !== void 0 ? points : [];\r\n        this._distance = Math.max(distance, 0) || 1;\r\n        this._minPoints = Math.max(minPoints, 1);\r\n        this._visited = new Array(points.length);\r\n        this._assigned = new Array(points.length);\r\n    }\r\n    static runAsync(points, epsilon, minPoints) {\r\n        return __awaiter$3(this, void 0, void 0, function* () {\r\n            const dbScan = new DBSCAN(points, epsilon !== null && epsilon !== void 0 ? epsilon : 1, minPoints !== null && minPoints !== void 0 ? minPoints : 1);\r\n            return dbScan.runClustering();\r\n        });\r\n    }\r\n    runClustering() {\r\n        if (!this._points.length) {\r\n            return [];\r\n        }\r\n        for (let pointId = 0; pointId < this._points.length; pointId++) {\r\n            if (!this._visited[pointId]) {\r\n                this._visited[pointId] = true;\r\n                const neighbours = this.getPointNeighbourIds(pointId);\r\n                if (neighbours.length < this._minPoints) {\r\n                    this._noise.push(pointId);\r\n                }\r\n                else {\r\n                    const clusterId = this._clusters.length;\r\n                    this._clusters.push([]);\r\n                    this.addPointToCluster(pointId, clusterId);\r\n                    this.expandCluster(clusterId, neighbours);\r\n                }\r\n            }\r\n        }\r\n        return this._clusters;\r\n    }\r\n    ;\r\n    expandCluster(clusterId, neighbours) {\r\n        for (let i = 0; i < neighbours.length; i++) {\r\n            const neighbourPoint = neighbours[i];\r\n            if (!this._visited[neighbourPoint]) {\r\n                this._visited[neighbourPoint] = true;\r\n                const newNeighbours = this.getPointNeighbourIds(neighbourPoint);\r\n                if (newNeighbours.length >= this._minPoints) {\r\n                    neighbours.push(...newNeighbours);\r\n                }\r\n            }\r\n            if (!this._assigned[neighbourPoint]) {\r\n                this.addPointToCluster(neighbourPoint, clusterId);\r\n            }\r\n        }\r\n    }\r\n    ;\r\n    addPointToCluster(pointId, clusterId) {\r\n        this._clusters[clusterId].push(this._points[pointId]);\r\n        this._assigned[pointId] = true;\r\n    }\r\n    ;\r\n    getPointNeighbourIds(pointId) {\r\n        const neighbours = [];\r\n        for (let i = 0; i < this._points.length; i++) {\r\n            const dist = mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2.getDistance(this._points[pointId], this._points[i]);\r\n            if (dist < this._distance) {\r\n                neighbours.push(i);\r\n            }\r\n        }\r\n        return neighbours;\r\n    }\r\n    ;\r\n}\n\nvar __awaiter$2 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst docChangeEvent = \"tspdf-docchangeevent\";\r\nclass DocChangeEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(docChangeEvent, { detail });\r\n    }\r\n}\r\nclass DocManagerService {\r\n    constructor(mainEventService) {\r\n        this._dummyDiv = document.createElement(\"div\");\r\n        if (!mainEventService) {\r\n            throw new Error(\"Main event service is not defined\");\r\n        }\r\n        this._eventService = mainEventService;\r\n        this._docLoaders = {\r\n            main: new PdfLoaderService(mainEventService),\r\n            compared: new PdfLoaderService(new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.EventService(this._dummyDiv)),\r\n        };\r\n        this._comparisonService = new ComparisonService();\r\n    }\r\n    get comparisonService() {\r\n        return this._comparisonService;\r\n    }\r\n    get docService() {\r\n        return this._docLoaders.main.docService;\r\n    }\r\n    get pageCount() {\r\n        return this._docLoaders.main.pageCount;\r\n    }\r\n    get docLoaded() {\r\n        return this._docLoaders.main.docLoaded;\r\n    }\r\n    get fileName() {\r\n        return this._docLoaders.main.fileName;\r\n    }\r\n    destroy() {\r\n        this._comparisonService.destroy();\r\n        Object.keys(this._docLoaders).forEach(key => {\r\n            this._docLoaders[key].destroy();\r\n        });\r\n    }\r\n    openPdfAsync(type, src, fileName, userName, getPasswordAsync, onProgress) {\r\n        return __awaiter$2(this, void 0, void 0, function* () {\r\n            yield this._docLoaders[type].openPdfAsync(src, fileName, userName, getPasswordAsync, onProgress);\r\n            if (type === \"main\") {\r\n                yield this.closePdfAsync(\"compared\");\r\n                this._eventService.dispatchEvent(new DocChangeEvent({ action: \"open\", type: \"main\" }));\r\n            }\r\n            else if (type === \"compared\") {\r\n                yield this._comparisonService.compareAsync(this._docLoaders.main.docProxy, this._docLoaders.compared.docProxy);\r\n                this._eventService.dispatchEvent(new DocChangeEvent({ action: \"open\", type: \"compared\" }));\r\n            }\r\n        });\r\n    }\r\n    closePdfAsync(type) {\r\n        return __awaiter$2(this, void 0, void 0, function* () {\r\n            yield this._docLoaders[type].closePdfAsync();\r\n            if (type === \"main\") {\r\n                yield this.closePdfAsync(\"compared\");\r\n                this._eventService.dispatchEvent(new DocChangeEvent({ action: \"close\", type: \"main\" }));\r\n            }\r\n            else if (type === \"compared\") {\r\n                yield this._comparisonService.clearComparisonResult();\r\n                this._eventService.dispatchEvent(new DocChangeEvent({ action: \"close\", type: \"compared\" }));\r\n            }\r\n        });\r\n    }\r\n    getPageProxy(type, pageIndex) {\r\n        return this._docLoaders[type].getPage(pageIndex);\r\n    }\r\n    getComparisonResultForPage(pageIndex) {\r\n        return this._comparisonService.getComparisonResultForPage(pageIndex);\r\n    }\r\n}\n\nvar __awaiter$1 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass Viewer {\r\n    constructor(modeService, pageService, container, options) {\r\n        this._scale = 1;\r\n        this._pointerInfo = {\r\n            lastPos: null,\r\n            downPos: null,\r\n            downScroll: null,\r\n        };\r\n        this._pinchInfo = {\r\n            active: false,\r\n            lastDist: 0,\r\n            minDist: 10,\r\n            sensitivity: 0.025,\r\n            target: null,\r\n        };\r\n        this.onPagesLoaded = (event) => {\r\n            var _a;\r\n            (_a = event.detail.pages) === null || _a === void 0 ? void 0 : _a.forEach(x => {\r\n                x.scale = this._scale;\r\n                this._container.append(x.viewContainer);\r\n            });\r\n            this.renderVisible();\r\n        };\r\n        this.onScrollRequest = (event) => {\r\n            this.scrollToPage(event.detail.pageIndex);\r\n        };\r\n        this.onPointerMove = (event) => {\r\n            const { clientX, clientY } = event;\r\n            this._pointerInfo.lastPos = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(clientX, clientY);\r\n        };\r\n        this.onScroll = (e) => {\r\n            this.renderVisible();\r\n        };\r\n        this.onPointerDownScroll = (e) => {\r\n            if (this._modeService.mode !== \"hand\") {\r\n                return;\r\n            }\r\n            const { clientX, clientY } = e;\r\n            this._pointerInfo.downPos = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(clientX, clientY);\r\n            this._pointerInfo.downScroll = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(this._container.scrollLeft, this._container.scrollTop);\r\n            const onPointerMove = (moveEvent) => {\r\n                const { x, y } = this._pointerInfo.downPos;\r\n                const { x: left, y: top } = this._pointerInfo.downScroll;\r\n                const dX = moveEvent.clientX - x;\r\n                const dY = moveEvent.clientY - y;\r\n                this._container.scrollTo(left - dX, top - dY);\r\n            };\r\n            const onPointerUp = (upEvent) => {\r\n                this._pointerInfo.downPos = null;\r\n                this._pointerInfo.downScroll = null;\r\n                const upTarget = upEvent.target;\r\n                upTarget.removeEventListener(\"pointermove\", onPointerMove);\r\n                upTarget.removeEventListener(\"pointerup\", onPointerUp);\r\n                upTarget.removeEventListener(\"pointerout\", onPointerUp);\r\n                upTarget.releasePointerCapture(upEvent.pointerId);\r\n            };\r\n            const target = e.target;\r\n            target.setPointerCapture(e.pointerId);\r\n            target.addEventListener(\"pointermove\", onPointerMove);\r\n            target.addEventListener(\"pointerup\", onPointerUp);\r\n            target.addEventListener(\"pointerout\", onPointerUp);\r\n        };\r\n        this.onWheelZoom = (event) => {\r\n            if (!event.ctrlKey) {\r\n                return;\r\n            }\r\n            event.preventDefault();\r\n            if (event.deltaY > 0) {\r\n                this.zoomOutCentered(this._pointerInfo.lastPos);\r\n            }\r\n            else {\r\n                this.zoomInCentered(this._pointerInfo.lastPos);\r\n            }\r\n        };\r\n        this.onTouchZoom = (event) => {\r\n            if (event.touches.length !== 2) {\r\n                return;\r\n            }\r\n            const a = event.touches[0];\r\n            const b = event.touches[1];\r\n            this._pinchInfo.active = true;\r\n            this._pinchInfo.lastDist = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.getDistance2D)(a.clientX, a.clientY, b.clientX, b.clientY);\r\n            const onTouchMove = (moveEvent) => {\r\n                if (moveEvent.touches.length !== 2) {\r\n                    return;\r\n                }\r\n                const mA = moveEvent.touches[0];\r\n                const mB = moveEvent.touches[1];\r\n                const dist = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.getDistance2D)(mA.clientX, mA.clientY, mB.clientX, mB.clientY);\r\n                const delta = dist - this._pinchInfo.lastDist;\r\n                const factor = Math.floor(delta / this._pinchInfo.minDist);\r\n                if (factor) {\r\n                    const center = new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2((mB.clientX + mA.clientX) / 2, (mB.clientY + mA.clientY) / 2);\r\n                    this._pinchInfo.lastDist = dist;\r\n                    this.zoom(factor * this._pinchInfo.sensitivity, center);\r\n                }\r\n            };\r\n            const onTouchEnd = (endEvent) => {\r\n                this._pinchInfo.active = false;\r\n                this._pinchInfo.lastDist = 0;\r\n                event.target.removeEventListener(\"touchmove\", onTouchMove);\r\n                event.target.removeEventListener(\"touchend\", onTouchEnd);\r\n                event.target.removeEventListener(\"touchcancel\", onTouchEnd);\r\n            };\r\n            event.target.addEventListener(\"touchmove\", onTouchMove);\r\n            event.target.addEventListener(\"touchend\", onTouchEnd);\r\n            event.target.addEventListener(\"touchcancel\", onTouchEnd);\r\n        };\r\n        if (!modeService) {\r\n            throw new Error(\"Mode service is not defined\");\r\n        }\r\n        if (!pageService) {\r\n            throw new Error(\"Page service is not defined\");\r\n        }\r\n        if (!container) {\r\n            throw new Error(\"Container is not defined\");\r\n        }\r\n        this._modeService = modeService;\r\n        this._pageService = pageService;\r\n        this._container = container;\r\n        this._minScale = (options === null || options === void 0 ? void 0 : options.minScale) || 0.25;\r\n        this._maxScale = (options === null || options === void 0 ? void 0 : options.maxScale) || 4;\r\n        this._modeService.addOnModeChangeStarted(() => {\r\n            if (this === null || this === void 0 ? void 0 : this._dialogClose) {\r\n                this._dialogClose();\r\n            }\r\n        });\r\n        this.init();\r\n    }\r\n    get container() {\r\n        return this._container;\r\n    }\r\n    get scale() {\r\n        return this._scale;\r\n    }\r\n    destroy() {\r\n        this._pageService.eventService.removeListener(pagesLoadedEvent, this.onPagesLoaded);\r\n        this._pageService.eventService.removeListener(currentPageChangeRequestEvent, this.onScrollRequest);\r\n        this._container.removeEventListener(\"scroll\", this.onScroll);\r\n        this._container.removeEventListener(\"wheel\", this.onWheelZoom);\r\n        this._container.removeEventListener(\"pointermove\", this.onPointerMove);\r\n        this._container.removeEventListener(\"pointerdown\", this.onPointerDownScroll);\r\n        this._container.removeEventListener(\"touchstart\", this.onTouchZoom);\r\n    }\r\n    zoomOut() {\r\n        this.zoomOutCentered();\r\n    }\r\n    zoomIn() {\r\n        this.zoomInCentered();\r\n    }\r\n    zoomFitViewer() {\r\n        const cWidth = this._container.getBoundingClientRect().width;\r\n        const pWidth = this._pageService.getCurrentPage().viewContainer.getBoundingClientRect().width;\r\n        const scale = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)((cWidth - 20) / pWidth * this._scale, this._minScale, this._maxScale);\r\n        this.setScale(scale);\r\n        this.scrollToPage(this._pageService.currentPageIndex);\r\n    }\r\n    zoomFitPage() {\r\n        const { width: cWidth, height: cHeight } = this._container.getBoundingClientRect();\r\n        const { width: pWidth, height: pHeight } = this._pageService.getCurrentPage().viewContainer.getBoundingClientRect();\r\n        const hScale = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)((cWidth - 20) / pWidth * this._scale, this._minScale, this._maxScale);\r\n        const vScale = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)((cHeight - 20) / pHeight * this._scale, this._minScale, this._maxScale);\r\n        this.setScale(Math.min(hScale, vScale));\r\n        this.scrollToPage(this._pageService.currentPageIndex);\r\n    }\r\n    renderVisible(force) {\r\n        this._pageService.renderVisiblePages(this._container, force);\r\n    }\r\n    showTextDialogAsync(initialText) {\r\n        return __awaiter$1(this, void 0, void 0, function* () {\r\n            if (this._dialogClose) {\r\n                return;\r\n            }\r\n            const dialog = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.htmlToElements(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.HtmlTemplates.textDialogHtml)[0];\r\n            dialog.style.top = this._container.scrollTop + \"px\";\r\n            dialog.style.left = this._container.scrollLeft + \"px\";\r\n            this._container.append(dialog);\r\n            this._container.classList.add(\"dialog-shown\");\r\n            let value = initialText || \"\";\r\n            const input = dialog.querySelector(\".text-input\");\r\n            input.placeholder = \"Enter text...\";\r\n            input.value = value;\r\n            input.addEventListener(\"change\", () => value = input.value);\r\n            const textPromise = new Promise((resolve, reject) => {\r\n                const ok = () => {\r\n                    resolve(value || \"\");\r\n                };\r\n                const cancel = () => {\r\n                    resolve(null);\r\n                };\r\n                dialog.addEventListener(\"click\", (e) => {\r\n                    if (e.target === dialog) {\r\n                        cancel();\r\n                    }\r\n                });\r\n                dialog.querySelector(\".text-ok\").addEventListener(\"click\", ok);\r\n                dialog.querySelector(\".text-cancel\").addEventListener(\"click\", cancel);\r\n                this._dialogClose = () => resolve(null);\r\n            });\r\n            const result = yield textPromise;\r\n            this._dialogClose = null;\r\n            dialog.remove();\r\n            this._container.classList.remove(\"dialog-shown\");\r\n            return result;\r\n        });\r\n    }\r\n    scrollToPage(pageNumber) {\r\n        if (!this._pageService.pages.length) {\r\n            return;\r\n        }\r\n        const { top: cTop } = this._container.getBoundingClientRect();\r\n        const { top: pTop } = this._pageService.getPage(pageNumber).viewContainer.getBoundingClientRect();\r\n        const scroll = pTop - (cTop - this._container.scrollTop) - 20;\r\n        this._container.scrollTo(this._container.scrollLeft, scroll);\r\n    }\r\n    init() {\r\n        this._container.addEventListener(\"scroll\", this.onScroll);\r\n        this._container.addEventListener(\"wheel\", this.onWheelZoom, { passive: false });\r\n        this._container.addEventListener(\"pointermove\", this.onPointerMove);\r\n        this._container.addEventListener(\"pointerdown\", this.onPointerDownScroll);\r\n        this._container.addEventListener(\"touchstart\", this.onTouchZoom);\r\n        this._pageService.eventService.addListener(pagesLoadedEvent, this.onPagesLoaded);\r\n        this._pageService.eventService.addListener(currentPageChangeRequestEvent, this.onScrollRequest);\r\n    }\r\n    setScale(scale, cursorPosition = null) {\r\n        if (!scale || scale === this._scale) {\r\n            return;\r\n        }\r\n        let pageContainerUnderPivot;\r\n        let xPageRatio;\r\n        let yPageRatio;\r\n        if (cursorPosition) {\r\n            for (const page of this._pageService.pages) {\r\n                const { x: x, y: y } = cursorPosition;\r\n                const { x: pX, y: pY, width: pWidth, height: pHeight } = page.viewContainer.getBoundingClientRect();\r\n                if (pX <= x\r\n                    && pX + pWidth >= x\r\n                    && pY <= y\r\n                    && pY + pHeight >= y) {\r\n                    pageContainerUnderPivot = page.viewContainer;\r\n                    xPageRatio = (x - pX) / pWidth;\r\n                    yPageRatio = (y - pY) / pHeight;\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n        this._scale = scale;\r\n        this._pageService.scale = scale;\r\n        if (pageContainerUnderPivot\r\n            &&\r\n                (this._container.scrollHeight > this._container.clientHeight\r\n                    || this._container.scrollWidth > this._container.clientWidth)) {\r\n            const { x: initialX, y: initialY } = cursorPosition;\r\n            const { x: pX, y: pY, width: pWidth, height: pHeight } = pageContainerUnderPivot.getBoundingClientRect();\r\n            const resultX = pX + (pWidth * xPageRatio);\r\n            const resultY = pY + (pHeight * yPageRatio);\r\n            let scrollLeft = this._container.scrollLeft + (resultX - initialX);\r\n            let scrollTop = this._container.scrollTop + (resultY - initialY);\r\n            scrollLeft = scrollLeft < 0\r\n                ? 0\r\n                : scrollLeft;\r\n            scrollTop = scrollTop < 0\r\n                ? 0\r\n                : scrollTop;\r\n            if (scrollTop !== this._container.scrollTop\r\n                || scrollLeft !== this._container.scrollLeft) {\r\n                this._container.scrollTo(scrollLeft, scrollTop);\r\n                return;\r\n            }\r\n        }\r\n        setTimeout(() => this.renderVisible(), 0);\r\n    }\r\n    zoom(diff, cursorPosition = null) {\r\n        const scale = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)(this._scale + diff, this._minScale, this._maxScale);\r\n        this.setScale(scale, cursorPosition || this.getCenterPosition());\r\n    }\r\n    zoomOutCentered(center = null) {\r\n        this.zoom(-0.25, center);\r\n    }\r\n    zoomInCentered(center = null) {\r\n        this.zoom(0.25, center);\r\n    }\r\n    getCenterPosition() {\r\n        const { x, y, width, height } = this._container.getBoundingClientRect();\r\n        return new mathador__WEBPACK_IMPORTED_MODULE_1__.Vec2(x + width / 2, y + height / 2);\r\n    }\r\n}\n\nclass Previewer {\r\n    constructor(pageService, container) {\r\n        this._hidden = true;\r\n        this.onPagesLoaded = (event) => {\r\n            var _a;\r\n            (_a = event.detail.pages) === null || _a === void 0 ? void 0 : _a.forEach(x => {\r\n                x.previewContainer.addEventListener(\"click\", this.onPreviewerPageClick);\r\n                this._container.append(x.previewContainer);\r\n            });\r\n            this.renderVisible();\r\n        };\r\n        this.onCurrentPageChanged = (event) => {\r\n            this.scrollToPreview(event.detail.newIndex);\r\n        };\r\n        this.onPreviewerPageClick = (e) => {\r\n            let target = e.target;\r\n            let pageNumber;\r\n            while (target && !pageNumber) {\r\n                const data = target.dataset[\"pageNumber\"];\r\n                if (data) {\r\n                    pageNumber = +data;\r\n                }\r\n                else {\r\n                    target = target.parentElement;\r\n                }\r\n            }\r\n            if (pageNumber) {\r\n                this._pageService.requestSetCurrentPageIndex(pageNumber - 1);\r\n            }\r\n        };\r\n        this.onPreviewerScroll = (e) => {\r\n            this.renderVisible();\r\n        };\r\n        if (!pageService) {\r\n            throw new Error(\"Page service is not defined\");\r\n        }\r\n        if (!container) {\r\n            throw new Error(\"Container is not defined\");\r\n        }\r\n        this._pageService = pageService;\r\n        this._container = container;\r\n        this.init();\r\n    }\r\n    get hidden() {\r\n        return this._hidden;\r\n    }\r\n    destroy() {\r\n        this._pageService.eventService.removeListener(pagesLoadedEvent, this.onPagesLoaded);\r\n        this._pageService.eventService.removeListener(currentPageChangeEvent, this.onCurrentPageChanged);\r\n    }\r\n    show() {\r\n        this._hidden = false;\r\n        setTimeout(() => this.renderVisible(), 1000);\r\n    }\r\n    hide() {\r\n        this._hidden = true;\r\n    }\r\n    renderVisible() {\r\n        if (this._hidden) {\r\n            return;\r\n        }\r\n        this._pageService.renderVisiblePreviews(this._container);\r\n    }\r\n    init() {\r\n        this._container.addEventListener(\"scroll\", this.onPreviewerScroll);\r\n        this._pageService.eventService.addListener(pagesLoadedEvent, this.onPagesLoaded);\r\n        this._pageService.eventService.addListener(currentPageChangeEvent, this.onCurrentPageChanged);\r\n    }\r\n    scrollToPreview(pageIndex) {\r\n        if (!this._pageService.pages.length) {\r\n            return;\r\n        }\r\n        const { top: cTop, height: cHeight } = this._container.getBoundingClientRect();\r\n        const { top: pTop, height: pHeight } = this._pageService.getPage(pageIndex).previewContainer.getBoundingClientRect();\r\n        const cCenter = cTop + cHeight / 2;\r\n        const pCenter = pTop + pHeight / 2;\r\n        const scroll = pCenter - cCenter + this._container.scrollTop;\r\n        this._container.scrollTo(0, scroll);\r\n    }\r\n}\n\nvar __awaiter = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass TsPdfViewer {\r\n    constructor(options) {\r\n        this._timers = {\r\n            hidePanels: 0,\r\n        };\r\n        this.onTextSelectionChange = () => {\r\n            const selection = this._shadowRoot.getSelection();\r\n            if (!selection.rangeCount) {\r\n                return;\r\n            }\r\n            if (this._eventService.hasListenersForKey(textSelectionChangeEvent)) {\r\n                const selectionInfos = getSelectionInfosFromSelection(selection);\r\n                this._eventService.dispatchEvent(new TextSelectionChangeEvent({ selectionInfos }));\r\n            }\r\n        };\r\n        this.onFileInput = () => {\r\n            const files = this._fileInput.files;\r\n            if (files.length === 0) {\r\n                return;\r\n            }\r\n            this.openDocAsync(\"main\", files[0], files[0].name);\r\n            this._fileInput.value = null;\r\n        };\r\n        this.onOpenFileButtonClick = () => {\r\n            this._fileInput.click();\r\n        };\r\n        this.onSaveFileButtonClickAsync = () => __awaiter(this, void 0, void 0, function* () {\r\n            var _a;\r\n            const blob = yield this.getCurrentPdfAsync();\r\n            if (!blob) {\r\n                return;\r\n            }\r\n            ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.downloadFile(blob, ((_a = this._docManagerService) === null || _a === void 0 ? void 0 : _a.fileName)\r\n                || `file_${new Date().toISOString()}.pdf`);\r\n        });\r\n        this.onCloseFileButtonClick = () => {\r\n            this.closeDocAsync(\"main\");\r\n        };\r\n        this.onComparableFileInput = () => {\r\n            const files = this._comparableFileInput.files;\r\n            if (files.length === 0) {\r\n                return;\r\n            }\r\n            this.openDocAsync(\"compared\", files[0], files[0].name);\r\n            this._comparableFileInput.value = null;\r\n        };\r\n        this.onComparableOpenFileButtonClick = () => {\r\n            this._comparableFileInput.click();\r\n        };\r\n        this.onComparableCloseFileButtonClick = () => {\r\n            this.closeDocAsync(\"compared\");\r\n        };\r\n        this.onViewerModeButtonClick = (e) => {\r\n            const parentButton = e.target.closest(\"*[id^=\\\"button-mode-\\\"]\");\r\n            if (!parentButton) {\r\n                return;\r\n            }\r\n            const mode = /button-mode-(.+)/.exec(parentButton.id)[1];\r\n            this.setMode(mode);\r\n        };\r\n        this.onZoomOutClick = () => {\r\n            this._viewer.zoomOut();\r\n        };\r\n        this.onZoomInClick = () => {\r\n            this._viewer.zoomIn();\r\n        };\r\n        this.onZoomFitViewerClick = () => {\r\n            this._viewer.zoomFitViewer();\r\n        };\r\n        this.onZoomFitPageClick = () => {\r\n            this._viewer.zoomFitPage();\r\n        };\r\n        this.onRotateCounterClockwiseClick = () => {\r\n            this.rotateCounterClockwise();\r\n        };\r\n        this.onRotateClockwiseClick = () => {\r\n            this.rotateClockwise();\r\n        };\r\n        this.onPaginatorInput = (event) => {\r\n            if (event.target instanceof HTMLInputElement) {\r\n                event.target.value = event.target.value.replace(/[^\\d]+/g, \"\");\r\n            }\r\n        };\r\n        this.onPaginatorChange = (event) => {\r\n            if (event.target instanceof HTMLInputElement) {\r\n                const pageNumber = Math.max(Math.min(+event.target.value, this._docManagerService.pageCount), 1);\r\n                if (pageNumber + \"\" !== event.target.value) {\r\n                    event.target.value = pageNumber + \"\";\r\n                }\r\n                this._pageService.requestSetCurrentPageIndex(pageNumber - 1);\r\n            }\r\n        };\r\n        this.onPaginatorPrevClick = () => {\r\n            this.moveToPrevPage();\r\n        };\r\n        this.onPaginatorNextClick = () => {\r\n            this.moveToNextPage();\r\n        };\r\n        this.onCurrentPagesChanged = (event) => {\r\n            const { newIndex } = event.detail;\r\n            this._shadowRoot.getElementById(\"paginator-input\").value = newIndex + 1 + \"\";\r\n        };\r\n        this.annotatorUndo = () => {\r\n            var _a;\r\n            (_a = this._annotatorService.annotator) === null || _a === void 0 ? void 0 : _a.undo();\r\n        };\r\n        this.annotatorClear = () => {\r\n            var _a;\r\n            (_a = this._annotatorService.annotator) === null || _a === void 0 ? void 0 : _a.clear();\r\n        };\r\n        this.annotatorSave = () => {\r\n            var _a;\r\n            (_a = this._annotatorService.annotator) === null || _a === void 0 ? void 0 : _a.saveAnnotationAsync();\r\n        };\r\n        this.onCustomStampChanged = (e) => {\r\n            this.setAnnotationMode(\"stamp\");\r\n            if (this._customStampChangeCallback) {\r\n                this._customStampChangeCallback(e.detail);\r\n            }\r\n        };\r\n        this.onAnnotationChange = (e) => {\r\n            if (!e.detail) {\r\n                return;\r\n            }\r\n            const annotations = e.detail.annotations;\r\n            switch (e.detail.type) {\r\n                case \"focus\":\r\n                    if (annotations === null || annotations === void 0 ? void 0 : annotations.length) {\r\n                        this._mainContainer.classList.add(\"annotation-focused\");\r\n                    }\r\n                    else {\r\n                        this._mainContainer.classList.remove(\"annotation-focused\");\r\n                    }\r\n                    const annotation = annotations[0];\r\n                    if (annotation) {\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-author\")\r\n                            .textContent = annotation.author || \"\";\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-date\")\r\n                            .textContent = new Date(annotation.dateModified || annotation.dateCreated).toDateString();\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-text\")\r\n                            .textContent = annotation.textContent || \"\";\r\n                    }\r\n                    else {\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-author\")\r\n                            .textContent = \"\";\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-date\")\r\n                            .textContent = \"\";\r\n                        this._shadowRoot.querySelector(\"#focused-annotation-text\")\r\n                            .textContent = \"\";\r\n                    }\r\n                    break;\r\n                case \"select\":\r\n                    if (annotations === null || annotations === void 0 ? void 0 : annotations.length) {\r\n                        this._mainContainer.classList.add(\"annotation-selected\");\r\n                        this._mainContainer.classList.add(\"annotation-focused\");\r\n                    }\r\n                    else {\r\n                        this._mainContainer.classList.remove(\"annotation-selected\");\r\n                        this._mainContainer.classList.remove(\"annotation-focused\");\r\n                    }\r\n                    break;\r\n                case \"add\":\r\n                case \"delete\":\r\n                case \"render\":\r\n                case \"import\":\r\n                    if (annotations === null || annotations === void 0 ? void 0 : annotations.length) {\r\n                        const pageIdSet = new Set(annotations.map(x => x.pageId));\r\n                        this._pageService.renderSpecifiedPages(pageIdSet);\r\n                    }\r\n                    break;\r\n            }\r\n            if (this._annotChangeCallback) {\r\n                this._annotChangeCallback(e.detail);\r\n            }\r\n        };\r\n        this.onAnnotatorDataChanged = (event) => {\r\n            annotatorTypes.forEach(x => {\r\n                this._mainContainer.classList.remove(x + \"-annotator-data-saveable\");\r\n                this._mainContainer.classList.remove(x + \"-annotator-data-undoable\");\r\n                this._mainContainer.classList.remove(x + \"-annotator-data-clearable\");\r\n            });\r\n            if (event.detail.saveable) {\r\n                this._mainContainer.classList.add(event.detail.annotatorType + \"-annotator-data-saveable\");\r\n            }\r\n            if (event.detail.undoable) {\r\n                this._mainContainer.classList.add(event.detail.annotatorType + \"-annotator-data-undoable\");\r\n            }\r\n            if (event.detail.clearable) {\r\n                this._mainContainer.classList.add(event.detail.annotatorType + \"-annotator-data-clearable\");\r\n            }\r\n        };\r\n        this.onAnnotationEditTextButtonClick = () => __awaiter(this, void 0, void 0, function* () {\r\n            var _b, _c;\r\n            const initialText = (_b = this._docService) === null || _b === void 0 ? void 0 : _b.getSelectedAnnotationTextContent();\r\n            const text = yield this._viewer.showTextDialogAsync(initialText);\r\n            if (text === null) {\r\n                return;\r\n            }\r\n            yield ((_c = this._docService) === null || _c === void 0 ? void 0 : _c.setSelectedAnnotationTextContentAsync(text));\r\n        });\r\n        this.onAnnotationDeleteButtonClick = () => {\r\n            var _a;\r\n            (_a = this._docService) === null || _a === void 0 ? void 0 : _a.removeSelectedAnnotation();\r\n        };\r\n        this.onAnnotationModeButtonClick = (e) => {\r\n            const parentButton = e.target.closest(\"*[id^=\\\"button-annotation-mode-\\\"]\");\r\n            if (!parentButton) {\r\n                return;\r\n            }\r\n            const mode = /button-annotation-mode-(.+)/.exec(parentButton.id)[1];\r\n            this.setAnnotationMode(mode);\r\n        };\r\n        this.onMainContainerPointerMove = (event) => {\r\n            const { clientX, clientY } = event;\r\n            const { x: rectX, y: rectY, width, height } = this._mainContainer.getBoundingClientRect();\r\n            const l = clientX - rectX;\r\n            const t = clientY - rectY;\r\n            const r = width - l;\r\n            const b = height - t;\r\n            if (Math.min(l, r, t, b) > 150) {\r\n                this.hidePanels();\r\n            }\r\n            else {\r\n                this.showPanels();\r\n            }\r\n        };\r\n        this.onPdfLoadingProgress = (progressData) => {\r\n        };\r\n        this.docServiceUndo = () => {\r\n            var _a;\r\n            (_a = this._docService) === null || _a === void 0 ? void 0 : _a.undoAsync();\r\n        };\r\n        this.onDocChangeAsync = (e) => __awaiter(this, void 0, void 0, function* () {\r\n            var _d;\r\n            if (e.detail.type === \"main\") {\r\n                if (e.detail.action === \"open\") {\r\n                    this.setMode();\r\n                    yield this.refreshPagesAsync();\r\n                    this._annotatorService = new AnnotatorService(this._docService, this._pageService, this._customStampsService, this._viewer);\r\n                    this.setAnnotationMode(\"select\");\r\n                    this._mainContainer.classList.remove(\"disabled\");\r\n                }\r\n                else if (e.detail.action === \"close\") {\r\n                    this._mainContainer.classList.add(\"disabled\");\r\n                    this._mainContainer.classList.remove(\"annotation-focused\");\r\n                    this._mainContainer.classList.remove(\"annotation-selected\");\r\n                    this.setMode();\r\n                    (_d = this._annotatorService) === null || _d === void 0 ? void 0 : _d.destroy();\r\n                    yield this.refreshPagesAsync();\r\n                    this.showPanels();\r\n                }\r\n            }\r\n            if (e.detail.type === \"compared\") {\r\n                if (e.detail.action === \"open\") {\r\n                    this._mainContainer.classList.add(\"comparison-loaded\");\r\n                }\r\n                else if (e.detail.action === \"close\") {\r\n                    this._mainContainer.classList.remove(\"comparison-loaded\");\r\n                }\r\n                if (this._modeService.mode === \"comparison\") {\r\n                    this._viewer.renderVisible(true);\r\n                }\r\n            }\r\n        });\r\n        this.onDocServiceStateChange = (e) => {\r\n            if (e.detail.undoableCount) {\r\n                this._mainContainer.classList.add(\"undoable-commands\");\r\n            }\r\n            else {\r\n                this._mainContainer.classList.remove(\"undoable-commands\");\r\n            }\r\n        };\r\n        this.onPreviewerToggleClick = () => {\r\n            this.togglePreviewer();\r\n        };\r\n        this.showPasswordDialogAsync = () => __awaiter(this, void 0, void 0, function* () {\r\n            const passwordPromise = new Promise((resolve, reject) => {\r\n                const dialog = ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.DomUtils.htmlToElements(passwordDialogHtml)[0];\r\n                this._mainContainer.append(dialog);\r\n                let value = \"\";\r\n                const input = dialog.querySelector(\".password-input\");\r\n                input.placeholder = \"Enter password...\";\r\n                input.addEventListener(\"change\", () => value = input.value);\r\n                const ok = () => {\r\n                    dialog.remove();\r\n                    resolve(value);\r\n                };\r\n                const cancel = () => {\r\n                    dialog.remove();\r\n                    resolve(null);\r\n                };\r\n                dialog.addEventListener(\"click\", (e) => {\r\n                    if (e.target === dialog) {\r\n                        cancel();\r\n                    }\r\n                });\r\n                dialog.querySelector(\".password-ok\").addEventListener(\"click\", ok);\r\n                dialog.querySelector(\".password-cancel\").addEventListener(\"click\", cancel);\r\n            });\r\n            return passwordPromise;\r\n        });\r\n        this.onViewerKeyDown = (event) => {\r\n            var _a, _b, _c, _d;\r\n            switch (event.code) {\r\n                case \"KeyO\":\r\n                    if (event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        if (this._fileButtons.includes(\"open\")) {\r\n                            if (this._fileOpenAction) {\r\n                                this._fileOpenAction();\r\n                            }\r\n                            else if (this.onOpenFileButtonClick) {\r\n                                this.onOpenFileButtonClick();\r\n                            }\r\n                        }\r\n                    }\r\n                    break;\r\n                case \"KeyS\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        if (this._fileButtons.includes(\"save\")) {\r\n                            if (this._fileSaveAction) {\r\n                                this._fileSaveAction();\r\n                            }\r\n                            else if (this.onSaveFileButtonClickAsync) {\r\n                                this.onSaveFileButtonClickAsync();\r\n                            }\r\n                        }\r\n                    }\r\n                    break;\r\n                case \"KeyX\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        if (this._fileButtons.includes(\"close\")) {\r\n                            if (this._fileCloseAction) {\r\n                                this._fileCloseAction();\r\n                            }\r\n                            else if (this.onCloseFileButtonClick) {\r\n                                this.onCloseFileButtonClick();\r\n                            }\r\n                        }\r\n                    }\r\n                    break;\r\n                case \"KeyT\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        this.togglePreviewer();\r\n                    }\r\n                    break;\r\n                case \"Digit1\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        this.setMode(\"text\");\r\n                    }\r\n                    break;\r\n                case \"Digit2\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        this.setMode(\"hand\");\r\n                    }\r\n                    break;\r\n                case \"Digit3\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        this.setMode(\"annotation\");\r\n                    }\r\n                    break;\r\n                case \"Digit4\":\r\n                    if (this._docService && event.ctrlKey && event.altKey) {\r\n                        event.preventDefault();\r\n                        this.setMode(\"comparison\");\r\n                    }\r\n                    break;\r\n                case \"ArrowLeft\":\r\n                    event.preventDefault();\r\n                    this.moveToPrevPage();\r\n                    break;\r\n                case \"ArrowRight\":\r\n                    event.preventDefault();\r\n                    this.moveToNextPage();\r\n                    break;\r\n                case \"ArrowUp\":\r\n                    event.preventDefault();\r\n                    this._viewer.zoomIn();\r\n                    break;\r\n                case \"ArrowDown\":\r\n                    event.preventDefault();\r\n                    this._viewer.zoomOut();\r\n                    break;\r\n                case \"Comma\":\r\n                    event.preventDefault();\r\n                    this.rotateCounterClockwise();\r\n                    break;\r\n                case \"Period\":\r\n                    event.preventDefault();\r\n                    this.rotateClockwise();\r\n                    break;\r\n                case \"Escape\":\r\n                    event.preventDefault();\r\n                    (_a = this._annotatorService.annotator) === null || _a === void 0 ? void 0 : _a.clear();\r\n                    break;\r\n                case \"Backspace\":\r\n                    event.preventDefault();\r\n                    (_b = this._annotatorService.annotator) === null || _b === void 0 ? void 0 : _b.undo();\r\n                    break;\r\n                case \"Enter\":\r\n                    event.preventDefault();\r\n                    (_c = this._annotatorService.annotator) === null || _c === void 0 ? void 0 : _c.saveAnnotationAsync();\r\n                    break;\r\n                case \"KeyZ\":\r\n                    if (event.ctrlKey) {\r\n                        event.preventDefault();\r\n                        (_d = this._docService) === null || _d === void 0 ? void 0 : _d.undoAsync();\r\n                    }\r\n                    break;\r\n                default:\r\n                    return;\r\n            }\r\n        };\r\n        if (!options) {\r\n            throw new Error(\"No options provided\");\r\n        }\r\n        const container = document.querySelector(options.containerSelector);\r\n        if (!container) {\r\n            throw new Error(\"Container not found\");\r\n        }\r\n        else if (!(container instanceof HTMLDivElement)) {\r\n            throw new Error(\"Container is not a DIV element\");\r\n        }\r\n        else {\r\n            this._outerContainer = container;\r\n        }\r\n        if (!options.workerSource) {\r\n            throw new Error(\"Worker source path not defined\");\r\n        }\r\n        pdfjs_dist__WEBPACK_IMPORTED_MODULE_0__.GlobalWorkerOptions.workerSrc = options.workerSource;\r\n        this._userName = options.userName || \"Guest\";\r\n        this._fileButtons = options.fileButtons || [];\r\n        this._fileOpenAction = options.fileOpenAction;\r\n        this._fileSaveAction = options.fileSaveAction;\r\n        this._fileCloseAction = options.fileCloseAction;\r\n        this._comparableFileButtons = options.comparableFileButtons || [];\r\n        this._comparableFileOpenAction = options.comparableFileOpenAction;\r\n        this._comparableFileCloseAction = options.comparableFileCloseAction;\r\n        this._annotChangeCallback = options.annotChangeCallback;\r\n        this._customStampChangeCallback = options.customStampChangeCallback;\r\n        const visibleAdjPages = options.visibleAdjPages || 0;\r\n        const previewWidth = options.previewWidth || 100;\r\n        const minScale = options.minScale || 0.25;\r\n        const maxScale = options.maxScale || 4;\r\n        this._shadowRoot = this._outerContainer.attachShadow({ mode: \"open\" });\r\n        this._shadowRoot.innerHTML = styles + mainHtml;\r\n        this._mainContainer = this._shadowRoot.querySelector(\"div#main-container\");\r\n        this._eventService = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.EventService(this._mainContainer);\r\n        this._modeService = new ModeService({ disabledModes: options.disabledModes || [] });\r\n        this._docManagerService = new DocManagerService(this._eventService);\r\n        this._pageService = new PageService(this._eventService, this._modeService, this._docManagerService, { previewCanvasWidth: previewWidth, visibleAdjPages: visibleAdjPages });\r\n        this._customStampsService = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.CustomStampService(this._mainContainer, this._eventService);\r\n        this._customStampsService.importCustomStamps(options.customStamps);\r\n        this._spinner = new ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.Spinner();\r\n        this._previewer = new Previewer(this._pageService, this._shadowRoot.querySelector(\"#previewer\"));\r\n        this._viewer = new Viewer(this._modeService, this._pageService, this._shadowRoot.querySelector(\"#viewer\"), { minScale: minScale, maxScale: maxScale });\r\n        this._viewer.container.addEventListener(\"contextmenu\", e => e.preventDefault());\r\n        this.initMainContainerEventHandlers();\r\n        this.initViewControls();\r\n        this.initFileButtons();\r\n        this.initModeSwitchButtons();\r\n        this.initAnnotationButtons();\r\n        this._eventService.addListener(docChangeEvent, this.onDocChangeAsync);\r\n        this._eventService.addListener(annotChangeEvent, this.onAnnotationChange);\r\n        this._eventService.addListener(currentPageChangeEvent, this.onCurrentPagesChanged);\r\n        this._eventService.addListener(annotatorDataChangeEvent, this.onAnnotatorDataChanged);\r\n        this._eventService.addListener(ts_viewers_core__WEBPACK_IMPORTED_MODULE_2__.customStampEvent, this.onCustomStampChanged);\r\n        this._eventService.addListener(docServiceStateChangeEvent, this.onDocServiceStateChange);\r\n        document.addEventListener(\"selectionchange\", this.onTextSelectionChange);\r\n        this._mainContainer.addEventListener(\"keydown\", this.onViewerKeyDown);\r\n    }\r\n    get _docService() {\r\n        var _a;\r\n        return (_a = this._docManagerService) === null || _a === void 0 ? void 0 : _a.docService;\r\n    }\r\n    destroy() {\r\n        var _a, _b;\r\n        this._annotChangeCallback = null;\r\n        (_a = this._annotatorService) === null || _a === void 0 ? void 0 : _a.destroy();\r\n        this._docManagerService.destroy();\r\n        this._viewer.destroy();\r\n        this._previewer.destroy();\r\n        this._pageService.destroy();\r\n        this._customStampsService.destroy();\r\n        this._eventService.destroy();\r\n        (_b = this._mainContainerRObserver) === null || _b === void 0 ? void 0 : _b.disconnect();\r\n        this._shadowRoot.innerHTML = \"\";\r\n        document.removeEventListener(\"selectionchange\", this.onTextSelectionChange);\r\n    }\r\n    openPdfAsync(src, fileName) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            yield this.openDocAsync(\"main\", src, fileName);\r\n        });\r\n    }\r\n    closePdfAsync() {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            yield this.closeDocAsync(\"main\");\r\n        });\r\n    }\r\n    openComparedPdfAsync(src, fileName) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            if (!this._docManagerService.docLoaded) {\r\n                return;\r\n            }\r\n            yield this.openDocAsync(\"compared\", src, fileName);\r\n            this.setMode(\"comparison\");\r\n        });\r\n    }\r\n    closeComparedPdfAsync() {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            yield this.closeDocAsync(\"compared\");\r\n            this.setMode();\r\n        });\r\n    }\r\n    importAnnotationsAsync(dtos) {\r\n        var _a;\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            try {\r\n                yield ((_a = this._docService) === null || _a === void 0 ? void 0 : _a.appendSerializedAnnotationsAsync(dtos));\r\n            }\r\n            catch (e) {\r\n                console.log(`Error while importing annotations: ${e.message}`);\r\n            }\r\n        });\r\n    }\r\n    importAnnotationsFromJsonAsync(json) {\r\n        var _a;\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            try {\r\n                const dtos = JSON.parse(json);\r\n                yield ((_a = this._docService) === null || _a === void 0 ? void 0 : _a.appendSerializedAnnotationsAsync(dtos));\r\n            }\r\n            catch (e) {\r\n                console.log(`Error while importing annotations: ${e.message}`);\r\n            }\r\n        });\r\n    }\r\n    exportAnnotationsAsync() {\r\n        var _a;\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            const dtos = yield ((_a = this._docService) === null || _a === void 0 ? void 0 : _a.serializeAnnotationsAsync(true));\r\n            return dtos;\r\n        });\r\n    }\r\n    exportAnnotationsToJsonAsync() {\r\n        var _a;\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            const dtos = yield ((_a = this._docService) === null || _a === void 0 ? void 0 : _a.serializeAnnotationsAsync(true));\r\n            return JSON.stringify(dtos);\r\n        });\r\n    }\r\n    importCustomStamps(customStamps) {\r\n        try {\r\n            this._customStampsService.importCustomStamps(customStamps);\r\n        }\r\n        catch (e) {\r\n            console.log(`Error while importing custom stamps: ${e.message}`);\r\n        }\r\n    }\r\n    importCustomStampsFromJson(json) {\r\n        try {\r\n            const customStamps = JSON.parse(json);\r\n            this._customStampsService.importCustomStamps(customStamps);\r\n        }\r\n        catch (e) {\r\n            console.log(`Error while importing custom stamps: ${e.message}`);\r\n        }\r\n    }\r\n    exportCustomStamps() {\r\n        const customStamps = this._customStampsService.getCustomStamps();\r\n        return customStamps;\r\n    }\r\n    exportCustomStampsToJson() {\r\n        const customStamps = this._customStampsService.getCustomStamps();\r\n        return JSON.stringify(customStamps);\r\n    }\r\n    getCurrentPdfAsync() {\r\n        var _a;\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            const data = yield ((_a = this._docService) === null || _a === void 0 ? void 0 : _a.getDataWithUpdatedAnnotationsAsync());\r\n            if (!(data === null || data === void 0 ? void 0 : data.length)) {\r\n                return null;\r\n            }\r\n            const blob = new Blob([data], {\r\n                type: \"application/pdf\",\r\n            });\r\n            return blob;\r\n        });\r\n    }\r\n    openDocAsync(type, src, fileName) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            this._spinner.show(this._mainContainer);\r\n            try {\r\n                yield this._docManagerService.openPdfAsync(type, src, fileName, this._userName, this.showPasswordDialogAsync, this.onPdfLoadingProgress);\r\n            }\r\n            catch (e) {\r\n                this._spinner.hide();\r\n                throw e;\r\n            }\r\n            this._spinner.hide();\r\n        });\r\n    }\r\n    closeDocAsync(type) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            yield this._docManagerService.closePdfAsync(type);\r\n        });\r\n    }\r\n    initMainContainerEventHandlers() {\r\n        const mcResizeObserver = new ResizeObserver((entries) => {\r\n            const { width } = this._mainContainer.getBoundingClientRect();\r\n            if (width < 721) {\r\n                this._mainContainer.classList.add(\"mobile\");\r\n            }\r\n            else {\r\n                this._mainContainer.classList.remove(\"mobile\");\r\n            }\r\n            if (width < 400) {\r\n                this._mainContainer.classList.add(\"compact\");\r\n            }\r\n            else {\r\n                this._mainContainer.classList.remove(\"compact\");\r\n            }\r\n        });\r\n        mcResizeObserver.observe(this._mainContainer);\r\n        this._mainContainerRObserver = mcResizeObserver;\r\n        this._mainContainer.addEventListener(\"pointermove\", this.onMainContainerPointerMove);\r\n    }\r\n    initViewControls() {\r\n        const paginatorInput = this._shadowRoot.getElementById(\"paginator-input\");\r\n        paginatorInput.addEventListener(\"input\", this.onPaginatorInput);\r\n        paginatorInput.addEventListener(\"change\", this.onPaginatorChange);\r\n        this._shadowRoot.querySelector(\"#paginator-prev\")\r\n            .addEventListener(\"click\", this.onPaginatorPrevClick);\r\n        this._shadowRoot.querySelector(\"#paginator-next\")\r\n            .addEventListener(\"click\", this.onPaginatorNextClick);\r\n        this._shadowRoot.querySelector(\"#rotate-clockwise\")\r\n            .addEventListener(\"click\", this.onRotateClockwiseClick);\r\n        this._shadowRoot.querySelector(\"#rotate-counter-clockwise\")\r\n            .addEventListener(\"click\", this.onRotateCounterClockwiseClick);\r\n        this._shadowRoot.querySelector(\"#zoom-out\")\r\n            .addEventListener(\"click\", this.onZoomOutClick);\r\n        this._shadowRoot.querySelector(\"#zoom-in\")\r\n            .addEventListener(\"click\", this.onZoomInClick);\r\n        this._shadowRoot.querySelector(\"#zoom-fit-viewer\")\r\n            .addEventListener(\"click\", this.onZoomFitViewerClick);\r\n        this._shadowRoot.querySelector(\"#zoom-fit-page\")\r\n            .addEventListener(\"click\", this.onZoomFitPageClick);\r\n        this._shadowRoot.querySelector(\"#toggle-previewer\")\r\n            .addEventListener(\"click\", this.onPreviewerToggleClick);\r\n    }\r\n    initFileButtons() {\r\n        const openButton = this._shadowRoot.querySelector(\"#button-open-file\");\r\n        const saveButton = this._shadowRoot.querySelector(\"#button-save-file\");\r\n        const closeButton = this._shadowRoot.querySelector(\"#button-close-file\");\r\n        if (this._fileButtons.includes(\"open\")) {\r\n            this._fileInput = this._shadowRoot.getElementById(\"open-file-input\");\r\n            this._fileInput.addEventListener(\"change\", this.onFileInput);\r\n            openButton.addEventListener(\"click\", this._fileOpenAction || this.onOpenFileButtonClick);\r\n        }\r\n        else {\r\n            openButton.remove();\r\n        }\r\n        if (this._fileButtons.includes(\"save\")) {\r\n            saveButton.addEventListener(\"click\", this._fileSaveAction || this.onSaveFileButtonClickAsync);\r\n        }\r\n        else {\r\n            saveButton.remove();\r\n        }\r\n        if (this._fileButtons.includes(\"close\")) {\r\n            closeButton.addEventListener(\"click\", this._fileCloseAction || this.onCloseFileButtonClick);\r\n        }\r\n        else {\r\n            closeButton.remove();\r\n        }\r\n        const comparableOpenButton = this._shadowRoot.querySelector(\"#button-command-comparison-open\");\r\n        const comparableCloseButton = this._shadowRoot.querySelector(\"#button-command-comparison-close\");\r\n        if (this._comparableFileButtons.includes(\"open\")) {\r\n            this._comparableFileInput = this._shadowRoot\r\n                .getElementById(\"open-comparable-file-input\");\r\n            this._comparableFileInput.addEventListener(\"change\", this.onComparableFileInput);\r\n            comparableOpenButton.addEventListener(\"click\", this._comparableFileOpenAction || this.onComparableOpenFileButtonClick);\r\n        }\r\n        else {\r\n            comparableOpenButton.remove();\r\n        }\r\n        if (this._comparableFileButtons.includes(\"close\")) {\r\n            comparableCloseButton.addEventListener(\"click\", this._comparableFileCloseAction || this.onComparableCloseFileButtonClick);\r\n        }\r\n        else {\r\n            comparableCloseButton.remove();\r\n        }\r\n    }\r\n    initModeSwitchButtons() {\r\n        const modeButtons = this._shadowRoot.querySelectorAll(\"*[id^=\\\"button-mode-\\\"]\");\r\n        const enabledModes = this._modeService.enabledModes;\r\n        modeButtons.forEach(x => {\r\n            const mode = /button-mode-(.+)/.exec(x.id)[1];\r\n            if (enabledModes.includes(mode)) {\r\n                x.addEventListener(\"click\", this.onViewerModeButtonClick);\r\n            }\r\n            else {\r\n                x.classList.add(\"disabled\");\r\n            }\r\n        });\r\n    }\r\n    initAnnotationButtons() {\r\n        this._shadowRoot.querySelectorAll(\"*[id^=\\\"button-annotation-mode-\\\"]\")\r\n            .forEach(x => {\r\n            x.addEventListener(\"click\", this.onAnnotationModeButtonClick);\r\n        });\r\n        this._shadowRoot.querySelector(\"#button-annotation-edit-text\")\r\n            .addEventListener(\"click\", this.onAnnotationEditTextButtonClick);\r\n        this._shadowRoot.querySelector(\"#button-annotation-delete\")\r\n            .addEventListener(\"click\", this.onAnnotationDeleteButtonClick);\r\n        this._shadowRoot.querySelectorAll(\".button-annotation-undo\")\r\n            .forEach(x => x.addEventListener(\"click\", this.annotatorUndo));\r\n        this._shadowRoot.querySelectorAll(\".button-annotation-clear\")\r\n            .forEach(x => x.addEventListener(\"click\", this.annotatorClear));\r\n        this._shadowRoot.querySelectorAll(\".button-annotation-save\")\r\n            .forEach(x => x.addEventListener(\"click\", this.annotatorSave));\r\n        this._shadowRoot.querySelector(\"#button-command-undo\")\r\n            .addEventListener(\"click\", this.docServiceUndo);\r\n    }\r\n    setMode(mode) {\r\n        mode = mode || this._modeService.enabledModes[0] || \"text\";\r\n        viewerModes.forEach(x => {\r\n            this._mainContainer.classList.remove(\"mode-\" + x);\r\n            this._shadowRoot.querySelector(\"#button-mode-\" + x).classList.remove(\"on\");\r\n        });\r\n        this.setAnnotationMode(\"select\");\r\n        this._mainContainer.classList.add(\"mode-\" + mode);\r\n        this._shadowRoot.querySelector(\"#button-mode-\" + mode).classList.add(\"on\");\r\n        this._modeService.mode = mode;\r\n        this._viewer.renderVisible();\r\n    }\r\n    rotateCounterClockwise() {\r\n        if (!this._docService) {\r\n            return;\r\n        }\r\n        this._pageService.getCurrentPage().rotateCounterClockwise();\r\n        this.setAnnotationMode(this._annotatorService.mode);\r\n    }\r\n    rotateClockwise() {\r\n        if (!this._docService) {\r\n            return;\r\n        }\r\n        this._pageService.getCurrentPage().rotateCounterClockwise();\r\n        this.setAnnotationMode(this._annotatorService.mode);\r\n    }\r\n    moveToPrevPage() {\r\n        if (!this._docService) {\r\n            return;\r\n        }\r\n        const pageIndex = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)(this._pageService.currentPageIndex - 1, 0, this._pageService.length - 1);\r\n        this._pageService.requestSetCurrentPageIndex(pageIndex);\r\n    }\r\n    moveToNextPage() {\r\n        if (!this._docService) {\r\n            return;\r\n        }\r\n        const pageIndex = (0,mathador__WEBPACK_IMPORTED_MODULE_1__.clamp)(this._pageService.currentPageIndex + 1, 0, this._pageService.length - 1);\r\n        this._pageService.requestSetCurrentPageIndex(pageIndex);\r\n    }\r\n    setAnnotationMode(mode) {\r\n        var _a, _b;\r\n        if (!this._annotatorService || !mode) {\r\n            return;\r\n        }\r\n        const prevMode = this._annotatorService.mode;\r\n        (_a = this._shadowRoot.querySelector(`#button-annotation-mode-${prevMode}`)) === null || _a === void 0 ? void 0 : _a.classList.remove(\"on\");\r\n        (_b = this._shadowRoot.querySelector(`#button-annotation-mode-${mode}`)) === null || _b === void 0 ? void 0 : _b.classList.add(\"on\");\r\n        this._annotatorService.mode = mode;\r\n    }\r\n    hidePanels() {\r\n        if (!this._panelsHidden && !this._timers.hidePanels) {\r\n            this._timers.hidePanels = setTimeout(() => {\r\n                var _a;\r\n                if (!((_a = this._docManagerService) === null || _a === void 0 ? void 0 : _a.docLoaded)) {\r\n                    return;\r\n                }\r\n                this._mainContainer.classList.add(\"hide-panels\");\r\n                this._panelsHidden = true;\r\n                this._timers.hidePanels = null;\r\n            }, 5000);\r\n        }\r\n    }\r\n    showPanels() {\r\n        if (this._timers.hidePanels) {\r\n            clearTimeout(this._timers.hidePanels);\r\n            this._timers.hidePanels = null;\r\n        }\r\n        if (this._panelsHidden) {\r\n            this._mainContainer.classList.remove(\"hide-panels\");\r\n            this._panelsHidden = false;\r\n        }\r\n    }\r\n    refreshPagesAsync() {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            const docPagesNumber = this._docManagerService.pageCount;\r\n            this._shadowRoot.getElementById(\"paginator-total\").innerHTML = docPagesNumber + \"\";\r\n            yield this._pageService.reloadPagesAsync();\r\n        });\r\n    }\r\n    togglePreviewer() {\r\n        if (this._previewer.hidden) {\r\n            this._mainContainer.classList.remove(\"hide-previewer\");\r\n            this._shadowRoot.querySelector(\"div#toggle-previewer\").classList.add(\"on\");\r\n            this._previewer.show();\r\n        }\r\n        else {\r\n            this._mainContainer.classList.add(\"hide-previewer\");\r\n            this._shadowRoot.querySelector(\"div#toggle-previewer\").classList.remove(\"on\");\r\n            this._previewer.hide();\r\n        }\r\n    }\r\n}\n\n\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/ts-pdf/dist/ts-pdf.esm.js?");

/***/ }),

/***/ "./node_modules/ts-viewers-core/dist/ts-viewers-core.esm.js":
/*!******************************************************************!*\
  !*** ./node_modules/ts-viewers-core/dist/ts-viewers-core.esm.js ***!
  \******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"ByteUtils\": () => (/* binding */ ByteUtils),\n/* harmony export */   \"CanvasSmoothPathEditor\": () => (/* binding */ CanvasSmoothPathEditor),\n/* harmony export */   \"CloudCurveData\": () => (/* binding */ CloudCurveData),\n/* harmony export */   \"ContextMenu\": () => (/* binding */ ContextMenu),\n/* harmony export */   \"CustomStampEvent\": () => (/* binding */ CustomStampEvent),\n/* harmony export */   \"CustomStampService\": () => (/* binding */ CustomStampService),\n/* harmony export */   \"DomUtils\": () => (/* binding */ DomUtils),\n/* harmony export */   \"EventService\": () => (/* binding */ EventService),\n/* harmony export */   \"HtmlTemplates\": () => (/* binding */ HtmlTemplates),\n/* harmony export */   \"Icons\": () => (/* binding */ Icons),\n/* harmony export */   \"LinkedList\": () => (/* binding */ LinkedList),\n/* harmony export */   \"LinkedListNode\": () => (/* binding */ LinkedListNode),\n/* harmony export */   \"SmoothPath\": () => (/* binding */ SmoothPath),\n/* harmony export */   \"Spinner\": () => (/* binding */ Spinner),\n/* harmony export */   \"SvgSmoothPath\": () => (/* binding */ SvgSmoothPath),\n/* harmony export */   \"SvgTempPath\": () => (/* binding */ SvgTempPath),\n/* harmony export */   \"Thumbs\": () => (/* binding */ Thumbs),\n/* harmony export */   \"UUID\": () => (/* binding */ UUID),\n/* harmony export */   \"customStampEvent\": () => (/* binding */ customStampEvent),\n/* harmony export */   \"getCommonStyles\": () => (/* binding */ getCommonStyles)\n/* harmony export */ });\n/* harmony import */ var mathador__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mathador */ \"./node_modules/mathador/dist/index.esm.min.js\");\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n/**\n * MIT License\n *\n * Copyright (c) 2021-present Volodymyr Yermolenko (yermolim@gmail.com)\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n\n\n\nvar img$J = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/PCSiERUtRCy2iGKRgCiIpUQwTbRIIhi1SdY8hDyW3QQJtoKNRcBCtPFV+A+0FWwVBEERRGz8A74akfVOIkQkmWX2fpyZc5k5A85wTs9b7jHIF0pmJBTUFuNLmucFNz304kRL6JYxF52N0XJ83uFQ9TagerXe13R0rqYsHRztwpO6YZaEp4XD6yVD8bZwv55NrAofCvtNOaDwldKTdX5WnKnzu2IzFpkBp+qpZf5w8g/rWTMvPCrsy+fK+u951E28qcJCVOqgzCEsIoQIopGkzBo5SgSkFiSz5r6xmm+eonh0+RtUMMWRIStev6hl6ZqSmhY9JV+Oisr9f55WemK83t0bhLYn234bBs8OfFdt++vItr+PwfUIF4WGvyg5TX2IXm1ovgPo3oSzy4aW3IXzLRh4MBJmoia5ZDrTaXg9ha449N1Ax3I9q991Tu4htiFPdA17+zAi+7tXfgDAkGftS3qrhgAAAAlwSFlzAAALEwAACxMBAJqcGAAABNVJREFUeNrlW21T4jAQTkJxPI9BeXFGZ27u//8oP934QUcpMnIngjS3GxomhKRt0qSUmjmuRTD22X32NQklkcft7S3ZbreEU0o4vKdZRjhj4krhiiPj8Al8vv8Mvwc/Y3D/+voa9flojEnH4/EOGIBilu9kAJZJASj3tu9xuM7nc5/H4UVYaUjQQssFYOoOnJvg3NWFwcvw1hbAaDQSD4V/iZFmRpabT/b1RRaLhYsAjjAntW0o1zatojm8R5ZsNsIvLO/uxM8GT0+k1+sR2u/v5kGfoPgIfUiG9ZKkiolzg1BoMAHYUXP4x4W2rFp6eBCXpWWK6+trIRich4Y1q70QggsAZ958fpLlcll7LlVwg8GAXFxciGjh4QCtQkhC2STDMAavdDaLQigpUBlWszxMeoIP5wME1UEAabEzCjZeXl7E9ebmZucr3MBTPSxS0r3BXXIe+p3Bk7LQLTO6cwY/mkwKlWwVwGg6dfW4rdQ8LVGkUQBD8LQcPG1XaI8RY4oKrRoFEiVz64LNY7j8skQMZqR+Bx0eAp1MJsUCwMIGa/Iuenv5S5he2xmAtFccH2Z4+i+cE3hQ6O9MUyjWFkYBiHpepwcIY+GR4Y0NVIsFPv9bRs3P5/M/TItk6BBVpe4FwA3dG1ojDE4D+xIAagQPtUfhQ/b7/Z+6Q2RKGc0OanZN1DOPwkZqHyWN9yHYIMGrc1UBj+P5+fmvXjNQ5X1P0l+vt7GkXa/Xzlo3GejHx0cwzf+4uhKvKuD3YR00fmD7wOzLy0uyWq0smSBIyKeet3VwfVlgoj0OF/A43t/fjxgu8xzxf6bZOufcW2PYD2AG3+EqhFDgrf4sFwjDBgMzNDjqDBsTqjrG0OCNAgEGoOmzrZbz86IeniMTjjpHuWM8Bfg0TYlJrYzr1AhYA9jMwcaE2JrXkYnQz0ncYTIHExOaoP2RIxS9TD3+R+gBlDnGJsDbHCPjGuVx0aIpJjQNXo9uorNMNAZsIzZCDI6xUc3r0Q0ZQEuKjjirxzvqn4T2qu8R6xklFVcsH+lVz8cYjfe9bDYvwUcspclwODx2gm0CH7ufoC+lceEETwzeZvMxhKDXA6wpBpSBty2ohm6qUEPRx9qied/aoXYi1Cbau9YOznmAgQG0QoiiTYCvYv919h7gmgA31AasDZqP1VQpbPLAe9xpxtoGvkLt4CcAnf75e9ZG8GWUdxUCJkDUIpCQAuCmB67dydHmxPf4cnGMib6dDuj/ljMslAC46YFDFTZyTnVuNJEqTLi/v78qMgcWEnzMqs7CrlIhrNbrf/p6J+4wLQpxLmGwNVWd0VeMx78gmXo8qAGA/tggDcGAVoMXDEnTR70A2mgdL9ZV8JZkQKwSHTjI7wIebf/NsMWefRfwPdvO887TPq/7bUv9SdfBlx21oQ5gzw58JXb49hJIRwarCx631olzQ80nObgPuPY8SV3Nex5l8x6Q22N6uz+k0bQAQi+UVEaAJS1WdZ8AXhysDLSMn5zYBHmREOQub16whnfuAthrF3N2mp87EsmLQu+YHjex0JI3hJ3ayllWktmh/W8CLOUnocIcbj8VOzALDjyGKGbk8dxQh7SisEsepw0iDAkaXm8RTpJHT2hURyYEAldc8cGrbFXLe5Zf1c9ih9n/LqFyUTq2iTQAAAAASUVORK5CYII=\";\n\nvar img$I = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJT0lEQVR42uVbW2wUVRiec7bt0i2l3U7TAgajCFp8AoEIgjzZhCBqUB40qfdYL5V6wRASjAlKYoIgVsQLPGlMMJYEI4IhJfGBApogBB+o1hIvmBSyO7vbUrv3Gb9/ma1nTme7u7O7tV1PsswyOz0z//ffL8OUEi+v13sjDisYY0sMw2jB8SbdMJpxrp5z7qZrdF2P4hDijF3FNb8rnPcxwziPc2cCgcBfpXw+Voo96xsbV4OAjfjcqzB2SyGbGbo+AECOAqXuYDB4mk5NSQDq6uq8vKKiHUS3g+j5peCWCcYBPZHYPzQ0FJoSANTW1qqVlZVbINYdEOkaZRIWVGYE6vJBMpncCSCC/xUAroaGhg5wezvp8wTXJXVFOcsNoxff+6Djv+BzGURcGx4eHqELZs2aNRPg1cI+zMN/Wxjni/A3q7miLKX7TLB3AAS8oWnaR4TLpAGgqmpLUtc/w0Mvz3BJDIp6FOrwOb6fgCEbdnIfADwLh1YA1gZQ1uF7la1EKMr3FYw97vf7+0sOAB7qSYj7PhBfbfOzXzGMPYlE4mNwN1BMsTdV7XlI3MvEAxu1+Btq8QLA/qxUALjg0rrAiQ67m+P8WzOqqvYODg6OllL/m5uba+Lx+EtgwjYwwTPOUCrK+0FNeyVXlcgNgAUL3A2BQDfQv8/mhoch6p2l9tcZ4ou9AP5+G2/xVVBVH1YGBqJZuZoL8fXB4NcwUOskrkfgkjqA9pZwOJy3jjc2Ni6tcrsHqmtqqiPh8Hf5/n0kEhnC5wu3x+MDA+4BcyrGuMpYS3Uksix8ww2HlEAgWYgEkKU/LHMesvUXiF8f8vkuODJuqhqUPUdA0xx7JIB5RyKZPAKVmCtLJxi0cSJ14FnErGsc8br+M9P1VU6JhwdZZuc2vaq6xykAsP7nIPar8Gz9Enc3YN/djlQAnH8K+rVDJj7hdq8Z9vsHnRIPrvTg6wwbUVwxw+Ophzocd7J3NBoNIRr9Eh7oAaiAKu4LNbmEfX/KWQVMP39OdHUk9sR5xON/OhTTpbDcZ00gB7H3nAw+fU9I014tICS/CYw7Le5PXqrC5VoCSfk1FxVwmUFOtWTw1hdI/Imxm2Yg3nygV+pV9V2nACA0/h3Erkc8EhXuV4P7f2pHr8tG9DcBwaetT8U7Qn7/MacGD2LfaYp9yE78BaAHIb61EMuVENs6p+owOjo66PF4yNCKnmse9ryKPc9mVIFUtFVVNSAaKdOSPlio2DtKegpUBzDzCIz4euGUlkwkFoiZpEUkKKsTiaesi4Ich5wPCDofzubu7M6TOmAfx/k/ssVNuLcYmapI2V+ztQGUz1NKaxEPeAEnER5xnjzbdREyoml7ks3XZ/q9IYsrm8geID94W4oSO+He68YBQMUMSz5vGD6K7R2Kfc+/KDJ3PoFOhutedQqCy+V6j7YVDGIt/nlGBoClKjnW1ZVvYkMRmSn23kKivIwgNDTsyhcAn883AmZ2Sda2PW3/UgBQDU8qY8UQUHzkgPgTuYq1IxAY2+wEhFgs9iEOcUG1F0INVowBQAVMKYY+mk8+bxq8HwvlfKlAGBkZ8UP3v5Xs20YRgHstP16v5OTK+VtlwotBfDYQEONvz6vwwdjnUsyRihF4Kq+2lq4TuLgn50qtYbSWivgM+2kmBY/k6RJ7xKwQxrAFzJtDErBCCj5+1DTtWq4b49pPgMLJUhFvs6+K+30D4B/K0yWGoAbnJSm4q4I6NpbA4Hr1Np+VQKywZjKqQAWDyzkxaumY9DK2mFO7SrqsTynXxVifZOwXcerVSTr9S7nSD4IttCG9v5mbjUoRgMtlC0A8bknnDc6buVyeoo5NuQIAT3BNigi9PN2iTq90u6oc18js2desNpG7ufI/X9wcThhb1KgsV2JnXrlSK6l7hJtlKsWSLpbpQmpcK8UFQU5jKVLMPK9sw4DKyhslN3iVp2ZyrKulbAGQgj64wd84DSRJaeKiMrZ5FgAQV/dxcxpLTIZWly35un63JBEXyAiesdgFJAvmZEZZLSr6QrqXSEbxFKeqb2r6SjiPT2vZ+XvOWxWhCAxJv+jz+a5w89ejUj7QVn6JIGuT0v5jyhgiut4tGcJ11CUqmwBo5sxGILBWOn1oDIDUBKZhXBJ+rEoNJJXJqnS7X6SDEAH2Q/V/UASdMAzG9ksy8zINJE134lVVpWZrpyTh+wWjb6KSSOynXqD4tzSNNe1rAIZBE2NewfgNw/0dGAcAFQ1p/NTiNg1jmzmNNV1d382gYasU/HSJg5tcKhjsVKx9NJrD2ztdAYCf/8Ay0GkYPhiA3VLc8++iwWOavZX05f56VZ12BhHBXKcijfYh9n8dBn9IkojxMQMIPg1k7hSQiyY5Xznk958vysPZ9PyL2U+A4VuOG1B5X5wt7sU9qHxvZJSAtOpXMPaYZbCAMTdLJr+hAaQpr/dNTfOTuv61SDzVOROcP6HYvGxhWxKjqWsYxOelUHIu1OE4XGPTVCW+qampmcfjx/Gssy1i7nI9O+zzXbINkTNtRlPXNHgsgXBrNBY7WQxJoNE18zhaLM7DbfeCSQskP7gr6PcfzJgjTLQpTV3T4LEMAm5yiuYBnD4s6Tv2eDNllxjbUaj+0wAmi8dPjSNeUbrByC0T5ghZd6dJ8WCQQFgrIRtFgrFZ07R9U8Dav6PIL1Mg2QHxG/AtVhgAJgjeYPAgzd7ahFpHIMabQqHQH5Md5JCfl13dGOc1rS0b8encPweZDSQj4XD3DI+njkntdDzAbbAV7R6PhyPrOjc6OhorJeEU21dXV2/FfQ9C5G+3YcgucP45fEvklCbn+wCIEdpguT7O8IZYgAaSaCaHxlKKndJSVmcmNl4bozoCa98+kcErCgC0YAAXmrO3KzNcEqeZHBpLockMp+/4pd5F5LwV+zxq5vMVGS7tJT+fydUVHQAhYnwWbuQtxeYlJjHFSE1mcN5L/XlqUVOXlhqV6V4ddWyoaUF1e7N03QKWroGIL87iqfxI47eB6wcUh2+UsiIYI3pjdDNNYE5WVymV0iKro8RGju0nHYD0So2f0gSmrrfTHF5JCNf1fipmUD7v9F3EkgEg7klDiDSHR6NoNI1VILcvmgXMQ+kyVlEfttTiSqNoNI1FA0k0k0NjKTSZYQ4npF+fpxcygtSro3YVdWyoaUF1eypdl/L5/gF8P3SyE6no9QAAAABJRU5ErkJggg==\";\n\nvar img$H = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJeElEQVR42uVbbWxb1Rk+5zi2g+Mmvv4Q6QSMQVSWaRuqqNSVtf+oEC1lBdEfSFW3Pw0d0GVQ2FRpExKi0r74KhRE+QFslZhop2pQojKkaWKsq9SVov0hoqWgTqJN5OvrNGkcx/a5e96ba/fek2vHvrbT1LxSm+Te63PP+7zveb/NWZsplUr1l0qlH5qc32oyNsil/JYpxLVMSk0I0U3PSCnzTAgD98Zw7wvO2KfcND/B/WPpdPp8O/fH27FoPB5fjR/3S843CMa+08xaAGcUQIyYUh4yDOM4LplLEgAw3Qspb8dGh7DhFe0AFmufhqbsByqvAYyJJQGApml92NQuiGUY0u5li0DQikkuxF5ZLD4zMTFhXCkAuJZMbsdZ3YPfk7X2C8l9ApA+xO+j0JJRs1A4B7swOdXfP0kPRC9cWBYIBJbxYPAGbOgWZpqD4HItmFyJ24Eaa+uSsV9ndf1Ves+iAdCbSt3cJeUb+HVtlUeKYOKoaZp/grQ+8Culvr6+GIBZj3W2Aoy7cClY5dF/C85/DIN5uu0AQOoPmKXSfpzzqMdtA0dhbyGff2lqairdSrWPRqPJUCj0EON8mEyOx7G4BC3bAW040C4ABAzdb7GBxz1enoMEfsM5f07X9ck2u9Uojs/PpWnuhhAi8wwlY88bur6r3iNRLwCheCJByG6Zb5rNEWzoEaj5F2wRKRaLfRMAvAiBbPIA4bChaQ+wM2fyrQAgBMkfxos2KNdnwfwTmUxmL7uClEgkHoaNeAb7Cyu3jmY0bfNCIAQWAgiSfwuLb1ZU/gJU/g4wf7jJ2GH3NZHIh92RSG4ml/uXnzVyudyJnp6ekZKUm3AElzluDXRPT393ZmbmYK3giS+wwd+rZx4u7YwMBu+cGB8/2xTziQSWktN0jsmA4WdPRtd9u2V4jBvhKd5XgzAyyrAJw1UNWy1r78V8MBhc2yzzlZfbRoyYb3Yt2KAvw6HQOoD5mSLhn0GQ2xoCgPw8XN2rqtqT5MfHx8fYEqWxsbFxCOlO7PUrdyRmvpJMJlfUCwCnIAdScZ6n2YAQ97RK8u0k0gQzELgbBjrv1LSiaf7Ri1/hofrb50V4sPbw7yfYVUIT6fQpZKKPKoyuhsf4aU0jSIkNLOlpnP2U08/D2m9secoMI6hea8YIVknU/grDeI/zFaViccAZmgvFKu1yMk8RHgU57OqlneRpnLgjt/iF5xGw8nmktK6bCG8XO8JrJRmGcQ487FEM4iOUZM0DgIoZSj5vUGzPrnKC236B0maHQYyKrq6h+QBIOaQGEO1ObBbJNV6CHXveZfhMc6hs/0S5hqdEUAVKaVmHUKFQeMXKXSoI8JthIG93asD9its72up8/krS5OSkDg0fUQz+lgoAUsn0kF0dYB1GsGcHlCKG5doF1e2V0rWkMhbrPCKeShVAhBjA0b9OUNNCSXhONVtpXYqEYO6iZOykcnmNoI6Ncjb+yTqUoOkfuYTN+UpB7SrludFOBQDa/aliBwYF9eoUVDoWAFW4MIw3CqtR6QSgUDjXsRpgmv9TwuJrBXVpnRepY9OpAFBLTbkUE+UWdZnK7apOpIsXL0657b0IC/Y1J2ENJziIGpWdymxvb29UORJ5QZMZzovUpe1YabvrnERZcoOuKi+1qDsVALi9612AcD5GbtBV8bH6850LwC2KW/xS0ECS4iwHO9jmDSqAjAqaxlKc5bpGV43FYt9DZvUuVXq9qr2tpPI78D6aOOlqKA7gfK2iAacoDjjmQkWIlc6iYZ2q9Rf8dzeza2/tAsG1LufrEonEg/V+Fs8ug8+/Tbl8XNAcHo2iOW0DjaU0aF7fKr/Hc7OtZv4y8HXXLSDt9S6NMc3Praqx7R5GlIe3NrI5Q9efZNSjr2PTrWKeXgvhfVY3AJxvVf5+z06RrTTxkHIM7qKZnAYLDo+3AwSPzxtwX7dldD3eQAAUh7HfqABwqAIATWBaQ4iXKWgNJDVedWkpCF6fo8EMSP7jRtbp6uqinmDIoeJns+n0RxUA6JI1gek+YMM0kOQLBMaebRaEKpJf1Sjzy5cvpxmEYUX6+5k9NSIc7u81JV2M0zSWH8ll5qa0fINQec7Z4uZ8PZg/2eheZmZndyr9zkuyWKwIuwIAzd7S+KlSMNhNoydNgMAaBaF8nxqzjsEnww/zVPXF0f6VcoT2Ve0OA5k/MHcfLQKX+KJfA0btbsnYc/WC4LyOd19jb3hVIwZPUfW9ykBntlAo/M6V/Dn/yOfzM+FIZNJlMTlfEYlE0jSN5WcTM7nc+1izD2uusSV7XpnmUimLf+UiTVavMeBUi7RkcgjvfEIJBn4J6f9DyX3mhzWQBFnINY4P5oHk7Y0aIFe4nEg8C3V7tM7Hs7a1P+nrXanUraxYPO6sdgH4E1nDIJ5KLma9QmYaPLZmby9rQbhYKh3xaw9sUT7mdRwcGzyvuDpfzGuadgMWO6IwnwsIsU1lft4RKNP09HSmu6fnHNTjPkfYSWq7ASC8fQnk9zh0RyIxrPsDj7CW1s/i3jqovS/mo/39KVEq/R0A3qSo+Q64Z8+wOVBjs/9VN4tNJorF4o/C4fAR2Itsy0GYY/4/fiVvMS/Et13HXsp98HB7qiZyC6U5WiJxCA/dq6jrV12BwKZmbIKHJ8jC2mu+zzypPWPXKUbvXUj+Xi/Vr2UDXLxaU9eMHVVqa98ACMdg2B7yCwC5SCDwtDUuO+fqfDFP1t4yeArzsDd/y8TjW2oxX48GzNHAQFjT9T8jUNo8z9dK+Q5+7KTUcjFLO1aQAz+vamdF8sR8HePygfrElSnR1DXOroYXrlbrbEifH0SsQFnXx7CPhXYyTrF9MBx+DO88CM35vodA6Mz/BHuuax/cB/LbECK/XGXAWaeBJJrJobGUVjJOKS2yuh1sbgI06eFG6VsrD+PMv95QNcvPZmjwuGiabwoPS27TLM3k2GMpH9Bwgk81p7G9O6iYYUenoSoxxAny8/AgDXe2mxlNFTR7C0P2FPP4EpODSjSZQcMJdn9+lLq0lHmWe3XUsaGmBdXt7dL1IBUw8ZlVCxzTLDTuSQC8byFj1w4ALEJgpNH4KU1gVvkmWcvJ+oIFsjpKbJo9ai0bTqZKsjWBKeV2GkBqC+emeZaKGZTPt2qOqR1fnubWECLN4Um5sWkwTPNzKmBSDc8uYy3NL0/X8teUWdJAEs3k0FgKTWawueGEsK3SeTsDHKN2FXVsqGmBa8fbHV/8H2Qog/fmBwhzAAAAAElFTkSuQmCC\";\n\nvar img$G = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIoSE1JoISKYQsUiAVEUS4mgTbSIEYzaZNc8hDyW3Q0SbAUbC8FCtPFV+A+0FWwVBEERRGz8A74akfWOCSRIMsvs/Tgz5zJzBtzRnJ63WoYhX7DN2EwkuJhYCra94qEPL37GkrplzM5Px2k6vu5xqXoXVr2a72s4OlZTlg6uduFx3TBt4Unh6LptKN4W7tKzyVXhI+GQKQcUvla6VuEXxZkKfyg247EpcKuewUwda3WsZ8288JBwfz5X0qvnUTfxpQoL81J7ZPZiEWOGCEE0SqyRwyYstSCZNfYN//nmKIpHl79BGVMcGbLiDYlakq4pqWnRU/LlKKvc/+dppUdHKt19EWh9dpz3AWjbhZ8dx/k+dpyfE/A8wWWh5i9KThOfou/UtP5DCGzC+VVN0/bgYgu6H42kmfyTPDLd6TS8nYE/AZ234F2uZFVd5/QB4hvyRDewfwCDsj+w8gsVKmgU+omlKwAAAAlwSFlzAAALEwAACxMBAJqcGAAACdRJREFUeNrdW3tsW9UdPuf4Ok5wHrav86pYB6zQZA+NDpi6tUzaRCSg7TakIsEUFYTUQGlpV2AVk7ZJCLFNhY62lIHafwarhLZ2KoK2g0XaHzRQ0Cgt/yyllOdQm9SPmzgmTvw4d99xbff45NqxnTi+7pFS3/oe33u/3+P7Pc65lFR5+P3+bs75D01KrzcJ6aWcX20y1kk49zLGXGIOzk8RxgycG8W5Tykhw9Q0P3A4HG8FAoGRaj4frcY1vV7vcsrYWgC7HSB75nIxTsh/mWkexeHBcDj8rm0FANBt0OJ6qHMA4K+thrYg0DO49l5Yxz4II2ILAbS1tXmYpj1qcr4Z2m4hCzBgFRE8+C5IZIdhGOO1EgDz6Pr9jJAncKwXe14I5ySs4xihdBg88KGZSHyRSqUmol1dE2JC88hIC/y9hTqdi6Fd4TI9AHcztL1M3KfglU0zAM74jREM7hP/WzABgNiu5ab5Ig5/UGBKAqD/SSndD6CD4+PjYxValyDKPlynH8K7FV85C0wdSjJ2byQQ+LjqAoDW+6GdF/BgbovTYWhlVzwe/3M0Gg3Op9k3Nzf7nS7XJjzwZkE5FvwwQR2O+2ENL1dLAMyr6zvwg19a3HySUfoHmPFOhK1oNf1f1/UW0zS3wgIfgxKaLNziaRDktlJdojQBLFni8hrGy5h8h8UND8PMH4KZf0YWcMA9robA98A1brc4fSAcCvXjMz53AQC8zzBewdGtCvBp+OYjoVDoOVLD4fP5NkMIT+GwQXm+o7CEO2YTAp3V7L3ef4CNf66Y/HnN4VgdDAbfJzYYcIubUpy/CpfosrCEuy5GTuvhKJrc6PpOaPkeNRkBw/8Y8XeY2GTEYrFzrtbWQzSVWoXn9UmnvtXU1OTG+cGyLQCmtQ6m9aIK3tXQcPPo6OgFYsPR0dHRmUgkhmCxS/K8gdJfFIoOtECcvy6ZSr0vhzqAPwfNr1hosiubHDs6rqGJxFuyO+DZo1zTrrfKE6yyLJZEkpMX50F48Pk1dgcvxviFC584GFsjkx+wNGuc/8VK4Q4LQnkQswbyTJ/SLSCTV0mdDMEJ8P0IXPg26evFjW73uanJyRMFXUCkng5NOysoIKd8sCsI72ekDgd47IiSJwSBZ4lcQOW5ABKLbTJ4keHh46GKS2Rdfxxh9IzH4/lOLQSABG0TMMRkeoM/PGLJAaKsRXq5Ke8kpU9CWl9UKP2nYV6/E70B+ODva8IH4+OfAsMf8yICIVvwbK0zBICafkCQhTQ35HQ6d1UKHqaXlXQIx6tr5QbIC57BhyEBbkVYXK8KgMLe1yup5E7E+6/mCJ7M0iuo+kCqPgGt786DxvlAHgnCT1fAVIekOfFEPL5oYmIiVBZ4VIv4eHhGjRwK0VoKQZTSDS7XeRxqkoKXix4jywTKOxUJHb1cwIuR7k2Y5uvK12svuQDnqxS/2V8meNOu4C8p3PyrktukwyODz16p5M4p/A2W0SH6k9X3dgKfCemDclUIzX+zvb29i6l9Pcw4UWrLWYDHBbbaHXwmJBpw7VNKnrCCISQsUxKDocsN/CVw7E2lSvwug230KgQ4fFmCvzhOK0lRLxIlelWxSRbp7TNZ8KIzVEfghcbzsIl1Sob0t1Nhy/8VAy93hZE5dtcL+DS2RCIvrReLtCIx8ChsOVEk1JFyz9ViFFKIWI1CtSuDFQsvF5eosyMSiUQtNP9EvZTAooJFaP+1ZUKUWYqTLLiRlWQ6nD9cLwIAqCuQyT1Z8nxIbFr+orW1tVmdpDkcP6ojC/gK/viYZU0wMtKizJ0WFjCmSHDGEncwGDwhz5PZ34YW4DZCoe1W58QKtDLZ0BAHR3HYLdUBX8PH5xbEAirQb4R0B7PsX08hMI3N6VyMMCeHwVGGsPeZUggtLVJbvwekfdJXY3aMAgUFQMhSJQyKjhFVE5/eWRoM7+FHN2bAe+waCguUhL2KQIaFBZxUysSVs11HcAKEcIvECbG6EALnedioaZ4SO7oWoxz+PK8cNk1fKRUhABs5KzDNafiPy66cIJq+SILEpo3cWgiUuIilu76mKS8ZiQm3lJhxeTPuQLLg7WoJiAB9MnhY7WlY8nmWKRKOKEVDf6kXzoRIw+7pMVy9XwmXR3MtMQA+qJDDKiREvjJyb1/GEgw7CkE0ReHmtynZ7cGcAMaCwSGI6BPpfIOmaQ+Uc5MMMfbZ0RIaGhoeJNIOM4D/CK7/Tk4AaQuhdG9+0KRbu7u7r6hACDfYyRLa29ubgWWLkgHuJZlNVLliiCeTe0UeLU3zT8XjZa8Lim0zcois9UAJLPoXvrxyn/N9OVlkD0TTEA/+nOInvxVd40qEkGcFpnmsFuA9Hs/XuWnmlcbggt0FV4cTicR2uegRhQVcY3eFTQlBjEtBqJuQU/ykRoXRs+nyWEpkYek7iBLzcyMej8eamppi8sYCAOhtdLvPqxsLShmTk5OhWCz2H1Jkl1a1Bgq3jYLH8hJBQh4dN4xjSsSbmTN4vN7jkNxNkt9MEU1bPhYIfFAPRY/f7/8envltOTnDOA6rXKkqw6ojlHIwtk7eWCBaR5DCYZE22x08Ut6rkqnUazJ4Qe7s4na/GZbIClR8p/GDjcrEKxE33mju6mq3K/jOzs4OkNwbUNgihQweADF/ZJkiF7oYfPdUY2NjO8rl70u9Aj9NJteAJ16bmpoat5vmU5z/G+Cvy4tkhOwcC4WeKtIjKF5DIAweAvI1Cpl8CamutgsntPn9y2gqdVjVPMAfMkKhtcVIeLaucCrs892JX/9LdQeSTL7j9fsHag3eo+sbHJwfn2H2hLxueL13zxaBSt4u7wuHD6iWkJUyNc3NiPVfLiTwDCE/C5//6Yxn4vwVQ9fvImfPTs9aJpeW1YRT4IS/gxN0mROyeQKyrYEmt5t7PZ6T0Wg0UWWic7tcrl9B8H+D1r9toZDdRjh8H545WWKfsLwBTrgPgPcUeFsjgH93JZPJ5yORSHg+gbe0tOhOp3MDrFDk9vrMblf6rZUNsMSXyrluRa0rZFk9YNyX5GRJGXFo4ghcYz8sZlDs1KrkPpn9fH2imQFTF1taGixbfYS8q1G6DqHuTLn3mEvvTkQIkW4+TpQFVmUkxa4TZppi48UwwHwoVqBFVZZdhxSrUWJBJrMm0QOwvfjNSpDtDbO4aVhsxoSAn6803abzZJrb4BYbC7xJNu9DbH+Hue9BqbtdVLFzuda8dW/T7/hp2gDMfgBWcU2VGnsfi8aN6F1U+i5i1QQgX9Pj96+EINbibxWE8Y05Yeb8LJKuI1D7AdTxb5MK3xBdSAFYxevl8O9l8P0esSUnsyvFI70+L+L1mFinTC/VMSZenz+ZruCqnF/8H8NHa92AY3WkAAAAAElFTkSuQmCC\";\n\nvar img$F = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIoSE1JoISKYQsUiAVEUS4mgTbSIEYzaZNc8hDyW3Q0SbAUbC8FCtPFV+A+0FWwVBEERRGz8A74akfWOCSRIMsvs/Tgz5zJzBtzRnJ63WoYhX7DN2EwkuJhYCra94qEPL37GkrplzM5Px2k6vu5xqXoXVr2a72s4OlZTlg6uduFx3TBt4Unh6LptKN4W7tKzyVXhI+GQKQcUvla6VuEXxZkKfyg247EpcKuewUwda3WsZ8288JBwfz5X0qvnUTfxpQoL81J7ZPZiEWOGCEE0SqyRwyYstSCZNfYN//nmKIpHl79BGVMcGbLiDYlakq4pqWnRU/LlKKvc/+dppUdHKt19EWh9dpz3AWjbhZ8dx/k+dpyfE/A8wWWh5i9KThOfou/UtP5DCGzC+VVN0/bgYgu6H42kmfyTPDLd6TS8nYE/AZ234F2uZFVd5/QB4hvyRDewfwCDsj+w8gsVKmgU+omlKwAAAAlwSFlzAAALEwAACxMBAJqcGAAACd1JREFUeNrdW2tsHFcVnrmzT3vt9e7s+gFNCa3TxPCjpEUi5AFCIlKbpFUrEolKaQuImDTNo2kgP3gIiYd4CPJqQ2gi8Wit0qoGShO7LUb9EUxIlRSDVJGkSWkIqI7xzs76va+Zy3fN7nLnena9a2e9417JnvV4duZ+537nO+fce0eWqtzC4fBNOHycyvJKyTQ7ZFlealLagnNNhBAvu8Y0zRQOCSLLQ5TSq7jmIo4DOHdW1/Vr1eyfXI17hkKh1RIhW4Bso0xI+7zuRunbMF4PfroTsVg/O+NIAwSDwSbicnXKlHZKsnxrVYaL0n/AEMfNbPb4yMiI7ggDAHhIUZT9oPVOUDogLUCDy0zAXY5mMpkfjo2NabUyAFFV9RHw8VvM1UtcZ5iS9AaRpH5qmhfwN/PvfwHE2Ojo6Di7oLGxMQDjNcD3l+BnOU51mLK8Ft+5E59dJe6dACu+GY/Hj7LnLJgBIpHIbVlKn0YHP1bkkjTA9gJMFz73oYOjc3kODNwAY60H7beioxtxylOEEecUQh7SNO1i1Q0AVX8IdD+GEauz+beGETkEah6bLzXFBpaEXS7XI/i4BxoTtTHCFNxiJ4z9s2oZgIRU9SC+sNvm4ZN4+HfdbvfhoaGhiWr6f1tbW10ynd4Fhn3dTnNw/ihC555yXaI8A7S3e0Oa9hxC2n02D3wJh13Vjtd2+QVc4wgA3G8TLU7Gw+Et0pUrqfkbAODDuv4iPt0lPCQFodqb0LRjUg1bKBLppIZxGGzwWVgpSb9PhEL3zmYEuQzad4tWBuXfpYqyaSQWG5Ac0Jqi0dvRqVMQ5ZtmMCEev7+UOyglrauqBwD+8wL4t0D7T43o+kXJIS05OTnk9/l+jYhxNyJP5P/DKy/3+XxqMpnsrZgBTaq6FRZ9RgTv9XjWQej+IzmwBVpbo65U6jTcYYXAhC+ACT8v2wCI88uyhjGAG9VbaG+aa5CCXpUc3FCH3EwJ+RPvDixEIk+4wy5PIHZ+jzj/Sx48EzyXotzjdPCsTUcjQjYBdLIAiBC/YZpP27m8YkP97aDFdgtNZPkxWO8laZG0aU0IBIaB4x4Ow/v9fr82NTX1elEXmC5sXK7LLAsVlPTeGuBwIRX+EjreF4vF3pqTO6jqb4QIlsik0+18lmpxAZSz+3jwLMPDz65ajCISnddQaD0Jd7wUVtX4nAodSnezypEnOLLV/bYaAPEIQuQsaS7S2+8lEol/1oTHsrzOmu9E7qj0FmDuv5G9ftsSySh9lDF9JgMI2cZKUv77qPMPOcWv0fE/zMUIPo/nCRxinCDWs4kb0QAy+N4pxM7Dw8PD47UCHNc0MUSHYIQ3YIQ7K7nP4ODgJLAcFFyjM69/JEf/VaDKMu4aaEX6J7UedRsjMCb0VWqEbDb7UzZHwbnXLU2RyNqCAQB+s1DhvTw+Ph5zAvWLMOF8JcI4Ojoah6D2CCzYXDAAlHKDEPe7nBTX7ZiQE8aymQDAXcLfG6ePuEkbLPouP4dnZLMRZH0JpyU4GHWaz0wxSt58bIeBQmWE1UZ8J84nf2D6BwhGf7VA/wEngrcwAeBZfp+P7eUwgc1LmpJ0Xji9ilBZ/oi1EiD9Tk5z80Zg+b0QImc1AqG0X3D1lQSc6hASkAtOz/UFTWBsbWLCiNT5o7N89YI10tMVRDbND1pOStKlxVDwcEZo4vreV8oIAHxJYMBSF2rnFt6cNJO5NqsIObBBEwbhFm3o4Dn001YY2YKMbM0pWgi+abnQMIyxIpXVfqGwcFRj4Pmix04T2GqUWP2T/BJ1vo23to4VmTr6vmWSxOEtaxinbRKiccFoXlL2HSn9GiuPF4sBkN0eKOu6plBonB/ZdCoVLZYGO1kDyskep5fX3G6Nc4kpF3jA1tkLBkAJ3MCXj2WkpLXPDK1R7JCuaXuL6ESDcCrBwuCQhRJu982LYYTz4Jn6lwM+F/aWCBM+QwRh8B2hSFixWMDz6o8092Ap8Lm2QgiLV4ksZEfiRU4GX/BlgE9o2uNlCGOH4BMXCEb8b0Kw/MR7EXzu2rUC2wfkaDTaanB+xK7LlcP6ewm8XTkMH1hChoeHr+NGf7eKJVnvdPDTEl4m+FxbL8wFXGGzxiRXJvYKavmgw8EfqDQkQ/C2Cv7fU5gSQ+sW4sVdgUAg4mDw+yq5T0NDgwoB3CBo3QsFA4AKr7Olb+7fLrfXu9Nx4Cn9caXgWXO73WxzlYenv67rZ3gGsBBxXCh+drNtajUmgWYBH49/udIbtLS01IPRjwn0PyHlttwSLiScgBjy+/lC8Ju9NYNO6Skpv045R/CsZTKZPZJ1vXOcbbUtpP75D1NTUyl/XV0dRv6T3ITBKq/X+2wqlVrwSVI8900cPo3RO6rH41+dyz2mN0tI0vMQdTfH7AOJRKKH+9vyhSBc4Qo+RriR6IX1N0qLsAHP74CHX9qPI8dp53McywaJZDKZ8tXXj/AbCzACy/x+vy5uLHB6a1LVHSh2Hhd07SsQv9PCuZkpMxSYXcSnjWlcuEbTtPOLATxbRYavn+EWT1jWeBaJ05r/feT00E5+soR8jokFd86DdPlksLn5FqeDDwaDS7OGcdIC3jQnXLL8sAi+mAGk0eHht2VF6RQmE1pJJvNqc3Nzi1PBI+Q1w+dfRV/fJ9T9O4ptsym6UTI5OfkmfD8AS67mUuSwYRj3eRsbe1ITE7rTRh4sfQ3gbxNmiI4givygaIk8y30J9OA5HLdYs0jzugJ1hSacc4rPg/anhKlxlvG9CNH7jB31S7oAjxWp51ZJKJaYO8Cy/Sgxd9caPLLVR5ngieDRXtFV9bOlwJfDgIIIggldIhPyeQLcYidi6zsLTXlFUZ6AX26a0SVJ+q0eCj1QznZ5pcznGcgDuqEJ9bwm5PME/O5EEqng5y+4Ll1N4NFoNODz+fbjub+C4H3YBjybGP0iKrxsOfereJo7FIk8QA3jKZspZtZ0JjqZVOrJG73FhpXnHo9nB4Cz3H7GS1rTy3aEbEesr2h3y5zm+Ruj0VtdpvkLIVmy1CBwjVdQTHWhY31znV5j7yKC5uvZZAZG+25W2Ra59M8IdQ8j1F2u9BnzWeiQwYZtsml+x+4lJn5w2K4TjM4fJfbKHHstNpO5xhZh8+uQgevXG9iCDFuTQIeWw3gdGNJ1AL1yFqHWoHDfwKg/NZvYVcMAhQIK4PaB+nvQ08aFEEC2ygvjHEFZ+6P5bue5YUtdbNYVo7sNo90pJiM3bIrANC9LbOLGNE8gvo/ciHtWZa0PxmAvVG42ZXkDWPGheY72RRi0F+C7Afqs5NSXp0uErVb4+xqw43a2H4ltyWG7UtjGjPybXtOvzxOis3VKtlTHVqtkSv+K/5+BsA1Ws3//Bc6zp+jC743WAAAAAElFTkSuQmCC\";\n\nvar img$E = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JErEBymMIKKQQsXCgCiIpUTQRi1iBKM22c1LyGPZTZBgK9hYBCxEG1+F/0BbwVZBEBRBxMY/4KuRsN7JBhLEzDJ7P87MucycAfd8Rs9aLWOQzRXM8FwosBJdDXjf8NCDDz8DMd0yFpZmIzQd3w+4VL0Pql7N9/07OuIJSwdXm/CkbpgF4Wnh+c2CoXhX2K+nY3HhY+FRUw4ofKN0zeFXxSmHPxWbkfAMuFXPQKqBtQbW02ZWeER4MJsp6rXzqJt0JnLLS1L7ZPZjEWaOEAE0imyQoUBQak4y+983VvUtkhePLn+DEqY4UqTFOypqUbompCZFT8iXoaRy/5unlZwYd7p3hqD1xbY/hsC7B5Wybf+c2HblFDzPcJWr+/OS09SX6OW6NngEvm24uK5r2j5c7kDvkxEzY1XJI9OdTML7OXRFofsO2tecrGrrnD1CZEue6BYODmFY9vvWfwHle2f+inwUtgAAAAlwSFlzAAALEwAACxMBAJqcGAAACSJJREFUeNrlW1tsFGUUnvl3tyV1e5m90EIAMVSwPkhQE0Tqmz7ILRDhgYSAL1TkkqqoCVFDYiRRIgGL1QiJFyRGAwkqSlDeAJEEBd4od4IJ0trZbbutsN3d+f3Osltn/53ZnZ2d2a5xkma3c/nnnO/cz39Wllw+wuFwSyqVms9leTaXpDZZ0x7gjDXjc6LMWA3do3GekGS5D+d6ce26LEkXZM7PM8ZO9ff3/+kmfbIbiwYCgbn4WK7J8gImSQ8b3aNpmgQG874b3NeDa0e4ph2MRqOncYpXJQBgugFSXgtCO0DwTDeAxdqXgdQeoLIXYAxWBQCKojSCqM0QSydk2CBV4IBWxGA+XVoyuWNwcDA6XgDISii0Fra6Dd9DheiF5M4DpOP43gMt6eGJxE34hdhwS0uMbvDfvl3v8XjqZZ9vGgiaJXHeBi7bweQcXPYUWFvVJOmtAVX9hN5TMQAawuEZXk37HF/bTW5JgomjnPMvIa1jdqXU2NjYBGCewTqrAMazOOUzufVXJstr4DAvuw4ApL6Sp1J7YOd+g8tRmEJXIh7/cHh4uN9Jtff7/aGampr1iBad5HIMzGIEWrYO2rDfLQAYHN17IOBVg5ffgQTelWV5p6qqMZfDqh/m8xJC5xYIoS7PUUrSrqiqbrZqElYBqAkEg4TsinzXzI+AoI1Q8+tSBY+mpqb7AcBuCGSxAQiHooqyUrpyJe4EADWQ/CG8aIFwfhTMvxaJRLpKiWROa2YwGNwAH7ED9NUKl45GFGVpMRCKvUiG5L8RJQ+Vv+1hbDHU/TcHmbZNZygUejSZSh2GRkwW8oZvkS88V8gcWJHkZrvIPBa9wn2++RaY5w5mbQXXgvc/C7rmQzCXclBjbKkSDO60hSx5e8T4r0TmfT5fe19fX28FpF4y3c3NzRPjo6Mn8jJRztfAVPdZXojiPEsmz2Gher3ak+QH+/quuWzjZa2B3GE6JP+L3hxA+99ej2cONOWSFROQKcnRM08ODza/pEzmZd2fE/cZvg/R6Ab3eBZB6mPOj8JlkvN9RvwyA9Vfm5fhwdvD5s/YZN4KM3afNQahv/8cKtGXBUbnImK8WFCNqLBBMnMZISWsj/Own4U2mHej1C7pXeDnO5jDEt2pSCqZbNWn5rkagKpOzzxleJTkVAnzhdY1o2MT2b8+sKG2eN3QBNL1PEranItIbwtkeNxhdXccBOQAN8HDttzSlG+kIisPAGpmCPV8lHJ7qToPyyAjbH9AZbPOIfqZ19uRD4CmdQhwdhUobLhVopBJVhKEPLp6e3tH4Md25TzIeUf2eZbt4QnJQ4JK2nKZd6XfCEB1oFoCIZFIfJyuXcaekmfAQT6p14DlQtg76mQ975QWZNeJqGpJz8ViMRUafkRw+CvGANCESg/V1f5yVBHFiSipskEowLwl7YM/2y80MdKhXU737TVN33vXECtDJm2ssmwfHpkKF9sAFJB8UbooygGFSE6PkfOpjDYthILnXAk9PFP0jYhFCCqqCaLmWGDekhYgmRtCTfy7cHoeox0bwTZOOGX7RDRJ3chEimlNFggLzFvv6UnSyRxhy/IcRttVwn09Tpa4RipvpAlmmlEG83n0QrsvCH6gjdFenYBKj9PJiJkmZJl2iHkr9PQIjnE6o43KHAASiZtuxG8z5+eC5M1VgvM/BE1sZlADRX+SdmzcSmKsMuUG85niLiZoQAAJIJugP5ndrhovENxino6hoaFhQSNqmfQ/PxjUIqdvThuVbufylUibjY6Ghga/YAJJhrifk/TQLu14Me82CEKfk0zgLwqDOS1u2qKuJPNmNu8GCJD4VCE176UweF0IprPsJhp2mTcDwSxjtEsPAJglaMANRgNJQrBsKzfxsSN5u7VDiYlRmwBID6NpLCFYPuW25zWTeKm1Q8l5gCy3CxpAmz/sVA4qjM3RNw2dMgOrcd5q7VAqHcFgsB4x/zHh9GlGc3g0iqb3DTSWMt6ZYKHawWYaTDx5dSeuprvGmfBwRE8gzeSUYFfcSeZt1A6WmjQo8lYJ//841hKjIUT94jSQRDM5lZa8WyESCVAAiCwUADioR0pWFOUiGH9QpyJbI5HI2zZbULycyOF4DhIIvAGX/46Ot2vgrZW+sTGCaQIzN0Z00kCSjTjMpSo6Jk2aRINUnYL092TpZLrwt1coFwM0jVViTsCd6CI5edwdHd0k7HeOaMnkHl2b7N5Bs7c0fiqEny00cOBkYlRh1Z8C//amkP52m+4OA5n3pdx9tDqExN1OtMXG44CqdwkDnQOJRGJ7DiD6f4DMAM3eCr5gEY2i/ddAUEKhDhC2TEgGttIuUTHiGcIMtY/n6R6Mw2tOsJmFVRygpnB4tpRMntZ3u2D7ZwaiUeIpZaoB2Xtp8Dg9e/uvFtQ2KcotJ1Jh1yWvKNPA7Q8C83c8jK0WmTcDQEpPXTO2TmgmTAIIF2kUrVpt3t/SEoZEfgJTUwTHt1FVVcN2v2lPkKauafBYAGEmzeHpIoNcLT6AJO+Nx4+DxodyVFTTumG+n9q1T6YEgwdFZwKVuuX1eBbThGY1MJ+2eVJ7QfLwXYfB/DIj1S+qAVle01PXknRU0ITJAOFUUzC4vhq8fdrhCcwjmv0cCQRWFGLeuoduba1VVPVrmr3N84Ka9j0+NlFpWfEkB3E+L9RlJU/MWxiX91gryyKpu3fvHphQV6fghXPFPhvK5xfq6uqo6jo7MjKScDu399XWvoJ3HoBze8RAIN0QxvOg2RIdsg3kVyNF/ghmcJ/BZZUGkmgmR0w4yj2opPV6veukexOgeaV65lcrG2Dzn5Wyri0PHgqFZiY5/wJ294TJLaM0k5MZSzlGwwk21ZzG9p6mZkamnq8xdFRIcijOm4U6t7I0RrO3CJXUMwgUuC9Fkxk0nJDZn++hXVqqPLN7dbRjQ5sW1LfPtK7bqIGJZx4vYqYDmb5FdzFn51qaipxAofFTmsA0+SWZ4wdlqVTVUWFTrqk5lsRQJzk9galpaxEtWt0p7/g1amZQPV/uL0bdLFTk9BAizeFp2sKyweD8KjUwqYc30N9/UqrWH08XitdUWdJAEs3k0FgKTWbgMwxf4M2E0ji+R2ivjraraMeGNi1w6bTb+cU/7fBoL+/5UFUAAAAASUVORK5CYII=\";\n\nvar img$D = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/N4piFBEtRCxSRLFQCApiKRFMoxYxgq8mu24SIRuX3Q0itoKNRcBCtPFV+A+0FWwVBEERRGz8A74akfVOVohIMsvs/Tgz5zJzBrTJvGG59TGwCp6TTMQjc/MLkcYXQmiE6aQ9bbj21MxEiprj8446VW8HVa/a+6qO8LLpGlDXJDxi2I4nPCY8uebZireFO41celn4UHjAkQMKXyldD/hZcTbgd8VOKjkOmuoZyf5h/Q8bOccS7heOWvmi8XsedZMWszA7I7VbZg8uSRLEiaBTZIU8HoNSC5JZdV+s7JtmVTyG/G3WccSRJSfeAVGL0tWUmhHdlC/Pusr9f55uZngo6N4Sh4Yn33/rhcYd+C75/teR738fQ+gRLgoV/6rkNPoheqmiRQ+gbRPOLiuavgvnW9D1YKeddFkKydQyGXg9hdZ56LiB5sUgq991Tu4htSFPdA17+9An+9uWfgCZXmfbLPy9EwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAtBJREFUeNrlWwtuwjAMra2cALj/CWFHWLYiQKGLEzu282GRqiFo3bznT23PhY1Yl8vl/vd6vW6VFTf5AitZp/P5JQsByPMoHEABr12oAE/d21IWG0+gTuywYrLx2OumR8sOSnmg3LwaONcFiqZT0j4jBngAhoZYVDX/HLbQCfgRWJT6MkVGycefn0tEQO5HS7YJWWwCanI5+y8REKxUu99UEEhzsQO0hFOKK5GFrdrfhT2PQU+RJiVVCdA8WkYA0O4DPTdrHUg5AKUk4AhNzURy0DIqDH4uJB/3sH+mAt+fVPg7Ri+Nx5bonpFtIscrFeZkfFGxeSs5pLLQGfww2Vy3xIXAu9wDO2xMY7bgTQJODF5EQi4Q59zg+B1ODt7FElIS4HQ+v/34dbv1Ah8NrqleW+t14OSad7cEXAi8Cwm4GHgVCRbl8Azgm0igiqagBf/rR+BZCVaKGaor/ZY2l/aEC2reNCaE9LGXtrgy1diM4KuW8Lt/YPcDMqayAniVO+CiZm/mDvhB4JtIwA8DLyYBt3++Qmsw6bUa8wq2FeOoRoTjErkw9io6ZgR/dwGLVHMl8Mf+BzIaCCtYQvOTC5m9tJlJUD22JdVg1h0etQKsCP7lAtyO6mSWYJKwoaQWn4gEs2wVGxOOkSSYpuqaVHgECeZ1ingqy3BTUXl+E/gU3z4aYFEM9bAEc/B38wdonxLrSIJreW5ZDnuQYAaecm3UChjQNDG7B/m/QcoNJiDBXDZ22CiMluM6K1wQDoqgaqb12mMdS/6hcINlFqZDz9z3hVYnIcUVtg9dZmNyveZ+e4En3xpLL+aAfp43G0Fdp8UVsSCOKKWzEyKcbtAKbpAL4hwMotfmDF6vE78252mJr1RYo+G9KfpojHIOiYuwjlalNI3LCwYopFle1ChAky2GI7iOSc4xz+/SVK0+BrlEPH6HwgyR1MebSOBOqVHf/wB4polu0KoYHQAAAABJRU5ErkJggg==\";\n\nvar img$C = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAZdJREFUeNrtW1GywiAMZDOeQHv/E9Z3hBenf05ttZAACSQz/lQHdjcJCRVSCgsLm9nQcC62iA3GSDfHCcOkm2CGI+JVsKMDeTQcq/oA7H0OVASmvb5UmQ8VwPSsLGghABvoKdRwwCl5NTxwTF4FF5yTF+MjJ/uIrmWQjZMXYSXnnhdjo8Lc8mRcqhg7834RdkqTGw2S+8VYaeDcv8SJBvR+tRTwZphdgEtpQJPkvygCMHIaRB8QAoQAIUAIEAKEAOUvFDxugCICfgiAgfmiNAKG3R/cpAPcH4/093wePte0szmOnuc4jTQ2QHuy2uSV5oA0AvibMDVIC+a4nLLTV4GS8zrWq0QW5tsMTl6W5fCLdV1/pgCclcQsbJswqBFWxsjjnfDHIvj+8CxUHETCpQMSW8hLvDjEEZm9kzX+G2Qv5LUaGD759CAvwrFxj4OSFUuOi6OyJOjhkRGiGqGuTl6SApKFcKjj8j2rgakLEy2FMHtlpqYYri5NaYlh59rcvn38Z7sbQgK+9v4fv0+TG+V635N5xt7MXlrTY+62KCOPAAAAAElFTkSuQmCC\";\n\nvar img$B = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/4yOikYAKilikULFIICiIpUTQRi1iBF/NZpNNhDyW3QQJtoKNRcBCtPFV+A+0FWwVBEERRGz8A74aCeudJJAgcZbZ+3FmzmXmDLjmUnrabglCOpOzwrMh3/LKqs/9RgttdOOmT9Ntc35xJsK/4/uBJlXvA6rX//sajs5Y3NahqV14QjetnPCU8NxmzlS8K9yrJ7WY8LGw35IDCt8oPVrhV8WJCn8qtiLhaXCpnr5EHUfrWE9aaeFR4aF0Kq9Xz6Nu4olnlhalDsgcxCbMLCF8RMmzQYocAakZyayxL1j2LZAVjy5/kwKWOBIkxesXNS9d41IN0ePypSio3P/maRvjY5XunhC0vjjOxzC496BUdJyfE8cpnULzM1xlav6s5DT5JXqxpg0dgXcbLq5rWnQfLneg/8nULK0sNct0GQa8n0PXCvTcQcdaJavqOmePENmSJ7qFg0MYkf3e9V+kTWfgP9nSuwAAAAlwSFlzAAALEwAACxMBAJqcGAAACLpJREFUeNrlW1tsU2Uc/76vl5HZjZ1e2Ea4GRZwvhD0AYHxJg9cAxEeSAj6sokCoqAmPBATo4kSCTgkBEi88kCUBBUlQ964yBIUeGOBcQkmk+HabmwTurbn8/dv2nL6tT29nq7ML+nanXN6zve//3///7+cWbx8Pl9TNBpdLDmfJxlr5br+rBSikem6JoSYRNfouh5iQgRxrh/n7nDGrnMpr+H87wMDA39buT9uxU3dbvcCvK3TOV8uGHu+lHuBOT1gxGmp6yeCwWA3DsmqZACIroeU27HRDmx4jhWMxb1vQlOOgCtHwYyhqmCApmmTsamdEMt2SLveCsIDfj9zezxGrRjmQnTqkchnQ0NDg+PFAK55ve2w248Y5z4zLYbkroJJ5/G5B1rSI8Phe/ALwyNNTcN0gev+/TqbzVbHHY4Z2NBcJmUrqFwCIufjtDC5t19nbPeg33+YnlMxBtT7fLPtuv41PrZluSQMIrqklMcgrbOQUrCY50yePLkBjFmK+2wEM5bhkCPLpZcE56/CYd60nAGQ+gYZjR6GnddlOB2EKXSGQ6EvRkZGBsppBi6Xy+t0Ot+Etm0nl5PBWY5CyzZDG45ZxQAOR7cHG3g3w8MfQQKfcM73+f3+YYvDqgvm87Yu5S4IoTbNUTK2P+j378zXJPJlgBNOiDi7Pt01y9PY0Fao+R1WwQXzmAXzOACBrMzAhJNBTdvAentD5WCAE5I/iQctV46Pgfj3AoFAJxvH5fF4tsBH7MX+apRTXQFNW5OLCbkYICD546rkofL3bUKshrpfLjSUW+WbGjStDybRrOQNPyJfeMXMHESO5OZTlXjctFc6HIsLIF4aXqyI7+T1vcFgcCoEcyOFi0Ks0TyefaYSNvP2qsMj4h0OR9vQgwe3LSA6n/uZrhqnc0kaExh7C4LcVJCqUZwXkQiBEZdR7UnyeRJv9eJmzhGSv4i9TzWGSLvN9gLyhBv5aACnJMdIPDk82PyqHMTnK3Ge41WSL0E0ugtiV8FBJ50faHkmIuU3megVGVS/PS3Dg7eHzf9RgtQLITDfa2U2AUDSV4BEdyiEvoSI8YapKhGwgfr04qPXGOcR6lYUSTwvow8we4bM9EzQ8xPoWW3EVdFIpMWYmqdqAFCdkXjK8CjJKWJjnJW31mB2P2ny/zbQ8K8xsCF5ej+jCcTwPCBtykmktyYZnqxkkaWYeyMHuAcaPk6FpnIrgaw0BlAxQ8HzQcrtCyCeW0x8UUxA2P6cYLPBIbqE3d6RzgBd71Ao7LQa2FjgD9JWf3//KPzYfgW9tScYyZM1PM67DZdExkKh5iyQVlZY7UtOpevq6jwOp7OPcI1B4G0wkYsJDVinhL2uKiS+6DU8POwHwacVh78+aQK6gvSArr6rUlqK9jPwZ8cUM4iFdh6r2+u6sfauI1Z6M5SxnkrpG6McuBDAR5tB0tMFNS0UwHOt2BpeNS8kcw+Bif9UDi8U1LFRbOOcVZh9vBfs/UKKsDmfL6hdpVzXM04Iz/oQouvXFT/QKqhXp3Clh03c1aM4xlki1qg0MiAcvldB9ZeV1C5Et7+UtLiRNGAKAEPyIHVsxiGpqQgTqKWmaIBPAC46kR8nDybaVeOQ0VnOhIcPH44oGmEX7H++BOwgbDQBalSOE6KzPKzW19e7FBMICfx9YDQB6tJWMK2taE6h9jNhAgFygv0pu3I4ZjwNuX2ReGC6UvDppzB4R9nR3HJj8qpBUpzPVTTgrqCBJCVYtk6EtDfLalUY0iNoGksJlm0T1eMD9rcpGnCVe73eZkSCPsPxaBwOD050OAxsMFPQHB6NohmutdFYygRUgJeVWsCtWNU4Hh5OK6qxMU9pPzXOECBvo/L/r3GIHFOFEymUCrGMZnImiuiRALkhvRUKA04kGUATmLEhxCfLERtImiBaYLfbNzNDRRgqfntwYOBCkgExImgCMzVGbKeBpBLATVWs5ubmWtDyjiL9I4k9C0P4O6rARTdNYxXg+auSCY/Hxrax1H7nqB6JJIWdZADN3tL4qVIw2NXQ0DDzaWUCQt80mPZuJf09mLU7DM7sZal9tFq8DhRYFaoaJkDVO2k4wnBoMBwO70lhiPEf4gzN3iq+YBWNohXBhHIyouD7aV5vBza3VknzP6AuUS4CaDSOPORCwxdD4OQimrwoUuq8BMILvk+DzzePRSLdiR9kxG3/8mAwSDRFs2pA4loaPI7N3j7RgppINHqKBpCKJLCQqbGSJsw0TZsBan9RiH9kE2KTSnw2BrDY1LUQm5ViwlQ4yTONjY1TSsT2Mser6OVqavLhBmdA1DTF8W3x+/0Zy/1Za4I0dU2DxwoT5oTGxs6baMK4ASSSvD0UOoc9PpfCbV0/GAgEvip2s0LzeE6ozgQq1SdttpVDAwNXK5Qk8Zw2T2qvSB6+6xSIX5tJ9XNqQILW2NQ1Y12qOdh0/VJDhrEzE9PgBRKc1/fI28ccnkI8otlvAbd7vRnx+atrS0uN5vcfp9nbNPHq+s9420bQsuJJDuJ8WqhLSJ6Iz2Nc3pbX0wKB6OPHj3+YVFur4YEL1Dob4PPrtbW1hLqujI6Ohq3O7R01NTvwzO+F2tmO2zyE8Rr2HC7ZtrJwfhNS5EOZfq0RyyKl3I9s65CacJQD0gLVkcltz/QjrfivVrbC5r8sm3PJtrxe75yIlN8KRRsMa4xmcuJjKWdpOKGY5yADrYOkl1IxI47nnRkdFZIcivPZQp0VGVrMF9LsLVz8hyzDj5gMK0qTGTScEO/P91CXlpBnoldHHRtqWlDdPl66bqUCJr7zIsF5k3sPUnoLBh/M5ewsi9nICTQaP6UJTGXC3LJFWSqhOgI2pZpa2ZIWGj+lCUwuZQdsdLY18E7epmIG4flyzTFZkbVxZGWLYnN4ur4CobOlRKJvUQGTanjxMlZ1/njaLF4TsqSBJJrJobEUmszAuxu+oCYeSuFT5T/Uq6N2FXVsqGmBU91W5xf/AaUAHXpt/nz4AAAAAElFTkSuQmCC\";\n\nvar img$A = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZG9S0JRGMZ/aqGVIVRDVIODRYGBFERjGORSDWaQ1aI3PwI/LvcqIa1BS4PQELX0NfQf1Bq0FgRBEUS09A/0tUTc3qOCEnku574/nnOel3OeA/bZjJY1WwKQzRWMcCjoXYoue52vtNGPiy5GYpqpzy3MRGg6vu6xqXo3qno13/fv6FhLmBrYXMITmm4UhKeEZzcKuuId4R4tHVsTPhL2G3JA4Wulx6v8ojhV5Q/FRiQ8DXbV05tq4HgDa2kjKzws7MtmilrtPOom7kRucUFqn8wBTMKECOIlTpF1MhQYlZqTzP73BSq+efLi0eSvU8IQR4q0eP2iFqVrQmpS9IR8GUoq9795msnxsWp3dxBany3rfRCcu/BTtqzvY8v6OQHHE1zm6v685DT5KXq5rvkOwbMF51d1Lb4HF9vQ+6jHjFhFcsi0J5PwdgadUei+hfaVala1dU4fILIpT3QD+wcwJPs9q78GJWgN6zGReAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAlxJREFUeNrtW1uOgzAMxCgn2HL/E9IeYb30AymkYbETv6BEQuoDiD2xJ+MQYNhp0zRh7fdfxEGrjQCb7/M8w6DcgOq4BwAWQADVcU8ANIEYhy9vcDT6FnnISUNpe1Ikx8u+qWnZFQG1Tjydp0SDpH1fzwFj5NHP7CmPexZQJ8FK4xASXA0A7HG8V1aX5/08HmKyOmmiazGNcW0pgUjEUQBCFEBEx4+ASFfMay0SdJOxZc6/ns9ue96/v+1JFihHltWj9uhHEVY1O9723lLYKfSRKazU7JHmAEq4Y/HZNUVSgCg8BKHC+ig1IB4cAJ11hui5aUWXoq+V89YkHUrlOzLEBVJunh+NIEgqUmBxAEdhOTeXJTE4k2NaswAI5nuIYstjFgjjvBcAocrs5OQwdjp/aiG0GqbtPOncUSCfwy5/aXMAGilEOyHUG1pMWR2GOLE4uOdXrzEAoaktdm1sry13g1MxZDUlYisHoLVxJiSYh2rgsNUVQsQOwCsFNFeEWoohby3PFUL/2paOtqYRQXBf3LQWQp7OhhBCR0UNSgI1TdPmu+TTpqQwGnjqFOh8ti/ufDn6V1wQ8Y2AvaemEYyrjf5ir7wQ2ukcpQknSthXSYwz6vlDj0WlQV5p5SVx/p8QV3DvB7VqMFeW4muCBFndS7LAuB/ugPAJgOUObVfSK5RvqpBMMxBEWQ3CKQCcFCCToDL5QZT73TrgBkB3Pg9FqDV77rfGLFCOsFlyz65k2Xm0V/BUIqBHVpetZcvOqvKob6GG5YDW/Urc61RSILKs/nhjxKKzCEDs8c8fwBklUiRq2yMAAAAASUVORK5CYII=\";\n\nvar img$z = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/4yOikYAKilikULFIICiIpUTQRi1iBF/NZpNNhDyW3QQJtoKNRcBCtPFV+A+0FWwVBEERRGz8A74aCeudJJAgcZbZ+3FmzmXmDLjmUnrabglCOpOzwrMh3/LKqs/9RgttdOOmT9Ntc35xJsK/4/uBJlXvA6rX//sajs5Y3NahqV14QjetnPCU8NxmzlS8K9yrJ7WY8LGw35IDCt8oPVrhV8WJCn8qtiLhaXCpnr5EHUfrWE9aaeFR4aF0Kq9Xz6Nu4olnlhalDsgcxCbMLCF8RMmzQYocAakZyayxL1j2LZAVjy5/kwKWOBIkxesXNS9d41IN0ePypSio3P/maRvjY5XunhC0vjjOxzC496BUdJyfE8cpnULzM1xlav6s5DT5JXqxpg0dgXcbLq5rWnQfLneg/8nULK0sNct0GQa8n0PXCvTcQcdaJavqOmePENmSJ7qFg0MYkf3e9V+kTWfgP9nSuwAAAAlwSFlzAAALEwAACxMBAJqcGAAACQFJREFUeNrlW2tsHMUdn5nbuwv4dXd7ju2IUh4BbAmpBAQyjfnWSJQQSqREAslKK6QY0jwoBSIqFRBCFS1tRBKSUiUfWmgkRBMEgiRA+QaBgNoS+FKHEN6oiXOPtc8Hie8xw2+ud2Z2vPf07tk+Rjrfend2d37/x+///8/MUeJxi0ajfZzzHwtKrxKEDFDOLxaM9RDOw4yxoOyD6+cIYxaujeHap5SQUSrEBz6f761YLHbay/FRL54ZDocHKWNrAOwmgOyfzcM4If9lQhzG4YFkMvnuvBUAQHdBi+uhzhGAv8wLbUGgJ/DsPbCOvRBGal4IoKurK8QM4z7B+RZou6N0PplIkIhpemK2sIoUBr4DEtlmWdbEXAmAhUzzTkbIoziuhJRDOMdgHW8SSkfBAx+KbPaLfD4/me7tnZQd2k+f7oC/d1C//0JoV7pMP8DdAG0vk+8p+2QhYuCM31rx+F75X9MEAGK7jAvxNA6vL9MlC9CvUEr3AejrExMT4w1alyTKFXjOMIR3I075y3Q9kmPsF6lY7GPPBQCtD0M7f8HA2hwuJ6GVHZlM5s/pdDruptm3t7dH/cHgJgx4i6QcB36YpD7fnbCGZ70SAAub5jbc8CuHl3/DKH0MZrwdYSvtZdgyTbNDCHEPLPABKOE8B7f4Ewhya60uUZsAli4Nhi3rWXRe7fDCgzDzzTDzz0gTG9zjYgh8F1zjJofL+0HCw/jOzF4AAB+xrBdxdKMGfAq+eW8ikdhN5rBFIpEtEMIfcRjQxncYlrC6mhBoVbMPh58HG9+qmfypccta0sB4hRfcBLe4Ns/5S3CJXgdLuO3/kbMMwIrJjWk+4QD+RB3ghfYhDdxXtcEK/yX8/uWIPCe1S2thIX+oqOEKprWuyLg28MFA4IY6ALjRahLGxJkzn/j9/qEZQqD0vnA0entdpoY4f3kun39PDXUA/z88fHkVshNNcPuK7tG1ePElNJt9S3UHjD3NDeMqpzzByQJYDkmOLc6D8Ayfb5VL4GmVz6ysS1qCj7FVKvkBS7vB+d+cns8cCGUDTg7aTJ/SX8fj8fcqDEDUAZq41FdU4IR/Q2n3a6eH4ArrK5qTTD19hiF9KDL9FrArCo6flXkxrQKeusgDdb8DPHZIyxPiwLNULaBsFoDEYqsKXmZ4+NpcYSCiihbd9Htar3CQoG0ChrMqvcEf7nV0AVnWIr3cZLtI6e8grS/mwSRLtWc7CgGc9Skw/F7reDcso3OGAFDTj0iyUF0JYWXHPAJfzRochYBs9Ql8WQrgTkHpel0AFPa+Xkslt4+NjX3tUabXtAZCnMSgdtoGyfmITWNId5cj4zui9MlkM5klk5OTiWaksi6TI3UqpQPB4CkcGoqCB+UcIysGyrWahA47gJ+PrSZXKMxNCPGqdnrNdy7A+UrNb/Z5wNZz2oQQf9dym0J4pGDEC4D4SzV6oHfErVnX+eIKxRwnrhI/MsY+ps/roW78zwIDX1NDSLTg2u9recJyhpCwTEsMjixAfLW5HWNv2MyG0h8x+P+ARoCjLaJ0J7c4rnUYQKJEL6rUqZUaNG7DJtcpGdLfHo0tv2yylkSz3EAuyNj+Z6xHWkC3NuszOQcm2pQMUq5GKTilBSxm0LihdkqlUuk58k/PhVBaiitOkhBkvwFGvudNusCUeqKzs7N9jsKW5xmkXIRVXQD8l5UukLSHyu+WuJsohKakz3IFWnUBZMBnGExgTKsDftDkBKZptYNcftfC4Ji0gM80AVzRQomPLu0rtDAoZ4yonvgMtAi/UYeScEDrMCot4JhWJg61LOVzbsNGhXhf7ui6EPHw8+9BORwqlsM+JQQuYYVZXyHUJSPZ4SetpnxEgBUqeITB4/F4/BQrFgmHtKJhuJW0X6xxhrVwf5iUZkcA+IB290okRJFW0b6cFIWb/1Qr+w9MC2A8Hj8CEX2iXA8YhnFXq2g/EAj8kig7zAD+I7j+O9MCKFgIpXvsj6H39PX1nb+Q475s3d3d7cBytzYztKd0/3QxxHO5PSAGdSEkei6T2bzAwFOHEljuaovYyn3O907LonQgJw0RFnZrfvJgYdZ4gYIPhUI/RMHzG1snxnaWXR3OZrOPS0pQmLINrrFzIYIvjv9JfFQ3TsDSt9n6qP8UVoOEeFh78upwNDrSwECFy8DrAm+a5kb4/ipbIkjIg9LSq93sC4XDRyG5axW/OUcMY3A8FvugQU1Rj4iu3B6nqzHmtyGAoHL6aDKRGCLaljmnGaG8j7F16sYCCGMRpHBQps2z1KBwsa8jeKS8F+Xy+ZdV8JLcwW8/Jw77BR2nxBKJxHHcsFHreAFG9Fp7b2+3S+Zc7tPwHEJPT89ikNxrUNgSjQzuQtr7kSNPlHsLiqG/Igrs1kil35iaemMWluB+iatofiqTeRNjvFyT9vbxRGJf3Q8s8QHC4AsOZPIVpHFzDZwgvAQ9DT4aXUbz+YO65vHyF6xEYg1pdKus5INkJLIWd/9TdweSy71TQ3Sodw+g030VW8g0N/g4PzrD7Al51QqHb68EvnZ2ljvGk8n9uiWUpEyF2AKX+aqZvlB0wyfh87fMGBPnL1qmeRs5eXKqaplc09uSyfzZs2f/sWjRIpNSep0mwQFkWyPntbXxcCh0LJ1OZ70EDqJrCwaD90Pwz0HrVzooZKeVTN6BMedc8S+9gRPuAOBdZX6tEcPfHblc7qlUKpV0E3hHR4fp9/s3wAplbm/OnO0q/GplAyzxGVcJpkyW1Z/n/Bk1WdJaBpo4BNfYB4t5Xe7UauQ9xf18K+RkBkxdbmkJOE71EfKuQek6hLoTrjNslQgh081HJBdV6JeTu06YEHLjxSjAfChXoGVVVlqHlKtRckGmuCbRD7ADuGcIZHtNFTdNAsBDEPBT1cjOCwGoprkVbrGxzC/JXG9y+zvMfRdK3cf13L7pAlASkbDcbQqzH4FVXOJNLSg+lhM3cu6i0d8ieiYA9ZmhaHQIgliDz0oI49JZYZa/AGHsENS+H3X82y5Xmd6vyxXj9SD8exl8v19uyZG7UuTGjNLeBLlCLRdp5TplYamOMfnz+WOFCs7j/OJb5EAGggqAwaMAAAAASUVORK5CYII=\";\n\nvar img$y = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/EyXigxSxELFIEcXCoCiIWEkEbaJFEsFXk6x5CHksuxsk2Ao2FoKFaOOr8B9oK9gqCIIiiNj4B3w1EtY72UCCJLPM3o8zcy4zZ8AVzmo5s3UUcnnLiMyF/EvLK37POy58eBhhKq6Z+nx0NkbT8fNIi6oPQdWr+b6Go3M9aWrQ0i48oemGJTwtHN60dMW7wj1aJr4ufCI8bMgBhW+VnnD4TXHa4S/FRiwyAy7V05+u40QdaxkjJzwkHMhli1r1POomXcn8YlRqn8x+TCLMEcJPgiIbZLEISs1LZo19oxXfAgXxaPLXKWGII01GvMOiFqVrUmpK9KR8WUoq9/95mqnxMad7VwjaXm37cwA8+1Des+3fU9sun4H7Ba7zNX9Bcpr8Fn2vpgWOwbsNlzc1LXEAVzvQ+6zHjXhFcst0pVLwcQHdy+C7h45VJ6vqOudPENuSJ7qDwyMYlP3etT9GwWgrP+9tUQAAAAlwSFlzAAALEwAACxMBAJqcGAAACRlJREFUeNrlW1toHFUYnjm7my3rJs3s7DaJ1FoxtMYHS0Wo1fgg6IO9eEH7IJTqS2LVlnoHQRGEgrdijVYxffBWRLFYL7VEBR+s1kLViCAGW6tUsE3c2c092ezsHL9/uklmzs7sJdnZWfFAyXZm9sz5v/9+WVnyeCUSidZcLnctl+U1XJI6ZMO4hDPWgr/LZMYa6BmD86wky0O4Noh7f8iS9KvM+U+MsWPJZPKsl+eTvdg0Foutw587DFnewCTpcqdnDMOQQGDBZ4fnBnDvCDeMg+l0+jgu8boEAEQ3gctdOGg3DrzKC2Cx90kg1QtU9gOMkboAQFGUpTjUw2DLLvCwSarBglSMQX16DF3fMzIykvYLAFmJx7ugq7vxOV7svODcTwDpa3wegJQM8Gz2DOzC2Hhr6xg9ED13rjEQCDTKodAKHGi1xHkHqOwEkWtxO1Bkb82QpCeHNe11ek/NAGhKJC4NGsab+Njp8ogOIvo45++AW18ulEtLly5tBjA3Yp+tAOMmXAq5PPodk+W7YDBPeg4AuH4nz+V6oedRh9tpqEJPNpN5ZXx8PFlNsY9Go/GGhob74C12kclxUIsJSNl2SMMBrwBgMHTP4gCPOLx8Chx4RpblFzVNG/PYrUahPg/AdT4OJkQKDKUk7U1r2sPlqkS5ADTEVJWQ3VJomvkRHGgHxPwPqYarubn5YgDwMhiy2QGEQ2lFuVM6dSpTDQAawPlDeNEG4foMiH80lUr1SD4uVVXvh43Yg/OFhVt9KUW5tRQIpQCQwfn3Rc5D5M8FGNsMcf9eqoMVj8ev1HO5TyERFwpxw0eIF24vpg6BEsHN80C2S9j0FA+Frk8nk79IdbImJyfPhsPhD/FxA+yQOsc9Wb5sSSSiTE9N9VUsAWTt4ePfFYkPhUKdQ0NDg1IdrpaWlmWZmZmjBZEo53dBVd8uGwDy80zX+7FRo1XswflrR4aGTkt1vBA7rETM8K1VHXD2yWAgsBZxwm8Frs0JFApyrMSTwYPO31zvxNOCN/qTBwKbwPU540fuUuf8bSd6mYPodxVEeLD2MHgnitoLVeW1JLTY+0aSyX5kog8KhK6Dx7i3qApQYgPDcRLWI2H189CfjeUeJqVpco2Jl/FOt0TtY6jDzZZLqZyut1tDc7sEIKuzEk8RHgU5lXDCa0lw2L/Y+3aS/lu/jtziMUcVMPN5pLS2mwhvFxLheQVCpfsiBjgDGnbbU1O+g5KsAgComCHk82mK7Uu9xE3kEZzwWhBfSuXgtl+itNliEKMsGOwuBMAwugW56ik3sXE6BJA2D41/vhFPa3BwcAJ2bK/N8HHePWv/2GwNTwgespTSVnJIOgzEzbGS5Rfx88RkXzNzl/kQ8VIYyGusEnCH4Pb6FpLPI9CQq2kTqkE8rbGxMQ0SfkQw+FvmADCETA/Z1YGFcsxNEioFoVrEW/KCA0IRw3Ttslm3Nwxr7d2Ar4wvttjoRAAB4yYlXhI/6+WAQsqWAHJ+EaOmhZDw9C+W+FKGsdbEm99PpUaRE/8gXF7PqGMj6MbRarkuN3Vwc5FeEW9xed/YmC3Laxm1q4TnBqrpv51E3kkSvCY+L92/Cnagg1GvTkClqgCUYxhrQbwTc2EYVzJqVNoAyGbPeBHGVuoivUiq4N3+EiSxhUEMFOtF6th4lciUS5RXGSW11AQJiCEAZEusF2fbVX6B4GU6PTo6Oi5IRJhJ//PFIBa2ujk1Kv2q5HhdT2hqaooKKqAz+H1b0ENdWr+I9xoEoc5JKvAPuUFbiZta1LUk3k3nvQABHL9ICM0HyQ3aKj5mf77GxNeqqAIAVgsS8CejgSTBWXb4wfmF5g4Vrg4BkAFG01iCs7zOL7GvNHeoOA6Q5U5BAvplbN4GpP8W0mEVGeGwX5UcL6JDVVUbsSmlw0FLbnAxozk8GkWz2gYaS/GzjFWtoorA7RutxOPC72bVOO8ejggPb/WLeK/Ka0jytgr//2yuJEZDiDbjwNhNNJPjF/HVdpEIgGLYaKMAwME5AGgC0xxCnF8hcyDJR+JLfb8SwxgMBqkn2GAR8dPDyeQ3cwDQJXMC0+4jdtFAkp/EV8NFtrW10SDVLoH7vVK+XM8s7m+/kC7GaBrLb+IXaxinZ2Z2Cv3OCUPXey1lsvOLZm9p/FRA+XEaOHDb3E0MvUppy6ko28CJxZZDtZ8Qwt99rt1hIPOCZO+jReASXy52IJErXrfHy4kgLaLeIwx0Dmez2edsgFj/Q8EPzd4KtmATjaKVw5VazAaUk0PQUuLxbty8TQgGnqIukZD7FGaN0CuykOstX8wAyWtA7I//hSJHcyKxRtL149ZqF3T/xHA6TTTlXCVg9lkaPDZnb+elIKzncoeL2YN6WYqirAC1hwXipwKMbROJdwNAMqeuGdsuFBPaYCQ/p1G0eiU+2tqagFX+HEQtFwzfDk3THMv9roOS01NTPy+JRJqhI1db0kdV1/VbwuHw4UwmM1xvnGe53Fdg1GU2tTeMffBwu11rBKWqSIqqHhSNCUTq72AgsLlebIKp8yT2Audhuz5NpVK3OYl+URWw0mpOXUtSn6AOFwKEY82qep/vnIe1Nw2eQDy82RepWGxLMeLLkYDzq709rGjae7ABtxb4WsP4BH92UmpZS8LNIAd+vsDVzXKeiC9jXD5QnuNN5aanpz+gwWO8cJ1YZ0P6fE8kEqGs68eJiYmsl4RTbB8Khx/COz+AcbvCgSGk83fjzGWdQ14A8tsQIr8KNbjA4bZGA0k0kyMGHItdlNIiq9sunZ8ALUjV879auR86/0Yl+y4ockMOsErn/C1m8RDCmqGZnPxYypc0nLBAMaexvRuomJHP5xscDRWCHPLzbq6u6gDM2kKavYXffVpy+BGTZeVoMoOGE/L9+QHq0lLmOduro44NNS2obp8vXXdQARPfuaqEmg5TeAuA95Uydl4AYC5EhwqNn9IEpssvyaq+KEqlrI4Sm8WqWtWSFxo/NScwDaML3qLdE8o5P03FDMrnqzHHVFUArHuaQ4g0h2cYGxcNBue/UwGTanj5MlZ9/ni6mL+mzJIGkmgmh8ZSaDIDfxOwBcG8K83gc4p6ddSuoo4NNS1w67jX8cW/7UTXYK9/2wQAAAAASUVORK5CYII=\";\n\nvar img$x = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZG9S0JRGMZ/adGX4VBDRIODRYOCGERjGNRiDWrQ16LXezVQu9yrRLQGLQ1BQ9TS19B/UGvQWhAERRDR0j/Q1xJye48KSui5nPv+eM55Xs55DriiOS1vt4cgXyhasdmIb3Fp2df5jpsh+gnTndRscy4+k6Dl+HmkTdWHoOrVel/T0ZvWbQ3auoQnNNMqCk8JRzeKpuJd4QEtm0wLnwgHLDmg8K3SU1V+U5yp8pdiKxGbBpfq6cs0cKqBtayVFx4T9udzJa12HnUTj15YiEsdkjmMTYxZIvhIUWKNHEWCUguSWXNfqOKbZ108mvxNNrHEkSEr3oCoJemqSzVE1+XLsaly/5+nbYyHq909Eeh4dZzPEejch/Ke4/yeOk75DNwvcF2o+9clp8lv0ffqmv8YvNtweVPXUgdwtQODz2bSSlYkt0yXYcDHBfQtQf899KxUs6qtc/4EiS15ojs4PIJR2e9d/QMO/2gR3i+r3wAAAAlwSFlzAAALEwAACxMBAJqcGAAABZ9JREFUeNrlW2tv2zYUJWkpH7YsieUYaICi2P7/XyqwYeiHBvEjTryiqWNx99JixlyREimSsrYRcGVHNqtzeHhfJDnL3JbLJTsej0xyziR85nXNpBDqyuGKrZZwB+6/3cPvwd8EvF+tVlmfj+fotKqqEzAAJRzfqQGs0AQY713fk3DdbrejESBDyUHQapQ7wMQ27Jth3wnJ4A7w3gqZz+fqofBHgo3T6mb61K+vbLfbefNnw1R0gPdSgp7H3Gfk8D2q5HBQdmH/4YP62+XXr2w2mzFelqd+0CYYNoI2rbBZUYSCb2EqPH8cbisAhIQXjpZzlD5/Vpe9o4vr62tFDPbDh08r2XWzsEwJGUMCfvHw8sL2+3201E3iLi8v2cXFhfIWqcC7FBBMgrLU6MbgtVmvs8x7Tah2q3XjJgeA530EhJGAUgcCNv7GKKo9PDyo683NzclWRID3sfLeHU2oBT0zT93hvwk863PdTUTHhxqYKYCfLxadA+UkYH57a1rcqZPgHHluhObeBFyBpZVgaQPC5knLHj3GLQ6oLwGFO56fGglecx6xvDo8hrBKf3gCNVmDh0AXi0U3AZjYYE4emUVO0trrH2F47VYAyt4INTHCgx/8NjESvMHDgH6qyYBibmElQOXzVB5ABsTjv4cqoVos5Fjgq5Osrc+x3W7/FCR3QINoquCNAGmp3kBs/8vQ6QBWNykJNlIRPOQenbIvy/JnahCFkUaLdzk7oXq9Xj+HFlaaEVFM40NXFsMzFLzZlw94bPf393/RnIEbn4WWP3V7mNKGVpccvlamHHkE7gv+Dcvh0AqPVCXLGQkCQ0Py+dVqldQmuH4XAh7b8/NzS+G6QqX+rTnNcIcPGj6csBQtQklIBd6wZ7SIcSIACwzCUuCIaS4l+BrG1OCthIAC1NQ/kphfdtXwApXQqhw1hvEc4DebDbMNq5BUGglr+q7p4FJC7pGnyJTrzx222aaDTQljyL5lCFUtk/p/nr7Q02cYxwDvMoxCEslL6jMzKmFs8NS7qcoyIwo4tgshSZWQ8nuhjXo3pQAaAerlqnORkFP2T09PLUWMtZ452SaoLHChMmcbGgekaFdXV+0pQP0+LRiMCT43CXS6qylA3SAuUY8J3jXnc5BA8wFhc4P8DOBdJKQuqnBL0ie4JRU+x8gPzR2iAyFOAUdmgjGyD80dguMAmwKoYcA0kZaOxyxm+OYOoQ3XBGw+X+A+vL7S8diVnFRFlc4iD3zGnWbC5R7OBX5o7tBLAJV/81nY0kScBrgn51zgU7tIDIC4gxBFAEqBkqA2JAWSbNsfFF3JaXsL9QoxjAXdTgcKf2y24ApnJQgYWi6XvjKQ5gOmTmyMeMGcIl5KuLu7+6lrOgjT/dXt1HgfAj5nVmfrDwnpI+H7jx/f6Hon7jC1Bn5zcBWc5M8wNX7d7XZ/hIBnefcPef+fVVV9BBf65Z2RB/ljgbStAARsMKO9w8TAd/Xfeh4A+qW14kUqXu/uYjm8TjwK5yaBGj9cJXISgO2xf6fnVLbNBZGA09mUvpMAnSY6VoemtmfQiwTEMnPtPHdEYbYFkqlumOwlAQd0PWQP8/yf9XjpeE2pWZ9RL4OziNH7T2+V/d9vlhaxHaHE+mSWo+HS9ty+/SbIOxSxLKrDS2Bl8YHKssQ9OVmBQ2yP4e3bIY2O5/Q671CkkL2Otg4QSSIRGG3RgCO2YUqLWd0LgOeM+Zwh8iKhSD7nYVRKSKXVrtNmhGwBiK/MdfY20OhwFnhoKpnBM0fopqnH6ZqDPk2m1+pwdFFFvDl3pIIXQ96RFreThOiDk/pom8chpmRNz//AqWY9OJns6CwSoXZgdhx4jHdwUk2HwBOj6eXdG0E2x2mTkNGAxtdjhpPk2QMa05ApQnAE8SQogmqqz/q9aK7mvRwnxs32N2D2E/TuYxaGAAAAAElFTkSuQmCC\";\n\nvar img$w = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/YyTBBykUEbHYwoiFAVEQS4mgjVrECEZtkk02EbKbZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9YwIJorPM3o8zcy4zZ8A3k9dN1z8MplV0YtNRbTGxpAVe8NNNB0HCSd21Z+en4vw7Pu9oUvU2onr9v+/P0ZbOuDo0BYXHdNspCk8Iz6wVbcVbwl16LpkWPhQecuSAwldKT1X5WXG2yu+KnXhsEnyqp5Zt4FQD6znHFB4U7jfzJb12HnWT9oy1MC+1V2YfLjGmiaKRosQqeYpEpFqS2d++4R/fHAXx6PK3KeOII0tOvEOilqRrRqoheka+PGWV++88XWN0pNq9PQotT573FobADlS2Pe/ryPMqx9D8CBdW3V+QnMY/RN+ua/0HENqAs8u6ltqF803oebCTTvJHapbpMwx4PYWOBHTeQOtyNavaOif3EF+XJ7qGvX0YkP2hlW/cxWf6XLNyeQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAJpJREFUeNrt1TESxCAIBdCw97+z2+1slQmgNHmv9guS0VwXAAAAAADAS8TDdauYq2Qna6WbyeSz2claWza92yObnaz1aACrcZXW4LVd3SsfGw7/v9fpw++oFZUBRGNIcfhtyGajFUg2ls1O1fqt/TRe3mhkd/+uy31+DjeWycVwD1sGMPH1T+55O4AoNlbJTdYCAAAAAAAAXugLTOAcJH5aTj8AAAAASUVORK5CYII=\";\n\nvar img$v = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABbmlDQ1BpY2MAACiRdZE7SwNBFIW/JEp8IqiFiEWKKAoKoiCWEkEbtYgRfDW76yYRsuuyu0GCrWBjIViINr4K/4G2gq2CICiCiI1/wFcjYb1jhATRWWbvx5k5l5kzEJ7IGZZX1Q+W7bvJ8URsdm4+Fn0mQjO19BDVDM+ZnB5L8e/4uCWk6k2f6vX/vj9H/ZLpGRCqER4yHNcXHhGeWPUdxZvCrUZWWxI+EO515YDCl0rXS/ykOFPiN8VuKjkKYdUzlqlgvYKNrGsJdwvHrVze+DmPukmDac9MS22X2YFHknESxNDJs0wOnz6ptmT2t6//2zfFingM+TsUcMWRISveXlHz0tWUmhbdlC9HQeX+O08vPThQ6t6QgOrHIHjthOg2FLeC4PMwCIpHEHmAc7vsX5Gcht9F3ypr8X1oWofTi7Km78DZBrTdO5qrfUsRmeF0Gl5OoHEOWq6hbqGU1c86x3eQWpMnuoLdPeiS/U2LX8/hZ/QGsUVrAAAACXBIWXMAAAsTAAALEwEAmpwYAAABDklEQVR42u2aQRKDIAxFSacnqNz/hNgjNF221qkIKAJ5f+eMjPwHiZmAc8i2pPL3tLV5SYPmq87tRgiUr1TXnsWY+ZVvQsB6CCCESILUAdQBhmUewP2gokEzxtUasxnahAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYUqwt7rz3i+eXLjvMz3m+1MBjmj6rKesueQiBHQAAAPxX7HR41KMxTocBAAAAAOBIAJKRmWuNKSuFC36pLY3J3gEj3BrTFAAWLhJLag7QUVd/a8X17Ni7yLyUJEHtBIRmx8OACTDqVQaO/10+5Yxt1YPx3MSmoxhPejHWGG2qtv9qjMYaorvqgF/zPannuVfTG32vK+uRIdIIAAAAAElFTkSuQmCC\";\n\nvar img$u = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABbmlDQ1BpY2MAACiRdZG9S0JRGMZ/amGY4VBDRIODhYRCFERjGORiDWqQ1aLXr8CPy71KSGvQ0iA0RC19Df0HtQatBUFQBBEt/QN9LSG392RghJ7Lue+P55zn5ZzngD1S0Ipm1zgUSxUjGg55lxLLXucLDly4GcOf1Ex9PjYXp+P4vMOm6m1Q9eq8r+3oTWdMDWw9wlOablSEZ4Qj6xVd8bbwgJZPpoUPhQOGHFD4SumpJj8rzjX5XbERj86CXfX05v5w6g9reaMo7Bf2FQtV7fc86ibuTGkxJnVI5jAmUcKE8JKiyhoFKgSlliSz9r7xH98CZfFo8tepYYgjR168AVGr0jUjNSt6Rr4CNZX7/zzN7OREs7s7BN1PlvU2As4daNQt6+vIshrH4HiEi1LLX5acpj9Er7c03wF4NuHssqWlduF8CwYf9KSR/JEcMu3ZLLyeQl8C+m/AtdLM6nedk3uIb8gTXcPePozKfs/qNw5zaBHJcPVKAAAACXBIWXMAAAsTAAALEwEAmpwYAAADIUlEQVR42u1bPY7UMBS2PZYQotmdTMMhqFhKGsR23IN6F1pEg7bj5xZUnICSluEAXIBmnEkFQsomPId45bGcxEnsTJ4nT7I0cX7s73u/diaUNMhms7H2F2VJ+kgqhK3b9hBqu3CdJM5jMUobz+12O2s/dwWOXRQukwgeO/AuIhg5caFd2m/ynZHiHAN8aLsNG58Y+KSiMLQRwWwnYwDvaiEnEQOkQp3T4Ny0PyY75be3JNvvD7CZz+MhJ+CDUFvhVRQFYYw1Fj7qHnlNl3DMpt23KrUGQUyAlcZdNOsqR7EAWd/rawTz2GEtMWitYLMa7sOMhpIwh2egcQEzGPsAj4oAPZv4Ao9yMdQGXsULmSajJMAFfN8swWIDH6ULhAKPgoCQ4FEGQZ/gnSrBOe4N+AKP0gJ8gkdHgG/wzouhMXsCvlwoBHg0FhAKPAoCQoJHnQYXAhwspnRYFPEYtdrHbRYXWAhYCFgIWAhYCDhhGV0H5Hn+iDF2Qyh9UedgGmqy6yT5/xanLL+lafpMDu/DAkqjmYNWr5NUU+/aVaOUfqnBi4NJhgIvhdKnSZK8HPioA7zjXYCxz/WvxDpZ3+DvOKBfZxED9kK8BZN87zJpX+DlsGB9PychQNbV8rW0anJzRG/VNWn6OgQJlvv3MIfHMKf17LKAbxJs9wH456D5H7NNgxUJhHwYS0KD5i98gw9SB4B5vhpDgpbq/mqavwTwWzSFUE0C6UuCOl8UxR8I8/e0gBcEfNBKUBZEBSEfXUnQ+6Gwul9r/sJnwAtSCXZsmV/nUDwBy1e1Zn8BuIct12fQztTvkJqfbC2QCXGtLKEDPKnBZ7Xmz6NZDOkk2ERahpHqtmQimWw1KEkAJ/9kr6Yry8hgFfUkNHi9qKua2RFSoGy+aiIBRr4UQnyPfj9AkmA3kOnBH21DRKZIsIR34Pu/pwx4gwg4O/c/N5k6V5S+4avVAzjcHvODLdtncyUEortgoP/fHrtIbLNwgTkJ07XdxlSM2pfYedcNNoKwAzfSb3+tH+sv9q6FjosoxS5fjg7xf8wWYLo0HeI7GAloimX/ANBjieJDfrkhAAAAAElFTkSuQmCC\";\n\nvar img$t = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB30lEQVR42u2bzXKDIBCAw+ql6cnqpQ/Q93+f9gF60aan9GKwmkqHsXZA5Wd3YWcyySFO+D4WCLKKU+R4qush5u/DKfHIAlIXIFIDXs45eQhkAYlHiaUhTdMMcvgZniDcTE397Xb9vFweKQgoFfwU+ue1kFJ+AcDDf6J+RQKcqWRAv+cikyhqc4Ax71WPT73Pbg746Lpd/0uO7iVIrwIuNlJkBIyrhJddJBkBbdt62UIDp7Qf5xExL5PvLAXYwM+rxDM7AbbwLIeAL3gSAnzCoxfgGx61gBDwaAWEgkcpICQ8OgGh4VEJiAGPRkAseBQCPMF3JAQo+LV7e3vh9esGKd9M3xeppT2Kk6GYY/5PBiwb47sBmOCDZwA2eCsBVVW9Tg0fX63TsadNfLHgrQQIgBebHtza8+pQIyb81iFQc0n7YHMAdnivAijAexNABd6LAErwzgVQg3cqgCK8MwFU4Z0IoAx/WAB1+EMCOMBvEqAfOXOB3yRAHTlzgne6DOrwy3IW9gKWPa+Xs7AXQDHt9ThcJ7h2p8eiglPMdYF85oCpfvf+ble+OpDMAFNx8o7f7tELGHv2WhbF2SQGisJYv7soh+9JZICp3p565EdmsoDEQ8R+dpfSwUgeAlkAw/gGgdL3j4c6UpkAAAAASUVORK5CYII=\";\n\nvar img$s = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB+0lEQVR42u2bMW/EIAyFA7qla5Ol///HdUm6dguFKlQuBwnh7ADKs5TlTsrxPp6NAZ16H0czCMTXsijO90mNUw83DwC4OwAV5hZ37rYWoV6kAAAAAAAAAAAAAAAAAAAAAADcMh6CO63F7iwnkR2cUmqe57YcEIq3zyg4cWaapnYARM7rRjtLYupXY9ggaAHxzqKDtSgbAXdIkwBqqgK4QryP8J3OBe6xLjBVAFwpnjoh9rmDUJoOuhfxqXTwTiitCbon8WE6ROrCaQi6N/GxdFjX9XtzwWkIukS8/cHPmuKfnKD1W6kTdMnM2x/8qC0+VhNIPciGoEts7+nb75ro53cm4nCJ3L0ZkrqRvWSXRwokBZR9M9SzeJoOR82SziHYe5C6kA/A2cZB8E/PsXfh+zgqLt4+DgIl2cotsivEdizJlD0aZ84ymOy/G5nd5FhyJukQwHby8td60jW3hULpxP8Wu605O+vQrEaIQqDtZ20nePG+OStJz+xW+MkJpP2s4QQqvmTmizZDUSdsg7jSCVzii7bDHkK4PF5VEzjFFx+IOAip/lsSArf4YgCxZkl6iZQQ/zKAVJ/AnQ5S4lkA0Jog3Msv3OK5HBBdHZjj300TZxvOdjcoCYHrjlHMAT0HAAAAAAAAAAAAAAAAAAAAANwzFP47jBQAgFvHDyRnPtj60cBDAAAAAElFTkSuQmCC\";\n\nvar img$r = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAeNJREFUeNrlm2uOwjAMhDsWJ4De/4bsEfD+WGm3QqTNw54460hIBbWNP2ec2G3Alq/p4RhIDP/jgczwmRyghd9NQ0AbzkUEeAtD1MBAzIIf6VwdjAUbvqdTJUgWLPjWztQAQAlO0JZ7wgAeTnMIvOFrOlFSzFr0oz3Xw/qGrNi1shWB4Hv7HrJVAiYvICjm9EQNkjJf2WGiUgSFv7LHLERlW6+Zzk8IPPotyVO3nRKkYhuBG7JTiDl+yLpBssV8rQMQHN5UQp6TX/TQgqw8ehY2SmD5U5psydst0JJVM9urgVo1ogKmld+SGT6CA6bCz3bAdPiSAzQL/CwFWD/4HHYAFpU9VlPACLyyQ4CVx09Pu+XEEA0MD28FRBp5ZSiAqYJReDDmgH+zzrc6wEIFVvCUx/S1D0SUHK+0dxRiMLIMeHoq3PoqWo3A6XPHaP6NzX/vkOvuMa809JNj0OFc9xXq1jByq+wSc00pV9knWM0g+77/fjkeTzAOMxKlCApgQzfPAbUZngaGLucB98fDKr3F26ck8VD1AIzga64L+cpdnOCXaZIZ/swBKeBLDkgD/8kBqeDfHZAO/uiAlPBX9TxKNcJL/y75ej5nFk5uq0CajVKXD0UrKsTlQ+AoV9afF8PwfwNGBXNgWGrhCQAAAABJRU5ErkJggg==\";\n\nvar img$q = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZE9S8NQFIbfpkpFqx3qIMUhQxWHFoqCOEoFu1SHtoJVl+Q2aYQkDUmKFFfBxaHgILr4NfgPdBVcFQRBEURc/AN+LVLiuU2hRdoTbs7De897uPdcQMjqzHD6UoBhunYukxZXi2ti6B0BxDACAVGJOdZSfrGAnvHzSNUUD0neq3dd1xgqKQ4DAgPEs8yyXeJ54uyWa3HeIx5lmlQiPiFO2HRA4luuyz6/cS77/MXZLuQWAIH3FMsdLHcw02yDeIo4buhV1joPv0lYMVfylGO0xuEghwzSECGjik3ocJGkbNLMuvtSTd8yKuRh9LdQg02OMjTyJkitUleFskq6Qp+OGp/7/3k66sy03z2cBvpfPe9zAgjtA4265/2eel7jDAi+ANdm21+hOc19k15va/FjILIDXN60NfkAuNoFxp4tyZaaUpCWoKrAxwUwXASi98Dguj+r1j7On4DCNj3RHXB4BExSfWTjD603Z+Sp2ztrAAAACXBIWXMAAAsTAAALEwEAmpwYAAADGklEQVR42uVbC47jIAytESeY6f1P2NkjLCOqInmoP5g4BChSpLZJAT8/G9sQuDHtfr+Tv/9P6WZp/35+tP6lDsEyXgBg7z0eD3qAVsE9AWgU/s8cOQG+vr+bAOCAiK2Cn9CS4TnwGrTIWYAItw9voGmfo56DJlI1DnD38jx75qGxOvcZRwuuCV++V888zaCmLyUkvlc+S0BE6uZBtBMDKHjYbvnMzVG6Rz0bvbSaByWo+0frR0GQWCSZicSE0Kv93Fm5mAl10V/4PSkrSGpRkgrAUXoatWbq8yVA8ujfFQBOg56UbxXQCoIXACytvUHwBjkepffL+Q0PYGqQseaxw5WWyScDcmyPr6uEYOzdnT3YcTcxwMsBtsTlXv1aVoJwpv0bNH16tDl8FThTmwygXeYSBtn61YAmLn6YlgFW0Bg/UgueatMYWQ+AWRiFQZjSBOql6kwneWlF6MyaA8E+6EqHtUleEQUeMD2ofcJH1QRPS4cno7tp/NjoMGbSIljpL4EfPo3ybwzAOzd5aRC0DSOTllEgBEPykBSAlmzBkjkhILyWJLb2Vy7qP54heW89oGu/rgiEKskiRdGETyurBUr7L08L0sA9FdhpTYBaZopmpMKjBwjO+5KiuVD9xVYPSuzXTRdAtdQRc90TnyMIBxBetuHib+jQxjYgPNnQ68m3igOsjm0nEALl4Q2BzvIgRC3Qwaewciu5A9pzr4sM65nAQRYszYioxPzqQUXsDzJbOMZMDwAX6GQB6vM522WDStKzdYt1HlCzQNrBXZEROAxuDYS2YUGtrAwGmw1+SmsNhdMm2n87Wxha1/PdvH/xa8GQg69eEL3ufMBszg+zPBjD2jRwgmfavv7CxC7rvqbcgA89E4cKYQNfkCTlDt0XmGDZezNt1QmuGBgJwvNvjeE/t5Siy3ncq/f9LcJTrA1Wp7GAQ2SFJ0+ItGx5C0XQNJPmhYIuiG+Otm5P9QzQypwjpmSlPR4TNDoTr6iRA40+ak/l95QD1+RaemdIE96UDqMDCUuBYBW+lhM0O1VC4nQl/SkW1MJrcvwCJhH28gf87HUAAAAASUVORK5CYII=\";\n\nvar img$p = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/o6JoJIIWIhZbqFhEEAWxlAimUYsYwahNsskmwm6y7CZIsBVsLAIWoo2vwn+grWCrIAiKIGLjH/DVSFjvGCFBkllm78eZOZeZM+CbM3XLbRkDK5t3IuGQthxb0dpeaaEbP5ME4rprzy/ORmk4vu5pUvVuVPVqvK/u6EymXB2a2oUnddvJC08Lz23kbcU7wr16Jp4UPhIOOnJA4WulJyr8ojhd4Q/FTjQyAz7VU0vXcKKG9YxjCY8ID1pmQf87j7qJP5VdWpTaL3MAlwhhQmgkKLCOSZ5RqVnJrL5v7Ne3QE48uvxtijjiSJMRb1DUgnRNSTVET8lnUlS5/8/TNSbGK939IWh99rz3IWjbhXLJ876PPa98As1PcJmt+nOS09Sn6KWqNngIgS04v6pqiT242Ia+RzvuxH+lZpk+w4C3M+iKQc8tdKxWsvpb5/QBopvyRDewfwDDsj+w9gMBwWgLeGpB4gAAAAlwSFlzAAALEwAACxMBAJqcGAAABX1JREFUeNrlW21P4zgQtt0EcRwC2lJpkU6n+/+/aT+cTvthEdBS6B3Q0vhmjF2ZiZ3YiZ3SrrXdpKR188w88+qYs8xjNpux7XbLJOdMwnteVUwKoY4cjjgqCVfg+u4afg7+JuD8/v4+6/3xHJNOJpMPYABKeD5TAVhhBGCd+z4n4bhYLLrcjmzCylOCVlpuANN34NwM5w4XhmzD21sA4/FY3RT+kmDDjEqbT/X+zpbLZYwAapiL3jaktc1DNIfnyJLNRvmF1bdv6m/nP3+y0WjEeFl+zIM+wfIRdBiGjYoixMSlQyg8mQD8qCX8k0pbXi19/64OK88Ul5eXSjA4D09rVjshJBcAzrx5e2Or1ar3XLbgzs/P2cnJiYoWHRygVwhFKpsUGMbgNX94yEIoI1ATVisdJjuCT+cDFNVBAPNmZ5Rs3N3dqePV1dWHr4gDz2lY5Oz4hozJefivDJ61hW6T0R0y+PF02qhkrwDG19exHvdLap63KNIpgAvwtBI87bHQHiPGNSo0NAoUVuZ2DDaP4fLdEzGEk/pH6PAQ6HQ6bRYAFjZYkx+jtzdfwvTazwCkveX4MMOjXzgk8KDQPyuiUKwtnAJQ9TylBwhj2SHDmziolgu8/i2n5heLxT+CRDJ0iLZSdwKQju4N7xEGrxP7EgDqBA+1R+NNlmX5O3WIwiqjxaeanYj6oUNhY7SPksbzFGww4O25QsDjuL29/ZfWDNx6PzL0p/U2lrTr9Tpa6y4DfXl5Sab5387O1CsE/C6sg8Y/2T4w+/T0lL2+vnoyQZBQl3re18HtygIX7XHEgMfx/PxcY7jJc9T/FbF1KWVnjWE/QDh8R6wQUoH3+jMtEIENBuFocPQZPiaEOsbU4J0CAQag6YstyfllUw8vkgm1zpF2jPsAP5/PmUutQlJqJKwBfObgY0JuzVNkKvRLlne4zMHFhCFoX3OEqpdJ43+GHkCbYxwCvM8xCkkoj4sWQzFhaPA0uqnOMiMM2GZshDgc46Cap9FNMYD21s1y1QBCGJz2T09PNUbsq+3TqZ7PMQSlBS5U5hw+mzfgM5bS7OLiom4CNO7ThsGQ4HP3E6i5KxOgYRCXqIcE77P5HEKg9YBwhUG+B/C+BdXUTRXuKPoEd5TC+9B819qhdyLEKeCEXeFY2sfWDtF5gIsB1DFgmZiiE9w1wwutHWIHrgm4Yr7AH2xrHQ/dyUnVVGls8sB7fNJM+MLDvsAH1A7dBEDpr98LV5mIZoDP5OwLfJNj7CIETIC4RyBKAEgFKgT1QFKkkF033LuTQ+bE9/iKcYwFfZwOGP6oGSa8nSCQ0Gw2C6WBdN1wqsLGzGnPjSYSwoSbm5uzJnMQdvir6qXxKgZ8zqrOw65WIbyu1//R9U58wtSZ+I1hMk7qZzCNv5bL5d9fvapz+orJ5A8IoT8+OXmgPzZI6wxAwJZkTHQ4VPCKIfP5DxrhNqTj9ekqtsOrSJv/quA9yYBaJfIKAMdj+4LoQYJHc7ap7xWAKRM9q0MHC37ke/Lcm4XVv3CYtNcK7bLUr6KCBd71+vJDbehoKomP1uGF9gQ8YPmvAJ76AEnOg8AjxdpolinJsU208yhaNN2qebV5Cbws3lBZlvhMTlbgkNtjervbpJFKADxACP5HznXE2EAmiYLAbIsmHH0HlrRY1b0BeM5Ysj1EBQHY3+ZBKyWU0uqpU60hVwISSnNTveVyOoUDaJLwZmvoSvfjTM/B7CYza3WoXWQR1/uOVPJi0Tunx+URoc/5WbO1LWATU9LMDu0/hanxiPjfqAgUhHoCs2HDY4piBs0hYMdoEgG48oLw7Evv8e0tDA0aX48ZdpJnT2hsR6YEghrEnaAISnefzbnQR/taxx3jweN/nwXieSq4/nsAAAAASUVORK5CYII=\";\n\nvar img$o = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZG9S0JRGMZ/adGX4VBDRIODRYOCGERjGNRiDWrQ16LXezVQu9yrRLQGLQ1BQ9TS19B/UGvQWhAERRDR0j/Q1xJye48KSui5nPv+eM55Xs55DriiOS1vt4cgXyhasdmIb3Fp2df5jpsh+gnTndRscy4+k6Dl+HmkTdWHoOrVel/T0ZvWbQ3auoQnNNMqCk8JRzeKpuJd4QEtm0wLnwgHLDmg8K3SU1V+U5yp8pdiKxGbBpfq6cs0cKqBtayVFx4T9udzJa12HnUTj15YiEsdkjmMTYxZIvhIUWKNHEWCUguSWXNfqOKbZ108mvxNNrHEkSEr3oCoJemqSzVE1+XLsaly/5+nbYyHq909Eeh4dZzPEejch/Ke4/yeOk75DNwvcF2o+9clp8lv0ffqmv8YvNtweVPXUgdwtQODz2bSSlYkt0yXYcDHBfQtQf899KxUs6qtc/4EiS15ojs4PIJR2e9d/QMO/2gR3i+r3wAAAAlwSFlzAAALEwAACxMBAJqcGAAAAvVJREFUeNrtW01y0zAYtRQPadzpkEQ5AwcoXcCGHSdgxTFaTtA9tGy5BxumnemCbXoD9mwsJ6sYZlqLT0EeUiNZ/pHj2P40o3HGcWS99733SXJk4hnKYrHQnk+E2B4jzr1DKXPGtkdKiPGaMAy150c64EEQGBsS6hjHca1Ow31ePhuPf0yOjye/4viuTlsT1V+SQ4DEJOtms3lyntgi3oQCIGIrOEx3z0F7pEkFmBRB9y1XxthZFrwsM8au27APsUXf5J2q4EE/NzoClL0+rzg/d3U/m6oltlHqD92XWb/U9TwAXMLHoyRJfoJfTzTReDUOgueQE765uKfsv6ymnCa/G+lYchn1FDzkjlsJXiWrkxxJvnZJginA6fnGc4BMeAB+qWS/zk2woAyVmM6njF256oMMqCmoJKsAl9FXkV9W/X3ieddrzi+qev3h8dFbr1a519IijetqgchHKXiIbGwb7nTnpRKgHVGaOBiqZaXULvBGLCAjL0e2v6ld/IaOTIqM9abvgYRPRQCntUyhTYCHTtz8MxkZl5noGK67sJFQtVDH4E+V7Gd1ZnlGEubzj3X7mFULrSMfDfjborKuRAIhH1yQ4FwBKuHd1418GyRQB7J/kQXuAryNBFg7XB4EAUKIt02BN7TH1azpvea6dEK1PwI451+Ahe9Ngde0y+B+X4H4dzrwW1C0OCzfQd8eoih6s4+la84k6jCGwS4WJGDoBFhzgOtnA6gAJKBjFjA9cOiLNdACSAAS0K+yOy0WBRZFfh+jWmZtgBZAApAAJAAJQAKQgGGvBrN/Bz158Cg3IO3+Y3RI2+MqFoEKQAJKECAlL/ffpbXoBoku5YDWFyzpRsfBWCCbSNtMrJgDkAAkAAlAAoa+FhhWxDMvVfhl3rJACyABAyRgOpv1mgD5vsB/+2PDMOxlYtBh9VvqiKchvR0L6KKtY6qP0ZfYfdsPum4HWzBJlajX2Va/74mOqaSBHfwwWMn/XVZA1tKkine6SIApl/0BVV9uhgTVncEAAAAASUVORK5CYII=\";\n\nvar img$n = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAIkklEQVR42uVbWYwTZRz/vm96YOku207r7hK8IgHXBw3GBI/VxEQfBFGM8mBCxBdWEAheaHwwJiYknhFX0YgPXsR4EFFBsmpijAKSeGBMDBtBNJggu3baLnt0u53O5+8/duvM19lDaJd2/L+0OzM7M//79z/KWY0pmUy2FYvFqyXnl0rGOrhlXSCFaMXn2VyIEF1jSVlgnPfjWB/O/cYZO8Sl/FEIsT+VSv1Zy/fjtbhpPB5fjI/bLc6XCMYu9rrGsiwGBiu+e1zXi3N7pGXtyGQyB3BI1qUAwHQztLwaL9qFF15QC8Hi3ochqW2QyqsQxkBdCCAWi83BSz0AtWyEDpvZDBCsYhDu022Z5rMDAwOZMyUAHkskVsNXN+N7YrL3heZ+hJC+wvdeWEmvLBSOIS4MDrW1DdIF0RMnmjRNa+LB4Ll4oYVMyg5w2QkmF+G0Nsm9DYuxR7OG8Qo9Z8YE0JxMXhiwrNfxtXOCS0ww0SOlfAva+vxUtTRnzpwWCOYG3GclhHEjDgUnuPQbwfkqBMzDNRcAtH6HLBa3wc+jHqczcIXuQj7/4tDQUKqaZh+NRhOhUOgeZIuNFHI83GIYVrYG1rC9VgIQCHRP4gUe9Hh4Dhp4gnP+nGEYgzVOq1G4z71InY9ACZGKQMnYloxhPDBdl5iuAEJxXSfJrqgMzXIPXmg9zPw3NoPU0tJyHgTwAhSyzEMIOzOx2B3syJF8NQQQguZ34kFLlONjYH5TOp3uZmeQdF1fhxjxLN4vrJzqScdiy6cSwlQC4ND8u6rmYfInNCGWwdy/Y3VAiUTiMrNY3AWLmKvghg+BF26bzB20KcDN05DsauWmR2QweF0mlfqZ1QmNjIz8GQ6HP8DXJYhDell7nF80KxKJjeZyPf/ZAijaI8e/rTIfDAY7+/v7+1gdUmtr69n5sbGvK5ColKvgqm9OWwCU54VpHsSNmpxmD81fPdDff5TVMQE7nA/MsM/pDnj3kYCmLQJO+KUitXkJhUCOk3kKePD5m+udeSJko9+lpt0ErZeDH6VLU8o3vfjVPEy/C2axTjGh+2FCO1mDUH5k5EQ4EjHAx1KHqc+LRCJ/5XK5byd0ASpsEDgOI3oknXkezC9lDUjg5yO4w82OQ+miac53QnO3SaCqczJPCI9ADmtc2kD+70xsqC0e8owBdj2PktZ1EvB2phFeNQkY4Bh42OwuTeV6KrIqBEDNDKWezxC2Zw1OSNvPU9nsCIhREQh0VQrAsroUPN1d68JmJqivr28YcWyLK/BJ2TUe/3i5h8f5Acc1hbF8fm61S9ozRU1NTXowFDpOdY1D4Z1wkX3jFnC7kvZ6/MI80eDgoAGG9ygBf0XZBSyl0kN1tZ35jBDPtitNDDu1c7tvb1nO3ruFXJk43WZjvRFlOUgh7QJ/Up4jaGihFDwH/ca8jYDS6ZOoib9XDl8paGKj+MbXzKcEf9/rUjbniwSNq5Trev0qAFj3ISUOdAia1SlS8a0AVOUiMJ4vaFDpEkChcMy3FiDlHwosbg3ADGLMMZikiY1nFNV12UjMpg2jotlDIzWhaU4LiAMai1nOi8bHVX6kkydPDikWERbsf04CZuHqm9Og0q/MNjc3R5UgaAbg/wR6yiMmmtLiIzUdn2o4bbv7nOQCf1EadLW4aUTtVwuAxs9RGj59lAZdHR97Pu9fASxULOB3QQtJSrLs8HHM61AE0itoG0tJltf4lXuU/Z2KBRzkiUSiHYjouFIO66gIs35iXtf1JiA5KocDjtrgPEF7eLSK5owNtJbiQxh8g5N5HPjV7hqX0sMe5eKVvhMA5yuVvz8plci2KexwBQchbqSdHB8BoLhzTFYSwI6yAGgD015C/JeC9kKSTygQCKxljo4wTPxoNpXaWxYAHbI3MN05YiMtJDU68+3t7YRyNyra38ZKK7fCkf5epXLRWQHTNlajC2B0bGyDMu8ctkyzrOxycTw6Opo/a/bs2fCVax0NgyvC4fDb+Xy+IVNiPB6fh4D+HgBPyIF0t2Sz2V3llOcCCqb5DHPP0SJIiS80cOTvVhY6s4VC4SnnNa4FCWh6NByJDLoiJucLIpFISl0sqHcqLXpsUsDAwwB4Xyq1T2XVGNd1ipBXOv4xD0leBdD0QyMw35JMXspM84Cz2wXf/zabyRBPRRezXpCZFo/t3dt/rSBsFou7aQGp7jUfi50LbncrzOc0Ie5UmZ9IAMzeuhZijdJMaAdA+pRW0eqV+WhbWxK57VMwNU+p+9cbhuHZ7p9wUXI0l/tpViTSAh+5wlE+6qZp3oLMsLveMgNpXhSLX0BRF7nc3rK2AuhtnrBHMFUXKabrO3DRre6K2Toe0LRl9RITbJ8ns1c0j9i1K51O3+pl+pO6gJNXe+uasR7FHeZCCPtbdP2Mw2WK9nbAU5i3GPssHY+vmIz56VjAPzR/fjhmGO8gBiyvyLWW9TE+NlBpOeMgB3letc6y5on5aazLa9N6WjpdBFJ8nxaP8cDFSltpIdDW3cAKVHX9MDw8XKg1tg+Gw/fjme8juF3ioRDy+bvwztN6D34Kkr8TEPkluMFsj9MGLSQBbb1MaynVLmlR1a2BxO9jHj/SKv1qZR18/rX/ct9T6vUnEokFppRvCEeGUGiMdnJKaymf03LCKZo5re1dT82MEjoNeQYqgBzK8xOluqoLYDwW6rq+Fnn3cebxIyYHFWkzg5YTSvP5XprSUuU5PqujiQ0NLahvX2pdd1ADE/9z+RRumoXFPQYBb50q2NVCADYBHcZo/ZQ2MCf4JVnViVAqzH0rFTan62pVG3fR+qm9gWlZq5Et5temvJNHqZlB9Xy19phqMe/jQGVX2Xt4lrX0tIUh5a/UwKQeXqmNVZ8/np4sX1NlSQtJtJNDaym0mYHPJGJBoJRK8/ieplkdjatoYkNDC5w6UGt88TeBNfhPMH+OaQAAAABJRU5ErkJggg==\";\n\nvar img$m = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/EyXigxSxELFIEcXCoCiIWEkEbaJFEsFXk6x5CHksuxsk2Ao2FoKFaOOr8B9oK9gqCIIiiNj4B3w1EtY72UCCJLPM3o8zcy4zZ8AVzmo5s3UUcnnLiMyF/EvLK37POy58eBhhKq6Z+nx0NkbT8fNIi6oPQdWr+b6Go3M9aWrQ0i48oemGJTwtHN60dMW7wj1aJr4ufCI8bMgBhW+VnnD4TXHa4S/FRiwyAy7V05+u40QdaxkjJzwkHMhli1r1POomXcn8YlRqn8x+TCLMEcJPgiIbZLEISs1LZo19oxXfAgXxaPLXKWGII01GvMOiFqVrUmpK9KR8WUoq9/95mqnxMad7VwjaXm37cwA8+1Des+3fU9sun4H7Ba7zNX9Bcpr8Fn2vpgWOwbsNlzc1LXEAVzvQ+6zHjXhFcst0pVLwcQHdy+C7h45VJ6vqOudPENuSJ7qDwyMYlP3etT9GwWgrP+9tUQAAAAlwSFlzAAALEwAACxMBAJqcGAAACZpJREFUeNrNW11sHNUVvnN31xtt145nZxfbiL+KQHAfioIqpYT0oVJ5ICEUVPKAFEFf7AZIlLa0lZBaVaoUqX+o1DStGh7a0qhqRVRKoZEpUh8KhUi0BFWqsEhIUCqR2N3ZtWM79npn5/Y7w665e3d2/nbG3itZO56Znbnnu+fnO+ee1VjCo1QqjTYajbuEpt0uGBvXbPuTgvMRfF6jcT5A99hC1JmmzeHcLK5d0Bh7VxPiHc75G+Vy+VKS89OSeGihUNiJjwdtTdvDGfuU2z22bTMI2HHsct8Mrp0Stn2yWq2exinRlwBA6CGs8gQmOokJ35oEsHj2WSB1HKg8CzAW+gIAXde3YlJPYFmOYA2H2AYMaMUizGfKtqynFhYWqpsFgKYXixOw1aM4LnrNFyv3DkD6O45noCUzol6/CL+wuDQ6ukg35C9fHkylUoNaJnMDJrSdCTEOKXdDyB24nPJ4tmkz9p150/wlvWfDABgqlW5O2/avcbi7yy0WhJgWQvwWq/Vq1FXaunXrMIC5G885ADDuwalMl1vf5Jr2CBzm2cQBwKo/JBqN47DzvMvlKkxhql6r/Wxpaakcp9rn8/niwMDAY4gWR8jluJjFMrTsILThRFIAcDi6H2AC33B5+QpW4Puapv3ENM3FhMNqHubzVYTOJ7EIuQ5HydjTVdN8IqhJBAVgoGAYhOz+TtcsTmFCh6DmF9gGjuHh4RsBwDNYkH0uILxQ1fWH2LlztTgAGMDKv4AX7VHOr0H4b1YqlSm2icMwjMfhI57C/LLKpemKrt/vB4IfABpW/g/qykPlL6c43wd1/yfrg1EsFu+wGo2XoBHXKrzhT+ALX/Iyh5QPufkRkJ1QHnpOZDKfr5bL/2F9Mq5evXopm83+EYd74IeM9dXTtNu25HL66srKdGgNIG+PGP87VfhMJrN7bm5ulvXhGBkZuaa2tvZaBxMV4hGY6nOBAaA4zy3rDB40KKs9Vv6uhbm586yPB7jDTeAM/5DNAXO/mk6ldoAnvNcR2txAIZIjC08ODzZ/X78LTwPR6AORSt2LVV93fhQuLSGec5OXu6j+RAfDg7eHw3vL018YxoYK6vW+hXL5DDLRrymC7kTEeNTTBCixgeM4C+9RkuM87Gdv0MlUTHPDhe/2TsjzIszhPvnWhmVtk6l5uwYgq5OFJ4ZHJCfMZJLWhJDPP0z2L38ducW3XE3AyeeR0rZdBL2NwvCSBIFWG/OiP9H6Aw9wvRcc4CKuH21PTcUhSrI6AKBihpLPV4nbB5lQF3KSFOlhLlWhrlUihO2fUtosOcQ8T6cnOwGw7UnliVNBExs3EIC0owkb7RzVMTs7uww/9nSb4xNisuX/eKuGp5CHOqW0UVQzYcrLotQE6/X6L5zc5WOKeDMc5C5ZAx5Uwt50lHweRCNWnyB/L6rwNBYXF01o+CnF4e9fB8BWMj1kVyd6dVK9ghBSeF/Vgz87oRQxnNCuOXV725Zr7zZiZbHXYqObwARMNy3x4hVeAOB5geyOohxQqLQlgEJcz2nTQkl4zvQqvJ9jDANcL6rfNp9K5Qpy4n8pp+/ktGOj2MZrccfsoCGyCzg9qb5Cel5ve7Cm7eC0XaXcNxOn53ZT+W6aQIDJfz5RRQtiTop2v6v4gXFOe3UKKrECENUx+ql+WOHdFheO8SZOG5VtANTrF5OI4WEmHIfXd9UAIf6raOIIhxro8knasUmSx8chfMTVd7bUFA0ogADyLfLJ1nbVZoIQlyap48qVK0uKRmR5P1VzklJ9z8gAtWirm9NG5Wbk80mqfmsMDQ3lFROw0oj7RHrWt5hol5Y0LcJK+U6wh8ywZ+GbqfCgYgL/ozDYVuKmLeogDtXtnFcNYBNCnls+cL1CzWcpDF5QjGx7D+9wBaGb8H48PwzXDwjAdkUDPuDUkKQEy/Ee39MGgpfwQeYcc0FlXAFkhlM3lhIsPxdkYlE0oYvwws/u4yqvIe3frWjAGQ0PHwMj+lBJhw1khPMxVGe6Oq+gqh9Xyd0wjEG8jNLhtJQb3MipD49a0WTfQG0pQQhJAPsUEa9pMUcRWu27ZeFx4n2natwMD6eUmw+E8S0+mhI2l/cMeVFBQJJ3QPn/L+slMWpCbJsB5/dQT04IahoKBC9QwlaMAhKgAia4VwHg5DoA1IHpNCF+PDJOQ1I4fh4IBB+N0IJGizCOMZ1O057ggKTi5+fL5dfXAXDskTow22PEEWpISgKEsKoftbxGY2xsjFjuEWX1j7d8EJfC37NKuligbqwImVoU4uJLdaNWm1fX1g4r+53LtmUdl8pkHw3qvaX2UwXlJ6nhwCcU9gxCUKoblhIXCoXrYNrfVujvsa67w0Dmx6x9Hy2HkPhM2AmFASEs1VXNwYsbQNWnlIbO+Xq9/sM2QOR/iPxQ763iC+6lVjQ/r6yqYosneAkYlee3hPYSXi8WJ/HwBxQy8F3aJfKL4RzCkIe8U/piDUjuwoTf7qHYIZJKctQxXCrdzizrtFztgu2/NV+tkkwNXxKDyd5iNRrUJPUJ6QGXYE+7qAeH9fHQdf0GQU1SjF0nzX0lxfkdpml2VLx5F9WkHyYcVIoJY3CSr1ArWr8Knx8dLUHNXpGFbzq+Q27COwWgruFjZeXfW3K5YajIZ6X00bAs64vZbPblWq02328rzxuNv2Ghbmsze9s+hgh3NGpay3XDOKk6E6jUh+lUal8vPiF2m7ftl9WVh+96qVKpPKDava8JyLI6XdeMTSvmcC1AeGPYMB7b9JWHt3ccniI8otlfK4XCfi/hgxOWbduyumn+Hj7g/o5Ya9t/xsdhSi03UnCH5CDOd4S61sqT8AHa5VPBAm+lsbq6+jw1HuOFO9U6G9Lnr+RyOcq63l5eXq4nKThx+0w2+3W883k4t0+7LAjZ/Jcx50Dz0CIg/zAo8s/lECkNkxqSqCdHJRy9DkppkdUdZB91gHZw8OavVh6Hzf8qVBISkdTcagnxGy5FCGWsUU9Osy3lVWpOiKjm1Lb3BSpmNPP5AVdHBZKDOP9wt1AXOwAtX0i9t4i732MuP2KSRoM6M6g5obk/P0O7tJR5tvbqaMeGNi2obt8sXY9TARPf+YyPmc4TvQXAx/ycXRIAOAPZok7tp9SB2eWXZLEPSmkpq6PEpldTi42PU/up04Fp2xOIFtsSkVyI81TMoHw+jj6mWAGQn+k0IVIfnm3v7RkMId6nAibV8JplrP788bRXvKbMkhqSqCeH2lKoMwOfJfiCdDOU1nBcob062q6iHRvatMCl00nzi/8Dx0Tcgl7ehnwAAAAASUVORK5CYII=\";\n\nvar img$l = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAaNJREFUeNrlm0sOgzAMRHHEEbj/CbmDq7Ko2opWxBk79pBNuwCTN/4lCshSc+jbfxkxJMXhhzmEAH6IRUjgzTxCBG9iaoXhBSBW+gi4Aq8jbELiebMIQhL2ZhGEBN58rxDBm2wIGXy3LSGE77LZSOEv399I4S8viORm8GlqQDR8qjaYBn5GDZie8zMjIEXOzxIgJXyUAGnhIwRIDe8tQHp4TwFKwHsJUAbeQ4BS8GgBysEjBSgJf2pk27bjd993evjnWL/B7+J5xGaoPPxLAIP3KeCtEUADfxg+8/6fAkgF3xsBdPCnAvzwPiX8Rxsk8Tz8bDAzPOStkdUw8dnwipxf73l7NnjxqgG6+AwFpSKsQDYQQEl49EqwHPw/g8iXEhHwbmsCj91gGfgeAQSYDqneS2oArym4jWqkWM2hZmgV+F8PUcM1iLDXGWnSgMKhcj60RvTsBTwLni6ThjhOxgIf3iHWIFFTwp89VIPAU8BbIqDiV2bDAngfoU8VVYInqdkiKmpTolnTCXEuUBbeskTtTZ30RTRqpZa2eyA/R6FvmZTjAXQIhaMv+ge0AAAAAElFTkSuQmCC\";\n\nvar img$k = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcWlDQ1BpY2MAACiRdZG9S8NQFMVPW8Wi1Q46SHHIUMWhhaIgjlLBLtWhrWDVJXlN2kKShpcUKa6Ci0PBQXTxa/A/0FVwVRAERRBx8R/wa5ES72sKLdLe8PJ+nHfP5eUE8Kd1Zth9CcAwHZ5JJaW1/Lo08A4fRhBEHBGZ2dZydimHnvXzSN1UD3Exq3df1xoqqDYDfEHiOWZxh3iBOL3lWIL3iMdYSS4QnxDHOF2Q+Fboisdvgosefwnmucwi4BczpWIHKx3MStwgniaOGnqVte4jviSkmqtZ2iO0JmAjgxSSkKCgijJ0OJRLGSZl1t2XaPpWUCEPo7eFGjg5iiiRN0ZqlaaqtGukq/ToqInc/+dpa7Mz3vRQEuh/dd3PSWBgH2jUXff31HUbZ0DgBbg22/4K5TT/TXq9rUWPgfAOcHnT1pQD4GoXGH+2ZC43pQAtv6YBHxfAcB4YvQcGN7ysWuc4fwJy2/SL7oDDI2CK+sObf/JNaAQfxWcoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAIPUlEQVR42uVbW2wUVRg+c/ZSUrelsxfaGkQNDVgfJKgJAuVNg1yDER5ICPrSigJWQU1INCYmJEokQLEQIPHKgwYSULABeQPEJijwRiPXYKK07uz2Kt3uzhy/f90uM2dnt6XdbXfH87LbmdOZ83///bIKK/AKhUI1uq4vFIoyRzBWrxjG44LzanxOUzj30h5DiDhTlC5c68S9WwpjVxUhrnDOL4TD4b8KeT6lEA/1+/3z8LHaUJSlnLEn7fYYhsFAYMZ3m30duNcmDONoNBptxyVRlACA6EpwuREHbcKBZxUCWDz7GpA6CFQOAYyeogBAVdWpONRWsKUZPKxkE7AgFX1QnxYjkdjZ09MTnSwAFDUYbISubsf3YK7zgnNXANJZfO+AlHSIePwO7EJff01NH23w3b1b4XK5KhSPZwYONJsJUQ8qG0DkXNx25Xi2ZjD2QbemHaD3TBgAlaHQTLdhfImvDVm2JEDEKSHEN+DWmbFyaerUqVUA5gU8Zx3AWIJLnixbf+GK8goM5rWCAwCurxW6fhB67rO5HYUqtMRjsc/6+/vD+RR7n88X9Hq9b8BbNJPJsVGLAUjZBkjD4UIBwGHoPsEB3rF5+T1w4GNFUXZpmtZXYLfqg/q8Bde5DUwozzCUjO2OatrW0arEaAHw+gMBQnZNpmkWbTjQJoj5LTaBq6qq6lEAsBcMWWEDwrGoqq5l16/H8gGAF5w/hhctla4Pgfh3I5FIC5vEFQgENsJG7MT5yqRbpyKqumokEEYCQAHnv5M5D5G/6+J8BcT91zHHDYGAJaCJaNqYPVIwGHw6oesnIBEPS3HDccQLL+dSBz5CcLNDJh4PvS48noXjIT7fC9b/Es61EIz53cI9zlepgcCunIYtl7WXDR4R7/F4Gnq6um6yIluwQbfLvN5FGSAw9iYYuf6BACA/D1d3QBZ7w+NZ3NXV1cmKdHV2dnaBSYtx1j+tkZjYDzWZNVoAFApyoE8VZoMHnV9ZjJy3kwThci2HgU4bP3KXCSG+tqOX24h+Y0aEB2sPnb/ISmT1hMOXkYm+LRE6Dx7j9ZxegBIbBDPXoPshs5+Hq1uW95Q5j14gR6L2PQzhSvNr9ESizhyaWyUAWZ2ZeIrwKMhhpbs2g4Z/zLgjt3jPVgWS+TxSWstNhLcTHeHlcyEGuAMatksGcRMlWRkAUDFDyuejFNuzEl9w23sobTYZRB93u5syATCMJimebil0YjNBrnEAdmy3xfAJ0TRs//hwDU8qY8UppWUOWfF4fH8yd0kjoMyEgVxgloDVkts7le98fjJXX1+fBglvkwz+mjQAhpTpIbs6zBy2YM8OS0WMpGvnVLeXStcGlbGY8xbRpJsSpTqo/nROTQsp4bk83kprMS4Ec73IiX+TLs/n1LGRdOMcc+iCpJ+3MFtR5nJqV0n7OpwKAKT7qmQH6jn16iRUHAuAzFwYxsc4NSotAMTjdxwrAUL8IYXF1W6IgcpMjUnq2Iwmeyt0djhuo2eTXVJLjbtcZgnwIwDkU8ybhttVTly9vb39kkSUcfY/XxxiYambU6PSqcRWVlb6JCOYcEP/KehJt5ioS4uP8Gh0qtgrQhncttY5SQX+JjdoqfJSi9qpEgCOPyIVfDrJDVoqPsn+vHMBmC1JwG1OA0mSs6x3sM2rlwDp4DSNJTnLRU6lHml/gyQBlykOuGBBhfO55qKhU1YgEKiAz39GutzOaQ6PRtHMtoHGUhwYBhNNbtOFG8mqcco9tEmb1zkOAEVZJ/39YypFTqaJRyU1WEIzOQ4KgPww9sskAI6mAaAJzOQQ4v3lSQ4kOWS53W7qCXpNIn6zOxw+nwaALiUnMK0+opkGkkqd+NraWopymyXuH2SpkVtucn+HKF00R6s0jVXqAAwODW2W+p0DRiKRZnYaAJq9pfFTqWCwDS7xsVIlnqq+UO33pfC3NWt3GMh8yqx9tHK4xL0lbPlbpIHO7ng8vsMCiPkPINNNs7eSLVhOo2ilRrwaDDbB8r8kBQMfUpdIyn0ys0akqmQh55v+MQYkF9A0Vimkw1Wh0ByWSLSbq13Q/Yvd0SjRpGeVgOG9NHicnL29LwVlCV0/WQr2QFXVGaD2pET8PRfn62XiswHAklPXnG+Qigm1MJKnq6urpxUr8b6amhDE6jSImi4Zvk2aptmW+7PWBGnqmgaPJRBmxYaGzhWjJBDn3bHYWZzxCYvaG0ZrJBL5PGuVKNdDaeqaBo9lECAJP9N4arEQTzovcCaZeNiuE3DvzTmLJCM+va6uzB+NHse3F6WHx5Bfb4Gk7Jtsay90fY9c3oc3+6lbVVeOd1g6DYKqad/S7G2GrzWMH/CxmVLLCQ9y4OczXF2K8xG/f81oxuVdo3pbJKIPDg4emVJeruKF86Sy0mykz6+Vl5dT1nVpYGAgXujY3lNWtgXvPALj9pQNQ1rBjFdx5lGdQxkD8usRIu+DyD1kc1ujgSSayZEDjnyktMjqNrD/JkAzUvXUr1Y2wuB98SDPHVPwQYPHCSG+ggV9LsuWIZrJSY2lnKHhhDGKOY3tPU/FjFQ+77XbR0EO+flsri7vAAw7BJq9hZf4iNn8iMm0dJrMoOGEVH++g7q0lHkO9+qoY0NNC6rbp0rX9VTAxP88O4KadlN4C4Bb7YKcQgOQXIgJVBo/pQnMLL8ky/uiKJWyOkpsxqtqeYu/qZKcnMA0jEYaQCpMeiduUjGD8vl8zTEVoh+nJIcQaQ7PMJaNGwwhblABk2p4qTJWcf54Ope/psySBpJoJofGUmgyA58h2AJ3ypXG8D1CvTpqV1HHhpoWuNVe6PjiX7rk5GR8PE/UAAAAAElFTkSuQmCC\";\n\nvar img$j = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAA0dJREFUeNrlWwmO5CAMjBEv2On/v7BnnjDeZhUkixgfQELIIkXqzgG4XD64YKuU1+vF3v9F3Dzl5/vbVX9PewGg+uz9frP3wduxskMVAdHSlgeImgB/vr5MANTqid6OGAoK92GbXLKcGYgwuH7sfH55iZr2a9TrBAmkdjxsrPkYrZ70LLUZBwpes3vUQCjbSv+5zpf05YSkz/JvCYjAPRykdZCcX6vtWjTrqTOeZPtgZMIQQDTFSUwIrdpPlY2IHFqnRxauzrDNKzhKwz2hPFxA/22UL7AI6AVhJgOGULrXVOJoRK8UvhY2c4zXwuQ/BqTcnl53FHB09KCgTDeBGsPOYl5pNuHJmr7ECVobKqnXo+GRoIWRdmUNU/m9VhBGmkeYaecjtcy9Lw2oLgWgFq8/93BPpNjrrDR5ehRwJDBIQDqFlXGG8C3ffDqMwrfQCkLs7fBVmaLSD2wF4w5jAahcbpB306qaDAfi5SZAhfl0SJoqB6pdmt9bTWYTpt1cANxlQLSDAJY5hV1g1TSWHg5z5qL4iQNgkU4rJ9oI2gZrsjEJiEx70VSSj/i8BwcG5I8lBBWAblO0PlJHGYzCl0B0aarQWjVR2jUJLSGucKTDw2BTZrYLBVR4ia4EHI+tm/xEdpKB0z7pJAidw22tYosCOcxkzaT/QrzGM+21IW3WzAVcY4Fi4hFmaN0DAuMzDiXtJ6D7CMIIGq1W6ORvaNDGY0BIV2ik5CNAYBlgsfMngRA4D+9IdJYHIQqJDmSvSUseO5Clp+Fr/5ebQCcLlmZEVHJ+0NYLqT9IbKkx5vYA1BKdJMCoFZ0losCIQc+yJsCxgNuadsMJEbvGSRpsTYQew4LDstgHjOpo8H8p1lQYH6L9w4auYI3nT/P+2a8FxxgcFwcBe0zgUc6Psjw401q8sINn2r5+YOIpcV9TbqD7e5hNhfAAX4CScmNHpbCA3auHt1QnuGJiJAhfPzVGP7ZMRe9bVuCsjY5nCM+xNnidxgIOsSo8e2DCsuQtTILinTQvTOiCeHLUujzV0oCVOT2m5KU9bRM0OjNH1NiGZm21V84LgybX0itDmvCu4bB19+YKiyKS8KWcoNmpkhLjTPpzLCiF1+T4C+eX+V1keq0EAAAAAElFTkSuQmCC\";\n\nvar img$i = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAbhJREFUeNrtWgFqwzAM9Jm+YM3/X5juCdPooFA8Z7MdSZbkCEohtFi6O8lSUEqXXba0waBPpOkfDAev4uPNcOBLpADN9hOOWEcUAKjRJ5V6AEPBY0ZRhDHWW/8HTwDQSR9EQYAxyauDAKOsq4EAw6yrgAAngYuBAKNyV5sZ4IR1MSXAafBsIMBx8CwgZOaucsZscerMbMEJofNJCgBKNm0IhByA/VMg5CDsD4OQA7E/BEIOxr7qLYCVAAjJPncj5LE4NgFADuVPlwKYAPDIflfBjqgA4lJAFPaXrwHgAgAR0ckr5/8KKYCrBvxjt055/UL0435Pn49Hqj3ntKMz3p5X5b9t28/3vu/dCmguemWw3MEPnoESiBcYowroclDCOM4oFRGlBgyP673LCXACAErGa/ZUQfhb4Kj4RboG6Uw9GNnPcbteW0uH/P6w8oNQs38tHTCAMDyyf0Ty8q1wS3NBDZ+ZChj24xk7BmUmMplx3v/cTmmxDMn8r/YBjf01Jkm6J90glQJW1CFCkoVl6fAAaIBkYlV2Fkgh31bbKhxl+/hFdtcFMtA8Cl+tcAsAf71RsW6efVezb/4DdiZjsxv1AAAAAElFTkSuQmCC\";\n\nvar img$h = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAa1JREFUeNrtmoFqAyEMhv2lT7De+z/hdY+wjA4GxXkjphqTaKAUpOWSL380eqa0bdvSBoM+kaZ/MBy8io83w4EvUQI02084yjqiACCmTyrzAQwFjxmTIoxlnfs/eAJAb/owFAKMSV4dAoxmXQ0CDGddBQKcBD4MAozKXW3PACdZH6YEOA2+G4TsvL2GsCyHAMCkvcXUZZCMbKvFE6PFIzFVCNEANEOICKAJQlQAbAg5LW4bwAawjmElALQVsAHwlvu8svw5AChNfHE5uwRIStWL/PckGBAArQ6gebO3fAncGuX1h+jH/Z4+H49UG+9pV894Ga/K/ziOn+/zPJsVwD4rKIPtHbzwGShB/MKQKqDJwRHW4xmlIqLMAeI+pfVyApwAQJnxmj1VEH4VuJr8Ii2D9M58ILmf4/Z6ba0c8utg5Qcej83RUg4QEIbH7F8leflWmNNcEOMzUwFiP56xQyizITuznut/b6e0soyR9V/tA5j9NSZJuqXcMKoErKhjSJIsXJYOD0ADkomrsrMgRb7kYaRuyvbxi+y+J8kAeyu8W2EOgP9OVKybZ9/V7BsoanMeq391+AAAAABJRU5ErkJggg==\";\n\nvar img$g = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAhtJREFUeNrtW21uwyAMjREnWHv/E6brDrDGC1MzZQiCCWAMwVL+NCH2e/iLQGHyyP1+R9fvC+IkVRSA9948z86bQAXeOgE+IoAKvBcCbCLUdHGB0Oz7YidFVn22jiLg3noOsWlO4NzyJhaOiFCu2e8BPDXhXyIHGE/whZmWPvt2voiR79dr+no+/2GzPV6XNCBHgnOV3WVZJqWUt+xtY8wzIdEtu3aOnkSnzmCqh8Q2OgY0ZWazEVBbPh+Pw/sft1uS18D6ArQUUpKg1H44aLuN94wvoWCHibbt8msBVcLNJIdAdBL0ZHmyIlcVObsYOkp4W7K0nwkl0WZCgAKeKwS6Ad8EASXBN10FcoAfjZDxAMNkJJtdNULboN/LZif0vNCL4gF/FzgGdR0Ctu26oKJuW+HLrwUGAYOAjuRsEuSqAiDRAzhLII4QEEgAZw8AUnPAaIQGAb0QsP/iErvL0qLYGPVVgPtI0JdzeWtLXcccLRtJcBAwCOifAOqR2RbFhW0clfUx09thSR9GHRrQOhGhkIYzsX90PG23T5+VuPW9SOlaqX1NkePy+y22zeCc4G0dWb8HbIzkrALG8FRPyEmkK6S9Z4VzEZFCQk7w5P8MZRAM5Rvm94TLoEASkMvekiXuLAjktLV0jY8Fg9x2cjQ5VFBYw0auLi8EDmvZx9nmokTbuPt8lGZXjYUOSrKp5koPBdlSlYSqX6B+AGDuGPLVCsLeAAAAAElFTkSuQmCC\";\n\nvar img$f = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAhRJREFUeNrtW1tywyAMtBhO0OT+J3SaHqAxMZ2446qINwQBmvFPbAy7rB4YAgth1+tVmX7flFpaNQFA3lvX1XgTfIFzJ4AiAnyB90IAJkIsgxu4Zp/ynRTb+8N9FAH36seKTdYEXttexIKNCGGa/R7A+wb8IWKAVgLlZrL12cfxIsS+H4/l637/gw0rXpYcQI4AZ0q727YtQggy7R1t9DMuk5ylnaMmkakzmKqQ0EJHg/aZ2WwEvNs+bzfr/Y/LJUk1sL9AoQ59gmCr9bBz7BhvjJZUw4IJHtvwawFRQmYtu0BwECSivHdHpiwSuxiyBbwjWOJnXEGUjQv4gK/lAt2AZ0FASfCss0AO8LMQ0grQTAay2VUhdDT6uTA7rucbvXwU8HuBoVHXLoDHLgt21G0pPPxaYBIwCejIYoNgrSwALSqgZgpU0wUaJKBmDQCtxoBZCE0CeiHg/MUldJeFo2GMchTgFAlyOMmjLXUZcrRsBsFJwCSgfwJ8j8xyNBO2eVSWYqa3w5IURulqwJ0Il0tDjO+fDhr9Iwfv0xt2nZJijKtq9a1rko7Ln7bTlAk8ATwZvOW9+T44uJSAT3PsMwKeg8uWXWwqcCkAuzR5VpgIGjHjbSKtev9nKAIMJIB/e4CFDDMKHIGXLITYgM/9PYAV8JwuUKofdgpgBbzGYohFCS1HBV5KAewWTnJU4KkDVz2A1/YE9TAKPpdsqQcAAAAASUVORK5CYII=\";\n\nvar img$e = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABcmlDQ1BpY2MAACiRdZE9S8NQFIbftkpFWwrqIOKQoYpCC0VBHKWCXapDW8GqS3KbtEKShpsUKa6Ci0PBQXTxa/Af6Cq4KgiCIoi4+Af8WqTEc5tCi7Qn3JyH9573cO+5gD+tM8PuSQCG6fBMKimt5tek4Dt8GEQYQ5iSmW0tZRdz6Bo/j1RN8RAXvbrXdYyBgmozwNdHPMss7hDPE6e3HEvwHvEwK8kF4hPiGKcDEt8KXfH4TXDR4y/BPJdZAPyip1RsY6WNWYkbxJPEUUOvsOZ5xE1CqrmSpTxKaww2MkghCQkKKtiEDgdxyibNrLMv0fAto0weRn8LVXByFFEib4zUCnVVKWukq/TpqIq5/5+nrc1Me91DSaD31XU/x4HgPlCvue7vqevWz4DAC3BttvxlmtPcN+m1lhY9BiI7wOVNS1MOgKtdYOTZkrnckAK0/JoGfFwA4TwwdA/0r3uzau7j/AnIbdMT3QGHR8AE1Uc2/gDt82gCvNGYhAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAcpJREFUeNrtWwFuwyAMjBEPWNf8/4XpugesoWMKUppBYidQ5cAnVZWaRtGdDxscoC6Bvu9d7PfRue6sMETJa8MwRC8Slzi6ACkhiEu8FgGWQpiucdBW9FNj5wiWzyvxjOk5/muVm30n8Xfjl8NfkNeEMLHo10Cem/CbyAHeCZMb/sGePfqTfXfh5/Hovu/3F25Lx9ujiURad6WIld1xHDtjTLLshXv8f7Zgka2dY04ClQNCxDmR5eL0Dvi63Vavf16vh1xjzzy13YKUPPQQWFaDHOShBJjX8VzkIRdDa+RDvvBlskoBOOSlVcLURr7KIVCKPIQAJclDJsGc5FkzwdBUqJE8pANykocTIDd59mKI2zIv0Q8oSR7GAaXIQwhQkjx0GVQBGI5xjEWRrTGqkmGjQ0AFUAFUABVABVAB2sXmRMi3pEbnSDLJyNm3h3MAEvnsAqCRZw0Bb/l5Q2THjg1qaghoFVABVAAVQAVQAVQAFUCCI9thxYSJXj5WcspCHaACNNgP+LhcTr+gySqAX/nNX2nP99ujI/aaX3NAbAPDkQ0RSNFfPTUWbkA/QLUVTNoT9RpOj+rJ0aUDJE5AdkDy8LRECEQBUrnsCeUexwK5uUFRAAAAAElFTkSuQmCC\";\n\nvar img$d = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAMtJREFUeNrt2kEKgzAQBVAjnqDm/ifUHqHpsigKgkYa5/2dWRjnOQkE0nUiEjlpZ7xEqTcFKn6z5j76EggPMJzYJ1pJ0QEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACB4hrMveI1j957nzfErszfH1vjtHbAu9uria84x1PrAGqkxR/g94Mg1uafdEXJNDgAAAAAAAAAAAACAY6fBogMAxDoOP7nt01GARXLOi+dP+V+fPv1KmqbJEjgNsP77LaXlb78tX1rgGEFVOtioAAAAAElFTkSuQmCC\";\n\nvar img$c = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JIpioim0ELHYIgaLCKIglhJBG7WIEYzabDabRNjEZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9Y4SImFlm78eZOZeZM+CfsoyC2zQIhWLJSUzGtfnUgtbyTIAQHQSJ6oZrT89OJGk4Pm7xqXozoHo13vfvCGZM1wBfq/CIYTsl4THhqdWSrXhTuMvI6xnhA+GYIwcUvlR6usZPinM1flPsJBPj4Fc9tdwvTv9iI+8UhPuFIwWrbPycR90kZBbnZqX2yOzFJcEkcTTSlFnGosSA1KJk9r9v8Ns3w4p4DPnbVHDEkSMv3pioZelqSs2KbspnUVG5/83TzQ4P1bqH4tD86HmvfdCyDdUtz/s89LzqEQQe4LxY969ITqPvom/Vtcg+hNfh9KKupXfgbAO6723d0b+lgEx/NgsvJ9Cegs5raFusZfWzzvEdJNfkia5gdw+isj+89AXPlWf0rTeiAwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAZBJREFUeNrtmlGOwyAMRDOoJ9jm/idM9wjrzVZaKWpDoBI2YzBSf6oqeB5jjGmWZfKBDnMKU0wgEd0tPpAKN4sTDsSrxgqyPDffH2AoHp2eYwqgddDqEEAs3gQCyMWrPz85KbHUZVA6VxewOsDFSOTWV392UrAkW3Nl6gCL5grMKSDsK94aAAhSIKpAACADIF7yvxUAeM3/SAFFAOIltRKLFXvNqZkCwr76sQc0BgBv9rdwgDDbP1Ig2uFwQAAIAI46QZU5wgEOdmzEHuAEgOV/BMJk0VxAFu8eQA3Auq6nlH/k/evvx+Ptu6/7van6mjkS8jy2bUMVgJzwKwCvAbYWXzvHFYAcCNQKLwGg2NBQnxH/IKavAiitfi53vIySttuowo86dgjZ0okzQqOIP7ggW0qn2AP2BX1+sifB4w9GW/2Ss3FiC4zshteUjzK4n6jk7Jg5w/g7TWLheNNr2AsRfgBajYunFOh1qdG9BYgUCAABIADcPuymnsPLrVCuAQoHXABAafWd3gNM0+x9PH4BvDJ3ZJJMpIIAAAAASUVORK5CYII=\";\n\nvar img$b = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIU/YyTBBykUEbHYwoiFAVEQS4mgjVrECEZtkk02EbKbZTdBgq1gYyFYiDa+Cv+BtoKtgiAogoiNf8BXI2G9YwIJorPM3o8zcy4zZ8A3k9dN1z8MplV0YtNRbTGxpAVe8NNNB0HCSd21Z+en4vw7Pu9oUvU2onr9v+/P0ZbOuDo0BYXHdNspCk8Iz6wVbcVbwl16LpkWPhQecuSAwldKT1X5WXG2yu+KnXhsEnyqp5Zt4FQD6znHFB4U7jfzJb12HnWT9oy1MC+1V2YfLjGmiaKRosQqeYpEpFqS2d++4R/fHAXx6PK3KeOII0tOvEOilqRrRqoheka+PGWV++88XWN0pNq9PQotT573FobADlS2Pe/ryPMqx9D8CBdW3V+QnMY/RN+ua/0HENqAs8u6ltqF803oebCTTvJHapbpMwx4PYWOBHTeQOtyNavaOif3EF+XJ7qGvX0YkP2hlW/cxWf6XLNyeQAAAAlwSFlzAAALEwAACxMBAJqcGAAAADdJREFUeNrt1LERAAAEA0DsvzO9EfjvUsrlRAAAAAAAAABwX67c3+6u7wtQgC8AAAAAAAAAwH0DNkcBCEXoxRkAAAAASUVORK5CYII=\";\n\nvar img$a = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/xmiESWEhLO5iyAKJkqVGscFiZpTBZu51Z0bNx+3eO2myVTYWykJsfC38B2yVLaUUKcnGP+BrI13vMVMzyZzbue+v55zn7ZzngG8mY2Qd/zBkc64dmQ5rC/FFLfCCn27aGCKYMBxrNjoVo+b4vKNO1dtB1av2vn9H84rpGFDXKDxmWLYrPCE8s+ZaireEO4x0YkX4UHjAlgMKXyldL/Gz4lSJ3xXbscgk+FRPLVXFehUbaTsr3C8cymYKRvk86iYtZm4+KrVLZg8OEaYJo6FTYJUMLoNSc5LZ/77hX98cefEY8rcoYosjRVq8A6IWpKspNSm6KV+Gosr9b55OcnSk1L0lDA1PnvfWC4Ed+N72vK8jz/s+hvpHuMhV/HnJafxD9O2KFjqA1g04u6xo+i6cb0Lng5WwE79SvUxfMgmvpxCMQ/sNNC2Vsiqvc3IPsXV5omvY24c+2d+6/AMRKmgSy8M37AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAV1JREFUeNrtmgEKgzAMRRvJCab3P6HuCOtU5nBdY61iqcn/UJBN0f9qkxTjHARBkGGR9EfXdT72+8v7as00JNpxfd/TLgCS8bsDkEDQXuNaAIQgGsSAxOxLa+cuSnljrcbXPkYI02EUBMUIaTG/eguWwz+vJmLAOKHziAZO7bOf8mY+CwCAdQBszXBYyfLB0rbWephKLAFf8QR7xIACAGquE7KfjUvdCGkQAAAAADRVgnoKoecwuGlYLYSWi+bxaFufc36lY1Mfj99BkYtI+RLwKISQBQAAAADgZBAslQmo1jegVBr0WAKVAihVB1DNMYAsvwFIg2oAjLuj9U5JveHQI1sxLkEw920w7CTjnNYyBEEAAAD9APa2zN5RMW9olZXIKGyWjHrk1AWae4V/dnQ5a3+rryjzK9PpUjZV6Ei6pF3+avNX3INDIpqzQGxJs3SCNhCae6AhCIKgo3oDRfKqQh1Aqh4AAAAASUVORK5CYII=\";\n\nvar img$9 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABbmlDQ1BpY2MAACiRdZE7SwNBFIW/JEpEE1JoIZIihYqFgiiIpUTQRi1iBF/N7uYlZDfLboKIrWBjIViINr4K/4G2gq2CICiCiI1/wFcjst5JAgmSzDJ7P87MucycAf9M3jDdlmEwraKTmI7HFpeWY8E3WogSIoxPM1x7dn4qSdPx/YBP1fsh1av5voajI5V2DfC1CY8ZtlMUnhCeWS/aineEu4yclhI+Fh505IDCN0rXK/yqOFvhT8VOMjEJftUzlq1jvY6NnGMKDwj3mvmSUT2PukkobS3MS+2RGcUlwTRxYuiUWCNPkSGplmTW2Ddc9s1REI8hf5sNHHFkyYl3UNSSdE1LzYieli/Phsr9f55uZnSk0j0Uh9YXz/vog+Ae/O563s+J5/2eQuAZrqyavyA5jX+JvlvTeo8gsgUX1zVN34fLbeh+sjVHK0sBmf5MBt7PIbwEnXfQvlLJqrrO2SMkN+WJbuHgEPplf2T1D6TFZ+Dpj8jzAAAACXBIWXMAAAsTAAALEwEAmpwYAAABJUlEQVR42u2b6wrCMAyFF9kTuL3/q0YUlDIQrGnatPkOFPZDluY0l7NQty05pHjWCfbo9nKd6KCa4pY9BSAgOwF7w7zTRrmrRIAjzvN8rSsB0rP1VFZ86RUBUqwIbc91L+8ooAtkdv4ZBUQABEAAn8Ot8KsS1Ei+946ASJ/dSgoMIECipf8+ed2pxv04hhdB2iAEQEAcjCiCLbWAGGwsIYTUYAMhtIIQEoMN8Qjv6woHhBBtEAIgYCUhZO4gTISoAXMLIfNe0k2E6AIQAAFT6ADLoGMJHaDOzqMDousAy6Cjai/p5gHlFTlSAAJsbVD/+E24lBBH52ts6ijfI6SAjrTLJanOJyeBokBSnvi36/IAUATD/3fQxXdJ6vyHBHRA9hQA2fEADxYsjjbR70EAAAAASUVORK5CYII=\";\n\nvar img$8 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAZ1JREFUeNrtmw1uwyAMhTHiBGvuf8K03QHWMDE1UkehgEMSDO+TKlX5IXnG2E4gpCJM0xTcvlirWkUTRffN8xzcTrnCpRsgZgjKFd6LAVIeAQAYCzrjon7APTMgmdZ7KDc7hfh5PNT3/f7W3mpw99/seQM1ejeUdpdlUVrraNpbz3HHpDQZyeO3Rk1ifJfweyzVg1s9pLTQcaJjPcuOAUeKKOV2vX7c/3W5bPIa8htIXfBJq/VwMqv5ejm+ZBsOC8X3ptXg6D3cTFJhx60Dsi8UyiLcSvBTwFtjV2lMEzMEcsQfNQS6ES/CAHuKF50FaohHIeQ8wAkutGZXhRCnrraN/4o00imWbqgQAgCAoRk+C1BH4lmaNIYACiEAhub16ah0lkW6XocZRXjMCNzZ4aOyQPWo/jalzpgYbeoFxxacdgmVILXYuO1BPHcIdMPfEAgZoNdlpCGteBiKWaY3L4hpNKkTpBsiFeOKl8s7Xhca1Zqjq1Xa5i6ZXzuWFQMY02lyXoi0tI53Dw/w9ZjYAb3VB/hCBAAAAAAAgH/8Ah3f3c5J52vwAAAAAElFTkSuQmCC\";\n\nvar img$7 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAgVJREFUeNrtWwtuwyAMxREnWLn/Cdt1B1hDSzemyoNiKFADthSpSiDhPX/5FFREjDHB+7u1iqtsANFnx+MxeB+owEcnIEYEUIHPQgAmwvfgi6qt3ClbFfyP1ajFZXkCNCUz1BYccGMpqpHYFAGshJqdQvJ9uaiv8/nf+zzh7rduOYAa2g2l3X3f1bZt0bTn+7g2KUx6ZP+tUZNobBJYYykNvmohuYWOAx3TbHEQ7AkiVz5Pp6fPPw6Hl6wGbi+w6IOULMC1eEqOHeMtsSXOlWP22KQSbGFmnF2AUglSojz5Q6EsUloJPgt4PljiNqkgOowLUMBPOxlqBX4IAlqCHzoL1AAvhZCzAMdkJptTFUK+0/3C7KTaM70oFvB3hRZFp3YBVWlFiHM1KHMBIUAIEALqzQbfnAmAqwX0SoNWXIApAb3qAOAcA2BlC5A0OA0BjysuubssIwrGqFcBHiNBL2fyaEsdjDG28wkNNuL2J+SU2PJZ4GYGsCp4hx1Ce38MY0LJumXQ58UFMAGU3dtMTVmm5h60dJ3qkOEOFv0GrsCDvpSj9ceDRr+7SrbxbDEaA3AVSz0y7xVbFAPQdlpr8H0XHDJPb/QCX80CMB4da0BwiaE0T/7PUKFG3m65PUvhqeYOyxdCI7oAcHnZ0Omv1oCHJ6HGYOcqhFYjYWNG5PDCdjosEpEraP7o1MFLlvgAAAAASUVORK5CYII=\";\n\nvar img$6 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAALNJREFUeNrt2zEOgCAMAEAw/v/L1Qc4FSWNvSaORLjS6gBjiN4x7yc6Axzdd0B7gDMzKCJmyXqeMz7fAVUXn52bHgBAE9zffJ5qNdPA3uhHSiCZ7VjJ3FefvcxczuSLR5Vf6NUEKAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPDj2HJlJnOkddcBzKPi4lfGKQEAxQCytbyrB7g3qAQACNE5LgqdKICszpBUAAAAAElFTkSuQmCC\";\n\nvar img$5 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZE7SwNBFIW/JMaIRlJoISKaQsVCQRTEUiKYRi1iBF9Ndt0kwiYuuwkitoKNhWAh2vgq/AfaCrYKgqAIIjb+AV+NhPVOVkiQOMvs/Tgz5zJzBvyTpp5z6gYhly/YiXgsOje/EA29EqSeEJ10pXTHmpqZSPLv+LrHp+rdgOr1/76ao2nZcHTwNQiP6JZdEB4TnlwrWIq3hVv1bGpZ+Ei435YDCl8rXfP4RXHG4w/FdjIxDn7VM5qpYq2K9aydE+4T7s6ZRf33POomYSM/OyO1XWYHDgnixIiiUWQFkwIDUvOSWW3fYNk3zap4dPlbrGOLI0NWvP2iFqWrITUtuiGfybrK/W+eTnp4yOsejkHw2XXfeyC0C6Ud1/0+dt3SCQSe4DJf8a9KTqOfou9UtO5DiGzC+VVF0/bgYgvaHq2UnSpLAZn+dBrezqB5HlpuoXHRy+p3ndMHSG7IE93A/gH0yv7I0g/RtGf1H+H7WwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAPxJREFUeNrtmm0OgyAQRB3TE1Tvf1WaNmlCE4NCW77mkfDHRbP7nF1AXBbzpsL7wizxaKLgi2Ja3VMAAO4Abo2KT+ilHtkpYN/3V/8GgH40lf5DeaqlAEW9h2kv25e3CpgFnIN/qgAFAAAAbIdbtNCLL6QAANgNerX7tlEESQEAAAAAAAAAADwBsBAiBQAAAAAAAAAAAAAAAAAAAAAAAACwOxmKf5FDAQColwKhYEyVT2TqJPhm/lED3AGooxrQyje/dUC8FtDFt6YJ7UnD2cnN6PbL5I7Gj25PXggGZUA5spkeggyD/4h9zZHLhPYkAJ08ZHR7sgbMOO8f2h90sy2pSZTVdgAAAABJRU5ErkJggg==\";\n\nvar img$4 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAMpJREFUeNrtmksKgDAMBY30BNr7n7B3iCgo4kbwl+CbAZdCM77E+uk6AABh7OJ5/pd67EfFX6qpV4t8rXU5ZAXIJ2CfhJkSNHw8yzySboE5Bf0DV9sCa7i9lvJR5DPuZWgBBARG2bOshRZAgDhFreBhHBmCtAACEIAABABocrYRciEXdhTggoEwboPqAuRnAAAzIAReiHAbRAACEIAABMQj92Vo/4scCUAAAngWoAVogbjIp1ibJS3+tfWt+4DWGi0gmQBmAAAAwMYEsvUT/L18rywAAAAASUVORK5CYII=\";\n\nvar img$3 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABb2lDQ1BpY2MAACiRdZHNK0RRGMZ/M4gYUSwk6S6GKFOiZKlRZoPFGGWwuffOnRk1M273zqTJVtlYTFmIja+F/4CtsqWUIiXZ+Ad8bTRd7zFqJHNu576/nnOet3OeA/7pjJl164chm8s70UhYW4gvao3P1NNDO4P06qZrz8xNxag5Pm7xqXoTUr1q7/t3tCQs1wRfk/CYaTt54Qnh6bW8rXhLuNNM6wnhA+EhRw4ofKl0o8JPilMVflPsxKKT4Fc9tdQvNn6xmXaywgPCwWymYP6cR90kYOXm56R2y+zBJUqEMBoGBVbIkCckNSeZ/e8b/vbNsioeU/42RRxxpEiLd0jUgnS1pCZFt+TLUFS5/83TTY6OVLoHwtDw6HmvfdC4DeWS530eel75COoe4DxX9a9KTuPvopeqWnAf2jbg9KKqGTtwtgld97bu6N9SnUx/MgkvJ9Aah45raF6qZPWzzvEdxNblia5gdw/6ZX/b8hco4WgdZKtgqgAAAAlwSFlzAAALEwAACxMBAJqcGAAAANNJREFUeNrt2tEKwyAMhWEz9gSr7/+qjg0GvZ3dVMwX8K6F5OfkRFtLSR7R+V7bpZ7YqPiumm7ZWwCA7ADuk8ynreJH6RRQa32vKwDiR6P0H8qLUQqI01ph7H2dy0cFpkDm4l8qoAAAAHAcnhFtlVy0AABOg7nicRxMUAsAAAAAAAAAQE4ANkJaAAAAAAAAAAAAAAAAAAAAAAAA0v0ZOl+RowAAxrVA63hmyCeyWKT4afnxgOwAYiEPmJVbvn3A1evyQmxogi1r/ZG4eCYIAA+w2SpPUykQkfN9GyAAAAAASUVORK5CYII=\";\n\nclass Icons {\r\n}\r\nIcons.icon_arrow = img$J;\r\nIcons.icon_arrow_up = img$I;\r\nIcons.icon_arrow_down = img$H;\r\nIcons.icon_arrow_left = img$G;\r\nIcons.icon_arrow_right = img$F;\r\nIcons.icon_back = img$E;\r\nIcons.icon_caret = img$D;\r\nIcons.icon_circle = img$C;\r\nIcons.icon_clockwise = img$B;\r\nIcons.icon_counter_clockwise = img$z;\r\nIcons.icon_compare = img$A;\r\nIcons.icon_close = img$y;\r\nIcons.icon_close2 = img$x;\r\nIcons.icon_cloudy = img$w;\r\nIcons.icon_delete = img$v;\r\nIcons.icon_download = img$u;\r\nIcons.icon_fit_page = img$t;\r\nIcons.icon_fit_viewer = img$s;\r\nIcons.icon_geometric = img$r;\r\nIcons.icon_hand = img$q;\r\nIcons.icon_line = img$p;\r\nIcons.icon_load = img$o;\r\nIcons.icon_minus = img$n;\r\nIcons.icon_ok = img$m;\r\nIcons.icon_pen = img$l;\r\nIcons.icon_plus = img$k;\r\nIcons.icon_pointer = img$j;\r\nIcons.icon_polygon = img$i;\r\nIcons.icon_polyline = img$h;\r\nIcons.icon_popup = img$g;\r\nIcons.icon_popup2 = img$f;\r\nIcons.icon_sidebar = img$e;\r\nIcons.icon_square = img$d;\r\nIcons.icon_stamp = img$c;\r\nIcons.icon_straight = img$b;\r\nIcons.icon_text = img$a;\r\nIcons.icon_text2 = img$9;\r\nIcons.icon_text_free = img$8;\r\nIcons.icon_text_callout = img$7;\r\nIcons.icon_text_highlight = img$6;\r\nIcons.icon_text_squiggly = img$5;\r\nIcons.icon_text_strikeout = img$4;\r\nIcons.icon_text_underline = img$3;\r\nIcons.geometricIcons = {\r\n    square: `<img src=\"${Icons.icon_square}\"/>`,\r\n    circle: `<img src=\"${Icons.icon_circle}\"/>`,\r\n    line: `<img src=\"${Icons.icon_line}\"/>`,\r\n    arrow: `<img src=\"${Icons.icon_arrow}\"/>`,\r\n    polyline: `<img src=\"${Icons.icon_polyline}\"/>`,\r\n    polygon: `<img src=\"${Icons.icon_polygon}\"/>`,\r\n};\r\nIcons.textIcons = {\r\n    note: `<img src=\"${Icons.icon_popup2}\"/>`,\r\n    freeText: `<img src=\"${Icons.icon_text_free}\"/>`,\r\n    freeTextCallout: `<img src=\"${Icons.icon_text_callout}\"/>`,\r\n    strikeout: `<img src=\"${Icons.icon_text_strikeout}\"/>`,\r\n    squiggly: `<img src=\"${Icons.icon_text_squiggly}\"/>`,\r\n    underline: `<img src=\"${Icons.icon_text_underline}\"/>`,\r\n    highlight: `<img src=\"${Icons.icon_text_highlight}\"/>`,\r\n};\r\nIcons.lineTypeIcons = {\r\n    straight: `<img src=\"${Icons.icon_straight}\"/>`,\r\n    cloudy: `<img src=\"${Icons.icon_cloudy}\"/>`,\r\n};\r\nIcons.editIcons = {\r\n    close: `<img src=\"${Icons.icon_close}\"/>`,\r\n    ok: `<img src=\"${Icons.icon_ok}\"/>`,\r\n    back: `<img src=\"${Icons.icon_back}\"/>`,\r\n    delete: `<img src=\"${Icons.icon_delete}\"/>`,\r\n};\n\nfunction getCommonStyles(appName) {\r\n    return `\r\n    :host {\r\n      --${appName}-color-primary-final: var(--${appName}-color-primary, rgba(40,40,40,1));\r\n      --${appName}-color-primary-tr-final: var(--${appName}-color-primary-tr, rgba(40,40,40,0.9));\r\n      --${appName}-color-secondary-final: var(--${appName}-color-secondary, rgba(60,60,60,1));\r\n      --${appName}-color-secondary-tr-final: var(--${appName}-color-secondary-tr, rgba(60,60,60,0.9));\r\n      --${appName}-color-accent-final: var(--${appName}-color-accent, rgba(96,96,96,1));\r\n      --${appName}-color-shadow-final: var(--${appName}-color-shadow, rgba(0,0,0,0.75));\r\n      --${appName}-color-bg-final: var(--${appName}-color-bg, rgba(128,128,128,1));\r\n      --${appName}-color-fg-primary-final: var(--${appName}-color-fg-primary, rgba(255,255,255,1));\r\n      --${appName}-color-fg-secondary-final: var(--${appName}-color-fg-secondary, rgba(187,187,187,1));\r\n      --${appName}-color-fg-accent-final: var(--${appName}-color-fg-accent, rgba(255,204,0,1));\r\n      --${appName}-color-text-selection-final: var(--${appName}-color-text-selection, rgba(104,104,128,0.3));\r\n    }\r\n  \r\n    .disabled {\r\n      pointer-events: none !important;\r\n    }\r\n  \r\n    .relative {\r\n      position: relative;\r\n    }\r\n    .absolute {\r\n      position: absolute;\r\n    }\r\n    .abs-hidden {\r\n      position: absolute;\r\n      opacity: 0;\r\n      z-index: -10;\r\n    }\r\n    .abs-stretch {\r\n      position: absolute;\r\n      left: 0;\r\n      top: 0;\r\n      width: 100%;\r\n      height: 100%;\r\n    }\r\n    .abs-topleft {\r\n      position: absolute;\r\n      left: 0;\r\n      top: 0;\r\n    }\r\n    .stretch {\r\n      width: 100%;\r\n      height: 100%;\r\n    }\r\n    \r\n    .no-margin {\r\n      margin: 0;\r\n    }\r\n    .no-padding {\r\n      padding: 0;\r\n    }\r\n    .margin-s-5 {\r\n      margin: 0 5px;\r\n    }\r\n  \r\n    .line-clamp {\r\n      display: -webkit-box;\r\n      -webkit-line-clamp: 1;\r\n      -webkit-box-orient: vertical; \r\n      overflow: hidden; \r\n    }\r\n  \r\n    #main-container {\r\n      box-sizing: border-box;\r\n      position: relative;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: stretch;\r\n      align-items: stretch;\r\n      width: 100%;\r\n      height: 100%;\r\n      background: var(--${appName}-color-bg-final);\r\n    }\r\n  \r\n    #top-panel {\r\n      position: relative;\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: space-between;\r\n      align-items: center;\r\n      flex-shrink: 0;\r\n      width: 100%;\r\n      height: 50px;\r\n      background: var(--${appName}-color-primary-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      z-index: 4;\r\n      transition: height 0.25s ease-out 0.1s;\r\n    }\r\n    .hide-panels #top-panel {\r\n      height: 0;\r\n      transition: height 0.25s ease-in 0.2s;\r\n    }\r\n  \r\n    #bottom-panel {\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: center;\r\n      align-items: center;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      bottom: 20px;\r\n      height: 50px;  \r\n      background: var(--${appName}-color-primary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      z-index: 4;\r\n      transition: height 0.25s ease-out, bottom 0.1s linear 0.25s;\r\n    }\r\n    .hide-panels #bottom-panel {\r\n      bottom: 0;\r\n      height: 0;\r\n      transition: bottom 0.1s linear 0.1s, height 0.25s ease-in 0.2s;\r\n    }\r\n    .compact #zoom-fit-viewer,\r\n    .compact #zoom-fit-page {  \r\n      width: 0;  \r\n      transform: scale(0);\r\n    }\r\n  \r\n    #focused-annotation-panel {\r\n      box-sizing: border-box;\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: flex-start;\r\n      align-items: stretch;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      left: calc(50% - 120px);\r\n      top: 80px;\r\n      width: 240px;\r\n      height: 84px; \r\n      padding: 18px;\r\n      border-radius: 18px;\r\n      background: var(--${appName}-color-secondary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      opacity: 0;\r\n      transform: scale(0);\r\n      transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n      z-index: 4;\r\n      pointer-events: none;\r\n    }\r\n    .mobile #focused-annotation-panel {\r\n      left: 20px;\r\n      width: 150px;\r\n    }\r\n    .annotation-focused #focused-annotation-panel {\r\n      opacity: 100;\r\n      transform: scale(1);    \r\n      transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n    }\r\n    #focused-annotation-panel p {\r\n      margin: 0;\r\n      padding: 0;\r\n      line-height: 16px;\r\n      font-size: 12px;\r\n      font-family: sans-serif;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n    }\r\n    \r\n    #annotation-panel,\r\n    #command-panel {\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: center;\r\n      align-items: flex-end;\r\n      flex-grow: 1;\r\n      flex-shrink: 1;\r\n      right: 20px;\r\n      pointer-events: none;\r\n    }\r\n    #annotation-panel {\r\n      top: 125px;\r\n      z-index: -5;\r\n      transition: z-index 0s linear 0.25s;\r\n    }\r\n    #command-panel {\r\n      top: 80px;\r\n      z-index: 5;\r\n    }\r\n    .mode-annotation #annotation-panel {\r\n      z-index: 5;\r\n    }\r\n    \r\n    .annotation-panel-row,\r\n    .command-panel-row {      \r\n        display: flex;\r\n        flex-direction: row;\r\n        justify-content: flex-end;\r\n        align-items: center;\r\n        flex-grow: 1;\r\n        flex-shrink: 1;\r\n      }\r\n  \r\n    .annotation-panel-item {\r\n      margin: 3px;\r\n      cursor: default;      \r\n      opacity: 0;\r\n      background: var(--${appName}-color-primary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      transform: scale(0);\r\n      transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n      pointer-events: all;\r\n    }    \r\n    .mode-annotation .annotation-panel-item { \r\n      cursor: pointer;\r\n      opacity: 100;\r\n      transform: scale(1);    \r\n      transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n    }\r\n  \r\n    .annotation-panel-subitem,\r\n    .command-panel-subitem {\r\n      margin: 3px;    \r\n      background: var(--${appName}-color-secondary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      pointer-events: all;\r\n    }    \r\n    .command-panel-subitem.accent:hover,\r\n    .command-panel-subitem.accent.on {\r\n      box-shadow: 0 0 10px var(--${appName}-color-fg-accent-final);\r\n    }\r\n    :not(.mode-annotation):not(.undoable-commands) #button-command-undo,\r\n    :not(.annotation-selected) #button-annotation-edit-text,\r\n    :not(.annotation-selected) #button-annotation-delete,\r\n    :not(.stamp-annotator-data-undoable) #button-annotation-stamp-undo,\r\n    :not(.stamp-annotator-data-clearable) #button-annotation-stamp-clear,\r\n    :not(.stamp-annotator-data-saveable) #button-annotation-stamp-save,\r\n    :not(.pen-annotator-data-undoable) #button-annotation-pen-undo,\r\n    :not(.pen-annotator-data-clearable) #button-annotation-pen-clear,\r\n    :not(.pen-annotator-data-saveable) #button-annotation-pen-save,\r\n    :not(.text-annotator-data-undoable) #button-annotation-text-undo,\r\n    :not(.text-annotator-data-clearable) #button-annotation-text-clear,\r\n    :not(.text-annotator-data-saveable) #button-annotation-text-save,\r\n    :not(.geom-annotator-data-undoable) #button-annotation-geometric-undo,\r\n    :not(.geom-annotator-data-clearable) #button-annotation-geometric-clear,\r\n    :not(.geom-annotator-data-saveable) #button-annotation-geometric-save {\r\n      cursor: default;      \r\n      opacity: 0;\r\n      transform: scale(0);\r\n      transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n    }\r\n    .mode-annotation.undoable-commands #button-command-undo,\r\n    .annotation-selected #button-annotation-edit-text,\r\n    .annotation-selected #button-annotation-delete,\r\n    .stamp-annotator-data-undoable #button-annotation-stamp-undo,\r\n    .stamp-annotator-data-clearable #button-annotation-stamp-clear,\r\n    .stamp-annotator-data-saveable #button-annotation-stamp-save,\r\n    .pen-annotator-data-undoable #button-annotation-pen-undo,\r\n    .pen-annotator-data-clearable #button-annotation-pen-clear,\r\n    .pen-annotator-data-saveable #button-annotation-pen-save,\r\n    .text-annotator-data-undoable #button-annotation-text-undo,\r\n    .text-annotator-data-clearable #button-annotation-text-clear,\r\n    .text-annotator-data-saveable #button-annotation-text-save,\r\n    .geom-annotator-data-undoable #button-annotation-geometric-undo,\r\n    .geom-annotator-data-clearable #button-annotation-geometric-clear,\r\n    .geom-annotator-data-saveable #button-annotation-geometric-save { \r\n      cursor: pointer;\r\n      opacity: 100;\r\n      transform: scale(1);    \r\n      transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n    }\r\n  \r\n    .panel-v-separator {\r\n      width: 1px;\r\n      height: 30px;\r\n      background-color: var(--${appName}-color-fg-secondary-final);\r\n    }\r\n  \r\n    .panel-button {\r\n      cursor: pointer;\r\n      user-select: none;\r\n      display: flex;\r\n      flex-direction: column;\r\n      flex-shrink: 0;\r\n      flex-grow: 0;\r\n      justify-content: center;\r\n      align-items: center;\r\n      width: 36px;\r\n      height: 36px;\r\n      border-radius: 50%;\r\n    }\r\n    .panel-button:hover,\r\n    .panel-button.on {\r\n      background-color: var(--${appName}-color-accent-final);\r\n    }\r\n    .panel-button.accent,\r\n    .panel-button.accent:hover,\r\n    .panel-button.accent.on {\r\n      background-color: var(--${appName}-color-fg-accent-final);\r\n    }\r\n    .panel-button img {\r\n      width: 20px;\r\n      height: 20px;\r\n      filter: invert() opacity(0.7) drop-shadow(0 0 0 var(--${appName}-color-fg-primary-final)) saturate(1000%);\r\n    }  \r\n    .panel-button:hover img,\r\n    .panel-button.on img {\r\n      filter: invert() opacity(0.7) drop-shadow(0 0 0 var(--${appName}-color-fg-accent-final)) saturate(1000%);\r\n    }  \r\n    .panel-button.accent img,  \r\n    .panel-button.accent:hover img,\r\n    .panel-button.accent.on img {\r\n      filter: opacity(0.7) drop-shadow(0 0 0 var(--${appName}-color-primary-final)) saturate(1000%);\r\n    }\r\n    .disabled .panel-button img,\r\n    .panel-button.disabled img {\r\n      filter: invert() opacity(0.2) drop-shadow(0 0 0 var(--${appName}-color-fg-primary-final)) saturate(1000%);\r\n    }  \r\n    .context-menu-content .panel-button {\r\n      margin: 1px;\r\n    }\r\n    \r\n    .subpanel {\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: center;\r\n      align-items: center;\r\n      margin: 0 4px;\r\n    }    \r\n    \r\n    .panel-item {\r\n      transform: scale(1);\r\n      transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n    }\r\n    .hide-panels .panel-item {\r\n      cursor: default;      \r\n      opacity: 0;\r\n      transform: scale(0);\r\n      transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n    }\r\n  \r\n    #paginator {  \r\n      user-select: none;\r\n      font-family: sans-serif;\r\n      font-size: 16px;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n    }\r\n  \r\n    #toggle-previewer {\r\n      margin: 4px;\r\n    }\r\n      \r\n    #previewer {\r\n      box-sizing: border-box;\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: flex-start;\r\n      overflow-x: hidden;\r\n      overflow-y: auto;\r\n      left: 0;\r\n      top: 50px;\r\n      bottom: 0;\r\n      width: 160px; \r\n      padding-top: 0px;\r\n      background: var(--${appName}-color-secondary-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      z-index: 3;\r\n      transition: padding-top 0.25s ease-out 0.1s, top 0.25s ease-out 0.1s, width 0.25s ease-out;\r\n    } \r\n    .hide-panels #previewer {\r\n      top: 0;\r\n      padding-top: 50px;\r\n      transition: padding-top 0.25s ease-in 0.2s, top 0.25s ease-in 0.2s;\r\n    }   \r\n    .mobile #previewer {\r\n      background: var(--${appName}-color-secondary-tr-final);\r\n    } \r\n    .hide-previewer #previewer {\r\n      width: 0;\r\n      transition: width 0.25s ease-in 0.1s;\r\n    }\r\n    #previewer .page-preview {      \r\n      transform: scaleX(1);\r\n      transition: opacity 0.1s ease-out 0.35s, transform 0s linear 0.35s;\r\n    }\r\n    .hide-previewer #previewer .page-preview {\r\n      opacity: 0;\r\n      transform: scaleX(0);\r\n      transition: opacity 0.1s ease-in, transform 0s linear 0.1s;\r\n    }\r\n  \r\n    #viewer {\r\n      box-sizing: border-box;\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      overflow: auto;\r\n      left: 160px;\r\n      right: 0;\r\n      top: 50px;\r\n      bottom: 0;\r\n      padding-top: 0;\r\n      transition: padding-top 0.25s ease-out 0.1s, top 0.25s ease-out 0.1s, left 0.25s ease-out;\r\n    }\r\n    #viewer.dialog-shown {\r\n      overflow: hidden;\r\n    }\r\n    .mode-hand #viewer {\r\n      cursor: grab !important;\r\n      user-select: none !important;\r\n    }\r\n    .hide-panels #viewer {\r\n      top: 0;\r\n      padding-top: 50px;\r\n      transition: padding-top 0.25s ease-in 0.2s, top 0.25s ease-in 0.2s;\r\n    }      \r\n    .hide-panels.mobile #viewer,\r\n    .hide-panels.hide-previewer #viewer {\r\n      top: 0;\r\n      padding-top: 50px;\r\n      left: 0;\r\n      transition: padding-top 0.25s ease-in 0.2s, top 0.25s ease-in 0.2s, left 0.25s ease-in;\r\n    }   \r\n    .mobile #viewer,\r\n    .hide-previewer #viewer {\r\n      top: 50px;\r\n      padding-top: 0px;\r\n      left: 0;\r\n      transition: padding-top 0.25s ease-out 0.1s, top 0.25s ease-out 0.1s, left 0.25s ease-in;\r\n    }\r\n    \r\n    #annotation-overlay-container {\r\n      position: absolute;\r\n      top: 0; \r\n      right: 0;\r\n      bottom: 0;\r\n      left: 0; \r\n      margin-top: 0;\r\n      transition: margin-top 0.25s ease-out 0.1s;\r\n      z-index: 3;\r\n    }\r\n    .hide-panels #annotation-overlay-container {\r\n      margin-top: 50px;\r\n      transition: margin-top 0.25s ease-in 0.2s;\r\n    }\r\n    .mode-text-markup #annotation-overlay-container {\r\n      pointer-events: none;\r\n    }\r\n    \r\n    #annotation-overlay {\r\n      position: absolute;\r\n      margin: 0;\r\n      padding: 0;\r\n      width: 100%;\r\n      height: 100%;\r\n      touch-action: none;\r\n    }\r\n  \r\n    .page-container {    \r\n      position: relative;\r\n      display: flex;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      background-color: white;\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n    }\r\n    .page {    \r\n      position: absolute;\r\n      top: 0;\r\n      right: 0;\r\n      bottom: 0;\r\n      left: 0;    \r\n      transform-origin: left top;\r\n    }\r\n    .page-preview {   \r\n      cursor: pointer; \r\n      position: relative;\r\n      display: flex;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      margin: 0 auto;\r\n      background-color: white;\r\n      background-clip: content-box;\r\n      border-style: solid;\r\n      border-width: 10px 10px 20px 10px;\r\n      border-color: transparent;\r\n    }\r\n    .page-preview:hover,\r\n    .page-preview.current {\r\n      border-color: var(--${appName}-color-accent-final);\r\n    }\r\n    .page-preview::after {\r\n      display: inline-block;\r\n      position: absolute;\r\n      top: calc(100% + 3px);\r\n      width: 100%;\r\n      text-align: center;\r\n      font-family: sans-serif;\r\n      font-size: 14px;\r\n      line-height: 1;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n      content: attr(data-page-number) \" \";\r\n    }\r\n  \r\n    .page-canvas {\r\n      background-color: white;\r\n    } \r\n  \r\n    .page-annotations {\r\n      width: 0;\r\n      height: 0;\r\n    }\r\n    .mode-text-markup .page-annotations,\r\n    .mode-text .page-annotations,\r\n    .mode-hand .page-annotations {\r\n      pointer-events: none;\r\n    }\r\n    .page-annotations-controls,\r\n    .annotation-content,\r\n    .annotation-content-element {    \r\n      position: absolute;\r\n      left: 0;\r\n      top: 0;\r\n      width: 100%;\r\n      height: 100%;\r\n    }\r\n    .page-annotations-controls {\r\n      z-index: 2;\r\n    }\r\n    .annotation-content {\r\n      pointer-events: none;\r\n    }\r\n  \r\n    .abs-full-size-overlay {\r\n      position: absolute;\r\n      left: 0;\r\n      top: 0;\r\n      width: 100%;\r\n      height: 100%;\r\n      background: var(--${appName}-color-secondary-tr-final);\r\n      touch-action: none;\r\n    }\r\n    \r\n    .fixed-full-size-overlay {\r\n      position: fixed;\r\n      left: 0;\r\n      top: 0;\r\n      width: 100%;\r\n      height: 100%;\r\n      background: var(--${appName}-color-secondary-tr-final);\r\n    }\r\n    \r\n    .text-dialog {\r\n      z-index: 9;\r\n    }\r\n    .text-dialog .form {\r\n      box-sizing: border-box;\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: stretch;\r\n      align-items: stretch;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      left: calc(50% - 160px);\r\n      top: calc(50% - 120px);\r\n      width: 320px;\r\n      height: 240px;\r\n      padding: 5px;\r\n      background: var(--${appName}-color-primary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n    }\r\n    .text-dialog textarea {\r\n      height: 100%;\r\n      margin: 0 0 5px 0;\r\n      padding: 5px;\r\n      font-size: 14px;\r\n      resize: none;\r\n      outline: none;\r\n      border: none;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n      background-color: var(--${appName}-color-primary-final);\r\n    }\r\n    .text-dialog textarea::placeholder {\r\n      font-size: 14px;\r\n      font-style: italic;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n    }\r\n    .text-dialog .buttons {\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: flex-end;\r\n      align-items: center;\r\n      flex-grow: 1;\r\n      flex-shrink: 1;\r\n    } \r\n    \r\n    .stamp-dialog {\r\n      z-index: 9;\r\n    }\r\n    .stamp-dialog .form {\r\n      position: absolute;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: stretch;\r\n      align-items: stretch;\r\n      flex-grow: 0;\r\n      flex-shrink: 0;\r\n      left: 50%;\r\n      top: 50%;\r\n      width: 100%;\r\n      height: 100%;\r\n      max-width: 720px;\r\n      max-height: 720px;\r\n      background: var(--${appName}-color-primary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      transform-origin: center;\r\n      transform: translate(-50%, -50%)\r\n    }\r\n    .stamp-dialog .buttons {\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: flex-end;\r\n      align-items: center;\r\n      height: 40px;\r\n    } \r\n    .stamp-dialog .form-canvas-wrapper {\r\n      position: relative;\r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: center;\r\n      align-items: center;\r\n      margin: 20px;\r\n      flex-grow: 1;\r\n      flex-shrink: 1;\r\n    } \r\n    .stamp-dialog input {\r\n      width: 100%;\r\n      margin: 10px;\r\n      padding: 5px;\r\n      font-size: 16px;\r\n      outline: none;\r\n      border: none;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n      background-color: var(--${appName}-color-primary-final);\r\n    }\r\n    .stamp-dialog input::placeholder {\r\n      font-size: 14px;\r\n      font-style: italic;\r\n      color: var(--${appName}-color-fg-primary-final);\r\n    }\r\n    .stamp-input-row {    \r\n      display: flex;\r\n      flex-direction: row;\r\n      justify-content: stretch;\r\n      align-items: center;\r\n      height: 30px;\r\n      margin: 10px;\r\n    }\r\n    .stamp-input-row p {\r\n      user-select: none;\r\n      margin: 0;   \r\n      padding: 0 10px;\r\n      font-family: sans-serif; \r\n      font-size: 16px;\r\n      white-space: nowrap;\r\n      color: var(--${appName}-color-fg-secondary-final);\r\n    }\r\n    \r\n    .abs-ratio-canvas {\r\n      outline: 0;\r\n      position: absolute;\r\n      width: 100%;\r\n      height: auto;\r\n      max-height: 100%;\r\n      border: 2px solid var(--${appName}-color-fg-secondary-final);\r\n    }\r\n  \r\n    .annotation-temp-copy {\r\n      opacity: 0.2;\r\n    }  \r\n    .annotation-controls {\r\n      cursor: pointer;\r\n    }     \r\n    .annotation-out-of-page {\r\n      cursor: not-allowed;\r\n    }\r\n    .annotation-rect,\r\n    .annotation-bbox {\r\n      fill: none;\r\n    }\r\n    .mode-annotation .annotation-controls.selected {\r\n      cursor: grab;\r\n    } \r\n    .mode-annotation .annotation-controls.selected .annotation-rect {\r\n      vector-effect: non-scaling-stroke;\r\n      stroke: rgba(80, 80, 80, 0.5);\r\n      stroke-dasharray: 3 3;\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-bbox {\r\n      vector-effect: non-scaling-stroke;\r\n      stroke: rgba(80, 80, 80, 1);\r\n      stroke-dasharray: 3 3;\r\n    }   \r\n    .mode-annotation .annotation-controls.focused .annotation-bbox {\r\n      vector-effect: non-scaling-stroke;\r\n      stroke: rgba(255, 165, 0, 1);\r\n      stroke-dasharray: 3 0;\r\n    } \r\n    .mode-annotation .annotation-controls.selected .annotation-handle {\r\n      stroke-width: 16;\r\n      stroke-linecap: round;\r\n      vector-effect: non-scaling-stroke;\r\n      cursor: pointer;\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-handle.helper {\r\n      stroke-width: 12;\r\n      stroke: rgba(200, 200, 50, 0.75);\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-handle.scale {\r\n      stroke: rgba(0, 0, 0, 0.75);\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-handle.rotation {\r\n      stroke: rgba(50, 100, 50, 0.75);\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-handle.translation {\r\n      stroke: rgba(100, 100, 200, 0.75);\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-rotator {\r\n      fill: none;\r\n      cursor: pointer;\r\n      vector-effect: non-scaling-stroke;\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-rotator .circle {\r\n      r: 25;\r\n    }\r\n    .mode-annotation .annotation-controls.selected .annotation-rotator .dashed {\r\n      stroke: rgba(80, 80, 80, 1);\r\n      stroke-dasharray: 3 3;\r\n    }\r\n  \r\n    #context-menu {\r\n      box-sizing: border-box;\r\n      position: absolute;\r\n      z-index: 5;\r\n      min-width: 50px;\r\n      min-height: 50px;\r\n      max-height: 300px;\r\n      padding: 5px;\r\n      background: var(--${appName}-color-secondary-tr-final);\r\n      box-shadow: 0 0 10px var(--${appName}-color-shadow-final);\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: stretch;\r\n      align-items: stretch;\r\n      overflow-y: auto;\r\n    }\r\n    .context-menu-content {\r\n      display: flex;\r\n      justify-content: center;\r\n      align-items: center;\r\n      flex-grow: 1;\r\n      flex-shrink: 0;\r\n    }\r\n    .context-menu-content.row {\r\n      flex-direction: row;\r\n    }\r\n    .context-menu-content.column {\r\n      flex-direction: column;\r\n    }\r\n    .context-menu-color-icon {\r\n      width: 20px;\r\n      height: 20px;\r\n      border-radius: 12px;\r\n      border-width: 2px;\r\n      border-style: solid;\r\n      border-color: var(--${appName}-color-fg-secondary-final);\r\n    }\r\n    .context-menu-stamp-select-button {\r\n      box-sizing: border-box;\r\n      cursor: pointer;\r\n      user-select: none;\r\n      display: flex;\r\n      flex-direction: column;\r\n      justify-content: center;\r\n      align-items: flex-start;\r\n      width: 100%;\r\n      height: 36px;\r\n      padding: 0 5px;\r\n      border-radius: 5px;\r\n      font-family: sans-serif;\r\n      font-size: 16px;\r\n      color: var(--${appName}-color-fg-primary-final); \r\n    }\r\n    .context-menu-stamp-select-button:hover,\r\n    .context-menu-stamp-select-button.on {\r\n      background-color: var(--${appName}-color-accent-final);\r\n    }\r\n    .context-menu-slider {\r\n      -webkit-appearance: none;\r\n      appearance: none;\r\n      outline: none;\r\n      margin: 10px;\r\n      height: 5px;\r\n      border-radius: 5px;\r\n      cursor: pointer;\r\n      background-color: var(--${appName}-color-fg-secondary-final);\r\n    }\r\n    .context-menu-slider::-webkit-slider-thumb {\r\n      -webkit-appearance: none;\r\n      appearance: none;\r\n      outline: none;\r\n      width: 20px;\r\n      height: 20px;\r\n      border-radius: 10px;\r\n      cursor: pointer;\r\n      background-color: var(--${appName}-color-accent-final);\r\n    }\r\n    .context-menu-slider::-moz-range-thumb {\r\n      outline: none; \r\n      width: 20px;\r\n      height: 20px;\r\n      border-radius: 10px;\r\n      cursor: pointer;\r\n      background-color: var(--${appName}-color-accent-final);\r\n    }\r\n  \r\n    #button-open-file {\r\n      pointer-events: auto !important;\r\n    }\r\n    .disabled #button-open-file img {\r\n      filter: invert() opacity(0.7) drop-shadow(0 0 0 var(--${appName}-color-fg-primary-final)) saturate(1000%);\r\n    }\r\n  \r\n    .spinner {\r\n      position: absolute;\r\n      left: calc(50% - 30px);\r\n      top: calc(50% - 30px);\r\n      width: 60px;\r\n      height: 60px;\r\n    }\r\n    .spinner div {   \r\n      position: absolute; \r\n      width: 20px;\r\n      height: 20px;\r\n      margin: 5px;\r\n      border-radius: 5px;\r\n      animation-duration: 3s;\r\n      animation-timing-function: linear;\r\n      animation-iteration-count: infinite;\r\n    }\r\n    .spinner div:nth-child(1) {\r\n      animation-name: spinnerone;\r\n      background-color: var(--${appName}-color-accent-final);\r\n    }\r\n    .spinner div:nth-child(2) {\r\n      animation-name: spinnertwo;\r\n      background-color: var(--${appName}-color-fg-primary-final);  \r\n    }\r\n    .spinner div:nth-child(3) {  \r\n      animation-name: spinnerthree;\r\n      background-color: var(--${appName}-color-fg-secondary-final);  \r\n    }\r\n  \r\n    @keyframes spinnerone {\r\n      from {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      8.3% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      16.7% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      25% { \r\n        left: 30px;\r\n        top: 0px; \r\n      }\r\n      33.3% {\r\n        left: 30px;\r\n        top: 0px;        \r\n      }\r\n      41.7% {\r\n        left: 30px;\r\n        top: 0px;        \r\n      }\r\n      50% {\r\n        left: 30px;\r\n        top: 30px;         \r\n      }\r\n      58.3% {\r\n        left: 30px;\r\n        top: 30px;       \r\n      }\r\n      66.7% {      \r\n        left: 30px;\r\n        top: 30px;   \r\n      }\r\n      75% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      83.3% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      91.7% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      to {   \r\n        left: 0;\r\n        top: 0;   \r\n      }\r\n    }\r\n    @keyframes spinnertwo {\r\n      from {\r\n        left: 30px;\r\n        top: 0px;\r\n      }\r\n      8.3% {\r\n        left: 30px;\r\n        top: 0px;\r\n      }\r\n      16.7% {\r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      25% { \r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      33.3% {\r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      41.7% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      50% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      58.3% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      66.7% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      75% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      83.3% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      91.7% {\r\n        left: 30px;\r\n        top: 0px;\r\n      }\r\n      to {\r\n        left: 30px;\r\n        top: 0px;\r\n      }\r\n    }\r\n    @keyframes spinnerthree {\r\n      from {\r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      8.3% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      16.7% {\r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      25% { \r\n        left: 0;\r\n        top: 30px;\r\n      }\r\n      33.3% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      41.7% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      50% {\r\n        left: 0;\r\n        top: 0;\r\n      }\r\n      58.3% {\r\n        left: 30px;\r\n        top: 0; \r\n      }\r\n      66.7% {\r\n        left: 30px;\r\n        top: 0;\r\n      }\r\n      75% {\r\n        left: 30px;\r\n        top: 0;\r\n      }\r\n      83.3% {\r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      91.7% {\r\n        left: 30px;\r\n        top: 30px;\r\n      }\r\n      to {\r\n        left: 30px;\r\n        top: 30px; \r\n      }\r\n    }\r\n  `;\r\n}\n\nclass ByteUtils {\r\n    static parseIntFromBytes(bytes) {\r\n        if (!(bytes === null || bytes === void 0 ? void 0 : bytes.length)) {\r\n            return 0;\r\n        }\r\n        if (bytes.length === 1) {\r\n            return bytes[0];\r\n        }\r\n        const hex = Array.from(bytes, (byte) => (\"0\" + (byte & 0xFF).toString(16)).slice(-2)).join(\"\");\r\n        return parseInt(hex, 16);\r\n    }\r\n    static int8ToBytes(int) {\r\n        const buffer = new ArrayBuffer(1);\r\n        const view = new DataView(buffer);\r\n        view.setInt8(0, int);\r\n        return new Uint8Array(buffer);\r\n    }\r\n    static int16ToBytes(int, le = false) {\r\n        const buffer = new ArrayBuffer(2);\r\n        const view = new DataView(buffer);\r\n        view.setInt16(0, int, le);\r\n        return new Uint8Array(buffer);\r\n    }\r\n    static int32ToBytes(int, le = false) {\r\n        const buffer = new ArrayBuffer(4);\r\n        const view = new DataView(buffer);\r\n        view.setInt32(0, int, le);\r\n        return new Uint8Array(buffer);\r\n    }\r\n    static int32ArrayToBytes(ints, le = false) {\r\n        const buffer = new ArrayBuffer(ints.length * 4);\r\n        const view = new DataView(buffer);\r\n        for (let i = 0; i < ints.length; i++) {\r\n            view.setInt32(i * 4, ints[i], le);\r\n        }\r\n        return new Uint8Array(buffer);\r\n    }\r\n    static bytesToInt32Array(bytes, le = false) {\r\n        if (!(bytes === null || bytes === void 0 ? void 0 : bytes.length)) {\r\n            return null;\r\n        }\r\n        const buffer = new ArrayBuffer(Math.ceil(bytes.length / 4) * 4);\r\n        const view = new DataView(buffer);\r\n        for (let i = 0; i < bytes.length; i++) {\r\n            view.setUint8(i, bytes[i]);\r\n        }\r\n        const result = new Int32Array(buffer.byteLength / 4);\r\n        for (let j = 0; j < result.length; j++) {\r\n            result[j] = view.getInt32(j * 4, le);\r\n        }\r\n        return result;\r\n    }\r\n    static xorBytes(bytes, n) {\r\n        const result = new Uint8Array(bytes.length);\r\n        for (let i = 0; i < bytes.length; i++) {\r\n            result[i] = bytes[i] ^ n;\r\n        }\r\n        return result;\r\n    }\r\n    static arraysEqual(a, b) {\r\n        if (a.length !== b.length) {\r\n            return false;\r\n        }\r\n        for (let i = 0; i < a.length; i++) {\r\n            if (a[i] !== b[i]) {\r\n                return false;\r\n            }\r\n        }\r\n        return true;\r\n    }\r\n    static findSubarrayIndex(arr, sub) {\r\n        if ((arr === null || arr === void 0 ? void 0 : arr.length) && (sub === null || sub === void 0 ? void 0 : sub.length)) {\r\n            let j;\r\n            outer_loop: for (let i = 0; i <= arr.length; i++) {\r\n                let overlap = false;\r\n                for (j = 0; j < sub.length; j++) {\r\n                    if (i + j < arr.length) {\r\n                        if (arr[i + j] !== sub[j]) {\r\n                            continue outer_loop;\r\n                        }\r\n                        overlap = true;\r\n                    }\r\n                    else if (overlap) {\r\n                        return i;\r\n                    }\r\n                    else {\r\n                        break outer_loop;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        return -1;\r\n    }\r\n    static hexStringToBytes(hexString) {\r\n        const bytes = new Uint8Array(hexString.length / 2);\r\n        for (let i = 0, j = 0; i < hexString.length; i += 2, j++) {\r\n            bytes[j] = parseInt(hexString.substr(i, 2), 16);\r\n        }\r\n        return bytes;\r\n    }\r\n    static getBit(n, bitPosition) {\r\n        return (n & (1 << bitPosition)) === 0 ? 0 : 1;\r\n    }\r\n    static setBit(n, bitPosition) {\r\n        return n | (1 << bitPosition);\r\n    }\r\n    static clearBit(n, bitPosition) {\r\n        const mask = ~(1 << bitPosition);\r\n        return n & mask;\r\n    }\r\n    static updateBit(n, bitPosition, bitValue) {\r\n        const bitValueNormalized = bitValue ? 1 : 0;\r\n        const clearMask = ~(1 << bitPosition);\r\n        return (n & clearMask) | (bitValueNormalized << bitPosition);\r\n    }\r\n}\n\nclass ContextMenu {\r\n    constructor() {\r\n        this.onPointerDownOutside = (e) => {\r\n            if (!this._shown) {\r\n                return;\r\n            }\r\n            const target = e.composedPath()[0];\r\n            if (!target.closest(\"#context-menu\")) {\r\n                this.hide();\r\n            }\r\n        };\r\n        this._container = document.createElement(\"div\");\r\n        this._container.id = \"context-menu\";\r\n        this.hide();\r\n        document.addEventListener(\"pointerdown\", this.onPointerDownOutside);\r\n    }\r\n    set content(value) {\r\n        var _a;\r\n        (_a = this._content) === null || _a === void 0 ? void 0 : _a.forEach(x => x.remove());\r\n        if (value === null || value === void 0 ? void 0 : value.length) {\r\n            value.forEach(x => this._container.append(x));\r\n            this._content = value;\r\n        }\r\n        else {\r\n            this._content = null;\r\n        }\r\n    }\r\n    get enabled() {\r\n        return this._enabled;\r\n    }\r\n    set enabled(value) {\r\n        this._enabled = !!value;\r\n    }\r\n    destroy() {\r\n        this.clear();\r\n        document.removeEventListener(\"pointerdown\", this.onPointerDownOutside);\r\n    }\r\n    show(pointerPosition, parent) {\r\n        parent.append(this._container);\r\n        this._shown = true;\r\n        setTimeout(() => {\r\n            this.setContextMenuPosition(pointerPosition, parent);\r\n            this._container.style.opacity = \"1\";\r\n        }, 0);\r\n    }\r\n    hide() {\r\n        this._container.style.opacity = \"0\";\r\n        this._container.remove();\r\n        this._shown = false;\r\n    }\r\n    clear() {\r\n        this.hide();\r\n        this.content = null;\r\n    }\r\n    setContextMenuPosition(pointerPosition, parent) {\r\n        const menuDimension = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(this._container.offsetWidth, this._container.offsetHeight);\r\n        const menuPosition = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2();\r\n        const parentRect = parent.getBoundingClientRect();\r\n        const relPointerPosition = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(pointerPosition.x - parentRect.x, pointerPosition.y - parentRect.y);\r\n        if (relPointerPosition.x + menuDimension.x > parentRect.width + parentRect.x) {\r\n            menuPosition.x = relPointerPosition.x - menuDimension.x;\r\n        }\r\n        else {\r\n            menuPosition.x = relPointerPosition.x;\r\n        }\r\n        if (relPointerPosition.y + menuDimension.y > parentRect.height + parentRect.y) {\r\n            menuPosition.y = relPointerPosition.y - menuDimension.y;\r\n        }\r\n        else {\r\n            menuPosition.y = relPointerPosition.y;\r\n        }\r\n        this._container.style.left = menuPosition.x + parent.scrollLeft + \"px\";\r\n        this._container.style.top = menuPosition.y + parent.scrollTop + \"px\";\r\n    }\r\n}\n\nclass SmoothPath {\r\n    constructor(options) {\r\n        this._paths = [];\r\n        this._positionBuffer = [];\r\n        this._bufferSize = (options === null || options === void 0 ? void 0 : options.bufferSize) || SmoothPath._defaultBufferSize;\r\n        this._id = options === null || options === void 0 ? void 0 : options.id;\r\n        this._uuid = options === null || options === void 0 ? void 0 : options.uuid;\r\n    }\r\n    get id() {\r\n        return this._id;\r\n    }\r\n    get uuid() {\r\n        return this._uuid;\r\n    }\r\n    get bufferSize() {\r\n        return this._bufferSize;\r\n    }\r\n    get paths() {\r\n        return this._paths.slice();\r\n    }\r\n    get pathCount() {\r\n        return this._paths.length;\r\n    }\r\n    endPath() {\r\n        if (this._currentPath && this._currentPath.positions.length > 1) {\r\n            this._paths.push(this._currentPath);\r\n        }\r\n        this._positionBuffer = null;\r\n        this._currentPath = null;\r\n        this._currentPathString = null;\r\n    }\r\n    addPosition(pos) {\r\n        this.appendPositionToBuffer(pos);\r\n        this.updateCurrentPath();\r\n    }\r\n    appendPositionToBuffer(pos) {\r\n        const buffer = this._positionBuffer;\r\n        buffer.push(pos);\r\n        this._positionBuffer = buffer\r\n            .slice(Math.max(0, buffer.length - this._bufferSize), buffer.length);\r\n    }\r\n    getAverageBufferPosition(offset) {\r\n        const len = this._positionBuffer.length;\r\n        if (len >= this._bufferSize) {\r\n            let totalX = 0;\r\n            let totalY = 0;\r\n            let pos;\r\n            let i;\r\n            let count = 0;\r\n            for (i = offset; i < len; i++) {\r\n                count++;\r\n                pos = this._positionBuffer[i];\r\n                totalX += pos.x;\r\n                totalY += pos.y;\r\n            }\r\n            return new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(totalX / count, totalY / count);\r\n        }\r\n        return null;\r\n    }\r\n    updateCurrentPath() {\r\n        let pos = this.getAverageBufferPosition(0);\r\n        if (!pos) {\r\n            return null;\r\n        }\r\n        this._currentPathString += \" L\" + pos.x + \" \" + pos.y;\r\n        this._currentPath.positions.push(pos);\r\n        let tmpPath = \"\";\r\n        for (let offset = 2; offset < this._positionBuffer.length; offset += 2) {\r\n            pos = this.getAverageBufferPosition(offset);\r\n            tmpPath += \" L\" + pos.x + \" \" + pos.y;\r\n        }\r\n        return tmpPath;\r\n    }\r\n}\r\nSmoothPath._defaultBufferSize = 8;\n\nclass CanvasSmoothPathEditor extends SmoothPath {\r\n    constructor(container, options) {\r\n        super(options);\r\n        this._strokeWidth = CanvasSmoothPathEditor._defaultStrokeWidth;\r\n        this._color = CanvasSmoothPathEditor._colors[0];\r\n        this._paths = [];\r\n        this.onContextMenu = (event) => {\r\n            if (this._contextMenu.enabled) {\r\n                event.preventDefault();\r\n                this._contextMenu.show(new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(event.clientX, event.clientY), this._container);\r\n            }\r\n        };\r\n        this.onPointerDown = (e) => {\r\n            if (!e.isPrimary || e.button === 2) {\r\n                return;\r\n            }\r\n            const { clientX: clX, clientY: clY } = e;\r\n            const [caX, caY] = this.convertClientCoordsToCanvas(clX, clY);\r\n            this.newPath(new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(caX, caY));\r\n            const target = e.target;\r\n            target.addEventListener(\"pointermove\", this.onPointerMove);\r\n            target.addEventListener(\"pointerup\", this.onPointerUp);\r\n            target.addEventListener(\"pointerout\", this.onPointerUp);\r\n            target.setPointerCapture(e.pointerId);\r\n        };\r\n        this.onPointerMove = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const { clientX: clX, clientY: clY } = e;\r\n            const [caX, caY] = this.convertClientCoordsToCanvas(clX, clY);\r\n            this.addPosition(new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(caX, caY));\r\n            this.refreshEditor();\r\n        };\r\n        this.onPointerUp = (e) => {\r\n            if (!e.isPrimary) {\r\n                return;\r\n            }\r\n            const target = e.target;\r\n            target.removeEventListener(\"pointermove\", this.onPointerMove);\r\n            target.removeEventListener(\"pointerup\", this.onPointerUp);\r\n            target.removeEventListener(\"pointerout\", this.onPointerUp);\r\n            target.releasePointerCapture(e.pointerId);\r\n            this.endPath();\r\n            this.refreshEditor();\r\n        };\r\n        if (!container) {\r\n            throw new Error(\"Container is not defined\");\r\n        }\r\n        if (!(options === null || options === void 0 ? void 0 : options.canvasWidth) || !options.canvasHeight) {\r\n            throw new Error(\"Canvas dimensions is not defined\");\r\n        }\r\n        this._container = container;\r\n        this._canvas = document.createElement(\"canvas\");\r\n        this._canvas.classList.add(\"abs-ratio-canvas\");\r\n        this._canvas.width = options.canvasWidth;\r\n        this._canvas.height = options.canvasHeight;\r\n        this._canvas.addEventListener(\"pointerdown\", this.onPointerDown);\r\n        this._contextMenu = new ContextMenu();\r\n        this.fillContextMenu();\r\n        this._container.append(this._canvas);\r\n        this._container.addEventListener(\"contextmenu\", this.onContextMenu);\r\n    }\r\n    get canvas() {\r\n        return this._canvas;\r\n    }\r\n    get ctx() {\r\n        return this._canvas.getContext(\"2d\");\r\n    }\r\n    get canvasSize() {\r\n        return [this._canvas.width, this._canvas.height];\r\n    }\r\n    set canvasSize(value) {\r\n        if (!value) {\r\n            return;\r\n        }\r\n        const [w, h] = value;\r\n        if (!w || !h) {\r\n            return;\r\n        }\r\n        if (w === this._canvas.width\r\n            && h === this._canvas.height) {\r\n            return;\r\n        }\r\n        this._canvas.width = w;\r\n        this._canvas.height = h;\r\n        this.refreshEditor();\r\n    }\r\n    get paths() {\r\n        return this._paths.slice();\r\n    }\r\n    destroy() {\r\n        this._canvas.remove();\r\n        this._container.removeEventListener(\"contextmenu\", this.onContextMenu);\r\n        this._contextMenu.destroy();\r\n    }\r\n    getImageData() {\r\n        this.refreshEditor();\r\n        const imgData = this.ctx.getImageData(0, 0, this._canvas.width, this._canvas.height).data;\r\n        return imgData;\r\n    }\r\n    newPath(startPosition) {\r\n        const pathString = \"M\" + startPosition.x + \" \" + startPosition.y;\r\n        const path2d = new Path2D(pathString);\r\n        this._positionBuffer = [startPosition];\r\n        this._currentPath = {\r\n            strokeWidth: this._strokeWidth,\r\n            color: this._color,\r\n            path: path2d,\r\n            positions: [new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(startPosition.x, startPosition.y)],\r\n        };\r\n        this._currentPathString = pathString;\r\n    }\r\n    removePath(path) {\r\n        if (!path) {\r\n            return;\r\n        }\r\n        this._paths = this._paths.filter(x => x.path !== path);\r\n        this.refreshEditor();\r\n    }\r\n    removeLastPath() {\r\n        this._paths.pop();\r\n        this.refreshEditor();\r\n    }\r\n    removeAllPaths() {\r\n        this._paths.length = 0;\r\n        this.refreshEditor();\r\n    }\r\n    updateCurrentPath() {\r\n        const tmpPath = super.updateCurrentPath();\r\n        if (tmpPath) {\r\n            this._currentPath.path = new Path2D(this._currentPathString + tmpPath);\r\n        }\r\n        return tmpPath;\r\n    }\r\n    refreshEditor() {\r\n        this.drawPaths();\r\n        this.fillContextMenu();\r\n    }\r\n    drawPaths() {\r\n        this.ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);\r\n        (this._currentPath\r\n            ? [...this._paths, this._currentPath]\r\n            : this._paths).forEach(x => {\r\n            const [r, g, b, a] = x.color;\r\n            this.ctx.strokeStyle = `rgba(${r * 255},${g * 255},${b * 255},${a})`;\r\n            this.ctx.lineWidth = x.strokeWidth;\r\n            this.ctx.lineCap = \"round\";\r\n            this.ctx.lineJoin = \"round\";\r\n            this.ctx.stroke(x.path);\r\n        });\r\n    }\r\n    convertClientCoordsToCanvas(clX, clY) {\r\n        const { top, left, width, height } = this._canvas.getBoundingClientRect();\r\n        const caHorRatio = width / this._canvas.width;\r\n        const caVertRatio = height / this._canvas.height;\r\n        const caX = (clX - left) / caHorRatio;\r\n        const caY = (clY - top) / caVertRatio;\r\n        return [caX, caY];\r\n    }\r\n    fillContextMenu() {\r\n        const cmContent = [\r\n            this.buildColorPicker(),\r\n            this.buildWidthSliderWithButtons(),\r\n        ];\r\n        this._contextMenu.content = cmContent;\r\n        this._contextMenu.enabled = true;\r\n    }\r\n    buildColorPicker() {\r\n        const colorPickerDiv = document.createElement(\"div\");\r\n        colorPickerDiv.classList.add(\"context-menu-content\", \"row\");\r\n        CanvasSmoothPathEditor._colors.forEach(x => {\r\n            const item = document.createElement(\"div\");\r\n            item.classList.add(\"panel-button\");\r\n            if (x === this._color) {\r\n                item.classList.add(\"on\");\r\n            }\r\n            item.addEventListener(\"click\", () => {\r\n                this._color = x;\r\n                this.fillContextMenu();\r\n            });\r\n            const colorIcon = document.createElement(\"div\");\r\n            colorIcon.classList.add(\"context-menu-color-icon\");\r\n            colorIcon.style.backgroundColor = `rgb(${x[0] * 255},${x[1] * 255},${x[2] * 255})`;\r\n            item.append(colorIcon);\r\n            colorPickerDiv.append(item);\r\n        });\r\n        return colorPickerDiv;\r\n    }\r\n    buildWidthSliderWithButtons() {\r\n        const div = document.createElement(\"div\");\r\n        div.classList.add(\"context-menu-content\", \"row\");\r\n        const undoButton = document.createElement(\"div\");\r\n        undoButton.classList.add(\"panel-button\");\r\n        if (!this.pathCount) {\r\n            undoButton.classList.add(\"disabled\");\r\n        }\r\n        else {\r\n            undoButton.addEventListener(\"click\", () => {\r\n                this.removeLastPath();\r\n            });\r\n        }\r\n        undoButton.innerHTML = `<img src=\"${Icons.icon_back}\"/>`;\r\n        div.append(undoButton);\r\n        const clearButton = document.createElement(\"div\");\r\n        clearButton.classList.add(\"panel-button\");\r\n        if (!this.pathCount) {\r\n            clearButton.classList.add(\"disabled\");\r\n        }\r\n        else {\r\n            clearButton.addEventListener(\"click\", () => {\r\n                this.removeAllPaths();\r\n            });\r\n        }\r\n        clearButton.innerHTML = `<img src=\"${Icons.icon_close}\"/>`;\r\n        div.append(clearButton);\r\n        const slider = document.createElement(\"input\");\r\n        slider.setAttribute(\"type\", \"range\");\r\n        slider.setAttribute(\"min\", \"1\");\r\n        slider.setAttribute(\"max\", \"32\");\r\n        slider.setAttribute(\"step\", \"1\");\r\n        slider.setAttribute(\"value\", this._strokeWidth + \"\");\r\n        slider.classList.add(\"context-menu-slider\");\r\n        slider.addEventListener(\"change\", () => {\r\n            this._strokeWidth = slider.valueAsNumber;\r\n        });\r\n        div.append(slider);\r\n        return div;\r\n    }\r\n}\r\nCanvasSmoothPathEditor._defaultStrokeWidth = 3;\r\nCanvasSmoothPathEditor._colors = [\r\n    [0, 0, 0, 1],\r\n    [0.804, 0, 0, 1],\r\n    [0, 0.804, 0, 1],\r\n    [0, 0, 0.804, 1],\r\n    [1, 0.5, 0, 1],\r\n    [1, 0.2, 1, 1],\r\n];\n\nvar __awaiter$1 = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nclass DomUtils {\r\n    static htmlToElements(html) {\r\n        const template = document.createElement(\"template\");\r\n        template.innerHTML = html;\r\n        const nodes = [];\r\n        template.content.childNodes.forEach(x => {\r\n            if (x instanceof HTMLElement) {\r\n                nodes.push(x);\r\n            }\r\n        });\r\n        return nodes;\r\n    }\r\n    static promisify(callback) {\r\n        return __awaiter$1(this, void 0, void 0, function* () {\r\n            return new Promise(resolve => {\r\n                setTimeout(() => {\r\n                    const result = callback();\r\n                    resolve(result);\r\n                }, 0);\r\n            });\r\n        });\r\n    }\r\n    static runEmptyTimeout() {\r\n        return __awaiter$1(this, void 0, void 0, function* () {\r\n            yield this.promisify(() => undefined);\r\n        });\r\n    }\r\n    static downloadFile(blob, name) {\r\n        const url = URL.createObjectURL(blob);\r\n        const link = document.createElement(\"a\");\r\n        link.setAttribute(\"download\", name);\r\n        link.href = url;\r\n        document.body.appendChild(link);\r\n        link.click();\r\n        link.remove();\r\n        setTimeout(() => URL.revokeObjectURL(url), 10000);\r\n    }\r\n    static loadImageAsync(url, revoke = false) {\r\n        return __awaiter$1(this, void 0, void 0, function* () {\r\n            const loadedImage = yield new Promise((resolve, reject) => {\r\n                const image = new Image();\r\n                image.onerror = (e, error) => {\r\n                    if (revoke) {\r\n                        URL.revokeObjectURL(url);\r\n                    }\r\n                    console.log(`Error while loading image: ${(error === null || error === void 0 ? void 0 : error.message) || e.toString()}`);\r\n                    resolve(null);\r\n                };\r\n                image.onload = () => {\r\n                    if (revoke) {\r\n                        URL.revokeObjectURL(url);\r\n                    }\r\n                    resolve(image);\r\n                };\r\n                image.src = url;\r\n            });\r\n            return loadedImage;\r\n        });\r\n    }\r\n    static loadFileDataAsync(src) {\r\n        return __awaiter$1(this, void 0, void 0, function* () {\r\n            let data;\r\n            if (src instanceof Uint8Array) {\r\n                data = src;\r\n            }\r\n            else {\r\n                let blob;\r\n                if (typeof src === \"string\") {\r\n                    const res = yield fetch(src);\r\n                    blob = yield res.blob();\r\n                }\r\n                else {\r\n                    blob = src;\r\n                }\r\n                const buffer = yield blob.arrayBuffer();\r\n                data = new Uint8Array(buffer);\r\n            }\r\n            return data;\r\n        });\r\n    }\r\n}\n\nclass Spinner {\r\n    constructor() {\r\n        this._spinnerElement = DomUtils.htmlToElements(Spinner.spinnerHtml)[0];\r\n    }\r\n    show(parent, zIndex = 8) {\r\n        if (this._isShown || !parent) {\r\n            return;\r\n        }\r\n        this._spinnerElement.style.zIndex = zIndex + \"\";\r\n        this._spinnerElement.style.top = parent.scrollTop + \"px\";\r\n        this._spinnerElement.style.left = parent.scrollLeft + \"px\";\r\n        parent.append(this._spinnerElement);\r\n        this._isShown = true;\r\n    }\r\n    hide() {\r\n        this._spinnerElement.remove();\r\n        this._isShown = false;\r\n    }\r\n}\r\nSpinner.spinnerHtml = `\r\n  <div class=\"abs-full-size-overlay\">\r\n    <div class=\"spinner\">\r\n      <div></div>\r\n      <div></div>\r\n      <div></div>\r\n    </div>\r\n  </div>\r\n  `;\n\nclass CloudCurveData {\r\n    static buildFromPolyline(polylinePoints, maxArcSize) {\r\n        if (!polylinePoints || polylinePoints.length < 2) {\r\n            return null;\r\n        }\r\n        if (isNaN(maxArcSize) || maxArcSize <= 0) {\r\n            throw new Error(`Invalid maximal arc size ${maxArcSize}`);\r\n        }\r\n        const start = polylinePoints[0].clone().truncate(2);\r\n        const curves = [];\r\n        const zeroVec = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2();\r\n        const lengthVec = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2();\r\n        let i;\r\n        let j;\r\n        let lineStart;\r\n        let lineEnd;\r\n        let lineLength;\r\n        let arcCount;\r\n        let arcSize;\r\n        let halfArcSize;\r\n        let arcStart;\r\n        let arcEnd;\r\n        for (i = 0; i < polylinePoints.length - 1; i++) {\r\n            lineStart = polylinePoints[i];\r\n            lineEnd = polylinePoints[i + 1];\r\n            lineLength = mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2.subtract(lineEnd, lineStart).getMagnitude();\r\n            if (!lineLength) {\r\n                continue;\r\n            }\r\n            lengthVec.set(lineLength, 0);\r\n            const matrix = mathador__WEBPACK_IMPORTED_MODULE_0__.Mat3.from4Vec2(zeroVec, lengthVec, lineStart, lineEnd);\r\n            arcCount = Math.ceil(lineLength / maxArcSize);\r\n            arcSize = lineLength / arcCount;\r\n            halfArcSize = arcSize / 2;\r\n            for (j = 0; j < arcCount; j++) {\r\n                arcStart = j * arcSize;\r\n                arcEnd = (j + 1) * arcSize;\r\n                const curve = [\r\n                    new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(arcStart, -halfArcSize).applyMat3(matrix).truncate(2),\r\n                    new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(arcEnd, -halfArcSize).applyMat3(matrix).truncate(2),\r\n                    new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(arcEnd, 0).applyMat3(matrix).truncate(2),\r\n                ];\r\n                curves.push(curve);\r\n            }\r\n        }\r\n        return {\r\n            start,\r\n            curves,\r\n        };\r\n    }\r\n    static buildFromEllipse(rx, ry, maxArcSize, matrix) {\r\n        matrix || (matrix = new mathador__WEBPACK_IMPORTED_MODULE_0__.Mat3());\r\n        const center = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2();\r\n        const ellipseCircumferenceApprox = Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));\r\n        const segmentsNumber = Math.ceil(ellipseCircumferenceApprox / maxArcSize / 4) * 4;\r\n        const maxSegmentLength = Math.ceil(ellipseCircumferenceApprox / segmentsNumber);\r\n        const points = [];\r\n        const current = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(center.x + rx, center.y);\r\n        const next = new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2();\r\n        let angle = 0;\r\n        let distance;\r\n        points.push(current.clone().applyMat3(matrix).truncate(2));\r\n        for (let i = 0; i < segmentsNumber; i++) {\r\n            distance = 0;\r\n            while (distance < maxSegmentLength) {\r\n                angle += 0.25 / 180 * Math.PI;\r\n                next.set(rx * Math.cos(angle) + center.x, ry * Math.sin(angle) + center.y);\r\n                distance += (0,mathador__WEBPACK_IMPORTED_MODULE_0__.getDistance2D)(current.x, current.y, next.x, next.y);\r\n                current.setFromVec2(next);\r\n            }\r\n            points.push(current.clone().applyMat3(matrix).truncate(2));\r\n        }\r\n        const curveData = this.buildFromPolyline(points, maxArcSize);\r\n        return curveData;\r\n    }\r\n}\n\nclass SvgSmoothPath extends SmoothPath {\r\n    constructor(options) {\r\n        super(options);\r\n        this._paths = [];\r\n        this._strokeWidth = (options === null || options === void 0 ? void 0 : options.strokeWidth) || SvgSmoothPath._defaultStrokeWidth;\r\n        this._color = (options === null || options === void 0 ? void 0 : options.color) || SvgSmoothPath._defaultColor;\r\n        this._group = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\r\n    }\r\n    get strokeWidth() {\r\n        return this._strokeWidth;\r\n    }\r\n    get color() {\r\n        return this._color;\r\n    }\r\n    get group() {\r\n        return this._group;\r\n    }\r\n    get paths() {\r\n        return this._paths.slice();\r\n    }\r\n    newPath(startPosition) {\r\n        const [r, g, b, a] = this._color || [0, 0, 0, 1];\r\n        const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n        path.setAttribute(\"fill\", \"none\");\r\n        path.setAttribute(\"stroke\", `rgba(${r * 255},${g * 255},${b * 255},${a})`);\r\n        path.setAttribute(\"stroke-width\", this._strokeWidth + \"\");\r\n        path.setAttribute(\"stroke-linecap\", \"round\");\r\n        path.setAttribute(\"stroke-linejoin\", \"round\");\r\n        const pathString = \"M\" + startPosition.x + \" \" + startPosition.y;\r\n        path.setAttribute(\"d\", pathString);\r\n        this._positionBuffer = [startPosition];\r\n        this._currentPath = { path, positions: [new mathador__WEBPACK_IMPORTED_MODULE_0__.Vec2(startPosition.x, startPosition.y)] };\r\n        this._currentPathString = pathString;\r\n        this._group.append(path);\r\n    }\r\n    removePath(path) {\r\n        if (!path) {\r\n            return;\r\n        }\r\n        path.remove();\r\n        this._paths = this._paths.filter(x => x.path !== path);\r\n    }\r\n    removeLastPath() {\r\n        const pathData = this._paths.pop();\r\n        pathData === null || pathData === void 0 ? void 0 : pathData.path.remove();\r\n    }\r\n    updateCurrentPath() {\r\n        const tmpPath = super.updateCurrentPath();\r\n        if (tmpPath) {\r\n            this._currentPath.path.setAttribute(\"d\", this._currentPathString + tmpPath);\r\n        }\r\n        return tmpPath;\r\n    }\r\n}\r\nSvgSmoothPath._defaultStrokeWidth = 3;\r\nSvgSmoothPath._defaultColor = [0, 0, 0, 0.8];\n\nclass SvgTempPath {\r\n    constructor() {\r\n        this._path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\r\n    }\r\n    get path() {\r\n        return this._path;\r\n    }\r\n    set(fill, stroke, w, points, close = false) {\r\n        let d = \"\";\r\n        if ((points === null || points === void 0 ? void 0 : points.length) > 1) {\r\n            d += `M${points[0].x},${points[0].y} `;\r\n            for (let i = 1; i < points.length; i++) {\r\n                d += `L${points[i].x},${points[i].y} `;\r\n            }\r\n            if (close) {\r\n                d += \"Z\";\r\n            }\r\n        }\r\n        this._path.classList.add(\"annotation-temp-copy\");\r\n        this._path.setAttribute(\"d\", d);\r\n        this._path.style.fill = fill;\r\n        this._path.style.stroke = stroke;\r\n        this._path.style.strokeWidth = w + \"\";\r\n    }\r\n    insertAfter(element) {\r\n        element.after(this._path);\r\n    }\r\n    remove() {\r\n        this._path.setAttribute(\"d\", \"\");\r\n        this._path.remove();\r\n    }\r\n}\n\nclass EventService {\r\n    constructor(container) {\r\n        this._eventMap = new Map();\r\n        if (!container) {\r\n            throw new Error(\"Container is not defined\");\r\n        }\r\n        const element = document.createElement(\"div\");\r\n        element.style.position = \"absolute\";\r\n        element.style.width = \"0\";\r\n        element.style.height = \"0\";\r\n        element.style.zIndex = \"-1000\";\r\n        container.append(element);\r\n        this._element = element;\r\n    }\r\n    get element() {\r\n        return this._element;\r\n    }\r\n    destroy() {\r\n        this.removeAllListeners();\r\n        this._element.remove();\r\n        this._element = null;\r\n    }\r\n    addListener(key, listener, options) {\r\n        if (!this._element) {\r\n            return;\r\n        }\r\n        this._element.addEventListener(key, listener, options);\r\n        if (this._eventMap.has(key)) {\r\n            this._eventMap.get(key).add(listener);\r\n        }\r\n        else {\r\n            this._eventMap.set(key, new Set().add(listener));\r\n        }\r\n    }\r\n    removeListener(key, listener) {\r\n        if (!this._element) {\r\n            return;\r\n        }\r\n        this._element.removeEventListener(key, listener);\r\n        if (this._eventMap.has(key)) {\r\n            this._eventMap.get(key).delete(listener);\r\n        }\r\n    }\r\n    removeAllListenersForKey(key) {\r\n        if (!this._element) {\r\n            return;\r\n        }\r\n        if (this._eventMap.has(key)) {\r\n            const listeners = this._eventMap.get(key);\r\n            listeners.forEach(x => this._element.removeEventListener(key, x));\r\n            this._eventMap.delete(key);\r\n        }\r\n    }\r\n    removeAllListeners() {\r\n        if (!this._element) {\r\n            return;\r\n        }\r\n        this._eventMap.forEach((v, k) => {\r\n            v.forEach(x => this._element.removeEventListener(k, x));\r\n        });\r\n        this._eventMap.clear();\r\n    }\r\n    getListenersByKey(key) {\r\n        const listenerSet = this._eventMap.get(key);\r\n        return listenerSet\r\n            ? [...listenerSet]\r\n            : [];\r\n    }\r\n    hasListenersForKey(key) {\r\n        const listenerSet = this._eventMap.get(key);\r\n        return !!(listenerSet === null || listenerSet === void 0 ? void 0 : listenerSet.size);\r\n    }\r\n    dispatchEvent(e) {\r\n        if (!this._element) {\r\n            return;\r\n        }\r\n        if (!this.hasListenersForKey(e.type)) {\r\n            return;\r\n        }\r\n        this._element.dispatchEvent(e);\r\n    }\r\n}\n\nclass LinkedListNode {\r\n    constructor(data) {\r\n        this.data = data;\r\n    }\r\n}\r\nclass LinkedList {\r\n    constructor(head) {\r\n        this._length = 0;\r\n        if (head) {\r\n            this.push(head);\r\n        }\r\n    }\r\n    get head() {\r\n        return this._head.data;\r\n    }\r\n    get length() {\r\n        return this._length;\r\n    }\r\n    get tail() {\r\n        return this.get(this._length - 1);\r\n    }\r\n    push(value) {\r\n        const node = new LinkedListNode(value);\r\n        let current;\r\n        if (!this._head) {\r\n            this._head = node;\r\n        }\r\n        else {\r\n            current = this._head;\r\n            while (current.next) {\r\n                current = current.next;\r\n            }\r\n            current.next = node;\r\n        }\r\n        this._length++;\r\n    }\r\n    insert(value, n) {\r\n        if (n < 0 || n > this._length - 1) {\r\n            return null;\r\n        }\r\n        const node = new LinkedListNode(value);\r\n        let previous;\r\n        let current = this._head;\r\n        let i = 0;\r\n        if (!n) {\r\n            this._head = node;\r\n        }\r\n        else {\r\n            while (i++ < n) {\r\n                previous = current;\r\n                current = current.next;\r\n            }\r\n            previous.next = node;\r\n        }\r\n        node.next = current;\r\n        this._length++;\r\n        return node.data;\r\n    }\r\n    replace(value, n) {\r\n        if (n < 0 || n > this._length - 1) {\r\n            return null;\r\n        }\r\n        const node = new LinkedListNode(value);\r\n        let previous;\r\n        let current = this._head;\r\n        let i = 0;\r\n        if (!n) {\r\n            this._head = node;\r\n        }\r\n        else {\r\n            while (i++ < n) {\r\n                previous = current;\r\n                current = current.next;\r\n            }\r\n            previous.next = node;\r\n        }\r\n        node.next = current.next;\r\n        return current.data;\r\n    }\r\n    remove(n) {\r\n        if (n < 0 || n > this._length - 1) {\r\n            return null;\r\n        }\r\n        let previous;\r\n        let current = this._head;\r\n        let i = 0;\r\n        if (!n) {\r\n            this._head = current.next;\r\n        }\r\n        else {\r\n            while (i++ < n) {\r\n                previous = current;\r\n                current = current.next;\r\n            }\r\n            previous.next = current.next;\r\n        }\r\n        this._length--;\r\n        return current.data;\r\n    }\r\n    clear() {\r\n        this._head = null;\r\n        this._length = 0;\r\n    }\r\n    get(n) {\r\n        if (n < 0 || n > this._length - 1) {\r\n            return null;\r\n        }\r\n        let current = this._head;\r\n        let i = 0;\r\n        while (i++ < n) {\r\n            current = current.next;\r\n        }\r\n        return current.data;\r\n    }\r\n    pop() {\r\n        return this.remove(this._length - 1);\r\n    }\r\n    has(value, comparator) {\r\n        if (!this._length) {\r\n            return false;\r\n        }\r\n        comparator || (comparator = (a, b) => a === b);\r\n        let current = this._head;\r\n        let i = 0;\r\n        while (i < this._length) {\r\n            if (comparator(value, current.data)) {\r\n                return true;\r\n            }\r\n            current = current.next;\r\n            i++;\r\n        }\r\n        return false;\r\n    }\r\n    findIndex(value, comparator) {\r\n        if (!this._length) {\r\n            return -1;\r\n        }\r\n        comparator || (comparator = (a, b) => a === b);\r\n        let current = this._head;\r\n        let i = 0;\r\n        while (i < this._length) {\r\n            if (comparator(value, current.data)) {\r\n                return i;\r\n            }\r\n            current = current.next;\r\n            i++;\r\n        }\r\n        return -1;\r\n    }\r\n    *[Symbol.iterator]() {\r\n        let current = this._head;\r\n        while (current) {\r\n            yield current.data;\r\n            current = current.next;\r\n        }\r\n    }\r\n}\n\nclass UUID {\r\n    static getRandomUuid() {\r\n        return (0,uuid__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\r\n    }\r\n}\n\nvar __awaiter = ( false) || function (thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n};\r\nconst stampImageLoaderHtml = `\r\n  <div class=\"abs-full-size-overlay stamp-dialog\">\r\n    <div class=\"form\">\r\n      <div class=\"form-canvas-wrapper\">\r\n        <canvas class=\"abs-ratio-canvas\"></canvas>\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Stamp name:</p>\r\n        <input class=\"stamp-name-input\" type=\"text\" maxlength=\"128\"/>\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Stamp description:</p>\r\n        <input class=\"stamp-subject-input\" type=\"text\" maxlength=\"256\"/>\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Width:</p>\r\n        <input class=\"stamp-width-input\" type=\"text\" maxlength=\"4\"/>\r\n        <p>Height:</p>\r\n        <input class=\"stamp-height-input\" type=\"text\" maxlength=\"4\"/>\r\n      </div>\r\n      <div class=\"buttons\">\r\n        <div class=\"panel-button stamp-ok\">\r\n          <img src=\"${Icons.icon_ok}\"/>\r\n        </div>\r\n        <div class=\"panel-button stamp-cancel\">\r\n          <img src=\"${Icons.icon_close}\"/>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  </div>\r\n`;\r\nconst stampDesignerHtml = `\r\n  <div class=\"abs-full-size-overlay stamp-dialog\">\r\n    <div class=\"form\">\r\n      <div class=\"form-canvas-wrapper\">\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Stamp name:</p>\r\n        <input class=\"stamp-name-input\" type=\"text\" maxlength=\"128\"/>\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Stamp description:</p>\r\n        <input class=\"stamp-subject-input\" type=\"text\" maxlength=\"256\"/>\r\n      </div>\r\n      <div class=\"stamp-input-row\">\r\n        <p>Width:</p>\r\n        <input class=\"stamp-width-input\" type=\"text\" maxlength=\"4\"/>\r\n        <p>Height:</p>\r\n        <input class=\"stamp-height-input\" type=\"text\" maxlength=\"4\"/>\r\n      </div>\r\n      <div class=\"buttons\">\r\n        <div class=\"panel-button stamp-ok\">\r\n          <img src=\"${Icons.icon_ok}\"/>\r\n        </div>\r\n        <div class=\"panel-button stamp-cancel\">\r\n          <img src=\"${Icons.icon_close}\"/>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  </div>\r\n`;\r\nconst customStampEvent = \"tsviewer-customstampchange\";\r\nclass CustomStampEvent extends CustomEvent {\r\n    constructor(detail) {\r\n        super(customStampEvent, { detail });\r\n    }\r\n}\r\nclass CustomStampService {\r\n    constructor(container, eventService) {\r\n        this._customStampsByType = new Map();\r\n        this._spinner = new Spinner();\r\n        this.onFileInput = () => {\r\n            const files = this._fileInput.files;\r\n            if (files.length === 0) {\r\n                return;\r\n            }\r\n            this.openImageLoaderOverlayAsync(files[0]);\r\n            this._fileInput.value = null;\r\n        };\r\n        if (!container) {\r\n            throw new Error(\"Container is not defined\");\r\n        }\r\n        if (!eventService) {\r\n            throw new Error(\"Event service is not defined\");\r\n        }\r\n        this._container = container;\r\n        this._eventService = eventService;\r\n        const fileInput = document.createElement(\"input\");\r\n        fileInput.type = \"file\";\r\n        fileInput.accept = \"image/*\";\r\n        fileInput.classList.add(\"abs-hidden\");\r\n        this._fileInput = fileInput;\r\n        this._fileInput.addEventListener(\"change\", this.onFileInput);\r\n        this._container.append(this._fileInput);\r\n    }\r\n    destroy() {\r\n        var _a;\r\n        this._fileInput.remove();\r\n        this._spinner.hide();\r\n        (_a = this._overlay) === null || _a === void 0 ? void 0 : _a.remove();\r\n    }\r\n    importCustomStamps(stamps) {\r\n        if (stamps === null || stamps === void 0 ? void 0 : stamps.length) {\r\n            stamps.forEach(x => {\r\n                this._customStampsByType.set(x.type, x);\r\n            });\r\n        }\r\n    }\r\n    getCustomStamps() {\r\n        return [...this._customStampsByType.values()];\r\n    }\r\n    addCustomStamp(stamp) {\r\n        this._customStampsByType.set(stamp.type, stamp);\r\n        this._eventService.dispatchEvent(new CustomStampEvent({\r\n            type: \"add\",\r\n            stamp: stamp,\r\n        }));\r\n    }\r\n    removeCustomStamp(type) {\r\n        const stamp = this._customStampsByType.get(type);\r\n        if (!stamp) {\r\n            return;\r\n        }\r\n        this._customStampsByType.delete(type);\r\n        this._eventService.dispatchEvent(new CustomStampEvent({\r\n            type: \"delete\",\r\n            stamp: stamp,\r\n        }));\r\n    }\r\n    startLoadingImage() {\r\n        this._fileInput.click();\r\n    }\r\n    startDrawing() {\r\n        this.openDesignerOverlayAsync();\r\n    }\r\n    openImageLoaderOverlayAsync(file) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            this._spinner.show(this._container, 10);\r\n            const imagePromise = new Promise((resolve, reject) => {\r\n                const url = URL.createObjectURL(file);\r\n                const img = new Image();\r\n                img.onload = () => {\r\n                    URL.revokeObjectURL(url);\r\n                    resolve(img);\r\n                };\r\n                img.onerror = (e) => {\r\n                    console.log(e);\r\n                    reject();\r\n                };\r\n                img.src = url;\r\n            });\r\n            let image;\r\n            try {\r\n                image = yield imagePromise;\r\n            }\r\n            catch (_a) {\r\n                this._spinner.hide();\r\n                return;\r\n            }\r\n            const imageWidth = image.width;\r\n            const imageHeight = image.height;\r\n            const imageRatio = image.width / image.height;\r\n            const overlay = DomUtils.htmlToElements(stampImageLoaderHtml)[0];\r\n            const canvas = overlay.querySelector(\"canvas\");\r\n            const cancelButton = overlay.querySelector(\".stamp-cancel\");\r\n            const okButton = overlay.querySelector(\".stamp-ok\");\r\n            const nameInput = overlay.querySelector(\".stamp-name-input\");\r\n            const subjectInput = overlay.querySelector(\".stamp-subject-input\");\r\n            const widthInput = overlay.querySelector(\".stamp-width-input\");\r\n            const heightInput = overlay.querySelector(\".stamp-height-input\");\r\n            let stampName = \"Custom stamp\";\r\n            let stampSubject = \"image stamp\";\r\n            let stampWidth = 64;\r\n            let stampHeight = +(64 / imageRatio).toFixed();\r\n            nameInput.value = stampName;\r\n            widthInput.value = stampWidth + \"\";\r\n            heightInput.value = stampHeight + \"\";\r\n            this._overlay = overlay;\r\n            this._container.append(overlay);\r\n            canvas.width = imageWidth;\r\n            canvas.height = imageHeight;\r\n            const ctx = canvas.getContext(\"2d\");\r\n            ctx.drawImage(image, 0, 0);\r\n            const imgData = ctx.getImageData(0, 0, image.width, image.height).data;\r\n            const validate = () => {\r\n                if (!stampName\r\n                    || (!stampHeight || isNaN(stampHeight))\r\n                    || (!stampWidth || isNaN(stampWidth))) {\r\n                    okButton.classList.add(\"disabled\");\r\n                }\r\n                else {\r\n                    okButton.classList.remove(\"disabled\");\r\n                }\r\n            };\r\n            nameInput.addEventListener(\"input\", () => {\r\n                stampName = nameInput.value;\r\n                validate();\r\n            });\r\n            subjectInput.addEventListener(\"input\", () => {\r\n                stampSubject = subjectInput.value;\r\n                validate();\r\n            });\r\n            widthInput.addEventListener(\"input\", () => {\r\n                var _a;\r\n                stampWidth = +((_a = (+widthInput.value)) === null || _a === void 0 ? void 0 : _a.toFixed());\r\n                validate();\r\n            });\r\n            heightInput.addEventListener(\"input\", () => {\r\n                var _a;\r\n                stampHeight = +((_a = (+heightInput.value)) === null || _a === void 0 ? void 0 : _a.toFixed());\r\n                validate();\r\n            });\r\n            const hide = () => {\r\n                overlay.remove();\r\n                this._overlay = null;\r\n            };\r\n            cancelButton.addEventListener(\"click\", hide);\r\n            okButton.addEventListener(\"click\", () => {\r\n                const imageDataArray = new Array(imgData.length);\r\n                for (let i = 0; i < imgData.length; i++) {\r\n                    imageDataArray[i] = imgData[i];\r\n                }\r\n                const stamp = {\r\n                    type: \"/\" + UUID.getRandomUuid(),\r\n                    name: stampName,\r\n                    subject: stampSubject,\r\n                    rect: [0, 0, stampWidth, stampHeight],\r\n                    bbox: [0, 0, imageWidth, imageHeight],\r\n                    imageData: imageDataArray,\r\n                };\r\n                this.addCustomStamp(stamp);\r\n                hide();\r\n            });\r\n            this._spinner.hide();\r\n        });\r\n    }\r\n    openDesignerOverlayAsync() {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            this._spinner.show(this._container, 10);\r\n            const overlay = DomUtils.htmlToElements(stampDesignerHtml)[0];\r\n            const canvasContainer = overlay.querySelector(\".form-canvas-wrapper\");\r\n            const cancelButton = overlay.querySelector(\".stamp-cancel\");\r\n            const okButton = overlay.querySelector(\".stamp-ok\");\r\n            const nameInput = overlay.querySelector(\".stamp-name-input\");\r\n            const subjectInput = overlay.querySelector(\".stamp-subject-input\");\r\n            const widthInput = overlay.querySelector(\".stamp-width-input\");\r\n            const heightInput = overlay.querySelector(\".stamp-height-input\");\r\n            let stampName = \"Custom stamp\";\r\n            let stampSubject = \"drawing stamp\";\r\n            let stampWidth = 64;\r\n            let stampHeight = 64;\r\n            nameInput.value = stampName;\r\n            widthInput.value = stampWidth + \"\";\r\n            heightInput.value = stampHeight + \"\";\r\n            const editor = new CanvasSmoothPathEditor(canvasContainer, {\r\n                canvasWidth: stampWidth,\r\n                canvasHeight: stampHeight,\r\n            });\r\n            this._overlay = overlay;\r\n            this._container.append(overlay);\r\n            const updateCanvasSize = () => {\r\n                editor.canvasSize = [stampWidth, stampHeight];\r\n            };\r\n            const validate = () => {\r\n                if (!stampName\r\n                    || (!stampHeight || isNaN(stampHeight))\r\n                    || (!stampWidth || isNaN(stampWidth))) {\r\n                    okButton.classList.add(\"disabled\");\r\n                }\r\n                else {\r\n                    updateCanvasSize();\r\n                    okButton.classList.remove(\"disabled\");\r\n                }\r\n            };\r\n            nameInput.addEventListener(\"input\", () => {\r\n                stampName = nameInput.value;\r\n                validate();\r\n            });\r\n            subjectInput.addEventListener(\"input\", () => {\r\n                stampSubject = subjectInput.value;\r\n                validate();\r\n            });\r\n            widthInput.addEventListener(\"input\", () => {\r\n                var _a;\r\n                stampWidth = +((_a = (+widthInput.value)) === null || _a === void 0 ? void 0 : _a.toFixed());\r\n                validate();\r\n            });\r\n            heightInput.addEventListener(\"input\", () => {\r\n                var _a;\r\n                stampHeight = +((_a = (+heightInput.value)) === null || _a === void 0 ? void 0 : _a.toFixed());\r\n                validate();\r\n            });\r\n            const hide = () => {\r\n                overlay.remove();\r\n                this._overlay = null;\r\n            };\r\n            cancelButton.addEventListener(\"click\", hide);\r\n            okButton.addEventListener(\"click\", () => {\r\n                const imgData = editor.getImageData();\r\n                const imageDataArray = new Array(imgData.length);\r\n                for (let i = 0; i < imgData.length; i++) {\r\n                    imageDataArray[i] = imgData[i];\r\n                }\r\n                const stamp = {\r\n                    type: \"/\" + UUID.getRandomUuid(),\r\n                    name: stampName,\r\n                    subject: stampSubject,\r\n                    rect: [0, 0, stampWidth, stampHeight],\r\n                    bbox: [0, 0, stampWidth, stampHeight],\r\n                    imageData: imageDataArray,\r\n                };\r\n                this.addCustomStamp(stamp);\r\n                hide();\r\n            });\r\n            this._spinner.hide();\r\n        });\r\n    }\r\n}\n\nclass HtmlTemplates {\r\n}\r\nHtmlTemplates.textDialogHtml = `\r\n    <div class=\"abs-full-size-overlay text-dialog\">\r\n      <div class=\"form\">\r\n        <textarea class=\"text-input\" maxlength=\"1024\"></textarea>\r\n        <div class=\"buttons\">\r\n          <div class=\"panel-button text-ok\">\r\n            <img src=\"${Icons.icon_ok}\"/>\r\n          </div>\r\n          <div class=\"panel-button text-cancel\">\r\n            <img src=\"${Icons.icon_close}\"/>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n  `;\r\nHtmlTemplates.stampContextButtonsHtml = `\r\n    <div class=\"context-menu-content row\">\r\n      <div class=\"panel-button stamp-load-image\">\r\n        <img src=\"${Icons.icon_load}\"/>\r\n      </div>\r\n      <div class=\"panel-button stamp-draw-image\">\r\n        <img src=\"${Icons.icon_pen}\"/>\r\n      </div>\r\n      <div class=\"panel-button stamp-delete disabled\">\r\n        <img src=\"${Icons.icon_delete}\"/>\r\n      </div>\r\n    </div>\r\n  `;\n\nvar img$2 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABwCAYAAAD8HIl9AAABbmlDQ1BpY2MAACiRdZE7SwNBFIW/JEqCRiy0kGCxRRSLCEFRLCWCadQiiWDUJtm8hDyW3Q0SbAUbC8FCtPFV+A+0FWwVBEERRGz8A74akfVOIkTEzDJ7P87MucycAfdMUS9ZbWEolW0zFo1oC8lFzfuMlwA+xphI6ZYxG59O0HJ83OJS9WZY9Wq979/RmclaOrh8wuO6YdrCk8Izq7aheFO4Vy+kMsIHwiFTDih8qfR0g58U5xv8pthMxKbArXpq+V+c/sV6wSwJDwkHS8Wq/nMedRN/tjwflxqQ2Y9FjCgRNNJUWaGIzbDUsmT2vy9c981REY8uf4MapjjyFMQbErUqXbNSc6Jn5StSU7n/zdPKjY40uvsj0P7oOK8D4N2Gry3H+Tx0nK8j8DzAebnpr0hOE++ibzW14D50r8PpRVNL78DZBvTdGykzVZc8Mt25HLycQFcSeq6hY6mR1c86x3eQWJMnuoLdPRiU/d3L32vcaDwWMYLbAAAACXBIWXMAAAsSAAALEgHS3X78AAACGElEQVR42u3ZQWrCQABA0VRFcKu30FvoVhAELxlXgjtRPIE38AQiuFJwY2khxVJTU1sdO3lvJQ1xsPOZmehLmqanBP5Yxb8AYSEshAXCQlgIC4SFsBAWCAthISwQFsJCWCAshIWwQFgIC2GBsBAWwgJhISyEBcJCWAgLhIWwEBYIC2EhLBAWwkJYICyEhbBAWAgLYYGwCKkW44cajUYfr8fj8Y/vy7un2+0mrVbr4vV2u510Op27jCusJwqqyKSdX7t276Xr18Y9Ho/JZDK5+X1thU8aVYh79/v9x+t6vX63ca1YDzAYDHK3oF6vlzSbzfdJvLbV5F3PW/W+23Kza78Z14oVWLYyXJqg+Xxe6D1+M/mXrhWNJcaoPBUWnNzlcnmXbTrWqEoTVjaBt55pNpvNl7/1+/3SrkalOGMNh8Mgh+FGo2Gpj3nFqlarZtGKFfashBWrsNVqFWTc7XarnpjDWq/XhZ/M/vIMtlgsbn4aFFYkQv8WV8YtuhJjQJ8OkbVakHHLvFpFc3g//zE3b0J3u12Qccv6QBHNinVtAmez2cPHLfNT6kuapqeYPtDbF5fn34o/cnKzVetwOCTT6bTUW2F0YWErRFggLISFsEBYCAthgbAQFsICYSEshAXCQlgIC4SFsBAWCAthISwQFsJCWCAshIWwQFgIC2GBsBAWwgJhISyEBcJCWAgLhIWwEBYIC2Hxv7wC1uyhFqqhxsMAAAAASUVORK5CYII=\";\n\nvar img$1 = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABwCAYAAAD8HIl9AAAAAXNSR0IArs4c6QAAA1lJREFUeF7t2EGOIWEAhuGycQsX4DrtkmwkLmHlBlYuISxmQqJT86fKT/PpknlmNdP0p/r1zE8bLRaLP40/Cry4wAisFxc1dykAFgiRAmBFshoFi4FIAbAiWY2CxUCkAFiRrEbBYiBSAKxIVqNgMRApAFYkq1GwGIgUACuS1ShYDEQKgBXJahQsBiIFwIpkNQoWA5ECYEWyGgWLgUgBsCJZjYLFQKQAWJGsRsFiIFIArEhWo2AxECkAViSrUbAYiBQAK5LVKFgMRAqAFclqFCwGIgXAimQ1ChYDkQJgRbIaBYuBSAGwIlmNgsVApABYkaxGwWIgUgCsSFajYDEQKQBWJKtRsBiIFAArktUoWAxECoAVyWoULAYiBcCKZDUKVoeB+Xx++epyuXy7kPNj/8bjvvoH/S9h1Z688+3r9bo5HA6v7l3dq11bdWAgdwCr58T6rVMDrIH8z7j1stV3W+3J67r92ZfH8/efTqdmtVr9U246nTaz2ez75a92bQPJXr2Mjz2xrk90+ydsnzLl7dfb2l/vOpW6bu/bOj92CaH97+vf77mW63s6sKpms3eoPaGbzabZ7/eXiyhPm9qTV+LY7XbNdru9bH19fTWj0aj3hCm/t/wloAvetdSzp2K2+GPrH31ilSdU+1QqT6NbT2iZrHbfGo7ydLz3OsF6DG/k3rUTayiwHr2O2mkaiRkYdWJVfivseyPfdzo+c9p1vWcLPOdvmQRrQLC8FL7F/O0Hqb0Utt80P/vm/ZGtZ04ssAYOq/2b4PVSuz6K6PsQtAvtvR9rlAhvvccqr/N8X++xBoBrSJcwHo+b4/H4o0uaTCbfH438aGCA3/Sx77EG2NIltQqAhUOkAFiRrEbBYiBSAKxIVqNgMRApAFYkq1GwGIgUACuS1ShYDEQKgBXJahQsBiIFwIpkNQoWA5ECYEWyGgWLgUgBsCJZjYLFQKQAWJGsRsFiIFIArEhWo2AxECkAViSrUbAYiBQAK5LVKFgMRAqAFclqFCwGIgXAimQ1ChYDkQJgRbIaBYuBSAGwIlmNgsVApABYkaxGwWIgUgCsSFajYDEQKQBWJKtRsBiIFAArktUoWAxECoAVyWoULAYiBcCKZDUKFgORAmBFshoFi4FIAbAiWY3+BSYEzz/XQrcyAAAAAElFTkSuQmCC\";\n\nvar img = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAABwCAYAAAD8HIl9AAAAAXNSR0IArs4c6QAAA6JJREFUeF7t179O6mAAxuEPEx2dZfB6HI2DN6kmjuxegbujg7q7mchJST5SK9AWefHPeVxOxPYFfzyn1MnV1dW8+FJgxwUmYO24qLlFAbBAiBQAK5LVKFgMRAqAFclqFCwGIgXAimQ1ChYDkQJgRbIaBYuBSAGwIlmNgsVApABYkaxGwWIgUgCsSFajYDEQKQBWJKtRsBiIFAArktUoWAxECoAVyWoULAYiBcCKZDUKFgORAmBFshoFi4FIAbAiWY2CxUCkAFiRrEbBYiBSAKxIVqNgMRApAFYkq1GwGIgUACuS1ShYDEQKgBXJahQsBiIFwIpkNQoWA5ECYEWyGgWLgUgBsCJZjYLFQKQAWJGsRsFiIFIArEhWo2AxECkAViSrUbAYiBQAK5LVKFgMRAqAFcm6evTy8rJcX1+PesZtzhn1BKGDwQqFXTW7DZJtztnjr7T2qX4drG7o+n373+a3bV8Zmp/Vr/r42J1N+0dHR+X8/HzxFN3nfXt7K4eHhx/egPZraH5wf39fHh4elsfU19scB9ae/ptsAtF+Y7vgmp81j81ms/L6+vrpDVsHp+/xursKbBtI33FDzt9T4p08zZ+7YtUqq2C1i/Vdsfp22vs3NzdlPp8vTmkev7u7Ky8vL2vxNsddXFyU29vbxTknJyfl+fl5eX5Fdnx8XM7Ozkbfl+1ExhdH/jys+maP/SgcA6t7Q74Odffq133vVn30+Sj8ovChp4+90nSvUvXjcuzO0OPbH3ljzulCXvf90E7ffdyvvmJtuskdctXo3kRvumJ89X7JPdZ3U+95/vZfeO/v7+Xg4GBxD9J3U7/qo7A+1twfTSaT5U77JXTxDfnZpr8821fMIVv1+B/+tnx6eb/uirVt4NPT0/L4+Nh7egU6nU7L09PT8vh93+s00OsfBL0v+gce8N/AGtp+HaB9wxr6en/qcWB13hmwdkMVrN10tNIpABYSkQJgRbIaBYuBSAGwIlmNgsVApABYkaxGwWIgUgCsSFajYDEQKQBWJKtRsBiIFAArktUoWAxECoAVyWoULAYiBcCKZDUKFgORAmBFshoFi4FIAbAiWY2CxUCkAFiRrEbBYiBSAKxIVqNgMRApAFYkq1GwGIgUACuS1ShYDEQKgBXJahQsBiIFwIpkNQoWA5ECYEWyGgWLgUgBsCJZjYLFQKQAWJGsRsFiIFIArEhWo2AxECkAViSrUbAYiBQAK5LVKFgMRAqAFclq9B++BPw/bBBNsgAAAABJRU5ErkJggg==\";\n\nclass Thumbs {\r\n}\r\nThumbs.thumb_error = img$2;\r\nThumbs.thumb_not_found = img$1;\r\nThumbs.thumb_unsupported = img;\n\n\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/ts-viewers-core/dist/ts-viewers-core.esm.js?");

/***/ }),

/***/ "./node_modules/uuid/dist/esm-browser/regex.js":
/*!*****************************************************!*\
  !*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
  \*****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/uuid/dist/esm-browser/regex.js?");

/***/ }),

/***/ "./node_modules/uuid/dist/esm-browser/rng.js":
/*!***************************************************!*\
  !*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
  \***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ rng)\n/* harmony export */ });\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nfunction rng() {\n  // lazy load so that environments that need to polyfill have a chance to do so\n  if (!getRandomValues) {\n    // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n    // find the complete implementation of crypto (msCrypto) on IE11.\n    getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n    if (!getRandomValues) {\n      throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n    }\n  }\n\n  return getRandomValues(rnds8);\n}\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/uuid/dist/esm-browser/rng.js?");

/***/ }),

/***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
/*!*********************************************************!*\
  !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n  byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n  var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n  // Note: Be careful editing this code!  It's been tuned for performance\n  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n  var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID.  If this throws, it's likely due to one\n  // of the following:\n  // - One or more input array values don't map to a hex octet (leading to\n  // \"undefined\" in the uuid)\n  // - Invalid input values for the RFC `version` or `variant` fields\n\n  if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n    throw TypeError('Stringified UUID is invalid');\n  }\n\n  return uuid;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/uuid/dist/esm-browser/stringify.js?");

/***/ }),

/***/ "./node_modules/uuid/dist/esm-browser/v4.js":
/*!**************************************************!*\
  !*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n\n\n\nfunction v4(options, buf, offset) {\n  options = options || {};\n  var rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n  rnds[6] = rnds[6] & 0x0f | 0x40;\n  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n  if (buf) {\n    offset = offset || 0;\n\n    for (var i = 0; i < 16; ++i) {\n      buf[offset + i] = rnds[i];\n    }\n\n    return buf;\n  }\n\n  return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(rnds);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/uuid/dist/esm-browser/v4.js?");

/***/ }),

/***/ "./node_modules/uuid/dist/esm-browser/validate.js":
/*!********************************************************!*\
  !*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
  \********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ \"./node_modules/uuid/dist/esm-browser/regex.js\");\n\n\nfunction validate(uuid) {\n  return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].test(uuid);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/uuid/dist/esm-browser/validate.js?");

/***/ }),

/***/ "?4a14":
/*!************************!*\
  !*** canvas (ignored) ***!
  \************************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/canvas_(ignored)?");

/***/ }),

/***/ "?fe90":
/*!********************!*\
  !*** fs (ignored) ***!
  \********************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/fs_(ignored)?");

/***/ }),

/***/ "?d446":
/*!**********************!*\
  !*** http (ignored) ***!
  \**********************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/http_(ignored)?");

/***/ }),

/***/ "?4c38":
/*!***********************!*\
  !*** https (ignored) ***!
  \***********************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/https_(ignored)?");

/***/ }),

/***/ "?9f5f":
/*!*********************!*\
  !*** url (ignored) ***!
  \*********************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/url_(ignored)?");

/***/ }),

/***/ "?afbb":
/*!**********************!*\
  !*** zlib (ignored) ***!
  \**********************/
/***/ (() => {

eval("/* (ignored) */\n\n//# sourceURL=webpack://django-universal-uploader-widget/zlib_(ignored)?");

/***/ }),

/***/ "./node_modules/@medv/finder/finder.js":
/*!*********************************************!*\
  !*** ./node_modules/@medv/finder/finder.js ***!
  \*********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"finder\": () => (/* binding */ finder)\n/* harmony export */ });\nvar Limit;\n(function (Limit) {\n    Limit[Limit[\"All\"] = 0] = \"All\";\n    Limit[Limit[\"Two\"] = 1] = \"Two\";\n    Limit[Limit[\"One\"] = 2] = \"One\";\n})(Limit || (Limit = {}));\nlet config;\nlet rootDocument;\nfunction finder(input, options) {\n    if (input.nodeType !== Node.ELEMENT_NODE) {\n        throw new Error(`Can't generate CSS selector for non-element node type.`);\n    }\n    if (\"html\" === input.tagName.toLowerCase()) {\n        return \"html\";\n    }\n    const defaults = {\n        root: document.body,\n        idName: (name) => true,\n        className: (name) => true,\n        tagName: (name) => true,\n        attr: (name, value) => false,\n        seedMinLength: 1,\n        optimizedMinLength: 2,\n        threshold: 1000,\n        maxNumberOfTries: 10000,\n    };\n    config = Object.assign(Object.assign({}, defaults), options);\n    rootDocument = findRootDocument(config.root, defaults);\n    let path = bottomUpSearch(input, Limit.All, () => bottomUpSearch(input, Limit.Two, () => bottomUpSearch(input, Limit.One)));\n    if (path) {\n        const optimized = sort(optimize(path, input));\n        if (optimized.length > 0) {\n            path = optimized[0];\n        }\n        return selector(path);\n    }\n    else {\n        throw new Error(`Selector was not found.`);\n    }\n}\nfunction findRootDocument(rootNode, defaults) {\n    if (rootNode.nodeType === Node.DOCUMENT_NODE) {\n        return rootNode;\n    }\n    if (rootNode === defaults.root) {\n        return rootNode.ownerDocument;\n    }\n    return rootNode;\n}\nfunction bottomUpSearch(input, limit, fallback) {\n    let path = null;\n    let stack = [];\n    let current = input;\n    let i = 0;\n    while (current && current !== config.root.parentElement) {\n        let level = maybe(id(current)) ||\n            maybe(...attr(current)) ||\n            maybe(...classNames(current)) ||\n            maybe(tagName(current)) || [any()];\n        const nth = index(current);\n        if (limit === Limit.All) {\n            if (nth) {\n                level = level.concat(level.filter(dispensableNth).map((node) => nthChild(node, nth)));\n            }\n        }\n        else if (limit === Limit.Two) {\n            level = level.slice(0, 1);\n            if (nth) {\n                level = level.concat(level.filter(dispensableNth).map((node) => nthChild(node, nth)));\n            }\n        }\n        else if (limit === Limit.One) {\n            const [node] = (level = level.slice(0, 1));\n            if (nth && dispensableNth(node)) {\n                level = [nthChild(node, nth)];\n            }\n        }\n        for (let node of level) {\n            node.level = i;\n        }\n        stack.push(level);\n        if (stack.length >= config.seedMinLength) {\n            path = findUniquePath(stack, fallback);\n            if (path) {\n                break;\n            }\n        }\n        current = current.parentElement;\n        i++;\n    }\n    if (!path) {\n        path = findUniquePath(stack, fallback);\n    }\n    return path;\n}\nfunction findUniquePath(stack, fallback) {\n    const paths = sort(combinations(stack));\n    if (paths.length > config.threshold) {\n        return fallback ? fallback() : null;\n    }\n    for (let candidate of paths) {\n        if (unique(candidate)) {\n            return candidate;\n        }\n    }\n    return null;\n}\nfunction selector(path) {\n    let node = path[0];\n    let query = node.name;\n    for (let i = 1; i < path.length; i++) {\n        const level = path[i].level || 0;\n        if (node.level === level - 1) {\n            query = `${path[i].name} > ${query}`;\n        }\n        else {\n            query = `${path[i].name} ${query}`;\n        }\n        node = path[i];\n    }\n    return query;\n}\nfunction penalty(path) {\n    return path.map((node) => node.penalty).reduce((acc, i) => acc + i, 0);\n}\nfunction unique(path) {\n    switch (rootDocument.querySelectorAll(selector(path)).length) {\n        case 0:\n            throw new Error(`Can't select any node with this selector: ${selector(path)}`);\n        case 1:\n            return true;\n        default:\n            return false;\n    }\n}\nfunction id(input) {\n    const elementId = input.getAttribute(\"id\");\n    if (elementId && config.idName(elementId)) {\n        return {\n            name: \"#\" + cssesc(elementId, { isIdentifier: true }),\n            penalty: 0,\n        };\n    }\n    return null;\n}\nfunction attr(input) {\n    const attrs = Array.from(input.attributes).filter((attr) => config.attr(attr.name, attr.value));\n    return attrs.map((attr) => ({\n        name: \"[\" +\n            cssesc(attr.name, { isIdentifier: true }) +\n            '=\"' +\n            cssesc(attr.value) +\n            '\"]',\n        penalty: 0.5,\n    }));\n}\nfunction classNames(input) {\n    const names = Array.from(input.classList).filter(config.className);\n    return names.map((name) => ({\n        name: \".\" + cssesc(name, { isIdentifier: true }),\n        penalty: 1,\n    }));\n}\nfunction tagName(input) {\n    const name = input.tagName.toLowerCase();\n    if (config.tagName(name)) {\n        return {\n            name,\n            penalty: 2,\n        };\n    }\n    return null;\n}\nfunction any() {\n    return {\n        name: \"*\",\n        penalty: 3,\n    };\n}\nfunction index(input) {\n    const parent = input.parentNode;\n    if (!parent) {\n        return null;\n    }\n    let child = parent.firstChild;\n    if (!child) {\n        return null;\n    }\n    let i = 0;\n    while (child) {\n        if (child.nodeType === Node.ELEMENT_NODE) {\n            i++;\n        }\n        if (child === input) {\n            break;\n        }\n        child = child.nextSibling;\n    }\n    return i;\n}\nfunction nthChild(node, i) {\n    return {\n        name: node.name + `:nth-child(${i})`,\n        penalty: node.penalty + 1,\n    };\n}\nfunction dispensableNth(node) {\n    return node.name !== \"html\" && !node.name.startsWith(\"#\");\n}\nfunction maybe(...level) {\n    const list = level.filter(notEmpty);\n    if (list.length > 0) {\n        return list;\n    }\n    return null;\n}\nfunction notEmpty(value) {\n    return value !== null && value !== undefined;\n}\nfunction* combinations(stack, path = []) {\n    if (stack.length > 0) {\n        for (let node of stack[0]) {\n            yield* combinations(stack.slice(1, stack.length), path.concat(node));\n        }\n    }\n    else {\n        yield path;\n    }\n}\nfunction sort(paths) {\n    return Array.from(paths).sort((a, b) => penalty(a) - penalty(b));\n}\nfunction* optimize(path, input, scope = {\n    counter: 0,\n    visited: new Map(),\n}) {\n    if (path.length > 2 && path.length > config.optimizedMinLength) {\n        for (let i = 1; i < path.length - 1; i++) {\n            if (scope.counter > config.maxNumberOfTries) {\n                return; // Okay At least I tried!\n            }\n            scope.counter += 1;\n            const newPath = [...path];\n            newPath.splice(i, 1);\n            const newPathKey = selector(newPath);\n            if (scope.visited.has(newPathKey)) {\n                return;\n            }\n            if (unique(newPath) && same(newPath, input)) {\n                yield newPath;\n                scope.visited.set(newPathKey, true);\n                yield* optimize(newPath, input, scope);\n            }\n        }\n    }\n}\nfunction same(path, input) {\n    return rootDocument.querySelector(selector(path)) === input;\n}\nconst regexAnySingleEscape = /[ -,\\.\\/:-@\\[-\\^`\\{-~]/;\nconst regexSingleEscape = /[ -,\\.\\/:-@\\[\\]\\^`\\{-~]/;\nconst regexExcessiveSpaces = /(^|\\\\+)?(\\\\[A-F0-9]{1,6})\\x20(?![a-fA-F0-9\\x20])/g;\nconst defaultOptions = {\n    escapeEverything: false,\n    isIdentifier: false,\n    quotes: \"single\",\n    wrap: false,\n};\nfunction cssesc(string, opt = {}) {\n    const options = Object.assign(Object.assign({}, defaultOptions), opt);\n    if (options.quotes != \"single\" && options.quotes != \"double\") {\n        options.quotes = \"single\";\n    }\n    const quote = options.quotes == \"double\" ? '\"' : \"'\";\n    const isIdentifier = options.isIdentifier;\n    const firstChar = string.charAt(0);\n    let output = \"\";\n    let counter = 0;\n    const length = string.length;\n    while (counter < length) {\n        const character = string.charAt(counter++);\n        let codePoint = character.charCodeAt(0);\n        let value = void 0;\n        // If it’s not a printable ASCII character…\n        if (codePoint < 0x20 || codePoint > 0x7e) {\n            if (codePoint >= 0xd800 && codePoint <= 0xdbff && counter < length) {\n                // It’s a high surrogate, and there is a next character.\n                const extra = string.charCodeAt(counter++);\n                if ((extra & 0xfc00) == 0xdc00) {\n                    // next character is low surrogate\n                    codePoint = ((codePoint & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;\n                }\n                else {\n                    // It’s an unmatched surrogate; only append this code unit, in case\n                    // the next code unit is the high surrogate of a surrogate pair.\n                    counter--;\n                }\n            }\n            value = \"\\\\\" + codePoint.toString(16).toUpperCase() + \" \";\n        }\n        else {\n            if (options.escapeEverything) {\n                if (regexAnySingleEscape.test(character)) {\n                    value = \"\\\\\" + character;\n                }\n                else {\n                    value = \"\\\\\" + codePoint.toString(16).toUpperCase() + \" \";\n                }\n            }\n            else if (/[\\t\\n\\f\\r\\x0B]/.test(character)) {\n                value = \"\\\\\" + codePoint.toString(16).toUpperCase() + \" \";\n            }\n            else if (character == \"\\\\\" ||\n                (!isIdentifier &&\n                    ((character == '\"' && quote == character) ||\n                        (character == \"'\" && quote == character))) ||\n                (isIdentifier && regexSingleEscape.test(character))) {\n                value = \"\\\\\" + character;\n            }\n            else {\n                value = character;\n            }\n        }\n        output += value;\n    }\n    if (isIdentifier) {\n        if (/^-[-\\d]/.test(output)) {\n            output = \"\\\\-\" + output.slice(1);\n        }\n        else if (/\\d/.test(firstChar)) {\n            output = \"\\\\3\" + firstChar + \" \" + output.slice(1);\n        }\n    }\n    // Remove spaces after `\\HEX` escapes that are not followed by a hex digit,\n    // since they’re redundant. Note that this is only possible if the escape\n    // sequence isn’t preceded by an odd number of backslashes.\n    output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {\n        if ($1 && $1.length % 2) {\n            // It’s not safe to remove the space, so don’t.\n            return $0;\n        }\n        // Strip the space.\n        return ($1 || \"\") + $2;\n    });\n    if (!isIdentifier && options.wrap) {\n        return quote + output + quote;\n    }\n    return output;\n}\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/@medv/finder/finder.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/aes.js":
/*!*******************************************!*\
  !*** ./node_modules/crypto-es/lib/aes.js ***!
  \*******************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"AESAlgo\": () => (/* binding */ AESAlgo),\n/* harmony export */   \"AES\": () => (/* binding */ AES)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\n// Lookup tables\nconst _SBOX = [];\nconst INV_SBOX = [];\nconst _SUB_MIX_0 = [];\nconst _SUB_MIX_1 = [];\nconst _SUB_MIX_2 = [];\nconst _SUB_MIX_3 = [];\nconst INV_SUB_MIX_0 = [];\nconst INV_SUB_MIX_1 = [];\nconst INV_SUB_MIX_2 = [];\nconst INV_SUB_MIX_3 = [];\n\n// Compute lookup tables\n\n// Compute double table\nconst d = [];\nfor (let i = 0; i < 256; i += 1) {\n  if (i < 128) {\n    d[i] = i << 1;\n  } else {\n    d[i] = (i << 1) ^ 0x11b;\n  }\n}\n\n// Walk GF(2^8)\nlet x = 0;\nlet xi = 0;\nfor (let i = 0; i < 256; i += 1) {\n  // Compute sbox\n  let sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n  sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n  _SBOX[x] = sx;\n  INV_SBOX[sx] = x;\n\n  // Compute multiplication\n  const x2 = d[x];\n  const x4 = d[x2];\n  const x8 = d[x4];\n\n  // Compute sub bytes, mix columns tables\n  let t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n  _SUB_MIX_0[x] = (t << 24) | (t >>> 8);\n  _SUB_MIX_1[x] = (t << 16) | (t >>> 16);\n  _SUB_MIX_2[x] = (t << 8) | (t >>> 24);\n  _SUB_MIX_3[x] = t;\n\n  // Compute inv sub bytes, inv mix columns tables\n  t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n  INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);\n  INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);\n  INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);\n  INV_SUB_MIX_3[sx] = t;\n\n  // Compute next counter\n  if (!x) {\n    xi = 1;\n    x = xi;\n  } else {\n    x = x2 ^ d[d[d[x8 ^ x2]]];\n    xi ^= d[d[xi]];\n  }\n}\n\n// Precomputed Rcon lookup\nconst RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\n/**\n * AES block cipher algorithm.\n */\nclass AESAlgo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipher {\n  _doReset() {\n    let t;\n\n    // Skip reset of nRounds has been set before and key did not change\n    if (this._nRounds && this._keyPriorReset === this._key) {\n      return;\n    }\n\n    // Shortcuts\n    this._keyPriorReset = this._key;\n    const key = this._keyPriorReset;\n    const keyWords = key.words;\n    const keySize = key.sigBytes / 4;\n\n    // Compute number of rounds\n    this._nRounds = keySize + 6;\n    const nRounds = this._nRounds;\n\n    // Compute number of key schedule rows\n    const ksRows = (nRounds + 1) * 4;\n\n    // Compute key schedule\n    this._keySchedule = [];\n    const keySchedule = this._keySchedule;\n    for (let ksRow = 0; ksRow < ksRows; ksRow += 1) {\n      if (ksRow < keySize) {\n        keySchedule[ksRow] = keyWords[ksRow];\n      } else {\n        t = keySchedule[ksRow - 1];\n\n        if (!(ksRow % keySize)) {\n          // Rot word\n          t = (t << 8) | (t >>> 24);\n\n          // Sub word\n          t = (_SBOX[t >>> 24] << 24)\n            | (_SBOX[(t >>> 16) & 0xff] << 16)\n            | (_SBOX[(t >>> 8) & 0xff] << 8)\n            | _SBOX[t & 0xff];\n\n          // Mix Rcon\n          t ^= RCON[(ksRow / keySize) | 0] << 24;\n        } else if (keySize > 6 && ksRow % keySize === 4) {\n          // Sub word\n          t = (_SBOX[t >>> 24] << 24)\n            | (_SBOX[(t >>> 16) & 0xff] << 16)\n            | (_SBOX[(t >>> 8) & 0xff] << 8)\n            | _SBOX[t & 0xff];\n        }\n\n        keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;\n      }\n    }\n\n    // Compute inv key schedule\n    this._invKeySchedule = [];\n    const invKeySchedule = this._invKeySchedule;\n    for (let invKsRow = 0; invKsRow < ksRows; invKsRow += 1) {\n      const ksRow = ksRows - invKsRow;\n\n      if (invKsRow % 4) {\n        t = keySchedule[ksRow];\n      } else {\n        t = keySchedule[ksRow - 4];\n      }\n\n      if (invKsRow < 4 || ksRow <= 4) {\n        invKeySchedule[invKsRow] = t;\n      } else {\n        invKeySchedule[invKsRow] = INV_SUB_MIX_0[_SBOX[t >>> 24]]\n          ^ INV_SUB_MIX_1[_SBOX[(t >>> 16) & 0xff]]\n          ^ INV_SUB_MIX_2[_SBOX[(t >>> 8) & 0xff]]\n          ^ INV_SUB_MIX_3[_SBOX[t & 0xff]];\n      }\n    }\n  }\n\n  encryptBlock(M, offset) {\n    this._doCryptBlock(\n      M, offset, this._keySchedule, _SUB_MIX_0, _SUB_MIX_1, _SUB_MIX_2, _SUB_MIX_3, _SBOX,\n    );\n  }\n\n  decryptBlock(M, offset) {\n    const _M = M;\n\n    // Swap 2nd and 4th rows\n    let t = _M[offset + 1];\n    _M[offset + 1] = _M[offset + 3];\n    _M[offset + 3] = t;\n\n    this._doCryptBlock(\n      _M,\n      offset,\n      this._invKeySchedule,\n      INV_SUB_MIX_0,\n      INV_SUB_MIX_1,\n      INV_SUB_MIX_2,\n      INV_SUB_MIX_3,\n      INV_SBOX,\n    );\n\n    // Inv swap 2nd and 4th rows\n    t = _M[offset + 1];\n    _M[offset + 1] = _M[offset + 3];\n    _M[offset + 3] = t;\n  }\n\n  _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {\n    const _M = M;\n\n    // Shortcut\n    const nRounds = this._nRounds;\n\n    // Get input, add round key\n    let s0 = _M[offset] ^ keySchedule[0];\n    let s1 = _M[offset + 1] ^ keySchedule[1];\n    let s2 = _M[offset + 2] ^ keySchedule[2];\n    let s3 = _M[offset + 3] ^ keySchedule[3];\n\n    // Key schedule row counter\n    let ksRow = 4;\n\n    // Rounds\n    for (let round = 1; round < nRounds; round += 1) {\n      // Shift rows, sub bytes, mix columns, add round key\n      const t0 = SUB_MIX_0[s0 >>> 24]\n        ^ SUB_MIX_1[(s1 >>> 16) & 0xff]\n        ^ SUB_MIX_2[(s2 >>> 8) & 0xff]\n        ^ SUB_MIX_3[s3 & 0xff]\n        ^ keySchedule[ksRow];\n      ksRow += 1;\n      const t1 = SUB_MIX_0[s1 >>> 24]\n        ^ SUB_MIX_1[(s2 >>> 16) & 0xff]\n        ^ SUB_MIX_2[(s3 >>> 8) & 0xff]\n        ^ SUB_MIX_3[s0 & 0xff]\n        ^ keySchedule[ksRow];\n      ksRow += 1;\n      const t2 = SUB_MIX_0[s2 >>> 24]\n        ^ SUB_MIX_1[(s3 >>> 16) & 0xff]\n        ^ SUB_MIX_2[(s0 >>> 8) & 0xff]\n        ^ SUB_MIX_3[s1 & 0xff]\n        ^ keySchedule[ksRow];\n      ksRow += 1;\n      const t3 = SUB_MIX_0[s3 >>> 24]\n        ^ SUB_MIX_1[(s0 >>> 16) & 0xff]\n        ^ SUB_MIX_2[(s1 >>> 8) & 0xff]\n        ^ SUB_MIX_3[s2 & 0xff]\n        ^ keySchedule[ksRow];\n      ksRow += 1;\n\n      // Update state\n      s0 = t0;\n      s1 = t1;\n      s2 = t2;\n      s3 = t3;\n    }\n\n    // Shift rows, sub bytes, add round key\n    const t0 = (\n      (SBOX[s0 >>> 24] << 24)\n        | (SBOX[(s1 >>> 16) & 0xff] << 16)\n        | (SBOX[(s2 >>> 8) & 0xff] << 8)\n        | SBOX[s3 & 0xff]\n    ) ^ keySchedule[ksRow];\n    ksRow += 1;\n    const t1 = (\n      (SBOX[s1 >>> 24] << 24)\n        | (SBOX[(s2 >>> 16) & 0xff] << 16)\n        | (SBOX[(s3 >>> 8) & 0xff] << 8)\n        | SBOX[s0 & 0xff]\n    ) ^ keySchedule[ksRow];\n    ksRow += 1;\n    const t2 = (\n      (SBOX[s2 >>> 24] << 24)\n        | (SBOX[(s3 >>> 16) & 0xff] << 16)\n        | (SBOX[(s0 >>> 8) & 0xff] << 8)\n        | SBOX[s1 & 0xff]\n    ) ^ keySchedule[ksRow];\n    ksRow += 1;\n    const t3 = (\n      (SBOX[s3 >>> 24] << 24)\n        | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]\n    ) ^ keySchedule[ksRow];\n    ksRow += 1;\n\n    // Set output\n    _M[offset] = t0;\n    _M[offset + 1] = t1;\n    _M[offset + 2] = t2;\n    _M[offset + 3] = t3;\n  }\n}\nAESAlgo.keySize = 256 / 32;\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);\n */\nconst AES = _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipher._createHelper(AESAlgo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/aes.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/cipher-core.js":
/*!***************************************************!*\
  !*** ./node_modules/crypto-es/lib/cipher-core.js ***!
  \***************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Cipher\": () => (/* binding */ Cipher),\n/* harmony export */   \"StreamCipher\": () => (/* binding */ StreamCipher),\n/* harmony export */   \"BlockCipherMode\": () => (/* binding */ BlockCipherMode),\n/* harmony export */   \"CBC\": () => (/* binding */ CBC),\n/* harmony export */   \"Pkcs7\": () => (/* binding */ Pkcs7),\n/* harmony export */   \"BlockCipher\": () => (/* binding */ BlockCipher),\n/* harmony export */   \"CipherParams\": () => (/* binding */ CipherParams),\n/* harmony export */   \"OpenSSLFormatter\": () => (/* binding */ OpenSSLFormatter),\n/* harmony export */   \"SerializableCipher\": () => (/* binding */ SerializableCipher),\n/* harmony export */   \"OpenSSLKdf\": () => (/* binding */ OpenSSLKdf),\n/* harmony export */   \"PasswordBasedCipher\": () => (/* binding */ PasswordBasedCipher)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _enc_base64_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enc-base64.js */ \"./node_modules/crypto-es/lib/enc-base64.js\");\n/* harmony import */ var _evpkdf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./evpkdf.js */ \"./node_modules/crypto-es/lib/evpkdf.js\");\n/* eslint-disable no-use-before-define */\n\n\n\n\n\n/**\n * Abstract base cipher template.\n *\n * @property {number} keySize This cipher's key size. Default: 4 (128 bits)\n * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)\n * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.\n * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.\n */\nclass Cipher extends _core_js__WEBPACK_IMPORTED_MODULE_0__.BufferedBlockAlgorithm {\n  /**\n   * Initializes a newly created cipher.\n   *\n   * @param {number} xformMode Either the encryption or decryption transormation mode constant.\n   * @param {WordArray} key The key.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @example\n   *\n   *     const cipher = CryptoJS.algo.AES.create(\n   *       CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }\n   *     );\n   */\n  constructor(xformMode, key, cfg) {\n    super();\n\n    /**\n     * Configuration options.\n     *\n     * @property {WordArray} iv The IV to use for this operation.\n     */\n    this.cfg = Object.assign(new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(), cfg);\n\n    // Store transform mode and key\n    this._xformMode = xformMode;\n    this._key = key;\n\n    // Set initial values\n    this.reset();\n  }\n\n  /**\n   * Creates this cipher in encryption mode.\n   *\n   * @param {WordArray} key The key.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {Cipher} A cipher instance.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });\n   */\n  static createEncryptor(key, cfg) {\n    return this.create(this._ENC_XFORM_MODE, key, cfg);\n  }\n\n  /**\n   * Creates this cipher in decryption mode.\n   *\n   * @param {WordArray} key The key.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {Cipher} A cipher instance.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });\n   */\n  static createDecryptor(key, cfg) {\n    return this.create(this._DEC_XFORM_MODE, key, cfg);\n  }\n\n  /**\n   * Creates shortcut functions to a cipher's object interface.\n   *\n   * @param {Cipher} cipher The cipher to create a helper for.\n   *\n   * @return {Object} An object with encrypt and decrypt shortcut functions.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);\n   */\n  static _createHelper(SubCipher) {\n    const selectCipherStrategy = (key) => {\n      if (typeof key === 'string') {\n        return PasswordBasedCipher;\n      }\n      return SerializableCipher;\n    };\n\n    return {\n      encrypt(message, key, cfg) {\n        return selectCipherStrategy(key).encrypt(SubCipher, message, key, cfg);\n      },\n\n      decrypt(ciphertext, key, cfg) {\n        return selectCipherStrategy(key).decrypt(SubCipher, ciphertext, key, cfg);\n      },\n    };\n  }\n\n  /**\n   * Resets this cipher to its initial state.\n   *\n   * @example\n   *\n   *     cipher.reset();\n   */\n  reset() {\n    // Reset data buffer\n    super.reset.call(this);\n\n    // Perform concrete-cipher logic\n    this._doReset();\n  }\n\n  /**\n   * Adds data to be encrypted or decrypted.\n   *\n   * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.\n   *\n   * @return {WordArray} The data after processing.\n   *\n   * @example\n   *\n   *     const encrypted = cipher.process('data');\n   *     const encrypted = cipher.process(wordArray);\n   */\n  process(dataUpdate) {\n    // Append\n    this._append(dataUpdate);\n\n    // Process available blocks\n    return this._process();\n  }\n\n  /**\n   * Finalizes the encryption or decryption process.\n   * Note that the finalize operation is effectively a destructive, read-once operation.\n   *\n   * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.\n   *\n   * @return {WordArray} The data after final processing.\n   *\n   * @example\n   *\n   *     const encrypted = cipher.finalize();\n   *     const encrypted = cipher.finalize('data');\n   *     const encrypted = cipher.finalize(wordArray);\n   */\n  finalize(dataUpdate) {\n    // Final data update\n    if (dataUpdate) {\n      this._append(dataUpdate);\n    }\n\n    // Perform concrete-cipher logic\n    const finalProcessedData = this._doFinalize();\n\n    return finalProcessedData;\n  }\n}\nCipher._ENC_XFORM_MODE = 1;\nCipher._DEC_XFORM_MODE = 2;\nCipher.keySize = 128 / 32;\nCipher.ivSize = 128 / 32;\n\n/**\n * Abstract base stream cipher template.\n *\n * @property {number} blockSize\n *\n *     The number of 32-bit words this cipher operates on. Default: 1 (32 bits)\n */\nclass StreamCipher extends Cipher {\n  constructor(...args) {\n    super(...args);\n\n    this.blockSize = 1;\n  }\n\n  _doFinalize() {\n    // Process partial blocks\n    const finalProcessedBlocks = this._process(!!'flush');\n\n    return finalProcessedBlocks;\n  }\n}\n\n/**\n * Abstract base block cipher mode template.\n */\nclass BlockCipherMode extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created mode.\n   *\n   * @param {Cipher} cipher A block cipher instance.\n   * @param {Array} iv The IV words.\n   *\n   * @example\n   *\n   *     const mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);\n   */\n  constructor(cipher, iv) {\n    super();\n\n    this._cipher = cipher;\n    this._iv = iv;\n  }\n\n  /**\n   * Creates this mode for encryption.\n   *\n   * @param {Cipher} cipher A block cipher instance.\n   * @param {Array} iv The IV words.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);\n   */\n  static createEncryptor(cipher, iv) {\n    return this.Encryptor.create(cipher, iv);\n  }\n\n  /**\n   * Creates this mode for decryption.\n   *\n   * @param {Cipher} cipher A block cipher instance.\n   * @param {Array} iv The IV words.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);\n   */\n  static createDecryptor(cipher, iv) {\n    return this.Decryptor.create(cipher, iv);\n  }\n}\n\nfunction xorBlock(words, offset, blockSize) {\n  const _words = words;\n  let block;\n\n  // Shortcut\n  const iv = this._iv;\n\n  // Choose mixing block\n  if (iv) {\n    block = iv;\n\n    // Remove IV for subsequent blocks\n    this._iv = undefined;\n  } else {\n    block = this._prevBlock;\n  }\n\n  // XOR blocks\n  for (let i = 0; i < blockSize; i += 1) {\n    _words[offset + i] ^= block[i];\n  }\n}\n\n/**\n * Cipher Block Chaining mode.\n */\n\n/**\n * Abstract base CBC mode.\n */\nclass CBC extends BlockCipherMode {\n}\n/**\n * CBC encryptor.\n */\nCBC.Encryptor = class extends CBC {\n  /**\n   * Processes the data block at offset.\n   *\n   * @param {Array} words The data words to operate on.\n   * @param {number} offset The offset where the block starts.\n   *\n   * @example\n   *\n   *     mode.processBlock(data.words, offset);\n   */\n  processBlock(words, offset) {\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n\n    // XOR and encrypt\n    xorBlock.call(this, words, offset, blockSize);\n    cipher.encryptBlock(words, offset);\n\n    // Remember this block to use with next block\n    this._prevBlock = words.slice(offset, offset + blockSize);\n  }\n};\n/**\n * CBC decryptor.\n */\nCBC.Decryptor = class extends CBC {\n  /**\n   * Processes the data block at offset.\n   *\n   * @param {Array} words The data words to operate on.\n   * @param {number} offset The offset where the block starts.\n   *\n   * @example\n   *\n   *     mode.processBlock(data.words, offset);\n   */\n  processBlock(words, offset) {\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n\n    // Remember this block to use with next block\n    const thisBlock = words.slice(offset, offset + blockSize);\n\n    // Decrypt and XOR\n    cipher.decryptBlock(words, offset);\n    xorBlock.call(this, words, offset, blockSize);\n\n    // This block becomes the previous block\n    this._prevBlock = thisBlock;\n  }\n};\n\n/**\n * PKCS #5/7 padding strategy.\n */\nconst Pkcs7 = {\n  /**\n   * Pads data using the algorithm defined in PKCS #5/7.\n   *\n   * @param {WordArray} data The data to pad.\n   * @param {number} blockSize The multiple that the data should be padded to.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);\n   */\n  pad(data, blockSize) {\n    // Shortcut\n    const blockSizeBytes = blockSize * 4;\n\n    // Count padding bytes\n    const nPaddingBytes = blockSizeBytes - (data.sigBytes % blockSizeBytes);\n\n    // Create padding word\n    const paddingWord = (nPaddingBytes << 24)\n      | (nPaddingBytes << 16)\n      | (nPaddingBytes << 8)\n      | nPaddingBytes;\n\n    // Create padding\n    const paddingWords = [];\n    for (let i = 0; i < nPaddingBytes; i += 4) {\n      paddingWords.push(paddingWord);\n    }\n    const padding = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(paddingWords, nPaddingBytes);\n\n    // Add padding\n    data.concat(padding);\n  },\n\n  /**\n   * Unpads data that had been padded using the algorithm defined in PKCS #5/7.\n   *\n   * @param {WordArray} data The data to unpad.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     CryptoJS.pad.Pkcs7.unpad(wordArray);\n   */\n  unpad(data) {\n    const _data = data;\n\n    // Get number of padding bytes from last byte\n    const nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;\n\n    // Remove padding\n    _data.sigBytes -= nPaddingBytes;\n  },\n};\n\n/**\n * Abstract base block cipher template.\n *\n * @property {number} blockSize\n *\n *    The number of 32-bit words this cipher operates on. Default: 4 (128 bits)\n */\nclass BlockCipher extends Cipher {\n  constructor(xformMode, key, cfg) {\n    /**\n     * Configuration options.\n     *\n     * @property {Mode} mode The block mode to use. Default: CBC\n     * @property {Padding} padding The padding strategy to use. Default: Pkcs7\n     */\n    super(xformMode, key, Object.assign(\n      {\n        mode: CBC,\n        padding: Pkcs7,\n      },\n      cfg,\n    ));\n\n    this.blockSize = 128 / 32;\n  }\n\n  reset() {\n    let modeCreator;\n\n    // Reset cipher\n    super.reset.call(this);\n\n    // Shortcuts\n    const { cfg } = this;\n    const { iv, mode } = cfg;\n\n    // Reset block mode\n    if (this._xformMode === this.constructor._ENC_XFORM_MODE) {\n      modeCreator = mode.createEncryptor;\n    } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n      modeCreator = mode.createDecryptor;\n      // Keep at least one block in the buffer for unpadding\n      this._minBufferSize = 1;\n    }\n\n    this._mode = modeCreator.call(mode, this, iv && iv.words);\n    this._mode.__creator = modeCreator;\n  }\n\n  _doProcessBlock(words, offset) {\n    this._mode.processBlock(words, offset);\n  }\n\n  _doFinalize() {\n    let finalProcessedBlocks;\n\n    // Shortcut\n    const { padding } = this.cfg;\n\n    // Finalize\n    if (this._xformMode === this.constructor._ENC_XFORM_MODE) {\n      // Pad data\n      padding.pad(this._data, this.blockSize);\n\n      // Process final blocks\n      finalProcessedBlocks = this._process(!!'flush');\n    } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n      // Process final blocks\n      finalProcessedBlocks = this._process(!!'flush');\n\n      // Unpad data\n      padding.unpad(finalProcessedBlocks);\n    }\n\n    return finalProcessedBlocks;\n  }\n}\n\n/**\n * A collection of cipher parameters.\n *\n * @property {WordArray} ciphertext The raw ciphertext.\n * @property {WordArray} key The key to this ciphertext.\n * @property {WordArray} iv The IV used in the ciphering operation.\n * @property {WordArray} salt The salt used with a key derivation function.\n * @property {Cipher} algorithm The cipher algorithm.\n * @property {Mode} mode The block mode used in the ciphering operation.\n * @property {Padding} padding The padding scheme used in the ciphering operation.\n * @property {number} blockSize The block size of the cipher.\n * @property {Format} formatter\n *    The default formatting strategy to convert this cipher params object to a string.\n */\nclass CipherParams extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created cipher params object.\n   *\n   * @param {Object} cipherParams An object with any of the possible cipher parameters.\n   *\n   * @example\n   *\n   *     var cipherParams = CryptoJS.lib.CipherParams.create({\n   *         ciphertext: ciphertextWordArray,\n   *         key: keyWordArray,\n   *         iv: ivWordArray,\n   *         salt: saltWordArray,\n   *         algorithm: CryptoJS.algo.AES,\n   *         mode: CryptoJS.mode.CBC,\n   *         padding: CryptoJS.pad.PKCS7,\n   *         blockSize: 4,\n   *         formatter: CryptoJS.format.OpenSSL\n   *     });\n   */\n  constructor(cipherParams) {\n    super();\n\n    this.mixIn(cipherParams);\n  }\n\n  /**\n   * Converts this cipher params object to a string.\n   *\n   * @param {Format} formatter (Optional) The formatting strategy to use.\n   *\n   * @return {string} The stringified cipher params.\n   *\n   * @throws Error If neither the formatter nor the default formatter is set.\n   *\n   * @example\n   *\n   *     var string = cipherParams + '';\n   *     var string = cipherParams.toString();\n   *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);\n   */\n  toString(formatter) {\n    return (formatter || this.formatter).stringify(this);\n  }\n}\n\n/**\n * OpenSSL formatting strategy.\n */\nconst OpenSSLFormatter = {\n  /**\n   * Converts a cipher params object to an OpenSSL-compatible string.\n   *\n   * @param {CipherParams} cipherParams The cipher params object.\n   *\n   * @return {string} The OpenSSL-compatible string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);\n   */\n  stringify(cipherParams) {\n    let wordArray;\n\n    // Shortcuts\n    const { ciphertext, salt } = cipherParams;\n\n    // Format\n    if (salt) {\n      wordArray = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);\n    } else {\n      wordArray = ciphertext;\n    }\n\n    return wordArray.toString(_enc_base64_js__WEBPACK_IMPORTED_MODULE_1__.Base64);\n  },\n\n  /**\n   * Converts an OpenSSL-compatible string to a cipher params object.\n   *\n   * @param {string} openSSLStr The OpenSSL-compatible string.\n   *\n   * @return {CipherParams} The cipher params object.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);\n   */\n  parse(openSSLStr) {\n    let salt;\n\n    // Parse base64\n    const ciphertext = _enc_base64_js__WEBPACK_IMPORTED_MODULE_1__.Base64.parse(openSSLStr);\n\n    // Shortcut\n    const ciphertextWords = ciphertext.words;\n\n    // Test for salt\n    if (ciphertextWords[0] === 0x53616c74 && ciphertextWords[1] === 0x65645f5f) {\n      // Extract salt\n      salt = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(ciphertextWords.slice(2, 4));\n\n      // Remove salt from ciphertext\n      ciphertextWords.splice(0, 4);\n      ciphertext.sigBytes -= 16;\n    }\n\n    return CipherParams.create({ ciphertext, salt });\n  },\n};\n\n/**\n * A cipher wrapper that returns ciphertext as a serializable cipher params object.\n */\nclass SerializableCipher extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Encrypts a message.\n   *\n   * @param {Cipher} cipher The cipher algorithm to use.\n   * @param {WordArray|string} message The message to encrypt.\n   * @param {WordArray} key The key.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {CipherParams} A cipher params object.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var ciphertextParams = CryptoJS.lib.SerializableCipher\n   *       .encrypt(CryptoJS.algo.AES, message, key);\n   *     var ciphertextParams = CryptoJS.lib.SerializableCipher\n   *       .encrypt(CryptoJS.algo.AES, message, key, { iv: iv });\n   *     var ciphertextParams = CryptoJS.lib.SerializableCipher\n   *       .encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n   */\n  static encrypt(cipher, message, key, cfg) {\n    // Apply config defaults\n    const _cfg = Object.assign(new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(), this.cfg, cfg);\n\n    // Encrypt\n    const encryptor = cipher.createEncryptor(key, _cfg);\n    const ciphertext = encryptor.finalize(message);\n\n    // Shortcut\n    const cipherCfg = encryptor.cfg;\n\n    // Create and return serializable cipher params\n    return CipherParams.create({\n      ciphertext,\n      key,\n      iv: cipherCfg.iv,\n      algorithm: cipher,\n      mode: cipherCfg.mode,\n      padding: cipherCfg.padding,\n      blockSize: encryptor.blockSize,\n      formatter: _cfg.format,\n    });\n  }\n\n  /**\n   * Decrypts serialized ciphertext.\n   *\n   * @param {Cipher} cipher The cipher algorithm to use.\n   * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n   * @param {WordArray} key The key.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {WordArray} The plaintext.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var plaintext = CryptoJS.lib.SerializableCipher\n   *       .decrypt(CryptoJS.algo.AES, formattedCiphertext, key,\n   *         { iv: iv, format: CryptoJS.format.OpenSSL });\n   *     var plaintext = CryptoJS.lib.SerializableCipher\n   *       .decrypt(CryptoJS.algo.AES, ciphertextParams, key,\n   *         { iv: iv, format: CryptoJS.format.OpenSSL });\n   */\n  static decrypt(cipher, ciphertext, key, cfg) {\n    let _ciphertext = ciphertext;\n\n    // Apply config defaults\n    const _cfg = Object.assign(new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(), this.cfg, cfg);\n\n    // Convert string to CipherParams\n    _ciphertext = this._parse(_ciphertext, _cfg.format);\n\n    // Decrypt\n    const plaintext = cipher.createDecryptor(key, _cfg).finalize(_ciphertext.ciphertext);\n\n    return plaintext;\n  }\n\n  /**\n   * Converts serialized ciphertext to CipherParams,\n   * else assumed CipherParams already and returns ciphertext unchanged.\n   *\n   * @param {CipherParams|string} ciphertext The ciphertext.\n   * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.\n   *\n   * @return {CipherParams} The unserialized ciphertext.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var ciphertextParams = CryptoJS.lib.SerializableCipher\n   *       ._parse(ciphertextStringOrParams, format);\n   */\n  static _parse(ciphertext, format) {\n    if (typeof ciphertext === 'string') {\n      return format.parse(ciphertext, this);\n    }\n    return ciphertext;\n  }\n}\n/**\n * Configuration options.\n *\n * @property {Formatter} format\n *\n *    The formatting strategy to convert cipher param objects to and from a string.\n *    Default: OpenSSL\n */\nSerializableCipher.cfg = Object.assign(\n  new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(),\n  { format: OpenSSLFormatter },\n);\n\n/**\n * OpenSSL key derivation function.\n */\nconst OpenSSLKdf = {\n  /**\n   * Derives a key and IV from a password.\n   *\n   * @param {string} password The password to derive from.\n   * @param {number} keySize The size in words of the key to generate.\n   * @param {number} ivSize The size in words of the IV to generate.\n   * @param {WordArray|string} salt\n   *     (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.\n   *\n   * @return {CipherParams} A cipher params object with the key, IV, and salt.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);\n   *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');\n   */\n  execute(password, keySize, ivSize, salt) {\n    let _salt = salt;\n\n    // Generate random salt\n    if (!_salt) {\n      _salt = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.random(64 / 8);\n    }\n\n    // Derive key and IV\n    const key = _evpkdf_js__WEBPACK_IMPORTED_MODULE_2__.EvpKDFAlgo.create({ keySize: keySize + ivSize }).compute(password, _salt);\n\n    // Separate key and IV\n    const iv = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(key.words.slice(keySize), ivSize * 4);\n    key.sigBytes = keySize * 4;\n\n    // Return params\n    return CipherParams.create({ key, iv, salt: _salt });\n  },\n};\n\n/**\n * A serializable cipher wrapper that derives the key from a password,\n * and returns ciphertext as a serializable cipher params object.\n */\nclass PasswordBasedCipher extends SerializableCipher {\n  /**\n   * Encrypts a message using a password.\n   *\n   * @param {Cipher} cipher The cipher algorithm to use.\n   * @param {WordArray|string} message The message to encrypt.\n   * @param {string} password The password.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {CipherParams} A cipher params object.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher\n   *       .encrypt(CryptoJS.algo.AES, message, 'password');\n   *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher\n   *       .encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });\n   */\n  static encrypt(cipher, message, password, cfg) {\n    // Apply config defaults\n    const _cfg = Object.assign(new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(), this.cfg, cfg);\n\n    // Derive key and other params\n    const derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);\n\n    // Add IV to config\n    _cfg.iv = derivedParams.iv;\n\n    // Encrypt\n    const ciphertext = SerializableCipher.encrypt\n      .call(this, cipher, message, derivedParams.key, _cfg);\n\n    // Mix in derived params\n    ciphertext.mixIn(derivedParams);\n\n    return ciphertext;\n  }\n\n  /**\n   * Decrypts serialized ciphertext using a password.\n   *\n   * @param {Cipher} cipher The cipher algorithm to use.\n   * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n   * @param {string} password The password.\n   * @param {Object} cfg (Optional) The configuration options to use for this operation.\n   *\n   * @return {WordArray} The plaintext.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var plaintext = CryptoJS.lib.PasswordBasedCipher\n   *       .decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password',\n   *         { format: CryptoJS.format.OpenSSL });\n   *     var plaintext = CryptoJS.lib.PasswordBasedCipher\n   *       .decrypt(CryptoJS.algo.AES, ciphertextParams, 'password',\n   *         { format: CryptoJS.format.OpenSSL });\n   */\n  static decrypt(cipher, ciphertext, password, cfg) {\n    let _ciphertext = ciphertext;\n\n    // Apply config defaults\n    const _cfg = Object.assign(new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(), this.cfg, cfg);\n\n    // Convert string to CipherParams\n    _ciphertext = this._parse(_ciphertext, _cfg.format);\n\n    // Derive key and other params\n    const derivedParams = _cfg.kdf\n      .execute(password, cipher.keySize, cipher.ivSize, _ciphertext.salt);\n\n    // Add IV to config\n    _cfg.iv = derivedParams.iv;\n\n    // Decrypt\n    const plaintext = SerializableCipher.decrypt\n      .call(this, cipher, _ciphertext, derivedParams.key, _cfg);\n\n    return plaintext;\n  }\n}\n/**\n * Configuration options.\n *\n * @property {KDF} kdf\n *     The key derivation function to use to generate a key and IV from a password.\n *     Default: OpenSSL\n */\nPasswordBasedCipher.cfg = Object.assign(SerializableCipher.cfg, { kdf: OpenSSLKdf });\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/cipher-core.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/core.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-es/lib/core.js ***!
  \********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Base\": () => (/* binding */ Base),\n/* harmony export */   \"WordArray\": () => (/* binding */ WordArray),\n/* harmony export */   \"Hex\": () => (/* binding */ Hex),\n/* harmony export */   \"Latin1\": () => (/* binding */ Latin1),\n/* harmony export */   \"Utf8\": () => (/* binding */ Utf8),\n/* harmony export */   \"BufferedBlockAlgorithm\": () => (/* binding */ BufferedBlockAlgorithm),\n/* harmony export */   \"Hasher\": () => (/* binding */ Hasher),\n/* harmony export */   \"HMAC\": () => (/* binding */ HMAC)\n/* harmony export */ });\n/* eslint-disable no-use-before-define */\n\n/**\n * Base class for inheritance.\n */\nclass Base {\n  /**\n   * Extends this object and runs the init method.\n   * Arguments to create() will be passed to init().\n   *\n   * @return {Object} The new object.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var instance = MyType.create();\n   */\n  static create(...args) {\n    return new this(...args);\n  }\n\n  /**\n   * Copies properties into this object.\n   *\n   * @param {Object} properties The properties to mix in.\n   *\n   * @example\n   *\n   *     MyType.mixIn({\n   *         field: 'value'\n   *     });\n   */\n  mixIn(properties) {\n    return Object.assign(this, properties);\n  }\n\n  /**\n   * Creates a copy of this object.\n   *\n   * @return {Object} The clone.\n   *\n   * @example\n   *\n   *     var clone = instance.clone();\n   */\n  clone() {\n    const clone = new this.constructor();\n    Object.assign(clone, this);\n    return clone;\n  }\n}\n\n/**\n * An array of 32-bit words.\n *\n * @property {Array} words The array of 32-bit words.\n * @property {number} sigBytes The number of significant bytes in this word array.\n */\nclass WordArray extends Base {\n  /**\n   * Initializes a newly created word array.\n   *\n   * @param {Array} words (Optional) An array of 32-bit words.\n   * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.lib.WordArray.create();\n   *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n   *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n   */\n  constructor(words = [], sigBytes = words.length * 4) {\n    super();\n\n    let typedArray = words;\n    // Convert buffers to uint8\n    if (typedArray instanceof ArrayBuffer) {\n      typedArray = new Uint8Array(typedArray);\n    }\n\n    // Convert other array views to uint8\n    if (\n      typedArray instanceof Int8Array\n      || typedArray instanceof Uint8ClampedArray\n      || typedArray instanceof Int16Array\n      || typedArray instanceof Uint16Array\n      || typedArray instanceof Int32Array\n      || typedArray instanceof Uint32Array\n      || typedArray instanceof Float32Array\n      || typedArray instanceof Float64Array\n    ) {\n      typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n    }\n\n    // Handle Uint8Array\n    if (typedArray instanceof Uint8Array) {\n      // Shortcut\n      const typedArrayByteLength = typedArray.byteLength;\n\n      // Extract bytes\n      const _words = [];\n      for (let i = 0; i < typedArrayByteLength; i += 1) {\n        _words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);\n      }\n\n      // Initialize this word array\n      this.words = _words;\n      this.sigBytes = typedArrayByteLength;\n    } else {\n      // Else call normal init\n      this.words = words;\n      this.sigBytes = sigBytes;\n    }\n  }\n\n  /**\n   * Creates a word array filled with random bytes.\n   *\n   * @param {number} nBytes The number of random bytes to generate.\n   *\n   * @return {WordArray} The random word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.lib.WordArray.random(16);\n   */\n  static random(nBytes) {\n    const words = [];\n\n    const r = (m_w) => {\n      let _m_w = m_w;\n      let _m_z = 0x3ade68b1;\n      const mask = 0xffffffff;\n\n      return () => {\n        _m_z = (0x9069 * (_m_z & 0xFFFF) + (_m_z >> 0x10)) & mask;\n        _m_w = (0x4650 * (_m_w & 0xFFFF) + (_m_w >> 0x10)) & mask;\n        let result = ((_m_z << 0x10) + _m_w) & mask;\n        result /= 0x100000000;\n        result += 0.5;\n        return result * (Math.random() > 0.5 ? 1 : -1);\n      };\n    };\n\n    for (let i = 0, rcache; i < nBytes; i += 4) {\n      const _r = r((rcache || Math.random()) * 0x100000000);\n\n      rcache = _r() * 0x3ade67b7;\n      words.push((_r() * 0x100000000) | 0);\n    }\n\n    return new WordArray(words, nBytes);\n  }\n\n  /**\n   * Converts this word array to a string.\n   *\n   * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n   *\n   * @return {string} The stringified word array.\n   *\n   * @example\n   *\n   *     var string = wordArray + '';\n   *     var string = wordArray.toString();\n   *     var string = wordArray.toString(CryptoJS.enc.Utf8);\n   */\n  toString(encoder = Hex) {\n    return encoder.stringify(this);\n  }\n\n  /**\n   * Concatenates a word array to this word array.\n   *\n   * @param {WordArray} wordArray The word array to append.\n   *\n   * @return {WordArray} This word array.\n   *\n   * @example\n   *\n   *     wordArray1.concat(wordArray2);\n   */\n  concat(wordArray) {\n    // Shortcuts\n    const thisWords = this.words;\n    const thatWords = wordArray.words;\n    const thisSigBytes = this.sigBytes;\n    const thatSigBytes = wordArray.sigBytes;\n\n    // Clamp excess bits\n    this.clamp();\n\n    // Concat\n    if (thisSigBytes % 4) {\n      // Copy one byte at a time\n      for (let i = 0; i < thatSigBytes; i += 1) {\n        const thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n        thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n      }\n    } else {\n      // Copy one word at a time\n      for (let i = 0; i < thatSigBytes; i += 4) {\n        thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n      }\n    }\n    this.sigBytes += thatSigBytes;\n\n    // Chainable\n    return this;\n  }\n\n  /**\n   * Removes insignificant bits.\n   *\n   * @example\n   *\n   *     wordArray.clamp();\n   */\n  clamp() {\n    // Shortcuts\n    const { words, sigBytes } = this;\n\n    // Clamp\n    words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n    words.length = Math.ceil(sigBytes / 4);\n  }\n\n  /**\n   * Creates a copy of this word array.\n   *\n   * @return {WordArray} The clone.\n   *\n   * @example\n   *\n   *     var clone = wordArray.clone();\n   */\n  clone() {\n    const clone = super.clone.call(this);\n    clone.words = this.words.slice(0);\n\n    return clone;\n  }\n}\n\n/**\n * Hex encoding strategy.\n */\nconst Hex = {\n  /**\n   * Converts a word array to a hex string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The hex string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    // Shortcuts\n    const { words, sigBytes } = wordArray;\n\n    // Convert\n    const hexChars = [];\n    for (let i = 0; i < sigBytes; i += 1) {\n      const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n      hexChars.push((bite >>> 4).toString(16));\n      hexChars.push((bite & 0x0f).toString(16));\n    }\n\n    return hexChars.join('');\n  },\n\n  /**\n   * Converts a hex string to a word array.\n   *\n   * @param {string} hexStr The hex string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.enc.Hex.parse(hexString);\n   */\n  parse(hexStr) {\n    // Shortcut\n    const hexStrLength = hexStr.length;\n\n    // Convert\n    const words = [];\n    for (let i = 0; i < hexStrLength; i += 2) {\n      words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n    }\n\n    return new WordArray(words, hexStrLength / 2);\n  },\n};\n\n/**\n * Latin1 encoding strategy.\n */\nconst Latin1 = {\n  /**\n   * Converts a word array to a Latin1 string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The Latin1 string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    // Shortcuts\n    const { words, sigBytes } = wordArray;\n\n    // Convert\n    const latin1Chars = [];\n    for (let i = 0; i < sigBytes; i += 1) {\n      const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n      latin1Chars.push(String.fromCharCode(bite));\n    }\n\n    return latin1Chars.join('');\n  },\n\n  /**\n   * Converts a Latin1 string to a word array.\n   *\n   * @param {string} latin1Str The Latin1 string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n   */\n  parse(latin1Str) {\n    // Shortcut\n    const latin1StrLength = latin1Str.length;\n\n    // Convert\n    const words = [];\n    for (let i = 0; i < latin1StrLength; i += 1) {\n      words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n    }\n\n    return new WordArray(words, latin1StrLength);\n  },\n};\n\n/**\n * UTF-8 encoding strategy.\n */\nconst Utf8 = {\n  /**\n   * Converts a word array to a UTF-8 string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The UTF-8 string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    try {\n      return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n    } catch (e) {\n      throw new Error('Malformed UTF-8 data');\n    }\n  },\n\n  /**\n   * Converts a UTF-8 string to a word array.\n   *\n   * @param {string} utf8Str The UTF-8 string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n   */\n  parse(utf8Str) {\n    return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n  },\n};\n\n/**\n * Abstract buffered block algorithm template.\n *\n * The property blockSize must be implemented in a concrete subtype.\n *\n * @property {number} _minBufferSize\n *\n *     The number of blocks that should be kept unprocessed in the buffer. Default: 0\n */\nclass BufferedBlockAlgorithm extends Base {\n  constructor() {\n    super();\n    this._minBufferSize = 0;\n  }\n\n  /**\n   * Resets this block algorithm's data buffer to its initial state.\n   *\n   * @example\n   *\n   *     bufferedBlockAlgorithm.reset();\n   */\n  reset() {\n    // Initial values\n    this._data = new WordArray();\n    this._nDataBytes = 0;\n  }\n\n  /**\n   * Adds new data to this block algorithm's buffer.\n   *\n   * @param {WordArray|string} data\n   *\n   *     The data to append. Strings are converted to a WordArray using UTF-8.\n   *\n   * @example\n   *\n   *     bufferedBlockAlgorithm._append('data');\n   *     bufferedBlockAlgorithm._append(wordArray);\n   */\n  _append(data) {\n    let m_data = data;\n\n    // Convert string to WordArray, else assume WordArray already\n    if (typeof m_data === 'string') {\n      m_data = Utf8.parse(m_data);\n    }\n\n    // Append\n    this._data.concat(m_data);\n    this._nDataBytes += m_data.sigBytes;\n  }\n\n  /**\n   * Processes available data blocks.\n   *\n   * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n   *\n   * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n   *\n   * @return {WordArray} The processed data.\n   *\n   * @example\n   *\n   *     var processedData = bufferedBlockAlgorithm._process();\n   *     var processedData = bufferedBlockAlgorithm._process(!!'flush');\n   */\n  _process(doFlush) {\n    let processedWords;\n\n    // Shortcuts\n    const { _data: data, blockSize } = this;\n    const dataWords = data.words;\n    const dataSigBytes = data.sigBytes;\n    const blockSizeBytes = blockSize * 4;\n\n    // Count blocks ready\n    let nBlocksReady = dataSigBytes / blockSizeBytes;\n    if (doFlush) {\n      // Round up to include partial blocks\n      nBlocksReady = Math.ceil(nBlocksReady);\n    } else {\n      // Round down to include only full blocks,\n      // less the number of blocks that must remain in the buffer\n      nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n    }\n\n    // Count words ready\n    const nWordsReady = nBlocksReady * blockSize;\n\n    // Count bytes ready\n    const nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n    // Process blocks\n    if (nWordsReady) {\n      for (let offset = 0; offset < nWordsReady; offset += blockSize) {\n        // Perform concrete-algorithm logic\n        this._doProcessBlock(dataWords, offset);\n      }\n\n      // Remove processed words\n      processedWords = dataWords.splice(0, nWordsReady);\n      data.sigBytes -= nBytesReady;\n    }\n\n    // Return processed words\n    return new WordArray(processedWords, nBytesReady);\n  }\n\n  /**\n   * Creates a copy of this object.\n   *\n   * @return {Object} The clone.\n   *\n   * @example\n   *\n   *     var clone = bufferedBlockAlgorithm.clone();\n   */\n  clone() {\n    const clone = super.clone.call(this);\n    clone._data = this._data.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Abstract hasher template.\n *\n * @property {number} blockSize\n *\n *     The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n */\nclass Hasher extends BufferedBlockAlgorithm {\n  constructor(cfg) {\n    super();\n\n    this.blockSize = 512 / 32;\n\n    /**\n     * Configuration options.\n     */\n    this.cfg = Object.assign(new Base(), cfg);\n\n    // Set initial values\n    this.reset();\n  }\n\n  /**\n   * Creates a shortcut function to a hasher's object interface.\n   *\n   * @param {Hasher} SubHasher The hasher to create a helper for.\n   *\n   * @return {Function} The shortcut function.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n   */\n  static _createHelper(SubHasher) {\n    return (message, cfg) => new SubHasher(cfg).finalize(message);\n  }\n\n  /**\n   * Creates a shortcut function to the HMAC's object interface.\n   *\n   * @param {Hasher} SubHasher The hasher to use in this HMAC helper.\n   *\n   * @return {Function} The shortcut function.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n   */\n  static _createHmacHelper(SubHasher) {\n    return (message, key) => new HMAC(SubHasher, key).finalize(message);\n  }\n\n  /**\n   * Resets this hasher to its initial state.\n   *\n   * @example\n   *\n   *     hasher.reset();\n   */\n  reset() {\n    // Reset data buffer\n    super.reset.call(this);\n\n    // Perform concrete-hasher logic\n    this._doReset();\n  }\n\n  /**\n   * Updates this hasher with a message.\n   *\n   * @param {WordArray|string} messageUpdate The message to append.\n   *\n   * @return {Hasher} This hasher.\n   *\n   * @example\n   *\n   *     hasher.update('message');\n   *     hasher.update(wordArray);\n   */\n  update(messageUpdate) {\n    // Append\n    this._append(messageUpdate);\n\n    // Update the hash\n    this._process();\n\n    // Chainable\n    return this;\n  }\n\n  /**\n   * Finalizes the hash computation.\n   * Note that the finalize operation is effectively a destructive, read-once operation.\n   *\n   * @param {WordArray|string} messageUpdate (Optional) A final message update.\n   *\n   * @return {WordArray} The hash.\n   *\n   * @example\n   *\n   *     var hash = hasher.finalize();\n   *     var hash = hasher.finalize('message');\n   *     var hash = hasher.finalize(wordArray);\n   */\n  finalize(messageUpdate) {\n    // Final message update\n    if (messageUpdate) {\n      this._append(messageUpdate);\n    }\n\n    // Perform concrete-hasher logic\n    const hash = this._doFinalize();\n\n    return hash;\n  }\n}\n\n/**\n * HMAC algorithm.\n */\nclass HMAC extends Base {\n  /**\n   * Initializes a newly created HMAC.\n   *\n   * @param {Hasher} SubHasher The hash algorithm to use.\n   * @param {WordArray|string} key The secret key.\n   *\n   * @example\n   *\n   *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n   */\n  constructor(SubHasher, key) {\n    super();\n\n    const hasher = new SubHasher();\n    this._hasher = hasher;\n\n    // Convert string to WordArray, else assume WordArray already\n    let _key = key;\n    if (typeof _key === 'string') {\n      _key = Utf8.parse(_key);\n    }\n\n    // Shortcuts\n    const hasherBlockSize = hasher.blockSize;\n    const hasherBlockSizeBytes = hasherBlockSize * 4;\n\n    // Allow arbitrary length keys\n    if (_key.sigBytes > hasherBlockSizeBytes) {\n      _key = hasher.finalize(key);\n    }\n\n    // Clamp excess bits\n    _key.clamp();\n\n    // Clone key for inner and outer pads\n    const oKey = _key.clone();\n    this._oKey = oKey;\n    const iKey = _key.clone();\n    this._iKey = iKey;\n\n    // Shortcuts\n    const oKeyWords = oKey.words;\n    const iKeyWords = iKey.words;\n\n    // XOR keys with pad constants\n    for (let i = 0; i < hasherBlockSize; i += 1) {\n      oKeyWords[i] ^= 0x5c5c5c5c;\n      iKeyWords[i] ^= 0x36363636;\n    }\n    oKey.sigBytes = hasherBlockSizeBytes;\n    iKey.sigBytes = hasherBlockSizeBytes;\n\n    // Set initial values\n    this.reset();\n  }\n\n  /**\n   * Resets this HMAC to its initial state.\n   *\n   * @example\n   *\n   *     hmacHasher.reset();\n   */\n  reset() {\n    // Shortcut\n    const hasher = this._hasher;\n\n    // Reset\n    hasher.reset();\n    hasher.update(this._iKey);\n  }\n\n  /**\n   * Updates this HMAC with a message.\n   *\n   * @param {WordArray|string} messageUpdate The message to append.\n   *\n   * @return {HMAC} This HMAC instance.\n   *\n   * @example\n   *\n   *     hmacHasher.update('message');\n   *     hmacHasher.update(wordArray);\n   */\n  update(messageUpdate) {\n    this._hasher.update(messageUpdate);\n\n    // Chainable\n    return this;\n  }\n\n  /**\n   * Finalizes the HMAC computation.\n   * Note that the finalize operation is effectively a destructive, read-once operation.\n   *\n   * @param {WordArray|string} messageUpdate (Optional) A final message update.\n   *\n   * @return {WordArray} The HMAC.\n   *\n   * @example\n   *\n   *     var hmac = hmacHasher.finalize();\n   *     var hmac = hmacHasher.finalize('message');\n   *     var hmac = hmacHasher.finalize(wordArray);\n   */\n  finalize(messageUpdate) {\n    // Shortcut\n    const hasher = this._hasher;\n\n    // Compute HMAC\n    const innerHash = hasher.finalize(messageUpdate);\n    hasher.reset();\n    const hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n    return hmac;\n  }\n}\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/core.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/enc-base64.js":
/*!**************************************************!*\
  !*** ./node_modules/crypto-es/lib/enc-base64.js ***!
  \**************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Base64\": () => (/* binding */ Base64)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\nconst parseLoop = (base64Str, base64StrLength, reverseMap) => {\n  const words = [];\n  let nBytes = 0;\n  for (let i = 0; i < base64StrLength; i += 1) {\n    if (i % 4) {\n      const bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n      const bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n      const bitsCombined = bits1 | bits2;\n      words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);\n      nBytes += 1;\n    }\n  }\n  return _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(words, nBytes);\n};\n\n/**\n * Base64 encoding strategy.\n */\nconst Base64 = {\n  /**\n   * Converts a word array to a Base64 string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The Base64 string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const base64String = CryptoJS.enc.Base64.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    // Shortcuts\n    const { words, sigBytes } = wordArray;\n    const map = this._map;\n\n    // Clamp excess bits\n    wordArray.clamp();\n\n    // Convert\n    const base64Chars = [];\n    for (let i = 0; i < sigBytes; i += 3) {\n      const byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n      const byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n      const byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n      const triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n      for (let j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j += 1) {\n        base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n      }\n    }\n\n    // Add padding\n    const paddingChar = map.charAt(64);\n    if (paddingChar) {\n      while (base64Chars.length % 4) {\n        base64Chars.push(paddingChar);\n      }\n    }\n\n    return base64Chars.join('');\n  },\n\n  /**\n   * Converts a Base64 string to a word array.\n   *\n   * @param {string} base64Str The Base64 string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const wordArray = CryptoJS.enc.Base64.parse(base64String);\n   */\n  parse(base64Str) {\n    // Shortcuts\n    let base64StrLength = base64Str.length;\n    const map = this._map;\n    let reverseMap = this._reverseMap;\n\n    if (!reverseMap) {\n      this._reverseMap = [];\n      reverseMap = this._reverseMap;\n      for (let j = 0; j < map.length; j += 1) {\n        reverseMap[map.charCodeAt(j)] = j;\n      }\n    }\n\n    // Ignore padding\n    const paddingChar = map.charAt(64);\n    if (paddingChar) {\n      const paddingIndex = base64Str.indexOf(paddingChar);\n      if (paddingIndex !== -1) {\n        base64StrLength = paddingIndex;\n      }\n    }\n\n    // Convert\n    return parseLoop(base64Str, base64StrLength, reverseMap);\n  },\n\n  _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/enc-base64.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/enc-utf16.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-es/lib/enc-utf16.js ***!
  \*************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Utf16BE\": () => (/* binding */ Utf16BE),\n/* harmony export */   \"Utf16\": () => (/* binding */ Utf16),\n/* harmony export */   \"Utf16LE\": () => (/* binding */ Utf16LE)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\nconst swapEndian = word => ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);\n\n/**\n * UTF-16 BE encoding strategy.\n */\nconst Utf16BE = {\n  /**\n   * Converts a word array to a UTF-16 BE string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The UTF-16 BE string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const utf16String = CryptoJS.enc.Utf16.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    // Shortcuts\n    const { words, sigBytes } = wordArray;\n\n    // Convert\n    const utf16Chars = [];\n    for (let i = 0; i < sigBytes; i += 2) {\n      const codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;\n      utf16Chars.push(String.fromCharCode(codePoint));\n    }\n\n    return utf16Chars.join('');\n  },\n\n  /**\n   * Converts a UTF-16 BE string to a word array.\n   *\n   * @param {string} utf16Str The UTF-16 BE string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const wordArray = CryptoJS.enc.Utf16.parse(utf16String);\n   */\n  parse(utf16Str) {\n    // Shortcut\n    const utf16StrLength = utf16Str.length;\n\n    // Convert\n    const words = [];\n    for (let i = 0; i < utf16StrLength; i += 1) {\n      words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);\n    }\n\n    return _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(words, utf16StrLength * 2);\n  },\n};\nconst Utf16 = Utf16BE;\n\n/**\n * UTF-16 LE encoding strategy.\n */\nconst Utf16LE = {\n  /**\n   * Converts a word array to a UTF-16 LE string.\n   *\n   * @param {WordArray} wordArray The word array.\n   *\n   * @return {string} The UTF-16 LE string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);\n   */\n  stringify(wordArray) {\n    // Shortcuts\n    const { words, sigBytes } = wordArray;\n\n    // Convert\n    const utf16Chars = [];\n    for (let i = 0; i < sigBytes; i += 2) {\n      const codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);\n      utf16Chars.push(String.fromCharCode(codePoint));\n    }\n\n    return utf16Chars.join('');\n  },\n\n  /**\n   * Converts a UTF-16 LE string to a word array.\n   *\n   * @param {string} utf16Str The UTF-16 LE string.\n   *\n   * @return {WordArray} The word array.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     const wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);\n   */\n  parse(utf16Str) {\n    // Shortcut\n    const utf16StrLength = utf16Str.length;\n\n    // Convert\n    const words = [];\n    for (let i = 0; i < utf16StrLength; i += 1) {\n      words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));\n    }\n\n    return _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(words, utf16StrLength * 2);\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/enc-utf16.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/evpkdf.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/evpkdf.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"EvpKDFAlgo\": () => (/* binding */ EvpKDFAlgo),\n/* harmony export */   \"EvpKDF\": () => (/* binding */ EvpKDF)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ \"./node_modules/crypto-es/lib/md5.js\");\n\n\n\n/**\n * This key derivation function is meant to conform with EVP_BytesToKey.\n * www.openssl.org/docs/crypto/EVP_BytesToKey.html\n */\nclass EvpKDFAlgo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created key derivation function.\n   *\n   * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n   *\n   * @example\n   *\n   *     const kdf = CryptoJS.algo.EvpKDF.create();\n   *     const kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });\n   *     const kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });\n   */\n  constructor(cfg) {\n    super();\n\n    /**\n     * Configuration options.\n     *\n     * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n     * @property {Hasher} hasher The hash algorithm to use. Default: MD5\n     * @property {number} iterations The number of iterations to perform. Default: 1\n     */\n    this.cfg = Object.assign(\n      new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(),\n      {\n        keySize: 128 / 32,\n        hasher: _md5_js__WEBPACK_IMPORTED_MODULE_1__.MD5Algo,\n        iterations: 1,\n      },\n      cfg,\n    );\n  }\n\n  /**\n   * Derives a key from a password.\n   *\n   * @param {WordArray|string} password The password.\n   * @param {WordArray|string} salt A salt.\n   *\n   * @return {WordArray} The derived key.\n   *\n   * @example\n   *\n   *     const key = kdf.compute(password, salt);\n   */\n  compute(password, salt) {\n    let block;\n\n    // Shortcut\n    const { cfg } = this;\n\n    // Init hasher\n    const hasher = cfg.hasher.create();\n\n    // Initial values\n    const derivedKey = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create();\n\n    // Shortcuts\n    const derivedKeyWords = derivedKey.words;\n    const { keySize, iterations } = cfg;\n\n    // Generate key\n    while (derivedKeyWords.length < keySize) {\n      if (block) {\n        hasher.update(block);\n      }\n      block = hasher.update(password).finalize(salt);\n      hasher.reset();\n\n      // Iterations\n      for (let i = 1; i < iterations; i += 1) {\n        block = hasher.finalize(block);\n        hasher.reset();\n      }\n\n      derivedKey.concat(block);\n    }\n    derivedKey.sigBytes = keySize * 4;\n\n    return derivedKey;\n  }\n}\n\n/**\n * Derives a key from a password.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n * @param {Object} cfg (Optional) The configuration options to use for this computation.\n *\n * @return {WordArray} The derived key.\n *\n * @static\n *\n * @example\n *\n *     var key = CryptoJS.EvpKDF(password, salt);\n *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });\n *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });\n */\nconst EvpKDF = (password, salt, cfg) => EvpKDFAlgo.create(cfg).compute(password, salt);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/evpkdf.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/format-hex.js":
/*!**************************************************!*\
  !*** ./node_modules/crypto-es/lib/format-hex.js ***!
  \**************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"HexFormatter\": () => (/* binding */ HexFormatter)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n\nconst HexFormatter = {\n  /**\n   * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.\n   *\n   * @param {CipherParams} cipherParams The cipher params object.\n   *\n   * @return {string} The hexadecimally encoded string.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);\n   */\n  stringify(cipherParams) {\n    return cipherParams.ciphertext.toString(_core_js__WEBPACK_IMPORTED_MODULE_1__.Hex);\n  },\n\n  /**\n   * Converts a hexadecimally encoded ciphertext string to a cipher params object.\n   *\n   * @param {string} input The hexadecimally encoded string.\n   *\n   * @return {CipherParams} The cipher params object.\n   *\n   * @static\n   *\n   * @example\n   *\n   *     var cipherParams = CryptoJS.format.Hex.parse(hexString);\n   */\n  parse(input) {\n    const ciphertext = _core_js__WEBPACK_IMPORTED_MODULE_1__.Hex.parse(input);\n    return _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.CipherParams.create({ ciphertext });\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/format-hex.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/hmac.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-es/lib/hmac.js ***!
  \********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"HMAC\": () => (/* reexport safe */ _core_js__WEBPACK_IMPORTED_MODULE_0__.HMAC)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/hmac.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/index.js":
/*!*********************************************!*\
  !*** ./node_modules/crypto-es/lib/index.js ***!
  \*********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _x64_core_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./x64-core.js */ \"./node_modules/crypto-es/lib/x64-core.js\");\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n/* harmony import */ var _enc_utf16_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enc-utf16.js */ \"./node_modules/crypto-es/lib/enc-utf16.js\");\n/* harmony import */ var _enc_base64_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./enc-base64.js */ \"./node_modules/crypto-es/lib/enc-base64.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/crypto-es/lib/hmac.js\");\n/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./md5.js */ \"./node_modules/crypto-es/lib/md5.js\");\n/* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./sha1.js */ \"./node_modules/crypto-es/lib/sha1.js\");\n/* harmony import */ var _sha224_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./sha224.js */ \"./node_modules/crypto-es/lib/sha224.js\");\n/* harmony import */ var _sha256_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sha256.js */ \"./node_modules/crypto-es/lib/sha256.js\");\n/* harmony import */ var _sha384_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sha384.js */ \"./node_modules/crypto-es/lib/sha384.js\");\n/* harmony import */ var _sha512_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sha512.js */ \"./node_modules/crypto-es/lib/sha512.js\");\n/* harmony import */ var _sha3_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./sha3.js */ \"./node_modules/crypto-es/lib/sha3.js\");\n/* harmony import */ var _ripemd160_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ripemd160.js */ \"./node_modules/crypto-es/lib/ripemd160.js\");\n/* harmony import */ var _pbkdf2_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./pbkdf2.js */ \"./node_modules/crypto-es/lib/pbkdf2.js\");\n/* harmony import */ var _evpkdf_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./evpkdf.js */ \"./node_modules/crypto-es/lib/evpkdf.js\");\n/* harmony import */ var _aes_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./aes.js */ \"./node_modules/crypto-es/lib/aes.js\");\n/* harmony import */ var _tripledes_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./tripledes.js */ \"./node_modules/crypto-es/lib/tripledes.js\");\n/* harmony import */ var _rabbit_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./rabbit.js */ \"./node_modules/crypto-es/lib/rabbit.js\");\n/* harmony import */ var _rabbit_legacy_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./rabbit-legacy.js */ \"./node_modules/crypto-es/lib/rabbit-legacy.js\");\n/* harmony import */ var _rc4_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./rc4.js */ \"./node_modules/crypto-es/lib/rc4.js\");\n/* harmony import */ var _mode_cfb_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./mode-cfb.js */ \"./node_modules/crypto-es/lib/mode-cfb.js\");\n/* harmony import */ var _mode_ctr_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./mode-ctr.js */ \"./node_modules/crypto-es/lib/mode-ctr.js\");\n/* harmony import */ var _mode_ctr_gladman_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./mode-ctr-gladman.js */ \"./node_modules/crypto-es/lib/mode-ctr-gladman.js\");\n/* harmony import */ var _mode_ecb_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./mode-ecb.js */ \"./node_modules/crypto-es/lib/mode-ecb.js\");\n/* harmony import */ var _mode_ofb_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./mode-ofb.js */ \"./node_modules/crypto-es/lib/mode-ofb.js\");\n/* harmony import */ var _pad_ansix923_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./pad-ansix923.js */ \"./node_modules/crypto-es/lib/pad-ansix923.js\");\n/* harmony import */ var _pad_iso10126_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./pad-iso10126.js */ \"./node_modules/crypto-es/lib/pad-iso10126.js\");\n/* harmony import */ var _pad_iso97971_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./pad-iso97971.js */ \"./node_modules/crypto-es/lib/pad-iso97971.js\");\n/* harmony import */ var _pad_nopadding_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./pad-nopadding.js */ \"./node_modules/crypto-es/lib/pad-nopadding.js\");\n/* harmony import */ var _pad_zeropadding_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./pad-zeropadding.js */ \"./node_modules/crypto-es/lib/pad-zeropadding.js\");\n/* harmony import */ var _format_hex_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./format-hex.js */ \"./node_modules/crypto-es/lib/format-hex.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n  lib: {\n    Base: _core_js__WEBPACK_IMPORTED_MODULE_0__.Base,\n    WordArray: _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray,\n    BufferedBlockAlgorithm: _core_js__WEBPACK_IMPORTED_MODULE_0__.BufferedBlockAlgorithm,\n    Hasher: _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher,\n    Cipher: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.Cipher,\n    StreamCipher: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.StreamCipher,\n    BlockCipherMode: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.BlockCipherMode,\n    BlockCipher: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.BlockCipher,\n    CipherParams: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.CipherParams,\n    SerializableCipher: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.SerializableCipher,\n    PasswordBasedCipher: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.PasswordBasedCipher,\n  },\n\n  x64: {\n    Word: _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word,\n    WordArray: _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64WordArray,\n  },\n\n  enc: {\n    Hex: _core_js__WEBPACK_IMPORTED_MODULE_0__.Hex,\n    Latin1: _core_js__WEBPACK_IMPORTED_MODULE_0__.Latin1,\n    Utf8: _core_js__WEBPACK_IMPORTED_MODULE_0__.Utf8,\n    Utf16: _enc_utf16_js__WEBPACK_IMPORTED_MODULE_3__.Utf16,\n    Utf16BE: _enc_utf16_js__WEBPACK_IMPORTED_MODULE_3__.Utf16BE,\n    Utf16LE: _enc_utf16_js__WEBPACK_IMPORTED_MODULE_3__.Utf16LE,\n    Base64: _enc_base64_js__WEBPACK_IMPORTED_MODULE_4__.Base64,\n  },\n\n  algo: {\n    HMAC: _hmac_js__WEBPACK_IMPORTED_MODULE_5__.HMAC,\n    MD5: _md5_js__WEBPACK_IMPORTED_MODULE_6__.MD5Algo,\n    SHA1: _sha1_js__WEBPACK_IMPORTED_MODULE_7__.SHA1Algo,\n    SHA224: _sha224_js__WEBPACK_IMPORTED_MODULE_8__.SHA224Algo,\n    SHA256: _sha256_js__WEBPACK_IMPORTED_MODULE_9__.SHA256Algo,\n    SHA384: _sha384_js__WEBPACK_IMPORTED_MODULE_10__.SHA384Algo,\n    SHA512: _sha512_js__WEBPACK_IMPORTED_MODULE_11__.SHA512Algo,\n    SHA3: _sha3_js__WEBPACK_IMPORTED_MODULE_12__.SHA3Algo,\n    RIPEMD160: _ripemd160_js__WEBPACK_IMPORTED_MODULE_13__.RIPEMD160Algo,\n\n    PBKDF2: _pbkdf2_js__WEBPACK_IMPORTED_MODULE_14__.PBKDF2Algo,\n    EvpKDF: _evpkdf_js__WEBPACK_IMPORTED_MODULE_15__.EvpKDFAlgo,\n\n    AES: _aes_js__WEBPACK_IMPORTED_MODULE_16__.AESAlgo,\n    DES: _tripledes_js__WEBPACK_IMPORTED_MODULE_17__.DESAlgo,\n    TripleDES: _tripledes_js__WEBPACK_IMPORTED_MODULE_17__.TripleDESAlgo,\n    Rabbit: _rabbit_js__WEBPACK_IMPORTED_MODULE_18__.RabbitAlgo,\n    RabbitLegacy: _rabbit_legacy_js__WEBPACK_IMPORTED_MODULE_19__.RabbitLegacyAlgo,\n    RC4: _rc4_js__WEBPACK_IMPORTED_MODULE_20__.RC4Algo,\n    RC4Drop: _rc4_js__WEBPACK_IMPORTED_MODULE_20__.RC4DropAlgo,\n  },\n\n  mode: {\n    CBC: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.CBC,\n    CFB: _mode_cfb_js__WEBPACK_IMPORTED_MODULE_21__.CFB,\n    CTR: _mode_ctr_js__WEBPACK_IMPORTED_MODULE_22__.CTR,\n    CTRGladman: _mode_ctr_gladman_js__WEBPACK_IMPORTED_MODULE_23__.CTRGladman,\n    ECB: _mode_ecb_js__WEBPACK_IMPORTED_MODULE_24__.ECB,\n    OFB: _mode_ofb_js__WEBPACK_IMPORTED_MODULE_25__.OFB,\n  },\n\n  pad: {\n    Pkcs7: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.Pkcs7,\n    AnsiX923: _pad_ansix923_js__WEBPACK_IMPORTED_MODULE_26__.AnsiX923,\n    Iso10126: _pad_iso10126_js__WEBPACK_IMPORTED_MODULE_27__.Iso10126,\n    Iso97971: _pad_iso97971_js__WEBPACK_IMPORTED_MODULE_28__.Iso97971,\n    NoPadding: _pad_nopadding_js__WEBPACK_IMPORTED_MODULE_29__.NoPadding,\n    ZeroPadding: _pad_zeropadding_js__WEBPACK_IMPORTED_MODULE_30__.ZeroPadding,\n  },\n\n  format: {\n    OpenSSL: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.OpenSSLFormatter,\n    Hex: _format_hex_js__WEBPACK_IMPORTED_MODULE_31__.HexFormatter,\n  },\n\n  kdf: {\n    OpenSSL: _cipher_core_js__WEBPACK_IMPORTED_MODULE_2__.OpenSSLKdf,\n  },\n\n  MD5: _md5_js__WEBPACK_IMPORTED_MODULE_6__.MD5,\n  HmacMD5: _md5_js__WEBPACK_IMPORTED_MODULE_6__.HmacMD5,\n  SHA1: _sha1_js__WEBPACK_IMPORTED_MODULE_7__.SHA1,\n  HmacSHA1: _sha1_js__WEBPACK_IMPORTED_MODULE_7__.HmacSHA1,\n  SHA224: _sha224_js__WEBPACK_IMPORTED_MODULE_8__.SHA224,\n  HmacSHA224: _sha224_js__WEBPACK_IMPORTED_MODULE_8__.HmacSHA224,\n  SHA256: _sha256_js__WEBPACK_IMPORTED_MODULE_9__.SHA256,\n  HmacSHA256: _sha256_js__WEBPACK_IMPORTED_MODULE_9__.HmacSHA256,\n  SHA384: _sha384_js__WEBPACK_IMPORTED_MODULE_10__.SHA384,\n  HmacSHA384: _sha384_js__WEBPACK_IMPORTED_MODULE_10__.HmacSHA384,\n  SHA512: _sha512_js__WEBPACK_IMPORTED_MODULE_11__.SHA512,\n  HmacSHA512: _sha512_js__WEBPACK_IMPORTED_MODULE_11__.HmacSHA512,\n  SHA3: _sha3_js__WEBPACK_IMPORTED_MODULE_12__.SHA3,\n  HmacSHA3: _sha3_js__WEBPACK_IMPORTED_MODULE_12__.HmacSHA3,\n  RIPEMD160: _ripemd160_js__WEBPACK_IMPORTED_MODULE_13__.RIPEMD160,\n  HmacRIPEMD160: _ripemd160_js__WEBPACK_IMPORTED_MODULE_13__.HmacRIPEMD160,\n\n  PBKDF2: _pbkdf2_js__WEBPACK_IMPORTED_MODULE_14__.PBKDF2,\n  EvpKDF: _evpkdf_js__WEBPACK_IMPORTED_MODULE_15__.EvpKDF,\n\n  AES: _aes_js__WEBPACK_IMPORTED_MODULE_16__.AES,\n  DES: _tripledes_js__WEBPACK_IMPORTED_MODULE_17__.DES,\n  TripleDES: _tripledes_js__WEBPACK_IMPORTED_MODULE_17__.TripleDES,\n  Rabbit: _rabbit_js__WEBPACK_IMPORTED_MODULE_18__.Rabbit,\n  RabbitLegacy: _rabbit_legacy_js__WEBPACK_IMPORTED_MODULE_19__.RabbitLegacy,\n  RC4: _rc4_js__WEBPACK_IMPORTED_MODULE_20__.RC4,\n  RC4Drop: _rc4_js__WEBPACK_IMPORTED_MODULE_20__.RC4Drop,\n});\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/index.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/md5.js":
/*!*******************************************!*\
  !*** ./node_modules/crypto-es/lib/md5.js ***!
  \*******************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"MD5Algo\": () => (/* binding */ MD5Algo),\n/* harmony export */   \"MD5\": () => (/* binding */ MD5),\n/* harmony export */   \"HmacMD5\": () => (/* binding */ HmacMD5)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n// Constants table\nconst T = [];\n\n// Compute constants\nfor (let i = 0; i < 64; i += 1) {\n  T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;\n}\n\nconst FF = (a, b, c, d, x, s, t) => {\n  const n = a + ((b & c) | (~b & d)) + x + t;\n  return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst GG = (a, b, c, d, x, s, t) => {\n  const n = a + ((b & d) | (c & ~d)) + x + t;\n  return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst HH = (a, b, c, d, x, s, t) => {\n  const n = a + (b ^ c ^ d) + x + t;\n  return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst II = (a, b, c, d, x, s, t) => {\n  const n = a + (c ^ (b | ~d)) + x + t;\n  return ((n << s) | (n >>> (32 - s))) + b;\n};\n\n/**\n * MD5 hash algorithm.\n */\nclass MD5Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  _doReset() {\n    this._hash = new _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray([\n      0x67452301,\n      0xefcdab89,\n      0x98badcfe,\n      0x10325476,\n    ]);\n  }\n\n  _doProcessBlock(M, offset) {\n    const _M = M;\n\n    // Swap endian\n    for (let i = 0; i < 16; i += 1) {\n      // Shortcuts\n      const offset_i = offset + i;\n      const M_offset_i = M[offset_i];\n\n      _M[offset_i] = (\n        (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff)\n          | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n      );\n    }\n\n    // Shortcuts\n    const H = this._hash.words;\n\n    const M_offset_0 = _M[offset + 0];\n    const M_offset_1 = _M[offset + 1];\n    const M_offset_2 = _M[offset + 2];\n    const M_offset_3 = _M[offset + 3];\n    const M_offset_4 = _M[offset + 4];\n    const M_offset_5 = _M[offset + 5];\n    const M_offset_6 = _M[offset + 6];\n    const M_offset_7 = _M[offset + 7];\n    const M_offset_8 = _M[offset + 8];\n    const M_offset_9 = _M[offset + 9];\n    const M_offset_10 = _M[offset + 10];\n    const M_offset_11 = _M[offset + 11];\n    const M_offset_12 = _M[offset + 12];\n    const M_offset_13 = _M[offset + 13];\n    const M_offset_14 = _M[offset + 14];\n    const M_offset_15 = _M[offset + 15];\n\n    // Working varialbes\n    let a = H[0];\n    let b = H[1];\n    let c = H[2];\n    let d = H[3];\n\n    // Computation\n    a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n    d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n    c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n    b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n    a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n    d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n    c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n    b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n    a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n    d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n    c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n    b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n    a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n    d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n    c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n    b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n\n    a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n    d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n    c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n    b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n    a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n    d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n    c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n    b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n    a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n    d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n    c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n    b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n    a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n    d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n    c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n    b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n\n    a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n    d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n    c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n    b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n    a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n    d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n    c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n    b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n    a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n    d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n    c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n    b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n    a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n    d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n    c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n    b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n\n    a = II(a, b, c, d, M_offset_0, 6, T[48]);\n    d = II(d, a, b, c, M_offset_7, 10, T[49]);\n    c = II(c, d, a, b, M_offset_14, 15, T[50]);\n    b = II(b, c, d, a, M_offset_5, 21, T[51]);\n    a = II(a, b, c, d, M_offset_12, 6, T[52]);\n    d = II(d, a, b, c, M_offset_3, 10, T[53]);\n    c = II(c, d, a, b, M_offset_10, 15, T[54]);\n    b = II(b, c, d, a, M_offset_1, 21, T[55]);\n    a = II(a, b, c, d, M_offset_8, 6, T[56]);\n    d = II(d, a, b, c, M_offset_15, 10, T[57]);\n    c = II(c, d, a, b, M_offset_6, 15, T[58]);\n    b = II(b, c, d, a, M_offset_13, 21, T[59]);\n    a = II(a, b, c, d, M_offset_4, 6, T[60]);\n    d = II(d, a, b, c, M_offset_11, 10, T[61]);\n    c = II(c, d, a, b, M_offset_2, 15, T[62]);\n    b = II(b, c, d, a, M_offset_9, 21, T[63]);\n\n    // Intermediate hash value\n    H[0] = (H[0] + a) | 0;\n    H[1] = (H[1] + b) | 0;\n    H[2] = (H[2] + c) | 0;\n    H[3] = (H[3] + d) | 0;\n  }\n  /* eslint-ensable no-param-reassign */\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n\n    const nBitsTotal = this._nDataBytes * 8;\n    const nBitsLeft = data.sigBytes * 8;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n\n    const nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n    const nBitsTotalL = nBitsTotal;\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (\n      (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff)\n        | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)\n    );\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n      (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff)\n        | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)\n    );\n\n    data.sigBytes = (dataWords.length + 1) * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Shortcuts\n    const hash = this._hash;\n    const H = hash.words;\n\n    // Swap endian\n    for (let i = 0; i < 4; i += 1) {\n      // Shortcut\n      const H_i = H[i];\n\n      H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff)\n        | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n    }\n\n    // Return final computed hash\n    return hash;\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n    clone._hash = this._hash.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.MD5('message');\n *     var hash = CryptoJS.MD5(wordArray);\n */\nconst MD5 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(MD5Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacMD5(message, key);\n */\nconst HmacMD5 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(MD5Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/md5.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/mode-cfb.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-es/lib/mode-cfb.js ***!
  \************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"CFB\": () => (/* binding */ CFB)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\nfunction generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {\n  const _words = words;\n  let keystream;\n\n  // Shortcut\n  const iv = this._iv;\n\n  // Generate keystream\n  if (iv) {\n    keystream = iv.slice(0);\n\n    // Remove IV for subsequent blocks\n    this._iv = undefined;\n  } else {\n    keystream = this._prevBlock;\n  }\n  cipher.encryptBlock(keystream, 0);\n\n  // Encrypt\n  for (let i = 0; i < blockSize; i += 1) {\n    _words[offset + i] ^= keystream[i];\n  }\n}\n\n/**\n * Cipher Feedback block mode.\n */\nclass CFB extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipherMode {\n}\nCFB.Encryptor = class extends CFB {\n  processBlock(words, offset) {\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n\n    generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);\n\n    // Remember this block to use with next block\n    this._prevBlock = words.slice(offset, offset + blockSize);\n  }\n};\nCFB.Decryptor = class extends CFB {\n  processBlock(words, offset) {\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n\n    // Remember this block to use with next block\n    const thisBlock = words.slice(offset, offset + blockSize);\n\n    generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);\n\n    // This block becomes the previous block\n    this._prevBlock = thisBlock;\n  }\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/mode-cfb.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/mode-ctr-gladman.js":
/*!********************************************************!*\
  !*** ./node_modules/crypto-es/lib/mode-ctr-gladman.js ***!
  \********************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"CTRGladman\": () => (/* binding */ CTRGladman)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\nconst incWord = (word) => {\n  let _word = word;\n\n  if (((word >> 24) & 0xff) === 0xff) { // overflow\n    let b1 = (word >> 16) & 0xff;\n    let b2 = (word >> 8) & 0xff;\n    let b3 = word & 0xff;\n\n    if (b1 === 0xff) { // overflow b1\n      b1 = 0;\n      if (b2 === 0xff) {\n        b2 = 0;\n        if (b3 === 0xff) {\n          b3 = 0;\n        } else {\n          b3 += 1;\n        }\n      } else {\n        b2 += 1;\n      }\n    } else {\n      b1 += 1;\n    }\n\n    _word = 0;\n    _word += (b1 << 16);\n    _word += (b2 << 8);\n    _word += b3;\n  } else {\n    _word += (0x01 << 24);\n  }\n  return _word;\n};\n\nconst incCounter = (counter) => {\n  const _counter = counter;\n  _counter[0] = incWord(_counter[0]);\n\n  if (_counter[0] === 0) {\n    // encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8\n    _counter[1] = incWord(_counter[1]);\n  }\n  return _counter;\n};\n\n/** @preserve\n * Counter block mode compatible with  Dr Brian Gladman fileenc.c\n * derived from CryptoJS.mode.CTR\n * Jan Hruby jhruby.web@gmail.com\n */\nclass CTRGladman extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipherMode {\n}\nCTRGladman.Encryptor = class extends CTRGladman {\n  processBlock(words, offset) {\n    const _words = words;\n\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n    const iv = this._iv;\n    let counter = this._counter;\n\n    // Generate keystream\n    if (iv) {\n      this._counter = iv.slice(0);\n      counter = this._counter;\n\n      // Remove IV for subsequent blocks\n      this._iv = undefined;\n    }\n\n    incCounter(counter);\n\n    const keystream = counter.slice(0);\n    cipher.encryptBlock(keystream, 0);\n\n    // Encrypt\n    for (let i = 0; i < blockSize; i += 1) {\n      _words[offset + i] ^= keystream[i];\n    }\n  }\n};\nCTRGladman.Decryptor = CTRGladman.Encryptor;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/mode-ctr-gladman.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/mode-ctr.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-es/lib/mode-ctr.js ***!
  \************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"CTR\": () => (/* binding */ CTR)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n/**\n * Counter block mode.\n */\n\n\nclass CTR extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipherMode {\n}\nCTR.Encryptor = class extends CTR {\n  processBlock(words, offset) {\n    const _words = words;\n\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n    const iv = this._iv;\n    let counter = this._counter;\n\n    // Generate keystream\n    if (iv) {\n      this._counter = iv.slice(0);\n      counter = this._counter;\n\n      // Remove IV for subsequent blocks\n      this._iv = undefined;\n    }\n    const keystream = counter.slice(0);\n    cipher.encryptBlock(keystream, 0);\n\n    // Increment counter\n    counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0;\n\n    // Encrypt\n    for (let i = 0; i < blockSize; i += 1) {\n      _words[offset + i] ^= keystream[i];\n    }\n  }\n};\nCTR.Decryptor = CTR.Encryptor;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/mode-ctr.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/mode-ecb.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-es/lib/mode-ecb.js ***!
  \************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"ECB\": () => (/* binding */ ECB)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n/**\n * Electronic Codebook block mode.\n */\n\n\nclass ECB extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipherMode {\n}\nECB.Encryptor = class extends ECB {\n  processBlock(words, offset) {\n    this._cipher.encryptBlock(words, offset);\n  }\n};\nECB.Decryptor = class extends ECB {\n  processBlock(words, offset) {\n    this._cipher.decryptBlock(words, offset);\n  }\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/mode-ecb.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/mode-ofb.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-es/lib/mode-ofb.js ***!
  \************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"OFB\": () => (/* binding */ OFB)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n/**\n * Output Feedback block mode.\n */\n\n\nclass OFB extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.BlockCipherMode {\n}\nOFB.Encryptor = class extends OFB {\n  processBlock(words, offset) {\n    const _words = words;\n\n    // Shortcuts\n    const cipher = this._cipher;\n    const { blockSize } = cipher;\n    const iv = this._iv;\n    let keystream = this._keystream;\n\n    // Generate keystream\n    if (iv) {\n      this._keystream = iv.slice(0);\n      keystream = this._keystream;\n\n      // Remove IV for subsequent blocks\n      this._iv = undefined;\n    }\n    cipher.encryptBlock(keystream, 0);\n\n    // Encrypt\n    for (let i = 0; i < blockSize; i += 1) {\n      _words[offset + i] ^= keystream[i];\n    }\n  }\n};\nOFB.Decryptor = OFB.Encryptor;\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/mode-ofb.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pad-ansix923.js":
/*!****************************************************!*\
  !*** ./node_modules/crypto-es/lib/pad-ansix923.js ***!
  \****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"AnsiX923\": () => (/* binding */ AnsiX923)\n/* harmony export */ });\n/**\n * ANSI X.923 padding strategy.\n */\nconst AnsiX923 = {\n  pad(data, blockSize) {\n    const _data = data;\n\n    // Shortcuts\n    const dataSigBytes = _data.sigBytes;\n    const blockSizeBytes = blockSize * 4;\n\n    // Count padding bytes\n    const nPaddingBytes = blockSizeBytes - (dataSigBytes % blockSizeBytes);\n\n    // Compute last byte position\n    const lastBytePos = dataSigBytes + nPaddingBytes - 1;\n\n    // Pad\n    _data.clamp();\n    _data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);\n    _data.sigBytes += nPaddingBytes;\n  },\n\n  unpad(data) {\n    const _data = data;\n\n    // Get number of padding bytes from last byte\n    const nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;\n\n    // Remove padding\n    _data.sigBytes -= nPaddingBytes;\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pad-ansix923.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pad-iso10126.js":
/*!****************************************************!*\
  !*** ./node_modules/crypto-es/lib/pad-iso10126.js ***!
  \****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Iso10126\": () => (/* binding */ Iso10126)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n/**\n * ISO 10126 padding strategy.\n */\nconst Iso10126 = {\n  pad(data, blockSize) {\n    // Shortcut\n    const blockSizeBytes = blockSize * 4;\n\n    // Count padding bytes\n    const nPaddingBytes = blockSizeBytes - (data.sigBytes % blockSizeBytes);\n\n    // Pad\n    data\n      .concat(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.random(nPaddingBytes - 1))\n      .concat(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([nPaddingBytes << 24], 1));\n  },\n\n  unpad(data) {\n    const _data = data;\n    // Get number of padding bytes from last byte\n    const nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;\n\n    // Remove padding\n    _data.sigBytes -= nPaddingBytes;\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pad-iso10126.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pad-iso97971.js":
/*!****************************************************!*\
  !*** ./node_modules/crypto-es/lib/pad-iso97971.js ***!
  \****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Iso97971\": () => (/* binding */ Iso97971)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _pad_zeropadding_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pad-zeropadding.js */ \"./node_modules/crypto-es/lib/pad-zeropadding.js\");\n\n\n\n/**\n * ISO/IEC 9797-1 Padding Method 2.\n */\nconst Iso97971 = {\n  pad(data, blockSize) {\n    // Add 0x80 byte\n    data.concat(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x80000000], 1));\n\n    // Zero pad the rest\n    _pad_zeropadding_js__WEBPACK_IMPORTED_MODULE_1__.ZeroPadding.pad(data, blockSize);\n  },\n\n  unpad(data) {\n    const _data = data;\n\n    // Remove zero padding\n    _pad_zeropadding_js__WEBPACK_IMPORTED_MODULE_1__.ZeroPadding.unpad(_data);\n\n    // Remove one more byte -- the 0x80 byte\n    _data.sigBytes -= 1;\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pad-iso97971.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pad-nopadding.js":
/*!*****************************************************!*\
  !*** ./node_modules/crypto-es/lib/pad-nopadding.js ***!
  \*****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"NoPadding\": () => (/* binding */ NoPadding)\n/* harmony export */ });\n/**\n * A noop padding strategy.\n */\nconst NoPadding = {\n  pad() {\n  },\n\n  unpad() {\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pad-nopadding.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pad-zeropadding.js":
/*!*******************************************************!*\
  !*** ./node_modules/crypto-es/lib/pad-zeropadding.js ***!
  \*******************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"ZeroPadding\": () => (/* binding */ ZeroPadding)\n/* harmony export */ });\n/**\n * Zero padding strategy.\n */\nconst ZeroPadding = {\n  pad(data, blockSize) {\n    const _data = data;\n\n    // Shortcut\n    const blockSizeBytes = blockSize * 4;\n\n    // Pad\n    _data.clamp();\n    _data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);\n  },\n\n  unpad(data) {\n    const _data = data;\n\n    // Shortcut\n    const dataWords = _data.words;\n\n    // Unpad\n    for (let i = _data.sigBytes - 1; i >= 0; i -= 1) {\n      if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {\n        _data.sigBytes = i + 1;\n        break;\n      }\n    }\n  },\n};\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pad-zeropadding.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/pbkdf2.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/pbkdf2.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"PBKDF2Algo\": () => (/* binding */ PBKDF2Algo),\n/* harmony export */   \"PBKDF2\": () => (/* binding */ PBKDF2)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha1.js */ \"./node_modules/crypto-es/lib/sha1.js\");\n/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hmac.js */ \"./node_modules/crypto-es/lib/hmac.js\");\n\n\n\n\n/**\n * Password-Based Key Derivation Function 2 algorithm.\n */\nclass PBKDF2Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created key derivation function.\n   *\n   * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n   *\n   * @example\n   *\n   *     const kdf = CryptoJS.algo.PBKDF2.create();\n   *     const kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });\n   *     const kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });\n   */\n  constructor(cfg) {\n    super();\n\n    /**\n     * Configuration options.\n     *\n     * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n     * @property {Hasher} hasher The hasher to use. Default: SHA1\n     * @property {number} iterations The number of iterations to perform. Default: 1\n     */\n    this.cfg = Object.assign(\n      new _core_js__WEBPACK_IMPORTED_MODULE_0__.Base(),\n      {\n        keySize: 128 / 32,\n        hasher: _sha1_js__WEBPACK_IMPORTED_MODULE_1__.SHA1Algo,\n        iterations: 1,\n      },\n      cfg,\n    );\n  }\n\n  /**\n   * Computes the Password-Based Key Derivation Function 2.\n   *\n   * @param {WordArray|string} password The password.\n   * @param {WordArray|string} salt A salt.\n   *\n   * @return {WordArray} The derived key.\n   *\n   * @example\n   *\n   *     const key = kdf.compute(password, salt);\n   */\n  compute(password, salt) {\n    // Shortcut\n    const { cfg } = this;\n\n    // Init HMAC\n    const hmac = _hmac_js__WEBPACK_IMPORTED_MODULE_2__.HMAC.create(cfg.hasher, password);\n\n    // Initial values\n    const derivedKey = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create();\n    const blockIndex = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x00000001]);\n\n    // Shortcuts\n    const derivedKeyWords = derivedKey.words;\n    const blockIndexWords = blockIndex.words;\n    const { keySize, iterations } = cfg;\n\n    // Generate key\n    while (derivedKeyWords.length < keySize) {\n      const block = hmac.update(salt).finalize(blockIndex);\n      hmac.reset();\n\n      // Shortcuts\n      const blockWords = block.words;\n      const blockWordsLength = blockWords.length;\n\n      // Iterations\n      let intermediate = block;\n      for (let i = 1; i < iterations; i += 1) {\n        intermediate = hmac.finalize(intermediate);\n        hmac.reset();\n\n        // Shortcut\n        const intermediateWords = intermediate.words;\n\n        // XOR intermediate with block\n        for (let j = 0; j < blockWordsLength; j += 1) {\n          blockWords[j] ^= intermediateWords[j];\n        }\n      }\n\n      derivedKey.concat(block);\n      blockIndexWords[0] += 1;\n    }\n    derivedKey.sigBytes = keySize * 4;\n\n    return derivedKey;\n  }\n}\n\n/**\n * Computes the Password-Based Key Derivation Function 2.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n * @param {Object} cfg (Optional) The configuration options to use for this computation.\n *\n * @return {WordArray} The derived key.\n *\n * @static\n *\n * @example\n *\n *     var key = CryptoJS.PBKDF2(password, salt);\n *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });\n *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });\n */\nconst PBKDF2 = (password, salt, cfg) => PBKDF2Algo.create(cfg).compute(password, salt);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/pbkdf2.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/rabbit-legacy.js":
/*!*****************************************************!*\
  !*** ./node_modules/crypto-es/lib/rabbit-legacy.js ***!
  \*****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"RabbitLegacyAlgo\": () => (/* binding */ RabbitLegacyAlgo),\n/* harmony export */   \"RabbitLegacy\": () => (/* binding */ RabbitLegacy)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\n// Reusable objects\nconst S = [];\nconst C_ = [];\nconst G = [];\n\nfunction nextState() {\n  // Shortcuts\n  const X = this._X;\n  const C = this._C;\n\n  // Save old counter values\n  for (let i = 0; i < 8; i += 1) {\n    C_[i] = C[i];\n  }\n\n  // Calculate new counter values\n  C[0] = (C[0] + 0x4d34d34d + this._b) | 0;\n  C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;\n  C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;\n  C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;\n  C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;\n  C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;\n  C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;\n  C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;\n  this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;\n\n  // Calculate the g-values\n  for (let i = 0; i < 8; i += 1) {\n    const gx = X[i] + C[i];\n\n    // Construct high and low argument for squaring\n    const ga = gx & 0xffff;\n    const gb = gx >>> 16;\n\n    // Calculate high and low result of squaring\n    const gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;\n    const gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);\n\n    // High XOR low\n    G[i] = gh ^ gl;\n  }\n\n  // Calculate new state values\n  X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;\n  X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;\n  X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;\n  X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;\n  X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;\n  X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;\n  X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;\n  X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;\n}\n\n/**\n * Rabbit stream cipher algorithm.\n *\n * This is a legacy version that neglected to convert the key to little-endian.\n * This error doesn't affect the cipher's security,\n * but it does affect its compatibility with other implementations.\n */\nclass RabbitLegacyAlgo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher {\n  constructor(...args) {\n    super(...args);\n\n    this.blockSize = 128 / 32;\n    this.ivSize = 64 / 32;\n  }\n\n  _doReset() {\n    // Shortcuts\n    const K = this._key.words;\n    const { iv } = this.cfg;\n\n    // Generate initial state values\n    this._X = [\n      K[0], (K[3] << 16) | (K[2] >>> 16),\n      K[1], (K[0] << 16) | (K[3] >>> 16),\n      K[2], (K[1] << 16) | (K[0] >>> 16),\n      K[3], (K[2] << 16) | (K[1] >>> 16),\n    ];\n    const X = this._X;\n\n    // Generate initial counter values\n    this._C = [\n      (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),\n      (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),\n      (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),\n      (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff),\n    ];\n    const C = this._C;\n\n    // Carry bit\n    this._b = 0;\n\n    // Iterate the system four times\n    for (let i = 0; i < 4; i += 1) {\n      nextState.call(this);\n    }\n\n    // Modify the counters\n    for (let i = 0; i < 8; i += 1) {\n      C[i] ^= X[(i + 4) & 7];\n    }\n\n    // IV setup\n    if (iv) {\n      // Shortcuts\n      const IV = iv.words;\n      const IV_0 = IV[0];\n      const IV_1 = IV[1];\n\n      // Generate four subvectors\n      const i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff)\n        | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);\n      const i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff)\n        | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);\n      const i1 = (i0 >>> 16) | (i2 & 0xffff0000);\n      const i3 = (i2 << 16) | (i0 & 0x0000ffff);\n\n      // Modify counter values\n      C[0] ^= i0;\n      C[1] ^= i1;\n      C[2] ^= i2;\n      C[3] ^= i3;\n      C[4] ^= i0;\n      C[5] ^= i1;\n      C[6] ^= i2;\n      C[7] ^= i3;\n\n      // Iterate the system four times\n      for (let i = 0; i < 4; i += 1) {\n        nextState.call(this);\n      }\n    }\n  }\n\n  _doProcessBlock(M, offset) {\n    const _M = M;\n\n    // Shortcut\n    const X = this._X;\n\n    // Iterate the system\n    nextState.call(this);\n\n    // Generate four keystream words\n    S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);\n    S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);\n    S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);\n    S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);\n\n    for (let i = 0; i < 4; i += 1) {\n      // Swap endian\n      S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff)\n        | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);\n\n      // Encrypt\n      _M[offset + i] ^= S[i];\n    }\n  }\n}\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);\n */\nconst RabbitLegacy = _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher._createHelper(RabbitLegacyAlgo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/rabbit-legacy.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/rabbit.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/rabbit.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"RabbitAlgo\": () => (/* binding */ RabbitAlgo),\n/* harmony export */   \"Rabbit\": () => (/* binding */ Rabbit)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\n// Reusable objects\nconst S = [];\nconst C_ = [];\nconst G = [];\n\nfunction nextState() {\n  // Shortcuts\n  const X = this._X;\n  const C = this._C;\n\n  // Save old counter values\n  for (let i = 0; i < 8; i += 1) {\n    C_[i] = C[i];\n  }\n\n  // Calculate new counter values\n  C[0] = (C[0] + 0x4d34d34d + this._b) | 0;\n  C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;\n  C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;\n  C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;\n  C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;\n  C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;\n  C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;\n  C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;\n  this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;\n\n  // Calculate the g-values\n  for (let i = 0; i < 8; i += 1) {\n    const gx = X[i] + C[i];\n\n    // Construct high and low argument for squaring\n    const ga = gx & 0xffff;\n    const gb = gx >>> 16;\n\n    // Calculate high and low result of squaring\n    const gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;\n    const gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);\n\n    // High XOR low\n    G[i] = gh ^ gl;\n  }\n\n  // Calculate new state values\n  X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;\n  X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;\n  X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;\n  X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;\n  X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;\n  X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;\n  X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;\n  X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;\n}\n\n/**\n * Rabbit stream cipher algorithm\n */\nclass RabbitAlgo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher {\n  constructor(...args) {\n    super(...args);\n\n    this.blockSize = 128 / 32;\n    this.ivSize = 64 / 32;\n  }\n\n  _doReset() {\n    // Shortcuts\n    const K = this._key.words;\n    const { iv } = this.cfg;\n\n    // Swap endian\n    for (let i = 0; i < 4; i += 1) {\n      K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff)\n        | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);\n    }\n\n    // Generate initial state values\n    this._X = [\n      K[0], (K[3] << 16) | (K[2] >>> 16),\n      K[1], (K[0] << 16) | (K[3] >>> 16),\n      K[2], (K[1] << 16) | (K[0] >>> 16),\n      K[3], (K[2] << 16) | (K[1] >>> 16),\n    ];\n    const X = this._X;\n\n    // Generate initial counter values\n    this._C = [\n      (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),\n      (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),\n      (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),\n      (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff),\n    ];\n    const C = this._C;\n\n    // Carry bit\n    this._b = 0;\n\n    // Iterate the system four times\n    for (let i = 0; i < 4; i += 1) {\n      nextState.call(this);\n    }\n\n    // Modify the counters\n    for (let i = 0; i < 8; i += 1) {\n      C[i] ^= X[(i + 4) & 7];\n    }\n\n    // IV setup\n    if (iv) {\n      // Shortcuts\n      const IV = iv.words;\n      const IV_0 = IV[0];\n      const IV_1 = IV[1];\n\n      // Generate four subvectors\n      const i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff)\n        | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);\n      const i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff)\n        | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);\n      const i1 = (i0 >>> 16) | (i2 & 0xffff0000);\n      const i3 = (i2 << 16) | (i0 & 0x0000ffff);\n\n      // Modify counter values\n      C[0] ^= i0;\n      C[1] ^= i1;\n      C[2] ^= i2;\n      C[3] ^= i3;\n      C[4] ^= i0;\n      C[5] ^= i1;\n      C[6] ^= i2;\n      C[7] ^= i3;\n\n      // Iterate the system four times\n      for (let i = 0; i < 4; i += 1) {\n        nextState.call(this);\n      }\n    }\n  }\n\n  _doProcessBlock(M, offset) {\n    const _M = M;\n\n    // Shortcut\n    const X = this._X;\n\n    // Iterate the system\n    nextState.call(this);\n\n    // Generate four keystream words\n    S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);\n    S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);\n    S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);\n    S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);\n\n    for (let i = 0; i < 4; i += 1) {\n      // Swap endian\n      S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff)\n        | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);\n\n      // Encrypt\n      _M[offset + i] ^= S[i];\n    }\n  }\n}\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);\n */\nconst Rabbit = _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher._createHelper(RabbitAlgo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/rabbit.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/rc4.js":
/*!*******************************************!*\
  !*** ./node_modules/crypto-es/lib/rc4.js ***!
  \*******************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"RC4Algo\": () => (/* binding */ RC4Algo),\n/* harmony export */   \"RC4\": () => (/* binding */ RC4),\n/* harmony export */   \"RC4DropAlgo\": () => (/* binding */ RC4DropAlgo),\n/* harmony export */   \"RC4Drop\": () => (/* binding */ RC4Drop)\n/* harmony export */ });\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\nfunction generateKeystreamWord() {\n  // Shortcuts\n  const S = this._S;\n  let i = this._i;\n  let j = this._j;\n\n  // Generate keystream word\n  let keystreamWord = 0;\n  for (let n = 0; n < 4; n += 1) {\n    i = (i + 1) % 256;\n    j = (j + S[i]) % 256;\n\n    // Swap\n    const t = S[i];\n    S[i] = S[j];\n    S[j] = t;\n\n    keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);\n  }\n\n  // Update counters\n  this._i = i;\n  this._j = j;\n\n  return keystreamWord;\n}\n\n/**\n * RC4 stream cipher algorithm.\n */\nclass RC4Algo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher {\n  _doReset() {\n    // Shortcuts\n    const key = this._key;\n    const keyWords = key.words;\n    const keySigBytes = key.sigBytes;\n\n    // Init sbox\n    this._S = [];\n    const S = this._S;\n    for (let i = 0; i < 256; i += 1) {\n      S[i] = i;\n    }\n\n    // Key setup\n    for (let i = 0, j = 0; i < 256; i += 1) {\n      const keyByteIndex = i % keySigBytes;\n      const keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;\n\n      j = (j + S[i] + keyByte) % 256;\n\n      // Swap\n      const t = S[i];\n      S[i] = S[j];\n      S[j] = t;\n    }\n\n    // Counters\n    this._j = 0;\n    this._i = this._j;\n  }\n\n  _doProcessBlock(M, offset) {\n    const _M = M;\n\n    _M[offset] ^= generateKeystreamWord.call(this);\n  }\n}\nRC4Algo.keySize = 256 / 32;\nRC4Algo.ivSize = 0;\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);\n */\nconst RC4 = _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher._createHelper(RC4Algo);\n\n/**\n * Modified RC4 stream cipher algorithm.\n */\nclass RC4DropAlgo extends RC4Algo {\n  constructor(...args) {\n    super(...args);\n\n    /**\n     * Configuration options.\n     *\n     * @property {number} drop The number of keystream words to drop. Default 192\n     */\n    Object.assign(this.cfg, { drop: 192 });\n  }\n\n  _doReset() {\n    super._doReset.call(this);\n\n    // Drop\n    for (let i = this.cfg.drop; i > 0; i -= 1) {\n      generateKeystreamWord.call(this);\n    }\n  }\n}\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);\n */\nconst RC4Drop = _cipher_core_js__WEBPACK_IMPORTED_MODULE_0__.StreamCipher._createHelper(RC4DropAlgo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/rc4.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/ripemd160.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-es/lib/ripemd160.js ***!
  \*************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"RIPEMD160Algo\": () => (/* binding */ RIPEMD160Algo),\n/* harmony export */   \"RIPEMD160\": () => (/* binding */ RIPEMD160),\n/* harmony export */   \"HmacRIPEMD160\": () => (/* binding */ HmacRIPEMD160)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/** @preserve\n(c) 2012 by Cédric Mesnil. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted\nprovided that the following conditions are met:\n\n    - Redistributions of source code must retain the above copyright notice, this list of\n    conditions and the following disclaimer.\n    - Redistributions in binary form must reproduce the above copyright notice, this list\n    of conditions and the following disclaimer in the documentation and/or other materials\n    provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\nWAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n\n\n// Constants table\nconst _zl = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([\n  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n  7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n  3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n  1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n  4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);\nconst _zr = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([\n  5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n  6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n  15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n  8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n  12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);\nconst _sl = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([\n  11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n  7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n  11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n  11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n  9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]);\nconst _sr = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([\n  8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n  9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n  9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n  15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n  8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]);\n\nconst _hl = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);\nconst _hr = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);\n\nconst f1 = (x, y, z) => (x) ^ (y) ^ (z);\n\nconst f2 = (x, y, z) => ((x) & (y)) | ((~x) & (z));\n\nconst f3 = (x, y, z) => ((x) | (~(y))) ^ (z);\n\nconst f4 = (x, y, z) => ((x) & (z)) | ((y) & (~(z)));\n\nconst f5 = (x, y, z) => (x) ^ ((y) | (~(z)));\n\nconst rotl = (x, n) => (x << n) | (x >>> (32 - n));\n\n/**\n * RIPEMD160 hash algorithm.\n */\nclass RIPEMD160Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  _doReset() {\n    this._hash = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);\n  }\n\n  _doProcessBlock(M, offset) {\n    const _M = M;\n\n    // Swap endian\n    for (let i = 0; i < 16; i += 1) {\n      // Shortcuts\n      const offset_i = offset + i;\n      const M_offset_i = _M[offset_i];\n\n      // Swap\n      _M[offset_i] = (\n        (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff)\n          | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n      );\n    }\n    // Shortcut\n    const H = this._hash.words;\n    const hl = _hl.words;\n    const hr = _hr.words;\n    const zl = _zl.words;\n    const zr = _zr.words;\n    const sl = _sl.words;\n    const sr = _sr.words;\n\n    // Working variables\n    let al = H[0];\n    let bl = H[1];\n    let cl = H[2];\n    let dl = H[3];\n    let el = H[4];\n    let ar = H[0];\n    let br = H[1];\n    let cr = H[2];\n    let dr = H[3];\n    let er = H[4];\n\n    // Computation\n    let t;\n    for (let i = 0; i < 80; i += 1) {\n      t = (al + _M[offset + zl[i]]) | 0;\n      if (i < 16) {\n        t += f1(bl, cl, dl) + hl[0];\n      } else if (i < 32) {\n        t += f2(bl, cl, dl) + hl[1];\n      } else if (i < 48) {\n        t += f3(bl, cl, dl) + hl[2];\n      } else if (i < 64) {\n        t += f4(bl, cl, dl) + hl[3];\n      } else { // if (i<80) {\n        t += f5(bl, cl, dl) + hl[4];\n      }\n      t |= 0;\n      t = rotl(t, sl[i]);\n      t = (t + el) | 0;\n      al = el;\n      el = dl;\n      dl = rotl(cl, 10);\n      cl = bl;\n      bl = t;\n\n      t = (ar + _M[offset + zr[i]]) | 0;\n      if (i < 16) {\n        t += f5(br, cr, dr) + hr[0];\n      } else if (i < 32) {\n        t += f4(br, cr, dr) + hr[1];\n      } else if (i < 48) {\n        t += f3(br, cr, dr) + hr[2];\n      } else if (i < 64) {\n        t += f2(br, cr, dr) + hr[3];\n      } else { // if (i<80) {\n        t += f1(br, cr, dr) + hr[4];\n      }\n      t |= 0;\n      t = rotl(t, sr[i]);\n      t = (t + er) | 0;\n      ar = er;\n      er = dr;\n      dr = rotl(cr, 10);\n      cr = br;\n      br = t;\n    }\n    // Intermediate hash value\n    t = (H[1] + cl + dr) | 0;\n    H[1] = (H[2] + dl + er) | 0;\n    H[2] = (H[3] + el + ar) | 0;\n    H[3] = (H[4] + al + br) | 0;\n    H[4] = (H[0] + bl + cr) | 0;\n    H[0] = t;\n  }\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n\n    const nBitsTotal = this._nDataBytes * 8;\n    const nBitsLeft = data.sigBytes * 8;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n      (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff)\n        | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)\n    );\n    data.sigBytes = (dataWords.length + 1) * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Shortcuts\n    const hash = this._hash;\n    const H = hash.words;\n\n    // Swap endian\n    for (let i = 0; i < 5; i += 1) {\n      // Shortcut\n      const H_i = H[i];\n\n      // Swap\n      H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff)\n        | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n    }\n\n    // Return final computed hash\n    return hash;\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n    clone._hash = this._hash.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.RIPEMD160('message');\n *     var hash = CryptoJS.RIPEMD160(wordArray);\n */\nconst RIPEMD160 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(RIPEMD160Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacRIPEMD160(message, key);\n */\nconst HmacRIPEMD160 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(RIPEMD160Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/ripemd160.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha1.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha1.js ***!
  \********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA1Algo\": () => (/* binding */ SHA1Algo),\n/* harmony export */   \"SHA1\": () => (/* binding */ SHA1),\n/* harmony export */   \"HmacSHA1\": () => (/* binding */ HmacSHA1)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n// Reusable object\nconst W = [];\n\n/**\n * SHA-1 hash algorithm.\n */\nclass SHA1Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  _doReset() {\n    this._hash = new _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray([\n      0x67452301,\n      0xefcdab89,\n      0x98badcfe,\n      0x10325476,\n      0xc3d2e1f0,\n    ]);\n  }\n\n  _doProcessBlock(M, offset) {\n    // Shortcut\n    const H = this._hash.words;\n\n    // Working variables\n    let a = H[0];\n    let b = H[1];\n    let c = H[2];\n    let d = H[3];\n    let e = H[4];\n\n    // Computation\n    for (let i = 0; i < 80; i += 1) {\n      if (i < 16) {\n        W[i] = M[offset + i] | 0;\n      } else {\n        const n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n        W[i] = (n << 1) | (n >>> 31);\n      }\n\n      let t = ((a << 5) | (a >>> 27)) + e + W[i];\n      if (i < 20) {\n        t += ((b & c) | (~b & d)) + 0x5a827999;\n      } else if (i < 40) {\n        t += (b ^ c ^ d) + 0x6ed9eba1;\n      } else if (i < 60) {\n        t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;\n      } else /* if (i < 80) */ {\n        t += (b ^ c ^ d) - 0x359d3e2a;\n      }\n\n      e = d;\n      d = c;\n      c = (b << 30) | (b >>> 2);\n      b = a;\n      a = t;\n    }\n\n    // Intermediate hash value\n    H[0] = (H[0] + a) | 0;\n    H[1] = (H[1] + b) | 0;\n    H[2] = (H[2] + c) | 0;\n    H[3] = (H[3] + d) | 0;\n    H[4] = (H[4] + e) | 0;\n  }\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n\n    const nBitsTotal = this._nDataBytes * 8;\n    const nBitsLeft = data.sigBytes * 8;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n    data.sigBytes = dataWords.length * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Return final computed hash\n    return this._hash;\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n    clone._hash = this._hash.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA1('message');\n *     var hash = CryptoJS.SHA1(wordArray);\n */\nconst SHA1 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(SHA1Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA1(message, key);\n */\nconst HmacSHA1 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(SHA1Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha1.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha224.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha224.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA224Algo\": () => (/* binding */ SHA224Algo),\n/* harmony export */   \"SHA224\": () => (/* binding */ SHA224),\n/* harmony export */   \"HmacSHA224\": () => (/* binding */ HmacSHA224)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _sha256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha256.js */ \"./node_modules/crypto-es/lib/sha256.js\");\n\n\n\n/**\n * SHA-224 hash algorithm.\n */\nclass SHA224Algo extends _sha256_js__WEBPACK_IMPORTED_MODULE_1__.SHA256Algo {\n  _doReset() {\n    this._hash = new _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray([\n      0xc1059ed8,\n      0x367cd507,\n      0x3070dd17,\n      0xf70e5939,\n      0xffc00b31,\n      0x68581511,\n      0x64f98fa7,\n      0xbefa4fa4,\n    ]);\n  }\n\n  _doFinalize() {\n    const hash = super._doFinalize.call(this);\n\n    hash.sigBytes -= 4;\n\n    return hash;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA224('message');\n *     var hash = CryptoJS.SHA224(wordArray);\n */\nconst SHA224 = _sha256_js__WEBPACK_IMPORTED_MODULE_1__.SHA256Algo._createHelper(SHA224Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA224(message, key);\n */\nconst HmacSHA224 = _sha256_js__WEBPACK_IMPORTED_MODULE_1__.SHA256Algo._createHmacHelper(SHA224Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha224.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha256.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha256.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA256Algo\": () => (/* binding */ SHA256Algo),\n/* harmony export */   \"SHA256\": () => (/* binding */ SHA256),\n/* harmony export */   \"HmacSHA256\": () => (/* binding */ HmacSHA256)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\n// Initialization and round constants tables\nconst H = [];\nconst K = [];\n\n// Compute constants\nconst isPrime = (n) => {\n  const sqrtN = Math.sqrt(n);\n  for (let factor = 2; factor <= sqrtN; factor += 1) {\n    if (!(n % factor)) {\n      return false;\n    }\n  }\n\n  return true;\n};\n\nconst getFractionalBits = n => ((n - (n | 0)) * 0x100000000) | 0;\n\nlet n = 2;\nlet nPrime = 0;\nwhile (nPrime < 64) {\n  if (isPrime(n)) {\n    if (nPrime < 8) {\n      H[nPrime] = getFractionalBits(n ** (1 / 2));\n    }\n    K[nPrime] = getFractionalBits(n ** (1 / 3));\n\n    nPrime += 1;\n  }\n\n  n += 1;\n}\n\n// Reusable object\nconst W = [];\n\n/**\n * SHA-256 hash algorithm.\n */\nclass SHA256Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  _doReset() {\n    this._hash = new _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray(H.slice(0));\n  }\n\n  _doProcessBlock(M, offset) {\n    // Shortcut\n    const _H = this._hash.words;\n\n    // Working variables\n    let a = _H[0];\n    let b = _H[1];\n    let c = _H[2];\n    let d = _H[3];\n    let e = _H[4];\n    let f = _H[5];\n    let g = _H[6];\n    let h = _H[7];\n\n    // Computation\n    for (let i = 0; i < 64; i += 1) {\n      if (i < 16) {\n        W[i] = M[offset + i] | 0;\n      } else {\n        const gamma0x = W[i - 15];\n        const gamma0 = ((gamma0x << 25) | (gamma0x >>> 7))\n          ^ ((gamma0x << 14) | (gamma0x >>> 18))\n          ^ (gamma0x >>> 3);\n\n        const gamma1x = W[i - 2];\n        const gamma1 = ((gamma1x << 15) | (gamma1x >>> 17))\n          ^ ((gamma1x << 13) | (gamma1x >>> 19))\n          ^ (gamma1x >>> 10);\n\n        W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n      }\n\n      const ch = (e & f) ^ (~e & g);\n      const maj = (a & b) ^ (a & c) ^ (b & c);\n\n      const sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n      const sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\n      const t1 = h + sigma1 + ch + K[i] + W[i];\n      const t2 = sigma0 + maj;\n\n      h = g;\n      g = f;\n      f = e;\n      e = (d + t1) | 0;\n      d = c;\n      c = b;\n      b = a;\n      a = (t1 + t2) | 0;\n    }\n\n    // Intermediate hash value\n    _H[0] = (_H[0] + a) | 0;\n    _H[1] = (_H[1] + b) | 0;\n    _H[2] = (_H[2] + c) | 0;\n    _H[3] = (_H[3] + d) | 0;\n    _H[4] = (_H[4] + e) | 0;\n    _H[5] = (_H[5] + f) | 0;\n    _H[6] = (_H[6] + g) | 0;\n    _H[7] = (_H[7] + h) | 0;\n  }\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n\n    const nBitsTotal = this._nDataBytes * 8;\n    const nBitsLeft = data.sigBytes * 8;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n    dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n    data.sigBytes = dataWords.length * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Return final computed hash\n    return this._hash;\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n    clone._hash = this._hash.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA256('message');\n *     var hash = CryptoJS.SHA256(wordArray);\n */\nconst SHA256 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(SHA256Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA256(message, key);\n */\nconst HmacSHA256 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(SHA256Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha256.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha3.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha3.js ***!
  \********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA3Algo\": () => (/* binding */ SHA3Algo),\n/* harmony export */   \"SHA3\": () => (/* binding */ SHA3),\n/* harmony export */   \"HmacSHA3\": () => (/* binding */ HmacSHA3)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _x64_core_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./x64-core.js */ \"./node_modules/crypto-es/lib/x64-core.js\");\n\n\n\n// Constants tables\nconst RHO_OFFSETS = [];\nconst PI_INDEXES = [];\nconst ROUND_CONSTANTS = [];\n\n// Compute Constants\n// Compute rho offset constants\nlet _x = 1;\nlet _y = 0;\nfor (let t = 0; t < 24; t += 1) {\n  RHO_OFFSETS[_x + 5 * _y] = ((t + 1) * (t + 2) / 2) % 64;\n\n  const newX = _y % 5;\n  const newY = (2 * _x + 3 * _y) % 5;\n  _x = newX;\n  _y = newY;\n}\n\n// Compute pi index constants\nfor (let x = 0; x < 5; x += 1) {\n  for (let y = 0; y < 5; y += 1) {\n    PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;\n  }\n}\n\n// Compute round constants\nlet LFSR = 0x01;\nfor (let i = 0; i < 24; i += 1) {\n  let roundConstantMsw = 0;\n  let roundConstantLsw = 0;\n\n  for (let j = 0; j < 7; j += 1) {\n    if (LFSR & 0x01) {\n      const bitPosition = (1 << j) - 1;\n      if (bitPosition < 32) {\n        roundConstantLsw ^= 1 << bitPosition;\n      } else /* if (bitPosition >= 32) */ {\n        roundConstantMsw ^= 1 << (bitPosition - 32);\n      }\n    }\n\n    // Compute next LFSR\n    if (LFSR & 0x80) {\n      // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1\n      LFSR = (LFSR << 1) ^ 0x71;\n    } else {\n      LFSR <<= 1;\n    }\n  }\n\n  ROUND_CONSTANTS[i] = _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word.create(roundConstantMsw, roundConstantLsw);\n}\n\n// Reusable objects for temporary values\nconst T = [];\nfor (let i = 0; i < 25; i += 1) {\n  T[i] = _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word.create();\n}\n\n/**\n * SHA-3 hash algorithm.\n */\nclass SHA3Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  constructor(cfg) {\n    /**\n     * Configuration options.\n     *\n     * @property {number} outputLength\n     *   The desired number of bits in the output hash.\n     *   Only values permitted are: 224, 256, 384, 512.\n     *   Default: 512\n     */\n    super(Object.assign(\n      { outputLength: 512 },\n      cfg,\n    ));\n  }\n\n  _doReset() {\n    this._state = [];\n    const state = this._state;\n    for (let i = 0; i < 25; i += 1) {\n      state[i] = new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word();\n    }\n\n    this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;\n  }\n\n  _doProcessBlock(M, offset) {\n    // Shortcuts\n    const state = this._state;\n    const nBlockSizeLanes = this.blockSize / 2;\n\n    // Absorb\n    for (let i = 0; i < nBlockSizeLanes; i += 1) {\n      // Shortcuts\n      let M2i = M[offset + 2 * i];\n      let M2i1 = M[offset + 2 * i + 1];\n\n      // Swap endian\n      M2i = (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff)\n        | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00);\n      M2i1 = (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff)\n        | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00);\n\n      // Absorb message into state\n      const lane = state[i];\n      lane.high ^= M2i1;\n      lane.low ^= M2i;\n    }\n\n    // Rounds\n    for (let round = 0; round < 24; round += 1) {\n      // Theta\n      for (let x = 0; x < 5; x += 1) {\n        // Mix column lanes\n        let tMsw = 0;\n        let tLsw = 0;\n        for (let y = 0; y < 5; y += 1) {\n          const lane = state[x + 5 * y];\n          tMsw ^= lane.high;\n          tLsw ^= lane.low;\n        }\n\n        // Temporary values\n        const Tx = T[x];\n        Tx.high = tMsw;\n        Tx.low = tLsw;\n      }\n      for (let x = 0; x < 5; x += 1) {\n        // Shortcuts\n        const Tx4 = T[(x + 4) % 5];\n        const Tx1 = T[(x + 1) % 5];\n        const Tx1Msw = Tx1.high;\n        const Tx1Lsw = Tx1.low;\n\n        // Mix surrounding columns\n        const tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));\n        const tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));\n        for (let y = 0; y < 5; y += 1) {\n          const lane = state[x + 5 * y];\n          lane.high ^= tMsw;\n          lane.low ^= tLsw;\n        }\n      }\n\n      // Rho Pi\n      for (let laneIndex = 1; laneIndex < 25; laneIndex += 1) {\n        let tMsw;\n        let tLsw;\n\n        // Shortcuts\n        const lane = state[laneIndex];\n        const laneMsw = lane.high;\n        const laneLsw = lane.low;\n        const rhoOffset = RHO_OFFSETS[laneIndex];\n\n        // Rotate lanes\n        if (rhoOffset < 32) {\n          tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));\n          tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));\n        } else /* if (rhoOffset >= 32) */ {\n          tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));\n          tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));\n        }\n\n        // Transpose lanes\n        const TPiLane = T[PI_INDEXES[laneIndex]];\n        TPiLane.high = tMsw;\n        TPiLane.low = tLsw;\n      }\n\n      // Rho pi at x = y = 0\n      const T0 = T[0];\n      const state0 = state[0];\n      T0.high = state0.high;\n      T0.low = state0.low;\n\n      // Chi\n      for (let x = 0; x < 5; x += 1) {\n        for (let y = 0; y < 5; y += 1) {\n          // Shortcuts\n          const laneIndex = x + 5 * y;\n          const lane = state[laneIndex];\n          const TLane = T[laneIndex];\n          const Tx1Lane = T[((x + 1) % 5) + 5 * y];\n          const Tx2Lane = T[((x + 2) % 5) + 5 * y];\n\n          // Mix rows\n          lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);\n          lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);\n        }\n      }\n\n      // Iota\n      const lane = state[0];\n      const roundConstant = ROUND_CONSTANTS[round];\n      lane.high ^= roundConstant.high;\n      lane.low ^= roundConstant.low;\n    }\n  }\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n    const nBitsLeft = data.sigBytes * 8;\n    const blockSizeBits = this.blockSize * 32;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - (nBitsLeft % 32));\n    dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;\n    data.sigBytes = dataWords.length * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Shortcuts\n    const state = this._state;\n    const outputLengthBytes = this.cfg.outputLength / 8;\n    const outputLengthLanes = outputLengthBytes / 8;\n\n    // Squeeze\n    const hashWords = [];\n    for (let i = 0; i < outputLengthLanes; i += 1) {\n      // Shortcuts\n      const lane = state[i];\n      let laneMsw = lane.high;\n      let laneLsw = lane.low;\n\n      // Swap endian\n      laneMsw = (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff)\n        | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00);\n      laneLsw = (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff)\n        | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00);\n\n      // Squeeze state to retrieve hash\n      hashWords.push(laneLsw);\n      hashWords.push(laneMsw);\n    }\n\n    // Return final computed hash\n    return new _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray(hashWords, outputLengthBytes);\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n\n    clone._state = this._state.slice(0);\n    const state = clone._state;\n    for (let i = 0; i < 25; i += 1) {\n      state[i] = state[i].clone();\n    }\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA3('message');\n *     var hash = CryptoJS.SHA3(wordArray);\n */\nconst SHA3 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(SHA3Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA3(message, key);\n */\nconst HmacSHA3 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(SHA3Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha3.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha384.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha384.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA384Algo\": () => (/* binding */ SHA384Algo),\n/* harmony export */   \"SHA384\": () => (/* binding */ SHA384),\n/* harmony export */   \"HmacSHA384\": () => (/* binding */ HmacSHA384)\n/* harmony export */ });\n/* harmony import */ var _x64_core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./x64-core.js */ \"./node_modules/crypto-es/lib/x64-core.js\");\n/* harmony import */ var _sha512_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha512.js */ \"./node_modules/crypto-es/lib/sha512.js\");\n\n\n\n/**\n * SHA-384 hash algorithm.\n */\nclass SHA384Algo extends _sha512_js__WEBPACK_IMPORTED_MODULE_1__.SHA512Algo {\n  _doReset() {\n    this._hash = new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64WordArray([\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0xcbbb9d5d, 0xc1059ed8),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x629a292a, 0x367cd507),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x9159015a, 0x3070dd17),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x152fecd8, 0xf70e5939),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x67332667, 0xffc00b31),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x8eb44a87, 0x68581511),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0xdb0c2e0d, 0x64f98fa7),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_0__.X64Word(0x47b5481d, 0xbefa4fa4),\n    ]);\n  }\n\n  _doFinalize() {\n    const hash = super._doFinalize.call(this);\n\n    hash.sigBytes -= 16;\n\n    return hash;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA384('message');\n *     var hash = CryptoJS.SHA384(wordArray);\n */\nconst SHA384 = _sha512_js__WEBPACK_IMPORTED_MODULE_1__.SHA512Algo._createHelper(SHA384Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA384(message, key);\n */\nconst HmacSHA384 = _sha512_js__WEBPACK_IMPORTED_MODULE_1__.SHA512Algo._createHmacHelper(SHA384Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha384.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/sha512.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-es/lib/sha512.js ***!
  \**********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"SHA512Algo\": () => (/* binding */ SHA512Algo),\n/* harmony export */   \"SHA512\": () => (/* binding */ SHA512),\n/* harmony export */   \"HmacSHA512\": () => (/* binding */ HmacSHA512)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _x64_core_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./x64-core.js */ \"./node_modules/crypto-es/lib/x64-core.js\");\n\n\n\n// Constants\nconst K = [\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x428a2f98, 0xd728ae22),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x71374491, 0x23ef65cd),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xb5c0fbcf, 0xec4d3b2f),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xe9b5dba5, 0x8189dbbc),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x3956c25b, 0xf348b538),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x59f111f1, 0xb605d019),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x923f82a4, 0xaf194f9b),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xab1c5ed5, 0xda6d8118),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xd807aa98, 0xa3030242),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x12835b01, 0x45706fbe),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x243185be, 0x4ee4b28c),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x550c7dc3, 0xd5ffb4e2),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x72be5d74, 0xf27b896f),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x80deb1fe, 0x3b1696b1),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x9bdc06a7, 0x25c71235),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xc19bf174, 0xcf692694),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xe49b69c1, 0x9ef14ad2),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xefbe4786, 0x384f25e3),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x0fc19dc6, 0x8b8cd5b5),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x240ca1cc, 0x77ac9c65),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x2de92c6f, 0x592b0275),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x4a7484aa, 0x6ea6e483),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x5cb0a9dc, 0xbd41fbd4),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x76f988da, 0x831153b5),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x983e5152, 0xee66dfab),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xa831c66d, 0x2db43210),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xb00327c8, 0x98fb213f),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xbf597fc7, 0xbeef0ee4),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xc6e00bf3, 0x3da88fc2),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xd5a79147, 0x930aa725),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x06ca6351, 0xe003826f),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x14292967, 0x0a0e6e70),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x27b70a85, 0x46d22ffc),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x2e1b2138, 0x5c26c926),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x4d2c6dfc, 0x5ac42aed),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x53380d13, 0x9d95b3df),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x650a7354, 0x8baf63de),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x766a0abb, 0x3c77b2a8),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x81c2c92e, 0x47edaee6),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x92722c85, 0x1482353b),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xa2bfe8a1, 0x4cf10364),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xa81a664b, 0xbc423001),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xc24b8b70, 0xd0f89791),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xc76c51a3, 0x0654be30),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xd192e819, 0xd6ef5218),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xd6990624, 0x5565a910),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xf40e3585, 0x5771202a),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x106aa070, 0x32bbd1b8),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x19a4c116, 0xb8d2d0c8),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x1e376c08, 0x5141ab53),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x2748774c, 0xdf8eeb99),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x34b0bcb5, 0xe19b48a8),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x391c0cb3, 0xc5c95a63),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x4ed8aa4a, 0xe3418acb),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x5b9cca4f, 0x7763e373),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x682e6ff3, 0xd6b2b8a3),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x748f82ee, 0x5defb2fc),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x78a5636f, 0x43172f60),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x84c87814, 0xa1f0ab72),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x8cc70208, 0x1a6439ec),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x90befffa, 0x23631e28),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xa4506ceb, 0xde82bde9),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xbef9a3f7, 0xb2c67915),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xc67178f2, 0xe372532b),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xca273ece, 0xea26619c),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xd186b8c7, 0x21c0c207),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xeada7dd6, 0xcde0eb1e),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xf57d4f7f, 0xee6ed178),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x06f067aa, 0x72176fba),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x0a637dc5, 0xa2c898a6),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x113f9804, 0xbef90dae),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x1b710b35, 0x131c471b),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x28db77f5, 0x23047d84),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x32caab7b, 0x40c72493),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x3c9ebe0a, 0x15c9bebc),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x431d67c4, 0x9c100d4c),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x4cc5d4be, 0xcb3e42b6),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x597f299c, 0xfc657e2a),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x5fcb6fab, 0x3ad6faec),\n  new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x6c44198c, 0x4a475817),\n];\n\n// Reusable objects\nconst W = [];\nfor (let i = 0; i < 80; i += 1) {\n  W[i] = new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word();\n}\n\n/**\n * SHA-512 hash algorithm.\n */\nclass SHA512Algo extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher {\n  constructor() {\n    super();\n\n    this.blockSize = 1024 / 32;\n  }\n\n  _doReset() {\n    this._hash = new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64WordArray([\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x6a09e667, 0xf3bcc908),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xbb67ae85, 0x84caa73b),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x3c6ef372, 0xfe94f82b),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0xa54ff53a, 0x5f1d36f1),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x510e527f, 0xade682d1),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x9b05688c, 0x2b3e6c1f),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x1f83d9ab, 0xfb41bd6b),\n      new _x64_core_js__WEBPACK_IMPORTED_MODULE_1__.X64Word(0x5be0cd19, 0x137e2179),\n    ]);\n  }\n\n  _doProcessBlock(M, offset) {\n    // Shortcuts\n    const H = this._hash.words;\n\n    const H0 = H[0];\n    const H1 = H[1];\n    const H2 = H[2];\n    const H3 = H[3];\n    const H4 = H[4];\n    const H5 = H[5];\n    const H6 = H[6];\n    const H7 = H[7];\n\n    const H0h = H0.high;\n    let H0l = H0.low;\n    const H1h = H1.high;\n    let H1l = H1.low;\n    const H2h = H2.high;\n    let H2l = H2.low;\n    const H3h = H3.high;\n    let H3l = H3.low;\n    const H4h = H4.high;\n    let H4l = H4.low;\n    const H5h = H5.high;\n    let H5l = H5.low;\n    const H6h = H6.high;\n    let H6l = H6.low;\n    const H7h = H7.high;\n    let H7l = H7.low;\n\n    // Working variables\n    let ah = H0h;\n    let al = H0l;\n    let bh = H1h;\n    let bl = H1l;\n    let ch = H2h;\n    let cl = H2l;\n    let dh = H3h;\n    let dl = H3l;\n    let eh = H4h;\n    let el = H4l;\n    let fh = H5h;\n    let fl = H5l;\n    let gh = H6h;\n    let gl = H6l;\n    let hh = H7h;\n    let hl = H7l;\n\n    // Rounds\n    for (let i = 0; i < 80; i += 1) {\n      let Wil;\n      let Wih;\n\n      // Shortcut\n      const Wi = W[i];\n\n      // Extend message\n      if (i < 16) {\n        Wi.high = M[offset + i * 2] | 0;\n        Wih = Wi.high;\n        Wi.low = M[offset + i * 2 + 1] | 0;\n        Wil = Wi.low;\n      } else {\n        // Gamma0\n        const gamma0x = W[i - 15];\n        const gamma0xh = gamma0x.high;\n        const gamma0xl = gamma0x.low;\n        const gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31))\n          ^ ((gamma0xh >>> 8) | (gamma0xl << 24))\n          ^ (gamma0xh >>> 7);\n        const gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31))\n          ^ ((gamma0xl >>> 8) | (gamma0xh << 24))\n          ^ ((gamma0xl >>> 7) | (gamma0xh << 25));\n\n        // Gamma1\n        const gamma1x = W[i - 2];\n        const gamma1xh = gamma1x.high;\n        const gamma1xl = gamma1x.low;\n        const gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13))\n          ^ ((gamma1xh << 3) | (gamma1xl >>> 29))\n          ^ (gamma1xh >>> 6);\n        const gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13))\n          ^ ((gamma1xl << 3) | (gamma1xh >>> 29))\n          ^ ((gamma1xl >>> 6) | (gamma1xh << 26));\n\n        // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n        const Wi7 = W[i - 7];\n        const Wi7h = Wi7.high;\n        const Wi7l = Wi7.low;\n\n        const Wi16 = W[i - 16];\n        const Wi16h = Wi16.high;\n        const Wi16l = Wi16.low;\n\n        Wil = gamma0l + Wi7l;\n        Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);\n        Wil += gamma1l;\n        Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);\n        Wil += Wi16l;\n        Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);\n\n        Wi.high = Wih;\n        Wi.low = Wil;\n      }\n\n      const chh = (eh & fh) ^ (~eh & gh);\n      const chl = (el & fl) ^ (~el & gl);\n      const majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);\n      const majl = (al & bl) ^ (al & cl) ^ (bl & cl);\n\n      const sigma0h = ((ah >>> 28) | (al << 4))\n        ^ ((ah << 30) | (al >>> 2))\n        ^ ((ah << 25) | (al >>> 7));\n      const sigma0l = ((al >>> 28) | (ah << 4))\n        ^ ((al << 30) | (ah >>> 2))\n        ^ ((al << 25) | (ah >>> 7));\n      const sigma1h = ((eh >>> 14) | (el << 18))\n        ^ ((eh >>> 18) | (el << 14))\n        ^ ((eh << 23) | (el >>> 9));\n      const sigma1l = ((el >>> 14) | (eh << 18))\n        ^ ((el >>> 18) | (eh << 14))\n        ^ ((el << 23) | (eh >>> 9));\n\n      // t1 = h + sigma1 + ch + K[i] + W[i]\n      const Ki = K[i];\n      const Kih = Ki.high;\n      const Kil = Ki.low;\n\n      let t1l = hl + sigma1l;\n      let t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);\n      t1l += chl;\n      t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);\n      t1l += Kil;\n      t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);\n      t1l += Wil;\n      t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);\n\n      // t2 = sigma0 + maj\n      const t2l = sigma0l + majl;\n      const t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);\n\n      // Update working variables\n      hh = gh;\n      hl = gl;\n      gh = fh;\n      gl = fl;\n      fh = eh;\n      fl = el;\n      el = (dl + t1l) | 0;\n      eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;\n      dh = ch;\n      dl = cl;\n      ch = bh;\n      cl = bl;\n      bh = ah;\n      bl = al;\n      al = (t1l + t2l) | 0;\n      ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;\n    }\n\n    // Intermediate hash value\n    H0.low = (H0l + al);\n    H0l = H0.low;\n    H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));\n    H1.low = (H1l + bl);\n    H1l = H1.low;\n    H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));\n    H2.low = (H2l + cl);\n    H2l = H2.low;\n    H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));\n    H3.low = (H3l + dl);\n    H3l = H3.low;\n    H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));\n    H4.low = (H4l + el);\n    H4l = H4.low;\n    H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));\n    H5.low = (H5l + fl);\n    H5l = H5.low;\n    H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));\n    H6.low = (H6l + gl);\n    H6l = H6.low;\n    H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));\n    H7.low = (H7l + hl);\n    H7l = H7.low;\n    H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));\n  }\n\n  _doFinalize() {\n    // Shortcuts\n    const data = this._data;\n    const dataWords = data.words;\n\n    const nBitsTotal = this._nDataBytes * 8;\n    const nBitsLeft = data.sigBytes * 8;\n\n    // Add padding\n    dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n    dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);\n    dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;\n    data.sigBytes = dataWords.length * 4;\n\n    // Hash final blocks\n    this._process();\n\n    // Convert hash to 32-bit word array before returning\n    const hash = this._hash.toX32();\n\n    // Return final computed hash\n    return hash;\n  }\n\n  clone() {\n    const clone = super.clone.call(this);\n    clone._hash = this._hash.clone();\n\n    return clone;\n  }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n *     var hash = CryptoJS.SHA512('message');\n *     var hash = CryptoJS.SHA512(wordArray);\n */\nconst SHA512 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHelper(SHA512Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n *     var hmac = CryptoJS.HmacSHA512(message, key);\n */\nconst HmacSHA512 = _core_js__WEBPACK_IMPORTED_MODULE_0__.Hasher._createHmacHelper(SHA512Algo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/sha512.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/tripledes.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-es/lib/tripledes.js ***!
  \*************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"DESAlgo\": () => (/* binding */ DESAlgo),\n/* harmony export */   \"DES\": () => (/* binding */ DES),\n/* harmony export */   \"TripleDESAlgo\": () => (/* binding */ TripleDESAlgo),\n/* harmony export */   \"TripleDES\": () => (/* binding */ TripleDES)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n/* harmony import */ var _cipher_core_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cipher-core.js */ \"./node_modules/crypto-es/lib/cipher-core.js\");\n\n\n\n// Permuted Choice 1 constants\nconst PC1 = [\n  57, 49, 41, 33, 25, 17, 9, 1,\n  58, 50, 42, 34, 26, 18, 10, 2,\n  59, 51, 43, 35, 27, 19, 11, 3,\n  60, 52, 44, 36, 63, 55, 47, 39,\n  31, 23, 15, 7, 62, 54, 46, 38,\n  30, 22, 14, 6, 61, 53, 45, 37,\n  29, 21, 13, 5, 28, 20, 12, 4,\n];\n\n// Permuted Choice 2 constants\nconst PC2 = [\n  14, 17, 11, 24, 1, 5,\n  3, 28, 15, 6, 21, 10,\n  23, 19, 12, 4, 26, 8,\n  16, 7, 27, 20, 13, 2,\n  41, 52, 31, 37, 47, 55,\n  30, 40, 51, 45, 33, 48,\n  44, 49, 39, 56, 34, 53,\n  46, 42, 50, 36, 29, 32,\n];\n\n// Cumulative bit shift constants\nconst BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];\n\n// SBOXes and round permutation constants\nconst SBOX_P = [\n  {\n    0x0: 0x808200,\n    0x10000000: 0x8000,\n    0x20000000: 0x808002,\n    0x30000000: 0x2,\n    0x40000000: 0x200,\n    0x50000000: 0x808202,\n    0x60000000: 0x800202,\n    0x70000000: 0x800000,\n    0x80000000: 0x202,\n    0x90000000: 0x800200,\n    0xa0000000: 0x8200,\n    0xb0000000: 0x808000,\n    0xc0000000: 0x8002,\n    0xd0000000: 0x800002,\n    0xe0000000: 0x0,\n    0xf0000000: 0x8202,\n    0x8000000: 0x0,\n    0x18000000: 0x808202,\n    0x28000000: 0x8202,\n    0x38000000: 0x8000,\n    0x48000000: 0x808200,\n    0x58000000: 0x200,\n    0x68000000: 0x808002,\n    0x78000000: 0x2,\n    0x88000000: 0x800200,\n    0x98000000: 0x8200,\n    0xa8000000: 0x808000,\n    0xb8000000: 0x800202,\n    0xc8000000: 0x800002,\n    0xd8000000: 0x8002,\n    0xe8000000: 0x202,\n    0xf8000000: 0x800000,\n    0x1: 0x8000,\n    0x10000001: 0x2,\n    0x20000001: 0x808200,\n    0x30000001: 0x800000,\n    0x40000001: 0x808002,\n    0x50000001: 0x8200,\n    0x60000001: 0x200,\n    0x70000001: 0x800202,\n    0x80000001: 0x808202,\n    0x90000001: 0x808000,\n    0xa0000001: 0x800002,\n    0xb0000001: 0x8202,\n    0xc0000001: 0x202,\n    0xd0000001: 0x800200,\n    0xe0000001: 0x8002,\n    0xf0000001: 0x0,\n    0x8000001: 0x808202,\n    0x18000001: 0x808000,\n    0x28000001: 0x800000,\n    0x38000001: 0x200,\n    0x48000001: 0x8000,\n    0x58000001: 0x800002,\n    0x68000001: 0x2,\n    0x78000001: 0x8202,\n    0x88000001: 0x8002,\n    0x98000001: 0x800202,\n    0xa8000001: 0x202,\n    0xb8000001: 0x808200,\n    0xc8000001: 0x800200,\n    0xd8000001: 0x0,\n    0xe8000001: 0x8200,\n    0xf8000001: 0x808002,\n  },\n  {\n    0x0: 0x40084010,\n    0x1000000: 0x4000,\n    0x2000000: 0x80000,\n    0x3000000: 0x40080010,\n    0x4000000: 0x40000010,\n    0x5000000: 0x40084000,\n    0x6000000: 0x40004000,\n    0x7000000: 0x10,\n    0x8000000: 0x84000,\n    0x9000000: 0x40004010,\n    0xa000000: 0x40000000,\n    0xb000000: 0x84010,\n    0xc000000: 0x80010,\n    0xd000000: 0x0,\n    0xe000000: 0x4010,\n    0xf000000: 0x40080000,\n    0x800000: 0x40004000,\n    0x1800000: 0x84010,\n    0x2800000: 0x10,\n    0x3800000: 0x40004010,\n    0x4800000: 0x40084010,\n    0x5800000: 0x40000000,\n    0x6800000: 0x80000,\n    0x7800000: 0x40080010,\n    0x8800000: 0x80010,\n    0x9800000: 0x0,\n    0xa800000: 0x4000,\n    0xb800000: 0x40080000,\n    0xc800000: 0x40000010,\n    0xd800000: 0x84000,\n    0xe800000: 0x40084000,\n    0xf800000: 0x4010,\n    0x10000000: 0x0,\n    0x11000000: 0x40080010,\n    0x12000000: 0x40004010,\n    0x13000000: 0x40084000,\n    0x14000000: 0x40080000,\n    0x15000000: 0x10,\n    0x16000000: 0x84010,\n    0x17000000: 0x4000,\n    0x18000000: 0x4010,\n    0x19000000: 0x80000,\n    0x1a000000: 0x80010,\n    0x1b000000: 0x40000010,\n    0x1c000000: 0x84000,\n    0x1d000000: 0x40004000,\n    0x1e000000: 0x40000000,\n    0x1f000000: 0x40084010,\n    0x10800000: 0x84010,\n    0x11800000: 0x80000,\n    0x12800000: 0x40080000,\n    0x13800000: 0x4000,\n    0x14800000: 0x40004000,\n    0x15800000: 0x40084010,\n    0x16800000: 0x10,\n    0x17800000: 0x40000000,\n    0x18800000: 0x40084000,\n    0x19800000: 0x40000010,\n    0x1a800000: 0x40004010,\n    0x1b800000: 0x80010,\n    0x1c800000: 0x0,\n    0x1d800000: 0x4010,\n    0x1e800000: 0x40080010,\n    0x1f800000: 0x84000,\n  },\n  {\n    0x0: 0x104,\n    0x100000: 0x0,\n    0x200000: 0x4000100,\n    0x300000: 0x10104,\n    0x400000: 0x10004,\n    0x500000: 0x4000004,\n    0x600000: 0x4010104,\n    0x700000: 0x4010000,\n    0x800000: 0x4000000,\n    0x900000: 0x4010100,\n    0xa00000: 0x10100,\n    0xb00000: 0x4010004,\n    0xc00000: 0x4000104,\n    0xd00000: 0x10000,\n    0xe00000: 0x4,\n    0xf00000: 0x100,\n    0x80000: 0x4010100,\n    0x180000: 0x4010004,\n    0x280000: 0x0,\n    0x380000: 0x4000100,\n    0x480000: 0x4000004,\n    0x580000: 0x10000,\n    0x680000: 0x10004,\n    0x780000: 0x104,\n    0x880000: 0x4,\n    0x980000: 0x100,\n    0xa80000: 0x4010000,\n    0xb80000: 0x10104,\n    0xc80000: 0x10100,\n    0xd80000: 0x4000104,\n    0xe80000: 0x4010104,\n    0xf80000: 0x4000000,\n    0x1000000: 0x4010100,\n    0x1100000: 0x10004,\n    0x1200000: 0x10000,\n    0x1300000: 0x4000100,\n    0x1400000: 0x100,\n    0x1500000: 0x4010104,\n    0x1600000: 0x4000004,\n    0x1700000: 0x0,\n    0x1800000: 0x4000104,\n    0x1900000: 0x4000000,\n    0x1a00000: 0x4,\n    0x1b00000: 0x10100,\n    0x1c00000: 0x4010000,\n    0x1d00000: 0x104,\n    0x1e00000: 0x10104,\n    0x1f00000: 0x4010004,\n    0x1080000: 0x4000000,\n    0x1180000: 0x104,\n    0x1280000: 0x4010100,\n    0x1380000: 0x0,\n    0x1480000: 0x10004,\n    0x1580000: 0x4000100,\n    0x1680000: 0x100,\n    0x1780000: 0x4010004,\n    0x1880000: 0x10000,\n    0x1980000: 0x4010104,\n    0x1a80000: 0x10104,\n    0x1b80000: 0x4000004,\n    0x1c80000: 0x4000104,\n    0x1d80000: 0x4010000,\n    0x1e80000: 0x4,\n    0x1f80000: 0x10100,\n  },\n  {\n    0x0: 0x80401000,\n    0x10000: 0x80001040,\n    0x20000: 0x401040,\n    0x30000: 0x80400000,\n    0x40000: 0x0,\n    0x50000: 0x401000,\n    0x60000: 0x80000040,\n    0x70000: 0x400040,\n    0x80000: 0x80000000,\n    0x90000: 0x400000,\n    0xa0000: 0x40,\n    0xb0000: 0x80001000,\n    0xc0000: 0x80400040,\n    0xd0000: 0x1040,\n    0xe0000: 0x1000,\n    0xf0000: 0x80401040,\n    0x8000: 0x80001040,\n    0x18000: 0x40,\n    0x28000: 0x80400040,\n    0x38000: 0x80001000,\n    0x48000: 0x401000,\n    0x58000: 0x80401040,\n    0x68000: 0x0,\n    0x78000: 0x80400000,\n    0x88000: 0x1000,\n    0x98000: 0x80401000,\n    0xa8000: 0x400000,\n    0xb8000: 0x1040,\n    0xc8000: 0x80000000,\n    0xd8000: 0x400040,\n    0xe8000: 0x401040,\n    0xf8000: 0x80000040,\n    0x100000: 0x400040,\n    0x110000: 0x401000,\n    0x120000: 0x80000040,\n    0x130000: 0x0,\n    0x140000: 0x1040,\n    0x150000: 0x80400040,\n    0x160000: 0x80401000,\n    0x170000: 0x80001040,\n    0x180000: 0x80401040,\n    0x190000: 0x80000000,\n    0x1a0000: 0x80400000,\n    0x1b0000: 0x401040,\n    0x1c0000: 0x80001000,\n    0x1d0000: 0x400000,\n    0x1e0000: 0x40,\n    0x1f0000: 0x1000,\n    0x108000: 0x80400000,\n    0x118000: 0x80401040,\n    0x128000: 0x0,\n    0x138000: 0x401000,\n    0x148000: 0x400040,\n    0x158000: 0x80000000,\n    0x168000: 0x80001040,\n    0x178000: 0x40,\n    0x188000: 0x80000040,\n    0x198000: 0x1000,\n    0x1a8000: 0x80001000,\n    0x1b8000: 0x80400040,\n    0x1c8000: 0x1040,\n    0x1d8000: 0x80401000,\n    0x1e8000: 0x400000,\n    0x1f8000: 0x401040,\n  },\n  {\n    0x0: 0x80,\n    0x1000: 0x1040000,\n    0x2000: 0x40000,\n    0x3000: 0x20000000,\n    0x4000: 0x20040080,\n    0x5000: 0x1000080,\n    0x6000: 0x21000080,\n    0x7000: 0x40080,\n    0x8000: 0x1000000,\n    0x9000: 0x20040000,\n    0xa000: 0x20000080,\n    0xb000: 0x21040080,\n    0xc000: 0x21040000,\n    0xd000: 0x0,\n    0xe000: 0x1040080,\n    0xf000: 0x21000000,\n    0x800: 0x1040080,\n    0x1800: 0x21000080,\n    0x2800: 0x80,\n    0x3800: 0x1040000,\n    0x4800: 0x40000,\n    0x5800: 0x20040080,\n    0x6800: 0x21040000,\n    0x7800: 0x20000000,\n    0x8800: 0x20040000,\n    0x9800: 0x0,\n    0xa800: 0x21040080,\n    0xb800: 0x1000080,\n    0xc800: 0x20000080,\n    0xd800: 0x21000000,\n    0xe800: 0x1000000,\n    0xf800: 0x40080,\n    0x10000: 0x40000,\n    0x11000: 0x80,\n    0x12000: 0x20000000,\n    0x13000: 0x21000080,\n    0x14000: 0x1000080,\n    0x15000: 0x21040000,\n    0x16000: 0x20040080,\n    0x17000: 0x1000000,\n    0x18000: 0x21040080,\n    0x19000: 0x21000000,\n    0x1a000: 0x1040000,\n    0x1b000: 0x20040000,\n    0x1c000: 0x40080,\n    0x1d000: 0x20000080,\n    0x1e000: 0x0,\n    0x1f000: 0x1040080,\n    0x10800: 0x21000080,\n    0x11800: 0x1000000,\n    0x12800: 0x1040000,\n    0x13800: 0x20040080,\n    0x14800: 0x20000000,\n    0x15800: 0x1040080,\n    0x16800: 0x80,\n    0x17800: 0x21040000,\n    0x18800: 0x40080,\n    0x19800: 0x21040080,\n    0x1a800: 0x0,\n    0x1b800: 0x21000000,\n    0x1c800: 0x1000080,\n    0x1d800: 0x40000,\n    0x1e800: 0x20040000,\n    0x1f800: 0x20000080,\n  },\n  {\n    0x0: 0x10000008,\n    0x100: 0x2000,\n    0x200: 0x10200000,\n    0x300: 0x10202008,\n    0x400: 0x10002000,\n    0x500: 0x200000,\n    0x600: 0x200008,\n    0x700: 0x10000000,\n    0x800: 0x0,\n    0x900: 0x10002008,\n    0xa00: 0x202000,\n    0xb00: 0x8,\n    0xc00: 0x10200008,\n    0xd00: 0x202008,\n    0xe00: 0x2008,\n    0xf00: 0x10202000,\n    0x80: 0x10200000,\n    0x180: 0x10202008,\n    0x280: 0x8,\n    0x380: 0x200000,\n    0x480: 0x202008,\n    0x580: 0x10000008,\n    0x680: 0x10002000,\n    0x780: 0x2008,\n    0x880: 0x200008,\n    0x980: 0x2000,\n    0xa80: 0x10002008,\n    0xb80: 0x10200008,\n    0xc80: 0x0,\n    0xd80: 0x10202000,\n    0xe80: 0x202000,\n    0xf80: 0x10000000,\n    0x1000: 0x10002000,\n    0x1100: 0x10200008,\n    0x1200: 0x10202008,\n    0x1300: 0x2008,\n    0x1400: 0x200000,\n    0x1500: 0x10000000,\n    0x1600: 0x10000008,\n    0x1700: 0x202000,\n    0x1800: 0x202008,\n    0x1900: 0x0,\n    0x1a00: 0x8,\n    0x1b00: 0x10200000,\n    0x1c00: 0x2000,\n    0x1d00: 0x10002008,\n    0x1e00: 0x10202000,\n    0x1f00: 0x200008,\n    0x1080: 0x8,\n    0x1180: 0x202000,\n    0x1280: 0x200000,\n    0x1380: 0x10000008,\n    0x1480: 0x10002000,\n    0x1580: 0x2008,\n    0x1680: 0x10202008,\n    0x1780: 0x10200000,\n    0x1880: 0x10202000,\n    0x1980: 0x10200008,\n    0x1a80: 0x2000,\n    0x1b80: 0x202008,\n    0x1c80: 0x200008,\n    0x1d80: 0x0,\n    0x1e80: 0x10000000,\n    0x1f80: 0x10002008,\n  },\n  {\n    0x0: 0x100000,\n    0x10: 0x2000401,\n    0x20: 0x400,\n    0x30: 0x100401,\n    0x40: 0x2100401,\n    0x50: 0x0,\n    0x60: 0x1,\n    0x70: 0x2100001,\n    0x80: 0x2000400,\n    0x90: 0x100001,\n    0xa0: 0x2000001,\n    0xb0: 0x2100400,\n    0xc0: 0x2100000,\n    0xd0: 0x401,\n    0xe0: 0x100400,\n    0xf0: 0x2000000,\n    0x8: 0x2100001,\n    0x18: 0x0,\n    0x28: 0x2000401,\n    0x38: 0x2100400,\n    0x48: 0x100000,\n    0x58: 0x2000001,\n    0x68: 0x2000000,\n    0x78: 0x401,\n    0x88: 0x100401,\n    0x98: 0x2000400,\n    0xa8: 0x2100000,\n    0xb8: 0x100001,\n    0xc8: 0x400,\n    0xd8: 0x2100401,\n    0xe8: 0x1,\n    0xf8: 0x100400,\n    0x100: 0x2000000,\n    0x110: 0x100000,\n    0x120: 0x2000401,\n    0x130: 0x2100001,\n    0x140: 0x100001,\n    0x150: 0x2000400,\n    0x160: 0x2100400,\n    0x170: 0x100401,\n    0x180: 0x401,\n    0x190: 0x2100401,\n    0x1a0: 0x100400,\n    0x1b0: 0x1,\n    0x1c0: 0x0,\n    0x1d0: 0x2100000,\n    0x1e0: 0x2000001,\n    0x1f0: 0x400,\n    0x108: 0x100400,\n    0x118: 0x2000401,\n    0x128: 0x2100001,\n    0x138: 0x1,\n    0x148: 0x2000000,\n    0x158: 0x100000,\n    0x168: 0x401,\n    0x178: 0x2100400,\n    0x188: 0x2000001,\n    0x198: 0x2100000,\n    0x1a8: 0x0,\n    0x1b8: 0x2100401,\n    0x1c8: 0x100401,\n    0x1d8: 0x400,\n    0x1e8: 0x2000400,\n    0x1f8: 0x100001,\n  },\n  {\n    0x0: 0x8000820,\n    0x1: 0x20000,\n    0x2: 0x8000000,\n    0x3: 0x20,\n    0x4: 0x20020,\n    0x5: 0x8020820,\n    0x6: 0x8020800,\n    0x7: 0x800,\n    0x8: 0x8020000,\n    0x9: 0x8000800,\n    0xa: 0x20800,\n    0xb: 0x8020020,\n    0xc: 0x820,\n    0xd: 0x0,\n    0xe: 0x8000020,\n    0xf: 0x20820,\n    0x80000000: 0x800,\n    0x80000001: 0x8020820,\n    0x80000002: 0x8000820,\n    0x80000003: 0x8000000,\n    0x80000004: 0x8020000,\n    0x80000005: 0x20800,\n    0x80000006: 0x20820,\n    0x80000007: 0x20,\n    0x80000008: 0x8000020,\n    0x80000009: 0x820,\n    0x8000000a: 0x20020,\n    0x8000000b: 0x8020800,\n    0x8000000c: 0x0,\n    0x8000000d: 0x8020020,\n    0x8000000e: 0x8000800,\n    0x8000000f: 0x20000,\n    0x10: 0x20820,\n    0x11: 0x8020800,\n    0x12: 0x20,\n    0x13: 0x800,\n    0x14: 0x8000800,\n    0x15: 0x8000020,\n    0x16: 0x8020020,\n    0x17: 0x20000,\n    0x18: 0x0,\n    0x19: 0x20020,\n    0x1a: 0x8020000,\n    0x1b: 0x8000820,\n    0x1c: 0x8020820,\n    0x1d: 0x20800,\n    0x1e: 0x820,\n    0x1f: 0x8000000,\n    0x80000010: 0x20000,\n    0x80000011: 0x800,\n    0x80000012: 0x8020020,\n    0x80000013: 0x20820,\n    0x80000014: 0x20,\n    0x80000015: 0x8020000,\n    0x80000016: 0x8000000,\n    0x80000017: 0x8000820,\n    0x80000018: 0x8020820,\n    0x80000019: 0x8000020,\n    0x8000001a: 0x8000800,\n    0x8000001b: 0x0,\n    0x8000001c: 0x20800,\n    0x8000001d: 0x820,\n    0x8000001e: 0x20020,\n    0x8000001f: 0x8020800,\n  },\n];\n\n// Masks that select the SBOX input\nconst SBOX_MASK = [\n  0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,\n  0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f,\n];\n\n// Swap bits across the left and right words\nfunction exchangeLR(offset, mask) {\n  const t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;\n  this._rBlock ^= t;\n  this._lBlock ^= t << offset;\n}\n\nfunction exchangeRL(offset, mask) {\n  const t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;\n  this._lBlock ^= t;\n  this._rBlock ^= t << offset;\n}\n\n/**\n * DES block cipher algorithm.\n */\nclass DESAlgo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_1__.BlockCipher {\n  _doReset() {\n    // Shortcuts\n    const key = this._key;\n    const keyWords = key.words;\n\n    // Select 56 bits according to PC1\n    const keyBits = [];\n    for (let i = 0; i < 56; i += 1) {\n      const keyBitPos = PC1[i] - 1;\n      keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - (keyBitPos % 32))) & 1;\n    }\n\n    // Assemble 16 subkeys\n    this._subKeys = [];\n    const subKeys = this._subKeys;\n    for (let nSubKey = 0; nSubKey < 16; nSubKey += 1) {\n      // Create subkey\n      subKeys[nSubKey] = [];\n      const subKey = subKeys[nSubKey];\n\n      // Shortcut\n      const bitShift = BIT_SHIFTS[nSubKey];\n\n      // Select 48 bits according to PC2\n      for (let i = 0; i < 24; i += 1) {\n        // Select from the left 28 key bits\n        subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - (i % 6));\n\n        // Select from the right 28 key bits\n        subKey[4 + ((i / 6) | 0)]\n          |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)]\n          << (31 - (i % 6));\n      }\n\n      // Since each subkey is applied to an expanded 32-bit input,\n      // the subkey can be broken into 8 values scaled to 32-bits,\n      // which allows the key to be used without expansion\n      subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);\n      for (let i = 1; i < 7; i += 1) {\n        subKey[i] >>>= ((i - 1) * 4 + 3);\n      }\n      subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);\n    }\n\n    // Compute inverse subkeys\n    this._invSubKeys = [];\n    const invSubKeys = this._invSubKeys;\n    for (let i = 0; i < 16; i += 1) {\n      invSubKeys[i] = subKeys[15 - i];\n    }\n  }\n\n  encryptBlock(M, offset) {\n    this._doCryptBlock(M, offset, this._subKeys);\n  }\n\n  decryptBlock(M, offset) {\n    this._doCryptBlock(M, offset, this._invSubKeys);\n  }\n\n  _doCryptBlock(M, offset, subKeys) {\n    const _M = M;\n\n    // Get input\n    this._lBlock = M[offset];\n    this._rBlock = M[offset + 1];\n\n    // Initial permutation\n    exchangeLR.call(this, 4, 0x0f0f0f0f);\n    exchangeLR.call(this, 16, 0x0000ffff);\n    exchangeRL.call(this, 2, 0x33333333);\n    exchangeRL.call(this, 8, 0x00ff00ff);\n    exchangeLR.call(this, 1, 0x55555555);\n\n    // Rounds\n    for (let round = 0; round < 16; round += 1) {\n      // Shortcuts\n      const subKey = subKeys[round];\n      const lBlock = this._lBlock;\n      const rBlock = this._rBlock;\n\n      // Feistel function\n      let f = 0;\n      for (let i = 0; i < 8; i += 1) {\n        f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];\n      }\n      this._lBlock = rBlock;\n      this._rBlock = lBlock ^ f;\n    }\n\n    // Undo swap from last round\n    const t = this._lBlock;\n    this._lBlock = this._rBlock;\n    this._rBlock = t;\n\n    // Final permutation\n    exchangeLR.call(this, 1, 0x55555555);\n    exchangeRL.call(this, 8, 0x00ff00ff);\n    exchangeRL.call(this, 2, 0x33333333);\n    exchangeLR.call(this, 16, 0x0000ffff);\n    exchangeLR.call(this, 4, 0x0f0f0f0f);\n\n    // Set output\n    _M[offset] = this._lBlock;\n    _M[offset + 1] = this._rBlock;\n  }\n}\nDESAlgo.keySize = 64 / 32;\nDESAlgo.ivSize = 64 / 32;\nDESAlgo.blockSize = 64 / 32;\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);\n */\nconst DES = _cipher_core_js__WEBPACK_IMPORTED_MODULE_1__.BlockCipher._createHelper(DESAlgo);\n\n/**\n * Triple-DES block cipher algorithm.\n */\nclass TripleDESAlgo extends _cipher_core_js__WEBPACK_IMPORTED_MODULE_1__.BlockCipher {\n  _doReset() {\n    // Shortcuts\n    const key = this._key;\n    const keyWords = key.words;\n    // Make sure the key length is valid (64, 128 or >= 192 bit)\n    if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {\n      throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');\n    }\n\n    // Extend the key according to the keying options defined in 3DES standard\n    const key1 = keyWords.slice(0, 2);\n    const key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);\n    const key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);\n\n    // Create DES instances\n    this._des1 = DESAlgo.createEncryptor(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(key1));\n    this._des2 = DESAlgo.createEncryptor(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(key2));\n    this._des3 = DESAlgo.createEncryptor(_core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray.create(key3));\n  }\n\n  encryptBlock(M, offset) {\n    this._des1.encryptBlock(M, offset);\n    this._des2.decryptBlock(M, offset);\n    this._des3.encryptBlock(M, offset);\n  }\n\n  decryptBlock(M, offset) {\n    this._des3.decryptBlock(M, offset);\n    this._des2.encryptBlock(M, offset);\n    this._des1.decryptBlock(M, offset);\n  }\n}\nTripleDESAlgo.keySize = 192 / 32;\nTripleDESAlgo.ivSize = 64 / 32;\nTripleDESAlgo.blockSize = 64 / 32;\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);\n *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);\n */\nconst TripleDES = _cipher_core_js__WEBPACK_IMPORTED_MODULE_1__.BlockCipher._createHelper(TripleDESAlgo);\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/tripledes.js?");

/***/ }),

/***/ "./node_modules/crypto-es/lib/x64-core.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-es/lib/x64-core.js ***!
  \************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"X64Word\": () => (/* binding */ X64Word),\n/* harmony export */   \"X64WordArray\": () => (/* binding */ X64WordArray)\n/* harmony export */ });\n/* harmony import */ var _core_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core.js */ \"./node_modules/crypto-es/lib/core.js\");\n\n\nconst X32WordArray = _core_js__WEBPACK_IMPORTED_MODULE_0__.WordArray;\n\n/**\n * A 64-bit word.\n */\nclass X64Word extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created 64-bit word.\n   *\n   * @param {number} high The high 32 bits.\n   * @param {number} low The low 32 bits.\n   *\n   * @example\n   *\n   *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);\n   */\n  constructor(high, low) {\n    super();\n\n    this.high = high;\n    this.low = low;\n  }\n}\n\n/**\n * An array of 64-bit words.\n *\n * @property {Array} words The array of CryptoJS.x64.Word objects.\n * @property {number} sigBytes The number of significant bytes in this word array.\n */\nclass X64WordArray extends _core_js__WEBPACK_IMPORTED_MODULE_0__.Base {\n  /**\n   * Initializes a newly created word array.\n   *\n   * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.\n   * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n   *\n   * @example\n   *\n   *     var wordArray = CryptoJS.x64.WordArray.create();\n   *\n   *     var wordArray = CryptoJS.x64.WordArray.create([\n   *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n   *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n   *     ]);\n   *\n   *     var wordArray = CryptoJS.x64.WordArray.create([\n   *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n   *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n   *     ], 10);\n   */\n  constructor(words = [], sigBytes = words.length * 8) {\n    super();\n\n    this.words = words;\n    this.sigBytes = sigBytes;\n  }\n\n  /**\n   * Converts this 64-bit word array to a 32-bit word array.\n   *\n   * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.\n   *\n   * @example\n   *\n   *     var x32WordArray = x64WordArray.toX32();\n   */\n  toX32() {\n    // Shortcuts\n    const x64Words = this.words;\n    const x64WordsLength = x64Words.length;\n\n    // Convert\n    const x32Words = [];\n    for (let i = 0; i < x64WordsLength; i += 1) {\n      const x64Word = x64Words[i];\n      x32Words.push(x64Word.high);\n      x32Words.push(x64Word.low);\n    }\n\n    return X32WordArray.create(x32Words, this.sigBytes);\n  }\n\n  /**\n   * Creates a copy of this word array.\n   *\n   * @return {X64WordArray} The clone.\n   *\n   * @example\n   *\n   *     var clone = x64WordArray.clone();\n   */\n  clone() {\n    const clone = super.clone.call(this);\n\n    // Clone \"words\" array\n    clone.words = this.words.slice(0);\n    const { words } = clone;\n\n    // Clone each X64Word object\n    const wordsLength = words.length;\n    for (let i = 0; i < wordsLength; i += 1) {\n      words[i] = words[i].clone();\n    }\n\n    return clone;\n  }\n}\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/crypto-es/lib/x64-core.js?");

/***/ }),

/***/ "./node_modules/pako/dist/pako.esm.mjs":
/*!*********************************************!*\
  !*** ./node_modules/pako/dist/pako.esm.mjs ***!
  \*********************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"Deflate\": () => (/* binding */ Deflate_1),\n/* harmony export */   \"Inflate\": () => (/* binding */ Inflate_1),\n/* harmony export */   \"constants\": () => (/* binding */ constants_1),\n/* harmony export */   \"default\": () => (/* binding */ pako),\n/* harmony export */   \"deflate\": () => (/* binding */ deflate_1),\n/* harmony export */   \"deflateRaw\": () => (/* binding */ deflateRaw_1),\n/* harmony export */   \"gzip\": () => (/* binding */ gzip_1),\n/* harmony export */   \"inflate\": () => (/* binding */ inflate_1),\n/* harmony export */   \"inflateRaw\": () => (/* binding */ inflateRaw_1),\n/* harmony export */   \"ungzip\": () => (/* binding */ ungzip_1)\n/* harmony export */ });\n\n/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//const Z_FILTERED          = 1;\n//const Z_HUFFMAN_ONLY      = 2;\n//const Z_RLE               = 3;\nconst Z_FIXED$1               = 4;\n//const Z_DEFAULT_STRATEGY  = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nconst Z_BINARY              = 0;\nconst Z_TEXT                = 1;\n//const Z_ASCII             = 1; // = Z_TEXT\nconst Z_UNKNOWN$1             = 2;\n\n/*============================================================================*/\n\n\nfunction zero$1(buf) { let len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES    = 2;\n/* The three kinds of block type */\n\nconst MIN_MATCH$1    = 3;\nconst MAX_MATCH$1    = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nconst LENGTH_CODES$1  = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nconst LITERALS$1      = 256;\n/* number of literal bytes 0..255 */\n\nconst L_CODES$1       = LITERALS$1 + 1 + LENGTH_CODES$1;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nconst D_CODES$1       = 30;\n/* number of distance codes */\n\nconst BL_CODES$1      = 19;\n/* number of codes used to transfer the bit lengths */\n\nconst HEAP_SIZE$1     = 2 * L_CODES$1 + 1;\n/* maximum heap size */\n\nconst MAX_BITS$1      = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst Buf_size      = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nconst MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nconst END_BLOCK   = 256;\n/* end of block literal code */\n\nconst REP_3_6     = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nconst REPZ_3_10   = 17;\n/* repeat a zero length 3-10 times  (3 bits of repeat count) */\n\nconst REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times  (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nconst extra_lbits =   /* extra bits for each length code */\n  new Uint8Array([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]);\n\nconst extra_dbits =   /* extra bits for each distance code */\n  new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);\n\nconst extra_blbits =  /* extra bits for each bit length code */\n  new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);\n\nconst bl_order =\n  new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nconst DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nconst static_ltree  = new Array((L_CODES$1 + 2) * 2);\nzero$1(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nconst static_dtree  = new Array(D_CODES$1 * 2);\nzero$1(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nconst _dist_code    = new Array(DIST_CODE_LEN);\nzero$1(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nconst _length_code  = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1);\nzero$1(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nconst base_length   = new Array(LENGTH_CODES$1);\nzero$1(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nconst base_dist     = new Array(D_CODES$1);\nzero$1(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n  this.static_tree  = static_tree;  /* static tree or NULL */\n  this.extra_bits   = extra_bits;   /* extra bits for each code or NULL */\n  this.extra_base   = extra_base;   /* base index for extra_bits */\n  this.elems        = elems;        /* max number of elements in the tree */\n  this.max_length   = max_length;   /* max bit length for the codes */\n\n  // show if `static_tree` has data or dummy - needed for monomorphic objects\n  this.has_stree    = static_tree && static_tree.length;\n}\n\n\nlet static_l_desc;\nlet static_d_desc;\nlet static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n  this.dyn_tree = dyn_tree;     /* the dynamic tree */\n  this.max_code = 0;            /* largest code with non zero frequency */\n  this.stat_desc = stat_desc;   /* the corresponding static tree */\n}\n\n\n\nconst d_code = (dist) => {\n\n  return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n};\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nconst put_short = (s, w) => {\n//    put_byte(s, (uch)((w) & 0xff));\n//    put_byte(s, (uch)((ush)(w) >> 8));\n  s.pending_buf[s.pending++] = (w) & 0xff;\n  s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n};\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nconst send_bits = (s, value, length) => {\n\n  if (s.bi_valid > (Buf_size - length)) {\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\n    put_short(s, s.bi_buf);\n    s.bi_buf = value >> (Buf_size - s.bi_valid);\n    s.bi_valid += length - Buf_size;\n  } else {\n    s.bi_buf |= (value << s.bi_valid) & 0xffff;\n    s.bi_valid += length;\n  }\n};\n\n\nconst send_code = (s, c, tree) => {\n\n  send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n};\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nconst bi_reverse = (code, len) => {\n\n  let res = 0;\n  do {\n    res |= code & 1;\n    code >>>= 1;\n    res <<= 1;\n  } while (--len > 0);\n  return res >>> 1;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nconst bi_flush = (s) => {\n\n  if (s.bi_valid === 16) {\n    put_short(s, s.bi_buf);\n    s.bi_buf = 0;\n    s.bi_valid = 0;\n\n  } else if (s.bi_valid >= 8) {\n    s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n    s.bi_buf >>= 8;\n    s.bi_valid -= 8;\n  }\n};\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n *    above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n *     array bl_count contains the frequencies for each bit length.\n *     The length opt_len is updated; static_len is also updated if stree is\n *     not null.\n */\nconst gen_bitlen = (s, desc) =>\n//    deflate_state *s;\n//    tree_desc *desc;    /* the tree descriptor */\n{\n  const tree            = desc.dyn_tree;\n  const max_code        = desc.max_code;\n  const stree           = desc.stat_desc.static_tree;\n  const has_stree       = desc.stat_desc.has_stree;\n  const extra           = desc.stat_desc.extra_bits;\n  const base            = desc.stat_desc.extra_base;\n  const max_length      = desc.stat_desc.max_length;\n  let h;              /* heap index */\n  let n, m;           /* iterate over the tree elements */\n  let bits;           /* bit length */\n  let xbits;          /* extra bits */\n  let f;              /* frequency */\n  let overflow = 0;   /* number of elements with bit length too large */\n\n  for (bits = 0; bits <= MAX_BITS$1; bits++) {\n    s.bl_count[bits] = 0;\n  }\n\n  /* In a first pass, compute the optimal bit lengths (which may\n   * overflow in the case of the bit length tree).\n   */\n  tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n  for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) {\n    n = s.heap[h];\n    bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n    if (bits > max_length) {\n      bits = max_length;\n      overflow++;\n    }\n    tree[n * 2 + 1]/*.Len*/ = bits;\n    /* We overwrite tree[n].Dad which is no longer needed */\n\n    if (n > max_code) { continue; } /* not a leaf node */\n\n    s.bl_count[bits]++;\n    xbits = 0;\n    if (n >= base) {\n      xbits = extra[n - base];\n    }\n    f = tree[n * 2]/*.Freq*/;\n    s.opt_len += f * (bits + xbits);\n    if (has_stree) {\n      s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n    }\n  }\n  if (overflow === 0) { return; }\n\n  // Trace((stderr,\"\\nbit length overflow\\n\"));\n  /* This happens for example on obj2 and pic of the Calgary corpus */\n\n  /* Find the first bit length which could increase: */\n  do {\n    bits = max_length - 1;\n    while (s.bl_count[bits] === 0) { bits--; }\n    s.bl_count[bits]--;      /* move one leaf down the tree */\n    s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n    s.bl_count[max_length]--;\n    /* The brother of the overflow item also moves one step up,\n     * but this does not affect bl_count[max_length]\n     */\n    overflow -= 2;\n  } while (overflow > 0);\n\n  /* Now recompute all bit lengths, scanning in increasing frequency.\n   * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n   * lengths instead of fixing only the wrong ones. This idea is taken\n   * from 'ar' written by Haruhiko Okumura.)\n   */\n  for (bits = max_length; bits !== 0; bits--) {\n    n = s.bl_count[bits];\n    while (n !== 0) {\n      m = s.heap[--h];\n      if (m > max_code) { continue; }\n      if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n        // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n        s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n        tree[m * 2 + 1]/*.Len*/ = bits;\n      }\n      n--;\n    }\n  }\n};\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n *     zero code length.\n */\nconst gen_codes = (tree, max_code, bl_count) =>\n//    ct_data *tree;             /* the tree to decorate */\n//    int max_code;              /* largest code with non zero frequency */\n//    ushf *bl_count;            /* number of codes at each bit length */\n{\n  const next_code = new Array(MAX_BITS$1 + 1); /* next code value for each bit length */\n  let code = 0;              /* running code value */\n  let bits;                  /* bit index */\n  let n;                     /* code index */\n\n  /* The distribution counts are first used to generate the code values\n   * without bit reversal.\n   */\n  for (bits = 1; bits <= MAX_BITS$1; bits++) {\n    next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n  }\n  /* Check that the bit counts in bl_count are consistent. The last code\n   * must be all ones.\n   */\n  //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n  //        \"inconsistent bit counts\");\n  //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n  for (n = 0;  n <= max_code; n++) {\n    let len = tree[n * 2 + 1]/*.Len*/;\n    if (len === 0) { continue; }\n    /* Now reverse the bits */\n    tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n    //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n    //     n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n  }\n};\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nconst tr_static_init = () => {\n\n  let n;        /* iterates over tree elements */\n  let bits;     /* bit counter */\n  let length;   /* length value */\n  let code;     /* code value */\n  let dist;     /* distance index */\n  const bl_count = new Array(MAX_BITS$1 + 1);\n  /* number of codes at each bit length for an optimal tree */\n\n  // do check in _tr_init()\n  //if (static_init_done) return;\n\n  /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n  static_l_desc.static_tree = static_ltree;\n  static_l_desc.extra_bits = extra_lbits;\n  static_d_desc.static_tree = static_dtree;\n  static_d_desc.extra_bits = extra_dbits;\n  static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n  /* Initialize the mapping length (0..255) -> length code (0..28) */\n  length = 0;\n  for (code = 0; code < LENGTH_CODES$1 - 1; code++) {\n    base_length[code] = length;\n    for (n = 0; n < (1 << extra_lbits[code]); n++) {\n      _length_code[length++] = code;\n    }\n  }\n  //Assert (length == 256, \"tr_static_init: length != 256\");\n  /* Note that the length 255 (match length 258) can be represented\n   * in two different ways: code 284 + 5 bits or code 285, so we\n   * overwrite length_code[255] to use the best encoding:\n   */\n  _length_code[length - 1] = code;\n\n  /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n  dist = 0;\n  for (code = 0; code < 16; code++) {\n    base_dist[code] = dist;\n    for (n = 0; n < (1 << extra_dbits[code]); n++) {\n      _dist_code[dist++] = code;\n    }\n  }\n  //Assert (dist == 256, \"tr_static_init: dist != 256\");\n  dist >>= 7; /* from now on, all distances are divided by 128 */\n  for (; code < D_CODES$1; code++) {\n    base_dist[code] = dist << 7;\n    for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n      _dist_code[256 + dist++] = code;\n    }\n  }\n  //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n  /* Construct the codes of the static literal tree */\n  for (bits = 0; bits <= MAX_BITS$1; bits++) {\n    bl_count[bits] = 0;\n  }\n\n  n = 0;\n  while (n <= 143) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\n    n++;\n    bl_count[8]++;\n  }\n  while (n <= 255) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 9;\n    n++;\n    bl_count[9]++;\n  }\n  while (n <= 279) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 7;\n    n++;\n    bl_count[7]++;\n  }\n  while (n <= 287) {\n    static_ltree[n * 2 + 1]/*.Len*/ = 8;\n    n++;\n    bl_count[8]++;\n  }\n  /* Codes 286 and 287 do not exist, but we must include them in the\n   * tree construction to get a canonical Huffman tree (longest code\n   * all ones)\n   */\n  gen_codes(static_ltree, L_CODES$1 + 1, bl_count);\n\n  /* The static distance tree is trivial: */\n  for (n = 0; n < D_CODES$1; n++) {\n    static_dtree[n * 2 + 1]/*.Len*/ = 5;\n    static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n  }\n\n  // Now data ready and we can init static trees\n  static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1);\n  static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0,          D_CODES$1, MAX_BITS$1);\n  static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0,         BL_CODES$1, MAX_BL_BITS);\n\n  //static_init_done = true;\n};\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nconst init_block = (s) => {\n\n  let n; /* iterates over tree elements */\n\n  /* Initialize the trees. */\n  for (n = 0; n < L_CODES$1;  n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n  for (n = 0; n < D_CODES$1;  n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n  for (n = 0; n < BL_CODES$1; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n  s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n  s.opt_len = s.static_len = 0;\n  s.last_lit = s.matches = 0;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nconst bi_windup = (s) =>\n{\n  if (s.bi_valid > 8) {\n    put_short(s, s.bi_buf);\n  } else if (s.bi_valid > 0) {\n    //put_byte(s, (Byte)s->bi_buf);\n    s.pending_buf[s.pending++] = s.bi_buf;\n  }\n  s.bi_buf = 0;\n  s.bi_valid = 0;\n};\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nconst copy_block = (s, buf, len, header) =>\n//DeflateState *s;\n//charf    *buf;    /* the input data */\n//unsigned len;     /* its length */\n//int      header;  /* true if block header must be written */\n{\n  bi_windup(s);        /* align on byte boundary */\n\n  if (header) {\n    put_short(s, len);\n    put_short(s, ~len);\n  }\n//  while (len--) {\n//    put_byte(s, *buf++);\n//  }\n  s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending);\n  s.pending += len;\n};\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nconst smaller = (tree, n, m, depth) => {\n\n  const _n2 = n * 2;\n  const _m2 = m * 2;\n  return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n         (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n};\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nconst pqdownheap = (s, tree, k) =>\n//    deflate_state *s;\n//    ct_data *tree;  /* the tree to restore */\n//    int k;               /* node to move down */\n{\n  const v = s.heap[k];\n  let j = k << 1;  /* left son of k */\n  while (j <= s.heap_len) {\n    /* Set j to the smallest of the two sons: */\n    if (j < s.heap_len &&\n      smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n      j++;\n    }\n    /* Exit if v is smaller than both sons */\n    if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n    /* Exchange v with the smallest son */\n    s.heap[k] = s.heap[j];\n    k = j;\n\n    /* And continue down the tree, setting j to the left son of k */\n    j <<= 1;\n  }\n  s.heap[k] = v;\n};\n\n\n// inlined manually\n// const SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nconst compress_block = (s, ltree, dtree) =>\n//    deflate_state *s;\n//    const ct_data *ltree; /* literal tree */\n//    const ct_data *dtree; /* distance tree */\n{\n  let dist;           /* distance of matched string */\n  let lc;             /* match length or unmatched char (if dist == 0) */\n  let lx = 0;         /* running index in l_buf */\n  let code;           /* the code to send */\n  let extra;          /* number of extra bits to send */\n\n  if (s.last_lit !== 0) {\n    do {\n      dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n      lc = s.pending_buf[s.l_buf + lx];\n      lx++;\n\n      if (dist === 0) {\n        send_code(s, lc, ltree); /* send a literal byte */\n        //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n      } else {\n        /* Here, lc is the match length - MIN_MATCH */\n        code = _length_code[lc];\n        send_code(s, code + LITERALS$1 + 1, ltree); /* send the length code */\n        extra = extra_lbits[code];\n        if (extra !== 0) {\n          lc -= base_length[code];\n          send_bits(s, lc, extra);       /* send the extra length bits */\n        }\n        dist--; /* dist is now the match distance - 1 */\n        code = d_code(dist);\n        //Assert (code < D_CODES, \"bad d_code\");\n\n        send_code(s, code, dtree);       /* send the distance code */\n        extra = extra_dbits[code];\n        if (extra !== 0) {\n          dist -= base_dist[code];\n          send_bits(s, dist, extra);   /* send the extra distance bits */\n        }\n      } /* literal or match pair ? */\n\n      /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n      //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n      //       \"pendingBuf overflow\");\n\n    } while (lx < s.last_lit);\n  }\n\n  send_code(s, END_BLOCK, ltree);\n};\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n *     and corresponding code. The length opt_len is updated; static_len is\n *     also updated if stree is not null. The field max_code is set.\n */\nconst build_tree = (s, desc) =>\n//    deflate_state *s;\n//    tree_desc *desc; /* the tree descriptor */\n{\n  const tree     = desc.dyn_tree;\n  const stree    = desc.stat_desc.static_tree;\n  const has_stree = desc.stat_desc.has_stree;\n  const elems    = desc.stat_desc.elems;\n  let n, m;          /* iterate over heap elements */\n  let max_code = -1; /* largest code with non zero frequency */\n  let node;          /* new node being created */\n\n  /* Construct the initial heap, with least frequent element in\n   * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n   * heap[0] is not used.\n   */\n  s.heap_len = 0;\n  s.heap_max = HEAP_SIZE$1;\n\n  for (n = 0; n < elems; n++) {\n    if (tree[n * 2]/*.Freq*/ !== 0) {\n      s.heap[++s.heap_len] = max_code = n;\n      s.depth[n] = 0;\n\n    } else {\n      tree[n * 2 + 1]/*.Len*/ = 0;\n    }\n  }\n\n  /* The pkzip format requires that at least one distance code exists,\n   * and that at least one bit should be sent even if there is only one\n   * possible code. So to avoid special checks later on we force at least\n   * two codes of non zero frequency.\n   */\n  while (s.heap_len < 2) {\n    node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n    tree[node * 2]/*.Freq*/ = 1;\n    s.depth[node] = 0;\n    s.opt_len--;\n\n    if (has_stree) {\n      s.static_len -= stree[node * 2 + 1]/*.Len*/;\n    }\n    /* node is 0 or 1 so it does not have extra bits */\n  }\n  desc.max_code = max_code;\n\n  /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n   * establish sub-heaps of increasing lengths:\n   */\n  for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n  /* Construct the Huffman tree by repeatedly combining the least two\n   * frequent nodes.\n   */\n  node = elems;              /* next internal node of the tree */\n  do {\n    //pqremove(s, tree, n);  /* n = node of least frequency */\n    /*** pqremove ***/\n    n = s.heap[1/*SMALLEST*/];\n    s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n    pqdownheap(s, tree, 1/*SMALLEST*/);\n    /***/\n\n    m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n    s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n    s.heap[--s.heap_max] = m;\n\n    /* Create a new node father of n and m */\n    tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n    s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n    tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n    /* and insert the new node in the heap */\n    s.heap[1/*SMALLEST*/] = node++;\n    pqdownheap(s, tree, 1/*SMALLEST*/);\n\n  } while (s.heap_len >= 2);\n\n  s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n  /* At this point, the fields freq and dad are set. We can now\n   * generate the bit lengths.\n   */\n  gen_bitlen(s, desc);\n\n  /* The field len is now set, we can generate the bit codes */\n  gen_codes(tree, max_code, s.bl_count);\n};\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nconst scan_tree = (s, tree, max_code) =>\n//    deflate_state *s;\n//    ct_data *tree;   /* the tree to be scanned */\n//    int max_code;    /* and its largest code of non zero frequency */\n{\n  let n;                     /* iterates over all tree elements */\n  let prevlen = -1;          /* last emitted length */\n  let curlen;                /* length of current code */\n\n  let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n  let count = 0;             /* repeat count of the current code */\n  let max_count = 7;         /* max repeat count */\n  let min_count = 4;         /* min repeat count */\n\n  if (nextlen === 0) {\n    max_count = 138;\n    min_count = 3;\n  }\n  tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n  for (n = 0; n <= max_code; n++) {\n    curlen = nextlen;\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n    if (++count < max_count && curlen === nextlen) {\n      continue;\n\n    } else if (count < min_count) {\n      s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n    } else if (curlen !== 0) {\n\n      if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n      s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n    } else if (count <= 10) {\n      s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n    } else {\n      s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n    }\n\n    count = 0;\n    prevlen = curlen;\n\n    if (nextlen === 0) {\n      max_count = 138;\n      min_count = 3;\n\n    } else if (curlen === nextlen) {\n      max_count = 6;\n      min_count = 3;\n\n    } else {\n      max_count = 7;\n      min_count = 4;\n    }\n  }\n};\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nconst send_tree = (s, tree, max_code) =>\n//    deflate_state *s;\n//    ct_data *tree; /* the tree to be scanned */\n//    int max_code;       /* and its largest code of non zero frequency */\n{\n  let n;                     /* iterates over all tree elements */\n  let prevlen = -1;          /* last emitted length */\n  let curlen;                /* length of current code */\n\n  let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n  let count = 0;             /* repeat count of the current code */\n  let max_count = 7;         /* max repeat count */\n  let min_count = 4;         /* min repeat count */\n\n  /* tree[max_code+1].Len = -1; */  /* guard already set */\n  if (nextlen === 0) {\n    max_count = 138;\n    min_count = 3;\n  }\n\n  for (n = 0; n <= max_code; n++) {\n    curlen = nextlen;\n    nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n    if (++count < max_count && curlen === nextlen) {\n      continue;\n\n    } else if (count < min_count) {\n      do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n    } else if (curlen !== 0) {\n      if (curlen !== prevlen) {\n        send_code(s, curlen, s.bl_tree);\n        count--;\n      }\n      //Assert(count >= 3 && count <= 6, \" 3_6?\");\n      send_code(s, REP_3_6, s.bl_tree);\n      send_bits(s, count - 3, 2);\n\n    } else if (count <= 10) {\n      send_code(s, REPZ_3_10, s.bl_tree);\n      send_bits(s, count - 3, 3);\n\n    } else {\n      send_code(s, REPZ_11_138, s.bl_tree);\n      send_bits(s, count - 11, 7);\n    }\n\n    count = 0;\n    prevlen = curlen;\n    if (nextlen === 0) {\n      max_count = 138;\n      min_count = 3;\n\n    } else if (curlen === nextlen) {\n      max_count = 6;\n      min_count = 3;\n\n    } else {\n      max_count = 7;\n      min_count = 4;\n    }\n  }\n};\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nconst build_bl_tree = (s) => {\n\n  let max_blindex;  /* index of last bit length code of non zero freq */\n\n  /* Determine the bit length frequencies for literal and distance trees */\n  scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n  scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n  /* Build the bit length tree: */\n  build_tree(s, s.bl_desc);\n  /* opt_len now includes the length of the tree representations, except\n   * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n   */\n\n  /* Determine the number of bit length codes to send. The pkzip format\n   * requires that at least 4 bit length codes be sent. (appnote.txt says\n   * 3 but the actual value used is 4.)\n   */\n  for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) {\n    if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n      break;\n    }\n  }\n  /* Update opt_len to include the bit length tree and counts */\n  s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n  //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n  //        s->opt_len, s->static_len));\n\n  return max_blindex;\n};\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nconst send_all_trees = (s, lcodes, dcodes, blcodes) =>\n//    deflate_state *s;\n//    int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n  let rank;                    /* index in bl_order */\n\n  //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n  //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n  //        \"too many codes\");\n  //Tracev((stderr, \"\\nbl counts: \"));\n  send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n  send_bits(s, dcodes - 1,   5);\n  send_bits(s, blcodes - 4,  4); /* not -3 as stated in appnote.txt */\n  for (rank = 0; rank < blcodes; rank++) {\n    //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n    send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n  }\n  //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n  send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n  //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n  send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n  //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n};\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n *    a) There are no non-portable control characters belonging to the\n *       \"black list\" (0..6, 14..25, 28..31).\n *    b) There is at least one printable character belonging to the\n *       \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n *   \"gray list\" that is ignored in this detection algorithm:\n *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nconst detect_data_type = (s) => {\n  /* black_mask is the bit mask of black-listed bytes\n   * set bits 0..6, 14..25, and 28..31\n   * 0xf3ffc07f = binary 11110011111111111100000001111111\n   */\n  let black_mask = 0xf3ffc07f;\n  let n;\n\n  /* Check for non-textual (\"black-listed\") bytes. */\n  for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n    if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n      return Z_BINARY;\n    }\n  }\n\n  /* Check for textual (\"white-listed\") bytes. */\n  if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n      s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n    return Z_TEXT;\n  }\n  for (n = 32; n < LITERALS$1; n++) {\n    if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n      return Z_TEXT;\n    }\n  }\n\n  /* There are no \"black-listed\" or \"white-listed\" bytes:\n   * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n   */\n  return Z_BINARY;\n};\n\n\nlet static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nconst _tr_init$1 = (s) =>\n{\n\n  if (!static_init_done) {\n    tr_static_init();\n    static_init_done = true;\n  }\n\n  s.l_desc  = new TreeDesc(s.dyn_ltree, static_l_desc);\n  s.d_desc  = new TreeDesc(s.dyn_dtree, static_d_desc);\n  s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n  s.bi_buf = 0;\n  s.bi_valid = 0;\n\n  /* Initialize the first block of the first file: */\n  init_block(s);\n};\n\n\n/* ===========================================================================\n * Send a stored block\n */\nconst _tr_stored_block$1 = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf;       /* input block */\n//ulg stored_len;   /* length of input block */\n//int last;         /* one if this is the last block for a file */\n{\n  send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3);    /* send block type */\n  copy_block(s, buf, stored_len, true); /* with header */\n};\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nconst _tr_align$1 = (s) => {\n  send_bits(s, STATIC_TREES << 1, 3);\n  send_code(s, END_BLOCK, static_ltree);\n  bi_flush(s);\n};\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nconst _tr_flush_block$1 = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf;       /* input block, or NULL if too old */\n//ulg stored_len;   /* length of input block */\n//int last;         /* one if this is the last block for a file */\n{\n  let opt_lenb, static_lenb;  /* opt_len and static_len in bytes */\n  let max_blindex = 0;        /* index of last bit length code of non zero freq */\n\n  /* Build the Huffman trees unless a stored block is forced */\n  if (s.level > 0) {\n\n    /* Check if the file is binary or text */\n    if (s.strm.data_type === Z_UNKNOWN$1) {\n      s.strm.data_type = detect_data_type(s);\n    }\n\n    /* Construct the literal and distance trees */\n    build_tree(s, s.l_desc);\n    // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n    //        s->static_len));\n\n    build_tree(s, s.d_desc);\n    // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n    //        s->static_len));\n    /* At this point, opt_len and static_len are the total bit lengths of\n     * the compressed block data, excluding the tree representations.\n     */\n\n    /* Build the bit length tree for the above two trees, and get the index\n     * in bl_order of the last bit length code to send.\n     */\n    max_blindex = build_bl_tree(s);\n\n    /* Determine the best encoding. Compute the block lengths in bytes. */\n    opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n    static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n    // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n    //        opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n    //        s->last_lit));\n\n    if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n  } else {\n    // Assert(buf != (char*)0, \"lost buf\");\n    opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n  }\n\n  if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n    /* 4: two words for the lengths */\n\n    /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n     * Otherwise we can't have processed more than WSIZE input bytes since\n     * the last block flush, because compression would have been\n     * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n     * transform a block into a stored block.\n     */\n    _tr_stored_block$1(s, buf, stored_len, last);\n\n  } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) {\n\n    send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n    compress_block(s, static_ltree, static_dtree);\n\n  } else {\n    send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n    send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n    compress_block(s, s.dyn_ltree, s.dyn_dtree);\n  }\n  // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n  /* The above check is made mod 2^32, for files larger than 512 MB\n   * and uLong implemented on 32 bits.\n   */\n  init_block(s);\n\n  if (last) {\n    bi_windup(s);\n  }\n  // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n  //       s->compressed_len-7*last));\n};\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nconst _tr_tally$1 = (s, dist, lc) =>\n//    deflate_state *s;\n//    unsigned dist;  /* distance of matched string */\n//    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n  //let out_length, in_length, dcode;\n\n  s.pending_buf[s.d_buf + s.last_lit * 2]     = (dist >>> 8) & 0xff;\n  s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n  s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n  s.last_lit++;\n\n  if (dist === 0) {\n    /* lc is the unmatched char */\n    s.dyn_ltree[lc * 2]/*.Freq*/++;\n  } else {\n    s.matches++;\n    /* Here, lc is the match length - MIN_MATCH */\n    dist--;             /* dist = match distance - 1 */\n    //Assert((ush)dist < (ush)MAX_DIST(s) &&\n    //       (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n    //       (ush)d_code(dist) < (ush)D_CODES,  \"_tr_tally: bad match\");\n\n    s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]/*.Freq*/++;\n    s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n  }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n//  /* Try to guess if it is profitable to stop the current block here */\n//  if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n//    /* Compute an upper bound for the compressed length */\n//    out_length = s.last_lit*8;\n//    in_length = s.strstart - s.block_start;\n//\n//    for (dcode = 0; dcode < D_CODES; dcode++) {\n//      out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n//    }\n//    out_length >>>= 3;\n//    //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n//    //       s->last_lit, in_length, out_length,\n//    //       100L - out_length*100L/in_length));\n//    if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n//      return true;\n//    }\n//  }\n//#endif\n\n  return (s.last_lit === s.lit_bufsize - 1);\n  /* We avoid equality with lit_bufsize because of wraparound at 64K\n   * on 16 bit machines and because stored blocks are restricted to\n   * 64K-1 bytes.\n   */\n};\n\nvar _tr_init_1  = _tr_init$1;\nvar _tr_stored_block_1 = _tr_stored_block$1;\nvar _tr_flush_block_1  = _tr_flush_block$1;\nvar _tr_tally_1 = _tr_tally$1;\nvar _tr_align_1 = _tr_align$1;\n\nvar trees = {\n\t_tr_init: _tr_init_1,\n\t_tr_stored_block: _tr_stored_block_1,\n\t_tr_flush_block: _tr_flush_block_1,\n\t_tr_tally: _tr_tally_1,\n\t_tr_align: _tr_align_1\n};\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = (adler, buf, len, pos) => {\n  let s1 = (adler & 0xffff) |0,\n      s2 = ((adler >>> 16) & 0xffff) |0,\n      n = 0;\n\n  while (len !== 0) {\n    // Set limit ~ twice less than 5552, to keep\n    // s2 in 31-bits, because we force signed ints.\n    // in other case %= will fail.\n    n = len > 2000 ? 2000 : len;\n    len -= n;\n\n    do {\n      s1 = (s1 + buf[pos++]) |0;\n      s2 = (s2 + s1) |0;\n    } while (--n);\n\n    s1 %= 65521;\n    s2 %= 65521;\n  }\n\n  return (s1 | (s2 << 16)) |0;\n};\n\n\nvar adler32_1 = adler32;\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nconst makeTable = () => {\n  let c, table = [];\n\n  for (var n = 0; n < 256; n++) {\n    c = n;\n    for (var k = 0; k < 8; k++) {\n      c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n    }\n    table[n] = c;\n  }\n\n  return table;\n};\n\n// Create table on load. Just 255 signed longs. Not a problem.\nconst crcTable = new Uint32Array(makeTable());\n\n\nconst crc32 = (crc, buf, len, pos) => {\n  const t = crcTable;\n  const end = pos + len;\n\n  crc ^= -1;\n\n  for (let i = pos; i < end; i++) {\n    crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n  }\n\n  return (crc ^ (-1)); // >>> 0;\n};\n\n\nvar crc32_1 = crc32;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar messages = {\n  2:      'need dictionary',     /* Z_NEED_DICT       2  */\n  1:      'stream end',          /* Z_STREAM_END      1  */\n  0:      '',                    /* Z_OK              0  */\n  '-1':   'file error',          /* Z_ERRNO         (-1) */\n  '-2':   'stream error',        /* Z_STREAM_ERROR  (-2) */\n  '-3':   'data error',          /* Z_DATA_ERROR    (-3) */\n  '-4':   'insufficient memory', /* Z_MEM_ERROR     (-4) */\n  '-5':   'buffer error',        /* Z_BUF_ERROR     (-5) */\n  '-6':   'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar constants$2 = {\n\n  /* Allowed flush values; see deflate() and inflate() below for details */\n  Z_NO_FLUSH:         0,\n  Z_PARTIAL_FLUSH:    1,\n  Z_SYNC_FLUSH:       2,\n  Z_FULL_FLUSH:       3,\n  Z_FINISH:           4,\n  Z_BLOCK:            5,\n  Z_TREES:            6,\n\n  /* Return codes for the compression/decompression functions. Negative values\n  * are errors, positive values are used for special but normal events.\n  */\n  Z_OK:               0,\n  Z_STREAM_END:       1,\n  Z_NEED_DICT:        2,\n  Z_ERRNO:           -1,\n  Z_STREAM_ERROR:    -2,\n  Z_DATA_ERROR:      -3,\n  Z_MEM_ERROR:       -4,\n  Z_BUF_ERROR:       -5,\n  //Z_VERSION_ERROR: -6,\n\n  /* compression levels */\n  Z_NO_COMPRESSION:         0,\n  Z_BEST_SPEED:             1,\n  Z_BEST_COMPRESSION:       9,\n  Z_DEFAULT_COMPRESSION:   -1,\n\n\n  Z_FILTERED:               1,\n  Z_HUFFMAN_ONLY:           2,\n  Z_RLE:                    3,\n  Z_FIXED:                  4,\n  Z_DEFAULT_STRATEGY:       0,\n\n  /* Possible values of the data_type field (though see inflate()) */\n  Z_BINARY:                 0,\n  Z_TEXT:                   1,\n  //Z_ASCII:                1, // = Z_TEXT (deprecated)\n  Z_UNKNOWN:                2,\n\n  /* The deflate compression method */\n  Z_DEFLATED:               8\n  //Z_NULL:                 null // Use -1 or null inline, depending on var type\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees;\n\n\n\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n  Z_NO_FLUSH: Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH: Z_FULL_FLUSH$1, Z_FINISH: Z_FINISH$3, Z_BLOCK: Z_BLOCK$1,\n  Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$1,\n  Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,\n  Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,\n  Z_UNKNOWN,\n  Z_DEFLATED: Z_DEFLATED$2\n} = constants$2;\n\n/*============================================================================*/\n\n\nconst MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nconst MAX_WBITS$1 = 15;\n/* 32K LZ77 window */\nconst DEF_MEM_LEVEL = 8;\n\n\nconst LENGTH_CODES  = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nconst LITERALS      = 256;\n/* number of literal bytes 0..255 */\nconst L_CODES       = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nconst D_CODES       = 30;\n/* number of distance codes */\nconst BL_CODES      = 19;\n/* number of codes used to transfer the bit lengths */\nconst HEAP_SIZE     = 2 * L_CODES + 1;\n/* maximum heap size */\nconst MAX_BITS  = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42;\nconst EXTRA_STATE = 69;\nconst NAME_STATE = 73;\nconst COMMENT_STATE = 91;\nconst HCRC_STATE = 103;\nconst BUSY_STATE = 113;\nconst FINISH_STATE = 666;\n\nconst BS_NEED_MORE      = 1; /* block not completed, need more input or more output */\nconst BS_BLOCK_DONE     = 2; /* block flush performed */\nconst BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nconst BS_FINISH_DONE    = 4; /* finish done, accept no more input or output */\n\nconst OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nconst err = (strm, errorCode) => {\n  strm.msg = messages[errorCode];\n  return errorCode;\n};\n\nconst rank = (f) => {\n  return ((f) << 1) - ((f) > 4 ? 9 : 0);\n};\n\nconst zero = (buf) => {\n  let len = buf.length; while (--len >= 0) { buf[len] = 0; }\n};\n\n\n/* eslint-disable new-cap */\nlet HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;\n// This hash causes less collisions, https://github.com/nodeca/pako/issues/135\n// But breaks binary compatibility\n//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;\nlet HASH = HASH_ZLIB;\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nconst flush_pending = (strm) => {\n  const s = strm.state;\n\n  //_tr_flush_bits(s);\n  let len = s.pending;\n  if (len > strm.avail_out) {\n    len = strm.avail_out;\n  }\n  if (len === 0) { return; }\n\n  strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);\n  strm.next_out += len;\n  s.pending_out += len;\n  strm.total_out += len;\n  strm.avail_out -= len;\n  s.pending -= len;\n  if (s.pending === 0) {\n    s.pending_out = 0;\n  }\n};\n\n\nconst flush_block_only = (s, last) => {\n  _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n  s.block_start = s.strstart;\n  flush_pending(s.strm);\n};\n\n\nconst put_byte = (s, b) => {\n  s.pending_buf[s.pending++] = b;\n};\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nconst putShortMSB = (s, b) => {\n\n  //  put_byte(s, (Byte)(b >> 8));\n//  put_byte(s, (Byte)(b & 0xff));\n  s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n  s.pending_buf[s.pending++] = b & 0xff;\n};\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read.  All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nconst read_buf = (strm, buf, start, size) => {\n\n  let len = strm.avail_in;\n\n  if (len > size) { len = size; }\n  if (len === 0) { return 0; }\n\n  strm.avail_in -= len;\n\n  // zmemcpy(buf, strm->next_in, len);\n  buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);\n  if (strm.state.wrap === 1) {\n    strm.adler = adler32_1(strm.adler, buf, len, start);\n  }\n\n  else if (strm.state.wrap === 2) {\n    strm.adler = crc32_1(strm.adler, buf, len, start);\n  }\n\n  strm.next_in += len;\n  strm.total_in += len;\n\n  return len;\n};\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nconst longest_match = (s, cur_match) => {\n\n  let chain_length = s.max_chain_length;      /* max hash chain length */\n  let scan = s.strstart; /* current string */\n  let match;                       /* matched string */\n  let len;                           /* length of current match */\n  let best_len = s.prev_length;              /* best match length so far */\n  let nice_match = s.nice_match;             /* stop if match long enough */\n  const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n      s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n  const _win = s.window; // shortcut\n\n  const wmask = s.w_mask;\n  const prev  = s.prev;\n\n  /* Stop when cur_match becomes <= limit. To simplify the code,\n   * we prevent matches with the string of window index 0.\n   */\n\n  const strend = s.strstart + MAX_MATCH;\n  let scan_end1  = _win[scan + best_len - 1];\n  let scan_end   = _win[scan + best_len];\n\n  /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n   * It is easy to get rid of this optimization if necessary.\n   */\n  // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n  /* Do not waste too much time if we already have a good match: */\n  if (s.prev_length >= s.good_match) {\n    chain_length >>= 2;\n  }\n  /* Do not look for matches beyond the end of the input. This is necessary\n   * to make deflate deterministic.\n   */\n  if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n  // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n  do {\n    // Assert(cur_match < s->strstart, \"no future\");\n    match = cur_match;\n\n    /* Skip to next match if the match length cannot increase\n     * or if the match length is less than 2.  Note that the checks below\n     * for insufficient lookahead only occur occasionally for performance\n     * reasons.  Therefore uninitialized memory will be accessed, and\n     * conditional jumps will be made that depend on those values.\n     * However the length of the match is limited to the lookahead, so\n     * the output of deflate is not affected by the uninitialized values.\n     */\n\n    if (_win[match + best_len]     !== scan_end  ||\n        _win[match + best_len - 1] !== scan_end1 ||\n        _win[match]                !== _win[scan] ||\n        _win[++match]              !== _win[scan + 1]) {\n      continue;\n    }\n\n    /* The check at best_len-1 can be removed because it will be made\n     * again later. (This heuristic is not always a win.)\n     * It is not necessary to compare scan[2] and match[2] since they\n     * are always equal when the other bytes match, given that\n     * the hash keys are equal and that HASH_BITS >= 8.\n     */\n    scan += 2;\n    match++;\n    // Assert(*scan == *match, \"match[2]?\");\n\n    /* We check for insufficient lookahead only every 8th comparison;\n     * the 256th check will be made at strstart+258.\n     */\n    do {\n      /*jshint noempty:false*/\n    } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n             scan < strend);\n\n    // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n    len = MAX_MATCH - (strend - scan);\n    scan = strend - MAX_MATCH;\n\n    if (len > best_len) {\n      s.match_start = cur_match;\n      best_len = len;\n      if (len >= nice_match) {\n        break;\n      }\n      scan_end1  = _win[scan + best_len - 1];\n      scan_end   = _win[scan + best_len];\n    }\n  } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n  if (best_len <= s.lookahead) {\n    return best_len;\n  }\n  return s.lookahead;\n};\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n *    At least one byte has been read, or avail_in == 0; reads are\n *    performed for at least two bytes (required for the zip translate_eol\n *    option -- not supported here).\n */\nconst fill_window = (s) => {\n\n  const _w_size = s.w_size;\n  let p, n, m, more, str;\n\n  //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n  do {\n    more = s.window_size - s.lookahead - s.strstart;\n\n    // JS ints have 32 bit, block below not needed\n    /* Deal with !@#$% 64K limit: */\n    //if (sizeof(int) <= 2) {\n    //    if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n    //        more = wsize;\n    //\n    //  } else if (more == (unsigned)(-1)) {\n    //        /* Very unlikely, but possible on 16 bit machine if\n    //         * strstart == 0 && lookahead == 1 (input done a byte at time)\n    //         */\n    //        more--;\n    //    }\n    //}\n\n\n    /* If the window is almost full and there is insufficient lookahead,\n     * move the upper half to the lower one to make room in the upper half.\n     */\n    if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n      s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0);\n      s.match_start -= _w_size;\n      s.strstart -= _w_size;\n      /* we now have strstart >= MAX_DIST */\n      s.block_start -= _w_size;\n\n      /* Slide the hash table (could be avoided with 32 bit values\n       at the expense of memory usage). We slide even when level == 0\n       to keep the hash table consistent if we switch back to level > 0\n       later. (Using level 0 permanently is not an optimal usage of\n       zlib, so we don't care about this pathological case.)\n       */\n\n      n = s.hash_size;\n      p = n;\n\n      do {\n        m = s.head[--p];\n        s.head[p] = (m >= _w_size ? m - _w_size : 0);\n      } while (--n);\n\n      n = _w_size;\n      p = n;\n\n      do {\n        m = s.prev[--p];\n        s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n        /* If n is not on any hash chain, prev[n] is garbage but\n         * its value will never be used.\n         */\n      } while (--n);\n\n      more += _w_size;\n    }\n    if (s.strm.avail_in === 0) {\n      break;\n    }\n\n    /* If there was no sliding:\n     *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n     *    more == window_size - lookahead - strstart\n     * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n     * => more >= window_size - 2*WSIZE + 2\n     * In the BIG_MEM or MMAP case (not yet supported),\n     *   window_size == input_size + MIN_LOOKAHEAD  &&\n     *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n     * Otherwise, window_size == 2*WSIZE so more >= 2.\n     * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n     */\n    //Assert(more >= 2, \"more < 2\");\n    n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n    s.lookahead += n;\n\n    /* Initialize the hash value now that we have some input: */\n    if (s.lookahead + s.insert >= MIN_MATCH) {\n      str = s.strstart - s.insert;\n      s.ins_h = s.window[str];\n\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n      s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);\n//#if MIN_MATCH != 3\n//        Call update_hash() MIN_MATCH-3 more times\n//#endif\n      while (s.insert) {\n        /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n        s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n        s.prev[str & s.w_mask] = s.head[s.ins_h];\n        s.head[s.ins_h] = str;\n        str++;\n        s.insert--;\n        if (s.lookahead + s.insert < MIN_MATCH) {\n          break;\n        }\n      }\n    }\n    /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n     * but this is not important since only literal bytes will be emitted.\n     */\n\n  } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n  /* If the WIN_INIT bytes after the end of the current data have never been\n   * written, then zero those bytes in order to avoid memory check reports of\n   * the use of uninitialized (or uninitialised as Julian writes) bytes by\n   * the longest match routines.  Update the high water mark for the next\n   * time through here.  WIN_INIT is set to MAX_MATCH since the longest match\n   * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n   */\n//  if (s.high_water < s.window_size) {\n//    const curr = s.strstart + s.lookahead;\n//    let init = 0;\n//\n//    if (s.high_water < curr) {\n//      /* Previous high water mark below current data -- zero WIN_INIT\n//       * bytes or up to end of window, whichever is less.\n//       */\n//      init = s.window_size - curr;\n//      if (init > WIN_INIT)\n//        init = WIN_INIT;\n//      zmemzero(s->window + curr, (unsigned)init);\n//      s->high_water = curr + init;\n//    }\n//    else if (s->high_water < (ulg)curr + WIN_INIT) {\n//      /* High water mark at or above current data, but below current data\n//       * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n//       * to end of window, whichever is less.\n//       */\n//      init = (ulg)curr + WIN_INIT - s->high_water;\n//      if (init > s->window_size - s->high_water)\n//        init = s->window_size - s->high_water;\n//      zmemzero(s->window + s->high_water, (unsigned)init);\n//      s->high_water += init;\n//    }\n//  }\n//\n//  Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n//    \"not enough room for search\");\n};\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nconst deflate_stored = (s, flush) => {\n\n  /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n   * to pending_buf_size, and each stored block has a 5 byte header:\n   */\n  let max_block_size = 0xffff;\n\n  if (max_block_size > s.pending_buf_size - 5) {\n    max_block_size = s.pending_buf_size - 5;\n  }\n\n  /* Copy as much as possible from input to output: */\n  for (;;) {\n    /* Fill the window as much as possible: */\n    if (s.lookahead <= 1) {\n\n      //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n      //  s->block_start >= (long)s->w_size, \"slide too late\");\n//      if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n//        s.block_start >= s.w_size)) {\n//        throw  new Error(\"slide too late\");\n//      }\n\n      fill_window(s);\n      if (s.lookahead === 0 && flush === Z_NO_FLUSH$2) {\n        return BS_NEED_MORE;\n      }\n\n      if (s.lookahead === 0) {\n        break;\n      }\n      /* flush the current block */\n    }\n    //Assert(s->block_start >= 0L, \"block gone\");\n//    if (s.block_start < 0) throw new Error(\"block gone\");\n\n    s.strstart += s.lookahead;\n    s.lookahead = 0;\n\n    /* Emit a stored block if pending_buf will be full: */\n    const max_start = s.block_start + max_block_size;\n\n    if (s.strstart === 0 || s.strstart >= max_start) {\n      /* strstart == 0 is possible when wraparound on 16-bit machine */\n      s.lookahead = s.strstart - max_start;\n      s.strstart = max_start;\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n\n\n    }\n    /* Flush if we may have to slide, otherwise block_start may become\n     * negative and the data will be gone:\n     */\n    if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n\n  s.insert = 0;\n\n  if (flush === Z_FINISH$3) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n\n  if (s.strstart > s.block_start) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n\n  return BS_NEED_MORE;\n};\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nconst deflate_fast = (s, flush) => {\n\n  let hash_head;        /* head of the hash chain */\n  let bflush;           /* set if current block must be flushed */\n\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the next match, plus MIN_MATCH bytes to insert the\n     * string following the next match.\n     */\n    if (s.lookahead < MIN_LOOKAHEAD) {\n      fill_window(s);\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) {\n        break; /* flush the current block */\n      }\n    }\n\n    /* Insert the string window[strstart .. strstart+2] in the\n     * dictionary, and set hash_head to the head of the hash chain:\n     */\n    hash_head = 0/*NIL*/;\n    if (s.lookahead >= MIN_MATCH) {\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n      s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n      s.head[s.ins_h] = s.strstart;\n      /***/\n    }\n\n    /* Find the longest match, discarding those <= prev_length.\n     * At this point we have always match_length < MIN_MATCH\n     */\n    if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n      /* To simplify the code, we prevent matches with the string\n       * of window index 0 (in particular we have to avoid a match\n       * of the string with itself at the start of the input file).\n       */\n      s.match_length = longest_match(s, hash_head);\n      /* longest_match() sets match_start */\n    }\n    if (s.match_length >= MIN_MATCH) {\n      // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n      /*** _tr_tally_dist(s, s.strstart - s.match_start,\n                     s.match_length - MIN_MATCH, bflush); ***/\n      bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n      s.lookahead -= s.match_length;\n\n      /* Insert new strings in the hash table only if the match length\n       * is not too large. This saves time but degrades compression.\n       */\n      if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n        s.match_length--; /* string at strstart already in table */\n        do {\n          s.strstart++;\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n          s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n          s.head[s.ins_h] = s.strstart;\n          /***/\n          /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n           * always MIN_MATCH bytes ahead.\n           */\n        } while (--s.match_length !== 0);\n        s.strstart++;\n      } else\n      {\n        s.strstart += s.match_length;\n        s.match_length = 0;\n        s.ins_h = s.window[s.strstart];\n        /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n        s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);\n\n//#if MIN_MATCH != 3\n//                Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n        /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n         * matter since it will be recomputed at next deflate call.\n         */\n      }\n    } else {\n      /* No match, output a literal byte */\n      //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n      bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n      s.lookahead--;\n      s.strstart++;\n    }\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n  if (flush === Z_FINISH$3) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nconst deflate_slow = (s, flush) => {\n\n  let hash_head;          /* head of hash chain */\n  let bflush;              /* set if current block must be flushed */\n\n  let max_insert;\n\n  /* Process the input block. */\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the next match, plus MIN_MATCH bytes to insert the\n     * string following the next match.\n     */\n    if (s.lookahead < MIN_LOOKAHEAD) {\n      fill_window(s);\n      if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) { break; } /* flush the current block */\n    }\n\n    /* Insert the string window[strstart .. strstart+2] in the\n     * dictionary, and set hash_head to the head of the hash chain:\n     */\n    hash_head = 0/*NIL*/;\n    if (s.lookahead >= MIN_MATCH) {\n      /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n      s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n      hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n      s.head[s.ins_h] = s.strstart;\n      /***/\n    }\n\n    /* Find the longest match, discarding those <= prev_length.\n     */\n    s.prev_length = s.match_length;\n    s.prev_match = s.match_start;\n    s.match_length = MIN_MATCH - 1;\n\n    if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n        s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n      /* To simplify the code, we prevent matches with the string\n       * of window index 0 (in particular we have to avoid a match\n       * of the string with itself at the start of the input file).\n       */\n      s.match_length = longest_match(s, hash_head);\n      /* longest_match() sets match_start */\n\n      if (s.match_length <= 5 &&\n         (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n        /* If prev_match is also MIN_MATCH, match_start is garbage\n         * but we will ignore the current match anyway.\n         */\n        s.match_length = MIN_MATCH - 1;\n      }\n    }\n    /* If there was a match at the previous step and the current\n     * match is not better, output the previous match:\n     */\n    if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n      max_insert = s.strstart + s.lookahead - MIN_MATCH;\n      /* Do not insert strings in hash table beyond this. */\n\n      //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n      /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n                     s.prev_length - MIN_MATCH, bflush);***/\n      bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n      /* Insert in hash table all strings up to the end of the match.\n       * strstart-1 and strstart are already inserted. If there is not\n       * enough lookahead, the last two strings are not inserted in\n       * the hash table.\n       */\n      s.lookahead -= s.prev_length - 1;\n      s.prev_length -= 2;\n      do {\n        if (++s.strstart <= max_insert) {\n          /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n          s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n          hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n          s.head[s.ins_h] = s.strstart;\n          /***/\n        }\n      } while (--s.prev_length !== 0);\n      s.match_available = 0;\n      s.match_length = MIN_MATCH - 1;\n      s.strstart++;\n\n      if (bflush) {\n        /*** FLUSH_BLOCK(s, 0); ***/\n        flush_block_only(s, false);\n        if (s.strm.avail_out === 0) {\n          return BS_NEED_MORE;\n        }\n        /***/\n      }\n\n    } else if (s.match_available) {\n      /* If there was no match at the previous position, output a\n       * single literal. If there was a match but the current match\n       * is longer, truncate the previous match to a single literal.\n       */\n      //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n      /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n      bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n      if (bflush) {\n        /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n        flush_block_only(s, false);\n        /***/\n      }\n      s.strstart++;\n      s.lookahead--;\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n    } else {\n      /* There is no previous match to compare with, wait for\n       * the next step to decide.\n       */\n      s.match_available = 1;\n      s.strstart++;\n      s.lookahead--;\n    }\n  }\n  //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n  if (s.match_available) {\n    //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n    /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n    bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n    s.match_available = 0;\n  }\n  s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n  if (flush === Z_FINISH$3) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n\n  return BS_BLOCK_DONE;\n};\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one.  Do not maintain a hash table.  (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nconst deflate_rle = (s, flush) => {\n\n  let bflush;            /* set if current block must be flushed */\n  let prev;              /* byte at distance one to match */\n  let scan, strend;      /* scan goes up to strend for length of run */\n\n  const _win = s.window;\n\n  for (;;) {\n    /* Make sure that we always have enough lookahead, except\n     * at the end of the input file. We need MAX_MATCH bytes\n     * for the longest run, plus one for the unrolled loop.\n     */\n    if (s.lookahead <= MAX_MATCH) {\n      fill_window(s);\n      if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) {\n        return BS_NEED_MORE;\n      }\n      if (s.lookahead === 0) { break; } /* flush the current block */\n    }\n\n    /* See how many times the previous byte repeats */\n    s.match_length = 0;\n    if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n      scan = s.strstart - 1;\n      prev = _win[scan];\n      if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n        strend = s.strstart + MAX_MATCH;\n        do {\n          /*jshint noempty:false*/\n        } while (prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 prev === _win[++scan] && prev === _win[++scan] &&\n                 scan < strend);\n        s.match_length = MAX_MATCH - (strend - scan);\n        if (s.match_length > s.lookahead) {\n          s.match_length = s.lookahead;\n        }\n      }\n      //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n    }\n\n    /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n    if (s.match_length >= MIN_MATCH) {\n      //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n      /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n      bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n      s.lookahead -= s.match_length;\n      s.strstart += s.match_length;\n      s.match_length = 0;\n    } else {\n      /* No match, output a literal byte */\n      //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n      /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n      bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n      s.lookahead--;\n      s.strstart++;\n    }\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = 0;\n  if (flush === Z_FINISH$3) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nconst deflate_huff = (s, flush) => {\n\n  let bflush;             /* set if current block must be flushed */\n\n  for (;;) {\n    /* Make sure that we have a literal to write. */\n    if (s.lookahead === 0) {\n      fill_window(s);\n      if (s.lookahead === 0) {\n        if (flush === Z_NO_FLUSH$2) {\n          return BS_NEED_MORE;\n        }\n        break;      /* flush the current block */\n      }\n    }\n\n    /* Output a literal byte */\n    s.match_length = 0;\n    //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n    /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n    bflush = _tr_tally(s, 0, s.window[s.strstart]);\n    s.lookahead--;\n    s.strstart++;\n    if (bflush) {\n      /*** FLUSH_BLOCK(s, 0); ***/\n      flush_block_only(s, false);\n      if (s.strm.avail_out === 0) {\n        return BS_NEED_MORE;\n      }\n      /***/\n    }\n  }\n  s.insert = 0;\n  if (flush === Z_FINISH$3) {\n    /*** FLUSH_BLOCK(s, 1); ***/\n    flush_block_only(s, true);\n    if (s.strm.avail_out === 0) {\n      return BS_FINISH_STARTED;\n    }\n    /***/\n    return BS_FINISH_DONE;\n  }\n  if (s.last_lit) {\n    /*** FLUSH_BLOCK(s, 0); ***/\n    flush_block_only(s, false);\n    if (s.strm.avail_out === 0) {\n      return BS_NEED_MORE;\n    }\n    /***/\n  }\n  return BS_BLOCK_DONE;\n};\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\n  this.good_length = good_length;\n  this.max_lazy = max_lazy;\n  this.nice_length = nice_length;\n  this.max_chain = max_chain;\n  this.func = func;\n}\n\nconst configuration_table = [\n  /*      good lazy nice chain */\n  new Config(0, 0, 0, 0, deflate_stored),          /* 0 store only */\n  new Config(4, 4, 8, 4, deflate_fast),            /* 1 max speed, no lazy matches */\n  new Config(4, 5, 16, 8, deflate_fast),           /* 2 */\n  new Config(4, 6, 32, 32, deflate_fast),          /* 3 */\n\n  new Config(4, 4, 16, 16, deflate_slow),          /* 4 lazy matches */\n  new Config(8, 16, 32, 32, deflate_slow),         /* 5 */\n  new Config(8, 16, 128, 128, deflate_slow),       /* 6 */\n  new Config(8, 32, 128, 256, deflate_slow),       /* 7 */\n  new Config(32, 128, 258, 1024, deflate_slow),    /* 8 */\n  new Config(32, 258, 258, 4096, deflate_slow)     /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nconst lm_init = (s) => {\n\n  s.window_size = 2 * s.w_size;\n\n  /*** CLEAR_HASH(s); ***/\n  zero(s.head); // Fill with NIL (= 0);\n\n  /* Set the default configuration parameters:\n   */\n  s.max_lazy_match = configuration_table[s.level].max_lazy;\n  s.good_match = configuration_table[s.level].good_length;\n  s.nice_match = configuration_table[s.level].nice_length;\n  s.max_chain_length = configuration_table[s.level].max_chain;\n\n  s.strstart = 0;\n  s.block_start = 0;\n  s.lookahead = 0;\n  s.insert = 0;\n  s.match_length = s.prev_length = MIN_MATCH - 1;\n  s.match_available = 0;\n  s.ins_h = 0;\n};\n\n\nfunction DeflateState() {\n  this.strm = null;            /* pointer back to this zlib stream */\n  this.status = 0;            /* as the name implies */\n  this.pending_buf = null;      /* output still pending */\n  this.pending_buf_size = 0;  /* size of pending_buf */\n  this.pending_out = 0;       /* next pending byte to output to the stream */\n  this.pending = 0;           /* nb of bytes in the pending buffer */\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\n  this.gzhead = null;         /* gzip header information to write */\n  this.gzindex = 0;           /* where in extra, name, or comment */\n  this.method = Z_DEFLATED$2; /* can only be DEFLATED */\n  this.last_flush = -1;   /* value of flush param for previous deflate call */\n\n  this.w_size = 0;  /* LZ77 window size (32K by default) */\n  this.w_bits = 0;  /* log2(w_size)  (8..16) */\n  this.w_mask = 0;  /* w_size - 1 */\n\n  this.window = null;\n  /* Sliding window. Input bytes are read into the second half of the window,\n   * and move to the first half later to keep a dictionary of at least wSize\n   * bytes. With this organization, matches are limited to a distance of\n   * wSize-MAX_MATCH bytes, but this ensures that IO is always\n   * performed with a length multiple of the block size.\n   */\n\n  this.window_size = 0;\n  /* Actual size of window: 2*wSize, except when the user input buffer\n   * is directly used as sliding window.\n   */\n\n  this.prev = null;\n  /* Link to older string with same hash index. To limit the size of this\n   * array to 64K, this link is maintained only for the last 32K strings.\n   * An index in this array is thus a window index modulo 32K.\n   */\n\n  this.head = null;   /* Heads of the hash chains or NIL. */\n\n  this.ins_h = 0;       /* hash index of string to be inserted */\n  this.hash_size = 0;   /* number of elements in hash table */\n  this.hash_bits = 0;   /* log2(hash_size) */\n  this.hash_mask = 0;   /* hash_size-1 */\n\n  this.hash_shift = 0;\n  /* Number of bits by which ins_h must be shifted at each input\n   * step. It must be such that after MIN_MATCH steps, the oldest\n   * byte no longer takes part in the hash key, that is:\n   *   hash_shift * MIN_MATCH >= hash_bits\n   */\n\n  this.block_start = 0;\n  /* Window position at the beginning of the current output block. Gets\n   * negative when the window is moved backwards.\n   */\n\n  this.match_length = 0;      /* length of best match */\n  this.prev_match = 0;        /* previous match */\n  this.match_available = 0;   /* set if previous match exists */\n  this.strstart = 0;          /* start of string to insert */\n  this.match_start = 0;       /* start of matching string */\n  this.lookahead = 0;         /* number of valid bytes ahead in window */\n\n  this.prev_length = 0;\n  /* Length of the best match at previous step. Matches not greater than this\n   * are discarded. This is used in the lazy match evaluation.\n   */\n\n  this.max_chain_length = 0;\n  /* To speed up deflation, hash chains are never searched beyond this\n   * length.  A higher limit improves compression ratio but degrades the\n   * speed.\n   */\n\n  this.max_lazy_match = 0;\n  /* Attempt to find a better match only when the current match is strictly\n   * smaller than this value. This mechanism is used only for compression\n   * levels >= 4.\n   */\n  // That's alias to max_lazy_match, don't use directly\n  //this.max_insert_length = 0;\n  /* Insert new strings in the hash table only if the match length is not\n   * greater than this length. This saves time but degrades compression.\n   * max_insert_length is used only for compression levels <= 3.\n   */\n\n  this.level = 0;     /* compression level (1..9) */\n  this.strategy = 0;  /* favor or force Huffman coding*/\n\n  this.good_match = 0;\n  /* Use a faster search when the previous match is longer than this */\n\n  this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n              /* used by trees.c: */\n\n  /* Didn't use ct_data typedef below to suppress compiler warning */\n\n  // struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */\n  // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n  // struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */\n\n  // Use flat array of DOUBLE size, with interleaved fata,\n  // because JS does not support effective\n  this.dyn_ltree  = new Uint16Array(HEAP_SIZE * 2);\n  this.dyn_dtree  = new Uint16Array((2 * D_CODES + 1) * 2);\n  this.bl_tree    = new Uint16Array((2 * BL_CODES + 1) * 2);\n  zero(this.dyn_ltree);\n  zero(this.dyn_dtree);\n  zero(this.bl_tree);\n\n  this.l_desc   = null;         /* desc. for literal tree */\n  this.d_desc   = null;         /* desc. for distance tree */\n  this.bl_desc  = null;         /* desc. for bit length tree */\n\n  //ush bl_count[MAX_BITS+1];\n  this.bl_count = new Uint16Array(MAX_BITS + 1);\n  /* number of codes at each bit length for an optimal tree */\n\n  //int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */\n  this.heap = new Uint16Array(2 * L_CODES + 1);  /* heap used to build the Huffman trees */\n  zero(this.heap);\n\n  this.heap_len = 0;               /* number of elements in the heap */\n  this.heap_max = 0;               /* element of largest frequency */\n  /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n   * The same heap array is used to build all trees.\n   */\n\n  this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n  zero(this.depth);\n  /* Depth of each subtree used as tie breaker for trees of equal frequency\n   */\n\n  this.l_buf = 0;          /* buffer index for literals or lengths */\n\n  this.lit_bufsize = 0;\n  /* Size of match buffer for literals/lengths.  There are 4 reasons for\n   * limiting lit_bufsize to 64K:\n   *   - frequencies can be kept in 16 bit counters\n   *   - if compression is not successful for the first block, all input\n   *     data is still in the window so we can still emit a stored block even\n   *     when input comes from standard input.  (This can also be done for\n   *     all blocks if lit_bufsize is not greater than 32K.)\n   *   - if compression is not successful for a file smaller than 64K, we can\n   *     even emit a stored file instead of a stored block (saving 5 bytes).\n   *     This is applicable only for zip (not gzip or zlib).\n   *   - creating new Huffman trees less frequently may not provide fast\n   *     adaptation to changes in the input data statistics. (Take for\n   *     example a binary file with poorly compressible code followed by\n   *     a highly compressible string table.) Smaller buffer sizes give\n   *     fast adaptation but have of course the overhead of transmitting\n   *     trees more frequently.\n   *   - I can't count above 4\n   */\n\n  this.last_lit = 0;      /* running index in l_buf */\n\n  this.d_buf = 0;\n  /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n   * the same number of elements. To use different lengths, an extra flag\n   * array would be necessary.\n   */\n\n  this.opt_len = 0;       /* bit length of current block with optimal trees */\n  this.static_len = 0;    /* bit length of current block with static trees */\n  this.matches = 0;       /* number of string matches in current block */\n  this.insert = 0;        /* bytes at end of window left to insert */\n\n\n  this.bi_buf = 0;\n  /* Output buffer. bits are inserted starting at the bottom (least\n   * significant bits).\n   */\n  this.bi_valid = 0;\n  /* Number of valid bits in bi_buf.  All bits above the last valid bit\n   * are always zero.\n   */\n\n  // Used for window memory init. We safely ignore it for JS. That makes\n  // sense only for pointers and memory check tools.\n  //this.high_water = 0;\n  /* High water mark offset in window for initialized bytes -- bytes above\n   * this are set to zero in order to avoid memory check warnings when\n   * longest match routines access bytes past the input.  This is then\n   * updated to the new high water mark.\n   */\n}\n\n\nconst deflateResetKeep = (strm) => {\n\n  if (!strm || !strm.state) {\n    return err(strm, Z_STREAM_ERROR$2);\n  }\n\n  strm.total_in = strm.total_out = 0;\n  strm.data_type = Z_UNKNOWN;\n\n  const s = strm.state;\n  s.pending = 0;\n  s.pending_out = 0;\n\n  if (s.wrap < 0) {\n    s.wrap = -s.wrap;\n    /* was made negative by deflate(..., Z_FINISH); */\n  }\n  s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n  strm.adler = (s.wrap === 2) ?\n    0  // crc32(0, Z_NULL, 0)\n  :\n    1; // adler32(0, Z_NULL, 0)\n  s.last_flush = Z_NO_FLUSH$2;\n  _tr_init(s);\n  return Z_OK$3;\n};\n\n\nconst deflateReset = (strm) => {\n\n  const ret = deflateResetKeep(strm);\n  if (ret === Z_OK$3) {\n    lm_init(strm.state);\n  }\n  return ret;\n};\n\n\nconst deflateSetHeader = (strm, head) => {\n\n  if (!strm || !strm.state) { return Z_STREAM_ERROR$2; }\n  if (strm.state.wrap !== 2) { return Z_STREAM_ERROR$2; }\n  strm.state.gzhead = head;\n  return Z_OK$3;\n};\n\n\nconst deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {\n\n  if (!strm) { // === Z_NULL\n    return Z_STREAM_ERROR$2;\n  }\n  let wrap = 1;\n\n  if (level === Z_DEFAULT_COMPRESSION$1) {\n    level = 6;\n  }\n\n  if (windowBits < 0) { /* suppress zlib wrapper */\n    wrap = 0;\n    windowBits = -windowBits;\n  }\n\n  else if (windowBits > 15) {\n    wrap = 2;           /* write gzip wrapper instead */\n    windowBits -= 16;\n  }\n\n\n  if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 ||\n    windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n    strategy < 0 || strategy > Z_FIXED) {\n    return err(strm, Z_STREAM_ERROR$2);\n  }\n\n\n  if (windowBits === 8) {\n    windowBits = 9;\n  }\n  /* until 256-byte window bug fixed */\n\n  const s = new DeflateState();\n\n  strm.state = s;\n  s.strm = strm;\n\n  s.wrap = wrap;\n  s.gzhead = null;\n  s.w_bits = windowBits;\n  s.w_size = 1 << s.w_bits;\n  s.w_mask = s.w_size - 1;\n\n  s.hash_bits = memLevel + 7;\n  s.hash_size = 1 << s.hash_bits;\n  s.hash_mask = s.hash_size - 1;\n  s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n  s.window = new Uint8Array(s.w_size * 2);\n  s.head = new Uint16Array(s.hash_size);\n  s.prev = new Uint16Array(s.w_size);\n\n  // Don't need mem init magic for JS.\n  //s.high_water = 0;  /* nothing written to s->window yet */\n\n  s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n  s.pending_buf_size = s.lit_bufsize * 4;\n\n  //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n  //s->pending_buf = (uchf *) overlay;\n  s.pending_buf = new Uint8Array(s.pending_buf_size);\n\n  // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n  //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n  s.d_buf = 1 * s.lit_bufsize;\n\n  //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n  s.l_buf = (1 + 2) * s.lit_bufsize;\n\n  s.level = level;\n  s.strategy = strategy;\n  s.method = method;\n\n  return deflateReset(strm);\n};\n\nconst deflateInit = (strm, level) => {\n\n  return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1);\n};\n\n\nconst deflate$2 = (strm, flush) => {\n\n  let beg, val; // for gzip header write only\n\n  if (!strm || !strm.state ||\n    flush > Z_BLOCK$1 || flush < 0) {\n    return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2;\n  }\n\n  const s = strm.state;\n\n  if (!strm.output ||\n      (!strm.input && strm.avail_in !== 0) ||\n      (s.status === FINISH_STATE && flush !== Z_FINISH$3)) {\n    return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2);\n  }\n\n  s.strm = strm; /* just in case */\n  const old_flush = s.last_flush;\n  s.last_flush = flush;\n\n  /* Write the header */\n  if (s.status === INIT_STATE) {\n\n    if (s.wrap === 2) { // GZIP header\n      strm.adler = 0;  //crc32(0L, Z_NULL, 0);\n      put_byte(s, 31);\n      put_byte(s, 139);\n      put_byte(s, 8);\n      if (!s.gzhead) { // s->gzhead == Z_NULL\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, 0);\n        put_byte(s, s.level === 9 ? 2 :\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n                     4 : 0));\n        put_byte(s, OS_CODE);\n        s.status = BUSY_STATE;\n      }\n      else {\n        put_byte(s, (s.gzhead.text ? 1 : 0) +\n                    (s.gzhead.hcrc ? 2 : 0) +\n                    (!s.gzhead.extra ? 0 : 4) +\n                    (!s.gzhead.name ? 0 : 8) +\n                    (!s.gzhead.comment ? 0 : 16)\n        );\n        put_byte(s, s.gzhead.time & 0xff);\n        put_byte(s, (s.gzhead.time >> 8) & 0xff);\n        put_byte(s, (s.gzhead.time >> 16) & 0xff);\n        put_byte(s, (s.gzhead.time >> 24) & 0xff);\n        put_byte(s, s.level === 9 ? 2 :\n                    (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n                     4 : 0));\n        put_byte(s, s.gzhead.os & 0xff);\n        if (s.gzhead.extra && s.gzhead.extra.length) {\n          put_byte(s, s.gzhead.extra.length & 0xff);\n          put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n        }\n        if (s.gzhead.hcrc) {\n          strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);\n        }\n        s.gzindex = 0;\n        s.status = EXTRA_STATE;\n      }\n    }\n    else // DEFLATE header\n    {\n      let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;\n      let level_flags = -1;\n\n      if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n        level_flags = 0;\n      } else if (s.level < 6) {\n        level_flags = 1;\n      } else if (s.level === 6) {\n        level_flags = 2;\n      } else {\n        level_flags = 3;\n      }\n      header |= (level_flags << 6);\n      if (s.strstart !== 0) { header |= PRESET_DICT; }\n      header += 31 - (header % 31);\n\n      s.status = BUSY_STATE;\n      putShortMSB(s, header);\n\n      /* Save the adler32 of the preset dictionary: */\n      if (s.strstart !== 0) {\n        putShortMSB(s, strm.adler >>> 16);\n        putShortMSB(s, strm.adler & 0xffff);\n      }\n      strm.adler = 1; // adler32(0L, Z_NULL, 0);\n    }\n  }\n\n//#ifdef GZIP\n  if (s.status === EXTRA_STATE) {\n    if (s.gzhead.extra/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n\n      while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            break;\n          }\n        }\n        put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n        s.gzindex++;\n      }\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (s.gzindex === s.gzhead.extra.length) {\n        s.gzindex = 0;\n        s.status = NAME_STATE;\n      }\n    }\n    else {\n      s.status = NAME_STATE;\n    }\n  }\n  if (s.status === NAME_STATE) {\n    if (s.gzhead.name/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n      //int val;\n\n      do {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            val = 1;\n            break;\n          }\n        }\n        // JS specific: little magic to add zero terminator to end of string\n        if (s.gzindex < s.gzhead.name.length) {\n          val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n        } else {\n          val = 0;\n        }\n        put_byte(s, val);\n      } while (val !== 0);\n\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (val === 0) {\n        s.gzindex = 0;\n        s.status = COMMENT_STATE;\n      }\n    }\n    else {\n      s.status = COMMENT_STATE;\n    }\n  }\n  if (s.status === COMMENT_STATE) {\n    if (s.gzhead.comment/* != Z_NULL*/) {\n      beg = s.pending;  /* start of bytes to update crc */\n      //int val;\n\n      do {\n        if (s.pending === s.pending_buf_size) {\n          if (s.gzhead.hcrc && s.pending > beg) {\n            strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n          }\n          flush_pending(strm);\n          beg = s.pending;\n          if (s.pending === s.pending_buf_size) {\n            val = 1;\n            break;\n          }\n        }\n        // JS specific: little magic to add zero terminator to end of string\n        if (s.gzindex < s.gzhead.comment.length) {\n          val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n        } else {\n          val = 0;\n        }\n        put_byte(s, val);\n      } while (val !== 0);\n\n      if (s.gzhead.hcrc && s.pending > beg) {\n        strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n      }\n      if (val === 0) {\n        s.status = HCRC_STATE;\n      }\n    }\n    else {\n      s.status = HCRC_STATE;\n    }\n  }\n  if (s.status === HCRC_STATE) {\n    if (s.gzhead.hcrc) {\n      if (s.pending + 2 > s.pending_buf_size) {\n        flush_pending(strm);\n      }\n      if (s.pending + 2 <= s.pending_buf_size) {\n        put_byte(s, strm.adler & 0xff);\n        put_byte(s, (strm.adler >> 8) & 0xff);\n        strm.adler = 0; //crc32(0L, Z_NULL, 0);\n        s.status = BUSY_STATE;\n      }\n    }\n    else {\n      s.status = BUSY_STATE;\n    }\n  }\n//#endif\n\n  /* Flush as much pending output as possible */\n  if (s.pending !== 0) {\n    flush_pending(strm);\n    if (strm.avail_out === 0) {\n      /* Since avail_out is 0, deflate will be called again with\n       * more output space, but possibly with both pending and\n       * avail_in equal to zero. There won't be anything to do,\n       * but this is not an error situation so make sure we\n       * return OK instead of BUF_ERROR at next call of deflate:\n       */\n      s.last_flush = -1;\n      return Z_OK$3;\n    }\n\n    /* Make sure there is something to do and avoid duplicate consecutive\n     * flushes. For repeated and useless calls with Z_FINISH, we keep\n     * returning Z_STREAM_END instead of Z_BUF_ERROR.\n     */\n  } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n    flush !== Z_FINISH$3) {\n    return err(strm, Z_BUF_ERROR$1);\n  }\n\n  /* User must not provide more input after the first FINISH: */\n  if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n    return err(strm, Z_BUF_ERROR$1);\n  }\n\n  /* Start a new block or continue the current one.\n   */\n  if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n    (flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE)) {\n    let bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n      (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n        configuration_table[s.level].func(s, flush));\n\n    if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n      s.status = FINISH_STATE;\n    }\n    if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n      if (strm.avail_out === 0) {\n        s.last_flush = -1;\n        /* avoid BUF_ERROR next call, see above */\n      }\n      return Z_OK$3;\n      /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n       * of deflate should use the same flush parameter to make sure\n       * that the flush is complete. So we don't have to output an\n       * empty block here, this will be done at next call. This also\n       * ensures that for a very small output buffer, we emit at most\n       * one empty block.\n       */\n    }\n    if (bstate === BS_BLOCK_DONE) {\n      if (flush === Z_PARTIAL_FLUSH) {\n        _tr_align(s);\n      }\n      else if (flush !== Z_BLOCK$1) { /* FULL_FLUSH or SYNC_FLUSH */\n\n        _tr_stored_block(s, 0, 0, false);\n        /* For a full flush, this empty block will be recognized\n         * as a special marker by inflate_sync().\n         */\n        if (flush === Z_FULL_FLUSH$1) {\n          /*** CLEAR_HASH(s); ***/             /* forget history */\n          zero(s.head); // Fill with NIL (= 0);\n\n          if (s.lookahead === 0) {\n            s.strstart = 0;\n            s.block_start = 0;\n            s.insert = 0;\n          }\n        }\n      }\n      flush_pending(strm);\n      if (strm.avail_out === 0) {\n        s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n        return Z_OK$3;\n      }\n    }\n  }\n  //Assert(strm->avail_out > 0, \"bug2\");\n  //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n  if (flush !== Z_FINISH$3) { return Z_OK$3; }\n  if (s.wrap <= 0) { return Z_STREAM_END$3; }\n\n  /* Write the trailer */\n  if (s.wrap === 2) {\n    put_byte(s, strm.adler & 0xff);\n    put_byte(s, (strm.adler >> 8) & 0xff);\n    put_byte(s, (strm.adler >> 16) & 0xff);\n    put_byte(s, (strm.adler >> 24) & 0xff);\n    put_byte(s, strm.total_in & 0xff);\n    put_byte(s, (strm.total_in >> 8) & 0xff);\n    put_byte(s, (strm.total_in >> 16) & 0xff);\n    put_byte(s, (strm.total_in >> 24) & 0xff);\n  }\n  else\n  {\n    putShortMSB(s, strm.adler >>> 16);\n    putShortMSB(s, strm.adler & 0xffff);\n  }\n\n  flush_pending(strm);\n  /* If avail_out is zero, the application will call deflate again\n   * to flush the rest.\n   */\n  if (s.wrap > 0) { s.wrap = -s.wrap; }\n  /* write the trailer only once! */\n  return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3;\n};\n\n\nconst deflateEnd = (strm) => {\n\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n    return Z_STREAM_ERROR$2;\n  }\n\n  const status = strm.state.status;\n  if (status !== INIT_STATE &&\n    status !== EXTRA_STATE &&\n    status !== NAME_STATE &&\n    status !== COMMENT_STATE &&\n    status !== HCRC_STATE &&\n    status !== BUSY_STATE &&\n    status !== FINISH_STATE\n  ) {\n    return err(strm, Z_STREAM_ERROR$2);\n  }\n\n  strm.state = null;\n\n  return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3;\n};\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nconst deflateSetDictionary = (strm, dictionary) => {\n\n  let dictLength = dictionary.length;\n\n  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n    return Z_STREAM_ERROR$2;\n  }\n\n  const s = strm.state;\n  const wrap = s.wrap;\n\n  if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n    return Z_STREAM_ERROR$2;\n  }\n\n  /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n  if (wrap === 1) {\n    /* adler32(strm->adler, dictionary, dictLength); */\n    strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);\n  }\n\n  s.wrap = 0;   /* avoid computing Adler-32 in read_buf */\n\n  /* if dictionary would fill window, just replace the history */\n  if (dictLength >= s.w_size) {\n    if (wrap === 0) {            /* already empty otherwise */\n      /*** CLEAR_HASH(s); ***/\n      zero(s.head); // Fill with NIL (= 0);\n      s.strstart = 0;\n      s.block_start = 0;\n      s.insert = 0;\n    }\n    /* use the tail */\n    // dictionary = dictionary.slice(dictLength - s.w_size);\n    let tmpDict = new Uint8Array(s.w_size);\n    tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);\n    dictionary = tmpDict;\n    dictLength = s.w_size;\n  }\n  /* insert dictionary into window and hash */\n  const avail = strm.avail_in;\n  const next = strm.next_in;\n  const input = strm.input;\n  strm.avail_in = dictLength;\n  strm.next_in = 0;\n  strm.input = dictionary;\n  fill_window(s);\n  while (s.lookahead >= MIN_MATCH) {\n    let str = s.strstart;\n    let n = s.lookahead - (MIN_MATCH - 1);\n    do {\n      /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n      s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n      s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n      s.head[s.ins_h] = str;\n      str++;\n    } while (--n);\n    s.strstart = str;\n    s.lookahead = MIN_MATCH - 1;\n    fill_window(s);\n  }\n  s.strstart += s.lookahead;\n  s.block_start = s.strstart;\n  s.insert = s.lookahead;\n  s.lookahead = 0;\n  s.match_length = s.prev_length = MIN_MATCH - 1;\n  s.match_available = 0;\n  strm.next_in = next;\n  strm.input = input;\n  strm.avail_in = avail;\n  s.wrap = wrap;\n  return Z_OK$3;\n};\n\n\nvar deflateInit_1 = deflateInit;\nvar deflateInit2_1 = deflateInit2;\nvar deflateReset_1 = deflateReset;\nvar deflateResetKeep_1 = deflateResetKeep;\nvar deflateSetHeader_1 = deflateSetHeader;\nvar deflate_2$1 = deflate$2;\nvar deflateEnd_1 = deflateEnd;\nvar deflateSetDictionary_1 = deflateSetDictionary;\nvar deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.deflateBound = deflateBound;\nmodule.exports.deflateCopy = deflateCopy;\nmodule.exports.deflateParams = deflateParams;\nmodule.exports.deflatePending = deflatePending;\nmodule.exports.deflatePrime = deflatePrime;\nmodule.exports.deflateTune = deflateTune;\n*/\n\nvar deflate_1$2 = {\n\tdeflateInit: deflateInit_1,\n\tdeflateInit2: deflateInit2_1,\n\tdeflateReset: deflateReset_1,\n\tdeflateResetKeep: deflateResetKeep_1,\n\tdeflateSetHeader: deflateSetHeader_1,\n\tdeflate: deflate_2$1,\n\tdeflateEnd: deflateEnd_1,\n\tdeflateSetDictionary: deflateSetDictionary_1,\n\tdeflateInfo: deflateInfo\n};\n\nconst _has = (obj, key) => {\n  return Object.prototype.hasOwnProperty.call(obj, key);\n};\n\nvar assign = function (obj /*from1, from2, from3, ...*/) {\n  const sources = Array.prototype.slice.call(arguments, 1);\n  while (sources.length) {\n    const source = sources.shift();\n    if (!source) { continue; }\n\n    if (typeof source !== 'object') {\n      throw new TypeError(source + 'must be non-object');\n    }\n\n    for (const p in source) {\n      if (_has(source, p)) {\n        obj[p] = source[p];\n      }\n    }\n  }\n\n  return obj;\n};\n\n\n// Join array of chunks to single array.\nvar flattenChunks = (chunks) => {\n  // calculate data length\n  let len = 0;\n\n  for (let i = 0, l = chunks.length; i < l; i++) {\n    len += chunks[i].length;\n  }\n\n  // join chunks\n  const result = new Uint8Array(len);\n\n  for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n    let chunk = chunks[i];\n    result.set(chunk, pos);\n    pos += chunk.length;\n  }\n\n  return result;\n};\n\nvar common = {\n\tassign: assign,\n\tflattenChunks: flattenChunks\n};\n\n// String encode/decode helpers\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nlet STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nconst _utf8len = new Uint8Array(256);\nfor (let q = 0; q < 256; q++) {\n  _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nvar string2buf = (str) => {\n  if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n    return new TextEncoder().encode(str);\n  }\n\n  let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n  // count binary size\n  for (m_pos = 0; m_pos < str_len; m_pos++) {\n    c = str.charCodeAt(m_pos);\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n      c2 = str.charCodeAt(m_pos + 1);\n      if ((c2 & 0xfc00) === 0xdc00) {\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n        m_pos++;\n      }\n    }\n    buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n  }\n\n  // allocate buffer\n  buf = new Uint8Array(buf_len);\n\n  // convert\n  for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n    c = str.charCodeAt(m_pos);\n    if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n      c2 = str.charCodeAt(m_pos + 1);\n      if ((c2 & 0xfc00) === 0xdc00) {\n        c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n        m_pos++;\n      }\n    }\n    if (c < 0x80) {\n      /* one byte */\n      buf[i++] = c;\n    } else if (c < 0x800) {\n      /* two bytes */\n      buf[i++] = 0xC0 | (c >>> 6);\n      buf[i++] = 0x80 | (c & 0x3f);\n    } else if (c < 0x10000) {\n      /* three bytes */\n      buf[i++] = 0xE0 | (c >>> 12);\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n      buf[i++] = 0x80 | (c & 0x3f);\n    } else {\n      /* four bytes */\n      buf[i++] = 0xf0 | (c >>> 18);\n      buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n      buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n      buf[i++] = 0x80 | (c & 0x3f);\n    }\n  }\n\n  return buf;\n};\n\n// Helper\nconst buf2binstring = (buf, len) => {\n  // On Chrome, the arguments in a function call that are allowed is `65534`.\n  // If the length of the buffer is smaller than that, we can use this optimization,\n  // otherwise we will take a slower path.\n  if (len < 65534) {\n    if (buf.subarray && STR_APPLY_UIA_OK) {\n      return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n    }\n  }\n\n  let result = '';\n  for (let i = 0; i < len; i++) {\n    result += String.fromCharCode(buf[i]);\n  }\n  return result;\n};\n\n\n// convert array to string\nvar buf2string = (buf, max) => {\n  const len = max || buf.length;\n\n  if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n    return new TextDecoder().decode(buf.subarray(0, max));\n  }\n\n  let i, out;\n\n  // Reserve max possible length (2 words per char)\n  // NB: by unknown reasons, Array is significantly faster for\n  //     String.fromCharCode.apply than Uint16Array.\n  const utf16buf = new Array(len * 2);\n\n  for (out = 0, i = 0; i < len;) {\n    let c = buf[i++];\n    // quick process ascii\n    if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n    let c_len = _utf8len[c];\n    // skip 5 & 6 byte codes\n    if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n    // apply mask on first byte\n    c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n    // join the rest\n    while (c_len > 1 && i < len) {\n      c = (c << 6) | (buf[i++] & 0x3f);\n      c_len--;\n    }\n\n    // terminated by end of string?\n    if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n    if (c < 0x10000) {\n      utf16buf[out++] = c;\n    } else {\n      c -= 0x10000;\n      utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n      utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n    }\n  }\n\n  return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max   - length limit (mandatory);\nvar utf8border = (buf, max) => {\n\n  max = max || buf.length;\n  if (max > buf.length) { max = buf.length; }\n\n  // go back from last position, until start of sequence found\n  let pos = max - 1;\n  while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n  // Very small and broken sequence,\n  // return max, because we should return something anyway.\n  if (pos < 0) { return max; }\n\n  // If we came to start of buffer - that means buffer is too small,\n  // return max too.\n  if (pos === 0) { return max; }\n\n  return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\nvar strings = {\n\tstring2buf: string2buf,\n\tbuf2string: buf2string,\n\tutf8border: utf8border\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n  /* next input byte */\n  this.input = null; // JS specific, because we have no pointers\n  this.next_in = 0;\n  /* number of bytes available at input */\n  this.avail_in = 0;\n  /* total number of input bytes read so far */\n  this.total_in = 0;\n  /* next output byte should be put there */\n  this.output = null; // JS specific, because we have no pointers\n  this.next_out = 0;\n  /* remaining free space at output */\n  this.avail_out = 0;\n  /* total number of bytes output so far */\n  this.total_out = 0;\n  /* last error message, NULL if no error */\n  this.msg = ''/*Z_NULL*/;\n  /* not visible by applications */\n  this.state = null;\n  /* best guess about the data type: binary or text */\n  this.data_type = 2/*Z_UNKNOWN*/;\n  /* adler32 value of the uncompressed data */\n  this.adler = 0;\n}\n\nvar zstream = ZStream;\n\nconst toString$1 = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n  Z_NO_FLUSH: Z_NO_FLUSH$1, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH: Z_FINISH$2,\n  Z_OK: Z_OK$2, Z_STREAM_END: Z_STREAM_END$2,\n  Z_DEFAULT_COMPRESSION,\n  Z_DEFAULT_STRATEGY,\n  Z_DEFLATED: Z_DEFLATED$1\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `header` (Object) - custom header for gzip\n *   - `text` (Boolean) - true if compressed data believed to be text\n *   - `time` (Number) - modification time, unix timestamp\n *   - `os` (Number) - operation system code\n *   - `extra` (Array) - array of bytes with extra data (max 65536)\n *   - `name` (String) - file name (binary string)\n *   - `comment` (String) - comment (binary string)\n *   - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n *   , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n *   , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true);  // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate$1(options) {\n  this.options = common.assign({\n    level: Z_DEFAULT_COMPRESSION,\n    method: Z_DEFLATED$1,\n    chunkSize: 16384,\n    windowBits: 15,\n    memLevel: 8,\n    strategy: Z_DEFAULT_STRATEGY\n  }, options || {});\n\n  let opt = this.options;\n\n  if (opt.raw && (opt.windowBits > 0)) {\n    opt.windowBits = -opt.windowBits;\n  }\n\n  else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n    opt.windowBits += 16;\n  }\n\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\n  this.msg    = '';     // error message\n  this.ended  = false;  // used to avoid multiple onEnd() calls\n  this.chunks = [];     // chunks of compressed data\n\n  this.strm = new zstream();\n  this.strm.avail_out = 0;\n\n  let status = deflate_1$2.deflateInit2(\n    this.strm,\n    opt.level,\n    opt.method,\n    opt.windowBits,\n    opt.memLevel,\n    opt.strategy\n  );\n\n  if (status !== Z_OK$2) {\n    throw new Error(messages[status]);\n  }\n\n  if (opt.header) {\n    deflate_1$2.deflateSetHeader(this.strm, opt.header);\n  }\n\n  if (opt.dictionary) {\n    let dict;\n    // Convert data if needed\n    if (typeof opt.dictionary === 'string') {\n      // If we need to compress text, change encoding to utf8.\n      dict = strings.string2buf(opt.dictionary);\n    } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {\n      dict = new Uint8Array(opt.dictionary);\n    } else {\n      dict = opt.dictionary;\n    }\n\n    status = deflate_1$2.deflateSetDictionary(this.strm, dict);\n\n    if (status !== Z_OK$2) {\n      throw new Error(messages[status]);\n    }\n\n    this._dict_set = true;\n  }\n}\n\n/**\n * Deflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer|String): input data. Strings will be\n *   converted to utf8 byte sequence.\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n *   See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must\n * have `flush_mode` Z_FINISH (or `true`). That will flush internal pending\n * buffers and call [[Deflate#onEnd]].\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true);  // push last chunk\n * ```\n **/\nDeflate$1.prototype.push = function (data, flush_mode) {\n  const strm = this.strm;\n  const chunkSize = this.options.chunkSize;\n  let status, _flush_mode;\n\n  if (this.ended) { return false; }\n\n  if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n  else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;\n\n  // Convert data if needed\n  if (typeof data === 'string') {\n    // If we need to compress text, change encoding to utf8.\n    strm.input = strings.string2buf(data);\n  } else if (toString$1.call(data) === '[object ArrayBuffer]') {\n    strm.input = new Uint8Array(data);\n  } else {\n    strm.input = data;\n  }\n\n  strm.next_in = 0;\n  strm.avail_in = strm.input.length;\n\n  for (;;) {\n    if (strm.avail_out === 0) {\n      strm.output = new Uint8Array(chunkSize);\n      strm.next_out = 0;\n      strm.avail_out = chunkSize;\n    }\n\n    // Make sure avail_out > 6 to avoid repeating markers\n    if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {\n      this.onData(strm.output.subarray(0, strm.next_out));\n      strm.avail_out = 0;\n      continue;\n    }\n\n    status = deflate_1$2.deflate(strm, _flush_mode);\n\n    // Ended => flush and finish\n    if (status === Z_STREAM_END$2) {\n      if (strm.next_out > 0) {\n        this.onData(strm.output.subarray(0, strm.next_out));\n      }\n      status = deflate_1$2.deflateEnd(this.strm);\n      this.onEnd(status);\n      this.ended = true;\n      return status === Z_OK$2;\n    }\n\n    // Flush if out buffer full\n    if (strm.avail_out === 0) {\n      this.onData(strm.output);\n      continue;\n    }\n\n    // Flush if requested and has data\n    if (_flush_mode > 0 && strm.next_out > 0) {\n      this.onData(strm.output.subarray(0, strm.next_out));\n      strm.avail_out = 0;\n      continue;\n    }\n\n    if (strm.avail_in === 0) break;\n  }\n\n  return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array): output data.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate$1.prototype.onData = function (chunk) {\n  this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n *   other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate$1.prototype.onEnd = function (status) {\n  // On success - join\n  if (status === Z_OK$2) {\n    this.result = common.flattenChunks(this.chunks);\n  }\n  this.chunks = [];\n  this.err = status;\n  this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n *   negative windowBits implicitly.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate$1(input, options) {\n  const deflator = new Deflate$1(options);\n\n  deflator.push(input, true);\n\n  // That will never happens, if you don't cheat with options :)\n  if (deflator.err) { throw deflator.msg || messages[deflator.err]; }\n\n  return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw$1(input, options) {\n  options = options || {};\n  options.raw = true;\n  return deflate$1(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip$1(input, options) {\n  options = options || {};\n  options.gzip = true;\n  return deflate$1(input, options);\n}\n\n\nvar Deflate_1$1 = Deflate$1;\nvar deflate_2 = deflate$1;\nvar deflateRaw_1$1 = deflateRaw$1;\nvar gzip_1$1 = gzip$1;\nvar constants$1 = constants$2;\n\nvar deflate_1$1 = {\n\tDeflate: Deflate_1$1,\n\tdeflate: deflate_2,\n\tdeflateRaw: deflateRaw_1$1,\n\tgzip: gzip_1$1,\n\tconstants: constants$1\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nconst BAD$1 = 30;       /* got a data error -- remain here until reset */\nconst TYPE$1 = 12;      /* i: waiting for type bits, including last-flag bit */\n\n/*\n   Decode literal, length, and distance codes and write out the resulting\n   literal and match bytes until either not enough input or output is\n   available, an end-of-block is encountered, or a data error is encountered.\n   When large enough input and output buffers are supplied to inflate(), for\n   example, a 16K input buffer and a 64K output buffer, more than 95% of the\n   inflate execution time is spent in this routine.\n\n   Entry assumptions:\n\n        state.mode === LEN\n        strm.avail_in >= 6\n        strm.avail_out >= 258\n        start >= strm.avail_out\n        state.bits < 8\n\n   On return, state.mode is one of:\n\n        LEN -- ran out of enough output space or enough available input\n        TYPE -- reached end of block code, inflate() to interpret next block\n        BAD -- error in block data\n\n   Notes:\n\n    - The maximum input bits used by a length/distance pair is 15 bits for the\n      length code, 5 bits for the length extra, 15 bits for the distance code,\n      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.\n      Therefore if strm.avail_in >= 6, then there is enough input to avoid\n      checking for available input while decoding.\n\n    - The maximum bytes that a single length/distance pair can output is 258\n      bytes, which is the maximum length that can be coded.  inflate_fast()\n      requires strm.avail_out >= 258 for each loop to avoid checking for\n      output space.\n */\nvar inffast = function inflate_fast(strm, start) {\n  let _in;                    /* local strm.input */\n  let last;                   /* have enough input while in < last */\n  let _out;                   /* local strm.output */\n  let beg;                    /* inflate()'s initial strm.output */\n  let end;                    /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n  let dmax;                   /* maximum distance from zlib header */\n//#endif\n  let wsize;                  /* window size or zero if not using window */\n  let whave;                  /* valid bytes in the window */\n  let wnext;                  /* window write index */\n  // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n  let s_window;               /* allocated sliding window, if wsize != 0 */\n  let hold;                   /* local strm.hold */\n  let bits;                   /* local strm.bits */\n  let lcode;                  /* local strm.lencode */\n  let dcode;                  /* local strm.distcode */\n  let lmask;                  /* mask for first level of length codes */\n  let dmask;                  /* mask for first level of distance codes */\n  let here;                   /* retrieved table entry */\n  let op;                     /* code bits, operation, extra bits, or */\n                              /*  window position, window bytes to copy */\n  let len;                    /* match length, unused bytes */\n  let dist;                   /* match distance */\n  let from;                   /* where to copy match from */\n  let from_source;\n\n\n  let input, output; // JS specific, because we have no pointers\n\n  /* copy state to local variables */\n  const state = strm.state;\n  //here = state.here;\n  _in = strm.next_in;\n  input = strm.input;\n  last = _in + (strm.avail_in - 5);\n  _out = strm.next_out;\n  output = strm.output;\n  beg = _out - (start - strm.avail_out);\n  end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n  dmax = state.dmax;\n//#endif\n  wsize = state.wsize;\n  whave = state.whave;\n  wnext = state.wnext;\n  s_window = state.window;\n  hold = state.hold;\n  bits = state.bits;\n  lcode = state.lencode;\n  dcode = state.distcode;\n  lmask = (1 << state.lenbits) - 1;\n  dmask = (1 << state.distbits) - 1;\n\n\n  /* decode literals and length/distances until end-of-block or not enough\n     input data or output space */\n\n  top:\n  do {\n    if (bits < 15) {\n      hold += input[_in++] << bits;\n      bits += 8;\n      hold += input[_in++] << bits;\n      bits += 8;\n    }\n\n    here = lcode[hold & lmask];\n\n    dolen:\n    for (;;) { // Goto emulation\n      op = here >>> 24/*here.bits*/;\n      hold >>>= op;\n      bits -= op;\n      op = (here >>> 16) & 0xff/*here.op*/;\n      if (op === 0) {                          /* literal */\n        //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n        //        \"inflate:         literal '%c'\\n\" :\n        //        \"inflate:         literal 0x%02x\\n\", here.val));\n        output[_out++] = here & 0xffff/*here.val*/;\n      }\n      else if (op & 16) {                     /* length base */\n        len = here & 0xffff/*here.val*/;\n        op &= 15;                           /* number of extra bits */\n        if (op) {\n          if (bits < op) {\n            hold += input[_in++] << bits;\n            bits += 8;\n          }\n          len += hold & ((1 << op) - 1);\n          hold >>>= op;\n          bits -= op;\n        }\n        //Tracevv((stderr, \"inflate:         length %u\\n\", len));\n        if (bits < 15) {\n          hold += input[_in++] << bits;\n          bits += 8;\n          hold += input[_in++] << bits;\n          bits += 8;\n        }\n        here = dcode[hold & dmask];\n\n        dodist:\n        for (;;) { // goto emulation\n          op = here >>> 24/*here.bits*/;\n          hold >>>= op;\n          bits -= op;\n          op = (here >>> 16) & 0xff/*here.op*/;\n\n          if (op & 16) {                      /* distance base */\n            dist = here & 0xffff/*here.val*/;\n            op &= 15;                       /* number of extra bits */\n            if (bits < op) {\n              hold += input[_in++] << bits;\n              bits += 8;\n              if (bits < op) {\n                hold += input[_in++] << bits;\n                bits += 8;\n              }\n            }\n            dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n            if (dist > dmax) {\n              strm.msg = 'invalid distance too far back';\n              state.mode = BAD$1;\n              break top;\n            }\n//#endif\n            hold >>>= op;\n            bits -= op;\n            //Tracevv((stderr, \"inflate:         distance %u\\n\", dist));\n            op = _out - beg;                /* max distance in output */\n            if (dist > op) {                /* see if copy from window */\n              op = dist - op;               /* distance back in window */\n              if (op > whave) {\n                if (state.sane) {\n                  strm.msg = 'invalid distance too far back';\n                  state.mode = BAD$1;\n                  break top;\n                }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n//                if (len <= op - whave) {\n//                  do {\n//                    output[_out++] = 0;\n//                  } while (--len);\n//                  continue top;\n//                }\n//                len -= op - whave;\n//                do {\n//                  output[_out++] = 0;\n//                } while (--op > whave);\n//                if (op === 0) {\n//                  from = _out - dist;\n//                  do {\n//                    output[_out++] = output[from++];\n//                  } while (--len);\n//                  continue top;\n//                }\n//#endif\n              }\n              from = 0; // window index\n              from_source = s_window;\n              if (wnext === 0) {           /* very common case */\n                from += wsize - op;\n                if (op < len) {         /* some from window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = _out - dist;  /* rest from output */\n                  from_source = output;\n                }\n              }\n              else if (wnext < op) {      /* wrap around window */\n                from += wsize + wnext - op;\n                op -= wnext;\n                if (op < len) {         /* some from end of window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = 0;\n                  if (wnext < len) {  /* some from start of window */\n                    op = wnext;\n                    len -= op;\n                    do {\n                      output[_out++] = s_window[from++];\n                    } while (--op);\n                    from = _out - dist;      /* rest from output */\n                    from_source = output;\n                  }\n                }\n              }\n              else {                      /* contiguous in window */\n                from += wnext - op;\n                if (op < len) {         /* some from window */\n                  len -= op;\n                  do {\n                    output[_out++] = s_window[from++];\n                  } while (--op);\n                  from = _out - dist;  /* rest from output */\n                  from_source = output;\n                }\n              }\n              while (len > 2) {\n                output[_out++] = from_source[from++];\n                output[_out++] = from_source[from++];\n                output[_out++] = from_source[from++];\n                len -= 3;\n              }\n              if (len) {\n                output[_out++] = from_source[from++];\n                if (len > 1) {\n                  output[_out++] = from_source[from++];\n                }\n              }\n            }\n            else {\n              from = _out - dist;          /* copy direct from output */\n              do {                        /* minimum length is three */\n                output[_out++] = output[from++];\n                output[_out++] = output[from++];\n                output[_out++] = output[from++];\n                len -= 3;\n              } while (len > 2);\n              if (len) {\n                output[_out++] = output[from++];\n                if (len > 1) {\n                  output[_out++] = output[from++];\n                }\n              }\n            }\n          }\n          else if ((op & 64) === 0) {          /* 2nd level distance code */\n            here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n            continue dodist;\n          }\n          else {\n            strm.msg = 'invalid distance code';\n            state.mode = BAD$1;\n            break top;\n          }\n\n          break; // need to emulate goto via \"continue\"\n        }\n      }\n      else if ((op & 64) === 0) {              /* 2nd level length code */\n        here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n        continue dolen;\n      }\n      else if (op & 32) {                     /* end-of-block */\n        //Tracevv((stderr, \"inflate:         end of block\\n\"));\n        state.mode = TYPE$1;\n        break top;\n      }\n      else {\n        strm.msg = 'invalid literal/length code';\n        state.mode = BAD$1;\n        break top;\n      }\n\n      break; // need to emulate goto via \"continue\"\n    }\n  } while (_in < last && _out < end);\n\n  /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n  len = bits >> 3;\n  _in -= len;\n  bits -= len << 3;\n  hold &= (1 << bits) - 1;\n\n  /* update state and return */\n  strm.next_in = _in;\n  strm.next_out = _out;\n  strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n  strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n  state.hold = hold;\n  state.bits = bits;\n  return;\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst MAXBITS = 15;\nconst ENOUGH_LENS$1 = 852;\nconst ENOUGH_DISTS$1 = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst CODES$1 = 0;\nconst LENS$1 = 1;\nconst DISTS$1 = 2;\n\nconst lbase = new Uint16Array([ /* Length codes 257..285 base */\n  3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n  35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n]);\n\nconst lext = new Uint8Array([ /* Length codes 257..285 extra */\n  16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n  19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n]);\n\nconst dbase = new Uint16Array([ /* Distance codes 0..29 base */\n  1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n  257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n  8193, 12289, 16385, 24577, 0, 0\n]);\n\nconst dext = new Uint8Array([ /* Distance codes 0..29 extra */\n  16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n  23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n  28, 28, 29, 29, 64, 64\n]);\n\nconst inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n{\n  const bits = opts.bits;\n      //here = opts.here; /* table entry for duplication */\n\n  let len = 0;               /* a code's length in bits */\n  let sym = 0;               /* index of code symbols */\n  let min = 0, max = 0;          /* minimum and maximum code lengths */\n  let root = 0;              /* number of index bits for root table */\n  let curr = 0;              /* number of index bits for current table */\n  let drop = 0;              /* code bits to drop for sub-table */\n  let left = 0;                   /* number of prefix codes available */\n  let used = 0;              /* code entries in table used */\n  let huff = 0;              /* Huffman code */\n  let incr;              /* for incrementing code, index */\n  let fill;              /* index for replicating entries */\n  let low;               /* low bits for current root entry */\n  let mask;              /* mask for low root bits */\n  let next;             /* next available space in table */\n  let base = null;     /* base value table to use */\n  let base_index = 0;\n//  let shoextra;    /* extra bits table to use */\n  let end;                    /* use base and extra for symbol > end */\n  const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1];    /* number of codes of each length */\n  const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1];     /* offsets in table for each length */\n  let extra = null;\n  let extra_index = 0;\n\n  let here_bits, here_op, here_val;\n\n  /*\n   Process a set of code lengths to create a canonical Huffman code.  The\n   code lengths are lens[0..codes-1].  Each length corresponds to the\n   symbols 0..codes-1.  The Huffman code is generated by first sorting the\n   symbols by length from short to long, and retaining the symbol order\n   for codes with equal lengths.  Then the code starts with all zero bits\n   for the first code of the shortest length, and the codes are integer\n   increments for the same length, and zeros are appended as the length\n   increases.  For the deflate format, these bits are stored backwards\n   from their more natural integer increment ordering, and so when the\n   decoding tables are built in the large loop below, the integer codes\n   are incremented backwards.\n\n   This routine assumes, but does not check, that all of the entries in\n   lens[] are in the range 0..MAXBITS.  The caller must assure this.\n   1..MAXBITS is interpreted as that code length.  zero means that that\n   symbol does not occur in this code.\n\n   The codes are sorted by computing a count of codes for each length,\n   creating from that a table of starting indices for each length in the\n   sorted table, and then entering the symbols in order in the sorted\n   table.  The sorted table is work[], with that space being provided by\n   the caller.\n\n   The length counts are used for other purposes as well, i.e. finding\n   the minimum and maximum length codes, determining if there are any\n   codes at all, checking for a valid set of lengths, and looking ahead\n   at length counts to determine sub-table sizes when building the\n   decoding tables.\n   */\n\n  /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n  for (len = 0; len <= MAXBITS; len++) {\n    count[len] = 0;\n  }\n  for (sym = 0; sym < codes; sym++) {\n    count[lens[lens_index + sym]]++;\n  }\n\n  /* bound code lengths, force root to be within code lengths */\n  root = bits;\n  for (max = MAXBITS; max >= 1; max--) {\n    if (count[max] !== 0) { break; }\n  }\n  if (root > max) {\n    root = max;\n  }\n  if (max === 0) {                     /* no symbols to code at all */\n    //table.op[opts.table_index] = 64;  //here.op = (var char)64;    /* invalid code marker */\n    //table.bits[opts.table_index] = 1;   //here.bits = (var char)1;\n    //table.val[opts.table_index++] = 0;   //here.val = (var short)0;\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n    //table.op[opts.table_index] = 64;\n    //table.bits[opts.table_index] = 1;\n    //table.val[opts.table_index++] = 0;\n    table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n    opts.bits = 1;\n    return 0;     /* no symbols, but wait for decoding to report error */\n  }\n  for (min = 1; min < max; min++) {\n    if (count[min] !== 0) { break; }\n  }\n  if (root < min) {\n    root = min;\n  }\n\n  /* check for an over-subscribed or incomplete set of lengths */\n  left = 1;\n  for (len = 1; len <= MAXBITS; len++) {\n    left <<= 1;\n    left -= count[len];\n    if (left < 0) {\n      return -1;\n    }        /* over-subscribed */\n  }\n  if (left > 0 && (type === CODES$1 || max !== 1)) {\n    return -1;                      /* incomplete set */\n  }\n\n  /* generate offsets into symbol table for each length for sorting */\n  offs[1] = 0;\n  for (len = 1; len < MAXBITS; len++) {\n    offs[len + 1] = offs[len] + count[len];\n  }\n\n  /* sort symbols by length, by symbol order within each length */\n  for (sym = 0; sym < codes; sym++) {\n    if (lens[lens_index + sym] !== 0) {\n      work[offs[lens[lens_index + sym]]++] = sym;\n    }\n  }\n\n  /*\n   Create and fill in decoding tables.  In this loop, the table being\n   filled is at next and has curr index bits.  The code being used is huff\n   with length len.  That code is converted to an index by dropping drop\n   bits off of the bottom.  For codes where len is less than drop + curr,\n   those top drop + curr - len bits are incremented through all values to\n   fill the table with replicated entries.\n\n   root is the number of index bits for the root table.  When len exceeds\n   root, sub-tables are created pointed to by the root entry with an index\n   of the low root bits of huff.  This is saved in low to check for when a\n   new sub-table should be started.  drop is zero when the root table is\n   being filled, and drop is root when sub-tables are being filled.\n\n   When a new sub-table is needed, it is necessary to look ahead in the\n   code lengths to determine what size sub-table is needed.  The length\n   counts are used for this, and so count[] is decremented as codes are\n   entered in the tables.\n\n   used keeps track of how many table entries have been allocated from the\n   provided *table space.  It is checked for LENS and DIST tables against\n   the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n   the initial root table size constants.  See the comments in inftrees.h\n   for more information.\n\n   sym increments through all symbols, and the loop terminates when\n   all codes of length max, i.e. all codes, have been processed.  This\n   routine permits incomplete codes, so another loop after this one fills\n   in the rest of the decoding tables with invalid code markers.\n   */\n\n  /* set up for code type */\n  // poor man optimization - use if-else instead of switch,\n  // to avoid deopts in old v8\n  if (type === CODES$1) {\n    base = extra = work;    /* dummy value--not used */\n    end = 19;\n\n  } else if (type === LENS$1) {\n    base = lbase;\n    base_index -= 257;\n    extra = lext;\n    extra_index -= 257;\n    end = 256;\n\n  } else {                    /* DISTS */\n    base = dbase;\n    extra = dext;\n    end = -1;\n  }\n\n  /* initialize opts for loop */\n  huff = 0;                   /* starting code */\n  sym = 0;                    /* starting code symbol */\n  len = min;                  /* starting code length */\n  next = table_index;              /* current table to fill in */\n  curr = root;                /* current table index bits */\n  drop = 0;                   /* current bits to drop from code for index */\n  low = -1;                   /* trigger new sub-table when len > root */\n  used = 1 << root;          /* use root table entries */\n  mask = used - 1;            /* mask for comparing low */\n\n  /* check available table space */\n  if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n    (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n    return 1;\n  }\n\n  /* process all codes and make table entries */\n  for (;;) {\n    /* create table entry */\n    here_bits = len - drop;\n    if (work[sym] < end) {\n      here_op = 0;\n      here_val = work[sym];\n    }\n    else if (work[sym] > end) {\n      here_op = extra[extra_index + work[sym]];\n      here_val = base[base_index + work[sym]];\n    }\n    else {\n      here_op = 32 + 64;         /* end of block */\n      here_val = 0;\n    }\n\n    /* replicate for those indices with low len bits equal to huff */\n    incr = 1 << (len - drop);\n    fill = 1 << curr;\n    min = fill;                 /* save offset to next table */\n    do {\n      fill -= incr;\n      table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n    } while (fill !== 0);\n\n    /* backwards increment the len-bit code huff */\n    incr = 1 << (len - 1);\n    while (huff & incr) {\n      incr >>= 1;\n    }\n    if (incr !== 0) {\n      huff &= incr - 1;\n      huff += incr;\n    } else {\n      huff = 0;\n    }\n\n    /* go to next symbol, update count, len */\n    sym++;\n    if (--count[len] === 0) {\n      if (len === max) { break; }\n      len = lens[lens_index + work[sym]];\n    }\n\n    /* create new sub-table if needed */\n    if (len > root && (huff & mask) !== low) {\n      /* if first time, transition to sub-tables */\n      if (drop === 0) {\n        drop = root;\n      }\n\n      /* increment past last table */\n      next += min;            /* here min is 1 << curr */\n\n      /* determine length of next table */\n      curr = len - drop;\n      left = 1 << curr;\n      while (curr + drop < max) {\n        left -= count[curr + drop];\n        if (left <= 0) { break; }\n        curr++;\n        left <<= 1;\n      }\n\n      /* check for enough space */\n      used += 1 << curr;\n      if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n        (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n        return 1;\n      }\n\n      /* point entry in root table to sub-table */\n      low = huff & mask;\n      /*table.op[low] = curr;\n      table.bits[low] = root;\n      table.val[low] = next - opts.table_index;*/\n      table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n    }\n  }\n\n  /* fill in remaining table entry if code is incomplete (guaranteed to have\n   at most one remaining entry, since if the code is incomplete, the\n   maximum code length that was allowed to get this far is one bit) */\n  if (huff !== 0) {\n    //table.op[next + huff] = 64;            /* invalid code marker */\n    //table.bits[next + huff] = len - drop;\n    //table.val[next + huff] = 0;\n    table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n  }\n\n  /* set return parameters */\n  //opts.table_index += used;\n  opts.bits = root;\n  return 0;\n};\n\n\nvar inftrees = inflate_table;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n  Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n  Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n  Z_DEFLATED\n} = constants$2;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nconst    HEAD = 1;       /* i: waiting for magic header */\nconst    FLAGS = 2;      /* i: waiting for method and flags (gzip) */\nconst    TIME = 3;       /* i: waiting for modification time (gzip) */\nconst    OS = 4;         /* i: waiting for extra flags and operating system (gzip) */\nconst    EXLEN = 5;      /* i: waiting for extra length (gzip) */\nconst    EXTRA = 6;      /* i: waiting for extra bytes (gzip) */\nconst    NAME = 7;       /* i: waiting for end of file name (gzip) */\nconst    COMMENT = 8;    /* i: waiting for end of comment (gzip) */\nconst    HCRC = 9;       /* i: waiting for header crc (gzip) */\nconst    DICTID = 10;    /* i: waiting for dictionary check value */\nconst    DICT = 11;      /* waiting for inflateSetDictionary() call */\nconst        TYPE = 12;      /* i: waiting for type bits, including last-flag bit */\nconst        TYPEDO = 13;    /* i: same, but skip check to exit inflate on new block */\nconst        STORED = 14;    /* i: waiting for stored size (length and complement) */\nconst        COPY_ = 15;     /* i/o: same as COPY below, but only first time in */\nconst        COPY = 16;      /* i/o: waiting for input or output to copy stored block */\nconst        TABLE = 17;     /* i: waiting for dynamic block table lengths */\nconst        LENLENS = 18;   /* i: waiting for code length code lengths */\nconst        CODELENS = 19;  /* i: waiting for length/lit and distance code lengths */\nconst            LEN_ = 20;      /* i: same as LEN below, but only first time in */\nconst            LEN = 21;       /* i: waiting for length/lit/eob code */\nconst            LENEXT = 22;    /* i: waiting for length extra bits */\nconst            DIST = 23;      /* i: waiting for distance code */\nconst            DISTEXT = 24;   /* i: waiting for distance extra bits */\nconst            MATCH = 25;     /* o: waiting for output space to copy string */\nconst            LIT = 26;       /* o: waiting for output space to write literal */\nconst    CHECK = 27;     /* i: waiting for 32-bit check value */\nconst    LENGTH = 28;    /* i: waiting for 32-bit length (gzip) */\nconst    DONE = 29;      /* finished check, done -- remain here until reset */\nconst    BAD = 30;       /* got a data error -- remain here until reset */\nconst    MEM = 31;       /* got an inflate() memory error -- remain here until reset */\nconst    SYNC = 32;      /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH =  (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_WBITS = MAX_WBITS;\n\n\nconst zswap32 = (q) => {\n\n  return  (((q >>> 24) & 0xff) +\n          ((q >>> 8) & 0xff00) +\n          ((q & 0xff00) << 8) +\n          ((q & 0xff) << 24));\n};\n\n\nfunction InflateState() {\n  this.mode = 0;             /* current inflate mode */\n  this.last = false;          /* true if processing last block */\n  this.wrap = 0;              /* bit 0 true for zlib, bit 1 true for gzip */\n  this.havedict = false;      /* true if dictionary provided */\n  this.flags = 0;             /* gzip header method and flags (0 if zlib) */\n  this.dmax = 0;              /* zlib header max distance (INFLATE_STRICT) */\n  this.check = 0;             /* protected copy of check value */\n  this.total = 0;             /* protected copy of output count */\n  // TODO: may be {}\n  this.head = null;           /* where to save gzip header information */\n\n  /* sliding window */\n  this.wbits = 0;             /* log base 2 of requested window size */\n  this.wsize = 0;             /* window size or zero if not using window */\n  this.whave = 0;             /* valid bytes in the window */\n  this.wnext = 0;             /* window write index */\n  this.window = null;         /* allocated sliding window, if needed */\n\n  /* bit accumulator */\n  this.hold = 0;              /* input bit accumulator */\n  this.bits = 0;              /* number of bits in \"in\" */\n\n  /* for string and stored block copying */\n  this.length = 0;            /* literal or length of data to copy */\n  this.offset = 0;            /* distance back to copy string from */\n\n  /* for table and code decoding */\n  this.extra = 0;             /* extra bits needed */\n\n  /* fixed and dynamic code tables */\n  this.lencode = null;          /* starting table for length/literal codes */\n  this.distcode = null;         /* starting table for distance codes */\n  this.lenbits = 0;           /* index bits for lencode */\n  this.distbits = 0;          /* index bits for distcode */\n\n  /* dynamic table building */\n  this.ncode = 0;             /* number of code length code lengths */\n  this.nlen = 0;              /* number of length code lengths */\n  this.ndist = 0;             /* number of distance code lengths */\n  this.have = 0;              /* number of code lengths in lens[] */\n  this.next = null;              /* next available space in codes[] */\n\n  this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n  this.work = new Uint16Array(288); /* work area for code table building */\n\n  /*\n   because we don't have pointers in js, we use lencode and distcode directly\n   as buffers so we don't need codes\n  */\n  //this.codes = new Int32Array(ENOUGH);       /* space for code tables */\n  this.lendyn = null;              /* dynamic table for length/literal codes (JS specific) */\n  this.distdyn = null;             /* dynamic table for distance codes (JS specific) */\n  this.sane = 0;                   /* if false, allow invalid distance too far */\n  this.back = 0;                   /* bits back of last unprocessed length/lit */\n  this.was = 0;                    /* initial length of match */\n}\n\n\nconst inflateResetKeep = (strm) => {\n\n  if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n  const state = strm.state;\n  strm.total_in = strm.total_out = state.total = 0;\n  strm.msg = ''; /*Z_NULL*/\n  if (state.wrap) {       /* to support ill-conceived Java test suite */\n    strm.adler = state.wrap & 1;\n  }\n  state.mode = HEAD;\n  state.last = 0;\n  state.havedict = 0;\n  state.dmax = 32768;\n  state.head = null/*Z_NULL*/;\n  state.hold = 0;\n  state.bits = 0;\n  //state.lencode = state.distcode = state.next = state.codes;\n  state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n  state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n  state.sane = 1;\n  state.back = -1;\n  //Tracev((stderr, \"inflate: reset\\n\"));\n  return Z_OK$1;\n};\n\n\nconst inflateReset = (strm) => {\n\n  if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n  const state = strm.state;\n  state.wsize = 0;\n  state.whave = 0;\n  state.wnext = 0;\n  return inflateResetKeep(strm);\n\n};\n\n\nconst inflateReset2 = (strm, windowBits) => {\n  let wrap;\n\n  /* get the state */\n  if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n  const state = strm.state;\n\n  /* extract wrap request from windowBits parameter */\n  if (windowBits < 0) {\n    wrap = 0;\n    windowBits = -windowBits;\n  }\n  else {\n    wrap = (windowBits >> 4) + 1;\n    if (windowBits < 48) {\n      windowBits &= 15;\n    }\n  }\n\n  /* set number of window bits, free window if different */\n  if (windowBits && (windowBits < 8 || windowBits > 15)) {\n    return Z_STREAM_ERROR$1;\n  }\n  if (state.window !== null && state.wbits !== windowBits) {\n    state.window = null;\n  }\n\n  /* update state and reset the rest of it */\n  state.wrap = wrap;\n  state.wbits = windowBits;\n  return inflateReset(strm);\n};\n\n\nconst inflateInit2 = (strm, windowBits) => {\n\n  if (!strm) { return Z_STREAM_ERROR$1; }\n  //strm.msg = Z_NULL;                 /* in case we return an error */\n\n  const state = new InflateState();\n\n  //if (state === Z_NULL) return Z_MEM_ERROR;\n  //Tracev((stderr, \"inflate: allocated\\n\"));\n  strm.state = state;\n  state.window = null/*Z_NULL*/;\n  const ret = inflateReset2(strm, windowBits);\n  if (ret !== Z_OK$1) {\n    strm.state = null/*Z_NULL*/;\n  }\n  return ret;\n};\n\n\nconst inflateInit = (strm) => {\n\n  return inflateInit2(strm, DEF_WBITS);\n};\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding.  Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter.  This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time.  However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nlet virgin = true;\n\nlet lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\nconst fixedtables = (state) => {\n\n  /* build fixed huffman tables if first call (may not be thread safe) */\n  if (virgin) {\n    lenfix = new Int32Array(512);\n    distfix = new Int32Array(32);\n\n    /* literal/length table */\n    let sym = 0;\n    while (sym < 144) { state.lens[sym++] = 8; }\n    while (sym < 256) { state.lens[sym++] = 9; }\n    while (sym < 280) { state.lens[sym++] = 7; }\n    while (sym < 288) { state.lens[sym++] = 8; }\n\n    inftrees(LENS,  state.lens, 0, 288, lenfix,   0, state.work, { bits: 9 });\n\n    /* distance table */\n    sym = 0;\n    while (sym < 32) { state.lens[sym++] = 5; }\n\n    inftrees(DISTS, state.lens, 0, 32,   distfix, 0, state.work, { bits: 5 });\n\n    /* do this just once */\n    virgin = false;\n  }\n\n  state.lencode = lenfix;\n  state.lenbits = 9;\n  state.distcode = distfix;\n  state.distbits = 5;\n};\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning.  If window does not exist yet, create it.  This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nconst updatewindow = (strm, src, end, copy) => {\n\n  let dist;\n  const state = strm.state;\n\n  /* if it hasn't been done already, allocate space for the window */\n  if (state.window === null) {\n    state.wsize = 1 << state.wbits;\n    state.wnext = 0;\n    state.whave = 0;\n\n    state.window = new Uint8Array(state.wsize);\n  }\n\n  /* copy state->wsize or less output bytes into the circular window */\n  if (copy >= state.wsize) {\n    state.window.set(src.subarray(end - state.wsize, end), 0);\n    state.wnext = 0;\n    state.whave = state.wsize;\n  }\n  else {\n    dist = state.wsize - state.wnext;\n    if (dist > copy) {\n      dist = copy;\n    }\n    //zmemcpy(state->window + state->wnext, end - copy, dist);\n    state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n    copy -= dist;\n    if (copy) {\n      //zmemcpy(state->window, end - copy, copy);\n      state.window.set(src.subarray(end - copy, end), 0);\n      state.wnext = copy;\n      state.whave = state.wsize;\n    }\n    else {\n      state.wnext += dist;\n      if (state.wnext === state.wsize) { state.wnext = 0; }\n      if (state.whave < state.wsize) { state.whave += dist; }\n    }\n  }\n  return 0;\n};\n\n\nconst inflate$2 = (strm, flush) => {\n\n  let state;\n  let input, output;          // input/output buffers\n  let next;                   /* next input INDEX */\n  let put;                    /* next output INDEX */\n  let have, left;             /* available input and output */\n  let hold;                   /* bit buffer */\n  let bits;                   /* bits in bit buffer */\n  let _in, _out;              /* save starting available input and output */\n  let copy;                   /* number of stored or match bytes to copy */\n  let from;                   /* where to copy match bytes from */\n  let from_source;\n  let here = 0;               /* current decoding table entry */\n  let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n  //let last;                   /* parent table entry */\n  let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n  let len;                    /* length to copy for repeats, bits to drop */\n  let ret;                    /* return code */\n  const hbuf = new Uint8Array(4);    /* buffer for gzip header crc calculation */\n  let opts;\n\n  let n; // temporary variable for NEED_BITS\n\n  const order = /* permutation of code lengths */\n    new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n  if (!strm || !strm.state || !strm.output ||\n      (!strm.input && strm.avail_in !== 0)) {\n    return Z_STREAM_ERROR$1;\n  }\n\n  state = strm.state;\n  if (state.mode === TYPE) { state.mode = TYPEDO; }    /* skip check */\n\n\n  //--- LOAD() ---\n  put = strm.next_out;\n  output = strm.output;\n  left = strm.avail_out;\n  next = strm.next_in;\n  input = strm.input;\n  have = strm.avail_in;\n  hold = state.hold;\n  bits = state.bits;\n  //---\n\n  _in = have;\n  _out = left;\n  ret = Z_OK$1;\n\n  inf_leave: // goto emulation\n  for (;;) {\n    switch (state.mode) {\n      case HEAD:\n        if (state.wrap === 0) {\n          state.mode = TYPEDO;\n          break;\n        }\n        //=== NEEDBITS(16);\n        while (bits < 16) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if ((state.wrap & 2) && hold === 0x8b1f) {  /* gzip header */\n          state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n          //=== CRC2(state.check, hold);\n          hbuf[0] = hold & 0xff;\n          hbuf[1] = (hold >>> 8) & 0xff;\n          state.check = crc32_1(state.check, hbuf, 2, 0);\n          //===//\n\n          //=== INITBITS();\n          hold = 0;\n          bits = 0;\n          //===//\n          state.mode = FLAGS;\n          break;\n        }\n        state.flags = 0;           /* expect zlib header */\n        if (state.head) {\n          state.head.done = false;\n        }\n        if (!(state.wrap & 1) ||   /* check if zlib header allowed */\n          (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n          strm.msg = 'incorrect header check';\n          state.mode = BAD;\n          break;\n        }\n        if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n          strm.msg = 'unknown compression method';\n          state.mode = BAD;\n          break;\n        }\n        //--- DROPBITS(4) ---//\n        hold >>>= 4;\n        bits -= 4;\n        //---//\n        len = (hold & 0x0f)/*BITS(4)*/ + 8;\n        if (state.wbits === 0) {\n          state.wbits = len;\n        }\n        else if (len > state.wbits) {\n          strm.msg = 'invalid window size';\n          state.mode = BAD;\n          break;\n        }\n\n        // !!! pako patch. Force use `options.windowBits` if passed.\n        // Required to always use max window size by default.\n        state.dmax = 1 << state.wbits;\n        //state.dmax = 1 << len;\n\n        //Tracev((stderr, \"inflate:   zlib header ok\\n\"));\n        strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n        state.mode = hold & 0x200 ? DICTID : TYPE;\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        break;\n      case FLAGS:\n        //=== NEEDBITS(16); */\n        while (bits < 16) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.flags = hold;\n        if ((state.flags & 0xff) !== Z_DEFLATED) {\n          strm.msg = 'unknown compression method';\n          state.mode = BAD;\n          break;\n        }\n        if (state.flags & 0xe000) {\n          strm.msg = 'unknown header flags set';\n          state.mode = BAD;\n          break;\n        }\n        if (state.head) {\n          state.head.text = ((hold >> 8) & 1);\n        }\n        if (state.flags & 0x0200) {\n          //=== CRC2(state.check, hold);\n          hbuf[0] = hold & 0xff;\n          hbuf[1] = (hold >>> 8) & 0xff;\n          state.check = crc32_1(state.check, hbuf, 2, 0);\n          //===//\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = TIME;\n        /* falls through */\n      case TIME:\n        //=== NEEDBITS(32); */\n        while (bits < 32) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if (state.head) {\n          state.head.time = hold;\n        }\n        if (state.flags & 0x0200) {\n          //=== CRC4(state.check, hold)\n          hbuf[0] = hold & 0xff;\n          hbuf[1] = (hold >>> 8) & 0xff;\n          hbuf[2] = (hold >>> 16) & 0xff;\n          hbuf[3] = (hold >>> 24) & 0xff;\n          state.check = crc32_1(state.check, hbuf, 4, 0);\n          //===\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = OS;\n        /* falls through */\n      case OS:\n        //=== NEEDBITS(16); */\n        while (bits < 16) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if (state.head) {\n          state.head.xflags = (hold & 0xff);\n          state.head.os = (hold >> 8);\n        }\n        if (state.flags & 0x0200) {\n          //=== CRC2(state.check, hold);\n          hbuf[0] = hold & 0xff;\n          hbuf[1] = (hold >>> 8) & 0xff;\n          state.check = crc32_1(state.check, hbuf, 2, 0);\n          //===//\n        }\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = EXLEN;\n        /* falls through */\n      case EXLEN:\n        if (state.flags & 0x0400) {\n          //=== NEEDBITS(16); */\n          while (bits < 16) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          state.length = hold;\n          if (state.head) {\n            state.head.extra_len = hold;\n          }\n          if (state.flags & 0x0200) {\n            //=== CRC2(state.check, hold);\n            hbuf[0] = hold & 0xff;\n            hbuf[1] = (hold >>> 8) & 0xff;\n            state.check = crc32_1(state.check, hbuf, 2, 0);\n            //===//\n          }\n          //=== INITBITS();\n          hold = 0;\n          bits = 0;\n          //===//\n        }\n        else if (state.head) {\n          state.head.extra = null/*Z_NULL*/;\n        }\n        state.mode = EXTRA;\n        /* falls through */\n      case EXTRA:\n        if (state.flags & 0x0400) {\n          copy = state.length;\n          if (copy > have) { copy = have; }\n          if (copy) {\n            if (state.head) {\n              len = state.head.extra_len - state.length;\n              if (!state.head.extra) {\n                // Use untyped array for more convenient processing later\n                state.head.extra = new Uint8Array(state.head.extra_len);\n              }\n              state.head.extra.set(\n                input.subarray(\n                  next,\n                  // extra field is limited to 65536 bytes\n                  // - no need for additional size check\n                  next + copy\n                ),\n                /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n                len\n              );\n              //zmemcpy(state.head.extra + len, next,\n              //        len + copy > state.head.extra_max ?\n              //        state.head.extra_max - len : copy);\n            }\n            if (state.flags & 0x0200) {\n              state.check = crc32_1(state.check, input, copy, next);\n            }\n            have -= copy;\n            next += copy;\n            state.length -= copy;\n          }\n          if (state.length) { break inf_leave; }\n        }\n        state.length = 0;\n        state.mode = NAME;\n        /* falls through */\n      case NAME:\n        if (state.flags & 0x0800) {\n          if (have === 0) { break inf_leave; }\n          copy = 0;\n          do {\n            // TODO: 2 or 1 bytes?\n            len = input[next + copy++];\n            /* use constant limit because in js we should not preallocate memory */\n            if (state.head && len &&\n                (state.length < 65536 /*state.head.name_max*/)) {\n              state.head.name += String.fromCharCode(len);\n            }\n          } while (len && copy < have);\n\n          if (state.flags & 0x0200) {\n            state.check = crc32_1(state.check, input, copy, next);\n          }\n          have -= copy;\n          next += copy;\n          if (len) { break inf_leave; }\n        }\n        else if (state.head) {\n          state.head.name = null;\n        }\n        state.length = 0;\n        state.mode = COMMENT;\n        /* falls through */\n      case COMMENT:\n        if (state.flags & 0x1000) {\n          if (have === 0) { break inf_leave; }\n          copy = 0;\n          do {\n            len = input[next + copy++];\n            /* use constant limit because in js we should not preallocate memory */\n            if (state.head && len &&\n                (state.length < 65536 /*state.head.comm_max*/)) {\n              state.head.comment += String.fromCharCode(len);\n            }\n          } while (len && copy < have);\n          if (state.flags & 0x0200) {\n            state.check = crc32_1(state.check, input, copy, next);\n          }\n          have -= copy;\n          next += copy;\n          if (len) { break inf_leave; }\n        }\n        else if (state.head) {\n          state.head.comment = null;\n        }\n        state.mode = HCRC;\n        /* falls through */\n      case HCRC:\n        if (state.flags & 0x0200) {\n          //=== NEEDBITS(16); */\n          while (bits < 16) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          if (hold !== (state.check & 0xffff)) {\n            strm.msg = 'header crc mismatch';\n            state.mode = BAD;\n            break;\n          }\n          //=== INITBITS();\n          hold = 0;\n          bits = 0;\n          //===//\n        }\n        if (state.head) {\n          state.head.hcrc = ((state.flags >> 9) & 1);\n          state.head.done = true;\n        }\n        strm.adler = state.check = 0;\n        state.mode = TYPE;\n        break;\n      case DICTID:\n        //=== NEEDBITS(32); */\n        while (bits < 32) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        strm.adler = state.check = zswap32(hold);\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = DICT;\n        /* falls through */\n      case DICT:\n        if (state.havedict === 0) {\n          //--- RESTORE() ---\n          strm.next_out = put;\n          strm.avail_out = left;\n          strm.next_in = next;\n          strm.avail_in = have;\n          state.hold = hold;\n          state.bits = bits;\n          //---\n          return Z_NEED_DICT$1;\n        }\n        strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n        state.mode = TYPE;\n        /* falls through */\n      case TYPE:\n        if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n        /* falls through */\n      case TYPEDO:\n        if (state.last) {\n          //--- BYTEBITS() ---//\n          hold >>>= bits & 7;\n          bits -= bits & 7;\n          //---//\n          state.mode = CHECK;\n          break;\n        }\n        //=== NEEDBITS(3); */\n        while (bits < 3) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.last = (hold & 0x01)/*BITS(1)*/;\n        //--- DROPBITS(1) ---//\n        hold >>>= 1;\n        bits -= 1;\n        //---//\n\n        switch ((hold & 0x03)/*BITS(2)*/) {\n          case 0:                             /* stored block */\n            //Tracev((stderr, \"inflate:     stored block%s\\n\",\n            //        state.last ? \" (last)\" : \"\"));\n            state.mode = STORED;\n            break;\n          case 1:                             /* fixed block */\n            fixedtables(state);\n            //Tracev((stderr, \"inflate:     fixed codes block%s\\n\",\n            //        state.last ? \" (last)\" : \"\"));\n            state.mode = LEN_;             /* decode codes */\n            if (flush === Z_TREES) {\n              //--- DROPBITS(2) ---//\n              hold >>>= 2;\n              bits -= 2;\n              //---//\n              break inf_leave;\n            }\n            break;\n          case 2:                             /* dynamic block */\n            //Tracev((stderr, \"inflate:     dynamic codes block%s\\n\",\n            //        state.last ? \" (last)\" : \"\"));\n            state.mode = TABLE;\n            break;\n          case 3:\n            strm.msg = 'invalid block type';\n            state.mode = BAD;\n        }\n        //--- DROPBITS(2) ---//\n        hold >>>= 2;\n        bits -= 2;\n        //---//\n        break;\n      case STORED:\n        //--- BYTEBITS() ---// /* go to byte boundary */\n        hold >>>= bits & 7;\n        bits -= bits & 7;\n        //---//\n        //=== NEEDBITS(32); */\n        while (bits < 32) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n          strm.msg = 'invalid stored block lengths';\n          state.mode = BAD;\n          break;\n        }\n        state.length = hold & 0xffff;\n        //Tracev((stderr, \"inflate:       stored length %u\\n\",\n        //        state.length));\n        //=== INITBITS();\n        hold = 0;\n        bits = 0;\n        //===//\n        state.mode = COPY_;\n        if (flush === Z_TREES) { break inf_leave; }\n        /* falls through */\n      case COPY_:\n        state.mode = COPY;\n        /* falls through */\n      case COPY:\n        copy = state.length;\n        if (copy) {\n          if (copy > have) { copy = have; }\n          if (copy > left) { copy = left; }\n          if (copy === 0) { break inf_leave; }\n          //--- zmemcpy(put, next, copy); ---\n          output.set(input.subarray(next, next + copy), put);\n          //---//\n          have -= copy;\n          next += copy;\n          left -= copy;\n          put += copy;\n          state.length -= copy;\n          break;\n        }\n        //Tracev((stderr, \"inflate:       stored end\\n\"));\n        state.mode = TYPE;\n        break;\n      case TABLE:\n        //=== NEEDBITS(14); */\n        while (bits < 14) {\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n        }\n        //===//\n        state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n        //--- DROPBITS(5) ---//\n        hold >>>= 5;\n        bits -= 5;\n        //---//\n        state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n        //--- DROPBITS(5) ---//\n        hold >>>= 5;\n        bits -= 5;\n        //---//\n        state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n        //--- DROPBITS(4) ---//\n        hold >>>= 4;\n        bits -= 4;\n        //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n        if (state.nlen > 286 || state.ndist > 30) {\n          strm.msg = 'too many length or distance symbols';\n          state.mode = BAD;\n          break;\n        }\n//#endif\n        //Tracev((stderr, \"inflate:       table sizes ok\\n\"));\n        state.have = 0;\n        state.mode = LENLENS;\n        /* falls through */\n      case LENLENS:\n        while (state.have < state.ncode) {\n          //=== NEEDBITS(3);\n          while (bits < 3) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n          //--- DROPBITS(3) ---//\n          hold >>>= 3;\n          bits -= 3;\n          //---//\n        }\n        while (state.have < 19) {\n          state.lens[order[state.have++]] = 0;\n        }\n        // We have separate tables & no pointers. 2 commented lines below not needed.\n        //state.next = state.codes;\n        //state.lencode = state.next;\n        // Switch to use dynamic table\n        state.lencode = state.lendyn;\n        state.lenbits = 7;\n\n        opts = { bits: state.lenbits };\n        ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n        state.lenbits = opts.bits;\n\n        if (ret) {\n          strm.msg = 'invalid code lengths set';\n          state.mode = BAD;\n          break;\n        }\n        //Tracev((stderr, \"inflate:       code lengths ok\\n\"));\n        state.have = 0;\n        state.mode = CODELENS;\n        /* falls through */\n      case CODELENS:\n        while (state.have < state.nlen + state.ndist) {\n          for (;;) {\n            here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n            here_bits = here >>> 24;\n            here_op = (here >>> 16) & 0xff;\n            here_val = here & 0xffff;\n\n            if ((here_bits) <= bits) { break; }\n            //--- PULLBYTE() ---//\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n            //---//\n          }\n          if (here_val < 16) {\n            //--- DROPBITS(here.bits) ---//\n            hold >>>= here_bits;\n            bits -= here_bits;\n            //---//\n            state.lens[state.have++] = here_val;\n          }\n          else {\n            if (here_val === 16) {\n              //=== NEEDBITS(here.bits + 2);\n              n = here_bits + 2;\n              while (bits < n) {\n                if (have === 0) { break inf_leave; }\n                have--;\n                hold += input[next++] << bits;\n                bits += 8;\n              }\n              //===//\n              //--- DROPBITS(here.bits) ---//\n              hold >>>= here_bits;\n              bits -= here_bits;\n              //---//\n              if (state.have === 0) {\n                strm.msg = 'invalid bit length repeat';\n                state.mode = BAD;\n                break;\n              }\n              len = state.lens[state.have - 1];\n              copy = 3 + (hold & 0x03);//BITS(2);\n              //--- DROPBITS(2) ---//\n              hold >>>= 2;\n              bits -= 2;\n              //---//\n            }\n            else if (here_val === 17) {\n              //=== NEEDBITS(here.bits + 3);\n              n = here_bits + 3;\n              while (bits < n) {\n                if (have === 0) { break inf_leave; }\n                have--;\n                hold += input[next++] << bits;\n                bits += 8;\n              }\n              //===//\n              //--- DROPBITS(here.bits) ---//\n              hold >>>= here_bits;\n              bits -= here_bits;\n              //---//\n              len = 0;\n              copy = 3 + (hold & 0x07);//BITS(3);\n              //--- DROPBITS(3) ---//\n              hold >>>= 3;\n              bits -= 3;\n              //---//\n            }\n            else {\n              //=== NEEDBITS(here.bits + 7);\n              n = here_bits + 7;\n              while (bits < n) {\n                if (have === 0) { break inf_leave; }\n                have--;\n                hold += input[next++] << bits;\n                bits += 8;\n              }\n              //===//\n              //--- DROPBITS(here.bits) ---//\n              hold >>>= here_bits;\n              bits -= here_bits;\n              //---//\n              len = 0;\n              copy = 11 + (hold & 0x7f);//BITS(7);\n              //--- DROPBITS(7) ---//\n              hold >>>= 7;\n              bits -= 7;\n              //---//\n            }\n            if (state.have + copy > state.nlen + state.ndist) {\n              strm.msg = 'invalid bit length repeat';\n              state.mode = BAD;\n              break;\n            }\n            while (copy--) {\n              state.lens[state.have++] = len;\n            }\n          }\n        }\n\n        /* handle error breaks in while */\n        if (state.mode === BAD) { break; }\n\n        /* check for end-of-block code (better have one) */\n        if (state.lens[256] === 0) {\n          strm.msg = 'invalid code -- missing end-of-block';\n          state.mode = BAD;\n          break;\n        }\n\n        /* build code tables -- note: do not change the lenbits or distbits\n           values here (9 and 6) without reading the comments in inftrees.h\n           concerning the ENOUGH constants, which depend on those values */\n        state.lenbits = 9;\n\n        opts = { bits: state.lenbits };\n        ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n        // We have separate tables & no pointers. 2 commented lines below not needed.\n        // state.next_index = opts.table_index;\n        state.lenbits = opts.bits;\n        // state.lencode = state.next;\n\n        if (ret) {\n          strm.msg = 'invalid literal/lengths set';\n          state.mode = BAD;\n          break;\n        }\n\n        state.distbits = 6;\n        //state.distcode.copy(state.codes);\n        // Switch to use dynamic table\n        state.distcode = state.distdyn;\n        opts = { bits: state.distbits };\n        ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n        // We have separate tables & no pointers. 2 commented lines below not needed.\n        // state.next_index = opts.table_index;\n        state.distbits = opts.bits;\n        // state.distcode = state.next;\n\n        if (ret) {\n          strm.msg = 'invalid distances set';\n          state.mode = BAD;\n          break;\n        }\n        //Tracev((stderr, 'inflate:       codes ok\\n'));\n        state.mode = LEN_;\n        if (flush === Z_TREES) { break inf_leave; }\n        /* falls through */\n      case LEN_:\n        state.mode = LEN;\n        /* falls through */\n      case LEN:\n        if (have >= 6 && left >= 258) {\n          //--- RESTORE() ---\n          strm.next_out = put;\n          strm.avail_out = left;\n          strm.next_in = next;\n          strm.avail_in = have;\n          state.hold = hold;\n          state.bits = bits;\n          //---\n          inffast(strm, _out);\n          //--- LOAD() ---\n          put = strm.next_out;\n          output = strm.output;\n          left = strm.avail_out;\n          next = strm.next_in;\n          input = strm.input;\n          have = strm.avail_in;\n          hold = state.hold;\n          bits = state.bits;\n          //---\n\n          if (state.mode === TYPE) {\n            state.back = -1;\n          }\n          break;\n        }\n        state.back = 0;\n        for (;;) {\n          here = state.lencode[hold & ((1 << state.lenbits) - 1)];  /*BITS(state.lenbits)*/\n          here_bits = here >>> 24;\n          here_op = (here >>> 16) & 0xff;\n          here_val = here & 0xffff;\n\n          if (here_bits <= bits) { break; }\n          //--- PULLBYTE() ---//\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n          //---//\n        }\n        if (here_op && (here_op & 0xf0) === 0) {\n          last_bits = here_bits;\n          last_op = here_op;\n          last_val = here_val;\n          for (;;) {\n            here = state.lencode[last_val +\n                    ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n            here_bits = here >>> 24;\n            here_op = (here >>> 16) & 0xff;\n            here_val = here & 0xffff;\n\n            if ((last_bits + here_bits) <= bits) { break; }\n            //--- PULLBYTE() ---//\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n            //---//\n          }\n          //--- DROPBITS(last.bits) ---//\n          hold >>>= last_bits;\n          bits -= last_bits;\n          //---//\n          state.back += last_bits;\n        }\n        //--- DROPBITS(here.bits) ---//\n        hold >>>= here_bits;\n        bits -= here_bits;\n        //---//\n        state.back += here_bits;\n        state.length = here_val;\n        if (here_op === 0) {\n          //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n          //        \"inflate:         literal '%c'\\n\" :\n          //        \"inflate:         literal 0x%02x\\n\", here.val));\n          state.mode = LIT;\n          break;\n        }\n        if (here_op & 32) {\n          //Tracevv((stderr, \"inflate:         end of block\\n\"));\n          state.back = -1;\n          state.mode = TYPE;\n          break;\n        }\n        if (here_op & 64) {\n          strm.msg = 'invalid literal/length code';\n          state.mode = BAD;\n          break;\n        }\n        state.extra = here_op & 15;\n        state.mode = LENEXT;\n        /* falls through */\n      case LENEXT:\n        if (state.extra) {\n          //=== NEEDBITS(state.extra);\n          n = state.extra;\n          while (bits < n) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n          //--- DROPBITS(state.extra) ---//\n          hold >>>= state.extra;\n          bits -= state.extra;\n          //---//\n          state.back += state.extra;\n        }\n        //Tracevv((stderr, \"inflate:         length %u\\n\", state.length));\n        state.was = state.length;\n        state.mode = DIST;\n        /* falls through */\n      case DIST:\n        for (;;) {\n          here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n          here_bits = here >>> 24;\n          here_op = (here >>> 16) & 0xff;\n          here_val = here & 0xffff;\n\n          if ((here_bits) <= bits) { break; }\n          //--- PULLBYTE() ---//\n          if (have === 0) { break inf_leave; }\n          have--;\n          hold += input[next++] << bits;\n          bits += 8;\n          //---//\n        }\n        if ((here_op & 0xf0) === 0) {\n          last_bits = here_bits;\n          last_op = here_op;\n          last_val = here_val;\n          for (;;) {\n            here = state.distcode[last_val +\n                    ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n            here_bits = here >>> 24;\n            here_op = (here >>> 16) & 0xff;\n            here_val = here & 0xffff;\n\n            if ((last_bits + here_bits) <= bits) { break; }\n            //--- PULLBYTE() ---//\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n            //---//\n          }\n          //--- DROPBITS(last.bits) ---//\n          hold >>>= last_bits;\n          bits -= last_bits;\n          //---//\n          state.back += last_bits;\n        }\n        //--- DROPBITS(here.bits) ---//\n        hold >>>= here_bits;\n        bits -= here_bits;\n        //---//\n        state.back += here_bits;\n        if (here_op & 64) {\n          strm.msg = 'invalid distance code';\n          state.mode = BAD;\n          break;\n        }\n        state.offset = here_val;\n        state.extra = (here_op) & 15;\n        state.mode = DISTEXT;\n        /* falls through */\n      case DISTEXT:\n        if (state.extra) {\n          //=== NEEDBITS(state.extra);\n          n = state.extra;\n          while (bits < n) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n          //--- DROPBITS(state.extra) ---//\n          hold >>>= state.extra;\n          bits -= state.extra;\n          //---//\n          state.back += state.extra;\n        }\n//#ifdef INFLATE_STRICT\n        if (state.offset > state.dmax) {\n          strm.msg = 'invalid distance too far back';\n          state.mode = BAD;\n          break;\n        }\n//#endif\n        //Tracevv((stderr, \"inflate:         distance %u\\n\", state.offset));\n        state.mode = MATCH;\n        /* falls through */\n      case MATCH:\n        if (left === 0) { break inf_leave; }\n        copy = _out - left;\n        if (state.offset > copy) {         /* copy from window */\n          copy = state.offset - copy;\n          if (copy > state.whave) {\n            if (state.sane) {\n              strm.msg = 'invalid distance too far back';\n              state.mode = BAD;\n              break;\n            }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n//          Trace((stderr, \"inflate.c too far\\n\"));\n//          copy -= state.whave;\n//          if (copy > state.length) { copy = state.length; }\n//          if (copy > left) { copy = left; }\n//          left -= copy;\n//          state.length -= copy;\n//          do {\n//            output[put++] = 0;\n//          } while (--copy);\n//          if (state.length === 0) { state.mode = LEN; }\n//          break;\n//#endif\n          }\n          if (copy > state.wnext) {\n            copy -= state.wnext;\n            from = state.wsize - copy;\n          }\n          else {\n            from = state.wnext - copy;\n          }\n          if (copy > state.length) { copy = state.length; }\n          from_source = state.window;\n        }\n        else {                              /* copy from output */\n          from_source = output;\n          from = put - state.offset;\n          copy = state.length;\n        }\n        if (copy > left) { copy = left; }\n        left -= copy;\n        state.length -= copy;\n        do {\n          output[put++] = from_source[from++];\n        } while (--copy);\n        if (state.length === 0) { state.mode = LEN; }\n        break;\n      case LIT:\n        if (left === 0) { break inf_leave; }\n        output[put++] = state.length;\n        left--;\n        state.mode = LEN;\n        break;\n      case CHECK:\n        if (state.wrap) {\n          //=== NEEDBITS(32);\n          while (bits < 32) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            // Use '|' instead of '+' to make sure that result is signed\n            hold |= input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          _out -= left;\n          strm.total_out += _out;\n          state.total += _out;\n          if (_out) {\n            strm.adler = state.check =\n                /*UPDATE(state.check, put - _out, _out);*/\n                (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n          }\n          _out = left;\n          // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n          if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n            strm.msg = 'incorrect data check';\n            state.mode = BAD;\n            break;\n          }\n          //=== INITBITS();\n          hold = 0;\n          bits = 0;\n          //===//\n          //Tracev((stderr, \"inflate:   check matches trailer\\n\"));\n        }\n        state.mode = LENGTH;\n        /* falls through */\n      case LENGTH:\n        if (state.wrap && state.flags) {\n          //=== NEEDBITS(32);\n          while (bits < 32) {\n            if (have === 0) { break inf_leave; }\n            have--;\n            hold += input[next++] << bits;\n            bits += 8;\n          }\n          //===//\n          if (hold !== (state.total & 0xffffffff)) {\n            strm.msg = 'incorrect length check';\n            state.mode = BAD;\n            break;\n          }\n          //=== INITBITS();\n          hold = 0;\n          bits = 0;\n          //===//\n          //Tracev((stderr, \"inflate:   length matches trailer\\n\"));\n        }\n        state.mode = DONE;\n        /* falls through */\n      case DONE:\n        ret = Z_STREAM_END$1;\n        break inf_leave;\n      case BAD:\n        ret = Z_DATA_ERROR$1;\n        break inf_leave;\n      case MEM:\n        return Z_MEM_ERROR$1;\n      case SYNC:\n        /* falls through */\n      default:\n        return Z_STREAM_ERROR$1;\n    }\n  }\n\n  // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n  /*\n     Return from inflate(), updating the total counts and the check value.\n     If there was no progress during the inflate() call, return a buffer\n     error.  Call updatewindow() to create and/or update the window state.\n     Note: a memory error from inflate() is non-recoverable.\n   */\n\n  //--- RESTORE() ---\n  strm.next_out = put;\n  strm.avail_out = left;\n  strm.next_in = next;\n  strm.avail_in = have;\n  state.hold = hold;\n  state.bits = bits;\n  //---\n\n  if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n                      (state.mode < CHECK || flush !== Z_FINISH$1))) {\n    if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n  }\n  _in -= strm.avail_in;\n  _out -= strm.avail_out;\n  strm.total_in += _in;\n  strm.total_out += _out;\n  state.total += _out;\n  if (state.wrap && _out) {\n    strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n      (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n  }\n  strm.data_type = state.bits + (state.last ? 64 : 0) +\n                    (state.mode === TYPE ? 128 : 0) +\n                    (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n  if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n    ret = Z_BUF_ERROR;\n  }\n  return ret;\n};\n\n\nconst inflateEnd = (strm) => {\n\n  if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n    return Z_STREAM_ERROR$1;\n  }\n\n  let state = strm.state;\n  if (state.window) {\n    state.window = null;\n  }\n  strm.state = null;\n  return Z_OK$1;\n};\n\n\nconst inflateGetHeader = (strm, head) => {\n\n  /* check state */\n  if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n  const state = strm.state;\n  if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n  /* save header structure */\n  state.head = head;\n  head.done = false;\n  return Z_OK$1;\n};\n\n\nconst inflateSetDictionary = (strm, dictionary) => {\n  const dictLength = dictionary.length;\n\n  let state;\n  let dictid;\n  let ret;\n\n  /* check state */\n  if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n  state = strm.state;\n\n  if (state.wrap !== 0 && state.mode !== DICT) {\n    return Z_STREAM_ERROR$1;\n  }\n\n  /* check for correct dictionary identifier */\n  if (state.mode === DICT) {\n    dictid = 1; /* adler32(0, null, 0)*/\n    /* dictid = adler32(dictid, dictionary, dictLength); */\n    dictid = adler32_1(dictid, dictionary, dictLength, 0);\n    if (dictid !== state.check) {\n      return Z_DATA_ERROR$1;\n    }\n  }\n  /* copy dictionary to window using updatewindow(), which will amend the\n   existing dictionary if appropriate */\n  ret = updatewindow(strm, dictionary, dictLength, dictLength);\n  if (ret) {\n    state.mode = MEM;\n    return Z_MEM_ERROR$1;\n  }\n  state.havedict = 1;\n  // Tracev((stderr, \"inflate:   dictionary set\\n\"));\n  return Z_OK$1;\n};\n\n\nvar inflateReset_1 = inflateReset;\nvar inflateReset2_1 = inflateReset2;\nvar inflateResetKeep_1 = inflateResetKeep;\nvar inflateInit_1 = inflateInit;\nvar inflateInit2_1 = inflateInit2;\nvar inflate_2$1 = inflate$2;\nvar inflateEnd_1 = inflateEnd;\nvar inflateGetHeader_1 = inflateGetHeader;\nvar inflateSetDictionary_1 = inflateSetDictionary;\nvar inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.inflateCopy = inflateCopy;\nmodule.exports.inflateGetDictionary = inflateGetDictionary;\nmodule.exports.inflateMark = inflateMark;\nmodule.exports.inflatePrime = inflatePrime;\nmodule.exports.inflateSync = inflateSync;\nmodule.exports.inflateSyncPoint = inflateSyncPoint;\nmodule.exports.inflateUndermine = inflateUndermine;\n*/\n\nvar inflate_1$2 = {\n\tinflateReset: inflateReset_1,\n\tinflateReset2: inflateReset2_1,\n\tinflateResetKeep: inflateResetKeep_1,\n\tinflateInit: inflateInit_1,\n\tinflateInit2: inflateInit2_1,\n\tinflate: inflate_2$1,\n\tinflateEnd: inflateEnd_1,\n\tinflateGetHeader: inflateGetHeader_1,\n\tinflateSetDictionary: inflateSetDictionary_1,\n\tinflateInfo: inflateInfo\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n//   claim that you wrote the original software. If you use this software\n//   in a product, an acknowledgment in the product documentation would be\n//   appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n//   misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n  /* true if compressed data believed to be text */\n  this.text       = 0;\n  /* modification time */\n  this.time       = 0;\n  /* extra flags (not used when writing a gzip file) */\n  this.xflags     = 0;\n  /* operating system */\n  this.os         = 0;\n  /* pointer to extra field or Z_NULL if none */\n  this.extra      = null;\n  /* extra field length (valid if extra != Z_NULL) */\n  this.extra_len  = 0; // Actually, we don't need it in JS,\n                       // but leave for few code modifications\n\n  //\n  // Setup limits is not necessary because in js we should not preallocate memory\n  // for inflate use constant limit in 65536 bytes\n  //\n\n  /* space at extra (only when reading header) */\n  // this.extra_max  = 0;\n  /* pointer to zero-terminated file name or Z_NULL */\n  this.name       = '';\n  /* space at name (only when reading header) */\n  // this.name_max   = 0;\n  /* pointer to zero-terminated comment or Z_NULL */\n  this.comment    = '';\n  /* space at comment (only when reading header) */\n  // this.comm_max   = 0;\n  /* true if there was or will be a header crc */\n  this.hcrc       = 0;\n  /* true when done reading gzip header (not used when writing a gzip file) */\n  this.done       = false;\n}\n\nvar gzheader = GZheader;\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n  Z_NO_FLUSH, Z_FINISH,\n  Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n *   from utf8 to utf16 (javascript) string. When string output requested,\n *   chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true);  // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate$1(options) {\n  this.options = common.assign({\n    chunkSize: 1024 * 64,\n    windowBits: 15,\n    to: ''\n  }, options || {});\n\n  const opt = this.options;\n\n  // Force window size for `raw` data, if not set directly,\n  // because we have no header for autodetect.\n  if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n    opt.windowBits = -opt.windowBits;\n    if (opt.windowBits === 0) { opt.windowBits = -15; }\n  }\n\n  // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n  if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n      !(options && options.windowBits)) {\n    opt.windowBits += 32;\n  }\n\n  // Gzip header has no info about windows size, we can do autodetect only\n  // for deflate. So, if window size not set, force it to max when gzip possible\n  if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n    // bit 3 (16) -> gzipped data\n    // bit 4 (32) -> autodetect gzip/deflate\n    if ((opt.windowBits & 15) === 0) {\n      opt.windowBits |= 15;\n    }\n  }\n\n  this.err    = 0;      // error code, if happens (0 = Z_OK)\n  this.msg    = '';     // error message\n  this.ended  = false;  // used to avoid multiple onEnd() calls\n  this.chunks = [];     // chunks of compressed data\n\n  this.strm   = new zstream();\n  this.strm.avail_out = 0;\n\n  let status  = inflate_1$2.inflateInit2(\n    this.strm,\n    opt.windowBits\n  );\n\n  if (status !== Z_OK) {\n    throw new Error(messages[status]);\n  }\n\n  this.header = new gzheader();\n\n  inflate_1$2.inflateGetHeader(this.strm, this.header);\n\n  // Setup dictionary\n  if (opt.dictionary) {\n    // Convert data if needed\n    if (typeof opt.dictionary === 'string') {\n      opt.dictionary = strings.string2buf(opt.dictionary);\n    } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n      opt.dictionary = new Uint8Array(opt.dictionary);\n    }\n    if (opt.raw) { //In raw mode we need to set the dictionary early\n      status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary);\n      if (status !== Z_OK) {\n        throw new Error(messages[status]);\n      }\n    }\n  }\n}\n\n/**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n *   flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n *   `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true);  // push last chunk\n * ```\n **/\nInflate$1.prototype.push = function (data, flush_mode) {\n  const strm = this.strm;\n  const chunkSize = this.options.chunkSize;\n  const dictionary = this.options.dictionary;\n  let status, _flush_mode, last_avail_out;\n\n  if (this.ended) return false;\n\n  if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n  else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n  // Convert data if needed\n  if (toString.call(data) === '[object ArrayBuffer]') {\n    strm.input = new Uint8Array(data);\n  } else {\n    strm.input = data;\n  }\n\n  strm.next_in = 0;\n  strm.avail_in = strm.input.length;\n\n  for (;;) {\n    if (strm.avail_out === 0) {\n      strm.output = new Uint8Array(chunkSize);\n      strm.next_out = 0;\n      strm.avail_out = chunkSize;\n    }\n\n    status = inflate_1$2.inflate(strm, _flush_mode);\n\n    if (status === Z_NEED_DICT && dictionary) {\n      status = inflate_1$2.inflateSetDictionary(strm, dictionary);\n\n      if (status === Z_OK) {\n        status = inflate_1$2.inflate(strm, _flush_mode);\n      } else if (status === Z_DATA_ERROR) {\n        // Replace code with more verbose\n        status = Z_NEED_DICT;\n      }\n    }\n\n    // Skip snyc markers if more data follows and not raw mode\n    while (strm.avail_in > 0 &&\n           status === Z_STREAM_END &&\n           strm.state.wrap > 0 &&\n           data[strm.next_in] !== 0)\n    {\n      inflate_1$2.inflateReset(strm);\n      status = inflate_1$2.inflate(strm, _flush_mode);\n    }\n\n    switch (status) {\n      case Z_STREAM_ERROR:\n      case Z_DATA_ERROR:\n      case Z_NEED_DICT:\n      case Z_MEM_ERROR:\n        this.onEnd(status);\n        this.ended = true;\n        return false;\n    }\n\n    // Remember real `avail_out` value, because we may patch out buffer content\n    // to align utf8 strings boundaries.\n    last_avail_out = strm.avail_out;\n\n    if (strm.next_out) {\n      if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n        if (this.options.to === 'string') {\n\n          let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n          let tail = strm.next_out - next_out_utf8;\n          let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n          // move tail & realign counters\n          strm.next_out = tail;\n          strm.avail_out = chunkSize - tail;\n          if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n          this.onData(utf8str);\n\n        } else {\n          this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n        }\n      }\n    }\n\n    // Must repeat iteration if out buffer is full\n    if (status === Z_OK && last_avail_out === 0) continue;\n\n    // Finalize if end of stream reached.\n    if (status === Z_STREAM_END) {\n      status = inflate_1$2.inflateEnd(this.strm);\n      this.onEnd(status);\n      this.ended = true;\n      return true;\n    }\n\n    if (strm.avail_in === 0) break;\n  }\n\n  return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n *   each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate$1.prototype.onData = function (chunk) {\n  this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n *   other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate$1.prototype.onEnd = function (status) {\n  // On success - join\n  if (status === Z_OK) {\n    if (this.options.to === 'string') {\n      this.result = this.chunks.join('');\n    } else {\n      this.result = common.flattenChunks(this.chunks);\n    }\n  }\n  this.chunks = [];\n  this.err = status;\n  this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n *   negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n *   from utf8 to utf16 (javascript) string. When string output requested,\n *   chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n *   output = pako.inflate(input);\n * } catch (err) {\n *   console.log(err);\n * }\n * ```\n **/\nfunction inflate$1(input, options) {\n  const inflator = new Inflate$1(options);\n\n  inflator.push(input);\n\n  // That will never happens, if you don't cheat with options :)\n  if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n  return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw$1(input, options) {\n  options = options || {};\n  options.raw = true;\n  return inflate$1(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nvar Inflate_1$1 = Inflate$1;\nvar inflate_2 = inflate$1;\nvar inflateRaw_1$1 = inflateRaw$1;\nvar ungzip$1 = inflate$1;\nvar constants = constants$2;\n\nvar inflate_1$1 = {\n\tInflate: Inflate_1$1,\n\tinflate: inflate_2,\n\tinflateRaw: inflateRaw_1$1,\n\tungzip: ungzip$1,\n\tconstants: constants\n};\n\nconst { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;\n\nconst { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;\n\n\n\nvar Deflate_1 = Deflate;\nvar deflate_1 = deflate;\nvar deflateRaw_1 = deflateRaw;\nvar gzip_1 = gzip;\nvar Inflate_1 = Inflate;\nvar inflate_1 = inflate;\nvar inflateRaw_1 = inflateRaw;\nvar ungzip_1 = ungzip;\nvar constants_1 = constants$2;\n\nvar pako = {\n\tDeflate: Deflate_1,\n\tdeflate: deflate_1,\n\tdeflateRaw: deflateRaw_1,\n\tgzip: gzip_1,\n\tInflate: Inflate_1,\n\tinflate: inflate_1,\n\tinflateRaw: inflateRaw_1,\n\tungzip: ungzip_1,\n\tconstants: constants_1\n};\n\n\n\n\n//# sourceURL=webpack://django-universal-uploader-widget/./node_modules/pako/dist/pako.esm.mjs?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => (module['default']) :
/******/ 				() => (module);
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	__webpack_require__("./src/UniversalUploaderInline.ts");
/******/ 	var __webpack_exports__ = __webpack_require__("./src/UniversalUploaderInline.scss");
/******/ 	
/******/ })()
;