@kne-components/components-core 0.4.45 → 0.4.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +111 -111
- package/build/index.html +1 -1
- package/build/remoteEntry.js +1 -1
- package/build/remoteEntry.js.map +1 -1
- package/build/static/css/1381.97c23e40.chunk.css +2 -0
- package/build/static/css/1381.97c23e40.chunk.css.map +1 -0
- package/build/static/css/1742.72826de6.chunk.css +2 -0
- package/build/static/css/{1742.12f27291.chunk.css.map → 1742.72826de6.chunk.css.map} +1 -1
- package/build/static/css/{1996.e97d56df.chunk.css → 1996.052f96b0.chunk.css} +2 -2
- package/build/static/css/{1996.e97d56df.chunk.css.map → 1996.052f96b0.chunk.css.map} +1 -1
- package/build/static/css/2004.59eeddc7.chunk.css +2 -0
- package/build/static/css/{2004.33c1e186.chunk.css.map → 2004.59eeddc7.chunk.css.map} +1 -1
- package/build/static/css/2307.4b3df026.chunk.css +2 -0
- package/build/static/css/2307.4b3df026.chunk.css.map +1 -0
- package/build/static/css/254.ee7957b1.chunk.css +2 -0
- package/build/static/css/254.ee7957b1.chunk.css.map +1 -0
- package/build/static/css/3404.f9aed7da.chunk.css +2 -0
- package/build/static/css/{3404.6f0b882e.chunk.css.map → 3404.f9aed7da.chunk.css.map} +1 -1
- package/build/static/css/3625.de3c6911.chunk.css +2 -0
- package/build/static/css/3625.de3c6911.chunk.css.map +1 -0
- package/build/static/css/{3771.accb9a83.chunk.css → 3771.0b0ceea9.chunk.css} +2 -2
- package/build/static/css/{3771.accb9a83.chunk.css.map → 3771.0b0ceea9.chunk.css.map} +1 -1
- package/build/static/css/{3790.8118caa7.chunk.css → 3790.0a878038.chunk.css} +2 -2
- package/build/static/css/{3790.8118caa7.chunk.css.map → 3790.0a878038.chunk.css.map} +1 -1
- package/build/static/css/5195.841f8004.chunk.css +2 -0
- package/build/static/css/5195.841f8004.chunk.css.map +1 -0
- package/build/static/css/{5582.877dc4db.chunk.css → 5582.1990debe.chunk.css} +2 -2
- package/build/static/css/5582.1990debe.chunk.css.map +1 -0
- package/build/static/css/5633.97c23e40.chunk.css +2 -0
- package/build/static/css/5633.97c23e40.chunk.css.map +1 -0
- package/build/static/css/5674.c88fd2db.chunk.css +2 -0
- package/build/static/css/5674.c88fd2db.chunk.css.map +1 -0
- package/build/static/css/653.f1a8c344.chunk.css +2 -0
- package/build/static/css/653.f1a8c344.chunk.css.map +1 -0
- package/build/static/css/{6763.5cb27d52.chunk.css → 6763.0df869ff.chunk.css} +2 -2
- package/build/static/css/{6763.5cb27d52.chunk.css.map → 6763.0df869ff.chunk.css.map} +1 -1
- package/build/static/css/7227.d9d1299c.chunk.css +2 -0
- package/build/static/css/{7227.65ee4c4e.chunk.css.map → 7227.d9d1299c.chunk.css.map} +1 -1
- package/build/static/css/7589.f3c8f89b.chunk.css +2 -0
- package/build/static/css/7589.f3c8f89b.chunk.css.map +1 -0
- package/build/static/css/{760.9d94b7ab.chunk.css → 760.f8be7f84.chunk.css} +2 -2
- package/build/static/css/{760.9d94b7ab.chunk.css.map → 760.f8be7f84.chunk.css.map} +1 -1
- package/build/static/css/7857.484072c1.chunk.css +2 -0
- package/build/static/css/{7857.ec76e428.chunk.css.map → 7857.484072c1.chunk.css.map} +1 -1
- package/build/static/css/7987.97c23e40.chunk.css +2 -0
- package/build/static/css/7987.97c23e40.chunk.css.map +1 -0
- package/build/static/css/833.e28708c8.chunk.css +2 -0
- package/build/static/css/{833.deb93503.chunk.css.map → 833.e28708c8.chunk.css.map} +1 -1
- package/build/static/css/{8593.4a9031dc.chunk.css → 8593.7ef21cba.chunk.css} +2 -2
- package/build/static/css/{8593.4a9031dc.chunk.css.map → 8593.7ef21cba.chunk.css.map} +1 -1
- package/build/static/css/8689.906ec3c8.chunk.css +12 -0
- package/build/static/css/8689.906ec3c8.chunk.css.map +1 -0
- package/build/static/css/9556.3c875a41.chunk.css +2 -0
- package/build/static/css/{9556.78fa406b.chunk.css.map → 9556.3c875a41.chunk.css.map} +1 -1
- package/build/static/js/{1381.3a1fb929.chunk.js → 1381.37b05f38.chunk.js} +1 -1
- package/build/static/js/1742.59b24864.chunk.js +2 -0
- package/build/static/js/1742.59b24864.chunk.js.map +1 -0
- package/build/static/js/{1996.758be72d.chunk.js → 1996.14344c2d.chunk.js} +2 -2
- package/build/static/js/{1996.758be72d.chunk.js.map → 1996.14344c2d.chunk.js.map} +1 -1
- package/build/static/js/{2004.74384107.chunk.js → 2004.d8122da2.chunk.js} +3 -3
- package/build/static/js/{2004.74384107.chunk.js.map → 2004.d8122da2.chunk.js.map} +1 -1
- package/build/static/js/2086.c3a0124d.chunk.js +3 -0
- package/build/static/js/2086.c3a0124d.chunk.js.map +1 -0
- package/build/static/js/{2242.a0059cca.chunk.js → 2242.a55a6844.chunk.js} +2 -2
- package/build/static/js/2242.a55a6844.chunk.js.map +1 -0
- package/build/static/js/254.e7805354.chunk.js +2 -0
- package/build/static/js/254.e7805354.chunk.js.map +1 -0
- package/build/static/js/{2723.a5f0a1fa.chunk.js → 2723.38314d6e.chunk.js} +1 -1
- package/build/static/js/{3404.b93a548c.chunk.js → 3404.1557958c.chunk.js} +3 -3
- package/build/static/js/{3404.b93a548c.chunk.js.map → 3404.1557958c.chunk.js.map} +1 -1
- package/build/static/js/{3625.db151aab.chunk.js → 3625.23761746.chunk.js} +2 -2
- package/build/static/js/{3625.db151aab.chunk.js.map → 3625.23761746.chunk.js.map} +1 -1
- package/build/static/js/{3771.d4bd749c.chunk.js → 3771.997ccc57.chunk.js} +2 -2
- package/build/static/js/{3771.d4bd749c.chunk.js.map → 3771.997ccc57.chunk.js.map} +1 -1
- package/build/static/js/{3790.6af26115.chunk.js → 3790.805593bc.chunk.js} +2 -2
- package/build/static/js/{3790.6af26115.chunk.js.map → 3790.805593bc.chunk.js.map} +1 -1
- package/build/static/js/{3856.23c16ed0.chunk.js → 3856.bfc95e79.chunk.js} +2 -2
- package/build/static/js/{3856.23c16ed0.chunk.js.map → 3856.bfc95e79.chunk.js.map} +1 -1
- package/build/static/js/{4189.473f9ca6.chunk.js → 4189.4161d40a.chunk.js} +3 -3
- package/build/static/js/4189.4161d40a.chunk.js.map +1 -0
- package/build/static/js/4297.71ba78e9.chunk.js +2 -0
- package/build/static/js/4297.71ba78e9.chunk.js.map +1 -0
- package/build/static/js/4474.bf030f69.chunk.js +2 -0
- package/build/static/js/4474.bf030f69.chunk.js.map +1 -0
- package/build/static/js/5195.605db17c.chunk.js +2 -0
- package/build/static/js/5195.605db17c.chunk.js.map +1 -0
- package/build/static/js/{5633.d81b4db2.chunk.js → 5633.10b44bd7.chunk.js} +1 -1
- package/build/static/js/{5674.8d9c60e9.chunk.js → 5674.86bb2ec6.chunk.js} +2 -2
- package/build/static/js/{5674.8d9c60e9.chunk.js.map → 5674.86bb2ec6.chunk.js.map} +1 -1
- package/build/static/js/5958.89468fa5.chunk.js +2 -0
- package/build/static/js/5958.89468fa5.chunk.js.map +1 -0
- package/build/static/js/{6763.77f6d956.chunk.js → 6763.f0ced4ef.chunk.js} +2 -2
- package/build/static/js/{6763.77f6d956.chunk.js.map → 6763.f0ced4ef.chunk.js.map} +1 -1
- package/build/static/js/{7040.fb2de04f.chunk.js → 7040.85ca80c3.chunk.js} +2 -2
- package/build/static/js/{7040.fb2de04f.chunk.js.map → 7040.85ca80c3.chunk.js.map} +1 -1
- package/build/static/js/{7227.3a5d8032.chunk.js → 7227.7bdd14a5.chunk.js} +3 -3
- package/build/static/js/{7227.3a5d8032.chunk.js.map → 7227.7bdd14a5.chunk.js.map} +1 -1
- package/build/static/js/{7589.03d16dce.chunk.js → 7589.19464c85.chunk.js} +2 -2
- package/build/static/js/{7589.03d16dce.chunk.js.map → 7589.19464c85.chunk.js.map} +1 -1
- package/build/static/js/{760.7adc7293.chunk.js → 760.93414278.chunk.js} +2 -2
- package/build/static/js/{760.7adc7293.chunk.js.map → 760.93414278.chunk.js.map} +1 -1
- package/build/static/js/7857.b3aee7e8.chunk.js +2 -0
- package/build/static/js/7857.b3aee7e8.chunk.js.map +1 -0
- package/build/static/js/7899.92317382.chunk.js +2 -0
- package/build/static/js/7899.92317382.chunk.js.map +1 -0
- package/build/static/js/833.61f11966.chunk.js +2 -0
- package/build/static/js/833.61f11966.chunk.js.map +1 -0
- package/build/static/js/{8593.92a539df.chunk.js → 8593.d3cad462.chunk.js} +2 -2
- package/build/static/js/{8593.92a539df.chunk.js.map → 8593.d3cad462.chunk.js.map} +1 -1
- package/build/static/js/{9556.46180fc4.chunk.js → 9556.1ce5861f.chunk.js} +3 -3
- package/build/static/js/{9556.46180fc4.chunk.js.map → 9556.1ce5861f.chunk.js.map} +1 -1
- package/build/static/js/main.26785b52.js +2 -0
- package/build/static/js/{main.3f3ac682.js.map → main.26785b52.js.map} +1 -1
- package/package.json +3 -3
- package/build/static/css/1381.ae89d4cb.chunk.css +0 -2
- package/build/static/css/1381.ae89d4cb.chunk.css.map +0 -1
- package/build/static/css/1742.12f27291.chunk.css +0 -2
- package/build/static/css/2004.33c1e186.chunk.css +0 -2
- package/build/static/css/2307.0ec76807.chunk.css +0 -2
- package/build/static/css/2307.0ec76807.chunk.css.map +0 -1
- package/build/static/css/254.b513f3ff.chunk.css +0 -2
- package/build/static/css/254.b513f3ff.chunk.css.map +0 -1
- package/build/static/css/3404.6f0b882e.chunk.css +0 -2
- package/build/static/css/3625.d84a60b5.chunk.css +0 -2
- package/build/static/css/3625.d84a60b5.chunk.css.map +0 -1
- package/build/static/css/5195.b239bddb.chunk.css +0 -2
- package/build/static/css/5195.b239bddb.chunk.css.map +0 -1
- package/build/static/css/5582.877dc4db.chunk.css.map +0 -1
- package/build/static/css/5633.ae89d4cb.chunk.css +0 -2
- package/build/static/css/5633.ae89d4cb.chunk.css.map +0 -1
- package/build/static/css/5674.49c3a29d.chunk.css +0 -2
- package/build/static/css/5674.49c3a29d.chunk.css.map +0 -1
- package/build/static/css/653.e0c03500.chunk.css +0 -2
- package/build/static/css/653.e0c03500.chunk.css.map +0 -1
- package/build/static/css/7227.65ee4c4e.chunk.css +0 -2
- package/build/static/css/7589.e72d7a14.chunk.css +0 -2
- package/build/static/css/7589.e72d7a14.chunk.css.map +0 -1
- package/build/static/css/7857.ec76e428.chunk.css +0 -2
- package/build/static/css/7987.ae89d4cb.chunk.css +0 -2
- package/build/static/css/7987.ae89d4cb.chunk.css.map +0 -1
- package/build/static/css/833.deb93503.chunk.css +0 -2
- package/build/static/css/8689.67d74ad5.chunk.css +0 -12
- package/build/static/css/8689.67d74ad5.chunk.css.map +0 -1
- package/build/static/css/9556.78fa406b.chunk.css +0 -2
- package/build/static/js/1742.190ff95f.chunk.js +0 -2
- package/build/static/js/1742.190ff95f.chunk.js.map +0 -1
- package/build/static/js/2086.04de3393.chunk.js +0 -3
- package/build/static/js/2086.04de3393.chunk.js.map +0 -1
- package/build/static/js/2242.a0059cca.chunk.js.map +0 -1
- package/build/static/js/254.54f5f58b.chunk.js +0 -2
- package/build/static/js/254.54f5f58b.chunk.js.map +0 -1
- package/build/static/js/4189.473f9ca6.chunk.js.map +0 -1
- package/build/static/js/4297.cb02aafc.chunk.js +0 -2
- package/build/static/js/4297.cb02aafc.chunk.js.map +0 -1
- package/build/static/js/4474.1059ef67.chunk.js +0 -2
- package/build/static/js/4474.1059ef67.chunk.js.map +0 -1
- package/build/static/js/5195.d3ea6ecc.chunk.js +0 -2
- package/build/static/js/5195.d3ea6ecc.chunk.js.map +0 -1
- package/build/static/js/5958.25a2c01c.chunk.js +0 -2
- package/build/static/js/5958.25a2c01c.chunk.js.map +0 -1
- package/build/static/js/7857.3ddc9e5b.chunk.js +0 -2
- package/build/static/js/7857.3ddc9e5b.chunk.js.map +0 -1
- package/build/static/js/7899.633b8c99.chunk.js +0 -2
- package/build/static/js/7899.633b8c99.chunk.js.map +0 -1
- package/build/static/js/833.816bfa8f.chunk.js +0 -2
- package/build/static/js/833.816bfa8f.chunk.js.map +0 -1
- package/build/static/js/main.3f3ac682.js +0 -2
- /package/build/static/js/{2004.74384107.chunk.js.LICENSE.txt → 2004.d8122da2.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{2086.04de3393.chunk.js.LICENSE.txt → 2086.c3a0124d.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{3404.b93a548c.chunk.js.LICENSE.txt → 3404.1557958c.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4189.473f9ca6.chunk.js.LICENSE.txt → 4189.4161d40a.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7227.3a5d8032.chunk.js.LICENSE.txt → 7227.7bdd14a5.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{9556.46180fc4.chunk.js.LICENSE.txt → 9556.1ce5861f.chunk.js.LICENSE.txt} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! For license information please see 4189.
|
|
2
|
-
(self.webpackChunk_kne_components_components_core=self.webpackChunk_kne_components_components_core||[]).push([[2273,4189,6125,8506,9379],{1488(t,e,i){var n=i(50149),s=i(97132),r=i(88140),a=i(35324),o=i(96614),l=i(96761),c=i(15857),h=i(68592),d=c(function(t,e){var i={};if(null==t)return i;var c=!1;e=n(e,function(e){return e=a(e,t),c||(c=e.length>1),e}),o(t,h(t),i),c&&(i=s(i,7,l));for(var d=e.length;d--;)r(i,e[d]);return i});t.exports=d},3343(t){t.exports=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}},3523(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},3892(t){t.exports=function(t){return this.__data__.has(t)}},4262(t,e,i){var n=i(48895),s=i(54052);t.exports=function(t,e,i){var r=e(t);return s(t)?r:n(r,i(t))}},4757(t,e,i){var n=i(56552);t.exports=function(){return n.Date.now()}},5538(t,e,i){var n=i(97160),s=i(84545),r=i(10793),a=i(27760),o=i(3892),l=i(76788);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=s,c.prototype.delete=r,c.prototype.get=a,c.prototype.has=o,c.prototype.set=l,t.exports=c},5654(t,e,i){var n=i(87937),s=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(e){}}();t.exports=s},5791(t,e,i){var n=i(26924),s=i(22761);t.exports=function(t){return s(t)&&"[object Map]"==n(t)}},6571(t,e,i){var n=i(11629),s=i(56173);t.exports=function(t){return null!=t&&s(t.length)&&!n(t)}},6806(t,e,i){var n=i(61516);t.exports=function(t,e){var i=e?n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}},8195(t,e,i){"use strict";function n(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}i.d(e,{A:()=>n})},9056(){},9316(t,e,i){"use strict";i.d(e,{A:()=>o});var n=i(58168),s=i(73884),r=i(3523),a=i(78478);const o=s.forwardRef(function(t,e){return s.createElement(a.A,(0,n.A)({},t,{ref:e,icon:r.A}))})},9812(t,e,i){var n=i(56552).Symbol;t.exports=n},10143(t){var e=/\s/;t.exports=function(t){for(var i=t.length;i--&&e.test(t.charAt(i)););return i}},10793(t){t.exports=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}},11295(t,e,i){var n=i(9812),s=n?n.prototype:void 0,r=s?s.valueOf:void 0;t.exports=function(t){return r?Object(r.call(t)):{}}},11629(t,e,i){var n=i(16913),s=i(46686);t.exports=function(t){if(!s(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},12322(t,e,i){var n=i(16913),s=i(85990),r=i(22761),a=Function.prototype,o=Object.prototype,l=a.toString,c=o.hasOwnProperty,h=l.call(Object);t.exports=function(t){if(!r(t)||"[object Object]"!=n(t))return!1;var e=s(t);if(null===e)return!0;var i=c.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==h}},12622(t,e,i){var n=i(70705);t.exports=function(t,e){var i=t.__data__;return n(e)?i["string"==typeof e?"string":"hash"]:i.map}},13028(t){t.exports=function(t,e){return function(i){return t(e(i))}}},13440(t,e,i){var n=i(56552)["__core-js_shared__"];t.exports=n},14079(t,e,i){var n=i(88259),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=n(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(s,function(t,i,n,s){e.push(n?s.replace(r,"$1"):i||t)}),e});t.exports=a},14657(t){t.exports=function(t,e){return null==t?void 0:t[e]}},15193(t,e,i){var n=i(16913),s=i(22761);t.exports=function(t){return s(t)&&"[object Arguments]"==n(t)}},15797(t,e,i){var n=i(64816);function s(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;if(r.has(s))return r.get(s);var a=t.apply(this,n);return i.cache=r.set(s,a)||r,a};return i.cache=new(s.Cache||n),i}s.Cache=n,t.exports=s},15857(t,e,i){var n=i(20819),s=i(55636),r=i(46350);t.exports=function(t){return r(s(t,void 0,n),t+"")}},16095(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},16913(t,e,i){var n=i(9812),s=i(34552),r=i(16095),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?s(t):r(t)}},17529(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length,s=0,r=[];++i<n;){var a=t[i];e(a,i,t)&&(r[s++]=a)}return r}},18630(t,e,i){var n=i(61516),s=i(6806),r=i(18962),a=i(11295),o=i(38710);t.exports=function(t,e,i){var l=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new l(+t);case"[object DataView]":return s(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(t,i);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(t);case"[object RegExp]":return r(t);case"[object Symbol]":return a(t)}}},18962(t){var e=/\w*$/;t.exports=function(t){var i=new t.constructor(t.source,e.exec(t));return i.lastIndex=t.lastIndex,i}},19155(t,e,i){"use strict";i.d(e,{A:()=>h});var n=i(73884),s=i(79889),r=i.n(s),a=i(93950),o=i.n(a),l=i(96418),c=i.n(l);const h=(t,e)=>{const i=(0,n.useRef)(null);i.current=Object.assign({},{time:500,isDebounce:!1},e);const s=(0,n.useRef)(null),a=c()(t);return(0,n.useLayoutEffect)(()=>{const t=s.current,e=()=>window.requestAnimationFrame(()=>{t&&a(t)});e();const n=new ResizeObserver((i.current.isDebounce?o():r())(e,i.current.time));return t&&n.observe(t),()=>{n.disconnect()}},[a]),s}},19495(t,e,i){"use strict";function n(t){var e,i,n,r=2;for("undefined"!=typeof Symbol&&(i=Symbol.asyncIterator,n=Symbol.iterator);r--;){if(i&&null!=(e=t[i]))return e.call(t);if(n&&null!=(e=t[n]))return new s(e.call(t));i="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function s(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:e}})}return s=function(t){this.s=t,this.n=t.next},s.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var i=this.s.return;return void 0===i?Promise.resolve({value:t,done:!0}):e(i.apply(this.s,arguments))},throw:function(t){var i=this.s.return;return void 0===i?Promise.reject(t):e(i.apply(this.s,arguments))}},new s(t)}i.d(e,{A:()=>n})},19841(t,e,i){var n=i(16913),s=i(22761);t.exports=function(t){return"symbol"==typeof t||s(t)&&"[object Symbol]"==n(t)}},20310(t,e,i){var n=i(21817),s=i(85990),r=i(36140);t.exports=function(t){return"function"!=typeof t.constructor||r(t)?{}:n(s(t))}},20449(t,e,i){var n=i(26924),s=i(22761);t.exports=function(t){return s(t)&&"[object Set]"==n(t)}},20816(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(82284);function s(t){var e=function(t,e){if("object"!=(0,n.A)(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=(0,n.A)(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==(0,n.A)(e)?e:e+""}},20819(t,e,i){var n=i(80755);t.exports=function(t){return(null==t?0:t.length)?n(t,1):[]}},21676(t,e,i){var n=i(52969),s=i(53871);t.exports=function(t,e){return e.length<2?t:n(t,s(e,0,-1))}},21817(t,e,i){var n=i(46686),s=Object.create,r=function(){function t(){}return function(e){if(!n(e))return{};if(s)return s(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();t.exports=r},22541(t){t.exports=function(t){return function(){return t}}},22662(t,e,i){var n=i(95575);t.exports=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},22761(t){t.exports=function(t){return null!=t&&"object"==typeof t}},22777(t,e,i){var n=i(15193),s=i(22761),r=Object.prototype,a=r.hasOwnProperty,o=r.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(t){return s(t)&&a.call(t,"callee")&&!o.call(t,"callee")};t.exports=l},22929(t,e,i){var n=i(56552).Uint8Array;t.exports=n},23253(t,e,i){var n=i(5538),s=i(63868),r=i(94258),a=i(83223),o=i(46686),l=i(30474),c=i(53737);t.exports=function t(e,i,h,d,u){e!==i&&r(i,function(r,l){if(u||(u=new n),o(r))a(e,i,l,h,t,d,u);else{var p=d?d(c(e,l),r,l+"",e,i,u):void 0;void 0===p&&(p=r),s(e,l,p)}},l)}},24190(t,e,i){var n=i(61340);t.exports=function(t){var e=this.__data__,i=n(e,t);return i<0?void 0:e[i][1]}},24558(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(26562);function s(t,e,i){return t.set((0,n.A)(t,e),i),i}},25051(t){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},26562(t,e,i){"use strict";function n(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}i.d(e,{A:()=>n})},26600(t,e,i){var n=i(87937)(i(56552),"WeakMap");t.exports=n},26924(t,e,i){var n=i(97685),s=i(85204),r=i(65387),a=i(72070),o=i(26600),l=i(16913),c=i(96996),h="[object Map]",d="[object Promise]",u="[object Set]",p="[object WeakMap]",A="[object DataView]",f=c(n),g=c(s),m=c(r),v=c(a),w=c(o),b=l;(n&&b(new n(new ArrayBuffer(1)))!=A||s&&b(new s)!=h||r&&b(r.resolve())!=d||a&&b(new a)!=u||o&&b(new o)!=p)&&(b=function(t){var e=l(t),i="[object Object]"==e?t.constructor:void 0,n=i?c(i):"";if(n)switch(n){case f:return A;case g:return h;case m:return d;case v:return u;case w:return p}return e}),t.exports=b},27615(t,e,i){var n=i(95575);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},27760(t){t.exports=function(t){return this.__data__.get(t)}},28325(t,e,i){var n=i(22541),s=i(5654),r=i(33279),a=s?function(t,e){return s(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:r;t.exports=a},28673(t,e,i){var n=i(73204),s=i(83713),r=i(6571);t.exports=function(t){return r(t)?n(t):s(t)}},29075(t,e,i){var n=i(96614),s=i(56326);t.exports=function(t,e){return n(t,s(t),e)}},29935(t,e,i){var n=i(61340),s=Array.prototype.splice;t.exports=function(t){var e=this.__data__,i=n(e,t);return!(i<0)&&(i==e.length-1?e.pop():s.call(e,i,1),--this.size,!0)}},30474(t,e,i){var n=i(73204),s=i(58122),r=i(6571);t.exports=function(t){return r(t)?n(t,!0):s(t)}},31170(t){t.exports=function(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}},33279(t){t.exports=function(t){return t}},34552(t,e,i){var n=i(9812),s=Object.prototype,r=s.hasOwnProperty,a=s.toString,o=n?n.toStringTag:void 0;t.exports=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var n=!0}catch(l){}var s=a.call(t);return n&&(e?t[o]=i:delete t[o]),s}},34677(t,e,i){var n=i(23253),s=i(84570)(function(t,e,i){n(t,e,i)});t.exports=s},35324(t,e,i){var n=i(54052),s=i(62597),r=i(14079),a=i(41069);t.exports=function(t,e){return n(t)?t:s(t,e)?[t]:r(a(t))}},35428(t,e,i){var n=i(16913),s=i(56173),r=i(22761),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return r(t)&&s(t.length)&&!!a[n(t)]}},36140(t){var e=Object.prototype;t.exports=function(t){var i=t&&t.constructor;return t===("function"==typeof i&&i.prototype||e)}},36954(t,e,i){var n=i(11629),s=i(37857),r=i(46686),a=i(96996),o=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,h=l.toString,d=c.hasOwnProperty,u=RegExp("^"+h.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!r(t)||s(t))&&(n(t)?u:o).test(a(t))}},37105(t,e,i){var n="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;t.exports=n},37159(t,e,i){var n=i(12622);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},37857(t,e,i){var n=i(13440),s=function(){var t=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!s&&s in t}},38268(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t){var i=t.length,n=new t.constructor(i);return i&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},38458(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(26562);function s(t,e){return t.get((0,n.A)(t,e))}},38541(t,e,i){var n=i(9812),s=i(50149),r=i(54052),a=i(19841),o=n?n.prototype:void 0,l=o?o.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(r(e))return s(e,t)+"";if(a(e))return l?l.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}},38710(t,e,i){var n=i(61516);t.exports=function(t,e){var i=e?n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}},39790(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(8195);function s(t,e){(0,n.A)(t,e),e.add(t)}},40801(t,e,i){var n=i(61141),s=i(46686),r=i(19841),a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(r(t))return NaN;if(s(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=s(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var i=o.test(t);return i||l.test(t)?c(t.slice(2),i?2:8):a.test(t)?NaN:+t}},41069(t,e,i){var n=i(38541);t.exports=function(t){return null==t?"":n(t)}},43516(t){t.exports=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}},44353(t,e,i){t=i.nmd(t);var n=i(56552),s=e&&!e.nodeType&&e,r=s&&t&&!t.nodeType&&t,a=r&&r.exports===s?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var i=t.length,n=o?o(i):new t.constructor(i);return t.copy(n),n}},44543(t,e,i){t=i.nmd(t);var n=i(56552),s=i(60014),r=e&&!e.nodeType&&e,a=r&&t&&!t.nodeType&&t,o=a&&a.exports===r?n.Buffer:void 0,l=(o?o.isBuffer:void 0)||s;t.exports=l},45921(t,e,i){var n=i(20449),s=i(47574),r=i(56832),a=r&&r.isSet,o=a?s(a):n;t.exports=o},46350(t,e,i){var n=i(28325),s=i(86578)(n);t.exports=s},46686(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},47251(t,e,i){var n=i(98724),s=i(97160),r=i(85204);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(r||s),string:new n}}},47574(t){t.exports=function(t){return function(e){return t(e)}}},48734(t,e,i){var n=i(95575),s=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:s.call(e,t)}},48895(t){t.exports=function(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t}},50149(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s}},51104(t,e,i){var n=i(96614),s=i(28673);t.exports=function(t,e){return t&&n(e,s(e),t)}},51153(t,e,i){"use strict";var n=i(73884),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,i){var n,r={},c=null,h=null;for(n in void 0!==i&&(c=""+i),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(h=e.ref),e)a.call(e,n)&&!l.hasOwnProperty(n)&&(r[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===r[n]&&(r[n]=e[n]);return{$$typeof:s,type:t,key:c,ref:h,props:r,_owner:o.current}}e.Fragment=r,e.jsx=c,e.jsxs=c},51268(t,e,i){var n=i(35428),s=i(47574),r=i(56832),a=r&&r.isTypedArray,o=a?s(a):n;t.exports=o},51946(t,e,i){var n=i(61340);t.exports=function(t){return n(this.__data__,t)>-1}},52969(t,e,i){var n=i(35324),s=i(70914);t.exports=function(t,e){for(var i=0,r=(e=n(e,t)).length;null!=t&&i<r;)t=t[s(e[i++])];return i&&i==r?t:void 0}},53737(t){t.exports=function(t,e){if(("constructor"!==e||"function"!==typeof t[e])&&"__proto__"!=e)return t[e]}},53871(t){t.exports=function(t,e,i){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(i=i>s?s:i)<0&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0;for(var r=Array(s);++n<s;)r[n]=t[n+e];return r}},53986(t,e,i){"use strict";function n(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}i.d(e,{A:()=>n})},54052(t){var e=Array.isArray;t.exports=e},55119(t,e,i){var n=i(96614),s=i(30474);t.exports=function(t,e){return t&&n(e,s(e),t)}},55149(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(8195);function s(t,e,i){(0,n.A)(t,e),e.set(t,i)}},55636(t,e,i){var n=i(31170),s=Math.max;t.exports=function(t,e,i){return e=s(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,o=s(r.length-e,0),l=Array(o);++a<o;)l[a]=r[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=r[a];return c[e]=i(l),n(t,this,c)}}},55647(t,e,i){var n=i(33279),s=i(55636),r=i(46350);t.exports=function(t,e){return r(s(t,e,n),t+"")}},55906(t){t.exports=function(t){return function(e,i,n){for(var s=-1,r=Object(e),a=n(e),o=a.length;o--;){var l=a[t?o:++s];if(!1===i(r[l],l,r))break}return e}}},56173(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},56326(t,e,i){var n=i(48895),s=i(85990),r=i(69621),a=i(57828),o=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,r(t)),t=s(t);return e}:a;t.exports=o},56552(t,e,i){var n=i(37105),s="object"==typeof self&&self&&self.Object===Object&&self,r=n||s||Function("return this")();t.exports=r},56760(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"}},56832(t,e,i){t=i.nmd(t);var n=i(37105),s=e&&!e.nodeType&&e,r=s&&t&&!t.nodeType&&t,a=r&&r.exports===s&&n.process,o=function(){try{var t=r&&r.require&&r.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(e){}}();t.exports=o},56874(t,e,i){var n=i(12622);t.exports=function(t,e){var i=n(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this}},57828(t){t.exports=function(){return[]}},57887(t,e,i){var n=i(5791),s=i(47574),r=i(56832),a=r&&r.isMap,o=a?s(a):n;t.exports=o},58122(t,e,i){var n=i(46686),s=i(36140),r=i(43516),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return r(t);var e=s(t),i=[];for(var o in t)("constructor"!=o||!e&&a.call(t,o))&&i.push(o);return i}},58387(t,e,i){"use strict";function n(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=n(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}function s(){for(var t,e,i=0,s="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=n(t))&&(s&&(s+=" "),s+=e);return s}i.d(e,{$:()=>s,A:()=>r});const r=s},59395(t,e,i){var n=i(4262),s=i(69621),r=i(28673);t.exports=function(t){return n(t,r,s)}},60014(t){t.exports=function(){return!1}},60929(t,e,i){var n=i(93211),s=i(6571),r=i(69194),a=i(46686);t.exports=function(t,e,i){if(!a(i))return!1;var o=typeof e;return!!("number"==o?s(i)&&r(e,i.length):"string"==o&&e in i)&&n(i[e],t)}},61141(t,e,i){var n=i(10143),s=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(s,""):t}},61143(t,e,i){var n=i(13028)(Object.keys,Object);t.exports=n},61340(t,e,i){var n=i(93211);t.exports=function(t,e){for(var i=t.length;i--;)if(n(t[i][0],e))return i;return-1}},61516(t,e,i){var n=i(22929);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},61714(t,e,i){var n=i(61340);t.exports=function(t,e){var i=this.__data__,s=n(i,t);return s<0?(++this.size,i.push([t,e])):i[s][1]=e,this}},62597(t,e,i){var n=i(54052),s=i(19841),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!s(t))||(a.test(t)||!r.test(t)||null!=e&&t in Object(e))}},63868(t,e,i){var n=i(71775),s=i(93211);t.exports=function(t,e,i){(void 0!==i&&!s(t[e],i)||void 0===i&&!(e in t))&&n(t,e,i)}},64189(t,e,i){"use strict";i.r(e),i.d(e,{AudioPreview:()=>py,Download:()=>Gb,FileButton:()=>Ly,FileInput:()=>d_,FileList:()=>i_,FileListOptionButtons:()=>Qy,FileModal:()=>Dy,FilePreview:()=>_y,FileUpload:()=>p_,HtmlPreview:()=>iy,Image:()=>Ky,ImagePreview:()=>dy,OSSFilePreview:()=>by,OfficePreview:()=>ay,PdfPreview:()=>oy,PrintButton:()=>Ey,TextPreview:()=>ly,UnknownPreview:()=>cy,VideoPreview:()=>fy,computedAccept:()=>A_,default:()=>Fb,defaultAccept:()=>l_,download:()=>Nb,downloadBlobFile:()=>Ob,useDownload:()=>zb,useFileModal:()=>Py,useFileModalProps:()=>Ty,useFileUpload:()=>n_,withOSSFile:()=>Lb});var n={};i.r(n),i.d(n,{dU:()=>_A,ng:()=>ne,EA:()=>Gc,Tm:()=>xd,D6:()=>id,YE:()=>fd});var s=i(73884),r=i.n(s),a=i(83694),o=i(87558),l=i.n(o),c=i(34677),h=i.n(c),d=i(55199),u=i(58168),p=i(56760),A=i(78478);const f=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:p.A}))});const g={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M820 436h-40c-4.4 0-8 3.6-8 8v40c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-40c0-4.4-3.6-8-8-8zm32-104H732V120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM360 180h304v152H360V180zm304 664H360V568h304v276zm200-140H732V500H292v204H160V412c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v292z"}}]},name:"printer",theme:"outlined"};const m=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:g}))});const v={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};const w=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:v}))});var b=i(82211);const y=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:b.A}))});var _=i(71360);const x=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:_.A}))});var E=i(9316);const S={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};const k=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:S}))});var C,M=i(96418),T=i.n(M),P=i(1488),D=i.n(P),R=i(52526),L=0,I=!1,F=!1,N="[iFrameSizer]",O=null,B=window.requestAnimationFrame,W=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),j={},U=null,z=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){K("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function H(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function V(t,e,i){t.addEventListener(e,i,!1)}function G(t,e,i){t.removeEventListener(e,i,!1)}function q(t){return N+"["+function(t){var e="Host page: "+t;return window.top!==window.self&&(e=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t),e}(t)+"]"}function X(t){return j[t]?j[t].log:I}function Y(t,e){Q("log",t,e,X(t))}function K(t,e){Q("warn",t,e,!0)}function Q(t,e,i,n){!0===n&&"object"===typeof window.console&&console[t](q(e),i)}function J(t){function e(){s("Height"),s("Width"),at(function(){rt(p),it(A),d("onResized",p)},p,"init")}function i(t){return"border-box"!==t.boxSizing?0:(t.paddingTop?parseInt(t.paddingTop,10):0)+(t.paddingBottom?parseInt(t.paddingBottom,10):0)}function n(t){return"border-box"!==t.boxSizing?0:(t.borderTopWidth?parseInt(t.borderTopWidth,10):0)+(t.borderBottomWidth?parseInt(t.borderBottomWidth,10):0)}function s(t){var e=Number(j[A]["max"+t]),i=Number(j[A]["min"+t]),n=t.toLowerCase(),s=Number(p[n]);Y(A,"Checking "+n+" is in range "+i+"-"+e),s<i&&(s=i,Y(A,"Set "+n+" to min value")),s>e&&(s=e,Y(A,"Set "+n+" to max value")),p[n]=""+s}function r(t){return u.slice(u.indexOf(":")+7+t)}function a(t,e){var i,n,s;i=function(){ot("Send Page Info","pageInfo:"+function(){var t=document.body.getBoundingClientRect(),e=p.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:e.height,iframeWidth:e.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(e.top-t.top,10),offsetLeft:parseInt(e.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}(),t,e)},n=32,dt[s=e]||(dt[s]=setTimeout(function(){dt[s]=null,i()},n))}function o(t){var e=t.getBoundingClientRect();return et(A),{x:Math.floor(Number(e.left)+Number(O.x)),y:Math.floor(Number(e.top)+Number(O.y))}}function l(t){var e=t?o(p.iframe):{x:0,y:0},i={x:Number(p.width)+e.x,y:Number(p.height)+e.y};Y(A,"Reposition requested from iFrame (offset x:"+e.x+" y:"+e.y+")"),window.top===window.self?(O=i,c(),Y(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(t?"Offset":"")](i.x,i.y):K(A,"Unable to scroll to requested position, window.parentIFrame not found")}function c(){!1===d("onScroll",O)?nt():it(A)}function h(t){var e={};if(0===Number(p.width)&&0===Number(p.height)){var i=r(9).split(":");e={x:i[1],y:i[0]}}else e={x:p.width,y:p.height};d(t,{iframe:p.iframe,screenX:Number(e.x),screenY:Number(e.y),type:p.type})}function d(t,e){return Z(A,t,e)}var u=t.data,p={},A=null;"[iFrameResizerChild]Ready"===u?function(){for(var t in j)ot("iFrame requested init",lt(t),j[t].iframe,t)}():N===(""+u).slice(0,13)&&u.slice(13).split(":")[0]in j?(p=function(){var t=u.slice(13).split(":"),e=t[1]?parseInt(t[1],10):0,s=j[t[0]]&&j[t[0]].iframe,r=getComputedStyle(s);return{iframe:s,id:t[0],height:e+i(r)+n(r),width:t[2],type:t[3]}}(),A=p.id,j[A]&&(j[A].loaded=!0),!function(){var t=p.type in{true:1,false:1,undefined:1};return t&&Y(A,"Ignoring init message from meta parent page"),t}()&&function(t){var e=!0;return j[t]||(e=!1,K(p.type+" No settings for "+t+". Message was: "+u)),e}(A)&&(Y(A,"Received: "+u),function(){var t=!0;return null===p.iframe&&(K(A,"IFrame ("+p.id+") not found"),t=!1),t}()&&function(){var e=t.origin,i=j[A]&&j[A].checkOrigin;if(i&&""+e!=="null"&&!(i.constructor===Array?function(){var t=0,n=!1;for(Y(A,"Checking connection is from allowed list of origins: "+i);t<i.length;t++)if(i[t]===e){n=!0;break}return n}():function(){var t=j[A]&&j[A].remoteHost;return Y(A,"Checking connection is from: "+t),e===t}()))throw new Error("Unexpected message received from: "+e+" for "+p.iframe.id+". Message was: "+t.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(j[A]&&j[A].firstRun&&j[A]&&(j[A].firstRun=!1),p.type){case"close":tt(p.iframe);break;case"message":t=r(6),Y(A,"onMessage passed: {iframe: "+p.iframe.id+", message: "+t+"}"),d("onMessage",{iframe:p.iframe,message:JSON.parse(t)}),Y(A,"--");break;case"mouseenter":h("onMouseEnter");break;case"mouseleave":h("onMouseLeave");break;case"autoResize":j[A].autoResize=JSON.parse(r(9));break;case"scrollTo":l(!1);break;case"scrollToOffset":l(!0);break;case"pageInfo":a(j[A]&&j[A].iframe,A),function(){function t(t,n){function s(){j[i]?a(j[i].iframe,i):e()}["scroll","resize"].forEach(function(e){Y(i,t+e+" listener for sendPageInfo"),n(window,e,s)})}function e(){t("Remove ",G)}var i=A;t("Add ",V),j[i]&&(j[i].stopPageInfo=e)}();break;case"pageInfoStop":j[A]&&j[A].stopPageInfo&&(j[A].stopPageInfo(),delete j[A].stopPageInfo);break;case"inPageLink":!function(t){var e=t.split("#")[1]||"",i=decodeURIComponent(e),n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){var t=o(n);Y(A,"Moving to in page link (#"+e+") at x: "+t.x+" y: "+t.y),O={x:t.x,y:t.y},c(),Y(A,"--")}():window.top===window.self?Y(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):Y(A,"In page link #"+e+" not found and window.parentIFrame not found")}(r(9));break;case"reset":st(p);break;case"init":e(),d("onInit",p.iframe);break;default:0===Number(p.width)&&0===Number(p.height)?K("Unsupported message received ("+p.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):e()}var t}())):function(t,e){Q("info",t,e,X(t))}(A,"Ignored: "+u)}function Z(t,e,i){var n=null,s=null;if(j[t]){if("function"!==typeof(n=j[t][e]))throw new TypeError(e+" on iFrame["+t+"] is not a function");s=n(i)}return s}function $(t){var e=t.id;delete j[e]}function tt(t){var e=t.id;if(!1!==Z(e,"onClose",e)){Y(e,"Removing iFrame: "+e);try{t.parentNode&&t.parentNode.removeChild(t)}catch(i){K(i)}Z(e,"onClosed",e),Y(e,"--"),$(t),C&&(C.disconnect(),C=null)}else Y(e,"Close iframe cancelled by onClose event")}function et(t){null===O&&Y(t,"Get page position: "+(O={x:void 0===window.pageXOffset?document.documentElement.scrollLeft:window.pageXOffset,y:void 0===window.pageYOffset?document.documentElement.scrollTop:window.pageYOffset}).x+","+O.y)}function it(t){null!==O&&(window.scrollTo(O.x,O.y),Y(t,"Set page position: "+O.x+","+O.y),nt())}function nt(){O=null}function st(t){Y(t.id,"Size reset requested by "+("init"===t.type?"host page":"iFrame")),et(t.id),at(function(){rt(t),ot("reset","reset",t.iframe,t.id)},t,"reset")}function rt(t){function e(e){F||"0"!==t[e]||(F=!0,Y(n,"Hidden iFrame detected, creating visibility listener"),function(){function t(){function t(t){function e(e){return"0px"===(j[t]&&j[t].iframe.style[e])}function i(t){return null!==t.offsetParent}j[t]&&i(j[t].iframe)&&(e("height")||e("width"))&&ot("Visibility change","resize",j[t].iframe,t)}Object.keys(j).forEach(function(e){t(e)})}function e(e){Y("window","Mutation observed: "+e[0].target+" "+e[0].type),ht(t,16)}function i(){var t=document.querySelector("body"),i={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};new n(e).observe(t,i)}var n=H();n&&i()}())}function i(i){!function(e){t.id?(t.iframe.style[e]=t[e]+"px",Y(t.id,"IFrame ("+n+") "+e+" set to "+t[e]+"px")):Y("undefined","messageData id not set")}(i),e(i)}var n=t.iframe.id;j[n]&&(j[n].sizeHeight&&i("height"),j[n].sizeWidth&&i("width"))}function at(t,e,i){i!==e.type&&B&&!window.jasmine?(Y(e.id,"Requesting animation frame"),B(t)):t()}function ot(t,e,i,n,s){var r=!1;n=n||i.id,j[n]&&(i&&"contentWindow"in i&&null!==i.contentWindow?function(){var s=j[n]&&j[n].targetOrigin;Y(n,"["+t+"] Sending msg to iframe["+n+"] ("+e+") targetOrigin: "+s),i.contentWindow.postMessage(N+e,s)}():K(n,"["+t+"] IFrame("+n+") not found"),s&&j[n]&&j[n].warningTimeout&&(j[n].msgTimeout=setTimeout(function(){!j[n]||j[n].loaded||r||(r=!0,K(n,"IFrame has not responded within "+j[n].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},j[n].warningTimeout)))}function lt(t){return t+":"+j[t].bodyMarginV1+":"+j[t].sizeWidth+":"+j[t].log+":"+j[t].interval+":"+j[t].enablePublicMethods+":"+j[t].autoResize+":"+j[t].bodyMargin+":"+j[t].heightCalculationMethod+":"+j[t].bodyBackground+":"+j[t].bodyPadding+":"+j[t].tolerance+":"+j[t].inPageLinks+":"+j[t].resizeFrom+":"+j[t].widthCalculationMethod+":"+j[t].mouseEvents}function ct(t,e){function i(t){var e=t.split("Callback");if(2===e.length){var i="on"+e[0].charAt(0).toUpperCase()+e[0].slice(1);this[i]=this[t],delete this[t],K(n,"Deprecated: '"+t+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}}var n=function(i){if("string"!==typeof i)throw new TypeError("Invaild id for iFrame. Expected String");return""===i&&(t.id=i=function(){var t=e&&e.id||z.id+L++;return null!==document.getElementById(t)&&(t+=L++),t}(),I=(e||{}).log,Y(i,"Added missing iframe ID: "+i+" ("+t.src+")")),i}(t.id);n in j&&"iFrameResizer"in t?K(n,"Ignored iFrame, already setup."):(!function(e){var s;e=e||{},j[n]=Object.create(null),j[n].iframe=t,j[n].firstRun=!0,j[n].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(t){if("object"!==typeof t)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(i,e),function(t){for(var e in z)Object.prototype.hasOwnProperty.call(z,e)&&(j[n][e]=Object.prototype.hasOwnProperty.call(t,e)?t[e]:z[e])}(e),j[n]&&(j[n].targetOrigin=!0===j[n].checkOrigin?""===(s=j[n].remoteHost)||null!==s.match(/^(about:blank|javascript:|file:\/\/)/)?"*":s:"*")}(e),function(){switch(Y(n,"IFrame scrolling "+(j[n]&&j[n].scrolling?"enabled":"disabled")+" for "+n),t.style.overflow=!1===(j[n]&&j[n].scrolling)?"hidden":"auto",j[n]&&j[n].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=j[n]?j[n].scrolling:"no"}}(),function(){function e(e){var i=j[n][e];1/0!==i&&0!==i&&(t.style[e]="number"===typeof i?i+"px":i,Y(n,"Set "+e+" = "+t.style[e]))}function i(t){if(j[n]["min"+t]>j[n]["max"+t])throw new Error("Value for min"+t+" can not be greater than max"+t)}i("Height"),i("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!==typeof(j[n]&&j[n].bodyMargin)&&"0"!==(j[n]&&j[n].bodyMargin)||(j[n].bodyMarginV1=j[n].bodyMargin,j[n].bodyMargin=j[n].bodyMargin+"px"),function(e){var i=H();i&&(C=function(e){if(!t.parentNode)return null;var i=new e(function(e){e.forEach(function(e){Array.prototype.slice.call(e.removedNodes).forEach(function(e){e===t&&tt(t)})})});return i.observe(t.parentNode,{childList:!0}),i}(i)),V(t,"load",function(){ot("iFrame.onload",e,t,void 0,!0),function(){var e=j[n]&&j[n].firstRun,i=j[n]&&j[n].heightCalculationMethod in W;!e&&i&&st({iframe:t,height:0,width:0,type:"init"})}()}),ot("init",e,t,void 0,!0)}(lt(n)),j[n]&&(j[n].iframe.iFrameResizer={close:tt.bind(null,j[n].iframe),removeListeners:$.bind(null,j[n].iframe),resize:ot.bind(null,"Window resize","resize",j[n].iframe),moveToAnchor:function(t){ot("Move to anchor","moveToAnchor:"+t,j[n].iframe,n)},sendMessage:function(t){ot("Send Message","message:"+(t=JSON.stringify(t)),j[n].iframe,n)}}))}function ht(t,e){null===U&&(U=setTimeout(function(){U=null,t()},e))}var dt={};function ut(){"hidden"!==document.visibilityState&&(Y("document","Trigger event: Visibility change"),ht(function(){pt("Tab Visible","resize")},16))}function pt(t,e){Object.keys(j).forEach(function(i){(function(t){return j[t]&&"parent"===j[t].resizeFrom&&j[t].autoResize&&!j[t].firstRun})(i)&&ot(t,e,j[i].iframe,i)})}function At(){V(window,"message",J),V(window,"resize",function(){var t;Y("window","Trigger event: "+(t="resize")),ht(function(){pt("Window "+t,"resize")},16)}),V(document,"visibilitychange",ut),V(document,"-webkit-visibilitychange",ut)}var ft=function(){function t(t,i){i&&(!function(){if(!i.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==i.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+i.tagName+">")}(),ct(i,t),e.push(i))}var e;return function(){var t,e=["moz","webkit","o","ms"];for(t=0;t<e.length&&!B;t+=1)B=window[e[t]+"RequestAnimationFrame"];B?B=B.bind(window):Y("setup","RequestAnimationFrame not supported")}(),At(),function(i,n){switch(e=[],function(t){t&&t.enablePublicMethods&&K("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof n){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(n||"iframe"),t.bind(void 0,i));break;case"object":t(i,n);break;default:throw new TypeError("Unexpected data type ("+typeof n+")")}return e}}(),gt=i(83136),mt=i.n(gt);function vt(t,e,i){e||(e=[]);var n=e.length++;return Object.defineProperty({},"_",{set:function(s){e[n]=s,t.apply(i,e)}})}var wt=i(89379),bt=i(39790),yt=i(55149),_t=i(26562);function xt(t,e,i){return i((0,_t.A)(t,e))}var Et,St,kt,Ct,Mt,Tt,Pt,Dt,Rt,Lt,It,Ft,Nt,Ot,Bt,Wt,jt,Ut,zt=i(38458),Ht=i(24558),Vt=i(64467),Gt=i(19495);const qt="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),Xt=[.001,0,0,.001,0,0],Yt=1.35,Kt=1,Qt=2,Jt=4,Zt=16,$t=32,te=64,ee=128,ie=256,ne={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},se="pdfjs_internal_editor_",re={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ae={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},oe=0,le=1,ce=2,he=3,de=3,ue=4,pe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ae={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},fe=1,ge=2,me=3,ve=4,we=5,be={ERRORS:0,WARNINGS:1,INFOS:5},ye={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},_e=0,xe=1,Ee=2,Se=3;let ke=be.WARNINGS;function Ce(t){Number.isInteger(t)&&(ke=t)}function Me(){return ke}function Te(t){ke>=be.INFOS&&console.info("Info: ".concat(t))}function Pe(t){ke>=be.WARNINGS&&console.warn("Warning: ".concat(t))}function De(t){throw new Error(t)}function Re(t,e){t||De(e)}function Le(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=e?URL.parse(t,e):URL.parse(t);return function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n)?n:null}function Ie(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=URL.parse(t);return n?(n.hash=e,n.href):i&&Le(t,"http://example.com")?t.split("#",1)[0]+"".concat(e?"#".concat(e):""):""}function Fe(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const Ne=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class Oe extends Ne{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Be extends Ne{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class We extends Ne{constructor(t){super(t,"InvalidPDFException")}}class je extends Ne{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class Ue extends Ne{constructor(t){super(t,"FormatError")}}class ze extends Ne{constructor(t){super(t,"AbortException")}}function He(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||De("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let s=0;s<e;s+=i){const r=Math.min(s+i,e),a=t.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function Ve(t){"string"!==typeof t&&De("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}class Ge{static get isLittleEndian(){return Fe(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Fe(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return Fe(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Fe(this,"isImageDecoderSupported","undefined"!==typeof ImageDecoder)}static get platform(){const{platform:t,userAgent:e}=navigator;return Fe(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return Fe(this,"isCSSRoundSupported",null===(t=globalThis.CSS)||void 0===t||null===(e=t.supports)||void 0===e?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const qe=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Xe{static makeHexColor(t,e,i){return"#".concat(qe[t]).concat(qe[e]).concat(qe[i])}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=t[i],s=t[i+1];t[i]=n*e[0]+s*e[2]+e[4],t[i+1]=n*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5];for(let c=0;c<6;c+=2){const e=t[i+c],h=t[i+c+1];t[i+c]=e*n+h*r+o,t[i+c+1]=e*s+h*a+l}}static applyInverseTransform(t,e){const i=t[0],n=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-i*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],c=t[0],h=t[1],d=t[2],u=t[3];let p=n*c+o,A=p,f=n*d+o,g=f,m=a*h+l,v=m,w=a*u+l,b=w;if(0!==s||0!==r){const t=s*c,e=s*d,i=r*h,n=r*u;p+=i,g+=i,f+=n,A+=n,m+=t,b+=t,w+=e,v+=e}i[0]=Math.min(i[0],p,f,A,g),i[1]=Math.min(i[1],m,w,v,b),i[2]=Math.max(i[2],p,f,A,g),i[3]=Math.max(i[3],m,w,v,b)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],a=i**2+n**2,o=i*s+n*r,l=s**2+r**2,c=(a+l)/2,h=Math.sqrt(c**2-(a*l-o**2));e[0]=Math.sqrt(c+h||1),e[1]=Math.sqrt(c-h||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>r?null:[i,s,n,r]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,n,s){s[0]=Math.min(s[0],t,i),s[1]=Math.min(s[1],e,n),s[2]=Math.max(s[2],t,i),s[3]=Math.max(s[3],e,n)}static bezierBoundingBox(t,e,i,n,s,r,a,o,l){l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o),(0,_t.A)(Xe,this,Ke).call(this,t,i,s,a,e,n,r,o,3*(3*(i-s)-t+a),6*(t-2*i+s),3*(i-t),l),(0,_t.A)(Xe,this,Ke).call(this,t,i,s,a,e,n,r,o,3*(3*(n-r)-e+o),6*(e-2*n+r),3*(n-e),l)}}function Ye(t,e,i,n,s,r,a,o,l,c){if(l<=0||l>=1)return;const h=1-l,d=l*l,u=d*l,p=h*(h*(h*t+3*l*e)+3*d*i)+u*n,A=h*(h*(h*s+3*l*r)+3*d*a)+u*o;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],A),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],A)}function Ke(t,e,i,n,s,r,a,o,l,c,h,d){if(Math.abs(l)<1e-12)return void(Math.abs(c)>=1e-12&&(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,-h/c,d));const u=c**2-4*h*l;if(u<0)return;const p=Math.sqrt(u),A=2*l;(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,(-c+p)/A,d),(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,(-c-p)/A,d)}Et=Xe;let Qe=null,Je=null;function Ze(){if("function"===typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),He(t)}const $e="pdfjs_internal_id_";function ti(t,e,i){return Math.min(Math.max(t,e),i)}function ei(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(He(t))}"function"!==typeof Promise.try&&(Promise.try=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return new Promise(e=>{e(t(...i))})}),"function"!==typeof Math.sumPrecise&&(Math.sumPrecise=function(t){return t.reduce((t,e)=>t+e,0)});class ii{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var n;if(!i)return;let s=null;const r=i.name;if("#text"===r)s=i.value;else{if(!ii.shouldBuildText(r))return;null!==i&&void 0!==i&&null!==(n=i.attributes)&&void 0!==n&&n.textContent?s=i.attributes.textContent:i.value&&(s=i.value)}if(null!==s&&e.push({str:s}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}class ni{static setupStorage(t,e,i,n,s){const r=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?t.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",t=>{n.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})})}break;case"select":if(null!==r.value){t.setAttribute("value",r.value);for(const t of i.children)t.attributes.value===r.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(e,{value:s})})}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:s,linkService:r}=t;const{attributes:a}=i,o=e instanceof HTMLAnchorElement;"radio"===a.type&&(a.name="".concat(a.name,"-").concat(s));for(const[l,c]of Object.entries(a))if(null!==c&&void 0!==c)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!o||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,c)}o&&r.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:s,linkService:i});const a="richText"!==s,o=t.div;if(o.append(r),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);r.append(t),a&&ii.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const c=[[n,-1,r]];for(;c.length>0;){var h,d;const[t,n,r]=c.at(-1);if(n+1===t.children.length){c.pop();continue}const o=t.children[++c.at(-1)[1]];if(null===o)continue;const{name:u}=o;if("#text"===u){const t=document.createTextNode(o.value);l.push(t),r.append(t);continue}const p=null!==o&&void 0!==o&&null!==(h=o.attributes)&&void 0!==h&&h.xmlns?document.createElementNS(o.attributes.xmlns,u):document.createElement(u);if(r.append(p),o.attributes&&this.setAttributes({html:p,element:o,storage:e,intent:s,linkService:i}),(null===(d=o.children)||void 0===d?void 0:d.length)>0)c.push([o,-1,p]);else if(o.value){const t=document.createTextNode(o.value);a&&ii.shouldBuildText(u)&&l.push(t),p.append(t)}}for(const u of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const si="http://www.w3.org/2000/svg";class ri{}async function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(ui(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)n(new Error(s.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(s.response)}i(s.responseText)}},s.send(null)})}St=ri,(0,Vt.A)(ri,"CSS",96),(0,Vt.A)(ri,"PDF",72),(0,Vt.A)(ri,"PDF_TO_CSS_UNITS",St.CSS/St.PDF);class oi{constructor(t){let{viewBox:e,userUnit:i,scale:n,rotation:s,offsetX:r=0,offsetY:a=0,dontFlip:o=!1}=t;this.viewBox=e,this.userUnit=i,this.scale=n,this.rotation=s,this.offsetX=r,this.offsetY=a,n*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,u,p,A,f,g,m;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,u=0,p=1;break;case 90:h=0,d=1,u=1,p=0;break;case 270:h=0,d=-1,u=-1,p=0;break;case 0:h=1,d=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(u=-u,p=-p),0===h?(A=Math.abs(c-e[1])*n+r,f=Math.abs(l-e[0])*n+a,g=(e[3]-e[1])*n,m=(e[2]-e[0])*n):(A=Math.abs(l-e[0])*n+r,f=Math.abs(c-e[1])*n+a,g=(e[2]-e[0])*n,m=(e[3]-e[1])*n),this.transform=[h*n,d*n,u*n,p*n,A-h*n*l-u*n*c,f-d*n*l-p*n*c],this.width=g,this.height=m}get rawDims(){const t=this.viewBox;return Fe(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new oi({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){const i=[t,e];return Xe.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];Xe.applyTransform(e,this.transform);const i=[t[2],t[3]];return Xe.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return Xe.applyInverseTransform(i,this.transform),i}}class li extends Ne{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function ci(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function hi(t){return"string"===typeof t&&/\.pdf$/i.test(t)}class di{constructor(){(0,Vt.A)(this,"started",Object.create(null)),(0,Vt.A)(this,"times",[])}time(t){t in this.started&&Pe("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||Pe("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:n,end:s}of this.times)t.push("".concat(i.padEnd(e)," ").concat(s-n,"ms\n"));return t.join("")}}function ui(t,e){const i=e?URL.parse(t,e):URL.parse(t);return"http:"===(null===i||void 0===i?void 0:i.protocol)||"https:"===(null===i||void 0===i?void 0:i.protocol)}function pi(t){t.preventDefault()}function Ai(t){t.preventDefault(),t.stopPropagation()}class fi{static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!==typeof t)return null;(0,_t.A)(fi,this,gi)._||(gi._=(0,_t.A)(fi,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));const e=(0,_t.A)(fi,this,gi)._.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let h=parseInt(e[9],10)||0;return h=h>=0&&h<=59?h:0,"-"===l?(r+=c,a+=h):"+"===l&&(r-=c,a-=h),new Date(Date.UTC(i,n,s,r,a,o))}}var gi={_:void 0};function mi(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Pe('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function vi(t){const{a:e,b:i,c:n,d:s,e:r,f:a}=t.getTransform();return[e,i,n,s,r,a]}function wi(t){const{a:e,b:i,c:n,d:s,e:r,f:a}=t.getTransform().invertSelf();return[e,i,n,s,r,a]}function bi(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof oi){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:r}=t,a=Ge.isCSSRoundSupported,o="var(--total-scale-factor) * ".concat(n,"px"),l="var(--total-scale-factor) * ".concat(s,"px"),c=a?"round(down, ".concat(o,", var(--scale-round-x))"):"calc(".concat(o,")"),h=a?"round(down, ".concat(l,", var(--scale-round-y))"):"calc(".concat(l,")");i&&e.rotation%180!==0?(r.width=h,r.height=c):(r.width=c,r.height=h)}n&&t.setAttribute("data-main-rotation",e.rotation)}class yi{constructor(){const{pixelRatio:t}=yi;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,r=1/0,a=1/0,o=1/0;(i=yi.capPixels(i,s))>0&&(r=Math.sqrt(i/(t*e))),-1!==n&&(a=n/t,o=n/e);const l=Math.min(r,a,o);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}const _i=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class xi{static get isDarkMode(){var t,e;return Fe(this,"isDarkMode",!(null===(t=window)||void 0===t||null===(e=t.matchMedia)||void 0===e||!e.call(t,"(prefers-color-scheme: dark)").matches))}}function Ei(t,e){const i=t[0]/255,n=t[1]/255,s=t[2]/255,r=Math.max(i,n,s),a=Math.min(i,n,s),o=(r+a)/2;if(r===a)e[0]=e[1]=0;else{const t=r-a;switch(e[1]=o<.5?t/(r+a):t/(2-r-a),r){case i:e[0]=60*((n-s)/t+(n<s?6:0));break;case n:e[0]=60*((s-i)/t+2);break;case s:e[0]=60*((i-n)/t+4)}}e[2]=o}function Si(t,e){const i=t[0],n=t[1],s=t[2],r=(1-Math.abs(2*s-1))*n,a=r*(1-Math.abs(i/60%2-1)),o=s-r/2;switch(Math.floor(i/60)){case 0:e[0]=r+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=r+o,e[2]=o;break;case 2:e[0]=o,e[1]=r+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=r+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=r+o;break;case 5:case 6:e[0]=r+o,e[1]=o,e[2]=a+o}}function ki(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Ci(t,e,i){Si(t,i),i.map(ki);const n=.2126*i[0]+.7152*i[1]+.0722*i[2];Si(e,i),i.map(ki);const s=.2126*i[0]+.7152*i[1]+.0722*i[2];return n>s?(n+.05)/(s+.05):(s+.05)/(n+.05)}const Mi=new Map;function Ti(t,e){let{html:i,dir:n,className:s}=t;const r=document.createDocumentFragment();if("string"===typeof i){const t=document.createElement("p");t.dir=n||"auto";const e=i.split(/(?:\r\n?|\n)/);for(let i=0,n=e.length;i<n;++i){const s=e[i];t.append(document.createTextNode(s)),i<n-1&&t.append(document.createElement("br"))}r.append(t)}else ni.render({xfaHtml:i,div:r,intent:"richText"});r.firstChild.classList.add("richText",s),e.append(r)}var Pi=new WeakMap,Di=new WeakMap,Ri=new WeakMap,Li=new WeakMap,Ii=new WeakMap,Fi=new WeakMap,Ni=new WeakMap,Oi=new WeakMap,Bi=new WeakSet;class Wi{constructor(t){(0,bt.A)(this,Bi),(0,yt.A)(this,Pi,null),(0,yt.A)(this,Di,null),(0,yt.A)(this,Ri,void 0),(0,yt.A)(this,Li,null),(0,yt.A)(this,Ii,null),(0,yt.A)(this,Fi,null),(0,yt.A)(this,Ni,null),(0,yt.A)(this,Oi,null),(0,Ht.A)(Ri,this,t),Gi._||(Gi._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=(0,Ht.A)(Pi,this,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=(0,zt.A)(Ri,this)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",pi,{signal:e}),t.addEventListener("pointerdown",ji,{signal:e}));const i=(0,Ht.A)(Li,this,document.createElement("div"));i.className="buttons",t.append(i);const n=(0,zt.A)(Ri,this).toolbarPosition;if(n){const{style:e}=t,i="ltr"===(0,zt.A)(Ri,this)._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*n[1],"% + var(--editor-toolbar-vert-offset))")}return t}get div(){return(0,zt.A)(Pi,this)}hide(){var t;(0,zt.A)(Pi,this).classList.add("hidden"),null===(t=(0,zt.A)(Di,this))||void 0===t||t.hideDropdown()}show(){var t,e;(0,zt.A)(Pi,this).classList.remove("hidden"),null===(t=(0,zt.A)(Ii,this))||void 0===t||t.shown(),null===(e=(0,zt.A)(Fi,this))||void 0===e||e.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=(0,zt.A)(Ri,this),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",Gi._[t]),(0,_t.A)(Bi,this,Hi).call(this,i)&&i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),(0,zt.A)(Li,this).append(i)}async addAltText(t){const e=await t.render();(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi)),(0,Ht.A)(Ii,this,t)}addComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if((0,zt.A)(Fi,this))return;const i=t.renderForToolbar();if(!i)return;(0,_t.A)(Bi,this,Hi).call(this,i);const n=(0,Ht.A)(Ni,this,xt(Bi,this,Vi));e?((0,zt.A)(Li,this).insertBefore(i,e),(0,zt.A)(Li,this).insertBefore(n,e)):(0,zt.A)(Li,this).append(i,n),(0,Ht.A)(Fi,this,t),t.toolbar=this}addColorPicker(t){if((0,zt.A)(Di,this))return;(0,Ht.A)(Di,this,t);const e=t.renderButton();(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi))}async addEditSignatureButton(t){const e=(0,Ht.A)(Oi,this,await t.renderEditButton((0,zt.A)(Ri,this)));(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi))}removeButton(t){var e,i;if("comment"===t)null===(e=(0,zt.A)(Fi,this))||void 0===e||e.removeToolbarCommentButton(),(0,Ht.A)(Fi,this,null),null===(i=(0,zt.A)(Ni,this))||void 0===i||i.remove(),(0,Ht.A)(Ni,this,null)}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e)}}async addButtonBefore(t,e,i){const n=(0,zt.A)(Li,this).querySelector(i);n&&"comment"===t&&this.addComment(e,n)}updateEditSignatureButton(t){(0,zt.A)(Oi,this)&&((0,zt.A)(Oi,this).title=t)}remove(){var t;(0,zt.A)(Pi,this).remove(),null===(t=(0,zt.A)(Di,this))||void 0===t||t.destroy(),(0,Ht.A)(Di,this,null)}}function ji(t){t.stopPropagation()}function Ui(t){(0,zt.A)(Ri,this)._focusEventsAllowed=!1,Ai(t)}function zi(t){(0,zt.A)(Ri,this)._focusEventsAllowed=!0,Ai(t)}function Hi(t){const e=(0,zt.A)(Ri,this)._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",(0,_t.A)(Bi,this,Ui).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,_t.A)(Bi,this,zi).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",pi,{signal:e}),!0)}function Vi(t){const e=document.createElement("div");return e.className="divider",e}var Gi={_:null},qi=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Ki=new WeakSet;class Qi{constructor(t){(0,bt.A)(this,Ki),(0,yt.A)(this,qi,null),(0,yt.A)(this,Xi,null),(0,yt.A)(this,Yi,void 0),(0,Ht.A)(Yi,this,t)}show(t,e,i){const[n,s]=(0,_t.A)(Ki,this,Zi).call(this,e,i),{style:r}=(0,zt.A)(Xi,this)||(0,Ht.A)(Xi,this,(0,_t.A)(Ki,this,Ji).call(this));t.append((0,zt.A)(Xi,this)),r.insetInlineEnd="".concat(100*n,"%"),r.top="calc(".concat(100*s,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,zt.A)(Xi,this).remove()}}function Ji(){const t=(0,Ht.A)(Xi,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=(0,zt.A)(Yi,this)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",pi,{signal:e});const i=(0,Ht.A)(qi,this,document.createElement("div"));return i.className="buttons",t.append(i),(0,zt.A)(Yi,this).hasCommentManager()&&(0,_t.A)(Ki,this,$i).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{(0,zt.A)(Yi,this).commentSelection("floating_button")}),(0,_t.A)(Ki,this,$i).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{(0,zt.A)(Yi,this).highlightSelection("floating_button")}),t}function Zi(t,e){let i=0,n=0;for(const s of t){const t=s.y+s.height;if(t<i)continue;const r=s.x+(e?s.width:0);t>i?(n=r,i=t):e?r>n&&(n=r):r<n&&(n=r)}return[e?1-n:n,i]}function $i(t,e,i,n){const s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);const r=document.createElement("span");s.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",i);const a=(0,zt.A)(Yi,this)._signal;a instanceof AbortSignal&&!a.aborted&&(s.addEventListener("contextmenu",pi,{signal:a}),s.addEventListener("click",n,{signal:a})),(0,zt.A)(qi,this).append(s)}function tn(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))}var en=new WeakMap;class nn{constructor(){(0,yt.A)(this,en,0)}get id(){var t,e;return"".concat(se).concat(((0,Ht.A)(en,this,(t=(0,zt.A)(en,this),e=t++,t)),e))}}var sn=new WeakMap,rn=new WeakMap,an=new WeakMap,on=new WeakSet;class ln{constructor(){(0,bt.A)(this,on),(0,yt.A)(this,sn,Ze()),(0,yt.A)(this,rn,0),(0,yt.A)(this,an,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return Fe(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){const{lastModified:e,name:i,size:n,type:s}=t;return(0,_t.A)(on,this,cn).call(this,"".concat(e,"_").concat(i,"_").concat(n,"_").concat(s),t)}async getFromUrl(t){return(0,_t.A)(on,this,cn).call(this,t,t)}async getFromBlob(t,e){const i=await e;return(0,_t.A)(on,this,cn).call(this,t,i)}async getFromId(t){(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);const e=(0,zt.A)(an,this).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){var i,n,s;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);let r=(0,zt.A)(an,this).get(t);if(null!==(s=r)&&void 0!==s&&s.bitmap)return r.refCounter+=1,r;const a=new OffscreenCanvas(e.width,e.height);return a.getContext("2d").drawImage(e,0,0),r={bitmap:a.transferToImageBitmap(),id:"image_".concat((0,zt.A)(sn,this),"_").concat(((0,Ht.A)(rn,this,(i=(0,zt.A)(rn,this),n=i++,i)),n)),refCounter:1,isSvg:!1},(0,zt.A)(an,this).set(t,r),(0,zt.A)(an,this).set(r.id,r),r}getSvgUrl(t){const e=(0,zt.A)(an,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){var e;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);const i=(0,zt.A)(an,this).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const{bitmap:n}=i;if(!i.url&&!i.file){const t=new OffscreenCanvas(n.width,n.height);t.getContext("bitmaprenderer").transferFromImageBitmap(n),i.blobPromise=t.convertToBlob()}null===(e=n.close)||void 0===e||e.call(n),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat((0,zt.A)(sn,this),"_"))}}async function cn(t,e){var i;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);let n=(0,zt.A)(an,this).get(t);if(null===n)return null;if(null!==(i=n)&&void 0!==i&&i.bitmap)return n.refCounter+=1,n;try{var s,r;let t;if(n||(n={bitmap:null,id:"image_".concat((0,zt.A)(sn,this),"_").concat(((0,Ht.A)(rn,this,(s=(0,zt.A)(rn,this),r=s++,s)),r)),refCounter:0,isSvg:!1}),"string"===typeof e?(n.url=e,t=await ai(e,"blob")):e instanceof File?t=n.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=kt._isSVGFittingCanvas,i=new FileReader,s=new Image,r=new Promise((t,r)=>{s.onload=()=>{n.bitmap=s,n.isSvg=!0,t()},i.onload=async()=>{const t=n.svgUrl=i.result;s.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},s.onerror=i.onerror=r});i.readAsDataURL(t),await r}else n.bitmap=await createImageBitmap(t);n.refCounter=1}catch(a){Pe(a),n=null}return(0,zt.A)(an,this).set(t,n),n&&(0,zt.A)(an,this).set(n.id,n),n}kt=ln;var hn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap;class An{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;(0,yt.A)(this,hn,[]),(0,yt.A)(this,dn,!1),(0,yt.A)(this,un,void 0),(0,yt.A)(this,pn,-1),(0,Ht.A)(un,this,t)}add(t){let{cmd:e,undo:i,post:n,mustExec:s,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}=t;if(s&&e(),(0,zt.A)(dn,this))return;const l={cmd:e,undo:i,post:n,type:r};if(-1===(0,zt.A)(pn,this))return(0,zt.A)(hn,this).length>0&&((0,zt.A)(hn,this).length=0),(0,Ht.A)(pn,this,0),void(0,zt.A)(hn,this).push(l);if(a&&(0,zt.A)(hn,this)[(0,zt.A)(pn,this)].type===r)return o&&(l.undo=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)].undo),void((0,zt.A)(hn,this)[(0,zt.A)(pn,this)]=l);const c=(0,zt.A)(pn,this)+1;c===(0,zt.A)(un,this)?(0,zt.A)(hn,this).splice(0,1):((0,Ht.A)(pn,this,c),c<(0,zt.A)(hn,this).length&&(0,zt.A)(hn,this).splice(c)),(0,zt.A)(hn,this).push(l)}undo(){if(-1===(0,zt.A)(pn,this))return;(0,Ht.A)(dn,this,!0);const{undo:t,post:e}=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)];t(),null===e||void 0===e||e(),(0,Ht.A)(dn,this,!1),(0,Ht.A)(pn,this,(0,zt.A)(pn,this)-1)}redo(){if((0,zt.A)(pn,this)<(0,zt.A)(hn,this).length-1){(0,Ht.A)(pn,this,(0,zt.A)(pn,this)+1),(0,Ht.A)(dn,this,!0);const{cmd:t,post:e}=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)];t(),null===e||void 0===e||e(),(0,Ht.A)(dn,this,!1)}}hasSomethingToUndo(){return-1!==(0,zt.A)(pn,this)}hasSomethingToRedo(){return(0,zt.A)(pn,this)<(0,zt.A)(hn,this).length-1}cleanType(t){if(-1!==(0,zt.A)(pn,this)){for(let e=(0,zt.A)(pn,this);e>=0;e--)if((0,zt.A)(hn,this)[e].type!==t)return(0,zt.A)(hn,this).splice(e+1,(0,zt.A)(pn,this)-e),void(0,Ht.A)(pn,this,e);(0,zt.A)(hn,this).length=0,(0,Ht.A)(pn,this,-1)}}destroy(){(0,Ht.A)(hn,this,null)}}var fn=new WeakSet;class gn{constructor(t){(0,bt.A)(this,fn),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Ge.platform;for(const[i,n,s={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get((0,_t.A)(fn,this,mn).call(this,e));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:r=[],checker:a=null}}=i;a&&!a(t,e)||(n.bind(t,...r,e)(),s||Ai(e))}}function mn(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}class vn{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,mi(n))}e.remove()}(t),Fe(this,"_colors",t)}convert(t){const e=mi(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every((t,i)=>t===e[i]))return vn._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?Xe.makeHexColor(...e):t}}(0,Vt.A)(vn,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var wn=new WeakMap,bn=new WeakMap,yn=new WeakMap,_n=new WeakMap,xn=new WeakMap,En=new WeakMap,Sn=new WeakMap,kn=new WeakMap,Cn=new WeakMap,Mn=new WeakMap,Tn=new WeakMap,Pn=new WeakMap,Dn=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,In=new WeakMap,Fn=new WeakMap,Nn=new WeakMap,On=new WeakMap,Bn=new WeakMap,Wn=new WeakMap,jn=new WeakMap,Un=new WeakMap,zn=new WeakMap,Hn=new WeakMap,Vn=new WeakMap,Gn=new WeakMap,qn=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,$n=new WeakMap,ts=new WeakMap,es=new WeakMap,is=new WeakMap,ns=new WeakMap,ss=new WeakMap,rs=new WeakMap,as=new WeakMap,os=new WeakMap,ls=new WeakMap,cs=new WeakMap,hs=new WeakMap,ds=new WeakMap,us=new WeakMap,ps=new WeakMap,As=new WeakSet;class fs{static get _keyboardManager(){const t=fs.prototype,e=t=>(0,zt.A)(hs,t).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Fe(this,"_keyboardManager",new gn([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,zt.A)(hs,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,zt.A)(hs,t).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,i,n,s,r,a,o,l,c,h,d,u,p,A,f){(0,bt.A)(this,As),(0,yt.A)(this,wn,new AbortController),(0,yt.A)(this,bn,null),(0,yt.A)(this,yn,null),(0,yt.A)(this,_n,new Map),(0,yt.A)(this,xn,new Map),(0,yt.A)(this,En,null),(0,yt.A)(this,Sn,null),(0,yt.A)(this,kn,null),(0,yt.A)(this,Cn,new An),(0,yt.A)(this,Mn,null),(0,yt.A)(this,Tn,null),(0,yt.A)(this,Pn,null),(0,yt.A)(this,Dn,0),(0,yt.A)(this,Rn,new Set),(0,yt.A)(this,Ln,null),(0,yt.A)(this,In,null),(0,yt.A)(this,Fn,new Set),(0,Vt.A)(this,"_editorUndoBar",null),(0,yt.A)(this,Nn,!1),(0,yt.A)(this,On,!1),(0,yt.A)(this,Bn,!1),(0,yt.A)(this,Wn,null),(0,yt.A)(this,jn,null),(0,yt.A)(this,Un,null),(0,yt.A)(this,zn,null),(0,yt.A)(this,Hn,!1),(0,yt.A)(this,Vn,null),(0,yt.A)(this,Gn,new nn),(0,yt.A)(this,qn,!1),(0,yt.A)(this,Xn,!1),(0,yt.A)(this,Yn,!1),(0,yt.A)(this,Kn,null),(0,yt.A)(this,Qn,null),(0,yt.A)(this,Jn,null),(0,yt.A)(this,Zn,null),(0,yt.A)(this,$n,null),(0,yt.A)(this,ts,re.NONE),(0,yt.A)(this,es,new Set),(0,yt.A)(this,is,null),(0,yt.A)(this,ns,null),(0,yt.A)(this,ss,null),(0,yt.A)(this,rs,null),(0,yt.A)(this,as,null),(0,yt.A)(this,os,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,yt.A)(this,ls,[0,0]),(0,yt.A)(this,cs,null),(0,yt.A)(this,hs,null),(0,yt.A)(this,ds,null),(0,yt.A)(this,us,null),(0,yt.A)(this,ps,null);const g=this._signal=(0,zt.A)(wn,this).signal;(0,Ht.A)(hs,this,t),(0,Ht.A)(ds,this,e),(0,Ht.A)(us,this,i),(0,Ht.A)(En,this,n),(0,Ht.A)(Mn,this,s),(0,Ht.A)(ns,this,r),(0,Ht.A)(as,this,o),this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:g}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:g}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:g}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:g}),a._on("setpreference",this.onSetPreference.bind(this),{signal:g}),a._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:g}),window.addEventListener("pointerdown",()=>{(0,Ht.A)(Xn,this,!0)},{capture:!0,signal:g}),window.addEventListener("pointerup",()=>{(0,Ht.A)(Xn,this,!1)},{capture:!0,signal:g}),(0,_t.A)(As,this,ys).call(this),(0,_t.A)(As,this,Ms).call(this),(0,_t.A)(As,this,Es).call(this),(0,Ht.A)(Sn,this,o.annotationStorage),(0,Ht.A)(Wn,this,o.filterFactory),(0,Ht.A)(ss,this,l),(0,Ht.A)(zn,this,c||null),(0,Ht.A)(Nn,this,h),(0,Ht.A)(On,this,d),(0,Ht.A)(Bn,this,u),(0,Ht.A)($n,this,p||null),this.viewParameters={realScale:ri.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=A||null,this._supportsPinchToZoom=!1!==f,null===s||void 0===s||s.setSidebarUiManager(this)}destroy(){var t,e,i,n,s,r,a,o,l;null===(t=(0,zt.A)(ps,this))||void 0===t||t.resolve(),(0,Ht.A)(ps,this,null),null===(e=(0,zt.A)(wn,this))||void 0===e||e.abort(),(0,Ht.A)(wn,this,null),this._signal=null;for(const c of(0,zt.A)(xn,this).values())c.destroy();(0,zt.A)(xn,this).clear(),(0,zt.A)(_n,this).clear(),(0,zt.A)(Fn,this).clear(),null===(i=(0,zt.A)(Zn,this))||void 0===i||i.clear(),(0,Ht.A)(bn,this,null),(0,zt.A)(es,this).clear(),(0,zt.A)(Cn,this).destroy(),null===(n=(0,zt.A)(En,this))||void 0===n||n.destroy(),null===(s=(0,zt.A)(Mn,this))||void 0===s||s.destroy(),null===(r=(0,zt.A)(ns,this))||void 0===r||r.destroy(),null===(a=(0,zt.A)(Vn,this))||void 0===a||a.hide(),(0,Ht.A)(Vn,this,null),null===(o=(0,zt.A)(Jn,this))||void 0===o||o.destroy(),(0,Ht.A)(Jn,this,null),(0,Ht.A)(yn,this,null),(0,zt.A)(jn,this)&&(clearTimeout((0,zt.A)(jn,this)),(0,Ht.A)(jn,this,null)),(0,zt.A)(cs,this)&&(clearTimeout((0,zt.A)(cs,this)),(0,Ht.A)(cs,this,null)),null===(l=this._editorUndoBar)||void 0===l||l.destroy(),(0,Ht.A)(as,this,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,zt.A)($n,this)}get useNewAltTextFlow(){return(0,zt.A)(On,this)}get useNewAltTextWhenAddingImage(){return(0,zt.A)(Bn,this)}get hcmFilter(){return Fe(this,"hcmFilter",(0,zt.A)(ss,this)?(0,zt.A)(Wn,this).addHCMFilter((0,zt.A)(ss,this).foreground,(0,zt.A)(ss,this).background):"none")}get direction(){return Fe(this,"direction",getComputedStyle((0,zt.A)(hs,this)).direction)}get _highlightColors(){return Fe(this,"_highlightColors",(0,zt.A)(zn,this)?new Map((0,zt.A)(zn,this).split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return Fe(this,"highlightColors",null);const e=new Map,i=!!(0,zt.A)(ss,this);for(const[n,s]of t){const t=n.endsWith("_HCM");i&&t?e.set(n.replace("_HCM",""),s):i||t||e.set(n,s)}return Fe(this,"highlightColors",e)}get highlightColorNames(){return Fe(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),(0,Ht.A)(Pn,this,t)}setMainHighlightColorPicker(t){(0,Ht.A)(Jn,this,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=(0,zt.A)(En,this))||void 0===e||e.editAltText(this,t,i)}hasCommentManager(){return!!(0,zt.A)(Mn,this)}editComment(t,e,i,n){var s;null===(s=(0,zt.A)(Mn,this))||void 0===s||s.showDialog(this,t,e,i,n)}selectComment(t,e){const i=(0,zt.A)(xn,this).get(t),n=null===i||void 0===i?void 0:i.getEditorByUID(e);null===n||void 0===n||n.toggleComment(!0,!0)}updateComment(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.updateComment(t.getData())}updatePopupColor(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.updatePopupColor(t)}removeComment(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.removeComments([t.uid])}toggleComment(t,e){var i;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;null===(i=(0,zt.A)(Mn,this))||void 0===i||i.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){var i;return t&&(null===(i=(0,zt.A)(Mn,this))||void 0===i?void 0:i.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return(null===(t=(0,zt.A)(Mn,this))||void 0===t?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if((0,zt.A)(xn,this).has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),n=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",n),e())};this._eventBus.on("editorsrendered",n),await i}getSignature(t){var e;null===(e=(0,zt.A)(ns,this))||void 0===e||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return(0,zt.A)(ns,this)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;if("enableNewAltTextWhenAddingImage"===e)(0,Ht.A)(Bn,this,i)}onPageChanging(t){let{pageNumber:e}=t;(0,Ht.A)(Dn,this,e-1)}focusMainContainer(){(0,zt.A)(hs,this).focus()}findParent(t,e){for(const i of(0,zt.A)(xn,this).values()){const{x:n,y:s,width:r,height:a}=i.div.getBoundingClientRect();if(t>=n&&t<=n+r&&e>=s&&e<=s+a)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,zt.A)(ds,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,zt.A)(Fn,this).add(t)}removeShouldRescale(t){(0,zt.A)(Fn,this).delete(t)}onScaleChanging(t){var e;let{scale:i}=t;this.commitOrRemove(),this.viewParameters.realScale=i*ri.PDF_TO_CSS_UNITS;for(const n of(0,zt.A)(Fn,this))n.onScaleChanging();null===(e=(0,zt.A)(Pn,this))||void 0===e||e.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a}=i,o=i.toString(),l=(0,_t.A)(As,this,gs).call(this,i).closest(".textLayer"),c=this.getSelectionBoxes(l);if(!c)return;i.empty();const h=(0,_t.A)(As,this,ms).call(this,l),d=(0,zt.A)(ts,this)===re.NONE,u=()=>{const i=null===h||void 0===h?void 0:h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:c,anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a,text:o});d&&this.showAllEditors("highlight",!0,!0),e&&(null===i||void 0===i||i.editComment())};d?this.switchToMode(re.HIGHLIGHT,u):u()}commentSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!(0,zt.A)(Sn,this))return null;const e="".concat(se).concat(t),i=(0,zt.A)(Sn,this).getRawValue(e);return i&&(0,zt.A)(Sn,this).remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!(0,zt.A)(Sn,this)||(0,zt.A)(Sn,this).has(t.id)||(0,zt.A)(Sn,this).setValue(t.id,t)}a11yAlert(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,zt.A)(us,this);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,(0,zt.A)(Hn,this)&&((0,Ht.A)(Hn,this,!1),(0,_t.A)(As,this,bs).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of(0,zt.A)(es,this))if(e.div.contains(t)){(0,Ht.A)(Qn,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,zt.A)(Qn,this))return;const[t,e]=(0,zt.A)(Qn,this);(0,Ht.A)(Qn,this,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){(0,_t.A)(As,this,Es).call(this),(0,_t.A)(As,this,ks).call(this)}removeEditListeners(){(0,_t.A)(As,this,Ss).call(this),(0,_t.A)(As,this,Cs).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of(0,zt.A)(In,this))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of(0,zt.A)(In,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=(0,zt.A)(bn,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const n of(0,zt.A)(es,this)){const t=n.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const t of(0,zt.A)(In,this))if(t.isHandlingMimeForPasting(r.type))return void t.paste(r,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){return void Pe('paste: "'.concat(s.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const r of i){const e=await n.deserialize(r);if(!e)return;t.push(e)}const e=()=>{for(const e of t)(0,_t.A)(As,this,Ls).call(this,e);(0,_t.A)(As,this,Ns).call(this,t)},s=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:s,mustExec:!0})}catch(s){Pe('paste: "'.concat(s.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,zt.A)(ts,this)===re.NONE||this.isEditorHandlingKeyboard||fs._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,zt.A)(Hn,this)&&((0,Ht.A)(Hn,this,!1),(0,_t.A)(As,this,bs).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}setEditingState(t){t?((0,_t.A)(As,this,_s).call(this),(0,_t.A)(As,this,ks).call(this),(0,_t.A)(As,this,Ts).call(this,{isEditing:(0,zt.A)(ts,this)!==re.NONE,isEmpty:(0,_t.A)(As,this,Fs).call(this),hasSomethingToUndo:(0,zt.A)(Cn,this).hasSomethingToUndo(),hasSomethingToRedo:(0,zt.A)(Cn,this).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,_t.A)(As,this,xs).call(this),(0,_t.A)(As,this,Cs).call(this),(0,_t.A)(As,this,Ts).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,zt.A)(In,this)){(0,Ht.A)(In,this,t);for(const t of(0,zt.A)(In,this))(0,_t.A)(As,this,Ps).call(this,t.defaultPropertiesToUpdate)}}getId(){return(0,zt.A)(Gn,this).id}get currentLayer(){return(0,zt.A)(xn,this).get((0,zt.A)(Dn,this))}getLayer(t){return(0,zt.A)(xn,this).get(t)}get currentPageIndex(){return(0,zt.A)(Dn,this)}addLayer(t){(0,zt.A)(xn,this).set(t.pageIndex,t),(0,zt.A)(qn,this)?t.enable():t.disable()}removeLayer(t){(0,zt.A)(xn,this).delete(t.pageIndex)}async updateMode(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if((0,zt.A)(ts,this)!==t&&(!(0,zt.A)(ps,this)||(await(0,zt.A)(ps,this).promise,(0,zt.A)(ps,this)))){var o,l;if((0,Ht.A)(ps,this,Promise.withResolvers()),null===(e=(0,zt.A)(Pn,this))||void 0===e||e.commitOrRemove(),(0,zt.A)(ts,this)===re.POPUP)null===(o=(0,zt.A)(Mn,this))||void 0===o||o.hideSidebar();if(null===(i=(0,zt.A)(Mn,this))||void 0===i||i.destroyPopup(),(0,Ht.A)(ts,this,t),t===re.NONE){var c;this.setEditingState(!1),(0,_t.A)(As,this,Rs).call(this);for(const t of(0,zt.A)(_n,this).values())t.hideStandaloneCommentButton();return null===(c=this._editorUndoBar)||void 0===c||c.hide(),this.toggleComment(null),void(0,zt.A)(ps,this).resolve()}for(const t of(0,zt.A)(_n,this).values())t.addStandaloneCommentButton();if(t===re.SIGNATURE)await(null===(l=(0,zt.A)(ns,this))||void 0===l?void 0:l.loadSignatures());this.setEditingState(!0),await(0,_t.A)(As,this,Ds).call(this),this.unselectAll();for(const e of(0,zt.A)(xn,this).values())e.updateMode(t);if(t===re.POPUP){var h;(0,zt.A)(yn,this)||(0,Ht.A)(yn,this,await(0,zt.A)(as,this).getAnnotationsByType(new Set((0,zt.A)(In,this).map(t=>t._editorType))));const t=new Set,e=[];for(const i of(0,zt.A)(_n,this).values()){const{annotationElementId:n,hasComment:s,deleted:r}=i;n&&t.add(n),s&&!r&&e.push(i.getData())}for(const i of(0,zt.A)(yn,this)){const{id:n,popupRef:s,contentsObj:r}=i;s&&null!==r&&void 0!==r&&r.str&&!t.has(n)&&!(0,zt.A)(Rn,this).has(n)&&e.push(i)}null===(h=(0,zt.A)(Mn,this))||void 0===h||h.showSidebar(e)}if(!n)return s&&this.addNewEditorFromKeyboard(),void(0,zt.A)(ps,this).resolve();for(const t of(0,zt.A)(_n,this).values())t.uid===n?(this.setSelected(t),a?t.editComment():r?t.enterInEditMode():t.focus()):t.unselect();(0,zt.A)(ps,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==(0,zt.A)(ts,this)&&this._eventBus.dispatch("switchannotationeditormode",(0,wt.A)({source:this},t))}updateParams(t,e){if((0,zt.A)(In,this)){switch(t){case ae.CREATE:return void this.currentLayer.addNewEditor(e);case ae.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),((0,zt.A)(rs,this)||(0,Ht.A)(rs,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(const i of(0,zt.A)(es,this))i.updateParams(t,e);else for(const i of(0,zt.A)(In,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,n;for(const s of(0,zt.A)(_n,this).values())s.editorType===t&&s.show(e);(null===(i=null===(n=(0,zt.A)(rs,this))||void 0===n?void 0:n.get(ae.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&(0,_t.A)(As,this,Ps).call(this,[[ae.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,zt.A)(Yn,this)!==t){(0,Ht.A)(Yn,this,t);for(const e of(0,zt.A)(xn,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of(0,zt.A)(_n,this).values())e.pageIndex===t&&(yield e)}getEditor(t){return(0,zt.A)(_n,this).get(t)}addEditor(t){(0,zt.A)(_n,this).set(t.id,t)}removeEditor(t){var e,i;(t.div.contains(document.activeElement)&&((0,zt.A)(jn,this)&&clearTimeout((0,zt.A)(jn,this)),(0,Ht.A)(jn,this,setTimeout(()=>{this.focusMainContainer(),(0,Ht.A)(jn,this,null)},0))),(0,zt.A)(_n,this).delete(t.id),t.annotationElementId)&&(null===(e=(0,zt.A)(Zn,this))||void 0===e||e.delete(t.annotationElementId));(this.unselect(t),t.annotationElementId&&(0,zt.A)(Rn,this).has(t.annotationElementId))||(null===(i=(0,zt.A)(Sn,this))||void 0===i||i.remove(t.id))}addDeletedAnnotationElement(t){(0,zt.A)(Rn,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return(0,zt.A)(Rn,this).has(t)}removeDeletedAnnotationElement(t){(0,zt.A)(Rn,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,zt.A)(bn,this)!==t&&((0,Ht.A)(bn,this,t),t&&(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate))}updateUI(t){xt(As,this,Is)===t&&(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){(0,_t.A)(As,this,Ps).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if((0,zt.A)(es,this).has(t))return(0,zt.A)(es,this).delete(t),t.unselect(),void(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection});(0,zt.A)(es,this).add(t),t.select(),(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),null===(e=(0,zt.A)(Pn,this))||void 0===e||e.commitOrRemove();for(const i of(0,zt.A)(es,this))i!==t&&i.unselect();(0,zt.A)(es,this).clear(),(0,zt.A)(es,this).add(t),t.select(),(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,zt.A)(es,this).has(t)}get firstSelectedEditor(){return(0,zt.A)(es,this).values().next().value}unselect(t){t.unselect(),(0,zt.A)(es,this).delete(t),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,zt.A)(es,this).size}get isEnterHandled(){return 1===(0,zt.A)(es,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;(0,zt.A)(Cn,this).undo(),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:(0,zt.A)(Cn,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,_t.A)(As,this,Fs).call(this)}),null===(t=this._editorUndoBar)||void 0===t||t.hide()}redo(){(0,zt.A)(Cn,this).redo(),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,zt.A)(Cn,this).hasSomethingToRedo(),isEmpty:(0,_t.A)(As,this,Fs).call(this)})}addCommands(t){(0,zt.A)(Cn,this).add(t),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,_t.A)(As,this,Fs).call(this)})}cleanUndoStack(t){(0,zt.A)(Cn,this).cleanType(t)}delete(){var t;this.commitOrRemove();const e=null===(t=this.currentLayer)||void 0===t?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...(0,zt.A)(es,this)],n=()=>{for(const t of i)(0,_t.A)(As,this,Ls).call(this,t)};this.addCommands({cmd:()=>{var t;null===(t=this._editorUndoBar)||void 0===t||t.show(n,1===i.length?i[0].editorType:i.length);for(const e of i)e.remove()},undo:n,mustExec:!0})}commitOrRemove(){var t;null===(t=(0,zt.A)(bn,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,zt.A)(bn,this)||this.hasSelection}selectAll(){for(const t of(0,zt.A)(es,this))t.commit();(0,_t.A)(As,this,Ns).call(this,(0,zt.A)(_n,this).values())}unselectAll(){var t;if((!(0,zt.A)(bn,this)||((0,zt.A)(bn,this).commitOrRemove(),(0,zt.A)(ts,this)===re.NONE))&&(null===(t=(0,zt.A)(Pn,this))||void 0===t||!t.commitOrRemove())&&this.hasSelection){for(const t of(0,zt.A)(es,this))t.unselect();(0,zt.A)(es,this).clear(),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;(0,zt.A)(ls,this)[0]+=t,(0,zt.A)(ls,this)[1]+=e;const[i,n]=(0,zt.A)(ls,this),s=[...(0,zt.A)(es,this)];(0,zt.A)(cs,this)&&clearTimeout((0,zt.A)(cs,this)),(0,Ht.A)(cs,this,setTimeout(()=>{(0,Ht.A)(cs,this,null),(0,zt.A)(ls,this)[0]=(0,zt.A)(ls,this)[1]=0,this.addCommands({cmd:()=>{for(const t of s)(0,zt.A)(_n,this).has(t.id)&&(t.translateInPage(i,n),t.translationDone())},undo:()=>{for(const t of s)(0,zt.A)(_n,this).has(t.id)&&(t.translateInPage(-i,-n),t.translationDone())},mustExec:!1})},1e3));for(const r of s)r.translateInPage(t,e),r.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),(0,Ht.A)(Ln,this,new Map);for(const t of(0,zt.A)(es,this))(0,zt.A)(Ln,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!(0,zt.A)(Ln,this))return!1;this.disableUserSelect(!1);const t=(0,zt.A)(Ln,this);(0,Ht.A)(Ln,this,null);let e=!1;for(const[{x:n,y:s,pageIndex:r},a]of t)a.newX=n,a.newY=s,a.newPageIndex=r,e||(e=n!==a.savedX||s!==a.savedY||r!==a.savedPageIndex);if(!e)return!1;const i=(t,e,i,n)=>{if((0,zt.A)(_n,this).has(t.id)){const s=(0,zt.A)(xn,this).get(n);s?t._setParentAndPosition(s,e,i):(t.pageIndex=n,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:n,newY:s,newPageIndex:r}]of t)i(e,n,s,r)},undo:()=>{for(const[e,{savedX:n,savedY:s,savedPageIndex:r}]of t)i(e,n,s,r)},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,zt.A)(Ln,this))for(const i of(0,zt.A)(Ln,this).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===(0,zt.A)(es,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,zt.A)(bn,this)===t}getActive(){return(0,zt.A)(bn,this)}getMode(){return(0,zt.A)(ts,this)}isEditingMode(){return(0,zt.A)(ts,this)!==re.NONE}get imageManager(){return Fe(this,"imageManager",new ln)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,c=e.rangeCount;l<c;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:n,width:s,height:r}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(t,e,a,o)=>({x:(e-n)/r,y:1-(t+a-i)/s,width:o/r,height:a/s});break;case"180":a=(t,e,a,o)=>({x:1-(t+a-i)/s,y:1-(e+o-n)/r,width:a/s,height:o/r});break;case"270":a=(t,e,a,o)=>({x:1-(e+o-n)/r,y:(t-i)/s,width:o/r,height:a/s});break;default:a=(t,e,a,o)=>({x:(t-i)/s,y:(e-n)/r,width:a/s,height:o/r})}const o=[];for(let l=0,c=e.rangeCount;l<c;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:n,height:s}of t.getClientRects())0!==n&&0!==s&&o.push(a(e,i,n,s))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;((0,zt.A)(kn,this)||(0,Ht.A)(kn,this,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=(0,zt.A)(kn,this))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=(0,zt.A)(kn,this))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const n=(0,zt.A)(Sn,this).getRawValue(i);n&&((0,zt.A)(ts,this)!==re.NONE||n.hasBeenModified)&&n.renderAnnotationElement(t)}setMissingCanvas(t,e,i){var n;const s=null===(n=(0,zt.A)(Zn,this))||void 0===n?void 0:n.get(t);s&&(s.setCanvas(e,i),(0,zt.A)(Zn,this).delete(t))}addMissingCanvas(t,e){((0,zt.A)(Zn,this)||(0,Ht.A)(Zn,this,new Map)).set(t,e)}}function gs(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function ms(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of(0,zt.A)(xn,this).values())if(i.hasTextLayer(t))return i;return null}function vs(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=(0,_t.A)(As,this,gs).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,zt.A)(Vn,this)||(0,Ht.A)(Vn,this,new Qi(this)),(0,zt.A)(Vn,this).show(e,i,"ltr"===this.direction))}function ws(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if((0,zt.A)(is,this))null===(i=(0,zt.A)(Vn,this))||void 0===i||i.hide(),(0,Ht.A)(is,this,null),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!1});return}const{anchorNode:n}=e;if(n===(0,zt.A)(is,this))return;const s=(0,_t.A)(As,this,gs).call(this,e).closest(".textLayer");var r;if(s){if(null===(t=(0,zt.A)(Vn,this))||void 0===t||t.hide(),(0,Ht.A)(is,this,n),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!0}),((0,zt.A)(ts,this)===re.HIGHLIGHT||(0,zt.A)(ts,this)===re.NONE)&&((0,zt.A)(ts,this)===re.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,Ht.A)(Hn,this,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=(0,zt.A)(ts,this)===re.HIGHLIGHT?(0,_t.A)(As,this,ms).call(this,s):null;if(null===t||void 0===t||t.toggleDrawing(),(0,zt.A)(Xn,this)){const e=new AbortController,i=this.combinedSignal(e),n=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),null===t||void 0===t||t.toggleDrawing(!0),"pointerup"===i.type&&(0,_t.A)(As,this,bs).call(this,"main_toolbar"))};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}else null===t||void 0===t||t.toggleDrawing(!0),(0,_t.A)(As,this,bs).call(this,"main_toolbar")}}else(0,zt.A)(is,this)&&(null===(r=(0,zt.A)(Vn,this))||void 0===r||r.hide(),(0,Ht.A)(is,this,null),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!1}))}function bs(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,zt.A)(ts,this)===re.HIGHLIGHT?this.highlightSelection(t):(0,zt.A)(Nn,this)&&(0,_t.A)(As,this,vs).call(this)}function ys(){document.addEventListener("selectionchange",(0,_t.A)(As,this,ws).bind(this),{signal:this._signal})}function _s(){if((0,zt.A)(Un,this))return;(0,Ht.A)(Un,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Un,this));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function xs(){var t;null===(t=(0,zt.A)(Un,this))||void 0===t||t.abort(),(0,Ht.A)(Un,this,null)}function Es(){if((0,zt.A)(Kn,this))return;(0,Ht.A)(Kn,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Kn,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function Ss(){var t;null===(t=(0,zt.A)(Kn,this))||void 0===t||t.abort(),(0,Ht.A)(Kn,this,null)}function ks(){if((0,zt.A)(Tn,this))return;(0,Ht.A)(Tn,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Tn,this));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function Cs(){var t;null===(t=(0,zt.A)(Tn,this))||void 0===t||t.abort(),(0,Ht.A)(Tn,this,null)}function Ms(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function Ts(t){Object.entries(t).some(t=>{let[e,i]=t;return(0,zt.A)(os,this)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,zt.A)(os,this),t)}),(0,zt.A)(ts,this)===re.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,_t.A)(As,this,Ps).call(this,[[ae.HIGHLIGHT_FREE,!0]]))}function Ps(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function Ds(){if(!(0,zt.A)(qn,this)){(0,Ht.A)(qn,this,!0);const t=[];for(const e of(0,zt.A)(xn,this).values())t.push(e.enable());await Promise.all(t);for(const e of(0,zt.A)(_n,this).values())e.enable()}}function Rs(){if(this.unselectAll(),(0,zt.A)(qn,this)){(0,Ht.A)(qn,this,!1);for(const t of(0,zt.A)(xn,this).values())t.disable();for(const t of(0,zt.A)(_n,this).values())t.disable()}}function Ls(t){const e=(0,zt.A)(xn,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function Is(t){let e=null;for(e of(0,zt.A)(es,t));return e}function Fs(){if(0===(0,zt.A)(_n,this).size)return!0;if(1===(0,zt.A)(_n,this).size)for(const t of(0,zt.A)(_n,this).values())return t.isEmpty();return!1}function Ns(t){for(const e of(0,zt.A)(es,this))e.unselect();(0,zt.A)(es,this).clear();for(const e of t)e.isEmpty()||((0,zt.A)(es,this).add(e),e.select());(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection})}(0,Vt.A)(fs,"TRANSLATE_SMALL",1),(0,Vt.A)(fs,"TRANSLATE_BIG",10);var Os=new WeakMap,Bs=new WeakMap,Ws=new WeakMap,js=new WeakMap,Us=new WeakMap,zs=new WeakMap,Hs=new WeakMap,Vs=new WeakMap,Gs=new WeakMap,qs=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,Ks=new WeakSet;class Qs{constructor(t){(0,bt.A)(this,Ks),(0,yt.A)(this,Os,null),(0,yt.A)(this,Bs,!1),(0,yt.A)(this,Ws,null),(0,yt.A)(this,js,null),(0,yt.A)(this,Us,null),(0,yt.A)(this,zs,null),(0,yt.A)(this,Hs,!1),(0,yt.A)(this,Vs,null),(0,yt.A)(this,Gs,null),(0,yt.A)(this,qs,null),(0,yt.A)(this,Xs,null),(0,yt.A)(this,Ys,!1),(0,Ht.A)(Gs,this,t),(0,Ht.A)(Ys,this,t._uiManager.useNewAltTextFlow),$s._||($s._=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){var e;null!==(e=Qs._l10n)&&void 0!==e||(Qs._l10n=t)}async render(){const t=(0,Ht.A)(Ws,this,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=(0,Ht.A)(js,this,document.createElement("span"));t.append(e),(0,zt.A)(Ys,this)?(t.classList.add("new"),t.setAttribute("data-l10n-id",$s._.missing),e.setAttribute("data-l10n-id",$s._["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=(0,zt.A)(Gs,this)._uiManager._signal;t.addEventListener("contextmenu",pi,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=t=>{t.preventDefault(),(0,zt.A)(Gs,this)._uiManager.editAltText((0,zt.A)(Gs,this)),(0,zt.A)(Ys,this)&&(0,zt.A)(Gs,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:xt(Ks,this,Js)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,Ht.A)(Hs,this,!0),n(e))},{signal:i}),await(0,_t.A)(Ks,this,Zs).call(this),t}finish(){(0,zt.A)(Ws,this)&&((0,zt.A)(Ws,this).focus({focusVisible:(0,zt.A)(Hs,this)}),(0,Ht.A)(Hs,this,!1))}isEmpty(){return(0,zt.A)(Ys,this)?null===(0,zt.A)(Os,this):!(0,zt.A)(Os,this)&&!(0,zt.A)(Bs,this)}hasData(){return(0,zt.A)(Ys,this)?null!==(0,zt.A)(Os,this)||!!(0,zt.A)(qs,this):this.isEmpty()}get guessedText(){return(0,zt.A)(qs,this)}async setGuessedText(t){null===(0,zt.A)(Os,this)&&((0,Ht.A)(qs,this,t),(0,Ht.A)(Xs,this,await Qs._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,_t.A)(Ks,this,Zs).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e;if(!(0,zt.A)(Ys,this)||(0,zt.A)(Os,this))return null===(e=(0,zt.A)(Vs,this))||void 0===e||e.remove(),void(0,Ht.A)(Vs,this,null);if(!(0,zt.A)(Vs,this)){const t=(0,Ht.A)(Vs,this,document.createElement("div"));t.className="noAltTextBadge",(0,zt.A)(Gs,this).div.append(t)}(0,zt.A)(Vs,this).classList.toggle("hidden",!t)}serialize(t){let e=(0,zt.A)(Os,this);return t||(0,zt.A)(qs,this)!==e||(e=(0,zt.A)(Xs,this)),{altText:e,decorative:(0,zt.A)(Bs,this),guessedText:(0,zt.A)(qs,this),textWithDisclaimer:(0,zt.A)(Xs,this)}}get data(){return{altText:(0,zt.A)(Os,this),decorative:(0,zt.A)(Bs,this)}}set data(t){let{altText:e,decorative:i,guessedText:n,textWithDisclaimer:s,cancel:r=!1}=t;n&&((0,Ht.A)(qs,this,n),(0,Ht.A)(Xs,this,s)),(0,zt.A)(Os,this)===e&&(0,zt.A)(Bs,this)===i||(r||((0,Ht.A)(Os,this,e),(0,Ht.A)(Bs,this,i)),(0,_t.A)(Ks,this,Zs).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,zt.A)(Ws,this)&&(!t&&(0,zt.A)(zs,this)&&(clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)),(0,zt.A)(Ws,this).disabled=!t)}shown(){(0,zt.A)(Gs,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:xt(Ks,this,Js)}})}destroy(){var t,e;null===(t=(0,zt.A)(Ws,this))||void 0===t||t.remove(),(0,Ht.A)(Ws,this,null),(0,Ht.A)(js,this,null),(0,Ht.A)(Us,this,null),null===(e=(0,zt.A)(Vs,this))||void 0===e||e.remove(),(0,Ht.A)(Vs,this,null)}}function Js(t){return((0,zt.A)(Os,t)?"added":null===(0,zt.A)(Os,t)&&t.guessedText&&"review")||"missing"}async function Zs(){const t=(0,zt.A)(Ws,this);if(!t)return;if((0,zt.A)(Ys,this)){var e,i;if(t.classList.toggle("done",!!(0,zt.A)(Os,this)),t.setAttribute("data-l10n-id",$s._[xt(Ks,this,Js)]),null===(e=(0,zt.A)(js,this))||void 0===e||e.setAttribute("data-l10n-id",$s._["".concat(xt(Ks,this,Js),"-label")]),!(0,zt.A)(Os,this))return void(null===(i=(0,zt.A)(Us,this))||void 0===i||i.remove())}else{var n;if(!(0,zt.A)(Os,this)&&!(0,zt.A)(Bs,this))return t.classList.remove("done"),void(null===(n=(0,zt.A)(Us,this))||void 0===n||n.remove());t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let s=(0,zt.A)(Us,this);if(!s){(0,Ht.A)(Us,this,s=document.createElement("span")),s.className="tooltip",s.setAttribute("role","tooltip"),s.id="alt-text-tooltip-".concat((0,zt.A)(Gs,this).id);const e=100,i=(0,zt.A)(Gs,this)._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)},{once:!0}),t.addEventListener("mouseenter",()=>{(0,Ht.A)(zs,this,setTimeout(()=>{(0,Ht.A)(zs,this,null),(0,zt.A)(Us,this).classList.add("show"),(0,zt.A)(Gs,this)._reportTelemetry({action:"alt_text_tooltip"})},e))},{signal:i}),t.addEventListener("mouseleave",()=>{var t;(0,zt.A)(zs,this)&&(clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)),null===(t=(0,zt.A)(Us,this))||void 0===t||t.classList.remove("show")},{signal:i})}(0,zt.A)(Bs,this)?s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(s.removeAttribute("data-l10n-id"),s.textContent=(0,zt.A)(Os,this)),s.parentNode||t.append(s);const r=(0,zt.A)(Gs,this).getElementForAltText();null===r||void 0===r||r.setAttribute("aria-describedby",s.id)}var $s={_:null};(0,Vt.A)(Qs,"_l10n",null);var tr=new WeakMap,er=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,rr=new WeakMap,ar=new WeakMap,or=new WeakMap,lr=new WeakMap,cr=new WeakMap,hr=new WeakSet;class dr{constructor(t){(0,bt.A)(this,hr),(0,yt.A)(this,tr,null),(0,yt.A)(this,er,null),(0,yt.A)(this,ir,!1),(0,yt.A)(this,nr,null),(0,yt.A)(this,sr,null),(0,yt.A)(this,rr,null),(0,yt.A)(this,ar,null),(0,yt.A)(this,or,null),(0,yt.A)(this,lr,!1),(0,yt.A)(this,cr,null),(0,Ht.A)(nr,this,t)}renderForToolbar(){const t=(0,Ht.A)(er,this,document.createElement("button"));return t.className="comment",(0,_t.A)(hr,this,ur).call(this,t,!1)}renderForStandalone(){const t=(0,Ht.A)(tr,this,document.createElement("button"));t.className="annotationCommentButton";const e=(0,zt.A)(nr,this).commentButtonPosition;if(e){const{style:i}=t;i.insetInlineEnd="calc(".concat(100*("ltr"===(0,zt.A)(nr,this)._uiManager.direction?1-e[0]:e[0]),"% - var(--comment-button-dim))"),i.top="calc(".concat(100*e[1],"% - var(--comment-button-dim))");const n=(0,zt.A)(nr,this).commentButtonColor;n&&(i.backgroundColor=n)}return(0,_t.A)(hr,this,ur).call(this,t,!0)}focusButton(){setTimeout(()=>{var t,e;null===(t=null!==(e=(0,zt.A)(tr,this))&&void 0!==e?e:(0,zt.A)(er,this))||void 0===t||t.focus()},0)}onUpdatedColor(){if(!(0,zt.A)(tr,this))return;const t=(0,zt.A)(nr,this).commentButtonColor;t&&((0,zt.A)(tr,this).style.backgroundColor=t),(0,zt.A)(nr,this)._uiManager.updatePopupColor((0,zt.A)(nr,this))}get commentButtonWidth(){var t,e;return(null!==(t=null===(e=(0,zt.A)(tr,this))||void 0===e?void 0:e.getBoundingClientRect().width)&&void 0!==t?t:0)/(0,zt.A)(nr,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if((0,zt.A)(cr,this))return(0,zt.A)(cr,this);if(!(0,zt.A)(tr,this))return null;const{x:t,y:e,height:i}=(0,zt.A)(tr,this).getBoundingClientRect(),{x:n,y:s,width:r,height:a}=(0,zt.A)(nr,this).parent.boundingClientRect;return[(t-n)/r,(e+i-s)/a]}set commentPopupPositionInLayer(t){(0,Ht.A)(cr,this,t)}hasDefaultPopupPosition(){return null===(0,zt.A)(cr,this)}removeStandaloneCommentButton(){var t;null===(t=(0,zt.A)(tr,this))||void 0===t||t.remove(),(0,Ht.A)(tr,this,null)}removeToolbarCommentButton(){var t;null===(t=(0,zt.A)(er,this))||void 0===t||t.remove(),(0,Ht.A)(er,this,null)}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;(0,zt.A)(tr,this)&&((0,zt.A)(tr,this).classList.toggle("selected",e),(0,zt.A)(tr,this).ariaExpanded=i)}edit(t){const e=this.commentPopupPositionInLayer;let i,n;if(e)[i,n]=e;else{[i,n]=(0,zt.A)(nr,this).commentButtonPosition;const{width:t,height:e,x:s,y:r}=(0,zt.A)(nr,this);i=s+i*t,n=r+n*e}const s=(0,zt.A)(nr,this).parent.boundingClientRect,{x:r,y:a,width:o,height:l}=s;(0,zt.A)(nr,this)._uiManager.editComment((0,zt.A)(nr,this),r+i*o,a+n*l,(0,wt.A)((0,wt.A)({},t),{},{parentDimensions:s}))}finish(){(0,zt.A)(er,this)&&((0,zt.A)(er,this).focus({focusVisible:(0,zt.A)(ir,this)}),(0,Ht.A)(ir,this,!1))}isDeleted(){return(0,zt.A)(lr,this)||""===(0,zt.A)(ar,this)}isEmpty(){return null===(0,zt.A)(ar,this)}hasBeenEdited(){return this.isDeleted()||(0,zt.A)(ar,this)!==(0,zt.A)(sr,this)}serialize(){return this.data}get data(){return{text:(0,zt.A)(ar,this),richText:(0,zt.A)(rr,this),date:(0,zt.A)(or,this),deleted:this.isDeleted()}}set data(t){if(t!==(0,zt.A)(ar,this)&&(0,Ht.A)(rr,this,null),null===t)return(0,Ht.A)(ar,this,""),void(0,Ht.A)(lr,this,!0);(0,Ht.A)(ar,this,t),(0,Ht.A)(or,this,new Date),(0,Ht.A)(lr,this,!1)}setInitialText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,Ht.A)(sr,this,t),this.data=t,(0,Ht.A)(or,this,null),(0,Ht.A)(rr,this,e)}shown(){}destroy(){var t,e;null===(t=(0,zt.A)(er,this))||void 0===t||t.remove(),(0,Ht.A)(er,this,null),null===(e=(0,zt.A)(tr,this))||void 0===e||e.remove(),(0,Ht.A)(tr,this,null),(0,Ht.A)(ar,this,""),(0,Ht.A)(rr,this,null),(0,Ht.A)(or,this,null),(0,Ht.A)(nr,this,null),(0,Ht.A)(ir,this,!1),(0,Ht.A)(lr,this,!1)}}function ur(t,e){if(!(0,zt.A)(nr,this)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[(0,zt.A)(nr,this)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const i=(0,zt.A)(nr,this)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",pi,{signal:i}),e&&(t.addEventListener("focusin",t=>{(0,zt.A)(nr,this)._focusEventsAllowed=!1,Ai(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{(0,zt.A)(nr,this)._focusEventsAllowed=!0,Ai(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=e=>{e.preventDefault(),t===(0,zt.A)(er,this)?this.edit():(0,zt.A)(nr,this).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,Ht.A)(ir,this,!0),n(e))},{signal:i}),t.addEventListener("pointerenter",()=>{(0,zt.A)(nr,this).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{(0,zt.A)(nr,this).toggleComment(!1,!1)},{signal:i}),t}var pr=new WeakMap,Ar=new WeakMap,fr=new WeakMap,gr=new WeakMap,mr=new WeakMap,vr=new WeakMap,wr=new WeakMap,br=new WeakMap,yr=new WeakMap,_r=new WeakMap,xr=new WeakMap,Er=new WeakMap,Sr=new WeakSet;class kr{constructor(t){let{container:e,isPinchingDisabled:i=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:r=null,onPinchEnd:a=null,signal:o}=t;(0,bt.A)(this,Sr),(0,yt.A)(this,pr,void 0),(0,yt.A)(this,Ar,!1),(0,yt.A)(this,fr,null),(0,yt.A)(this,gr,void 0),(0,yt.A)(this,mr,void 0),(0,yt.A)(this,vr,void 0),(0,yt.A)(this,wr,void 0),(0,yt.A)(this,br,null),(0,yt.A)(this,yr,void 0),(0,yt.A)(this,_r,null),(0,yt.A)(this,xr,void 0),(0,yt.A)(this,Er,null),(0,Ht.A)(pr,this,e),(0,Ht.A)(fr,this,n),(0,Ht.A)(gr,this,i),(0,Ht.A)(mr,this,s),(0,Ht.A)(vr,this,r),(0,Ht.A)(wr,this,a),(0,Ht.A)(xr,this,new AbortController),(0,Ht.A)(yr,this,AbortSignal.any([o,(0,zt.A)(xr,this).signal])),e.addEventListener("touchstart",(0,_t.A)(Sr,this,Cr).bind(this),{passive:!1,signal:(0,zt.A)(yr,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/yi.pixelRatio}destroy(){var t,e;null===(t=(0,zt.A)(xr,this))||void 0===t||t.abort(),(0,Ht.A)(xr,this,null),null===(e=(0,zt.A)(br,this))||void 0===e||e.abort(),(0,Ht.A)(br,this,null)}}function Cr(t){var e,i;if(null!==(e=(0,zt.A)(gr,this))&&void 0!==e&&e.call(this))return;if(1===t.touches.length){if((0,zt.A)(br,this))return;const t=(0,Ht.A)(br,this,new AbortController),e=AbortSignal.any([(0,zt.A)(yr,this),t.signal]),i=(0,zt.A)(pr,this),n={capture:!0,signal:e,passive:!1},s=t=>{var e;"touch"===t.pointerType&&(null===(e=(0,zt.A)(br,this))||void 0===e||e.abort(),(0,Ht.A)(br,this,null))};return i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(Ai(t),s(t))},n),i.addEventListener("pointerup",s,n),void i.addEventListener("pointercancel",s,n)}if(!(0,zt.A)(Er,this)){var n;(0,Ht.A)(Er,this,new AbortController);const t=AbortSignal.any([(0,zt.A)(yr,this),(0,zt.A)(Er,this).signal]),e=(0,zt.A)(pr,this),i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",(0,_t.A)(Sr,this,Mr).bind(this),i);const s=(0,_t.A)(Sr,this,Tr).bind(this);e.addEventListener("touchend",s,i),e.addEventListener("touchcancel",s,i),i.capture=!0,e.addEventListener("pointerdown",Ai,i),e.addEventListener("pointermove",Ai,i),e.addEventListener("pointercancel",Ai,i),e.addEventListener("pointerup",Ai,i),null===(n=(0,zt.A)(mr,this))||void 0===n||n.call(this)}if(Ai(t),2!==t.touches.length||null!==(i=(0,zt.A)(fr,this))&&void 0!==i&&i.call(this))return void(0,Ht.A)(_r,this,null);let[s,r]=t.touches;s.identifier>r.identifier&&([s,r]=[r,s]),(0,Ht.A)(_r,this,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:r.screenX,touch1Y:r.screenY})}function Mr(t){var e;if(!(0,zt.A)(_r,this)||2!==t.touches.length)return;Ai(t);let[i,n]=t.touches;i.identifier>n.identifier&&([i,n]=[n,i]);const{screenX:s,screenY:r}=i,{screenX:a,screenY:o}=n,l=(0,zt.A)(_r,this),{touch0X:c,touch0Y:h,touch1X:d,touch1Y:u}=l,p=d-c,A=u-h,f=a-s,g=o-r,m=Math.hypot(f,g)||1,v=Math.hypot(p,A)||1;if(!(0,zt.A)(Ar,this)&&Math.abs(v-m)<=Ct.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=r,l.touch1X=a,l.touch1Y=o,!(0,zt.A)(Ar,this))return void(0,Ht.A)(Ar,this,!0);const w=[(s+a)/2,(r+o)/2];null===(e=(0,zt.A)(vr,this))||void 0===e||e.call(this,w,v,m)}function Tr(t){if(!(t.touches.length>=2)){var e;if((0,zt.A)(Er,this))(0,zt.A)(Er,this).abort(),(0,Ht.A)(Er,this,null),null===(e=(0,zt.A)(wr,this))||void 0===e||e.call(this);(0,zt.A)(_r,this)&&(Ai(t),(0,Ht.A)(_r,this,null),(0,Ht.A)(Ar,this,!1))}}Ct=kr;var Pr=new WeakMap,Dr=new WeakMap,Rr=new WeakMap,Lr=new WeakMap,Ir=new WeakMap,Fr=new WeakMap,Nr=new WeakMap,Or=new WeakMap,Br=new WeakMap,Wr=new WeakMap,jr=new WeakMap,Ur=new WeakMap,zr=new WeakMap,Hr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,qr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,$r=new WeakMap,ta=new WeakMap,ea=new WeakMap,ia=new WeakSet;class na{static get _resizerKeyboardManager(){const t=na.prototype._resizeWithKeyboard,e=fs.TRANSLATE_SMALL,i=fs.TRANSLATE_BIG;return Fe(this,"_resizerKeyboardManager",new gn([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],na.prototype._stopResizingWithKeyboard]]))}constructor(t){(0,bt.A)(this,ia),(0,yt.A)(this,Pr,null),(0,yt.A)(this,Dr,null),(0,yt.A)(this,Rr,null),(0,yt.A)(this,Lr,null),(0,yt.A)(this,Ir,null),(0,yt.A)(this,Fr,!1),(0,yt.A)(this,Nr,null),(0,yt.A)(this,Or,""),(0,yt.A)(this,Br,null),(0,yt.A)(this,Wr,null),(0,yt.A)(this,jr,null),(0,yt.A)(this,Ur,null),(0,yt.A)(this,zr,null),(0,yt.A)(this,Hr,""),(0,yt.A)(this,Vr,!1),(0,yt.A)(this,Gr,null),(0,yt.A)(this,qr,!1),(0,yt.A)(this,Xr,!1),(0,yt.A)(this,Yr,!1),(0,yt.A)(this,Kr,null),(0,yt.A)(this,Qr,0),(0,yt.A)(this,Jr,0),(0,yt.A)(this,Zr,null),(0,yt.A)(this,$r,null),(0,Vt.A)(this,"isSelected",!1),(0,Vt.A)(this,"_isCopy",!1),(0,Vt.A)(this,"_editToolbar",null),(0,Vt.A)(this,"_initialOptions",Object.create(null)),(0,Vt.A)(this,"_initialData",null),(0,Vt.A)(this,"_isVisible",!0),(0,Vt.A)(this,"_uiManager",null),(0,Vt.A)(this,"_focusEventsAllowed",!0),(0,yt.A)(this,ta,!1),(0,yt.A)(this,ea,na._zIndex++),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,r];const[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Fe(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new xa({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){var i;if(null!==(i=na._l10n)&&void 0!==i||(na._l10n=t),na._l10nResizer||(na._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==na._borderLineWidth)return;const n=getComputedStyle(document.documentElement);na._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){De("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,zt.A)(ta,this)}set _isDraggable(t){var e;(0,Ht.A)(ta,this,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,zt.A)(ea,this)}setParent(t){var e;null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):((0,_t.A)(ia,this,_a).call(this),null===(e=(0,zt.A)(Ur,this))||void 0===e||e.remove(),(0,Ht.A)(Ur,this,null));this.parent=t}focusin(t){this._focusEventsAllowed&&((0,zt.A)(Vr,this)?(0,Ht.A)(Vr,this,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/r,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),this._onTranslated()}translate(t,e){(0,_t.A)(ia,this,sa).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]),(0,_t.A)(ia,this,sa).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[n,s]}=this;if(this.x+=t/n,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:a}=this;const[o,l]=this.getBaseTranslation();r+=o,a+=l;const{style:c}=i;c.left="".concat((100*r).toFixed(2),"%"),c.top="".concat((100*a).toFixed(2),"%"),this._onTranslating(r,a),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!(0,zt.A)(Gr,this)&&((0,zt.A)(Gr,this)[0]!==this.x||(0,zt.A)(Gr,this)[1]!==this.y)}get _hasBeenResized(){return!!(0,zt.A)(Gr,this)&&((0,zt.A)(Gr,this)[2]!==this.width||(0,zt.A)(Gr,this)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=na,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const{div:{style:e},pageDimensions:[i,n]}=this;let{x:s,y:r,width:a,height:o}=this;if(a*=i,o*=n,s*=i,r*=n,this._mustFixPosition)switch(t){case 0:s=ti(s,0,i-a),r=ti(r,0,n-o);break;case 90:s=ti(s,0,i-o),r=ti(r,a,n);break;case 180:s=ti(s,a,i),r=ti(r,o,n);break;case 270:s=ti(s,o,i),r=ti(r,0,n-a)}this.x=s/=i,this.y=r/=n;const[l,c]=this.getBaseTranslation();s+=l,r+=c,e.left="".concat((100*s).toFixed(2),"%"),e.top="".concat((100*r).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return ra.call(na,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return ra.call(na,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width="".concat((100*e).toFixed(2),"%"),t.height="".concat((100*i).toFixed(2),"%")}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null===(t=(0,zt.A)(Rr,this))||void 0===t||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||(0,zt.A)(Xr,this))return this._editToolbar;this._editToolbar=new Wi(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.removeButton("comment")}removeEditToolbar(){var t,e;null===(t=this._editToolbar)||void 0===t||t.remove(),this._editToolbar=null,null===(e=(0,zt.A)(Rr,this))||void 0===e||e.destroy()}addContainer(t){var e;const i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return(0,zt.A)(Rr,this)||(Qs.initialize(na._l10n),(0,Ht.A)(Rr,this,new Qs(this)),(0,zt.A)(Pr,this)&&((0,zt.A)(Rr,this).data=(0,zt.A)(Pr,this),(0,Ht.A)(Pr,this,null))),(0,zt.A)(Rr,this)}get altTextData(){var t;return null===(t=(0,zt.A)(Rr,this))||void 0===t?void 0:t.data}set altTextData(t){(0,zt.A)(Rr,this)&&((0,zt.A)(Rr,this).data=t)}get guessedAltText(){var t;return null===(t=(0,zt.A)(Rr,this))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!(0,zt.A)(Rr,this)&&!(0,zt.A)(Rr,this).isEmpty()}hasAltTextData(){var t,e;return null!==(t=null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.hasData())&&void 0!==t&&t}focusCommentButton(){var t;null===(t=(0,zt.A)(Lr,this))||void 0===t||t.focusButton()}addCommentButton(){return(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this))}addStandaloneCommentButton(){(0,zt.A)(Ir,this)?this._uiManager.isEditingMode()&&(0,zt.A)(Ir,this).classList.remove("hidden"):this.hasComment&&((0,Ht.A)(Ir,this,(0,zt.A)(Lr,this).renderForStandalone()),this.div.append((0,zt.A)(Ir,this)))}removeStandaloneCommentButton(){(0,zt.A)(Lr,this).removeStandaloneCommentButton(),(0,Ht.A)(Ir,this,null)}hideStandaloneCommentButton(){var t;null===(t=(0,zt.A)(Ir,this))||void 0===t||t.classList.add("hidden")}get comment(){var t;const{data:{richText:e,text:i,date:n,deleted:s}}=(0,zt.A)(Lr,this);return{text:i,richText:e,date:n,deleted:s,color:this.getNonHCMColor(),opacity:null!==(t=this.opacity)&&void 0!==t?t:1}}set comment(t){(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData(t){let{comment:e,popupRef:i,richText:n}=t;if(!i)return;if((0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).setInitialText(e,n),!this.annotationElementId)return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var t;return null===(t=(0,zt.A)(Lr,this))||void 0===t?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return null===(t=(0,zt.A)(Lr,this))||void 0===t?void 0:t.isDeleted()}get hasComment(){return!!(0,zt.A)(Lr,this)&&!(0,zt.A)(Lr,this).isEmpty()&&!(0,zt.A)(Lr,this).isDeleted()}async editComment(t){(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).edit(t)}toggleComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){(0,zt.A)(Lr,this).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const e=180,i=100,[,,,n]=t.rect,[s]=this.pageDimensions,[r]=this.pageTranslation,a=r+s+1,o=n-i,l=a+e;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[a,o,l,n]}}}updateFromAnnotationLayer(t){let{popup:{contents:e,deleted:i}}=t;(0,zt.A)(Lr,this).data=i?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var t;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=(0,zt.A)(Fr,this)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),(0,_t.A)(ia,this,ma).call(this);const[i,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth="".concat((100*n/i).toFixed(2),"%"),e.style.maxHeight="".concat((100*i/n).toFixed(2),"%"));const[s,r]=this.getInitialTranslation();return this.translate(s,r),tn(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&((0,zt.A)($r,this)||(0,Ht.A)($r,this,new kr({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:(0,_t.A)(ia,this,ua).bind(this),onPinching:(0,_t.A)(ia,this,pa).bind(this),onPinchEnd:(0,_t.A)(ia,this,Aa).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),null===(t=this._uiManager._editorUndoBar)||void 0===t||t.hide(),e}pointerdown(t){const{isMac:e}=Ge.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():((0,Ht.A)(Vr,this,!0),this._isDraggable?(0,_t.A)(ia,this,ga).call(this,t):(0,_t.A)(ia,this,fa).call(this,t))}_onStartDragging(){}_onStopDragging(){}moveInDOM(){(0,zt.A)(Kr,this)&&clearTimeout((0,zt.A)(Kr,this)),(0,Ht.A)(Kr,this,setTimeout(()=>{var t;(0,Ht.A)(Kr,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const n=this.parentScale,[s,r]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/n,c=e/n,h=this.x*s,d=this.y*r,u=this.width*s,p=this.height*r;switch(i){case 0:return[h+l+a,r-d-c-p+o,h+l+u+a,r-d-c+o];case 90:return[h+c+a,r-d+l+o,h+c+p+a,r-d+l+u+o];case 180:return[h-l-u+a,r-d+c+o,h-l+a,r-d+c+p+o];case 270:return[h-c-p+a,r-d-l-u+o,h-c+a,r-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,s,r]=t,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,e-r,a,o];case 90:return[i,e-n,o,a];case 180:return[s,e-n,a,o];case 270:return[s,e-r,o,a];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&na._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;null===(t=(0,zt.A)(Lr,this))||void 0===t||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:n,deleted:s,richText:r},uid:a,pageIndex:o,creationDate:l,modificationDate:c}=this;return{id:a,pageIndex:o,rect:this.getPDFRect(),richText:r,contentsObj:{str:t},creationDate:l,modificationDate:i||c,popupRef:!s,color:e,opacity:n}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),(0,Ht.A)(Xr,this,!0),!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),(0,Ht.A)(Xr,this,!1),!0)}isInEditMode(){return(0,zt.A)(Xr,this)}shouldGetKeyboardEvents(){return(0,zt.A)(Yr,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:r}=window;return e<r&&n>0&&t<s&&i>0}rebuild(){(0,_t.A)(ia,this,ma).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){var t;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}static async deserialize(t,e,i){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});n.rotation=t.rotation,(0,Ht.A)(Pr,n,t.accessibilityData),n._isCopy=t.isCopy||!1;const[s,r]=n.pageDimensions,[a,o,l,c]=n.getRectInCurrentCoords(t.rect,r);return n.x=a/s,n.y=o/r,n.width=l/s,n.height=c/r,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t,e;if(null===(t=(0,zt.A)(zr,this))||void 0===t||t.abort(),(0,Ht.A)(zr,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,zt.A)(Kr,this)&&(clearTimeout((0,zt.A)(Kr,this)),(0,Ht.A)(Kr,this,null)),(0,_t.A)(ia,this,_a).call(this),this.removeEditToolbar(),(0,zt.A)(Zr,this)){for(const t of(0,zt.A)(Zr,this).values())clearTimeout(t);(0,Ht.A)(Zr,this,null)}this.parent=null,null===(e=(0,zt.A)($r,this))||void 0===e||e.destroy(),(0,Ht.A)($r,this,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,_t.A)(ia,this,oa).call(this),(0,zt.A)(Br,this).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[i,n,s,r]=this.getPDFRect();return[na._round(i+(s-i)*t),na._round(n+(r-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return(0,zt.A)(Lr,this).commentPopupPositionInLayer}set commentPopupPosition(t){(0,zt.A)(Lr,this).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return(0,zt.A)(Lr,this).hasDefaultPopupPosition()}get commentButtonWidth(){return(0,zt.A)(Lr,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){(0,zt.A)(Lr,this).setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=(0,zt.A)(Br,this).children;if(!(0,zt.A)(Dr,this)){(0,Ht.A)(Dr,this,Array.from(e));const t=(0,_t.A)(ia,this,va).bind(this),i=(0,_t.A)(ia,this,wa).bind(this),n=this._uiManager._signal;for(const e of(0,zt.A)(Dr,this)){const s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:n}),e.addEventListener("blur",i,{signal:n}),e.addEventListener("focus",(0,_t.A)(ia,this,ba).bind(this,s),{signal:n}),e.setAttribute("data-l10n-id",na._l10nResizer[s])}}const i=(0,zt.A)(Dr,this)[0];let n=0;for(const r of e){if(r===i)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*((0,zt.A)(Dr,this).length/4);if(s!==n){if(s<n)for(let e=0;e<n-s;e++)(0,zt.A)(Br,this).append((0,zt.A)(Br,this).firstChild);else if(s>n)for(let e=0;e<s-n;e++)(0,zt.A)(Br,this).firstChild.before((0,zt.A)(Br,this).lastChild);let t=0;for(const i of e){const e=(0,zt.A)(Dr,this)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",na._l10nResizer[e])}}(0,_t.A)(ia,this,ya).call(this,0),(0,Ht.A)(Yr,this,!0),(0,zt.A)(Br,this).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,zt.A)(Yr,this)&&(0,_t.A)(ia,this,da).call(this,(0,zt.A)(Hr,this),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){(0,_t.A)(ia,this,_a).call(this),this.div.focus()}select(){var t,e,i;this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),this._editToolbar?(null===(e=this._editToolbar)||void 0===e||e.show(),null===(i=(0,zt.A)(Rr,this))||void 0===i||i.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=this._editToolbar)||void 0===e||e.show())}))}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return null===(t=this.div)||void 0===t?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,i,n,s;this.isSelected&&(this.isSelected=!1,null===(t=(0,zt.A)(Br,this))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(n=this._editToolbar)||void 0===n||n.hide(),null===(s=(0,zt.A)(Rr,this))||void 0===s||s.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return(0,zt.A)(qr,this)}set isEditing(t){(0,Ht.A)(qr,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){(0,zt.A)(Zr,this)||(0,Ht.A)(Zr,this,new Map);const{action:e}=t;let i=(0,zt.A)(Zr,this).get(e);return i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),(0,zt.A)(Zr,this).delete(e),0===(0,zt.A)(Zr,this).size&&(0,Ht.A)(Zr,this,null)},na._telemetryTimeout),void(0,zt.A)(Zr,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,Ht.A)(Fr,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,Ht.A)(Fr,this,!0)}updateFakeAnnotationElement(t){if((0,zt.A)(Ur,this)||this.deleted)return this.deleted?((0,zt.A)(Ur,this).remove(),void(0,Ht.A)(Ur,this,null)):void((this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&(0,zt.A)(Ur,this).updateEdited({rect:this.getPDFRect(),popup:this.comment}));(0,Ht.A)(Ur,this,t.addFakeAnnotation(this))}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===(null===e||void 0===e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}}function sa(t,e,i){let[n,s]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/n,this.y+=i/s,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function ra(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function aa(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function oa(){if((0,zt.A)(Br,this))return;(0,Ht.A)(Br,this,document.createElement("div")),(0,zt.A)(Br,this).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");(0,zt.A)(Br,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,_t.A)(ia,this,la).bind(this,i),{signal:e}),t.addEventListener("contextmenu",pi,{signal:e}),t.tabIndex=-1}this.div.prepend((0,zt.A)(Br,this))}function la(t,e){var i;e.preventDefault();const{isMac:n}=Ge.platform;if(0!==e.button||e.ctrlKey&&n)return;null===(i=(0,zt.A)(Rr,this))||void 0===i||i.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,(0,Ht.A)(Wr,this,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,_t.A)(ia,this,da).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Ai,{passive:!1,signal:a}),window.addEventListener("contextmenu",pi,{signal:a}),(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const c=()=>{var t;r.abort(),this.parent.togglePointerEvents(!0),null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,(0,_t.A)(ia,this,ha).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})}function ca(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}function ha(){if(!(0,zt.A)(jr,this))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=(0,zt.A)(jr,this);(0,Ht.A)(jr,this,null);const s=this.x,r=this.y,a=this.width,o=this.height;s===t&&r===e&&a===i&&o===n||this.addCommands({cmd:(0,_t.A)(ia,this,ca).bind(this,s,r,a,o),undo:(0,_t.A)(ia,this,ca).bind(this,t,e,i,n),mustExec:!0})}function da(t,e){const[i,n]=this.parentDimensions,s=this.x,r=this.y,a=this.width,o=this.height,l=Mt.MIN_SIZE/i,c=Mt.MIN_SIZE/n,h=(0,_t.A)(ia,this,aa).call(this,this.rotation),d=(t,e)=>[h[0]*t+h[2]*e,h[1]*t+h[3]*e],u=(0,_t.A)(ia,this,aa).call(this,360-this.rotation);let p,A,f=!1,g=!1;switch(t){case"topLeft":f=!0,p=(t,e)=>[0,0],A=(t,e)=>[t,e];break;case"topMiddle":p=(t,e)=>[t/2,0],A=(t,e)=>[t/2,e];break;case"topRight":f=!0,p=(t,e)=>[t,0],A=(t,e)=>[0,e];break;case"middleRight":g=!0,p=(t,e)=>[t,e/2],A=(t,e)=>[0,e/2];break;case"bottomRight":f=!0,p=(t,e)=>[t,e],A=(t,e)=>[0,0];break;case"bottomMiddle":p=(t,e)=>[t/2,e],A=(t,e)=>[t/2,0];break;case"bottomLeft":f=!0,p=(t,e)=>[0,e],A=(t,e)=>[t,0];break;case"middleLeft":g=!0,p=(t,e)=>[0,e/2],A=(t,e)=>[t,e/2]}const m=p(a,o),v=A(a,o);let w=d(...v);const b=Mt._round(s+w[0]),y=Mt._round(r+w[1]);let _,x,E=1,S=1;if(e.fromKeyboard)({deltaX:_,deltaY:x}=e);else{const{screenX:t,screenY:i}=e,[n,s]=(0,zt.A)(Wr,this);[_,x]=this.screenToPageTranslation(t-n,i-s),(0,zt.A)(Wr,this)[0]=t,(0,zt.A)(Wr,this)[1]=i}var k,C;if([_,x]=(k=_/i,C=x/n,[u[0]*k+u[2]*C,u[1]*k+u[3]*C]),f){const t=Math.hypot(a,o);E=S=Math.max(Math.min(Math.hypot(v[0]-m[0]-_,v[1]-m[1]-x)/t,1/a,1/o),l/a,c/o)}else g?E=ti(Math.abs(v[0]-m[0]-_),l,1)/a:S=ti(Math.abs(v[1]-m[1]-x),c,1)/o;const M=Mt._round(a*E),T=Mt._round(o*S);w=d(...A(M,T));const P=b-w[0],D=y-w[1];(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]),this.width=M,this.height=T,this.x=P,this.y=D,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function ua(){var t;(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!1),this.parent.togglePointerEvents(!1)}function pa(t,e,i){let n=i/e*.7+1-.7;if(1===n)return;const s=(0,_t.A)(ia,this,aa).call(this,this.rotation),r=(t,e)=>[s[0]*t+s[2]*e,s[1]*t+s[3]*e],[a,o]=this.parentDimensions,l=this.x,c=this.y,h=this.width,d=this.height,u=Mt.MIN_SIZE/a,p=Mt.MIN_SIZE/o;n=Math.max(Math.min(n,1/h,1/d),u/h,p/d);const A=Mt._round(h*n),f=Mt._round(d*n);if(A===h&&f===d)return;(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[l,c,h,d]);const g=r(h/2,d/2),m=Mt._round(l+g[0]),v=Mt._round(c+g[1]),w=r(A/2,f/2);this.x=m-w[0],this.y=v-w[1],this.width=A,this.height=f,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function Aa(){var t;null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!0),this.parent.togglePointerEvents(!0),(0,_t.A)(ia,this,ha).call(this)}function fa(t){const{isMac:e}=Ge.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function ga(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const n=new AbortController,s=this._uiManager.combinedSignal(n),r={capture:!0,passive:!1,signal:s},a=t=>{n.abort(),(0,Ht.A)(Nr,this,null),(0,Ht.A)(Vr,this,!1),this._uiManager.endDragSession()||(0,_t.A)(ia,this,fa).call(this,t),i&&this._onStopDragging()};e&&((0,Ht.A)(Qr,this,t.clientX),(0,Ht.A)(Jr,this,t.clientY),(0,Ht.A)(Nr,this,t.pointerId),(0,Ht.A)(Or,this,t.pointerType),window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:e,clientY:n,pointerId:s}=t;if(s!==(0,zt.A)(Nr,this))return void Ai(t);const[r,a]=this.screenToPageTranslation(e-(0,zt.A)(Qr,this),n-(0,zt.A)(Jr,this));(0,Ht.A)(Qr,this,e),(0,Ht.A)(Jr,this,n),this._uiManager.dragSelectedEditors(r,a)},r),window.addEventListener("touchmove",Ai,r),window.addEventListener("pointerdown",t=>{t.pointerType===(0,zt.A)(Or,this)&&((0,zt.A)($r,this)||t.isPrimary)&&a(t),Ai(t)},r));const o=t=>{(0,zt.A)(Nr,this)&&(0,zt.A)(Nr,this)!==t.pointerId?Ai(t):a(t)};window.addEventListener("pointerup",o,{signal:s}),window.addEventListener("blur",o,{signal:s})}function ma(){if((0,zt.A)(zr,this)||!this.div)return;(0,Ht.A)(zr,this,new AbortController);const t=this._uiManager.combinedSignal((0,zt.A)(zr,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function va(t){Mt._resizerKeyboardManager.exec(this,t)}function wa(t){var e;(0,zt.A)(Yr,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,zt.A)(Br,this)&&(0,_t.A)(ia,this,_a).call(this)}function ba(t){(0,Ht.A)(Hr,this,(0,zt.A)(Yr,this)?t:"")}function ya(t){if((0,zt.A)(Dr,this))for(const e of(0,zt.A)(Dr,this))e.tabIndex=t}function _a(){(0,Ht.A)(Yr,this,!1),(0,_t.A)(ia,this,ya).call(this,-1),(0,_t.A)(ia,this,ha).call(this)}Mt=na,(0,Vt.A)(na,"_l10n",null),(0,Vt.A)(na,"_l10nResizer",null),(0,Vt.A)(na,"_borderLineWidth",-1),(0,Vt.A)(na,"_colorManager",new vn),(0,Vt.A)(na,"_zIndex",1),(0,Vt.A)(na,"_telemetryTimeout",1e3);class xa extends na{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Ea=3285377520,Sa=4294901760,ka=65535;class Ca{constructor(t){this.h1=t?4294967295&t:Ea,this.h2=t?4294967295&t:Ea}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,s=t.length;n<s;n++){const s=t.charCodeAt(n);s<=255?e[i++]=s:(e[i++]=s>>>8,e[i++]=255&s)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,s=i-4*n,r=new Uint32Array(e.buffer,0,n);let a=0,o=0,l=this.h1,c=this.h2;const h=3432918353,d=461845907,u=11601,p=13715;for(let A=0;A<n;A++)1&A?(a=r[A],a=a*h&Sa|a*u&ka,a=a<<15|a>>>17,a=a*d&Sa|a*p&ka,l^=a,l=l<<13|l>>>19,l=5*l+3864292196):(o=r[A],o=o*h&Sa|o*u&ka,o=o<<15|o>>>17,o=o*d&Sa|o*p&ka,c^=o,c=c<<13|c>>>19,c=5*c+3864292196);switch(a=0,s){case 3:a^=e[4*n+2]<<16;case 2:a^=e[4*n+1]<<8;case 1:a^=e[4*n],a=a*h&Sa|a*u&ka,a=a<<15|a>>>17,a=a*d&Sa|a*p&ka,1&n?l^=a:c^=a}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Sa|36045*t&ka,e=4283543511*e&Sa|(2950163797*(e<<16|t>>>16)&Sa)>>>16,t^=e>>>1,t=444984403*t&Sa|60499*t&ka,e=3301882366*e&Sa|(3120437893*(e<<16|t>>>16)&Sa)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Ma=Object.freeze({map:null,hash:"",transfer:void 0});var Ta=new WeakMap,Pa=new WeakMap,Da=new WeakMap,Ra=new WeakMap,La=new WeakSet;class Ia{constructor(){(0,bt.A)(this,La),(0,yt.A)(this,Ta,!1),(0,yt.A)(this,Pa,null),(0,yt.A)(this,Da,null),(0,yt.A)(this,Ra,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=(0,zt.A)(Ra,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,zt.A)(Ra,this).get(t)}remove(t){const e=(0,zt.A)(Ra,this).get(t);if(void 0!==e&&(e instanceof na&&(0,zt.A)(Da,this).delete(e.annotationElementId),(0,zt.A)(Ra,this).delete(t),0===(0,zt.A)(Ra,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor)){for(const t of(0,zt.A)(Ra,this).values())if(t instanceof na)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=(0,zt.A)(Ra,this).get(t);let n=!1;if(void 0!==i)for(const[s,r]of Object.entries(e))i[s]!==r&&(n=!0,i[s]=r);else n=!0,(0,zt.A)(Ra,this).set(t,e);n&&(0,_t.A)(La,this,Fa).call(this),e instanceof na&&(((0,zt.A)(Da,this)||(0,Ht.A)(Da,this,new Map)).set(e.annotationElementId,e),"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return(0,zt.A)(Ra,this).has(t)}get size(){return(0,zt.A)(Ra,this).size}resetModified(){(0,zt.A)(Ta,this)&&((0,Ht.A)(Ta,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new Oa(this)}get serializable(){if(0===(0,zt.A)(Ra,this).size)return Ma;const t=new Map,e=new Ca,i=[],n=Object.create(null);let s=!1;for(const[r,a]of(0,zt.A)(Ra,this)){const i=a instanceof na?a.serialize(!1,n):a;i&&(t.set(r,i),e.update("".concat(r,":").concat(JSON.stringify(i))),s||(s=!!i.bitmap))}if(s)for(const r of t.values())r.bitmap&&i.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Ma}get editorStats(){let t=null;const e=new Map;let i=0,n=0;for(const a of(0,zt.A)(Ra,this).values()){var s;if(!(a instanceof na)){a.popup&&(a.popup.deleted?n+=1:i+=1);continue}a.isCommentDeleted?n+=1:a.hasEditedComment&&(i+=1);const o=a.telemetryFinalData;if(!o)continue;const{type:l}=o;e.has(l)||e.set(l,Object.getPrototypeOf(a).constructor),t||(t=Object.create(null));const c=(s=t)[l]||(s[l]=new Map);for(const[t,e]of Object.entries(o)){var r;if("type"===t)continue;let i=c.get(t);i||(i=new Map,c.set(t,i));const n=null!==(r=i.get(e))&&void 0!==r?r:0;i.set(e,n+1)}}if((n>0||i>0)&&(t||(t=Object.create(null)),t.comments={deleted:n,edited:i}),!t)return null;for(const[a,o]of e)t[a]=o.computeTelemetryFinalData(t[a]);return t}resetModifiedIds(){(0,Ht.A)(Pa,this,null)}updateEditor(t,e){var i;const n=null===(i=(0,zt.A)(Da,this))||void 0===i?void 0:i.get(t);return!!n&&(n.updateFromAnnotationLayer(e),!0)}getEditor(t){var e;return(null===(e=(0,zt.A)(Da,this))||void 0===e?void 0:e.get(t))||null}get modifiedIds(){if((0,zt.A)(Pa,this))return(0,zt.A)(Pa,this);const t=[];if((0,zt.A)(Da,this))for(const e of(0,zt.A)(Da,this).values())e.serialize()&&t.push(e.annotationElementId);return(0,Ht.A)(Pa,this,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return(0,zt.A)(Ra,this).entries()}}function Fa(){(0,zt.A)(Ta,this)||((0,Ht.A)(Ta,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var Na=new WeakMap;class Oa extends Ia{constructor(t){super(),(0,yt.A)(this,Na,void 0);const{map:e,hash:i,transfer:n}=t.serializable,s=structuredClone(e,n?{transfer:n}:null);(0,Ht.A)(Na,this,{map:s,hash:i,transfer:n})}get print(){De("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,zt.A)(Na,this)}get modifiedIds(){return Fe(this,"modifiedIds",{ids:new Set,hash:""})}}var Ba=new WeakMap;class Wa{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;(0,yt.A)(this,Ba,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,zt.A)(Ba,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,disableFontFace:i,_inspectFont:n}=t;if(e&&!(0,zt.A)(Ba,this).has(e.loadedName)){if(Re(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:r}=e,a=new FontFace(t,i,r);this.addNativeFontFace(a);try{await a.load(),(0,zt.A)(Ba,this).add(t),null===n||void 0===n||n(e)}catch(s){Pe("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(a)}return}De("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw Pe("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return Fe(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){return Fe(this,"isSyncFontLoadingSupported",qt||Ge.platform.isFirefox)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Re(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Fe(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let s,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const o=a.getContext("2d");let l=0;const c="lt".concat(Date.now()).concat(this.loadTestFontId++);let h=this._loadTestFont;h=n(h,976,c.length,c);const d=1482184792;let u=i(h,16);for(s=0,r=c.length-3;s<r;s+=4)u=u-d+i(c,s)|0;var p;s<c.length&&(u=u-d+i(c+"XXX",s)|0),h=n(h,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const A="url(data:font/opentype;base64,".concat(btoa(h),");"),f='@font-face {font-family:"'.concat(c,'";src:').concat(A,"}");this.insertRule(f);const g=this._document.createElement("div");g.style.visibility="hidden",g.style.width=g.style.height="10px",g.style.position="absolute",g.style.top=g.style.left="0px";for(const m of[t.loadedName,c]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=m,g.append(t)}this._document.body.append(g),function t(e,i){if(++l>30)return Pe("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(c,()=>{g.remove(),e.complete()})}}var ja=new WeakMap;class Ua{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;(0,yt.A)(this,ja,void 0),this.compiledGlyphs=Object.create(null),(0,Ht.A)(ja,this,t),this._inspectFont=e,i&&Object.assign(this,i),n&&(this.charProcOperatorList=n)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e="url(data:".concat(this.mimetype,";base64,").concat(ei(this.data),");");let i;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),i='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(e,"}")}else i='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(e,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let n;try{n=t.get(i)}catch(r){Pe('getPathGenerator - ignoring character: "'.concat(r,'".'))}const s=new Path2D(n||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return(0,zt.A)(ja,this).black}get bold(){return(0,zt.A)(ja,this).bold}get disableFontFace(){var t;return null!==(t=(0,zt.A)(ja,this).disableFontFace)&&void 0!==t&&t}get fontExtraProperties(){var t;return null!==(t=(0,zt.A)(ja,this).fontExtraProperties)&&void 0!==t&&t}get isInvalidPDFjsFont(){return(0,zt.A)(ja,this).isInvalidPDFjsFont}get isType3Font(){return(0,zt.A)(ja,this).isType3Font}get italic(){return(0,zt.A)(ja,this).italic}get missingFile(){return(0,zt.A)(ja,this).missingFile}get remeasure(){return(0,zt.A)(ja,this).remeasure}get vertical(){return(0,zt.A)(ja,this).vertical}get ascent(){return(0,zt.A)(ja,this).ascent}get defaultWidth(){return(0,zt.A)(ja,this).defaultWidth}get descent(){return(0,zt.A)(ja,this).descent}get bbox(){return(0,zt.A)(ja,this).bbox}get fontMatrix(){return(0,zt.A)(ja,this).fontMatrix}get fallbackName(){return(0,zt.A)(ja,this).fallbackName}get loadedName(){return(0,zt.A)(ja,this).loadedName}get mimetype(){return(0,zt.A)(ja,this).mimetype}get name(){return(0,zt.A)(ja,this).name}get data(){return(0,zt.A)(ja,this).data}clearData(){(0,zt.A)(ja,this).clearData()}get cssFontInfo(){return(0,zt.A)(ja,this).cssFontInfo}get systemFontInfo(){return(0,zt.A)(ja,this).systemFontInfo}get defaultVMetrics(){return(0,zt.A)(ja,this).defaultVMetrics}}function za(t){if("string"!==typeof t)return null;if(t.endsWith("/"))return t;throw new Error('Invalid factory url: "'.concat(t,'" must include trailing slash.'))}const Ha=t=>"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0,Va=function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[n,s,...r]=i;if(!t(n)&&!Number.isInteger(n))return!1;if(!e(s))return!1;const a=r.length;let o=!0;switch(s.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;o=!1;break;default:return!1}for(const l of r)if(!("number"===typeof l||o&&null===l))return!1;return!0}.bind(null,Ha,t=>"object"===typeof t&&"string"===typeof(null===t||void 0===t?void 0:t.name));var Ga=new WeakMap,qa=new WeakMap;class Xa{constructor(){(0,yt.A)(this,Ga,new Map),(0,yt.A)(this,qa,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};(0,zt.A)(qa,this).then(()=>{for(const[t]of(0,zt.A)(Ga,this))t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=null;if((null===i||void 0===i?void 0:i.signal)instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void Pe("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",r),s.addEventListener("abort",r)}(0,zt.A)(Ga,this).set(e,n)}removeEventListener(t,e){const i=(0,zt.A)(Ga,this).get(e);null===i||void 0===i||i(),(0,zt.A)(Ga,this).delete(e)}terminate(){for(const[,t]of(0,zt.A)(Ga,this))null===t||void 0===t||t();(0,zt.A)(Ga,this).clear()}}const Ya=1,Ka=2,Qa=1,Ja=2,Za=3,$a=4,to=5,eo=6,io=7,no=8;function so(){}function ro(t){if(t instanceof ze||t instanceof We||t instanceof Oe||t instanceof je||t instanceof Be)return t;switch(t instanceof Error||"object"===typeof t&&null!==t||De('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ze(t.message);case"InvalidPDFException":return new We(t.message);case"PasswordException":return new Oe(t.message,t.code);case"ResponseException":return new je(t.message,t.status,t.missing);case"UnknownErrorException":return new Be(t.message,t.details)}return new Be(t.message,t.toString())}var ao=new WeakMap,oo=new WeakSet;class lo{constructor(t,e,i){(0,bt.A)(this,oo),(0,yt.A)(this,ao,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",(0,_t.A)(oo,this,co).bind(this),{signal:(0,zt.A)(ao,this).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(r){s.reject(r)}return s.promise}sendWithStream(t,e,i,n){const s=this.streamId++,r=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:r,targetName:a,action:t,streamId:s,data:e,desiredSize:i.desiredSize},n),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[s].pullCall=e,o.postMessage({sourceName:r,targetName:a,stream:eo,streamId:s,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Re(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[s].cancelCall=e,this.streamControllers[s].isClosed=!0,o.postMessage({sourceName:r,targetName:a,stream:Qa,streamId:s,reason:ro(t)}),e.promise}},i)}destroy(){var t;null===(t=(0,zt.A)(ao,this))||void 0===t||t.abort(),(0,Ht.A)(ao,this,null)}}function co(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void(0,_t.A)(oo,this,uo).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===Ya)i.resolve(e.data);else{if(e.callback!==Ka)throw new Error("Unexpected callback case");i.reject(ro(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,n=e.sourceName,s=this.comObj;return void Promise.try(i,e.data).then(function(i){s.postMessage({sourceName:t,targetName:n,callback:Ya,callbackId:e.callbackId,data:i})},function(i){s.postMessage({sourceName:t,targetName:n,callback:Ka,callbackId:e.callbackId,reason:ro(i)})})}e.streamId?(0,_t.A)(oo,this,ho).call(this,e):i(e.data)}function ho(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this,a=this.actionHandler[t.action],o={enqueue(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=r,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:$a,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Za,streamId:e}),delete r.streamSinks[e])},error(t){Re(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:to,streamId:e,reason:ro(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(a,t.data,o).then(function(){s.postMessage({sourceName:i,targetName:n,stream:no,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:no,streamId:e,reason:ro(t)})})}function uo(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case no:t.success?r.startCall.resolve():r.startCall.reject(ro(t.reason));break;case io:t.success?r.pullCall.resolve():r.pullCall.reject(ro(t.reason));break;case eo:if(!a){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,Promise.try(a.onPull||so).then(function(){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,reason:ro(t)})});break;case $a:if(Re(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Za:if(Re(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),(0,_t.A)(oo,this,po).call(this,r,e);break;case to:Re(r,"error should have stream controller"),r.controller.error(ro(t.reason)),(0,_t.A)(oo,this,po).call(this,r,e);break;case Ja:t.success?r.cancelCall.resolve():r.cancelCall.reject(ro(t.reason)),(0,_t.A)(oo,this,po).call(this,r,e);break;case Qa:if(!a)break;const o=ro(t.reason);Promise.try(a.onCancel||so,o).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ja,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:Ja,streamId:e,reason:ro(t)})}),a.sinkCapability.reject(o),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function po(t,e){var i,n,s;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(n=t.pullCall)||void 0===n?void 0:n.promise,null===(s=t.cancelCall)||void 0===s?void 0:s.promise]),delete this.streamControllers[e]}var Ao=new WeakMap;class fo{constructor(t){let{enableHWA:e=!1}=t;(0,yt.A)(this,Ao,!1),(0,Ht.A)(Ao,this,e)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,zt.A)(Ao,this)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){De("Abstract method `_createCanvas` called.")}}class go extends fo{constructor(t){let{ownerDocument:e=globalThis.document,enableHWA:i=!1}=t;super({enableHWA:i}),this._document=e}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class mo{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class vo extends mo{async _fetch(t){const e=await ai(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Ve(e)}}class wo{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(){}}var bo=new WeakMap,yo=new WeakMap,_o=new WeakMap,xo=new WeakMap,Eo=new WeakMap,So=new WeakMap,ko=new WeakMap,Co=new WeakSet;class Mo extends wo{constructor(t){let{docId:e,ownerDocument:i=globalThis.document}=t;super(),(0,bt.A)(this,Co),(0,yt.A)(this,bo,void 0),(0,yt.A)(this,yo,void 0),(0,yt.A)(this,_o,void 0),(0,yt.A)(this,xo,void 0),(0,yt.A)(this,Eo,void 0),(0,yt.A)(this,So,void 0),(0,yt.A)(this,ko,0),(0,Ht.A)(xo,this,e),(0,Ht.A)(Eo,this,i)}addFilter(t){var e,i;if(!t)return"none";let n=xt(Co,this,To).get(t);if(n)return n;const[s,r,a]=(0,_t.A)(Co,this,Ro).call(this,t),o=1===t.length?s:"".concat(s).concat(r).concat(a);if(n=xt(Co,this,To).get(o),n)return xt(Co,this,To).set(t,n),n;const l="g_".concat((0,zt.A)(xo,this),"_transfer_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),c=(0,_t.A)(Co,this,Lo).call(this,l);xt(Co,this,To).set(t,c),xt(Co,this,To).set(o,c);const h=(0,_t.A)(Co,this,No).call(this,l);return(0,_t.A)(Co,this,Bo).call(this,s,r,a,h),c}addHCMFilter(t,e){var i;const n="".concat(t,"-").concat(e),s="base";let r=xt(Co,this,Po).get(s);if((null===(i=r)||void 0===i?void 0:i.key)===n)return r.url;var a;r?(null===(a=r.filter)||void 0===a||a.remove(),r.key=n,r.url="none",r.filter=null):(r={key:n,url:"none",filter:null},xt(Co,this,Po).set(s,r));if(!t||!e)return r.url;const o=(0,_t.A)(Co,this,jo).call(this,t);t=Xe.makeHexColor(...o);const l=(0,_t.A)(Co,this,jo).call(this,e);if(e=Xe.makeHexColor(...l),xt(Co,this,Do).style.color="","#000000"===t&&"#ffffff"===e||t===e)return r.url;const c=new Array(256);for(let A=0;A<=255;A++){const t=A/255;c[A]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const h=c.join(","),d="g_".concat((0,zt.A)(xo,this),"_hcm_filter"),u=r.filter=(0,_t.A)(Co,this,No).call(this,d);(0,_t.A)(Co,this,Bo).call(this,h,h,h,u),(0,_t.A)(Co,this,Fo).call(this,u);const p=(t,e)=>{const i=o[t]/255,n=l[t]/255,s=new Array(e+1);for(let r=0;r<=e;r++)s[r]=i+r/e*(n-i);return s.join(",")};return(0,_t.A)(Co,this,Bo).call(this,p(0,5),p(1,5),p(2,5),u),r.url=(0,_t.A)(Co,this,Lo).call(this,d),r.url}addAlphaFilter(t){var e,i;let n=xt(Co,this,To).get(t);if(n)return n;const[s]=(0,_t.A)(Co,this,Ro).call(this,[t]),r="alpha_".concat(s);if(n=xt(Co,this,To).get(r),n)return xt(Co,this,To).set(t,n),n;const a="g_".concat((0,zt.A)(xo,this),"_alpha_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),o=(0,_t.A)(Co,this,Lo).call(this,a);xt(Co,this,To).set(t,o),xt(Co,this,To).set(r,o);const l=(0,_t.A)(Co,this,No).call(this,a);return(0,_t.A)(Co,this,Wo).call(this,s,l),o}addLuminosityFilter(t){var e,i;let n,s,r=xt(Co,this,To).get(t||"luminosity");if(r)return r;if(t?([n]=(0,_t.A)(Co,this,Ro).call(this,[t]),s="luminosity_".concat(n)):s="luminosity",r=xt(Co,this,To).get(s),r)return xt(Co,this,To).set(t,r),r;const a="g_".concat((0,zt.A)(xo,this),"_luminosity_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),o=(0,_t.A)(Co,this,Lo).call(this,a);xt(Co,this,To).set(t,o),xt(Co,this,To).set(s,o);const l=(0,_t.A)(Co,this,No).call(this,a);return(0,_t.A)(Co,this,Io).call(this,l),t&&(0,_t.A)(Co,this,Wo).call(this,n,l),o}addHighlightHCMFilter(t,e,i,n,s){var r;const a="".concat(e,"-").concat(i,"-").concat(n,"-").concat(s);let o=xt(Co,this,Po).get(t);if((null===(r=o)||void 0===r?void 0:r.key)===a)return o.url;var l;o?(null===(l=o.filter)||void 0===l||l.remove(),o.key=a,o.url="none",o.filter=null):(o={key:a,url:"none",filter:null},xt(Co,this,Po).set(t,o));if(!e||!i)return o.url;const[c,h]=[e,i].map((0,_t.A)(Co,this,jo).bind(this));let d=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[p,A]=[n,s].map((0,_t.A)(Co,this,jo).bind(this));u<d&&([d,u,p,A]=[u,d,A,p]),xt(Co,this,Do).style.color="";const f=(t,e,i)=>{const n=new Array(256),s=(u-d)/i,r=t/255,a=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(d+l*s),e=r+l*a;for(let i=o;i<=t;i++)n[i]=e;o=t+1}for(let l=o;l<256;l++)n[l]=n[o-1];return n.join(",")},g="g_".concat((0,zt.A)(xo,this),"_hcm_").concat(t,"_filter"),m=o.filter=(0,_t.A)(Co,this,No).call(this,g);return(0,_t.A)(Co,this,Fo).call(this,m),(0,_t.A)(Co,this,Bo).call(this,f(p[0],A[0],5),f(p[1],A[1],5),f(p[2],A[2],5),m),o.url=(0,_t.A)(Co,this,Lo).call(this,g),o.url}destroy(){var t,e,i,n;arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&null!==(t=(0,zt.A)(So,this))&&void 0!==t&&t.size||(null===(e=(0,zt.A)(_o,this))||void 0===e||e.parentNode.parentNode.remove(),(0,Ht.A)(_o,this,null),null===(i=(0,zt.A)(yo,this))||void 0===i||i.clear(),(0,Ht.A)(yo,this,null),null===(n=(0,zt.A)(So,this))||void 0===n||n.clear(),(0,Ht.A)(So,this,null),(0,Ht.A)(ko,this,0))}}function To(t){return(0,zt.A)(yo,t)||(0,Ht.A)(yo,t,new Map)}function Po(t){return(0,zt.A)(So,t)||(0,Ht.A)(So,t,new Map)}function Do(t){if(!(0,zt.A)(_o,t)){const e=(0,zt.A)(Eo,t).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const n=(0,zt.A)(Eo,t).createElementNS(si,"svg");n.setAttribute("width",0),n.setAttribute("height",0),(0,Ht.A)(_o,t,(0,zt.A)(Eo,t).createElementNS(si,"defs")),e.append(n),n.append((0,zt.A)(_o,t)),(0,zt.A)(Eo,t).body.append(e)}return(0,zt.A)(_o,t)}function Ro(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const n=i.join(",");return[n,n,n]}const[e,i,n]=t,s=new Array(256),r=new Array(256),a=new Array(256);for(let o=0;o<256;o++)s[o]=e[o]/255,r[o]=i[o]/255,a[o]=n[o]/255;return[s.join(","),r.join(","),a.join(",")]}function Lo(t){if(void 0===(0,zt.A)(bo,this)){(0,Ht.A)(bo,this,"");const t=(0,zt.A)(Eo,this).URL;t!==(0,zt.A)(Eo,this).baseURI&&(ci(t)?Pe('#createUrl: ignore "data:"-URL for performance reasons.'):(0,Ht.A)(bo,this,Ie(t,"")))}return"url(".concat((0,zt.A)(bo,this),"#").concat(t,")")}function Io(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function Fo(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}function No(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),xt(Co,this,Do).append(e),e}function Oo(t,e,i){const n=(0,zt.A)(Eo,this).createElementNS(si,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}function Bo(t,e,i,n){const s=(0,zt.A)(Eo,this).createElementNS(si,"feComponentTransfer");n.append(s),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncR",t),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncG",e),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncB",i)}function Wo(t,e){const i=(0,zt.A)(Eo,this).createElementNS(si,"feComponentTransfer");e.append(i),(0,_t.A)(Co,this,Oo).call(this,i,"feFuncA",t)}function jo(t){return xt(Co,this,Do).style.color=t,mi(getComputedStyle(xt(Co,this,Do)).getPropertyValue("color"))}class Uo{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load font data at: ".concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class zo extends Uo{async _fetch(t){const e=await ai(t,"arraybuffer");return new Uint8Array(e)}}class Ho{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load wasm data at: ".concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class Vo extends Ho{async _fetch(t){const e=await ai(t,"arraybuffer");return new Uint8Array(e)}}async function Go(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}qt&&Pe("Please use the `legacy` build in Node.js environments.");class qo extends wo{}class Xo extends fo{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///home/runner/work/components-core/components-core/node_modules/pdfjs-dist/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class Yo extends mo{async _fetch(t){return Go(t)}}class Ko extends Uo{async _fetch(t){return Go(t)}}class Qo extends Ho{async _fetch(t){return Go(t)}}const Jo="__forcedDependency",{floor:Zo,ceil:$o}=Math;function tl(t,e,i,n,s,r){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],n),t[4*e+2]=Math.max(t[4*e+2],s),t[4*e+3]=Math.max(t[4*e+3],r)}const el=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var il=new WeakMap,nl=new WeakMap;class sl{constructor(t,e){(0,yt.A)(this,il,void 0),(0,yt.A)(this,nl,void 0),(0,Ht.A)(il,this,t),(0,Ht.A)(nl,this,e)}get length(){return(0,zt.A)(il,this).length}isEmpty(t){return(0,zt.A)(il,this)[t]===el}minX(t){return(0,zt.A)(nl,this)[4*t+0]/256}minY(t){return(0,zt.A)(nl,this)[4*t+1]/256}maxX(t){return((0,zt.A)(nl,this)[4*t+2]+1)/256}maxY(t){return((0,zt.A)(nl,this)[4*t+3]+1)/256}}const rl=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};var al=new WeakMap,ol=new WeakMap,ll=new WeakMap,cl=new WeakMap,hl=new WeakMap,dl=new WeakMap,ul=new WeakMap,pl=new WeakMap,Al=new WeakMap,fl=new WeakMap,gl=new WeakMap,ml=new WeakMap,vl=new WeakMap,wl=new WeakMap,bl=new WeakMap,yl=new WeakMap,_l=new WeakMap,xl=new WeakSet;class El{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,bt.A)(this,xl),(0,yt.A)(this,al,{__proto__:null}),(0,yt.A)(this,ol,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Jo]:[]}),(0,yt.A)(this,ll,new Map),(0,yt.A)(this,cl,[]),(0,yt.A)(this,hl,[]),(0,yt.A)(this,dl,[[1,0,0,1,0,0]]),(0,yt.A)(this,ul,[-1/0,-1/0,1/0,1/0]),(0,yt.A)(this,pl,new Float64Array([1/0,1/0,-1/0,-1/0])),(0,yt.A)(this,Al,-1),(0,yt.A)(this,fl,new Set),(0,yt.A)(this,gl,new Map),(0,yt.A)(this,ml,new Map),(0,yt.A)(this,vl,void 0),(0,yt.A)(this,wl,void 0),(0,yt.A)(this,bl,void 0),(0,yt.A)(this,yl,void 0),(0,yt.A)(this,_l,void 0),(0,Ht.A)(vl,this,t.width),(0,Ht.A)(wl,this,t.height),(0,_t.A)(xl,this,Sl).call(this,e),i&&(0,Ht.A)(_l,this,new Map)}growOperationsCount(t){t>=(0,zt.A)(yl,this).length&&(0,_t.A)(xl,this,Sl).call(this,t,(0,zt.A)(yl,this))}save(t){return(0,Ht.A)(al,this,{__proto__:(0,zt.A)(al,this)}),(0,Ht.A)(ol,this,{__proto__:(0,zt.A)(ol,this),transform:{__proto__:(0,zt.A)(ol,this).transform},moveText:{__proto__:(0,zt.A)(ol,this).moveText},sameLineText:{__proto__:(0,zt.A)(ol,this).sameLineText},[Jo]:{__proto__:(0,zt.A)(ol,this)[Jo]}}),(0,Ht.A)(ul,this,{__proto__:(0,zt.A)(ul,this)}),(0,zt.A)(cl,this).push(t),this}restore(t){const e=Object.getPrototypeOf((0,zt.A)(al,this));if(null===e)return this;(0,Ht.A)(al,this,e),(0,Ht.A)(ol,this,Object.getPrototypeOf((0,zt.A)(ol,this))),(0,Ht.A)(ul,this,Object.getPrototypeOf((0,zt.A)(ul,this)));const i=(0,zt.A)(cl,this).pop();var n;void 0!==i&&(null===(n=rl((0,zt.A)(_l,this),t))||void 0===n||n.dependencies.add(i),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[i]);return this}recordOpenMarker(t){return(0,zt.A)(cl,this).push(t),this}getOpenMarker(){return 0===(0,zt.A)(cl,this).length?null:(0,zt.A)(cl,this).at(-1)}recordCloseMarker(t){const e=(0,zt.A)(cl,this).pop();var i;void 0!==e&&(null===(i=rl((0,zt.A)(_l,this),t))||void 0===i||i.dependencies.add(e),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[e]);return this}beginMarkedContent(t){return(0,zt.A)(hl,this).push(t),this}endMarkedContent(t){const e=(0,zt.A)(hl,this).pop();var i;void 0!==e&&(null===(i=rl((0,zt.A)(_l,this),t))||void 0===i||i.dependencies.add(e),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[e]);return this}pushBaseTransform(t){return(0,zt.A)(dl,this).push(Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),t.getTransform())),this}popBaseTransform(){return(0,zt.A)(dl,this).length>1&&(0,zt.A)(dl,this).pop(),this}recordSimpleData(t,e){return(0,zt.A)(al,this)[t]=e,this}recordIncrementalData(t,e){return(0,zt.A)(ol,this)[t].push(e),this}resetIncrementalData(t,e){return(0,zt.A)(ol,this)[t].length=0,this}recordNamedData(t,e){return(0,zt.A)(ll,this).set(t,e),this}recordSimpleDataFromNamed(t,e,i){var n;(0,zt.A)(al,this)[t]=null!==(n=(0,zt.A)(ll,this).get(e))&&void 0!==n?n:i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Jo,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in(0,zt.A)(al,this)&&this.recordFutureForcedDependency(e,(0,zt.A)(al,this)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of(0,zt.A)(fl,this))this.recordFutureForcedDependency(Jo,t);return this}resetBBox(t){return(0,zt.A)(Al,this)!==t&&((0,Ht.A)(Al,this,t),(0,zt.A)(pl,this)[0]=1/0,(0,zt.A)(pl,this)[1]=1/0,(0,zt.A)(pl,this)[2]=-1/0,(0,zt.A)(pl,this)[3]=-1/0),this}recordClipBox(t,e,i,n,s,r){const a=Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),e.getTransform()),o=[1/0,1/0,-1/0,-1/0];Xe.axialAlignedBoundingBox([i,s,n,r],a,o);const l=Xe.intersect((0,zt.A)(ul,this),o);return l?((0,zt.A)(ul,this)[0]=l[0],(0,zt.A)(ul,this)[1]=l[1],(0,zt.A)(ul,this)[2]=l[2],(0,zt.A)(ul,this)[3]=l[3]):((0,zt.A)(ul,this)[0]=(0,zt.A)(ul,this)[1]=1/0,(0,zt.A)(ul,this)[2]=(0,zt.A)(ul,this)[3]=-1/0),this}recordBBox(t,e,i,n,s,r){const a=(0,zt.A)(ul,this);if(a[0]===1/0)return this;const o=Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),e.getTransform());if(a[0]===-1/0)return Xe.axialAlignedBoundingBox([i,s,n,r],o,(0,zt.A)(pl,this)),this;const l=[1/0,1/0,-1/0,-1/0];return Xe.axialAlignedBoundingBox([i,s,n,r],o,l),(0,zt.A)(pl,this)[0]=Math.min((0,zt.A)(pl,this)[0],Math.max(l[0],a[0])),(0,zt.A)(pl,this)[1]=Math.min((0,zt.A)(pl,this)[1],Math.max(l[1],a[1])),(0,zt.A)(pl,this)[2]=Math.max((0,zt.A)(pl,this)[2],Math.min(l[2],a[2])),(0,zt.A)(pl,this)[3]=Math.max((0,zt.A)(pl,this)[3],Math.min(l[3],a[3])),this}recordCharacterBBox(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6?arguments[6]:void 0;const o=i.bbox;let l,c;if(o&&(l=o[2]!==o[0]&&o[3]!==o[1]&&(0,zt.A)(ml,this).get(i),!1!==l&&(c=[0,0,0,0],Xe.axialAlignedBoundingBox(o,i.fontMatrix,c),1===n&&0===s&&0===r||Xe.scaleMinMax([n,0,0,-n,s,r],c),l)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!a)return this.recordFullPageBBox(t);const h=a();return o&&c&&void 0===l&&(l=c[0]<=s-h.actualBoundingBoxLeft&&c[2]>=s+h.actualBoundingBoxRight&&c[1]<=r-h.actualBoundingBoxAscent&&c[3]>=r+h.actualBoundingBoxDescent,(0,zt.A)(ml,this).set(i,l),l)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,s-h.actualBoundingBoxLeft,s+h.actualBoundingBoxRight,r-h.actualBoundingBoxAscent,r+h.actualBoundingBoxDescent)}recordFullPageBBox(t){return(0,zt.A)(pl,this)[0]=Math.max(0,(0,zt.A)(ul,this)[0]),(0,zt.A)(pl,this)[1]=Math.max(0,(0,zt.A)(ul,this)[1]),(0,zt.A)(pl,this)[2]=Math.min((0,zt.A)(vl,this),(0,zt.A)(ul,this)[2]),(0,zt.A)(pl,this)[3]=Math.min((0,zt.A)(wl,this),(0,zt.A)(ul,this)[3]),this}getSimpleIndex(t){return(0,zt.A)(al,this)[t]}recordDependencies(t,e){const i=(0,zt.A)(fl,this),n=(0,zt.A)(al,this),s=(0,zt.A)(ol,this);for(const r of e)r in(0,zt.A)(al,this)?i.add(n[r]):r in s&&s[r].forEach(i.add,i);return this}recordNamedDependency(t,e){return(0,zt.A)(ll,this).has(e)&&(0,zt.A)(fl,this).add((0,zt.A)(ll,this).get(e)),this}recordOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.recordDependencies(t,[Jo]),(0,zt.A)(_l,this)){const e=rl((0,zt.A)(_l,this),t),{dependencies:i}=e;(0,zt.A)(fl,this).forEach(i.add,i),(0,zt.A)(cl,this).forEach(i.add,i),(0,zt.A)(hl,this).forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if((0,zt.A)(Al,this)===t){const i=Zo(256*(0,zt.A)(pl,this)[0]/(0,zt.A)(vl,this)),n=Zo(256*(0,zt.A)(pl,this)[1]/(0,zt.A)(wl,this)),s=$o(256*(0,zt.A)(pl,this)[2]/(0,zt.A)(vl,this)),r=$o(256*(0,zt.A)(pl,this)[3]/(0,zt.A)(wl,this));tl((0,zt.A)(bl,this),t,i,n,s,r);for(const e of(0,zt.A)(fl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);for(const e of(0,zt.A)(cl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);for(const e of(0,zt.A)(hl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);e||((0,zt.A)(fl,this).clear(),(0,Ht.A)(Al,this,-1))}return this}recordShowTextOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Array.from((0,zt.A)(fl,this));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const n of i)this.recordIncrementalData("sameLineText",n);return this}bboxToClipBoxDropOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,zt.A)(Al,this)===t&&((0,Ht.A)(Al,this,-1),(0,zt.A)(ul,this)[0]=Math.max((0,zt.A)(ul,this)[0],(0,zt.A)(pl,this)[0]),(0,zt.A)(ul,this)[1]=Math.max((0,zt.A)(ul,this)[1],(0,zt.A)(pl,this)[1]),(0,zt.A)(ul,this)[2]=Math.min((0,zt.A)(ul,this)[2],(0,zt.A)(pl,this)[2]),(0,zt.A)(ul,this)[3]=Math.min((0,zt.A)(ul,this)[3],(0,zt.A)(pl,this)[3]),e||(0,zt.A)(fl,this).clear()),this}_takePendingDependencies(){const t=(0,zt.A)(fl,this);return(0,Ht.A)(fl,this,new Set),t}_extractOperation(t){const e=(0,zt.A)(gl,this).get(t);return(0,zt.A)(gl,this).delete(t),e}_pushPendingDependencies(t){for(const e of t)(0,zt.A)(fl,this).add(e)}take(){return(0,zt.A)(ml,this).clear(),new sl((0,zt.A)(yl,this),(0,zt.A)(bl,this))}takeDebugMetadata(){return(0,zt.A)(_l,this)}}function Sl(t,e){const i=new ArrayBuffer(4*t);(0,Ht.A)(bl,this,new Uint8ClampedArray(i)),(0,Ht.A)(yl,this,new Uint32Array(i)),e&&e.length>0?((0,zt.A)(yl,this).set(e),(0,zt.A)(yl,this).fill(el,e.length)):(0,zt.A)(yl,this).fill(el)}var kl=new WeakMap,Cl=new WeakMap,Ml=new WeakMap,Tl=new WeakMap,Pl=new WeakMap;class Dl{constructor(t,e,i){if((0,yt.A)(this,kl,void 0),(0,yt.A)(this,Cl,void 0),(0,yt.A)(this,Ml,void 0),(0,yt.A)(this,Tl,0),(0,yt.A)(this,Pl,0),t instanceof Dl&&(0,zt.A)(Ml,t)===!!i)return t;(0,Ht.A)(kl,this,t),(0,Ht.A)(Cl,this,e),(0,Ht.A)(Ml,this,!!i)}growOperationsCount(){throw new Error("Unreachable")}save(t){var e;return(0,Ht.A)(Pl,this,(e=(0,zt.A)(Pl,this),e++,e)),(0,zt.A)(kl,this).save((0,zt.A)(Cl,this)),this}restore(t){var e;(0,zt.A)(Pl,this)>0&&((0,zt.A)(kl,this).restore((0,zt.A)(Cl,this)),(0,Ht.A)(Pl,this,(e=(0,zt.A)(Pl,this),e--,e)));return this}recordOpenMarker(t){var e;return(0,Ht.A)(Tl,this,(e=(0,zt.A)(Tl,this),e++,e)),this}getOpenMarker(){return(0,zt.A)(Tl,this)>0?(0,zt.A)(Cl,this):(0,zt.A)(kl,this).getOpenMarker()}recordCloseMarker(t){var e;return(0,Ht.A)(Tl,this,(e=(0,zt.A)(Tl,this),e--,e)),this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return(0,zt.A)(kl,this).pushBaseTransform(t),this}popBaseTransform(){return(0,zt.A)(kl,this).popBaseTransform(),this}recordSimpleData(t,e){return(0,zt.A)(kl,this).recordSimpleData(t,(0,zt.A)(Cl,this)),this}recordIncrementalData(t,e){return(0,zt.A)(kl,this).recordIncrementalData(t,(0,zt.A)(Cl,this)),this}resetIncrementalData(t,e){return(0,zt.A)(kl,this).resetIncrementalData(t,(0,zt.A)(Cl,this)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return(0,zt.A)(kl,this).recordSimpleDataFromNamed(t,e,(0,zt.A)(Cl,this)),this}recordFutureForcedDependency(t,e){return(0,zt.A)(kl,this).recordFutureForcedDependency(t,(0,zt.A)(Cl,this)),this}inheritSimpleDataAsFutureForcedDependencies(t){return(0,zt.A)(kl,this).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return(0,zt.A)(kl,this).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).resetBBox((0,zt.A)(Cl,this)),this}recordClipBox(t,e,i,n,s,r){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordClipBox((0,zt.A)(Cl,this),e,i,n,s,r),this}recordBBox(t,e,i,n,s,r){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordBBox((0,zt.A)(Cl,this),e,i,n,s,r),this}recordCharacterBBox(t,e,i,n,s,r,a){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordCharacterBBox((0,zt.A)(Cl,this),e,i,n,s,r,a),this}recordFullPageBBox(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordFullPageBBox((0,zt.A)(Cl,this)),this}getSimpleIndex(t){return(0,zt.A)(kl,this).getSimpleIndex(t)}recordDependencies(t,e){return(0,zt.A)(kl,this).recordDependencies((0,zt.A)(Cl,this),e),this}recordNamedDependency(t,e){return(0,zt.A)(kl,this).recordNamedDependency((0,zt.A)(Cl,this),e),this}recordOperation(t){return(0,zt.A)(kl,this).recordOperation((0,zt.A)(Cl,this),!0),this}recordShowTextOperation(t){return(0,zt.A)(kl,this).recordShowTextOperation((0,zt.A)(Cl,this),!0),this}bboxToClipBoxDropOperation(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).bboxToClipBoxDropOperation((0,zt.A)(Cl,this),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const Rl=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],Ll=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],Il=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],Fl=["filter","fillColor","fillAlpha"],Nl=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],Ol=["transform"],Bl=["transform","fillColor"],Wl="Fill",jl="Stroke",Ul="Shading";function zl(t,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],i,n),t.clip(s)}class Hl{isModifyingCurrentTransform(){return!1}getPattern(){De("Abstract method `getPattern` called.")}}class Vl extends Hl{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,n){let s;if(n===jl||n===Wl){const r=e.current.getClippedPathBoundingBox(n,vi(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,o=Math.ceil(r[3]-r[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,o),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),i=Xe.transform(i,[1,0,0,1,r[0],r[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),zl(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(l.canvas,"no-repeat");const h=new DOMMatrix(i);s.setTransform(h)}else zl(t,this._bbox),s=this._createGradient(t);return s}}function Gl(t,e,i,n,s,r,a,o){const l=e.coords,c=e.colors,h=t.data,d=4*t.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u);const p=(l[i]+e.offsetX)*e.scaleX,A=(l[i+1]+e.offsetY)*e.scaleY,f=(l[n]+e.offsetX)*e.scaleX,g=(l[n+1]+e.offsetY)*e.scaleY,m=(l[s]+e.offsetX)*e.scaleX,v=(l[s+1]+e.offsetY)*e.scaleY;if(A>=v)return;const w=c[r],b=c[r+1],y=c[r+2],_=c[a],x=c[a+1],E=c[a+2],S=c[o],k=c[o+1],C=c[o+2],M=Math.round(A),T=Math.round(v);let P,D,R,L,I,F,N,O;for(let B=M;B<=T;B++){if(B<g){const t=B<A?0:(A-B)/(A-g);P=p-(p-f)*t,D=w-(w-_)*t,R=b-(b-x)*t,L=y-(y-E)*t}else{let t;t=B>v?1:g===v?0:(g-B)/(g-v),P=f-(f-m)*t,D=_-(_-S)*t,R=x-(x-k)*t,L=E-(E-C)*t}let t;t=B<A?0:B>v?1:(A-B)/(A-v),I=p-(p-m)*t,F=w-(w-S)*t,N=b-(b-k)*t,O=y-(y-C)*t;const e=Math.round(Math.min(P,I)),i=Math.round(Math.max(P,I));let n=d*B+4*e;for(let s=e;s<=i;s++)t=(P-s)/(P-I),t<0?t=0:t>1&&(t=1),h[n++]=D-(D-F)*t|0,h[n++]=R-(R-N)*t|0,h[n++]=L-(L-O)*t|0,h[n++]=255}}function ql(t,e,i){const n=e.coords,s=e.colors;let r,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(r=0;r<l;r++){let e=r*o;for(let r=0;r<c;r++,e++)Gl(t,i,n[e],n[e+1],n[e+o],s[e],s[e+1],s[e+o]),Gl(t,i,n[e+o+1],n[e+1],n[e+o],s[e+o+1],s[e+1],s[e+o])}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)Gl(t,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class Xl extends Hl{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),c=r/o,h=a/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/c,scaleY:1/h},u=o+4,p=l+4,A=i.getCanvas("mesh",u,p),f=A.context,g=f.createImageData(o,l);if(e){const t=g.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const m of this._figures)ql(g,m,d);f.putImageData(g,2,2);return{canvas:A.canvas,offsetX:n-2*c,offsetY:s-2*h,scaleX:c,scaleY:h}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,n){zl(t,this._bbox);const s=new Float32Array(2);if(n===Ul)Xe.singularValueDecompose2dScale(vi(t),s);else if(this.matrix){Xe.singularValueDecompose2dScale(this.matrix,s);const[t,i]=s;Xe.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=t,s[1]*=i}else Xe.singularValueDecompose2dScale(e.baseTransform,s);const r=this._createMeshCanvas(s,n===Ul?null:this._background,e.cachedCanvases);return n!==Ul&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class Yl extends Hl{getPattern(){return"hotpink"}}const Kl=1,Ql=2;class Jl{constructor(t,e,i,n){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t,e){var i,n;const{bbox:s,operatorList:r,paintType:a,tilingType:o,color:l,canvasGraphicsFactory:c}=this;let{xstep:h,ystep:d}=this;h=Math.abs(h),d=Math.abs(d),Te("TilingType: "+o);const u=s[0],p=s[1],A=s[2],f=s[3],g=A-u,m=f-p,v=new Float32Array(2);Xe.singularValueDecompose2dScale(this.matrix,v);const[w,b]=v;Xe.singularValueDecompose2dScale(this.baseTransform,v);const y=w*v[0],_=b*v[1];let x=g,E=m,S=!1,k=!1;const C=Math.ceil(h*y),M=Math.ceil(d*_);C>=Math.ceil(g*y)?x=h:S=!0,M>=Math.ceil(m*_)?E=d:k=!0;const T=this.getSizeAndScale(x,this.ctx.canvas.width,y),P=this.getSizeAndScale(E,this.ctx.canvas.height,_),D=t.cachedCanvases.getCanvas("pattern",T.size,P.size),R=D.context,L=c.createCanvasGraphics(R,e);if(L.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(L,a,l),R.translate(-T.scale*u,-P.scale*p),L.transform(0,T.scale,0,0,P.scale,0,0),R.save(),null===(i=L.dependencyTracker)||void 0===i||i.save(),this.clipBbox(L,u,p,A,f),L.baseTransform=vi(L.ctx),L.executeOperatorList(r),L.endDrawing(),null===(n=L.dependencyTracker)||void 0===n||n.restore(),R.restore(),S||k){const e=D.canvas;S&&(x=h),k&&(E=d);const i=this.getSizeAndScale(x,this.ctx.canvas.width,y),n=this.getSizeAndScale(E,this.ctx.canvas.height,_),s=i.size,r=n.size,a=t.cachedCanvases.getCanvas("pattern-workaround",s,r),o=a.context,l=S?Math.floor(g/h):0,c=k?Math.floor(m/d):0;for(let t=0;t<=l;t++)for(let i=0;i<=c;i++)o.drawImage(e,s*t,r*i,s,r,0,0,s,r);return{canvas:a.canvas,scaleX:i.scale,scaleY:n.scale,offsetX:u,offsetY:p}}return{canvas:D.canvas,scaleX:T.scale,scaleY:P.scale,offsetX:u,offsetY:p}}getSizeAndScale(t,e,i){const n=Math.max(Jl.MAX_PATTERN_SIZE,e);let s=Math.ceil(t*i);return s>=n?s=n:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,n,s){const r=n-e,a=s-i;t.ctx.rect(e,i,r,a),Xe.axialAlignedBoundingBox([e,i,n,s],vi(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,s=t.current;switch(e){case Kl:const{fillStyle:t,strokeStyle:r}=this.ctx;n.fillStyle=s.fillColor=t,n.strokeStyle=s.strokeColor=r;break;case Ql:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new Ue("Unsupported paint type: ".concat(e))}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let r=i;n!==Ul&&(r=Xe.transform(r,e.baseTransform),this.matrix&&(r=Xe.transform(r,this.matrix)));const a=this.createPatternCanvas(e,s);let o=new DOMMatrix(r);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}}function Zl(t){let{src:e,srcPos:i=0,dest:n,width:s,height:r,nonBlackColor:a=4294967295,inverseDecode:o=!1}=t;const l=Ge.isLittleEndian?4278190080:255,[c,h]=o?[a,l]:[l,a],d=s>>3,u=7&s,p=e.length;n=new Uint32Array(n.buffer);let A=0;for(let f=0;f<r;f++){for(const s=i+d;i<s;i++){const t=i<p?e[i]:255;n[A++]=128&t?h:c,n[A++]=64&t?h:c,n[A++]=32&t?h:c,n[A++]=16&t?h:c,n[A++]=8&t?h:c,n[A++]=4&t?h:c,n[A++]=2&t?h:c,n[A++]=1&t?h:c}if(0===u)continue;const t=i<p?e[i++]:255;for(let e=0;e<u;e++)n[A++]=t&1<<7-e?h:c}return{srcPos:i,destPos:A}}(0,Vt.A)(Jl,"MAX_PATTERN_SIZE",3e3);const $l=16,tc=new DOMMatrix,ec=new Float32Array(2),ic=new Float32Array([1/0,1/0,-1/0,-1/0]);class nc{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function sc(t,e,i,n,s,r,a,o,l,c){const[h,d,u,p,A,f]=vi(t);if(0===d&&0===u){const g=a*h+A,m=Math.round(g),v=o*p+f,w=Math.round(v),b=(a+l)*h+A,y=Math.abs(Math.round(b)-m)||1,_=(o+c)*p+f,x=Math.abs(Math.round(_)-w)||1;return t.setTransform(Math.sign(h),0,0,Math.sign(p),m,w),t.drawImage(e,i,n,s,r,0,0,y,x),t.setTransform(h,d,u,p,A,f),[y,x]}if(0===h&&0===p){const g=o*u+A,m=Math.round(g),v=a*d+f,w=Math.round(v),b=(o+c)*u+A,y=Math.abs(Math.round(b)-m)||1,_=(a+l)*d+f,x=Math.abs(Math.round(_)-w)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,m,w),t.drawImage(e,i,n,s,r,0,0,x,y),t.setTransform(h,d,u,p,A,f),[x,y]}t.drawImage(e,i,n,s,r,a,o,l,c);return[Math.hypot(h,d)*l,Math.hypot(u,p)*c]}class rc{constructor(t,e,i){(0,Vt.A)(this,"alphaIsShape",!1),(0,Vt.A)(this,"fontSize",0),(0,Vt.A)(this,"fontSizeScale",1),(0,Vt.A)(this,"textMatrix",null),(0,Vt.A)(this,"textMatrixScale",1),(0,Vt.A)(this,"fontMatrix",Xt),(0,Vt.A)(this,"leading",0),(0,Vt.A)(this,"x",0),(0,Vt.A)(this,"y",0),(0,Vt.A)(this,"lineX",0),(0,Vt.A)(this,"lineY",0),(0,Vt.A)(this,"charSpacing",0),(0,Vt.A)(this,"wordSpacing",0),(0,Vt.A)(this,"textHScale",1),(0,Vt.A)(this,"textRenderingMode",oe),(0,Vt.A)(this,"textRise",0),(0,Vt.A)(this,"fillColor","#000000"),(0,Vt.A)(this,"strokeColor","#000000"),(0,Vt.A)(this,"patternFill",!1),(0,Vt.A)(this,"patternStroke",!1),(0,Vt.A)(this,"fillAlpha",1),(0,Vt.A)(this,"strokeAlpha",1),(0,Vt.A)(this,"lineWidth",1),(0,Vt.A)(this,"activeSMask",null),(0,Vt.A)(this,"transferMaps","none"),null===i||void 0===i||i(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=ic.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.minMax.slice();if(t===jl){e||De("Stroke bounding box must include transform."),Xe.singularValueDecompose2dScale(e,ec);const t=ec[0]*this.lineWidth/2,n=ec[1]*this.lineWidth/2;i[0]-=t,i[1]-=n,i[2]+=t,i[3]+=n}return i}updateClipFromPath(){const t=Xe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(ic,0)}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Xe.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function ac(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,s=i%$l,r=(i-s)/$l,a=0===s?r:r+1,o=t.createImageData(n,$l);let l,c=0;const h=e.data,d=o.data;let u,p,A,f;if(e.kind===pe.GRAYSCALE_1BPP){const e=h.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),f=i.length,g=n+7>>3,m=4294967295,v=Ge.isLittleEndian?4278190080:255;for(u=0;u<a;u++){for(A=u<r?$l:s,l=0,p=0;p<A;p++){const t=e-c;let s=0;const r=t>g?n:8*t-7,a=-8&r;let o=0,d=0;for(;s<a;s+=8)d=h[c++],i[l++]=128&d?m:v,i[l++]=64&d?m:v,i[l++]=32&d?m:v,i[l++]=16&d?m:v,i[l++]=8&d?m:v,i[l++]=4&d?m:v,i[l++]=2&d?m:v,i[l++]=1&d?m:v;for(;s<r;s++)0===o&&(d=h[c++],o=128),i[l++]=d&o?m:v,o>>=1}for(;l<f;)i[l++]=0;t.putImageData(o,0,u*$l)}}else if(e.kind===pe.RGBA_32BPP){for(p=0,f=n*$l*4,u=0;u<r;u++)d.set(h.subarray(c,c+f)),c+=f,t.putImageData(o,0,p),p+=$l;u<a&&(f=n*s*4,d.set(h.subarray(c,c+f)),t.putImageData(o,0,p))}else{if(e.kind!==pe.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(A=$l,f=n*A,u=0;u<a;u++){for(u>=r&&(A=s,f=n*A),l=0,p=f;p--;)d[l++]=h[c++],d[l++]=h[c++],d[l++]=h[c++],d[l++]=255;t.putImageData(o,0,u*$l)}}}function oc(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,s=i%$l,r=(i-s)/$l,a=0===s?r:r+1,o=t.createImageData(n,$l);let l=0;const c=e.data,h=o.data;for(let d=0;d<a;d++){const e=d<r?$l:s;({srcPos:l}=Zl({src:c,srcPos:l,dest:h,width:n,height:e,nonBlackColor:0})),t.putImageData(o,0,d*$l)}}function lc(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)void 0!==t[n]&&(e[n]=t[n]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function cc(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function hc(t,e){if(e)return!0;Xe.singularValueDecompose2dScale(t,ec);const i=Math.fround(yi.pixelRatio*ri.PDF_TO_CSS_UNITS);return ec[0]<=i&&ec[1]<=i}const dc=["butt","round","square"],uc=["miter","round","bevel"],pc={},Ac={};var fc=new WeakSet;class gc{constructor(t,e,i,n,s,r,a,o,l){let{optionalContentConfig:c,markedContentStack:h=null}=r;(0,bt.A)(this,fc),this.ctx=t,this.current=new rc(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=n,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=h||[],this.optionalContentConfig=c,this.cachedCanvases=new nc(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=a,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=o,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=null!==l&&void 0!==l?l:null}getObject(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;var n;return"string"===typeof e?(null===(n=this.dependencyTracker)||void 0===n||n.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing(t){let{transform:e,viewport:i,transparency:n=!1,background:s=null}=t;const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,n){const t=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...vi(this.compositeCtx))}this.ctx.save(),cc(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=vi(this.ctx)}executeOperatorList(t,e,i,n,s){const r=t.argsArray,a=t.fnArray;let o=e||0;const l=r.length;if(l===o)return o;const c=l-o>10&&"function"===typeof i,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let A,f;for(;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,i),o;var g;if(!s||s(o))if(A=a[o],f=null!==(g=r[o])&&void 0!==g?g:null,A!==ye.dependency)null===f?this[A](o):this[A](o,...f);else for(const t of f){var m;null===(m=this.dependencyTracker)||void 0===m||m.recordNamedData(t,o);const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>h)return i(),o;d=0}}}endDrawing(){(0,_t.A)(fc,this,mc).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,_t.A)(fc,this,vc).call(this)}_scaleImage(t,e){var i,n;const s=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,r=null!==(n=t.height)&&void 0!==n?n:t.displayHeight;let a,o,l=Math.max(Math.hypot(e[0],e[1]),1),c=Math.max(Math.hypot(e[2],e[3]),1),h=s,d=r,u="prescale1";for(;l>2&&h>1||c>2&&d>1;){let e=h,i=d;l>2&&h>1&&(e=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),l/=h/e),c>2&&d>1&&(i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,c/=d/i),a=this.cachedCanvases.getCanvas(u,e,i),o=a.context,o.clearRect(0,0,e,i),o.drawImage(t,0,0,h,d,0,0,e,i),t=a.canvas,h=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:d}}_createMaskCanvas(t,e){var i;const n=this.ctx,{width:s,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,l=vi(n);let c,h,d,u;if((e.bitmap||e.data)&&e.count>1){const i=e.bitmap||e.data.buffer;h=JSON.stringify(o?l:[l.slice(0,4),a]),c=this._cachedBitmapsMap.get(i),c||(c=new Map,this._cachedBitmapsMap.set(i,c));const n=c.get(h);if(n&&!o){var p;const e=Math.round(Math.min(l[0],l[2])+l[4]),i=Math.round(Math.min(l[1],l[3])+l[5]);return null===(p=this.dependencyTracker)||void 0===p||p.recordDependencies(t,Bl),{canvas:n,offsetX:e,offsetY:i}}d=n}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,r),oc(u.context,e));let A=Xe.transform(l,[1/s,0,0,-1/r,0,0]);A=Xe.transform(A,[1,0,0,1,0,-r]);const f=ic.slice();Xe.axialAlignedBoundingBox([0,0,s,r],A,f);const[g,m,v,w]=f,b=Math.round(v-g)||1,y=Math.round(w-m)||1,_=this.cachedCanvases.getCanvas("fillCanvas",b,y),x=_.context,E=g,S=m;x.translate(-E,-S),x.transform(...A),d||(d=this._scaleImage(u.canvas,wi(x)),d=d.img,c&&o&&c.set(h,d)),x.imageSmoothingEnabled=hc(vi(x),e.interpolate),sc(x,d,0,0,d.width,d.height,0,0,s,r),x.globalCompositeOperation="source-in";const k=Xe.transform(wi(x),[1,0,0,1,-E,-S]);return x.fillStyle=o?a.getPattern(n,this,k,Wl,t):a,x.fillRect(0,0,s,r),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(h,_.canvas)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Bl),{canvas:_.canvas,offsetX:Math.round(E),offsetY:Math.round(S)}}setLineWidth(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineCap",t),this.ctx.lineCap=dc[e]}setLineJoin(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineJoin",t),this.ctx.lineJoin=uc[e]}setMiterLimit(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("dash",t);const s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(e),s.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var i,n,s,r,a;for(const[o,l]of e)switch(o){case"LW":this.setLineWidth(t,l);break;case"LC":this.setLineCap(t,l);break;case"LJ":this.setLineJoin(t,l);break;case"ML":this.setMiterLimit(t,l);break;case"D":this.setDash(t,l[0],l[1]);break;case"RI":this.setRenderingIntent(t,l);break;case"FL":this.setFlatness(t,l);break;case"Font":this.setFont(t,l[0],l[1]);break;case"CA":null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=l;break;case"ca":null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=l;break;case"BM":null===(s=this.dependencyTracker)||void 0===s||s.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=l;break;case"SMask":null===(r=this.dependencyTracker)||void 0===r||r.recordSimpleData("SMask",t),this.current.activeSMask=l?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":null===(a=this.dependencyTracker)||void 0===a||a.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(l)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,i);this.suspendedCtx=this.ctx;const r=this.ctx=s.context;r.setTransform(this.suspendedCtx.getTransform()),lc(this.suspendedCtx,r),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,s,r,a){e.transform(t,i,n,s,r,a),this.__originalTransform(t,i,n,s,r,a)},t.setTransform=function(t,i,n,s,r,a){e.setTransform(t,i,n,s,r,a),this.__originalSetTransform(t,i,n,s,r,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,s,r,a){e.bezierCurveTo(t,i,n,s,r,a),this.__originalBezierCurveTo(t,i,n,s,r,a)},t.rect=function(t,i,n,s){e.rect(t,i,n,s),this.__originalRect(t,i,n,s)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(r,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),lc(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;0!==a&&0!==o&&(this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,s,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,r,a,o,l,c,h){let d=t.canvas,u=o-c,p=l-h;if(r)if(u<0||p<0||u+i>d.width||p+n>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,n),e=t.context;e.drawImage(d,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=r,e.fillRect(0,0,i,n),e.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,n),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=r,t.fillRect(u,p,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(a));const A=new Path2D;A.rect(o,l,i,n),e.clip(A),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,n,o,l,i,n),e.restore()}save(t){var e;this.inSMaskMode&&lc(this.ctx,this.suspendedCtx),this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone(),null===(e=this.dependencyTracker)||void 0===e||e.save(t)}restore(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.restore(t),0!==this.stateStack.length?(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&lc(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null):this.inSMaskMode&&this.endSMaskMode()}transform(t,e,i,n,s,r,a){var o;null===(o=this.dependencyTracker)||void 0===o||o.recordIncrementalData("transform",t),this.ctx.transform(e,i,n,s,r,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,n){let[s]=i;if(!n)return s||(s=i[0]=new Path2D),void this[e](t,s);if(null!==this.dependencyTracker){const i=e===ye.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,n[0]-i,n[2]+i,n[1]-i,n[3]+i).recordDependencies(t,["transform"])}if(!(s instanceof Path2D)){const t=i[0]=new Path2D;for(let e=0,i=s.length;e<i;)switch(s[e++]){case _e:t.moveTo(s[e++],s[e++]);break;case xe:t.lineTo(s[e++],s[e++]);break;case Ee:t.bezierCurveTo(s[e++],s[e++],s[e++],s[e++],s[e++],s[e++]);break;case Se:t.closePath();break;default:Pe("Unrecognized drawing path operator: ".concat(s[e-1]))}s=t}Xe.axialAlignedBoundingBox(n,vi(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e){var i;let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,r=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"===typeof r&&null!==r&&void 0!==r&&r.getPattern){const i=r.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=r.getPattern(s,this,wi(s),jl,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}this.rescaleAndStroke(e,!1),s.restore()}else this.rescaleAndStroke(e,!0);null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Rl),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(jl,vi(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e){var i;let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,r=this.current.fillColor;let a=!1;if(this.current.patternFill){var o;const i=r.isModifyingCurrentTransform()?s.getTransform():null;if(null===(o=this.dependencyTracker)||void 0===o||o.save(t),s.save(),s.fillStyle=r.getPattern(s,this,wi(s),Wl,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}a=!0}const l=this.current.getClippedPathBoundingBox();var c;(this.contentVisible&&null!==l&&(this.pendingEOFill?(s.fill(e,"evenodd"),this.pendingEOFill=!1):s.fill(e)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Ll),a)&&(s.restore(),null===(c=this.dependencyTracker)||void 0===c||c.restore(t));n&&this.consumePath(t,e,l)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var i;this.ctx.fill(e),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Fl).recordOperation(t)}clip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=pc}eoClip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=Ac}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,null===(e=this.dependencyTracker)||void 0===e||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){const t=new Path2D,n=i.getTransform().invertSelf();for(const{transform:i,x:s,y:r,fontSize:a,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(n).translate(s,r).scale(a,-a));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){var n,s;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const r=this.commonObjs.get(e),a=this.current;if(!r)throw new Error("Can't find font for ".concat(e));if(a.fontMatrix=r.fontMatrix||Xt,0!==a.fontMatrix[0]&&0!==a.fontMatrix[3]||Pe("Invalid font matrix for font "+e),i<0?(i=-i,a.fontDirection=-1):a.fontDirection=1,this.current.font=r,this.current.fontSize=i,r.isType3Font)return;const o=r.loadedName||"sans-serif",l=(null===(s=r.systemFontInfo)||void 0===s?void 0:s.css)||'"'.concat(o,'", ').concat(r.fallbackName);let c="normal";r.black?c="900":r.bold&&(c="bold");const h=r.italic?"italic":"normal";let d=i;i<16?d=16:i>100&&(d=100),this.current.fontSizeScale=i/d,this.ctx.font="".concat(h," ").concat(c," ").concat(d,"px ").concat(l)}setTextRenderingMode(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textMatrix",t);const{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){var e,i;this.moveText(t,0,this.current.leading),null===(e=this.dependencyTracker)||void 0===e||e.recordIncrementalData("moveText",null!==(i=this.dependencyTracker.getSimpleIndex("leading"))&&void 0!==i?i:t)}paintChar(t,e,i,n,s,r){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&de,u=!!(c&ue),p=o.patternFill&&!l.missingFile,A=o.patternStroke&&!l.missingFile;let f;if((l.disableFontFace||u||p||A)&&!l.missingFile&&(f=l.getPathGenerator(this.commonObjs,e)),f&&(l.disableFontFace||p||A)){var g;let e;if(a.save(),a.translate(i,n),a.scale(h,-h),null===(g=this.dependencyTracker)||void 0===g||g.recordCharacterBBox(t,a,l),d===oe||d===ce)if(s){e=a.getTransform(),a.setTransform(...s);const t=(0,_t.A)(fc,this,wc).call(this,f,e,s);a.fill(t)}else a.fill(f);if(d===le||d===ce)if(r){e||(e=a.getTransform()),a.setTransform(...r);const{a:t,b:i,c:n,d:s}=e,o=Xe.inverseTransform(r),l=Xe.transform([t,i,n,s,0,0],o);Xe.singularValueDecompose2dScale(l,ec),a.lineWidth*=Math.max(ec[0],ec[1])/h,a.stroke((0,_t.A)(fc,this,wc).call(this,f,e,r))}else a.lineWidth/=h,a.stroke(f);a.restore()}else{var m;if(d===oe||d===ce)a.fillText(e,i,n),null===(m=this.dependencyTracker)||void 0===m||m.recordCharacterBBox(t,a,l,h,i,n,()=>a.measureText(e));if(d===le||d===ce){var v;if(this.dependencyTracker)null===(v=this.dependencyTracker)||void 0===v||v.recordCharacterBBox(t,a,l,h,i,n,()=>a.measureText(e)).recordDependencies(t,Rl);a.strokeText(e,i,n)}}if(u){var w;(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:vi(a),x:i,y:n,fontSize:h,path:f}),null===(w=this.dependencyTracker)||void 0===w||w.recordCharacterBBox(t,a,l,h,i,n)}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n<e.length;n+=4)if(e[n]>0&&e[n]<255){i=!0;break}return Fe(this,"isFontSubpixelAAEnabled",i)}showText(t,e){var i;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Nl).resetBBox(t),this.current.textRenderingMode&ue&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,s=n.font;var r;if(s.isType3Font)return this.showType3Text(t,e),void(null===(r=this.dependencyTracker)||void 0===r||r.recordShowTextOperation(t));const a=n.fontSize;var o;if(0===a)return void(null===(o=this.dependencyTracker)||void 0===o||o.recordOperation(t));const l=this.ctx,c=n.fontSizeScale,h=n.charSpacing,d=n.wordSpacing,u=n.fontDirection,p=n.textHScale*u,A=e.length,f=s.vertical,g=f?1:-1,m=s.defaultVMetrics,v=a*n.fontMatrix[0],w=n.textRenderingMode===oe&&!s.disableFontFace&&!n.patternFill;let b,y;if(l.save(),n.textMatrix&&l.transform(...n.textMatrix),l.translate(n.x,n.y+n.textRise),u>0?l.scale(p,-1):l.scale(p,1),n.patternFill){l.save();const e=n.fillColor.getPattern(l,this,wi(l),Wl,t);b=vi(l),l.restore(),l.fillStyle=e}if(n.patternStroke){l.save();const e=n.strokeColor.getPattern(l,this,wi(l),jl,t);y=vi(l),l.restore(),l.strokeStyle=e}let _=n.lineWidth;const x=n.textMatrixScale;if(0===x||0===_){const t=n.textRenderingMode&de;t!==le&&t!==ce||(_=this.getSinglePixelWidth())}else _/=x;if(1!==c&&(l.scale(c,c),_/=c),l.lineWidth=_,s.isInvalidPDFjsFont){const i=[];let s=0;for(const t of e)i.push(t.unicode),s+=t.width;const r=i.join("");if(l.fillText(r,0,0),null!==this.dependencyTracker){const e=l.measureText(r);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}return n.x+=s*v*p,l.restore(),void this.compose()}let E,S=0;for(E=0;E<A;++E){const i=e[E];if("number"===typeof i){S+=g*i*a/1e3;continue}let n=!1;const r=(i.isSpace?d:0)+h,o=i.fontChar,p=i.accent;let A,_,x,C=i.width;if(f){const t=i.vmetric||m,e=-(i.vmetric?t[1]:.5*C)*v,n=t[2]*v;C=t?-t[0]:C,A=e/c,_=(S+n)/c}else A=S/c,_=0;if(s.remeasure&&C>0){x=l.measureText(o);const t=1e3*x.width/a*c;if(C<t&&this.isFontSubpixelAAEnabled){const e=C/t;n=!0,l.save(),l.scale(e,1),A/=e}else C!==t&&(A+=(C-t)/2e3*a/c)}var k;if(this.contentVisible&&(i.isInFont||s.missingFile))if(w&&!p)l.fillText(o,A,_),null===(k=this.dependencyTracker)||void 0===k||k.recordCharacterBBox(t,l,x?{bbox:null}:s,a/c,A,_,()=>null!==x&&void 0!==x?x:l.measureText(o));else if(this.paintChar(t,o,A,_,b,y),p){const e=A+a*p.offset.x/c,i=_-a*p.offset.y/c;this.paintChar(t,p.fontChar,e,i,b,y)}S+=f?C*v-r*u:C*v+r*u,n&&l.restore()}f?n.y-=S:n.x+=S*p,l.restore(),this.compose(),null===(i=this.dependencyTracker)||void 0===i||i.recordShowTextOperation(t)}showType3Text(t,e){const i=this.ctx,n=this.current,s=n.font,r=n.fontSize,a=n.fontDirection,o=s.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,h=n.textHScale*a,d=n.fontMatrix||Xt,u=e.length;let p,A,f,g;if(n.textRenderingMode===he||0===r)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),n.textMatrix&&i.transform(...n.textMatrix),i.translate(n.x,n.y+n.textRise),i.scale(h,a);const m=this.dependencyTracker;for(this.dependencyTracker=m?new Dl(m,t):null,p=0;p<u;++p){if(A=e[p],"number"===typeof A){g=o*A*r/1e3,this.ctx.translate(g,0),n.x+=g*h;continue}const t=(A.isSpace?c:0)+l,a=s.charProcOperatorList[A.operatorListId];a?this.contentVisible&&(this.save(),i.scale(r,r),i.transform(...d),this.executeOperatorList(a),this.restore()):Pe('Type3 character "'.concat(A.operatorListId,'" is not available.'));const u=[A.width,0];Xe.applyTransform(u,d),f=u[0]*r+t,i.translate(f,0),n.x+=f*h}i.restore(),m&&(this.dependencyTracker=m)}setCharWidth(t,e,i){}setCharWidthAndBounds(t,e,i,n,s,r,a){var o;const l=new Path2D;l.rect(n,s,r-n,a-s),this.ctx.clip(l),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,this.ctx,n,r,s,a).recordClipBox(t,this.ctx,n,r,s,a),this.endPath(t)}getColorN_Pattern(t,e){let i;if("TilingPattern"===e[0]){const t=this.baseTransform||vi(this.ctx),n={createCanvasGraphics:(t,e)=>new gc(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Dl(this.dependencyTracker,e,!0):null)};i=new Jl(e,this.ctx,n,t)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("strokeColor",t);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];this.current.strokeColor=this.getColorN_Pattern(t,n),this.current.patternStroke=!0}setFillColorN(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("fillColor",t);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];this.current.fillColor=this.getColorN_Pattern(t,n),this.current.patternFill=!0}setStrokeRGBColor(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=function(t){switch(t[0]){case"RadialAxial":return new Vl(t);case"Mesh":return new Xl(t);case"Dummy":return new Yl}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t,e)),this.cachedPatterns.set(e,i)),n&&(i.matrix=n),i}shadingFill(t,e){var i;if(!this.contentVisible)return;const n=this.ctx;this.save(t);const s=this._getPattern(t,e);n.fillStyle=s.getPattern(n,this,wi(n),Ul,t);const r=wi(n);if(r){const{width:t,height:e}=n.canvas,i=ic.slice();Xe.axialAlignedBoundingBox([0,0,t,e],r,i);const[s,a,o,l]=i;this.ctx.fillRect(s,a,o-s,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Ol).recordDependencies(t,Ll).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){De("Should not call beginInlineImage")}beginImageData(){De("Should not call beginImageData")}paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=vi(this.ctx),i)){var n;Xe.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[e,s,r,a]=i,o=new Path2D;o.rect(e,s,r-e,a-s),this.ctx.clip(o),null===(n=this.dependencyTracker)||void 0===n||n.recordClipBox(t,this.ctx,e,r,s,a),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var i;if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const n=this.ctx;e.isolated||Te("TODO: Support non-isolated groups."),e.knockout&&Pe("Knockout groups not supported.");const s=vi(n);if(e.matrix&&n.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=ic.slice();Xe.axialAlignedBoundingBox(e.bbox,vi(n),r);const a=[0,0,n.canvas.width,n.canvas.height];r=Xe.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),l=Math.floor(r[1]),c=Math.max(Math.ceil(r[2])-o,1),h=Math.max(Math.ceil(r[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,h]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,c,h),p=u.context;p.translate(-o,-l),p.transform(...s);let A=new Path2D;const[f,g,m,v]=e.bbox;if(A.rect(f,g,m-f,v-g),e.matrix){const t=new Path2D;t.addPath(A,new DOMMatrix(e.matrix)),A=t}p.clip(A),e.smask&&this.smaskStack.push({canvas:u.canvas,context:p,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),e.smask&&!this.dependencyTracker||(n.setTransform(1,0,0,1,0,0),n.translate(o,l),n.save()),lc(n,p),this.ctx=p,null===(i=this.dependencyTracker)||void 0===i||i.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){var i;if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,null===(i=this.dependencyTracker)||void 0===i||i.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const e=vi(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);const i=ic.slice();Xe.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],e,i),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,n,s,r){if((0,_t.A)(fc,this,mc).call(this),cc(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const s=i[2]-i[0],a=i[3]-i[1];if(r&&this.annotationCanvasMap){(n=n.slice())[4]-=i[0],n[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=s,i[3]=a,Xe.singularValueDecompose2dScale(vi(this.ctx),ec);const{viewportScale:t}=this,r=Math.ceil(s*this.outputScaleX*t),o=Math.ceil(a*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(r,o);const{canvas:l,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(ec[0],0,0,-ec[1],0,a*ec[1]),cc(this.ctx)}else{cc(this.ctx),this.endPath(t);const e=new Path2D;e.rect(i[0],i[1],s,a),this.ctx.clip(e)}}this.current=new rc(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...n),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),(0,_t.A)(fc,this,vc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){var i;if(!this.contentVisible)return;const n=e.count;(e=this.getObject(t,e.data,e)).count=n;const s=this.ctx,r=this._createMaskCanvas(t,e),a=r.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,r.offsetX,r.offsetY),null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+a.width,r.offsetY,r.offsetY+a.height).recordOperation(t),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i){var n,s;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const c=this.ctx;c.save();const h=vi(c);c.transform(i,r,a,o,0,0);const d=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]),null===(n=this.dependencyTracker)||void 0===n||n.resetBBox(t);for(let p=0,A=l.length;p<A;p+=2){var u;const e=Xe.transform(h,[i,r,a,o,l[p],l[p+1]]);c.drawImage(d.canvas,e[4],e[5]),null===(u=this.dependencyTracker)||void 0===u||u.recordBBox(t,this.ctx,e[4],e[4]+d.canvas.width,e[5],e[5]+d.canvas.height)}c.restore(),this.compose(),null===(s=this.dependencyTracker)||void 0===s||s.recordOperation(t)}paintImageMaskXObjectGroup(t,e){var i,n;if(!this.contentVisible)return;const s=this.ctx,r=this.current.fillColor,a=this.current.patternFill;null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordDependencies(t,Bl);for(const l of e){var o;const{data:e,width:i,height:n,transform:c}=l,h=this.cachedCanvases.getCanvas("maskCanvas",i,n),d=h.context;d.save();oc(d,this.getObject(t,e,l)),d.globalCompositeOperation="source-in",d.fillStyle=a?r.getPattern(d,this,wi(s),Wl,t):r,d.fillRect(0,0,i,n),d.restore(),s.save(),s.transform(...c),s.scale(1,-1),sc(s,h.canvas,0,0,i,n,0,-1,1,1),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,s,0,i,0,n),s.restore()}this.compose(),null===(n=this.dependencyTracker)||void 0===n||n.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;const i=this.getObject(t,e);i?this.paintInlineImageXObject(t,i):Pe("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n,s){if(!this.contentVisible)return;const r=this.getObject(t,e);if(!r)return void Pe("Dependent image isn't ready yet");const a=r.width,o=r.height,l=[];for(let c=0,h=s.length;c<h;c+=2)l.push({transform:[i,0,0,n,s[c],s[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(t,r,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:n}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",s.canvas}paintInlineImageXObject(t,e){var i;if(!this.contentVisible)return;const n=e.width,s=e.height,r=this.ctx;this.save(t);const{filter:a}=r;let o;if("none"!==a&&""!==a&&(r.filter="none"),r.scale(1/n,-1/s),e.bitmap)o=this.applyTransferMapsToBitmap(e);else if("function"===typeof HTMLElement&&e instanceof HTMLElement||!e.data)o=e;else{const t=this.cachedCanvases.getCanvas("inlineImage",n,s).context;ac(t,e),o=this.applyTransferMapsToCanvas(t)}const l=this._scaleImage(o,wi(r));r.imageSmoothingEnabled=hc(vi(r),e.interpolate),null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordBBox(t,r,0,n,-s,0).recordDependencies(t,Il).recordOperation(t),sc(r,l.img,0,0,l.paintWidth,l.paintHeight,0,-s,n,s),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){var n,s;if(!this.contentVisible)return;const r=this.ctx;let a;if(e.bitmap)a=e.bitmap;else{const t=e.width,i=e.height,n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;ac(n,e),a=this.applyTransferMapsToCanvas(n)}null===(n=this.dependencyTracker)||void 0===n||n.resetBBox(t);for(const l of i){var o;r.save(),r.transform(...l.transform),r.scale(1,-1),sc(r,a,l.x,l.y,l.w,l.h,0,-1,1,1),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,r,0,1,-1,0),r.restore()}null===(s=this.dependencyTracker)||void 0===s||s.recordOperation(t),this.compose()}paintSolidColorImageMask(t){var e;this.contentVisible&&(null===(e=this.dependencyTracker)||void 0===e||e.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Ll).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,i){}beginMarkedContent(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.beginMarkedContent(t),"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const s=this.ctx;var r,a;this.pendingClip?(n||(this.pendingClip===Ac?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,null===(r=this.dependencyTracker)||void 0===r||r.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):null===(a=this.dependencyTracker)||void 0===a||a.recordOperation(t);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=vi(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:n,d:s}=this.ctx.getTransform();let r,a;if(0===i&&0===n){const i=Math.abs(e),n=Math.abs(s);if(i===n)if(0===t)r=a=1/i;else{const e=i*t;r=a=e<1?1/e:1}else if(0===t)r=1/i,a=1/n;else{const e=i*t,s=n*t;r=e<1?1/e:1,a=s<1?1/s:1}}else{const o=Math.abs(e*s-i*n),l=Math.hypot(e,i),c=Math.hypot(n,s);if(0===t)r=c/o,a=l/o;else{const e=t*o;r=c>e?c/e:1,a=l>e?l/e:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:n}}=this,[s,r]=this.getScaleForStroking();if(s===r)return i.lineWidth=(n||1)*s,void i.stroke(t);const a=i.getLineDash();e&&i.save(),i.scale(s,r),tc.a=1/s,tc.d=1/r;const o=new Path2D;if(o.addPath(t,tc),a.length>0){const t=Math.max(s,r);i.setLineDash(a.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=n||1,i.stroke(o),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function mc(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function vc(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}function wc(t,e,i){const n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n}for(const f_ in ye)void 0!==gc.prototype[f_]&&(gc.prototype[ye[f_]]=gc.prototype[f_]);var bc=new WeakMap,yc=new WeakMap,_c=new WeakMap,xc=new WeakSet;class Ec{static write(t){const e=new TextEncoder,i={};let n=0;for(const l of Ec.strings){const s=e.encode(t[l]);i[l]=s,n+=4+s.length}const s=new ArrayBuffer(n),r=new Uint8Array(s),a=new DataView(s);let o=0;for(const l of Ec.strings){const t=i[l],e=t.length;a.setUint32(o,e),r.set(t,o+4),o+=4+e}return Re(o===s.byteLength,"CssFontInfo.write: Buffer overflow"),s}constructor(t){(0,bt.A)(this,xc),(0,yt.A)(this,bc,void 0),(0,yt.A)(this,yc,void 0),(0,yt.A)(this,_c,void 0),(0,Ht.A)(bc,this,t),(0,Ht.A)(yc,this,new DataView((0,zt.A)(bc,this))),(0,Ht.A)(_c,this,new TextDecoder)}get fontFamily(){return(0,_t.A)(xc,this,Sc).call(this,0)}get fontWeight(){return(0,_t.A)(xc,this,Sc).call(this,1)}get italicAngle(){return(0,_t.A)(xc,this,Sc).call(this,2)}}function Sc(t){Re(t<Tt.strings.length,"Invalid string index");let e=0;for(let n=0;n<t;n++)e+=(0,zt.A)(yc,this).getUint32(e)+4;const i=(0,zt.A)(yc,this).getUint32(e);return(0,zt.A)(_c,this).decode(new Uint8Array((0,zt.A)(bc,this),e+4,i))}Tt=Ec,(0,Vt.A)(Ec,"strings",["fontFamily","fontWeight","italicAngle"]);var kc=new WeakMap,Cc=new WeakMap,Mc=new WeakMap,Tc=new WeakSet;class Pc{static write(t){const e=new TextEncoder,i={};let n=0;for(const d of Pc.strings){const s=e.encode(t[d]);i[d]=s,n+=4+s.length}n+=4;let s,r,a=1+n;t.style&&(s=e.encode(t.style.style),r=e.encode(t.style.weight),a+=4+s.length+4+r.length);const o=new ArrayBuffer(a),l=new Uint8Array(o),c=new DataView(o);let h=0;c.setUint8(h++,t.guessFallback?1:0),c.setUint32(h,0),h+=4,n=0;for(const d of Pc.strings){const t=i[d],e=t.length;n+=4+e,c.setUint32(h,e),l.set(t,h+4),h+=4+e}return c.setUint32(h-n-4,n),t.style&&(c.setUint32(h,s.length),l.set(s,h+4),h+=4+s.length,c.setUint32(h,r.length),l.set(r,h+4),h+=4+r.length),Re(h<=o.byteLength,"SubstitionInfo.write: Buffer overflow"),o.transferToFixedLength(h)}constructor(t){(0,bt.A)(this,Tc),(0,yt.A)(this,kc,void 0),(0,yt.A)(this,Cc,void 0),(0,yt.A)(this,Mc,void 0),(0,Ht.A)(kc,this,t),(0,Ht.A)(Cc,this,new DataView((0,zt.A)(kc,this))),(0,Ht.A)(Mc,this,new TextDecoder)}get guessFallback(){return 0!==(0,zt.A)(Cc,this).getUint8(0)}get css(){return(0,_t.A)(Tc,this,Dc).call(this,0)}get loadedName(){return(0,_t.A)(Tc,this,Dc).call(this,1)}get baseFontName(){return(0,_t.A)(Tc,this,Dc).call(this,2)}get src(){return(0,_t.A)(Tc,this,Dc).call(this,3)}get style(){let t=1;t+=4+(0,zt.A)(Cc,this).getUint32(t);const e=(0,zt.A)(Cc,this).getUint32(t),i=(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),t+4,e));t+=4+e;const n=(0,zt.A)(Cc,this).getUint32(t);return{style:i,weight:(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),t+4,n))}}}function Dc(t){Re(t<Pt.strings.length,"Invalid string index");let e=5;for(let n=0;n<t;n++)e+=(0,zt.A)(Cc,this).getUint32(e)+4;const i=(0,zt.A)(Cc,this).getUint32(e);return(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),e+4,i))}Pt=Pc,(0,Vt.A)(Pc,"strings",["css","loadedName","baseFontName","src"]);var Rc=new WeakMap,Lc=new WeakMap,Ic=new WeakMap,Fc=new WeakSet;class Nc{constructor(t){let{data:e,extra:i}=t;(0,bt.A)(this,Fc),(0,yt.A)(this,Rc,void 0),(0,yt.A)(this,Lc,void 0),(0,yt.A)(this,Ic,void 0),(0,Ht.A)(Rc,this,e),(0,Ht.A)(Lc,this,new TextDecoder),(0,Ht.A)(Ic,this,new DataView((0,zt.A)(Rc,this))),i&&Object.assign(this,i)}get black(){return(0,_t.A)(Fc,this,Oc).call(this,0)}get bold(){return(0,_t.A)(Fc,this,Oc).call(this,1)}get disableFontFace(){return(0,_t.A)(Fc,this,Oc).call(this,2)}get fontExtraProperties(){return(0,_t.A)(Fc,this,Oc).call(this,3)}get isInvalidPDFjsFont(){return(0,_t.A)(Fc,this,Oc).call(this,4)}get isType3Font(){return(0,_t.A)(Fc,this,Oc).call(this,5)}get italic(){return(0,_t.A)(Fc,this,Oc).call(this,6)}get missingFile(){return(0,_t.A)(Fc,this,Oc).call(this,7)}get remeasure(){return(0,_t.A)(Fc,this,Oc).call(this,8)}get vertical(){return(0,_t.A)(Fc,this,Oc).call(this,9)}get ascent(){return(0,_t.A)(Fc,this,Bc).call(this,0)}get defaultWidth(){return(0,_t.A)(Fc,this,Bc).call(this,1)}get descent(){return(0,_t.A)(Fc,this,Bc).call(this,2)}get bbox(){let t=Uc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<4;i++)e.push((0,zt.A)(Ic,this).getInt16(t,!0)),t+=2;return e}get fontMatrix(){let t=zc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<6;i++)e.push((0,zt.A)(Ic,this).getFloat64(t,!0)),t+=8;return e}get defaultVMetrics(){let t=Hc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<3;i++)e.push((0,zt.A)(Ic,this).getInt16(t,!0)),t+=2;return e}get fallbackName(){return(0,_t.A)(Fc,this,Wc).call(this,0)}get loadedName(){return(0,_t.A)(Fc,this,Wc).call(this,1)}get mimetype(){return(0,_t.A)(Fc,this,Wc).call(this,2)}get name(){return(0,_t.A)(Fc,this,Wc).call(this,3)}get data(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0!==e)return new Uint8Array((0,zt.A)(Rc,this),t+4,e)}clearData(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);new Uint8Array((0,zt.A)(Rc,this),t+4,e).fill(0),(0,zt.A)(Ic,this).setUint32(t,0)}get cssFontInfo(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array((0,zt.A)(Rc,this),t+4,e)),new Ec(i.buffer)}get systemFontInfo(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array((0,zt.A)(Rc,this),t+4,e)),new Pc(i.buffer)}static write(t){const e=t.systemFontInfo?Pc.write(t.systemFontInfo):null,i=t.cssFontInfo?Ec.write(t.cssFontInfo):null,n=new TextEncoder,s={};let r=0;for(const A of Nc.strings)s[A]=n.encode(t[A]),r+=4+s[A].length;const a=Vc._+4+r+4+(e?e.byteLength:0)+4+(i?i.byteLength:0)+4+(t.data?t.data.length:0),o=new ArrayBuffer(a),l=new Uint8Array(o),c=new DataView(o);let h=0;const d=Nc.bools.length;let u=0,p=0;for(let A=0;A<d;A++){const e=t[Nc.bools[A]];u|=(void 0===e?0:e?2:1)<<p,p+=2,8!==p&&A!==d-1||(c.setUint8(h++,u),u=0,p=0)}Re(h===jc._,"FontInfo.write: Boolean properties offset mismatch");for(const A of Nc.numbers)c.setFloat64(h,t[A]),h+=8;if(Re(h===Uc._,"FontInfo.write: Number properties offset mismatch"),t.bbox){c.setUint8(h++,4);for(const e of t.bbox)c.setInt16(h,e,!0),h+=2}else c.setUint8(h++,0),h+=8;if(Re(h===zc._,"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix){c.setUint8(h++,6);for(const e of t.fontMatrix)c.setFloat64(h,e,!0),h+=8}else c.setUint8(h++,0),h+=48;if(Re(h===Hc._,"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics){c.setUint8(h++,1);for(const e of t.defaultVMetrics)c.setInt16(h,e,!0),h+=2}else c.setUint8(h++,0),h+=6;Re(h===Vc._,"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(Vc._,0),h+=4;for(const A of Nc.strings){const t=s[A],e=t.length;c.setUint32(h,e),l.set(t,h+4),h+=4+e}if(c.setUint32(Vc._,h-Vc._-4),e){const t=e.byteLength;c.setUint32(h,t),Re(h+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),l.set(new Uint8Array(e),h+4),h+=4+t}else c.setUint32(h,0),h+=4;if(i){const t=i.byteLength;c.setUint32(h,t),Re(h+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),l.set(new Uint8Array(i),h+4),h+=4+t}else c.setUint32(h,0),h+=4;return void 0===t.data?(c.setUint32(h,0),h+=4):(c.setUint32(h,t.data.length),l.set(t.data,h+4),h+=4+t.data.length),Re(h<=o.byteLength,"FontInfo.write: Buffer overflow"),o.transferToFixedLength(h)}}function Oc(t){Re(t<Dt.bools.length,"Invalid boolean index");const e=Math.floor(t/4),i=2*t%8,n=(0,zt.A)(Ic,this).getUint8(e)>>i&3;return 0===n?void 0:2===n}function Bc(t){return Re(t<Dt.numbers.length,"Invalid number index"),(0,zt.A)(Ic,this).getFloat64(jc._+8*t)}function Wc(t){Re(t<Dt.strings.length,"Invalid string index");let e=Vc._+4;for(let s=0;s<t;s++)e+=(0,zt.A)(Ic,this).getUint32(e)+4;const i=(0,zt.A)(Ic,this).getUint32(e),n=new Uint8Array(i);return n.set(new Uint8Array((0,zt.A)(Rc,this),e+4,i)),(0,zt.A)(Lc,this).decode(n)}Dt=Nc,(0,Vt.A)(Nc,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),(0,Vt.A)(Nc,"numbers",["ascent","defaultWidth","descent"]),(0,Vt.A)(Nc,"strings",["fallbackName","loadedName","mimetype","name"]);var jc={_:Math.ceil(2*Dt.bools.length/8)},Uc={_:(0,_t.A)(Dt,Dt,jc)._+8*Dt.numbers.length},zc={_:(0,_t.A)(Dt,Dt,Uc)._+1+8},Hc={_:(0,_t.A)(Dt,Dt,zc)._+1+48},Vc={_:(0,_t.A)(Dt,Dt,Hc)._+1+6};class Gc{static get workerPort(){return(0,_t.A)(Gc,this,qc)._}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");qc._=(0,_t.A)(Gc,this,t)}static get workerSrc(){return(0,_t.A)(Gc,this,Xc)._}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");Xc._=(0,_t.A)(Gc,this,t)}}var qc={_:null},Xc={_:""},Yc=new WeakMap,Kc=new WeakMap;class Qc{constructor(t){let{parsedData:e,rawData:i}=t;(0,yt.A)(this,Yc,void 0),(0,yt.A)(this,Kc,void 0),(0,Ht.A)(Yc,this,e),(0,Ht.A)(Kc,this,i)}getRaw(){return(0,zt.A)(Kc,this)}get(t){var e;return null!==(e=(0,zt.A)(Yc,this).get(t))&&void 0!==e?e:null}[Symbol.iterator](){return(0,zt.A)(Yc,this).entries()}}const Jc=Symbol("INTERNAL");var Zc=new WeakMap,$c=new WeakMap,th=new WeakMap,eh=new WeakMap;class ih{constructor(t,e){let{name:i,intent:n,usage:s,rbGroups:r}=e;(0,yt.A)(this,Zc,!1),(0,yt.A)(this,$c,!1),(0,yt.A)(this,th,!1),(0,yt.A)(this,eh,!0),(0,Ht.A)(Zc,this,!!(t&Qt)),(0,Ht.A)($c,this,!!(t&Jt)),this.name=i,this.intent=n,this.usage=s,this.rbGroups=r}get visible(){if((0,zt.A)(th,this))return(0,zt.A)(eh,this);if(!(0,zt.A)(eh,this))return!1;const{print:t,view:e}=this.usage;return(0,zt.A)(Zc,this)?"OFF"!==(null===e||void 0===e?void 0:e.viewState):!(0,zt.A)($c,this)||"OFF"!==(null===t||void 0===t?void 0:t.printState)}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==Jc&&De("Internal method `_setVisible` called."),(0,Ht.A)(th,this,i),(0,Ht.A)(eh,this,e)}}var nh=new WeakMap,sh=new WeakMap,rh=new WeakMap,ah=new WeakMap,oh=new WeakSet;class lh{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qt;if((0,bt.A)(this,oh),(0,yt.A)(this,nh,null),(0,yt.A)(this,sh,new Map),(0,yt.A)(this,rh,null),(0,yt.A)(this,ah,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,(0,Ht.A)(ah,this,t.order);for(const i of t.groups)(0,zt.A)(sh,this).set(i.id,new ih(e,i));if("OFF"===t.baseState)for(const t of(0,zt.A)(sh,this).values())t._setVisible(Jc,!1);for(const e of t.on)(0,zt.A)(sh,this).get(e)._setVisible(Jc,!0);for(const e of t.off)(0,zt.A)(sh,this).get(e)._setVisible(Jc,!1);(0,Ht.A)(rh,this,this.getHash())}}isVisible(t){if(0===(0,zt.A)(sh,this).size)return!0;if(!t)return Te("Optional content group not defined."),!0;if("OCG"===t.type)return(0,zt.A)(sh,this).has(t.id)?(0,zt.A)(sh,this).get(t.id).visible:(Pe("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,_t.A)(oh,this,ch).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if((0,zt.A)(sh,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if(!(0,zt.A)(sh,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if(!(0,zt.A)(sh,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if((0,zt.A)(sh,this).get(e).visible)return!1}return!0}return Pe("Unknown optional content policy ".concat(t.policy,".")),!0}return Pe("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=(0,zt.A)(sh,this).get(t);if(n){if(i&&e&&n.rbGroups.length)for(const e of n.rbGroups)for(const i of e){var s;if(i!==t)null===(s=(0,zt.A)(sh,this).get(i))||void 0===s||s._setVisible(Jc,!1,!0)}n._setVisible(Jc,!!e,!0),(0,Ht.A)(nh,this,null)}else Pe("Optional content group not found: ".concat(t))}setOCGState(t){let e,{state:i,preserveRB:n}=t;for(const s of i){switch(s){case"ON":case"OFF":case"Toggle":e=s;continue}const t=(0,zt.A)(sh,this).get(s);if(t)switch(e){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!t.visible,n)}}(0,Ht.A)(nh,this,null)}get hasInitialVisibility(){return null===(0,zt.A)(rh,this)||this.getHash()===(0,zt.A)(rh,this)}getOrder(){return(0,zt.A)(sh,this).size?(0,zt.A)(ah,this)?(0,zt.A)(ah,this).slice():[...(0,zt.A)(sh,this).keys()]:null}getGroup(t){return(0,zt.A)(sh,this).get(t)||null}getHash(){if(null!==(0,zt.A)(nh,this))return(0,zt.A)(nh,this);const t=new Ca;for(const[e,i]of(0,zt.A)(sh,this))t.update("".concat(e,":").concat(i.visible));return(0,Ht.A)(nh,this,t.hexdigest())}[Symbol.iterator](){return(0,zt.A)(sh,this).entries()}}function ch(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const e=t[n];let s;if(Array.isArray(e))s=(0,_t.A)(oh,this,ch).call(this,e);else{if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;s=(0,zt.A)(sh,this).get(e).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===i}class hh{constructor(t,e){let{disableRange:i=!1,disableStream:n=!1}=e;Re(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:r,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(null===r||void 0===r?void 0:r.length)>0){const t=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!i,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t;const n=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{Re(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(n),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,n,s;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(n=this._fullRequestReader)||void 0===n||null===(s=n.onProgress)||void 0===s||s.call(n,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Re(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new dh(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new uh(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class dh{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=hi(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uh{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function ph(t,e){const i=new Headers;if(!t||!e||"object"!==typeof e)return i;for(const n in e){const t=e[n];void 0!==t&&i.append(n,t)}return i}function Ah(t){var e,i;return null!==(e=null===(i=URL.parse(t))||void 0===i?void 0:i.origin)&&void 0!==e?e:null}function fh(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:n,disableRange:s}=t;const r={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(a))return r;if(r.suggestedLength=a,a<=2*n)return r;if(s||!i)return r;if("bytes"!==e.get("Accept-Ranges"))return r;return"identity"!==(e.get("Content-Encoding")||"identity")||(r.allowRangeRequests=!0),r}function gh(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=a(i);return t=unescape(t),t=o(t),t=l(t),r(t)}if(i=function(t){const e=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=s.exec(t));){let[,t,n,s]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,s]}const r=[];for(let n=0;n<e.length&&n in e;++n){let[t,i]=e[n];i=a(i),t&&(i=unescape(i),0===n&&(i=o(i))),r.push(i)}return r.join("")}(t),i)return r(l(i));if(i=n("filename","i").exec(t),i){i=i[1];let t=a(i);return t=l(t),r(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const n=new TextDecoder(t,{fatal:!0}),s=Ve(i);i=n.decode(s),e=!1}catch(n){}}return i}function r(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:s(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,n){if("q"===i||"Q"===i)return s(e,n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{n=atob(n)}catch(r){}return s(e,n)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(hi(t))return t}return null}function mh(t,e){return new je("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t,404===t||0===t&&e.startsWith("file:"))}function vh(t){return 200===t||206===t}function wh(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function bh(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Pe("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class yh{constructor(t){(0,Vt.A)(this,"_responseOrigin",null),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=ph(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Re(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new _h(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new xh(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class _h{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),n=e.url;fetch(n,wh(i,this._withCredentials,this._abortController)).then(e=>{if(t._responseOrigin=Ah(e.url),!vh(e.status))throw mh(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,{allowRangeRequests:s,suggestedLength:r}=fh({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=r||this._contentLength,this._filename=gh(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ze("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:bh(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class xh{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const n=t.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(t.headers);s.append("Range","bytes=".concat(e,"-").concat(i-1));const r=n.url;fetch(r,wh(s,this._withCredentials,this._abortController)).then(e=>{const i=Ah(e.url);if(i!==t._responseOrigin)throw new Error('Expected range response-origin "'.concat(i,'" to match "').concat(t._responseOrigin,'".'));if(!vh(e.status))throw mh(e.status,r);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:bh(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Eh{constructor(t){let{url:e,httpHeaders:i,withCredentials:n}=t;(0,Vt.A)(this,"_responseOrigin",null),this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=ph(this.isHttp,i),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[s,r]of this.headers)e.setRequestHeader(s,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",Re(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===n.status&&this.isHttp)return void i.onError(n.status);const s=n.status||200;if(!(200===s&&206===i.expectedStatus)&&s!==i.expectedStatus)return void i.onError(n.status);const r=function(t){const e=t.response;return"string"!==typeof e?e:Ve(e).buffer}(n);if(206===s){const t=n.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:r}):(Pe('Missing or invalid "Content-Range" header.'),i.onError(0))}else r?i.onDone({begin:0,chunk:r}):i.onError(n.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Sh{constructor(t){this._source=t,this._manager=new Eh(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Re(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new kh(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new Ch(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class kh{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Ah(e.responseURL);const i=e.getAllResponseHeaders(),n=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:r}=fh({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=gh(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=mh(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Ch{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=Ah(null===(t=this._manager.getRequestXhr(this._requestId))||void 0===t?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(e,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){var e;null!==(e=this._storedError)&&void 0!==e||(this._storedError=mh(t,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Mh=/^[a-z][a-z0-9\-+.]+:/i;class Th{constructor(t){this.source=t,this.url=function(t){if(Mh.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),Re("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Re(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Ph(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Dh(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Ph{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=mh(0,this._url.href)),this._storedError=t,this._headersCapability.reject(t)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ze("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Dh{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=t.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Rh=Symbol("INITIAL_DATA");var Lh=new WeakMap,Ih=new WeakSet;class Fh{constructor(){(0,bt.A)(this,Ih),(0,yt.A)(this,Lh,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=(0,_t.A)(Ih,this,Nh).call(this,t);return i.promise.then(()=>e(i.data)),null}const i=(0,zt.A)(Lh,this)[t];if(!i||i.data===Rh)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=(0,zt.A)(Lh,this)[t];return!!e&&e.data!==Rh}delete(t){const e=(0,zt.A)(Lh,this)[t];return!(!e||e.data===Rh)&&(delete(0,zt.A)(Lh,this)[t],!0)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,_t.A)(Ih,this,Nh).call(this,t);i.data=e,i.resolve()}clear(){for(const e in(0,zt.A)(Lh,this)){var t;const{data:i}=(0,zt.A)(Lh,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}(0,Ht.A)(Lh,this,Object.create(null))}*[Symbol.iterator](){for(const t in(0,zt.A)(Lh,this)){const{data:e}=(0,zt.A)(Lh,this)[t];e!==Rh&&(yield[t,e])}}}function Nh(t){var e;return(e=(0,zt.A)(Lh,this))[t]||(e[t]=(0,wt.A)((0,wt.A)({},Promise.withResolvers()),{},{data:Rh}))}var Oh=new WeakMap,Bh=new WeakMap,Wh=new WeakMap,jh=new WeakMap,Uh=new WeakMap,zh=new WeakMap,Hh=new WeakMap,Vh=new WeakMap,Gh=new WeakMap,qh=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,Kh=new WeakMap,Qh=new WeakMap,Jh=new WeakMap,Zh=new WeakMap,$h=new WeakMap,td=new WeakMap,ed=new WeakSet;class id{constructor(t){var e;let{textContentSource:i,container:n,viewport:s}=t;if((0,bt.A)(this,ed),(0,yt.A)(this,Oh,Promise.withResolvers()),(0,yt.A)(this,Bh,null),(0,yt.A)(this,Wh,!1),(0,yt.A)(this,jh,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),(0,yt.A)(this,Uh,null),(0,yt.A)(this,zh,null),(0,yt.A)(this,Hh,0),(0,yt.A)(this,Vh,0),(0,yt.A)(this,Gh,null),(0,yt.A)(this,qh,null),(0,yt.A)(this,Xh,0),(0,yt.A)(this,Yh,0),(0,yt.A)(this,Kh,Object.create(null)),(0,yt.A)(this,Qh,[]),(0,yt.A)(this,Jh,null),(0,yt.A)(this,Zh,[]),(0,yt.A)(this,$h,new WeakMap),(0,yt.A)(this,td,null),i instanceof ReadableStream)(0,Ht.A)(Jh,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');(0,Ht.A)(Jh,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}(0,Ht.A)(Bh,this,(0,Ht.A)(qh,this,n)),(0,Ht.A)(Yh,this,s.scale*yi.pixelRatio),(0,Ht.A)(Xh,this,s.rotation),(0,Ht.A)(zh,this,{div:null,properties:null,ctx:null});const{pageWidth:r,pageHeight:a,pageX:o,pageY:l}=s.rawDims;(0,Ht.A)(td,this,[1,0,0,-1,-o,l+a]),(0,Ht.A)(Vh,this,r),(0,Ht.A)(Hh,this,a),ld.call(id),bi(n,s),(0,zt.A)(Oh,this).promise.finally(()=>{Ad._.delete(this),(0,Ht.A)(zh,this,null),(0,Ht.A)(Kh,this,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=Ge.platform;return Fe(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{(0,zt.A)(Gh,this).read().then(e=>{var i;let{value:n,done:s}=e;s?(0,zt.A)(Oh,this).resolve():(null!==(i=(0,zt.A)(Uh,this))&&void 0!==i||(0,Ht.A)(Uh,this,n.lang),Object.assign((0,zt.A)(Kh,this),n.styles),(0,_t.A)(ed,this,nd).call(this,n.items),t())},(0,zt.A)(Oh,this).reject)};return(0,Ht.A)(Gh,this,(0,zt.A)(Jh,this).getReader()),Ad._.add(this),t(),(0,zt.A)(Oh,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const n=e.scale*yi.pixelRatio,s=e.rotation;if(s!==(0,zt.A)(Xh,this)&&(null===i||void 0===i||i(),(0,Ht.A)(Xh,this,s),bi((0,zt.A)(qh,this),{rotation:s})),n!==(0,zt.A)(Yh,this)){null===i||void 0===i||i(),(0,Ht.A)(Yh,this,n);const t={div:null,properties:null,ctx:ad.call(id,(0,zt.A)(Uh,this))};for(const e of(0,zt.A)(Zh,this))t.properties=(0,zt.A)($h,this).get(e),t.div=e,(0,_t.A)(ed,this,rd).call(this,t)}}cancel(){var t;const e=new ze("TextLayer task cancelled.");null===(t=(0,zt.A)(Gh,this))||void 0===t||t.cancel(e).catch(()=>{}),(0,Ht.A)(Gh,this,null),(0,zt.A)(Oh,this).reject(e)}get textDivs(){return(0,zt.A)(Zh,this)}get textContentItemsStr(){return(0,zt.A)(Qh,this)}static cleanup(){if(!((0,_t.A)(id,this,Ad)._.size>0)){(0,_t.A)(id,this,hd)._.clear();for(const{canvas:t}of(0,_t.A)(id,this,dd)._.values())t.remove();(0,_t.A)(id,this,dd)._.clear()}}}function nd(t){var e,i;if((0,zt.A)(Wh,this))return;null!==(i=(e=(0,zt.A)(zh,this)).ctx)&&void 0!==i||(e.ctx=ad.call(Rt,(0,zt.A)(Uh,this)));const n=(0,zt.A)(Zh,this),s=(0,zt.A)(Qh,this);for(const r of t){if(n.length>1e5)return Pe("Ignoring additional textDivs for performance reasons."),void(0,Ht.A)(Wh,this,!0);if(void 0!==r.str)s.push(r.str),(0,_t.A)(ed,this,sd).call(this,r);else if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){const t=(0,zt.A)(Bh,this);(0,Ht.A)(Bh,this,document.createElement("span")),(0,zt.A)(Bh,this).classList.add("markedContent"),r.id&&(0,zt.A)(Bh,this).setAttribute("id","".concat(r.id)),t.append((0,zt.A)(Bh,this))}else"endMarkedContent"===r.type&&(0,Ht.A)(Bh,this,(0,zt.A)(Bh,this).parentNode)}}function sd(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,zt.A)(Zh,this).push(e);const n=Xe.transform((0,zt.A)(td,this),t.transform);let s=Math.atan2(n[1],n[0]);const r=(0,zt.A)(Kh,this)[t.fontName];r.vertical&&(s+=Math.PI/2);let a=(0,zt.A)(jh,this)&&r.fontSubstitution||r.fontFamily;a=Rt.fontFamilyMap.get(a)||a;const o=Math.hypot(n[2],n[3]),l=o*cd.call(Rt,a,r,(0,zt.A)(Uh,this));let c,h;0===s?(c=n[4],h=n[5]-l):(c=n[4]+l*Math.sin(s),h=n[5]-l*Math.cos(s));const d="calc(var(--total-scale-factor) *",u=e.style;(0,zt.A)(Bh,this)===(0,zt.A)(qh,this)?(u.left="".concat((100*c/(0,zt.A)(Vh,this)).toFixed(2),"%"),u.top="".concat((100*h/(0,zt.A)(Hh,this)).toFixed(2),"%")):(u.left="".concat(d).concat(c.toFixed(2),"px)"),u.top="".concat(d).concat(h.toFixed(2),"px)")),u.fontSize="".concat(d).concat((pd._*o).toFixed(2),"px)"),u.fontFamily=a,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,(0,zt.A)(jh,this)&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),0!==s&&(i.angle=s*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(p=!0)}if(p&&(i.canvasWidth=r.vertical?t.height:t.width),(0,zt.A)($h,this).set(e,i),(0,zt.A)(zh,this).div=e,(0,zt.A)(zh,this).properties=i,(0,_t.A)(ed,this,rd).call(this,(0,zt.A)(zh,this)),i.hasText&&(0,zt.A)(Bh,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),(0,zt.A)(Bh,this).append(t)}}function rd(t){const{div:e,properties:i,ctx:n}=t,{style:s}=e;let r="";if(pd._>1&&(r="scale(".concat(1/pd._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:t}=s,{canvasWidth:a,fontSize:o}=i;od.call(Rt,n,o*(0,zt.A)(Yh,this),t);const{width:l}=n.measureText(e.textContent);l>0&&(r="scaleX(".concat(a*(0,zt.A)(Yh,this)/l,") ").concat(r))}0!==i.angle&&(r="rotate(".concat(i.angle,"deg) ").concat(r)),r.length>0&&(s.transform=r)}function ad(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,_t.A)(Rt,this,dd)._.get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),(0,_t.A)(Rt,this,dd)._.set(t,e),(0,_t.A)(Rt,this,ud)._.set(e,{size:0,family:""})}return e}function od(t,e,i){const n=(0,_t.A)(Rt,this,ud)._.get(t);e===n.size&&i===n.family||(t.font="".concat(e,"px ").concat(i),n.size=e,n.family=i)}function ld(){if(null!==(0,_t.A)(Rt,this,pd)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),pd._=(0,_t.A)(Rt,this,t.getBoundingClientRect().height),t.remove()}function cd(t,e,i){const n=(0,_t.A)(Rt,this,hd)._.get(t);if(n)return n;const s=(0,_t.A)(Rt,this,ad).call(this,i);s.canvas.width=s.canvas.height=30,(0,_t.A)(Rt,this,od).call(this,s,30,t);const r=s.measureText(""),a=r.fontBoundingBoxAscent,o=Math.abs(r.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;return a?l=a/(a+o):(Ge.platform.isFirefox&&Pe("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?l=e.ascent:e.descent&&(l=1+e.descent)),(0,_t.A)(Rt,this,hd)._.set(t,l),l}Rt=id;var hd={_:new Map},dd={_:new Map},ud={_:new WeakMap},pd={_:null},Ad={_:new Set};function fd(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const n=new gd,{docId:s}=n,r=i.url?function(t){if(t instanceof URL)return t.href;if("string"===typeof t){if(qt)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,a=i.data?function(t){if(qt&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return Ve(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(i.data):null,o=i.httpHeaders||null,l=!0===i.withCredentials,c=null!==(t=i.password)&&void 0!==t?t:null,h=i.range instanceof xd?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:65536;let u=i.worker instanceof Id?i.worker:null;const p=i.verbosity,A="string"!==typeof i.docBaseUrl||ci(i.docBaseUrl)?null:i.docBaseUrl,f=za(i.cMapUrl),g=!1!==i.cMapPacked,m=i.CMapReaderFactory||(qt?Yo:vo),v=za(i.iccUrl),w=za(i.standardFontDataUrl),b=i.StandardFontDataFactory||(qt?Ko:zo),y=za(i.wasmUrl),_=i.WasmFactory||(qt?Qo:Vo),x=!0!==i.stopAtErrors,E=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,S=!1!==i.isEvalSupported,k="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!qt,C="boolean"===typeof i.isImageDecoderSupported?i.isImageDecoderSupported:!qt&&(Ge.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,T="boolean"===typeof i.disableFontFace?i.disableFontFace:qt,P=!0===i.fontExtraProperties,D=!0===i.enableXfa,R=i.ownerDocument||globalThis.document,L=!0===i.disableRange,I=!0===i.disableStream,F=!0===i.disableAutoFetch,N=!0===i.pdfBug,O=i.CanvasFactory||(qt?Xo:go),B=i.FilterFactory||(qt?qo:Mo),W=!0===i.enableHWA,j=!1!==i.useWasm,U=h?h.length:null!==(e=i.length)&&void 0!==e?e:NaN,z="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!qt&&!T,H="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:!!(m===vo&&b===zo&&_===Vo&&f&&w&&y&&ui(f,document.baseURI)&&ui(w,document.baseURI)&&ui(y,document.baseURI));Ce(p);const V={canvasFactory:new O({ownerDocument:R,enableHWA:W}),filterFactory:new B({docId:s,ownerDocument:R}),cMapReaderFactory:H?null:new m({baseUrl:f,isCompressed:g}),standardFontDataFactory:H?null:new b({baseUrl:w}),wasmFactory:H?null:new _({baseUrl:y})};u||(u=Id.create({verbosity:p,port:Gc.workerPort}),n._worker=u);const G={docId:s,apiVersion:"5.4.296",data:a,password:c,disableAutoFetch:F,rangeChunkSize:d,length:U,docBaseUrl:A,enableXfa:D,evaluatorOptions:{maxImageSize:E,disableFontFace:T,ignoreErrors:x,isEvalSupported:S,isOffscreenCanvasSupported:k,isImageDecoderSupported:C,canvasMaxAreaInBytes:M,fontExtraProperties:P,useSystemFonts:z,useWasm:j,useWorkerFetch:H,cMapUrl:f,iccUrl:v,standardFontDataUrl:w,wasmUrl:y}},q={ownerDocument:R,pdfBug:N,styleElement:null,loadingParams:{disableAutoFetch:F,enableXfa:D}};return u.promise.then(function(){if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let e;if(h)e=new hh(h,{disableRange:L,disableStream:I});else if(!a){if(!r)throw new Error("getDocument - no `url` parameter provided.");const t=ui(r)?yh:qt?Th:Sh;e=new t({url:r,length:U,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:L,disableStream:I})}return t.then(t=>{if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new lo(s,t,u.port),r=new Kd(i,n,e,q,V,W);n._transport=r,i.send("Ready",null)})}).catch(n._capability.reject),n}class gd{constructor(){(0,Vt.A)(this,"_capability",Promise.withResolvers()),(0,Vt.A)(this,"_transport",null),(0,Vt.A)(this,"_worker",null),(0,Vt.A)(this,"docId","d".concat((md._=(Lt=md._,It=Lt++,Lt),It))),(0,Vt.A)(this,"destroyed",!1),(0,Vt.A)(this,"onPassword",null),(0,Vt.A)(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0;try{var e,i;null!==(e=this._worker)&&void 0!==e&&e.port&&(this._worker._pendingDestroy=!0),await(null===(i=this._transport)||void 0===i?void 0:i.destroy())}catch(s){var n;throw null!==(n=this._worker)&&void 0!==n&&n.port&&delete this._worker._pendingDestroy,s}this._transport=null,null===(t=this._worker)||void 0===t||t.destroy(),this._worker=null}async getData(){return this._transport.getData()}}var md={_:0},vd=new WeakMap,wd=new WeakMap,bd=new WeakMap,yd=new WeakMap,_d=new WeakMap;class xd{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;(0,yt.A)(this,vd,Promise.withResolvers()),(0,yt.A)(this,wd,[]),(0,yt.A)(this,bd,[]),(0,yt.A)(this,yd,[]),(0,yt.A)(this,_d,[]),this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n}addRangeListener(t){(0,zt.A)(_d,this).push(t)}addProgressListener(t){(0,zt.A)(yd,this).push(t)}addProgressiveReadListener(t){(0,zt.A)(bd,this).push(t)}addProgressiveDoneListener(t){(0,zt.A)(wd,this).push(t)}onDataRange(t,e){for(const i of(0,zt.A)(_d,this))i(t,e)}onDataProgress(t,e){(0,zt.A)(vd,this).promise.then(()=>{for(const i of(0,zt.A)(yd,this))i(t,e)})}onDataProgressiveRead(t){(0,zt.A)(vd,this).promise.then(()=>{for(const e of(0,zt.A)(bd,this))e(t)})}onDataProgressiveDone(){(0,zt.A)(vd,this).promise.then(()=>{for(const t of(0,zt.A)(wd,this))t()})}transportReady(){(0,zt.A)(vd,this).resolve()}requestDataRange(t,e){De("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Ed{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Fe(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Sd=new WeakMap,kd=new WeakSet;class Cd{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,bt.A)(this,kd),(0,yt.A)(this,Sd,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new di:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new Fh,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new oi({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Fe(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,n;let{canvasContext:s,canvas:r=s.canvas,viewport:a,intent:o="display",annotationMode:l=ne.ENABLE,transform:c=null,background:h=null,optionalContentConfigPromise:d=null,annotationCanvasMap:u=null,pageColors:p=null,printAnnotationStorage:A=null,isEditing:f=!1,recordOperations:g=!1,operationsFilter:m=null}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const v=this._transport.getRenderingIntent(o,l,A,f),{renderingIntent:w,cacheKey:b}=v;(0,Ht.A)(Sd,this,!1),d||(d=this._transport.getOptionalContentConfig(w));let y=this._intentStates.get(b);y||(y=Object.create(null),this._intentStates.set(b,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const _=!!(w&Jt);var x;y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(x=this._stats)||void 0===x||x.time("Page Request"),this._pumpOperatorList(v));const E=Boolean(this._pdfBug&&(null===(i=globalThis.StepperManager)||void 0===i?void 0:i.enabled)),S=!this.recordedBBoxes&&(g||E),k=t=>{if(y.renderTasks.delete(C),S){var e;const t=null===(e=C.gfx)||void 0===e?void 0:e.dependencyTracker.take();t&&(C.stepper&&C.stepper.setOperatorBBoxes(t,C.gfx.dependencyTracker.takeDebugMetadata()),g&&(this.recordedBBoxes=t))}var i;(_&&(0,Ht.A)(Sd,this,!0),(0,_t.A)(kd,this,Md).call(this),t?(C.capability.reject(t),this._abortOperatorList({intentState:y,reason:t instanceof Error?t:new Error(t)})):C.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(i=globalThis.Stats)&&void 0!==i&&i.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new tu({callback:k,params:{canvas:r,canvasContext:s,dependencyTracker:S?new El(r,y.operatorList.length,E):null,viewport:a,transform:c,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!_,pdfBug:this._pdfBug,pageColors:p,enableHWA:this._transport.enableHWA,operationsFilter:m});((n=y).renderTasks||(n.renderTasks=new Set)).add(C);const M=C.task;return Promise.all([y.displayReadyCapability.promise,d]).then(t=>{var e;let[i,n]=t;if(this.destroyed)k();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(n.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:i,optionalContentConfig:n}),C.operatorListChanged()}}).catch(k),M}getOperatorList(){let{intent:t="display",annotationMode:e=ne.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(t,e,i,n,!0);let r,a=this._intentStates.get(s.cacheKey);var o,l;(a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a)),a.opListReadCapability)||(r=Object.create(null),r.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(r))},a.opListReadCapability=Promise.withResolvers(),((o=a).renderTasks||(o.renderTasks=new Set)).add(r),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||void 0===l||l.time("Page Request"),this._pumpOperatorList(s));return a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>ii.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const n=e.getReader(),s={items:[],styles:Object.create(null),lang:null};!function e(){n.read().then(function(i){var n;let{value:r,done:a}=i;a?t(s):(null!==(n=s.lang)&&void 0!==n||(s.lang=r.lang),Object.assign(s.styles,r.styles),s.items.push(...r.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,Ht.A)(Sd,this,!1),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,Ht.A)(Sd,this,!0);const e=(0,_t.A)(kd,this,Md).call(this);return t&&e&&this._stats&&(this._stats=new di),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(n=s.displayReadyCapability)||void 0===n||n.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&(0,_t.A)(kd,this,Md).call(this)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:n,modifiedIds:s}=t;const{map:r,transfer:a}=n,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:r,modifiedIds:s},a).getReader(),l=this._intentStates.get(i);l.streamReader=o;const c=()=>{o.read().then(t=>{let{value:e,done:i}=t;i?l.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,l),c())},t=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const t of l.renderTasks)t.operatorListChanged();(0,_t.A)(kd,this,Md).call(this)}if(l.displayReadyCapability)l.displayReadyCapability.reject(t);else{if(!l.opListReadCapability)throw t;l.opListReadCapability.reject(t)}}})};c()}_abortOperatorList(t){let{intentState:e,reason:i,force:n=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof li){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t))}}if(e.streamReader.cancel(new ze(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}function Md(){if(!(0,zt.A)(Sd,this)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),(0,Ht.A)(Sd,this,!1),!0}var Td=new WeakMap,Pd=new WeakMap,Dd=new WeakMap,Rd=new WeakMap,Ld=new WeakSet;class Id{constructor(){let{name:t=null,port:e=null,verbosity:i=Me()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,bt.A)(this,Ld),(0,yt.A)(this,Td,Promise.withResolvers()),(0,yt.A)(this,Pd,null),(0,yt.A)(this,Dd,null),(0,yt.A)(this,Rd,null),this.name=t,this.destroyed=!1,this.verbosity=i,e){if(zd._.has(e))throw new Error("Cannot use more than one PDFWorker per port.");zd._.set(e,this),(0,_t.A)(Ld,this,Nd).call(this,e)}else(0,_t.A)(Ld,this,Od).call(this)}get promise(){return(0,zt.A)(Td,this).promise}get port(){return(0,zt.A)(Dd,this)}get messageHandler(){return(0,zt.A)(Pd,this)}destroy(){var t,e;this.destroyed=!0,null===(t=(0,zt.A)(Rd,this))||void 0===t||t.terminate(),(0,Ht.A)(Rd,this,null),zd._.delete((0,zt.A)(Dd,this)),(0,Ht.A)(Dd,this,null),null===(e=(0,zt.A)(Pd,this))||void 0===e||e.destroy(),(0,Ht.A)(Pd,this,null)}static create(t){const e=(0,_t.A)(Id,this,zd)._.get(null===t||void 0===t?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Id(t)}static get workerSrc(){if(Gc.workerSrc)return Gc.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Fe(this,"_setupFakeWorkerGlobal",(async()=>{if(xt(Id,this,Wd))return xt(Id,this,Wd);return(await i(50789)(this.workerSrc)).WorkerMessageHandler})())}}function Fd(){(0,zt.A)(Td,this).resolve(),(0,zt.A)(Pd,this).send("configure",{verbosity:this.verbosity})}function Nd(t){(0,Ht.A)(Dd,this,t),(0,Ht.A)(Pd,this,new lo("main","worker",t)),(0,zt.A)(Pd,this).on("ready",()=>{}),(0,_t.A)(Ld,this,Fd).call(this)}function Od(){if(Ud._||Wd(Ft))return void(0,_t.A)(Ld,this,Bd).call(this);let{workerSrc:t}=Ft;try{Ft._isSameOrigin(window.location,t)||(t=Ft._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new lo("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?(0,zt.A)(Td,this).reject(new Error("Worker was destroyed")):(0,_t.A)(Ld,this,Bd).call(this)},s=new AbortController;e.addEventListener("error",()=>{(0,zt.A)(Rd,this)||n()},{signal:s.signal}),i.on("test",t=>{s.abort(),!this.destroyed&&t?((0,Ht.A)(Pd,this,i),(0,Ht.A)(Dd,this,e),(0,Ht.A)(Rd,this,e),(0,_t.A)(Ld,this,Fd).call(this)):n()}),i.on("ready",t=>{if(s.abort(),this.destroyed)n();else try{r()}catch(e){(0,_t.A)(Ld,this,Bd).call(this)}});const r=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void r()}catch(e){Te("The worker has been disabled.")}(0,_t.A)(Ld,this,Bd).call(this)}function Bd(){Ud._||(Pe("Setting up fake worker."),Ud._=!0),Ft._setupFakeWorkerGlobal.then(t=>{var e,i;if(this.destroyed)return void(0,zt.A)(Td,this).reject(new Error("Worker was destroyed"));const n=new Xa;(0,Ht.A)(Dd,this,n);const s="fake".concat((jd._=(e=jd._,i=e++,e),i)),r=new lo(s+"_worker",s,n);t.setup(r,n),(0,Ht.A)(Pd,this,new lo(s,s+"_worker",n)),(0,_t.A)(Ld,this,Fd).call(this)}).catch(t=>{(0,zt.A)(Td,this).reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}function Wd(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(i){return null}}Ft=Id;var jd={_:0},Ud={_:!1},zd={_:new WeakMap};qt&&(Ud._=(0,_t.A)(Ft,Ft,!0),Gc.workerSrc||(Gc.workerSrc="./pdf.worker.mjs")),Ft._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(null===i||void 0===i||!i.origin||"null"===i.origin)return!1;const n=new URL(e,i);return i.origin===n.origin},Ft._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Ft.fromPort=t=>{var e;if(e="`PDFWorker.fromPort` - please use `PDFWorker.create` instead.",console.log("Deprecated API usage: "+e),null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return Ft.create(t)};var Hd=new WeakMap,Vd=new WeakMap,Gd=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Yd=new WeakSet;class Kd{constructor(t,e,i,n,s,r){(0,bt.A)(this,Yd),(0,yt.A)(this,Hd,new Map),(0,yt.A)(this,Vd,new Map),(0,yt.A)(this,Gd,new Map),(0,yt.A)(this,qd,new Map),(0,yt.A)(this,Xd,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Fh,this.fontLoader=new Wa({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=r,this.setupMessageHandler()}get annotationStorage(){return Fe(this,"annotationStorage",new Ia)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ne.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=Qt,a=Ma;switch(t){case"any":r=Kt;break;case"display":break;case"print":r=Jt;break;default:Pe("getRenderingIntent - invalid intent: ".concat(t))}const o=r&Jt&&i instanceof Oa?i:this.annotationStorage;switch(e){case ne.DISABLE:r+=te;break;case ne.ENABLE:break;case ne.ENABLE_FORMS:r+=Zt;break;case ne.ENABLE_STORAGE:r+=$t,a=o.serializable;break;default:Pe("getRenderingIntent - invalid annotationMode: ".concat(e))}n&&(r+=ee),s&&(r+=ie);const{ids:l,hash:c}=o.modifiedIds;return{renderingIntent:r,cacheKey:[r,a.hash,c].join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=(0,zt.A)(Xd,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of(0,zt.A)(Vd,this).values())e.push(n._destroy());(0,zt.A)(Vd,this).clear(),(0,zt.A)(Gd,this).clear(),(0,zt.A)(qd,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),(0,zt.A)(Hd,this).clear(),this.filterFactory.destroy(),id.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new ze("Worker was terminated.")),null===(e=this.messageHandler)||void 0===e||e.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{Re(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:n}=t;n?e.close():(Re(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:s}=this._fullReader;if(!i||!n){var r;if(this._lastProgress)null===(r=e.onProgress)||void 0===r||r.call(e,this._lastProgress);this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:n,contentLength:s}}),t.on("GetRangeReader",(t,e)=>{Re(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function(t){let{value:i,done:n}=t;n?e.close():(Re(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new Ed(i,this))}),t.on("DocException",t=>{e._capability.reject(ro(t))}),t.on("PasswordRequest",t=>{(0,Ht.A)(Xd,this,Promise.withResolvers());try{if(!e.onPassword)throw ro(t);const i=t=>{t instanceof Error?(0,zt.A)(Xd,this).reject(t):(0,zt.A)(Xd,this).resolve({password:t})};e.onPassword(i,t.code)}catch(i){(0,zt.A)(Xd,this).reject(i)}return(0,zt.A)(Xd,this).promise}),t.on("DataLoaded",t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(this.destroyed)return;(0,zt.A)(Vd,this).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{var i;let[n,s,r]=e;if(this.destroyed)return null;if(this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in r){const t=r.error;Pe("Error during font loading: ".concat(t)),this.commonObjs.resolve(n,t);break}const e=new Nc(r),a=this._params.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,o=new Ua(e,a,r.extra,r.charProcOperatorList);this.fontLoader.bind(o).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!o.fontExtraProperties&&o.data&&o.clearData(),this.commonObjs.resolve(n,o)});break;case"CopyLocalImage":const{imageRef:l}=r;Re(l,"The imageRef must be defined.");for(const t of(0,zt.A)(Vd,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===l)return e.dataLen?(this.commonObjs.resolve(n,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error("Got unknown common object type ".concat(s))}return null}),t.on("obj",t=>{let[e,i,n,s]=t;if(this.destroyed)return;const r=(0,zt.A)(Vd,this).get(i);var a;if(!r.objs.has(e))if(0!==r._intentStates.size)switch(n){case"Image":case"Pattern":r.objs.resolve(e,s);break;default:throw new Error("Got unknown object type ".concat(n))}else null===s||void 0===s||null===(a=s.bitmap)||void 0===a||a.close()}),t.on("DocProgress",t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");const e=this[t.type];if(!e)throw new Error("".concat(t.type," not initialized, see the `useWorkerFetch` parameter."));return e.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&Pe("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=(0,zt.A)(Gd,this).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&(0,zt.A)(qd,this).set(i.refStr,t);const n=new Cd(e,i,this,this._params.pdfBug);return(0,zt.A)(Vd,this).set(e,n),n});return(0,zt.A)(Gd,this).set(e,n),n}getPageIndex(t){return Ha(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,_t.A)(Yd,this,Qd).call(this,"GetFieldObjects")}hasJSActions(){return(0,_t.A)(Yd,this,Qd).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return(0,_t.A)(Yd,this,Qd).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return(0,_t.A)(Yd,this,Qd).call(this,"GetOptionalContentConfig").then(e=>new lh(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=(0,zt.A)(Hd,this).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,n,s;return{info:t[0],metadata:t[1]?new Qc(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(n=null===(s=this._fullReader)||void 0===s?void 0:s.contentLength)&&void 0!==n?n:null}});return(0,zt.A)(Hd,this).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of(0,zt.A)(Vd,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),(0,zt.A)(Hd,this).clear(),this.filterFactory.destroy(!0),id.cleanup()}}cachedPageNumber(t){var e;if(!Ha(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=(0,zt.A)(qd,this).get(i))&&void 0!==e?e:null}}function Qd(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,zt.A)(Hd,this).get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return(0,zt.A)(Hd,this).set(t,n),n}var Jd=new WeakMap;class Zd{constructor(t){(0,yt.A)(this,Jd,null),(0,Vt.A)(this,"onContinue",null),(0,Vt.A)(this,"onError",null),(0,Ht.A)(Jd,this,t)}get promise(){return(0,zt.A)(Jd,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,zt.A)(Jd,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=(0,zt.A)(Jd,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=(0,zt.A)(Jd,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var $d=new WeakMap;class tu{constructor(t){let{callback:e,params:i,objs:n,commonObjs:s,annotationCanvasMap:r,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:u=null,enableHWA:p=!1,operationsFilter:A=null}=t;(0,yt.A)(this,$d,null),this.callback=e,this.params=i,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Zd(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvas,this._canvasContext=i.canvas?null:i.canvasContext,this._enableHWA=p,this._dependencyTracker=i.dependencyTracker,this._operationsFilter=A}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:n=!1,optionalContentConfig:s}=t;if(this.cancelled)return;if(this._canvas){if(eu._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");eu._.add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:a,background:o,dependencyTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new gc(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:s},this.annotationCanvasMap,this.pageColors,l),this.gfx.beginDrawing({transform:a,viewport:r,transparency:n,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t,e,i;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),(0,zt.A)($d,this)&&(window.cancelAnimationFrame((0,zt.A)($d,this)),(0,Ht.A)($d,this,null)),eu._.delete(this._canvas),n||(n=new li("Rendering cancelled, page ".concat(this._pageIndex+1),s)),this.callback(n),null===(e=(i=this.task).onError)||void 0===e||e.call(i,n)}operatorListChanged(){var t,e;this.graphicsReady?(null===(t=this.gfx.dependencyTracker)||void 0===t||t.growOperationsCount(this.operatorList.fnArray.length),null===(e=this.stepper)||void 0===e||e.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,Ht.A)($d,this,window.requestAnimationFrame(()=>{(0,Ht.A)($d,this,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),eu._.delete(this._canvas),this.callback())))}}var eu={_:new WeakSet};var iu=new WeakMap,nu=new WeakMap,su=new WeakMap,ru=new WeakMap,au=new WeakMap,ou=new WeakMap,lu=new WeakMap,cu=new WeakMap,hu=new WeakMap,du=new WeakMap,uu=new WeakSet;class pu{static get _keyboardManager(){return Fe(this,"_keyboardManager",new gn([[["Escape","mac+Escape"],pu.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],pu.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],pu.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],pu.prototype._moveToPrevious],[["Home","mac+Home"],pu.prototype._moveToBeginning],[["End","mac+End"],pu.prototype._moveToEnd]]))}constructor(t){var e,i;let{editor:n=null,uiManager:s=null}=t;(0,bt.A)(this,uu),(0,yt.A)(this,iu,null),(0,yt.A)(this,nu,null),(0,yt.A)(this,su,void 0),(0,yt.A)(this,ru,null),(0,yt.A)(this,au,!1),(0,yt.A)(this,ou,!1),(0,yt.A)(this,lu,null),(0,yt.A)(this,cu,void 0),(0,yt.A)(this,hu,null),(0,yt.A)(this,du,null),n?((0,Ht.A)(ou,this,!1),(0,Ht.A)(lu,this,n)):(0,Ht.A)(ou,this,!0),(0,Ht.A)(du,this,(null===n||void 0===n?void 0:n._uiManager)||s),(0,Ht.A)(cu,this,(0,zt.A)(du,this)._eventBus),(0,Ht.A)(su,this,(null===n||void 0===n||null===(e=n.color)||void 0===e?void 0:e.toUpperCase())||(null===(i=(0,zt.A)(du,this))||void 0===i?void 0:i.highlightColors.values().next().value)||"#FFFF98"),bu._||(bu._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const t=(0,Ht.A)(iu,this,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",(0,zt.A)(lu,this)&&(t.ariaControls="".concat((0,zt.A)(lu,this).id,"_colorpicker_dropdown"));const e=(0,zt.A)(du,this)._signal;t.addEventListener("click",(0,_t.A)(uu,this,mu).bind(this),{signal:e}),t.addEventListener("keydown",(0,_t.A)(uu,this,gu).bind(this),{signal:e});const i=(0,Ht.A)(nu,this,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=(0,zt.A)(su,this),t.append(i),t}renderMainDropdown(){const t=(0,Ht.A)(ru,this,(0,_t.A)(uu,this,Au).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===(0,zt.A)(iu,this))return void(0,_t.A)(uu,this,mu).call(this,t);const e=t.target.getAttribute("data-color");e&&(0,_t.A)(uu,this,fu).call(this,e,t)}_moveToNext(t){var e,i;xt(uu,this,wu)?t.target!==(0,zt.A)(iu,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=(0,zt.A)(ru,this).firstChild)||void 0===i||i.focus():(0,_t.A)(uu,this,mu).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=(0,zt.A)(ru,this))||void 0===e?void 0:e.firstChild)&&t.target!==(0,zt.A)(iu,this)?(xt(uu,this,wu)||(0,_t.A)(uu,this,mu).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):xt(uu,this,wu)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;xt(uu,this,wu)?null===(e=(0,zt.A)(ru,this).firstChild)||void 0===e||e.focus():(0,_t.A)(uu,this,mu).call(this,t)}_moveToEnd(t){var e;xt(uu,this,wu)?null===(e=(0,zt.A)(ru,this).lastChild)||void 0===e||e.focus():(0,_t.A)(uu,this,mu).call(this,t)}hideDropdown(){var t,e;null===(t=(0,zt.A)(ru,this))||void 0===t||t.classList.add("hidden"),(0,zt.A)(iu,this).ariaExpanded="false",null===(e=(0,zt.A)(hu,this))||void 0===e||e.abort(),(0,Ht.A)(hu,this,null)}_hideDropdownFromKeyboard(){var t;(0,zt.A)(ou,this)||(xt(uu,this,wu)?(this.hideDropdown(),(0,zt.A)(iu,this).focus({preventScroll:!0,focusVisible:(0,zt.A)(au,this)})):null===(t=(0,zt.A)(lu,this))||void 0===t||t.unselect())}updateColor(t){if((0,zt.A)(nu,this)&&((0,zt.A)(nu,this).style.backgroundColor=t),!(0,zt.A)(ru,this))return;const e=(0,zt.A)(du,this).highlightColors.values();for(const i of(0,zt.A)(ru,this).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;null===(t=(0,zt.A)(iu,this))||void 0===t||t.remove(),(0,Ht.A)(iu,this,null),(0,Ht.A)(nu,this,null),null===(e=(0,zt.A)(ru,this))||void 0===e||e.remove(),(0,Ht.A)(ru,this,null)}}function Au(){const t=document.createElement("div"),e=(0,zt.A)(du,this)._signal;t.addEventListener("contextmenu",pi,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),(0,zt.A)(lu,this)&&(t.id="".concat((0,zt.A)(lu,this).id,"_colorpicker_dropdown"));for(const[i,n]of(0,zt.A)(du,this).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",bu._[i]);const r=document.createElement("span");s.append(r),r.className="swatch",r.style.backgroundColor=n,s.ariaSelected=n===(0,zt.A)(su,this),s.addEventListener("click",(0,_t.A)(uu,this,fu).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",(0,_t.A)(uu,this,gu).bind(this),{signal:e}),t}function fu(t,e){e.stopPropagation(),(0,zt.A)(cu,this).dispatch("switchannotationeditorparams",{source:this,type:ae.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}function gu(t){Nt._keyboardManager.exec(this,t)}function mu(t){if(xt(uu,this,wu))return void this.hideDropdown();if((0,Ht.A)(au,this,0===t.detail),(0,zt.A)(hu,this)||((0,Ht.A)(hu,this,new AbortController),window.addEventListener("pointerdown",(0,_t.A)(uu,this,vu).bind(this),{signal:(0,zt.A)(du,this).combinedSignal((0,zt.A)(hu,this))})),(0,zt.A)(iu,this).ariaExpanded="true",(0,zt.A)(ru,this))return void(0,zt.A)(ru,this).classList.remove("hidden");const e=(0,Ht.A)(ru,this,(0,_t.A)(uu,this,Au).call(this));(0,zt.A)(iu,this).append(e)}function vu(t){var e;null!==(e=(0,zt.A)(ru,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function wu(t){return(0,zt.A)(ru,t)&&!(0,zt.A)(ru,t).classList.contains("hidden")}Nt=pu;var bu={_:null},yu=new WeakMap,_u=new WeakMap,xu=new WeakMap;class Eu{constructor(t){(0,yt.A)(this,yu,null),(0,yt.A)(this,_u,null),(0,yt.A)(this,xu,null),(0,Ht.A)(_u,this,t),(0,Ht.A)(xu,this,t._uiManager),Su._||(Su._=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if((0,zt.A)(yu,this))return(0,zt.A)(yu,this);const{editorType:t,colorType:e,colorValue:i}=(0,zt.A)(_u,this),n=(0,Ht.A)(yu,this,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",Su._[t]),n.addEventListener("input",()=>{(0,zt.A)(xu,this).updateParams(e,n.value)},{signal:(0,zt.A)(xu,this)._signal}),n}update(t){(0,zt.A)(yu,this)&&((0,zt.A)(yu,this).value=t)}destroy(){var t;null===(t=(0,zt.A)(yu,this))||void 0===t||t.remove(),(0,Ht.A)(yu,this,null)}hideDropdown(){}}var Su={_:null};function ku(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Cu(t){return Math.max(0,Math.min(255,255*t))}class Mu{static CMYK_G(t){let[e,i,n,s]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+s)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=Cu(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=ku(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_rgb(t){return t.map(Cu)}static RGB_HTML(t){return"#".concat(t.map(ku).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,n,s]=t;return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,i+s)]}static CMYK_rgb(t){let[e,i,n,s]=t;return[Cu(1-Math.min(1,e+s)),Cu(1-Math.min(1,n+s)),Cu(1-Math.min(1,i+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const s=1-e,r=1-i,a=1-n;return["CMYK",s,r,a,Math.min(s,r,a)]}}class Tu{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width","".concat(t,"px")),n.setAttribute("height","".concat(e,"px"))),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),n}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){De("Abstract method `_createSVG` called.")}}class Pu extends Tu{_createSVG(t){return document.createElementNS(si,t)}}const Du=new WeakSet,Ru=60*(new Date).getTimezoneOffset()*1e3;class Lu{static create(t){switch(t.data.annotationType){case Ae.LINK:return new zu(t);case Ae.TEXT:return new qu(t);case Ae.WIDGET:switch(t.data.fieldType){case"Tx":return new Yu(t);case"Btn":return t.data.radioButton?new Ju(t):t.data.checkBox?new Qu(t):new Zu(t);case"Ch":return new $u(t);case"Sig":return new Ku(t)}return new Xu(t);case Ae.POPUP:return new ep(t);case Ae.FREETEXT:return new Vp(t);case Ae.LINE:return new qp(t);case Ae.SQUARE:return new Yp(t);case Ae.CIRCLE:return new Qp(t);case Ae.POLYLINE:return new Zp(t);case Ae.CARET:return new tA(t);case Ae.INK:return new sA(t);case Ae.POLYGON:return new $p(t);case Ae.HIGHLIGHT:return new aA(t);case Ae.UNDERLINE:return new oA(t);case Ae.SQUIGGLY:return new lA(t);case Ae.STRIKEOUT:return new cA(t);case Ae.STAMP:return new hA(t);case Ae.FILEATTACHMENT:return new pA(t);default:return new Bu(t)}}}var Iu=new WeakMap,Fu=new WeakMap,Nu=new WeakMap,Ou=new WeakSet;class Bu{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,bt.A)(this,Ou),(0,yt.A)(this,Iu,null),(0,yt.A)(this,Fu,!1),(0,yt.A)(this,Nu,null),this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData(t){let{contentsObj:e,richText:i}=t;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Bu._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var t;const{data:e}=this,i=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(e.id);return i?i.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var t;const e=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:i,inkLists:n,rect:s}=this.data;let r=-1/0,a=-1/0;if((null===i||void 0===i?void 0:i.length)>=8){for(let t=0;t<i.length;t+=8)i[t+1]>a?(a=i[t+1],r=i[t+2]):i[t+1]===a&&(r=Math.max(r,i[t+2]));return[r,a]}if((null===n||void 0===n?void 0:n.length)>=1){for(const t of n)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>a?(a=t[e+1],r=t[e]):t[e+1]===a&&(r=Math.max(r,t[e]));if(r!==1/0)return[r,a]}return s?[s[2],s[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:r}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/i,t[1]=100*(t[1]-r)/n,t}get commentText(){var t,e;const{data:i}=this;return(null===(t=this.annotationStorage.getRawValue("".concat(se).concat(i.id)))||void 0===t||null===(t=t.popup)||void 0===t?void 0:t.contents)||(null===(e=i.contentsObj)||void 0===e?void 0:e.str)||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue("".concat(se).concat(e.id),{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;null===(t=(null===(e=(0,zt.A)(Nu,this))||void 0===e?void 0:e.popup)||this.popup)||void 0===t||t.remove(),(0,Ht.A)(Nu,this,this.popup=null)}updateEdited(t){var e;if(!this.container)return;t.rect&&((0,zt.A)(Iu,this)||(0,Ht.A)(Iu,this,{rect:this.data.rect.slice(0)}));const{rect:i,popup:n}=t;i&&(0,_t.A)(Ou,this,Wu).call(this,i);let s=(null===(e=(0,zt.A)(Nu,this))||void 0===e?void 0:e.popup)||this.popup;!s&&null!==n&&void 0!==n&&n.text&&(this._createPopup(n),s=(0,zt.A)(Nu,this).popup),s&&(s.updateEdited(t),null!==n&&void 0!==n&&n.deleted&&(s.remove(),(0,Ht.A)(Nu,this,null),this.popup=null))}resetEdited(){var t;(0,zt.A)(Iu,this)&&((0,_t.A)(Ou,this,Wu).call(this,(0,zt.A)(Iu,this).rect),null===(t=(0,zt.A)(Nu,this))||void 0===t||t.popup.resetEdited(),(0,Ht.A)(Iu,this,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof Xu||this instanceof zu||(s.tabIndex=0);const{style:r}=s;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof ep){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,s),s}const{width:a,height:o}=this;if(!t&&e.borderStyle.width>0){r.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--total-scale-factor)) / calc(").concat(i,"px * var(--total-scale-factor))");r.borderRadius=e}else if(this instanceof Ju){const t="calc(".concat(a,"px * var(--total-scale-factor)) / calc(").concat(o,"px * var(--total-scale-factor))");r.borderRadius=t}switch(e.borderStyle.style){case fe:r.borderStyle="solid";break;case ge:r.borderStyle="dashed";break;case me:Pe("Unimplemented border style: beveled");break;case ve:Pe("Unimplemented border style: inset");break;case we:r.borderBottomStyle="solid"}const n=e.borderColor||null;n?((0,Ht.A)(Fu,this,!0),r.borderColor=Xe.makeHexColor(0|n[0],0|n[1],0|n[2])):r.borderWidth=0}const l=Xe.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:h,pageX:d,pageY:u}=n.rawDims;r.left="".concat(100*(l[0]-d)/c,"%"),r.top="".concat(100*(l[1]-u)/h,"%");const{rotation:p}=e;return e.hasOwnCanvas||0===p?(r.width="".concat(100*a/c,"%"),r.height="".concat(100*o/h,"%")):this.setRotation(p,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims;let{width:s,height:r}=this;t%180!==0&&([s,r]=[r,s]),e.style.width="".concat(100*s/i,"%"),e.style.height="".concat(100*r/n,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t],s=n[0],r=n.slice(1);i.target.style[e]=Mu["".concat(s,"_HTML")](r),this.annotationStorage.setValue(this.data.id,{[e]:Mu["".concat(s,"_rgb")](r)})};return Fe(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const s=t[n]||i[n];null===s||void 0===s||s(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,s]of Object.entries(e)){const r=i[n];if(r){r({detail:{[n]:s},target:t}),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,s]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[r,a,o,l]=t.subarray(2,6);if(n===r&&s===a&&e===o&&i===l)return}const{style:r}=this.container;let a;if((0,zt.A)(Fu,this)){const{borderColor:t,borderWidth:e}=r;r.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">','<g fill="transparent" stroke="'.concat(t,'" stroke-width="').concat(e,'">')],this.container.classList.add("hasBorder")}const o=n-e,l=s-i,{svgFactory:c}=this,h=c.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const d=c.createElement("defs");h.append(d);const u=c.createElement("clipPath"),p="clippath_".concat(this.data.id);u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let f=2,g=t.length;f<g;f+=8){var A;const i=t[f],n=t[f+1],r=t[f+2],h=t[f+3],d=c.createElement("rect"),p=(r-e)/o,g=(s-n)/l,m=(i-r)/o,v=(n-h)/l;d.setAttribute("x",p),d.setAttribute("y",g),d.setAttribute("width",m),d.setAttribute("height",v),u.append(d),null===(A=a)||void 0===A||A.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(g,'" width="').concat(m,'" height="').concat(v,'"/>'))}(0,zt.A)(Fu,this)&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(h),this.container.style.clipPath="url(#".concat(p,")")}_createPopup(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const{data:e}=this;let i,n;t?(i={str:t.text},n=t.date):(i=e.contentsObj,n=e.modificationDate);const s=(0,Ht.A)(Nu,this,new ep({data:{color:e.color,titleObj:e.titleObj,modificationDate:n,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(s.render())}get hasPopupElement(){return!!((0,zt.A)(Nu,this)||this.popup||this.data.popupRef)}get extraPopupElement(){return(0,zt.A)(Nu,this)}render(){De("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:s,exportValues:r}of n){if(-1===t)continue;if(s===e)continue;const n="string"===typeof r?r:null,a=document.querySelector('[data-element-id="'.concat(s,'"]'));!a||Du.has(a)?i.push({id:s,exportValue:n,domElement:a}):Pe("_getElementsByName - element not allowed: ".concat(s))}return i}for(const n of document.getElementsByName(t)){const{exportValue:t}=n,s=n.getAttribute("data-element-id");s!==e&&(Du.has(n)&&i.push({id:s,exportValue:t,domElement:n}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}function Wu(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:r,pageX:a,pageY:o}}}}=this;null===i||void 0===i||i.splice(0,4,...t),e.left="".concat(100*(t[0]-a)/s,"%"),e.top="".concat(100*(r-t[3]+o)/r,"%"),0===n?(e.width="".concat(100*(t[2]-t[0])/s,"%"),e.height="".concat(100*(t[3]-t[1])/r,"%")):this.setRotation(n)}class ju extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}var Uu=new WeakSet;class zu extends Bu{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),(0,bt.A)(this,Uu),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?((0,_t.A)(Uu,this,Vu).call(this,i,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?((0,_t.A)(Uu,this,Gu).call(this,i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,_t.A)(Uu,this,Hu).call(this),i&&(t.title=i)}_bindNamedAction(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),(0,_t.A)(Uu,this,Hu).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const s=i.get(n);s&&(t[s]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1})}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),(0,_t.A)(Uu,this,Hu).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,_t.A)(Uu,this,Hu).call(this),!this._fieldObjects)return Pe('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const{fields:t,refs:n,include:s}=e,r=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&r.push(i)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const a=this.annotationStorage,o=[];for(const e of r){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";a.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;a.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";a.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(Du.has(i)?i.dispatchEvent(new Event("resetform")):Pe("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}));return!1}}}function Hu(){this.container.setAttribute("data-internal-link","")}function Vu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,n),!1},(0,_t.A)(Uu,this,Hu).call(this)}function Gu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),(0,_t.A)(Uu,this,Hu).call(this)}class qu extends Bu{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class Xu extends Bu{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Ge.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var r;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&(null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t)}}))})}_setEventListeners(t,e,i,n){for(const[o,l]of i){var s,r,a;if("Action"===l||null!==(s=this.data.actions)&&void 0!==s&&s[l])"Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,o,l,n),"Focus"!==l||null!==(r=this.data.actions)&&void 0!==r&&r.Blur?"Blur"!==l||null!==(a=this.data.actions)&&void 0!==a&&a.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Xe.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,s=t.style;let r;const a=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(Yt*n))||1);r=Math.min(n,a(e/Yt))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(n,a(t/Yt))}s.fontSize="calc(".concat(r,"px * var(--total-scale-factor))"),s.color=Xe.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Yu extends Xu{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=i),s.setValue(r.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var n;const r=t.getValue(e,{value:this.data.fieldValue});let a=r.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&a.length>o&&(a=a.slice(0,o));let l=r.formattedValue||(null===(n=this.data.textContent)||void 0===n?void 0:n.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const c={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=null!==l&&void 0!==l?l:a,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",null!==l&&void 0!==l?l:a),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Du.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:h,datetimeType:d,timeStep:u}=this.data,p=!!d&&this.enableScripting;h&&(i.title=h),this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",t=>{var e;const n=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=c.userValue=n,c.formattedValue=null});let A=t=>{const{formattedValue:e}=c;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var s;i.addEventListener("focus",t=>{var e;if(c.focused)return;const{target:i}=t;if(p&&(i.type=d,u&&(i.step=u)),c.userValue){const t=c.userValue;if(p)if("time"===d){const e=new Date(t),n=[e.getHours(),e.getMinutes(),e.getSeconds()];i.value=n.map(t=>t.toString().padStart(2,"0")).join(":")}else i.value=new Date(t-Ru).toISOString().split("date"===d?"T":".",1)[0];else i.value=t}c.lastCommittedValue=i.value,c.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(c.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);const n={value(i){var n;c.userValue=null!==(n=i.detail.value)&&void 0!==n?n:"",p||t.setValue(e,{value:c.userValue.toString()}),i.target.value=c.userValue},formattedValue(i){const{formattedValue:n}=i.detail;c.formattedValue=n,null!==n&&void 0!==n&&i.target!==document.activeElement&&(i.target.value=n);const s={formattedValue:n};p&&(s.value=n),t.setValue(e,s)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var n;const{charLimit:s}=i.detail,{target:r}=i;if(0===s)return void r.removeAttribute("maxLength");r.setAttribute("maxLength",s);let a=c.userValue;!a||a.length<=s||(a=a.slice(0,s),r.value=c.userValue=a,t.setValue(e,{value:a}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)}),i.addEventListener("keydown",t=>{var i;c.commitKey=1;let n=-1;if("Escape"===t.key?n=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(c.commitKey=3):n=2,-1===n)return;const{value:s}=t.target;c.lastCommittedValue!==s&&(c.lastCommittedValue=s,c.userValue=s,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const n=A;A=null,i.addEventListener("blur",t=>{var i;if(!c.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(c.focused=!1);const{target:s}=t;let{value:r}=s;if(p){if(r&&"time"===d){const t=r.split(":").map(t=>parseInt(t,10));r=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),s.step=""}else r.includes("T")||(r="".concat(r,"T00:00")),r=new Date(r).valueOf();s.type="text"}var a;(c.userValue=r,c.lastCommittedValue!==r)&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:c.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));n(t)}),null!==(s=this.data.actions)&&void 0!==s&&s.Keystroke&&i.addEventListener("beforeinput",t=>{var i;c.lastCommittedValue=null;const{data:n,target:s}=t,{value:r,selectionStart:a,selectionEnd:o}=s;let l=a,h=o;switch(t.inputType){case"deleteWordBackward":{const t=r.substring(0,a).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=r.substring(a).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":a===o&&(l-=1);break;case"deleteContentForward":a===o&&(h+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,change:n||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(A&&i.addEventListener("blur",A),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--total-scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Ku extends Xu{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Qu extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return Du.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",n=>{const{name:s,checked:r}=n.target;for(const a of this._getElementsByName(s,i)){const i=r&&a.exportValue===e.exportValue;a.domElement&&(a.domElement.checked=i),t.setValue(a.id,{value:i})}t.setValue(i,{value:r})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",e=>{const n={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ju extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});const s=document.createElement("input");if(Du.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",e=>{const{name:n,checked:s}=e.target;for(const r of this._getElementsByName(n,i))t.setValue(r.id,{value:!1});t.setValue(i,{value:s})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;s.addEventListener("updatefromsandbox",e=>{const s={value:e=>{const s=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=s&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}};this._dispatchEventFromSandbox(s,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Zu extends zu{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class $u extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");Du.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const i of n.options)i.selected=i.value===e});for(const c of this.data.options){const t=document.createElement("option");t.textContent=c.displayValue,t.value=c.exportValue,i.value.includes(c.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let r=null;if(s){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),r=()=>{t.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=t=>{const e=t?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=a(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",i=>{const s={value(i){var s;null===(s=r)||void 0===s||s();const l=i.detail.value,c=new Set(Array.isArray(l)?l:[l]);for(const t of n.options)t.selected=c.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){n.multiple=!0},remove(i){const s=n.options,r=i.detail.remove;if(s[r].selected=!1,n.remove(r),s.length>0){-1===Array.prototype.findIndex.call(s,t=>t.selected)&&(s[0].selected=!0)}t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){const{index:s,displayValue:r,exportValue:c}=i.detail.insert,h=n.children[s],d=document.createElement("option");d.textContent=r,d.value=c,h?h.before(d):n.append(d),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of s){const{displayValue:e,exportValue:i}=t,s=document.createElement("option");s.textContent=e,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(s,i)}),n.addEventListener("input",i=>{var n;const s=a(!0),r=a(!1);t.setValue(e,{value:s}),i.preventDefault(),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:r,changeEx:s,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):n.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}var tp=new WeakSet;class ep extends Bu{constructor(t){const{data:e,elements:i,parent:n}=t,s=!!n._commentManager;if(super(t,{isRenderable:!s&&Bu._hasPopupData(e)}),(0,bt.A)(this,tp),this.elements=i,s&&Bu._hasPopupData(e)){const t=this.popup=(0,_t.A)(tp,this,ip).call(this);for(const e of i)e.popup=t}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=(0,_t.A)(tp,this,ip).call(this),i=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>"".concat($e).concat(t)).join(",")),this.container}}function ip(){return new Pp({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}var np=new WeakMap,sp=new WeakMap,rp=new WeakMap,ap=new WeakMap,op=new WeakMap,lp=new WeakMap,cp=new WeakMap,hp=new WeakMap,dp=new WeakMap,up=new WeakMap,pp=new WeakMap,Ap=new WeakMap,fp=new WeakMap,gp=new WeakMap,mp=new WeakMap,vp=new WeakMap,wp=new WeakMap,bp=new WeakMap,yp=new WeakMap,_p=new WeakMap,xp=new WeakMap,Ep=new WeakMap,Sp=new WeakMap,kp=new WeakMap,Cp=new WeakMap,Mp=new WeakMap,Tp=new WeakSet;class Pp{constructor(t){let{container:e,color:i,elements:n,titleObj:s,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:c,parentRect:h,open:d,commentManager:u=null}=t;(0,bt.A)(this,Tp),(0,yt.A)(this,np,null),(0,yt.A)(this,sp,(0,_t.A)(Tp,this,Wp).bind(this)),(0,yt.A)(this,rp,(0,_t.A)(Tp,this,Hp).bind(this)),(0,yt.A)(this,ap,(0,_t.A)(Tp,this,zp).bind(this)),(0,yt.A)(this,op,(0,_t.A)(Tp,this,Up).bind(this)),(0,yt.A)(this,lp,null),(0,yt.A)(this,cp,null),(0,yt.A)(this,hp,null),(0,yt.A)(this,dp,null),(0,yt.A)(this,up,null),(0,yt.A)(this,pp,null),(0,yt.A)(this,Ap,null),(0,yt.A)(this,fp,!1),(0,yt.A)(this,gp,null),(0,yt.A)(this,mp,null),(0,yt.A)(this,vp,null),(0,yt.A)(this,wp,null),(0,yt.A)(this,bp,null),(0,yt.A)(this,yp,null),(0,yt.A)(this,_p,null),(0,yt.A)(this,xp,null),(0,yt.A)(this,Ep,null),(0,yt.A)(this,Sp,null),(0,yt.A)(this,kp,!1),(0,yt.A)(this,Cp,null),(0,yt.A)(this,Mp,null),(0,Ht.A)(cp,this,e),(0,Ht.A)(Ep,this,s),(0,Ht.A)(hp,this,a),(0,Ht.A)(xp,this,o),(0,Ht.A)(pp,this,l),(0,Ht.A)(lp,this,i),(0,Ht.A)(_p,this,c),(0,Ht.A)(Ap,this,h),(0,Ht.A)(up,this,n),(0,Ht.A)(np,this,u),(0,Ht.A)(Cp,this,n[0]),(0,Ht.A)(dp,this,fi.toDateObject(r)),this.trigger=n.flatMap(t=>t.getElementsToTriggerPopup()),u?this.renderCommentButton():((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(cp,this).hidden=!0,d&&(0,_t.A)(Tp,this,Up).call(this))}renderCommentButton(){if((0,zt.A)(wp,this))return;if((0,zt.A)(bp,this)||(0,_t.A)(Tp,this,Rp).call(this),!(0,zt.A)(bp,this))return;const{signal:t}=(0,Ht.A)(mp,this,new AbortController),e=!!(0,zt.A)(Cp,this).extraPopupElement,i=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!1,!0,!e)},s=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!1,!1)};if(e){(0,Ht.A)(wp,this,(0,zt.A)(Cp,this).container);for(const e of this.trigger)e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),e.classList.add("popupTriggerArea")}else{const e=(0,Ht.A)(wp,this,document.createElement("button"));e.className="annotationCommentButton";const r=(0,zt.A)(Cp,this).container;e.style.zIndex=r.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),(0,_t.A)(Tp,this,Ip).call(this),(0,_t.A)(Tp,this,Lp).call(this),e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),r.after(e)}}get commentButtonColor(){const{color:t,opacity:e}=(0,zt.A)(Cp,this).commentData;return t?(0,zt.A)(pp,this)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;null===(t=(0,zt.A)(wp,this))||void 0===t||t.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=(0,zt.A)(Cp,this).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return(0,zt.A)(wp,this)}get comment(){return(0,zt.A)(Mp,this)||(0,Ht.A)(Mp,this,(0,zt.A)(Cp,this).commentText),(0,zt.A)(Mp,this)}set comment(t){t!==this.comment&&((0,zt.A)(Cp,this).commentText=(0,Ht.A)(Mp,this,t))}get parentBoundingClientRect(){return(0,zt.A)(Cp,this).layer.getBoundingClientRect()}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;(0,zt.A)(wp,this)&&((0,zt.A)(wp,this).classList.toggle("selected",e),(0,zt.A)(wp,this).ariaExpanded=i)}setSelectedCommentButton(t){(0,zt.A)(wp,this).classList.toggle("selected",t)}get commentPopupPosition(){if((0,zt.A)(yp,this))return(0,zt.A)(yp,this);const{x:t,y:e,height:i}=(0,zt.A)(wp,this).getBoundingClientRect(),{x:n,y:s,width:r,height:a}=(0,zt.A)(Cp,this).layer.getBoundingClientRect();return[(t-n)/r,(e+i-s)/a]}set commentPopupPosition(t){(0,Ht.A)(yp,this,t)}hasDefaultPopupPosition(){return null===(0,zt.A)(yp,this)}get commentButtonPosition(){return(0,zt.A)(bp,this)}get commentButtonWidth(){return(0,zt.A)(wp,this).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=(0,zt.A)(yp,this)||this.commentButtonPosition.map(t=>t/100),n=this.parentBoundingClientRect,{x:s,y:r,width:a,height:o}=n;(0,zt.A)(np,this).showDialog(null,this,s+e*a,r+i*o,(0,wt.A)((0,wt.A)({},t),{},{parentDimensions:n}))}render(){var t,e;if((0,zt.A)(gp,this))return;const i=(0,Ht.A)(gp,this,document.createElement("div"));if(i.className="popup",(0,zt.A)(lp,this)){const t=i.style.outlineColor=Xe.makeHexColor(...(0,zt.A)(lp,this));i.style.backgroundColor="color-mix(in srgb, ".concat(t," 30%, white)")}const n=document.createElement("span");if(n.className="header",null!==(t=(0,zt.A)(Ep,this))&&void 0!==t&&t.str){const t=document.createElement("span");t.className="title",n.append(t),({dir:t.dir,str:t.textContent}=(0,zt.A)(Ep,this))}if(i.append(n),(0,zt.A)(dp,this)){const t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:(0,zt.A)(dp,this).valueOf()})),t.dateTime=(0,zt.A)(dp,this).toISOString(),n.append(t)}Ti({html:xt(Tp,this,Fp)||(0,zt.A)(hp,this).str,dir:null===(e=(0,zt.A)(hp,this))||void 0===e?void 0:e.dir,className:"popupContent"},i),(0,zt.A)(cp,this).append(i)}updateEdited(t){var e;let{rect:i,popup:n,deleted:s}=t;if((0,zt.A)(np,this))return s?(this.remove(),(0,Ht.A)(Mp,this,null)):n&&(n.deleted?this.remove():((0,_t.A)(Tp,this,Ip).call(this),(0,Ht.A)(Mp,this,n.text))),void(i&&((0,Ht.A)(bp,this,null),(0,_t.A)(Tp,this,Rp).call(this),(0,_t.A)(Tp,this,Lp).call(this)));s||null!==n&&void 0!==n&&n.deleted?this.remove():((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(Sp,this)||(0,Ht.A)(Sp,this,{contentsObj:(0,zt.A)(hp,this),richText:(0,zt.A)(xp,this)}),i&&(0,Ht.A)(vp,this,null),n&&n.text&&((0,Ht.A)(xp,this,(0,_t.A)(Tp,this,Bp).call(this,n.text)),(0,Ht.A)(dp,this,fi.toDateObject(n.date)),(0,Ht.A)(hp,this,null)),null===(e=(0,zt.A)(gp,this))||void 0===e||e.remove(),(0,Ht.A)(gp,this,null))}resetEdited(){var t;(0,zt.A)(Sp,this)&&(({contentsObj:vt(Ht.A,[hp,this])._,richText:vt(Ht.A,[xp,this])._}=(0,zt.A)(Sp,this)),(0,Ht.A)(Sp,this,null),null===(t=(0,zt.A)(gp,this))||void 0===t||t.remove(),(0,Ht.A)(gp,this,null),(0,Ht.A)(vp,this,null))}remove(){var t,e,i;if(null===(t=(0,zt.A)(mp,this))||void 0===t||t.abort(),(0,Ht.A)(mp,this,null),null===(e=(0,zt.A)(gp,this))||void 0===e||e.remove(),(0,Ht.A)(gp,this,null),(0,Ht.A)(kp,this,!1),(0,Ht.A)(fp,this,!1),null===(i=(0,zt.A)(wp,this))||void 0===i||i.remove(),(0,Ht.A)(wp,this,null),this.trigger)for(const n of this.trigger)n.classList.remove("popupTriggerArea")}forceHide(){(0,Ht.A)(kp,this,this.isVisible),(0,zt.A)(kp,this)&&((0,zt.A)(cp,this).hidden=!0)}maybeShow(){(0,zt.A)(np,this)||((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(kp,this)&&((0,zt.A)(gp,this)||(0,_t.A)(Tp,this,zp).call(this),(0,Ht.A)(kp,this,!1),(0,zt.A)(cp,this).hidden=!1))}get isVisible(){return!(0,zt.A)(np,this)&&!1===(0,zt.A)(cp,this).hidden}}function Dp(){if((0,zt.A)(mp,this))return;(0,Ht.A)(mp,this,new AbortController);const{signal:t}=(0,zt.A)(mp,this);for(const i of this.trigger)i.addEventListener("click",(0,zt.A)(op,this),{signal:t}),i.addEventListener("pointerenter",(0,zt.A)(ap,this),{signal:t}),i.addEventListener("pointerleave",(0,zt.A)(rp,this),{signal:t}),i.classList.add("popupTriggerArea");for(const i of(0,zt.A)(up,this)){var e;null===(e=i.container)||void 0===e||e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t})}}function Rp(){const t=(0,zt.A)(up,this).find(t=>t.hasCommentButton);t&&(0,Ht.A)(bp,this,t._normalizePoint(t.commentButtonPosition))}function Lp(){if((0,zt.A)(Cp,this).extraPopupElement&&!(0,zt.A)(Cp,this).editor)return;this.renderCommentButton();const[t,e]=(0,zt.A)(bp,this),{style:i}=(0,zt.A)(wp,this);i.left="calc(".concat(t,"%)"),i.top="calc(".concat(e,"% - var(--comment-button-dim))")}function Ip(){(0,zt.A)(Cp,this).extraPopupElement||(this.renderCommentButton(),(0,zt.A)(wp,this).style.backgroundColor=this.commentButtonColor||"")}function Fp(t){const e=(0,zt.A)(xp,t),i=(0,zt.A)(hp,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:(0,zt.A)(xp,t).html||null}function Np(t){var e;return(null===(e=xt(Tp,t,Fp))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function Op(t){var e;return(null===(e=xt(Tp,t,Fp))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function Bp(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:xt(Tp,this,Op),fontSize:xt(Tp,this,Np)?"calc(".concat(xt(Tp,this,Np),"px * var(--total-scale-factor))"):""}};for(const s of t.split("\n"))e.push({name:"span",value:s,attributes:n});return i}function Wp(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&(0,zt.A)(fp,this))&&(0,_t.A)(Tp,this,Up).call(this)}function jp(){if(null!==(0,zt.A)(vp,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=(0,zt.A)(pp,this);let r=!!(0,zt.A)(Ap,this),a=r?(0,zt.A)(Ap,this):(0,zt.A)(_p,this);for(const u of(0,zt.A)(up,this))if(!a||null!==Xe.intersect(u.data.rect,a)){a=u.data.rect,r=!0;break}const o=Xe.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=r?a[2]-a[0]+5:0,c=o[0]+l,h=o[1];(0,Ht.A)(vp,this,[100*(c-n)/e,100*(h-s)/i]);const{style:d}=(0,zt.A)(cp,this);d.left="".concat((0,zt.A)(vp,this)[0],"%"),d.top="".concat((0,zt.A)(vp,this)[1],"%")}function Up(){(0,zt.A)(np,this)?(0,zt.A)(np,this).toggleCommentPopup(this,!1):((0,Ht.A)(fp,this,!(0,zt.A)(fp,this)),(0,zt.A)(fp,this)?((0,_t.A)(Tp,this,zp).call(this),(0,zt.A)(cp,this).addEventListener("click",(0,zt.A)(op,this)),(0,zt.A)(cp,this).addEventListener("keydown",(0,zt.A)(sp,this))):((0,_t.A)(Tp,this,Hp).call(this),(0,zt.A)(cp,this).removeEventListener("click",(0,zt.A)(op,this)),(0,zt.A)(cp,this).removeEventListener("keydown",(0,zt.A)(sp,this))))}function zp(){(0,zt.A)(gp,this)||this.render(),this.isVisible?(0,zt.A)(fp,this)&&(0,zt.A)(cp,this).classList.add("focused"):((0,_t.A)(Tp,this,jp).call(this),(0,zt.A)(cp,this).hidden=!1,(0,zt.A)(cp,this).style.zIndex=parseInt((0,zt.A)(cp,this).style.zIndex)+1e3)}function Hp(){(0,zt.A)(cp,this).classList.remove("focused"),!(0,zt.A)(fp,this)&&this.isVisible&&((0,zt.A)(cp,this).hidden=!0,(0,zt.A)(cp,this).style.zIndex=parseInt((0,zt.A)(cp,this).style.zIndex)-1e3)}class Vp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=re.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Gp=new WeakMap;class qp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Gp,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=(0,Ht.A)(Gp,this,this.svgFactory.createElement("svg:line"));return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Gp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Xp=new WeakMap;class Yp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Xp,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=(0,Ht.A)(Xp,this,this.svgFactory.createElement("svg:rect"));return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",e-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Xp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Kp=new WeakMap;class Qp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Kp,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=(0,Ht.A)(Kp,this,this.svgFactory.createElement("svg:ellipse"));return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Kp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Jp=new WeakMap;class Zp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Jp,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n},width:s,height:r}=this;if(!e)return this.container;const a=this.svgFactory.create(s,r,!0);let o=[];for(let c=0,h=e.length;c<h;c+=2){const i=e[c]-t[0],n=t[3]-e[c+1];o.push("".concat(i,",").concat(n))}o=o.join(" ");const l=(0,Ht.A)(Jp,this,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Jp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class $p extends Zp{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class tA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var eA=new WeakMap,iA=new WeakMap,nA=new WeakSet;class sA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,bt.A)(this,nA),(0,yt.A)(this,eA,null),(0,yt.A)(this,iA,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?re.HIGHLIGHT:re.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:e,inkLists:i,borderStyle:n,popupRef:s}}=this,{transform:r,width:a,height:o}=(0,_t.A)(nA,this,rA).call(this,e,t),l=this.svgFactory.create(a,o,!0),c=(0,Ht.A)(eA,this,this.svgFactory.createElement("svg:g"));l.append(c),c.setAttribute("stroke-width",n.width||1),c.setAttribute("stroke-linecap","round"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit",10),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),c.setAttribute("transform",r);for(let h=0,d=i.length;h<d;h++){const t=this.svgFactory.createElement(this.svgElementName);(0,zt.A)(iA,this).push(t),t.setAttribute("points",i[h].join(",")),c.append(t)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:e,points:i,rect:n}=t,s=(0,zt.A)(eA,this);if(e>=0&&s.setAttribute("stroke-width",e||1),i)for(let r=0,a=(0,zt.A)(iA,this).length;r<a;r++)(0,zt.A)(iA,this)[r].setAttribute("points",i[r].join(","));if(n){const{transform:t,width:e,height:i}=(0,_t.A)(nA,this,rA).call(this,this.data.rotation,n);s.parentElement.setAttribute("viewBox","0 0 ".concat(e," ").concat(i)),s.setAttribute("transform",t)}}getElementsToTriggerPopup(){return(0,zt.A)(iA,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function rA(t,e){switch(t){case 90:return{transform:"rotate(90) translate(".concat(-e[0],",").concat(e[1],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:"rotate(180) translate(".concat(-e[2],",").concat(e[1],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:"rotate(270) translate(".concat(-e[2],",").concat(e[3],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:"translate(".concat(-e[0],",").concat(e[3],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]}}}class aA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=re.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class oA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class lA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class cA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class hA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=re.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var dA=new WeakMap,uA=new WeakSet;class pA extends Bu{constructor(t){var e;super(t,{isRenderable:!0}),(0,bt.A)(this,uA),(0,yt.A)(this,dA,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",(0,wt.A)({source:this},i))}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(e.name)?"paperclip":"pushpin",".svg"),e.fillAlpha&&e.fillAlpha<1&&(i.style="filter: opacity(".concat(Math.round(100*e.fillAlpha),"%);"))),i.addEventListener("dblclick",(0,_t.A)(uA,this,AA).bind(this)),(0,Ht.A)(dA,this,i);const{isMac:n}=Ge.platform;return t.addEventListener("keydown",t=>{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&(0,_t.A)(uA,this,AA).call(this)}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return(0,zt.A)(dA,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function AA(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var fA=new WeakMap,gA=new WeakMap,mA=new WeakMap,vA=new WeakMap,wA=new WeakMap,bA=new WeakMap,yA=new WeakSet;class _A{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:n,annotationEditorUIManager:s,page:r,viewport:a,structTreeLayer:o,commentManager:l,linkService:c,annotationStorage:h}=t;(0,bt.A)(this,yA),(0,yt.A)(this,fA,null),(0,yt.A)(this,gA,null),(0,yt.A)(this,mA,null),(0,yt.A)(this,vA,new Map),(0,yt.A)(this,wA,null),(0,yt.A)(this,bA,null),this.div=e,(0,Ht.A)(fA,this,i),(0,Ht.A)(gA,this,n),(0,Ht.A)(wA,this,o||null),(0,Ht.A)(bA,this,c||null),(0,Ht.A)(mA,this,h||new Ia),this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return(0,zt.A)(vA,this).size>0}async render(t){const{annotations:e}=t,i=this.div;bi(i,this.viewport);const n=new Map,s={data:null,layer:i,linkService:(0,zt.A)(bA,this),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Pu,annotationStorage:(0,zt.A)(mA,this),enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){var r;if(o.noHTML)continue;const t=o.annotationType===Ae.POPUP;if(t){const t=n.get(o.id);if(!t)continue;s.elements=t}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;s.data=o;const e=Lu.create(s);if(!e.isRenderable)continue;if(!t&&o.popupRef){const t=n.get(o.popupRef);t?t.push(e):n.set(o.popupRef,[e])}const i=e.render();var a;if(o.hidden&&(i.style.visibility="hidden"),await(0,_t.A)(yA,this,xA).call(this,i,o.id,s.elements),null===(r=e.extraPopupElement)||void 0===r||null===(r=r.popup)||void 0===r||r.renderCommentButton(),e._isEditable)(0,zt.A)(vA,this).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}(0,_t.A)(yA,this,EA).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:(0,zt.A)(bA,this),svgFactory:new Pu,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=_A._defaultBorderStyle),e.data=i;const t=Lu.create(e);if(!t.isRenderable)continue;const n=t.render();await(0,_t.A)(yA,this,xA).call(this,n,i.id,null)}}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,bi(i,{rotation:e.rotation}),(0,_t.A)(yA,this,EA).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,zt.A)(vA,this).values())}getEditableAnnotation(t){return(0,zt.A)(vA,this).get(t)}addFakeAnnotation(t){var e;const{div:i}=this,{id:n,rotation:s}=t,r=new ju({data:{id:n,rect:t.getPDFRect(),rotation:s},editor:t,layer:i,parent:this,enableComment:!!this._commentManager,linkService:(0,zt.A)(bA,this),annotationStorage:(0,zt.A)(mA,this)}),a=r.render();return i.append(a),null===(e=(0,zt.A)(fA,this))||void 0===e||e.moveElementInDOM(i,a,a,!1),r.createOrUpdatePopup(),r}static get _defaultBorderStyle(){return Fe(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:fe,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}async function xA(t,e,i){var n;const s=t.firstChild||t,r=s.id="".concat($e).concat(e),a=await(null===(n=(0,zt.A)(wA,this))||void 0===n?void 0:n.getAriaAttributes(r));if(a)for(const[l,c]of a)s.setAttribute(l,c);var o;i?i.at(-1).container.after(t):(this.div.append(t),null===(o=(0,zt.A)(fA,this))||void 0===o||o.moveElementInDOM(this.div,t,s,!1))}function EA(){if(!(0,zt.A)(gA,this))return;const t=this.div;for(const[i,n]of(0,zt.A)(gA,this)){const s=t.querySelector('[data-annotation-id="'.concat(i,'"]'));if(!s)continue;n.className="annotationContent";const{firstChild:r}=s;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.classList.contains("annotationContent")?r.after(n):r.before(n):s.append(n);const a=(0,zt.A)(vA,this).get(i);var e;if(a)if(a._hasNoCanvas)null===(e=this._annotationEditorUIManager)||void 0===e||e.setMissingCanvas(i,s.id,n),a._hasNoCanvas=!1;else a.canvas=n}(0,zt.A)(gA,this).clear()}const SA=/\r\n?|\n/g;var kA=new WeakMap,CA=new WeakMap,MA=new WeakMap,TA=new WeakMap,PA=new WeakSet;class DA extends na{static get _keyboardManager(){const t=DA.prototype,e=t=>t.isEmpty(),i=fs.TRANSLATE_SMALL,n=fs.TRANSLATE_BIG;return Fe(this,"_keyboardManager",new gn([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"freeTextEditor"})),(0,bt.A)(this,PA),(0,yt.A)(this,kA,""),(0,yt.A)(this,CA,"".concat(this.id,"-editor")),(0,yt.A)(this,MA,null),(0,yt.A)(this,TA,void 0),(0,Vt.A)(this,"_colorPicker",null),this.color=t.color||DA._defaultColor||na._defaultLineColor,(0,Ht.A)(TA,this,t.fontSize||DA._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(t,e){na.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case ae.FREETEXT_SIZE:DA._defaultFontSize=e;break;case ae.FREETEXT_COLOR:DA._defaultColor=e}}updateParams(t,e){switch(t){case ae.FREETEXT_SIZE:(0,_t.A)(PA,this,RA).call(this,e);break;case ae.FREETEXT_COLOR:(0,_t.A)(PA,this,LA).call(this,e)}}static get defaultPropertiesToUpdate(){return[[ae.FREETEXT_SIZE,DA._defaultFontSize],[ae.FREETEXT_COLOR,DA._defaultColor||na._defaultLineColor]]}get propertiesToUpdate(){return[[ae.FREETEXT_SIZE,(0,zt.A)(TA,this)],[ae.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Eu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ae.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-DA._internalPadding*t,-(DA._internalPadding+(0,zt.A)(TA,this))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,Ht.A)(MA,this,new AbortController);const t=this._uiManager.combinedSignal((0,zt.A)(MA,this));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,zt.A)(CA,this)),this._isDraggable=!0,null===(t=(0,zt.A)(MA,this))||void 0===t||t.abort(),(0,Ht.A)(MA,this,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),null!==(e=this._initialOptions)&&void 0!==e&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=(0,zt.A)(kA,this),e=(0,Ht.A)(kA,this,(0,_t.A)(PA,this,IA).call(this).trimEnd());if(t===e)return;const i=t=>{(0,Ht.A)(kA,this,t),t?((0,_t.A)(PA,this,OA).call(this),this._uiManager.rebuild(this),(0,_t.A)(PA,this,FA).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,_t.A)(PA,this,FA).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){DA._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,zt.A)(CA,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat((0,zt.A)(TA,this),"px * var(--total-scale-factor))"),i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[r,a]=this.getInitialTranslation();[r,a]=this.pageTranslationToScreen(r,a);const[o,l]=this.pageDimensions,[c,h]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(s[0]-c)/o,u=e+this.height-(s[1]-h)/l;break;case 90:d=t+(s[0]-c)/o,u=e-(s[1]-h)/l,[r,a]=[a,-r];break;case 180:d=t-this.width+(s[0]-c)/o,u=e-(s[1]-h)/l,[r,a]=[-r,-a];break;case 270:d=t+(s[0]-c-this.height*l)/o,u=e+(s[1]-h-this.width*o)/l,[r,a]=[-a,r]}this.setAt(d*i,u*n,r,a)}else this._moveAfterPaste(t,e);(0,_t.A)(PA,this,OA).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=WA.call(DA,e.getData("text")||"").replaceAll(SA,"\n");if(!n)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const r=s.getRangeAt(0);if(!n.includes("\n"))return r.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void s.collapseToStart();const{startContainer:a,startOffset:o}=r,l=[],c=[];if(a.nodeType===Node.TEXT_NODE){const t=a.parentElement;if(c.push(a.nodeValue.slice(o).replaceAll(SA,"")),t!==this.editorDiv){let e=l;for(const i of this.editorDiv.childNodes)i!==t?e.push(NA.call(DA,i)):e=c}l.push(a.nodeValue.slice(0,o).replaceAll(SA,""))}else if(a===this.editorDiv){let t=l,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(NA.call(DA,i))}(0,Ht.A)(kA,this,"".concat(l.join("\n")).concat(n).concat(c.join("\n"))),(0,_t.A)(PA,this,OA).call(this);const h=new Range;let d=Math.sumPrecise(l.map(t=>t.length));for(const{firstChild:u}of this.editorDiv.childNodes)if(u.nodeType===Node.TEXT_NODE){const t=u.nodeValue.length;if(d<=t){h.setStart(u,d),h.setEnd(u,d);break}d-=t}s.removeAllRanges(),s.addRange(h)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=DA._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let n=null;if(t instanceof Vp){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:s,rotation:r,id:a,popupRef:o,richText:l,contentsObj:c,creationDate:h,modificationDate:d},textContent:u,textPosition:p,parent:{page:{pageNumber:A}}}=t;if(!u||0===u.length)return null;n=t={annotationType:re.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:p,pageIndex:A-1,rect:s.slice(0),rotation:r,annotationElementId:a,id:a,deleted:!1,popupRef:o,comment:(null===c||void 0===c?void 0:c.str)||null,richText:l,creationDate:h,modificationDate:d}}const s=await super.deserialize(t,e,i);return(0,Ht.A)(TA,s,t.fontSize),s.color=Xe.makeHexColor(...t.color),(0,Ht.A)(kA,s,WA.call(DA,t.value)),s._initialData=n,t.comment&&s.setCommentData(t),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=na._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:(0,zt.A)(TA,this),value:(0,_t.A)(PA,this,BA).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!(0,_t.A)(PA,this,jA).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:i}=e;i.fontSize="calc(".concat((0,zt.A)(TA,this),"px * var(--total-scale-factor))"),i.color=this.color,e.replaceChildren();for(const n of(0,zt.A)(kA,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:(0,zt.A)(kA,this)}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function RA(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--total-scale-factor))"),this.translate(0,-(t-(0,zt.A)(TA,this))*this.parentScale),(0,Ht.A)(TA,this,t),(0,_t.A)(PA,this,FA).call(this)},i=(0,zt.A)(TA,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function LA(t){const e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function IA(){const t=[];this.editorDiv.normalize();let e=null;for(const n of this.editorDiv.childNodes){var i;(null===(i=e)||void 0===i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===n.nodeName||(t.push(NA.call(Ot,n)),e=n)}return t.join("\n")}function FA(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,n=e.style.display,s=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=n,e.classList.toggle("hidden",s)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}function NA(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(SA,"")}function OA(){if(this.editorDiv.replaceChildren(),(0,zt.A)(kA,this))for(const t of(0,zt.A)(kA,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function BA(){return(0,zt.A)(kA,this).replaceAll("\xa0"," ")}function WA(t){return t.replaceAll(" ","\xa0")}function jA(t){const{value:e,fontSize:i,color:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==n[e])||t.pageIndex!==s}Ot=DA,(0,Vt.A)(DA,"_freeTextDefaultContent",""),(0,Vt.A)(DA,"_internalPadding",0),(0,Vt.A)(DA,"_defaultColor",null),(0,Vt.A)(DA,"_defaultFontSize",10),(0,Vt.A)(DA,"_type","freetext"),(0,Vt.A)(DA,"_editorType",re.FREETEXT);class UA{toSVGPath(){De("Abstract method `toSVGPath` must be implemented.")}get box(){De("Abstract getter `box` must be implemented.")}serialize(t,e){De("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,n,s,r){r||(r=new Float32Array(t.length));for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a]*n,r[a+1]=i+t[a+1]*s;return r}static _rescaleAndSwap(t,e,i,n,s,r){r||(r=new Float32Array(t.length));for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a+1]*n,r[a+1]=i+t[a]*s;return r}static _translate(t,e,i,n){n||(n=new Float32Array(t.length));for(let s=0,r=t.length;s<r;s+=2)n[s]=e+t[s],n[s+1]=i+t[s+1];return n}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,n,s){switch(s){case 90:return[1-e/i,t/n];case 180:return[1-t/i,1-e/n];case 270:return[e/i,1-t/n];default:return[t/i,e/n]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,n,s,r){return[(t+5*i)/6,(e+5*n)/6,(5*i+s)/6,(5*n+r)/6,(i+s)/2,(n+r)/2]}}(0,Vt.A)(UA,"PRECISION",1e-4);var zA=new WeakMap,HA=new WeakMap,VA=new WeakMap,GA=new WeakMap,qA=new WeakMap,XA=new WeakMap,YA=new WeakMap,KA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakMap,$A=new WeakMap,tf=new WeakMap,ef=new WeakSet;class nf{constructor(t,e,i,n,s){let{x:r,y:a}=t,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;(0,bt.A)(this,ef),(0,yt.A)(this,zA,void 0),(0,yt.A)(this,HA,[]),(0,yt.A)(this,VA,void 0),(0,yt.A)(this,GA,void 0),(0,yt.A)(this,qA,[]),(0,yt.A)(this,XA,new Float32Array(18)),(0,yt.A)(this,YA,void 0),(0,yt.A)(this,KA,void 0),(0,yt.A)(this,QA,void 0),(0,yt.A)(this,JA,void 0),(0,yt.A)(this,ZA,void 0),(0,yt.A)(this,$A,void 0),(0,yt.A)(this,tf,[]),(0,Ht.A)(zA,this,e),(0,Ht.A)($A,this,n*i),(0,Ht.A)(GA,this,s),(0,zt.A)(XA,this).set([NaN,NaN,NaN,NaN,r,a],6),(0,Ht.A)(VA,this,o),(0,Ht.A)(JA,this,df._*i),(0,Ht.A)(QA,this,uf._*i),(0,Ht.A)(ZA,this,i),(0,zt.A)(tf,this).push(r,a)}isEmpty(){return isNaN((0,zt.A)(XA,this)[8])}add(t){var e;let{x:i,y:n}=t;(0,Ht.A)(YA,this,i),(0,Ht.A)(KA,this,n);const[s,r,a,o]=(0,zt.A)(zA,this);let[l,c,h,d]=(0,zt.A)(XA,this).subarray(8,12);const u=i-h,p=n-d,A=Math.hypot(u,p);if(A<(0,zt.A)(QA,this))return!1;const f=A-(0,zt.A)(JA,this),g=f/A,m=g*u,v=g*p;let w=l,b=c;l=h,c=d,h+=m,d+=v,null===(e=(0,zt.A)(tf,this))||void 0===e||e.push(i,n);const y=m/f,_=-v/f*(0,zt.A)($A,this),x=y*(0,zt.A)($A,this);if((0,zt.A)(XA,this).set((0,zt.A)(XA,this).subarray(2,8),0),(0,zt.A)(XA,this).set([h+_,d+x],4),(0,zt.A)(XA,this).set((0,zt.A)(XA,this).subarray(14,18),12),(0,zt.A)(XA,this).set([h-_,d-x],16),isNaN((0,zt.A)(XA,this)[6]))return 0===(0,zt.A)(qA,this).length&&((0,zt.A)(XA,this).set([l+_,c+x],2),(0,zt.A)(qA,this).push(NaN,NaN,NaN,NaN,(l+_-s)/a,(c+x-r)/o),(0,zt.A)(XA,this).set([l-_,c-x],14),(0,zt.A)(HA,this).push(NaN,NaN,NaN,NaN,(l-_-s)/a,(c-x-r)/o)),(0,zt.A)(XA,this).set([w,b,l,c,h,d],6),!this.isEmpty();(0,zt.A)(XA,this).set([w,b,l,c,h,d],6);return Math.abs(Math.atan2(b-c,w-l)-Math.atan2(v,m))<Math.PI/2?([l,c,h,d]=(0,zt.A)(XA,this).subarray(2,6),(0,zt.A)(qA,this).push(NaN,NaN,NaN,NaN,((l+h)/2-s)/a,((c+d)/2-r)/o),[l,c,w,b]=(0,zt.A)(XA,this).subarray(14,18),(0,zt.A)(HA,this).push(NaN,NaN,NaN,NaN,((w+l)/2-s)/a,((b+c)/2-r)/o),!0):([w,b,l,c,h,d]=(0,zt.A)(XA,this).subarray(0,6),(0,zt.A)(qA,this).push(((w+5*l)/6-s)/a,((b+5*c)/6-r)/o,((5*l+h)/6-s)/a,((5*c+d)/6-r)/o,((l+h)/2-s)/a,((c+d)/2-r)/o),[h,d,l,c,w,b]=(0,zt.A)(XA,this).subarray(12,18),(0,zt.A)(HA,this).push(((w+5*l)/6-s)/a,((b+5*c)/6-r)/o,((5*l+h)/6-s)/a,((5*c+d)/6-r)/o,((l+h)/2-s)/a,((c+d)/2-r)/o),!0)}toSVGPath(){if(this.isEmpty())return"";const t=(0,zt.A)(qA,this),e=(0,zt.A)(HA,this);if(isNaN((0,zt.A)(XA,this)[6])&&!this.isEmpty())return(0,_t.A)(ef,this,rf).call(this);const i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let n=6;n<t.length;n+=6)isNaN(t[n])?i.push("L".concat(t[n+4]," ").concat(t[n+5])):i.push("C".concat(t[n]," ").concat(t[n+1]," ").concat(t[n+2]," ").concat(t[n+3]," ").concat(t[n+4]," ").concat(t[n+5]));(0,_t.A)(ef,this,of).call(this,i);for(let n=e.length-6;n>=6;n-=6)isNaN(e[n])?i.push("L".concat(e[n+4]," ").concat(e[n+5])):i.push("C".concat(e[n]," ").concat(e[n+1]," ").concat(e[n+2]," ").concat(e[n+3]," ").concat(e[n+4]," ").concat(e[n+5]));return(0,_t.A)(ef,this,af).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,r){return new yf(t,e,i,n,s,r)}getOutlines(){var t,e;const i=(0,zt.A)(qA,this),n=(0,zt.A)(HA,this),s=(0,zt.A)(XA,this),[r,a,o,l]=(0,zt.A)(zA,this),c=new Float32Array((null!==(t=null===(e=(0,zt.A)(tf,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let u=0,p=c.length-2;u<p;u+=2)c[u]=((0,zt.A)(tf,this)[u]-r)/o,c[u+1]=((0,zt.A)(tf,this)[u+1]-a)/l;if(c[c.length-2]=((0,zt.A)(YA,this)-r)/o,c[c.length-1]=((0,zt.A)(KA,this)-a)/l,isNaN(s[6])&&!this.isEmpty())return(0,_t.A)(ef,this,lf).call(this,c);const h=new Float32Array((0,zt.A)(qA,this).length+24+(0,zt.A)(HA,this).length);let d=i.length;for(let u=0;u<d;u+=2)isNaN(i[u])?h[u]=h[u+1]=NaN:(h[u]=i[u],h[u+1]=i[u+1]);d=(0,_t.A)(ef,this,hf).call(this,h,d);for(let u=n.length-6;u>=6;u-=6)for(let t=0;t<6;t+=2)isNaN(n[u+t])?(h[d]=h[d+1]=NaN,d+=2):(h[d]=n[u+t],h[d+1]=n[u+t+1],d+=2);return(0,_t.A)(ef,this,cf).call(this,h,d),this.newFreeDrawOutline(h,c,(0,zt.A)(zA,this),(0,zt.A)(ZA,this),(0,zt.A)(VA,this),(0,zt.A)(GA,this))}}function sf(){const t=(0,zt.A)(XA,this).subarray(4,6),e=(0,zt.A)(XA,this).subarray(16,18),[i,n,s,r]=(0,zt.A)(zA,this);return[((0,zt.A)(YA,this)+(t[0]-e[0])/2-i)/s,((0,zt.A)(KA,this)+(t[1]-e[1])/2-n)/r,((0,zt.A)(YA,this)+(e[0]-t[0])/2-i)/s,((0,zt.A)(KA,this)+(e[1]-t[1])/2-n)/r]}function rf(){const[t,e,i,n]=(0,zt.A)(zA,this),[s,r,a,o]=(0,_t.A)(ef,this,sf).call(this);return"M".concat(((0,zt.A)(XA,this)[2]-t)/i," ").concat(((0,zt.A)(XA,this)[3]-e)/n," L").concat(((0,zt.A)(XA,this)[4]-t)/i," ").concat(((0,zt.A)(XA,this)[5]-e)/n," L").concat(s," ").concat(r," L").concat(a," ").concat(o," L").concat(((0,zt.A)(XA,this)[16]-t)/i," ").concat(((0,zt.A)(XA,this)[17]-e)/n," L").concat(((0,zt.A)(XA,this)[14]-t)/i," ").concat(((0,zt.A)(XA,this)[15]-e)/n," Z")}function af(t){const e=(0,zt.A)(HA,this);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function of(t){const[e,i,n,s]=(0,zt.A)(zA,this),r=(0,zt.A)(XA,this).subarray(4,6),a=(0,zt.A)(XA,this).subarray(16,18),[o,l,c,h]=(0,_t.A)(ef,this,sf).call(this);t.push("L".concat((r[0]-e)/n," ").concat((r[1]-i)/s," L").concat(o," ").concat(l," L").concat(c," ").concat(h," L").concat((a[0]-e)/n," ").concat((a[1]-i)/s))}function lf(t){const e=(0,zt.A)(XA,this),[i,n,s,r]=(0,zt.A)(zA,this),[a,o,l,c]=(0,_t.A)(ef,this,sf).call(this),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-n)/r,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-n)/r,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-n)/r,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-n)/r],0),this.newFreeDrawOutline(h,t,(0,zt.A)(zA,this),(0,zt.A)(ZA,this),(0,zt.A)(VA,this),(0,zt.A)(GA,this))}function cf(t,e){const i=(0,zt.A)(HA,this);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function hf(t,e){const i=(0,zt.A)(XA,this).subarray(4,6),n=(0,zt.A)(XA,this).subarray(16,18),[s,r,a,o]=(0,zt.A)(zA,this),[l,c,h,d]=(0,_t.A)(ef,this,sf).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/a,(i[1]-r)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(n[0]-s)/a,(n[1]-r)/o],e),e+24}var df={_:8},uf={_:df._+2},pf=new WeakMap,Af=new WeakMap,ff=new WeakMap,gf=new WeakMap,mf=new WeakMap,vf=new WeakMap,wf=new WeakMap,bf=new WeakSet;class yf extends UA{constructor(t,e,i,n,s,r){super(),(0,bt.A)(this,bf),(0,yt.A)(this,pf,void 0),(0,yt.A)(this,Af,new Float32Array(4)),(0,yt.A)(this,ff,void 0),(0,yt.A)(this,gf,void 0),(0,yt.A)(this,mf,void 0),(0,yt.A)(this,vf,void 0),(0,yt.A)(this,wf,void 0),(0,Ht.A)(wf,this,t),(0,Ht.A)(mf,this,e),(0,Ht.A)(pf,this,i),(0,Ht.A)(vf,this,n),(0,Ht.A)(ff,this,s),(0,Ht.A)(gf,this,r),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],(0,_t.A)(bf,this,_f).call(this,r);const[a,o,l,c]=(0,zt.A)(Af,this);for(let h=0,d=t.length;h<d;h+=2)t[h]=(t[h]-a)/l,t[h+1]=(t[h+1]-o)/c;for(let h=0,d=e.length;h<d;h+=2)e[h]=(e[h]-a)/l,e[h+1]=(e[h+1]-o)/c}toSVGPath(){const t=["M".concat((0,zt.A)(wf,this)[4]," ").concat((0,zt.A)(wf,this)[5])];for(let e=6,i=(0,zt.A)(wf,this).length;e<i;e+=6)isNaN((0,zt.A)(wf,this)[e])?t.push("L".concat((0,zt.A)(wf,this)[e+4]," ").concat((0,zt.A)(wf,this)[e+5])):t.push("C".concat((0,zt.A)(wf,this)[e]," ").concat((0,zt.A)(wf,this)[e+1]," ").concat((0,zt.A)(wf,this)[e+2]," ").concat((0,zt.A)(wf,this)[e+3]," ").concat((0,zt.A)(wf,this)[e+4]," ").concat((0,zt.A)(wf,this)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let[i,n,s,r]=t;const a=s-i,o=r-n;let l,c;switch(e){case 0:l=UA._rescale((0,zt.A)(wf,this),i,r,a,-o),c=UA._rescale((0,zt.A)(mf,this),i,r,a,-o);break;case 90:l=UA._rescaleAndSwap((0,zt.A)(wf,this),i,n,a,o),c=UA._rescaleAndSwap((0,zt.A)(mf,this),i,n,a,o);break;case 180:l=UA._rescale((0,zt.A)(wf,this),s,n,-a,o),c=UA._rescale((0,zt.A)(mf,this),s,n,-a,o);break;case 270:l=UA._rescaleAndSwap((0,zt.A)(wf,this),s,r,-a,-o),c=UA._rescaleAndSwap((0,zt.A)(mf,this),s,r,-a,-o)}return{outline:Array.from(l),points:[Array.from(c)]}}get box(){return(0,zt.A)(Af,this)}newOutliner(t,e,i,n,s){return new nf(t,e,i,n,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(t,e){const[i,n,s,r]=(0,zt.A)(Af,this),[a,o,l,c]=(0,zt.A)(pf,this),h=s*l,d=r*c,u=i*l+a,p=n*c+o,A=this.newOutliner({x:(0,zt.A)(mf,this)[0]*h+u,y:(0,zt.A)(mf,this)[1]*d+p},(0,zt.A)(pf,this),(0,zt.A)(vf,this),t,(0,zt.A)(gf,this),null!==e&&void 0!==e?e:(0,zt.A)(ff,this));for(let f=2;f<(0,zt.A)(mf,this).length;f+=2)A.add({x:(0,zt.A)(mf,this)[f]*h+u,y:(0,zt.A)(mf,this)[f+1]*d+p});return A.getOutlines()}}function _f(t){const e=(0,zt.A)(wf,this);let i=e[4],n=e[5];const s=[i,n,i,n];let r=i,a=n,o=i,l=n;const c=t?Math.max:Math.min,h=new Float32Array(4);for(let u=6,p=e.length;u<p;u+=6){const t=e[u+4],d=e[u+5];isNaN(e[u])?(Xe.pointBoundingBox(t,d,s),a>d?(r=t,a=d):a===d&&(r=c(r,t)),l<d?(o=t,l=d):l===d&&(o=c(o,t))):(h[0]=h[1]=1/0,h[2]=h[3]=-1/0,Xe.bezierBoundingBox(i,n,...e.slice(u,u+6),h),Xe.rectBoundingBox(h[0],h[1],h[2],h[3],s),a>h[1]?(r=h[0],a=h[1]):a===h[1]&&(r=c(r,h[0])),l<h[3]?(o=h[2],l=h[3]):l===h[3]&&(o=c(o,h[2]))),i=t,n=d}const d=(0,zt.A)(Af,this);d[0]=s[0]-(0,zt.A)(ff,this),d[1]=s[1]-(0,zt.A)(ff,this),d[2]=s[2]-s[0]+2*(0,zt.A)(ff,this),d[3]=s[3]-s[1]+2*(0,zt.A)(ff,this),this.firstPoint=[r,a],this.lastPoint=[o,l]}var xf=new WeakMap,Ef=new WeakMap,Sf=new WeakMap,kf=new WeakMap,Cf=new WeakMap,Mf=new WeakSet;class Tf{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];(0,bt.A)(this,Mf),(0,yt.A)(this,xf,void 0),(0,yt.A)(this,Ef,void 0),(0,yt.A)(this,Sf,void 0),(0,yt.A)(this,kf,[]),(0,yt.A)(this,Cf,[]);const s=[1/0,1/0,-1/0,-1/0],r=10**-4;for(const{x:A,y:f,width:g,height:m}of t){const t=Math.floor((A-e)/r)*r,i=Math.ceil((A+g+e)/r)*r,n=Math.floor((f-e)/r)*r,a=Math.ceil((f+m+e)/r)*r,o=[t,n,a,!0],l=[i,n,a,!1];(0,zt.A)(kf,this).push(o,l),Xe.rectBoundingBox(t,n,i,a,s)}const a=s[2]-s[0]+2*i,o=s[3]-s[1]+2*i,l=s[0]-i,c=s[1]-i;let h=n?-1/0:1/0,d=1/0;const u=(0,zt.A)(kf,this).at(n?-1:-2),p=[u[0],u[2]];for(const A of(0,zt.A)(kf,this)){const[t,e,i,s]=A;!s&&n?e<d?(d=e,h=t):e===d&&(h=Math.max(h,t)):s&&!n&&(e<d?(d=e,h=t):e===d&&(h=Math.min(h,t))),A[0]=(t-l)/a,A[1]=(e-c)/o,A[2]=(i-c)/o}(0,Ht.A)(xf,this,new Float32Array([l,c,a,o])),(0,Ht.A)(Ef,this,[h,d]),(0,Ht.A)(Sf,this,p)}getOutlines(){(0,zt.A)(kf,this).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of(0,zt.A)(kf,this))e[3]?(t.push(...(0,_t.A)(Mf,this,If).call(this,e)),(0,_t.A)(Mf,this,Rf).call(this,e)):((0,_t.A)(Mf,this,Lf).call(this,e),t.push(...(0,_t.A)(Mf,this,If).call(this,e)));return(0,_t.A)(Mf,this,Pf).call(this,t)}}function Pf(t){const e=[],i=new Set;for(const r of t){const[t,i,n]=r;e.push([t,i,r],[t,n,r])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let r=0,a=e.length;r<a;r+=2){const t=e[r][2],n=e[r+1][2];t.push(n),n.push(t),i.add(t),i.add(n)}const n=[];let s;for(;i.size>0;){const t=i.values().next().value;let[e,r,a,o,l]=t;i.delete(t);let c=e,h=r;for(s=[e,a],n.push(s);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,r,a,o,l]=t,c!==e&&(s.push(c,h,e,h===r?r:a),c=e),h=h===r?a:r}s.push(c,h)}return new Of(n,(0,zt.A)(xf,this),(0,zt.A)(Ef,this),(0,zt.A)(Sf,this))}function Df(t){const e=(0,zt.A)(Cf,this);let i=0,n=e.length-1;for(;i<=n;){const s=i+n>>1,r=e[s][0];if(r===t)return s;r<t?i=s+1:n=s-1}return n+1}function Rf(t){let[,e,i]=t;const n=(0,_t.A)(Mf,this,Df).call(this,e);(0,zt.A)(Cf,this).splice(n,0,[e,i])}function Lf(t){let[,e,i]=t;const n=(0,_t.A)(Mf,this,Df).call(this,e);for(let s=n;s<(0,zt.A)(Cf,this).length;s++){const[t,n]=(0,zt.A)(Cf,this)[s];if(t!==e)break;if(t===e&&n===i)return void(0,zt.A)(Cf,this).splice(s,1)}for(let s=n-1;s>=0;s--){const[t,n]=(0,zt.A)(Cf,this)[s];if(t!==e)break;if(t===e&&n===i)return void(0,zt.A)(Cf,this).splice(s,1)}}function If(t){const[e,i,n]=t,s=[[e,i,n]],r=(0,_t.A)(Mf,this,Df).call(this,n);for(let a=0;a<r;a++){const[t,i]=(0,zt.A)(Cf,this)[a];for(let n=0,r=s.length;n<r;n++){const[,a,o]=s[n];if(!(i<=a||o<=t))if(a>=t)if(o>i)s[n][1]=i;else{if(1===r)return[];s.splice(n,1),n--,r--}else s[n][2]=t,o>i&&s.push([e,i,o])}}return s}var Ff=new WeakMap,Nf=new WeakMap;class Of extends UA{constructor(t,e,i,n){super(),(0,yt.A)(this,Ff,void 0),(0,yt.A)(this,Nf,void 0),(0,Ht.A)(Nf,this,t),(0,Ht.A)(Ff,this,e),this.firstPoint=i,this.lastPoint=n}toSVGPath(){const t=[];for(const e of(0,zt.A)(Nf,this)){let[i,n]=e;t.push("M".concat(i," ").concat(n));for(let s=2;s<e.length;s+=2){const r=e[s],a=e[s+1];r===i?(t.push("V".concat(a)),n=a):a===n&&(t.push("H".concat(r)),i=r)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,n,s,r]=t;const a=[],o=s-i,l=r-n;for(const c of(0,zt.A)(Nf,this)){const t=new Array(c.length);for(let e=0;e<c.length;e+=2)t[e]=i+c[e]*o,t[e+1]=r-c[e+1]*l;a.push(t)}return a}get box(){return(0,zt.A)(Ff,this)}get classNamesForOutlining(){return["highlightOutline"]}}class Bf extends nf{newFreeDrawOutline(t,e,i,n,s,r){return new Wf(t,e,i,n,s,r)}}class Wf extends yf{newOutliner(t,e,i,n,s){return new Bf(t,e,i,n,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}var jf=new WeakMap,Uf=new WeakMap,zf=new WeakMap,Hf=new WeakMap,Vf=new WeakMap,Gf=new WeakMap,qf=new WeakMap,Xf=new WeakMap,Yf=new WeakMap,Kf=new WeakMap,Qf=new WeakMap,Jf=new WeakMap,Zf=new WeakMap,$f=new WeakMap,tg=new WeakMap,eg=new WeakMap,ig=new WeakMap,ng=new WeakMap,sg=new WeakSet;class rg extends na{static get _keyboardManager(){const t=rg.prototype;return Fe(this,"_keyboardManager",new gn([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"highlightEditor"})),(0,bt.A)(this,sg),(0,yt.A)(this,jf,null),(0,yt.A)(this,Uf,0),(0,yt.A)(this,zf,void 0),(0,yt.A)(this,Hf,null),(0,yt.A)(this,Vf,null),(0,yt.A)(this,Gf,null),(0,yt.A)(this,qf,null),(0,yt.A)(this,Xf,0),(0,yt.A)(this,Yf,null),(0,yt.A)(this,Kf,null),(0,yt.A)(this,Qf,null),(0,yt.A)(this,Jf,!1),(0,yt.A)(this,Zf,null),(0,yt.A)(this,$f,null),(0,yt.A)(this,tg,null),(0,yt.A)(this,eg,""),(0,yt.A)(this,ig,void 0),(0,yt.A)(this,ng,""),this.color=t.color||rg._defaultColor,(0,Ht.A)(ig,this,t.thickness||rg._defaultThickness),this.opacity=t.opacity||rg._defaultOpacity,(0,Ht.A)(zf,this,t.boxes||null),(0,Ht.A)(ng,this,t.methodOfCreation||""),(0,Ht.A)(eg,this,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?((0,Ht.A)(Jf,this,!0),(0,_t.A)(sg,this,og).call(this,t),(0,_t.A)(sg,this,ug).call(this)):(0,zt.A)(zf,this)&&((0,Ht.A)(jf,this,t.anchorNode),(0,Ht.A)(Uf,this,t.anchorOffset),(0,Ht.A)(qf,this,t.focusNode),(0,Ht.A)(Xf,this,t.focusOffset),(0,_t.A)(sg,this,ag).call(this),(0,_t.A)(sg,this,ug).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:(0,zt.A)(Jf,this)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:(0,zt.A)(ig,this),methodOfCreation:(0,zt.A)(ng,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;na.initialize(t,e),rg._defaultColor||(rg._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case ae.HIGHLIGHT_COLOR:rg._defaultColor=e;break;case ae.HIGHLIGHT_THICKNESS:rg._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,zt.A)($f,this)}get commentButtonPosition(){return(0,zt.A)(Zf,this)}updateParams(t,e){switch(t){case ae.HIGHLIGHT_COLOR:(0,_t.A)(sg,this,lg).call(this,e);break;case ae.HIGHLIGHT_THICKNESS:(0,_t.A)(sg,this,cg).call(this,e)}}static get defaultPropertiesToUpdate(){return[[ae.HIGHLIGHT_COLOR,rg._defaultColor],[ae.HIGHLIGHT_THICKNESS,rg._defaultThickness]]}get propertiesToUpdate(){return[[ae.HIGHLIGHT_COLOR,this.color||rg._defaultColor],[ae.HIGHLIGHT_THICKNESS,(0,zt.A)(ig,this)||rg._defaultThickness],[ae.HIGHLIGHT_FREE,(0,zt.A)(Jf,this)]]}onUpdatedColor(){var t,e;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(Qf,this),{root:{fill:this.color,"fill-opacity":this.opacity}}),null===(e=(0,zt.A)(Vf,this))||void 0===e||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",(0,Ht.A)(Vf,this,new pu({editor:this}))]]}return super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,_t.A)(sg,this,gg).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,_t.A)(sg,this,gg).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){(0,_t.A)(sg,this,dg).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,_t.A)(sg,this,ug).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,_t.A)(sg,this,dg).call(this);else if(t){var i;(0,_t.A)(sg,this,ug).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const{drawLayer:e}=this.parent;let i;(0,zt.A)(Jf,this)?(t=(t-this.rotation+360)%360,i=pg.call(rg,(0,zt.A)(Kf,this).box,t)):i=pg.call(rg,[this.x,this.y,this.width,this.height],t),e.updateProperties((0,zt.A)(Qf,this),{bbox:i,root:{"data-main-rotation":t}}),e.updateProperties((0,zt.A)(tg,this),{bbox:pg.call(rg,(0,zt.A)(Gf,this).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();(0,zt.A)(eg,this)&&(t.setAttribute("aria-label",(0,zt.A)(eg,this)),t.setAttribute("role","mark")),(0,zt.A)(Jf,this)?t.classList.add("free"):this.div.addEventListener("keydown",(0,_t.A)(sg,this,Ag).bind(this),{signal:this._uiManager._signal});const e=(0,Ht.A)(Yf,this,document.createElement("div"));return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,zt.A)(Hf,this),this.setDims(this.width,this.height),tn(this,(0,zt.A)(Yf,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(tg,this),{rootClass:{hovered:!0}}))}pointerleave(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(tg,this),{rootClass:{hovered:!1}}))}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,_t.A)(sg,this,fg).call(this,!0);break;case 1:case 3:(0,_t.A)(sg,this,fg).call(this,!1)}}select(){var t;super.select(),(0,zt.A)(tg,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(tg,this),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),(0,zt.A)(tg,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(tg,this),{rootClass:{selected:!1}}),(0,zt.A)(Jf,this)||(0,_t.A)(sg,this,fg).call(this,!1))}get _mustFixPosition(){return!(0,zt.A)(Jf,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.updateProperties((0,zt.A)(Qf,this),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties((0,zt.A)(tg,this),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,i){let{target:n,x:s,y:r}=i;const{x:a,y:o,width:l,height:c}=n.getBoundingClientRect(),h=new AbortController,d=t.combinedSignal(h),u=e=>{h.abort(),(0,_t.A)(rg,this,bg).call(this,t,e)};window.addEventListener("blur",u,{signal:d}),window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("pointerdown",Ai,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",pi,{signal:d}),n.addEventListener("pointermove",(0,_t.A)(rg,this,wg).bind(this,t),{signal:d}),this._freeHighlight=new Bf({x:s,y:r},[a,o,l,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(t,e,i){let n=null;if(t instanceof aA){const{data:{quadPoints:e,rect:i,rotation:s,id:r,color:a,opacity:o,popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:re.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}else if(t instanceof sA){const{data:{inkLists:e,rect:i,rotation:s,id:r,color:a,borderStyle:{rawWidth:o},popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:re.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}const{color:s,quadPoints:r,inkLists:a,opacity:o}=t,l=await super.deserialize(t,e,i);l.color=Xe.makeHexColor(...s),l.opacity=o||1,a&&(0,Ht.A)(ig,l,t.thickness),l._initialData=n,t.comment&&l.setCommentData(t);const[c,h]=l.pageDimensions,[d,u]=l.pageTranslation;if(r){const t=(0,Ht.A)(zf,l,[]);for(let e=0;e<r.length;e+=8)t.push({x:(r[e]-d)/c,y:1-(r[e+1]-u)/h,width:(r[e+2]-r[e])/c,height:(r[e+1]-r[e+5])/h});(0,_t.A)(sg,l,ag).call(l),(0,_t.A)(sg,l,ug).call(l),l.rotate(l.rotation)}else if(a){(0,Ht.A)(Jf,l,!0);const t=a[0],i={x:t[0]-d,y:h-(t[1]-u)},n=new Bf(i,[0,0,c,h],1,(0,zt.A)(ig,l)/2,!0,.001);for(let e=0,a=t.length;e<a;e+=2)i.x=t[e]-d,i.y=h-(t[e+1]-u),n.add(i);const{id:s,clipPathId:r}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:n.toSVGPath()}},!0,!0);(0,_t.A)(sg,l,og).call(l,{highlightOutlines:n.getOutlines(),highlightId:s,clipPathId:r}),(0,_t.A)(sg,l,ug).call(l),l.rotate(l.parentRotation)}return l}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=na._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:e,opacity:this.opacity,thickness:(0,zt.A)(ig,this),quadPoints:(0,_t.A)(sg,this,mg).call(this),outlines:(0,_t.A)(sg,this,vg).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!(0,_t.A)(sg,this,yg).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}function ag(){const t=new Tf((0,zt.A)(zf,this),.001);(0,Ht.A)(Kf,this,t.getOutlines()),[this.x,this.y,this.width,this.height]=(0,zt.A)(Kf,this).box;const e=new Tf((0,zt.A)(zf,this),.0025,.001,"ltr"===this._uiManager.direction);(0,Ht.A)(Gf,this,e.getOutlines());const{firstPoint:i}=(0,zt.A)(Kf,this);(0,Ht.A)(Zf,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:n}=(0,zt.A)(Gf,this);(0,Ht.A)($f,this,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])}function og(t){let{highlightOutlines:e,highlightId:i,clipPathId:n}=t;(0,Ht.A)(Kf,this,e);if((0,Ht.A)(Gf,this,e.getNewOutline((0,zt.A)(ig,this)/2+1.5,.0025)),i>=0)(0,Ht.A)(Qf,this,i),(0,Ht.A)(Hf,this,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),(0,Ht.A)(tg,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:(0,zt.A)(Gf,this).box,path:{d:(0,zt.A)(Gf,this).toSVGPath()}},!0));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties((0,zt.A)(Qf,this),{bbox:pg.call(Bt,(0,zt.A)(Kf,this).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties((0,zt.A)(tg,this),{bbox:pg.call(Bt,(0,zt.A)(Gf,this).box,t),path:{d:(0,zt.A)(Gf,this).toSVGPath()}})}const[s,r,a,o]=e.box;switch(this.rotation){case 0:this.x=s,this.y=r,this.width=a,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=r,this.y=1-s,this.width=a*e/t,this.height=o*t/e;break}case 180:this.x=1-s,this.y=1-r,this.width=a,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-r,this.y=s,this.width=a*e/t,this.height=o*t/e;break}}const{firstPoint:l}=e;(0,Ht.A)(Zf,this,[(l[0]-s)/a,(l[1]-r)/o]);const{lastPoint:c}=(0,zt.A)(Gf,this);(0,Ht.A)($f,this,[(c[0]-s)/a,(c[1]-r)/o])}function lg(t){const e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,n=this.opacity;this.addCommands({cmd:e.bind(this,t,Bt._defaultOpacity),undo:e.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}function cg(t){const e=(0,zt.A)(ig,this),i=t=>{(0,Ht.A)(ig,this,t),(0,_t.A)(sg,this,hg).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function hg(t){(0,zt.A)(Jf,this)&&((0,_t.A)(sg,this,og).call(this,{highlightOutlines:(0,zt.A)(Kf,this).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}function dg(){null!==(0,zt.A)(Qf,this)&&this.parent&&(this.parent.drawLayer.remove((0,zt.A)(Qf,this)),(0,Ht.A)(Qf,this,null),this.parent.drawLayer.remove((0,zt.A)(tg,this)),(0,Ht.A)(tg,this,null))}function ug(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===(0,zt.A)(Qf,this)&&(({id:vt(Ht.A,[Qf,this])._,clipPathId:vt(Ht.A,[Hf,this])._}=t.drawLayer.draw({bbox:(0,zt.A)(Kf,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:(0,zt.A)(Jf,this)},path:{d:(0,zt.A)(Kf,this).toSVGPath()}},!1,!0)),(0,Ht.A)(tg,this,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:(0,zt.A)(Jf,this)},bbox:(0,zt.A)(Gf,this).box,path:{d:(0,zt.A)(Gf,this).toSVGPath()}},(0,zt.A)(Jf,this))),(0,zt.A)(Yf,this)&&((0,zt.A)(Yf,this).style.clipPath=(0,zt.A)(Hf,this)))}function pg(t,e){let[i,n,s,r]=t;switch(e){case 90:return[1-n-r,i,r,s];case 180:return[1-i-s,1-n-r,s,r];case 270:return[n,1-i-s,r,s]}return[i,n,s,r]}function Ag(t){Bt._keyboardManager.exec(this,t)}function fg(t){if(!(0,zt.A)(jf,this))return;const e=window.getSelection();t?e.setPosition((0,zt.A)(jf,this),(0,zt.A)(Uf,this)):e.setPosition((0,zt.A)(qf,this),(0,zt.A)(Xf,this))}function gg(){return(0,zt.A)(Jf,this)?this.rotation:0}function mg(){if((0,zt.A)(Jf,this))return null;const[t,e]=this.pageDimensions,[i,n]=this.pageTranslation,s=(0,zt.A)(zf,this),r=new Float32Array(8*s.length);let a=0;for(const{x:o,y:l,width:c,height:h}of s){const s=o*t+i,d=(1-l)*e+n;r[a]=r[a+4]=s,r[a+1]=r[a+3]=d,r[a+2]=r[a+6]=s+c*t,r[a+5]=r[a+7]=d-h*e,a+=8}return r}function vg(t){return(0,zt.A)(Kf,this).serialize(t,(0,_t.A)(sg,this,gg).call(this))}function wg(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function bg(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function yg(t){const{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}Bt=rg,(0,Vt.A)(rg,"_defaultColor",null),(0,Vt.A)(rg,"_defaultOpacity",1),(0,Vt.A)(rg,"_defaultThickness",12),(0,Vt.A)(rg,"_type","highlight"),(0,Vt.A)(rg,"_editorType",re.HIGHLIGHT),(0,Vt.A)(rg,"_freeHighlightId",-1),(0,Vt.A)(rg,"_freeHighlight",null),(0,Vt.A)(rg,"_freeHighlightClipId","");var _g=new WeakMap;class xg{constructor(){(0,yt.A)(this,_g,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){(0,zt.A)(_g,this)[t]=e}toSVGProperties(){const t=(0,zt.A)(_g,this);return(0,Ht.A)(_g,this,Object.create(null)),{root:t}}reset(){(0,Ht.A)(_g,this,Object.create(null))}updateAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(t)}clone(){De("Not implemented")}}var Eg=new WeakMap,Sg=new WeakMap,kg=new WeakSet;class Cg extends na{constructor(t){super(t),(0,bt.A)(this,kg),(0,yt.A)(this,Eg,null),(0,yt.A)(this,Sg,void 0),(0,Vt.A)(this,"_colorPicker",null),(0,Vt.A)(this,"_drawId",null),(0,Ht.A)(Sg,this,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&((0,_t.A)(kg,this,Mg).call(this,t),(0,_t.A)(kg,this,Dg).call(this))}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const[n,s]of Object.entries(e))i.has(n)?Object.assign(t[n],s):t[n]=s;return t}static getDefaultDrawingOptions(t){De("Not implemented")}static get typesMap(){De("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(Ng._.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,e[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,e[n]]);return t}_updateProperty(t,e,i){const n=this._drawingOptions,s=n[e],r=i=>{var s;n.updateProperty(e,i);const r=(0,zt.A)(Eg,this).updateProperty(e,i);r&&(0,_t.A)(kg,this,Ig).call(this,r),null===(s=this.parent)||void 0===s||s.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:r.bind(this,i),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cg._mergeSVGProperties((0,zt.A)(Eg,this).getPathResizingSVGProperties((0,_t.A)(kg,this,Lg).call(this)),{bbox:(0,_t.A)(kg,this,Fg).call(this)}))}_onResized(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cg._mergeSVGProperties((0,zt.A)(Eg,this).getPathResizedSVGProperties((0,_t.A)(kg,this,Lg).call(this)),{bbox:(0,_t.A)(kg,this,Fg).call(this)}))}_onTranslating(t,e){var i;null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,{bbox:(0,_t.A)(kg,this,Fg).call(this)})}_onTranslated(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cg._mergeSVGProperties((0,zt.A)(Eg,this).getPathTranslatedSVGProperties((0,_t.A)(kg,this,Lg).call(this),this.parentDimensions),{bbox:(0,_t.A)(kg,this,Fg).call(this)}))}_onStartDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,(0,zt.A)(Sg,this)&&((0,Ht.A)(Sg,this,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){(0,_t.A)(kg,this,Pg).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,_t.A)(kg,this,Dg).call(this),(0,_t.A)(kg,this,Ig).call(this,(0,zt.A)(Eg,this).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),(0,_t.A)(kg,this,Pg).call(this);else if(t){var i;this._uiManager.addShouldRescale(this),(0,_t.A)(kg,this,Dg).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Cg._mergeSVGProperties({bbox:(0,_t.A)(kg,this,Fg).call(this)},(0,zt.A)(Eg,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&(0,_t.A)(kg,this,Ig).call(this,(0,zt.A)(Eg,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,n,s){De("Not implemented")}static startDrawing(t,e,i,n){var s,r;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:h}=n;if(jg._&&jg._!==h)return;const{viewport:{rotation:d}}=t,{width:u,height:p}=a.getBoundingClientRect(),A=Og._=new AbortController,f=t.combinedSignal(A);Wg._||(Wg._=c),null!==(s=jg._)&&void 0!==s||(jg._=h),window.addEventListener("pointerup",t=>{var e;Wg._===t.pointerId?this._endDraw(t):null===(e=Ug._)||void 0===e||e.delete(t.pointerId)},{signal:f}),window.addEventListener("pointercancel",t=>{var e;Wg._===t.pointerId?this._currentParent.endDrawingSession():null===(e=Ug._)||void 0===e||e.delete(t.pointerId)},{signal:f}),window.addEventListener("pointerdown",t=>{jg._===t.pointerType&&((Ug._||(Ug._=new Set)).add(t.pointerId),Ng._.isCancellable()&&(Ng._.removeLastElement(),Ng._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",pi,{signal:f}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:f}),a.addEventListener("touchmove",t=>{t.timeStamp===zg._&&Ai(t)},{signal:f}),t.toggleDrawing(),null===(r=e._editorUndoBar)||void 0===r||r.hide(),Ng._?t.drawLayer.updateProperties(this._currentDrawId,Ng._.startNew(o,l,u,p,d)):(e.updateUIForDefaultProperties(this),Ng._=this.createDrawerInstance(o,l,u,p,d),Bg._=this.getDefaultDrawingOptions(),this._currentParent=t,({id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(Bg._.toSVGProperties(),Ng._.defaultSVGProperties),!0,!1)))}static _drawMove(t){var e;if(zg._=-1,!Ng._)return;const{offsetX:i,offsetY:n,pointerId:s}=t;Wg._===s&&((null===(e=Ug._)||void 0===e?void 0:e.size)>=1?this._endDraw(t):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,Ng._.add(i,n)),zg._=t.timeStamp,Ai(t)))}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,Ng._=null,Bg._=null,jg._=null,zg._=NaN),Og._&&(Og._.abort(),Og._=null,Wg._=NaN,Ug._=null)}static _endDraw(t){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(null===t||void 0===t?void 0:t.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,Ng._.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const t=Ng._,i=this._currentDrawId,n=t.getLastElement();return void e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(n))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:ae.DRAW_STEP})}this.endDrawing(!1)}}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(ae.DRAW_STEP),!Ng._.isEmpty()){const{pageDimensions:[i,n],scale:s}=e,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Ng._.getOutlines(i*s,n*s,s,this._INNER_MARGIN),drawingOptions:Bg._,mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,n,s,r){De("Not implemented")}static async deserialize(t,e,i){const{rawDims:{pageWidth:n,pageHeight:s,pageX:r,pageY:a}}=e.viewport,o=this.deserializeDraw(r,a,n,s,this._INNER_MARGIN,t),l=await super.deserialize(t,e,i);return l.createDrawingOptions(t),(0,_t.A)(kg,l,Mg).call(l,{drawOutlines:o}),(0,_t.A)(kg,l,Dg).call(l),l.onScaleChanging(),l.rotate(),l}serializeDraw(t){const[e,i]=this.pageTranslation,[n,s]=this.pageDimensions;return(0,zt.A)(Eg,this).serialize([e,i,n,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}function Mg(t){let{drawOutlines:e,drawId:i,drawingOptions:n}=t;(0,Ht.A)(Eg,this,e),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-".concat(this.editorType,"-added-alert")),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=(0,_t.A)(kg,this,Tg).call(this,e,this.parent),(0,_t.A)(kg,this,Ig).call(this,e.box)}function Tg(t,e){const{id:i}=e.drawLayer.draw(Wt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}function Pg(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function Dg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=(0,_t.A)(kg,this,Tg).call(this,(0,zt.A)(Eg,this),t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))}function Rg(t){let[e,i,n,s]=t;const{parentDimensions:[r,a],rotation:o}=this;switch(o){case 90:return[i,1-e,n*(a/r),s*(r/a)];case 180:return[1-e,1-i,n,s];case 270:return[1-i,e,n*(a/r),s*(r/a)];default:return[e,i,n,s]}}function Lg(){const{x:t,y:e,width:i,height:n,parentDimensions:[s,r],rotation:a}=this;switch(a){case 90:return[1-e,t,i*(s/r),n*(r/s)];case 180:return[1-t,1-e,i,n];case 270:return[e,1-t,i*(s/r),n*(r/s)];default:return[t,e,i,n]}}function Ig(t){[this.x,this.y,this.width,this.height]=(0,_t.A)(kg,this,Rg).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}function Fg(){const{x:t,y:e,width:i,height:n,rotation:s,parentRotation:r,parentDimensions:[a,o]}=this;switch((4*s+r)/90){case 1:return[1-e-n,t,n,i];case 2:return[1-t-i,1-e-n,i,n];case 3:return[e,1-t-i,n,i];case 4:return[t,e-i*(a/o),n*(o/a),i*(a/o)];case 5:return[1-e,t,i*(a/o),n*(o/a)];case 6:return[1-t-n*(o/a),1-e,n*(o/a),i*(a/o)];case 7:return[e-i*(a/o),1-t-n*(o/a),i*(a/o),n*(o/a)];case 8:return[t-i,e-n,i,n];case 9:return[1-e,t-i,n,i];case 10:return[1-t,1-e,i,n];case 11:return[e-n,1-t,n,i];case 12:return[t-n*(o/a),e,n*(o/a),i*(a/o)];case 13:return[1-e-i*(a/o),t-n*(o/a),i*(a/o),n*(o/a)];case 14:return[1-t,1-e-i*(a/o),n*(o/a),i*(a/o)];case 15:return[e,1-t,i*(a/o),n*(o/a)];default:return[t,e,i,n]}}Wt=Cg,(0,Vt.A)(Cg,"_currentDrawId",-1),(0,Vt.A)(Cg,"_currentParent",null);var Ng={_:null},Og={_:null},Bg={_:null},Wg={_:NaN},jg={_:null},Ug={_:null},zg={_:NaN};(0,Vt.A)(Cg,"_INNER_MARGIN",3);var Hg=new WeakMap,Vg=new WeakMap,Gg=new WeakMap,qg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Qg=new WeakMap,Jg=new WeakMap,Zg=new WeakMap,$g=new WeakMap,tm=new WeakSet;class em{constructor(t,e,i,n,s,r){(0,bt.A)(this,tm),(0,yt.A)(this,Hg,new Float64Array(6)),(0,yt.A)(this,Vg,void 0),(0,yt.A)(this,Gg,void 0),(0,yt.A)(this,qg,void 0),(0,yt.A)(this,Xg,void 0),(0,yt.A)(this,Yg,void 0),(0,yt.A)(this,Kg,""),(0,yt.A)(this,Qg,0),(0,yt.A)(this,Jg,new pm),(0,yt.A)(this,Zg,void 0),(0,yt.A)(this,$g,void 0),(0,Ht.A)(Zg,this,i),(0,Ht.A)($g,this,n),(0,Ht.A)(qg,this,s),(0,Ht.A)(Xg,this,r),[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const a=(0,Ht.A)(Vg,this,[NaN,NaN,NaN,NaN,t,e]);(0,Ht.A)(Yg,this,[t,e]),(0,Ht.A)(Gg,this,[{line:a,points:(0,zt.A)(Yg,this)}]),(0,zt.A)(Hg,this).set(a,0)}updateProperty(t,e){"stroke-width"===t&&(0,Ht.A)(Xg,this,e)}isEmpty(){return!(0,zt.A)(Gg,this)||0===(0,zt.A)(Gg,this).length}isCancellable(){return(0,zt.A)(Yg,this).length<=10}add(t,e){[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const[i,n,s,r]=(0,zt.A)(Hg,this).subarray(2,6),a=t-s,o=e-r;return Math.hypot((0,zt.A)(Zg,this)*a,(0,zt.A)($g,this)*o)<=2?null:((0,zt.A)(Yg,this).push(t,e),isNaN(i)?((0,zt.A)(Hg,this).set([s,r,t,e],2),(0,zt.A)(Vg,this).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN((0,zt.A)(Hg,this)[0])&&(0,zt.A)(Vg,this).splice(6,6),(0,zt.A)(Hg,this).set([i,n,s,r,t,e],0),(0,zt.A)(Vg,this).push(...UA.createBezierPoints(i,n,s,r,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(2===(0,zt.A)(Yg,this).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){(0,Ht.A)(Zg,this,i),(0,Ht.A)($g,this,n),(0,Ht.A)(qg,this,s),[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const r=(0,Ht.A)(Vg,this,[NaN,NaN,NaN,NaN,t,e]);(0,Ht.A)(Yg,this,[t,e]);const a=(0,zt.A)(Gg,this).at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),(0,zt.A)(Gg,this).push({line:r,points:(0,zt.A)(Yg,this)}),(0,zt.A)(Hg,this).set(r,0),(0,Ht.A)(Qg,this,0),this.toSVGPath(),null}getLastElement(){return(0,zt.A)(Gg,this).at(-1)}setLastElement(t){return(0,zt.A)(Gg,this)?((0,zt.A)(Gg,this).push(t),(0,Ht.A)(Vg,this,t.line),(0,Ht.A)(Yg,this,t.points),(0,Ht.A)(Qg,this,0),{path:{d:this.toSVGPath()}}):(0,zt.A)(Jg,this).setLastElement(t)}removeLastElement(){if(!(0,zt.A)(Gg,this))return(0,zt.A)(Jg,this).removeLastElement();(0,zt.A)(Gg,this).pop(),(0,Ht.A)(Kg,this,"");for(let t=0,e=(0,zt.A)(Gg,this).length;t<e;t++){const{line:e,points:i}=(0,zt.A)(Gg,this)[t];(0,Ht.A)(Vg,this,e),(0,Ht.A)(Yg,this,i),(0,Ht.A)(Qg,this,0),this.toSVGPath()}return{path:{d:(0,zt.A)(Kg,this)}}}toSVGPath(){const t=UA.svgRound((0,zt.A)(Vg,this)[4]),e=UA.svgRound((0,zt.A)(Vg,this)[5]);if(2===(0,zt.A)(Yg,this).length)return(0,Ht.A)(Kg,this,"".concat((0,zt.A)(Kg,this)," M ").concat(t," ").concat(e," Z")),(0,zt.A)(Kg,this);if((0,zt.A)(Yg,this).length<=6){const i=(0,zt.A)(Kg,this).lastIndexOf("M");(0,Ht.A)(Kg,this,"".concat((0,zt.A)(Kg,this).slice(0,i)," M ").concat(t," ").concat(e)),(0,Ht.A)(Qg,this,6)}if(4===(0,zt.A)(Yg,this).length){const t=UA.svgRound((0,zt.A)(Vg,this)[10]),e=UA.svgRound((0,zt.A)(Vg,this)[11]);return(0,Ht.A)(Kg,this,"".concat((0,zt.A)(Kg,this)," L ").concat(t," ").concat(e)),(0,Ht.A)(Qg,this,12),(0,zt.A)(Kg,this)}const i=[];0===(0,zt.A)(Qg,this)&&(i.push("M ".concat(t," ").concat(e)),(0,Ht.A)(Qg,this,6));for(let n=(0,zt.A)(Qg,this),s=(0,zt.A)(Vg,this).length;n<s;n+=6){const[t,e,s,r,a,o]=(0,zt.A)(Vg,this).slice(n,n+6).map(UA.svgRound);i.push("C".concat(t," ").concat(e," ").concat(s," ").concat(r," ").concat(a," ").concat(o))}return(0,Ht.A)(Kg,this,(0,zt.A)(Kg,this)+i.join(" ")),(0,Ht.A)(Qg,this,(0,zt.A)(Vg,this).length),(0,zt.A)(Kg,this)}getOutlines(t,e,i,n){const s=(0,zt.A)(Gg,this).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),(0,zt.A)(Jg,this).build((0,zt.A)(Gg,this),t,e,i,(0,zt.A)(qg,this),(0,zt.A)(Xg,this),n),(0,Ht.A)(Hg,this,null),(0,Ht.A)(Vg,this,null),(0,Ht.A)(Gg,this,null),(0,Ht.A)(Kg,this,null),(0,zt.A)(Jg,this)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}function im(t,e){return UA._normalizePoint(t,e,(0,zt.A)(Zg,this),(0,zt.A)($g,this),(0,zt.A)(qg,this))}var nm=new WeakMap,sm=new WeakMap,rm=new WeakMap,am=new WeakMap,om=new WeakMap,lm=new WeakMap,cm=new WeakMap,hm=new WeakMap,dm=new WeakMap,um=new WeakSet;class pm extends UA{constructor(){super(...arguments),(0,bt.A)(this,um),(0,yt.A)(this,nm,void 0),(0,yt.A)(this,sm,0),(0,yt.A)(this,rm,void 0),(0,yt.A)(this,am,void 0),(0,yt.A)(this,om,void 0),(0,yt.A)(this,lm,void 0),(0,yt.A)(this,cm,void 0),(0,yt.A)(this,hm,void 0),(0,yt.A)(this,dm,void 0)}build(t,e,i,n,s,r,a){(0,Ht.A)(om,this,e),(0,Ht.A)(lm,this,i),(0,Ht.A)(cm,this,n),(0,Ht.A)(hm,this,s),(0,Ht.A)(dm,this,r),(0,Ht.A)(rm,this,null!==a&&void 0!==a?a:0),(0,Ht.A)(am,this,t),(0,_t.A)(um,this,gm).call(this)}get thickness(){return(0,zt.A)(dm,this)}setLastElement(t){return(0,zt.A)(am,this).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return(0,zt.A)(am,this).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:e}of(0,zt.A)(am,this))if(t.push("M".concat(UA.svgRound(e[4])," ").concat(UA.svgRound(e[5]))),6!==e.length)if(12===e.length&&isNaN(e[6]))t.push("L".concat(UA.svgRound(e[10])," ").concat(UA.svgRound(e[11])));else for(let i=6,n=e.length;i<n;i+=6){const[n,s,r,a,o,l]=e.subarray(i,i+6).map(UA.svgRound);t.push("C".concat(n," ").concat(s," ").concat(r," ").concat(a," ").concat(o," ").concat(l))}else t.push("Z");return t.join("")}serialize(t,e){let[i,n,s,r]=t;const a=[],o=[],[l,c,h,d]=(0,_t.A)(um,this,fm).call(this);let u,p,A,f,g,m,v,w,b;switch((0,zt.A)(hm,this)){case 0:b=UA._rescale,u=i,p=n+r,A=s,f=-r,g=i+l*s,m=n+(1-c-d)*r,v=i+(l+h)*s,w=n+(1-c)*r;break;case 90:b=UA._rescaleAndSwap,u=i,p=n,A=s,f=r,g=i+c*s,m=n+l*r,v=i+(c+d)*s,w=n+(l+h)*r;break;case 180:b=UA._rescale,u=i+s,p=n,A=-s,f=r,g=i+(1-l-h)*s,m=n+c*r,v=i+(1-l)*s,w=n+(c+d)*r;break;case 270:b=UA._rescaleAndSwap,u=i+s,p=n+r,A=-s,f=-r,g=i+(1-c-d)*s,m=n+(1-l-h)*r,v=i+(1-c)*s,w=n+(1-l)*r}for(const{line:y,points:_}of(0,zt.A)(am,this))a.push(b(y,u,p,A,f,e?new Array(y.length):null)),o.push(b(_,u,p,A,f,e?new Array(_.length):null));return{lines:a,points:o,rect:[g,m,v,w]}}static deserialize(t,e,i,n,s,r){let{paths:{lines:a,points:o},rotation:l,thickness:c}=r;const h=[];let d,u,p,A,f;switch(l){case 0:f=UA._rescale,d=-t/i,u=e/n+1,p=1/i,A=-1/n;break;case 90:f=UA._rescaleAndSwap,d=-e/n,u=-t/i,p=1/n,A=1/i;break;case 180:f=UA._rescale,d=t/i+1,u=-e/n,p=-1/i,A=1/n;break;case 270:f=UA._rescaleAndSwap,d=e/n+1,u=t/i+1,p=-1/n,A=-1/i}if(!a){a=[];for(const t of o){const e=t.length;if(2===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}const i=new Float32Array(3*(e-2));a.push(i);let[n,s,r,o]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,n,s],0);for(let a=4;a<e;a+=2){const e=t[a],l=t[a+1];i.set(UA.createBezierPoints(n,s,r,o,e,l),3*(a-2)),[n,s,r,o]=[r,o,e,l]}}}for(let m=0,v=a.length;m<v;m++)h.push({line:f(a[m].map(t=>null!==t&&void 0!==t?t:NaN),d,u,p,A),points:f(o[m].map(t=>null!==t&&void 0!==t?t:NaN),d,u,p,A)});const g=new this.prototype.constructor;return g.build(h,i,n,1,l,c,s),g}get box(){return(0,zt.A)(nm,this)}updateProperty(t,e){return"stroke-width"===t?(0,_t.A)(um,this,mm).call(this,e):null}updateParentDimensions(t,e){let[i,n]=t;const[s,r]=(0,_t.A)(um,this,Am).call(this);(0,Ht.A)(om,this,i),(0,Ht.A)(lm,this,n),(0,Ht.A)(cm,this,e);const[a,o]=(0,_t.A)(um,this,Am).call(this),l=a-s,c=o-r,h=(0,zt.A)(nm,this);return h[0]-=l,h[1]-=c,h[2]+=2*l,h[3]+=2*c,h}updateRotation(t){return(0,Ht.A)(sm,this,t),{path:{transform:this.rotationTransform}}}get viewBox(){return(0,zt.A)(nm,this).map(UA.svgRound).join(" ")}get defaultProperties(){const[t,e]=(0,zt.A)(nm,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(t)," ").concat(UA.svgRound(e))}}}get rotationTransform(){const[,,t,e]=(0,zt.A)(nm,this);let i=0,n=0,s=0,r=0,a=0,o=0;switch((0,zt.A)(sm,this)){case 90:n=e/t,s=-t/e,a=t;break;case 180:i=-1,r=-1,a=t,o=e;break;case 270:n=-e/t,s=t/e,o=e;break;default:return""}return"matrix(".concat(i," ").concat(n," ").concat(s," ").concat(r," ").concat(UA.svgRound(a)," ").concat(UA.svgRound(o),")")}getPathResizingSVGProperties(t){let[e,i,n,s]=t;const[r,a]=(0,_t.A)(um,this,Am).call(this),[o,l,c,h]=(0,zt.A)(nm,this);if(Math.abs(c-r)<=UA.PRECISION||Math.abs(h-a)<=UA.PRECISION){const t=e+n/2-(o+c/2),r=i+s/2-(l+h/2);return{path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:"".concat(this.rotationTransform," translate(").concat(t," ").concat(r,")")}}}const d=(n-2*r)/(c-2*r),u=(s-2*a)/(h-2*a),p=c/n,A=h/s;return{path:{"transform-origin":"".concat(UA.svgRound(o)," ").concat(UA.svgRound(l)),transform:"".concat(this.rotationTransform," scale(").concat(p," ").concat(A,") ")+"translate(".concat(UA.svgRound(r)," ").concat(UA.svgRound(a),") scale(").concat(d," ").concat(u,") ")+"translate(".concat(UA.svgRound(-r)," ").concat(UA.svgRound(-a),")")}}}getPathResizedSVGProperties(t){let[e,i,n,s]=t;const[r,a]=(0,_t.A)(um,this,Am).call(this),o=(0,zt.A)(nm,this),[l,c,h,d]=o;if(o[0]=e,o[1]=i,o[2]=n,o[3]=s,Math.abs(h-r)<=UA.PRECISION||Math.abs(d-a)<=UA.PRECISION){const t=e+n/2-(l+h/2),r=i+s/2-(c+d/2);for(const{line:e,points:i}of(0,zt.A)(am,this))UA._translate(e,t,r,e),UA._translate(i,t,r,i);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(n-2*r)/(h-2*r),p=(s-2*a)/(d-2*a),A=-u*(l+r)+e+r,f=-p*(c+a)+i+a;if(1!==u||1!==p||0!==A||0!==f)for(const{line:g,points:m}of(0,zt.A)(am,this))UA._rescale(g,A,f,u,p,g),UA._rescale(m,A,f,u,p,m);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(t,e){let[i,n]=t;const[s,r]=e,a=(0,zt.A)(nm,this),o=i-a[0],l=n-a[1];if((0,zt.A)(om,this)===s&&(0,zt.A)(lm,this)===r)for(const{line:c,points:h}of(0,zt.A)(am,this))UA._translate(c,o,l,c),UA._translate(h,o,l,h);else{const t=(0,zt.A)(om,this)/s,e=(0,zt.A)(lm,this)/r;(0,Ht.A)(om,this,s),(0,Ht.A)(lm,this,r);for(const{line:i,points:n}of(0,zt.A)(am,this))UA._rescale(i,o,l,t,e,i),UA._rescale(n,o,l,t,e,n);a[2]*=t,a[3]*=e}return a[0]=i,a[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(UA.svgRound(i)," ").concat(UA.svgRound(n))}}}get defaultSVGProperties(){const t=(0,zt.A)(nm,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(UA.svgRound(t[0])," ").concat(UA.svgRound(t[1])),transform:this.rotationTransform||null},bbox:t}}}function Am(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,zt.A)(dm,this);const e=(0,zt.A)(rm,this)+t/2*(0,zt.A)(cm,this);return(0,zt.A)(hm,this)%180===0?[e/(0,zt.A)(om,this),e/(0,zt.A)(lm,this)]:[e/(0,zt.A)(lm,this),e/(0,zt.A)(om,this)]}function fm(){const[t,e,i,n]=(0,zt.A)(nm,this),[s,r]=(0,_t.A)(um,this,Am).call(this,0);return[t+s,e+r,i-2*s,n-2*r]}function gm(){const t=(0,Ht.A)(nm,this,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of(0,zt.A)(am,this)){if(n.length<=12){for(let e=4,i=n.length;e<i;e+=6)Xe.pointBoundingBox(n[e],n[e+1],t);continue}let e=n[4],i=n[5];for(let s=6,r=n.length;s<r;s+=6){const[r,a,o,l,c,h]=n.subarray(s,s+6);Xe.bezierBoundingBox(e,i,r,a,o,l,c,h,t),e=c,i=h}}const[e,i]=(0,_t.A)(um,this,Am).call(this);t[0]=ti(t[0]-e,0,1),t[1]=ti(t[1]-i,0,1),t[2]=ti(t[2]+e,0,1),t[3]=ti(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]}function mm(t){const[e,i]=(0,_t.A)(um,this,Am).call(this);(0,Ht.A)(dm,this,t);const[n,s]=(0,_t.A)(um,this,Am).call(this),[r,a]=[n-e,s-i],o=(0,zt.A)(nm,this);return o[0]-=r,o[1]-=a,o[2]+=2*r,o[3]+=2*a,o}class vm extends xg{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:na._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){"stroke-width"===t&&(null!==e&&void 0!==e||(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new vm(this._viewParameters);return t.updateAll(this),t}}var wm=new WeakSet;class bm extends Cg{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"inkEditor"})),(0,bt.A)(this,wm),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){na.initialize(t,e),this._defaultDrawingOptions=new vm(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Fe(this,"typesMap",new Map([[ae.INK_THICKNESS,"stroke-width"],[ae.INK_COLOR,"stroke"],[ae.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,n,s){return new em(t,e,i,n,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,n,s,r){return pm.deserialize(t,e,i,n,s,r)}static async deserialize(t,e,i){let n=null;if(t instanceof sA){const{data:{inkLists:e,rect:i,rotation:s,id:r,color:a,opacity:o,borderStyle:{rawWidth:l},popupRef:c,richText:h,contentsObj:d,creationDate:u,modificationDate:p},parent:{page:{pageNumber:A}}}=t;n=t={annotationType:re.INK,color:Array.from(a),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:A-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:c,richText:h,comment:(null===d||void 0===d?void 0:d.str)||null,creationDate:u,modificationDate:p}}const s=await super.deserialize(t,e,i);return s._initialData=n,t.comment&&s.setCommentData(t),s}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Eu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ae.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions(t){let{color:e,thickness:i,opacity:n}=t;this._drawingOptions=bm.getDefaultDrawingOptions({stroke:Xe.makeHexColor(...e),"stroke-width":i,"stroke-opacity":n})}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":s,"stroke-width":r}}=this,a=Object.assign(super.serialize(t),{color:na._colorManager.convert(n),opacity:s,thickness:r,paths:{lines:e,points:i}});return this.addComment(a),t?(a.isCopy=!0,a):this.annotationElementId&&!(0,_t.A)(wm,this,ym).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}function ym(t){const{color:e,thickness:i,opacity:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==n||t.pageIndex!==s}(0,Vt.A)(bm,"_type","ink"),(0,Vt.A)(bm,"_editorType",re.INK),(0,Vt.A)(bm,"_defaultDrawingOptions",null);class _m extends pm{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}class xm{static extractContoursFromText(t,e,i,n,s,r){let{fontFamily:a,fontStyle:o,fontWeight:l}=e,c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=h.font="".concat(o," ").concat(l," ").concat(200,"px ").concat(a),{actualBoundingBoxLeft:u,actualBoundingBoxRight:p,actualBoundingBoxAscent:A,actualBoundingBoxDescent:f,fontBoundingBoxAscent:g,fontBoundingBoxDescent:m,width:v}=h.measureText(t),w=1.5,b=Math.ceil(Math.max(Math.abs(u)+Math.abs(p)||0,v)*w),y=Math.ceil(Math.max(Math.abs(A)+Math.abs(f)||200,Math.abs(g)+Math.abs(m)||200)*w);c=new OffscreenCanvas(b,y),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=d,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,b,y),h.fillStyle="black",h.fillText(t,.5*b/2,1.5*y/2);const _=(0,_t.A)(xm,this,Rm).call(this,h.getImageData(0,0,b,y).data),x=(0,_t.A)(xm,this,Dm).call(this,_),E=(0,_t.A)(xm,this,Lm).call(this,x),S=(0,_t.A)(xm,this,Cm).call(this,_,b,y,E);return this.processDrawnLines({lines:{curves:S,width:b,height:y},pageWidth:i,pageHeight:n,rotation:s,innerMargin:r,mustSmooth:!0,areContours:!0})}static process(t,e,i,n,s){const[r,a,o]=(0,_t.A)(xm,this,Im).call(this,t),[l,c]=(0,_t.A)(xm,this,Pm).call(this,r,a,o,Math.hypot(a,o)*(0,_t.A)(xm,this,Fm)._.sigmaSFactor,(0,_t.A)(xm,this,Fm)._.sigmaR,(0,_t.A)(xm,this,Fm)._.kernelSize),h=(0,_t.A)(xm,this,Lm).call(this,c),d=(0,_t.A)(xm,this,Cm).call(this,l,a,o,h);return this.processDrawnLines({lines:{curves:d,width:a,height:o},pageWidth:e,pageHeight:i,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines(t){var e;let{lines:i,pageWidth:n,pageHeight:s,rotation:r,innerMargin:a,mustSmooth:o,areContours:l}=t;r%180!==0&&([n,s]=[s,n]);const{curves:c,width:h,height:d}=i,u=null!==(e=i.thickness)&&void 0!==e?e:0,p=[],A=Math.min(n/h,s/d),f=A/n,g=A/s,m=[];for(const{points:w}of c){const t=o?(0,_t.A)(xm,this,Tm).call(this,w):w;if(!t)continue;m.push(t);const e=t.length,i=new Float32Array(e),n=new Float32Array(3*(2===e?2:e-2));if(p.push({line:n,points:i}),2===e){i[0]=t[0]*f,i[1]=t[1]*g,n.set([NaN,NaN,NaN,NaN,i[0],i[1]],0);continue}let[s,r,a,l]=t;s*=f,r*=g,a*=f,l*=g,i.set([s,r,a,l],0),n.set([NaN,NaN,NaN,NaN,s,r],0);for(let o=4;o<e;o+=2){const e=i[o]=t[o]*f,c=i[o+1]=t[o+1]*g;n.set(UA.createBezierPoints(s,r,a,l,e,c),3*(o-2)),[s,r,a,l]=[a,l,e,c]}}if(0===p.length)return null;const v=l?new _m:new pm;return v.build(p,n,s,1,r,l?0:u,a),{outline:v,newCurves:m,areContours:l,thickness:u,width:h,height:d}}static async compressSignature(t){let e,{outlines:i,areContours:n,thickness:s,width:r,height:a}=t,o=1/0,l=-1/0,c=0;for(const v of i){c+=v.length;for(let t=2,e=v.length;t<e;t++){const e=v[t]-v[t-2];o=Math.min(o,e),l=Math.max(l,e)}}e=o>=-128&&l<=127?Int8Array:o>=-32768&&l<=32767?Int16Array:Int32Array;const h=i.length,d=8+3*h,u=new Uint32Array(d);let p=0;u[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*e.BYTES_PER_ELEMENT,u[p++]=0,u[p++]=r,u[p++]=a,u[p++]=n?0:1,u[p++]=Math.max(0,Math.floor(null!==s&&void 0!==s?s:0)),u[p++]=h,u[p++]=e.BYTES_PER_ELEMENT;for(const v of i)u[p++]=v.length-2,u[p++]=v[0],u[p++]=v[1];const A=new CompressionStream("deflate-raw"),f=A.writable.getWriter();await f.ready,f.write(u);const g=e.prototype.constructor;for(const v of i){const t=new g(v.length-2);for(let e=2,i=v.length;e<i;e++)t[e-2]=v[e]-v[e-2];f.write(t)}f.close();const m=await new Response(A.readable).arrayBuffer();return ei(new Uint8Array(m))}static async decompressSignature(t){try{const l=(a=t,Uint8Array.fromBase64?Uint8Array.fromBase64(a):Ve(atob(a))),{readable:c,writable:h}=new DecompressionStream("deflate-raw"),d=h.getWriter();await d.ready,d.write(l).then(async()=>{await d.ready,await d.close()}).catch(()=>{});let u=null,p=0;var e,i=!1,n=!1;try{for(var s,r=(0,Gt.A)(c);i=!(s=await r.next()).done;i=!1){const t=s.value;u||(u=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])),u.set(t,p),p+=t.length}}catch(o){n=!0,e=o}finally{try{i&&null!=r.return&&await r.return()}finally{if(n)throw e}}const A=new Uint32Array(u.buffer,0,u.length>>2),f=A[1];if(0!==f)throw new Error("Invalid version: ".concat(f));const g=A[2],m=A[3],v=0===A[4],w=A[5],b=A[6],y=A[7],_=[],x=(8+3*b)*Uint32Array.BYTES_PER_ELEMENT;let E;switch(y){case Int8Array.BYTES_PER_ELEMENT:E=new Int8Array(u.buffer,x);break;case Int16Array.BYTES_PER_ELEMENT:E=new Int16Array(u.buffer,x);break;case Int32Array.BYTES_PER_ELEMENT:E=new Int32Array(u.buffer,x)}p=0;for(let t=0;t<b;t++){const e=A[3*t+8],i=new Float32Array(e+2);_.push(i);for(let n=0;n<2;n++)i[n]=A[3*t+8+n+1];for(let t=0;t<e;t++)i[t+2]=i[t]+E[p++]}return{areContours:v,thickness:w,outlines:_,width:g,height:m}}catch(l){return Pe("decompressSignature: ".concat(l)),null}var a}}function Em(t,e,i,n){return n-=e,0===(i-=t)?n>0?0:4:1===i?n+6:2-n}function Sm(t,e,i,n,s,r,a){const o=(0,_t.A)(jt,this,Em).call(this,i,n,s,r);for(let l=0;l<8;l++){const s=(-l+o-a+16)%8;if(0!==t[(i+(0,_t.A)(jt,this,Nm)._[2*s])*e+(n+(0,_t.A)(jt,this,Nm)._[2*s+1])])return s}return-1}function km(t,e,i,n,s,r,a){const o=(0,_t.A)(jt,this,Em).call(this,i,n,s,r);for(let l=0;l<8;l++){const s=(l+o+a+16)%8;if(0!==t[(i+(0,_t.A)(jt,this,Nm)._[2*s])*e+(n+(0,_t.A)(jt,this,Nm)._[2*s+1])])return s}return-1}function Cm(t,e,i,n){const s=t.length,r=new Int32Array(s);for(let c=0;c<s;c++)r[c]=t[c]<=n?1:0;for(let c=1;c<i-1;c++)r[c*e]=r[c*e+e-1]=0;for(let c=0;c<e;c++)r[c]=r[e*i-1-c]=0;let a,o=1;const l=[];for(let c=1;c<i-1;c++){a=1;for(let t=1;t<e-1;t++){const i=c*e+t,n=r[i];if(0===n)continue;let s=c,h=t;if(1===n&&0===r[i-1])o+=1,h-=1;else{if(!(n>=1&&0===r[i+1])){1!==n&&(a=Math.abs(n));continue}o+=1,h+=1,n>1&&(a=n)}const d=[t,c],u=h===t+1,p={isHole:u,points:d,id:o,parent:0};let A;l.push(p);for(const t of l)if(t.id===a){A=t;break}A?A.isHole?p.parent=u?A.parent:a:p.parent=u?a:A.parent:p.parent=u?a:0;const f=(0,_t.A)(jt,this,Sm).call(this,r,e,c,t,s,h,0);if(-1===f){r[i]=-o,1!==r[i]&&(a=Math.abs(r[i]));continue}let g=(0,_t.A)(jt,this,Nm)._[2*f],m=(0,_t.A)(jt,this,Nm)._[2*f+1];const v=c+g,w=t+m;s=v,h=w;let b=c,y=t;for(;;){const n=(0,_t.A)(jt,this,km).call(this,r,e,b,y,s,h,1);g=(0,_t.A)(jt,this,Nm)._[2*n],m=(0,_t.A)(jt,this,Nm)._[2*n+1];const l=b+g,u=y+m;d.push(u,l);const p=b*e+y;if(0===r[p+1]?r[p]=-o:1===r[p]&&(r[p]=o),l===c&&u===t&&b===v&&y===w){1!==r[i]&&(a=Math.abs(r[i]));break}s=b,h=y,b=l,y=u}}}return l}function Mm(t,e,i,n){if(i-e<=4){for(let s=e;s<i-2;s+=2)n.push(t[s],t[s+1]);return}const s=t[e],r=t[e+1],a=t[i-4]-s,o=t[i-3]-r,l=Math.hypot(a,o),c=a/l,h=o/l,d=c*r-h*s,u=o/a,p=1/l,A=Math.atan(u),f=Math.cos(A),g=Math.sin(A),m=p*(Math.abs(f)+Math.abs(g)),v=p*(1-m+m**2),w=Math.max(Math.atan(Math.abs(g+f)*v),Math.atan(Math.abs(g-f)*v));let b=0,y=e;for(let _=e+2;_<i-2;_+=2){const e=Math.abs(d-c*t[_+1]+h*t[_]);e>b&&(y=_,b=e)}b>(l*w)**2?((0,_t.A)(jt,this,Mm).call(this,t,e,y+2,n),(0,_t.A)(jt,this,Mm).call(this,t,y,i,n)):n.push(s,r)}function Tm(t){const e=[],i=t.length;return(0,_t.A)(jt,this,Mm).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}function Pm(t,e,i,n,s,r){const a=new Float32Array(r**2),o=-2*n**2,l=r>>1;for(let A=0;A<r;A++){const t=(A-l)**2;for(let e=0;e<r;e++)a[A*r+e]=Math.exp((t+(e-l)**2)/o)}const c=new Float32Array(256),h=-2*s**2;for(let A=0;A<256;A++)c[A]=Math.exp(A**2/h);const d=t.length,u=new Uint8Array(d),p=new Uint32Array(256);for(let A=0;A<i;A++)for(let n=0;n<e;n++){const s=A*e+n,o=t[s];let h=0,d=0;for(let u=0;u<r;u++){const s=A+u-l;if(!(s<0||s>=i))for(let i=0;i<r;i++){const p=n+i-l;if(p<0||p>=e)continue;const A=t[s*e+p],f=a[u*r+i]*c[Math.abs(A-o)];h+=A*f,d+=f}}p[u[s]=Math.round(h/d)]++}return[u,p]}function Dm(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e}function Rm(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let n=-1/0,s=1/0;for(let a=0,o=i.length;a<o;a++){const e=i[a]=t[a<<2];n=Math.max(n,e),s=Math.min(s,e)}const r=255/(n-s);for(let a=0,o=i.length;a<o;a++)i[a]=(i[a]-s)*r;return i}function Lm(t){let e,i=-1/0,n=-1/0;const s=t.findIndex(t=>0!==t);let r=s,a=s;for(e=s;e<256;e++){const s=t[e];s>i&&(e-r>n&&(n=e-r,a=e-1),i=s,r=e)}for(e=a-1;e>=0&&!(t[e]>t[e+1]);e--);return e}function Im(t){const e=t,{width:i,height:n}=t,{maxDim:s}=(0,_t.A)(jt,this,Fm)._;let r=i,a=n;if(i>s||n>s){let o=i,l=n,c=Math.log2(Math.max(i,n)/s);const h=Math.floor(c);c=c===h?h-1:h;for(let i=0;i<c;i++){r=Math.ceil(o/2),a=Math.ceil(l/2);const i=new OffscreenCanvas(r,a);i.getContext("2d").drawImage(t,0,0,o,l,0,0,r,a),o=r,l=a,t!==e&&t.close(),t=i.transferToImageBitmap()}const d=Math.min(s/r,s/a);r=Math.round(r*d),a=Math.round(a*d)}const o=new OffscreenCanvas(r,a).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,r,a),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,r,a);const l=o.getImageData(0,0,r,a).data;return[(0,_t.A)(jt,this,Rm).call(this,l),r,a]}jt=xm;var Fm={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},Nm={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])};class Om extends xg{constructor(){super(),super.updateProperties({fill:na._defaultLineColor,"stroke-width":0})}clone(){const t=new Om;return t.updateAll(this),t}}class Bm extends vm{constructor(t){super(t),super.updateProperties({stroke:na._defaultLineColor,"stroke-width":1})}clone(){const t=new Bm(this._viewParameters);return t.updateAll(this),t}}var Wm=new WeakMap,jm=new WeakMap,Um=new WeakMap,zm=new WeakMap;class Hm extends Cg{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{mustBeCommitted:!0,name:"signatureEditor"})),(0,yt.A)(this,Wm,!1),(0,yt.A)(this,jm,null),(0,yt.A)(this,Um,null),(0,yt.A)(this,zm,null),this._willKeepAspectRatio=!0,(0,Ht.A)(Um,this,t.signatureData||null),(0,Ht.A)(jm,this,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){na.initialize(t,e),this._defaultDrawingOptions=new Om,this._defaultDrawnSignatureOptions=new Bm(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return Fe(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!(0,zt.A)(jm,this)}}static computeTelemetryFinalData(t){var e,i;const n=t.get("hasDescription");return{hasAltText:null!==(e=n.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=n.get(!1))&&void 0!==i?i:0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,e;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),null===this._drawId)if((0,zt.A)(Um,this)){const{lines:t,mustSmooth:e,areContours:i,description:n,uuid:s,heightInPage:r}=(0,zt.A)(Um,this),{rawDims:{pageWidth:a,pageHeight:o},rotation:l}=this.parent.viewport,c=xm.processDrawnLines({lines:t,pageWidth:a,pageHeight:o,rotation:l,innerMargin:Hm._INNER_MARGIN,mustSmooth:e,areContours:i});this.addSignature(c,r,n,s)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:(0,zt.A)(jm,this)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){(0,Ht.A)(zm,this,t),this.addEditToolbar()}getUuid(){return(0,zt.A)(zm,this)}get description(){return(0,zt.A)(jm,this)}set description(t){(0,Ht.A)(jm,this,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{null===e||void 0===e||e.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:i,width:n,height:s}=(0,zt.A)(Um,this),r=Math.max(n,s);return{areContours:e,outline:xm.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:n,height:s},pageWidth:r,pageHeight:r,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,n){const{x:s,y:r}=this,{outline:a}=(0,Ht.A)(Um,this,t);let o;(0,Ht.A)(Wm,this,a instanceof _m),this.description=i,(0,zt.A)(Wm,this)?o=Hm.getDefaultDrawingOptions():(o=Hm._defaultDrawnSignatureOptions.clone(),o.updateProperties({"stroke-width":a.thickness})),this._addOutlines({drawOutlines:a,drawingOptions:o});const[,l]=this.pageDimensions;let c=e/l;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=s,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return xm.process(t,e,i,n,Hm._INNER_MARGIN)}getFromText(t,e){const{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return xm.extractContoursFromText(t,e,i,n,s,Hm._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return xm.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:Hm._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions(t){let{areContours:e,thickness:i}=t;e?this._drawingOptions=Hm.getDefaultDrawingOptions():(this._drawingOptions=Hm._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:(0,zt.A)(Wm,this),color:[0,0,0],thickness:(0,zt.A)(Wm,this)?0:n});return this.addComment(s),t?(s.paths={lines:e,points:i},s.uuid=(0,zt.A)(zm,this),s.isCopy=!0):s.lines=e,(0,zt.A)(jm,this)&&(s.accessibilityData={type:"Figure",alt:(0,zt.A)(jm,this)}),s}static deserializeDraw(t,e,i,n,s,r){return r.areContours?_m.deserialize(t,e,i,n,s,r):pm.deserialize(t,e,i,n,s,r)}static async deserialize(t,e,i){var n;const s=await super.deserialize(t,e,i);return(0,Ht.A)(Wm,s,t.areContours),s.description=(null===(n=t.accessibilityData)||void 0===n?void 0:n.alt)||"",(0,Ht.A)(zm,s,t.uuid),s}}(0,Vt.A)(Hm,"_type","signature"),(0,Vt.A)(Hm,"_editorType",re.SIGNATURE),(0,Vt.A)(Hm,"_defaultDrawingOptions",null);var Vm=new WeakMap,Gm=new WeakMap,qm=new WeakMap,Xm=new WeakMap,Ym=new WeakMap,Km=new WeakMap,Qm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,$m=new WeakMap,tv=new WeakMap,ev=new WeakSet;class iv extends na{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"stampEditor"})),(0,bt.A)(this,ev),(0,yt.A)(this,Vm,null),(0,yt.A)(this,Gm,null),(0,yt.A)(this,qm,null),(0,yt.A)(this,Xm,null),(0,yt.A)(this,Ym,null),(0,yt.A)(this,Km,""),(0,yt.A)(this,Qm,null),(0,yt.A)(this,Jm,!1),(0,yt.A)(this,Zm,null),(0,yt.A)(this,$m,!1),(0,yt.A)(this,tv,!1),(0,Ht.A)(Xm,this,t.bitmapUrl),(0,Ht.A)(Ym,this,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){na.initialize(t,e)}static isHandlingMimeForPasting(t){return _i.includes(t)}static paste(t,e){e.pasteEditor({mode:re.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!(null===(t=this.altTextData)||void 0===t||!t.altText)}}static computeTelemetryFinalData(t){var e,i;const n=t.get("hasAltText");return{hasAltText:null!==(e=n.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=n.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:s,height:r}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:n,width:s,height:r,channels:n.length/(s*r)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");const o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var t;(0,zt.A)(Gm,this)&&((0,Ht.A)(Vm,this,null),this._uiManager.imageManager.deleteId((0,zt.A)(Gm,this)),null===(t=(0,zt.A)(Qm,this))||void 0===t||t.remove(),(0,Ht.A)(Qm,this,null),(0,zt.A)(Zm,this)&&(clearTimeout((0,zt.A)(Zm,this)),(0,Ht.A)(Zm,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&((0,zt.A)(Gm,this)&&null===(0,zt.A)(Qm,this)&&(0,_t.A)(ev,this,rv).call(this),this.isAttachedToDOM||this.parent.add(this))):(0,zt.A)(Gm,this)&&(0,_t.A)(ev,this,rv).call(this)}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!((0,zt.A)(qm,this)||(0,zt.A)(Vm,this)||(0,zt.A)(Xm,this)||(0,zt.A)(Ym,this)||(0,zt.A)(Gm,this)||(0,zt.A)(Jm,this))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),(0,zt.A)(Jm,this)||((0,zt.A)(Vm,this)?(0,_t.A)(ev,this,av).call(this):(0,_t.A)(ev,this,rv).call(this)),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&((0,Ht.A)(Gm,this,i),n&&(0,Ht.A)(Vm,this,n),(0,Ht.A)(Jm,this,!1),(0,_t.A)(ev,this,av).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==(0,zt.A)(Zm,this)&&clearTimeout((0,zt.A)(Zm,this));(0,Ht.A)(Zm,this,setTimeout(()=>{(0,Ht.A)(Zm,this,null),(0,_t.A)(ev,this,lv).call(this)},200))}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);const{width:n,height:s}=(0,zt.A)(Vm,this),r=new yi;let a=(0,zt.A)(Vm,this),o=n,l=s,c=null;if(e){if(n>e||s>e){const t=Math.min(e/n,e/s);o=Math.floor(n*t),l=Math.floor(s*t)}c=document.createElement("canvas");const t=c.width=Math.ceil(o*r.sx),i=c.height=Math.ceil(l*r.sy);(0,zt.A)($m,this)||(a=(0,_t.A)(ev,this,ov).call(this,t,i));const h=c.getContext("2d");h.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":xi.isDarkMode&&(d="#8f8f9d",u="#42414d");const p=15,A=p*r.sx,f=p*r.sy,g=new OffscreenCanvas(2*A,2*f),m=g.getContext("2d");m.fillStyle=d,m.fillRect(0,0,2*A,2*f),m.fillStyle=u,m.fillRect(0,0,A,f),m.fillRect(A,f,A,f),h.fillStyle=h.createPattern(g,"repeat"),h.fillRect(0,0,t,i),h.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let h=null;if(i){let e,i;if(r.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=(0,zt.A)(Vm,this),n>t||s>t){const r=Math.min(t/n,t/s);e=Math.floor(n*r),i=Math.floor(s*r),(0,zt.A)($m,this)||(a=(0,_t.A)(ev,this,ov).call(this,e,i))}const o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),h={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:c,width:o,height:l,imageData:h}}static async deserialize(t,e,i){let n=null,s=!1;if(t instanceof hA){var r;const{data:{rect:a,rotation:o,id:l,structParent:c,popupRef:h,richText:d,contentsObj:u,creationDate:p,modificationDate:A},container:f,parent:{page:{pageNumber:g}},canvas:m}=t;let v,w;m?(delete t.canvas,({id:v,bitmap:w}=i.imageManager.getFromCanvas(f.id,m)),m.remove()):(s=!0,t._hasNoCanvas=!0);const b=(null===(r=await e._structTree.getAriaAttributes("".concat($e).concat(l)))||void 0===r?void 0:r.get("aria-label"))||"";n=t={annotationType:re.STAMP,bitmapId:v,bitmap:w,pageIndex:g-1,rect:a.slice(0),rotation:o,annotationElementId:l,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:b},isSvg:!1,structParent:c,popupRef:h,richText:d,comment:(null===u||void 0===u?void 0:u.str)||null,creationDate:p,modificationDate:A}}const a=await super.deserialize(t,e,i),{rect:o,bitmap:l,bitmapUrl:c,bitmapId:h,isSvg:d,accessibilityData:u}=t;s?(i.addMissingCanvas(t.id,a),(0,Ht.A)(Jm,a,!0)):h&&i.imageManager.isValidId(h)?((0,Ht.A)(Gm,a,h),l&&(0,Ht.A)(Vm,a,l)):(0,Ht.A)(Xm,a,c),(0,Ht.A)($m,a,d);const[p,A]=a.pageDimensions;return a.width=(o[2]-o[0])/p,a.height=(o[3]-o[1])/A,u&&(a.altTextData=u),a._initialData=n,t.comment&&a.setCommentData(t),(0,Ht.A)(tv,a,!!n),a}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:(0,zt.A)(Gm,this),isSvg:(0,zt.A)($m,this)});if(this.addComment(i),t)return i.bitmapUrl=(0,_t.A)(ev,this,cv).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:s}=this.serializeAltText(!1);if(!n&&s&&(i.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){const t=(0,_t.A)(ev,this,hv).call(this,i);if(t.isSame)return null;var r;if(t.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=null!==(r=this._initialData.structParent)&&void 0!==r?r:-1;return i.id=this.annotationElementId,delete i.bitmapId,i}if(null===e)return i;e.stamps||(e.stamps=new Map);const a=(0,zt.A)($m,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has((0,zt.A)(Gm,this))){if((0,zt.A)($m,this)){const t=e.stamps.get((0,zt.A)(Gm,this));a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=(0,_t.A)(ev,this,cv).call(this,!1))}}else e.stamps.set((0,zt.A)(Gm,this),{area:a,serialized:i}),i.bitmap=(0,_t.A)(ev,this,cv).call(this,!1);return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}function nv(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?((0,Ht.A)(Vm,this,t.bitmap),e||((0,Ht.A)(Gm,this,t.id),(0,Ht.A)($m,this,t.isSvg)),t.file&&(0,Ht.A)(Km,this,t.file.name),(0,_t.A)(ev,this,av).call(this)):this.remove()}function sv(){if((0,Ht.A)(qm,this,null),this._uiManager.enableWaiting(!1),(0,zt.A)(Qm,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,zt.A)(Vm,this))this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,zt.A)(Vm,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function rv(){if((0,zt.A)(Gm,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId((0,zt.A)(Gm,this)).then(t=>(0,_t.A)(ev,this,nv).call(this,t,!0)).finally(()=>(0,_t.A)(ev,this,sv).call(this));if((0,zt.A)(Xm,this)){const t=(0,zt.A)(Xm,this);return(0,Ht.A)(Xm,this,null),this._uiManager.enableWaiting(!0),void(0,Ht.A)(qm,this,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,_t.A)(ev,this,nv).call(this,t)).finally(()=>(0,_t.A)(ev,this,sv).call(this)))}if((0,zt.A)(Ym,this)){const t=(0,zt.A)(Ym,this);return(0,Ht.A)(Ym,this,null),this._uiManager.enableWaiting(!0),void(0,Ht.A)(qm,this,this._uiManager.imageManager.getFromFile(t).then(t=>(0,_t.A)(ev,this,nv).call(this,t)).finally(()=>(0,_t.A)(ev,this,sv).call(this)))}const t=document.createElement("input");t.type="file",t.accept=_i.join(",");const e=this._uiManager._signal;(0,Ht.A)(qm,this,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),(0,_t.A)(ev,this,nv).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,_t.A)(ev,this,sv).call(this))),t.click()}function av(){var t;const{div:e}=this;let{width:i,height:n}=(0,zt.A)(Vm,this);const[s,r]=this.pageDimensions,a=.75;if(this.width)i=this.width*s,n=this.height*r;else if(i>a*s||n>a*r){const t=Math.min(a*s/i,a*r/n);i*=t,n*=t}this._uiManager.enableWaiting(!1);const o=(0,Ht.A)(Qm,this,document.createElement("canvas"));o.setAttribute("role","img"),this.addContainer(o),this.width=i/s,this.height=n/r,this.setDims(),null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),(0,_t.A)(ev,this,lv).call(this),(0,zt.A)(tv,this)||(this.parent.addUndoableEditor(this),(0,Ht.A)(tv,this,!0)),this._reportTelemetry({action:"inserted_image"}),(0,zt.A)(Km,this)&&this.div.setAttribute("aria-description",(0,zt.A)(Km,this)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function ov(t,e){const{width:i,height:n}=(0,zt.A)(Vm,this);let s=i,r=n,a=(0,zt.A)(Vm,this);for(;s>2*t||r>2*e;){const i=s,n=r;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const o=new OffscreenCanvas(s,r);o.getContext("2d").drawImage(a,0,0,i,n,0,0,s,r),a=o.transferToImageBitmap()}return a}function lv(){const[t,e]=this.parentDimensions,{width:i,height:n}=this,s=new yi,r=Math.ceil(i*t*s.sx),a=Math.ceil(n*e*s.sy),o=(0,zt.A)(Qm,this);if(!o||o.width===r&&o.height===a)return;o.width=r,o.height=a;const l=(0,zt.A)($m,this)?(0,zt.A)(Vm,this):(0,_t.A)(ev,this,ov).call(this,r,a),c=o.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(l,0,0,l.width,l.height,0,0,r,a)}function cv(t){if(t){if((0,zt.A)($m,this)){const t=this._uiManager.imageManager.getSvgUrl((0,zt.A)(Gm,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=(0,zt.A)(Vm,this));return t.getContext("2d").drawImage((0,zt.A)(Vm,this),0,0),t.toDataURL()}if((0,zt.A)($m,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*ri.PDF_TO_CSS_UNITS),n=Math.round(this.height*e*ri.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage((0,zt.A)(Vm,this),0,0,(0,zt.A)(Vm,this).width,(0,zt.A)(Vm,this).height,0,0,i,n),s.transferToImageBitmap()}return structuredClone((0,zt.A)(Vm,this))}function hv(t){var e;const{pageIndex:i,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===i,r=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&r,isSameAltText:r}}(0,Vt.A)(iv,"_type","stamp"),(0,Vt.A)(iv,"_editorType",re.STAMP);var dv=new WeakMap,uv=new WeakMap,pv=new WeakMap,Av=new WeakMap,fv=new WeakMap,gv=new WeakMap,mv=new WeakMap,vv=new WeakMap,wv=new WeakMap,bv=new WeakMap,yv=new WeakMap,_v=new WeakMap,xv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,kv=new WeakMap,Cv=new WeakSet;class Mv{constructor(t){let{uiManager:e,pageIndex:i,div:n,structTreeLayer:s,accessibilityManager:r,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}=t;(0,bt.A)(this,Cv),(0,yt.A)(this,dv,void 0),(0,yt.A)(this,uv,!1),(0,yt.A)(this,pv,null),(0,yt.A)(this,Av,null),(0,yt.A)(this,fv,null),(0,yt.A)(this,gv,new Map),(0,yt.A)(this,mv,!1),(0,yt.A)(this,vv,!1),(0,yt.A)(this,wv,!1),(0,yt.A)(this,bv,null),(0,yt.A)(this,yv,null),(0,yt.A)(this,_v,null),(0,yt.A)(this,xv,null),(0,yt.A)(this,Ev,null),(0,yt.A)(this,Sv,-1),(0,yt.A)(this,kv,void 0);const d=[...Fv._.values()];if(!Mv._initialized){Mv._initialized=!0;for(const t of d)t.initialize(h,e)}e.registerEditorTypes(d),(0,Ht.A)(kv,this,e),this.pageIndex=i,this.div=n,(0,Ht.A)(dv,this,r),(0,Ht.A)(pv,this,a),this.viewport=c,(0,Ht.A)(_v,this,l),this.drawLayer=o,this._structTree=s,(0,zt.A)(kv,this).addLayer(this)}get isEmpty(){return 0===(0,zt.A)(gv,this).size}get isInvisible(){return this.isEmpty&&(0,zt.A)(kv,this).getMode()===re.NONE}updateToolbar(t){(0,zt.A)(kv,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,zt.A)(kv,this).getMode();switch((0,_t.A)(Cv,this,Iv).call(this),t){case re.NONE:return this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case re.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case re.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===re.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const i of Fv._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=(0,zt.A)(_v,this))||void 0===e?void 0:e.div)}setEditingState(t){(0,zt.A)(kv,this).setEditingState(t)}addCommands(t){(0,zt.A)(kv,this).addCommands(t)}cleanUndoStack(t){(0,zt.A)(kv,this).cleanUndoStack(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(0,zt.A)(pv,this))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){var t;(0,Ht.A)(wv,this,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),null===(t=(0,zt.A)(Ev,this))||void 0===t||t.abort(),(0,Ht.A)(Ev,this,null);const e=new Set;for(const n of xt(Cv,this,Tv))n.enableEditing(),n.show(!0),n.annotationElementId&&((0,zt.A)(kv,this).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));const i=(0,zt.A)(pv,this);if(i)for(const n of i.getEditableAnnotations()){if(n.hide(),(0,zt.A)(kv,this).isDeletedAnnotationElement(n.data.id))continue;if(e.has(n.data.id))continue;const t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}(0,Ht.A)(wv,this,!1),(0,zt.A)(kv,this)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if((0,Ht.A)(vv,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),(0,zt.A)(_v,this)&&!(0,zt.A)(Ev,this)){(0,Ht.A)(Ev,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(Ev,this));(0,zt.A)(_v,this).div.addEventListener("pointerdown",t=>{const{clientX:e,clientY:i,timeStamp:n}=t;if(n-(0,zt.A)(Sv,this)>500)return void(0,Ht.A)(Sv,this,n);(0,Ht.A)(Sv,this,-1);const{classList:s}=this.div;s.toggle("getElements",!0);const r=document.elementsFromPoint(e,i);if(s.toggle("getElements",!1),!this.div.contains(r[0]))return;let a;const o=new RegExp("^".concat(se,"[0-9]+$"));for(const c of r)if(o.test(c.id)){a=c.id;break}if(!a)return;const l=(0,zt.A)(gv,this).get(a);null===(null===l||void 0===l?void 0:l.annotationElementId)&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}const t=(0,zt.A)(pv,this);if(t){const i=new Map,n=new Map;for(const r of xt(Cv,this,Tv)){var e;r.disableEditing(),r.annotationElementId?null===r.serialize()?(n.set(r.annotationElementId,r),null===(e=this.getEditableAnnotation(r.annotationElementId))||void 0===e||e.show(),r.remove()):i.set(r.annotationElementId,r):r.updateFakeAnnotationElement(t)}const s=t.getEditableAnnotations();for(const t of s){const{id:e}=t.data;if((0,zt.A)(kv,this).isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let s=n.get(e);s?(s.resetAnnotationElement(t),s.show(!1),t.show()):(s=i.get(e),s&&((0,zt.A)(kv,this).addChangedExistingAnnotation(s),s.renderAnnotationElement(t)&&s.show(!1)),t.show())}}(0,_t.A)(Cv,this,Iv).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const n of Fv._.values())i.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,Ht.A)(vv,this,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,zt.A)(pv,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,zt.A)(kv,this).getActive()!==t&&(0,zt.A)(kv,this).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,null!==(t=(0,zt.A)(_v,this))&&void 0!==t&&t.div&&!(0,zt.A)(xv,this)){(0,Ht.A)(xv,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(xv,this));(0,zt.A)(_v,this).div.addEventListener("pointerdown",(0,_t.A)(Cv,this,Pv).bind(this),{signal:t}),(0,zt.A)(_v,this).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=(0,zt.A)(_v,this))&&void 0!==t&&t.div&&(0,zt.A)(xv,this)&&((0,zt.A)(xv,this).abort(),(0,Ht.A)(xv,this,null),(0,zt.A)(_v,this).div.classList.remove("highlighting"))}enableClick(){if((0,zt.A)(Av,this))return;(0,Ht.A)(Av,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(Av,this));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null===(t=(0,zt.A)(Av,this))||void 0===t||t.abort(),(0,Ht.A)(Av,this,null)}attach(t){(0,zt.A)(gv,this).set(t.id,t);const{annotationElementId:e}=t;e&&(0,zt.A)(kv,this).isDeletedAnnotationElement(e)&&(0,zt.A)(kv,this).removeDeletedAnnotationElement(t)}detach(t){var e;(0,zt.A)(gv,this).delete(t.id),null===(e=(0,zt.A)(dv,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,zt.A)(vv,this)&&t.annotationElementId&&(0,zt.A)(kv,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,zt.A)(kv,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,zt.A)(kv,this).addDeletedAnnotationElement(t.annotationElementId),na.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,zt.A)(kv,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!(0,zt.A)(wv,this)),(0,zt.A)(kv,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!(0,zt.A)(fv,this)&&(t._focusEventsAllowed=!1,(0,Ht.A)(fv,this,setTimeout(()=>{(0,Ht.A)(fv,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,zt.A)(kv,this)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=(0,zt.A)(dv,this))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(const e of(0,zt.A)(gv,this).values())if(e.uid===t)return e;return null}getNextId(){return(0,zt.A)(kv,this).getId()}combinedSignal(t){return(0,zt.A)(kv,this).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=xt(Cv,this,Dv))||void 0===t?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await(0,zt.A)(kv,this).updateMode(t.mode);const{offsetX:i,offsetY:n}=(0,_t.A)(Cv,this,Lv).call(this),s=this.getNextId(),r=(0,_t.A)(Cv,this,Rv).call(this,(0,wt.A)({parent:this,id:s,x:i,y:n,uiManager:(0,zt.A)(kv,this),isCentered:!0},e));r&&this.add(r)}async deserialize(t){var e,i;return await(null===(e=Fv._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,zt.A)(kv,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),s=(0,_t.A)(Cv,this,Rv).call(this,(0,wt.A)({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:(0,zt.A)(kv,this),isCentered:e},i));return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor((0,_t.A)(Cv,this,Lv).call(this),!0,t)}setSelected(t){(0,zt.A)(kv,this).setSelected(t)}toggleSelected(t){(0,zt.A)(kv,this).toggleSelected(t)}unselect(t){(0,zt.A)(kv,this).unselect(t)}pointerup(t){var e;const{isMac:i}=Ge.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(!(0,zt.A)(mv,this))return;if((0,Ht.A)(mv,this,!1),null!==(e=xt(Cv,this,Dv))&&void 0!==e&&e.isDrawer&&xt(Cv,this,Dv).supportMultipleDrawings)return;if(!(0,zt.A)(uv,this))return void(0,Ht.A)(uv,this,!0);const n=(0,zt.A)(kv,this).getMode();n!==re.STAMP&&n!==re.SIGNATURE?this.createAndAddNewEditor(t,!1):(0,zt.A)(kv,this).unselectAll()}pointerdown(t){var e;if((0,zt.A)(kv,this).getMode()===re.HIGHLIGHT&&this.enableTextSelection(),(0,zt.A)(mv,this))return void(0,Ht.A)(mv,this,!1);const{isMac:i}=Ge.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if((0,Ht.A)(mv,this,!0),null!==(e=xt(Cv,this,Dv))&&void 0!==e&&e.isDrawer)return void this.startDrawingSession(t);const n=(0,zt.A)(kv,this).getActive();(0,Ht.A)(uv,this,!n||n.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),(0,zt.A)(bv,this))return void xt(Cv,this,Dv).startDrawing(this,(0,zt.A)(kv,this),!1,t);(0,zt.A)(kv,this).setCurrentDrawingSession(this),(0,Ht.A)(bv,this,new AbortController);const e=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(bv,this));this.div.addEventListener("blur",t=>{let{relatedTarget:e}=t;e&&!this.div.contains(e)&&((0,Ht.A)(yv,this,null),this.commitOrRemove())},{signal:e}),xt(Cv,this,Dv).startDrawing(this,(0,zt.A)(kv,this),!1,t)}pause(t){if(t){const{activeElement:t}=document;return void(this.div.contains(t)&&(0,Ht.A)(yv,this,t))}(0,zt.A)(yv,this)&&setTimeout(()=>{var t;null===(t=(0,zt.A)(yv,this))||void 0===t||t.focus(),(0,Ht.A)(yv,this,null)},0)}endDrawingSession(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,zt.A)(bv,this)?((0,zt.A)(kv,this).setCurrentDrawingSession(null),(0,zt.A)(bv,this).abort(),(0,Ht.A)(bv,this,null),(0,Ht.A)(yv,this,null),xt(Cv,this,Dv).endDrawing(t)):null}findNewParent(t,e,i){const n=(0,zt.A)(kv,this).findParent(e,i);return null!==n&&n!==this&&(n.changeParent(t),!0)}commitOrRemove(){return!!(0,zt.A)(bv,this)&&(this.endDrawingSession(),!0)}onScaleChanging(){(0,zt.A)(bv,this)&&xt(Cv,this,Dv).onScaleChangingWhenDrawing(this)}destroy(){var t;this.commitOrRemove(),(null===(t=(0,zt.A)(kv,this).getActive())||void 0===t?void 0:t.parent)===this&&((0,zt.A)(kv,this).commitOrRemove(),(0,zt.A)(kv,this).setActiveEditor(null)),(0,zt.A)(fv,this)&&(clearTimeout((0,zt.A)(fv,this)),(0,Ht.A)(fv,this,null));for(const i of(0,zt.A)(gv,this).values()){var e;null===(e=(0,zt.A)(dv,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,(0,zt.A)(gv,this).clear(),(0,zt.A)(kv,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,bi(this.div,e);for(const i of(0,zt.A)(kv,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,zt.A)(kv,this).commitOrRemove(),(0,_t.A)(Cv,this,Iv).call(this);const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,bi(this.div,{rotation:n}),i!==n)for(const s of(0,zt.A)(gv,this).values())s.rotate(n)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,zt.A)(kv,this).viewParameters.realScale}}function Tv(t){return 0!==(0,zt.A)(gv,t).size?(0,zt.A)(gv,t).values():(0,zt.A)(kv,t).getEditors(t.pageIndex)}function Pv(t){(0,zt.A)(kv,this).unselectAll();const{target:e}=t;if(e===(0,zt.A)(_v,this).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,zt.A)(_v,this).div.contains(e)){const{isMac:e}=Ge.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,zt.A)(kv,this).showAllEditors("highlight",!0,!0),(0,zt.A)(_v,this).div.classList.add("free"),this.toggleDrawing(),rg.startHighlighting(this,"ltr"===(0,zt.A)(kv,this).direction,{target:(0,zt.A)(_v,this).div,x:t.x,y:t.y}),(0,zt.A)(_v,this).div.addEventListener("pointerup",()=>{(0,zt.A)(_v,this).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:(0,zt.A)(kv,this)._signal}),t.preventDefault()}}function Dv(t){return Fv._.get((0,zt.A)(kv,t).getMode())}function Rv(t){const e=xt(Cv,this,Dv);return e?new e.prototype.constructor(t):null}function Lv(){const{x:t,y:e,width:i,height:n}=this.boundingClientRect,s=Math.max(0,t),r=Math.max(0,e),a=(s+Math.min(window.innerWidth,t+i))/2-t,o=(r+Math.min(window.innerHeight,e+n))/2-e,[l,c]=this.viewport.rotation%180===0?[a,o]:[o,a];return{offsetX:l,offsetY:c}}function Iv(){for(const t of(0,zt.A)(gv,this).values())t.isEmpty()&&t.remove()}(0,Vt.A)(Mv,"_initialized",!1);var Fv={_:new Map([DA,bm,iv,rg,Hm].map(t=>[t._editorType,t]))},Nv=new WeakMap,Ov=new WeakMap,Bv=new WeakMap,Wv=new WeakSet;class jv{constructor(t){let{pageIndex:e}=t;(0,bt.A)(this,Wv),(0,yt.A)(this,Nv,null),(0,yt.A)(this,Ov,new Map),(0,yt.A)(this,Bv,new Map),this.pageIndex=e}setParent(t){if((0,zt.A)(Nv,this)){if((0,zt.A)(Nv,this)!==t){if((0,zt.A)(Ov,this).size>0)for(const e of(0,zt.A)(Ov,this).values())e.remove(),t.append(e);(0,Ht.A)(Nv,this,t)}}else(0,Ht.A)(Nv,this,t)}static get _svgFactory(){return Fe(this,"_svgFactory",new Pu)}draw(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=(Gv._=(e=Gv._,i=e++,e),i),a=(0,_t.A)(Wv,this,zv).call(this),o=jv._svgFactory.createElement("defs");a.append(o);const l=jv._svgFactory.createElement("path");o.append(l);const c="path_p".concat(this.pageIndex,"_").concat(r);l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),n&&(0,zt.A)(Bv,this).set(r,l);const h=s?(0,_t.A)(Wv,this,Hv).call(this,o,c):null,d=jv._svgFactory.createElement("use");return a.append(d),d.setAttribute("href","#".concat(c)),this.updateProperties(a,t),(0,zt.A)(Ov,this).set(r,a),{id:r,clipPathId:"url(#".concat(h,")")}}drawOutline(t,e){var i,n;const s=(Gv._=(i=Gv._,n=i++,i),n),r=(0,_t.A)(Wv,this,zv).call(this),a=jv._svgFactory.createElement("defs");r.append(a);const o=jv._svgFactory.createElement("path");a.append(o);const l="path_p".concat(this.pageIndex,"_").concat(s);let c;if(o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e){const t=jv._svgFactory.createElement("mask");a.append(t),c="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",c),t.setAttribute("maskUnits","objectBoundingBox");const e=jv._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=jv._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(l)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const h=jv._svgFactory.createElement("use");r.append(h),h.setAttribute("href","#".concat(l)),c&&h.setAttribute("mask","url(#".concat(c,")"));const d=h.cloneNode();return r.append(d),h.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(r,t),(0,zt.A)(Ov,this).set(s,r),s}finalizeDraw(t,e){(0,zt.A)(Bv,this).delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;const{root:i,bbox:n,rootClass:s,path:r}=e,a="number"===typeof t?(0,zt.A)(Ov,this).get(t):t;if(a){if(i&&(0,_t.A)(Wv,this,Vv).call(this,a,i),n&&Uv.call(jv,a,n),s){const{classList:t}=a;for(const[e,i]of Object.entries(s))t.toggle(e,i)}if(r){const t=a.firstChild.firstChild;(0,_t.A)(Wv,this,Vv).call(this,t,r)}}}updateParent(t,e){if(e===this)return;const i=(0,zt.A)(Ov,this).get(t);i&&((0,zt.A)(Nv,e).append(i),(0,zt.A)(Ov,this).delete(t),(0,zt.A)(Ov,e).set(t,i))}remove(t){(0,zt.A)(Bv,this).delete(t),null!==(0,zt.A)(Nv,this)&&((0,zt.A)(Ov,this).get(t).remove(),(0,zt.A)(Ov,this).delete(t))}destroy(){(0,Ht.A)(Nv,this,null);for(const t of(0,zt.A)(Ov,this).values())t.remove();(0,zt.A)(Ov,this).clear(),(0,zt.A)(Bv,this).clear()}}function Uv(t,e){let[i,n,s,r]=e;const{style:a}=t;a.top="".concat(100*n,"%"),a.left="".concat(100*i,"%"),a.width="".concat(100*s,"%"),a.height="".concat(100*r,"%")}function zv(){const t=Ut._svgFactory.create(1,1,!0);return(0,zt.A)(Nv,this).append(t),t.setAttribute("aria-hidden",!0),t}function Hv(t,e){const i=Ut._svgFactory.createElement("clipPath");t.append(i);const n="clip_".concat(e);i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=Ut._svgFactory.createElement("use");return i.append(s),s.setAttribute("href","#".concat(e)),s.classList.add("clip"),n}function Vv(t,e){for(const[i,n]of Object.entries(e))null===n?t.removeAttribute(i):t.setAttribute(i,n)}Ut=jv;var Gv={_:0};globalThis._pdfjsTestingUtils={HighlightOutliner:Tf},globalThis.pdfjsLib={AbortException:ze,AnnotationEditorLayer:Mv,AnnotationEditorParamsType:ae,AnnotationEditorType:re,AnnotationEditorUIManager:fs,AnnotationLayer:_A,AnnotationMode:ne,AnnotationType:Ae,applyOpacity:function(t,e,i,n){const s=255*(1-(n=Math.min(Math.max(null!==n&&void 0!==n?n:1,0),1)));return[t=Math.round(t*n+s),e=Math.round(e*n+s),i=Math.round(i*n+s)]},build:"f56dc8601",ColorPicker:pu,createValidAbsoluteUrl:Le,CSSConstants:class{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),Fe(this,"commentForegroundColor",mi(i))}},DOMSVGFactory:Pu,DrawLayer:jv,FeatureTest:Ge,fetchData:ai,findContrastColor:function(t,e){const i=t[0]+256*t[1]+65536*t[2]+16777216*e[0]+4294967296*e[1]+1099511627776*e[2];let n=Mi.get(i);if(n)return n;const s=new Float32Array(9),r=s.subarray(0,3),a=s.subarray(3,6);Ei(t,a);const o=s.subarray(6,9);Ei(e,o);const l=o[2]<.5,c=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),Ci(a,o,r)<c){let t,e;l?(t=a[2],e=1):(t=0,e=a[2]);const i=.005;for(;e-t>i;){const i=a[2]=(t+e)/2;l===Ci(a,o,r)<c?t=i:e=i}a[2]=l?e:t}return Si(a,r),n=Xe.makeHexColor(Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])),Mi.set(i,n),n},getDocument:fd,getFilenameFromUrl:function(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)},getPdfFilenameFromUrl:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(ci(t))return Pe('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=(t=>{try{return new URL(t)}catch(e){try{return new URL(decodeURIComponent(t))}catch(i){try{return new URL(t,"https://foo.bar")}catch(n){try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch(s){return null}}}}})(t);if(!i)return e;const n=t=>{try{let e=decodeURIComponent(t);return e.includes("/")?(e=e.split("/").at(-1),e.test(/^\.pdf$/i)?e:t):e}catch(e){return t}},s=/\.pdf$/i,r=i.pathname.split("/").at(-1);if(s.test(r))return n(r);if(i.searchParams.size>0){const t=Array.from(i.searchParams.values()).reverse();for(const i of t)if(s.test(i))return n(i);const e=Array.from(i.searchParams.keys()).reverse();for(const i of e)if(s.test(i))return n(i)}if(i.hash){const t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return n(t[0])}return e},getRGB:mi,getUuid:Ze,getXfaPageViewport:function(t,e){let{scale:i=1,rotation:n=0}=e;const{width:s,height:r}=t.attributes.style,a=[0,0,parseInt(s),parseInt(r)];return new oi({viewBox:a,userUnit:1,scale:i,rotation:n})},GlobalWorkerOptions:Gc,ImageKind:pe,InvalidPDFException:We,isDataScheme:ci,isPdfFile:hi,isValidExplicitDest:Va,MathClamp:ti,noContextMenu:pi,normalizeUnicode:function(t){return Qe||(Qe=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFBD3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,Je=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Qe,(t,e,i)=>e?e.normalize("NFKC"):Je.get(i))},OPS:ye,OutputScale:yi,PasswordResponses:{NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PDFDataRangeTransport:xd,PDFDateString:fi,PDFWorker:Id,PermissionFlag:{PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PixelsPerInch:ri,RenderingCancelledException:li,renderRichText:Ti,ResponseException:je,setLayerDimensions:bi,shadow:Fe,SignatureExtractor:xm,stopEvent:Ai,SupportedImageMimeTypes:_i,TextLayer:id,TouchManager:kr,updateUrlHash:Ie,Util:Xe,VerbosityLevel:be,version:"5.4.296",XfaLayer:ni};var qv=i(53986),Xv=i(70579),Yv=i(58387),Kv=Object.prototype.hasOwnProperty;function Qv(t,e,i){for(i of t.keys())if(Jv(i,e))return i}function Jv(t,e){var i,n,s;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((n=t.length)===e.length)for(;n--&&Jv(t[n],e[n]););return-1===n}if(i===Set){if(t.size!==e.size)return!1;for(n of t){if((s=n)&&"object"===typeof s&&!(s=Qv(e,s)))return!1;if(!e.has(s))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(n of t){if((s=n[0])&&"object"===typeof s&&!(s=Qv(e,s)))return!1;if(!Jv(n[1],e.get(s)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return-1===n}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return-1===n}if(!i||"object"===typeof t){for(i in n=0,t){if(Kv.call(t,i)&&++n&&!Kv.call(e,i))return!1;if(!(i in e)||!Jv(t[i],e[i]))return!1}return Object.keys(e).length===n}}return t!==t&&e!==e}function Zv(t){let e=!1;return{promise:new Promise((i,n)=>{t.then(t=>!e&&i(t)).catch(t=>!e&&n(t))}),cancel(){e=!0}}}const $v=["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onInput","onInvalid","onReset","onSubmit","onLoad","onError","onKeyDown","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onChange","onToggle"];function tw(t,e){const i={};for(const n of $v){const s=t[n];s&&(i[n]=e?t=>s(t,e(n)):s)}return i}var ew="Invariant failed";function iw(t,e){if(!t)throw new Error(ew)}var nw=i(96440);const sw=(0,s.createContext)(null);class rw{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return iw(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(t){iw(this.pdfViewer),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{iw(this.pdfDocument),iw(t),"string"===typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{iw(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise(t=>{iw(this.pdfDocument),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{iw(!1,'"'.concat(e,'" is not a valid page reference.'))}):"number"===typeof e?t(e):iw(!1,'"'.concat(e,'" is not a valid destination reference.'))}).then(e=>{const i=e+1;iw(this.pdfViewer),iw(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}goToPage(t){const e=t-1;iw(this.pdfViewer),iw(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}}function aw(t){let{children:e,type:i}=t;return(0,Xv.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}const ow={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function lw(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function cw(){return(0,s.useReducer)(lw,{value:void 0,error:void 0})}const hw="undefined"!==typeof window,dw=hw&&"file:"===window.location.protocol;function uw(t){return function(t){return"undefined"!==typeof t}(t)&&null!==t}function pw(t){return function(t){return"string"===typeof t}(t)&&/^data:/.test(t)}function Aw(t){iw(pw(t));const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function fw(){return hw&&window.devicePixelRatio||1}const gw="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function mw(){nw(!dw,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(gw))}function vw(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()}function ww(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}const bw=["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate","scale"],yw=["url"],{Tm:_w}=n,xw=(t,e)=>{switch(e){case ow.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case ow.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function Ew(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const Sw=(0,s.forwardRef)(function(t,e){let{children:i,className:n,error:r="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:o,file:l,inputRef:c,imageResourcesPath:h,loading:d="Loading PDF\u2026",noData:u="No PDF file specified.",onItemClick:p,onLoadError:A,onLoadProgress:f,onLoadSuccess:g,onPassword:m=xw,onSourceError:v,onSourceSuccess:w,options:b,renderMode:y,rotate:_,scale:x}=t,E=(0,qv.A)(t,bw);const[S,k]=cw(),{value:C,error:M}=S,[T,P]=cw(),{value:D,error:R}=T,L=(0,s.useRef)(new rw),I=(0,s.useRef)([]),F=(0,s.useRef)(void 0),N=(0,s.useRef)(void 0);l&&l!==F.current&&Ew(l)&&(nw(!Jv(l,F.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),F.current=l),b&&b!==N.current&&(nw(!Jv(b,N.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),N.current=b);const O=(0,s.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:n=i-1}=t;if(p)return void p({dest:e,pageIndex:n,pageNumber:i});const s=I.current[n];s?s.scrollIntoView():nw(!1,"An internal link leading to page ".concat(i," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}});(0,s.useImperativeHandle)(e,()=>({linkService:L,pages:I,viewer:O}),[]),(0,s.useEffect)(function(){k({type:"RESET"})},[l,k]);const B=(0,s.useCallback)(async()=>{if(!l)return null;if("string"===typeof l){if(pw(l)){return{data:Aw(l)}}return mw(),{url:l}}if(l instanceof _w)return{range:l};if(l instanceof ArrayBuffer)return{data:l};if(hw&&function(t){return iw(hw),t instanceof Blob}(l)){const t=await function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return i(new Error("Error while reading a file."));e(n.result)},n.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},n.readAsArrayBuffer(t)})}(l);return{data:t}}if(iw("object"===typeof l),iw(Ew(l)),"url"in l&&"string"===typeof l.url){if(pw(l.url)){const{url:t}=l,e=(0,qv.A)(l,yw),i=Aw(t);return(0,wt.A)({data:i},e)}mw()}return l},[l]);(0,s.useEffect)(()=>{const t=Zv(B());return t.promise.then(t=>{k({type:"RESOLVE",value:t})}).catch(t=>{k({type:"REJECT",error:t})}),()=>{vw(t)}},[B,k]),(0,s.useEffect)(()=>{"undefined"!==typeof C&&(!1!==C?w&&w():M&&(nw(!1,M.toString()),v&&v(M)))},[C]),(0,s.useEffect)(function(){P({type:"RESET"})},[P,C]),(0,s.useEffect)(function(){if(!C)return;const t=fd(b?(0,wt.A)((0,wt.A)({},C),b):C);f&&(t.onProgress=f),m&&(t.onPassword=m);const e=t,i=e.promise.then(t=>{P({type:"RESOLVE",value:t})}).catch(t=>{e.destroyed||P({type:"REJECT",error:t})});return()=>{i.finally(()=>e.destroy())}},[b,P,C]),(0,s.useEffect)(()=>{"undefined"!==typeof D&&(!1!==D?D&&(g&&g(D),I.current=new Array(D.numPages),L.current.setDocument(D)):R&&(nw(!1,R.toString()),A&&A(R)))},[D]),(0,s.useEffect)(function(){L.current.setViewer(O.current),L.current.setExternalLinkRel(a),L.current.setExternalLinkTarget(o)},[a,o]);const W=(0,s.useCallback)((t,e)=>{I.current[t]=e},[]),j=(0,s.useCallback)(t=>{delete I.current[t]},[]),U=(0,s.useMemo)(()=>({imageResourcesPath:h,linkService:L.current,onItemClick:p,pdf:D,registerPage:W,renderMode:y,rotate:_,scale:x,unregisterPage:j}),[h,p,D,W,y,_,x,j]),z=(0,s.useMemo)(()=>tw(E,()=>D),[E,D]);return(0,Xv.jsx)("div",(0,wt.A)((0,wt.A)({className:(0,Yv.A)("react-pdf__Document",n),ref:c},z),{},{children:l?void 0===D||null===D?(0,Xv.jsx)(aw,{type:"loading",children:"function"===typeof d?d():d}):!1===D?(0,Xv.jsx)(aw,{type:"error",children:"function"===typeof r?r():r}):function(){if(t=U,!Boolean(null===t||void 0===t?void 0:t.pdf))throw new Error("pdf is undefined");var t;const e="function"===typeof i?i(U):i;return(0,Xv.jsx)(sw.Provider,{value:U,children:e})}():(0,Xv.jsx)(aw,{type:"no-data",children:"function"===typeof u?u():u})}))});function kw(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){for(var e=0,n=i;e<n.length;e++){var s=n[e];"function"===typeof s?s(t):s&&(s.current=t)}}}function Cw(){return(0,s.useContext)(sw)}const Mw=(0,s.createContext)(null);function Tw(){return(0,s.useContext)(Mw)}function Pw(){const t=Cw(),e=Tw();iw(e);const i=(0,wt.A)((0,wt.A)({},t),e),{imageResourcesPath:n,linkService:r,onGetAnnotationsError:a,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:c,page:h,pdf:d,renderForms:u,rotate:p,scale:A=1}=i;iw(d),iw(h),iw(r);const[f,g]=cw(),{value:m,error:v}=f,w=(0,s.useRef)(null);nw(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,s.useEffect)(function(){g({type:"RESET"})},[g,h]),(0,s.useEffect)(function(){if(!h)return;const t=Zv(h.getAnnotations()),e=t;return t.promise.then(t=>{g({type:"RESOLVE",value:t})}).catch(t=>{g({type:"REJECT",error:t})}),()=>{vw(e)}},[g,h]),(0,s.useEffect)(()=>{void 0!==m&&(!1!==m?m&&o&&o(m):v&&(nw(!1,v.toString()),a&&a(v)))},[m]);const b=(0,s.useMemo)(()=>h.getViewport({scale:A,rotation:p}),[h,p,A]);return(0,s.useEffect)(function(){if(!d||!h||!r||!m)return;const{current:t}=w;if(!t)return;const e=b.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:d.annotationStorage,commentManager:null,div:t,l10n:null,linkService:r,page:h,structTreeLayer:null,viewport:e},s={annotations:m,annotationStorage:d.annotationStorage,div:t,imageResourcesPath:n,linkService:r,page:h,renderForms:u,viewport:e};t.innerHTML="";try{new _A(i).render(s),c&&c()}catch(a){!function(t){nw(!1,"".concat(t)),l&&l(t)}(a)}return()=>{}},[m,n,r,h,d,u,b]),(0,Xv.jsx)("div",{className:(0,Yv.A)("react-pdf__Page__annotations","annotationLayer"),ref:w})}const Dw={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Rw=/^H(\d+)$/;function Lw(t){return"children"in t}function Iw(t){return!!Lw(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function Fw(t){const e={};if(Lw(t)){const{role:i}=t,n=i.match(Rw);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(function(t){return t in Dw}(i)){const t=Dw[i];t&&(e.role=t)}}return e}function Nw(t){const e={};if(Lw(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),Iw(t)){const[i]=t.children;if(i){const t=Nw(i);return(0,wt.A)((0,wt.A)({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function Ow(t){return t?(0,wt.A)((0,wt.A)({},Fw(t)),Nw(t)):null}function Bw(t){let{className:e,node:i}=t;const n=(0,s.useMemo)(()=>Ow(i),[i]),r=(0,s.useMemo)(()=>Lw(i)?Iw(i)?null:i.children.map((t,e)=>(0,Xv.jsx)(Bw,{node:t},e)):null,[i]);return(0,Xv.jsx)("span",(0,wt.A)((0,wt.A)({className:e},n),{},{children:r}))}function Ww(){const t=Tw();iw(t);const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[n,r]=cw(),{value:a,error:o}=n,{customTextRenderer:l,page:c}=t;return(0,s.useEffect)(function(){r({type:"RESET"})},[r,c]),(0,s.useEffect)(function(){if(l)return;if(!c)return;const t=Zv(c.getStructTree()),e=t;return t.promise.then(t=>{r({type:"RESOLVE",value:t})}).catch(t=>{r({type:"REJECT",error:t})}),()=>vw(e)},[l,c,r]),(0,s.useEffect)(()=>{void 0!==a&&(!1!==a?a&&i&&i(a):o&&(nw(!1,o.toString()),e&&e(o)))},[a]),a?(0,Xv.jsx)(Bw,{className:"react-pdf__Page__structTree structTree",node:a}):null}const jw=ne;function Uw(t){const e=Tw();iw(e);const i=(0,wt.A)((0,wt.A)({},e),t),{_className:n,canvasBackground:r,devicePixelRatio:a=fw(),onRenderError:o,onRenderSuccess:l,page:c,renderForms:h,renderTextLayer:d,rotate:u,scale:p}=i,{canvasRef:A}=t;iw(c);const f=(0,s.useRef)(null);function g(t){(function(t){return"RenderingCancelledException"===t.name})(t)||(nw(!1,t.toString()),o&&o(t))}const m=(0,s.useMemo)(()=>c.getViewport({scale:p*a,rotation:u}),[a,c,u,p]),v=(0,s.useMemo)(()=>c.getViewport({scale:p,rotation:u}),[c,u,p]);(0,s.useEffect)(function(){if(!c)return;c.cleanup();const{current:t}=f;if(!t)return;t.width=m.width,t.height=m.height,t.style.width="".concat(Math.floor(v.width),"px"),t.style.height="".concat(Math.floor(v.height),"px"),t.style.visibility="hidden";const e={annotationMode:h?jw.ENABLE_FORMS:jw.ENABLE,canvas:t,canvasContext:t.getContext("2d",{alpha:!1}),viewport:m};r&&(e.background=r);const i=c.render(e),n=i;return i.promise.then(()=>{t.style.visibility="",c&&l&&l(ww(c,p))}).catch(g),()=>vw(n)},[r,c,h,m,v]);const w=(0,s.useCallback)(()=>{const{current:t}=f;t&&(t.width=0,t.height=0)},[]);return(0,s.useEffect)(()=>w,[w]),(0,Xv.jsx)("canvas",{className:"".concat(n,"__canvas"),dir:"ltr",ref:kw(A,f),style:{display:"block",userSelect:"none"},children:d?(0,Xv.jsx)(Ww,{}):null})}function zw(){const t=Tw();iw(t);const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:n,onRenderTextLayerError:r,onRenderTextLayerSuccess:a,page:o,pageIndex:l,pageNumber:c,rotate:h,scale:d}=t;iw(o);const[u,p]=cw(),{value:A,error:f}=u,g=(0,s.useRef)(null);nw(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,s.useEffect)(function(){p({type:"RESET"})},[o,p]),(0,s.useEffect)(function(){if(!o)return;const t=Zv(o.getTextContent()),e=t;return t.promise.then(t=>{p({type:"RESOLVE",value:t})}).catch(t=>{p({type:"REJECT",error:t})}),()=>vw(e)},[o,p]),(0,s.useEffect)(()=>{void 0!==A&&(!1!==A?A&&n&&n(A):f&&(nw(!1,f.toString()),i&&i(f)))},[A]);const m=(0,s.useCallback)(()=>{a&&a()},[a]),v=(0,s.useCallback)(t=>{nw(!1,t.toString()),r&&r(t)},[r]);const w=(0,s.useMemo)(()=>o.getViewport({scale:d,rotation:h}),[o,h,d]);return(0,s.useLayoutEffect)(function(){if(!o||!A)return;const{current:t}=g;if(!t)return;t.innerHTML="";const i=o.streamTextContent({includeMarkedContent:!0}),n=new id({container:t,textContentSource:i,viewport:w}),s=n;return n.render().then(()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i);const n=t.querySelectorAll('[role="presentation"]');if(e){let t=0;A.items.forEach((i,s)=>{if(!function(t){return"str"in t}(i))return;const r=n[t];if(!r)return;const a=e((0,wt.A)({pageIndex:l,pageNumber:c,itemIndex:s},i));r.innerHTML=a,t+=i.str&&i.hasEOL?2:1})}m()}).catch(v),()=>vw(s)},[e,v,m,o,l,c,A,w]),(0,Xv.jsx)("div",{className:(0,Yv.A)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=g.current;t&&t.classList.remove("selecting")},onMouseDown:function(){const t=g.current;t&&t.classList.add("selecting")},ref:g})}const Hw=["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"],Vw=1;function Gw(t){const e=Cw(),i=(0,wt.A)((0,wt.A)({},e),t),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:r=!0,canvasBackground:a,canvasRef:o,children:l,className:c,customRenderer:h,customTextRenderer:d,devicePixelRatio:u,error:p="Failed to load the page.",height:A,inputRef:f,loading:g="Loading page\u2026",noData:m="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:w,onGetStructTreeError:b,onGetStructTreeSuccess:y,onGetTextError:_,onGetTextSuccess:x,onLoadError:E,onLoadSuccess:S,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:C,onRenderError:M,onRenderSuccess:T,onRenderTextLayerError:P,onRenderTextLayerSuccess:D,pageIndex:R,pageNumber:L,pdf:I,registerPage:F,renderAnnotationLayer:N=!0,renderForms:O=!1,renderMode:B="canvas",renderTextLayer:W=!0,rotate:j,scale:U=Vw,unregisterPage:z,width:H}=i,V=(0,qv.A)(i,Hw),[G,q]=cw(),{value:X,error:Y}=G,K=(0,s.useRef)(null);iw(I);const Q=uw(L)?L-1:null!==R&&void 0!==R?R:null,J=null!==L&&void 0!==L?L:uw(R)?R+1:null,Z=null!==j&&void 0!==j?j:X?X.rotate:null,$=(0,s.useMemo)(()=>{if(!X)return null;let t=1;const e=null!==U&&void 0!==U?U:Vw;if(H||A){const e=X.getViewport({scale:1,rotation:Z});H?t=H/e.width:A&&(t=A/e.height)}return e*t},[A,X,Z,U,H]);(0,s.useEffect)(function(){return()=>{uw(Q)&&r&&z&&z(Q)}},[r,I,Q,z]),(0,s.useEffect)(function(){q({type:"RESET"})},[q,I,Q]),(0,s.useEffect)(function(){if(!I||!J)return;const t=Zv(I.getPage(J)),e=t;return t.promise.then(t=>{q({type:"RESOLVE",value:t})}).catch(t=>{q({type:"REJECT",error:t})}),()=>vw(e)},[q,I,J]),(0,s.useEffect)(()=>{void 0!==X&&(!1!==X?function(){if(S){if(!X||!$)return;S(ww(X,$))}if(r&&F){if(!uw(Q)||!K.current)return;F(Q,K.current)}}():Y&&(nw(!1,Y.toString()),E&&E(Y)))},[X,$]);const tt=(0,s.useMemo)(()=>uw(Q)&&J&&uw(Z)&&uw($)?{_className:n,canvasBackground:a,customTextRenderer:d,devicePixelRatio:u,onGetAnnotationsError:v,onGetAnnotationsSuccess:w,onGetStructTreeError:b,onGetStructTreeSuccess:y,onGetTextError:_,onGetTextSuccess:x,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:C,onRenderError:M,onRenderSuccess:T,onRenderTextLayerError:P,onRenderTextLayerSuccess:D,page:X,pageIndex:Q,pageNumber:J,renderForms:O,renderTextLayer:W,rotate:Z,scale:$}:null,[n,a,d,u,v,w,b,y,_,x,k,C,M,T,P,D,X,Q,J,O,W,Z,$]),et=(0,s.useMemo)(()=>tw(V,()=>X?$?ww(X,$):void 0:X),[V,X,$]),it="".concat(Q,"@").concat($,"/").concat(Z);function nt(){switch(B){case"custom":return iw(h),(0,Xv.jsx)(h,{},"".concat(it,"_custom"));case"none":return null;default:return(0,Xv.jsx)(Uw,{canvasRef:o},"".concat(it,"_canvas"))}}return(0,Xv.jsx)("div",(0,wt.A)((0,wt.A)({className:(0,Yv.A)(n,c),"data-page-number":J,ref:kw(f,K),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":"".concat($),"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},et),{},{children:J?null===I||void 0===X||null===X?(0,Xv.jsx)(aw,{type:"loading",children:"function"===typeof g?g():g}):!1===I||!1===X?(0,Xv.jsx)(aw,{type:"error",children:"function"===typeof p?p():p}):function(){if(t=tt,!Boolean(null===t||void 0===t?void 0:t.page))throw new Error("page is undefined");var t;const e="function"===typeof l?l(tt):l;return(0,Xv.jsxs)(Mw.Provider,{value:tt,children:[nt(),W?(0,Xv.jsx)(zw,{},"".concat(it,"_text")):null,N?(0,Xv.jsx)(Pw,{},"".concat(it,"_annotations")):null,e]})}():(0,Xv.jsx)(aw,{type:"no-data",children:"function"===typeof m?m():m})}))}var qw,Xw=i(19155),Yw=i(93141),Kw=i(10986),Qw=i.n(Kw);const Jw=["title","titleId"];function Zw(){return Zw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Zw.apply(null,arguments)}function $w(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,Jw);return s.createElement("svg",Zw({t:1731465967110,className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg","p-id":1541,xmlnsXlink:"http://www.w3.org/1999/xlink",width:200,height:200,ref:e,"aria-labelledby":n},r),i?s.createElement("title",{id:n},i):null,qw||(qw=s.createElement("path",{d:"M112 166h-7q-21 3-35 18.5T56 222v562q3 20 18.5 34.5T112 833h388l56-167-119-179-103 123-72-71-5-5q-17-13-38-11.5T183 539l-71 71V222h259l18-56H112z m388 0l-18 56h407v379L654 327l-4-5q-18-16-41.5-14.5T570 328l-72 85 169 253-55 167h277l7-1q21-2 35-18t14-37V215q-3-21-18.5-35T889 166H500zM306 277q-34 0-58.5 24.5t-24.5 59q0 34.5 24.5 59T306 444q23 0 42.5-12t30.5-31l-45-68 14-44q-19-12-42-12z",fill:"#E0E0E0","p-id":1542})))}const tb=s.forwardRef($w);i.p;var eb,ib;const nb=["title","titleId"];function sb(){return sb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},sb.apply(null,arguments)}function rb(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,nb);return s.createElement("svg",sb({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u7f16\u7ec4 10"):i?s.createElement("title",{id:n},i):null,eb||(eb=s.createElement("defs",null,s.createElement("linearGradient",{x1:"50%",y1:"0%",x2:"50%",y2:"100%",id:"linearGradient-1"},s.createElement("stop",{stopColor:"#F5F5F5",offset:"0%"}),s.createElement("stop",{stopColor:"#E0E0E0",offset:"100%"})))),ib||(ib=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807Icon",transform:"translate(-760.000000, -2364.000000)"},s.createElement("g",{id:"\\u7F16\\u7EC4-10",transform:"translate(760.000000, 2364.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u65E0\\u6027\\u522B",fill:"url(#linearGradient-1)"},s.createElement("rect",{id:"Mask\\u5907\\u4EFD",x:0,y:0,width:56,height:56})),s.createElement("g",{id:"\\u5934\\u50CF_avatar-(1)\\u5907\\u4EFD",transform:"translate(8.000000, 12.000000)",fill:"#FFFFFF",fillRule:"nonzero"},s.createElement("path",{d:"M40,41.3851428 C40,40.9828571 40,35.6022857 39,33.792 C38.4,32.5851428 37.4,31.7805714 36.2,30.976 C34.8,30.1714285 33,29.3668572 30.8,28.9645714 C30.6,28.9645714 29.2,28.7634285 28,28.3611428 C26.6,27.9588571 26,27.7577143 25.8,27.5565714 L25.8,26.3497143 C26,23.7348571 27.4,22.3268572 28.6,21.12 C29,20.7177143 29.4,20.3154285 29.8,19.712 C31.2,17.7005714 31.4,15.6891429 31.4,15.2868571 C31.4,14.8845714 31.4,14.6834286 31.2,14.2811429 C31,13.8788572 30.8,13.4765714 30.6,13.2754286 C30.6,12.672 30.8,12.0685714 30.8,11.6662857 C30.8,10.6605715 31,9.05142856 30.6,7.44228572 C30.6,7.24114285 30.6,6.83885715 30.4,6.43657145 C30,5.22971431 29.6,4.22400004 28.8,3.4194286 C28.4,3.4194286 25.6,0.603428618 18,0 L15,0 C14.6,0 14.2,0 13.8,0.201142873 C12.4,0.603428571 12.2,1.60914289 12,2.01142859 L12,3.21828573 L11.8,3.4194286 C11.6,3.62057147 9.60000004,5.43085719 9.40000002,7.84457142 C9.20000001,9.45371426 9.20000001,11.8674285 9.40000002,13.6777143 C9.20000001,14.08 8.80000002,14.4822858 8.80000002,15.488 C8.80000002,15.8902857 9,17.9017143 10.4,19.712 C10.8,20.1142857 11,20.5165715 11.6,21.12 C12.8,22.528 14.2,23.936 14.4,26.3497143 L14.4,27.5565714 C14,27.7577143 13.4,28.16 12,28.5622857 C10.6,28.9645714 9.20000001,29.1657143 9,29.1657143 C7,29.568 5.19999998,30.1714285 3.80000001,30.976 C2.60000001,31.7805714 1.60000003,32.7862857 1,33.792 C0,35.6022857 0,40.9828571 0,41.3851428 L0,42.3908571 C0,43.1954286 0.800000015,44 1.8,44 L38.2,44 C39.2,44 40,43.1954286 40,42.1897143 L40,41.3851428 Z",id:"\\u8DEF\\u5F84"})))))))}const ab=s.forwardRef(rb);i.p;var ob;const lb=["title","titleId"];function cb(){return cb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},cb.apply(null,arguments)}function hb(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,lb);return s.createElement("svg",cb({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u5934\u50cf-\u5973"):i?s.createElement("title",{id:n},i):null,ob||(ob=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807",transform:"translate(-792.000000, -230.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u5973",transform:"translate(792.000000, 230.000000)"},s.createElement("rect",{id:"Mask\\u5907\\u4EFD",fill:"#F1F1F1",x:0,y:0,width:56,height:56}),s.createElement("g",{id:"\\u5973",transform:"translate(9.000000, 13.000000)",fillRule:"nonzero"},s.createElement("path",{d:"M19.1219936,0 C26.9032378,0 28.9014356,5.58612362 28.7427755,11.9244473 C28.5841154,18.262771 25.3419303,30.1526079 25.3419303,30.1526079 L19.1334908,30.1526079 L19.1219936,0 Z",id:"\\u8DEF\\u5F84",fill:"#370B00"}),s.createElement("path",{d:"M18.5011497,0 C10.7291032,0 8.7217078,5.58612362 8.88726615,11.9244473 C9.05282451,18.262771 12.2881114,30.1526079 12.2881114,30.1526079 L18.4965509,30.1526079 L18.5011497,0 Z",id:"\\u8DEF\\u5F84",fill:"#420E04"}),s.createElement("path",{d:"M14.2564166,26.7815518 C11.9891865,29.1996673 7.8778199,30.5010196 3.9780001,31.1309294 C0.0781803048,31.7608392 0,35.9948487 0,37.2177506 L0,43 L18.5011497,43 L18.5011497,26.7815518 L14.2564166,26.7815518 Z",id:"\\u8DEF\\u5F84",fill:"#EAE9E8"}),s.createElement("path",{d:"M18.5011497,21.5807577 L14.1736374,21.5807577 L14.1736374,27.196877 C14.1736374,28.0298347 15.5532906,30.6740717 18.5011497,30.6740717 L18.5011497,21.5807577 Z",id:"\\u8DEF\\u5F84",fill:"#EAC1A4"}),s.createElement("path",{d:"M18.5011497,3.92251556 C12.1202536,3.92251556 11.1751911,8.53723974 11.1751911,14.2502683 C11.1751911,20.0948165 16.693804,24.5872505 18.5011497,24.5872505 L18.5011497,3.92251556 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("path",{d:"M11.0372258,13.419618 C10.5888385,11.7352436 9.97489279,11.7352436 9.71505809,12.1621056 C9.45522339,12.5889676 10.351998,14.2387315 10.3749922,15.6000751 C10.3979864,16.9614187 10.7980859,17.1552372 11.294761,16.663769 C11.7914362,16.1723009 11.0372258,13.419618 11.0372258,13.419618 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#DDDCDB",points:"14.247219 27.1368856 11.4603194 28.8327967 15.6199739 36.09868 18.5011497 30.6740717"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#F4F2F2",points:"14.247219 26.7815518 11.4603194 28.8327967 15.6199739 35.7433462 18.5011497 30.6740717"}),s.createElement("path",{d:"M22.7642782,26.7815518 C25.0338077,29.1996673 29.1451744,30.5010196 33.0426947,31.1309294 C36.940215,31.7608392 37,35.9948487 37,37.2177506 L37,43 L18.5011497,43 L18.5011497,26.7815518 L22.7642782,26.7815518 Z",id:"\\u8DEF\\u5F84",fill:"#DDDCDB"}),s.createElement("path",{d:"M18.5011497,21.5807577 L22.8263626,21.5807577 L22.8263626,27.196877 C22.8263626,28.0298347 21.4467094,30.6740717 18.5011497,30.6740717 L18.5011497,21.5807577 Z",id:"\\u8DEF\\u5F84",fill:"#DDB597"}),s.createElement("path",{d:"M18.5011497,3.92251556 C24.8797464,3.92251556 25.8248089,8.53723974 25.8248089,14.2502683 C25.8248089,20.0948165 20.306196,24.5872505 18.5011497,24.5872505 L18.5011497,3.92251556 Z",id:"\\u8DEF\\u5F84",fill:"#EDC19C"}),s.createElement("path",{d:"M25.9673731,13.419618 C26.4272575,11.7352436 27.0320055,11.7352436 27.2918402,12.1621056 C27.5516748,12.5889676 26.6526008,14.2387315 26.6296066,15.6000751 C26.6066124,16.9614187 26.206513,17.1552372 25.7098378,16.663769 C25.2131626,16.1723009 25.967373,13.4196179 25.9673731,13.419618 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#DDDCDB",points:"22.752781 27.1368856 25.5396806 28.8327967 21.3800261 36.09868 18.5011497 30.6740717"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#EFEEED",points:"22.752781 26.7815518 25.5396806 28.8327967 21.3800261 35.7433462 18.5011497 30.6740717"}),s.createElement("path",{d:"M9.10801068,29.8549582 C7.43626653,30.4331409 5.71634854,30.860165 3.96880244,31.1309294 C0.0712820906,31.7608392 0,35.9948487 0,37.2177506 L0,43 L16.3373936,43 L9.10801068,29.848036 L9.10801068,29.8549582 Z",id:"\\u8DEF\\u5F84",fill:"#1D1D1D"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#303030",points:"9.10801068 29.8549582 7.32595862 30.4110324 7.10061524 34.8896222 10.4393761 36.7216678 10.4393761 42.9976927 16.3373936 42.9976927 9.10801068 29.8549582"}),s.createElement("path",{d:"M27.8942887,29.8549582 C29.5652485,30.433138 31.2844029,30.8601635 33.0311976,31.1309294 C36.940215,31.7608392 37,35.9902339 37,37.2177506 L37,43 L20.6741036,43 L27.9034864,29.848036 L27.8942887,29.8549582 Z",id:"\\u8DEF\\u5F84",fill:"#1D1D1D"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#303030",points:"27.8942887 29.8549582 29.6763408 30.4110324 29.8993848 34.8896222 26.5629234 36.7216678 26.5629234 42.9976927 20.6626064 42.9976927"}),s.createElement("path",{d:"M10.8072836,5.07619661 C9.67366851,9.80398152 11.1062085,14.2871861 11.267168,14.7163554 C11.267168,14.7163554 12.1248524,14.8524898 13.3366478,12.6581885 C14.9140514,9.79936683 16.8041763,8.32265508 18.4459636,7.55661088 L18.4459636,0 C14.334597,0 11.6005842,1.79974245 10.8072836,5.07619661 Z",id:"\\u8DEF\\u5F84",fill:"#471207"}),s.createElement("path",{d:"M25.6224598,14.7140481 C25.7742216,14.2871861 27.2067616,9.80398157 26.0823442,5.07388927 C25.2936424,1.80204979 22.5573302,0 18.4459636,0 L18.4459636,7.55661088 C19.5462153,7.03397245 20.7468113,6.75837793 21.9640793,6.74903414 C24.4014667,8.41494958 25.6155615,11.7513952 25.6224598,14.7140481 Z",id:"\\u8DEF\\u5F84",fill:"#370B00"})))))))}const db=s.forwardRef(hb);i.p;var ub;const pb=["title","titleId"];function Ab(){return Ab=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Ab.apply(null,arguments)}function fb(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,pb);return s.createElement("svg",Ab({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u5934\u50cf-\u7537"):i?s.createElement("title",{id:n},i):null,ub||(ub=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807",transform:"translate(-792.000000, -166.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u7537",transform:"translate(792.000000, 166.000000)"},s.createElement("rect",{id:"Mask",fill:"#F1F1F1",x:0,y:0,width:56,height:56}),s.createElement("g",{id:"Group-46",transform:"translate(7.671233, 12.041096)"},s.createElement("path",{d:"M20.3287113,17.7016171 L14.8261307,17.7016171 L14.8261307,21.8854179 L14.8261307,24.6737429 C14.8261307,25.7091313 16.5713146,28.9930418 20.3287113,28.9930418 L20.3287113,17.7016171 Z",id:"Fill-2",fill:"#DDB597"}),s.createElement("path",{d:"M18.1163052,33.9077874 C18.1163052,33.9077874 16.9107652,32.9969521 15.601989,31.3099039 C14.2932128,29.6230745 12.4333964,25.9116559 12.4333964,25.9116559 C11.796773,26.003812 11.1961258,26.0999083 10.6276562,26.2001637 L19.059062,43.7260274 L20.3287336,43.7260274 L20.3287336,29.2137349 L18.1163052,33.9077874 Z",id:"Fill-4",fill:"#EFEEED"}),s.createElement("path",{d:"M12.4334858,31.7147341 L8.64391162,30.0953254 L10.2679829,26.2654829 C4.85701892,27.2599373 2.57978853,28.6396525 1.7219446,30.5000682 C0.757736068,32.592078 0,43.7258961 0,43.7258961 L18.0757257,43.7258961 L10.3430638,38.5075824 L12.4334858,31.7147341 Z",id:"Fill-6",fill:"#1D1D1D"}),s.createElement("path",{d:"M20.3287113,17.7016171 L25.8312918,17.7016171 L25.8312918,21.8854179 L25.8312918,24.6737429 C25.8312918,25.7091313 24.0861079,28.9930418 20.3287113,28.9930418 L20.3287113,17.7016171 Z",id:"Fill-8",fill:"#D1AC93"}),s.createElement("path",{d:"M22.5412291,33.9077874 C22.5412291,33.9077874 23.7467691,32.9969521 25.0553218,31.3099039 C26.364098,29.6230745 28.2241379,25.9116559 28.2241379,25.9116559 C28.8607613,26.003812 29.4614085,26.0999083 30.0296546,26.2001637 L21.5984722,43.7260274 L20.3288006,43.7260274 L20.3288006,29.2137349 L22.5412291,33.9077874 Z",id:"Fill-10",fill:"#DDDCDB"}),s.createElement("path",{d:"M28.2240485,31.7147341 L32.0133992,30.0953254 L30.3895513,26.2654829 C35.8005153,27.2599373 38.0777457,28.6396525 38.9353662,30.5000682 C39.8997982,32.592078 40.6575342,43.7258961 40.6575342,43.7258961 L22.5815851,43.7258961 L30.314247,38.5075824 L28.2240485,31.7147341 Z",id:"Fill-12",fill:"#0F0F0F"}),s.createElement("path",{d:"M20.3287113,3.71115593 C14.1291744,3.71115593 13.2107742,8.10203448 13.2107742,13.5180132 C13.2107742,19.5112264 15.9664218,23.3250894 20.3287113,23.3250894 L20.3287113,3.71115593 Z",id:"Fill-14",fill:"#EBCFB7"}),s.createElement("path",{d:"M20.3287113,3.71115593 C26.5282481,3.71115593 27.4466484,8.10203448 27.4466484,13.5180132 C27.4466484,19.5112264 24.6910007,23.3250894 20.3287113,23.3250894 L20.3287113,3.71115593 Z",id:"Fill-16",fill:"#EFC7A6"}),s.createElement("path",{d:"M13.0715617,12.7308772 C12.6353774,11.1337961 12.0383055,11.1337961 11.7858013,11.5387578 C11.5330737,11.9435005 12.4056656,13.5180351 12.4286815,14.8001217 C12.4516974,16.0824272 12.8398388,16.2752765 13.3231721,15.80771 C13.8062819,15.3399246 13.0715617,12.7308772 13.0715617,12.7308772",id:"Fill-18",fill:"#EBCFB7"}),s.createElement("path",{d:"M27.5859726,12.7308772 C28.0221568,11.1337961 28.6192287,11.1337961 28.8717329,11.5387578 C29.1242371,11.9435005 28.2516452,13.5180351 28.2288528,14.8001217 C28.2058369,16.0824272 27.817472,16.2752765 27.3343622,15.80771 C26.8510289,15.3399246 27.5859726,12.7308772 27.5859726,12.7308772",id:"Fill-20",fill:"#EBCFB7"}),s.createElement("path",{d:"M12.3795884,25.9199302 C11.7632994,26.0094596 11.1796348,26.1029291 10.6277008,26.2001199 C10.5054709,26.2217908 10.3870398,26.2436806 10.2679382,26.2655705 L8.64386693,30.0951941 L12.4334411,31.7148217 L10.3430191,38.50767 L18.075681,43.7259836 L19.0591067,43.7259836 L12.3795884,25.9199302 Z",id:"Fill-22",fill:"#3A3939"}),s.createElement("path",{d:"M32.0133992,30.0952379 L30.3895513,26.2656142 C30.2834102,26.2459134 30.1768221,26.2264315 30.0686699,26.2071684 L30.0686699,26.2069495 C30.0628601,26.205855 30.0566033,26.2051983 30.0510169,26.2041039 C30.0438664,26.2027905 29.1706041,26.0423381 28.2939899,25.9223819 L21.6763687,43.5636049 L21.6765921,43.5633861 L21.5986063,43.7260274 L22.5815851,43.7260274 L30.314247,38.5077137 L28.2240485,31.7146466 L32.0133992,30.0952379 Z",id:"Fill-24",fill:"#2D2D2D"}),s.createElement("path",{d:"M20.3287113,6.64640537 L20.3287113,0 C16.3335585,0 13.6766779,1.70762469 12.9146962,4.81335203 C11.8139567,9.29901349 13.0521211,13.3967874 13.2000483,13.8032813 C13.8612518,13.932869 14.0167765,11.6642083 14.0167765,9.24144327 C14.0167765,3.89113401 16.7697427,6.64640537 20.3287113,6.64640537",id:"Fill-26",fill:"#370B00"}),s.createElement("path",{d:"M20.3287113,6.64640537 L20.3287113,0 C24.3238641,0 26.9807446,1.70762469 27.7427263,4.81335203 C28.8434659,9.29901349 27.605078,13.3967874 27.4573742,13.8032813 C26.7961707,13.932869 26.640646,11.6642083 26.640646,9.24144327 C26.640646,3.89113401 23.8876798,6.64640537 20.3287113,6.64640537",id:"Fill-28",fill:"#230600"}),s.createElement("polygon",{id:"Fill-30",fill:"#2A798C",points:"20.3287113 33.2162443 18.6501169 33.2162443 19.425506 43.7259836 20.3287113 43.7259836"}),s.createElement("polygon",{id:"Fill-32",fill:"#266C77",points:"21.23214 43.7259179 22.0073056 33.2161786 20.3287113 33.2161786 20.3287113 43.7259179"}),s.createElement("polygon",{id:"Fill-34",fill:"#3691AD",points:"18.2760532 31.4385503 19.1256293 33.2162224 20.3287113 33.2162224 20.3287113 28.9930199"}),s.createElement("polygon",{id:"Fill-36",fill:"#266C77",points:"22.3812799 31.4385503 20.3286219 28.9930199 20.3286219 33.2162224 21.5317039 33.2162224"}),s.createElement("path",{d:"M23.9005061,25.9844833 L25.8313812,24.1571213 C26.8119019,24.7194707 28.2241379,25.9115902 28.2241379,25.9115902 C28.2241379,25.9115902 26.4673343,29.8497873 25.1587815,31.6071019 C23.8497818,33.3639787 22.4846949,34.4026505 22.4846949,34.4026505 L20.3288006,29.2136692 L20.4320369,29.1004989 L23.9005061,25.9844833 Z",id:"Fill-38",fill:"#CCCCCC"}),s.createElement("path",{d:"M23.7972922,25.9115902 L25.8314035,24.1571213 C26.8119243,24.6969242 28.2241602,25.9115902 28.2241602,25.9115902 C28.2241602,25.9115902 26.3641204,29.6230088 25.0553442,31.3098382 C23.7465679,32.9968864 22.5412514,33.9077218 22.5412514,33.9077218 L20.328823,29.2136692 L20.328823,28.9034905 L23.7972922,25.9115902 Z",id:"Fill-40",fill:"#F4F2F2"}),s.createElement("path",{d:"M16.7568047,25.9844833 L14.826153,24.1571213 C13.8456323,24.7194707 12.4333964,25.9115902 12.4333964,25.9115902 C12.4333964,25.9115902 14.1899765,29.8497873 15.4987527,31.6071019 C16.807529,33.3639787 18.1726158,34.4026505 18.1726158,34.4026505 L20.3287336,29.2136692 L20.2252739,29.1004989 L16.7568047,25.9844833 Z",id:"Fill-42",fill:"#CCCCCC"}),s.createElement("path",{d:"M16.8601303,25.9115902 L14.826019,24.1571213 C13.8454982,24.6969242 12.4334858,25.9115902 12.4334858,25.9115902 C12.4334858,25.9115902 14.2933021,29.6230088 15.6020784,31.3098382 C16.9108546,32.9968864 18.1163946,33.9077218 18.1163946,33.9077218 L20.3285995,29.2136692 L20.3285995,28.9034905 L16.8601303,25.9115902 Z",id:"Fill-44",fill:"#FFFFFF"})))))))}const gb=s.forwardRef(fb);i.p;var mb=i(75087),vb=i.n(mb),wb=i(49461),bb=(i(9056),i(74065)),yb=i.n(bb),_b=i(57469),xb=i.n(_b),Eb=i(1582),Sb=i.n(Eb),kb=i(80111),Cb=i.n(kb);function Mb(){return Mb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Mb.apply(null,arguments)}function Tb(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}const Pb=["id","url","error","apis","loading","ttl","cacheName"],Db=["paramsType","paramsName"],Rb=["data"],Lb=t=>e=>{var i;const n=Object.assign({},{loading:null,ttl:6e6,cacheName:"file-cache"},e),{id:s,error:o,apis:c,loading:d,ttl:u,cacheName:p}=n,A=Tb(n,Pb),{apis:f}=(0,a.usePreset)(),g=h()({},f,c);if(!s)return null;if(null==g||null==(i=g.file)||!i.getUrl)return console.warn("\u8bf7\u5728Global\u7ec4\u4ef6\u8bbe\u7f6epreset.apis.file.getUrl\u53c2\u6570"),null;const m=Object.assign({paramsType:"params",paramsName:"id"},g.file.getUrl),{paramsType:v,paramsName:w}=m,b=Tb(m,Db),y={},_=s.split("?")[0];return y[v]={[w]:_},r().createElement(l(),Mb({},Object.assign({},b,y),{updateType:"refresh",error:o,loading:d,cache:p,ttl:u,render:e=>{let{data:i}=e,n=Tb(e,Rb);return r().createElement(t,Mb({},A,{id:_,data:i,fetchApi:n}))}}))},Ib=["data","children"],Fb=Lb(t=>{let{data:e,children:i}=t;return i(Mb({url:e},Tb(t,Ib)))}),Nb=(t,e)=>{const i=document.createElement("a"),n=new MouseEvent("click");i.download=e,i.target="_blank",i.href=t,i.dispatchEvent(n)},Ob=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file",i=arguments.length>2?arguments[2]:void 0;if(!t)throw new Error((null==i?void 0:i.notFoundFile)||"\u672a\u83b7\u53d6\u5230\u4e0b\u8f7d\u7684\u6587\u4ef6\u4fe1\u606f");if("string"===typeof t&&/blob:http(s)?:/.test(t))return void Nb(t,e);if("[object Blob]"===Object.prototype.toString.call(t)){const i=new Blob([t],{type:t.type});return void Nb(URL.createObjectURL(i),e)}const n=(0,o.getAjax)(),{data:s,headers:r}=await n({url:t,responseType:"blob"}),a=null==r?void 0:r["content-disposition"];if(a){const t=a.match(/filename\*?=(?:UTF-8'')?([^;]+)/i);if(t&&t[1])e=decodeURIComponent(t[1].replace(/['"]/g,""));else{const t=a.match(/filename="?([^"]+)"?/i);t&&(e=t[1])}}Nb(URL.createObjectURL(new Blob([s],{type:null==s?void 0:s.type})),e)},Bb=t=>{let{url:e,staticUrl:i}=t;return/^(blob:)?https?:\/\//.test(e)?e:i+e},Wb=t=>{let{url:e,staticUrl:i}=t;var n;const{apis:s}=(0,a.usePreset)(),r=i||(null==(n=s.file)?void 0:n.staticUrl)||"";return Bb({staticUrl:r,url:e})},jb=["paramsType","paramsName"],Ub=["isLoading","data","error","refresh"],zb=t=>{let{id:e,src:i,filename:n,staticUrl:r,apis:l,onError:c,onSuccess:h}=t;var u,p;const{message:A}=d.App.useApp(),{apis:f}=(0,a.usePreset)(),g=Object.assign({},f,l),m=r||(null==(u=g.file)?void 0:u.staticUrl)||"",[v,w]=(0,s.useState)(!1),b=Object.assign({paramsType:"params",paramsName:"id"},null==(p=g.file)?void 0:p.getUrl),{paramsType:y,paramsName:_}=b,x=Tb(b,jb),E={};E[y]={[_]:e};const S=(0,o.useFetch)(Object.assign({},x,E,{auto:!1})),{isLoading:k,data:C,error:M,refresh:P}=S,D=Tb(S,Ub),R=T()(c||A.error),L=T()(h),I=T()(t=>Ob(Bb({staticUrl:m,url:t}),n).then(L).catch(t=>{R(t.message)}));return(0,s.useEffect)(()=>{k||(M?R(M):C&&(w(!0),I(C).then(()=>{w(!1)})))},[k,M,C,R]),Mb({},D,{isLoading:k||v,download:()=>i?I(i):P(e?E:{})})},Hb={unnamedDownloadFile:"\u672a\u547d\u540d\u4e0b\u8f7d\u6587\u4ef6",fileUpload:"\u4e0a\u4f20\u6587\u4ef6",uploadTips:"\u652f\u6301\u6269\u5c55\u540d{accept}\uff0c\u5355\u4e2a\u6587\u4ef6\u5927\u5c0f\u4e0d\u8d85\u8fc7{fileSize}M\uff0c\u6700\u591a\u4e0a\u4f20{maxLength}\u4e2a\u9644\u4ef6",maxLengthError:"\u4e0a\u4f20\u6587\u4ef6\u4e0d\u80fd\u8d85\u8fc7\u6700\u5927\u5141\u8bb8\u6570\u91cf{maxLength}",fileSizeError:"\u6587\u4ef6{filename}\u4e0d\u80fd\u8d85\u8fc7{fileSize}MB!",uploadError:"\u6587\u4ef6{filename}\u4e0a\u4f20\u9519\u8bef{error}",uploadAnomaly:"\u6587\u4ef6{filename}\u4e0a\u4f20\u5f02\u5e38{error}",fileLoadedError:"\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25",fileNotFoundError:"\u672a\u6307\u5b9a\u6587\u4ef6",pageNotFoundError:"\u672a\u6307\u5b9a\u9875\u9762",unSupportFileType:"\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b",unSupportFileTypeDescription:"\u7cfb\u7edf\u4e0d\u652f\u6301\u8be5\u6587\u4ef6\u7c7b\u578b\u9884\u89c8\uff0c\u8bf7\u4e0b\u8f7d\u5230\u672c\u5730\u540e\u8fdb\u884c\u9884\u89c8",uploading:"\u6b63\u5728\u4e0a\u4f20",unNamedDownloadFile:"\u672a\u547d\u540d\u4e0b\u8f7d\u6587\u4ef6",notFoundFile:"\u672a\u83b7\u53d6\u5230\u4e0b\u8f7d\u7684\u6587\u4ef6\u4fe1\u606f",downloadSuccess:"\u4e0b\u8f7d\u6210\u529f",pleaseSetApi:"\u8bf7\u5728Global\u7ec4\u4ef6\u8bbe\u7f6epreset.apis.file.getUrl\u53c2\u6570",filePreview:"\u6587\u4ef6\u9884\u89c8"},Vb=["id","src","filename","api","onSuccess","onError","onClick"],Gb=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},{filename:e({id:"unnamedDownloadFile"})},t),{id:n,src:s,filename:a,api:o,onSuccess:l,onError:c,onClick:h}=i,u=Tb(i,Vb),{isLoading:p,download:A}=zb({id:n,src:s,filename:a,api:o,onError:c,onSuccess:l});return r().createElement(d.Button,Mb({icon:r().createElement(f,null)},D()(u,["locale"]),{loading:p,onClick:function(){h&&h(...arguments),A()}}))});Gb.useDownload=zb,Gb.download=Nb,Gb.downloadBlobFile=Ob;var qb="_Cmp6z",Xb="_lmC4r",Yb="_-jyU7",Kb="_lN9hC",Qb="_yaqrz",Jb="_SXsiw",Zb="_15U-a",$b="_tpRpL";const ty=["className","url","maxWidth","ignoreContent"],ey=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{let{data:e,apis:i,contentWindowUrl:n}=t;var o;const l=(0,s.useRef)(null),{apis:c}=(0,a.usePreset)(),{formatMessage:h}=(0,R.useIntl)(),d=Object.assign({},c,i),u=n||(null==(o=d.file)?void 0:o.contentWindowUrl)||"https://cdn.jsdelivr.net/npm/@kne/iframe-resizer@0.1.3/dist/contentWindow.js";return(0,s.useEffect)(()=>{const t=(new DOMParser).parseFromString(e,"text/html");t.querySelectorAll("script").forEach(t=>{t.parentElement.removeChild(t)});const i=document.createElement("script");i.src=u,t.head.appendChild(i);const n=document.createElement("style");n.innerText="html,body{height:auto!important;}body{pointer-events: none;background: #FFFFFF;}",t.head.appendChild(n),l.current.srcdoc=t.documentElement.outerHTML},[e]),(0,s.useEffect)(()=>{ft({checkOrigin:!1},l.current)},[]),r().createElement("iframe",{title:h({id:"filePreview"}),frameBorder:"0",width:"100%",ref:l})}),iy=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},t),{className:n,url:s,maxWidth:a,ignoreContent:o}=i,c=Tb(i,ty),h=r().createElement("iframe",{title:e({id:"filePreview"}),src:s,width:"100%",className:$b});return r().createElement("div",{className:mt()(n,qb),style:{maxWidth:a}},o?h:r().createElement(l(),{url:s,transformResponse:t=>{let{data:e}=t;return{data:{code:200,results:e}}},showError:!1,error:h,render:t=>{let{data:e}=t;return r().createElement(ey,Mb({},c,{url:s,data:e}))}}))}),ny=["url","filename","type"],sy=t=>{var e;let{url:i,filename:n,type:s}=t,o=Tb(t,ny);const{apis:l}=(0,a.usePreset)(),c=Object.assign({},l,o.apis),h=Wb({staticUrl:o.staticUrl||(null==(e=c.file)?void 0:e.staticUrl),url:i}),d=s&&my[s]||vy(n||h);return r().createElement(d,Mb({},o,{url:h}))},ry=["url","apis","className"],ay=t=>{var e;let{url:i,apis:n,className:s}=t,o=Tb(t,ry);const{apis:c}=(0,a.usePreset)(),h=Object.assign({},c,n);return r().createElement(l(),Mb({},(null==(e=h.file)?void 0:e.previewOffice)||{loader:async()=>({data:[{url:"https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(i)),type:"html"}]})},{render:t=>{let{data:e}=t;const{data:i}=e;return i.map(t=>{let{url:e,type:i}=t;return r().createElement(sy,Mb({},o,{type:i,ignoreContent:!0,url:e,className:s,key:e}))})}}))},oy=(0,s.memo)((0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{var e;const{formatMessage:i}=(0,R.useIntl)(),{url:n,apis:o,maxWidth:l,scale:c,rotate:h,className:u,pdfjsUrl:p}=Object.assign({},{autoSize:!0,renderTextLayer:!1,scale:100,rotate:0,maxWidth:1200},t),[A,f]=(0,s.useState)(0),{apis:g}=(0,a.usePreset)(),m=Object.assign({},g,o),v=p||(null==(e=m.file)?void 0:e.pdfjsUrl)||"https://cdn.jsdelivr.net/npm/pdfjs-dist@5.4.296";Gc.workerSrc=v+"/build/pdf.worker.min.mjs";const w=(0,s.useMemo)(()=>({file:n,options:{standardFontDataUrl:v+"/standard_fonts/",cMapUrl:v+"/cmaps/",cMapPacked:!0}}),[v,n]),[b,y]=(0,s.useState)(l),_=(0,Xw.A)(()=>{_.current&&_.current.clientWidth&&y(Math.min(_.current.clientWidth,l))});return r().createElement("div",{ref:_,className:mt()(u,qb),style:{maxWidth:l}},r().createElement(Sw,Mb({},w,{error:i({id:"fileLoadedError"}),loading:r().createElement("div",{className:Xb},r().createElement(d.Spin,null)),noData:i({id:"fileNotFoundError"}),onLoadSuccess:t=>{let{numPages:e}=t;f(e)}}),r().createElement(d.Flex,{vertical:!0,gap:8},A>=1&&Array.from(new Array(A),(t,e)=>r().createElement(Gw,{key:"page_".concat(e),className:"preview-item",scale:c/100,rotate:h,pageNumber:e+1,width:b,loading:null,renderAnnotationLayer:!1,renderTextLayer:!0,noData:i({id:"pageNotFoundError"})})))))})),ly=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{let{url:e,className:i,maxWidth:n}=t;const{formatMessage:a}=(0,R.useIntl)(),[l,c]=(0,s.useState)(""),[h,u]=(0,s.useState)(!0),[p,A]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(0,o.getAjax)()({url:e,method:"GET"}).then(t=>{let{data:e}=t;c(e),u(!1)},()=>{u(!1),A(!0)})},[e]),r().createElement("div",{className:mt()(i,qb),style:{maxWidth:n}},h?r().createElement("div",{className:Xb},r().createElement(d.Spin,null)):null,r().createElement("div",{className:Yb},p?r().createElement("div",{className:Kb},a({id:"fileLoadedError"})):r().createElement("div",{className:Qb},l)))}),cy=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{let{maxWidth:e}=t;const{formatMessage:i}=(0,R.useIntl)();return r().createElement("div",{className:qb,style:{maxWidth:e}},r().createElement("div",{className:Yb},r().createElement(d.Result,{status:"500",title:i({id:"unSupportFileType"}),subTitle:i({id:"unSupportFileTypeDescription"})})))}),hy=["url","scale","rotate","className","maxWidth","origin"],dy=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{let{url:e,scale:i,rotate:n,className:a,maxWidth:o,origin:l}=t,c=Tb(t,hy);const[h,u]=(0,s.useState)(!0),[p,A]=(0,s.useState)(!1),{formatMessage:f}=(0,R.useIntl)();return(0,s.useEffect)(()=>{const t=new Image;t.src=e;const i=()=>{u(!1)},n=()=>{u(!1),A(!0)};return t.addEventListener("load",i),t.addEventListener("error",n),()=>{t.removeEventListener("load",i),t.removeEventListener("error",n)}},[e,i,n]),l?r().createElement("img",Mb({alt:f({id:"filePreview"})},c,{className:a,src:e})):r().createElement("div",{className:mt()(a,qb),style:{maxWidth:o}},h?r().createElement("div",{className:Xb},r().createElement(d.Spin,null)):null,p?r().createElement("div",{className:Kb},f({id:"fileLoadedError"})):r().createElement("img",Mb({alt:f({id:"filePreview"})},c,{src:e})))}),uy=["url","maxWidth"],py=t=>{let{url:e,maxWidth:i}=t,n=Tb(t,uy);return r().createElement("div",{className:qb,style:{maxWidth:i}},r().createElement("div",{className:Jb},r().createElement("audio",Mb({},n,{src:e,controls:!0}))))},Ay=["url","maxWidth","origin","controls","getElement"],fy=t=>{let{url:e,maxWidth:i,origin:n,controls:a=!0,getElement:o}=t,l=Tb(t,Ay);const c=(0,s.useRef)(null),h=T()(o);return(0,s.useEffect)(()=>{h(c.current)},[h]),n?r().createElement("video",Mb({controls:a},l,{src:e,ref:c})):r().createElement("div",{className:qb,style:{maxWidth:i}},r().createElement("div",{className:Zb},r().createElement("video",Mb({controls:a},l,{src:e,ref:c}))))},gy=t=>{const e=(t||"").split("?")[0].toLowerCase();return/.txt$/.test(e)?"txt":/.pdf$/.test(e)?"pdf":/.(png|jpg|jpeg)$/.test(e)?"image":/.(html|htm)$/.test(e)?"html":/.(doc|docx|xls|xlsx|ppt|pptx|csv)$/.test(e)?"office":/.(mp3|wav|ogg|aac)$/.test(e)?"audio":/.(mp4|avi|mov|mkv|flv)$/.test(e)?"video":"unknown"},my={txt:ly,pdf:oy,image:dy,html:iy,office:ay,audio:py,video:fy,unknown:cy},vy=t=>my[gy(t)],wy=["data","id","staticUrl","className","fetchApi","filename","render"],by=Lb(t=>{let{data:e,id:i,staticUrl:n,className:s,fetchApi:a,filename:o,render:l}=t,c=Tb(t,wy);const h=Wb({staticUrl:n,url:e}),d=e&&vy(e)||o&&vy(o);return"function"===typeof l?l({data:e,id:i,staticUrl:n,className:s,fetchApi:a,filename:o,url:h,component:d}):r().createElement(d,Mb({},c,{className:s,url:h}))}),yy=["id","src","originName","filename"],_y=t=>{let{id:e,src:i,originName:n,filename:s}=t,a=Tb(t,yy);return i?r().createElement(sy,Mb({},a,{url:i,filename:s||n})):r().createElement(by,Mb({},a,{id:e,filename:s||n}))},xy=["content","onSuccess","onError","onBeforePrint","printProps","contentRef"],Ey=t=>{let{onSuccess:e,onError:i,onBeforePrint:n,printProps:a,contentRef:o}=t,l=Tb(t,xy);const[c,h]=(0,s.useState)(!1),u=(0,Yw.useReactToPrint)(Mb({contentRef:o,bodyClass:document.body.getAttribute("class"),onBeforePrint:async function(){h(!0),n&&await n(...arguments)},onPrintError:function(){h(!1),i&&i(...arguments)},onAfterPrint:function(){h(!1),e&&e(...arguments)}},a));return r().createElement(d.Button,Mb({},l,{onClick:()=>{h(!0),u()},loading:c}))};var Sy=".file-modal-outer {\n min-height: 100px;\n}\n\n.file-title {\n margin-right: 30px;\n}\n\n.ellipse {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n word-break: break-all;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlLm1vZHVsZXMuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFLGlCQUFpQjtBQUNuQjs7QUFFQTtFQUNFLGtCQUFrQjtBQUNwQjs7QUFFQTtFQUNFLGdCQUFnQjtFQUNoQix1QkFBdUI7RUFDdkIsb0JBQW9CO0VBQ3BCLHFCQUFxQjtFQUNyQiw0QkFBNEI7RUFDNUIscUJBQXFCO0FBQ3ZCIiwiZmlsZSI6InN0eWxlLm1vZHVsZXMuc2NzcyIsInNvdXJjZXNDb250ZW50IjpbIi5maWxlLW1vZGFsLW91dGVyIHtcbiAgbWluLWhlaWdodDogMTAwcHg7XG59XG5cbi5maWxlLXRpdGxlIHtcbiAgbWFyZ2luLXJpZ2h0OiAzMHB4O1xufVxuXG4uZWxsaXBzZSB7XG4gIG92ZXJmbG93OiBoaWRkZW47XG4gIHRleHQtb3ZlcmZsb3c6IGVsbGlwc2lzO1xuICBkaXNwbGF5OiAtd2Via2l0LWJveDtcbiAgLXdlYmtpdC1saW5lLWNsYW1wOiAxO1xuICAtd2Via2l0LWJveC1vcmllbnQ6IHZlcnRpY2FsO1xuICB3b3JkLWJyZWFrOiBicmVhay1hbGw7XG59Il19 */";const ky=["title","filename","originName","openDownload","openPrint","id","src","apis"],Cy=["renderModal"],My=(0,R.createIntlProvider)("zh-CN",Hb,"react-file"),Ty=t=>{const e=Object.assign({},{footer:null,openDownload:!1,openPrint:!1},t),{title:i,filename:n,originName:a,openDownload:o,openPrint:l,id:c,src:h,apis:u}=e,p=Tb(e,ky),[A,f]=Qw()(p,{value:"open",default:"defaultOpen",onChange:"onOpenChange"}),{message:g}=d.App.useApp(),v=(0,s.useRef)();return Mb({},p,{open:A,onOpenChange:f,onCancel:()=>{f(!1)},title:r().createElement(d.Space,{size:10,className:Sy["file-title"]},r().createElement("span",{className:Sy.ellipse},i||n||a),r().createElement("span",null,o&&r().createElement(My,null,t=>{let{formatMessage:e}=t;return r().createElement(Gb,{className:"btn-no-padding",type:"link",id:c,src:h,apis:u,filename:n||a,onSuccess:()=>{g.success(e({id:"downloadSuccess"}))}})}),l&&["txt","pdf","image","html"].indexOf(gy(n||a))>-1&&r().createElement(Ey,{contentRef:v,type:"link",icon:r().createElement(m,null)}))),children:r().createElement("div",{ref:v,className:Sy["file-modal-outer"]},r().createElement(_y,{id:c,src:h,filename:n||a,apis:u}))})},Py=t=>{const e=Object.assign({},{renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{renderModal:i}=e,n=Tb(e,Cy),s=Ty(n);return Object.assign({},s,{renderModal:t=>i(Object.assign({},s,t))})},Dy=t=>{const{renderModal:e}=Py(t);return e()},Ry=["filename","originName","id","src","title","modalProps","openDownload","openPrint","children"],Ly=t=>{const[e,i]=(0,s.useState)(!1),n=Object.assign({},{icon:r().createElement(w,null)},t),{filename:a,originName:o,id:l,src:c,title:h,modalProps:u,openDownload:p,openPrint:A,children:f}=n,g=Tb(n,Ry),m=Object.assign({},u,{filename:a||o,id:l,src:c,title:h,open:e,openPrint:A,openDownload:p,onCancel:()=>{i(!1)}});return r().createElement(r().Fragment,null,r().createElement(d.Button,Mb({},g,{onClick:()=>{i(!0)}}),"function"===typeof f?f(a||o):f||a||o),r().createElement(Dy,Mb({},m,{open:e,onOpenChange:i})))},Iy=t=>{let{params:e}=t;const{data:i}=e;return new Promise((t,e)=>{const n=new window.Image;n.src=i,n.addEventListener("load",()=>{t(i)}),n.addEventListener("error",t=>{e(t)})})};var Fy="_H1zfc",Ny="_BAe2W",Oy="_9kK1I",By="_Wwi2N";const Wy=["id","src","alt","onClick","loading","error","className","apis","staticUrl"],jy=["id","src","alt","gender","loading","error","className","gap","icon","children","shape","size","width","height","defaultAvatar","apis","staticUrl"],Uy=r().createElement(d.Skeleton.Avatar,{shape:"square",active:!0}),zy=r().createElement(tb,null),Hy=r().createElement(ab,null),Vy=r().createElement(db,null),Gy=r().createElement(gb,null),qy=t=>{let{data:e,className:i,alt:n,innerLoading:s,loading:o,error:c,innerError:h,children:d,onClick:u,staticUrl:p}=t;var A;const{apis:f}=(0,a.usePreset)(),g=Object.assign({},f),m=Wb({staticUrl:p||(null==(A=g.file)?void 0:A.staticUrl),url:e});return r().createElement(l(),{loader:Iy,params:{data:m},error:h||c,loading:s||o,render:t=>{let{data:e}=t;return"function"===typeof d?d({alt:n,className:mt()(i,Ny),src:e}):r().createElement("img",{alt:n,className:mt()(i,Ny),src:e,onClick:u})}})},Xy=Lb(qy),Yy=t=>{let{loading:e,error:i,src:n,id:s,alt:a,className:o,children:l,apis:c,onClick:h,staticUrl:d}=t;const u=(t,e)=>{const i=t.type;return!i&&t.render?t.render(Object.assign({},t.props,e)):r().createElement(i,Object.assign({},t.props,e))},p=e&&u(e,{className:Oy}),A=i&&u(i,{className:By});return s?r().createElement(Xy,{alt:a,className:o,id:s,loading:p,innerLoading:p,error:A,innerError:A,apis:c,onClick:h},l):n?r().createElement(qy,{alt:a,className:o,staticUrl:d,data:n,loading:p,error:A,onClick:h},l):A},Ky=t=>{const e=Object.assign({},{loading:Uy,error:zy},t),{id:i,src:n,alt:s,onClick:a,loading:o,error:l,className:c,apis:h,staticUrl:d}=e,u=Tb(e,Wy);return r().createElement("div",Mb({},u,{className:mt()(c,Fy)}),Yy({loading:o,error:l,src:n,id:i,alt:s,className:c,apis:h,onClick:a,staticUrl:d}))};Ky.Avatar=t=>{const e=Object.assign({},{size:100,defaultAvatar:Hy,error:zy,shape:"circle"},t),{id:i,src:n,alt:s,gender:a,loading:o,error:l,className:c,gap:h,icon:u,children:p,shape:A,size:f,width:g,height:m,defaultAvatar:v,apis:w,staticUrl:b}=e,y=Tb(e,jy),_=(()=>{const t=g&&m?{style:{width:g,height:m}}:{size:f};let e=A;if(g&&g!==m&&(e="square"),i||n)return Yy({loading:o||r().createElement(d.Skeleton.Avatar,{shape:e,active:!0}),staticUrl:b,error:l,src:n,defaultAvatar:v,id:i,alt:s,className:c,apis:w,children:i=>r().createElement(d.Avatar,Mb({},i,{gap:h,shape:e},t))});if(a){const i=["F","female","f"].indexOf(a)>-1?Vy:["M","male","m"].indexOf(a)>-1?Gy:Hy;return r().createElement(d.Avatar,Mb({},y,{src:i,gap:h,shape:e},t))}return r().createElement(d.Avatar,Mb({},y,{gap:h,icon:u,shape:e,size:f,src:v},t),p)})();return r().createElement("div",Mb({},y,{className:mt()(c,Fy),style:{width:g&&m?g:f,height:g&&m?m:f}}),_)};const Qy=t=>{const{item:e,hasPreview:i,getPermission:n,apis:s,onEdit:a,onDelete:o,onPreview:l,renderModal:c}=Object.assign({},{hasPreview:!0,apis:{},getPermission:()=>!0,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{filename:h,id:u,src:p}=e,{onOpenChange:A,renderModal:f}=Py({apis:s,id:u,src:p,filename:h,renderModal:c});return r().createElement(d.Flex,{justify:"end"},i&&n("preview",e)&&r().createElement(r().Fragment,null,r().createElement(d.Button,{type:"text",icon:r().createElement(y,null),onClick:()=>{l?l(e):A(!0)}}),f()),n("edit",e)&&r().createElement(wb.LoadingButton,{type:"text",icon:r().createElement(x,null),onClick:()=>a&&a(e)}),n("download",e)&&r().createElement(Gb,{type:"text",id:u,src:p,filename:h}),n("delete",e)&&r().createElement(wb.ConfirmButton,{type:"text",icon:r().createElement(E.A,null),onClick:()=>o&&o(e)}))};var Jy="_yRMtw",Zy="_OivOI",$y="_doPR9",t_="_bLeUP",e_="_mZdoa";const i_=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),{className:i,dataSource:n,getPermission:s,infoItemRenders:a,onDelete:o,onEdit:l,apis:c,renderModal:h}=Object.assign({},{infoItemRenders:[t=>t.userName?r().createElement(d.Typography.Text,null,t.userName):null,t=>t.date?r().createElement(d.Typography.Text,null,xb()(t.date).format("YYYY-MM-DD HH:mm:ss")):null],getPermission:()=>!0,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t);return r().createElement(d.List,{className:i,dataSource:n.map((t,e)=>(t.index=e,t)),rowKey:t=>"item_".concat(t.uuid&&"uuid_".concat(t.uuid)||t.id&&"id_".concat(t.id)||t.src&&"src_".concat(t.src)),renderItem:t=>{const{type:i,filename:n}=t;return r().createElement(d.List.Item,{className:Jy},r().createElement(d.Row,{justify:"space-between",wrap:!1,className:Zy},r().createElement(d.Col,{flex:1},r().createElement("div",{className:$y}),r().createElement(d.Space,{className:"is-block",align:"start",size:4},r().createElement(vb(),{type:yb()(null==n?void 0:n.split(".")),size:14}),n||"")),a&&a.map((e,n)=>r().createElement(d.Col,{span:e.span||4,key:n},"uploading"!==i&&("function"===typeof e?e:e.render)(t),r().createElement("div",{className:$y}))),r().createElement(d.Col,{className:e_},"uploading"!==i?r().createElement(Qy,{getPermission:s,item:t,apis:c,onDelete:o,renderModal:h,onEdit:l}):r().createElement(d.Space,{className:t_},r().createElement(d.Spin,{size:"small"}),r().createElement(d.Typography.Link,null,e({id:"uploading"}))))))},bordered:!0})}),n_=t=>{const{locale:e}=(0,a.useContext)(),{formatMessage:i}=(0,R.createIntl)({locale:e,namespace:"react-file"}),{multiple:n,fileSize:r,maxLength:o,value:l,concurrentCount:c,onAdd:h,onError:u,onSave:p,onChange:A,onUpload:f}=Object.assign({},{concurrentCount:1,value:[]},t),{apis:g}=(0,a.usePreset)(),{message:m}=d.App.useApp(),[v,w]=(0,s.useState)([]),b=(0,s.useRef)(c),y=(0,s.useMemo)(()=>Sb()(b.current),[]),_=T()(async t=>{const e=o-l.length;1!==o&&!0===n&&t.length>e?m.error(i({id:"maxLengthError"},{maxLength:o})):await Promise.allSettled(t.map(async t=>{if(t.size>1024*r*1024)return void m.error(i({id:"fileSizeError"},{filename:t.name,fileSize:r}));const e=Cb()(),s=n=>{const s=n.message||i({id:"uploadError"},{filename:t.name,error:n.message?":"+n.message:""});m.error(s),u&&u({file:t,error:n,errMsg:s}),w(t=>{const i=t.slice(0),n=i.findIndex(t=>t.uuid===e);return n>-1&&i.splice(n,1),i})};try{var a;w(1===o||!0!==n?[{uuid:e,type:"uploading",filename:t.name}]:i=>{const n=i.slice(0);return n.unshift({uuid:e,type:"uploading",filename:t.name}),n}),h&&await Promise.resolve(h(t));const r=f||(null==(a=g.file)?void 0:a.upload),{data:l}=await y(()=>r({file:t}));if(0!==l.code)return void s(new Error(i({id:"uploadError"},{filename:t.name,error:l.msg?":"+l.msg:""})));const c=p?await Promise.resolve(p(l,t,e)):Object.assign({},l.data,{filename:l.data.filename||l.data.originName||t.name,id:l.data.id,uuid:e});w(t=>{const i=t.slice(0),n=i.findIndex(t=>t.uuid===e);return n>-1&&i.splice(n,1),i}),A(1===o||!0!==n?[c]:t=>{const e=(t||[]).slice(0);return e.push(c),e})}catch(l){s(l)}}))});return{fileList:v,onFileSelected:_}};var s_="_-hhpT",r_="_FyygJ",a_="_hBEXs",o_="_BMSEY";const l_=[".pdf",".jpg",".png",".jpeg",".doc",".docx",".xls",".xlsx",".html",".msg",".eml",".zip"],c_=["children","className","buttonText","accept","multiple","onChange"],h_=["children"],d_=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=(0,s.useRef)(null),n=Object.assign({},{accept:l_,buttonText:e({id:"fileUpload"}),children:t=>{let{children:e}=t,i=Tb(t,h_);return r().createElement(d.Button,Mb({icon:r().createElement(k,null)},i),l,e)}},t),{children:a,className:o,buttonText:l,accept:c,multiple:h,onChange:u}=n,p=Tb(n,c_);return a(Mb({},p,{className:mt()(o,s_),children:!p.disabled&&r().createElement("input",{ref:i,type:"file",accept:c,multiple:h,className:r_,onChange:t=>{const e=[].slice.call(t.target.files,0);0!==e.length&&(i.current.setAttribute("type","text"),i.current.setAttribute("type","file"),u(e))}})}))}),u_=["className","fileSize","maxLength","multiple","size","accept","children","renderTips","showUploadList","onSave","ossUpload","getPermission","concurrentCount","apis","renderModal"],p_=(0,R.createWithIntlProvider)("zh-CN",Hb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},{defaultValue:[],accept:l_,renderTips:t=>t,children:e({id:"fileUpload"}),multiple:!0,showUploadList:!0,maxLength:10,fileSize:30,concurrentCount:10,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{className:n,fileSize:s,maxLength:a,multiple:o,size:l,accept:c,children:h,renderTips:u,showUploadList:p,onSave:A,ossUpload:f,getPermission:g,concurrentCount:m,apis:v,renderModal:w}=i,b=Tb(i,u_),[y,_]=Qw()(b),x=y||[],{fileList:E,onFileSelected:S}=n_({multiple:o,onSave:A,ossUpload:f,fileSize:s,maxLength:a,value:x,onChange:_,concurrentCount:m});c.map(t=>t.replace(/^\./,"")).join("\u3001");const k=[...x,...E],C=u(e({id:"uploadTips"},{fileSize:s,maxLength:a,accept:c.map(t=>t.replace(/^\./,"")).join(",")}),{fileSize:s,maxLength:a,accept:c});return r().createElement(d.Flex,{vertical:!0,gap:8},r().createElement(d.Flex,{gap:8},r().createElement(d_,Mb({},D()(b,["value","onChange"]),{size:l,multiple:o,accept:c,className:n,buttonText:h,onChange:S})),C&&r().createElement("div",{className:o_},C)),p&&k.length>0&&r().createElement(i_,{className:a_,dataSource:k,infoItemRenders:[],getPermission:g||(t=>["delete","preview"].indexOf(t)>-1),onDelete:t=>{const e=x.slice(0),i=e.indexOf(t);i>-1&&e.splice(i,1),_(e)},apis:v,renderModal:w}))}),A_=(t,e)=>{if(t&&e){const i=Array.isArray(e)?e:e.split(","),n=t.name||"",s=(t.type||"").toLowerCase(),r=s.replace(/\/.*$/,"");return i.some(t=>{const e=t.trim().toLowerCase();return"."===e.charAt(0)?n.toLowerCase().endsWith(e):e.endsWith("/*")?r===e.replace(/\/.*$/,""):s===e})}return!0}},64467(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(20816);function s(t,e,i){return(e=(0,n.A)(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}},64816(t,e,i){var n=i(47251),s=i(37159),r=i(80438),a=i(69394),o=i(56874);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l},65387(t,e,i){var n=i(87937)(i(56552),"Promise");t.exports=n},68592(t,e,i){var n=i(4262),s=i(56326),r=i(30474);t.exports=function(t){return n(t,r,s)}},69194(t){var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,i){var n=typeof t;return!!(i=null==i?9007199254740991:i)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<i}},69394(t,e,i){var n=i(12622);t.exports=function(t){return n(this,t).has(t)}},69621(t,e,i){var n=i(17529),s=i(57828),r=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(t){return null==t?[]:(t=Object(t),n(a(t),function(e){return r.call(t,e)}))}:s;t.exports=o},70579(t,e,i){"use strict";t.exports=i(51153)},70705(t){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},70914(t,e,i){var n=i(19841);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},71360(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"}},71775(t,e,i){var n=i(5654);t.exports=function(t,e,i){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}},72070(t,e,i){var n=i(87937)(i(56552),"Set");t.exports=n},72154(t,e,i){var n=i(95575),s=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return s.call(e,t)?e[t]:void 0}},73204(t,e,i){var n=i(3343),s=i(22777),r=i(54052),a=i(44543),o=i(69194),l=i(51268),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var i=r(t),h=!i&&s(t),d=!i&&!h&&a(t),u=!i&&!h&&!d&&l(t),p=i||h||d||u,A=p?n(t.length,String):[],f=A.length;for(var g in t)!e&&!c.call(t,g)||p&&("length"==g||d&&("offset"==g||"parent"==g)||u&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,f))||A.push(g);return A}},74065(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},76272(t,e,i){var n=i(6571),s=i(22761);t.exports=function(t){return s(t)&&n(t)}},76788(t,e,i){var n=i(97160),s=i(85204),r=i(64816);t.exports=function(t,e){var i=this.__data__;if(i instanceof n){var a=i.__data__;if(!s||a.length<199)return a.push([t,e]),this.size=++i.size,this;i=this.__data__=new r(a)}return i.set(t,e),this.size=i.size,this}},77116(t,e,i){var n=i(9812),s=i(22777),r=i(54052),a=n?n.isConcatSpreadable:void 0;t.exports=function(t){return r(t)||s(t)||!!(a&&t&&t[a])}},78420(t,e,i){var n=i(71775),s=i(93211),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,i){var a=t[e];r.call(t,e)&&s(a,i)&&(void 0!==i||e in t)||n(t,e,i)}},79889(t,e,i){var n=i(93950),s=i(46686);t.exports=function(t,e,i){var r=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return s(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),n(t,e,{leading:r,maxWait:e,trailing:a})}},80111(t,e,i){var n=i(41069),s=0;t.exports=function(t){var e=++s;return n(t)+e}},80438(t,e,i){var n=i(12622);t.exports=function(t){return n(this,t).get(t)}},80726(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n&&!1!==e(t[i],i,t););return t}},80755(t,e,i){var n=i(48895),s=i(77116);t.exports=function t(e,i,r,a,o){var l=-1,c=e.length;for(r||(r=s),o||(o=[]);++l<c;){var h=e[l];i>0&&r(h)?i>1?t(h,i-1,r,a,o):n(o,h):a||(o[o.length]=h)}return o}},82211(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"}},82284(t,e,i){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}i.d(e,{A:()=>n})},83223(t,e,i){var n=i(63868),s=i(44353),r=i(38710),a=i(91980),o=i(20310),l=i(22777),c=i(54052),h=i(76272),d=i(44543),u=i(11629),p=i(46686),A=i(12322),f=i(51268),g=i(53737),m=i(91609);t.exports=function(t,e,i,v,w,b,y){var _=g(t,i),x=g(e,i),E=y.get(x);if(E)n(t,i,E);else{var S=b?b(_,x,i+"",t,e,y):void 0,k=void 0===S;if(k){var C=c(x),M=!C&&d(x),T=!C&&!M&&f(x);S=x,C||M||T?c(_)?S=_:h(_)?S=a(_):M?(k=!1,S=s(x,!0)):T?(k=!1,S=r(x,!0)):S=[]:A(x)||l(x)?(S=_,l(_)?S=m(_):p(_)&&!u(_)||(S=o(x))):k=!1}k&&(y.set(x,S),w(S,x,v,b,y),y.delete(x)),n(t,i,S)}}},83713(t,e,i){var n=i(36140),s=i(61143),r=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return s(t);var e=[];for(var i in Object(t))r.call(t,i)&&"constructor"!=i&&e.push(i);return e}},84545(t,e,i){var n=i(97160);t.exports=function(){this.__data__=new n,this.size=0}},84570(t,e,i){var n=i(55647),s=i(60929);t.exports=function(t){return n(function(e,i){var n=-1,r=i.length,a=r>1?i[r-1]:void 0,o=r>2?i[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,o&&s(i[0],i[1],o)&&(a=r<3?void 0:a,r=1),e=Object(e);++n<r;){var l=i[n];l&&t(e,l,n,a)}return e})}},85204(t,e,i){var n=i(87937)(i(56552),"Map");t.exports=n},85990(t,e,i){var n=i(13028)(Object.getPrototypeOf,Object);t.exports=n},86578(t){var e=Date.now;t.exports=function(t){var i=0,n=0;return function(){var s=e(),r=16-(s-n);if(n=s,r>0){if(++i>=800)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},87563(t){t.exports=function(){this.__data__=[],this.size=0}},87937(t,e,i){var n=i(36954),s=i(14657);t.exports=function(t,e){var i=s(t,e);return n(i)?i:void 0}},88140(t,e,i){var n=i(35324),s=i(74065),r=i(21676),a=i(70914);t.exports=function(t,e){return e=n(e,t),null==(t=r(t,e))||delete t[a(s(e))]}},88259(t,e,i){var n=i(15797);t.exports=function(t){var e=n(t,function(t){return 500===i.size&&i.clear(),t}),i=e.cache;return e}},89379(t,e,i){"use strict";i.d(e,{A:()=>r});var n=i(64467);function s(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function r(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?s(Object(i),!0).forEach(function(e){(0,n.A)(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}},91609(t,e,i){var n=i(96614),s=i(30474);t.exports=function(t){return n(t,s(t))}},91980(t){t.exports=function(t,e){var i=-1,n=t.length;for(e||(e=Array(n));++i<n;)e[i]=t[i];return e}},93141(t,e,i){var n;"undefined"!=typeof self&&self,t.exports=(n=i(73884),function(){"use strict";var t={155:function(t){t.exports=n}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};i.r(s),i.d(s,{useReactToPrint:function(){return f}});var r=i(155);const a="printWindow";function o(t){let{level:e="error",messages:i,suppressErrors:n=!1}=t;n||("error"===e?console.error(i):"warning"===e?console.warn(i):console.debug(i))}function l(t,e){if(e||!t){const t=document.getElementById(a);t&&document.body.removeChild(t)}}function c(t){return t instanceof Error?t:new Error("Unknown Error")}function h(t,e){const{documentTitle:i,onAfterPrint:n,onPrintError:s,preserveAfterPrint:r,print:a,suppressErrors:h}=e;setTimeout(()=>{var e,d;if(t.contentWindow){function u(){null==n||n(),l(r)}if(t.contentWindow.focus(),a)a(t).then(u).catch(t=>{s?s("print",c(t)):o({messages:["An error was thrown by the specified `print` function"],suppressErrors:h})});else{if(t.contentWindow.print){const p=null!==(d=null===(e=t.contentDocument)||void 0===e?void 0:e.title)&&void 0!==d?d:"",A=t.ownerDocument.title;i&&(t.ownerDocument.title=i,t.contentDocument&&(t.contentDocument.title=i)),t.contentWindow.print(),i&&(t.ownerDocument.title=A,t.contentDocument&&(t.contentDocument.title=p))}else o({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:h});[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(t=>{var e,i;return(null!==(i=null!==(e=navigator.userAgent)&&void 0!==e?e:navigator.vendor)&&void 0!==i?i:"opera"in window&&window.opera).match(t)})?setTimeout(u,500):u()}}else o({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:h})},500)}function d(t){const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let n=i.nextNode();for(;n;)e.push(n),n=i.nextNode();return e}function u(t,e,i){const n=d(t),s=d(e);if(n.length===s.length)for(let r=0;r<n.length;r++){const t=n[r],e=s[r],a=t.shadowRoot;if(null!==a){const t=e.attachShadow({mode:a.mode});t.innerHTML=a.innerHTML,u(a,t,i)}}else o({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",t,e],suppressErrors:i})}const p='\n @page {\n /* Remove browser default header (title) and footer (url) */\n margin: 0;\n }\n @media print {\n body {\n /* Tell browsers to print background colors */\n color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */\n print-color-adjust: exact; /* Firefox/Safari */\n -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */\n }\n }\n';function A(t,e,i,n){var s,r,a,l,d;const{contentNode:A,clonedContentNode:f,clonedImgNodes:g,clonedVideoNodes:m,numResourcesToLoad:v,originalCanvasNodes:w}=i,{bodyClass:b,fonts:y,ignoreGlobalStyles:_,pageStyle:x,nonce:E,suppressErrors:S,copyShadowRoots:k}=n;t.onload=null;const C=null!==(s=t.contentDocument)&&void 0!==s?s:null===(r=t.contentWindow)||void 0===r?void 0:r.document;if(C){const i=C.body.appendChild(f);k&&u(A,i,!!S),y&&((null===(a=t.contentDocument)||void 0===a?void 0:a.fonts)&&(null===(l=t.contentWindow)||void 0===l?void 0:l.FontFace)?y.forEach(i=>{const n=new FontFace(i.family,i.source,{weight:i.weight,style:i.style});t.contentDocument.fonts.add(n),n.loaded.then(()=>{e(n)}).catch(t=>{e(n,["Failed loading the font:",n,"Load error:",c(t)])})}):(y.forEach(t=>{e(t)}),o({messages:['"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'],suppressErrors:S})));const n=null!=x?x:p,s=C.createElement("style");E&&(s.setAttribute("nonce",E),C.head.setAttribute("nonce",E)),s.appendChild(C.createTextNode(n)),C.head.appendChild(s),b&&C.body.classList.add(...b.split(" "));const r=C.querySelectorAll("canvas");for(let t=0;t<w.length;++t){const e=w[t],i=r[t];if(void 0===i){o({messages:["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.",e],suppressErrors:S});continue}const n=i.getContext("2d");n&&n.drawImage(e,0,0)}for(let t=0;t<g.length;t++){const i=g[t],n=i.getAttribute("src");if(n){const t=new Image;t.onload=()=>{e(i)},t.onerror=(t,n,s,r,a)=>{e(i,["Error loading <img>",i,"Error",a])},t.src=n}else e(i,['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.',i])}for(let t=0;t<m.length;t++){const i=m[t];i.preload="auto";const n=i.getAttribute("poster");if(n){const t=new Image;t.onload=()=>{e(i)},t.onerror=(t,s,r,a,o)=>{e(i,["Error loading video poster",n,"for video",i,"Error:",o])},t.src=n}else i.readyState>=2?e(i):i.src?(i.onloadeddata=()=>{e(i)},i.onerror=(t,n,s,r,a)=>{e(i,["Error loading video",i,"Error",a])},i.onstalled=()=>{e(i,["Loading video stalled, skipping",i])}):e(i,["Error loading video, `src` is empty",i])}const h="select",v=A.querySelectorAll(h),M=C.querySelectorAll(h);for(let t=0;t<v.length;t++)M[t].value=v[t].value;if(!_){const i=document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");for(let n=0,s=i.length;n<s;++n){const s=i[n];if("style"===s.tagName.toLowerCase()){const e=C.createElement(s.tagName),i=s.sheet;if(i){let r="";try{const t=i.cssRules.length;for(let e=0;e<t;++e)"string"==typeof i.cssRules[e].cssText&&(r+="".concat(i.cssRules[e].cssText,"\r\n"))}catch(t){o({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",s,"Original error: ".concat(c(t).message)],level:"warning"})}e.setAttribute("id","react-to-print-".concat(n)),E&&e.setAttribute("nonce",E),e.appendChild(C.createTextNode(r)),C.head.appendChild(e)}}else if(s.getAttribute("href"))if(s.hasAttribute("disabled"))o({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",s],level:"warning"}),e(s);else{const t=C.createElement(s.tagName);for(let e=0,i=s.attributes.length;e<i;++e){const i=s.attributes[e];i&&t.setAttribute(i.nodeName,null!==(d=i.nodeValue)&&void 0!==d?d:"")}t.onload=()=>{e(t)},t.onerror=(i,n,s,r,a)=>{e(t,["Failed to load",t,"Error:",a])},E&&t.setAttribute("nonce",E),C.head.appendChild(t)}else o({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",s],level:"warning"}),e(s)}}}0===v&&h(t,n)}function f(t){let{bodyClass:e,contentRef:i,copyShadowRoots:n,documentTitle:s,fonts:d,ignoreGlobalStyles:u,nonce:p,onAfterPrint:f,onBeforePrint:g,onPrintError:m,pageStyle:v,preserveAfterPrint:w,print:b,printIframeProps:y,suppressErrors:_}=t;const x=(0,r.useCallback)(t=>{function r(){const r={bodyClass:e,contentRef:i,copyShadowRoots:n,documentTitle:s,fonts:d,ignoreGlobalStyles:u,nonce:p,onAfterPrint:f,onBeforePrint:g,onPrintError:m,pageStyle:v,preserveAfterPrint:w,print:b,printIframeProps:y,suppressErrors:_},l=function(t){const e=document.createElement("iframe");return e.width="".concat(document.documentElement.clientWidth,"px"),e.height="".concat(document.documentElement.clientHeight,"px"),e.style.position="absolute",e.style.top="-".concat(document.documentElement.clientHeight+100,"px"),e.style.left="-".concat(document.documentElement.clientWidth+100,"px"),e.id=a,e.srcdoc="<!DOCTYPE html>",t&&(t.allow&&(e.allow=t.allow),void 0!==t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),void 0!==t.sandbox&&(e.sandbox=t.sandbox)),e}(y),c=function(t,e){const{contentRef:i,fonts:n,ignoreGlobalStyles:s,suppressErrors:r}=e,a=function(t){let{contentRef:e,optionalContent:i,suppressErrors:n}=t;return i&&"function"==typeof i?(e&&o({level:"warning",messages:['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']}),i()):e?e.current:void o({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:n})}({contentRef:i,optionalContent:t,suppressErrors:r});if(!a)return;const l=a.cloneNode(!0),c=document.querySelectorAll("link[rel~='stylesheet'], link[as='style']"),h=l.querySelectorAll("img"),d=l.querySelectorAll("video"),u=n?n.length:0;return{contentNode:a,clonedContentNode:l,clonedImgNodes:h,clonedVideoNodes:d,numResourcesToLoad:(s?0:c.length)+h.length+d.length+u,originalCanvasNodes:a.querySelectorAll("canvas")}}(t,r);if(!c)return void o({messages:["There is nothing to print"],suppressErrors:_});const x=function(t,e,i){const{suppressErrors:n}=t,s=[],r=[];return function(a,l){s.includes(a)?o({level:"debug",messages:["Tried to mark a resource that has already been handled",a],suppressErrors:n}):(l?(o({messages:['"react-to-print" was unable to load a resource but will continue attempting to print the page',...l],suppressErrors:n}),r.push(a)):s.push(a),s.length+r.length===e&&h(i,t))}}(r,c.numResourcesToLoad,l);!function(t,e,i,n){t.onload=()=>{A(t,e,i,n)},document.body.appendChild(t)}(l,x,c,r)}l(w,!0),g?g().then(()=>{r()}).catch(t=>{null==m||m("onBeforePrint",c(t))}):r()},[e,i,n,s,d,u,p,f,g,m,v,w,b,_]);return x}return s}())},93211(t){t.exports=function(t,e){return t===e||t!==t&&e!==e}},93950(t,e,i){var n=i(46686),s=i(4757),r=i(40801),a=Math.max,o=Math.min;t.exports=function(t,e,i){var l,c,h,d,u,p,A=0,f=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(e){var i=l,n=c;return l=c=void 0,A=e,d=t.apply(n,i)}function w(t){var i=t-p;return void 0===p||i>=e||i<0||g&&t-A>=h}function b(){var t=s();if(w(t))return y(t);u=setTimeout(b,function(t){var i=e-(t-p);return g?o(i,h-(t-A)):i}(t))}function y(t){return u=void 0,m&&l?v(t):(l=c=void 0,d)}function _(){var t=s(),i=w(t);if(l=arguments,c=this,p=t,i){if(void 0===u)return function(t){return A=t,u=setTimeout(b,e),f?v(t):d}(p);if(g)return clearTimeout(u),u=setTimeout(b,e),v(p)}return void 0===u&&(u=setTimeout(b,e)),d}return e=r(e)||0,n(i)&&(f=!!i.leading,h=(g="maxWait"in i)?a(r(i.maxWait)||0,e):h,m="trailing"in i?!!i.trailing:m),_.cancel=function(){void 0!==u&&clearTimeout(u),A=0,l=p=c=u=void 0},_.flush=function(){return void 0===u?d:y(s())},_}},94258(t,e,i){var n=i(55906)();t.exports=n},95575(t,e,i){var n=i(87937)(Object,"create");t.exports=n},96440(t){"use strict";var e=function(){};t.exports=e},96614(t,e,i){var n=i(78420),s=i(71775);t.exports=function(t,e,i,r){var a=!i;i||(i={});for(var o=-1,l=e.length;++o<l;){var c=e[o],h=r?r(i[c],t[c],c,i,t):void 0;void 0===h&&(h=t[c]),a?s(i,c,h):n(i,c,h)}return i}},96761(t,e,i){var n=i(12322);t.exports=function(t){return n(t)?void 0:t}},96996(t){var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(i){}try{return t+""}catch(i){}}return""}},97132(t,e,i){var n=i(5538),s=i(80726),r=i(78420),a=i(51104),o=i(55119),l=i(44353),c=i(91980),h=i(98124),d=i(29075),u=i(59395),p=i(68592),A=i(26924),f=i(38268),g=i(18630),m=i(20310),v=i(54052),w=i(44543),b=i(57887),y=i(46686),_=i(45921),x=i(28673),E=i(30474),S="[object Arguments]",k="[object Function]",C="[object Object]",M={};M[S]=M["[object Array]"]=M["[object ArrayBuffer]"]=M["[object DataView]"]=M["[object Boolean]"]=M["[object Date]"]=M["[object Float32Array]"]=M["[object Float64Array]"]=M["[object Int8Array]"]=M["[object Int16Array]"]=M["[object Int32Array]"]=M["[object Map]"]=M["[object Number]"]=M[C]=M["[object RegExp]"]=M["[object Set]"]=M["[object String]"]=M["[object Symbol]"]=M["[object Uint8Array]"]=M["[object Uint8ClampedArray]"]=M["[object Uint16Array]"]=M["[object Uint32Array]"]=!0,M["[object Error]"]=M[k]=M["[object WeakMap]"]=!1,t.exports=function t(e,i,T,P,D,R){var L,I=1&i,F=2&i,N=4&i;if(T&&(L=D?T(e,P,D,R):T(e)),void 0!==L)return L;if(!y(e))return e;var O=v(e);if(O){if(L=f(e),!I)return c(e,L)}else{var B=A(e),W=B==k||"[object GeneratorFunction]"==B;if(w(e))return l(e,I);if(B==C||B==S||W&&!D){if(L=F||W?{}:m(e),!I)return F?d(e,o(L,e)):h(e,a(L,e))}else{if(!M[B])return D?e:{};L=g(e,B,I)}}R||(R=new n);var j=R.get(e);if(j)return j;R.set(e,L),_(e)?e.forEach(function(n){L.add(t(n,i,T,n,e,R))}):b(e)&&e.forEach(function(n,s){L.set(s,t(n,i,T,s,e,R))});var U=O?void 0:(N?F?p:u:F?E:x)(e);return s(U||e,function(n,s){U&&(n=e[s=n]),r(L,s,t(n,i,T,s,e,R))}),L}},97160(t,e,i){var n=i(87563),s=i(29935),r=i(24190),a=i(51946),o=i(61714);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l},97685(t,e,i){var n=i(87937)(i(56552),"DataView");t.exports=n},98124(t,e,i){var n=i(96614),s=i(69621);t.exports=function(t,e){return n(t,s(t),e)}},98724(t,e,i){var n=i(27615),s=i(25051),r=i(72154),a=i(48734),o=i(22662);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l}}]);
|
|
3
|
-
//# sourceMappingURL=4189.
|
|
1
|
+
/*! For license information please see 4189.4161d40a.chunk.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunk_kne_components_components_core=self.webpackChunk_kne_components_components_core||[]).push([[2273,4189,6125,8506,9379],{1488(t,e,i){var n=i(50149),s=i(97132),r=i(88140),a=i(35324),o=i(96614),l=i(96761),c=i(15857),h=i(68592),d=c(function(t,e){var i={};if(null==t)return i;var c=!1;e=n(e,function(e){return e=a(e,t),c||(c=e.length>1),e}),o(t,h(t),i),c&&(i=s(i,7,l));for(var d=e.length;d--;)r(i,e[d]);return i});t.exports=d},3343(t){t.exports=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n}},3523(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"}},3892(t){t.exports=function(t){return this.__data__.has(t)}},4262(t,e,i){var n=i(48895),s=i(54052);t.exports=function(t,e,i){var r=e(t);return s(t)?r:n(r,i(t))}},4757(t,e,i){var n=i(56552);t.exports=function(){return n.Date.now()}},5538(t,e,i){var n=i(97160),s=i(84545),r=i(10793),a=i(27760),o=i(3892),l=i(76788);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=s,c.prototype.delete=r,c.prototype.get=a,c.prototype.has=o,c.prototype.set=l,t.exports=c},5654(t,e,i){var n=i(87937),s=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(e){}}();t.exports=s},5791(t,e,i){var n=i(26924),s=i(22761);t.exports=function(t){return s(t)&&"[object Map]"==n(t)}},6571(t,e,i){var n=i(11629),s=i(56173);t.exports=function(t){return null!=t&&s(t.length)&&!n(t)}},6806(t,e,i){var n=i(61516);t.exports=function(t,e){var i=e?n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}},8195(t,e,i){"use strict";function n(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}i.d(e,{A:()=>n})},9056(){},9316(t,e,i){"use strict";i.d(e,{A:()=>o});var n=i(58168),s=i(73884),r=i(3523),a=i(78478);const o=s.forwardRef(function(t,e){return s.createElement(a.A,(0,n.A)({},t,{ref:e,icon:r.A}))})},9812(t,e,i){var n=i(56552).Symbol;t.exports=n},10143(t){var e=/\s/;t.exports=function(t){for(var i=t.length;i--&&e.test(t.charAt(i)););return i}},10793(t){t.exports=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i}},11295(t,e,i){var n=i(9812),s=n?n.prototype:void 0,r=s?s.valueOf:void 0;t.exports=function(t){return r?Object(r.call(t)):{}}},11629(t,e,i){var n=i(16913),s=i(46686);t.exports=function(t){if(!s(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},12322(t,e,i){var n=i(16913),s=i(85990),r=i(22761),a=Function.prototype,o=Object.prototype,l=a.toString,c=o.hasOwnProperty,h=l.call(Object);t.exports=function(t){if(!r(t)||"[object Object]"!=n(t))return!1;var e=s(t);if(null===e)return!0;var i=c.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==h}},12622(t,e,i){var n=i(70705);t.exports=function(t,e){var i=t.__data__;return n(e)?i["string"==typeof e?"string":"hash"]:i.map}},13028(t){t.exports=function(t,e){return function(i){return t(e(i))}}},13440(t,e,i){var n=i(56552)["__core-js_shared__"];t.exports=n},14079(t,e,i){var n=i(88259),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=n(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(s,function(t,i,n,s){e.push(n?s.replace(r,"$1"):i||t)}),e});t.exports=a},14657(t){t.exports=function(t,e){return null==t?void 0:t[e]}},15193(t,e,i){var n=i(16913),s=i(22761);t.exports=function(t){return s(t)&&"[object Arguments]"==n(t)}},15797(t,e,i){var n=i(64816);function s(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;if(r.has(s))return r.get(s);var a=t.apply(this,n);return i.cache=r.set(s,a)||r,a};return i.cache=new(s.Cache||n),i}s.Cache=n,t.exports=s},15857(t,e,i){var n=i(20819),s=i(55636),r=i(46350);t.exports=function(t){return r(s(t,void 0,n),t+"")}},16095(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},16913(t,e,i){var n=i(9812),s=i(34552),r=i(16095),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?s(t):r(t)}},17529(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length,s=0,r=[];++i<n;){var a=t[i];e(a,i,t)&&(r[s++]=a)}return r}},18630(t,e,i){var n=i(61516),s=i(6806),r=i(18962),a=i(11295),o=i(38710);t.exports=function(t,e,i){var l=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new l(+t);case"[object DataView]":return s(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(t,i);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(t);case"[object RegExp]":return r(t);case"[object Symbol]":return a(t)}}},18962(t){var e=/\w*$/;t.exports=function(t){var i=new t.constructor(t.source,e.exec(t));return i.lastIndex=t.lastIndex,i}},19155(t,e,i){"use strict";i.d(e,{A:()=>h});var n=i(73884),s=i(79889),r=i.n(s),a=i(93950),o=i.n(a),l=i(96418),c=i.n(l);const h=(t,e)=>{const i=(0,n.useRef)(null);i.current=Object.assign({},{time:500,isDebounce:!1},e);const s=(0,n.useRef)(null),a=c()(t);return(0,n.useLayoutEffect)(()=>{const t=s.current,e=()=>window.requestAnimationFrame(()=>{t&&a(t)});e();const n=new ResizeObserver((i.current.isDebounce?o():r())(e,i.current.time));return t&&n.observe(t),()=>{n.disconnect()}},[a]),s}},19495(t,e,i){"use strict";function n(t){var e,i,n,r=2;for("undefined"!=typeof Symbol&&(i=Symbol.asyncIterator,n=Symbol.iterator);r--;){if(i&&null!=(e=t[i]))return e.call(t);if(n&&null!=(e=t[n]))return new s(e.call(t));i="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function s(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var e=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:e}})}return s=function(t){this.s=t,this.n=t.next},s.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var i=this.s.return;return void 0===i?Promise.resolve({value:t,done:!0}):e(i.apply(this.s,arguments))},throw:function(t){var i=this.s.return;return void 0===i?Promise.reject(t):e(i.apply(this.s,arguments))}},new s(t)}i.d(e,{A:()=>n})},19841(t,e,i){var n=i(16913),s=i(22761);t.exports=function(t){return"symbol"==typeof t||s(t)&&"[object Symbol]"==n(t)}},20310(t,e,i){var n=i(21817),s=i(85990),r=i(36140);t.exports=function(t){return"function"!=typeof t.constructor||r(t)?{}:n(s(t))}},20449(t,e,i){var n=i(26924),s=i(22761);t.exports=function(t){return s(t)&&"[object Set]"==n(t)}},20816(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(82284);function s(t){var e=function(t,e){if("object"!=(0,n.A)(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=(0,n.A)(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==(0,n.A)(e)?e:e+""}},20819(t,e,i){var n=i(80755);t.exports=function(t){return(null==t?0:t.length)?n(t,1):[]}},21676(t,e,i){var n=i(52969),s=i(53871);t.exports=function(t,e){return e.length<2?t:n(t,s(e,0,-1))}},21817(t,e,i){var n=i(46686),s=Object.create,r=function(){function t(){}return function(e){if(!n(e))return{};if(s)return s(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();t.exports=r},22541(t){t.exports=function(t){return function(){return t}}},22662(t,e,i){var n=i(95575);t.exports=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},22761(t){t.exports=function(t){return null!=t&&"object"==typeof t}},22777(t,e,i){var n=i(15193),s=i(22761),r=Object.prototype,a=r.hasOwnProperty,o=r.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(t){return s(t)&&a.call(t,"callee")&&!o.call(t,"callee")};t.exports=l},22929(t,e,i){var n=i(56552).Uint8Array;t.exports=n},23253(t,e,i){var n=i(5538),s=i(63868),r=i(94258),a=i(83223),o=i(46686),l=i(30474),c=i(53737);t.exports=function t(e,i,h,d,u){e!==i&&r(i,function(r,l){if(u||(u=new n),o(r))a(e,i,l,h,t,d,u);else{var p=d?d(c(e,l),r,l+"",e,i,u):void 0;void 0===p&&(p=r),s(e,l,p)}},l)}},24190(t,e,i){var n=i(61340);t.exports=function(t){var e=this.__data__,i=n(e,t);return i<0?void 0:e[i][1]}},24558(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(26562);function s(t,e,i){return t.set((0,n.A)(t,e),i),i}},25051(t){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},26562(t,e,i){"use strict";function n(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}i.d(e,{A:()=>n})},26600(t,e,i){var n=i(87937)(i(56552),"WeakMap");t.exports=n},26924(t,e,i){var n=i(97685),s=i(85204),r=i(65387),a=i(72070),o=i(26600),l=i(16913),c=i(96996),h="[object Map]",d="[object Promise]",u="[object Set]",p="[object WeakMap]",A="[object DataView]",g=c(n),f=c(s),m=c(r),v=c(a),w=c(o),b=l;(n&&b(new n(new ArrayBuffer(1)))!=A||s&&b(new s)!=h||r&&b(r.resolve())!=d||a&&b(new a)!=u||o&&b(new o)!=p)&&(b=function(t){var e=l(t),i="[object Object]"==e?t.constructor:void 0,n=i?c(i):"";if(n)switch(n){case g:return A;case f:return h;case m:return d;case v:return u;case w:return p}return e}),t.exports=b},27615(t,e,i){var n=i(95575);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},27760(t){t.exports=function(t){return this.__data__.get(t)}},28325(t,e,i){var n=i(22541),s=i(5654),r=i(33279),a=s?function(t,e){return s(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:r;t.exports=a},28673(t,e,i){var n=i(73204),s=i(83713),r=i(6571);t.exports=function(t){return r(t)?n(t):s(t)}},29075(t,e,i){var n=i(96614),s=i(56326);t.exports=function(t,e){return n(t,s(t),e)}},29935(t,e,i){var n=i(61340),s=Array.prototype.splice;t.exports=function(t){var e=this.__data__,i=n(e,t);return!(i<0)&&(i==e.length-1?e.pop():s.call(e,i,1),--this.size,!0)}},30474(t,e,i){var n=i(73204),s=i(58122),r=i(6571);t.exports=function(t){return r(t)?n(t,!0):s(t)}},31170(t){t.exports=function(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}},33279(t){t.exports=function(t){return t}},34552(t,e,i){var n=i(9812),s=Object.prototype,r=s.hasOwnProperty,a=s.toString,o=n?n.toStringTag:void 0;t.exports=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var n=!0}catch(l){}var s=a.call(t);return n&&(e?t[o]=i:delete t[o]),s}},34677(t,e,i){var n=i(23253),s=i(84570)(function(t,e,i){n(t,e,i)});t.exports=s},35324(t,e,i){var n=i(54052),s=i(62597),r=i(14079),a=i(41069);t.exports=function(t,e){return n(t)?t:s(t,e)?[t]:r(a(t))}},35428(t,e,i){var n=i(16913),s=i(56173),r=i(22761),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return r(t)&&s(t.length)&&!!a[n(t)]}},36140(t){var e=Object.prototype;t.exports=function(t){var i=t&&t.constructor;return t===("function"==typeof i&&i.prototype||e)}},36954(t,e,i){var n=i(11629),s=i(37857),r=i(46686),a=i(96996),o=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,h=l.toString,d=c.hasOwnProperty,u=RegExp("^"+h.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!r(t)||s(t))&&(n(t)?u:o).test(a(t))}},37105(t,e,i){var n="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;t.exports=n},37159(t,e,i){var n=i(12622);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},37857(t,e,i){var n=i(13440),s=function(){var t=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=function(t){return!!s&&s in t}},38268(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t){var i=t.length,n=new t.constructor(i);return i&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},38458(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(26562);function s(t,e){return t.get((0,n.A)(t,e))}},38541(t,e,i){var n=i(9812),s=i(50149),r=i(54052),a=i(19841),o=n?n.prototype:void 0,l=o?o.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(r(e))return s(e,t)+"";if(a(e))return l?l.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}},38710(t,e,i){var n=i(61516);t.exports=function(t,e){var i=e?n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}},39790(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(8195);function s(t,e){(0,n.A)(t,e),e.add(t)}},40801(t,e,i){var n=i(61141),s=i(46686),r=i(19841),a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(r(t))return NaN;if(s(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=s(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var i=o.test(t);return i||l.test(t)?c(t.slice(2),i?2:8):a.test(t)?NaN:+t}},41069(t,e,i){var n=i(38541);t.exports=function(t){return null==t?"":n(t)}},43516(t){t.exports=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}},44353(t,e,i){t=i.nmd(t);var n=i(56552),s=e&&!e.nodeType&&e,r=s&&t&&!t.nodeType&&t,a=r&&r.exports===s?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var i=t.length,n=o?o(i):new t.constructor(i);return t.copy(n),n}},44543(t,e,i){t=i.nmd(t);var n=i(56552),s=i(60014),r=e&&!e.nodeType&&e,a=r&&t&&!t.nodeType&&t,o=a&&a.exports===r?n.Buffer:void 0,l=(o?o.isBuffer:void 0)||s;t.exports=l},45921(t,e,i){var n=i(20449),s=i(47574),r=i(56832),a=r&&r.isSet,o=a?s(a):n;t.exports=o},46350(t,e,i){var n=i(28325),s=i(86578)(n);t.exports=s},46686(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},47251(t,e,i){var n=i(98724),s=i(97160),r=i(85204);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(r||s),string:new n}}},47574(t){t.exports=function(t){return function(e){return t(e)}}},48734(t,e,i){var n=i(95575),s=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:s.call(e,t)}},48895(t){t.exports=function(t,e){for(var i=-1,n=e.length,s=t.length;++i<n;)t[s+i]=e[i];return t}},50149(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s}},51104(t,e,i){var n=i(96614),s=i(28673);t.exports=function(t,e){return t&&n(e,s(e),t)}},51153(t,e,i){"use strict";var n=i(73884),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,i){var n,r={},c=null,h=null;for(n in void 0!==i&&(c=""+i),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(h=e.ref),e)a.call(e,n)&&!l.hasOwnProperty(n)&&(r[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===r[n]&&(r[n]=e[n]);return{$$typeof:s,type:t,key:c,ref:h,props:r,_owner:o.current}}e.Fragment=r,e.jsx=c,e.jsxs=c},51268(t,e,i){var n=i(35428),s=i(47574),r=i(56832),a=r&&r.isTypedArray,o=a?s(a):n;t.exports=o},51946(t,e,i){var n=i(61340);t.exports=function(t){return n(this.__data__,t)>-1}},52969(t,e,i){var n=i(35324),s=i(70914);t.exports=function(t,e){for(var i=0,r=(e=n(e,t)).length;null!=t&&i<r;)t=t[s(e[i++])];return i&&i==r?t:void 0}},53737(t){t.exports=function(t,e){if(("constructor"!==e||"function"!==typeof t[e])&&"__proto__"!=e)return t[e]}},53871(t){t.exports=function(t,e,i){var n=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(i=i>s?s:i)<0&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0;for(var r=Array(s);++n<s;)r[n]=t[n+e];return r}},53986(t,e,i){"use strict";function n(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}i.d(e,{A:()=>n})},54052(t){var e=Array.isArray;t.exports=e},55119(t,e,i){var n=i(96614),s=i(30474);t.exports=function(t,e){return t&&n(e,s(e),t)}},55149(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(8195);function s(t,e,i){(0,n.A)(t,e),e.set(t,i)}},55636(t,e,i){var n=i(31170),s=Math.max;t.exports=function(t,e,i){return e=s(void 0===e?t.length-1:e,0),function(){for(var r=arguments,a=-1,o=s(r.length-e,0),l=Array(o);++a<o;)l[a]=r[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=r[a];return c[e]=i(l),n(t,this,c)}}},55647(t,e,i){var n=i(33279),s=i(55636),r=i(46350);t.exports=function(t,e){return r(s(t,e,n),t+"")}},55906(t){t.exports=function(t){return function(e,i,n){for(var s=-1,r=Object(e),a=n(e),o=a.length;o--;){var l=a[t?o:++s];if(!1===i(r[l],l,r))break}return e}}},56173(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},56326(t,e,i){var n=i(48895),s=i(85990),r=i(69621),a=i(57828),o=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,r(t)),t=s(t);return e}:a;t.exports=o},56552(t,e,i){var n=i(37105),s="object"==typeof self&&self&&self.Object===Object&&self,r=n||s||Function("return this")();t.exports=r},56760(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"}},56832(t,e,i){t=i.nmd(t);var n=i(37105),s=e&&!e.nodeType&&e,r=s&&t&&!t.nodeType&&t,a=r&&r.exports===s&&n.process,o=function(){try{var t=r&&r.require&&r.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(e){}}();t.exports=o},56874(t,e,i){var n=i(12622);t.exports=function(t,e){var i=n(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this}},57828(t){t.exports=function(){return[]}},57887(t,e,i){var n=i(5791),s=i(47574),r=i(56832),a=r&&r.isMap,o=a?s(a):n;t.exports=o},58122(t,e,i){var n=i(46686),s=i(36140),r=i(43516),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return r(t);var e=s(t),i=[];for(var o in t)("constructor"!=o||!e&&a.call(t,o))&&i.push(o);return i}},58387(t,e,i){"use strict";function n(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(i=n(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}function s(){for(var t,e,i=0,s="",r=arguments.length;i<r;i++)(t=arguments[i])&&(e=n(t))&&(s&&(s+=" "),s+=e);return s}i.d(e,{$:()=>s,A:()=>r});const r=s},59395(t,e,i){var n=i(4262),s=i(69621),r=i(28673);t.exports=function(t){return n(t,r,s)}},60014(t){t.exports=function(){return!1}},60929(t,e,i){var n=i(93211),s=i(6571),r=i(69194),a=i(46686);t.exports=function(t,e,i){if(!a(i))return!1;var o=typeof e;return!!("number"==o?s(i)&&r(e,i.length):"string"==o&&e in i)&&n(i[e],t)}},61141(t,e,i){var n=i(10143),s=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(s,""):t}},61143(t,e,i){var n=i(13028)(Object.keys,Object);t.exports=n},61340(t,e,i){var n=i(93211);t.exports=function(t,e){for(var i=t.length;i--;)if(n(t[i][0],e))return i;return-1}},61516(t,e,i){var n=i(22929);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},61714(t,e,i){var n=i(61340);t.exports=function(t,e){var i=this.__data__,s=n(i,t);return s<0?(++this.size,i.push([t,e])):i[s][1]=e,this}},62597(t,e,i){var n=i(54052),s=i(19841),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!s(t))||(a.test(t)||!r.test(t)||null!=e&&t in Object(e))}},63868(t,e,i){var n=i(71775),s=i(93211);t.exports=function(t,e,i){(void 0!==i&&!s(t[e],i)||void 0===i&&!(e in t))&&n(t,e,i)}},64189(t,e,i){"use strict";i.r(e),i.d(e,{AudioPreview:()=>Ay,Download:()=>qb,FileButton:()=>Iy,FileInput:()=>u_,FileList:()=>n_,FileListOptionButtons:()=>Jy,FileModal:()=>Ry,FilePreview:()=>xy,FileUpload:()=>A_,HtmlPreview:()=>ny,Image:()=>Qy,ImagePreview:()=>uy,OSSFilePreview:()=>yy,OfficePreview:()=>oy,PdfPreview:()=>ly,PrintButton:()=>Sy,TextPreview:()=>cy,UnknownPreview:()=>hy,VideoPreview:()=>fy,computedAccept:()=>g_,default:()=>Nb,defaultAccept:()=>c_,download:()=>Ob,downloadBlobFile:()=>Bb,useDownload:()=>Hb,useFileModal:()=>Dy,useFileModalProps:()=>Py,useFileUpload:()=>s_,withOSSFile:()=>Ib});var n={};i.r(n),i.d(n,{dU:()=>_A,ng:()=>ne,EA:()=>Gc,Tm:()=>xd,D6:()=>id,YE:()=>gd});var s=i(73884),r=i.n(s),a=i(83694),o=i(87558),l=i.n(o),c=i(34677),h=i.n(c),d=i(55199),u=i(58168),p=i(56760),A=i(78478);const g=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:p.A}))});const f={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M820 436h-40c-4.4 0-8 3.6-8 8v40c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-40c0-4.4-3.6-8-8-8zm32-104H732V120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM360 180h304v152H360V180zm304 664H360V568h304v276zm200-140H732V500H292v204H160V412c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v292z"}}]},name:"printer",theme:"outlined"};const m=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:f}))});const v={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"};const w=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:v}))});var b=i(82211);const y=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:b.A}))});var _=i(71360);const x=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:_.A}))});var E=i(9316);const S={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};const k=s.forwardRef(function(t,e){return s.createElement(A.A,(0,u.A)({},t,{ref:e,icon:S}))});var C,M=i(96418),T=i.n(M),P=i(1488),D=i.n(P),R=i(52526),L=0,I=!1,F=!1,N="[iFrameSizer]",O=null,B=window.requestAnimationFrame,W=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),j={},U=null,z=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){K("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function H(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function V(t,e,i){t.addEventListener(e,i,!1)}function G(t,e,i){t.removeEventListener(e,i,!1)}function q(t){return N+"["+function(t){var e="Host page: "+t;return window.top!==window.self&&(e=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t),e}(t)+"]"}function X(t){return j[t]?j[t].log:I}function Y(t,e){Q("log",t,e,X(t))}function K(t,e){Q("warn",t,e,!0)}function Q(t,e,i,n){!0===n&&"object"===typeof window.console&&console[t](q(e),i)}function J(t){function e(){s("Height"),s("Width"),at(function(){rt(p),it(A),d("onResized",p)},p,"init")}function i(t){return"border-box"!==t.boxSizing?0:(t.paddingTop?parseInt(t.paddingTop,10):0)+(t.paddingBottom?parseInt(t.paddingBottom,10):0)}function n(t){return"border-box"!==t.boxSizing?0:(t.borderTopWidth?parseInt(t.borderTopWidth,10):0)+(t.borderBottomWidth?parseInt(t.borderBottomWidth,10):0)}function s(t){var e=Number(j[A]["max"+t]),i=Number(j[A]["min"+t]),n=t.toLowerCase(),s=Number(p[n]);Y(A,"Checking "+n+" is in range "+i+"-"+e),s<i&&(s=i,Y(A,"Set "+n+" to min value")),s>e&&(s=e,Y(A,"Set "+n+" to max value")),p[n]=""+s}function r(t){return u.slice(u.indexOf(":")+7+t)}function a(t,e){var i,n,s;i=function(){ot("Send Page Info","pageInfo:"+function(){var t=document.body.getBoundingClientRect(),e=p.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:e.height,iframeWidth:e.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(e.top-t.top,10),offsetLeft:parseInt(e.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}(),t,e)},n=32,dt[s=e]||(dt[s]=setTimeout(function(){dt[s]=null,i()},n))}function o(t){var e=t.getBoundingClientRect();return et(A),{x:Math.floor(Number(e.left)+Number(O.x)),y:Math.floor(Number(e.top)+Number(O.y))}}function l(t){var e=t?o(p.iframe):{x:0,y:0},i={x:Number(p.width)+e.x,y:Number(p.height)+e.y};Y(A,"Reposition requested from iFrame (offset x:"+e.x+" y:"+e.y+")"),window.top===window.self?(O=i,c(),Y(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(t?"Offset":"")](i.x,i.y):K(A,"Unable to scroll to requested position, window.parentIFrame not found")}function c(){!1===d("onScroll",O)?nt():it(A)}function h(t){var e={};if(0===Number(p.width)&&0===Number(p.height)){var i=r(9).split(":");e={x:i[1],y:i[0]}}else e={x:p.width,y:p.height};d(t,{iframe:p.iframe,screenX:Number(e.x),screenY:Number(e.y),type:p.type})}function d(t,e){return Z(A,t,e)}var u=t.data,p={},A=null;"[iFrameResizerChild]Ready"===u?function(){for(var t in j)ot("iFrame requested init",lt(t),j[t].iframe,t)}():N===(""+u).slice(0,13)&&u.slice(13).split(":")[0]in j?(p=function(){var t=u.slice(13).split(":"),e=t[1]?parseInt(t[1],10):0,s=j[t[0]]&&j[t[0]].iframe,r=getComputedStyle(s);return{iframe:s,id:t[0],height:e+i(r)+n(r),width:t[2],type:t[3]}}(),A=p.id,j[A]&&(j[A].loaded=!0),!function(){var t=p.type in{true:1,false:1,undefined:1};return t&&Y(A,"Ignoring init message from meta parent page"),t}()&&function(t){var e=!0;return j[t]||(e=!1,K(p.type+" No settings for "+t+". Message was: "+u)),e}(A)&&(Y(A,"Received: "+u),function(){var t=!0;return null===p.iframe&&(K(A,"IFrame ("+p.id+") not found"),t=!1),t}()&&function(){var e=t.origin,i=j[A]&&j[A].checkOrigin;if(i&&""+e!=="null"&&!(i.constructor===Array?function(){var t=0,n=!1;for(Y(A,"Checking connection is from allowed list of origins: "+i);t<i.length;t++)if(i[t]===e){n=!0;break}return n}():function(){var t=j[A]&&j[A].remoteHost;return Y(A,"Checking connection is from: "+t),e===t}()))throw new Error("Unexpected message received from: "+e+" for "+p.iframe.id+". Message was: "+t.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(j[A]&&j[A].firstRun&&j[A]&&(j[A].firstRun=!1),p.type){case"close":tt(p.iframe);break;case"message":t=r(6),Y(A,"onMessage passed: {iframe: "+p.iframe.id+", message: "+t+"}"),d("onMessage",{iframe:p.iframe,message:JSON.parse(t)}),Y(A,"--");break;case"mouseenter":h("onMouseEnter");break;case"mouseleave":h("onMouseLeave");break;case"autoResize":j[A].autoResize=JSON.parse(r(9));break;case"scrollTo":l(!1);break;case"scrollToOffset":l(!0);break;case"pageInfo":a(j[A]&&j[A].iframe,A),function(){function t(t,n){function s(){j[i]?a(j[i].iframe,i):e()}["scroll","resize"].forEach(function(e){Y(i,t+e+" listener for sendPageInfo"),n(window,e,s)})}function e(){t("Remove ",G)}var i=A;t("Add ",V),j[i]&&(j[i].stopPageInfo=e)}();break;case"pageInfoStop":j[A]&&j[A].stopPageInfo&&(j[A].stopPageInfo(),delete j[A].stopPageInfo);break;case"inPageLink":!function(t){var e=t.split("#")[1]||"",i=decodeURIComponent(e),n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){var t=o(n);Y(A,"Moving to in page link (#"+e+") at x: "+t.x+" y: "+t.y),O={x:t.x,y:t.y},c(),Y(A,"--")}():window.top===window.self?Y(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):Y(A,"In page link #"+e+" not found and window.parentIFrame not found")}(r(9));break;case"reset":st(p);break;case"init":e(),d("onInit",p.iframe);break;default:0===Number(p.width)&&0===Number(p.height)?K("Unsupported message received ("+p.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):e()}var t}())):function(t,e){Q("info",t,e,X(t))}(A,"Ignored: "+u)}function Z(t,e,i){var n=null,s=null;if(j[t]){if("function"!==typeof(n=j[t][e]))throw new TypeError(e+" on iFrame["+t+"] is not a function");s=n(i)}return s}function $(t){var e=t.id;delete j[e]}function tt(t){var e=t.id;if(!1!==Z(e,"onClose",e)){Y(e,"Removing iFrame: "+e);try{t.parentNode&&t.parentNode.removeChild(t)}catch(i){K(i)}Z(e,"onClosed",e),Y(e,"--"),$(t),C&&(C.disconnect(),C=null)}else Y(e,"Close iframe cancelled by onClose event")}function et(t){null===O&&Y(t,"Get page position: "+(O={x:void 0===window.pageXOffset?document.documentElement.scrollLeft:window.pageXOffset,y:void 0===window.pageYOffset?document.documentElement.scrollTop:window.pageYOffset}).x+","+O.y)}function it(t){null!==O&&(window.scrollTo(O.x,O.y),Y(t,"Set page position: "+O.x+","+O.y),nt())}function nt(){O=null}function st(t){Y(t.id,"Size reset requested by "+("init"===t.type?"host page":"iFrame")),et(t.id),at(function(){rt(t),ot("reset","reset",t.iframe,t.id)},t,"reset")}function rt(t){function e(e){F||"0"!==t[e]||(F=!0,Y(n,"Hidden iFrame detected, creating visibility listener"),function(){function t(){function t(t){function e(e){return"0px"===(j[t]&&j[t].iframe.style[e])}function i(t){return null!==t.offsetParent}j[t]&&i(j[t].iframe)&&(e("height")||e("width"))&&ot("Visibility change","resize",j[t].iframe,t)}Object.keys(j).forEach(function(e){t(e)})}function e(e){Y("window","Mutation observed: "+e[0].target+" "+e[0].type),ht(t,16)}function i(){var t=document.querySelector("body"),i={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};new n(e).observe(t,i)}var n=H();n&&i()}())}function i(i){!function(e){t.id?(t.iframe.style[e]=t[e]+"px",Y(t.id,"IFrame ("+n+") "+e+" set to "+t[e]+"px")):Y("undefined","messageData id not set")}(i),e(i)}var n=t.iframe.id;j[n]&&(j[n].sizeHeight&&i("height"),j[n].sizeWidth&&i("width"))}function at(t,e,i){i!==e.type&&B&&!window.jasmine?(Y(e.id,"Requesting animation frame"),B(t)):t()}function ot(t,e,i,n,s){var r=!1;n=n||i.id,j[n]&&(i&&"contentWindow"in i&&null!==i.contentWindow?function(){var s=j[n]&&j[n].targetOrigin;Y(n,"["+t+"] Sending msg to iframe["+n+"] ("+e+") targetOrigin: "+s),i.contentWindow.postMessage(N+e,s)}():K(n,"["+t+"] IFrame("+n+") not found"),s&&j[n]&&j[n].warningTimeout&&(j[n].msgTimeout=setTimeout(function(){!j[n]||j[n].loaded||r||(r=!0,K(n,"IFrame has not responded within "+j[n].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},j[n].warningTimeout)))}function lt(t){return t+":"+j[t].bodyMarginV1+":"+j[t].sizeWidth+":"+j[t].log+":"+j[t].interval+":"+j[t].enablePublicMethods+":"+j[t].autoResize+":"+j[t].bodyMargin+":"+j[t].heightCalculationMethod+":"+j[t].bodyBackground+":"+j[t].bodyPadding+":"+j[t].tolerance+":"+j[t].inPageLinks+":"+j[t].resizeFrom+":"+j[t].widthCalculationMethod+":"+j[t].mouseEvents}function ct(t,e){function i(t){var e=t.split("Callback");if(2===e.length){var i="on"+e[0].charAt(0).toUpperCase()+e[0].slice(1);this[i]=this[t],delete this[t],K(n,"Deprecated: '"+t+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}}var n=function(i){if("string"!==typeof i)throw new TypeError("Invaild id for iFrame. Expected String");return""===i&&(t.id=i=function(){var t=e&&e.id||z.id+L++;return null!==document.getElementById(t)&&(t+=L++),t}(),I=(e||{}).log,Y(i,"Added missing iframe ID: "+i+" ("+t.src+")")),i}(t.id);n in j&&"iFrameResizer"in t?K(n,"Ignored iFrame, already setup."):(!function(e){var s;e=e||{},j[n]=Object.create(null),j[n].iframe=t,j[n].firstRun=!0,j[n].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(t){if("object"!==typeof t)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(i,e),function(t){for(var e in z)Object.prototype.hasOwnProperty.call(z,e)&&(j[n][e]=Object.prototype.hasOwnProperty.call(t,e)?t[e]:z[e])}(e),j[n]&&(j[n].targetOrigin=!0===j[n].checkOrigin?""===(s=j[n].remoteHost)||null!==s.match(/^(about:blank|javascript:|file:\/\/)/)?"*":s:"*")}(e),function(){switch(Y(n,"IFrame scrolling "+(j[n]&&j[n].scrolling?"enabled":"disabled")+" for "+n),t.style.overflow=!1===(j[n]&&j[n].scrolling)?"hidden":"auto",j[n]&&j[n].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=j[n]?j[n].scrolling:"no"}}(),function(){function e(e){var i=j[n][e];1/0!==i&&0!==i&&(t.style[e]="number"===typeof i?i+"px":i,Y(n,"Set "+e+" = "+t.style[e]))}function i(t){if(j[n]["min"+t]>j[n]["max"+t])throw new Error("Value for min"+t+" can not be greater than max"+t)}i("Height"),i("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!==typeof(j[n]&&j[n].bodyMargin)&&"0"!==(j[n]&&j[n].bodyMargin)||(j[n].bodyMarginV1=j[n].bodyMargin,j[n].bodyMargin=j[n].bodyMargin+"px"),function(e){var i=H();i&&(C=function(e){if(!t.parentNode)return null;var i=new e(function(e){e.forEach(function(e){Array.prototype.slice.call(e.removedNodes).forEach(function(e){e===t&&tt(t)})})});return i.observe(t.parentNode,{childList:!0}),i}(i)),V(t,"load",function(){ot("iFrame.onload",e,t,void 0,!0),function(){var e=j[n]&&j[n].firstRun,i=j[n]&&j[n].heightCalculationMethod in W;!e&&i&&st({iframe:t,height:0,width:0,type:"init"})}()}),ot("init",e,t,void 0,!0)}(lt(n)),j[n]&&(j[n].iframe.iFrameResizer={close:tt.bind(null,j[n].iframe),removeListeners:$.bind(null,j[n].iframe),resize:ot.bind(null,"Window resize","resize",j[n].iframe),moveToAnchor:function(t){ot("Move to anchor","moveToAnchor:"+t,j[n].iframe,n)},sendMessage:function(t){ot("Send Message","message:"+(t=JSON.stringify(t)),j[n].iframe,n)}}))}function ht(t,e){null===U&&(U=setTimeout(function(){U=null,t()},e))}var dt={};function ut(){"hidden"!==document.visibilityState&&(Y("document","Trigger event: Visibility change"),ht(function(){pt("Tab Visible","resize")},16))}function pt(t,e){Object.keys(j).forEach(function(i){(function(t){return j[t]&&"parent"===j[t].resizeFrom&&j[t].autoResize&&!j[t].firstRun})(i)&&ot(t,e,j[i].iframe,i)})}function At(){V(window,"message",J),V(window,"resize",function(){var t;Y("window","Trigger event: "+(t="resize")),ht(function(){pt("Window "+t,"resize")},16)}),V(document,"visibilitychange",ut),V(document,"-webkit-visibilitychange",ut)}var gt=function(){function t(t,i){i&&(!function(){if(!i.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==i.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+i.tagName+">")}(),ct(i,t),e.push(i))}var e;return function(){var t,e=["moz","webkit","o","ms"];for(t=0;t<e.length&&!B;t+=1)B=window[e[t]+"RequestAnimationFrame"];B?B=B.bind(window):Y("setup","RequestAnimationFrame not supported")}(),At(),function(i,n){switch(e=[],function(t){t&&t.enablePublicMethods&&K("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof n){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(n||"iframe"),t.bind(void 0,i));break;case"object":t(i,n);break;default:throw new TypeError("Unexpected data type ("+typeof n+")")}return e}}(),ft=i(83136),mt=i.n(ft);function vt(t,e,i){e||(e=[]);var n=e.length++;return Object.defineProperty({},"_",{set:function(s){e[n]=s,t.apply(i,e)}})}var wt=i(89379),bt=i(39790),yt=i(55149),_t=i(26562);function xt(t,e,i){return i((0,_t.A)(t,e))}var Et,St,kt,Ct,Mt,Tt,Pt,Dt,Rt,Lt,It,Ft,Nt,Ot,Bt,Wt,jt,Ut,zt=i(38458),Ht=i(24558),Vt=i(64467),Gt=i(19495);const qt="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),Xt=[.001,0,0,.001,0,0],Yt=1.35,Kt=1,Qt=2,Jt=4,Zt=16,$t=32,te=64,ee=128,ie=256,ne={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},se="pdfjs_internal_editor_",re={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ae={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},oe=0,le=1,ce=2,he=3,de=3,ue=4,pe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ae={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},ge=1,fe=2,me=3,ve=4,we=5,be={ERRORS:0,WARNINGS:1,INFOS:5},ye={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},_e=0,xe=1,Ee=2,Se=3;let ke=be.WARNINGS;function Ce(t){Number.isInteger(t)&&(ke=t)}function Me(){return ke}function Te(t){ke>=be.INFOS&&console.info("Info: ".concat(t))}function Pe(t){ke>=be.WARNINGS&&console.warn("Warning: ".concat(t))}function De(t){throw new Error(t)}function Re(t,e){t||De(e)}function Le(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=e?URL.parse(t,e):URL.parse(t);return function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n)?n:null}function Ie(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=URL.parse(t);return n?(n.hash=e,n.href):i&&Le(t,"http://example.com")?t.split("#",1)[0]+"".concat(e?"#".concat(e):""):""}function Fe(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const Ne=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class Oe extends Ne{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Be extends Ne{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class We extends Ne{constructor(t){super(t,"InvalidPDFException")}}class je extends Ne{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class Ue extends Ne{constructor(t){super(t,"FormatError")}}class ze extends Ne{constructor(t){super(t,"AbortException")}}function He(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||De("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let s=0;s<e;s+=i){const r=Math.min(s+i,e),a=t.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function Ve(t){"string"!==typeof t&&De("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}class Ge{static get isLittleEndian(){return Fe(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Fe(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return Fe(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Fe(this,"isImageDecoderSupported","undefined"!==typeof ImageDecoder)}static get platform(){const{platform:t,userAgent:e}=navigator;return Fe(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return Fe(this,"isCSSRoundSupported",null===(t=globalThis.CSS)||void 0===t||null===(e=t.supports)||void 0===e?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const qe=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Xe{static makeHexColor(t,e,i){return"#".concat(qe[t]).concat(qe[e]).concat(qe[i])}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=t[i],s=t[i+1];t[i]=n*e[0]+s*e[2]+e[4],t[i+1]=n*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5];for(let c=0;c<6;c+=2){const e=t[i+c],h=t[i+c+1];t[i+c]=e*n+h*r+o,t[i+c+1]=e*s+h*a+l}}static applyInverseTransform(t,e){const i=t[0],n=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-i*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],c=t[0],h=t[1],d=t[2],u=t[3];let p=n*c+o,A=p,g=n*d+o,f=g,m=a*h+l,v=m,w=a*u+l,b=w;if(0!==s||0!==r){const t=s*c,e=s*d,i=r*h,n=r*u;p+=i,f+=i,g+=n,A+=n,m+=t,b+=t,w+=e,v+=e}i[0]=Math.min(i[0],p,g,A,f),i[1]=Math.min(i[1],m,w,v,b),i[2]=Math.max(i[2],p,g,A,f),i[3]=Math.max(i[3],m,w,v,b)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],a=i**2+n**2,o=i*s+n*r,l=s**2+r**2,c=(a+l)/2,h=Math.sqrt(c**2-(a*l-o**2));e[0]=Math.sqrt(c+h||1),e[1]=Math.sqrt(c-h||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>r?null:[i,s,n,r]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,n,s){s[0]=Math.min(s[0],t,i),s[1]=Math.min(s[1],e,n),s[2]=Math.max(s[2],t,i),s[3]=Math.max(s[3],e,n)}static bezierBoundingBox(t,e,i,n,s,r,a,o,l){l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o),(0,_t.A)(Xe,this,Ke).call(this,t,i,s,a,e,n,r,o,3*(3*(i-s)-t+a),6*(t-2*i+s),3*(i-t),l),(0,_t.A)(Xe,this,Ke).call(this,t,i,s,a,e,n,r,o,3*(3*(n-r)-e+o),6*(e-2*n+r),3*(n-e),l)}}function Ye(t,e,i,n,s,r,a,o,l,c){if(l<=0||l>=1)return;const h=1-l,d=l*l,u=d*l,p=h*(h*(h*t+3*l*e)+3*d*i)+u*n,A=h*(h*(h*s+3*l*r)+3*d*a)+u*o;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],A),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],A)}function Ke(t,e,i,n,s,r,a,o,l,c,h,d){if(Math.abs(l)<1e-12)return void(Math.abs(c)>=1e-12&&(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,-h/c,d));const u=c**2-4*h*l;if(u<0)return;const p=Math.sqrt(u),A=2*l;(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,(-c+p)/A,d),(0,_t.A)(Et,this,Ye).call(this,t,e,i,n,s,r,a,o,(-c-p)/A,d)}Et=Xe;let Qe=null,Je=null;function Ze(){if("function"===typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),He(t)}const $e="pdfjs_internal_id_";function ti(t,e,i){return Math.min(Math.max(t,e),i)}function ei(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(He(t))}"function"!==typeof Promise.try&&(Promise.try=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return new Promise(e=>{e(t(...i))})}),"function"!==typeof Math.sumPrecise&&(Math.sumPrecise=function(t){return t.reduce((t,e)=>t+e,0)});class ii{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var n;if(!i)return;let s=null;const r=i.name;if("#text"===r)s=i.value;else{if(!ii.shouldBuildText(r))return;null!==i&&void 0!==i&&null!==(n=i.attributes)&&void 0!==n&&n.textContent?s=i.attributes.textContent:i.value&&(s=i.value)}if(null!==s&&e.push({str:s}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}class ni{static setupStorage(t,e,i,n,s){const r=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?t.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",t=>{n.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===s)break;t.addEventListener("input",t=>{n.setValue(e,{value:t.target.value})})}break;case"select":if(null!==r.value){t.setAttribute("value",r.value);for(const t of i.children)t.attributes.value===r.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(e,{value:s})})}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:s,linkService:r}=t;const{attributes:a}=i,o=e instanceof HTMLAnchorElement;"radio"===a.type&&(a.name="".concat(a.name,"-").concat(s));for(const[l,c]of Object.entries(a))if(null!==c&&void 0!==c)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!o||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,c)}o&&r.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:s,linkService:i});const a="richText"!==s,o=t.div;if(o.append(r),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);r.append(t),a&&ii.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const c=[[n,-1,r]];for(;c.length>0;){var h,d;const[t,n,r]=c.at(-1);if(n+1===t.children.length){c.pop();continue}const o=t.children[++c.at(-1)[1]];if(null===o)continue;const{name:u}=o;if("#text"===u){const t=document.createTextNode(o.value);l.push(t),r.append(t);continue}const p=null!==o&&void 0!==o&&null!==(h=o.attributes)&&void 0!==h&&h.xmlns?document.createElementNS(o.attributes.xmlns,u):document.createElement(u);if(r.append(p),o.attributes&&this.setAttributes({html:p,element:o,storage:e,intent:s,linkService:i}),(null===(d=o.children)||void 0===d?void 0:d.length)>0)c.push([o,-1,p]);else if(o.value){const t=document.createTextNode(o.value);a&&ii.shouldBuildText(u)&&l.push(t),p.append(t)}}for(const u of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const si="http://www.w3.org/2000/svg";class ri{}async function ai(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(ui(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(200!==s.status&&0!==s.status)n(new Error(s.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(s.response)}i(s.responseText)}},s.send(null)})}St=ri,(0,Vt.A)(ri,"CSS",96),(0,Vt.A)(ri,"PDF",72),(0,Vt.A)(ri,"PDF_TO_CSS_UNITS",St.CSS/St.PDF);class oi{constructor(t){let{viewBox:e,userUnit:i,scale:n,rotation:s,offsetX:r=0,offsetY:a=0,dontFlip:o=!1}=t;this.viewBox=e,this.userUnit=i,this.scale=n,this.rotation=s,this.offsetX=r,this.offsetY=a,n*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let h,d,u,p,A,g,f,m;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,d=0,u=0,p=1;break;case 90:h=0,d=1,u=1,p=0;break;case 270:h=0,d=-1,u=-1,p=0;break;case 0:h=1,d=0,u=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(u=-u,p=-p),0===h?(A=Math.abs(c-e[1])*n+r,g=Math.abs(l-e[0])*n+a,f=(e[3]-e[1])*n,m=(e[2]-e[0])*n):(A=Math.abs(l-e[0])*n+r,g=Math.abs(c-e[1])*n+a,f=(e[2]-e[0])*n,m=(e[3]-e[1])*n),this.transform=[h*n,d*n,u*n,p*n,A-h*n*l-u*n*c,g-d*n*l-p*n*c],this.width=f,this.height=m}get rawDims(){const t=this.viewBox;return Fe(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new oi({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){const i=[t,e];return Xe.applyTransform(i,this.transform),i}convertToViewportRectangle(t){const e=[t[0],t[1]];Xe.applyTransform(e,this.transform);const i=[t[2],t[3]];return Xe.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){const i=[t,e];return Xe.applyInverseTransform(i,this.transform),i}}class li extends Ne{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function ci(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function hi(t){return"string"===typeof t&&/\.pdf$/i.test(t)}class di{constructor(){(0,Vt.A)(this,"started",Object.create(null)),(0,Vt.A)(this,"times",[])}time(t){t in this.started&&Pe("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||Pe("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:n,end:s}of this.times)t.push("".concat(i.padEnd(e)," ").concat(s-n,"ms\n"));return t.join("")}}function ui(t,e){const i=e?URL.parse(t,e):URL.parse(t);return"http:"===(null===i||void 0===i?void 0:i.protocol)||"https:"===(null===i||void 0===i?void 0:i.protocol)}function pi(t){t.preventDefault()}function Ai(t){t.preventDefault(),t.stopPropagation()}class gi{static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!==typeof t)return null;(0,_t.A)(gi,this,fi)._||(fi._=(0,_t.A)(gi,this,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")));const e=(0,_t.A)(gi,this,fi)._.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let h=parseInt(e[9],10)||0;return h=h>=0&&h<=59?h:0,"-"===l?(r+=c,a+=h):"+"===l&&(r-=c,a-=h),new Date(Date.UTC(i,n,s,r,a,o))}}var fi={_:void 0};function mi(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Pe('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function vi(t){const{a:e,b:i,c:n,d:s,e:r,f:a}=t.getTransform();return[e,i,n,s,r,a]}function wi(t){const{a:e,b:i,c:n,d:s,e:r,f:a}=t.getTransform().invertSelf();return[e,i,n,s,r,a]}function bi(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof oi){const{pageWidth:n,pageHeight:s}=e.rawDims,{style:r}=t,a=Ge.isCSSRoundSupported,o="var(--total-scale-factor) * ".concat(n,"px"),l="var(--total-scale-factor) * ".concat(s,"px"),c=a?"round(down, ".concat(o,", var(--scale-round-x))"):"calc(".concat(o,")"),h=a?"round(down, ".concat(l,", var(--scale-round-y))"):"calc(".concat(l,")");i&&e.rotation%180!==0?(r.width=h,r.height=c):(r.width=c,r.height=h)}n&&t.setAttribute("data-main-rotation",e.rotation)}class yi{constructor(){const{pixelRatio:t}=yi;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,r=1/0,a=1/0,o=1/0;(i=yi.capPixels(i,s))>0&&(r=Math.sqrt(i/(t*e))),-1!==n&&(a=n/t,o=n/e);const l=Math.min(r,a,o);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}const _i=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class xi{static get isDarkMode(){var t,e;return Fe(this,"isDarkMode",!(null===(t=window)||void 0===t||null===(e=t.matchMedia)||void 0===e||!e.call(t,"(prefers-color-scheme: dark)").matches))}}function Ei(t,e){const i=t[0]/255,n=t[1]/255,s=t[2]/255,r=Math.max(i,n,s),a=Math.min(i,n,s),o=(r+a)/2;if(r===a)e[0]=e[1]=0;else{const t=r-a;switch(e[1]=o<.5?t/(r+a):t/(2-r-a),r){case i:e[0]=60*((n-s)/t+(n<s?6:0));break;case n:e[0]=60*((s-i)/t+2);break;case s:e[0]=60*((i-n)/t+4)}}e[2]=o}function Si(t,e){const i=t[0],n=t[1],s=t[2],r=(1-Math.abs(2*s-1))*n,a=r*(1-Math.abs(i/60%2-1)),o=s-r/2;switch(Math.floor(i/60)){case 0:e[0]=r+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=r+o,e[2]=o;break;case 2:e[0]=o,e[1]=r+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=r+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=r+o;break;case 5:case 6:e[0]=r+o,e[1]=o,e[2]=a+o}}function ki(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function Ci(t,e,i){Si(t,i),i.map(ki);const n=.2126*i[0]+.7152*i[1]+.0722*i[2];Si(e,i),i.map(ki);const s=.2126*i[0]+.7152*i[1]+.0722*i[2];return n>s?(n+.05)/(s+.05):(s+.05)/(n+.05)}const Mi=new Map;function Ti(t,e){let{html:i,dir:n,className:s}=t;const r=document.createDocumentFragment();if("string"===typeof i){const t=document.createElement("p");t.dir=n||"auto";const e=i.split(/(?:\r\n?|\n)/);for(let i=0,n=e.length;i<n;++i){const s=e[i];t.append(document.createTextNode(s)),i<n-1&&t.append(document.createElement("br"))}r.append(t)}else ni.render({xfaHtml:i,div:r,intent:"richText"});r.firstChild.classList.add("richText",s),e.append(r)}var Pi=new WeakMap,Di=new WeakMap,Ri=new WeakMap,Li=new WeakMap,Ii=new WeakMap,Fi=new WeakMap,Ni=new WeakMap,Oi=new WeakMap,Bi=new WeakSet;class Wi{constructor(t){(0,bt.A)(this,Bi),(0,yt.A)(this,Pi,null),(0,yt.A)(this,Di,null),(0,yt.A)(this,Ri,void 0),(0,yt.A)(this,Li,null),(0,yt.A)(this,Ii,null),(0,yt.A)(this,Fi,null),(0,yt.A)(this,Ni,null),(0,yt.A)(this,Oi,null),(0,Ht.A)(Ri,this,t),Gi._||(Gi._=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=(0,Ht.A)(Pi,this,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=(0,zt.A)(Ri,this)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",pi,{signal:e}),t.addEventListener("pointerdown",ji,{signal:e}));const i=(0,Ht.A)(Li,this,document.createElement("div"));i.className="buttons",t.append(i);const n=(0,zt.A)(Ri,this).toolbarPosition;if(n){const{style:e}=t,i="ltr"===(0,zt.A)(Ri,this)._uiManager.direction?1-n[0]:n[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*n[1],"% + var(--editor-toolbar-vert-offset))")}return t}get div(){return(0,zt.A)(Pi,this)}hide(){var t;(0,zt.A)(Pi,this).classList.add("hidden"),null===(t=(0,zt.A)(Di,this))||void 0===t||t.hideDropdown()}show(){var t,e;(0,zt.A)(Pi,this).classList.remove("hidden"),null===(t=(0,zt.A)(Ii,this))||void 0===t||t.shown(),null===(e=(0,zt.A)(Fi,this))||void 0===e||e.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=(0,zt.A)(Ri,this),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",Gi._[t]),(0,_t.A)(Bi,this,Hi).call(this,i)&&i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),(0,zt.A)(Li,this).append(i)}async addAltText(t){const e=await t.render();(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi)),(0,Ht.A)(Ii,this,t)}addComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if((0,zt.A)(Fi,this))return;const i=t.renderForToolbar();if(!i)return;(0,_t.A)(Bi,this,Hi).call(this,i);const n=(0,Ht.A)(Ni,this,xt(Bi,this,Vi));e?((0,zt.A)(Li,this).insertBefore(i,e),(0,zt.A)(Li,this).insertBefore(n,e)):(0,zt.A)(Li,this).append(i,n),(0,Ht.A)(Fi,this,t),t.toolbar=this}addColorPicker(t){if((0,zt.A)(Di,this))return;(0,Ht.A)(Di,this,t);const e=t.renderButton();(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi))}async addEditSignatureButton(t){const e=(0,Ht.A)(Oi,this,await t.renderEditButton((0,zt.A)(Ri,this)));(0,_t.A)(Bi,this,Hi).call(this,e),(0,zt.A)(Li,this).append(e,xt(Bi,this,Vi))}removeButton(t){var e,i;if("comment"===t)null===(e=(0,zt.A)(Fi,this))||void 0===e||e.removeToolbarCommentButton(),(0,Ht.A)(Fi,this,null),null===(i=(0,zt.A)(Ni,this))||void 0===i||i.remove(),(0,Ht.A)(Ni,this,null)}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e)}}async addButtonBefore(t,e,i){const n=(0,zt.A)(Li,this).querySelector(i);n&&"comment"===t&&this.addComment(e,n)}updateEditSignatureButton(t){(0,zt.A)(Oi,this)&&((0,zt.A)(Oi,this).title=t)}remove(){var t;(0,zt.A)(Pi,this).remove(),null===(t=(0,zt.A)(Di,this))||void 0===t||t.destroy(),(0,Ht.A)(Di,this,null)}}function ji(t){t.stopPropagation()}function Ui(t){(0,zt.A)(Ri,this)._focusEventsAllowed=!1,Ai(t)}function zi(t){(0,zt.A)(Ri,this)._focusEventsAllowed=!0,Ai(t)}function Hi(t){const e=(0,zt.A)(Ri,this)._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",(0,_t.A)(Bi,this,Ui).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,_t.A)(Bi,this,zi).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",pi,{signal:e}),!0)}function Vi(t){const e=document.createElement("div");return e.className="divider",e}var Gi={_:null},qi=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Ki=new WeakSet;class Qi{constructor(t){(0,bt.A)(this,Ki),(0,yt.A)(this,qi,null),(0,yt.A)(this,Xi,null),(0,yt.A)(this,Yi,void 0),(0,Ht.A)(Yi,this,t)}show(t,e,i){const[n,s]=(0,_t.A)(Ki,this,Zi).call(this,e,i),{style:r}=(0,zt.A)(Xi,this)||(0,Ht.A)(Xi,this,(0,_t.A)(Ki,this,Ji).call(this));t.append((0,zt.A)(Xi,this)),r.insetInlineEnd="".concat(100*n,"%"),r.top="calc(".concat(100*s,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,zt.A)(Xi,this).remove()}}function Ji(){const t=(0,Ht.A)(Xi,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=(0,zt.A)(Yi,this)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",pi,{signal:e});const i=(0,Ht.A)(qi,this,document.createElement("div"));return i.className="buttons",t.append(i),(0,zt.A)(Yi,this).hasCommentManager()&&(0,_t.A)(Ki,this,$i).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{(0,zt.A)(Yi,this).commentSelection("floating_button")}),(0,_t.A)(Ki,this,$i).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{(0,zt.A)(Yi,this).highlightSelection("floating_button")}),t}function Zi(t,e){let i=0,n=0;for(const s of t){const t=s.y+s.height;if(t<i)continue;const r=s.x+(e?s.width:0);t>i?(n=r,i=t):e?r>n&&(n=r):r<n&&(n=r)}return[e?1-n:n,i]}function $i(t,e,i,n){const s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);const r=document.createElement("span");s.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",i);const a=(0,zt.A)(Yi,this)._signal;a instanceof AbortSignal&&!a.aborted&&(s.addEventListener("contextmenu",pi,{signal:a}),s.addEventListener("click",n,{signal:a})),(0,zt.A)(qi,this).append(s)}function tn(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))}var en=new WeakMap;class nn{constructor(){(0,yt.A)(this,en,0)}get id(){var t,e;return"".concat(se).concat(((0,Ht.A)(en,this,(t=(0,zt.A)(en,this),e=t++,t)),e))}}var sn=new WeakMap,rn=new WeakMap,an=new WeakMap,on=new WeakSet;class ln{constructor(){(0,bt.A)(this,on),(0,yt.A)(this,sn,Ze()),(0,yt.A)(this,rn,0),(0,yt.A)(this,an,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return Fe(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){const{lastModified:e,name:i,size:n,type:s}=t;return(0,_t.A)(on,this,cn).call(this,"".concat(e,"_").concat(i,"_").concat(n,"_").concat(s),t)}async getFromUrl(t){return(0,_t.A)(on,this,cn).call(this,t,t)}async getFromBlob(t,e){const i=await e;return(0,_t.A)(on,this,cn).call(this,t,i)}async getFromId(t){(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);const e=(0,zt.A)(an,this).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){var i,n,s;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);let r=(0,zt.A)(an,this).get(t);if(null!==(s=r)&&void 0!==s&&s.bitmap)return r.refCounter+=1,r;const a=new OffscreenCanvas(e.width,e.height);return a.getContext("2d").drawImage(e,0,0),r={bitmap:a.transferToImageBitmap(),id:"image_".concat((0,zt.A)(sn,this),"_").concat(((0,Ht.A)(rn,this,(i=(0,zt.A)(rn,this),n=i++,i)),n)),refCounter:1,isSvg:!1},(0,zt.A)(an,this).set(t,r),(0,zt.A)(an,this).set(r.id,r),r}getSvgUrl(t){const e=(0,zt.A)(an,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){var e;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);const i=(0,zt.A)(an,this).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const{bitmap:n}=i;if(!i.url&&!i.file){const t=new OffscreenCanvas(n.width,n.height);t.getContext("bitmaprenderer").transferFromImageBitmap(n),i.blobPromise=t.convertToBlob()}null===(e=n.close)||void 0===e||e.call(n),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat((0,zt.A)(sn,this),"_"))}}async function cn(t,e){var i;(0,zt.A)(an,this)||(0,Ht.A)(an,this,new Map);let n=(0,zt.A)(an,this).get(t);if(null===n)return null;if(null!==(i=n)&&void 0!==i&&i.bitmap)return n.refCounter+=1,n;try{var s,r;let t;if(n||(n={bitmap:null,id:"image_".concat((0,zt.A)(sn,this),"_").concat(((0,Ht.A)(rn,this,(s=(0,zt.A)(rn,this),r=s++,s)),r)),refCounter:0,isSvg:!1}),"string"===typeof e?(n.url=e,t=await ai(e,"blob")):e instanceof File?t=n.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=kt._isSVGFittingCanvas,i=new FileReader,s=new Image,r=new Promise((t,r)=>{s.onload=()=>{n.bitmap=s,n.isSvg=!0,t()},i.onload=async()=>{const t=n.svgUrl=i.result;s.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},s.onerror=i.onerror=r});i.readAsDataURL(t),await r}else n.bitmap=await createImageBitmap(t);n.refCounter=1}catch(a){Pe(a),n=null}return(0,zt.A)(an,this).set(t,n),n&&(0,zt.A)(an,this).set(n.id,n),n}kt=ln;var hn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap;class An{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;(0,yt.A)(this,hn,[]),(0,yt.A)(this,dn,!1),(0,yt.A)(this,un,void 0),(0,yt.A)(this,pn,-1),(0,Ht.A)(un,this,t)}add(t){let{cmd:e,undo:i,post:n,mustExec:s,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}=t;if(s&&e(),(0,zt.A)(dn,this))return;const l={cmd:e,undo:i,post:n,type:r};if(-1===(0,zt.A)(pn,this))return(0,zt.A)(hn,this).length>0&&((0,zt.A)(hn,this).length=0),(0,Ht.A)(pn,this,0),void(0,zt.A)(hn,this).push(l);if(a&&(0,zt.A)(hn,this)[(0,zt.A)(pn,this)].type===r)return o&&(l.undo=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)].undo),void((0,zt.A)(hn,this)[(0,zt.A)(pn,this)]=l);const c=(0,zt.A)(pn,this)+1;c===(0,zt.A)(un,this)?(0,zt.A)(hn,this).splice(0,1):((0,Ht.A)(pn,this,c),c<(0,zt.A)(hn,this).length&&(0,zt.A)(hn,this).splice(c)),(0,zt.A)(hn,this).push(l)}undo(){if(-1===(0,zt.A)(pn,this))return;(0,Ht.A)(dn,this,!0);const{undo:t,post:e}=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)];t(),null===e||void 0===e||e(),(0,Ht.A)(dn,this,!1),(0,Ht.A)(pn,this,(0,zt.A)(pn,this)-1)}redo(){if((0,zt.A)(pn,this)<(0,zt.A)(hn,this).length-1){(0,Ht.A)(pn,this,(0,zt.A)(pn,this)+1),(0,Ht.A)(dn,this,!0);const{cmd:t,post:e}=(0,zt.A)(hn,this)[(0,zt.A)(pn,this)];t(),null===e||void 0===e||e(),(0,Ht.A)(dn,this,!1)}}hasSomethingToUndo(){return-1!==(0,zt.A)(pn,this)}hasSomethingToRedo(){return(0,zt.A)(pn,this)<(0,zt.A)(hn,this).length-1}cleanType(t){if(-1!==(0,zt.A)(pn,this)){for(let e=(0,zt.A)(pn,this);e>=0;e--)if((0,zt.A)(hn,this)[e].type!==t)return(0,zt.A)(hn,this).splice(e+1,(0,zt.A)(pn,this)-e),void(0,Ht.A)(pn,this,e);(0,zt.A)(hn,this).length=0,(0,Ht.A)(pn,this,-1)}}destroy(){(0,Ht.A)(hn,this,null)}}var gn=new WeakSet;class fn{constructor(t){(0,bt.A)(this,gn),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Ge.platform;for(const[i,n,s={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:n,options:s}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get((0,_t.A)(gn,this,mn).call(this,e));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:r=[],checker:a=null}}=i;a&&!a(t,e)||(n.bind(t,...r,e)(),s||Ai(e))}}function mn(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}class vn{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,mi(n))}e.remove()}(t),Fe(this,"_colors",t)}convert(t){const e=mi(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every((t,i)=>t===e[i]))return vn._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?Xe.makeHexColor(...e):t}}(0,Vt.A)(vn,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var wn=new WeakMap,bn=new WeakMap,yn=new WeakMap,_n=new WeakMap,xn=new WeakMap,En=new WeakMap,Sn=new WeakMap,kn=new WeakMap,Cn=new WeakMap,Mn=new WeakMap,Tn=new WeakMap,Pn=new WeakMap,Dn=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,In=new WeakMap,Fn=new WeakMap,Nn=new WeakMap,On=new WeakMap,Bn=new WeakMap,Wn=new WeakMap,jn=new WeakMap,Un=new WeakMap,zn=new WeakMap,Hn=new WeakMap,Vn=new WeakMap,Gn=new WeakMap,qn=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,$n=new WeakMap,ts=new WeakMap,es=new WeakMap,is=new WeakMap,ns=new WeakMap,ss=new WeakMap,rs=new WeakMap,as=new WeakMap,os=new WeakMap,ls=new WeakMap,cs=new WeakMap,hs=new WeakMap,ds=new WeakMap,us=new WeakMap,ps=new WeakMap,As=new WeakSet;class gs{static get _keyboardManager(){const t=gs.prototype,e=t=>(0,zt.A)(hs,t).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Fe(this,"_keyboardManager",new fn([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,zt.A)(hs,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,zt.A)(hs,t).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}constructor(t,e,i,n,s,r,a,o,l,c,h,d,u,p,A,g){(0,bt.A)(this,As),(0,yt.A)(this,wn,new AbortController),(0,yt.A)(this,bn,null),(0,yt.A)(this,yn,null),(0,yt.A)(this,_n,new Map),(0,yt.A)(this,xn,new Map),(0,yt.A)(this,En,null),(0,yt.A)(this,Sn,null),(0,yt.A)(this,kn,null),(0,yt.A)(this,Cn,new An),(0,yt.A)(this,Mn,null),(0,yt.A)(this,Tn,null),(0,yt.A)(this,Pn,null),(0,yt.A)(this,Dn,0),(0,yt.A)(this,Rn,new Set),(0,yt.A)(this,Ln,null),(0,yt.A)(this,In,null),(0,yt.A)(this,Fn,new Set),(0,Vt.A)(this,"_editorUndoBar",null),(0,yt.A)(this,Nn,!1),(0,yt.A)(this,On,!1),(0,yt.A)(this,Bn,!1),(0,yt.A)(this,Wn,null),(0,yt.A)(this,jn,null),(0,yt.A)(this,Un,null),(0,yt.A)(this,zn,null),(0,yt.A)(this,Hn,!1),(0,yt.A)(this,Vn,null),(0,yt.A)(this,Gn,new nn),(0,yt.A)(this,qn,!1),(0,yt.A)(this,Xn,!1),(0,yt.A)(this,Yn,!1),(0,yt.A)(this,Kn,null),(0,yt.A)(this,Qn,null),(0,yt.A)(this,Jn,null),(0,yt.A)(this,Zn,null),(0,yt.A)(this,$n,null),(0,yt.A)(this,ts,re.NONE),(0,yt.A)(this,es,new Set),(0,yt.A)(this,is,null),(0,yt.A)(this,ns,null),(0,yt.A)(this,ss,null),(0,yt.A)(this,rs,null),(0,yt.A)(this,as,null),(0,yt.A)(this,os,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,yt.A)(this,ls,[0,0]),(0,yt.A)(this,cs,null),(0,yt.A)(this,hs,null),(0,yt.A)(this,ds,null),(0,yt.A)(this,us,null),(0,yt.A)(this,ps,null);const f=this._signal=(0,zt.A)(wn,this).signal;(0,Ht.A)(hs,this,t),(0,Ht.A)(ds,this,e),(0,Ht.A)(us,this,i),(0,Ht.A)(En,this,n),(0,Ht.A)(Mn,this,s),(0,Ht.A)(ns,this,r),(0,Ht.A)(as,this,o),this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:f}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),a._on("setpreference",this.onSetPreference.bind(this),{signal:f}),a._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:f}),window.addEventListener("pointerdown",()=>{(0,Ht.A)(Xn,this,!0)},{capture:!0,signal:f}),window.addEventListener("pointerup",()=>{(0,Ht.A)(Xn,this,!1)},{capture:!0,signal:f}),(0,_t.A)(As,this,ys).call(this),(0,_t.A)(As,this,Ms).call(this),(0,_t.A)(As,this,Es).call(this),(0,Ht.A)(Sn,this,o.annotationStorage),(0,Ht.A)(Wn,this,o.filterFactory),(0,Ht.A)(ss,this,l),(0,Ht.A)(zn,this,c||null),(0,Ht.A)(Nn,this,h),(0,Ht.A)(On,this,d),(0,Ht.A)(Bn,this,u),(0,Ht.A)($n,this,p||null),this.viewParameters={realScale:ri.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=A||null,this._supportsPinchToZoom=!1!==g,null===s||void 0===s||s.setSidebarUiManager(this)}destroy(){var t,e,i,n,s,r,a,o,l;null===(t=(0,zt.A)(ps,this))||void 0===t||t.resolve(),(0,Ht.A)(ps,this,null),null===(e=(0,zt.A)(wn,this))||void 0===e||e.abort(),(0,Ht.A)(wn,this,null),this._signal=null;for(const c of(0,zt.A)(xn,this).values())c.destroy();(0,zt.A)(xn,this).clear(),(0,zt.A)(_n,this).clear(),(0,zt.A)(Fn,this).clear(),null===(i=(0,zt.A)(Zn,this))||void 0===i||i.clear(),(0,Ht.A)(bn,this,null),(0,zt.A)(es,this).clear(),(0,zt.A)(Cn,this).destroy(),null===(n=(0,zt.A)(En,this))||void 0===n||n.destroy(),null===(s=(0,zt.A)(Mn,this))||void 0===s||s.destroy(),null===(r=(0,zt.A)(ns,this))||void 0===r||r.destroy(),null===(a=(0,zt.A)(Vn,this))||void 0===a||a.hide(),(0,Ht.A)(Vn,this,null),null===(o=(0,zt.A)(Jn,this))||void 0===o||o.destroy(),(0,Ht.A)(Jn,this,null),(0,Ht.A)(yn,this,null),(0,zt.A)(jn,this)&&(clearTimeout((0,zt.A)(jn,this)),(0,Ht.A)(jn,this,null)),(0,zt.A)(cs,this)&&(clearTimeout((0,zt.A)(cs,this)),(0,Ht.A)(cs,this,null)),null===(l=this._editorUndoBar)||void 0===l||l.destroy(),(0,Ht.A)(as,this,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,zt.A)($n,this)}get useNewAltTextFlow(){return(0,zt.A)(On,this)}get useNewAltTextWhenAddingImage(){return(0,zt.A)(Bn,this)}get hcmFilter(){return Fe(this,"hcmFilter",(0,zt.A)(ss,this)?(0,zt.A)(Wn,this).addHCMFilter((0,zt.A)(ss,this).foreground,(0,zt.A)(ss,this).background):"none")}get direction(){return Fe(this,"direction",getComputedStyle((0,zt.A)(hs,this)).direction)}get _highlightColors(){return Fe(this,"_highlightColors",(0,zt.A)(zn,this)?new Map((0,zt.A)(zn,this).split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return Fe(this,"highlightColors",null);const e=new Map,i=!!(0,zt.A)(ss,this);for(const[n,s]of t){const t=n.endsWith("_HCM");i&&t?e.set(n.replace("_HCM",""),s):i||t||e.set(n,s)}return Fe(this,"highlightColors",e)}get highlightColorNames(){return Fe(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),(0,Ht.A)(Pn,this,t)}setMainHighlightColorPicker(t){(0,Ht.A)(Jn,this,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=(0,zt.A)(En,this))||void 0===e||e.editAltText(this,t,i)}hasCommentManager(){return!!(0,zt.A)(Mn,this)}editComment(t,e,i,n){var s;null===(s=(0,zt.A)(Mn,this))||void 0===s||s.showDialog(this,t,e,i,n)}selectComment(t,e){const i=(0,zt.A)(xn,this).get(t),n=null===i||void 0===i?void 0:i.getEditorByUID(e);null===n||void 0===n||n.toggleComment(!0,!0)}updateComment(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.updateComment(t.getData())}updatePopupColor(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.updatePopupColor(t)}removeComment(t){var e;null===(e=(0,zt.A)(Mn,this))||void 0===e||e.removeComments([t.uid])}toggleComment(t,e){var i;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;null===(i=(0,zt.A)(Mn,this))||void 0===i||i.toggleCommentPopup(t,e,n)}makeCommentColor(t,e){var i;return t&&(null===(i=(0,zt.A)(Mn,this))||void 0===i?void 0:i.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return(null===(t=(0,zt.A)(Mn,this))||void 0===t?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if((0,zt.A)(xn,this).has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),n=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",n),e())};this._eventBus.on("editorsrendered",n),await i}getSignature(t){var e;null===(e=(0,zt.A)(ns,this))||void 0===e||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return(0,zt.A)(ns,this)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;if("enableNewAltTextWhenAddingImage"===e)(0,Ht.A)(Bn,this,i)}onPageChanging(t){let{pageNumber:e}=t;(0,Ht.A)(Dn,this,e-1)}focusMainContainer(){(0,zt.A)(hs,this).focus()}findParent(t,e){for(const i of(0,zt.A)(xn,this).values()){const{x:n,y:s,width:r,height:a}=i.div.getBoundingClientRect();if(t>=n&&t<=n+r&&e>=s&&e<=s+a)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,zt.A)(ds,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,zt.A)(Fn,this).add(t)}removeShouldRescale(t){(0,zt.A)(Fn,this).delete(t)}onScaleChanging(t){var e;let{scale:i}=t;this.commitOrRemove(),this.viewParameters.realScale=i*ri.PDF_TO_CSS_UNITS;for(const n of(0,zt.A)(Fn,this))n.onScaleChanging();null===(e=(0,zt.A)(Pn,this))||void 0===e||e.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a}=i,o=i.toString(),l=(0,_t.A)(As,this,fs).call(this,i).closest(".textLayer"),c=this.getSelectionBoxes(l);if(!c)return;i.empty();const h=(0,_t.A)(As,this,ms).call(this,l),d=(0,zt.A)(ts,this)===re.NONE,u=()=>{const i=null===h||void 0===h?void 0:h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:c,anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a,text:o});d&&this.showAllEditors("highlight",!0,!0),e&&(null===i||void 0===i||i.editComment())};d?this.switchToMode(re.HIGHLIGHT,u):u()}commentSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!(0,zt.A)(Sn,this))return null;const e="".concat(se).concat(t),i=(0,zt.A)(Sn,this).getRawValue(e);return i&&(0,zt.A)(Sn,this).remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!(0,zt.A)(Sn,this)||(0,zt.A)(Sn,this).has(t.id)||(0,zt.A)(Sn,this).setValue(t.id,t)}a11yAlert(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,zt.A)(us,this);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,(0,zt.A)(Hn,this)&&((0,Ht.A)(Hn,this,!1),(0,_t.A)(As,this,bs).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of(0,zt.A)(es,this))if(e.div.contains(t)){(0,Ht.A)(Qn,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,zt.A)(Qn,this))return;const[t,e]=(0,zt.A)(Qn,this);(0,Ht.A)(Qn,this,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){(0,_t.A)(As,this,Es).call(this),(0,_t.A)(As,this,ks).call(this)}removeEditListeners(){(0,_t.A)(As,this,Ss).call(this),(0,_t.A)(As,this,Cs).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of(0,zt.A)(In,this))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of(0,zt.A)(In,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=(0,zt.A)(bn,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const n of(0,zt.A)(es,this)){const t=n.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const t of(0,zt.A)(In,this))if(t.isHandlingMimeForPasting(r.type))return void t.paste(r,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){return void Pe('paste: "'.concat(s.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const r of i){const e=await n.deserialize(r);if(!e)return;t.push(e)}const e=()=>{for(const e of t)(0,_t.A)(As,this,Ls).call(this,e);(0,_t.A)(As,this,Ns).call(this,t)},s=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:s,mustExec:!0})}catch(s){Pe('paste: "'.concat(s.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,zt.A)(ts,this)===re.NONE||this.isEditorHandlingKeyboard||gs._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,zt.A)(Hn,this)&&((0,Ht.A)(Hn,this,!1),(0,_t.A)(As,this,bs).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}setEditingState(t){t?((0,_t.A)(As,this,_s).call(this),(0,_t.A)(As,this,ks).call(this),(0,_t.A)(As,this,Ts).call(this,{isEditing:(0,zt.A)(ts,this)!==re.NONE,isEmpty:(0,_t.A)(As,this,Fs).call(this),hasSomethingToUndo:(0,zt.A)(Cn,this).hasSomethingToUndo(),hasSomethingToRedo:(0,zt.A)(Cn,this).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,_t.A)(As,this,xs).call(this),(0,_t.A)(As,this,Cs).call(this),(0,_t.A)(As,this,Ts).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,zt.A)(In,this)){(0,Ht.A)(In,this,t);for(const t of(0,zt.A)(In,this))(0,_t.A)(As,this,Ps).call(this,t.defaultPropertiesToUpdate)}}getId(){return(0,zt.A)(Gn,this).id}get currentLayer(){return(0,zt.A)(xn,this).get((0,zt.A)(Dn,this))}getLayer(t){return(0,zt.A)(xn,this).get(t)}get currentPageIndex(){return(0,zt.A)(Dn,this)}addLayer(t){(0,zt.A)(xn,this).set(t.pageIndex,t),(0,zt.A)(qn,this)?t.enable():t.disable()}removeLayer(t){(0,zt.A)(xn,this).delete(t.pageIndex)}async updateMode(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if((0,zt.A)(ts,this)!==t&&(!(0,zt.A)(ps,this)||(await(0,zt.A)(ps,this).promise,(0,zt.A)(ps,this)))){var o,l;if((0,Ht.A)(ps,this,Promise.withResolvers()),null===(e=(0,zt.A)(Pn,this))||void 0===e||e.commitOrRemove(),(0,zt.A)(ts,this)===re.POPUP)null===(o=(0,zt.A)(Mn,this))||void 0===o||o.hideSidebar();if(null===(i=(0,zt.A)(Mn,this))||void 0===i||i.destroyPopup(),(0,Ht.A)(ts,this,t),t===re.NONE){var c;this.setEditingState(!1),(0,_t.A)(As,this,Rs).call(this);for(const t of(0,zt.A)(_n,this).values())t.hideStandaloneCommentButton();return null===(c=this._editorUndoBar)||void 0===c||c.hide(),this.toggleComment(null),void(0,zt.A)(ps,this).resolve()}for(const t of(0,zt.A)(_n,this).values())t.addStandaloneCommentButton();if(t===re.SIGNATURE)await(null===(l=(0,zt.A)(ns,this))||void 0===l?void 0:l.loadSignatures());this.setEditingState(!0),await(0,_t.A)(As,this,Ds).call(this),this.unselectAll();for(const e of(0,zt.A)(xn,this).values())e.updateMode(t);if(t===re.POPUP){var h;(0,zt.A)(yn,this)||(0,Ht.A)(yn,this,await(0,zt.A)(as,this).getAnnotationsByType(new Set((0,zt.A)(In,this).map(t=>t._editorType))));const t=new Set,e=[];for(const i of(0,zt.A)(_n,this).values()){const{annotationElementId:n,hasComment:s,deleted:r}=i;n&&t.add(n),s&&!r&&e.push(i.getData())}for(const i of(0,zt.A)(yn,this)){const{id:n,popupRef:s,contentsObj:r}=i;s&&null!==r&&void 0!==r&&r.str&&!t.has(n)&&!(0,zt.A)(Rn,this).has(n)&&e.push(i)}null===(h=(0,zt.A)(Mn,this))||void 0===h||h.showSidebar(e)}if(!n)return s&&this.addNewEditorFromKeyboard(),void(0,zt.A)(ps,this).resolve();for(const t of(0,zt.A)(_n,this).values())t.uid===n?(this.setSelected(t),a?t.editComment():r?t.enterInEditMode():t.focus()):t.unselect();(0,zt.A)(ps,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==(0,zt.A)(ts,this)&&this._eventBus.dispatch("switchannotationeditormode",(0,wt.A)({source:this},t))}updateParams(t,e){if((0,zt.A)(In,this)){switch(t){case ae.CREATE:return void this.currentLayer.addNewEditor(e);case ae.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),((0,zt.A)(rs,this)||(0,Ht.A)(rs,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(const i of(0,zt.A)(es,this))i.updateParams(t,e);else for(const i of(0,zt.A)(In,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,n;for(const s of(0,zt.A)(_n,this).values())s.editorType===t&&s.show(e);(null===(i=null===(n=(0,zt.A)(rs,this))||void 0===n?void 0:n.get(ae.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&(0,_t.A)(As,this,Ps).call(this,[[ae.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,zt.A)(Yn,this)!==t){(0,Ht.A)(Yn,this,t);for(const e of(0,zt.A)(xn,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of(0,zt.A)(_n,this).values())e.pageIndex===t&&(yield e)}getEditor(t){return(0,zt.A)(_n,this).get(t)}addEditor(t){(0,zt.A)(_n,this).set(t.id,t)}removeEditor(t){var e,i;(t.div.contains(document.activeElement)&&((0,zt.A)(jn,this)&&clearTimeout((0,zt.A)(jn,this)),(0,Ht.A)(jn,this,setTimeout(()=>{this.focusMainContainer(),(0,Ht.A)(jn,this,null)},0))),(0,zt.A)(_n,this).delete(t.id),t.annotationElementId)&&(null===(e=(0,zt.A)(Zn,this))||void 0===e||e.delete(t.annotationElementId));(this.unselect(t),t.annotationElementId&&(0,zt.A)(Rn,this).has(t.annotationElementId))||(null===(i=(0,zt.A)(Sn,this))||void 0===i||i.remove(t.id))}addDeletedAnnotationElement(t){(0,zt.A)(Rn,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return(0,zt.A)(Rn,this).has(t)}removeDeletedAnnotationElement(t){(0,zt.A)(Rn,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,zt.A)(bn,this)!==t&&((0,Ht.A)(bn,this,t),t&&(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate))}updateUI(t){xt(As,this,Is)===t&&(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){(0,_t.A)(As,this,Ps).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if((0,zt.A)(es,this).has(t))return(0,zt.A)(es,this).delete(t),t.unselect(),void(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection});(0,zt.A)(es,this).add(t),t.select(),(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),null===(e=(0,zt.A)(Pn,this))||void 0===e||e.commitOrRemove();for(const i of(0,zt.A)(es,this))i!==t&&i.unselect();(0,zt.A)(es,this).clear(),(0,zt.A)(es,this).add(t),t.select(),(0,_t.A)(As,this,Ps).call(this,t.propertiesToUpdate),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,zt.A)(es,this).has(t)}get firstSelectedEditor(){return(0,zt.A)(es,this).values().next().value}unselect(t){t.unselect(),(0,zt.A)(es,this).delete(t),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,zt.A)(es,this).size}get isEnterHandled(){return 1===(0,zt.A)(es,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;(0,zt.A)(Cn,this).undo(),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:(0,zt.A)(Cn,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,_t.A)(As,this,Fs).call(this)}),null===(t=this._editorUndoBar)||void 0===t||t.hide()}redo(){(0,zt.A)(Cn,this).redo(),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,zt.A)(Cn,this).hasSomethingToRedo(),isEmpty:(0,_t.A)(As,this,Fs).call(this)})}addCommands(t){(0,zt.A)(Cn,this).add(t),(0,_t.A)(As,this,Ts).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,_t.A)(As,this,Fs).call(this)})}cleanUndoStack(t){(0,zt.A)(Cn,this).cleanType(t)}delete(){var t;this.commitOrRemove();const e=null===(t=this.currentLayer)||void 0===t?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...(0,zt.A)(es,this)],n=()=>{for(const t of i)(0,_t.A)(As,this,Ls).call(this,t)};this.addCommands({cmd:()=>{var t;null===(t=this._editorUndoBar)||void 0===t||t.show(n,1===i.length?i[0].editorType:i.length);for(const e of i)e.remove()},undo:n,mustExec:!0})}commitOrRemove(){var t;null===(t=(0,zt.A)(bn,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,zt.A)(bn,this)||this.hasSelection}selectAll(){for(const t of(0,zt.A)(es,this))t.commit();(0,_t.A)(As,this,Ns).call(this,(0,zt.A)(_n,this).values())}unselectAll(){var t;if((!(0,zt.A)(bn,this)||((0,zt.A)(bn,this).commitOrRemove(),(0,zt.A)(ts,this)===re.NONE))&&(null===(t=(0,zt.A)(Pn,this))||void 0===t||!t.commitOrRemove())&&this.hasSelection){for(const t of(0,zt.A)(es,this))t.unselect();(0,zt.A)(es,this).clear(),(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;(0,zt.A)(ls,this)[0]+=t,(0,zt.A)(ls,this)[1]+=e;const[i,n]=(0,zt.A)(ls,this),s=[...(0,zt.A)(es,this)];(0,zt.A)(cs,this)&&clearTimeout((0,zt.A)(cs,this)),(0,Ht.A)(cs,this,setTimeout(()=>{(0,Ht.A)(cs,this,null),(0,zt.A)(ls,this)[0]=(0,zt.A)(ls,this)[1]=0,this.addCommands({cmd:()=>{for(const t of s)(0,zt.A)(_n,this).has(t.id)&&(t.translateInPage(i,n),t.translationDone())},undo:()=>{for(const t of s)(0,zt.A)(_n,this).has(t.id)&&(t.translateInPage(-i,-n),t.translationDone())},mustExec:!1})},1e3));for(const r of s)r.translateInPage(t,e),r.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),(0,Ht.A)(Ln,this,new Map);for(const t of(0,zt.A)(es,this))(0,zt.A)(Ln,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!(0,zt.A)(Ln,this))return!1;this.disableUserSelect(!1);const t=(0,zt.A)(Ln,this);(0,Ht.A)(Ln,this,null);let e=!1;for(const[{x:n,y:s,pageIndex:r},a]of t)a.newX=n,a.newY=s,a.newPageIndex=r,e||(e=n!==a.savedX||s!==a.savedY||r!==a.savedPageIndex);if(!e)return!1;const i=(t,e,i,n)=>{if((0,zt.A)(_n,this).has(t.id)){const s=(0,zt.A)(xn,this).get(n);s?t._setParentAndPosition(s,e,i):(t.pageIndex=n,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:n,newY:s,newPageIndex:r}]of t)i(e,n,s,r)},undo:()=>{for(const[e,{savedX:n,savedY:s,savedPageIndex:r}]of t)i(e,n,s,r)},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,zt.A)(Ln,this))for(const i of(0,zt.A)(Ln,this).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===(0,zt.A)(es,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,zt.A)(bn,this)===t}getActive(){return(0,zt.A)(bn,this)}getMode(){return(0,zt.A)(ts,this)}isEditingMode(){return(0,zt.A)(ts,this)!==re.NONE}get imageManager(){return Fe(this,"imageManager",new ln)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,c=e.rangeCount;l<c;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:n,width:s,height:r}=t.getBoundingClientRect();let a;switch(t.getAttribute("data-main-rotation")){case"90":a=(t,e,a,o)=>({x:(e-n)/r,y:1-(t+a-i)/s,width:o/r,height:a/s});break;case"180":a=(t,e,a,o)=>({x:1-(t+a-i)/s,y:1-(e+o-n)/r,width:a/s,height:o/r});break;case"270":a=(t,e,a,o)=>({x:1-(e+o-n)/r,y:(t-i)/s,width:o/r,height:a/s});break;default:a=(t,e,a,o)=>({x:(t-i)/s,y:(e-n)/r,width:a/s,height:o/r})}const o=[];for(let l=0,c=e.rangeCount;l<c;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:n,height:s}of t.getClientRects())0!==n&&0!==s&&o.push(a(e,i,n,s))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;((0,zt.A)(kn,this)||(0,Ht.A)(kn,this,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=(0,zt.A)(kn,this))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=(0,zt.A)(kn,this))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const n=(0,zt.A)(Sn,this).getRawValue(i);n&&((0,zt.A)(ts,this)!==re.NONE||n.hasBeenModified)&&n.renderAnnotationElement(t)}setMissingCanvas(t,e,i){var n;const s=null===(n=(0,zt.A)(Zn,this))||void 0===n?void 0:n.get(t);s&&(s.setCanvas(e,i),(0,zt.A)(Zn,this).delete(t))}addMissingCanvas(t,e){((0,zt.A)(Zn,this)||(0,Ht.A)(Zn,this,new Map)).set(t,e)}}function fs(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function ms(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of(0,zt.A)(xn,this).values())if(i.hasTextLayer(t))return i;return null}function vs(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=(0,_t.A)(As,this,fs).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,zt.A)(Vn,this)||(0,Ht.A)(Vn,this,new Qi(this)),(0,zt.A)(Vn,this).show(e,i,"ltr"===this.direction))}function ws(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if((0,zt.A)(is,this))null===(i=(0,zt.A)(Vn,this))||void 0===i||i.hide(),(0,Ht.A)(is,this,null),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!1});return}const{anchorNode:n}=e;if(n===(0,zt.A)(is,this))return;const s=(0,_t.A)(As,this,fs).call(this,e).closest(".textLayer");var r;if(s){if(null===(t=(0,zt.A)(Vn,this))||void 0===t||t.hide(),(0,Ht.A)(is,this,n),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!0}),((0,zt.A)(ts,this)===re.HIGHLIGHT||(0,zt.A)(ts,this)===re.NONE)&&((0,zt.A)(ts,this)===re.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,Ht.A)(Hn,this,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=(0,zt.A)(ts,this)===re.HIGHLIGHT?(0,_t.A)(As,this,ms).call(this,s):null;if(null===t||void 0===t||t.toggleDrawing(),(0,zt.A)(Xn,this)){const e=new AbortController,i=this.combinedSignal(e),n=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),null===t||void 0===t||t.toggleDrawing(!0),"pointerup"===i.type&&(0,_t.A)(As,this,bs).call(this,"main_toolbar"))};window.addEventListener("pointerup",n,{signal:i}),window.addEventListener("blur",n,{signal:i})}else null===t||void 0===t||t.toggleDrawing(!0),(0,_t.A)(As,this,bs).call(this,"main_toolbar")}}else(0,zt.A)(is,this)&&(null===(r=(0,zt.A)(Vn,this))||void 0===r||r.hide(),(0,Ht.A)(is,this,null),(0,_t.A)(As,this,Ts).call(this,{hasSelectedText:!1}))}function bs(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,zt.A)(ts,this)===re.HIGHLIGHT?this.highlightSelection(t):(0,zt.A)(Nn,this)&&(0,_t.A)(As,this,vs).call(this)}function ys(){document.addEventListener("selectionchange",(0,_t.A)(As,this,ws).bind(this),{signal:this._signal})}function _s(){if((0,zt.A)(Un,this))return;(0,Ht.A)(Un,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Un,this));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function xs(){var t;null===(t=(0,zt.A)(Un,this))||void 0===t||t.abort(),(0,Ht.A)(Un,this,null)}function Es(){if((0,zt.A)(Kn,this))return;(0,Ht.A)(Kn,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Kn,this));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function Ss(){var t;null===(t=(0,zt.A)(Kn,this))||void 0===t||t.abort(),(0,Ht.A)(Kn,this,null)}function ks(){if((0,zt.A)(Tn,this))return;(0,Ht.A)(Tn,this,new AbortController);const t=this.combinedSignal((0,zt.A)(Tn,this));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function Cs(){var t;null===(t=(0,zt.A)(Tn,this))||void 0===t||t.abort(),(0,Ht.A)(Tn,this,null)}function Ms(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function Ts(t){Object.entries(t).some(t=>{let[e,i]=t;return(0,zt.A)(os,this)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,zt.A)(os,this),t)}),(0,zt.A)(ts,this)===re.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,_t.A)(As,this,Ps).call(this,[[ae.HIGHLIGHT_FREE,!0]]))}function Ps(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function Ds(){if(!(0,zt.A)(qn,this)){(0,Ht.A)(qn,this,!0);const t=[];for(const e of(0,zt.A)(xn,this).values())t.push(e.enable());await Promise.all(t);for(const e of(0,zt.A)(_n,this).values())e.enable()}}function Rs(){if(this.unselectAll(),(0,zt.A)(qn,this)){(0,Ht.A)(qn,this,!1);for(const t of(0,zt.A)(xn,this).values())t.disable();for(const t of(0,zt.A)(_n,this).values())t.disable()}}function Ls(t){const e=(0,zt.A)(xn,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function Is(t){let e=null;for(e of(0,zt.A)(es,t));return e}function Fs(){if(0===(0,zt.A)(_n,this).size)return!0;if(1===(0,zt.A)(_n,this).size)for(const t of(0,zt.A)(_n,this).values())return t.isEmpty();return!1}function Ns(t){for(const e of(0,zt.A)(es,this))e.unselect();(0,zt.A)(es,this).clear();for(const e of t)e.isEmpty()||((0,zt.A)(es,this).add(e),e.select());(0,_t.A)(As,this,Ts).call(this,{hasSelectedEditor:this.hasSelection})}(0,Vt.A)(gs,"TRANSLATE_SMALL",1),(0,Vt.A)(gs,"TRANSLATE_BIG",10);var Os=new WeakMap,Bs=new WeakMap,Ws=new WeakMap,js=new WeakMap,Us=new WeakMap,zs=new WeakMap,Hs=new WeakMap,Vs=new WeakMap,Gs=new WeakMap,qs=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,Ks=new WeakSet;class Qs{constructor(t){(0,bt.A)(this,Ks),(0,yt.A)(this,Os,null),(0,yt.A)(this,Bs,!1),(0,yt.A)(this,Ws,null),(0,yt.A)(this,js,null),(0,yt.A)(this,Us,null),(0,yt.A)(this,zs,null),(0,yt.A)(this,Hs,!1),(0,yt.A)(this,Vs,null),(0,yt.A)(this,Gs,null),(0,yt.A)(this,qs,null),(0,yt.A)(this,Xs,null),(0,yt.A)(this,Ys,!1),(0,Ht.A)(Gs,this,t),(0,Ht.A)(Ys,this,t._uiManager.useNewAltTextFlow),$s._||($s._=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){var e;null!==(e=Qs._l10n)&&void 0!==e||(Qs._l10n=t)}async render(){const t=(0,Ht.A)(Ws,this,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=(0,Ht.A)(js,this,document.createElement("span"));t.append(e),(0,zt.A)(Ys,this)?(t.classList.add("new"),t.setAttribute("data-l10n-id",$s._.missing),e.setAttribute("data-l10n-id",$s._["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=(0,zt.A)(Gs,this)._uiManager._signal;t.addEventListener("contextmenu",pi,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=t=>{t.preventDefault(),(0,zt.A)(Gs,this)._uiManager.editAltText((0,zt.A)(Gs,this)),(0,zt.A)(Ys,this)&&(0,zt.A)(Gs,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:xt(Ks,this,Js)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,Ht.A)(Hs,this,!0),n(e))},{signal:i}),await(0,_t.A)(Ks,this,Zs).call(this),t}finish(){(0,zt.A)(Ws,this)&&((0,zt.A)(Ws,this).focus({focusVisible:(0,zt.A)(Hs,this)}),(0,Ht.A)(Hs,this,!1))}isEmpty(){return(0,zt.A)(Ys,this)?null===(0,zt.A)(Os,this):!(0,zt.A)(Os,this)&&!(0,zt.A)(Bs,this)}hasData(){return(0,zt.A)(Ys,this)?null!==(0,zt.A)(Os,this)||!!(0,zt.A)(qs,this):this.isEmpty()}get guessedText(){return(0,zt.A)(qs,this)}async setGuessedText(t){null===(0,zt.A)(Os,this)&&((0,Ht.A)(qs,this,t),(0,Ht.A)(Xs,this,await Qs._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,_t.A)(Ks,this,Zs).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e;if(!(0,zt.A)(Ys,this)||(0,zt.A)(Os,this))return null===(e=(0,zt.A)(Vs,this))||void 0===e||e.remove(),void(0,Ht.A)(Vs,this,null);if(!(0,zt.A)(Vs,this)){const t=(0,Ht.A)(Vs,this,document.createElement("div"));t.className="noAltTextBadge",(0,zt.A)(Gs,this).div.append(t)}(0,zt.A)(Vs,this).classList.toggle("hidden",!t)}serialize(t){let e=(0,zt.A)(Os,this);return t||(0,zt.A)(qs,this)!==e||(e=(0,zt.A)(Xs,this)),{altText:e,decorative:(0,zt.A)(Bs,this),guessedText:(0,zt.A)(qs,this),textWithDisclaimer:(0,zt.A)(Xs,this)}}get data(){return{altText:(0,zt.A)(Os,this),decorative:(0,zt.A)(Bs,this)}}set data(t){let{altText:e,decorative:i,guessedText:n,textWithDisclaimer:s,cancel:r=!1}=t;n&&((0,Ht.A)(qs,this,n),(0,Ht.A)(Xs,this,s)),(0,zt.A)(Os,this)===e&&(0,zt.A)(Bs,this)===i||(r||((0,Ht.A)(Os,this,e),(0,Ht.A)(Bs,this,i)),(0,_t.A)(Ks,this,Zs).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,zt.A)(Ws,this)&&(!t&&(0,zt.A)(zs,this)&&(clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)),(0,zt.A)(Ws,this).disabled=!t)}shown(){(0,zt.A)(Gs,this)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:xt(Ks,this,Js)}})}destroy(){var t,e;null===(t=(0,zt.A)(Ws,this))||void 0===t||t.remove(),(0,Ht.A)(Ws,this,null),(0,Ht.A)(js,this,null),(0,Ht.A)(Us,this,null),null===(e=(0,zt.A)(Vs,this))||void 0===e||e.remove(),(0,Ht.A)(Vs,this,null)}}function Js(t){return((0,zt.A)(Os,t)?"added":null===(0,zt.A)(Os,t)&&t.guessedText&&"review")||"missing"}async function Zs(){const t=(0,zt.A)(Ws,this);if(!t)return;if((0,zt.A)(Ys,this)){var e,i;if(t.classList.toggle("done",!!(0,zt.A)(Os,this)),t.setAttribute("data-l10n-id",$s._[xt(Ks,this,Js)]),null===(e=(0,zt.A)(js,this))||void 0===e||e.setAttribute("data-l10n-id",$s._["".concat(xt(Ks,this,Js),"-label")]),!(0,zt.A)(Os,this))return void(null===(i=(0,zt.A)(Us,this))||void 0===i||i.remove())}else{var n;if(!(0,zt.A)(Os,this)&&!(0,zt.A)(Bs,this))return t.classList.remove("done"),void(null===(n=(0,zt.A)(Us,this))||void 0===n||n.remove());t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let s=(0,zt.A)(Us,this);if(!s){(0,Ht.A)(Us,this,s=document.createElement("span")),s.className="tooltip",s.setAttribute("role","tooltip"),s.id="alt-text-tooltip-".concat((0,zt.A)(Gs,this).id);const e=100,i=(0,zt.A)(Gs,this)._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)},{once:!0}),t.addEventListener("mouseenter",()=>{(0,Ht.A)(zs,this,setTimeout(()=>{(0,Ht.A)(zs,this,null),(0,zt.A)(Us,this).classList.add("show"),(0,zt.A)(Gs,this)._reportTelemetry({action:"alt_text_tooltip"})},e))},{signal:i}),t.addEventListener("mouseleave",()=>{var t;(0,zt.A)(zs,this)&&(clearTimeout((0,zt.A)(zs,this)),(0,Ht.A)(zs,this,null)),null===(t=(0,zt.A)(Us,this))||void 0===t||t.classList.remove("show")},{signal:i})}(0,zt.A)(Bs,this)?s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(s.removeAttribute("data-l10n-id"),s.textContent=(0,zt.A)(Os,this)),s.parentNode||t.append(s);const r=(0,zt.A)(Gs,this).getElementForAltText();null===r||void 0===r||r.setAttribute("aria-describedby",s.id)}var $s={_:null};(0,Vt.A)(Qs,"_l10n",null);var tr=new WeakMap,er=new WeakMap,ir=new WeakMap,nr=new WeakMap,sr=new WeakMap,rr=new WeakMap,ar=new WeakMap,or=new WeakMap,lr=new WeakMap,cr=new WeakMap,hr=new WeakSet;class dr{constructor(t){(0,bt.A)(this,hr),(0,yt.A)(this,tr,null),(0,yt.A)(this,er,null),(0,yt.A)(this,ir,!1),(0,yt.A)(this,nr,null),(0,yt.A)(this,sr,null),(0,yt.A)(this,rr,null),(0,yt.A)(this,ar,null),(0,yt.A)(this,or,null),(0,yt.A)(this,lr,!1),(0,yt.A)(this,cr,null),(0,Ht.A)(nr,this,t)}renderForToolbar(){const t=(0,Ht.A)(er,this,document.createElement("button"));return t.className="comment",(0,_t.A)(hr,this,ur).call(this,t,!1)}renderForStandalone(){const t=(0,Ht.A)(tr,this,document.createElement("button"));t.className="annotationCommentButton";const e=(0,zt.A)(nr,this).commentButtonPosition;if(e){const{style:i}=t;i.insetInlineEnd="calc(".concat(100*("ltr"===(0,zt.A)(nr,this)._uiManager.direction?1-e[0]:e[0]),"% - var(--comment-button-dim))"),i.top="calc(".concat(100*e[1],"% - var(--comment-button-dim))");const n=(0,zt.A)(nr,this).commentButtonColor;n&&(i.backgroundColor=n)}return(0,_t.A)(hr,this,ur).call(this,t,!0)}focusButton(){setTimeout(()=>{var t,e;null===(t=null!==(e=(0,zt.A)(tr,this))&&void 0!==e?e:(0,zt.A)(er,this))||void 0===t||t.focus()},0)}onUpdatedColor(){if(!(0,zt.A)(tr,this))return;const t=(0,zt.A)(nr,this).commentButtonColor;t&&((0,zt.A)(tr,this).style.backgroundColor=t),(0,zt.A)(nr,this)._uiManager.updatePopupColor((0,zt.A)(nr,this))}get commentButtonWidth(){var t,e;return(null!==(t=null===(e=(0,zt.A)(tr,this))||void 0===e?void 0:e.getBoundingClientRect().width)&&void 0!==t?t:0)/(0,zt.A)(nr,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if((0,zt.A)(cr,this))return(0,zt.A)(cr,this);if(!(0,zt.A)(tr,this))return null;const{x:t,y:e,height:i}=(0,zt.A)(tr,this).getBoundingClientRect(),{x:n,y:s,width:r,height:a}=(0,zt.A)(nr,this).parent.boundingClientRect;return[(t-n)/r,(e+i-s)/a]}set commentPopupPositionInLayer(t){(0,Ht.A)(cr,this,t)}hasDefaultPopupPosition(){return null===(0,zt.A)(cr,this)}removeStandaloneCommentButton(){var t;null===(t=(0,zt.A)(tr,this))||void 0===t||t.remove(),(0,Ht.A)(tr,this,null)}removeToolbarCommentButton(){var t;null===(t=(0,zt.A)(er,this))||void 0===t||t.remove(),(0,Ht.A)(er,this,null)}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;(0,zt.A)(tr,this)&&((0,zt.A)(tr,this).classList.toggle("selected",e),(0,zt.A)(tr,this).ariaExpanded=i)}edit(t){const e=this.commentPopupPositionInLayer;let i,n;if(e)[i,n]=e;else{[i,n]=(0,zt.A)(nr,this).commentButtonPosition;const{width:t,height:e,x:s,y:r}=(0,zt.A)(nr,this);i=s+i*t,n=r+n*e}const s=(0,zt.A)(nr,this).parent.boundingClientRect,{x:r,y:a,width:o,height:l}=s;(0,zt.A)(nr,this)._uiManager.editComment((0,zt.A)(nr,this),r+i*o,a+n*l,(0,wt.A)((0,wt.A)({},t),{},{parentDimensions:s}))}finish(){(0,zt.A)(er,this)&&((0,zt.A)(er,this).focus({focusVisible:(0,zt.A)(ir,this)}),(0,Ht.A)(ir,this,!1))}isDeleted(){return(0,zt.A)(lr,this)||""===(0,zt.A)(ar,this)}isEmpty(){return null===(0,zt.A)(ar,this)}hasBeenEdited(){return this.isDeleted()||(0,zt.A)(ar,this)!==(0,zt.A)(sr,this)}serialize(){return this.data}get data(){return{text:(0,zt.A)(ar,this),richText:(0,zt.A)(rr,this),date:(0,zt.A)(or,this),deleted:this.isDeleted()}}set data(t){if(t!==(0,zt.A)(ar,this)&&(0,Ht.A)(rr,this,null),null===t)return(0,Ht.A)(ar,this,""),void(0,Ht.A)(lr,this,!0);(0,Ht.A)(ar,this,t),(0,Ht.A)(or,this,new Date),(0,Ht.A)(lr,this,!1)}setInitialText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,Ht.A)(sr,this,t),this.data=t,(0,Ht.A)(or,this,null),(0,Ht.A)(rr,this,e)}shown(){}destroy(){var t,e;null===(t=(0,zt.A)(er,this))||void 0===t||t.remove(),(0,Ht.A)(er,this,null),null===(e=(0,zt.A)(tr,this))||void 0===e||e.remove(),(0,Ht.A)(tr,this,null),(0,Ht.A)(ar,this,""),(0,Ht.A)(rr,this,null),(0,Ht.A)(or,this,null),(0,Ht.A)(nr,this,null),(0,Ht.A)(ir,this,!1),(0,Ht.A)(lr,this,!1)}}function ur(t,e){if(!(0,zt.A)(nr,this)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[(0,zt.A)(nr,this)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const i=(0,zt.A)(nr,this)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",pi,{signal:i}),e&&(t.addEventListener("focusin",t=>{(0,zt.A)(nr,this)._focusEventsAllowed=!1,Ai(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{(0,zt.A)(nr,this)._focusEventsAllowed=!0,Ai(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const n=e=>{e.preventDefault(),t===(0,zt.A)(er,this)?this.edit():(0,zt.A)(nr,this).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,Ht.A)(ir,this,!0),n(e))},{signal:i}),t.addEventListener("pointerenter",()=>{(0,zt.A)(nr,this).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{(0,zt.A)(nr,this).toggleComment(!1,!1)},{signal:i}),t}var pr=new WeakMap,Ar=new WeakMap,gr=new WeakMap,fr=new WeakMap,mr=new WeakMap,vr=new WeakMap,wr=new WeakMap,br=new WeakMap,yr=new WeakMap,_r=new WeakMap,xr=new WeakMap,Er=new WeakMap,Sr=new WeakSet;class kr{constructor(t){let{container:e,isPinchingDisabled:i=null,isPinchingStopped:n=null,onPinchStart:s=null,onPinching:r=null,onPinchEnd:a=null,signal:o}=t;(0,bt.A)(this,Sr),(0,yt.A)(this,pr,void 0),(0,yt.A)(this,Ar,!1),(0,yt.A)(this,gr,null),(0,yt.A)(this,fr,void 0),(0,yt.A)(this,mr,void 0),(0,yt.A)(this,vr,void 0),(0,yt.A)(this,wr,void 0),(0,yt.A)(this,br,null),(0,yt.A)(this,yr,void 0),(0,yt.A)(this,_r,null),(0,yt.A)(this,xr,void 0),(0,yt.A)(this,Er,null),(0,Ht.A)(pr,this,e),(0,Ht.A)(gr,this,n),(0,Ht.A)(fr,this,i),(0,Ht.A)(mr,this,s),(0,Ht.A)(vr,this,r),(0,Ht.A)(wr,this,a),(0,Ht.A)(xr,this,new AbortController),(0,Ht.A)(yr,this,AbortSignal.any([o,(0,zt.A)(xr,this).signal])),e.addEventListener("touchstart",(0,_t.A)(Sr,this,Cr).bind(this),{passive:!1,signal:(0,zt.A)(yr,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/yi.pixelRatio}destroy(){var t,e;null===(t=(0,zt.A)(xr,this))||void 0===t||t.abort(),(0,Ht.A)(xr,this,null),null===(e=(0,zt.A)(br,this))||void 0===e||e.abort(),(0,Ht.A)(br,this,null)}}function Cr(t){var e,i;if(null!==(e=(0,zt.A)(fr,this))&&void 0!==e&&e.call(this))return;if(1===t.touches.length){if((0,zt.A)(br,this))return;const t=(0,Ht.A)(br,this,new AbortController),e=AbortSignal.any([(0,zt.A)(yr,this),t.signal]),i=(0,zt.A)(pr,this),n={capture:!0,signal:e,passive:!1},s=t=>{var e;"touch"===t.pointerType&&(null===(e=(0,zt.A)(br,this))||void 0===e||e.abort(),(0,Ht.A)(br,this,null))};return i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(Ai(t),s(t))},n),i.addEventListener("pointerup",s,n),void i.addEventListener("pointercancel",s,n)}if(!(0,zt.A)(Er,this)){var n;(0,Ht.A)(Er,this,new AbortController);const t=AbortSignal.any([(0,zt.A)(yr,this),(0,zt.A)(Er,this).signal]),e=(0,zt.A)(pr,this),i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",(0,_t.A)(Sr,this,Mr).bind(this),i);const s=(0,_t.A)(Sr,this,Tr).bind(this);e.addEventListener("touchend",s,i),e.addEventListener("touchcancel",s,i),i.capture=!0,e.addEventListener("pointerdown",Ai,i),e.addEventListener("pointermove",Ai,i),e.addEventListener("pointercancel",Ai,i),e.addEventListener("pointerup",Ai,i),null===(n=(0,zt.A)(mr,this))||void 0===n||n.call(this)}if(Ai(t),2!==t.touches.length||null!==(i=(0,zt.A)(gr,this))&&void 0!==i&&i.call(this))return void(0,Ht.A)(_r,this,null);let[s,r]=t.touches;s.identifier>r.identifier&&([s,r]=[r,s]),(0,Ht.A)(_r,this,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:r.screenX,touch1Y:r.screenY})}function Mr(t){var e;if(!(0,zt.A)(_r,this)||2!==t.touches.length)return;Ai(t);let[i,n]=t.touches;i.identifier>n.identifier&&([i,n]=[n,i]);const{screenX:s,screenY:r}=i,{screenX:a,screenY:o}=n,l=(0,zt.A)(_r,this),{touch0X:c,touch0Y:h,touch1X:d,touch1Y:u}=l,p=d-c,A=u-h,g=a-s,f=o-r,m=Math.hypot(g,f)||1,v=Math.hypot(p,A)||1;if(!(0,zt.A)(Ar,this)&&Math.abs(v-m)<=Ct.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=s,l.touch0Y=r,l.touch1X=a,l.touch1Y=o,!(0,zt.A)(Ar,this))return void(0,Ht.A)(Ar,this,!0);const w=[(s+a)/2,(r+o)/2];null===(e=(0,zt.A)(vr,this))||void 0===e||e.call(this,w,v,m)}function Tr(t){if(!(t.touches.length>=2)){var e;if((0,zt.A)(Er,this))(0,zt.A)(Er,this).abort(),(0,Ht.A)(Er,this,null),null===(e=(0,zt.A)(wr,this))||void 0===e||e.call(this);(0,zt.A)(_r,this)&&(Ai(t),(0,Ht.A)(_r,this,null),(0,Ht.A)(Ar,this,!1))}}Ct=kr;var Pr=new WeakMap,Dr=new WeakMap,Rr=new WeakMap,Lr=new WeakMap,Ir=new WeakMap,Fr=new WeakMap,Nr=new WeakMap,Or=new WeakMap,Br=new WeakMap,Wr=new WeakMap,jr=new WeakMap,Ur=new WeakMap,zr=new WeakMap,Hr=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,qr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,$r=new WeakMap,ta=new WeakMap,ea=new WeakMap,ia=new WeakSet;class na{static get _resizerKeyboardManager(){const t=na.prototype._resizeWithKeyboard,e=gs.TRANSLATE_SMALL,i=gs.TRANSLATE_BIG;return Fe(this,"_resizerKeyboardManager",new fn([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],na.prototype._stopResizingWithKeyboard]]))}constructor(t){(0,bt.A)(this,ia),(0,yt.A)(this,Pr,null),(0,yt.A)(this,Dr,null),(0,yt.A)(this,Rr,null),(0,yt.A)(this,Lr,null),(0,yt.A)(this,Ir,null),(0,yt.A)(this,Fr,!1),(0,yt.A)(this,Nr,null),(0,yt.A)(this,Or,""),(0,yt.A)(this,Br,null),(0,yt.A)(this,Wr,null),(0,yt.A)(this,jr,null),(0,yt.A)(this,Ur,null),(0,yt.A)(this,zr,null),(0,yt.A)(this,Hr,""),(0,yt.A)(this,Vr,!1),(0,yt.A)(this,Gr,null),(0,yt.A)(this,qr,!1),(0,yt.A)(this,Xr,!1),(0,yt.A)(this,Yr,!1),(0,yt.A)(this,Kr,null),(0,yt.A)(this,Qr,0),(0,yt.A)(this,Jr,0),(0,yt.A)(this,Zr,null),(0,yt.A)(this,$r,null),(0,Vt.A)(this,"isSelected",!1),(0,Vt.A)(this,"_isCopy",!1),(0,Vt.A)(this,"_editToolbar",null),(0,Vt.A)(this,"_initialOptions",Object.create(null)),(0,Vt.A)(this,"_initialData",null),(0,Vt.A)(this,"_isVisible",!0),(0,Vt.A)(this,"_uiManager",null),(0,Vt.A)(this,"_focusEventsAllowed",!0),(0,yt.A)(this,ta,!1),(0,yt.A)(this,ea,na._zIndex++),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,r];const[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Fe(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new xa({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){var i;if(null!==(i=na._l10n)&&void 0!==i||(na._l10n=t),na._l10nResizer||(na._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==na._borderLineWidth)return;const n=getComputedStyle(document.documentElement);na._borderLineWidth=parseFloat(n.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){De("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,zt.A)(ta,this)}set _isDraggable(t){var e;(0,Ht.A)(ta,this,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,zt.A)(ea,this)}setParent(t){var e;null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):((0,_t.A)(ia,this,_a).call(this),null===(e=(0,zt.A)(Ur,this))||void 0===e||e.remove(),(0,Ht.A)(Ur,this,null));this.parent=t}focusin(t){this._focusEventsAllowed&&((0,zt.A)(Vr,this)?(0,Ht.A)(Vr,this,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/r,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),this._onTranslated()}translate(t,e){(0,_t.A)(ia,this,sa).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]),(0,_t.A)(ia,this,sa).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[n,s]}=this;if(this.x+=t/n,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:a}=this;const[o,l]=this.getBaseTranslation();r+=o,a+=l;const{style:c}=i;c.left="".concat((100*r).toFixed(2),"%"),c.top="".concat((100*a).toFixed(2),"%"),this._onTranslating(r,a),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!(0,zt.A)(Gr,this)&&((0,zt.A)(Gr,this)[0]!==this.x||(0,zt.A)(Gr,this)[1]!==this.y)}get _hasBeenResized(){return!!(0,zt.A)(Gr,this)&&((0,zt.A)(Gr,this)[2]!==this.width||(0,zt.A)(Gr,this)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=na,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const{div:{style:e},pageDimensions:[i,n]}=this;let{x:s,y:r,width:a,height:o}=this;if(a*=i,o*=n,s*=i,r*=n,this._mustFixPosition)switch(t){case 0:s=ti(s,0,i-a),r=ti(r,0,n-o);break;case 90:s=ti(s,0,i-o),r=ti(r,a,n);break;case 180:s=ti(s,a,i),r=ti(r,o,n);break;case 270:s=ti(s,o,i),r=ti(r,0,n-a)}this.x=s/=i,this.y=r/=n;const[l,c]=this.getBaseTranslation();s+=l,r+=c,e.left="".concat((100*s).toFixed(2),"%"),e.top="".concat((100*r).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return ra.call(na,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return ra.call(na,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width="".concat((100*e).toFixed(2),"%"),t.height="".concat((100*i).toFixed(2),"%")}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null===(t=(0,zt.A)(Rr,this))||void 0===t||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||(0,zt.A)(Xr,this))return this._editToolbar;this._editToolbar=new Wi(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var t;null===(t=this._editToolbar)||void 0===t||t.removeButton("comment")}removeEditToolbar(){var t,e;null===(t=this._editToolbar)||void 0===t||t.remove(),this._editToolbar=null,null===(e=(0,zt.A)(Rr,this))||void 0===e||e.destroy()}addContainer(t){var e;const i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return(0,zt.A)(Rr,this)||(Qs.initialize(na._l10n),(0,Ht.A)(Rr,this,new Qs(this)),(0,zt.A)(Pr,this)&&((0,zt.A)(Rr,this).data=(0,zt.A)(Pr,this),(0,Ht.A)(Pr,this,null))),(0,zt.A)(Rr,this)}get altTextData(){var t;return null===(t=(0,zt.A)(Rr,this))||void 0===t?void 0:t.data}set altTextData(t){(0,zt.A)(Rr,this)&&((0,zt.A)(Rr,this).data=t)}get guessedAltText(){var t;return null===(t=(0,zt.A)(Rr,this))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!(0,zt.A)(Rr,this)&&!(0,zt.A)(Rr,this).isEmpty()}hasAltTextData(){var t,e;return null!==(t=null===(e=(0,zt.A)(Rr,this))||void 0===e?void 0:e.hasData())&&void 0!==t&&t}focusCommentButton(){var t;null===(t=(0,zt.A)(Lr,this))||void 0===t||t.focusButton()}addCommentButton(){return(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this))}addStandaloneCommentButton(){(0,zt.A)(Ir,this)?this._uiManager.isEditingMode()&&(0,zt.A)(Ir,this).classList.remove("hidden"):this.hasComment&&((0,Ht.A)(Ir,this,(0,zt.A)(Lr,this).renderForStandalone()),this.div.append((0,zt.A)(Ir,this)))}removeStandaloneCommentButton(){(0,zt.A)(Lr,this).removeStandaloneCommentButton(),(0,Ht.A)(Ir,this,null)}hideStandaloneCommentButton(){var t;null===(t=(0,zt.A)(Ir,this))||void 0===t||t.classList.add("hidden")}get comment(){var t;const{data:{richText:e,text:i,date:n,deleted:s}}=(0,zt.A)(Lr,this);return{text:i,richText:e,date:n,deleted:s,color:this.getNonHCMColor(),opacity:null!==(t=this.opacity)&&void 0!==t?t:1}}set comment(t){(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData(t){let{comment:e,popupRef:i,richText:n}=t;if(!i)return;if((0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).setInitialText(e,n),!this.annotationElementId)return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var t;return null===(t=(0,zt.A)(Lr,this))||void 0===t?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return null===(t=(0,zt.A)(Lr,this))||void 0===t?void 0:t.isDeleted()}get hasComment(){return!!(0,zt.A)(Lr,this)&&!(0,zt.A)(Lr,this).isEmpty()&&!(0,zt.A)(Lr,this).isDeleted()}async editComment(t){(0,zt.A)(Lr,this)||(0,Ht.A)(Lr,this,new dr(this)),(0,zt.A)(Lr,this).edit(t)}toggleComment(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){(0,zt.A)(Lr,this).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const e=180,i=100,[,,,n]=t.rect,[s]=this.pageDimensions,[r]=this.pageTranslation,a=r+s+1,o=n-i,l=a+e;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[a,o,l,n]}}}updateFromAnnotationLayer(t){let{popup:{contents:e,deleted:i}}=t;(0,zt.A)(Lr,this).data=i?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var t;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=(0,zt.A)(Fr,this)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),(0,_t.A)(ia,this,ma).call(this);const[i,n]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth="".concat((100*n/i).toFixed(2),"%"),e.style.maxHeight="".concat((100*i/n).toFixed(2),"%"));const[s,r]=this.getInitialTranslation();return this.translate(s,r),tn(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&((0,zt.A)($r,this)||(0,Ht.A)($r,this,new kr({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:(0,_t.A)(ia,this,ua).bind(this),onPinching:(0,_t.A)(ia,this,pa).bind(this),onPinchEnd:(0,_t.A)(ia,this,Aa).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),null===(t=this._uiManager._editorUndoBar)||void 0===t||t.hide(),e}pointerdown(t){const{isMac:e}=Ge.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():((0,Ht.A)(Vr,this,!0),this._isDraggable?(0,_t.A)(ia,this,fa).call(this,t):(0,_t.A)(ia,this,ga).call(this,t))}_onStartDragging(){}_onStopDragging(){}moveInDOM(){(0,zt.A)(Kr,this)&&clearTimeout((0,zt.A)(Kr,this)),(0,Ht.A)(Kr,this,setTimeout(()=>{var t;(0,Ht.A)(Kr,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const n=this.parentScale,[s,r]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/n,c=e/n,h=this.x*s,d=this.y*r,u=this.width*s,p=this.height*r;switch(i){case 0:return[h+l+a,r-d-c-p+o,h+l+u+a,r-d-c+o];case 90:return[h+c+a,r-d+l+o,h+c+p+a,r-d+l+u+o];case 180:return[h-l-u+a,r-d+c+o,h-l+a,r-d+c+p+o];case 270:return[h-c-p+a,r-d-l-u+o,h-c+a,r-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,s,r]=t,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,e-r,a,o];case 90:return[i,e-n,o,a];case 180:return[s,e-n,a,o];case 270:return[s,e-r,o,a];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&na._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;null===(t=(0,zt.A)(Lr,this))||void 0===t||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:n,deleted:s,richText:r},uid:a,pageIndex:o,creationDate:l,modificationDate:c}=this;return{id:a,pageIndex:o,rect:this.getPDFRect(),richText:r,contentsObj:{str:t},creationDate:l,modificationDate:i||c,popupRef:!s,color:e,opacity:n}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),(0,Ht.A)(Xr,this,!0),!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),(0,Ht.A)(Xr,this,!1),!0)}isInEditMode(){return(0,zt.A)(Xr,this)}shouldGetKeyboardEvents(){return(0,zt.A)(Yr,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:r}=window;return e<r&&n>0&&t<s&&i>0}rebuild(){(0,_t.A)(ia,this,ma).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){var t;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}static async deserialize(t,e,i){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});n.rotation=t.rotation,(0,Ht.A)(Pr,n,t.accessibilityData),n._isCopy=t.isCopy||!1;const[s,r]=n.pageDimensions,[a,o,l,c]=n.getRectInCurrentCoords(t.rect,r);return n.x=a/s,n.y=o/r,n.width=l/s,n.height=c/r,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t,e;if(null===(t=(0,zt.A)(zr,this))||void 0===t||t.abort(),(0,Ht.A)(zr,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,zt.A)(Kr,this)&&(clearTimeout((0,zt.A)(Kr,this)),(0,Ht.A)(Kr,this,null)),(0,_t.A)(ia,this,_a).call(this),this.removeEditToolbar(),(0,zt.A)(Zr,this)){for(const t of(0,zt.A)(Zr,this).values())clearTimeout(t);(0,Ht.A)(Zr,this,null)}this.parent=null,null===(e=(0,zt.A)($r,this))||void 0===e||e.destroy(),(0,Ht.A)($r,this,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,_t.A)(ia,this,oa).call(this),(0,zt.A)(Br,this).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[i,n,s,r]=this.getPDFRect();return[na._round(i+(s-i)*t),na._round(n+(r-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return(0,zt.A)(Lr,this).commentPopupPositionInLayer}set commentPopupPosition(t){(0,zt.A)(Lr,this).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return(0,zt.A)(Lr,this).hasDefaultPopupPosition()}get commentButtonWidth(){return(0,zt.A)(Lr,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){(0,zt.A)(Lr,this).setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=(0,zt.A)(Br,this).children;if(!(0,zt.A)(Dr,this)){(0,Ht.A)(Dr,this,Array.from(e));const t=(0,_t.A)(ia,this,va).bind(this),i=(0,_t.A)(ia,this,wa).bind(this),n=this._uiManager._signal;for(const e of(0,zt.A)(Dr,this)){const s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:n}),e.addEventListener("blur",i,{signal:n}),e.addEventListener("focus",(0,_t.A)(ia,this,ba).bind(this,s),{signal:n}),e.setAttribute("data-l10n-id",na._l10nResizer[s])}}const i=(0,zt.A)(Dr,this)[0];let n=0;for(const r of e){if(r===i)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*((0,zt.A)(Dr,this).length/4);if(s!==n){if(s<n)for(let e=0;e<n-s;e++)(0,zt.A)(Br,this).append((0,zt.A)(Br,this).firstChild);else if(s>n)for(let e=0;e<s-n;e++)(0,zt.A)(Br,this).firstChild.before((0,zt.A)(Br,this).lastChild);let t=0;for(const i of e){const e=(0,zt.A)(Dr,this)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",na._l10nResizer[e])}}(0,_t.A)(ia,this,ya).call(this,0),(0,Ht.A)(Yr,this,!0),(0,zt.A)(Br,this).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,zt.A)(Yr,this)&&(0,_t.A)(ia,this,da).call(this,(0,zt.A)(Hr,this),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){(0,_t.A)(ia,this,_a).call(this),this.div.focus()}select(){var t,e,i;this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),this._editToolbar?(null===(e=this._editToolbar)||void 0===e||e.show(),null===(i=(0,zt.A)(Rr,this))||void 0===i||i.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=this._editToolbar)||void 0===e||e.show())}))}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return null===(t=this.div)||void 0===t?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,i,n,s;this.isSelected&&(this.isSelected=!1,null===(t=(0,zt.A)(Br,this))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(n=this._editToolbar)||void 0===n||n.hide(),null===(s=(0,zt.A)(Rr,this))||void 0===s||s.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return(0,zt.A)(qr,this)}set isEditing(t){(0,Ht.A)(qr,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){(0,zt.A)(Zr,this)||(0,Ht.A)(Zr,this,new Map);const{action:e}=t;let i=(0,zt.A)(Zr,this).get(e);return i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),(0,zt.A)(Zr,this).delete(e),0===(0,zt.A)(Zr,this).size&&(0,Ht.A)(Zr,this,null)},na._telemetryTimeout),void(0,zt.A)(Zr,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,Ht.A)(Fr,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,Ht.A)(Fr,this,!0)}updateFakeAnnotationElement(t){if((0,zt.A)(Ur,this)||this.deleted)return this.deleted?((0,zt.A)(Ur,this).remove(),void(0,Ht.A)(Ur,this,null)):void((this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&(0,zt.A)(Ur,this).updateEdited({rect:this.getPDFRect(),popup:this.comment}));(0,Ht.A)(Ur,this,t.addFakeAnnotation(this))}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===(null===e||void 0===e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}}function sa(t,e,i){let[n,s]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/n,this.y+=i/s,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function ra(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function aa(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function oa(){if((0,zt.A)(Br,this))return;(0,Ht.A)(Br,this,document.createElement("div")),(0,zt.A)(Br,this).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");(0,zt.A)(Br,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,_t.A)(ia,this,la).bind(this,i),{signal:e}),t.addEventListener("contextmenu",pi,{signal:e}),t.tabIndex=-1}this.div.prepend((0,zt.A)(Br,this))}function la(t,e){var i;e.preventDefault();const{isMac:n}=Ge.platform;if(0!==e.button||e.ctrlKey&&n)return;null===(i=(0,zt.A)(Rr,this))||void 0===i||i.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,(0,Ht.A)(Wr,this,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,_t.A)(ia,this,da).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Ai,{passive:!1,signal:a}),window.addEventListener("contextmenu",pi,{signal:a}),(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const c=()=>{var t;r.abort(),this.parent.togglePointerEvents(!0),null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,(0,_t.A)(ia,this,ha).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})}function ca(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}function ha(){if(!(0,zt.A)(jr,this))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=(0,zt.A)(jr,this);(0,Ht.A)(jr,this,null);const s=this.x,r=this.y,a=this.width,o=this.height;s===t&&r===e&&a===i&&o===n||this.addCommands({cmd:(0,_t.A)(ia,this,ca).bind(this,s,r,a,o),undo:(0,_t.A)(ia,this,ca).bind(this,t,e,i,n),mustExec:!0})}function da(t,e){const[i,n]=this.parentDimensions,s=this.x,r=this.y,a=this.width,o=this.height,l=Mt.MIN_SIZE/i,c=Mt.MIN_SIZE/n,h=(0,_t.A)(ia,this,aa).call(this,this.rotation),d=(t,e)=>[h[0]*t+h[2]*e,h[1]*t+h[3]*e],u=(0,_t.A)(ia,this,aa).call(this,360-this.rotation);let p,A,g=!1,f=!1;switch(t){case"topLeft":g=!0,p=(t,e)=>[0,0],A=(t,e)=>[t,e];break;case"topMiddle":p=(t,e)=>[t/2,0],A=(t,e)=>[t/2,e];break;case"topRight":g=!0,p=(t,e)=>[t,0],A=(t,e)=>[0,e];break;case"middleRight":f=!0,p=(t,e)=>[t,e/2],A=(t,e)=>[0,e/2];break;case"bottomRight":g=!0,p=(t,e)=>[t,e],A=(t,e)=>[0,0];break;case"bottomMiddle":p=(t,e)=>[t/2,e],A=(t,e)=>[t/2,0];break;case"bottomLeft":g=!0,p=(t,e)=>[0,e],A=(t,e)=>[t,0];break;case"middleLeft":f=!0,p=(t,e)=>[0,e/2],A=(t,e)=>[t,e/2]}const m=p(a,o),v=A(a,o);let w=d(...v);const b=Mt._round(s+w[0]),y=Mt._round(r+w[1]);let _,x,E=1,S=1;if(e.fromKeyboard)({deltaX:_,deltaY:x}=e);else{const{screenX:t,screenY:i}=e,[n,s]=(0,zt.A)(Wr,this);[_,x]=this.screenToPageTranslation(t-n,i-s),(0,zt.A)(Wr,this)[0]=t,(0,zt.A)(Wr,this)[1]=i}var k,C;if([_,x]=(k=_/i,C=x/n,[u[0]*k+u[2]*C,u[1]*k+u[3]*C]),g){const t=Math.hypot(a,o);E=S=Math.max(Math.min(Math.hypot(v[0]-m[0]-_,v[1]-m[1]-x)/t,1/a,1/o),l/a,c/o)}else f?E=ti(Math.abs(v[0]-m[0]-_),l,1)/a:S=ti(Math.abs(v[1]-m[1]-x),c,1)/o;const M=Mt._round(a*E),T=Mt._round(o*S);w=d(...A(M,T));const P=b-w[0],D=y-w[1];(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[this.x,this.y,this.width,this.height]),this.width=M,this.height=T,this.x=P,this.y=D,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function ua(){var t;(0,Ht.A)(jr,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!1),this.parent.togglePointerEvents(!1)}function pa(t,e,i){let n=i/e*.7+1-.7;if(1===n)return;const s=(0,_t.A)(ia,this,aa).call(this,this.rotation),r=(t,e)=>[s[0]*t+s[2]*e,s[1]*t+s[3]*e],[a,o]=this.parentDimensions,l=this.x,c=this.y,h=this.width,d=this.height,u=Mt.MIN_SIZE/a,p=Mt.MIN_SIZE/o;n=Math.max(Math.min(n,1/h,1/d),u/h,p/d);const A=Mt._round(h*n),g=Mt._round(d*n);if(A===h&&g===d)return;(0,zt.A)(Gr,this)||(0,Ht.A)(Gr,this,[l,c,h,d]);const f=r(h/2,d/2),m=Mt._round(l+f[0]),v=Mt._round(c+f[1]),w=r(A/2,g/2);this.x=m-w[0],this.y=v-w[1],this.width=A,this.height=g,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function Aa(){var t;null===(t=(0,zt.A)(Rr,this))||void 0===t||t.toggle(!0),this.parent.togglePointerEvents(!0),(0,_t.A)(ia,this,ha).call(this)}function ga(t){const{isMac:e}=Ge.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function fa(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const n=new AbortController,s=this._uiManager.combinedSignal(n),r={capture:!0,passive:!1,signal:s},a=t=>{n.abort(),(0,Ht.A)(Nr,this,null),(0,Ht.A)(Vr,this,!1),this._uiManager.endDragSession()||(0,_t.A)(ia,this,ga).call(this,t),i&&this._onStopDragging()};e&&((0,Ht.A)(Qr,this,t.clientX),(0,Ht.A)(Jr,this,t.clientY),(0,Ht.A)(Nr,this,t.pointerId),(0,Ht.A)(Or,this,t.pointerType),window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:e,clientY:n,pointerId:s}=t;if(s!==(0,zt.A)(Nr,this))return void Ai(t);const[r,a]=this.screenToPageTranslation(e-(0,zt.A)(Qr,this),n-(0,zt.A)(Jr,this));(0,Ht.A)(Qr,this,e),(0,Ht.A)(Jr,this,n),this._uiManager.dragSelectedEditors(r,a)},r),window.addEventListener("touchmove",Ai,r),window.addEventListener("pointerdown",t=>{t.pointerType===(0,zt.A)(Or,this)&&((0,zt.A)($r,this)||t.isPrimary)&&a(t),Ai(t)},r));const o=t=>{(0,zt.A)(Nr,this)&&(0,zt.A)(Nr,this)!==t.pointerId?Ai(t):a(t)};window.addEventListener("pointerup",o,{signal:s}),window.addEventListener("blur",o,{signal:s})}function ma(){if((0,zt.A)(zr,this)||!this.div)return;(0,Ht.A)(zr,this,new AbortController);const t=this._uiManager.combinedSignal((0,zt.A)(zr,this));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function va(t){Mt._resizerKeyboardManager.exec(this,t)}function wa(t){var e;(0,zt.A)(Yr,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,zt.A)(Br,this)&&(0,_t.A)(ia,this,_a).call(this)}function ba(t){(0,Ht.A)(Hr,this,(0,zt.A)(Yr,this)?t:"")}function ya(t){if((0,zt.A)(Dr,this))for(const e of(0,zt.A)(Dr,this))e.tabIndex=t}function _a(){(0,Ht.A)(Yr,this,!1),(0,_t.A)(ia,this,ya).call(this,-1),(0,_t.A)(ia,this,ha).call(this)}Mt=na,(0,Vt.A)(na,"_l10n",null),(0,Vt.A)(na,"_l10nResizer",null),(0,Vt.A)(na,"_borderLineWidth",-1),(0,Vt.A)(na,"_colorManager",new vn),(0,Vt.A)(na,"_zIndex",1),(0,Vt.A)(na,"_telemetryTimeout",1e3);class xa extends na{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Ea=3285377520,Sa=4294901760,ka=65535;class Ca{constructor(t){this.h1=t?4294967295&t:Ea,this.h2=t?4294967295&t:Ea}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,s=t.length;n<s;n++){const s=t.charCodeAt(n);s<=255?e[i++]=s:(e[i++]=s>>>8,e[i++]=255&s)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,s=i-4*n,r=new Uint32Array(e.buffer,0,n);let a=0,o=0,l=this.h1,c=this.h2;const h=3432918353,d=461845907,u=11601,p=13715;for(let A=0;A<n;A++)1&A?(a=r[A],a=a*h&Sa|a*u&ka,a=a<<15|a>>>17,a=a*d&Sa|a*p&ka,l^=a,l=l<<13|l>>>19,l=5*l+3864292196):(o=r[A],o=o*h&Sa|o*u&ka,o=o<<15|o>>>17,o=o*d&Sa|o*p&ka,c^=o,c=c<<13|c>>>19,c=5*c+3864292196);switch(a=0,s){case 3:a^=e[4*n+2]<<16;case 2:a^=e[4*n+1]<<8;case 1:a^=e[4*n],a=a*h&Sa|a*u&ka,a=a<<15|a>>>17,a=a*d&Sa|a*p&ka,1&n?l^=a:c^=a}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Sa|36045*t&ka,e=4283543511*e&Sa|(2950163797*(e<<16|t>>>16)&Sa)>>>16,t^=e>>>1,t=444984403*t&Sa|60499*t&ka,e=3301882366*e&Sa|(3120437893*(e<<16|t>>>16)&Sa)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Ma=Object.freeze({map:null,hash:"",transfer:void 0});var Ta=new WeakMap,Pa=new WeakMap,Da=new WeakMap,Ra=new WeakMap,La=new WeakSet;class Ia{constructor(){(0,bt.A)(this,La),(0,yt.A)(this,Ta,!1),(0,yt.A)(this,Pa,null),(0,yt.A)(this,Da,null),(0,yt.A)(this,Ra,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=(0,zt.A)(Ra,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,zt.A)(Ra,this).get(t)}remove(t){const e=(0,zt.A)(Ra,this).get(t);if(void 0!==e&&(e instanceof na&&(0,zt.A)(Da,this).delete(e.annotationElementId),(0,zt.A)(Ra,this).delete(t),0===(0,zt.A)(Ra,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor)){for(const t of(0,zt.A)(Ra,this).values())if(t instanceof na)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=(0,zt.A)(Ra,this).get(t);let n=!1;if(void 0!==i)for(const[s,r]of Object.entries(e))i[s]!==r&&(n=!0,i[s]=r);else n=!0,(0,zt.A)(Ra,this).set(t,e);n&&(0,_t.A)(La,this,Fa).call(this),e instanceof na&&(((0,zt.A)(Da,this)||(0,Ht.A)(Da,this,new Map)).set(e.annotationElementId,e),"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type))}has(t){return(0,zt.A)(Ra,this).has(t)}get size(){return(0,zt.A)(Ra,this).size}resetModified(){(0,zt.A)(Ta,this)&&((0,Ht.A)(Ta,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new Oa(this)}get serializable(){if(0===(0,zt.A)(Ra,this).size)return Ma;const t=new Map,e=new Ca,i=[],n=Object.create(null);let s=!1;for(const[r,a]of(0,zt.A)(Ra,this)){const i=a instanceof na?a.serialize(!1,n):a;i&&(t.set(r,i),e.update("".concat(r,":").concat(JSON.stringify(i))),s||(s=!!i.bitmap))}if(s)for(const r of t.values())r.bitmap&&i.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Ma}get editorStats(){let t=null;const e=new Map;let i=0,n=0;for(const a of(0,zt.A)(Ra,this).values()){var s;if(!(a instanceof na)){a.popup&&(a.popup.deleted?n+=1:i+=1);continue}a.isCommentDeleted?n+=1:a.hasEditedComment&&(i+=1);const o=a.telemetryFinalData;if(!o)continue;const{type:l}=o;e.has(l)||e.set(l,Object.getPrototypeOf(a).constructor),t||(t=Object.create(null));const c=(s=t)[l]||(s[l]=new Map);for(const[t,e]of Object.entries(o)){var r;if("type"===t)continue;let i=c.get(t);i||(i=new Map,c.set(t,i));const n=null!==(r=i.get(e))&&void 0!==r?r:0;i.set(e,n+1)}}if((n>0||i>0)&&(t||(t=Object.create(null)),t.comments={deleted:n,edited:i}),!t)return null;for(const[a,o]of e)t[a]=o.computeTelemetryFinalData(t[a]);return t}resetModifiedIds(){(0,Ht.A)(Pa,this,null)}updateEditor(t,e){var i;const n=null===(i=(0,zt.A)(Da,this))||void 0===i?void 0:i.get(t);return!!n&&(n.updateFromAnnotationLayer(e),!0)}getEditor(t){var e;return(null===(e=(0,zt.A)(Da,this))||void 0===e?void 0:e.get(t))||null}get modifiedIds(){if((0,zt.A)(Pa,this))return(0,zt.A)(Pa,this);const t=[];if((0,zt.A)(Da,this))for(const e of(0,zt.A)(Da,this).values())e.serialize()&&t.push(e.annotationElementId);return(0,Ht.A)(Pa,this,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return(0,zt.A)(Ra,this).entries()}}function Fa(){(0,zt.A)(Ta,this)||((0,Ht.A)(Ta,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var Na=new WeakMap;class Oa extends Ia{constructor(t){super(),(0,yt.A)(this,Na,void 0);const{map:e,hash:i,transfer:n}=t.serializable,s=structuredClone(e,n?{transfer:n}:null);(0,Ht.A)(Na,this,{map:s,hash:i,transfer:n})}get print(){De("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,zt.A)(Na,this)}get modifiedIds(){return Fe(this,"modifiedIds",{ids:new Set,hash:""})}}var Ba=new WeakMap;class Wa{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;(0,yt.A)(this,Ba,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,zt.A)(Ba,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,disableFontFace:i,_inspectFont:n}=t;if(e&&!(0,zt.A)(Ba,this).has(e.loadedName)){if(Re(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:r}=e,a=new FontFace(t,i,r);this.addNativeFontFace(a);try{await a.load(),(0,zt.A)(Ba,this).add(t),null===n||void 0===n||n(e)}catch(s){Pe("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(a)}return}De("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw Pe("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return Fe(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){return Fe(this,"isSyncFontLoadingSupported",qt||Ge.platform.isFirefox)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Re(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Fe(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let s,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const o=a.getContext("2d");let l=0;const c="lt".concat(Date.now()).concat(this.loadTestFontId++);let h=this._loadTestFont;h=n(h,976,c.length,c);const d=1482184792;let u=i(h,16);for(s=0,r=c.length-3;s<r;s+=4)u=u-d+i(c,s)|0;var p;s<c.length&&(u=u-d+i(c+"XXX",s)|0),h=n(h,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const A="url(data:font/opentype;base64,".concat(btoa(h),");"),g='@font-face {font-family:"'.concat(c,'";src:').concat(A,"}");this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const m of[t.loadedName,c]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=m,f.append(t)}this._document.body.append(f),function t(e,i){if(++l>30)return Pe("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(c,()=>{f.remove(),e.complete()})}}var ja=new WeakMap;class Ua{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;(0,yt.A)(this,ja,void 0),this.compiledGlyphs=Object.create(null),(0,Ht.A)(ja,this,t),this._inspectFont=e,i&&Object.assign(this,i),n&&(this.charProcOperatorList=n)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e="url(data:".concat(this.mimetype,";base64,").concat(ei(this.data),");");let i;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),i='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(e,"}")}else i='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(e,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let n;try{n=t.get(i)}catch(r){Pe('getPathGenerator - ignoring character: "'.concat(r,'".'))}const s=new Path2D(n||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return(0,zt.A)(ja,this).black}get bold(){return(0,zt.A)(ja,this).bold}get disableFontFace(){var t;return null!==(t=(0,zt.A)(ja,this).disableFontFace)&&void 0!==t&&t}get fontExtraProperties(){var t;return null!==(t=(0,zt.A)(ja,this).fontExtraProperties)&&void 0!==t&&t}get isInvalidPDFjsFont(){return(0,zt.A)(ja,this).isInvalidPDFjsFont}get isType3Font(){return(0,zt.A)(ja,this).isType3Font}get italic(){return(0,zt.A)(ja,this).italic}get missingFile(){return(0,zt.A)(ja,this).missingFile}get remeasure(){return(0,zt.A)(ja,this).remeasure}get vertical(){return(0,zt.A)(ja,this).vertical}get ascent(){return(0,zt.A)(ja,this).ascent}get defaultWidth(){return(0,zt.A)(ja,this).defaultWidth}get descent(){return(0,zt.A)(ja,this).descent}get bbox(){return(0,zt.A)(ja,this).bbox}get fontMatrix(){return(0,zt.A)(ja,this).fontMatrix}get fallbackName(){return(0,zt.A)(ja,this).fallbackName}get loadedName(){return(0,zt.A)(ja,this).loadedName}get mimetype(){return(0,zt.A)(ja,this).mimetype}get name(){return(0,zt.A)(ja,this).name}get data(){return(0,zt.A)(ja,this).data}clearData(){(0,zt.A)(ja,this).clearData()}get cssFontInfo(){return(0,zt.A)(ja,this).cssFontInfo}get systemFontInfo(){return(0,zt.A)(ja,this).systemFontInfo}get defaultVMetrics(){return(0,zt.A)(ja,this).defaultVMetrics}}function za(t){if("string"!==typeof t)return null;if(t.endsWith("/"))return t;throw new Error('Invalid factory url: "'.concat(t,'" must include trailing slash.'))}const Ha=t=>"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0,Va=function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[n,s,...r]=i;if(!t(n)&&!Number.isInteger(n))return!1;if(!e(s))return!1;const a=r.length;let o=!0;switch(s.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;o=!1;break;default:return!1}for(const l of r)if(!("number"===typeof l||o&&null===l))return!1;return!0}.bind(null,Ha,t=>"object"===typeof t&&"string"===typeof(null===t||void 0===t?void 0:t.name));var Ga=new WeakMap,qa=new WeakMap;class Xa{constructor(){(0,yt.A)(this,Ga,new Map),(0,yt.A)(this,qa,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};(0,zt.A)(qa,this).then(()=>{for(const[t]of(0,zt.A)(Ga,this))t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=null;if((null===i||void 0===i?void 0:i.signal)instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void Pe("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",r),s.addEventListener("abort",r)}(0,zt.A)(Ga,this).set(e,n)}removeEventListener(t,e){const i=(0,zt.A)(Ga,this).get(e);null===i||void 0===i||i(),(0,zt.A)(Ga,this).delete(e)}terminate(){for(const[,t]of(0,zt.A)(Ga,this))null===t||void 0===t||t();(0,zt.A)(Ga,this).clear()}}const Ya=1,Ka=2,Qa=1,Ja=2,Za=3,$a=4,to=5,eo=6,io=7,no=8;function so(){}function ro(t){if(t instanceof ze||t instanceof We||t instanceof Oe||t instanceof je||t instanceof Be)return t;switch(t instanceof Error||"object"===typeof t&&null!==t||De('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ze(t.message);case"InvalidPDFException":return new We(t.message);case"PasswordException":return new Oe(t.message,t.code);case"ResponseException":return new je(t.message,t.status,t.missing);case"UnknownErrorException":return new Be(t.message,t.details)}return new Be(t.message,t.toString())}var ao=new WeakMap,oo=new WeakSet;class lo{constructor(t,e,i){(0,bt.A)(this,oo),(0,yt.A)(this,ao,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",(0,_t.A)(oo,this,co).bind(this),{signal:(0,zt.A)(ao,this).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(r){s.reject(r)}return s.promise}sendWithStream(t,e,i,n){const s=this.streamId++,r=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[s]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:r,targetName:a,action:t,streamId:s,data:e,desiredSize:i.desiredSize},n),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[s].pullCall=e,o.postMessage({sourceName:r,targetName:a,stream:eo,streamId:s,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Re(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[s].cancelCall=e,this.streamControllers[s].isClosed=!0,o.postMessage({sourceName:r,targetName:a,stream:Qa,streamId:s,reason:ro(t)}),e.promise}},i)}destroy(){var t;null===(t=(0,zt.A)(ao,this))||void 0===t||t.abort(),(0,Ht.A)(ao,this,null)}}function co(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void(0,_t.A)(oo,this,uo).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===Ya)i.resolve(e.data);else{if(e.callback!==Ka)throw new Error("Unexpected callback case");i.reject(ro(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,n=e.sourceName,s=this.comObj;return void Promise.try(i,e.data).then(function(i){s.postMessage({sourceName:t,targetName:n,callback:Ya,callbackId:e.callbackId,data:i})},function(i){s.postMessage({sourceName:t,targetName:n,callback:Ka,callbackId:e.callbackId,reason:ro(i)})})}e.streamId?(0,_t.A)(oo,this,ho).call(this,e):i(e.data)}function ho(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this,a=this.actionHandler[t.action],o={enqueue(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=r,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:$a,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Za,streamId:e}),delete r.streamSinks[e])},error(t){Re(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:to,streamId:e,reason:ro(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(a,t.data,o).then(function(){s.postMessage({sourceName:i,targetName:n,stream:no,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:no,streamId:e,reason:ro(t)})})}function uo(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case no:t.success?r.startCall.resolve():r.startCall.reject(ro(t.reason));break;case io:t.success?r.pullCall.resolve():r.pullCall.reject(ro(t.reason));break;case eo:if(!a){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,Promise.try(a.onPull||so).then(function(){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:io,streamId:e,reason:ro(t)})});break;case $a:if(Re(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case Za:if(Re(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),(0,_t.A)(oo,this,po).call(this,r,e);break;case to:Re(r,"error should have stream controller"),r.controller.error(ro(t.reason)),(0,_t.A)(oo,this,po).call(this,r,e);break;case Ja:t.success?r.cancelCall.resolve():r.cancelCall.reject(ro(t.reason)),(0,_t.A)(oo,this,po).call(this,r,e);break;case Qa:if(!a)break;const o=ro(t.reason);Promise.try(a.onCancel||so,o).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ja,streamId:e,success:!0})},function(t){s.postMessage({sourceName:i,targetName:n,stream:Ja,streamId:e,reason:ro(t)})}),a.sinkCapability.reject(o),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function po(t,e){var i,n,s;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(n=t.pullCall)||void 0===n?void 0:n.promise,null===(s=t.cancelCall)||void 0===s?void 0:s.promise]),delete this.streamControllers[e]}var Ao=new WeakMap;class go{constructor(t){let{enableHWA:e=!1}=t;(0,yt.A)(this,Ao,!1),(0,Ht.A)(Ao,this,e)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,zt.A)(Ao,this)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){De("Abstract method `_createCanvas` called.")}}class fo extends go{constructor(t){let{ownerDocument:e=globalThis.document,enableHWA:i=!1}=t;super({enableHWA:i}),this._document=e}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class mo{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class vo extends mo{async _fetch(t){const e=await ai(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Ve(e)}}class wo{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(){}}var bo=new WeakMap,yo=new WeakMap,_o=new WeakMap,xo=new WeakMap,Eo=new WeakMap,So=new WeakMap,ko=new WeakMap,Co=new WeakSet;class Mo extends wo{constructor(t){let{docId:e,ownerDocument:i=globalThis.document}=t;super(),(0,bt.A)(this,Co),(0,yt.A)(this,bo,void 0),(0,yt.A)(this,yo,void 0),(0,yt.A)(this,_o,void 0),(0,yt.A)(this,xo,void 0),(0,yt.A)(this,Eo,void 0),(0,yt.A)(this,So,void 0),(0,yt.A)(this,ko,0),(0,Ht.A)(xo,this,e),(0,Ht.A)(Eo,this,i)}addFilter(t){var e,i;if(!t)return"none";let n=xt(Co,this,To).get(t);if(n)return n;const[s,r,a]=(0,_t.A)(Co,this,Ro).call(this,t),o=1===t.length?s:"".concat(s).concat(r).concat(a);if(n=xt(Co,this,To).get(o),n)return xt(Co,this,To).set(t,n),n;const l="g_".concat((0,zt.A)(xo,this),"_transfer_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),c=(0,_t.A)(Co,this,Lo).call(this,l);xt(Co,this,To).set(t,c),xt(Co,this,To).set(o,c);const h=(0,_t.A)(Co,this,No).call(this,l);return(0,_t.A)(Co,this,Bo).call(this,s,r,a,h),c}addHCMFilter(t,e){var i;const n="".concat(t,"-").concat(e),s="base";let r=xt(Co,this,Po).get(s);if((null===(i=r)||void 0===i?void 0:i.key)===n)return r.url;var a;r?(null===(a=r.filter)||void 0===a||a.remove(),r.key=n,r.url="none",r.filter=null):(r={key:n,url:"none",filter:null},xt(Co,this,Po).set(s,r));if(!t||!e)return r.url;const o=(0,_t.A)(Co,this,jo).call(this,t);t=Xe.makeHexColor(...o);const l=(0,_t.A)(Co,this,jo).call(this,e);if(e=Xe.makeHexColor(...l),xt(Co,this,Do).style.color="","#000000"===t&&"#ffffff"===e||t===e)return r.url;const c=new Array(256);for(let A=0;A<=255;A++){const t=A/255;c[A]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const h=c.join(","),d="g_".concat((0,zt.A)(xo,this),"_hcm_filter"),u=r.filter=(0,_t.A)(Co,this,No).call(this,d);(0,_t.A)(Co,this,Bo).call(this,h,h,h,u),(0,_t.A)(Co,this,Fo).call(this,u);const p=(t,e)=>{const i=o[t]/255,n=l[t]/255,s=new Array(e+1);for(let r=0;r<=e;r++)s[r]=i+r/e*(n-i);return s.join(",")};return(0,_t.A)(Co,this,Bo).call(this,p(0,5),p(1,5),p(2,5),u),r.url=(0,_t.A)(Co,this,Lo).call(this,d),r.url}addAlphaFilter(t){var e,i;let n=xt(Co,this,To).get(t);if(n)return n;const[s]=(0,_t.A)(Co,this,Ro).call(this,[t]),r="alpha_".concat(s);if(n=xt(Co,this,To).get(r),n)return xt(Co,this,To).set(t,n),n;const a="g_".concat((0,zt.A)(xo,this),"_alpha_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),o=(0,_t.A)(Co,this,Lo).call(this,a);xt(Co,this,To).set(t,o),xt(Co,this,To).set(r,o);const l=(0,_t.A)(Co,this,No).call(this,a);return(0,_t.A)(Co,this,Wo).call(this,s,l),o}addLuminosityFilter(t){var e,i;let n,s,r=xt(Co,this,To).get(t||"luminosity");if(r)return r;if(t?([n]=(0,_t.A)(Co,this,Ro).call(this,[t]),s="luminosity_".concat(n)):s="luminosity",r=xt(Co,this,To).get(s),r)return xt(Co,this,To).set(t,r),r;const a="g_".concat((0,zt.A)(xo,this),"_luminosity_map_").concat(((0,Ht.A)(ko,this,(e=(0,zt.A)(ko,this),i=e++,e)),i)),o=(0,_t.A)(Co,this,Lo).call(this,a);xt(Co,this,To).set(t,o),xt(Co,this,To).set(s,o);const l=(0,_t.A)(Co,this,No).call(this,a);return(0,_t.A)(Co,this,Io).call(this,l),t&&(0,_t.A)(Co,this,Wo).call(this,n,l),o}addHighlightHCMFilter(t,e,i,n,s){var r;const a="".concat(e,"-").concat(i,"-").concat(n,"-").concat(s);let o=xt(Co,this,Po).get(t);if((null===(r=o)||void 0===r?void 0:r.key)===a)return o.url;var l;o?(null===(l=o.filter)||void 0===l||l.remove(),o.key=a,o.url="none",o.filter=null):(o={key:a,url:"none",filter:null},xt(Co,this,Po).set(t,o));if(!e||!i)return o.url;const[c,h]=[e,i].map((0,_t.A)(Co,this,jo).bind(this));let d=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[p,A]=[n,s].map((0,_t.A)(Co,this,jo).bind(this));u<d&&([d,u,p,A]=[u,d,A,p]),xt(Co,this,Do).style.color="";const g=(t,e,i)=>{const n=new Array(256),s=(u-d)/i,r=t/255,a=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(d+l*s),e=r+l*a;for(let i=o;i<=t;i++)n[i]=e;o=t+1}for(let l=o;l<256;l++)n[l]=n[o-1];return n.join(",")},f="g_".concat((0,zt.A)(xo,this),"_hcm_").concat(t,"_filter"),m=o.filter=(0,_t.A)(Co,this,No).call(this,f);return(0,_t.A)(Co,this,Fo).call(this,m),(0,_t.A)(Co,this,Bo).call(this,g(p[0],A[0],5),g(p[1],A[1],5),g(p[2],A[2],5),m),o.url=(0,_t.A)(Co,this,Lo).call(this,f),o.url}destroy(){var t,e,i,n;arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&null!==(t=(0,zt.A)(So,this))&&void 0!==t&&t.size||(null===(e=(0,zt.A)(_o,this))||void 0===e||e.parentNode.parentNode.remove(),(0,Ht.A)(_o,this,null),null===(i=(0,zt.A)(yo,this))||void 0===i||i.clear(),(0,Ht.A)(yo,this,null),null===(n=(0,zt.A)(So,this))||void 0===n||n.clear(),(0,Ht.A)(So,this,null),(0,Ht.A)(ko,this,0))}}function To(t){return(0,zt.A)(yo,t)||(0,Ht.A)(yo,t,new Map)}function Po(t){return(0,zt.A)(So,t)||(0,Ht.A)(So,t,new Map)}function Do(t){if(!(0,zt.A)(_o,t)){const e=(0,zt.A)(Eo,t).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const n=(0,zt.A)(Eo,t).createElementNS(si,"svg");n.setAttribute("width",0),n.setAttribute("height",0),(0,Ht.A)(_o,t,(0,zt.A)(Eo,t).createElementNS(si,"defs")),e.append(n),n.append((0,zt.A)(_o,t)),(0,zt.A)(Eo,t).body.append(e)}return(0,zt.A)(_o,t)}function Ro(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const n=i.join(",");return[n,n,n]}const[e,i,n]=t,s=new Array(256),r=new Array(256),a=new Array(256);for(let o=0;o<256;o++)s[o]=e[o]/255,r[o]=i[o]/255,a[o]=n[o]/255;return[s.join(","),r.join(","),a.join(",")]}function Lo(t){if(void 0===(0,zt.A)(bo,this)){(0,Ht.A)(bo,this,"");const t=(0,zt.A)(Eo,this).URL;t!==(0,zt.A)(Eo,this).baseURI&&(ci(t)?Pe('#createUrl: ignore "data:"-URL for performance reasons.'):(0,Ht.A)(bo,this,Ie(t,"")))}return"url(".concat((0,zt.A)(bo,this),"#").concat(t,")")}function Io(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function Fo(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}function No(t){const e=(0,zt.A)(Eo,this).createElementNS(si,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),xt(Co,this,Do).append(e),e}function Oo(t,e,i){const n=(0,zt.A)(Eo,this).createElementNS(si,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}function Bo(t,e,i,n){const s=(0,zt.A)(Eo,this).createElementNS(si,"feComponentTransfer");n.append(s),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncR",t),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncG",e),(0,_t.A)(Co,this,Oo).call(this,s,"feFuncB",i)}function Wo(t,e){const i=(0,zt.A)(Eo,this).createElementNS(si,"feComponentTransfer");e.append(i),(0,_t.A)(Co,this,Oo).call(this,i,"feFuncA",t)}function jo(t){return xt(Co,this,Do).style.color=t,mi(getComputedStyle(xt(Co,this,Do)).getPropertyValue("color"))}class Uo{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load font data at: ".concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class zo extends Uo{async _fetch(t){const e=await ai(t,"arraybuffer");return new Uint8Array(e)}}class Ho{constructor(t){let{baseUrl:e=null}=t;this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw new Error("Unable to load wasm data at: ".concat(i))})}async _fetch(t){De("Abstract method `_fetch` called.")}}class Vo extends Ho{async _fetch(t){const e=await ai(t,"arraybuffer");return new Uint8Array(e)}}async function Go(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}qt&&Pe("Please use the `legacy` build in Node.js environments.");class qo extends wo{}class Xo extends go{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///home/runner/work/components-core/components-core/node_modules/pdfjs-dist/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class Yo extends mo{async _fetch(t){return Go(t)}}class Ko extends Uo{async _fetch(t){return Go(t)}}class Qo extends Ho{async _fetch(t){return Go(t)}}const Jo="__forcedDependency",{floor:Zo,ceil:$o}=Math;function tl(t,e,i,n,s,r){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],n),t[4*e+2]=Math.max(t[4*e+2],s),t[4*e+3]=Math.max(t[4*e+3],r)}const el=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var il=new WeakMap,nl=new WeakMap;class sl{constructor(t,e){(0,yt.A)(this,il,void 0),(0,yt.A)(this,nl,void 0),(0,Ht.A)(il,this,t),(0,Ht.A)(nl,this,e)}get length(){return(0,zt.A)(il,this).length}isEmpty(t){return(0,zt.A)(il,this)[t]===el}minX(t){return(0,zt.A)(nl,this)[4*t+0]/256}minY(t){return(0,zt.A)(nl,this)[4*t+1]/256}maxX(t){return((0,zt.A)(nl,this)[4*t+2]+1)/256}maxY(t){return((0,zt.A)(nl,this)[4*t+3]+1)/256}}const rl=(t,e)=>{if(!t)return;let i=t.get(e);return i||(i={dependencies:new Set,isRenderingOperation:!1},t.set(e,i)),i};var al=new WeakMap,ol=new WeakMap,ll=new WeakMap,cl=new WeakMap,hl=new WeakMap,dl=new WeakMap,ul=new WeakMap,pl=new WeakMap,Al=new WeakMap,gl=new WeakMap,fl=new WeakMap,ml=new WeakMap,vl=new WeakMap,wl=new WeakMap,bl=new WeakMap,yl=new WeakMap,_l=new WeakMap,xl=new WeakSet;class El{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,bt.A)(this,xl),(0,yt.A)(this,al,{__proto__:null}),(0,yt.A)(this,ol,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Jo]:[]}),(0,yt.A)(this,ll,new Map),(0,yt.A)(this,cl,[]),(0,yt.A)(this,hl,[]),(0,yt.A)(this,dl,[[1,0,0,1,0,0]]),(0,yt.A)(this,ul,[-1/0,-1/0,1/0,1/0]),(0,yt.A)(this,pl,new Float64Array([1/0,1/0,-1/0,-1/0])),(0,yt.A)(this,Al,-1),(0,yt.A)(this,gl,new Set),(0,yt.A)(this,fl,new Map),(0,yt.A)(this,ml,new Map),(0,yt.A)(this,vl,void 0),(0,yt.A)(this,wl,void 0),(0,yt.A)(this,bl,void 0),(0,yt.A)(this,yl,void 0),(0,yt.A)(this,_l,void 0),(0,Ht.A)(vl,this,t.width),(0,Ht.A)(wl,this,t.height),(0,_t.A)(xl,this,Sl).call(this,e),i&&(0,Ht.A)(_l,this,new Map)}growOperationsCount(t){t>=(0,zt.A)(yl,this).length&&(0,_t.A)(xl,this,Sl).call(this,t,(0,zt.A)(yl,this))}save(t){return(0,Ht.A)(al,this,{__proto__:(0,zt.A)(al,this)}),(0,Ht.A)(ol,this,{__proto__:(0,zt.A)(ol,this),transform:{__proto__:(0,zt.A)(ol,this).transform},moveText:{__proto__:(0,zt.A)(ol,this).moveText},sameLineText:{__proto__:(0,zt.A)(ol,this).sameLineText},[Jo]:{__proto__:(0,zt.A)(ol,this)[Jo]}}),(0,Ht.A)(ul,this,{__proto__:(0,zt.A)(ul,this)}),(0,zt.A)(cl,this).push(t),this}restore(t){const e=Object.getPrototypeOf((0,zt.A)(al,this));if(null===e)return this;(0,Ht.A)(al,this,e),(0,Ht.A)(ol,this,Object.getPrototypeOf((0,zt.A)(ol,this))),(0,Ht.A)(ul,this,Object.getPrototypeOf((0,zt.A)(ul,this)));const i=(0,zt.A)(cl,this).pop();var n;void 0!==i&&(null===(n=rl((0,zt.A)(_l,this),t))||void 0===n||n.dependencies.add(i),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[i]);return this}recordOpenMarker(t){return(0,zt.A)(cl,this).push(t),this}getOpenMarker(){return 0===(0,zt.A)(cl,this).length?null:(0,zt.A)(cl,this).at(-1)}recordCloseMarker(t){const e=(0,zt.A)(cl,this).pop();var i;void 0!==e&&(null===(i=rl((0,zt.A)(_l,this),t))||void 0===i||i.dependencies.add(e),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[e]);return this}beginMarkedContent(t){return(0,zt.A)(hl,this).push(t),this}endMarkedContent(t){const e=(0,zt.A)(hl,this).pop();var i;void 0!==e&&(null===(i=rl((0,zt.A)(_l,this),t))||void 0===i||i.dependencies.add(e),(0,zt.A)(yl,this)[t]=(0,zt.A)(yl,this)[e]);return this}pushBaseTransform(t){return(0,zt.A)(dl,this).push(Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),t.getTransform())),this}popBaseTransform(){return(0,zt.A)(dl,this).length>1&&(0,zt.A)(dl,this).pop(),this}recordSimpleData(t,e){return(0,zt.A)(al,this)[t]=e,this}recordIncrementalData(t,e){return(0,zt.A)(ol,this)[t].push(e),this}resetIncrementalData(t,e){return(0,zt.A)(ol,this)[t].length=0,this}recordNamedData(t,e){return(0,zt.A)(ll,this).set(t,e),this}recordSimpleDataFromNamed(t,e,i){var n;(0,zt.A)(al,this)[t]=null!==(n=(0,zt.A)(ll,this).get(e))&&void 0!==n?n:i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Jo,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in(0,zt.A)(al,this)&&this.recordFutureForcedDependency(e,(0,zt.A)(al,this)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of(0,zt.A)(gl,this))this.recordFutureForcedDependency(Jo,t);return this}resetBBox(t){return(0,zt.A)(Al,this)!==t&&((0,Ht.A)(Al,this,t),(0,zt.A)(pl,this)[0]=1/0,(0,zt.A)(pl,this)[1]=1/0,(0,zt.A)(pl,this)[2]=-1/0,(0,zt.A)(pl,this)[3]=-1/0),this}recordClipBox(t,e,i,n,s,r){const a=Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),e.getTransform()),o=[1/0,1/0,-1/0,-1/0];Xe.axialAlignedBoundingBox([i,s,n,r],a,o);const l=Xe.intersect((0,zt.A)(ul,this),o);return l?((0,zt.A)(ul,this)[0]=l[0],(0,zt.A)(ul,this)[1]=l[1],(0,zt.A)(ul,this)[2]=l[2],(0,zt.A)(ul,this)[3]=l[3]):((0,zt.A)(ul,this)[0]=(0,zt.A)(ul,this)[1]=1/0,(0,zt.A)(ul,this)[2]=(0,zt.A)(ul,this)[3]=-1/0),this}recordBBox(t,e,i,n,s,r){const a=(0,zt.A)(ul,this);if(a[0]===1/0)return this;const o=Xe.multiplyByDOMMatrix((0,zt.A)(dl,this).at(-1),e.getTransform());if(a[0]===-1/0)return Xe.axialAlignedBoundingBox([i,s,n,r],o,(0,zt.A)(pl,this)),this;const l=[1/0,1/0,-1/0,-1/0];return Xe.axialAlignedBoundingBox([i,s,n,r],o,l),(0,zt.A)(pl,this)[0]=Math.min((0,zt.A)(pl,this)[0],Math.max(l[0],a[0])),(0,zt.A)(pl,this)[1]=Math.min((0,zt.A)(pl,this)[1],Math.max(l[1],a[1])),(0,zt.A)(pl,this)[2]=Math.max((0,zt.A)(pl,this)[2],Math.min(l[2],a[2])),(0,zt.A)(pl,this)[3]=Math.max((0,zt.A)(pl,this)[3],Math.min(l[3],a[3])),this}recordCharacterBBox(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=arguments.length>6?arguments[6]:void 0;const o=i.bbox;let l,c;if(o&&(l=o[2]!==o[0]&&o[3]!==o[1]&&(0,zt.A)(ml,this).get(i),!1!==l&&(c=[0,0,0,0],Xe.axialAlignedBoundingBox(o,i.fontMatrix,c),1===n&&0===s&&0===r||Xe.scaleMinMax([n,0,0,-n,s,r],c),l)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!a)return this.recordFullPageBBox(t);const h=a();return o&&c&&void 0===l&&(l=c[0]<=s-h.actualBoundingBoxLeft&&c[2]>=s+h.actualBoundingBoxRight&&c[1]<=r-h.actualBoundingBoxAscent&&c[3]>=r+h.actualBoundingBoxDescent,(0,zt.A)(ml,this).set(i,l),l)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,s-h.actualBoundingBoxLeft,s+h.actualBoundingBoxRight,r-h.actualBoundingBoxAscent,r+h.actualBoundingBoxDescent)}recordFullPageBBox(t){return(0,zt.A)(pl,this)[0]=Math.max(0,(0,zt.A)(ul,this)[0]),(0,zt.A)(pl,this)[1]=Math.max(0,(0,zt.A)(ul,this)[1]),(0,zt.A)(pl,this)[2]=Math.min((0,zt.A)(vl,this),(0,zt.A)(ul,this)[2]),(0,zt.A)(pl,this)[3]=Math.min((0,zt.A)(wl,this),(0,zt.A)(ul,this)[3]),this}getSimpleIndex(t){return(0,zt.A)(al,this)[t]}recordDependencies(t,e){const i=(0,zt.A)(gl,this),n=(0,zt.A)(al,this),s=(0,zt.A)(ol,this);for(const r of e)r in(0,zt.A)(al,this)?i.add(n[r]):r in s&&s[r].forEach(i.add,i);return this}recordNamedDependency(t,e){return(0,zt.A)(ll,this).has(e)&&(0,zt.A)(gl,this).add((0,zt.A)(ll,this).get(e)),this}recordOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.recordDependencies(t,[Jo]),(0,zt.A)(_l,this)){const e=rl((0,zt.A)(_l,this),t),{dependencies:i}=e;(0,zt.A)(gl,this).forEach(i.add,i),(0,zt.A)(cl,this).forEach(i.add,i),(0,zt.A)(hl,this).forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}if((0,zt.A)(Al,this)===t){const i=Zo(256*(0,zt.A)(pl,this)[0]/(0,zt.A)(vl,this)),n=Zo(256*(0,zt.A)(pl,this)[1]/(0,zt.A)(wl,this)),s=$o(256*(0,zt.A)(pl,this)[2]/(0,zt.A)(vl,this)),r=$o(256*(0,zt.A)(pl,this)[3]/(0,zt.A)(wl,this));tl((0,zt.A)(bl,this),t,i,n,s,r);for(const e of(0,zt.A)(gl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);for(const e of(0,zt.A)(cl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);for(const e of(0,zt.A)(hl,this))e!==t&&tl((0,zt.A)(bl,this),e,i,n,s,r);e||((0,zt.A)(gl,this).clear(),(0,Ht.A)(Al,this,-1))}return this}recordShowTextOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=Array.from((0,zt.A)(gl,this));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const n of i)this.recordIncrementalData("sameLineText",n);return this}bboxToClipBoxDropOperation(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,zt.A)(Al,this)===t&&((0,Ht.A)(Al,this,-1),(0,zt.A)(ul,this)[0]=Math.max((0,zt.A)(ul,this)[0],(0,zt.A)(pl,this)[0]),(0,zt.A)(ul,this)[1]=Math.max((0,zt.A)(ul,this)[1],(0,zt.A)(pl,this)[1]),(0,zt.A)(ul,this)[2]=Math.min((0,zt.A)(ul,this)[2],(0,zt.A)(pl,this)[2]),(0,zt.A)(ul,this)[3]=Math.min((0,zt.A)(ul,this)[3],(0,zt.A)(pl,this)[3]),e||(0,zt.A)(gl,this).clear()),this}_takePendingDependencies(){const t=(0,zt.A)(gl,this);return(0,Ht.A)(gl,this,new Set),t}_extractOperation(t){const e=(0,zt.A)(fl,this).get(t);return(0,zt.A)(fl,this).delete(t),e}_pushPendingDependencies(t){for(const e of t)(0,zt.A)(gl,this).add(e)}take(){return(0,zt.A)(ml,this).clear(),new sl((0,zt.A)(yl,this),(0,zt.A)(bl,this))}takeDebugMetadata(){return(0,zt.A)(_l,this)}}function Sl(t,e){const i=new ArrayBuffer(4*t);(0,Ht.A)(bl,this,new Uint8ClampedArray(i)),(0,Ht.A)(yl,this,new Uint32Array(i)),e&&e.length>0?((0,zt.A)(yl,this).set(e),(0,zt.A)(yl,this).fill(el,e.length)):(0,zt.A)(yl,this).fill(el)}var kl=new WeakMap,Cl=new WeakMap,Ml=new WeakMap,Tl=new WeakMap,Pl=new WeakMap;class Dl{constructor(t,e,i){if((0,yt.A)(this,kl,void 0),(0,yt.A)(this,Cl,void 0),(0,yt.A)(this,Ml,void 0),(0,yt.A)(this,Tl,0),(0,yt.A)(this,Pl,0),t instanceof Dl&&(0,zt.A)(Ml,t)===!!i)return t;(0,Ht.A)(kl,this,t),(0,Ht.A)(Cl,this,e),(0,Ht.A)(Ml,this,!!i)}growOperationsCount(){throw new Error("Unreachable")}save(t){var e;return(0,Ht.A)(Pl,this,(e=(0,zt.A)(Pl,this),e++,e)),(0,zt.A)(kl,this).save((0,zt.A)(Cl,this)),this}restore(t){var e;(0,zt.A)(Pl,this)>0&&((0,zt.A)(kl,this).restore((0,zt.A)(Cl,this)),(0,Ht.A)(Pl,this,(e=(0,zt.A)(Pl,this),e--,e)));return this}recordOpenMarker(t){var e;return(0,Ht.A)(Tl,this,(e=(0,zt.A)(Tl,this),e++,e)),this}getOpenMarker(){return(0,zt.A)(Tl,this)>0?(0,zt.A)(Cl,this):(0,zt.A)(kl,this).getOpenMarker()}recordCloseMarker(t){var e;return(0,Ht.A)(Tl,this,(e=(0,zt.A)(Tl,this),e--,e)),this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return(0,zt.A)(kl,this).pushBaseTransform(t),this}popBaseTransform(){return(0,zt.A)(kl,this).popBaseTransform(),this}recordSimpleData(t,e){return(0,zt.A)(kl,this).recordSimpleData(t,(0,zt.A)(Cl,this)),this}recordIncrementalData(t,e){return(0,zt.A)(kl,this).recordIncrementalData(t,(0,zt.A)(Cl,this)),this}resetIncrementalData(t,e){return(0,zt.A)(kl,this).resetIncrementalData(t,(0,zt.A)(Cl,this)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return(0,zt.A)(kl,this).recordSimpleDataFromNamed(t,e,(0,zt.A)(Cl,this)),this}recordFutureForcedDependency(t,e){return(0,zt.A)(kl,this).recordFutureForcedDependency(t,(0,zt.A)(Cl,this)),this}inheritSimpleDataAsFutureForcedDependencies(t){return(0,zt.A)(kl,this).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return(0,zt.A)(kl,this).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).resetBBox((0,zt.A)(Cl,this)),this}recordClipBox(t,e,i,n,s,r){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordClipBox((0,zt.A)(Cl,this),e,i,n,s,r),this}recordBBox(t,e,i,n,s,r){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordBBox((0,zt.A)(Cl,this),e,i,n,s,r),this}recordCharacterBBox(t,e,i,n,s,r,a){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordCharacterBBox((0,zt.A)(Cl,this),e,i,n,s,r,a),this}recordFullPageBBox(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).recordFullPageBBox((0,zt.A)(Cl,this)),this}getSimpleIndex(t){return(0,zt.A)(kl,this).getSimpleIndex(t)}recordDependencies(t,e){return(0,zt.A)(kl,this).recordDependencies((0,zt.A)(Cl,this),e),this}recordNamedDependency(t,e){return(0,zt.A)(kl,this).recordNamedDependency((0,zt.A)(Cl,this),e),this}recordOperation(t){return(0,zt.A)(kl,this).recordOperation((0,zt.A)(Cl,this),!0),this}recordShowTextOperation(t){return(0,zt.A)(kl,this).recordShowTextOperation((0,zt.A)(Cl,this),!0),this}bboxToClipBoxDropOperation(t){return(0,zt.A)(Ml,this)||(0,zt.A)(kl,this).bboxToClipBoxDropOperation((0,zt.A)(Cl,this),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}}const Rl=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],Ll=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],Il=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],Fl=["filter","fillColor","fillAlpha"],Nl=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],Ol=["transform"],Bl=["transform","fillColor"],Wl="Fill",jl="Stroke",Ul="Shading";function zl(t,e){if(!e)return;const i=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],i,n),t.clip(s)}class Hl{isModifyingCurrentTransform(){return!1}getPattern(){De("Abstract method `getPattern` called.")}}class Vl extends Hl{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,n){let s;if(n===jl||n===Wl){const r=e.current.getClippedPathBoundingBox(n,vi(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,o=Math.ceil(r[3]-r[1])||1,l=e.cachedCanvases.getCanvas("pattern",a,o),c=l.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),i=Xe.transform(i,[1,0,0,1,r[0],r[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),zl(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(l.canvas,"no-repeat");const h=new DOMMatrix(i);s.setTransform(h)}else zl(t,this._bbox),s=this._createGradient(t);return s}}function Gl(t,e,i,n,s,r,a,o){const l=e.coords,c=e.colors,h=t.data,d=4*t.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u);const p=(l[i]+e.offsetX)*e.scaleX,A=(l[i+1]+e.offsetY)*e.scaleY,g=(l[n]+e.offsetX)*e.scaleX,f=(l[n+1]+e.offsetY)*e.scaleY,m=(l[s]+e.offsetX)*e.scaleX,v=(l[s+1]+e.offsetY)*e.scaleY;if(A>=v)return;const w=c[r],b=c[r+1],y=c[r+2],_=c[a],x=c[a+1],E=c[a+2],S=c[o],k=c[o+1],C=c[o+2],M=Math.round(A),T=Math.round(v);let P,D,R,L,I,F,N,O;for(let B=M;B<=T;B++){if(B<f){const t=B<A?0:(A-B)/(A-f);P=p-(p-g)*t,D=w-(w-_)*t,R=b-(b-x)*t,L=y-(y-E)*t}else{let t;t=B>v?1:f===v?0:(f-B)/(f-v),P=g-(g-m)*t,D=_-(_-S)*t,R=x-(x-k)*t,L=E-(E-C)*t}let t;t=B<A?0:B>v?1:(A-B)/(A-v),I=p-(p-m)*t,F=w-(w-S)*t,N=b-(b-k)*t,O=y-(y-C)*t;const e=Math.round(Math.min(P,I)),i=Math.round(Math.max(P,I));let n=d*B+4*e;for(let s=e;s<=i;s++)t=(P-s)/(P-I),t<0?t=0:t>1&&(t=1),h[n++]=D-(D-F)*t|0,h[n++]=R-(R-N)*t|0,h[n++]=L-(L-O)*t|0,h[n++]=255}}function ql(t,e,i){const n=e.coords,s=e.colors;let r,a;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(r=0;r<l;r++){let e=r*o;for(let r=0;r<c;r++,e++)Gl(t,i,n[e],n[e+1],n[e+o],s[e],s[e+1],s[e+o]),Gl(t,i,n[e+o+1],n[e+1],n[e+o],s[e+o+1],s[e+1],s[e+o])}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)Gl(t,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class Xl extends Hl{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3),c=r/o,h=a/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/c,scaleY:1/h},u=o+4,p=l+4,A=i.getCanvas("mesh",u,p),g=A.context,f=g.createImageData(o,l);if(e){const t=f.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const m of this._figures)ql(f,m,d);g.putImageData(f,2,2);return{canvas:A.canvas,offsetX:n-2*c,offsetY:s-2*h,scaleX:c,scaleY:h}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,n){zl(t,this._bbox);const s=new Float32Array(2);if(n===Ul)Xe.singularValueDecompose2dScale(vi(t),s);else if(this.matrix){Xe.singularValueDecompose2dScale(this.matrix,s);const[t,i]=s;Xe.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=t,s[1]*=i}else Xe.singularValueDecompose2dScale(e.baseTransform,s);const r=this._createMeshCanvas(s,n===Ul?null:this._background,e.cachedCanvases);return n!==Ul&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class Yl extends Hl{getPattern(){return"hotpink"}}const Kl=1,Ql=2;class Jl{constructor(t,e,i,n){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t,e){var i,n;const{bbox:s,operatorList:r,paintType:a,tilingType:o,color:l,canvasGraphicsFactory:c}=this;let{xstep:h,ystep:d}=this;h=Math.abs(h),d=Math.abs(d),Te("TilingType: "+o);const u=s[0],p=s[1],A=s[2],g=s[3],f=A-u,m=g-p,v=new Float32Array(2);Xe.singularValueDecompose2dScale(this.matrix,v);const[w,b]=v;Xe.singularValueDecompose2dScale(this.baseTransform,v);const y=w*v[0],_=b*v[1];let x=f,E=m,S=!1,k=!1;const C=Math.ceil(h*y),M=Math.ceil(d*_);C>=Math.ceil(f*y)?x=h:S=!0,M>=Math.ceil(m*_)?E=d:k=!0;const T=this.getSizeAndScale(x,this.ctx.canvas.width,y),P=this.getSizeAndScale(E,this.ctx.canvas.height,_),D=t.cachedCanvases.getCanvas("pattern",T.size,P.size),R=D.context,L=c.createCanvasGraphics(R,e);if(L.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(L,a,l),R.translate(-T.scale*u,-P.scale*p),L.transform(0,T.scale,0,0,P.scale,0,0),R.save(),null===(i=L.dependencyTracker)||void 0===i||i.save(),this.clipBbox(L,u,p,A,g),L.baseTransform=vi(L.ctx),L.executeOperatorList(r),L.endDrawing(),null===(n=L.dependencyTracker)||void 0===n||n.restore(),R.restore(),S||k){const e=D.canvas;S&&(x=h),k&&(E=d);const i=this.getSizeAndScale(x,this.ctx.canvas.width,y),n=this.getSizeAndScale(E,this.ctx.canvas.height,_),s=i.size,r=n.size,a=t.cachedCanvases.getCanvas("pattern-workaround",s,r),o=a.context,l=S?Math.floor(f/h):0,c=k?Math.floor(m/d):0;for(let t=0;t<=l;t++)for(let i=0;i<=c;i++)o.drawImage(e,s*t,r*i,s,r,0,0,s,r);return{canvas:a.canvas,scaleX:i.scale,scaleY:n.scale,offsetX:u,offsetY:p}}return{canvas:D.canvas,scaleX:T.scale,scaleY:P.scale,offsetX:u,offsetY:p}}getSizeAndScale(t,e,i){const n=Math.max(Jl.MAX_PATTERN_SIZE,e);let s=Math.ceil(t*i);return s>=n?s=n:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,n,s){const r=n-e,a=s-i;t.ctx.rect(e,i,r,a),Xe.axialAlignedBoundingBox([e,i,n,s],vi(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,s=t.current;switch(e){case Kl:const{fillStyle:t,strokeStyle:r}=this.ctx;n.fillStyle=s.fillColor=t,n.strokeStyle=s.strokeColor=r;break;case Ql:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new Ue("Unsupported paint type: ".concat(e))}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let r=i;n!==Ul&&(r=Xe.transform(r,e.baseTransform),this.matrix&&(r=Xe.transform(r,this.matrix)));const a=this.createPatternCanvas(e,s);let o=new DOMMatrix(r);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const l=t.createPattern(a.canvas,"repeat");return l.setTransform(o),l}}function Zl(t){let{src:e,srcPos:i=0,dest:n,width:s,height:r,nonBlackColor:a=4294967295,inverseDecode:o=!1}=t;const l=Ge.isLittleEndian?4278190080:255,[c,h]=o?[a,l]:[l,a],d=s>>3,u=7&s,p=e.length;n=new Uint32Array(n.buffer);let A=0;for(let g=0;g<r;g++){for(const s=i+d;i<s;i++){const t=i<p?e[i]:255;n[A++]=128&t?h:c,n[A++]=64&t?h:c,n[A++]=32&t?h:c,n[A++]=16&t?h:c,n[A++]=8&t?h:c,n[A++]=4&t?h:c,n[A++]=2&t?h:c,n[A++]=1&t?h:c}if(0===u)continue;const t=i<p?e[i++]:255;for(let e=0;e<u;e++)n[A++]=t&1<<7-e?h:c}return{srcPos:i,destPos:A}}(0,Vt.A)(Jl,"MAX_PATTERN_SIZE",3e3);const $l=16,tc=new DOMMatrix,ec=new Float32Array(2),ic=new Float32Array([1/0,1/0,-1/0,-1/0]);class nc{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function sc(t,e,i,n,s,r,a,o,l,c){const[h,d,u,p,A,g]=vi(t);if(0===d&&0===u){const f=a*h+A,m=Math.round(f),v=o*p+g,w=Math.round(v),b=(a+l)*h+A,y=Math.abs(Math.round(b)-m)||1,_=(o+c)*p+g,x=Math.abs(Math.round(_)-w)||1;return t.setTransform(Math.sign(h),0,0,Math.sign(p),m,w),t.drawImage(e,i,n,s,r,0,0,y,x),t.setTransform(h,d,u,p,A,g),[y,x]}if(0===h&&0===p){const f=o*u+A,m=Math.round(f),v=a*d+g,w=Math.round(v),b=(o+c)*u+A,y=Math.abs(Math.round(b)-m)||1,_=(a+l)*d+g,x=Math.abs(Math.round(_)-w)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,m,w),t.drawImage(e,i,n,s,r,0,0,x,y),t.setTransform(h,d,u,p,A,g),[x,y]}t.drawImage(e,i,n,s,r,a,o,l,c);return[Math.hypot(h,d)*l,Math.hypot(u,p)*c]}class rc{constructor(t,e,i){(0,Vt.A)(this,"alphaIsShape",!1),(0,Vt.A)(this,"fontSize",0),(0,Vt.A)(this,"fontSizeScale",1),(0,Vt.A)(this,"textMatrix",null),(0,Vt.A)(this,"textMatrixScale",1),(0,Vt.A)(this,"fontMatrix",Xt),(0,Vt.A)(this,"leading",0),(0,Vt.A)(this,"x",0),(0,Vt.A)(this,"y",0),(0,Vt.A)(this,"lineX",0),(0,Vt.A)(this,"lineY",0),(0,Vt.A)(this,"charSpacing",0),(0,Vt.A)(this,"wordSpacing",0),(0,Vt.A)(this,"textHScale",1),(0,Vt.A)(this,"textRenderingMode",oe),(0,Vt.A)(this,"textRise",0),(0,Vt.A)(this,"fillColor","#000000"),(0,Vt.A)(this,"strokeColor","#000000"),(0,Vt.A)(this,"patternFill",!1),(0,Vt.A)(this,"patternStroke",!1),(0,Vt.A)(this,"fillAlpha",1),(0,Vt.A)(this,"strokeAlpha",1),(0,Vt.A)(this,"lineWidth",1),(0,Vt.A)(this,"activeSMask",null),(0,Vt.A)(this,"transferMaps","none"),null===i||void 0===i||i(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=ic.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.minMax.slice();if(t===jl){e||De("Stroke bounding box must include transform."),Xe.singularValueDecompose2dScale(e,ec);const t=ec[0]*this.lineWidth/2,n=ec[1]*this.lineWidth/2;i[0]-=t,i[1]-=n,i[2]+=t,i[3]+=n}return i}updateClipFromPath(){const t=Xe.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(ic,0)}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Xe.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function ac(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,s=i%$l,r=(i-s)/$l,a=0===s?r:r+1,o=t.createImageData(n,$l);let l,c=0;const h=e.data,d=o.data;let u,p,A,g;if(e.kind===pe.GRAYSCALE_1BPP){const e=h.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),g=i.length,f=n+7>>3,m=4294967295,v=Ge.isLittleEndian?4278190080:255;for(u=0;u<a;u++){for(A=u<r?$l:s,l=0,p=0;p<A;p++){const t=e-c;let s=0;const r=t>f?n:8*t-7,a=-8&r;let o=0,d=0;for(;s<a;s+=8)d=h[c++],i[l++]=128&d?m:v,i[l++]=64&d?m:v,i[l++]=32&d?m:v,i[l++]=16&d?m:v,i[l++]=8&d?m:v,i[l++]=4&d?m:v,i[l++]=2&d?m:v,i[l++]=1&d?m:v;for(;s<r;s++)0===o&&(d=h[c++],o=128),i[l++]=d&o?m:v,o>>=1}for(;l<g;)i[l++]=0;t.putImageData(o,0,u*$l)}}else if(e.kind===pe.RGBA_32BPP){for(p=0,g=n*$l*4,u=0;u<r;u++)d.set(h.subarray(c,c+g)),c+=g,t.putImageData(o,0,p),p+=$l;u<a&&(g=n*s*4,d.set(h.subarray(c,c+g)),t.putImageData(o,0,p))}else{if(e.kind!==pe.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(A=$l,g=n*A,u=0;u<a;u++){for(u>=r&&(A=s,g=n*A),l=0,p=g;p--;)d[l++]=h[c++],d[l++]=h[c++],d[l++]=h[c++],d[l++]=255;t.putImageData(o,0,u*$l)}}}function oc(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,s=i%$l,r=(i-s)/$l,a=0===s?r:r+1,o=t.createImageData(n,$l);let l=0;const c=e.data,h=o.data;for(let d=0;d<a;d++){const e=d<r?$l:s;({srcPos:l}=Zl({src:c,srcPos:l,dest:h,width:n,height:e,nonBlackColor:0})),t.putImageData(o,0,d*$l)}}function lc(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of i)void 0!==t[n]&&(e[n]=t[n]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function cc(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0);const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function hc(t,e){if(e)return!0;Xe.singularValueDecompose2dScale(t,ec);const i=Math.fround(yi.pixelRatio*ri.PDF_TO_CSS_UNITS);return ec[0]<=i&&ec[1]<=i}const dc=["butt","round","square"],uc=["miter","round","bevel"],pc={},Ac={};var gc=new WeakSet;class fc{constructor(t,e,i,n,s,r,a,o,l){let{optionalContentConfig:c,markedContentStack:h=null}=r;(0,bt.A)(this,gc),this.ctx=t,this.current=new rc(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=n,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=h||[],this.optionalContentConfig=c,this.cachedCanvases=new nc(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=a,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=o,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=null!==l&&void 0!==l?l:null}getObject(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;var n;return"string"===typeof e?(null===(n=this.dependencyTracker)||void 0===n||n.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing(t){let{transform:e,viewport:i,transparency:n=!1,background:s=null}=t;const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,n){const t=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...vi(this.compositeCtx))}this.ctx.save(),cc(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=vi(this.ctx)}executeOperatorList(t,e,i,n,s){const r=t.argsArray,a=t.fnArray;let o=e||0;const l=r.length;if(l===o)return o;const c=l-o>10&&"function"===typeof i,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let A,g;for(;;){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,i),o;var f;if(!s||s(o))if(A=a[o],g=null!==(f=r[o])&&void 0!==f?f:null,A!==ye.dependency)null===g?this[A](o):this[A](o,...g);else for(const t of g){var m;null===(m=this.dependencyTracker)||void 0===m||m.recordNamedData(t,o);const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>h)return i(),o;d=0}}}endDrawing(){(0,_t.A)(gc,this,mc).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,_t.A)(gc,this,vc).call(this)}_scaleImage(t,e){var i,n;const s=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,r=null!==(n=t.height)&&void 0!==n?n:t.displayHeight;let a,o,l=Math.max(Math.hypot(e[0],e[1]),1),c=Math.max(Math.hypot(e[2],e[3]),1),h=s,d=r,u="prescale1";for(;l>2&&h>1||c>2&&d>1;){let e=h,i=d;l>2&&h>1&&(e=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),l/=h/e),c>2&&d>1&&(i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,c/=d/i),a=this.cachedCanvases.getCanvas(u,e,i),o=a.context,o.clearRect(0,0,e,i),o.drawImage(t,0,0,h,d,0,0,e,i),t=a.canvas,h=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:d}}_createMaskCanvas(t,e){var i;const n=this.ctx,{width:s,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,l=vi(n);let c,h,d,u;if((e.bitmap||e.data)&&e.count>1){const i=e.bitmap||e.data.buffer;h=JSON.stringify(o?l:[l.slice(0,4),a]),c=this._cachedBitmapsMap.get(i),c||(c=new Map,this._cachedBitmapsMap.set(i,c));const n=c.get(h);if(n&&!o){var p;const e=Math.round(Math.min(l[0],l[2])+l[4]),i=Math.round(Math.min(l[1],l[3])+l[5]);return null===(p=this.dependencyTracker)||void 0===p||p.recordDependencies(t,Bl),{canvas:n,offsetX:e,offsetY:i}}d=n}d||(u=this.cachedCanvases.getCanvas("maskCanvas",s,r),oc(u.context,e));let A=Xe.transform(l,[1/s,0,0,-1/r,0,0]);A=Xe.transform(A,[1,0,0,1,0,-r]);const g=ic.slice();Xe.axialAlignedBoundingBox([0,0,s,r],A,g);const[f,m,v,w]=g,b=Math.round(v-f)||1,y=Math.round(w-m)||1,_=this.cachedCanvases.getCanvas("fillCanvas",b,y),x=_.context,E=f,S=m;x.translate(-E,-S),x.transform(...A),d||(d=this._scaleImage(u.canvas,wi(x)),d=d.img,c&&o&&c.set(h,d)),x.imageSmoothingEnabled=hc(vi(x),e.interpolate),sc(x,d,0,0,d.width,d.height,0,0,s,r),x.globalCompositeOperation="source-in";const k=Xe.transform(wi(x),[1,0,0,1,-E,-S]);return x.fillStyle=o?a.getPattern(n,this,k,Wl,t):a,x.fillRect(0,0,s,r),c&&!o&&(this.cachedCanvases.delete("fillCanvas"),c.set(h,_.canvas)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Bl),{canvas:_.canvas,offsetX:Math.round(E),offsetY:Math.round(S)}}setLineWidth(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineCap",t),this.ctx.lineCap=dc[e]}setLineJoin(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("lineJoin",t),this.ctx.lineJoin=uc[e]}setMiterLimit(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("dash",t);const s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(e),s.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var i,n,s,r,a;for(const[o,l]of e)switch(o){case"LW":this.setLineWidth(t,l);break;case"LC":this.setLineCap(t,l);break;case"LJ":this.setLineJoin(t,l);break;case"ML":this.setMiterLimit(t,l);break;case"D":this.setDash(t,l[0],l[1]);break;case"RI":this.setRenderingIntent(t,l);break;case"FL":this.setFlatness(t,l);break;case"Font":this.setFont(t,l[0],l[1]);break;case"CA":null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=l;break;case"ca":null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=l;break;case"BM":null===(s=this.dependencyTracker)||void 0===s||s.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=l;break;case"SMask":null===(r=this.dependencyTracker)||void 0===r||r.recordSimpleData("SMask",t),this.current.activeSMask=l?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":null===(a=this.dependencyTracker)||void 0===a||a.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(l)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,i);this.suspendedCtx=this.ctx;const r=this.ctx=s.context;r.setTransform(this.suspendedCtx.getTransform()),lc(this.suspendedCtx,r),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,s,r,a){e.transform(t,i,n,s,r,a),this.__originalTransform(t,i,n,s,r,a)},t.setTransform=function(t,i,n,s,r,a){e.setTransform(t,i,n,s,r,a),this.__originalSetTransform(t,i,n,s,r,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,s,r,a){e.bezierCurveTo(t,i,n,s,r,a),this.__originalBezierCurveTo(t,i,n,s,r,a)},t.rect=function(t,i,n,s){e.rect(t,i,n,s),this.__originalRect(t,i,n,s)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(r,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),lc(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;0!==a&&0!==o&&(this.genericComposeSMask(e.context,i,a,o,e.subtype,e.backdrop,e.transferMap,s,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,r,a,o,l,c,h){let d=t.canvas,u=o-c,p=l-h;if(r)if(u<0||p<0||u+i>d.width||p+n>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,n),e=t.context;e.drawImage(d,-u,-p),e.globalCompositeOperation="destination-atop",e.fillStyle=r,e.fillRect(0,0,i,n),e.globalCompositeOperation="source-over",d=t.canvas,u=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,n),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=r,t.fillRect(u,p,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(a));const A=new Path2D;A.rect(o,l,i,n),e.clip(A),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,n,o,l,i,n),e.restore()}save(t){var e;this.inSMaskMode&&lc(this.ctx,this.suspendedCtx),this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone(),null===(e=this.dependencyTracker)||void 0===e||e.save(t)}restore(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.restore(t),0!==this.stateStack.length?(this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&lc(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null):this.inSMaskMode&&this.endSMaskMode()}transform(t,e,i,n,s,r,a){var o;null===(o=this.dependencyTracker)||void 0===o||o.recordIncrementalData("transform",t),this.ctx.transform(e,i,n,s,r,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,n){let[s]=i;if(!n)return s||(s=i[0]=new Path2D),void this[e](t,s);if(null!==this.dependencyTracker){const i=e===ye.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,n[0]-i,n[2]+i,n[1]-i,n[3]+i).recordDependencies(t,["transform"])}if(!(s instanceof Path2D)){const t=i[0]=new Path2D;for(let e=0,i=s.length;e<i;)switch(s[e++]){case _e:t.moveTo(s[e++],s[e++]);break;case xe:t.lineTo(s[e++],s[e++]);break;case Ee:t.bezierCurveTo(s[e++],s[e++],s[e++],s[e++],s[e++],s[e++]);break;case Se:t.closePath();break;default:Pe("Unrecognized drawing path operator: ".concat(s[e-1]))}s=t}Xe.axialAlignedBoundingBox(n,vi(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e){var i;let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,r=this.current.strokeColor;if(s.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"===typeof r&&null!==r&&void 0!==r&&r.getPattern){const i=r.isModifyingCurrentTransform()?s.getTransform():null;if(s.save(),s.strokeStyle=r.getPattern(s,this,wi(s),jl,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}this.rescaleAndStroke(e,!1),s.restore()}else this.rescaleAndStroke(e,!0);null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Rl),n&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(jl,vi(this.ctx))),s.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e){var i;let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.ctx,r=this.current.fillColor;let a=!1;if(this.current.patternFill){var o;const i=r.isModifyingCurrentTransform()?s.getTransform():null;if(null===(o=this.dependencyTracker)||void 0===o||o.save(t),s.save(),s.fillStyle=r.getPattern(s,this,wi(s),Wl,t),i){const t=new Path2D;t.addPath(e,s.getTransform().invertSelf().multiplySelf(i)),e=t}a=!0}const l=this.current.getClippedPathBoundingBox();var c;(this.contentVisible&&null!==l&&(this.pendingEOFill?(s.fill(e,"evenodd"),this.pendingEOFill=!1):s.fill(e)),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Ll),a)&&(s.restore(),null===(c=this.dependencyTracker)||void 0===c||c.restore(t));n&&this.consumePath(t,e,l)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var i;this.ctx.fill(e),null===(i=this.dependencyTracker)||void 0===i||i.recordDependencies(t,Fl).recordOperation(t)}clip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=pc}eoClip(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=Ac}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,null===(e=this.dependencyTracker)||void 0===e||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){const t=new Path2D,n=i.getTransform().invertSelf();for(const{transform:i,x:s,y:r,fontSize:a,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(n).translate(s,r).scale(a,-a));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){var n,s;null===(n=this.dependencyTracker)||void 0===n||n.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const r=this.commonObjs.get(e),a=this.current;if(!r)throw new Error("Can't find font for ".concat(e));if(a.fontMatrix=r.fontMatrix||Xt,0!==a.fontMatrix[0]&&0!==a.fontMatrix[3]||Pe("Invalid font matrix for font "+e),i<0?(i=-i,a.fontDirection=-1):a.fontDirection=1,this.current.font=r,this.current.fontSize=i,r.isType3Font)return;const o=r.loadedName||"sans-serif",l=(null===(s=r.systemFontInfo)||void 0===s?void 0:s.css)||'"'.concat(o,'", ').concat(r.fallbackName);let c="normal";r.black?c="900":r.bold&&(c="bold");const h=r.italic?"italic":"normal";let d=i;i<16?d=16:i>100&&(d=100),this.current.fontSizeScale=i/d,this.ctx.font="".concat(h," ").concat(c," ").concat(d,"px ").concat(l)}setTextRenderingMode(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("textMatrix",t);const{current:n}=this;n.textMatrix=e,n.textMatrixScale=Math.hypot(e[0],e[1]),n.x=n.lineX=0,n.y=n.lineY=0}nextLine(t){var e,i;this.moveText(t,0,this.current.leading),null===(e=this.dependencyTracker)||void 0===e||e.recordIncrementalData("moveText",null!==(i=this.dependencyTracker.getSimpleIndex("leading"))&&void 0!==i?i:t)}paintChar(t,e,i,n,s,r){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&de,u=!!(c&ue),p=o.patternFill&&!l.missingFile,A=o.patternStroke&&!l.missingFile;let g;if((l.disableFontFace||u||p||A)&&!l.missingFile&&(g=l.getPathGenerator(this.commonObjs,e)),g&&(l.disableFontFace||p||A)){var f;let e;if(a.save(),a.translate(i,n),a.scale(h,-h),null===(f=this.dependencyTracker)||void 0===f||f.recordCharacterBBox(t,a,l),d===oe||d===ce)if(s){e=a.getTransform(),a.setTransform(...s);const t=(0,_t.A)(gc,this,wc).call(this,g,e,s);a.fill(t)}else a.fill(g);if(d===le||d===ce)if(r){e||(e=a.getTransform()),a.setTransform(...r);const{a:t,b:i,c:n,d:s}=e,o=Xe.inverseTransform(r),l=Xe.transform([t,i,n,s,0,0],o);Xe.singularValueDecompose2dScale(l,ec),a.lineWidth*=Math.max(ec[0],ec[1])/h,a.stroke((0,_t.A)(gc,this,wc).call(this,g,e,r))}else a.lineWidth/=h,a.stroke(g);a.restore()}else{var m;if(d===oe||d===ce)a.fillText(e,i,n),null===(m=this.dependencyTracker)||void 0===m||m.recordCharacterBBox(t,a,l,h,i,n,()=>a.measureText(e));if(d===le||d===ce){var v;if(this.dependencyTracker)null===(v=this.dependencyTracker)||void 0===v||v.recordCharacterBBox(t,a,l,h,i,n,()=>a.measureText(e)).recordDependencies(t,Rl);a.strokeText(e,i,n)}}if(u){var w;(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:vi(a),x:i,y:n,fontSize:h,path:g}),null===(w=this.dependencyTracker)||void 0===w||w.recordCharacterBBox(t,a,l,h,i,n)}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n<e.length;n+=4)if(e[n]>0&&e[n]<255){i=!0;break}return Fe(this,"isFontSubpixelAAEnabled",i)}showText(t,e){var i;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Nl).resetBBox(t),this.current.textRenderingMode&ue&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const n=this.current,s=n.font;var r;if(s.isType3Font)return this.showType3Text(t,e),void(null===(r=this.dependencyTracker)||void 0===r||r.recordShowTextOperation(t));const a=n.fontSize;var o;if(0===a)return void(null===(o=this.dependencyTracker)||void 0===o||o.recordOperation(t));const l=this.ctx,c=n.fontSizeScale,h=n.charSpacing,d=n.wordSpacing,u=n.fontDirection,p=n.textHScale*u,A=e.length,g=s.vertical,f=g?1:-1,m=s.defaultVMetrics,v=a*n.fontMatrix[0],w=n.textRenderingMode===oe&&!s.disableFontFace&&!n.patternFill;let b,y;if(l.save(),n.textMatrix&&l.transform(...n.textMatrix),l.translate(n.x,n.y+n.textRise),u>0?l.scale(p,-1):l.scale(p,1),n.patternFill){l.save();const e=n.fillColor.getPattern(l,this,wi(l),Wl,t);b=vi(l),l.restore(),l.fillStyle=e}if(n.patternStroke){l.save();const e=n.strokeColor.getPattern(l,this,wi(l),jl,t);y=vi(l),l.restore(),l.strokeStyle=e}let _=n.lineWidth;const x=n.textMatrixScale;if(0===x||0===_){const t=n.textRenderingMode&de;t!==le&&t!==ce||(_=this.getSinglePixelWidth())}else _/=x;if(1!==c&&(l.scale(c,c),_/=c),l.lineWidth=_,s.isInvalidPDFjsFont){const i=[];let s=0;for(const t of e)i.push(t.unicode),s+=t.width;const r=i.join("");if(l.fillText(r,0,0),null!==this.dependencyTracker){const e=l.measureText(r);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}return n.x+=s*v*p,l.restore(),void this.compose()}let E,S=0;for(E=0;E<A;++E){const i=e[E];if("number"===typeof i){S+=f*i*a/1e3;continue}let n=!1;const r=(i.isSpace?d:0)+h,o=i.fontChar,p=i.accent;let A,_,x,C=i.width;if(g){const t=i.vmetric||m,e=-(i.vmetric?t[1]:.5*C)*v,n=t[2]*v;C=t?-t[0]:C,A=e/c,_=(S+n)/c}else A=S/c,_=0;if(s.remeasure&&C>0){x=l.measureText(o);const t=1e3*x.width/a*c;if(C<t&&this.isFontSubpixelAAEnabled){const e=C/t;n=!0,l.save(),l.scale(e,1),A/=e}else C!==t&&(A+=(C-t)/2e3*a/c)}var k;if(this.contentVisible&&(i.isInFont||s.missingFile))if(w&&!p)l.fillText(o,A,_),null===(k=this.dependencyTracker)||void 0===k||k.recordCharacterBBox(t,l,x?{bbox:null}:s,a/c,A,_,()=>null!==x&&void 0!==x?x:l.measureText(o));else if(this.paintChar(t,o,A,_,b,y),p){const e=A+a*p.offset.x/c,i=_-a*p.offset.y/c;this.paintChar(t,p.fontChar,e,i,b,y)}S+=g?C*v-r*u:C*v+r*u,n&&l.restore()}g?n.y-=S:n.x+=S*p,l.restore(),this.compose(),null===(i=this.dependencyTracker)||void 0===i||i.recordShowTextOperation(t)}showType3Text(t,e){const i=this.ctx,n=this.current,s=n.font,r=n.fontSize,a=n.fontDirection,o=s.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,h=n.textHScale*a,d=n.fontMatrix||Xt,u=e.length;let p,A,g,f;if(n.textRenderingMode===he||0===r)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),n.textMatrix&&i.transform(...n.textMatrix),i.translate(n.x,n.y+n.textRise),i.scale(h,a);const m=this.dependencyTracker;for(this.dependencyTracker=m?new Dl(m,t):null,p=0;p<u;++p){if(A=e[p],"number"===typeof A){f=o*A*r/1e3,this.ctx.translate(f,0),n.x+=f*h;continue}const t=(A.isSpace?c:0)+l,a=s.charProcOperatorList[A.operatorListId];a?this.contentVisible&&(this.save(),i.scale(r,r),i.transform(...d),this.executeOperatorList(a),this.restore()):Pe('Type3 character "'.concat(A.operatorListId,'" is not available.'));const u=[A.width,0];Xe.applyTransform(u,d),g=u[0]*r+t,i.translate(g,0),n.x+=g*h}i.restore(),m&&(this.dependencyTracker=m)}setCharWidth(t,e,i){}setCharWidthAndBounds(t,e,i,n,s,r,a){var o;const l=new Path2D;l.rect(n,s,r-n,a-s),this.ctx.clip(l),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,this.ctx,n,r,s,a).recordClipBox(t,this.ctx,n,r,s,a),this.endPath(t)}getColorN_Pattern(t,e){let i;if("TilingPattern"===e[0]){const t=this.baseTransform||vi(this.ctx),n={createCanvasGraphics:(t,e)=>new fc(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Dl(this.dependencyTracker,e,!0):null)};i=new Jl(e,this.ctx,n,t)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("strokeColor",t);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];this.current.strokeColor=this.getColorN_Pattern(t,n),this.current.patternStroke=!0}setFillColorN(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("fillColor",t);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];this.current.fillColor=this.getColorN_Pattern(t,n),this.current.patternFill=!0}setStrokeRGBColor(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=function(t){switch(t[0]){case"RadialAxial":return new Vl(t);case"Mesh":return new Xl(t);case"Dummy":return new Yl}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t,e)),this.cachedPatterns.set(e,i)),n&&(i.matrix=n),i}shadingFill(t,e){var i;if(!this.contentVisible)return;const n=this.ctx;this.save(t);const s=this._getPattern(t,e);n.fillStyle=s.getPattern(n,this,wi(n),Ul,t);const r=wi(n);if(r){const{width:t,height:e}=n.canvas,i=ic.slice();Xe.axialAlignedBoundingBox([0,0,t,e],r,i);const[s,a,o,l]=i;this.ctx.fillRect(s,a,o-s,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Ol).recordDependencies(t,Ll).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){De("Should not call beginInlineImage")}beginImageData(){De("Should not call beginImageData")}paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=vi(this.ctx),i)){var n;Xe.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[e,s,r,a]=i,o=new Path2D;o.rect(e,s,r-e,a-s),this.ctx.clip(o),null===(n=this.dependencyTracker)||void 0===n||n.recordClipBox(t,this.ctx,e,r,s,a),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var i;if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const n=this.ctx;e.isolated||Te("TODO: Support non-isolated groups."),e.knockout&&Pe("Knockout groups not supported.");const s=vi(n);if(e.matrix&&n.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=ic.slice();Xe.axialAlignedBoundingBox(e.bbox,vi(n),r);const a=[0,0,n.canvas.width,n.canvas.height];r=Xe.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),l=Math.floor(r[1]),c=Math.max(Math.ceil(r[2])-o,1),h=Math.max(Math.ceil(r[3])-l,1);this.current.startNewPathAndClipBox([0,0,c,h]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(d,c,h),p=u.context;p.translate(-o,-l),p.transform(...s);let A=new Path2D;const[g,f,m,v]=e.bbox;if(A.rect(g,f,m-g,v-f),e.matrix){const t=new Path2D;t.addPath(A,new DOMMatrix(e.matrix)),A=t}p.clip(A),e.smask&&this.smaskStack.push({canvas:u.canvas,context:p,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),e.smask&&!this.dependencyTracker||(n.setTransform(1,0,0,1,0,0),n.translate(o,l),n.save()),lc(n,p),this.ctx=p,null===(i=this.dependencyTracker)||void 0===i||i.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){var i;if(!this.contentVisible)return;this.groupLevel--;const n=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,null===(i=this.dependencyTracker)||void 0===i||i.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const e=vi(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);const i=ic.slice();Xe.axialAlignedBoundingBox([0,0,n.canvas.width,n.canvas.height],e,i),this.ctx.drawImage(n.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,n,s,r){if((0,_t.A)(gc,this,mc).call(this),cc(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const s=i[2]-i[0],a=i[3]-i[1];if(r&&this.annotationCanvasMap){(n=n.slice())[4]-=i[0],n[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=s,i[3]=a,Xe.singularValueDecompose2dScale(vi(this.ctx),ec);const{viewportScale:t}=this,r=Math.ceil(s*this.outputScaleX*t),o=Math.ceil(a*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(r,o);const{canvas:l,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(ec[0],0,0,-ec[1],0,a*ec[1]),cc(this.ctx)}else{cc(this.ctx),this.endPath(t);const e=new Path2D;e.rect(i[0],i[1],s,a),this.ctx.clip(e)}}this.current=new rc(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...n),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),(0,_t.A)(gc,this,vc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){var i;if(!this.contentVisible)return;const n=e.count;(e=this.getObject(t,e.data,e)).count=n;const s=this.ctx,r=this._createMaskCanvas(t,e),a=r.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,r.offsetX,r.offsetY),null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+a.width,r.offsetY,r.offsetY+a.height).recordOperation(t),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i){var n,s;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const c=this.ctx;c.save();const h=vi(c);c.transform(i,r,a,o,0,0);const d=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]),null===(n=this.dependencyTracker)||void 0===n||n.resetBBox(t);for(let p=0,A=l.length;p<A;p+=2){var u;const e=Xe.transform(h,[i,r,a,o,l[p],l[p+1]]);c.drawImage(d.canvas,e[4],e[5]),null===(u=this.dependencyTracker)||void 0===u||u.recordBBox(t,this.ctx,e[4],e[4]+d.canvas.width,e[5],e[5]+d.canvas.height)}c.restore(),this.compose(),null===(s=this.dependencyTracker)||void 0===s||s.recordOperation(t)}paintImageMaskXObjectGroup(t,e){var i,n;if(!this.contentVisible)return;const s=this.ctx,r=this.current.fillColor,a=this.current.patternFill;null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordDependencies(t,Bl);for(const l of e){var o;const{data:e,width:i,height:n,transform:c}=l,h=this.cachedCanvases.getCanvas("maskCanvas",i,n),d=h.context;d.save();oc(d,this.getObject(t,e,l)),d.globalCompositeOperation="source-in",d.fillStyle=a?r.getPattern(d,this,wi(s),Wl,t):r,d.fillRect(0,0,i,n),d.restore(),s.save(),s.transform(...c),s.scale(1,-1),sc(s,h.canvas,0,0,i,n,0,-1,1,1),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,s,0,i,0,n),s.restore()}this.compose(),null===(n=this.dependencyTracker)||void 0===n||n.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;const i=this.getObject(t,e);i?this.paintInlineImageXObject(t,i):Pe("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n,s){if(!this.contentVisible)return;const r=this.getObject(t,e);if(!r)return void Pe("Dependent image isn't ready yet");const a=r.width,o=r.height,l=[];for(let c=0,h=s.length;c<h;c+=2)l.push({transform:[i,0,0,n,s[c],s[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(t,r,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:n}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",s.canvas}paintInlineImageXObject(t,e){var i;if(!this.contentVisible)return;const n=e.width,s=e.height,r=this.ctx;this.save(t);const{filter:a}=r;let o;if("none"!==a&&""!==a&&(r.filter="none"),r.scale(1/n,-1/s),e.bitmap)o=this.applyTransferMapsToBitmap(e);else if("function"===typeof HTMLElement&&e instanceof HTMLElement||!e.data)o=e;else{const t=this.cachedCanvases.getCanvas("inlineImage",n,s).context;ac(t,e),o=this.applyTransferMapsToCanvas(t)}const l=this._scaleImage(o,wi(r));r.imageSmoothingEnabled=hc(vi(r),e.interpolate),null===(i=this.dependencyTracker)||void 0===i||i.resetBBox(t).recordBBox(t,r,0,n,-s,0).recordDependencies(t,Il).recordOperation(t),sc(r,l.img,0,0,l.paintWidth,l.paintHeight,0,-s,n,s),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){var n,s;if(!this.contentVisible)return;const r=this.ctx;let a;if(e.bitmap)a=e.bitmap;else{const t=e.width,i=e.height,n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;ac(n,e),a=this.applyTransferMapsToCanvas(n)}null===(n=this.dependencyTracker)||void 0===n||n.resetBBox(t);for(const l of i){var o;r.save(),r.transform(...l.transform),r.scale(1,-1),sc(r,a,l.x,l.y,l.w,l.h,0,-1,1,1),null===(o=this.dependencyTracker)||void 0===o||o.recordBBox(t,r,0,1,-1,0),r.restore()}null===(s=this.dependencyTracker)||void 0===s||s.recordOperation(t),this.compose()}paintSolidColorImageMask(t){var e;this.contentVisible&&(null===(e=this.dependencyTracker)||void 0===e||e.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Ll).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,i){}beginMarkedContent(t,e){var i;null===(i=this.dependencyTracker)||void 0===i||i.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){var n;null===(n=this.dependencyTracker)||void 0===n||n.beginMarkedContent(t),"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;null===(e=this.dependencyTracker)||void 0===e||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){const n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const s=this.ctx;var r,a;this.pendingClip?(n||(this.pendingClip===Ac?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,null===(r=this.dependencyTracker)||void 0===r||r.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):null===(a=this.dependencyTracker)||void 0===a||a.recordOperation(t);this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=vi(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:n,d:s}=this.ctx.getTransform();let r,a;if(0===i&&0===n){const i=Math.abs(e),n=Math.abs(s);if(i===n)if(0===t)r=a=1/i;else{const e=i*t;r=a=e<1?1/e:1}else if(0===t)r=1/i,a=1/n;else{const e=i*t,s=n*t;r=e<1?1/e:1,a=s<1?1/s:1}}else{const o=Math.abs(e*s-i*n),l=Math.hypot(e,i),c=Math.hypot(n,s);if(0===t)r=c/o,a=l/o;else{const e=t*o;r=c>e?c/e:1,a=l>e?l/e:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:n}}=this,[s,r]=this.getScaleForStroking();if(s===r)return i.lineWidth=(n||1)*s,void i.stroke(t);const a=i.getLineDash();e&&i.save(),i.scale(s,r),tc.a=1/s,tc.d=1/r;const o=new Path2D;if(o.addPath(t,tc),a.length>0){const t=Math.max(s,r);i.setLineDash(a.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=n||1,i.stroke(o),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function mc(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function vc(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}function wc(t,e,i){const n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n}for(const f_ in ye)void 0!==fc.prototype[f_]&&(fc.prototype[ye[f_]]=fc.prototype[f_]);var bc=new WeakMap,yc=new WeakMap,_c=new WeakMap,xc=new WeakSet;class Ec{static write(t){const e=new TextEncoder,i={};let n=0;for(const l of Ec.strings){const s=e.encode(t[l]);i[l]=s,n+=4+s.length}const s=new ArrayBuffer(n),r=new Uint8Array(s),a=new DataView(s);let o=0;for(const l of Ec.strings){const t=i[l],e=t.length;a.setUint32(o,e),r.set(t,o+4),o+=4+e}return Re(o===s.byteLength,"CssFontInfo.write: Buffer overflow"),s}constructor(t){(0,bt.A)(this,xc),(0,yt.A)(this,bc,void 0),(0,yt.A)(this,yc,void 0),(0,yt.A)(this,_c,void 0),(0,Ht.A)(bc,this,t),(0,Ht.A)(yc,this,new DataView((0,zt.A)(bc,this))),(0,Ht.A)(_c,this,new TextDecoder)}get fontFamily(){return(0,_t.A)(xc,this,Sc).call(this,0)}get fontWeight(){return(0,_t.A)(xc,this,Sc).call(this,1)}get italicAngle(){return(0,_t.A)(xc,this,Sc).call(this,2)}}function Sc(t){Re(t<Tt.strings.length,"Invalid string index");let e=0;for(let n=0;n<t;n++)e+=(0,zt.A)(yc,this).getUint32(e)+4;const i=(0,zt.A)(yc,this).getUint32(e);return(0,zt.A)(_c,this).decode(new Uint8Array((0,zt.A)(bc,this),e+4,i))}Tt=Ec,(0,Vt.A)(Ec,"strings",["fontFamily","fontWeight","italicAngle"]);var kc=new WeakMap,Cc=new WeakMap,Mc=new WeakMap,Tc=new WeakSet;class Pc{static write(t){const e=new TextEncoder,i={};let n=0;for(const d of Pc.strings){const s=e.encode(t[d]);i[d]=s,n+=4+s.length}n+=4;let s,r,a=1+n;t.style&&(s=e.encode(t.style.style),r=e.encode(t.style.weight),a+=4+s.length+4+r.length);const o=new ArrayBuffer(a),l=new Uint8Array(o),c=new DataView(o);let h=0;c.setUint8(h++,t.guessFallback?1:0),c.setUint32(h,0),h+=4,n=0;for(const d of Pc.strings){const t=i[d],e=t.length;n+=4+e,c.setUint32(h,e),l.set(t,h+4),h+=4+e}return c.setUint32(h-n-4,n),t.style&&(c.setUint32(h,s.length),l.set(s,h+4),h+=4+s.length,c.setUint32(h,r.length),l.set(r,h+4),h+=4+r.length),Re(h<=o.byteLength,"SubstitionInfo.write: Buffer overflow"),o.transferToFixedLength(h)}constructor(t){(0,bt.A)(this,Tc),(0,yt.A)(this,kc,void 0),(0,yt.A)(this,Cc,void 0),(0,yt.A)(this,Mc,void 0),(0,Ht.A)(kc,this,t),(0,Ht.A)(Cc,this,new DataView((0,zt.A)(kc,this))),(0,Ht.A)(Mc,this,new TextDecoder)}get guessFallback(){return 0!==(0,zt.A)(Cc,this).getUint8(0)}get css(){return(0,_t.A)(Tc,this,Dc).call(this,0)}get loadedName(){return(0,_t.A)(Tc,this,Dc).call(this,1)}get baseFontName(){return(0,_t.A)(Tc,this,Dc).call(this,2)}get src(){return(0,_t.A)(Tc,this,Dc).call(this,3)}get style(){let t=1;t+=4+(0,zt.A)(Cc,this).getUint32(t);const e=(0,zt.A)(Cc,this).getUint32(t),i=(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),t+4,e));t+=4+e;const n=(0,zt.A)(Cc,this).getUint32(t);return{style:i,weight:(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),t+4,n))}}}function Dc(t){Re(t<Pt.strings.length,"Invalid string index");let e=5;for(let n=0;n<t;n++)e+=(0,zt.A)(Cc,this).getUint32(e)+4;const i=(0,zt.A)(Cc,this).getUint32(e);return(0,zt.A)(Mc,this).decode(new Uint8Array((0,zt.A)(kc,this),e+4,i))}Pt=Pc,(0,Vt.A)(Pc,"strings",["css","loadedName","baseFontName","src"]);var Rc=new WeakMap,Lc=new WeakMap,Ic=new WeakMap,Fc=new WeakSet;class Nc{constructor(t){let{data:e,extra:i}=t;(0,bt.A)(this,Fc),(0,yt.A)(this,Rc,void 0),(0,yt.A)(this,Lc,void 0),(0,yt.A)(this,Ic,void 0),(0,Ht.A)(Rc,this,e),(0,Ht.A)(Lc,this,new TextDecoder),(0,Ht.A)(Ic,this,new DataView((0,zt.A)(Rc,this))),i&&Object.assign(this,i)}get black(){return(0,_t.A)(Fc,this,Oc).call(this,0)}get bold(){return(0,_t.A)(Fc,this,Oc).call(this,1)}get disableFontFace(){return(0,_t.A)(Fc,this,Oc).call(this,2)}get fontExtraProperties(){return(0,_t.A)(Fc,this,Oc).call(this,3)}get isInvalidPDFjsFont(){return(0,_t.A)(Fc,this,Oc).call(this,4)}get isType3Font(){return(0,_t.A)(Fc,this,Oc).call(this,5)}get italic(){return(0,_t.A)(Fc,this,Oc).call(this,6)}get missingFile(){return(0,_t.A)(Fc,this,Oc).call(this,7)}get remeasure(){return(0,_t.A)(Fc,this,Oc).call(this,8)}get vertical(){return(0,_t.A)(Fc,this,Oc).call(this,9)}get ascent(){return(0,_t.A)(Fc,this,Bc).call(this,0)}get defaultWidth(){return(0,_t.A)(Fc,this,Bc).call(this,1)}get descent(){return(0,_t.A)(Fc,this,Bc).call(this,2)}get bbox(){let t=Uc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<4;i++)e.push((0,zt.A)(Ic,this).getInt16(t,!0)),t+=2;return e}get fontMatrix(){let t=zc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<6;i++)e.push((0,zt.A)(Ic,this).getFloat64(t,!0)),t+=8;return e}get defaultVMetrics(){let t=Hc._;if(0===(0,zt.A)(Ic,this).getUint8(t))return;t+=1;const e=[];for(let i=0;i<3;i++)e.push((0,zt.A)(Ic,this).getInt16(t,!0)),t+=2;return e}get fallbackName(){return(0,_t.A)(Fc,this,Wc).call(this,0)}get loadedName(){return(0,_t.A)(Fc,this,Wc).call(this,1)}get mimetype(){return(0,_t.A)(Fc,this,Wc).call(this,2)}get name(){return(0,_t.A)(Fc,this,Wc).call(this,3)}get data(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0!==e)return new Uint8Array((0,zt.A)(Rc,this),t+4,e)}clearData(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);new Uint8Array((0,zt.A)(Rc,this),t+4,e).fill(0),(0,zt.A)(Ic,this).setUint32(t,0)}get cssFontInfo(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array((0,zt.A)(Rc,this),t+4,e)),new Ec(i.buffer)}get systemFontInfo(){let t=Vc._;t+=4+(0,zt.A)(Ic,this).getUint32(t);const e=(0,zt.A)(Ic,this).getUint32(t);if(0===e)return null;const i=new Uint8Array(e);return i.set(new Uint8Array((0,zt.A)(Rc,this),t+4,e)),new Pc(i.buffer)}static write(t){const e=t.systemFontInfo?Pc.write(t.systemFontInfo):null,i=t.cssFontInfo?Ec.write(t.cssFontInfo):null,n=new TextEncoder,s={};let r=0;for(const A of Nc.strings)s[A]=n.encode(t[A]),r+=4+s[A].length;const a=Vc._+4+r+4+(e?e.byteLength:0)+4+(i?i.byteLength:0)+4+(t.data?t.data.length:0),o=new ArrayBuffer(a),l=new Uint8Array(o),c=new DataView(o);let h=0;const d=Nc.bools.length;let u=0,p=0;for(let A=0;A<d;A++){const e=t[Nc.bools[A]];u|=(void 0===e?0:e?2:1)<<p,p+=2,8!==p&&A!==d-1||(c.setUint8(h++,u),u=0,p=0)}Re(h===jc._,"FontInfo.write: Boolean properties offset mismatch");for(const A of Nc.numbers)c.setFloat64(h,t[A]),h+=8;if(Re(h===Uc._,"FontInfo.write: Number properties offset mismatch"),t.bbox){c.setUint8(h++,4);for(const e of t.bbox)c.setInt16(h,e,!0),h+=2}else c.setUint8(h++,0),h+=8;if(Re(h===zc._,"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix){c.setUint8(h++,6);for(const e of t.fontMatrix)c.setFloat64(h,e,!0),h+=8}else c.setUint8(h++,0),h+=48;if(Re(h===Hc._,"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics){c.setUint8(h++,1);for(const e of t.defaultVMetrics)c.setInt16(h,e,!0),h+=2}else c.setUint8(h++,0),h+=6;Re(h===Vc._,"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(Vc._,0),h+=4;for(const A of Nc.strings){const t=s[A],e=t.length;c.setUint32(h,e),l.set(t,h+4),h+=4+e}if(c.setUint32(Vc._,h-Vc._-4),e){const t=e.byteLength;c.setUint32(h,t),Re(h+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),l.set(new Uint8Array(e),h+4),h+=4+t}else c.setUint32(h,0),h+=4;if(i){const t=i.byteLength;c.setUint32(h,t),Re(h+4+t<=o.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),l.set(new Uint8Array(i),h+4),h+=4+t}else c.setUint32(h,0),h+=4;return void 0===t.data?(c.setUint32(h,0),h+=4):(c.setUint32(h,t.data.length),l.set(t.data,h+4),h+=4+t.data.length),Re(h<=o.byteLength,"FontInfo.write: Buffer overflow"),o.transferToFixedLength(h)}}function Oc(t){Re(t<Dt.bools.length,"Invalid boolean index");const e=Math.floor(t/4),i=2*t%8,n=(0,zt.A)(Ic,this).getUint8(e)>>i&3;return 0===n?void 0:2===n}function Bc(t){return Re(t<Dt.numbers.length,"Invalid number index"),(0,zt.A)(Ic,this).getFloat64(jc._+8*t)}function Wc(t){Re(t<Dt.strings.length,"Invalid string index");let e=Vc._+4;for(let s=0;s<t;s++)e+=(0,zt.A)(Ic,this).getUint32(e)+4;const i=(0,zt.A)(Ic,this).getUint32(e),n=new Uint8Array(i);return n.set(new Uint8Array((0,zt.A)(Rc,this),e+4,i)),(0,zt.A)(Lc,this).decode(n)}Dt=Nc,(0,Vt.A)(Nc,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),(0,Vt.A)(Nc,"numbers",["ascent","defaultWidth","descent"]),(0,Vt.A)(Nc,"strings",["fallbackName","loadedName","mimetype","name"]);var jc={_:Math.ceil(2*Dt.bools.length/8)},Uc={_:(0,_t.A)(Dt,Dt,jc)._+8*Dt.numbers.length},zc={_:(0,_t.A)(Dt,Dt,Uc)._+1+8},Hc={_:(0,_t.A)(Dt,Dt,zc)._+1+48},Vc={_:(0,_t.A)(Dt,Dt,Hc)._+1+6};class Gc{static get workerPort(){return(0,_t.A)(Gc,this,qc)._}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");qc._=(0,_t.A)(Gc,this,t)}static get workerSrc(){return(0,_t.A)(Gc,this,Xc)._}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");Xc._=(0,_t.A)(Gc,this,t)}}var qc={_:null},Xc={_:""},Yc=new WeakMap,Kc=new WeakMap;class Qc{constructor(t){let{parsedData:e,rawData:i}=t;(0,yt.A)(this,Yc,void 0),(0,yt.A)(this,Kc,void 0),(0,Ht.A)(Yc,this,e),(0,Ht.A)(Kc,this,i)}getRaw(){return(0,zt.A)(Kc,this)}get(t){var e;return null!==(e=(0,zt.A)(Yc,this).get(t))&&void 0!==e?e:null}[Symbol.iterator](){return(0,zt.A)(Yc,this).entries()}}const Jc=Symbol("INTERNAL");var Zc=new WeakMap,$c=new WeakMap,th=new WeakMap,eh=new WeakMap;class ih{constructor(t,e){let{name:i,intent:n,usage:s,rbGroups:r}=e;(0,yt.A)(this,Zc,!1),(0,yt.A)(this,$c,!1),(0,yt.A)(this,th,!1),(0,yt.A)(this,eh,!0),(0,Ht.A)(Zc,this,!!(t&Qt)),(0,Ht.A)($c,this,!!(t&Jt)),this.name=i,this.intent=n,this.usage=s,this.rbGroups=r}get visible(){if((0,zt.A)(th,this))return(0,zt.A)(eh,this);if(!(0,zt.A)(eh,this))return!1;const{print:t,view:e}=this.usage;return(0,zt.A)(Zc,this)?"OFF"!==(null===e||void 0===e?void 0:e.viewState):!(0,zt.A)($c,this)||"OFF"!==(null===t||void 0===t?void 0:t.printState)}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==Jc&&De("Internal method `_setVisible` called."),(0,Ht.A)(th,this,i),(0,Ht.A)(eh,this,e)}}var nh=new WeakMap,sh=new WeakMap,rh=new WeakMap,ah=new WeakMap,oh=new WeakSet;class lh{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qt;if((0,bt.A)(this,oh),(0,yt.A)(this,nh,null),(0,yt.A)(this,sh,new Map),(0,yt.A)(this,rh,null),(0,yt.A)(this,ah,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,(0,Ht.A)(ah,this,t.order);for(const i of t.groups)(0,zt.A)(sh,this).set(i.id,new ih(e,i));if("OFF"===t.baseState)for(const t of(0,zt.A)(sh,this).values())t._setVisible(Jc,!1);for(const e of t.on)(0,zt.A)(sh,this).get(e)._setVisible(Jc,!0);for(const e of t.off)(0,zt.A)(sh,this).get(e)._setVisible(Jc,!1);(0,Ht.A)(rh,this,this.getHash())}}isVisible(t){if(0===(0,zt.A)(sh,this).size)return!0;if(!t)return Te("Optional content group not defined."),!0;if("OCG"===t.type)return(0,zt.A)(sh,this).has(t.id)?(0,zt.A)(sh,this).get(t.id).visible:(Pe("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,_t.A)(oh,this,ch).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if((0,zt.A)(sh,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if(!(0,zt.A)(sh,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if(!(0,zt.A)(sh,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;if((0,zt.A)(sh,this).get(e).visible)return!1}return!0}return Pe("Unknown optional content policy ".concat(t.policy,".")),!0}return Pe("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=(0,zt.A)(sh,this).get(t);if(n){if(i&&e&&n.rbGroups.length)for(const e of n.rbGroups)for(const i of e){var s;if(i!==t)null===(s=(0,zt.A)(sh,this).get(i))||void 0===s||s._setVisible(Jc,!1,!0)}n._setVisible(Jc,!!e,!0),(0,Ht.A)(nh,this,null)}else Pe("Optional content group not found: ".concat(t))}setOCGState(t){let e,{state:i,preserveRB:n}=t;for(const s of i){switch(s){case"ON":case"OFF":case"Toggle":e=s;continue}const t=(0,zt.A)(sh,this).get(s);if(t)switch(e){case"ON":this.setVisibility(s,!0,n);break;case"OFF":this.setVisibility(s,!1,n);break;case"Toggle":this.setVisibility(s,!t.visible,n)}}(0,Ht.A)(nh,this,null)}get hasInitialVisibility(){return null===(0,zt.A)(rh,this)||this.getHash()===(0,zt.A)(rh,this)}getOrder(){return(0,zt.A)(sh,this).size?(0,zt.A)(ah,this)?(0,zt.A)(ah,this).slice():[...(0,zt.A)(sh,this).keys()]:null}getGroup(t){return(0,zt.A)(sh,this).get(t)||null}getHash(){if(null!==(0,zt.A)(nh,this))return(0,zt.A)(nh,this);const t=new Ca;for(const[e,i]of(0,zt.A)(sh,this))t.update("".concat(e,":").concat(i.visible));return(0,Ht.A)(nh,this,t.hexdigest())}[Symbol.iterator](){return(0,zt.A)(sh,this).entries()}}function ch(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const e=t[n];let s;if(Array.isArray(e))s=(0,_t.A)(oh,this,ch).call(this,e);else{if(!(0,zt.A)(sh,this).has(e))return Pe("Optional content group not found: ".concat(e)),!0;s=(0,zt.A)(sh,this).get(e).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===i}class hh{constructor(t,e){let{disableRange:i=!1,disableStream:n=!1}=e;Re(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:s,initialData:r,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(null===r||void 0===r?void 0:r.length)>0){const t=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!i,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t;const n=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{Re(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(n),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,n,s;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(n=this._fullRequestReader)||void 0===n||null===(s=n.onProgress)||void 0===s||s.call(n,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Re(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new dh(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new uh(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class dh{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=hi(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uh{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function ph(t,e){const i=new Headers;if(!t||!e||"object"!==typeof e)return i;for(const n in e){const t=e[n];void 0!==t&&i.append(n,t)}return i}function Ah(t){var e,i;return null!==(e=null===(i=URL.parse(t))||void 0===i?void 0:i.origin)&&void 0!==e?e:null}function gh(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:n,disableRange:s}=t;const r={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(a))return r;if(r.suggestedLength=a,a<=2*n)return r;if(s||!i)return r;if("bytes"!==e.get("Accept-Ranges"))return r;return"identity"!==(e.get("Content-Encoding")||"identity")||(r.allowRangeRequests=!0),r}function fh(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=a(i);return t=unescape(t),t=o(t),t=l(t),r(t)}if(i=function(t){const e=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=s.exec(t));){let[,t,n,s]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,s]}const r=[];for(let n=0;n<e.length&&n in e;++n){let[t,i]=e[n];i=a(i),t&&(i=unescape(i),0===n&&(i=o(i))),r.push(i)}return r.join("")}(t),i)return r(l(i));if(i=n("filename","i").exec(t),i){i=i[1];let t=a(i);return t=l(t),r(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const n=new TextDecoder(t,{fatal:!0}),s=Ve(i);i=n.decode(s),e=!1}catch(n){}}return i}function r(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:s(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,n){if("q"===i||"Q"===i)return s(e,n=(n=n.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{n=atob(n)}catch(r){}return s(e,n)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(hi(t))return t}return null}function mh(t,e){return new je("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t,404===t||0===t&&e.startsWith("file:"))}function vh(t){return 200===t||206===t}function wh(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function bh(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Pe("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class yh{constructor(t){(0,Vt.A)(this,"_responseOrigin",null),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=ph(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Re(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new _h(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new xh(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class _h{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),n=e.url;fetch(n,wh(i,this._withCredentials,this._abortController)).then(e=>{if(t._responseOrigin=Ah(e.url),!vh(e.status))throw mh(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,{allowRangeRequests:s,suggestedLength:r}=gh({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=r||this._contentLength,this._filename=fh(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ze("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:bh(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class xh{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const n=t.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(t.headers);s.append("Range","bytes=".concat(e,"-").concat(i-1));const r=n.url;fetch(r,wh(s,this._withCredentials,this._abortController)).then(e=>{const i=Ah(e.url);if(i!==t._responseOrigin)throw new Error('Expected range response-origin "'.concat(i,'" to match "').concat(t._responseOrigin,'".'));if(!vh(e.status))throw mh(e.status,r);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:bh(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Eh{constructor(t){let{url:e,httpHeaders:i,withCredentials:n}=t;(0,Vt.A)(this,"_responseOrigin",null),this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=ph(this.isHttp,i),this.withCredentials=n||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[s,r]of this.headers)e.setRequestHeader(s,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",Re(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===n.status&&this.isHttp)return void i.onError(n.status);const s=n.status||200;if(!(200===s&&206===i.expectedStatus)&&s!==i.expectedStatus)return void i.onError(n.status);const r=function(t){const e=t.response;return"string"!==typeof e?e:Ve(e).buffer}(n);if(206===s){const t=n.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:r}):(Pe('Missing or invalid "Content-Range" header.'),i.onError(0))}else r?i.onDone({begin:0,chunk:r}):i.onError(n.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class Sh{constructor(t){this._source=t,this._manager=new Eh(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Re(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new kh(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new Ch(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class kh{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Ah(e.responseURL);const i=e.getAllResponseHeaders(),n=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{const[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:s,suggestedLength:r}=gh({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=fh(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=mh(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Ch{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=Ah(null===(t=this._manager.getRequestXhr(this._requestId))||void 0===t?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(e,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){var e;null!==(e=this._storedError)&&void 0!==e||(this._storedError=mh(t,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Mh=/^[a-z][a-z0-9\-+.]+:/i;class Th{constructor(t){this.source=t,this.url=function(t){if(Mh.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),Re("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Re(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Ph(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Dh(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Ph{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=mh(0,this._url.href)),this._storedError=t,this._headersCapability.reject(t)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ze("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Dh{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=t.source;this._isStreamingSupported=!n.disableStream;const s=process.getBuiltinModule("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Rh=Symbol("INITIAL_DATA");var Lh=new WeakMap,Ih=new WeakSet;class Fh{constructor(){(0,bt.A)(this,Ih),(0,yt.A)(this,Lh,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=(0,_t.A)(Ih,this,Nh).call(this,t);return i.promise.then(()=>e(i.data)),null}const i=(0,zt.A)(Lh,this)[t];if(!i||i.data===Rh)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=(0,zt.A)(Lh,this)[t];return!!e&&e.data!==Rh}delete(t){const e=(0,zt.A)(Lh,this)[t];return!(!e||e.data===Rh)&&(delete(0,zt.A)(Lh,this)[t],!0)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,_t.A)(Ih,this,Nh).call(this,t);i.data=e,i.resolve()}clear(){for(const e in(0,zt.A)(Lh,this)){var t;const{data:i}=(0,zt.A)(Lh,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}(0,Ht.A)(Lh,this,Object.create(null))}*[Symbol.iterator](){for(const t in(0,zt.A)(Lh,this)){const{data:e}=(0,zt.A)(Lh,this)[t];e!==Rh&&(yield[t,e])}}}function Nh(t){var e;return(e=(0,zt.A)(Lh,this))[t]||(e[t]=(0,wt.A)((0,wt.A)({},Promise.withResolvers()),{},{data:Rh}))}var Oh=new WeakMap,Bh=new WeakMap,Wh=new WeakMap,jh=new WeakMap,Uh=new WeakMap,zh=new WeakMap,Hh=new WeakMap,Vh=new WeakMap,Gh=new WeakMap,qh=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,Kh=new WeakMap,Qh=new WeakMap,Jh=new WeakMap,Zh=new WeakMap,$h=new WeakMap,td=new WeakMap,ed=new WeakSet;class id{constructor(t){var e;let{textContentSource:i,container:n,viewport:s}=t;if((0,bt.A)(this,ed),(0,yt.A)(this,Oh,Promise.withResolvers()),(0,yt.A)(this,Bh,null),(0,yt.A)(this,Wh,!1),(0,yt.A)(this,jh,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),(0,yt.A)(this,Uh,null),(0,yt.A)(this,zh,null),(0,yt.A)(this,Hh,0),(0,yt.A)(this,Vh,0),(0,yt.A)(this,Gh,null),(0,yt.A)(this,qh,null),(0,yt.A)(this,Xh,0),(0,yt.A)(this,Yh,0),(0,yt.A)(this,Kh,Object.create(null)),(0,yt.A)(this,Qh,[]),(0,yt.A)(this,Jh,null),(0,yt.A)(this,Zh,[]),(0,yt.A)(this,$h,new WeakMap),(0,yt.A)(this,td,null),i instanceof ReadableStream)(0,Ht.A)(Jh,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');(0,Ht.A)(Jh,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}(0,Ht.A)(Bh,this,(0,Ht.A)(qh,this,n)),(0,Ht.A)(Yh,this,s.scale*yi.pixelRatio),(0,Ht.A)(Xh,this,s.rotation),(0,Ht.A)(zh,this,{div:null,properties:null,ctx:null});const{pageWidth:r,pageHeight:a,pageX:o,pageY:l}=s.rawDims;(0,Ht.A)(td,this,[1,0,0,-1,-o,l+a]),(0,Ht.A)(Vh,this,r),(0,Ht.A)(Hh,this,a),ld.call(id),bi(n,s),(0,zt.A)(Oh,this).promise.finally(()=>{Ad._.delete(this),(0,Ht.A)(zh,this,null),(0,Ht.A)(Kh,this,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=Ge.platform;return Fe(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{(0,zt.A)(Gh,this).read().then(e=>{var i;let{value:n,done:s}=e;s?(0,zt.A)(Oh,this).resolve():(null!==(i=(0,zt.A)(Uh,this))&&void 0!==i||(0,Ht.A)(Uh,this,n.lang),Object.assign((0,zt.A)(Kh,this),n.styles),(0,_t.A)(ed,this,nd).call(this,n.items),t())},(0,zt.A)(Oh,this).reject)};return(0,Ht.A)(Gh,this,(0,zt.A)(Jh,this).getReader()),Ad._.add(this),t(),(0,zt.A)(Oh,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const n=e.scale*yi.pixelRatio,s=e.rotation;if(s!==(0,zt.A)(Xh,this)&&(null===i||void 0===i||i(),(0,Ht.A)(Xh,this,s),bi((0,zt.A)(qh,this),{rotation:s})),n!==(0,zt.A)(Yh,this)){null===i||void 0===i||i(),(0,Ht.A)(Yh,this,n);const t={div:null,properties:null,ctx:ad.call(id,(0,zt.A)(Uh,this))};for(const e of(0,zt.A)(Zh,this))t.properties=(0,zt.A)($h,this).get(e),t.div=e,(0,_t.A)(ed,this,rd).call(this,t)}}cancel(){var t;const e=new ze("TextLayer task cancelled.");null===(t=(0,zt.A)(Gh,this))||void 0===t||t.cancel(e).catch(()=>{}),(0,Ht.A)(Gh,this,null),(0,zt.A)(Oh,this).reject(e)}get textDivs(){return(0,zt.A)(Zh,this)}get textContentItemsStr(){return(0,zt.A)(Qh,this)}static cleanup(){if(!((0,_t.A)(id,this,Ad)._.size>0)){(0,_t.A)(id,this,hd)._.clear();for(const{canvas:t}of(0,_t.A)(id,this,dd)._.values())t.remove();(0,_t.A)(id,this,dd)._.clear()}}}function nd(t){var e,i;if((0,zt.A)(Wh,this))return;null!==(i=(e=(0,zt.A)(zh,this)).ctx)&&void 0!==i||(e.ctx=ad.call(Rt,(0,zt.A)(Uh,this)));const n=(0,zt.A)(Zh,this),s=(0,zt.A)(Qh,this);for(const r of t){if(n.length>1e5)return Pe("Ignoring additional textDivs for performance reasons."),void(0,Ht.A)(Wh,this,!0);if(void 0!==r.str)s.push(r.str),(0,_t.A)(ed,this,sd).call(this,r);else if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){const t=(0,zt.A)(Bh,this);(0,Ht.A)(Bh,this,document.createElement("span")),(0,zt.A)(Bh,this).classList.add("markedContent"),r.id&&(0,zt.A)(Bh,this).setAttribute("id","".concat(r.id)),t.append((0,zt.A)(Bh,this))}else"endMarkedContent"===r.type&&(0,Ht.A)(Bh,this,(0,zt.A)(Bh,this).parentNode)}}function sd(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,zt.A)(Zh,this).push(e);const n=Xe.transform((0,zt.A)(td,this),t.transform);let s=Math.atan2(n[1],n[0]);const r=(0,zt.A)(Kh,this)[t.fontName];r.vertical&&(s+=Math.PI/2);let a=(0,zt.A)(jh,this)&&r.fontSubstitution||r.fontFamily;a=Rt.fontFamilyMap.get(a)||a;const o=Math.hypot(n[2],n[3]),l=o*cd.call(Rt,a,r,(0,zt.A)(Uh,this));let c,h;0===s?(c=n[4],h=n[5]-l):(c=n[4]+l*Math.sin(s),h=n[5]-l*Math.cos(s));const d="calc(var(--total-scale-factor) *",u=e.style;(0,zt.A)(Bh,this)===(0,zt.A)(qh,this)?(u.left="".concat((100*c/(0,zt.A)(Vh,this)).toFixed(2),"%"),u.top="".concat((100*h/(0,zt.A)(Hh,this)).toFixed(2),"%")):(u.left="".concat(d).concat(c.toFixed(2),"px)"),u.top="".concat(d).concat(h.toFixed(2),"px)")),u.fontSize="".concat(d).concat((pd._*o).toFixed(2),"px)"),u.fontFamily=a,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,(0,zt.A)(jh,this)&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),0!==s&&(i.angle=s*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(p=!0)}if(p&&(i.canvasWidth=r.vertical?t.height:t.width),(0,zt.A)($h,this).set(e,i),(0,zt.A)(zh,this).div=e,(0,zt.A)(zh,this).properties=i,(0,_t.A)(ed,this,rd).call(this,(0,zt.A)(zh,this)),i.hasText&&(0,zt.A)(Bh,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),(0,zt.A)(Bh,this).append(t)}}function rd(t){const{div:e,properties:i,ctx:n}=t,{style:s}=e;let r="";if(pd._>1&&(r="scale(".concat(1/pd._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:t}=s,{canvasWidth:a,fontSize:o}=i;od.call(Rt,n,o*(0,zt.A)(Yh,this),t);const{width:l}=n.measureText(e.textContent);l>0&&(r="scaleX(".concat(a*(0,zt.A)(Yh,this)/l,") ").concat(r))}0!==i.angle&&(r="rotate(".concat(i.angle,"deg) ").concat(r)),r.length>0&&(s.transform=r)}function ad(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,_t.A)(Rt,this,dd)._.get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),(0,_t.A)(Rt,this,dd)._.set(t,e),(0,_t.A)(Rt,this,ud)._.set(e,{size:0,family:""})}return e}function od(t,e,i){const n=(0,_t.A)(Rt,this,ud)._.get(t);e===n.size&&i===n.family||(t.font="".concat(e,"px ").concat(i),n.size=e,n.family=i)}function ld(){if(null!==(0,_t.A)(Rt,this,pd)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),pd._=(0,_t.A)(Rt,this,t.getBoundingClientRect().height),t.remove()}function cd(t,e,i){const n=(0,_t.A)(Rt,this,hd)._.get(t);if(n)return n;const s=(0,_t.A)(Rt,this,ad).call(this,i);s.canvas.width=s.canvas.height=30,(0,_t.A)(Rt,this,od).call(this,s,30,t);const r=s.measureText(""),a=r.fontBoundingBoxAscent,o=Math.abs(r.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let l=.8;return a?l=a/(a+o):(Ge.platform.isFirefox&&Pe("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?l=e.ascent:e.descent&&(l=1+e.descent)),(0,_t.A)(Rt,this,hd)._.set(t,l),l}Rt=id;var hd={_:new Map},dd={_:new Map},ud={_:new WeakMap},pd={_:null},Ad={_:new Set};function gd(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const n=new fd,{docId:s}=n,r=i.url?function(t){if(t instanceof URL)return t.href;if("string"===typeof t){if(qt)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,a=i.data?function(t){if(qt&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return Ve(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(i.data):null,o=i.httpHeaders||null,l=!0===i.withCredentials,c=null!==(t=i.password)&&void 0!==t?t:null,h=i.range instanceof xd?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:65536;let u=i.worker instanceof Id?i.worker:null;const p=i.verbosity,A="string"!==typeof i.docBaseUrl||ci(i.docBaseUrl)?null:i.docBaseUrl,g=za(i.cMapUrl),f=!1!==i.cMapPacked,m=i.CMapReaderFactory||(qt?Yo:vo),v=za(i.iccUrl),w=za(i.standardFontDataUrl),b=i.StandardFontDataFactory||(qt?Ko:zo),y=za(i.wasmUrl),_=i.WasmFactory||(qt?Qo:Vo),x=!0!==i.stopAtErrors,E=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,S=!1!==i.isEvalSupported,k="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!qt,C="boolean"===typeof i.isImageDecoderSupported?i.isImageDecoderSupported:!qt&&(Ge.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,T="boolean"===typeof i.disableFontFace?i.disableFontFace:qt,P=!0===i.fontExtraProperties,D=!0===i.enableXfa,R=i.ownerDocument||globalThis.document,L=!0===i.disableRange,I=!0===i.disableStream,F=!0===i.disableAutoFetch,N=!0===i.pdfBug,O=i.CanvasFactory||(qt?Xo:fo),B=i.FilterFactory||(qt?qo:Mo),W=!0===i.enableHWA,j=!1!==i.useWasm,U=h?h.length:null!==(e=i.length)&&void 0!==e?e:NaN,z="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!qt&&!T,H="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:!!(m===vo&&b===zo&&_===Vo&&g&&w&&y&&ui(g,document.baseURI)&&ui(w,document.baseURI)&&ui(y,document.baseURI));Ce(p);const V={canvasFactory:new O({ownerDocument:R,enableHWA:W}),filterFactory:new B({docId:s,ownerDocument:R}),cMapReaderFactory:H?null:new m({baseUrl:g,isCompressed:f}),standardFontDataFactory:H?null:new b({baseUrl:w}),wasmFactory:H?null:new _({baseUrl:y})};u||(u=Id.create({verbosity:p,port:Gc.workerPort}),n._worker=u);const G={docId:s,apiVersion:"5.4.296",data:a,password:c,disableAutoFetch:F,rangeChunkSize:d,length:U,docBaseUrl:A,enableXfa:D,evaluatorOptions:{maxImageSize:E,disableFontFace:T,ignoreErrors:x,isEvalSupported:S,isOffscreenCanvasSupported:k,isImageDecoderSupported:C,canvasMaxAreaInBytes:M,fontExtraProperties:P,useSystemFonts:z,useWasm:j,useWorkerFetch:H,cMapUrl:g,iccUrl:v,standardFontDataUrl:w,wasmUrl:y}},q={ownerDocument:R,pdfBug:N,styleElement:null,loadingParams:{disableAutoFetch:F,enableXfa:D}};return u.promise.then(function(){if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let e;if(h)e=new hh(h,{disableRange:L,disableStream:I});else if(!a){if(!r)throw new Error("getDocument - no `url` parameter provided.");const t=ui(r)?yh:qt?Th:Sh;e=new t({url:r,length:U,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:L,disableStream:I})}return t.then(t=>{if(n.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new lo(s,t,u.port),r=new Kd(i,n,e,q,V,W);n._transport=r,i.send("Ready",null)})}).catch(n._capability.reject),n}class fd{constructor(){(0,Vt.A)(this,"_capability",Promise.withResolvers()),(0,Vt.A)(this,"_transport",null),(0,Vt.A)(this,"_worker",null),(0,Vt.A)(this,"docId","d".concat((md._=(Lt=md._,It=Lt++,Lt),It))),(0,Vt.A)(this,"destroyed",!1),(0,Vt.A)(this,"onPassword",null),(0,Vt.A)(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0;try{var e,i;null!==(e=this._worker)&&void 0!==e&&e.port&&(this._worker._pendingDestroy=!0),await(null===(i=this._transport)||void 0===i?void 0:i.destroy())}catch(s){var n;throw null!==(n=this._worker)&&void 0!==n&&n.port&&delete this._worker._pendingDestroy,s}this._transport=null,null===(t=this._worker)||void 0===t||t.destroy(),this._worker=null}async getData(){return this._transport.getData()}}var md={_:0},vd=new WeakMap,wd=new WeakMap,bd=new WeakMap,yd=new WeakMap,_d=new WeakMap;class xd{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;(0,yt.A)(this,vd,Promise.withResolvers()),(0,yt.A)(this,wd,[]),(0,yt.A)(this,bd,[]),(0,yt.A)(this,yd,[]),(0,yt.A)(this,_d,[]),this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n}addRangeListener(t){(0,zt.A)(_d,this).push(t)}addProgressListener(t){(0,zt.A)(yd,this).push(t)}addProgressiveReadListener(t){(0,zt.A)(bd,this).push(t)}addProgressiveDoneListener(t){(0,zt.A)(wd,this).push(t)}onDataRange(t,e){for(const i of(0,zt.A)(_d,this))i(t,e)}onDataProgress(t,e){(0,zt.A)(vd,this).promise.then(()=>{for(const i of(0,zt.A)(yd,this))i(t,e)})}onDataProgressiveRead(t){(0,zt.A)(vd,this).promise.then(()=>{for(const e of(0,zt.A)(bd,this))e(t)})}onDataProgressiveDone(){(0,zt.A)(vd,this).promise.then(()=>{for(const t of(0,zt.A)(wd,this))t()})}transportReady(){(0,zt.A)(vd,this).resolve()}requestDataRange(t,e){De("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Ed{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Fe(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Sd=new WeakMap,kd=new WeakSet;class Cd{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,bt.A)(this,kd),(0,yt.A)(this,Sd,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new di:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new Fh,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new oi({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Fe(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,n;let{canvasContext:s,canvas:r=s.canvas,viewport:a,intent:o="display",annotationMode:l=ne.ENABLE,transform:c=null,background:h=null,optionalContentConfigPromise:d=null,annotationCanvasMap:u=null,pageColors:p=null,printAnnotationStorage:A=null,isEditing:g=!1,recordOperations:f=!1,operationsFilter:m=null}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const v=this._transport.getRenderingIntent(o,l,A,g),{renderingIntent:w,cacheKey:b}=v;(0,Ht.A)(Sd,this,!1),d||(d=this._transport.getOptionalContentConfig(w));let y=this._intentStates.get(b);y||(y=Object.create(null),this._intentStates.set(b,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const _=!!(w&Jt);var x;y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(x=this._stats)||void 0===x||x.time("Page Request"),this._pumpOperatorList(v));const E=Boolean(this._pdfBug&&(null===(i=globalThis.StepperManager)||void 0===i?void 0:i.enabled)),S=!this.recordedBBoxes&&(f||E),k=t=>{if(y.renderTasks.delete(C),S){var e;const t=null===(e=C.gfx)||void 0===e?void 0:e.dependencyTracker.take();t&&(C.stepper&&C.stepper.setOperatorBBoxes(t,C.gfx.dependencyTracker.takeDebugMetadata()),f&&(this.recordedBBoxes=t))}var i;(_&&(0,Ht.A)(Sd,this,!0),(0,_t.A)(kd,this,Md).call(this),t?(C.capability.reject(t),this._abortOperatorList({intentState:y,reason:t instanceof Error?t:new Error(t)})):C.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(i=globalThis.Stats)&&void 0!==i&&i.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new tu({callback:k,params:{canvas:r,canvasContext:s,dependencyTracker:S?new El(r,y.operatorList.length,E):null,viewport:a,transform:c,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!_,pdfBug:this._pdfBug,pageColors:p,enableHWA:this._transport.enableHWA,operationsFilter:m});((n=y).renderTasks||(n.renderTasks=new Set)).add(C);const M=C.task;return Promise.all([y.displayReadyCapability.promise,d]).then(t=>{var e;let[i,n]=t;if(this.destroyed)k();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(n.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");C.initializeGraphics({transparency:i,optionalContentConfig:n}),C.operatorListChanged()}}).catch(k),M}getOperatorList(){let{intent:t="display",annotationMode:e=ne.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(t,e,i,n,!0);let r,a=this._intentStates.get(s.cacheKey);var o,l;(a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a)),a.opListReadCapability)||(r=Object.create(null),r.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(r))},a.opListReadCapability=Promise.withResolvers(),((o=a).renderTasks||(o.renderTasks=new Set)).add(r),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||void 0===l||l.time("Page Request"),this._pumpOperatorList(s));return a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>ii.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const n=e.getReader(),s={items:[],styles:Object.create(null),lang:null};!function e(){n.read().then(function(i){var n;let{value:r,done:a}=i;a?t(s):(null!==(n=s.lang)&&void 0!==n||(s.lang=r.lang),Object.assign(s.styles,r.styles),s.items.push(...r.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,Ht.A)(Sd,this,!1),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,Ht.A)(Sd,this,!0);const e=(0,_t.A)(kd,this,Md).call(this);return t&&e&&this._stats&&(this._stats=new di),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(n=s.displayReadyCapability)||void 0===n||n.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&(0,_t.A)(kd,this,Md).call(this)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:n,modifiedIds:s}=t;const{map:r,transfer:a}=n,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:r,modifiedIds:s},a).getReader(),l=this._intentStates.get(i);l.streamReader=o;const c=()=>{o.read().then(t=>{let{value:e,done:i}=t;i?l.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,l),c())},t=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const t of l.renderTasks)t.operatorListChanged();(0,_t.A)(kd,this,Md).call(this)}if(l.displayReadyCapability)l.displayReadyCapability.reject(t);else{if(!l.opListReadCapability)throw t;l.opListReadCapability.reject(t)}}})};c()}_abortOperatorList(t){let{intentState:e,reason:i,force:n=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof li){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t))}}if(e.streamReader.cancel(new ze(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}function Md(){if(!(0,zt.A)(Sd,this)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),(0,Ht.A)(Sd,this,!1),!0}var Td=new WeakMap,Pd=new WeakMap,Dd=new WeakMap,Rd=new WeakMap,Ld=new WeakSet;class Id{constructor(){let{name:t=null,port:e=null,verbosity:i=Me()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,bt.A)(this,Ld),(0,yt.A)(this,Td,Promise.withResolvers()),(0,yt.A)(this,Pd,null),(0,yt.A)(this,Dd,null),(0,yt.A)(this,Rd,null),this.name=t,this.destroyed=!1,this.verbosity=i,e){if(zd._.has(e))throw new Error("Cannot use more than one PDFWorker per port.");zd._.set(e,this),(0,_t.A)(Ld,this,Nd).call(this,e)}else(0,_t.A)(Ld,this,Od).call(this)}get promise(){return(0,zt.A)(Td,this).promise}get port(){return(0,zt.A)(Dd,this)}get messageHandler(){return(0,zt.A)(Pd,this)}destroy(){var t,e;this.destroyed=!0,null===(t=(0,zt.A)(Rd,this))||void 0===t||t.terminate(),(0,Ht.A)(Rd,this,null),zd._.delete((0,zt.A)(Dd,this)),(0,Ht.A)(Dd,this,null),null===(e=(0,zt.A)(Pd,this))||void 0===e||e.destroy(),(0,Ht.A)(Pd,this,null)}static create(t){const e=(0,_t.A)(Id,this,zd)._.get(null===t||void 0===t?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Id(t)}static get workerSrc(){if(Gc.workerSrc)return Gc.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Fe(this,"_setupFakeWorkerGlobal",(async()=>{if(xt(Id,this,Wd))return xt(Id,this,Wd);return(await i(50789)(this.workerSrc)).WorkerMessageHandler})())}}function Fd(){(0,zt.A)(Td,this).resolve(),(0,zt.A)(Pd,this).send("configure",{verbosity:this.verbosity})}function Nd(t){(0,Ht.A)(Dd,this,t),(0,Ht.A)(Pd,this,new lo("main","worker",t)),(0,zt.A)(Pd,this).on("ready",()=>{}),(0,_t.A)(Ld,this,Fd).call(this)}function Od(){if(Ud._||Wd(Ft))return void(0,_t.A)(Ld,this,Bd).call(this);let{workerSrc:t}=Ft;try{Ft._isSameOrigin(window.location,t)||(t=Ft._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new lo("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?(0,zt.A)(Td,this).reject(new Error("Worker was destroyed")):(0,_t.A)(Ld,this,Bd).call(this)},s=new AbortController;e.addEventListener("error",()=>{(0,zt.A)(Rd,this)||n()},{signal:s.signal}),i.on("test",t=>{s.abort(),!this.destroyed&&t?((0,Ht.A)(Pd,this,i),(0,Ht.A)(Dd,this,e),(0,Ht.A)(Rd,this,e),(0,_t.A)(Ld,this,Fd).call(this)):n()}),i.on("ready",t=>{if(s.abort(),this.destroyed)n();else try{r()}catch(e){(0,_t.A)(Ld,this,Bd).call(this)}});const r=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void r()}catch(e){Te("The worker has been disabled.")}(0,_t.A)(Ld,this,Bd).call(this)}function Bd(){Ud._||(Pe("Setting up fake worker."),Ud._=!0),Ft._setupFakeWorkerGlobal.then(t=>{var e,i;if(this.destroyed)return void(0,zt.A)(Td,this).reject(new Error("Worker was destroyed"));const n=new Xa;(0,Ht.A)(Dd,this,n);const s="fake".concat((jd._=(e=jd._,i=e++,e),i)),r=new lo(s+"_worker",s,n);t.setup(r,n),(0,Ht.A)(Pd,this,new lo(s,s+"_worker",n)),(0,_t.A)(Ld,this,Fd).call(this)}).catch(t=>{(0,zt.A)(Td,this).reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}function Wd(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(i){return null}}Ft=Id;var jd={_:0},Ud={_:!1},zd={_:new WeakMap};qt&&(Ud._=(0,_t.A)(Ft,Ft,!0),Gc.workerSrc||(Gc.workerSrc="./pdf.worker.mjs")),Ft._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(null===i||void 0===i||!i.origin||"null"===i.origin)return!1;const n=new URL(e,i);return i.origin===n.origin},Ft._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Ft.fromPort=t=>{var e;if(e="`PDFWorker.fromPort` - please use `PDFWorker.create` instead.",console.log("Deprecated API usage: "+e),null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return Ft.create(t)};var Hd=new WeakMap,Vd=new WeakMap,Gd=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Yd=new WeakSet;class Kd{constructor(t,e,i,n,s,r){(0,bt.A)(this,Yd),(0,yt.A)(this,Hd,new Map),(0,yt.A)(this,Vd,new Map),(0,yt.A)(this,Gd,new Map),(0,yt.A)(this,qd,new Map),(0,yt.A)(this,Xd,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Fh,this.fontLoader=new Wa({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.wasmFactory=s.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=r,this.setupMessageHandler()}get annotationStorage(){return Fe(this,"annotationStorage",new Ia)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ne.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=Qt,a=Ma;switch(t){case"any":r=Kt;break;case"display":break;case"print":r=Jt;break;default:Pe("getRenderingIntent - invalid intent: ".concat(t))}const o=r&Jt&&i instanceof Oa?i:this.annotationStorage;switch(e){case ne.DISABLE:r+=te;break;case ne.ENABLE:break;case ne.ENABLE_FORMS:r+=Zt;break;case ne.ENABLE_STORAGE:r+=$t,a=o.serializable;break;default:Pe("getRenderingIntent - invalid annotationMode: ".concat(e))}n&&(r+=ee),s&&(r+=ie);const{ids:l,hash:c}=o.modifiedIds;return{renderingIntent:r,cacheKey:[r,a.hash,c].join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=(0,zt.A)(Xd,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const n of(0,zt.A)(Vd,this).values())e.push(n._destroy());(0,zt.A)(Vd,this).clear(),(0,zt.A)(Gd,this).clear(),(0,zt.A)(qd,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),(0,zt.A)(Hd,this).clear(),this.filterFactory.destroy(),id.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new ze("Worker was terminated.")),null===(e=this.messageHandler)||void 0===e||e.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{Re(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:n}=t;n?e.close():(Re(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:s}=this._fullReader;if(!i||!n){var r;if(this._lastProgress)null===(r=e.onProgress)||void 0===r||r.call(e,this._lastProgress);this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:n,contentLength:s}}),t.on("GetRangeReader",(t,e)=>{Re(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function(t){let{value:i,done:n}=t;n?e.close():(Re(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new Ed(i,this))}),t.on("DocException",t=>{e._capability.reject(ro(t))}),t.on("PasswordRequest",t=>{(0,Ht.A)(Xd,this,Promise.withResolvers());try{if(!e.onPassword)throw ro(t);const i=t=>{t instanceof Error?(0,zt.A)(Xd,this).reject(t):(0,zt.A)(Xd,this).resolve({password:t})};e.onPassword(i,t.code)}catch(i){(0,zt.A)(Xd,this).reject(i)}return(0,zt.A)(Xd,this).promise}),t.on("DataLoaded",t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(this.destroyed)return;(0,zt.A)(Vd,this).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{var i;let[n,s,r]=e;if(this.destroyed)return null;if(this.commonObjs.has(n))return null;switch(s){case"Font":if("error"in r){const t=r.error;Pe("Error during font loading: ".concat(t)),this.commonObjs.resolve(n,t);break}const e=new Nc(r),a=this._params.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,o=new Ua(e,a,r.extra,r.charProcOperatorList);this.fontLoader.bind(o).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!o.fontExtraProperties&&o.data&&o.clearData(),this.commonObjs.resolve(n,o)});break;case"CopyLocalImage":const{imageRef:l}=r;Re(l,"The imageRef must be defined.");for(const t of(0,zt.A)(Vd,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===l)return e.dataLen?(this.commonObjs.resolve(n,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error("Got unknown common object type ".concat(s))}return null}),t.on("obj",t=>{let[e,i,n,s]=t;if(this.destroyed)return;const r=(0,zt.A)(Vd,this).get(i);var a;if(!r.objs.has(e))if(0!==r._intentStates.size)switch(n){case"Image":case"Pattern":r.objs.resolve(e,s);break;default:throw new Error("Got unknown object type ".concat(n))}else null===s||void 0===s||null===(a=s.bitmap)||void 0===a||a.close()}),t.on("DocProgress",t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");const e=this[t.type];if(!e)throw new Error("".concat(t.type," not initialized, see the `useWorkerFetch` parameter."));return e.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&Pe("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:n}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},n).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=(0,zt.A)(Gd,this).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&(0,zt.A)(qd,this).set(i.refStr,t);const n=new Cd(e,i,this,this._params.pdfBug);return(0,zt.A)(Vd,this).set(e,n),n});return(0,zt.A)(Gd,this).set(e,n),n}getPageIndex(t){return Ha(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,_t.A)(Yd,this,Qd).call(this,"GetFieldObjects")}hasJSActions(){return(0,_t.A)(Yd,this,Qd).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return(0,_t.A)(Yd,this,Qd).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return(0,_t.A)(Yd,this,Qd).call(this,"GetOptionalContentConfig").then(e=>new lh(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=(0,zt.A)(Hd,this).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,n,s;return{info:t[0],metadata:t[1]?new Qc(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(n=null===(s=this._fullReader)||void 0===s?void 0:s.contentLength)&&void 0!==n?n:null}});return(0,zt.A)(Hd,this).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of(0,zt.A)(Vd,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),(0,zt.A)(Hd,this).clear(),this.filterFactory.destroy(!0),id.cleanup()}}cachedPageNumber(t){var e;if(!Ha(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=(0,zt.A)(qd,this).get(i))&&void 0!==e?e:null}}function Qd(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,zt.A)(Hd,this).get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return(0,zt.A)(Hd,this).set(t,n),n}var Jd=new WeakMap;class Zd{constructor(t){(0,yt.A)(this,Jd,null),(0,Vt.A)(this,"onContinue",null),(0,Vt.A)(this,"onError",null),(0,Ht.A)(Jd,this,t)}get promise(){return(0,zt.A)(Jd,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,zt.A)(Jd,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=(0,zt.A)(Jd,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=(0,zt.A)(Jd,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var $d=new WeakMap;class tu{constructor(t){let{callback:e,params:i,objs:n,commonObjs:s,annotationCanvasMap:r,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:u=null,enableHWA:p=!1,operationsFilter:A=null}=t;(0,yt.A)(this,$d,null),this.callback=e,this.params=i,this.objs=n,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Zd(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvas,this._canvasContext=i.canvas?null:i.canvasContext,this._enableHWA=p,this._dependencyTracker=i.dependencyTracker,this._operationsFilter=A}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:n=!1,optionalContentConfig:s}=t;if(this.cancelled)return;if(this._canvas){if(eu._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");eu._.add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:a,background:o,dependencyTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new fc(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:s},this.annotationCanvasMap,this.pageColors,l),this.gfx.beginDrawing({transform:a,viewport:r,transparency:n,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t,e,i;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),(0,zt.A)($d,this)&&(window.cancelAnimationFrame((0,zt.A)($d,this)),(0,Ht.A)($d,this,null)),eu._.delete(this._canvas),n||(n=new li("Rendering cancelled, page ".concat(this._pageIndex+1),s)),this.callback(n),null===(e=(i=this.task).onError)||void 0===e||e.call(i,n)}operatorListChanged(){var t,e;this.graphicsReady?(null===(t=this.gfx.dependencyTracker)||void 0===t||t.growOperationsCount(this.operatorList.fnArray.length),null===(e=this.stepper)||void 0===e||e.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,Ht.A)($d,this,window.requestAnimationFrame(()=>{(0,Ht.A)($d,this,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),eu._.delete(this._canvas),this.callback())))}}var eu={_:new WeakSet};var iu=new WeakMap,nu=new WeakMap,su=new WeakMap,ru=new WeakMap,au=new WeakMap,ou=new WeakMap,lu=new WeakMap,cu=new WeakMap,hu=new WeakMap,du=new WeakMap,uu=new WeakSet;class pu{static get _keyboardManager(){return Fe(this,"_keyboardManager",new fn([[["Escape","mac+Escape"],pu.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],pu.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],pu.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],pu.prototype._moveToPrevious],[["Home","mac+Home"],pu.prototype._moveToBeginning],[["End","mac+End"],pu.prototype._moveToEnd]]))}constructor(t){var e,i;let{editor:n=null,uiManager:s=null}=t;(0,bt.A)(this,uu),(0,yt.A)(this,iu,null),(0,yt.A)(this,nu,null),(0,yt.A)(this,su,void 0),(0,yt.A)(this,ru,null),(0,yt.A)(this,au,!1),(0,yt.A)(this,ou,!1),(0,yt.A)(this,lu,null),(0,yt.A)(this,cu,void 0),(0,yt.A)(this,hu,null),(0,yt.A)(this,du,null),n?((0,Ht.A)(ou,this,!1),(0,Ht.A)(lu,this,n)):(0,Ht.A)(ou,this,!0),(0,Ht.A)(du,this,(null===n||void 0===n?void 0:n._uiManager)||s),(0,Ht.A)(cu,this,(0,zt.A)(du,this)._eventBus),(0,Ht.A)(su,this,(null===n||void 0===n||null===(e=n.color)||void 0===e?void 0:e.toUpperCase())||(null===(i=(0,zt.A)(du,this))||void 0===i?void 0:i.highlightColors.values().next().value)||"#FFFF98"),bu._||(bu._=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const t=(0,Ht.A)(iu,this,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",(0,zt.A)(lu,this)&&(t.ariaControls="".concat((0,zt.A)(lu,this).id,"_colorpicker_dropdown"));const e=(0,zt.A)(du,this)._signal;t.addEventListener("click",(0,_t.A)(uu,this,mu).bind(this),{signal:e}),t.addEventListener("keydown",(0,_t.A)(uu,this,fu).bind(this),{signal:e});const i=(0,Ht.A)(nu,this,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=(0,zt.A)(su,this),t.append(i),t}renderMainDropdown(){const t=(0,Ht.A)(ru,this,(0,_t.A)(uu,this,Au).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===(0,zt.A)(iu,this))return void(0,_t.A)(uu,this,mu).call(this,t);const e=t.target.getAttribute("data-color");e&&(0,_t.A)(uu,this,gu).call(this,e,t)}_moveToNext(t){var e,i;xt(uu,this,wu)?t.target!==(0,zt.A)(iu,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=(0,zt.A)(ru,this).firstChild)||void 0===i||i.focus():(0,_t.A)(uu,this,mu).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=(0,zt.A)(ru,this))||void 0===e?void 0:e.firstChild)&&t.target!==(0,zt.A)(iu,this)?(xt(uu,this,wu)||(0,_t.A)(uu,this,mu).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):xt(uu,this,wu)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;xt(uu,this,wu)?null===(e=(0,zt.A)(ru,this).firstChild)||void 0===e||e.focus():(0,_t.A)(uu,this,mu).call(this,t)}_moveToEnd(t){var e;xt(uu,this,wu)?null===(e=(0,zt.A)(ru,this).lastChild)||void 0===e||e.focus():(0,_t.A)(uu,this,mu).call(this,t)}hideDropdown(){var t,e;null===(t=(0,zt.A)(ru,this))||void 0===t||t.classList.add("hidden"),(0,zt.A)(iu,this).ariaExpanded="false",null===(e=(0,zt.A)(hu,this))||void 0===e||e.abort(),(0,Ht.A)(hu,this,null)}_hideDropdownFromKeyboard(){var t;(0,zt.A)(ou,this)||(xt(uu,this,wu)?(this.hideDropdown(),(0,zt.A)(iu,this).focus({preventScroll:!0,focusVisible:(0,zt.A)(au,this)})):null===(t=(0,zt.A)(lu,this))||void 0===t||t.unselect())}updateColor(t){if((0,zt.A)(nu,this)&&((0,zt.A)(nu,this).style.backgroundColor=t),!(0,zt.A)(ru,this))return;const e=(0,zt.A)(du,this).highlightColors.values();for(const i of(0,zt.A)(ru,this).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;null===(t=(0,zt.A)(iu,this))||void 0===t||t.remove(),(0,Ht.A)(iu,this,null),(0,Ht.A)(nu,this,null),null===(e=(0,zt.A)(ru,this))||void 0===e||e.remove(),(0,Ht.A)(ru,this,null)}}function Au(){const t=document.createElement("div"),e=(0,zt.A)(du,this)._signal;t.addEventListener("contextmenu",pi,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),(0,zt.A)(lu,this)&&(t.id="".concat((0,zt.A)(lu,this).id,"_colorpicker_dropdown"));for(const[i,n]of(0,zt.A)(du,this).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",bu._[i]);const r=document.createElement("span");s.append(r),r.className="swatch",r.style.backgroundColor=n,s.ariaSelected=n===(0,zt.A)(su,this),s.addEventListener("click",(0,_t.A)(uu,this,gu).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",(0,_t.A)(uu,this,fu).bind(this),{signal:e}),t}function gu(t,e){e.stopPropagation(),(0,zt.A)(cu,this).dispatch("switchannotationeditorparams",{source:this,type:ae.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}function fu(t){Nt._keyboardManager.exec(this,t)}function mu(t){if(xt(uu,this,wu))return void this.hideDropdown();if((0,Ht.A)(au,this,0===t.detail),(0,zt.A)(hu,this)||((0,Ht.A)(hu,this,new AbortController),window.addEventListener("pointerdown",(0,_t.A)(uu,this,vu).bind(this),{signal:(0,zt.A)(du,this).combinedSignal((0,zt.A)(hu,this))})),(0,zt.A)(iu,this).ariaExpanded="true",(0,zt.A)(ru,this))return void(0,zt.A)(ru,this).classList.remove("hidden");const e=(0,Ht.A)(ru,this,(0,_t.A)(uu,this,Au).call(this));(0,zt.A)(iu,this).append(e)}function vu(t){var e;null!==(e=(0,zt.A)(ru,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function wu(t){return(0,zt.A)(ru,t)&&!(0,zt.A)(ru,t).classList.contains("hidden")}Nt=pu;var bu={_:null},yu=new WeakMap,_u=new WeakMap,xu=new WeakMap;class Eu{constructor(t){(0,yt.A)(this,yu,null),(0,yt.A)(this,_u,null),(0,yt.A)(this,xu,null),(0,Ht.A)(_u,this,t),(0,Ht.A)(xu,this,t._uiManager),Su._||(Su._=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if((0,zt.A)(yu,this))return(0,zt.A)(yu,this);const{editorType:t,colorType:e,colorValue:i}=(0,zt.A)(_u,this),n=(0,Ht.A)(yu,this,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",Su._[t]),n.addEventListener("input",()=>{(0,zt.A)(xu,this).updateParams(e,n.value)},{signal:(0,zt.A)(xu,this)._signal}),n}update(t){(0,zt.A)(yu,this)&&((0,zt.A)(yu,this).value=t)}destroy(){var t;null===(t=(0,zt.A)(yu,this))||void 0===t||t.remove(),(0,Ht.A)(yu,this,null)}hideDropdown(){}}var Su={_:null};function ku(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Cu(t){return Math.max(0,Math.min(255,255*t))}class Mu{static CMYK_G(t){let[e,i,n,s]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+s)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=Cu(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=ku(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_rgb(t){return t.map(Cu)}static RGB_HTML(t){return"#".concat(t.map(ku).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,n,s]=t;return["RGB",1-Math.min(1,e+s),1-Math.min(1,n+s),1-Math.min(1,i+s)]}static CMYK_rgb(t){let[e,i,n,s]=t;return[Cu(1-Math.min(1,e+s)),Cu(1-Math.min(1,n+s)),Cu(1-Math.min(1,i+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const s=1-e,r=1-i,a=1-n;return["CMYK",s,r,a,Math.min(s,r,a)]}}class Tu{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width","".concat(t,"px")),n.setAttribute("height","".concat(e,"px"))),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),n}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){De("Abstract method `_createSVG` called.")}}class Pu extends Tu{_createSVG(t){return document.createElementNS(si,t)}}const Du=new WeakSet,Ru=60*(new Date).getTimezoneOffset()*1e3;class Lu{static create(t){switch(t.data.annotationType){case Ae.LINK:return new zu(t);case Ae.TEXT:return new qu(t);case Ae.WIDGET:switch(t.data.fieldType){case"Tx":return new Yu(t);case"Btn":return t.data.radioButton?new Ju(t):t.data.checkBox?new Qu(t):new Zu(t);case"Ch":return new $u(t);case"Sig":return new Ku(t)}return new Xu(t);case Ae.POPUP:return new ep(t);case Ae.FREETEXT:return new Vp(t);case Ae.LINE:return new qp(t);case Ae.SQUARE:return new Yp(t);case Ae.CIRCLE:return new Qp(t);case Ae.POLYLINE:return new Zp(t);case Ae.CARET:return new tA(t);case Ae.INK:return new sA(t);case Ae.POLYGON:return new $p(t);case Ae.HIGHLIGHT:return new aA(t);case Ae.UNDERLINE:return new oA(t);case Ae.SQUIGGLY:return new lA(t);case Ae.STRIKEOUT:return new cA(t);case Ae.STAMP:return new hA(t);case Ae.FILEATTACHMENT:return new pA(t);default:return new Bu(t)}}}var Iu=new WeakMap,Fu=new WeakMap,Nu=new WeakMap,Ou=new WeakSet;class Bu{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,bt.A)(this,Ou),(0,yt.A)(this,Iu,null),(0,yt.A)(this,Fu,!1),(0,yt.A)(this,Nu,null),this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData(t){let{contentsObj:e,richText:i}=t;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Bu._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var t;const{data:e}=this,i=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(e.id);return i?i.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var t;const e=null===(t=this.annotationStorage)||void 0===t?void 0:t.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:i,inkLists:n,rect:s}=this.data;let r=-1/0,a=-1/0;if((null===i||void 0===i?void 0:i.length)>=8){for(let t=0;t<i.length;t+=8)i[t+1]>a?(a=i[t+1],r=i[t+2]):i[t+1]===a&&(r=Math.max(r,i[t+2]));return[r,a]}if((null===n||void 0===n?void 0:n.length)>=1){for(const t of n)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>a?(a=t[e+1],r=t[e]):t[e+1]===a&&(r=Math.max(r,t[e]));if(r!==1/0)return[r,a]}return s?[s[2],s[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:r}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/i,t[1]=100*(t[1]-r)/n,t}get commentText(){var t,e;const{data:i}=this;return(null===(t=this.annotationStorage.getRawValue("".concat(se).concat(i.id)))||void 0===t||null===(t=t.popup)||void 0===t?void 0:t.contents)||(null===(e=i.contentsObj)||void 0===e?void 0:e.str)||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue("".concat(se).concat(e.id),{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;null===(t=(null===(e=(0,zt.A)(Nu,this))||void 0===e?void 0:e.popup)||this.popup)||void 0===t||t.remove(),(0,Ht.A)(Nu,this,this.popup=null)}updateEdited(t){var e;if(!this.container)return;t.rect&&((0,zt.A)(Iu,this)||(0,Ht.A)(Iu,this,{rect:this.data.rect.slice(0)}));const{rect:i,popup:n}=t;i&&(0,_t.A)(Ou,this,Wu).call(this,i);let s=(null===(e=(0,zt.A)(Nu,this))||void 0===e?void 0:e.popup)||this.popup;!s&&null!==n&&void 0!==n&&n.text&&(this._createPopup(n),s=(0,zt.A)(Nu,this).popup),s&&(s.updateEdited(t),null!==n&&void 0!==n&&n.deleted&&(s.remove(),(0,Ht.A)(Nu,this,null),this.popup=null))}resetEdited(){var t;(0,zt.A)(Iu,this)&&((0,_t.A)(Ou,this,Wu).call(this,(0,zt.A)(Iu,this).rect),null===(t=(0,zt.A)(Nu,this))||void 0===t||t.popup.resetEdited(),(0,Ht.A)(Iu,this,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof Xu||this instanceof zu||(s.tabIndex=0);const{style:r}=s;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof ep){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,s),s}const{width:a,height:o}=this;if(!t&&e.borderStyle.width>0){r.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--total-scale-factor)) / calc(").concat(i,"px * var(--total-scale-factor))");r.borderRadius=e}else if(this instanceof Ju){const t="calc(".concat(a,"px * var(--total-scale-factor)) / calc(").concat(o,"px * var(--total-scale-factor))");r.borderRadius=t}switch(e.borderStyle.style){case ge:r.borderStyle="solid";break;case fe:r.borderStyle="dashed";break;case me:Pe("Unimplemented border style: beveled");break;case ve:Pe("Unimplemented border style: inset");break;case we:r.borderBottomStyle="solid"}const n=e.borderColor||null;n?((0,Ht.A)(Fu,this,!0),r.borderColor=Xe.makeHexColor(0|n[0],0|n[1],0|n[2])):r.borderWidth=0}const l=Xe.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:h,pageX:d,pageY:u}=n.rawDims;r.left="".concat(100*(l[0]-d)/c,"%"),r.top="".concat(100*(l[1]-u)/h,"%");const{rotation:p}=e;return e.hasOwnCanvas||0===p?(r.width="".concat(100*a/c,"%"),r.height="".concat(100*o/h,"%")):this.setRotation(p,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims;let{width:s,height:r}=this;t%180!==0&&([s,r]=[r,s]),e.style.width="".concat(100*s/i,"%"),e.style.height="".concat(100*r/n,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t],s=n[0],r=n.slice(1);i.target.style[e]=Mu["".concat(s,"_HTML")](r),this.annotationStorage.setValue(this.data.id,{[e]:Mu["".concat(s,"_rgb")](r)})};return Fe(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const s=t[n]||i[n];null===s||void 0===s||s(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,s]of Object.entries(e)){const r=i[n];if(r){r({detail:{[n]:s},target:t}),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,s]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[r,a,o,l]=t.subarray(2,6);if(n===r&&s===a&&e===o&&i===l)return}const{style:r}=this.container;let a;if((0,zt.A)(Fu,this)){const{borderColor:t,borderWidth:e}=r;r.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">','<g fill="transparent" stroke="'.concat(t,'" stroke-width="').concat(e,'">')],this.container.classList.add("hasBorder")}const o=n-e,l=s-i,{svgFactory:c}=this,h=c.createElement("svg");h.classList.add("quadrilateralsContainer"),h.setAttribute("width",0),h.setAttribute("height",0),h.role="none";const d=c.createElement("defs");h.append(d);const u=c.createElement("clipPath"),p="clippath_".concat(this.data.id);u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let g=2,f=t.length;g<f;g+=8){var A;const i=t[g],n=t[g+1],r=t[g+2],h=t[g+3],d=c.createElement("rect"),p=(r-e)/o,f=(s-n)/l,m=(i-r)/o,v=(n-h)/l;d.setAttribute("x",p),d.setAttribute("y",f),d.setAttribute("width",m),d.setAttribute("height",v),u.append(d),null===(A=a)||void 0===A||A.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(f,'" width="').concat(m,'" height="').concat(v,'"/>'))}(0,zt.A)(Fu,this)&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(h),this.container.style.clipPath="url(#".concat(p,")")}_createPopup(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const{data:e}=this;let i,n;t?(i={str:t.text},n=t.date):(i=e.contentsObj,n=e.modificationDate);const s=(0,Ht.A)(Nu,this,new ep({data:{color:e.color,titleObj:e.titleObj,modificationDate:n,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(s.render())}get hasPopupElement(){return!!((0,zt.A)(Nu,this)||this.popup||this.data.popupRef)}get extraPopupElement(){return(0,zt.A)(Nu,this)}render(){De("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:s,exportValues:r}of n){if(-1===t)continue;if(s===e)continue;const n="string"===typeof r?r:null,a=document.querySelector('[data-element-id="'.concat(s,'"]'));!a||Du.has(a)?i.push({id:s,exportValue:n,domElement:a}):Pe("_getElementsByName - element not allowed: ".concat(s))}return i}for(const n of document.getElementsByName(t)){const{exportValue:t}=n,s=n.getAttribute("data-element-id");s!==e&&(Du.has(n)&&i.push({id:s,exportValue:t,domElement:n}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}function Wu(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:r,pageX:a,pageY:o}}}}=this;null===i||void 0===i||i.splice(0,4,...t),e.left="".concat(100*(t[0]-a)/s,"%"),e.top="".concat(100*(r-t[3]+o)/r,"%"),0===n?(e.width="".concat(100*(t[2]-t[0])/s,"%"),e.height="".concat(100*(t[3]-t[1])/r,"%")):this.setRotation(n)}class ju extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}var Uu=new WeakSet;class zu extends Bu{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),(0,bt.A)(this,Uu),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?((0,_t.A)(Uu,this,Vu).call(this,i,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?((0,_t.A)(Uu,this,Gu).call(this,i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}_bindLink(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,_t.A)(Uu,this,Hu).call(this),i&&(t.title=i)}_bindNamedAction(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),(0,_t.A)(Uu,this,Hu).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const s=i.get(n);s&&(t[s]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1})}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),(0,_t.A)(Uu,this,Hu).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,_t.A)(Uu,this,Hu).call(this),!this._fieldObjects)return Pe('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const{fields:t,refs:n,include:s}=e,r=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&r.push(i)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const a=this.annotationStorage,o=[];for(const e of r){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";a.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;a.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";a.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(Du.has(i)?i.dispatchEvent(new Event("resetform")):Pe("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}));return!1}}}function Hu(){this.container.setAttribute("data-internal-link","")}function Vu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,n),!1},(0,_t.A)(Uu,this,Hu).call(this)}function Gu(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),(0,_t.A)(Uu,this,Hu).call(this)}class qu extends Bu{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class Xu extends Bu{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Ge.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var r;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&(null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(t)}}))})}_setEventListeners(t,e,i,n){for(const[o,l]of i){var s,r,a;if("Action"===l||null!==(s=this.data.actions)&&void 0!==s&&s[l])"Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,o,l,n),"Focus"!==l||null!==(r=this.data.actions)&&void 0!==r&&r.Blur?"Blur"!==l||null!==(a=this.data.actions)&&void 0!==a&&a.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Xe.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,s=t.style;let r;const a=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(Yt*n))||1);r=Math.min(n,a(e/Yt))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(n,a(t/Yt))}s.fontSize="calc(".concat(r,"px * var(--total-scale-factor))"),s.color=Xe.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Yu extends Xu{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=i),s.setValue(r.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var n;const r=t.getValue(e,{value:this.data.fieldValue});let a=r.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&a.length>o&&(a=a.slice(0,o));let l=r.formattedValue||(null===(n=this.data.textContent)||void 0===n?void 0:n.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const c={userValue:a,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=null!==l&&void 0!==l?l:a,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",null!==l&&void 0!==l?l:a),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Du.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:h,datetimeType:d,timeStep:u}=this.data,p=!!d&&this.enableScripting;h&&(i.title=h),this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",t=>{var e;const n=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=c.userValue=n,c.formattedValue=null});let A=t=>{const{formattedValue:e}=c;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var s;i.addEventListener("focus",t=>{var e;if(c.focused)return;const{target:i}=t;if(p&&(i.type=d,u&&(i.step=u)),c.userValue){const t=c.userValue;if(p)if("time"===d){const e=new Date(t),n=[e.getHours(),e.getMinutes(),e.getSeconds()];i.value=n.map(t=>t.toString().padStart(2,"0")).join(":")}else i.value=new Date(t-Ru).toISOString().split("date"===d?"T":".",1)[0];else i.value=t}c.lastCommittedValue=i.value,c.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(c.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);const n={value(i){var n;c.userValue=null!==(n=i.detail.value)&&void 0!==n?n:"",p||t.setValue(e,{value:c.userValue.toString()}),i.target.value=c.userValue},formattedValue(i){const{formattedValue:n}=i.detail;c.formattedValue=n,null!==n&&void 0!==n&&i.target!==document.activeElement&&(i.target.value=n);const s={formattedValue:n};p&&(s.value=n),t.setValue(e,s)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var n;const{charLimit:s}=i.detail,{target:r}=i;if(0===s)return void r.removeAttribute("maxLength");r.setAttribute("maxLength",s);let a=c.userValue;!a||a.length<=s||(a=a.slice(0,s),r.value=c.userValue=a,t.setValue(e,{value:a}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)}),i.addEventListener("keydown",t=>{var i;c.commitKey=1;let n=-1;if("Escape"===t.key?n=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(c.commitKey=3):n=2,-1===n)return;const{value:s}=t.target;c.lastCommittedValue!==s&&(c.lastCommittedValue=s,c.userValue=s,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const n=A;A=null,i.addEventListener("blur",t=>{var i;if(!c.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(c.focused=!1);const{target:s}=t;let{value:r}=s;if(p){if(r&&"time"===d){const t=r.split(":").map(t=>parseInt(t,10));r=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),s.step=""}else r.includes("T")||(r="".concat(r,"T00:00")),r=new Date(r).valueOf();s.type="text"}var a;(c.userValue=r,c.lastCommittedValue!==r)&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:c.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));n(t)}),null!==(s=this.data.actions)&&void 0!==s&&s.Keystroke&&i.addEventListener("beforeinput",t=>{var i;c.lastCommittedValue=null;const{data:n,target:s}=t,{value:r,selectionStart:a,selectionEnd:o}=s;let l=a,h=o;switch(t.inputType){case"deleteWordBackward":{const t=r.substring(0,a).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=r.substring(a).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":a===o&&(l-=1);break;case"deleteContentForward":a===o&&(h+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,change:n||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(A&&i.addEventListener("blur",A),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--total-scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Ku extends Xu{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Qu extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return Du.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",n=>{const{name:s,checked:r}=n.target;for(const a of this._getElementsByName(s,i)){const i=r&&a.exportValue===e.exportValue;a.domElement&&(a.domElement.checked=i),t.setValue(a.id,{value:i})}t.setValue(i,{value:r})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",e=>{const n={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ju extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});const s=document.createElement("input");if(Du.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",e=>{const{name:n,checked:s}=e.target;for(const r of this._getElementsByName(n,i))t.setValue(r.id,{value:!1});t.setValue(i,{value:s})}),s.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;s.addEventListener("updatefromsandbox",e=>{const s={value:e=>{const s=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=s&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}};this._dispatchEventFromSandbox(s,e)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Zu extends zu{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class $u extends Xu{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");Du.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const i of n.options)i.selected=i.value===e});for(const c of this.data.options){const t=document.createElement("option");t.textContent=c.displayValue,t.value=c.exportValue,i.value.includes(c.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let r=null;if(s){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),r=()=>{t.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=t=>{const e=t?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=a(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",i=>{const s={value(i){var s;null===(s=r)||void 0===s||s();const l=i.detail.value,c=new Set(Array.isArray(l)?l:[l]);for(const t of n.options)t.selected=c.has(t.value);t.setValue(e,{value:a(!0)}),o=a(!1)},multipleSelection(t){n.multiple=!0},remove(i){const s=n.options,r=i.detail.remove;if(s[r].selected=!1,n.remove(r),s.length>0){-1===Array.prototype.findIndex.call(s,t=>t.selected)&&(s[0].selected=!0)}t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),o=a(!1)},insert(i){const{index:s,displayValue:r,exportValue:c}=i.detail.insert,h=n.children[s],d=document.createElement("option");d.textContent=r,d.value=c,h?h.before(d):n.append(d),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of s){const{displayValue:e,exportValue:i}=t,s=document.createElement("option");s.textContent=e,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:a(!0)}),o=a(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(s,i)}),n.addEventListener("input",i=>{var n;const s=a(!0),r=a(!1);t.setValue(e,{value:s}),i.preventDefault(),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:r,changeEx:s,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):n.addEventListener("input",function(i){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}var tp=new WeakSet;class ep extends Bu{constructor(t){const{data:e,elements:i,parent:n}=t,s=!!n._commentManager;if(super(t,{isRenderable:!s&&Bu._hasPopupData(e)}),(0,bt.A)(this,tp),this.elements=i,s&&Bu._hasPopupData(e)){const t=this.popup=(0,_t.A)(tp,this,ip).call(this);for(const e of i)e.popup=t}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const e=this.popup=(0,_t.A)(tp,this,ip).call(this),i=[];for(const n of this.elements)n.popup=e,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>"".concat($e).concat(t)).join(",")),this.container}}function ip(){return new Pp({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})}var np=new WeakMap,sp=new WeakMap,rp=new WeakMap,ap=new WeakMap,op=new WeakMap,lp=new WeakMap,cp=new WeakMap,hp=new WeakMap,dp=new WeakMap,up=new WeakMap,pp=new WeakMap,Ap=new WeakMap,gp=new WeakMap,fp=new WeakMap,mp=new WeakMap,vp=new WeakMap,wp=new WeakMap,bp=new WeakMap,yp=new WeakMap,_p=new WeakMap,xp=new WeakMap,Ep=new WeakMap,Sp=new WeakMap,kp=new WeakMap,Cp=new WeakMap,Mp=new WeakMap,Tp=new WeakSet;class Pp{constructor(t){let{container:e,color:i,elements:n,titleObj:s,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:c,parentRect:h,open:d,commentManager:u=null}=t;(0,bt.A)(this,Tp),(0,yt.A)(this,np,null),(0,yt.A)(this,sp,(0,_t.A)(Tp,this,Wp).bind(this)),(0,yt.A)(this,rp,(0,_t.A)(Tp,this,Hp).bind(this)),(0,yt.A)(this,ap,(0,_t.A)(Tp,this,zp).bind(this)),(0,yt.A)(this,op,(0,_t.A)(Tp,this,Up).bind(this)),(0,yt.A)(this,lp,null),(0,yt.A)(this,cp,null),(0,yt.A)(this,hp,null),(0,yt.A)(this,dp,null),(0,yt.A)(this,up,null),(0,yt.A)(this,pp,null),(0,yt.A)(this,Ap,null),(0,yt.A)(this,gp,!1),(0,yt.A)(this,fp,null),(0,yt.A)(this,mp,null),(0,yt.A)(this,vp,null),(0,yt.A)(this,wp,null),(0,yt.A)(this,bp,null),(0,yt.A)(this,yp,null),(0,yt.A)(this,_p,null),(0,yt.A)(this,xp,null),(0,yt.A)(this,Ep,null),(0,yt.A)(this,Sp,null),(0,yt.A)(this,kp,!1),(0,yt.A)(this,Cp,null),(0,yt.A)(this,Mp,null),(0,Ht.A)(cp,this,e),(0,Ht.A)(Ep,this,s),(0,Ht.A)(hp,this,a),(0,Ht.A)(xp,this,o),(0,Ht.A)(pp,this,l),(0,Ht.A)(lp,this,i),(0,Ht.A)(_p,this,c),(0,Ht.A)(Ap,this,h),(0,Ht.A)(up,this,n),(0,Ht.A)(np,this,u),(0,Ht.A)(Cp,this,n[0]),(0,Ht.A)(dp,this,gi.toDateObject(r)),this.trigger=n.flatMap(t=>t.getElementsToTriggerPopup()),u?this.renderCommentButton():((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(cp,this).hidden=!0,d&&(0,_t.A)(Tp,this,Up).call(this))}renderCommentButton(){if((0,zt.A)(wp,this))return;if((0,zt.A)(bp,this)||(0,_t.A)(Tp,this,Rp).call(this),!(0,zt.A)(bp,this))return;const{signal:t}=(0,Ht.A)(mp,this,new AbortController),e=!!(0,zt.A)(Cp,this).extraPopupElement,i=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!1,!0,!e)},s=()=>{(0,zt.A)(np,this).toggleCommentPopup(this,!1,!1)};if(e){(0,Ht.A)(wp,this,(0,zt.A)(Cp,this).container);for(const e of this.trigger)e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),e.classList.add("popupTriggerArea")}else{const e=(0,Ht.A)(wp,this,document.createElement("button"));e.className="annotationCommentButton";const r=(0,zt.A)(Cp,this).container;e.style.zIndex=r.style.zIndex+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),(0,_t.A)(Tp,this,Ip).call(this),(0,_t.A)(Tp,this,Lp).call(this),e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",n,{signal:t}),e.addEventListener("pointerleave",s,{signal:t}),r.after(e)}}get commentButtonColor(){const{color:t,opacity:e}=(0,zt.A)(Cp,this).commentData;return t?(0,zt.A)(pp,this)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;null===(t=(0,zt.A)(wp,this))||void 0===t||t.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=(0,zt.A)(Cp,this).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return(0,zt.A)(wp,this)}get comment(){return(0,zt.A)(Mp,this)||(0,Ht.A)(Mp,this,(0,zt.A)(Cp,this).commentText),(0,zt.A)(Mp,this)}set comment(t){t!==this.comment&&((0,zt.A)(Cp,this).commentText=(0,Ht.A)(Mp,this,t))}get parentBoundingClientRect(){return(0,zt.A)(Cp,this).layer.getBoundingClientRect()}setCommentButtonStates(t){let{selected:e,hasPopup:i}=t;(0,zt.A)(wp,this)&&((0,zt.A)(wp,this).classList.toggle("selected",e),(0,zt.A)(wp,this).ariaExpanded=i)}setSelectedCommentButton(t){(0,zt.A)(wp,this).classList.toggle("selected",t)}get commentPopupPosition(){if((0,zt.A)(yp,this))return(0,zt.A)(yp,this);const{x:t,y:e,height:i}=(0,zt.A)(wp,this).getBoundingClientRect(),{x:n,y:s,width:r,height:a}=(0,zt.A)(Cp,this).layer.getBoundingClientRect();return[(t-n)/r,(e+i-s)/a]}set commentPopupPosition(t){(0,Ht.A)(yp,this,t)}hasDefaultPopupPosition(){return null===(0,zt.A)(yp,this)}get commentButtonPosition(){return(0,zt.A)(bp,this)}get commentButtonWidth(){return(0,zt.A)(wp,this).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=(0,zt.A)(yp,this)||this.commentButtonPosition.map(t=>t/100),n=this.parentBoundingClientRect,{x:s,y:r,width:a,height:o}=n;(0,zt.A)(np,this).showDialog(null,this,s+e*a,r+i*o,(0,wt.A)((0,wt.A)({},t),{},{parentDimensions:n}))}render(){var t,e;if((0,zt.A)(fp,this))return;const i=(0,Ht.A)(fp,this,document.createElement("div"));if(i.className="popup",(0,zt.A)(lp,this)){const t=i.style.outlineColor=Xe.makeHexColor(...(0,zt.A)(lp,this));i.style.backgroundColor="color-mix(in srgb, ".concat(t," 30%, white)")}const n=document.createElement("span");if(n.className="header",null!==(t=(0,zt.A)(Ep,this))&&void 0!==t&&t.str){const t=document.createElement("span");t.className="title",n.append(t),({dir:t.dir,str:t.textContent}=(0,zt.A)(Ep,this))}if(i.append(n),(0,zt.A)(dp,this)){const t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:(0,zt.A)(dp,this).valueOf()})),t.dateTime=(0,zt.A)(dp,this).toISOString(),n.append(t)}Ti({html:xt(Tp,this,Fp)||(0,zt.A)(hp,this).str,dir:null===(e=(0,zt.A)(hp,this))||void 0===e?void 0:e.dir,className:"popupContent"},i),(0,zt.A)(cp,this).append(i)}updateEdited(t){var e;let{rect:i,popup:n,deleted:s}=t;if((0,zt.A)(np,this))return s?(this.remove(),(0,Ht.A)(Mp,this,null)):n&&(n.deleted?this.remove():((0,_t.A)(Tp,this,Ip).call(this),(0,Ht.A)(Mp,this,n.text))),void(i&&((0,Ht.A)(bp,this,null),(0,_t.A)(Tp,this,Rp).call(this),(0,_t.A)(Tp,this,Lp).call(this)));s||null!==n&&void 0!==n&&n.deleted?this.remove():((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(Sp,this)||(0,Ht.A)(Sp,this,{contentsObj:(0,zt.A)(hp,this),richText:(0,zt.A)(xp,this)}),i&&(0,Ht.A)(vp,this,null),n&&n.text&&((0,Ht.A)(xp,this,(0,_t.A)(Tp,this,Bp).call(this,n.text)),(0,Ht.A)(dp,this,gi.toDateObject(n.date)),(0,Ht.A)(hp,this,null)),null===(e=(0,zt.A)(fp,this))||void 0===e||e.remove(),(0,Ht.A)(fp,this,null))}resetEdited(){var t;(0,zt.A)(Sp,this)&&(({contentsObj:vt(Ht.A,[hp,this])._,richText:vt(Ht.A,[xp,this])._}=(0,zt.A)(Sp,this)),(0,Ht.A)(Sp,this,null),null===(t=(0,zt.A)(fp,this))||void 0===t||t.remove(),(0,Ht.A)(fp,this,null),(0,Ht.A)(vp,this,null))}remove(){var t,e,i;if(null===(t=(0,zt.A)(mp,this))||void 0===t||t.abort(),(0,Ht.A)(mp,this,null),null===(e=(0,zt.A)(fp,this))||void 0===e||e.remove(),(0,Ht.A)(fp,this,null),(0,Ht.A)(kp,this,!1),(0,Ht.A)(gp,this,!1),null===(i=(0,zt.A)(wp,this))||void 0===i||i.remove(),(0,Ht.A)(wp,this,null),this.trigger)for(const n of this.trigger)n.classList.remove("popupTriggerArea")}forceHide(){(0,Ht.A)(kp,this,this.isVisible),(0,zt.A)(kp,this)&&((0,zt.A)(cp,this).hidden=!0)}maybeShow(){(0,zt.A)(np,this)||((0,_t.A)(Tp,this,Dp).call(this),(0,zt.A)(kp,this)&&((0,zt.A)(fp,this)||(0,_t.A)(Tp,this,zp).call(this),(0,Ht.A)(kp,this,!1),(0,zt.A)(cp,this).hidden=!1))}get isVisible(){return!(0,zt.A)(np,this)&&!1===(0,zt.A)(cp,this).hidden}}function Dp(){if((0,zt.A)(mp,this))return;(0,Ht.A)(mp,this,new AbortController);const{signal:t}=(0,zt.A)(mp,this);for(const i of this.trigger)i.addEventListener("click",(0,zt.A)(op,this),{signal:t}),i.addEventListener("pointerenter",(0,zt.A)(ap,this),{signal:t}),i.addEventListener("pointerleave",(0,zt.A)(rp,this),{signal:t}),i.classList.add("popupTriggerArea");for(const i of(0,zt.A)(up,this)){var e;null===(e=i.container)||void 0===e||e.addEventListener("keydown",(0,zt.A)(sp,this),{signal:t})}}function Rp(){const t=(0,zt.A)(up,this).find(t=>t.hasCommentButton);t&&(0,Ht.A)(bp,this,t._normalizePoint(t.commentButtonPosition))}function Lp(){if((0,zt.A)(Cp,this).extraPopupElement&&!(0,zt.A)(Cp,this).editor)return;this.renderCommentButton();const[t,e]=(0,zt.A)(bp,this),{style:i}=(0,zt.A)(wp,this);i.left="calc(".concat(t,"%)"),i.top="calc(".concat(e,"% - var(--comment-button-dim))")}function Ip(){(0,zt.A)(Cp,this).extraPopupElement||(this.renderCommentButton(),(0,zt.A)(wp,this).style.backgroundColor=this.commentButtonColor||"")}function Fp(t){const e=(0,zt.A)(xp,t),i=(0,zt.A)(hp,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:(0,zt.A)(xp,t).html||null}function Np(t){var e;return(null===(e=xt(Tp,t,Fp))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function Op(t){var e;return(null===(e=xt(Tp,t,Fp))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function Bp(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:xt(Tp,this,Op),fontSize:xt(Tp,this,Np)?"calc(".concat(xt(Tp,this,Np),"px * var(--total-scale-factor))"):""}};for(const s of t.split("\n"))e.push({name:"span",value:s,attributes:n});return i}function Wp(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&(0,zt.A)(gp,this))&&(0,_t.A)(Tp,this,Up).call(this)}function jp(){if(null!==(0,zt.A)(vp,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=(0,zt.A)(pp,this);let r=!!(0,zt.A)(Ap,this),a=r?(0,zt.A)(Ap,this):(0,zt.A)(_p,this);for(const u of(0,zt.A)(up,this))if(!a||null!==Xe.intersect(u.data.rect,a)){a=u.data.rect,r=!0;break}const o=Xe.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=r?a[2]-a[0]+5:0,c=o[0]+l,h=o[1];(0,Ht.A)(vp,this,[100*(c-n)/e,100*(h-s)/i]);const{style:d}=(0,zt.A)(cp,this);d.left="".concat((0,zt.A)(vp,this)[0],"%"),d.top="".concat((0,zt.A)(vp,this)[1],"%")}function Up(){(0,zt.A)(np,this)?(0,zt.A)(np,this).toggleCommentPopup(this,!1):((0,Ht.A)(gp,this,!(0,zt.A)(gp,this)),(0,zt.A)(gp,this)?((0,_t.A)(Tp,this,zp).call(this),(0,zt.A)(cp,this).addEventListener("click",(0,zt.A)(op,this)),(0,zt.A)(cp,this).addEventListener("keydown",(0,zt.A)(sp,this))):((0,_t.A)(Tp,this,Hp).call(this),(0,zt.A)(cp,this).removeEventListener("click",(0,zt.A)(op,this)),(0,zt.A)(cp,this).removeEventListener("keydown",(0,zt.A)(sp,this))))}function zp(){(0,zt.A)(fp,this)||this.render(),this.isVisible?(0,zt.A)(gp,this)&&(0,zt.A)(cp,this).classList.add("focused"):((0,_t.A)(Tp,this,jp).call(this),(0,zt.A)(cp,this).hidden=!1,(0,zt.A)(cp,this).style.zIndex=parseInt((0,zt.A)(cp,this).style.zIndex)+1e3)}function Hp(){(0,zt.A)(cp,this).classList.remove("focused"),!(0,zt.A)(gp,this)&&this.isVisible&&((0,zt.A)(cp,this).hidden=!0,(0,zt.A)(cp,this).style.zIndex=parseInt((0,zt.A)(cp,this).style.zIndex)-1e3)}class Vp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=re.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Gp=new WeakMap;class qp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Gp,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=(0,Ht.A)(Gp,this,this.svgFactory.createElement("svg:line"));return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Gp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Xp=new WeakMap;class Yp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Xp,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=(0,Ht.A)(Xp,this,this.svgFactory.createElement("svg:rect"));return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",e-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Xp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Kp=new WeakMap;class Qp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Kp,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:i}=this,n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=(0,Ht.A)(Kp,this,this.svgFactory.createElement("svg:ellipse"));return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Kp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Jp=new WeakMap;class Zp extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,yt.A)(this,Jp,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n},width:s,height:r}=this;if(!e)return this.container;const a=this.svgFactory.create(s,r,!0);let o=[];for(let c=0,h=e.length;c<h;c+=2){const i=e[c]-t[0],n=t[3]-e[c+1];o.push("".concat(i,",").concat(n))}o=o.join(" ");const l=(0,Ht.A)(Jp,this,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,zt.A)(Jp,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class $p extends Zp{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class tA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var eA=new WeakMap,iA=new WeakMap,nA=new WeakSet;class sA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,bt.A)(this,nA),(0,yt.A)(this,eA,null),(0,yt.A)(this,iA,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?re.HIGHLIGHT:re.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:e,inkLists:i,borderStyle:n,popupRef:s}}=this,{transform:r,width:a,height:o}=(0,_t.A)(nA,this,rA).call(this,e,t),l=this.svgFactory.create(a,o,!0),c=(0,Ht.A)(eA,this,this.svgFactory.createElement("svg:g"));l.append(c),c.setAttribute("stroke-width",n.width||1),c.setAttribute("stroke-linecap","round"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit",10),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),c.setAttribute("transform",r);for(let h=0,d=i.length;h<d;h++){const t=this.svgFactory.createElement(this.svgElementName);(0,zt.A)(iA,this).push(t),t.setAttribute("points",i[h].join(",")),c.append(t)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:e,points:i,rect:n}=t,s=(0,zt.A)(eA,this);if(e>=0&&s.setAttribute("stroke-width",e||1),i)for(let r=0,a=(0,zt.A)(iA,this).length;r<a;r++)(0,zt.A)(iA,this)[r].setAttribute("points",i[r].join(","));if(n){const{transform:t,width:e,height:i}=(0,_t.A)(nA,this,rA).call(this,this.data.rotation,n);s.parentElement.setAttribute("viewBox","0 0 ".concat(e," ").concat(i)),s.setAttribute("transform",t)}}getElementsToTriggerPopup(){return(0,zt.A)(iA,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function rA(t,e){switch(t){case 90:return{transform:"rotate(90) translate(".concat(-e[0],",").concat(e[1],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:"rotate(180) translate(".concat(-e[2],",").concat(e[1],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:"rotate(270) translate(".concat(-e[2],",").concat(e[3],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:"translate(".concat(-e[0],",").concat(e[3],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]}}}class aA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=re.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class oA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class lA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class cA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class hA extends Bu{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=re.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var dA=new WeakMap,uA=new WeakSet;class pA extends Bu{constructor(t){var e;super(t,{isRenderable:!0}),(0,bt.A)(this,uA),(0,yt.A)(this,dA,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",(0,wt.A)({source:this},i))}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(e.name)?"paperclip":"pushpin",".svg"),e.fillAlpha&&e.fillAlpha<1&&(i.style="filter: opacity(".concat(Math.round(100*e.fillAlpha),"%);"))),i.addEventListener("dblclick",(0,_t.A)(uA,this,AA).bind(this)),(0,Ht.A)(dA,this,i);const{isMac:n}=Ge.platform;return t.addEventListener("keydown",t=>{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&(0,_t.A)(uA,this,AA).call(this)}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return(0,zt.A)(dA,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function AA(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var gA=new WeakMap,fA=new WeakMap,mA=new WeakMap,vA=new WeakMap,wA=new WeakMap,bA=new WeakMap,yA=new WeakSet;class _A{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:n,annotationEditorUIManager:s,page:r,viewport:a,structTreeLayer:o,commentManager:l,linkService:c,annotationStorage:h}=t;(0,bt.A)(this,yA),(0,yt.A)(this,gA,null),(0,yt.A)(this,fA,null),(0,yt.A)(this,mA,null),(0,yt.A)(this,vA,new Map),(0,yt.A)(this,wA,null),(0,yt.A)(this,bA,null),this.div=e,(0,Ht.A)(gA,this,i),(0,Ht.A)(fA,this,n),(0,Ht.A)(wA,this,o||null),(0,Ht.A)(bA,this,c||null),(0,Ht.A)(mA,this,h||new Ia),this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return(0,zt.A)(vA,this).size>0}async render(t){const{annotations:e}=t,i=this.div;bi(i,this.viewport);const n=new Map,s={data:null,layer:i,linkService:(0,zt.A)(bA,this),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Pu,annotationStorage:(0,zt.A)(mA,this),enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){var r;if(o.noHTML)continue;const t=o.annotationType===Ae.POPUP;if(t){const t=n.get(o.id);if(!t)continue;s.elements=t}else if(o.rect[2]===o.rect[0]||o.rect[3]===o.rect[1])continue;s.data=o;const e=Lu.create(s);if(!e.isRenderable)continue;if(!t&&o.popupRef){const t=n.get(o.popupRef);t?t.push(e):n.set(o.popupRef,[e])}const i=e.render();var a;if(o.hidden&&(i.style.visibility="hidden"),await(0,_t.A)(yA,this,xA).call(this,i,o.id,s.elements),null===(r=e.extraPopupElement)||void 0===r||null===(r=r.popup)||void 0===r||r.renderCommentButton(),e._isEditable)(0,zt.A)(vA,this).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}(0,_t.A)(yA,this,EA).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:(0,zt.A)(bA,this),svgFactory:new Pu,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=_A._defaultBorderStyle),e.data=i;const t=Lu.create(e);if(!t.isRenderable)continue;const n=t.render();await(0,_t.A)(yA,this,xA).call(this,n,i.id,null)}}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,bi(i,{rotation:e.rotation}),(0,_t.A)(yA,this,EA).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,zt.A)(vA,this).values())}getEditableAnnotation(t){return(0,zt.A)(vA,this).get(t)}addFakeAnnotation(t){var e;const{div:i}=this,{id:n,rotation:s}=t,r=new ju({data:{id:n,rect:t.getPDFRect(),rotation:s},editor:t,layer:i,parent:this,enableComment:!!this._commentManager,linkService:(0,zt.A)(bA,this),annotationStorage:(0,zt.A)(mA,this)}),a=r.render();return i.append(a),null===(e=(0,zt.A)(gA,this))||void 0===e||e.moveElementInDOM(i,a,a,!1),r.createOrUpdatePopup(),r}static get _defaultBorderStyle(){return Fe(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:ge,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}async function xA(t,e,i){var n;const s=t.firstChild||t,r=s.id="".concat($e).concat(e),a=await(null===(n=(0,zt.A)(wA,this))||void 0===n?void 0:n.getAriaAttributes(r));if(a)for(const[l,c]of a)s.setAttribute(l,c);var o;i?i.at(-1).container.after(t):(this.div.append(t),null===(o=(0,zt.A)(gA,this))||void 0===o||o.moveElementInDOM(this.div,t,s,!1))}function EA(){if(!(0,zt.A)(fA,this))return;const t=this.div;for(const[i,n]of(0,zt.A)(fA,this)){const s=t.querySelector('[data-annotation-id="'.concat(i,'"]'));if(!s)continue;n.className="annotationContent";const{firstChild:r}=s;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.classList.contains("annotationContent")?r.after(n):r.before(n):s.append(n);const a=(0,zt.A)(vA,this).get(i);var e;if(a)if(a._hasNoCanvas)null===(e=this._annotationEditorUIManager)||void 0===e||e.setMissingCanvas(i,s.id,n),a._hasNoCanvas=!1;else a.canvas=n}(0,zt.A)(fA,this).clear()}const SA=/\r\n?|\n/g;var kA=new WeakMap,CA=new WeakMap,MA=new WeakMap,TA=new WeakMap,PA=new WeakSet;class DA extends na{static get _keyboardManager(){const t=DA.prototype,e=t=>t.isEmpty(),i=gs.TRANSLATE_SMALL,n=gs.TRANSLATE_BIG;return Fe(this,"_keyboardManager",new fn([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"freeTextEditor"})),(0,bt.A)(this,PA),(0,yt.A)(this,kA,""),(0,yt.A)(this,CA,"".concat(this.id,"-editor")),(0,yt.A)(this,MA,null),(0,yt.A)(this,TA,void 0),(0,Vt.A)(this,"_colorPicker",null),this.color=t.color||DA._defaultColor||na._defaultLineColor,(0,Ht.A)(TA,this,t.fontSize||DA._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(t,e){na.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case ae.FREETEXT_SIZE:DA._defaultFontSize=e;break;case ae.FREETEXT_COLOR:DA._defaultColor=e}}updateParams(t,e){switch(t){case ae.FREETEXT_SIZE:(0,_t.A)(PA,this,RA).call(this,e);break;case ae.FREETEXT_COLOR:(0,_t.A)(PA,this,LA).call(this,e)}}static get defaultPropertiesToUpdate(){return[[ae.FREETEXT_SIZE,DA._defaultFontSize],[ae.FREETEXT_COLOR,DA._defaultColor||na._defaultLineColor]]}get propertiesToUpdate(){return[[ae.FREETEXT_SIZE,(0,zt.A)(TA,this)],[ae.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Eu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ae.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-DA._internalPadding*t,-(DA._internalPadding+(0,zt.A)(TA,this))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,Ht.A)(MA,this,new AbortController);const t=this._uiManager.combinedSignal((0,zt.A)(MA,this));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,zt.A)(CA,this)),this._isDraggable=!0,null===(t=(0,zt.A)(MA,this))||void 0===t||t.abort(),(0,Ht.A)(MA,this,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),null!==(e=this._initialOptions)&&void 0!==e&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=(0,zt.A)(kA,this),e=(0,Ht.A)(kA,this,(0,_t.A)(PA,this,IA).call(this).trimEnd());if(t===e)return;const i=t=>{(0,Ht.A)(kA,this,t),t?((0,_t.A)(PA,this,OA).call(this),this._uiManager.rebuild(this),(0,_t.A)(PA,this,FA).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,_t.A)(PA,this,FA).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){DA._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,zt.A)(CA,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat((0,zt.A)(TA,this),"px * var(--total-scale-factor))"),i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this._initialData;let[r,a]=this.getInitialTranslation();[r,a]=this.pageTranslationToScreen(r,a);const[o,l]=this.pageDimensions,[c,h]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=t+(s[0]-c)/o,u=e+this.height-(s[1]-h)/l;break;case 90:d=t+(s[0]-c)/o,u=e-(s[1]-h)/l,[r,a]=[a,-r];break;case 180:d=t-this.width+(s[0]-c)/o,u=e-(s[1]-h)/l,[r,a]=[-r,-a];break;case 270:d=t+(s[0]-c-this.height*l)/o,u=e+(s[1]-h-this.width*o)/l,[r,a]=[-a,r]}this.setAt(d*i,u*n,r,a)}else this._moveAfterPaste(t,e);(0,_t.A)(PA,this,OA).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=WA.call(DA,e.getData("text")||"").replaceAll(SA,"\n");if(!n)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const r=s.getRangeAt(0);if(!n.includes("\n"))return r.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void s.collapseToStart();const{startContainer:a,startOffset:o}=r,l=[],c=[];if(a.nodeType===Node.TEXT_NODE){const t=a.parentElement;if(c.push(a.nodeValue.slice(o).replaceAll(SA,"")),t!==this.editorDiv){let e=l;for(const i of this.editorDiv.childNodes)i!==t?e.push(NA.call(DA,i)):e=c}l.push(a.nodeValue.slice(0,o).replaceAll(SA,""))}else if(a===this.editorDiv){let t=l,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(NA.call(DA,i))}(0,Ht.A)(kA,this,"".concat(l.join("\n")).concat(n).concat(c.join("\n"))),(0,_t.A)(PA,this,OA).call(this);const h=new Range;let d=Math.sumPrecise(l.map(t=>t.length));for(const{firstChild:u}of this.editorDiv.childNodes)if(u.nodeType===Node.TEXT_NODE){const t=u.nodeValue.length;if(d<=t){h.setStart(u,d),h.setEnd(u,d);break}d-=t}s.removeAllRanges(),s.addRange(h)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=DA._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let n=null;if(t instanceof Vp){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:s,rotation:r,id:a,popupRef:o,richText:l,contentsObj:c,creationDate:h,modificationDate:d},textContent:u,textPosition:p,parent:{page:{pageNumber:A}}}=t;if(!u||0===u.length)return null;n=t={annotationType:re.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:p,pageIndex:A-1,rect:s.slice(0),rotation:r,annotationElementId:a,id:a,deleted:!1,popupRef:o,comment:(null===c||void 0===c?void 0:c.str)||null,richText:l,creationDate:h,modificationDate:d}}const s=await super.deserialize(t,e,i);return(0,Ht.A)(TA,s,t.fontSize),s.color=Xe.makeHexColor(...t.color),(0,Ht.A)(kA,s,WA.call(DA,t.value)),s._initialData=n,t.comment&&s.setCommentData(t),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=na._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:(0,zt.A)(TA,this),value:(0,_t.A)(PA,this,BA).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!(0,_t.A)(PA,this,jA).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:i}=e;i.fontSize="calc(".concat((0,zt.A)(TA,this),"px * var(--total-scale-factor))"),i.color=this.color,e.replaceChildren();for(const n of(0,zt.A)(kA,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:(0,zt.A)(kA,this)}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function RA(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--total-scale-factor))"),this.translate(0,-(t-(0,zt.A)(TA,this))*this.parentScale),(0,Ht.A)(TA,this,t),(0,_t.A)(PA,this,FA).call(this)},i=(0,zt.A)(TA,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function LA(t){const e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function IA(){const t=[];this.editorDiv.normalize();let e=null;for(const n of this.editorDiv.childNodes){var i;(null===(i=e)||void 0===i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===n.nodeName||(t.push(NA.call(Ot,n)),e=n)}return t.join("\n")}function FA(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,n=e.style.display,s=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=n,e.classList.toggle("hidden",s)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}function NA(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(SA,"")}function OA(){if(this.editorDiv.replaceChildren(),(0,zt.A)(kA,this))for(const t of(0,zt.A)(kA,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function BA(){return(0,zt.A)(kA,this).replaceAll("\xa0"," ")}function WA(t){return t.replaceAll(" ","\xa0")}function jA(t){const{value:e,fontSize:i,color:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==n[e])||t.pageIndex!==s}Ot=DA,(0,Vt.A)(DA,"_freeTextDefaultContent",""),(0,Vt.A)(DA,"_internalPadding",0),(0,Vt.A)(DA,"_defaultColor",null),(0,Vt.A)(DA,"_defaultFontSize",10),(0,Vt.A)(DA,"_type","freetext"),(0,Vt.A)(DA,"_editorType",re.FREETEXT);class UA{toSVGPath(){De("Abstract method `toSVGPath` must be implemented.")}get box(){De("Abstract getter `box` must be implemented.")}serialize(t,e){De("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,n,s,r){r||(r=new Float32Array(t.length));for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a]*n,r[a+1]=i+t[a+1]*s;return r}static _rescaleAndSwap(t,e,i,n,s,r){r||(r=new Float32Array(t.length));for(let a=0,o=t.length;a<o;a+=2)r[a]=e+t[a+1]*n,r[a+1]=i+t[a]*s;return r}static _translate(t,e,i,n){n||(n=new Float32Array(t.length));for(let s=0,r=t.length;s<r;s+=2)n[s]=e+t[s],n[s+1]=i+t[s+1];return n}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,n,s){switch(s){case 90:return[1-e/i,t/n];case 180:return[1-t/i,1-e/n];case 270:return[e/i,1-t/n];default:return[t/i,e/n]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,n,s,r){return[(t+5*i)/6,(e+5*n)/6,(5*i+s)/6,(5*n+r)/6,(i+s)/2,(n+r)/2]}}(0,Vt.A)(UA,"PRECISION",1e-4);var zA=new WeakMap,HA=new WeakMap,VA=new WeakMap,GA=new WeakMap,qA=new WeakMap,XA=new WeakMap,YA=new WeakMap,KA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakMap,$A=new WeakMap,tg=new WeakMap,eg=new WeakSet;class ig{constructor(t,e,i,n,s){let{x:r,y:a}=t,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;(0,bt.A)(this,eg),(0,yt.A)(this,zA,void 0),(0,yt.A)(this,HA,[]),(0,yt.A)(this,VA,void 0),(0,yt.A)(this,GA,void 0),(0,yt.A)(this,qA,[]),(0,yt.A)(this,XA,new Float32Array(18)),(0,yt.A)(this,YA,void 0),(0,yt.A)(this,KA,void 0),(0,yt.A)(this,QA,void 0),(0,yt.A)(this,JA,void 0),(0,yt.A)(this,ZA,void 0),(0,yt.A)(this,$A,void 0),(0,yt.A)(this,tg,[]),(0,Ht.A)(zA,this,e),(0,Ht.A)($A,this,n*i),(0,Ht.A)(GA,this,s),(0,zt.A)(XA,this).set([NaN,NaN,NaN,NaN,r,a],6),(0,Ht.A)(VA,this,o),(0,Ht.A)(JA,this,hg._*i),(0,Ht.A)(QA,this,dg._*i),(0,Ht.A)(ZA,this,i),(0,zt.A)(tg,this).push(r,a)}isEmpty(){return isNaN((0,zt.A)(XA,this)[8])}add(t){var e;let{x:i,y:n}=t;(0,Ht.A)(YA,this,i),(0,Ht.A)(KA,this,n);const[s,r,a,o]=(0,zt.A)(zA,this);let[l,c,h,d]=(0,zt.A)(XA,this).subarray(8,12);const u=i-h,p=n-d,A=Math.hypot(u,p);if(A<(0,zt.A)(QA,this))return!1;const g=A-(0,zt.A)(JA,this),f=g/A,m=f*u,v=f*p;let w=l,b=c;l=h,c=d,h+=m,d+=v,null===(e=(0,zt.A)(tg,this))||void 0===e||e.push(i,n);const y=m/g,_=-v/g*(0,zt.A)($A,this),x=y*(0,zt.A)($A,this);if((0,zt.A)(XA,this).set((0,zt.A)(XA,this).subarray(2,8),0),(0,zt.A)(XA,this).set([h+_,d+x],4),(0,zt.A)(XA,this).set((0,zt.A)(XA,this).subarray(14,18),12),(0,zt.A)(XA,this).set([h-_,d-x],16),isNaN((0,zt.A)(XA,this)[6]))return 0===(0,zt.A)(qA,this).length&&((0,zt.A)(XA,this).set([l+_,c+x],2),(0,zt.A)(qA,this).push(NaN,NaN,NaN,NaN,(l+_-s)/a,(c+x-r)/o),(0,zt.A)(XA,this).set([l-_,c-x],14),(0,zt.A)(HA,this).push(NaN,NaN,NaN,NaN,(l-_-s)/a,(c-x-r)/o)),(0,zt.A)(XA,this).set([w,b,l,c,h,d],6),!this.isEmpty();(0,zt.A)(XA,this).set([w,b,l,c,h,d],6);return Math.abs(Math.atan2(b-c,w-l)-Math.atan2(v,m))<Math.PI/2?([l,c,h,d]=(0,zt.A)(XA,this).subarray(2,6),(0,zt.A)(qA,this).push(NaN,NaN,NaN,NaN,((l+h)/2-s)/a,((c+d)/2-r)/o),[l,c,w,b]=(0,zt.A)(XA,this).subarray(14,18),(0,zt.A)(HA,this).push(NaN,NaN,NaN,NaN,((w+l)/2-s)/a,((b+c)/2-r)/o),!0):([w,b,l,c,h,d]=(0,zt.A)(XA,this).subarray(0,6),(0,zt.A)(qA,this).push(((w+5*l)/6-s)/a,((b+5*c)/6-r)/o,((5*l+h)/6-s)/a,((5*c+d)/6-r)/o,((l+h)/2-s)/a,((c+d)/2-r)/o),[h,d,l,c,w,b]=(0,zt.A)(XA,this).subarray(12,18),(0,zt.A)(HA,this).push(((w+5*l)/6-s)/a,((b+5*c)/6-r)/o,((5*l+h)/6-s)/a,((5*c+d)/6-r)/o,((l+h)/2-s)/a,((c+d)/2-r)/o),!0)}toSVGPath(){if(this.isEmpty())return"";const t=(0,zt.A)(qA,this),e=(0,zt.A)(HA,this);if(isNaN((0,zt.A)(XA,this)[6])&&!this.isEmpty())return(0,_t.A)(eg,this,sg).call(this);const i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let n=6;n<t.length;n+=6)isNaN(t[n])?i.push("L".concat(t[n+4]," ").concat(t[n+5])):i.push("C".concat(t[n]," ").concat(t[n+1]," ").concat(t[n+2]," ").concat(t[n+3]," ").concat(t[n+4]," ").concat(t[n+5]));(0,_t.A)(eg,this,ag).call(this,i);for(let n=e.length-6;n>=6;n-=6)isNaN(e[n])?i.push("L".concat(e[n+4]," ").concat(e[n+5])):i.push("C".concat(e[n]," ").concat(e[n+1]," ").concat(e[n+2]," ").concat(e[n+3]," ").concat(e[n+4]," ").concat(e[n+5]));return(0,_t.A)(eg,this,rg).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,r){return new bg(t,e,i,n,s,r)}getOutlines(){var t,e;const i=(0,zt.A)(qA,this),n=(0,zt.A)(HA,this),s=(0,zt.A)(XA,this),[r,a,o,l]=(0,zt.A)(zA,this),c=new Float32Array((null!==(t=null===(e=(0,zt.A)(tg,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let u=0,p=c.length-2;u<p;u+=2)c[u]=((0,zt.A)(tg,this)[u]-r)/o,c[u+1]=((0,zt.A)(tg,this)[u+1]-a)/l;if(c[c.length-2]=((0,zt.A)(YA,this)-r)/o,c[c.length-1]=((0,zt.A)(KA,this)-a)/l,isNaN(s[6])&&!this.isEmpty())return(0,_t.A)(eg,this,og).call(this,c);const h=new Float32Array((0,zt.A)(qA,this).length+24+(0,zt.A)(HA,this).length);let d=i.length;for(let u=0;u<d;u+=2)isNaN(i[u])?h[u]=h[u+1]=NaN:(h[u]=i[u],h[u+1]=i[u+1]);d=(0,_t.A)(eg,this,cg).call(this,h,d);for(let u=n.length-6;u>=6;u-=6)for(let t=0;t<6;t+=2)isNaN(n[u+t])?(h[d]=h[d+1]=NaN,d+=2):(h[d]=n[u+t],h[d+1]=n[u+t+1],d+=2);return(0,_t.A)(eg,this,lg).call(this,h,d),this.newFreeDrawOutline(h,c,(0,zt.A)(zA,this),(0,zt.A)(ZA,this),(0,zt.A)(VA,this),(0,zt.A)(GA,this))}}function ng(){const t=(0,zt.A)(XA,this).subarray(4,6),e=(0,zt.A)(XA,this).subarray(16,18),[i,n,s,r]=(0,zt.A)(zA,this);return[((0,zt.A)(YA,this)+(t[0]-e[0])/2-i)/s,((0,zt.A)(KA,this)+(t[1]-e[1])/2-n)/r,((0,zt.A)(YA,this)+(e[0]-t[0])/2-i)/s,((0,zt.A)(KA,this)+(e[1]-t[1])/2-n)/r]}function sg(){const[t,e,i,n]=(0,zt.A)(zA,this),[s,r,a,o]=(0,_t.A)(eg,this,ng).call(this);return"M".concat(((0,zt.A)(XA,this)[2]-t)/i," ").concat(((0,zt.A)(XA,this)[3]-e)/n," L").concat(((0,zt.A)(XA,this)[4]-t)/i," ").concat(((0,zt.A)(XA,this)[5]-e)/n," L").concat(s," ").concat(r," L").concat(a," ").concat(o," L").concat(((0,zt.A)(XA,this)[16]-t)/i," ").concat(((0,zt.A)(XA,this)[17]-e)/n," L").concat(((0,zt.A)(XA,this)[14]-t)/i," ").concat(((0,zt.A)(XA,this)[15]-e)/n," Z")}function rg(t){const e=(0,zt.A)(HA,this);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function ag(t){const[e,i,n,s]=(0,zt.A)(zA,this),r=(0,zt.A)(XA,this).subarray(4,6),a=(0,zt.A)(XA,this).subarray(16,18),[o,l,c,h]=(0,_t.A)(eg,this,ng).call(this);t.push("L".concat((r[0]-e)/n," ").concat((r[1]-i)/s," L").concat(o," ").concat(l," L").concat(c," ").concat(h," L").concat((a[0]-e)/n," ").concat((a[1]-i)/s))}function og(t){const e=(0,zt.A)(XA,this),[i,n,s,r]=(0,zt.A)(zA,this),[a,o,l,c]=(0,_t.A)(eg,this,ng).call(this),h=new Float32Array(36);return h.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-n)/r,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-n)/r,NaN,NaN,NaN,NaN,a,o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-n)/r,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-n)/r],0),this.newFreeDrawOutline(h,t,(0,zt.A)(zA,this),(0,zt.A)(ZA,this),(0,zt.A)(VA,this),(0,zt.A)(GA,this))}function lg(t,e){const i=(0,zt.A)(HA,this);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function cg(t,e){const i=(0,zt.A)(XA,this).subarray(4,6),n=(0,zt.A)(XA,this).subarray(16,18),[s,r,a,o]=(0,zt.A)(zA,this),[l,c,h,d]=(0,_t.A)(eg,this,ng).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/a,(i[1]-r)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,h,d,NaN,NaN,NaN,NaN,(n[0]-s)/a,(n[1]-r)/o],e),e+24}var hg={_:8},dg={_:hg._+2},ug=new WeakMap,pg=new WeakMap,Ag=new WeakMap,gg=new WeakMap,fg=new WeakMap,mg=new WeakMap,vg=new WeakMap,wg=new WeakSet;class bg extends UA{constructor(t,e,i,n,s,r){super(),(0,bt.A)(this,wg),(0,yt.A)(this,ug,void 0),(0,yt.A)(this,pg,new Float32Array(4)),(0,yt.A)(this,Ag,void 0),(0,yt.A)(this,gg,void 0),(0,yt.A)(this,fg,void 0),(0,yt.A)(this,mg,void 0),(0,yt.A)(this,vg,void 0),(0,Ht.A)(vg,this,t),(0,Ht.A)(fg,this,e),(0,Ht.A)(ug,this,i),(0,Ht.A)(mg,this,n),(0,Ht.A)(Ag,this,s),(0,Ht.A)(gg,this,r),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],(0,_t.A)(wg,this,yg).call(this,r);const[a,o,l,c]=(0,zt.A)(pg,this);for(let h=0,d=t.length;h<d;h+=2)t[h]=(t[h]-a)/l,t[h+1]=(t[h+1]-o)/c;for(let h=0,d=e.length;h<d;h+=2)e[h]=(e[h]-a)/l,e[h+1]=(e[h+1]-o)/c}toSVGPath(){const t=["M".concat((0,zt.A)(vg,this)[4]," ").concat((0,zt.A)(vg,this)[5])];for(let e=6,i=(0,zt.A)(vg,this).length;e<i;e+=6)isNaN((0,zt.A)(vg,this)[e])?t.push("L".concat((0,zt.A)(vg,this)[e+4]," ").concat((0,zt.A)(vg,this)[e+5])):t.push("C".concat((0,zt.A)(vg,this)[e]," ").concat((0,zt.A)(vg,this)[e+1]," ").concat((0,zt.A)(vg,this)[e+2]," ").concat((0,zt.A)(vg,this)[e+3]," ").concat((0,zt.A)(vg,this)[e+4]," ").concat((0,zt.A)(vg,this)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let[i,n,s,r]=t;const a=s-i,o=r-n;let l,c;switch(e){case 0:l=UA._rescale((0,zt.A)(vg,this),i,r,a,-o),c=UA._rescale((0,zt.A)(fg,this),i,r,a,-o);break;case 90:l=UA._rescaleAndSwap((0,zt.A)(vg,this),i,n,a,o),c=UA._rescaleAndSwap((0,zt.A)(fg,this),i,n,a,o);break;case 180:l=UA._rescale((0,zt.A)(vg,this),s,n,-a,o),c=UA._rescale((0,zt.A)(fg,this),s,n,-a,o);break;case 270:l=UA._rescaleAndSwap((0,zt.A)(vg,this),s,r,-a,-o),c=UA._rescaleAndSwap((0,zt.A)(fg,this),s,r,-a,-o)}return{outline:Array.from(l),points:[Array.from(c)]}}get box(){return(0,zt.A)(pg,this)}newOutliner(t,e,i,n,s){return new ig(t,e,i,n,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(t,e){const[i,n,s,r]=(0,zt.A)(pg,this),[a,o,l,c]=(0,zt.A)(ug,this),h=s*l,d=r*c,u=i*l+a,p=n*c+o,A=this.newOutliner({x:(0,zt.A)(fg,this)[0]*h+u,y:(0,zt.A)(fg,this)[1]*d+p},(0,zt.A)(ug,this),(0,zt.A)(mg,this),t,(0,zt.A)(gg,this),null!==e&&void 0!==e?e:(0,zt.A)(Ag,this));for(let g=2;g<(0,zt.A)(fg,this).length;g+=2)A.add({x:(0,zt.A)(fg,this)[g]*h+u,y:(0,zt.A)(fg,this)[g+1]*d+p});return A.getOutlines()}}function yg(t){const e=(0,zt.A)(vg,this);let i=e[4],n=e[5];const s=[i,n,i,n];let r=i,a=n,o=i,l=n;const c=t?Math.max:Math.min,h=new Float32Array(4);for(let u=6,p=e.length;u<p;u+=6){const t=e[u+4],d=e[u+5];isNaN(e[u])?(Xe.pointBoundingBox(t,d,s),a>d?(r=t,a=d):a===d&&(r=c(r,t)),l<d?(o=t,l=d):l===d&&(o=c(o,t))):(h[0]=h[1]=1/0,h[2]=h[3]=-1/0,Xe.bezierBoundingBox(i,n,...e.slice(u,u+6),h),Xe.rectBoundingBox(h[0],h[1],h[2],h[3],s),a>h[1]?(r=h[0],a=h[1]):a===h[1]&&(r=c(r,h[0])),l<h[3]?(o=h[2],l=h[3]):l===h[3]&&(o=c(o,h[2]))),i=t,n=d}const d=(0,zt.A)(pg,this);d[0]=s[0]-(0,zt.A)(Ag,this),d[1]=s[1]-(0,zt.A)(Ag,this),d[2]=s[2]-s[0]+2*(0,zt.A)(Ag,this),d[3]=s[3]-s[1]+2*(0,zt.A)(Ag,this),this.firstPoint=[r,a],this.lastPoint=[o,l]}var _g=new WeakMap,xg=new WeakMap,Eg=new WeakMap,Sg=new WeakMap,kg=new WeakMap,Cg=new WeakSet;class Mg{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];(0,bt.A)(this,Cg),(0,yt.A)(this,_g,void 0),(0,yt.A)(this,xg,void 0),(0,yt.A)(this,Eg,void 0),(0,yt.A)(this,Sg,[]),(0,yt.A)(this,kg,[]);const s=[1/0,1/0,-1/0,-1/0],r=10**-4;for(const{x:A,y:g,width:f,height:m}of t){const t=Math.floor((A-e)/r)*r,i=Math.ceil((A+f+e)/r)*r,n=Math.floor((g-e)/r)*r,a=Math.ceil((g+m+e)/r)*r,o=[t,n,a,!0],l=[i,n,a,!1];(0,zt.A)(Sg,this).push(o,l),Xe.rectBoundingBox(t,n,i,a,s)}const a=s[2]-s[0]+2*i,o=s[3]-s[1]+2*i,l=s[0]-i,c=s[1]-i;let h=n?-1/0:1/0,d=1/0;const u=(0,zt.A)(Sg,this).at(n?-1:-2),p=[u[0],u[2]];for(const A of(0,zt.A)(Sg,this)){const[t,e,i,s]=A;!s&&n?e<d?(d=e,h=t):e===d&&(h=Math.max(h,t)):s&&!n&&(e<d?(d=e,h=t):e===d&&(h=Math.min(h,t))),A[0]=(t-l)/a,A[1]=(e-c)/o,A[2]=(i-c)/o}(0,Ht.A)(_g,this,new Float32Array([l,c,a,o])),(0,Ht.A)(xg,this,[h,d]),(0,Ht.A)(Eg,this,p)}getOutlines(){(0,zt.A)(Sg,this).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of(0,zt.A)(Sg,this))e[3]?(t.push(...(0,_t.A)(Cg,this,Lg).call(this,e)),(0,_t.A)(Cg,this,Dg).call(this,e)):((0,_t.A)(Cg,this,Rg).call(this,e),t.push(...(0,_t.A)(Cg,this,Lg).call(this,e)));return(0,_t.A)(Cg,this,Tg).call(this,t)}}function Tg(t){const e=[],i=new Set;for(const r of t){const[t,i,n]=r;e.push([t,i,r],[t,n,r])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let r=0,a=e.length;r<a;r+=2){const t=e[r][2],n=e[r+1][2];t.push(n),n.push(t),i.add(t),i.add(n)}const n=[];let s;for(;i.size>0;){const t=i.values().next().value;let[e,r,a,o,l]=t;i.delete(t);let c=e,h=r;for(s=[e,a],n.push(s);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,r,a,o,l]=t,c!==e&&(s.push(c,h,e,h===r?r:a),c=e),h=h===r?a:r}s.push(c,h)}return new Ng(n,(0,zt.A)(_g,this),(0,zt.A)(xg,this),(0,zt.A)(Eg,this))}function Pg(t){const e=(0,zt.A)(kg,this);let i=0,n=e.length-1;for(;i<=n;){const s=i+n>>1,r=e[s][0];if(r===t)return s;r<t?i=s+1:n=s-1}return n+1}function Dg(t){let[,e,i]=t;const n=(0,_t.A)(Cg,this,Pg).call(this,e);(0,zt.A)(kg,this).splice(n,0,[e,i])}function Rg(t){let[,e,i]=t;const n=(0,_t.A)(Cg,this,Pg).call(this,e);for(let s=n;s<(0,zt.A)(kg,this).length;s++){const[t,n]=(0,zt.A)(kg,this)[s];if(t!==e)break;if(t===e&&n===i)return void(0,zt.A)(kg,this).splice(s,1)}for(let s=n-1;s>=0;s--){const[t,n]=(0,zt.A)(kg,this)[s];if(t!==e)break;if(t===e&&n===i)return void(0,zt.A)(kg,this).splice(s,1)}}function Lg(t){const[e,i,n]=t,s=[[e,i,n]],r=(0,_t.A)(Cg,this,Pg).call(this,n);for(let a=0;a<r;a++){const[t,i]=(0,zt.A)(kg,this)[a];for(let n=0,r=s.length;n<r;n++){const[,a,o]=s[n];if(!(i<=a||o<=t))if(a>=t)if(o>i)s[n][1]=i;else{if(1===r)return[];s.splice(n,1),n--,r--}else s[n][2]=t,o>i&&s.push([e,i,o])}}return s}var Ig=new WeakMap,Fg=new WeakMap;class Ng extends UA{constructor(t,e,i,n){super(),(0,yt.A)(this,Ig,void 0),(0,yt.A)(this,Fg,void 0),(0,Ht.A)(Fg,this,t),(0,Ht.A)(Ig,this,e),this.firstPoint=i,this.lastPoint=n}toSVGPath(){const t=[];for(const e of(0,zt.A)(Fg,this)){let[i,n]=e;t.push("M".concat(i," ").concat(n));for(let s=2;s<e.length;s+=2){const r=e[s],a=e[s+1];r===i?(t.push("V".concat(a)),n=a):a===n&&(t.push("H".concat(r)),i=r)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,n,s,r]=t;const a=[],o=s-i,l=r-n;for(const c of(0,zt.A)(Fg,this)){const t=new Array(c.length);for(let e=0;e<c.length;e+=2)t[e]=i+c[e]*o,t[e+1]=r-c[e+1]*l;a.push(t)}return a}get box(){return(0,zt.A)(Ig,this)}get classNamesForOutlining(){return["highlightOutline"]}}class Og extends ig{newFreeDrawOutline(t,e,i,n,s,r){return new Bg(t,e,i,n,s,r)}}class Bg extends bg{newOutliner(t,e,i,n,s){return new Og(t,e,i,n,s,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}var Wg=new WeakMap,jg=new WeakMap,Ug=new WeakMap,zg=new WeakMap,Hg=new WeakMap,Vg=new WeakMap,Gg=new WeakMap,qg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,Qg=new WeakMap,Jg=new WeakMap,Zg=new WeakMap,$g=new WeakMap,tf=new WeakMap,ef=new WeakMap,nf=new WeakMap,sf=new WeakSet;class rf extends na{static get _keyboardManager(){const t=rf.prototype;return Fe(this,"_keyboardManager",new fn([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"highlightEditor"})),(0,bt.A)(this,sf),(0,yt.A)(this,Wg,null),(0,yt.A)(this,jg,0),(0,yt.A)(this,Ug,void 0),(0,yt.A)(this,zg,null),(0,yt.A)(this,Hg,null),(0,yt.A)(this,Vg,null),(0,yt.A)(this,Gg,null),(0,yt.A)(this,qg,0),(0,yt.A)(this,Xg,null),(0,yt.A)(this,Yg,null),(0,yt.A)(this,Kg,null),(0,yt.A)(this,Qg,!1),(0,yt.A)(this,Jg,null),(0,yt.A)(this,Zg,null),(0,yt.A)(this,$g,null),(0,yt.A)(this,tf,""),(0,yt.A)(this,ef,void 0),(0,yt.A)(this,nf,""),this.color=t.color||rf._defaultColor,(0,Ht.A)(ef,this,t.thickness||rf._defaultThickness),this.opacity=t.opacity||rf._defaultOpacity,(0,Ht.A)(Ug,this,t.boxes||null),(0,Ht.A)(nf,this,t.methodOfCreation||""),(0,Ht.A)(tf,this,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?((0,Ht.A)(Qg,this,!0),(0,_t.A)(sf,this,of).call(this,t),(0,_t.A)(sf,this,uf).call(this)):(0,zt.A)(Ug,this)&&((0,Ht.A)(Wg,this,t.anchorNode),(0,Ht.A)(jg,this,t.anchorOffset),(0,Ht.A)(Gg,this,t.focusNode),(0,Ht.A)(qg,this,t.focusOffset),(0,_t.A)(sf,this,af).call(this),(0,_t.A)(sf,this,uf).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:(0,zt.A)(Qg,this)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:(0,zt.A)(ef,this),methodOfCreation:(0,zt.A)(nf,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;na.initialize(t,e),rf._defaultColor||(rf._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case ae.HIGHLIGHT_COLOR:rf._defaultColor=e;break;case ae.HIGHLIGHT_THICKNESS:rf._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,zt.A)(Zg,this)}get commentButtonPosition(){return(0,zt.A)(Jg,this)}updateParams(t,e){switch(t){case ae.HIGHLIGHT_COLOR:(0,_t.A)(sf,this,lf).call(this,e);break;case ae.HIGHLIGHT_THICKNESS:(0,_t.A)(sf,this,cf).call(this,e)}}static get defaultPropertiesToUpdate(){return[[ae.HIGHLIGHT_COLOR,rf._defaultColor],[ae.HIGHLIGHT_THICKNESS,rf._defaultThickness]]}get propertiesToUpdate(){return[[ae.HIGHLIGHT_COLOR,this.color||rf._defaultColor],[ae.HIGHLIGHT_THICKNESS,(0,zt.A)(ef,this)||rf._defaultThickness],[ae.HIGHLIGHT_FREE,(0,zt.A)(Qg,this)]]}onUpdatedColor(){var t,e;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)(Kg,this),{root:{fill:this.color,"fill-opacity":this.opacity}}),null===(e=(0,zt.A)(Hg,this))||void 0===e||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){if(this._uiManager.highlightColors){return[["colorPicker",(0,Ht.A)(Hg,this,new pu({editor:this}))]]}return super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,_t.A)(sf,this,ff).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,_t.A)(sf,this,ff).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){(0,_t.A)(sf,this,df).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,_t.A)(sf,this,uf).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,_t.A)(sf,this,df).call(this);else if(t){var i;(0,_t.A)(sf,this,uf).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const{drawLayer:e}=this.parent;let i;(0,zt.A)(Qg,this)?(t=(t-this.rotation+360)%360,i=pf.call(rf,(0,zt.A)(Yg,this).box,t)):i=pf.call(rf,[this.x,this.y,this.width,this.height],t),e.updateProperties((0,zt.A)(Kg,this),{bbox:i,root:{"data-main-rotation":t}}),e.updateProperties((0,zt.A)($g,this),{bbox:pf.call(rf,(0,zt.A)(Vg,this).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();(0,zt.A)(tf,this)&&(t.setAttribute("aria-label",(0,zt.A)(tf,this)),t.setAttribute("role","mark")),(0,zt.A)(Qg,this)?t.classList.add("free"):this.div.addEventListener("keydown",(0,_t.A)(sf,this,Af).bind(this),{signal:this._uiManager._signal});const e=(0,Ht.A)(Xg,this,document.createElement("div"));return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,zt.A)(zg,this),this.setDims(this.width,this.height),tn(this,(0,zt.A)(Xg,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)($g,this),{rootClass:{hovered:!0}}))}pointerleave(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)($g,this),{rootClass:{hovered:!1}}))}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,_t.A)(sf,this,gf).call(this,!0);break;case 1:case 3:(0,_t.A)(sf,this,gf).call(this,!1)}}select(){var t;super.select(),(0,zt.A)($g,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)($g,this),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),(0,zt.A)($g,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,zt.A)($g,this),{rootClass:{selected:!1}}),(0,zt.A)(Qg,this)||(0,_t.A)(sf,this,gf).call(this,!1))}get _mustFixPosition(){return!(0,zt.A)(Qg,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.updateProperties((0,zt.A)(Kg,this),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties((0,zt.A)($g,this),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,i){let{target:n,x:s,y:r}=i;const{x:a,y:o,width:l,height:c}=n.getBoundingClientRect(),h=new AbortController,d=t.combinedSignal(h),u=e=>{h.abort(),(0,_t.A)(rf,this,bf).call(this,t,e)};window.addEventListener("blur",u,{signal:d}),window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("pointerdown",Ai,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",pi,{signal:d}),n.addEventListener("pointermove",(0,_t.A)(rf,this,wf).bind(this,t),{signal:d}),this._freeHighlight=new Og({x:s,y:r},[a,o,l,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0))}static async deserialize(t,e,i){let n=null;if(t instanceof aA){const{data:{quadPoints:e,rect:i,rotation:s,id:r,color:a,opacity:o,popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:re.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}else if(t instanceof sA){const{data:{inkLists:e,rect:i,rotation:s,id:r,color:a,borderStyle:{rawWidth:o},popupRef:l,richText:c,contentsObj:h,creationDate:d,modificationDate:u},parent:{page:{pageNumber:p}}}=t;n=t={annotationType:re.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:l,richText:c,comment:(null===h||void 0===h?void 0:h.str)||null,creationDate:d,modificationDate:u}}const{color:s,quadPoints:r,inkLists:a,opacity:o}=t,l=await super.deserialize(t,e,i);l.color=Xe.makeHexColor(...s),l.opacity=o||1,a&&(0,Ht.A)(ef,l,t.thickness),l._initialData=n,t.comment&&l.setCommentData(t);const[c,h]=l.pageDimensions,[d,u]=l.pageTranslation;if(r){const t=(0,Ht.A)(Ug,l,[]);for(let e=0;e<r.length;e+=8)t.push({x:(r[e]-d)/c,y:1-(r[e+1]-u)/h,width:(r[e+2]-r[e])/c,height:(r[e+1]-r[e+5])/h});(0,_t.A)(sf,l,af).call(l),(0,_t.A)(sf,l,uf).call(l),l.rotate(l.rotation)}else if(a){(0,Ht.A)(Qg,l,!0);const t=a[0],i={x:t[0]-d,y:h-(t[1]-u)},n=new Og(i,[0,0,c,h],1,(0,zt.A)(ef,l)/2,!0,.001);for(let e=0,a=t.length;e<a;e+=2)i.x=t[e]-d,i.y=h-(t[e+1]-u),n.add(i);const{id:s,clipPathId:r}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:l.color,"fill-opacity":l._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:n.toSVGPath()}},!0,!0);(0,_t.A)(sf,l,of).call(l,{highlightOutlines:n.getOutlines(),highlightId:s,clipPathId:r}),(0,_t.A)(sf,l,uf).call(l),l.rotate(l.parentRotation)}return l}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=na._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return Object.assign(i,{color:e,opacity:this.opacity,thickness:(0,zt.A)(ef,this),quadPoints:(0,_t.A)(sf,this,mf).call(this),outlines:(0,_t.A)(sf,this,vf).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!(0,_t.A)(sf,this,yf).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}}function af(){const t=new Mg((0,zt.A)(Ug,this),.001);(0,Ht.A)(Yg,this,t.getOutlines()),[this.x,this.y,this.width,this.height]=(0,zt.A)(Yg,this).box;const e=new Mg((0,zt.A)(Ug,this),.0025,.001,"ltr"===this._uiManager.direction);(0,Ht.A)(Vg,this,e.getOutlines());const{firstPoint:i}=(0,zt.A)(Yg,this);(0,Ht.A)(Jg,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:n}=(0,zt.A)(Vg,this);(0,Ht.A)(Zg,this,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])}function of(t){let{highlightOutlines:e,highlightId:i,clipPathId:n}=t;(0,Ht.A)(Yg,this,e);if((0,Ht.A)(Vg,this,e.getNewOutline((0,zt.A)(ef,this)/2+1.5,.0025)),i>=0)(0,Ht.A)(Kg,this,i),(0,Ht.A)(zg,this,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),(0,Ht.A)($g,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:(0,zt.A)(Vg,this).box,path:{d:(0,zt.A)(Vg,this).toSVGPath()}},!0));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties((0,zt.A)(Kg,this),{bbox:pf.call(Bt,(0,zt.A)(Yg,this).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties((0,zt.A)($g,this),{bbox:pf.call(Bt,(0,zt.A)(Vg,this).box,t),path:{d:(0,zt.A)(Vg,this).toSVGPath()}})}const[s,r,a,o]=e.box;switch(this.rotation){case 0:this.x=s,this.y=r,this.width=a,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=r,this.y=1-s,this.width=a*e/t,this.height=o*t/e;break}case 180:this.x=1-s,this.y=1-r,this.width=a,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-r,this.y=s,this.width=a*e/t,this.height=o*t/e;break}}const{firstPoint:l}=e;(0,Ht.A)(Jg,this,[(l[0]-s)/a,(l[1]-r)/o]);const{lastPoint:c}=(0,zt.A)(Vg,this);(0,Ht.A)(Zg,this,[(c[0]-s)/a,(c[1]-r)/o])}function lf(t){const e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,n=this.opacity;this.addCommands({cmd:e.bind(this,t,Bt._defaultOpacity),undo:e.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}function cf(t){const e=(0,zt.A)(ef,this),i=t=>{(0,Ht.A)(ef,this,t),(0,_t.A)(sf,this,hf).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ae.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function hf(t){(0,zt.A)(Qg,this)&&((0,_t.A)(sf,this,of).call(this,{highlightOutlines:(0,zt.A)(Yg,this).getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}function df(){null!==(0,zt.A)(Kg,this)&&this.parent&&(this.parent.drawLayer.remove((0,zt.A)(Kg,this)),(0,Ht.A)(Kg,this,null),this.parent.drawLayer.remove((0,zt.A)($g,this)),(0,Ht.A)($g,this,null))}function uf(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===(0,zt.A)(Kg,this)&&(({id:vt(Ht.A,[Kg,this])._,clipPathId:vt(Ht.A,[zg,this])._}=t.drawLayer.draw({bbox:(0,zt.A)(Yg,this).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:(0,zt.A)(Qg,this)},path:{d:(0,zt.A)(Yg,this).toSVGPath()}},!1,!0)),(0,Ht.A)($g,this,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:(0,zt.A)(Qg,this)},bbox:(0,zt.A)(Vg,this).box,path:{d:(0,zt.A)(Vg,this).toSVGPath()}},(0,zt.A)(Qg,this))),(0,zt.A)(Xg,this)&&((0,zt.A)(Xg,this).style.clipPath=(0,zt.A)(zg,this)))}function pf(t,e){let[i,n,s,r]=t;switch(e){case 90:return[1-n-r,i,r,s];case 180:return[1-i-s,1-n-r,s,r];case 270:return[n,1-i-s,r,s]}return[i,n,s,r]}function Af(t){Bt._keyboardManager.exec(this,t)}function gf(t){if(!(0,zt.A)(Wg,this))return;const e=window.getSelection();t?e.setPosition((0,zt.A)(Wg,this),(0,zt.A)(jg,this)):e.setPosition((0,zt.A)(Gg,this),(0,zt.A)(qg,this))}function ff(){return(0,zt.A)(Qg,this)?this.rotation:0}function mf(){if((0,zt.A)(Qg,this))return null;const[t,e]=this.pageDimensions,[i,n]=this.pageTranslation,s=(0,zt.A)(Ug,this),r=new Float32Array(8*s.length);let a=0;for(const{x:o,y:l,width:c,height:h}of s){const s=o*t+i,d=(1-l)*e+n;r[a]=r[a+4]=s,r[a+1]=r[a+3]=d,r[a+2]=r[a+6]=s+c*t,r[a+5]=r[a+7]=d-h*e,a+=8}return r}function vf(t){return(0,zt.A)(Yg,this).serialize(t,(0,_t.A)(sf,this,ff).call(this))}function wf(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function bf(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function yf(t){const{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}Bt=rf,(0,Vt.A)(rf,"_defaultColor",null),(0,Vt.A)(rf,"_defaultOpacity",1),(0,Vt.A)(rf,"_defaultThickness",12),(0,Vt.A)(rf,"_type","highlight"),(0,Vt.A)(rf,"_editorType",re.HIGHLIGHT),(0,Vt.A)(rf,"_freeHighlightId",-1),(0,Vt.A)(rf,"_freeHighlight",null),(0,Vt.A)(rf,"_freeHighlightClipId","");var _f=new WeakMap;class xf{constructor(){(0,yt.A)(this,_f,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){(0,zt.A)(_f,this)[t]=e}toSVGProperties(){const t=(0,zt.A)(_f,this);return(0,Ht.A)(_f,this,Object.create(null)),{root:t}}reset(){(0,Ht.A)(_f,this,Object.create(null))}updateAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(t)}clone(){De("Not implemented")}}var Ef=new WeakMap,Sf=new WeakMap,kf=new WeakSet;class Cf extends na{constructor(t){super(t),(0,bt.A)(this,kf),(0,yt.A)(this,Ef,null),(0,yt.A)(this,Sf,void 0),(0,Vt.A)(this,"_colorPicker",null),(0,Vt.A)(this,"_drawId",null),(0,Ht.A)(Sf,this,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;null===(t=this._colorPicker)||void 0===t||t.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&((0,_t.A)(kf,this,Mf).call(this,t),(0,_t.A)(kf,this,Df).call(this))}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const[n,s]of Object.entries(e))i.has(n)?Object.assign(t[n],s):t[n]=s;return t}static getDefaultDrawingOptions(t){De("Not implemented")}static get typesMap(){De("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(Nf._.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,e[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,e[n]]);return t}_updateProperty(t,e,i){const n=this._drawingOptions,s=n[e],r=i=>{var s;n.updateProperty(e,i);const r=(0,zt.A)(Ef,this).updateProperty(e,i);r&&(0,_t.A)(kf,this,If).call(this,r),null===(s=this.parent)||void 0===s||s.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:r.bind(this,i),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cf._mergeSVGProperties((0,zt.A)(Ef,this).getPathResizingSVGProperties((0,_t.A)(kf,this,Lf).call(this)),{bbox:(0,_t.A)(kf,this,Ff).call(this)}))}_onResized(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cf._mergeSVGProperties((0,zt.A)(Ef,this).getPathResizedSVGProperties((0,_t.A)(kf,this,Lf).call(this)),{bbox:(0,_t.A)(kf,this,Ff).call(this)}))}_onTranslating(t,e){var i;null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,{bbox:(0,_t.A)(kf,this,Ff).call(this)})}_onTranslated(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,Cf._mergeSVGProperties((0,zt.A)(Ef,this).getPathTranslatedSVGProperties((0,_t.A)(kf,this,Lf).call(this),this.parentDimensions),{bbox:(0,_t.A)(kf,this,Ff).call(this)}))}_onStartDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,(0,zt.A)(Sf,this)&&((0,Ht.A)(Sf,this,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){(0,_t.A)(kf,this,Pf).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,_t.A)(kf,this,Df).call(this),(0,_t.A)(kf,this,If).call(this,(0,zt.A)(Ef,this).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),(0,_t.A)(kf,this,Pf).call(this);else if(t){var i;this._uiManager.addShouldRescale(this),(0,_t.A)(kf,this,Df).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,Cf._mergeSVGProperties({bbox:(0,_t.A)(kf,this,Ff).call(this)},(0,zt.A)(Ef,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&(0,_t.A)(kf,this,If).call(this,(0,zt.A)(Ef,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const i=super.render();i.classList.add("draw");const n=document.createElement("div");return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,n,s){De("Not implemented")}static startDrawing(t,e,i,n){var s,r;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:h}=n;if(jf._&&jf._!==h)return;const{viewport:{rotation:d}}=t,{width:u,height:p}=a.getBoundingClientRect(),A=Of._=new AbortController,g=t.combinedSignal(A);Wf._||(Wf._=c),null!==(s=jf._)&&void 0!==s||(jf._=h),window.addEventListener("pointerup",t=>{var e;Wf._===t.pointerId?this._endDraw(t):null===(e=Uf._)||void 0===e||e.delete(t.pointerId)},{signal:g}),window.addEventListener("pointercancel",t=>{var e;Wf._===t.pointerId?this._currentParent.endDrawingSession():null===(e=Uf._)||void 0===e||e.delete(t.pointerId)},{signal:g}),window.addEventListener("pointerdown",t=>{jf._===t.pointerType&&((Uf._||(Uf._=new Set)).add(t.pointerId),Nf._.isCancellable()&&(Nf._.removeLastElement(),Nf._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",pi,{signal:g}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),a.addEventListener("touchmove",t=>{t.timeStamp===zf._&&Ai(t)},{signal:g}),t.toggleDrawing(),null===(r=e._editorUndoBar)||void 0===r||r.hide(),Nf._?t.drawLayer.updateProperties(this._currentDrawId,Nf._.startNew(o,l,u,p,d)):(e.updateUIForDefaultProperties(this),Nf._=this.createDrawerInstance(o,l,u,p,d),Bf._=this.getDefaultDrawingOptions(),this._currentParent=t,({id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(Bf._.toSVGProperties(),Nf._.defaultSVGProperties),!0,!1)))}static _drawMove(t){var e;if(zf._=-1,!Nf._)return;const{offsetX:i,offsetY:n,pointerId:s}=t;Wf._===s&&((null===(e=Uf._)||void 0===e?void 0:e.size)>=1?this._endDraw(t):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,Nf._.add(i,n)),zf._=t.timeStamp,Ai(t)))}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,Nf._=null,Bf._=null,jf._=null,zf._=NaN),Of._&&(Of._.abort(),Of._=null,Wf._=NaN,Uf._=null)}static _endDraw(t){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(null===t||void 0===t?void 0:t.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,Nf._.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const t=Nf._,i=this._currentDrawId,n=t.getLastElement();return void e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(n))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:ae.DRAW_STEP})}this.endDrawing(!1)}}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(ae.DRAW_STEP),!Nf._.isEmpty()){const{pageDimensions:[i,n],scale:s}=e,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Nf._.getOutlines(i*s,n*s,s,this._INNER_MARGIN),drawingOptions:Bf._,mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,n,s,r){De("Not implemented")}static async deserialize(t,e,i){const{rawDims:{pageWidth:n,pageHeight:s,pageX:r,pageY:a}}=e.viewport,o=this.deserializeDraw(r,a,n,s,this._INNER_MARGIN,t),l=await super.deserialize(t,e,i);return l.createDrawingOptions(t),(0,_t.A)(kf,l,Mf).call(l,{drawOutlines:o}),(0,_t.A)(kf,l,Df).call(l),l.onScaleChanging(),l.rotate(),l}serializeDraw(t){const[e,i]=this.pageTranslation,[n,s]=this.pageDimensions;return(0,zt.A)(Ef,this).serialize([e,i,n,s],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}function Mf(t){let{drawOutlines:e,drawId:i,drawingOptions:n}=t;(0,Ht.A)(Ef,this,e),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-".concat(this.editorType,"-added-alert")),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=(0,_t.A)(kf,this,Tf).call(this,e,this.parent),(0,_t.A)(kf,this,If).call(this,e.box)}function Tf(t,e){const{id:i}=e.drawLayer.draw(Wt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}function Pf(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function Df(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=(0,_t.A)(kf,this,Tf).call(this,(0,zt.A)(Ef,this),t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))}function Rf(t){let[e,i,n,s]=t;const{parentDimensions:[r,a],rotation:o}=this;switch(o){case 90:return[i,1-e,n*(a/r),s*(r/a)];case 180:return[1-e,1-i,n,s];case 270:return[1-i,e,n*(a/r),s*(r/a)];default:return[e,i,n,s]}}function Lf(){const{x:t,y:e,width:i,height:n,parentDimensions:[s,r],rotation:a}=this;switch(a){case 90:return[1-e,t,i*(s/r),n*(r/s)];case 180:return[1-t,1-e,i,n];case 270:return[e,1-t,i*(s/r),n*(r/s)];default:return[t,e,i,n]}}function If(t){[this.x,this.y,this.width,this.height]=(0,_t.A)(kf,this,Rf).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}function Ff(){const{x:t,y:e,width:i,height:n,rotation:s,parentRotation:r,parentDimensions:[a,o]}=this;switch((4*s+r)/90){case 1:return[1-e-n,t,n,i];case 2:return[1-t-i,1-e-n,i,n];case 3:return[e,1-t-i,n,i];case 4:return[t,e-i*(a/o),n*(o/a),i*(a/o)];case 5:return[1-e,t,i*(a/o),n*(o/a)];case 6:return[1-t-n*(o/a),1-e,n*(o/a),i*(a/o)];case 7:return[e-i*(a/o),1-t-n*(o/a),i*(a/o),n*(o/a)];case 8:return[t-i,e-n,i,n];case 9:return[1-e,t-i,n,i];case 10:return[1-t,1-e,i,n];case 11:return[e-n,1-t,n,i];case 12:return[t-n*(o/a),e,n*(o/a),i*(a/o)];case 13:return[1-e-i*(a/o),t-n*(o/a),i*(a/o),n*(o/a)];case 14:return[1-t,1-e-i*(a/o),n*(o/a),i*(a/o)];case 15:return[e,1-t,i*(a/o),n*(o/a)];default:return[t,e,i,n]}}Wt=Cf,(0,Vt.A)(Cf,"_currentDrawId",-1),(0,Vt.A)(Cf,"_currentParent",null);var Nf={_:null},Of={_:null},Bf={_:null},Wf={_:NaN},jf={_:null},Uf={_:null},zf={_:NaN};(0,Vt.A)(Cf,"_INNER_MARGIN",3);var Hf=new WeakMap,Vf=new WeakMap,Gf=new WeakMap,qf=new WeakMap,Xf=new WeakMap,Yf=new WeakMap,Kf=new WeakMap,Qf=new WeakMap,Jf=new WeakMap,Zf=new WeakMap,$f=new WeakMap,tm=new WeakSet;class em{constructor(t,e,i,n,s,r){(0,bt.A)(this,tm),(0,yt.A)(this,Hf,new Float64Array(6)),(0,yt.A)(this,Vf,void 0),(0,yt.A)(this,Gf,void 0),(0,yt.A)(this,qf,void 0),(0,yt.A)(this,Xf,void 0),(0,yt.A)(this,Yf,void 0),(0,yt.A)(this,Kf,""),(0,yt.A)(this,Qf,0),(0,yt.A)(this,Jf,new pm),(0,yt.A)(this,Zf,void 0),(0,yt.A)(this,$f,void 0),(0,Ht.A)(Zf,this,i),(0,Ht.A)($f,this,n),(0,Ht.A)(qf,this,s),(0,Ht.A)(Xf,this,r),[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const a=(0,Ht.A)(Vf,this,[NaN,NaN,NaN,NaN,t,e]);(0,Ht.A)(Yf,this,[t,e]),(0,Ht.A)(Gf,this,[{line:a,points:(0,zt.A)(Yf,this)}]),(0,zt.A)(Hf,this).set(a,0)}updateProperty(t,e){"stroke-width"===t&&(0,Ht.A)(Xf,this,e)}isEmpty(){return!(0,zt.A)(Gf,this)||0===(0,zt.A)(Gf,this).length}isCancellable(){return(0,zt.A)(Yf,this).length<=10}add(t,e){[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const[i,n,s,r]=(0,zt.A)(Hf,this).subarray(2,6),a=t-s,o=e-r;return Math.hypot((0,zt.A)(Zf,this)*a,(0,zt.A)($f,this)*o)<=2?null:((0,zt.A)(Yf,this).push(t,e),isNaN(i)?((0,zt.A)(Hf,this).set([s,r,t,e],2),(0,zt.A)(Vf,this).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN((0,zt.A)(Hf,this)[0])&&(0,zt.A)(Vf,this).splice(6,6),(0,zt.A)(Hf,this).set([i,n,s,r,t,e],0),(0,zt.A)(Vf,this).push(...UA.createBezierPoints(i,n,s,r,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(2===(0,zt.A)(Yf,this).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){(0,Ht.A)(Zf,this,i),(0,Ht.A)($f,this,n),(0,Ht.A)(qf,this,s),[t,e]=(0,_t.A)(tm,this,im).call(this,t,e);const r=(0,Ht.A)(Vf,this,[NaN,NaN,NaN,NaN,t,e]);(0,Ht.A)(Yf,this,[t,e]);const a=(0,zt.A)(Gf,this).at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),(0,zt.A)(Gf,this).push({line:r,points:(0,zt.A)(Yf,this)}),(0,zt.A)(Hf,this).set(r,0),(0,Ht.A)(Qf,this,0),this.toSVGPath(),null}getLastElement(){return(0,zt.A)(Gf,this).at(-1)}setLastElement(t){return(0,zt.A)(Gf,this)?((0,zt.A)(Gf,this).push(t),(0,Ht.A)(Vf,this,t.line),(0,Ht.A)(Yf,this,t.points),(0,Ht.A)(Qf,this,0),{path:{d:this.toSVGPath()}}):(0,zt.A)(Jf,this).setLastElement(t)}removeLastElement(){if(!(0,zt.A)(Gf,this))return(0,zt.A)(Jf,this).removeLastElement();(0,zt.A)(Gf,this).pop(),(0,Ht.A)(Kf,this,"");for(let t=0,e=(0,zt.A)(Gf,this).length;t<e;t++){const{line:e,points:i}=(0,zt.A)(Gf,this)[t];(0,Ht.A)(Vf,this,e),(0,Ht.A)(Yf,this,i),(0,Ht.A)(Qf,this,0),this.toSVGPath()}return{path:{d:(0,zt.A)(Kf,this)}}}toSVGPath(){const t=UA.svgRound((0,zt.A)(Vf,this)[4]),e=UA.svgRound((0,zt.A)(Vf,this)[5]);if(2===(0,zt.A)(Yf,this).length)return(0,Ht.A)(Kf,this,"".concat((0,zt.A)(Kf,this)," M ").concat(t," ").concat(e," Z")),(0,zt.A)(Kf,this);if((0,zt.A)(Yf,this).length<=6){const i=(0,zt.A)(Kf,this).lastIndexOf("M");(0,Ht.A)(Kf,this,"".concat((0,zt.A)(Kf,this).slice(0,i)," M ").concat(t," ").concat(e)),(0,Ht.A)(Qf,this,6)}if(4===(0,zt.A)(Yf,this).length){const t=UA.svgRound((0,zt.A)(Vf,this)[10]),e=UA.svgRound((0,zt.A)(Vf,this)[11]);return(0,Ht.A)(Kf,this,"".concat((0,zt.A)(Kf,this)," L ").concat(t," ").concat(e)),(0,Ht.A)(Qf,this,12),(0,zt.A)(Kf,this)}const i=[];0===(0,zt.A)(Qf,this)&&(i.push("M ".concat(t," ").concat(e)),(0,Ht.A)(Qf,this,6));for(let n=(0,zt.A)(Qf,this),s=(0,zt.A)(Vf,this).length;n<s;n+=6){const[t,e,s,r,a,o]=(0,zt.A)(Vf,this).slice(n,n+6).map(UA.svgRound);i.push("C".concat(t," ").concat(e," ").concat(s," ").concat(r," ").concat(a," ").concat(o))}return(0,Ht.A)(Kf,this,(0,zt.A)(Kf,this)+i.join(" ")),(0,Ht.A)(Qf,this,(0,zt.A)(Vf,this).length),(0,zt.A)(Kf,this)}getOutlines(t,e,i,n){const s=(0,zt.A)(Gf,this).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),(0,zt.A)(Jf,this).build((0,zt.A)(Gf,this),t,e,i,(0,zt.A)(qf,this),(0,zt.A)(Xf,this),n),(0,Ht.A)(Hf,this,null),(0,Ht.A)(Vf,this,null),(0,Ht.A)(Gf,this,null),(0,Ht.A)(Kf,this,null),(0,zt.A)(Jf,this)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}function im(t,e){return UA._normalizePoint(t,e,(0,zt.A)(Zf,this),(0,zt.A)($f,this),(0,zt.A)(qf,this))}var nm=new WeakMap,sm=new WeakMap,rm=new WeakMap,am=new WeakMap,om=new WeakMap,lm=new WeakMap,cm=new WeakMap,hm=new WeakMap,dm=new WeakMap,um=new WeakSet;class pm extends UA{constructor(){super(...arguments),(0,bt.A)(this,um),(0,yt.A)(this,nm,void 0),(0,yt.A)(this,sm,0),(0,yt.A)(this,rm,void 0),(0,yt.A)(this,am,void 0),(0,yt.A)(this,om,void 0),(0,yt.A)(this,lm,void 0),(0,yt.A)(this,cm,void 0),(0,yt.A)(this,hm,void 0),(0,yt.A)(this,dm,void 0)}build(t,e,i,n,s,r,a){(0,Ht.A)(om,this,e),(0,Ht.A)(lm,this,i),(0,Ht.A)(cm,this,n),(0,Ht.A)(hm,this,s),(0,Ht.A)(dm,this,r),(0,Ht.A)(rm,this,null!==a&&void 0!==a?a:0),(0,Ht.A)(am,this,t),(0,_t.A)(um,this,fm).call(this)}get thickness(){return(0,zt.A)(dm,this)}setLastElement(t){return(0,zt.A)(am,this).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return(0,zt.A)(am,this).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:e}of(0,zt.A)(am,this))if(t.push("M".concat(UA.svgRound(e[4])," ").concat(UA.svgRound(e[5]))),6!==e.length)if(12===e.length&&isNaN(e[6]))t.push("L".concat(UA.svgRound(e[10])," ").concat(UA.svgRound(e[11])));else for(let i=6,n=e.length;i<n;i+=6){const[n,s,r,a,o,l]=e.subarray(i,i+6).map(UA.svgRound);t.push("C".concat(n," ").concat(s," ").concat(r," ").concat(a," ").concat(o," ").concat(l))}else t.push("Z");return t.join("")}serialize(t,e){let[i,n,s,r]=t;const a=[],o=[],[l,c,h,d]=(0,_t.A)(um,this,gm).call(this);let u,p,A,g,f,m,v,w,b;switch((0,zt.A)(hm,this)){case 0:b=UA._rescale,u=i,p=n+r,A=s,g=-r,f=i+l*s,m=n+(1-c-d)*r,v=i+(l+h)*s,w=n+(1-c)*r;break;case 90:b=UA._rescaleAndSwap,u=i,p=n,A=s,g=r,f=i+c*s,m=n+l*r,v=i+(c+d)*s,w=n+(l+h)*r;break;case 180:b=UA._rescale,u=i+s,p=n,A=-s,g=r,f=i+(1-l-h)*s,m=n+c*r,v=i+(1-l)*s,w=n+(c+d)*r;break;case 270:b=UA._rescaleAndSwap,u=i+s,p=n+r,A=-s,g=-r,f=i+(1-c-d)*s,m=n+(1-l-h)*r,v=i+(1-c)*s,w=n+(1-l)*r}for(const{line:y,points:_}of(0,zt.A)(am,this))a.push(b(y,u,p,A,g,e?new Array(y.length):null)),o.push(b(_,u,p,A,g,e?new Array(_.length):null));return{lines:a,points:o,rect:[f,m,v,w]}}static deserialize(t,e,i,n,s,r){let{paths:{lines:a,points:o},rotation:l,thickness:c}=r;const h=[];let d,u,p,A,g;switch(l){case 0:g=UA._rescale,d=-t/i,u=e/n+1,p=1/i,A=-1/n;break;case 90:g=UA._rescaleAndSwap,d=-e/n,u=-t/i,p=1/n,A=1/i;break;case 180:g=UA._rescale,d=t/i+1,u=-e/n,p=-1/i,A=1/n;break;case 270:g=UA._rescaleAndSwap,d=e/n+1,u=t/i+1,p=-1/n,A=-1/i}if(!a){a=[];for(const t of o){const e=t.length;if(2===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){a.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}const i=new Float32Array(3*(e-2));a.push(i);let[n,s,r,o]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,n,s],0);for(let a=4;a<e;a+=2){const e=t[a],l=t[a+1];i.set(UA.createBezierPoints(n,s,r,o,e,l),3*(a-2)),[n,s,r,o]=[r,o,e,l]}}}for(let m=0,v=a.length;m<v;m++)h.push({line:g(a[m].map(t=>null!==t&&void 0!==t?t:NaN),d,u,p,A),points:g(o[m].map(t=>null!==t&&void 0!==t?t:NaN),d,u,p,A)});const f=new this.prototype.constructor;return f.build(h,i,n,1,l,c,s),f}get box(){return(0,zt.A)(nm,this)}updateProperty(t,e){return"stroke-width"===t?(0,_t.A)(um,this,mm).call(this,e):null}updateParentDimensions(t,e){let[i,n]=t;const[s,r]=(0,_t.A)(um,this,Am).call(this);(0,Ht.A)(om,this,i),(0,Ht.A)(lm,this,n),(0,Ht.A)(cm,this,e);const[a,o]=(0,_t.A)(um,this,Am).call(this),l=a-s,c=o-r,h=(0,zt.A)(nm,this);return h[0]-=l,h[1]-=c,h[2]+=2*l,h[3]+=2*c,h}updateRotation(t){return(0,Ht.A)(sm,this,t),{path:{transform:this.rotationTransform}}}get viewBox(){return(0,zt.A)(nm,this).map(UA.svgRound).join(" ")}get defaultProperties(){const[t,e]=(0,zt.A)(nm,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(t)," ").concat(UA.svgRound(e))}}}get rotationTransform(){const[,,t,e]=(0,zt.A)(nm,this);let i=0,n=0,s=0,r=0,a=0,o=0;switch((0,zt.A)(sm,this)){case 90:n=e/t,s=-t/e,a=t;break;case 180:i=-1,r=-1,a=t,o=e;break;case 270:n=-e/t,s=t/e,o=e;break;default:return""}return"matrix(".concat(i," ").concat(n," ").concat(s," ").concat(r," ").concat(UA.svgRound(a)," ").concat(UA.svgRound(o),")")}getPathResizingSVGProperties(t){let[e,i,n,s]=t;const[r,a]=(0,_t.A)(um,this,Am).call(this),[o,l,c,h]=(0,zt.A)(nm,this);if(Math.abs(c-r)<=UA.PRECISION||Math.abs(h-a)<=UA.PRECISION){const t=e+n/2-(o+c/2),r=i+s/2-(l+h/2);return{path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:"".concat(this.rotationTransform," translate(").concat(t," ").concat(r,")")}}}const d=(n-2*r)/(c-2*r),u=(s-2*a)/(h-2*a),p=c/n,A=h/s;return{path:{"transform-origin":"".concat(UA.svgRound(o)," ").concat(UA.svgRound(l)),transform:"".concat(this.rotationTransform," scale(").concat(p," ").concat(A,") ")+"translate(".concat(UA.svgRound(r)," ").concat(UA.svgRound(a),") scale(").concat(d," ").concat(u,") ")+"translate(".concat(UA.svgRound(-r)," ").concat(UA.svgRound(-a),")")}}}getPathResizedSVGProperties(t){let[e,i,n,s]=t;const[r,a]=(0,_t.A)(um,this,Am).call(this),o=(0,zt.A)(nm,this),[l,c,h,d]=o;if(o[0]=e,o[1]=i,o[2]=n,o[3]=s,Math.abs(h-r)<=UA.PRECISION||Math.abs(d-a)<=UA.PRECISION){const t=e+n/2-(l+h/2),r=i+s/2-(c+d/2);for(const{line:e,points:i}of(0,zt.A)(am,this))UA._translate(e,t,r,e),UA._translate(i,t,r,i);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}const u=(n-2*r)/(h-2*r),p=(s-2*a)/(d-2*a),A=-u*(l+r)+e+r,g=-p*(c+a)+i+a;if(1!==u||1!==p||0!==A||0!==g)for(const{line:f,points:m}of(0,zt.A)(am,this))UA._rescale(f,A,g,u,p,f),UA._rescale(m,A,g,u,p,m);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(UA.svgRound(e)," ").concat(UA.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(t,e){let[i,n]=t;const[s,r]=e,a=(0,zt.A)(nm,this),o=i-a[0],l=n-a[1];if((0,zt.A)(om,this)===s&&(0,zt.A)(lm,this)===r)for(const{line:c,points:h}of(0,zt.A)(am,this))UA._translate(c,o,l,c),UA._translate(h,o,l,h);else{const t=(0,zt.A)(om,this)/s,e=(0,zt.A)(lm,this)/r;(0,Ht.A)(om,this,s),(0,Ht.A)(lm,this,r);for(const{line:i,points:n}of(0,zt.A)(am,this))UA._rescale(i,o,l,t,e,i),UA._rescale(n,o,l,t,e,n);a[2]*=t,a[3]*=e}return a[0]=i,a[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(UA.svgRound(i)," ").concat(UA.svgRound(n))}}}get defaultSVGProperties(){const t=(0,zt.A)(nm,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(UA.svgRound(t[0])," ").concat(UA.svgRound(t[1])),transform:this.rotationTransform||null},bbox:t}}}function Am(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,zt.A)(dm,this);const e=(0,zt.A)(rm,this)+t/2*(0,zt.A)(cm,this);return(0,zt.A)(hm,this)%180===0?[e/(0,zt.A)(om,this),e/(0,zt.A)(lm,this)]:[e/(0,zt.A)(lm,this),e/(0,zt.A)(om,this)]}function gm(){const[t,e,i,n]=(0,zt.A)(nm,this),[s,r]=(0,_t.A)(um,this,Am).call(this,0);return[t+s,e+r,i-2*s,n-2*r]}function fm(){const t=(0,Ht.A)(nm,this,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:n}of(0,zt.A)(am,this)){if(n.length<=12){for(let e=4,i=n.length;e<i;e+=6)Xe.pointBoundingBox(n[e],n[e+1],t);continue}let e=n[4],i=n[5];for(let s=6,r=n.length;s<r;s+=6){const[r,a,o,l,c,h]=n.subarray(s,s+6);Xe.bezierBoundingBox(e,i,r,a,o,l,c,h,t),e=c,i=h}}const[e,i]=(0,_t.A)(um,this,Am).call(this);t[0]=ti(t[0]-e,0,1),t[1]=ti(t[1]-i,0,1),t[2]=ti(t[2]+e,0,1),t[3]=ti(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]}function mm(t){const[e,i]=(0,_t.A)(um,this,Am).call(this);(0,Ht.A)(dm,this,t);const[n,s]=(0,_t.A)(um,this,Am).call(this),[r,a]=[n-e,s-i],o=(0,zt.A)(nm,this);return o[0]-=r,o[1]-=a,o[2]+=2*r,o[3]+=2*a,o}class vm extends xf{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:na._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){"stroke-width"===t&&(null!==e&&void 0!==e||(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new vm(this._viewParameters);return t.updateAll(this),t}}var wm=new WeakSet;class bm extends Cf{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"inkEditor"})),(0,bt.A)(this,wm),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){na.initialize(t,e),this._defaultDrawingOptions=new vm(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Fe(this,"typesMap",new Map([[ae.INK_THICKNESS,"stroke-width"],[ae.INK_COLOR,"stroke"],[ae.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,n,s){return new em(t,e,i,n,s,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,n,s,r){return pm.deserialize(t,e,i,n,s,r)}static async deserialize(t,e,i){let n=null;if(t instanceof sA){const{data:{inkLists:e,rect:i,rotation:s,id:r,color:a,opacity:o,borderStyle:{rawWidth:l},popupRef:c,richText:h,contentsObj:d,creationDate:u,modificationDate:p},parent:{page:{pageNumber:A}}}=t;n=t={annotationType:re.INK,color:Array.from(a),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:A-1,rect:i.slice(0),rotation:s,annotationElementId:r,id:r,deleted:!1,popupRef:c,richText:h,comment:(null===d||void 0===d?void 0:d.str)||null,creationDate:u,modificationDate:p}}const s=await super.deserialize(t,e,i);return s._initialData=n,t.comment&&s.setCommentData(t),s}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Eu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ae.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions(t){let{color:e,thickness:i,opacity:n}=t;this._drawingOptions=bm.getDefaultDrawingOptions({stroke:Xe.makeHexColor(...e),"stroke-width":i,"stroke-opacity":n})}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":s,"stroke-width":r}}=this,a=Object.assign(super.serialize(t),{color:na._colorManager.convert(n),opacity:s,thickness:r,paths:{lines:e,points:i}});return this.addComment(a),t?(a.isCopy=!0,a):this.annotationElementId&&!(0,_t.A)(wm,this,ym).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}function ym(t){const{color:e,thickness:i,opacity:n,pageIndex:s}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==n||t.pageIndex!==s}(0,Vt.A)(bm,"_type","ink"),(0,Vt.A)(bm,"_editorType",re.INK),(0,Vt.A)(bm,"_defaultDrawingOptions",null);class _m extends pm{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}class xm{static extractContoursFromText(t,e,i,n,s,r){let{fontFamily:a,fontStyle:o,fontWeight:l}=e,c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=h.font="".concat(o," ").concat(l," ").concat(200,"px ").concat(a),{actualBoundingBoxLeft:u,actualBoundingBoxRight:p,actualBoundingBoxAscent:A,actualBoundingBoxDescent:g,fontBoundingBoxAscent:f,fontBoundingBoxDescent:m,width:v}=h.measureText(t),w=1.5,b=Math.ceil(Math.max(Math.abs(u)+Math.abs(p)||0,v)*w),y=Math.ceil(Math.max(Math.abs(A)+Math.abs(g)||200,Math.abs(f)+Math.abs(m)||200)*w);c=new OffscreenCanvas(b,y),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=d,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,b,y),h.fillStyle="black",h.fillText(t,.5*b/2,1.5*y/2);const _=(0,_t.A)(xm,this,Rm).call(this,h.getImageData(0,0,b,y).data),x=(0,_t.A)(xm,this,Dm).call(this,_),E=(0,_t.A)(xm,this,Lm).call(this,x),S=(0,_t.A)(xm,this,Cm).call(this,_,b,y,E);return this.processDrawnLines({lines:{curves:S,width:b,height:y},pageWidth:i,pageHeight:n,rotation:s,innerMargin:r,mustSmooth:!0,areContours:!0})}static process(t,e,i,n,s){const[r,a,o]=(0,_t.A)(xm,this,Im).call(this,t),[l,c]=(0,_t.A)(xm,this,Pm).call(this,r,a,o,Math.hypot(a,o)*(0,_t.A)(xm,this,Fm)._.sigmaSFactor,(0,_t.A)(xm,this,Fm)._.sigmaR,(0,_t.A)(xm,this,Fm)._.kernelSize),h=(0,_t.A)(xm,this,Lm).call(this,c),d=(0,_t.A)(xm,this,Cm).call(this,l,a,o,h);return this.processDrawnLines({lines:{curves:d,width:a,height:o},pageWidth:e,pageHeight:i,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines(t){var e;let{lines:i,pageWidth:n,pageHeight:s,rotation:r,innerMargin:a,mustSmooth:o,areContours:l}=t;r%180!==0&&([n,s]=[s,n]);const{curves:c,width:h,height:d}=i,u=null!==(e=i.thickness)&&void 0!==e?e:0,p=[],A=Math.min(n/h,s/d),g=A/n,f=A/s,m=[];for(const{points:w}of c){const t=o?(0,_t.A)(xm,this,Tm).call(this,w):w;if(!t)continue;m.push(t);const e=t.length,i=new Float32Array(e),n=new Float32Array(3*(2===e?2:e-2));if(p.push({line:n,points:i}),2===e){i[0]=t[0]*g,i[1]=t[1]*f,n.set([NaN,NaN,NaN,NaN,i[0],i[1]],0);continue}let[s,r,a,l]=t;s*=g,r*=f,a*=g,l*=f,i.set([s,r,a,l],0),n.set([NaN,NaN,NaN,NaN,s,r],0);for(let o=4;o<e;o+=2){const e=i[o]=t[o]*g,c=i[o+1]=t[o+1]*f;n.set(UA.createBezierPoints(s,r,a,l,e,c),3*(o-2)),[s,r,a,l]=[a,l,e,c]}}if(0===p.length)return null;const v=l?new _m:new pm;return v.build(p,n,s,1,r,l?0:u,a),{outline:v,newCurves:m,areContours:l,thickness:u,width:h,height:d}}static async compressSignature(t){let e,{outlines:i,areContours:n,thickness:s,width:r,height:a}=t,o=1/0,l=-1/0,c=0;for(const v of i){c+=v.length;for(let t=2,e=v.length;t<e;t++){const e=v[t]-v[t-2];o=Math.min(o,e),l=Math.max(l,e)}}e=o>=-128&&l<=127?Int8Array:o>=-32768&&l<=32767?Int16Array:Int32Array;const h=i.length,d=8+3*h,u=new Uint32Array(d);let p=0;u[p++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*e.BYTES_PER_ELEMENT,u[p++]=0,u[p++]=r,u[p++]=a,u[p++]=n?0:1,u[p++]=Math.max(0,Math.floor(null!==s&&void 0!==s?s:0)),u[p++]=h,u[p++]=e.BYTES_PER_ELEMENT;for(const v of i)u[p++]=v.length-2,u[p++]=v[0],u[p++]=v[1];const A=new CompressionStream("deflate-raw"),g=A.writable.getWriter();await g.ready,g.write(u);const f=e.prototype.constructor;for(const v of i){const t=new f(v.length-2);for(let e=2,i=v.length;e<i;e++)t[e-2]=v[e]-v[e-2];g.write(t)}g.close();const m=await new Response(A.readable).arrayBuffer();return ei(new Uint8Array(m))}static async decompressSignature(t){try{const l=(a=t,Uint8Array.fromBase64?Uint8Array.fromBase64(a):Ve(atob(a))),{readable:c,writable:h}=new DecompressionStream("deflate-raw"),d=h.getWriter();await d.ready,d.write(l).then(async()=>{await d.ready,await d.close()}).catch(()=>{});let u=null,p=0;var e,i=!1,n=!1;try{for(var s,r=(0,Gt.A)(c);i=!(s=await r.next()).done;i=!1){const t=s.value;u||(u=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])),u.set(t,p),p+=t.length}}catch(o){n=!0,e=o}finally{try{i&&null!=r.return&&await r.return()}finally{if(n)throw e}}const A=new Uint32Array(u.buffer,0,u.length>>2),g=A[1];if(0!==g)throw new Error("Invalid version: ".concat(g));const f=A[2],m=A[3],v=0===A[4],w=A[5],b=A[6],y=A[7],_=[],x=(8+3*b)*Uint32Array.BYTES_PER_ELEMENT;let E;switch(y){case Int8Array.BYTES_PER_ELEMENT:E=new Int8Array(u.buffer,x);break;case Int16Array.BYTES_PER_ELEMENT:E=new Int16Array(u.buffer,x);break;case Int32Array.BYTES_PER_ELEMENT:E=new Int32Array(u.buffer,x)}p=0;for(let t=0;t<b;t++){const e=A[3*t+8],i=new Float32Array(e+2);_.push(i);for(let n=0;n<2;n++)i[n]=A[3*t+8+n+1];for(let t=0;t<e;t++)i[t+2]=i[t]+E[p++]}return{areContours:v,thickness:w,outlines:_,width:f,height:m}}catch(l){return Pe("decompressSignature: ".concat(l)),null}var a}}function Em(t,e,i,n){return n-=e,0===(i-=t)?n>0?0:4:1===i?n+6:2-n}function Sm(t,e,i,n,s,r,a){const o=(0,_t.A)(jt,this,Em).call(this,i,n,s,r);for(let l=0;l<8;l++){const s=(-l+o-a+16)%8;if(0!==t[(i+(0,_t.A)(jt,this,Nm)._[2*s])*e+(n+(0,_t.A)(jt,this,Nm)._[2*s+1])])return s}return-1}function km(t,e,i,n,s,r,a){const o=(0,_t.A)(jt,this,Em).call(this,i,n,s,r);for(let l=0;l<8;l++){const s=(l+o+a+16)%8;if(0!==t[(i+(0,_t.A)(jt,this,Nm)._[2*s])*e+(n+(0,_t.A)(jt,this,Nm)._[2*s+1])])return s}return-1}function Cm(t,e,i,n){const s=t.length,r=new Int32Array(s);for(let c=0;c<s;c++)r[c]=t[c]<=n?1:0;for(let c=1;c<i-1;c++)r[c*e]=r[c*e+e-1]=0;for(let c=0;c<e;c++)r[c]=r[e*i-1-c]=0;let a,o=1;const l=[];for(let c=1;c<i-1;c++){a=1;for(let t=1;t<e-1;t++){const i=c*e+t,n=r[i];if(0===n)continue;let s=c,h=t;if(1===n&&0===r[i-1])o+=1,h-=1;else{if(!(n>=1&&0===r[i+1])){1!==n&&(a=Math.abs(n));continue}o+=1,h+=1,n>1&&(a=n)}const d=[t,c],u=h===t+1,p={isHole:u,points:d,id:o,parent:0};let A;l.push(p);for(const t of l)if(t.id===a){A=t;break}A?A.isHole?p.parent=u?A.parent:a:p.parent=u?a:A.parent:p.parent=u?a:0;const g=(0,_t.A)(jt,this,Sm).call(this,r,e,c,t,s,h,0);if(-1===g){r[i]=-o,1!==r[i]&&(a=Math.abs(r[i]));continue}let f=(0,_t.A)(jt,this,Nm)._[2*g],m=(0,_t.A)(jt,this,Nm)._[2*g+1];const v=c+f,w=t+m;s=v,h=w;let b=c,y=t;for(;;){const n=(0,_t.A)(jt,this,km).call(this,r,e,b,y,s,h,1);f=(0,_t.A)(jt,this,Nm)._[2*n],m=(0,_t.A)(jt,this,Nm)._[2*n+1];const l=b+f,u=y+m;d.push(u,l);const p=b*e+y;if(0===r[p+1]?r[p]=-o:1===r[p]&&(r[p]=o),l===c&&u===t&&b===v&&y===w){1!==r[i]&&(a=Math.abs(r[i]));break}s=b,h=y,b=l,y=u}}}return l}function Mm(t,e,i,n){if(i-e<=4){for(let s=e;s<i-2;s+=2)n.push(t[s],t[s+1]);return}const s=t[e],r=t[e+1],a=t[i-4]-s,o=t[i-3]-r,l=Math.hypot(a,o),c=a/l,h=o/l,d=c*r-h*s,u=o/a,p=1/l,A=Math.atan(u),g=Math.cos(A),f=Math.sin(A),m=p*(Math.abs(g)+Math.abs(f)),v=p*(1-m+m**2),w=Math.max(Math.atan(Math.abs(f+g)*v),Math.atan(Math.abs(f-g)*v));let b=0,y=e;for(let _=e+2;_<i-2;_+=2){const e=Math.abs(d-c*t[_+1]+h*t[_]);e>b&&(y=_,b=e)}b>(l*w)**2?((0,_t.A)(jt,this,Mm).call(this,t,e,y+2,n),(0,_t.A)(jt,this,Mm).call(this,t,y,i,n)):n.push(s,r)}function Tm(t){const e=[],i=t.length;return(0,_t.A)(jt,this,Mm).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}function Pm(t,e,i,n,s,r){const a=new Float32Array(r**2),o=-2*n**2,l=r>>1;for(let A=0;A<r;A++){const t=(A-l)**2;for(let e=0;e<r;e++)a[A*r+e]=Math.exp((t+(e-l)**2)/o)}const c=new Float32Array(256),h=-2*s**2;for(let A=0;A<256;A++)c[A]=Math.exp(A**2/h);const d=t.length,u=new Uint8Array(d),p=new Uint32Array(256);for(let A=0;A<i;A++)for(let n=0;n<e;n++){const s=A*e+n,o=t[s];let h=0,d=0;for(let u=0;u<r;u++){const s=A+u-l;if(!(s<0||s>=i))for(let i=0;i<r;i++){const p=n+i-l;if(p<0||p>=e)continue;const A=t[s*e+p],g=a[u*r+i]*c[Math.abs(A-o)];h+=A*g,d+=g}}p[u[s]=Math.round(h/d)]++}return[u,p]}function Dm(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e}function Rm(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let n=-1/0,s=1/0;for(let a=0,o=i.length;a<o;a++){const e=i[a]=t[a<<2];n=Math.max(n,e),s=Math.min(s,e)}const r=255/(n-s);for(let a=0,o=i.length;a<o;a++)i[a]=(i[a]-s)*r;return i}function Lm(t){let e,i=-1/0,n=-1/0;const s=t.findIndex(t=>0!==t);let r=s,a=s;for(e=s;e<256;e++){const s=t[e];s>i&&(e-r>n&&(n=e-r,a=e-1),i=s,r=e)}for(e=a-1;e>=0&&!(t[e]>t[e+1]);e--);return e}function Im(t){const e=t,{width:i,height:n}=t,{maxDim:s}=(0,_t.A)(jt,this,Fm)._;let r=i,a=n;if(i>s||n>s){let o=i,l=n,c=Math.log2(Math.max(i,n)/s);const h=Math.floor(c);c=c===h?h-1:h;for(let i=0;i<c;i++){r=Math.ceil(o/2),a=Math.ceil(l/2);const i=new OffscreenCanvas(r,a);i.getContext("2d").drawImage(t,0,0,o,l,0,0,r,a),o=r,l=a,t!==e&&t.close(),t=i.transferToImageBitmap()}const d=Math.min(s/r,s/a);r=Math.round(r*d),a=Math.round(a*d)}const o=new OffscreenCanvas(r,a).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,r,a),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,r,a);const l=o.getImageData(0,0,r,a).data;return[(0,_t.A)(jt,this,Rm).call(this,l),r,a]}jt=xm;var Fm={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},Nm={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])};class Om extends xf{constructor(){super(),super.updateProperties({fill:na._defaultLineColor,"stroke-width":0})}clone(){const t=new Om;return t.updateAll(this),t}}class Bm extends vm{constructor(t){super(t),super.updateProperties({stroke:na._defaultLineColor,"stroke-width":1})}clone(){const t=new Bm(this._viewParameters);return t.updateAll(this),t}}var Wm=new WeakMap,jm=new WeakMap,Um=new WeakMap,zm=new WeakMap;class Hm extends Cf{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{mustBeCommitted:!0,name:"signatureEditor"})),(0,yt.A)(this,Wm,!1),(0,yt.A)(this,jm,null),(0,yt.A)(this,Um,null),(0,yt.A)(this,zm,null),this._willKeepAspectRatio=!0,(0,Ht.A)(Um,this,t.signatureData||null),(0,Ht.A)(jm,this,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){na.initialize(t,e),this._defaultDrawingOptions=new Om,this._defaultDrawnSignatureOptions=new Bm(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return Fe(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!(0,zt.A)(jm,this)}}static computeTelemetryFinalData(t){var e,i;const n=t.get("hasDescription");return{hasAltText:null!==(e=n.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=n.get(!1))&&void 0!==i?i:0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,e;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),null===this._drawId)if((0,zt.A)(Um,this)){const{lines:t,mustSmooth:e,areContours:i,description:n,uuid:s,heightInPage:r}=(0,zt.A)(Um,this),{rawDims:{pageWidth:a,pageHeight:o},rotation:l}=this.parent.viewport,c=xm.processDrawnLines({lines:t,pageWidth:a,pageHeight:o,rotation:l,innerMargin:Hm._INNER_MARGIN,mustSmooth:e,areContours:i});this.addSignature(c,r,n,s)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:(0,zt.A)(jm,this)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){(0,Ht.A)(zm,this,t),this.addEditToolbar()}getUuid(){return(0,zt.A)(zm,this)}get description(){return(0,zt.A)(jm,this)}set description(t){(0,Ht.A)(jm,this,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{null===e||void 0===e||e.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:i,width:n,height:s}=(0,zt.A)(Um,this),r=Math.max(n,s);return{areContours:e,outline:xm.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:n,height:s},pageWidth:r,pageHeight:r,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,n){const{x:s,y:r}=this,{outline:a}=(0,Ht.A)(Um,this,t);let o;(0,Ht.A)(Wm,this,a instanceof _m),this.description=i,(0,zt.A)(Wm,this)?o=Hm.getDefaultDrawingOptions():(o=Hm._defaultDrawnSignatureOptions.clone(),o.updateProperties({"stroke-width":a.thickness})),this._addOutlines({drawOutlines:a,drawingOptions:o});const[,l]=this.pageDimensions;let c=e/l;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=s,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return xm.process(t,e,i,n,Hm._INNER_MARGIN)}getFromText(t,e){const{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return xm.extractContoursFromText(t,e,i,n,s,Hm._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:e,pageHeight:i},rotation:n}=this.parent.viewport;return xm.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:Hm._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions(t){let{areContours:e,thickness:i}=t;e?this._drawingOptions=Hm.getDefaultDrawingOptions():(this._drawingOptions=Hm._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;const{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,s=Object.assign(super.serialize(t),{isSignature:!0,areContours:(0,zt.A)(Wm,this),color:[0,0,0],thickness:(0,zt.A)(Wm,this)?0:n});return this.addComment(s),t?(s.paths={lines:e,points:i},s.uuid=(0,zt.A)(zm,this),s.isCopy=!0):s.lines=e,(0,zt.A)(jm,this)&&(s.accessibilityData={type:"Figure",alt:(0,zt.A)(jm,this)}),s}static deserializeDraw(t,e,i,n,s,r){return r.areContours?_m.deserialize(t,e,i,n,s,r):pm.deserialize(t,e,i,n,s,r)}static async deserialize(t,e,i){var n;const s=await super.deserialize(t,e,i);return(0,Ht.A)(Wm,s,t.areContours),s.description=(null===(n=t.accessibilityData)||void 0===n?void 0:n.alt)||"",(0,Ht.A)(zm,s,t.uuid),s}}(0,Vt.A)(Hm,"_type","signature"),(0,Vt.A)(Hm,"_editorType",re.SIGNATURE),(0,Vt.A)(Hm,"_defaultDrawingOptions",null);var Vm=new WeakMap,Gm=new WeakMap,qm=new WeakMap,Xm=new WeakMap,Ym=new WeakMap,Km=new WeakMap,Qm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,$m=new WeakMap,tv=new WeakMap,ev=new WeakSet;class iv extends na{constructor(t){super((0,wt.A)((0,wt.A)({},t),{},{name:"stampEditor"})),(0,bt.A)(this,ev),(0,yt.A)(this,Vm,null),(0,yt.A)(this,Gm,null),(0,yt.A)(this,qm,null),(0,yt.A)(this,Xm,null),(0,yt.A)(this,Ym,null),(0,yt.A)(this,Km,""),(0,yt.A)(this,Qm,null),(0,yt.A)(this,Jm,!1),(0,yt.A)(this,Zm,null),(0,yt.A)(this,$m,!1),(0,yt.A)(this,tv,!1),(0,Ht.A)(Xm,this,t.bitmapUrl),(0,Ht.A)(Ym,this,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){na.initialize(t,e)}static isHandlingMimeForPasting(t){return _i.includes(t)}static paste(t,e){e.pasteEditor({mode:re.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!(null===(t=this.altTextData)||void 0===t||!t.altText)}}static computeTelemetryFinalData(t){var e,i;const n=t.get("hasAltText");return{hasAltText:null!==(e=n.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=n.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:s,height:r}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:n,width:s,height:r,channels:n.length/(s*r)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");const o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}remove(){var t;(0,zt.A)(Gm,this)&&((0,Ht.A)(Vm,this,null),this._uiManager.imageManager.deleteId((0,zt.A)(Gm,this)),null===(t=(0,zt.A)(Qm,this))||void 0===t||t.remove(),(0,Ht.A)(Qm,this,null),(0,zt.A)(Zm,this)&&(clearTimeout((0,zt.A)(Zm,this)),(0,Ht.A)(Zm,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&((0,zt.A)(Gm,this)&&null===(0,zt.A)(Qm,this)&&(0,_t.A)(ev,this,rv).call(this),this.isAttachedToDOM||this.parent.add(this))):(0,zt.A)(Gm,this)&&(0,_t.A)(ev,this,rv).call(this)}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!((0,zt.A)(qm,this)||(0,zt.A)(Vm,this)||(0,zt.A)(Xm,this)||(0,zt.A)(Ym,this)||(0,zt.A)(Gm,this)||(0,zt.A)(Jm,this))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),(0,zt.A)(Jm,this)||((0,zt.A)(Vm,this)?(0,_t.A)(ev,this,av).call(this):(0,_t.A)(ev,this,rv).call(this)),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&((0,Ht.A)(Gm,this,i),n&&(0,Ht.A)(Vm,this,n),(0,Ht.A)(Jm,this,!1),(0,_t.A)(ev,this,av).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==(0,zt.A)(Zm,this)&&clearTimeout((0,zt.A)(Zm,this));(0,Ht.A)(Zm,this,setTimeout(()=>{(0,Ht.A)(Zm,this,null),(0,_t.A)(ev,this,lv).call(this)},200))}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);const{width:n,height:s}=(0,zt.A)(Vm,this),r=new yi;let a=(0,zt.A)(Vm,this),o=n,l=s,c=null;if(e){if(n>e||s>e){const t=Math.min(e/n,e/s);o=Math.floor(n*t),l=Math.floor(s*t)}c=document.createElement("canvas");const t=c.width=Math.ceil(o*r.sx),i=c.height=Math.ceil(l*r.sy);(0,zt.A)($m,this)||(a=(0,_t.A)(ev,this,ov).call(this,t,i));const h=c.getContext("2d");h.filter=this._uiManager.hcmFilter;let d="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":xi.isDarkMode&&(d="#8f8f9d",u="#42414d");const p=15,A=p*r.sx,g=p*r.sy,f=new OffscreenCanvas(2*A,2*g),m=f.getContext("2d");m.fillStyle=d,m.fillRect(0,0,2*A,2*g),m.fillStyle=u,m.fillRect(0,0,A,g),m.fillRect(A,g,A,g),h.fillStyle=h.createPattern(f,"repeat"),h.fillRect(0,0,t,i),h.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let h=null;if(i){let e,i;if(r.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=(0,zt.A)(Vm,this),n>t||s>t){const r=Math.min(t/n,t/s);e=Math.floor(n*r),i=Math.floor(s*r),(0,zt.A)($m,this)||(a=(0,_t.A)(ev,this,ov).call(this,e,i))}const o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),h={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:c,width:o,height:l,imageData:h}}static async deserialize(t,e,i){let n=null,s=!1;if(t instanceof hA){var r;const{data:{rect:a,rotation:o,id:l,structParent:c,popupRef:h,richText:d,contentsObj:u,creationDate:p,modificationDate:A},container:g,parent:{page:{pageNumber:f}},canvas:m}=t;let v,w;m?(delete t.canvas,({id:v,bitmap:w}=i.imageManager.getFromCanvas(g.id,m)),m.remove()):(s=!0,t._hasNoCanvas=!0);const b=(null===(r=await e._structTree.getAriaAttributes("".concat($e).concat(l)))||void 0===r?void 0:r.get("aria-label"))||"";n=t={annotationType:re.STAMP,bitmapId:v,bitmap:w,pageIndex:f-1,rect:a.slice(0),rotation:o,annotationElementId:l,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:b},isSvg:!1,structParent:c,popupRef:h,richText:d,comment:(null===u||void 0===u?void 0:u.str)||null,creationDate:p,modificationDate:A}}const a=await super.deserialize(t,e,i),{rect:o,bitmap:l,bitmapUrl:c,bitmapId:h,isSvg:d,accessibilityData:u}=t;s?(i.addMissingCanvas(t.id,a),(0,Ht.A)(Jm,a,!0)):h&&i.imageManager.isValidId(h)?((0,Ht.A)(Gm,a,h),l&&(0,Ht.A)(Vm,a,l)):(0,Ht.A)(Xm,a,c),(0,Ht.A)($m,a,d);const[p,A]=a.pageDimensions;return a.width=(o[2]-o[0])/p,a.height=(o[3]-o[1])/A,u&&(a.altTextData=u),a._initialData=n,t.comment&&a.setCommentData(t),(0,Ht.A)(tv,a,!!n),a}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:(0,zt.A)(Gm,this),isSvg:(0,zt.A)($m,this)});if(this.addComment(i),t)return i.bitmapUrl=(0,_t.A)(ev,this,cv).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:s}=this.serializeAltText(!1);if(!n&&s&&(i.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){const t=(0,_t.A)(ev,this,hv).call(this,i);if(t.isSame)return null;var r;if(t.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=null!==(r=this._initialData.structParent)&&void 0!==r?r:-1;return i.id=this.annotationElementId,delete i.bitmapId,i}if(null===e)return i;e.stamps||(e.stamps=new Map);const a=(0,zt.A)($m,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has((0,zt.A)(Gm,this))){if((0,zt.A)($m,this)){const t=e.stamps.get((0,zt.A)(Gm,this));a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=(0,_t.A)(ev,this,cv).call(this,!1))}}else e.stamps.set((0,zt.A)(Gm,this),{area:a,serialized:i}),i.bitmap=(0,_t.A)(ev,this,cv).call(this,!1);return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}function nv(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?((0,Ht.A)(Vm,this,t.bitmap),e||((0,Ht.A)(Gm,this,t.id),(0,Ht.A)($m,this,t.isSvg)),t.file&&(0,Ht.A)(Km,this,t.file.name),(0,_t.A)(ev,this,av).call(this)):this.remove()}function sv(){if((0,Ht.A)(qm,this,null),this._uiManager.enableWaiting(!1),(0,zt.A)(Qm,this))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,zt.A)(Vm,this))this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,zt.A)(Vm,this)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function rv(){if((0,zt.A)(Gm,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId((0,zt.A)(Gm,this)).then(t=>(0,_t.A)(ev,this,nv).call(this,t,!0)).finally(()=>(0,_t.A)(ev,this,sv).call(this));if((0,zt.A)(Xm,this)){const t=(0,zt.A)(Xm,this);return(0,Ht.A)(Xm,this,null),this._uiManager.enableWaiting(!0),void(0,Ht.A)(qm,this,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,_t.A)(ev,this,nv).call(this,t)).finally(()=>(0,_t.A)(ev,this,sv).call(this)))}if((0,zt.A)(Ym,this)){const t=(0,zt.A)(Ym,this);return(0,Ht.A)(Ym,this,null),this._uiManager.enableWaiting(!0),void(0,Ht.A)(qm,this,this._uiManager.imageManager.getFromFile(t).then(t=>(0,_t.A)(ev,this,nv).call(this,t)).finally(()=>(0,_t.A)(ev,this,sv).call(this)))}const t=document.createElement("input");t.type="file",t.accept=_i.join(",");const e=this._uiManager._signal;(0,Ht.A)(qm,this,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),(0,_t.A)(ev,this,nv).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,_t.A)(ev,this,sv).call(this))),t.click()}function av(){var t;const{div:e}=this;let{width:i,height:n}=(0,zt.A)(Vm,this);const[s,r]=this.pageDimensions,a=.75;if(this.width)i=this.width*s,n=this.height*r;else if(i>a*s||n>a*r){const t=Math.min(a*s/i,a*r/n);i*=t,n*=t}this._uiManager.enableWaiting(!1);const o=(0,Ht.A)(Qm,this,document.createElement("canvas"));o.setAttribute("role","img"),this.addContainer(o),this.width=i/s,this.height=n/r,this.setDims(),null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),(0,_t.A)(ev,this,lv).call(this),(0,zt.A)(tv,this)||(this.parent.addUndoableEditor(this),(0,Ht.A)(tv,this,!0)),this._reportTelemetry({action:"inserted_image"}),(0,zt.A)(Km,this)&&this.div.setAttribute("aria-description",(0,zt.A)(Km,this)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}function ov(t,e){const{width:i,height:n}=(0,zt.A)(Vm,this);let s=i,r=n,a=(0,zt.A)(Vm,this);for(;s>2*t||r>2*e;){const i=s,n=r;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const o=new OffscreenCanvas(s,r);o.getContext("2d").drawImage(a,0,0,i,n,0,0,s,r),a=o.transferToImageBitmap()}return a}function lv(){const[t,e]=this.parentDimensions,{width:i,height:n}=this,s=new yi,r=Math.ceil(i*t*s.sx),a=Math.ceil(n*e*s.sy),o=(0,zt.A)(Qm,this);if(!o||o.width===r&&o.height===a)return;o.width=r,o.height=a;const l=(0,zt.A)($m,this)?(0,zt.A)(Vm,this):(0,_t.A)(ev,this,ov).call(this,r,a),c=o.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(l,0,0,l.width,l.height,0,0,r,a)}function cv(t){if(t){if((0,zt.A)($m,this)){const t=this._uiManager.imageManager.getSvgUrl((0,zt.A)(Gm,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=(0,zt.A)(Vm,this));return t.getContext("2d").drawImage((0,zt.A)(Vm,this),0,0),t.toDataURL()}if((0,zt.A)($m,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*ri.PDF_TO_CSS_UNITS),n=Math.round(this.height*e*ri.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage((0,zt.A)(Vm,this),0,0,(0,zt.A)(Vm,this).width,(0,zt.A)(Vm,this).height,0,0,i,n),s.transferToImageBitmap()}return structuredClone((0,zt.A)(Vm,this))}function hv(t){var e;const{pageIndex:i,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===i,r=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&r,isSameAltText:r}}(0,Vt.A)(iv,"_type","stamp"),(0,Vt.A)(iv,"_editorType",re.STAMP);var dv=new WeakMap,uv=new WeakMap,pv=new WeakMap,Av=new WeakMap,gv=new WeakMap,fv=new WeakMap,mv=new WeakMap,vv=new WeakMap,wv=new WeakMap,bv=new WeakMap,yv=new WeakMap,_v=new WeakMap,xv=new WeakMap,Ev=new WeakMap,Sv=new WeakMap,kv=new WeakMap,Cv=new WeakSet;class Mv{constructor(t){let{uiManager:e,pageIndex:i,div:n,structTreeLayer:s,accessibilityManager:r,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}=t;(0,bt.A)(this,Cv),(0,yt.A)(this,dv,void 0),(0,yt.A)(this,uv,!1),(0,yt.A)(this,pv,null),(0,yt.A)(this,Av,null),(0,yt.A)(this,gv,null),(0,yt.A)(this,fv,new Map),(0,yt.A)(this,mv,!1),(0,yt.A)(this,vv,!1),(0,yt.A)(this,wv,!1),(0,yt.A)(this,bv,null),(0,yt.A)(this,yv,null),(0,yt.A)(this,_v,null),(0,yt.A)(this,xv,null),(0,yt.A)(this,Ev,null),(0,yt.A)(this,Sv,-1),(0,yt.A)(this,kv,void 0);const d=[...Fv._.values()];if(!Mv._initialized){Mv._initialized=!0;for(const t of d)t.initialize(h,e)}e.registerEditorTypes(d),(0,Ht.A)(kv,this,e),this.pageIndex=i,this.div=n,(0,Ht.A)(dv,this,r),(0,Ht.A)(pv,this,a),this.viewport=c,(0,Ht.A)(_v,this,l),this.drawLayer=o,this._structTree=s,(0,zt.A)(kv,this).addLayer(this)}get isEmpty(){return 0===(0,zt.A)(fv,this).size}get isInvisible(){return this.isEmpty&&(0,zt.A)(kv,this).getMode()===re.NONE}updateToolbar(t){(0,zt.A)(kv,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,zt.A)(kv,this).getMode();switch((0,_t.A)(Cv,this,Iv).call(this),t){case re.NONE:return this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case re.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case re.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===re.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const i of Fv._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=(0,zt.A)(_v,this))||void 0===e?void 0:e.div)}setEditingState(t){(0,zt.A)(kv,this).setEditingState(t)}addCommands(t){(0,zt.A)(kv,this).addCommands(t)}cleanUndoStack(t){(0,zt.A)(kv,this).cleanUndoStack(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(0,zt.A)(pv,this))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){var t;(0,Ht.A)(wv,this,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),null===(t=(0,zt.A)(Ev,this))||void 0===t||t.abort(),(0,Ht.A)(Ev,this,null);const e=new Set;for(const n of xt(Cv,this,Tv))n.enableEditing(),n.show(!0),n.annotationElementId&&((0,zt.A)(kv,this).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));const i=(0,zt.A)(pv,this);if(i)for(const n of i.getEditableAnnotations()){if(n.hide(),(0,zt.A)(kv,this).isDeletedAnnotationElement(n.data.id))continue;if(e.has(n.data.id))continue;const t=await this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}(0,Ht.A)(wv,this,!1),(0,zt.A)(kv,this)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if((0,Ht.A)(vv,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),(0,zt.A)(_v,this)&&!(0,zt.A)(Ev,this)){(0,Ht.A)(Ev,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(Ev,this));(0,zt.A)(_v,this).div.addEventListener("pointerdown",t=>{const{clientX:e,clientY:i,timeStamp:n}=t;if(n-(0,zt.A)(Sv,this)>500)return void(0,Ht.A)(Sv,this,n);(0,Ht.A)(Sv,this,-1);const{classList:s}=this.div;s.toggle("getElements",!0);const r=document.elementsFromPoint(e,i);if(s.toggle("getElements",!1),!this.div.contains(r[0]))return;let a;const o=new RegExp("^".concat(se,"[0-9]+$"));for(const c of r)if(o.test(c.id)){a=c.id;break}if(!a)return;const l=(0,zt.A)(fv,this).get(a);null===(null===l||void 0===l?void 0:l.annotationElementId)&&(t.stopPropagation(),t.preventDefault(),l.dblclick(t))},{signal:t,capture:!0})}const t=(0,zt.A)(pv,this);if(t){const i=new Map,n=new Map;for(const r of xt(Cv,this,Tv)){var e;r.disableEditing(),r.annotationElementId?null===r.serialize()?(n.set(r.annotationElementId,r),null===(e=this.getEditableAnnotation(r.annotationElementId))||void 0===e||e.show(),r.remove()):i.set(r.annotationElementId,r):r.updateFakeAnnotationElement(t)}const s=t.getEditableAnnotations();for(const t of s){const{id:e}=t.data;if((0,zt.A)(kv,this).isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let s=n.get(e);s?(s.resetAnnotationElement(t),s.show(!1),t.show()):(s=i.get(e),s&&((0,zt.A)(kv,this).addChangedExistingAnnotation(s),s.renderAnnotationElement(t)&&s.show(!1)),t.show())}}(0,_t.A)(Cv,this,Iv).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const n of Fv._.values())i.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,Ht.A)(vv,this,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,zt.A)(pv,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,zt.A)(kv,this).getActive()!==t&&(0,zt.A)(kv,this).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,null!==(t=(0,zt.A)(_v,this))&&void 0!==t&&t.div&&!(0,zt.A)(xv,this)){(0,Ht.A)(xv,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(xv,this));(0,zt.A)(_v,this).div.addEventListener("pointerdown",(0,_t.A)(Cv,this,Pv).bind(this),{signal:t}),(0,zt.A)(_v,this).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=(0,zt.A)(_v,this))&&void 0!==t&&t.div&&(0,zt.A)(xv,this)&&((0,zt.A)(xv,this).abort(),(0,Ht.A)(xv,this,null),(0,zt.A)(_v,this).div.classList.remove("highlighting"))}enableClick(){if((0,zt.A)(Av,this))return;(0,Ht.A)(Av,this,new AbortController);const t=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(Av,this));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null===(t=(0,zt.A)(Av,this))||void 0===t||t.abort(),(0,Ht.A)(Av,this,null)}attach(t){(0,zt.A)(fv,this).set(t.id,t);const{annotationElementId:e}=t;e&&(0,zt.A)(kv,this).isDeletedAnnotationElement(e)&&(0,zt.A)(kv,this).removeDeletedAnnotationElement(t)}detach(t){var e;(0,zt.A)(fv,this).delete(t.id),null===(e=(0,zt.A)(dv,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,zt.A)(vv,this)&&t.annotationElementId&&(0,zt.A)(kv,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,zt.A)(kv,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,zt.A)(kv,this).addDeletedAnnotationElement(t.annotationElementId),na.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,zt.A)(kv,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!(0,zt.A)(wv,this)),(0,zt.A)(kv,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!(0,zt.A)(gv,this)&&(t._focusEventsAllowed=!1,(0,Ht.A)(gv,this,setTimeout(()=>{(0,Ht.A)(gv,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,zt.A)(kv,this)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=(0,zt.A)(dv,this))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(const e of(0,zt.A)(fv,this).values())if(e.uid===t)return e;return null}getNextId(){return(0,zt.A)(kv,this).getId()}combinedSignal(t){return(0,zt.A)(kv,this).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=xt(Cv,this,Dv))||void 0===t?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await(0,zt.A)(kv,this).updateMode(t.mode);const{offsetX:i,offsetY:n}=(0,_t.A)(Cv,this,Lv).call(this),s=this.getNextId(),r=(0,_t.A)(Cv,this,Rv).call(this,(0,wt.A)({parent:this,id:s,x:i,y:n,uiManager:(0,zt.A)(kv,this),isCentered:!0},e));r&&this.add(r)}async deserialize(t){var e,i;return await(null===(e=Fv._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,zt.A)(kv,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),s=(0,_t.A)(Cv,this,Rv).call(this,(0,wt.A)({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:(0,zt.A)(kv,this),isCentered:e},i));return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.createAndAddNewEditor((0,_t.A)(Cv,this,Lv).call(this),!0,t)}setSelected(t){(0,zt.A)(kv,this).setSelected(t)}toggleSelected(t){(0,zt.A)(kv,this).toggleSelected(t)}unselect(t){(0,zt.A)(kv,this).unselect(t)}pointerup(t){var e;const{isMac:i}=Ge.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if(!(0,zt.A)(mv,this))return;if((0,Ht.A)(mv,this,!1),null!==(e=xt(Cv,this,Dv))&&void 0!==e&&e.isDrawer&&xt(Cv,this,Dv).supportMultipleDrawings)return;if(!(0,zt.A)(uv,this))return void(0,Ht.A)(uv,this,!0);const n=(0,zt.A)(kv,this).getMode();n!==re.STAMP&&n!==re.SIGNATURE?this.createAndAddNewEditor(t,!1):(0,zt.A)(kv,this).unselectAll()}pointerdown(t){var e;if((0,zt.A)(kv,this).getMode()===re.HIGHLIGHT&&this.enableTextSelection(),(0,zt.A)(mv,this))return void(0,Ht.A)(mv,this,!1);const{isMac:i}=Ge.platform;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if((0,Ht.A)(mv,this,!0),null!==(e=xt(Cv,this,Dv))&&void 0!==e&&e.isDrawer)return void this.startDrawingSession(t);const n=(0,zt.A)(kv,this).getActive();(0,Ht.A)(uv,this,!n||n.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),(0,zt.A)(bv,this))return void xt(Cv,this,Dv).startDrawing(this,(0,zt.A)(kv,this),!1,t);(0,zt.A)(kv,this).setCurrentDrawingSession(this),(0,Ht.A)(bv,this,new AbortController);const e=(0,zt.A)(kv,this).combinedSignal((0,zt.A)(bv,this));this.div.addEventListener("blur",t=>{let{relatedTarget:e}=t;e&&!this.div.contains(e)&&((0,Ht.A)(yv,this,null),this.commitOrRemove())},{signal:e}),xt(Cv,this,Dv).startDrawing(this,(0,zt.A)(kv,this),!1,t)}pause(t){if(t){const{activeElement:t}=document;return void(this.div.contains(t)&&(0,Ht.A)(yv,this,t))}(0,zt.A)(yv,this)&&setTimeout(()=>{var t;null===(t=(0,zt.A)(yv,this))||void 0===t||t.focus(),(0,Ht.A)(yv,this,null)},0)}endDrawingSession(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,zt.A)(bv,this)?((0,zt.A)(kv,this).setCurrentDrawingSession(null),(0,zt.A)(bv,this).abort(),(0,Ht.A)(bv,this,null),(0,Ht.A)(yv,this,null),xt(Cv,this,Dv).endDrawing(t)):null}findNewParent(t,e,i){const n=(0,zt.A)(kv,this).findParent(e,i);return null!==n&&n!==this&&(n.changeParent(t),!0)}commitOrRemove(){return!!(0,zt.A)(bv,this)&&(this.endDrawingSession(),!0)}onScaleChanging(){(0,zt.A)(bv,this)&&xt(Cv,this,Dv).onScaleChangingWhenDrawing(this)}destroy(){var t;this.commitOrRemove(),(null===(t=(0,zt.A)(kv,this).getActive())||void 0===t?void 0:t.parent)===this&&((0,zt.A)(kv,this).commitOrRemove(),(0,zt.A)(kv,this).setActiveEditor(null)),(0,zt.A)(gv,this)&&(clearTimeout((0,zt.A)(gv,this)),(0,Ht.A)(gv,this,null));for(const i of(0,zt.A)(fv,this).values()){var e;null===(e=(0,zt.A)(dv,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,(0,zt.A)(fv,this).clear(),(0,zt.A)(kv,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,bi(this.div,e);for(const i of(0,zt.A)(kv,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,zt.A)(kv,this).commitOrRemove(),(0,_t.A)(Cv,this,Iv).call(this);const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,bi(this.div,{rotation:n}),i!==n)for(const s of(0,zt.A)(fv,this).values())s.rotate(n)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,zt.A)(kv,this).viewParameters.realScale}}function Tv(t){return 0!==(0,zt.A)(fv,t).size?(0,zt.A)(fv,t).values():(0,zt.A)(kv,t).getEditors(t.pageIndex)}function Pv(t){(0,zt.A)(kv,this).unselectAll();const{target:e}=t;if(e===(0,zt.A)(_v,this).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,zt.A)(_v,this).div.contains(e)){const{isMac:e}=Ge.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,zt.A)(kv,this).showAllEditors("highlight",!0,!0),(0,zt.A)(_v,this).div.classList.add("free"),this.toggleDrawing(),rf.startHighlighting(this,"ltr"===(0,zt.A)(kv,this).direction,{target:(0,zt.A)(_v,this).div,x:t.x,y:t.y}),(0,zt.A)(_v,this).div.addEventListener("pointerup",()=>{(0,zt.A)(_v,this).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:(0,zt.A)(kv,this)._signal}),t.preventDefault()}}function Dv(t){return Fv._.get((0,zt.A)(kv,t).getMode())}function Rv(t){const e=xt(Cv,this,Dv);return e?new e.prototype.constructor(t):null}function Lv(){const{x:t,y:e,width:i,height:n}=this.boundingClientRect,s=Math.max(0,t),r=Math.max(0,e),a=(s+Math.min(window.innerWidth,t+i))/2-t,o=(r+Math.min(window.innerHeight,e+n))/2-e,[l,c]=this.viewport.rotation%180===0?[a,o]:[o,a];return{offsetX:l,offsetY:c}}function Iv(){for(const t of(0,zt.A)(fv,this).values())t.isEmpty()&&t.remove()}(0,Vt.A)(Mv,"_initialized",!1);var Fv={_:new Map([DA,bm,iv,rf,Hm].map(t=>[t._editorType,t]))},Nv=new WeakMap,Ov=new WeakMap,Bv=new WeakMap,Wv=new WeakSet;class jv{constructor(t){let{pageIndex:e}=t;(0,bt.A)(this,Wv),(0,yt.A)(this,Nv,null),(0,yt.A)(this,Ov,new Map),(0,yt.A)(this,Bv,new Map),this.pageIndex=e}setParent(t){if((0,zt.A)(Nv,this)){if((0,zt.A)(Nv,this)!==t){if((0,zt.A)(Ov,this).size>0)for(const e of(0,zt.A)(Ov,this).values())e.remove(),t.append(e);(0,Ht.A)(Nv,this,t)}}else(0,Ht.A)(Nv,this,t)}static get _svgFactory(){return Fe(this,"_svgFactory",new Pu)}draw(t){var e,i;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=(Gv._=(e=Gv._,i=e++,e),i),a=(0,_t.A)(Wv,this,zv).call(this),o=jv._svgFactory.createElement("defs");a.append(o);const l=jv._svgFactory.createElement("path");o.append(l);const c="path_p".concat(this.pageIndex,"_").concat(r);l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),n&&(0,zt.A)(Bv,this).set(r,l);const h=s?(0,_t.A)(Wv,this,Hv).call(this,o,c):null,d=jv._svgFactory.createElement("use");return a.append(d),d.setAttribute("href","#".concat(c)),this.updateProperties(a,t),(0,zt.A)(Ov,this).set(r,a),{id:r,clipPathId:"url(#".concat(h,")")}}drawOutline(t,e){var i,n;const s=(Gv._=(i=Gv._,n=i++,i),n),r=(0,_t.A)(Wv,this,zv).call(this),a=jv._svgFactory.createElement("defs");r.append(a);const o=jv._svgFactory.createElement("path");a.append(o);const l="path_p".concat(this.pageIndex,"_").concat(s);let c;if(o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e){const t=jv._svgFactory.createElement("mask");a.append(t),c="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",c),t.setAttribute("maskUnits","objectBoundingBox");const e=jv._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=jv._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(l)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const h=jv._svgFactory.createElement("use");r.append(h),h.setAttribute("href","#".concat(l)),c&&h.setAttribute("mask","url(#".concat(c,")"));const d=h.cloneNode();return r.append(d),h.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(r,t),(0,zt.A)(Ov,this).set(s,r),s}finalizeDraw(t,e){(0,zt.A)(Bv,this).delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;const{root:i,bbox:n,rootClass:s,path:r}=e,a="number"===typeof t?(0,zt.A)(Ov,this).get(t):t;if(a){if(i&&(0,_t.A)(Wv,this,Vv).call(this,a,i),n&&Uv.call(jv,a,n),s){const{classList:t}=a;for(const[e,i]of Object.entries(s))t.toggle(e,i)}if(r){const t=a.firstChild.firstChild;(0,_t.A)(Wv,this,Vv).call(this,t,r)}}}updateParent(t,e){if(e===this)return;const i=(0,zt.A)(Ov,this).get(t);i&&((0,zt.A)(Nv,e).append(i),(0,zt.A)(Ov,this).delete(t),(0,zt.A)(Ov,e).set(t,i))}remove(t){(0,zt.A)(Bv,this).delete(t),null!==(0,zt.A)(Nv,this)&&((0,zt.A)(Ov,this).get(t).remove(),(0,zt.A)(Ov,this).delete(t))}destroy(){(0,Ht.A)(Nv,this,null);for(const t of(0,zt.A)(Ov,this).values())t.remove();(0,zt.A)(Ov,this).clear(),(0,zt.A)(Bv,this).clear()}}function Uv(t,e){let[i,n,s,r]=e;const{style:a}=t;a.top="".concat(100*n,"%"),a.left="".concat(100*i,"%"),a.width="".concat(100*s,"%"),a.height="".concat(100*r,"%")}function zv(){const t=Ut._svgFactory.create(1,1,!0);return(0,zt.A)(Nv,this).append(t),t.setAttribute("aria-hidden",!0),t}function Hv(t,e){const i=Ut._svgFactory.createElement("clipPath");t.append(i);const n="clip_".concat(e);i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=Ut._svgFactory.createElement("use");return i.append(s),s.setAttribute("href","#".concat(e)),s.classList.add("clip"),n}function Vv(t,e){for(const[i,n]of Object.entries(e))null===n?t.removeAttribute(i):t.setAttribute(i,n)}Ut=jv;var Gv={_:0};globalThis._pdfjsTestingUtils={HighlightOutliner:Mg},globalThis.pdfjsLib={AbortException:ze,AnnotationEditorLayer:Mv,AnnotationEditorParamsType:ae,AnnotationEditorType:re,AnnotationEditorUIManager:gs,AnnotationLayer:_A,AnnotationMode:ne,AnnotationType:Ae,applyOpacity:function(t,e,i,n){const s=255*(1-(n=Math.min(Math.max(null!==n&&void 0!==n?n:1,0),1)));return[t=Math.round(t*n+s),e=Math.round(e*n+s),i=Math.round(i*n+s)]},build:"f56dc8601",ColorPicker:pu,createValidAbsoluteUrl:Le,CSSConstants:class{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),Fe(this,"commentForegroundColor",mi(i))}},DOMSVGFactory:Pu,DrawLayer:jv,FeatureTest:Ge,fetchData:ai,findContrastColor:function(t,e){const i=t[0]+256*t[1]+65536*t[2]+16777216*e[0]+4294967296*e[1]+1099511627776*e[2];let n=Mi.get(i);if(n)return n;const s=new Float32Array(9),r=s.subarray(0,3),a=s.subarray(3,6);Ei(t,a);const o=s.subarray(6,9);Ei(e,o);const l=o[2]<.5,c=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),Ci(a,o,r)<c){let t,e;l?(t=a[2],e=1):(t=0,e=a[2]);const i=.005;for(;e-t>i;){const i=a[2]=(t+e)/2;l===Ci(a,o,r)<c?t=i:e=i}a[2]=l?e:t}return Si(a,r),n=Xe.makeHexColor(Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])),Mi.set(i,n),n},getDocument:gd,getFilenameFromUrl:function(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)},getPdfFilenameFromUrl:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(ci(t))return Pe('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=(t=>{try{return new URL(t)}catch(e){try{return new URL(decodeURIComponent(t))}catch(i){try{return new URL(t,"https://foo.bar")}catch(n){try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch(s){return null}}}}})(t);if(!i)return e;const n=t=>{try{let e=decodeURIComponent(t);return e.includes("/")?(e=e.split("/").at(-1),e.test(/^\.pdf$/i)?e:t):e}catch(e){return t}},s=/\.pdf$/i,r=i.pathname.split("/").at(-1);if(s.test(r))return n(r);if(i.searchParams.size>0){const t=Array.from(i.searchParams.values()).reverse();for(const i of t)if(s.test(i))return n(i);const e=Array.from(i.searchParams.keys()).reverse();for(const i of e)if(s.test(i))return n(i)}if(i.hash){const t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return n(t[0])}return e},getRGB:mi,getUuid:Ze,getXfaPageViewport:function(t,e){let{scale:i=1,rotation:n=0}=e;const{width:s,height:r}=t.attributes.style,a=[0,0,parseInt(s),parseInt(r)];return new oi({viewBox:a,userUnit:1,scale:i,rotation:n})},GlobalWorkerOptions:Gc,ImageKind:pe,InvalidPDFException:We,isDataScheme:ci,isPdfFile:hi,isValidExplicitDest:Va,MathClamp:ti,noContextMenu:pi,normalizeUnicode:function(t){return Qe||(Qe=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFBD3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,Je=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Qe,(t,e,i)=>e?e.normalize("NFKC"):Je.get(i))},OPS:ye,OutputScale:yi,PasswordResponses:{NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PDFDataRangeTransport:xd,PDFDateString:gi,PDFWorker:Id,PermissionFlag:{PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PixelsPerInch:ri,RenderingCancelledException:li,renderRichText:Ti,ResponseException:je,setLayerDimensions:bi,shadow:Fe,SignatureExtractor:xm,stopEvent:Ai,SupportedImageMimeTypes:_i,TextLayer:id,TouchManager:kr,updateUrlHash:Ie,Util:Xe,VerbosityLevel:be,version:"5.4.296",XfaLayer:ni};var qv=i(53986),Xv=i(70579),Yv=i(58387),Kv=Object.prototype.hasOwnProperty;function Qv(t,e,i){for(i of t.keys())if(Jv(i,e))return i}function Jv(t,e){var i,n,s;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((n=t.length)===e.length)for(;n--&&Jv(t[n],e[n]););return-1===n}if(i===Set){if(t.size!==e.size)return!1;for(n of t){if((s=n)&&"object"===typeof s&&!(s=Qv(e,s)))return!1;if(!e.has(s))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(n of t){if((s=n[0])&&"object"===typeof s&&!(s=Qv(e,s)))return!1;if(!Jv(n[1],e.get(s)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return-1===n}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return-1===n}if(!i||"object"===typeof t){for(i in n=0,t){if(Kv.call(t,i)&&++n&&!Kv.call(e,i))return!1;if(!(i in e)||!Jv(t[i],e[i]))return!1}return Object.keys(e).length===n}}return t!==t&&e!==e}function Zv(t){let e=!1;return{promise:new Promise((i,n)=>{t.then(t=>!e&&i(t)).catch(t=>!e&&n(t))}),cancel(){e=!0}}}const $v=["onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onFocus","onBlur","onInput","onInvalid","onReset","onSubmit","onLoad","onError","onKeyDown","onKeyPress","onKeyUp","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onScroll","onWheel","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onChange","onToggle"];function tw(t,e){const i={};for(const n of $v){const s=t[n];s&&(i[n]=e?t=>s(t,e(n)):s)}return i}var ew="Invariant failed";function iw(t,e){if(!t)throw new Error(ew)}var nw=i(96440);const sw=(0,s.createContext)(null);class rw{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return iw(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(t){iw(this.pdfViewer),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{iw(this.pdfDocument),iw(t),"string"===typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{iw(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise(t=>{iw(this.pdfDocument),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{iw(!1,'"'.concat(e,'" is not a valid page reference.'))}):"number"===typeof e?t(e):iw(!1,'"'.concat(e,'" is not a valid destination reference.'))}).then(e=>{const i=e+1;iw(this.pdfViewer),iw(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}goToPage(t){const e=t-1;iw(this.pdfViewer),iw(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}}function aw(t){let{children:e,type:i}=t;return(0,Xv.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}const ow={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function lw(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function cw(){return(0,s.useReducer)(lw,{value:void 0,error:void 0})}const hw="undefined"!==typeof window,dw=hw&&"file:"===window.location.protocol;function uw(t){return function(t){return"undefined"!==typeof t}(t)&&null!==t}function pw(t){return function(t){return"string"===typeof t}(t)&&/^data:/.test(t)}function Aw(t){iw(pw(t));const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function gw(){return hw&&window.devicePixelRatio||1}const fw="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function mw(){nw(!dw,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(fw))}function vw(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()}function ww(t,e){return Object.defineProperty(t,"width",{get(){return this.getViewport({scale:e}).width},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.getViewport({scale:e}).height},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),t}function bw(t){return"AbortException"===t.name||"RenderingCancelledException"===t.name}const yw=["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate","scale"],_w=["url"],{Tm:xw}=n,Ew=(t,e)=>{switch(e){case ow.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case ow.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function Sw(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const kw=(0,s.forwardRef)(function(t,e){let{children:i,className:n,error:r="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:o,file:l,inputRef:c,imageResourcesPath:h,loading:d="Loading PDF\u2026",noData:u="No PDF file specified.",onItemClick:p,onLoadError:A,onLoadProgress:g,onLoadSuccess:f,onPassword:m=Ew,onSourceError:v,onSourceSuccess:w,options:b,renderMode:y,rotate:_,scale:x}=t,E=(0,qv.A)(t,yw);const[S,k]=cw(),{value:C,error:M}=S,[T,P]=cw(),{value:D,error:R}=T,L=(0,s.useRef)(new rw),I=(0,s.useRef)([]),F=(0,s.useRef)(void 0),N=(0,s.useRef)(void 0);l&&l!==F.current&&Sw(l)&&(nw(!Jv(l,F.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),F.current=l),b&&b!==N.current&&(nw(!Jv(b,N.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),N.current=b);const O=(0,s.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:n=i-1}=t;if(p)return void p({dest:e,pageIndex:n,pageNumber:i});const s=I.current[n];s?s.scrollIntoView():nw(!1,"An internal link leading to page ".concat(i," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}});(0,s.useImperativeHandle)(e,()=>({linkService:L,pages:I,viewer:O}),[]),(0,s.useEffect)(function(){k({type:"RESET"})},[l,k]);const B=(0,s.useCallback)(async()=>{if(!l)return null;if("string"===typeof l){if(pw(l)){return{data:Aw(l)}}return mw(),{url:l}}if(l instanceof xw)return{range:l};if(l instanceof ArrayBuffer)return{data:l};if(hw&&function(t){return iw(hw),t instanceof Blob}(l)){const t=await function(t){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return i(new Error("Error while reading a file."));e(n.result)},n.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},n.readAsArrayBuffer(t)})}(l);return{data:t}}if(iw("object"===typeof l),iw(Sw(l)),"url"in l&&"string"===typeof l.url){if(pw(l.url)){const{url:t}=l,e=(0,qv.A)(l,_w),i=Aw(t);return(0,wt.A)({data:i},e)}mw()}return l},[l]);(0,s.useEffect)(()=>{const t=Zv(B());return t.promise.then(t=>{k({type:"RESOLVE",value:t})}).catch(t=>{k({type:"REJECT",error:t})}),()=>{vw(t)}},[B,k]),(0,s.useEffect)(()=>{"undefined"!==typeof C&&(!1!==C?w&&w():M&&(nw(!1,M.toString()),v&&v(M)))},[C]),(0,s.useEffect)(function(){P({type:"RESET"})},[P,C]),(0,s.useEffect)(function(){if(!C)return;const t=gd(b?(0,wt.A)((0,wt.A)({},C),b):C);g&&(t.onProgress=g),m&&(t.onPassword=m);const e=t;return e.promise.then(t=>{e.destroyed||P({type:"RESOLVE",value:t})}).catch(t=>{e.destroyed||P({type:"REJECT",error:t})}),()=>{e.destroy()}},[b,P,C]),(0,s.useEffect)(()=>{"undefined"!==typeof D&&(!1!==D?D&&(f&&f(D),I.current=new Array(D.numPages),L.current.setDocument(D)):R&&(nw(!1,R.toString()),A&&A(R)))},[D]),(0,s.useEffect)(function(){L.current.setViewer(O.current),L.current.setExternalLinkRel(a),L.current.setExternalLinkTarget(o)},[a,o]);const W=(0,s.useCallback)((t,e)=>{I.current[t]=e},[]),j=(0,s.useCallback)(t=>{delete I.current[t]},[]),U=(0,s.useMemo)(()=>({imageResourcesPath:h,linkService:L.current,onItemClick:p,pdf:D,registerPage:W,renderMode:y,rotate:_,scale:x,unregisterPage:j}),[h,p,D,W,y,_,x,j]),z=(0,s.useMemo)(()=>tw(E,()=>D),[E,D]);return(0,Xv.jsx)("div",(0,wt.A)((0,wt.A)({className:(0,Yv.A)("react-pdf__Document",n),ref:c},z),{},{children:l?void 0===D||null===D?(0,Xv.jsx)(aw,{type:"loading",children:"function"===typeof d?d():d}):!1===D?(0,Xv.jsx)(aw,{type:"error",children:"function"===typeof r?r():r}):function(){if(t=U,!Boolean(null===t||void 0===t?void 0:t.pdf))throw new Error("pdf is undefined");var t;const e="function"===typeof i?i(U):i;return(0,Xv.jsx)(sw.Provider,{value:U,children:e})}():(0,Xv.jsx)(aw,{type:"no-data",children:"function"===typeof u?u():u})}))});function Cw(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){for(var e=0,n=i;e<n.length;e++){var s=n[e];"function"===typeof s?s(t):s&&(s.current=t)}}}function Mw(){return(0,s.useContext)(sw)}const Tw=(0,s.createContext)(null);function Pw(){return(0,s.useContext)(Tw)}function Dw(){const t=Mw(),e=Pw();iw(e);const i=(0,wt.A)((0,wt.A)({},t),e),{filterAnnotations:n,imageResourcesPath:r,linkService:a,onGetAnnotationsError:o,onGetAnnotationsSuccess:l,onRenderAnnotationLayerError:c,onRenderAnnotationLayerSuccess:h,page:d,pdf:u,renderForms:p,rotate:A,scale:g=1}=i;iw(u),iw(d),iw(a);const[f,m]=cw(),{value:v,error:w}=f,b=(0,s.useRef)(null);nw(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,s.useEffect)(function(){m({type:"RESET"})},[m,d]),(0,s.useEffect)(function(){if(!d)return;const t=Zv(d.getAnnotations()),e=t;return t.promise.then(t=>{m({type:"RESOLVE",value:t})}).catch(t=>{m({type:"REJECT",error:t})}),()=>{vw(e)}},[m,d]),(0,s.useEffect)(()=>{void 0!==v&&(!1!==v?v&&l&&l(v):w&&(nw(!1,w.toString()),o&&o(w)))},[v]);const y=(0,s.useMemo)(()=>d.getViewport({scale:g,rotation:A}),[d,A,g]);return(0,s.useEffect)(function(){if(!u||!d||!a||!v)return;const{current:t}=b;if(!t)return;const e=y.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:u.annotationStorage,commentManager:null,div:t,l10n:null,linkService:a,page:d,structTreeLayer:null,viewport:e},s={annotations:n?n({annotations:v}):v,annotationStorage:u.annotationStorage,div:t,imageResourcesPath:r,linkService:a,page:d,renderForms:p,viewport:e};t.innerHTML="";try{new _A(i).render(s),h&&h()}catch(o){!function(t){nw(!1,"".concat(t)),c&&c(t)}(o)}return()=>{}},[v,n,r,a,d,u,p,y]),(0,Xv.jsx)("div",{className:(0,Yv.A)("react-pdf__Page__annotations","annotationLayer"),ref:b})}const Rw={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Lw=/^H(\d+)$/;function Iw(t){return"children"in t}function Fw(t){return!!Iw(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function Nw(t){const e={};if(Iw(t)){const{role:i}=t,n=i.match(Lw);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(function(t){return t in Rw}(i)){const t=Rw[i];t&&(e.role=t)}}return e}function Ow(t){const e={};if(Iw(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),Fw(t)){const[i]=t.children;if(i){const t=Ow(i);return(0,wt.A)((0,wt.A)({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function Bw(t){return t?(0,wt.A)((0,wt.A)({},Nw(t)),Ow(t)):null}function Ww(t){let{className:e,node:i}=t;const n=(0,s.useMemo)(()=>Bw(i),[i]),r=(0,s.useMemo)(()=>Iw(i)?Fw(i)?null:i.children.map((t,e)=>(0,Xv.jsx)(Ww,{node:t},e)):null,[i]);return(0,Xv.jsx)("span",(0,wt.A)((0,wt.A)({className:e},n),{},{children:r}))}function jw(){const t=Pw();iw(t);const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[n,r]=cw(),{value:a,error:o}=n,{customTextRenderer:l,page:c}=t;return(0,s.useEffect)(function(){r({type:"RESET"})},[r,c]),(0,s.useEffect)(function(){if(l)return;if(!c)return;const t=Zv(c.getStructTree()),e=t;return t.promise.then(t=>{r({type:"RESOLVE",value:t})}).catch(t=>{r({type:"REJECT",error:t})}),()=>vw(e)},[l,c,r]),(0,s.useEffect)(()=>{void 0!==a&&(!1!==a?a&&i&&i(a):o&&(nw(!1,o.toString()),e&&e(o)))},[a]),a?(0,Xv.jsx)(Ww,{className:"react-pdf__Page__structTree structTree",node:a}):null}const Uw=ne;function zw(t){const e=Pw();iw(e);const i=(0,wt.A)((0,wt.A)({},e),t),{_className:n,canvasBackground:r,devicePixelRatio:a=gw(),onRenderError:o,onRenderSuccess:l,page:c,renderForms:h,renderTextLayer:d,rotate:u,scale:p}=i,{canvasRef:A}=t;iw(c);const g=(0,s.useRef)(null);function f(t){bw(t)||(nw(!1,t.toString()),o&&o(t))}const m=(0,s.useMemo)(()=>c.getViewport({scale:p*a,rotation:u}),[a,c,u,p]),v=(0,s.useMemo)(()=>c.getViewport({scale:p,rotation:u}),[c,u,p]);(0,s.useEffect)(function(){if(!c)return;c.cleanup();const{current:t}=g;if(!t)return;t.width=m.width,t.height=m.height,t.style.width="".concat(Math.floor(v.width),"px"),t.style.height="".concat(Math.floor(v.height),"px"),t.style.visibility="hidden";const e={annotationMode:h?Uw.ENABLE_FORMS:Uw.ENABLE,canvas:t,canvasContext:t.getContext("2d",{alpha:!1}),viewport:m};r&&(e.background=r);const i=c.render(e),n=i;return i.promise.then(()=>{t.style.visibility="",c&&l&&l(ww(c,p))}).catch(f),()=>vw(n)},[r,c,h,m,v]);const w=(0,s.useCallback)(()=>{const{current:t}=g;t&&(t.width=0,t.height=0)},[]);return(0,s.useEffect)(()=>w,[w]),(0,Xv.jsx)("canvas",{className:"".concat(n,"__canvas"),dir:"ltr",ref:Cw(A,g),style:{display:"block",userSelect:"none"},children:d?(0,Xv.jsx)(jw,{}):null})}function Hw(){const t=Pw();iw(t);const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:n,onRenderTextLayerError:r,onRenderTextLayerSuccess:a,page:o,pageIndex:l,pageNumber:c,rotate:h,scale:d}=t;iw(o);const[u,p]=cw(),{value:A,error:g}=u,f=(0,s.useRef)(null);nw(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,s.useEffect)(function(){p({type:"RESET"})},[o,p]),(0,s.useEffect)(function(){if(!o)return;const t=Zv(o.getTextContent()),e=t;return t.promise.then(t=>{p({type:"RESOLVE",value:t})}).catch(t=>{p({type:"REJECT",error:t})}),()=>vw(e)},[o,p]),(0,s.useEffect)(()=>{void 0!==A&&(!1!==A?A&&n&&n(A):g&&(nw(!1,g.toString()),i&&i(g)))},[A]);const m=(0,s.useCallback)(()=>{a&&a()},[a]),v=(0,s.useCallback)(t=>{bw(t)||(nw(!1,t.toString()),r&&r(t))},[r]);const w=(0,s.useMemo)(()=>o.getViewport({scale:d,rotation:h}),[o,h,d]);return(0,s.useLayoutEffect)(function(){if(!o||!A)return;const{current:t}=f;if(!t)return;t.innerHTML="";const i=o.streamTextContent({includeMarkedContent:!0}),n=new id({container:t,textContentSource:i,viewport:w}),s=n;return n.render().then(()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i);const n=t.querySelectorAll('[role="presentation"]');if(e){let t=0;A.items.forEach((i,s)=>{if(!function(t){return"str"in t}(i))return;const r=n[t];if(!r)return;const a=e((0,wt.A)({pageIndex:l,pageNumber:c,itemIndex:s},i));r.innerHTML=a,t+=i.str&&i.hasEOL?2:1})}m()}).catch(v),()=>vw(s)},[e,v,m,o,l,c,A,w]),(0,Xv.jsx)("div",{className:(0,Yv.A)("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=f.current;t&&t.classList.remove("selecting")},onMouseDown:function(){const t=f.current;t&&t.classList.add("selecting")},ref:f})}const Vw=["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","filterAnnotations","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"],Gw=1;function qw(t){const e=Mw(),i=(0,wt.A)((0,wt.A)({},e),t),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:r=!0,canvasBackground:a,canvasRef:o,children:l,className:c,customRenderer:h,customTextRenderer:d,devicePixelRatio:u,error:p="Failed to load the page.",filterAnnotations:A,height:g,inputRef:f,loading:m="Loading page\u2026",noData:v="No page specified.",onGetAnnotationsError:w,onGetAnnotationsSuccess:b,onGetStructTreeError:y,onGetStructTreeSuccess:_,onGetTextError:x,onGetTextSuccess:E,onLoadError:S,onLoadSuccess:k,onRenderAnnotationLayerError:C,onRenderAnnotationLayerSuccess:M,onRenderError:T,onRenderSuccess:P,onRenderTextLayerError:D,onRenderTextLayerSuccess:R,pageIndex:L,pageNumber:I,pdf:F,registerPage:N,renderAnnotationLayer:O=!0,renderForms:B=!1,renderMode:W="canvas",renderTextLayer:j=!0,rotate:U,scale:z=Gw,unregisterPage:H,width:V}=i,G=(0,qv.A)(i,Vw),[q,X]=cw(),{value:Y,error:K}=q,Q=(0,s.useRef)(null);iw(F);const J=uw(I)?I-1:null!==L&&void 0!==L?L:null,Z=null!==I&&void 0!==I?I:uw(L)?L+1:null,$=null!==U&&void 0!==U?U:Y?Y.rotate:null,tt=(0,s.useMemo)(()=>{if(!Y)return null;let t=1;const e=null!==z&&void 0!==z?z:Gw;if(V||g){const e=Y.getViewport({scale:1,rotation:$});V?t=V/e.width:g&&(t=g/e.height)}return e*t},[g,Y,$,z,V]);(0,s.useEffect)(function(){return()=>{uw(J)&&r&&H&&H(J)}},[r,F,J,H]),(0,s.useEffect)(function(){X({type:"RESET"})},[X,F,J]),(0,s.useEffect)(function(){if(!F||!Z)return;const t=Zv(F.getPage(Z)),e=t;return t.promise.then(t=>{X({type:"RESOLVE",value:t})}).catch(t=>{X({type:"REJECT",error:t})}),()=>vw(e)},[X,F,Z]),(0,s.useEffect)(()=>{void 0!==Y&&(!1!==Y?function(){if(k){if(!Y||!tt)return;k(ww(Y,tt))}if(r&&N){if(!uw(J)||!Q.current)return;N(J,Q.current)}}():K&&(nw(!1,K.toString()),S&&S(K)))},[Y,tt]);const et=(0,s.useMemo)(()=>uw(J)&&Z&&uw($)&&uw(tt)?{_className:n,canvasBackground:a,customTextRenderer:d,devicePixelRatio:u,filterAnnotations:A,onGetAnnotationsError:w,onGetAnnotationsSuccess:b,onGetStructTreeError:y,onGetStructTreeSuccess:_,onGetTextError:x,onGetTextSuccess:E,onRenderAnnotationLayerError:C,onRenderAnnotationLayerSuccess:M,onRenderError:T,onRenderSuccess:P,onRenderTextLayerError:D,onRenderTextLayerSuccess:R,page:Y,pageIndex:J,pageNumber:Z,renderForms:B,renderTextLayer:j,rotate:$,scale:tt}:null,[n,a,d,u,A,w,b,y,_,x,E,C,M,T,P,D,R,Y,J,Z,B,j,$,tt]),it=(0,s.useMemo)(()=>tw(G,()=>Y?tt?ww(Y,tt):void 0:Y),[G,Y,tt]),nt="".concat(J,"@").concat(tt,"/").concat($);function st(){switch(W){case"custom":return iw(h),(0,Xv.jsx)(h,{},"".concat(nt,"_custom"));case"none":return null;default:return(0,Xv.jsx)(zw,{canvasRef:o},"".concat(nt,"_canvas"))}}return(0,Xv.jsx)("div",(0,wt.A)((0,wt.A)({className:(0,Yv.A)(n,c),"data-page-number":Z,ref:Cw(f,Q),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":"".concat(tt),"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},it),{},{children:Z?null===F||void 0===Y||null===Y?(0,Xv.jsx)(aw,{type:"loading",children:"function"===typeof m?m():m}):!1===F||!1===Y?(0,Xv.jsx)(aw,{type:"error",children:"function"===typeof p?p():p}):function(){if(t=et,!Boolean(null===t||void 0===t?void 0:t.page))throw new Error("page is undefined");var t;const e="function"===typeof l?l(et):l;return(0,Xv.jsxs)(Tw.Provider,{value:et,children:[st(),j?(0,Xv.jsx)(Hw,{},"".concat(nt,"_text")):null,O?(0,Xv.jsx)(Dw,{},"".concat(nt,"_annotations")):null,e]})}():(0,Xv.jsx)(aw,{type:"no-data",children:"function"===typeof v?v():v})}))}var Xw,Yw=i(19155),Kw=i(93141),Qw=i(10986),Jw=i.n(Qw);const Zw=["title","titleId"];function $w(){return $w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},$w.apply(null,arguments)}function tb(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,Zw);return s.createElement("svg",$w({t:1731465967110,className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg","p-id":1541,xmlnsXlink:"http://www.w3.org/1999/xlink",width:200,height:200,ref:e,"aria-labelledby":n},r),i?s.createElement("title",{id:n},i):null,Xw||(Xw=s.createElement("path",{d:"M112 166h-7q-21 3-35 18.5T56 222v562q3 20 18.5 34.5T112 833h388l56-167-119-179-103 123-72-71-5-5q-17-13-38-11.5T183 539l-71 71V222h259l18-56H112z m388 0l-18 56h407v379L654 327l-4-5q-18-16-41.5-14.5T570 328l-72 85 169 253-55 167h277l7-1q21-2 35-18t14-37V215q-3-21-18.5-35T889 166H500zM306 277q-34 0-58.5 24.5t-24.5 59q0 34.5 24.5 59T306 444q23 0 42.5-12t30.5-31l-45-68 14-44q-19-12-42-12z",fill:"#E0E0E0","p-id":1542})))}const eb=s.forwardRef(tb);i.p;var ib,nb;const sb=["title","titleId"];function rb(){return rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},rb.apply(null,arguments)}function ab(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,sb);return s.createElement("svg",rb({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u7f16\u7ec4 10"):i?s.createElement("title",{id:n},i):null,ib||(ib=s.createElement("defs",null,s.createElement("linearGradient",{x1:"50%",y1:"0%",x2:"50%",y2:"100%",id:"linearGradient-1"},s.createElement("stop",{stopColor:"#F5F5F5",offset:"0%"}),s.createElement("stop",{stopColor:"#E0E0E0",offset:"100%"})))),nb||(nb=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807Icon",transform:"translate(-760.000000, -2364.000000)"},s.createElement("g",{id:"\\u7F16\\u7EC4-10",transform:"translate(760.000000, 2364.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u65E0\\u6027\\u522B",fill:"url(#linearGradient-1)"},s.createElement("rect",{id:"Mask\\u5907\\u4EFD",x:0,y:0,width:56,height:56})),s.createElement("g",{id:"\\u5934\\u50CF_avatar-(1)\\u5907\\u4EFD",transform:"translate(8.000000, 12.000000)",fill:"#FFFFFF",fillRule:"nonzero"},s.createElement("path",{d:"M40,41.3851428 C40,40.9828571 40,35.6022857 39,33.792 C38.4,32.5851428 37.4,31.7805714 36.2,30.976 C34.8,30.1714285 33,29.3668572 30.8,28.9645714 C30.6,28.9645714 29.2,28.7634285 28,28.3611428 C26.6,27.9588571 26,27.7577143 25.8,27.5565714 L25.8,26.3497143 C26,23.7348571 27.4,22.3268572 28.6,21.12 C29,20.7177143 29.4,20.3154285 29.8,19.712 C31.2,17.7005714 31.4,15.6891429 31.4,15.2868571 C31.4,14.8845714 31.4,14.6834286 31.2,14.2811429 C31,13.8788572 30.8,13.4765714 30.6,13.2754286 C30.6,12.672 30.8,12.0685714 30.8,11.6662857 C30.8,10.6605715 31,9.05142856 30.6,7.44228572 C30.6,7.24114285 30.6,6.83885715 30.4,6.43657145 C30,5.22971431 29.6,4.22400004 28.8,3.4194286 C28.4,3.4194286 25.6,0.603428618 18,0 L15,0 C14.6,0 14.2,0 13.8,0.201142873 C12.4,0.603428571 12.2,1.60914289 12,2.01142859 L12,3.21828573 L11.8,3.4194286 C11.6,3.62057147 9.60000004,5.43085719 9.40000002,7.84457142 C9.20000001,9.45371426 9.20000001,11.8674285 9.40000002,13.6777143 C9.20000001,14.08 8.80000002,14.4822858 8.80000002,15.488 C8.80000002,15.8902857 9,17.9017143 10.4,19.712 C10.8,20.1142857 11,20.5165715 11.6,21.12 C12.8,22.528 14.2,23.936 14.4,26.3497143 L14.4,27.5565714 C14,27.7577143 13.4,28.16 12,28.5622857 C10.6,28.9645714 9.20000001,29.1657143 9,29.1657143 C7,29.568 5.19999998,30.1714285 3.80000001,30.976 C2.60000001,31.7805714 1.60000003,32.7862857 1,33.792 C0,35.6022857 0,40.9828571 0,41.3851428 L0,42.3908571 C0,43.1954286 0.800000015,44 1.8,44 L38.2,44 C39.2,44 40,43.1954286 40,42.1897143 L40,41.3851428 Z",id:"\\u8DEF\\u5F84"})))))))}const ob=s.forwardRef(ab);i.p;var lb;const cb=["title","titleId"];function hb(){return hb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},hb.apply(null,arguments)}function db(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,cb);return s.createElement("svg",hb({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u5934\u50cf-\u5973"):i?s.createElement("title",{id:n},i):null,lb||(lb=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807",transform:"translate(-792.000000, -230.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u5973",transform:"translate(792.000000, 230.000000)"},s.createElement("rect",{id:"Mask\\u5907\\u4EFD",fill:"#F1F1F1",x:0,y:0,width:56,height:56}),s.createElement("g",{id:"\\u5973",transform:"translate(9.000000, 13.000000)",fillRule:"nonzero"},s.createElement("path",{d:"M19.1219936,0 C26.9032378,0 28.9014356,5.58612362 28.7427755,11.9244473 C28.5841154,18.262771 25.3419303,30.1526079 25.3419303,30.1526079 L19.1334908,30.1526079 L19.1219936,0 Z",id:"\\u8DEF\\u5F84",fill:"#370B00"}),s.createElement("path",{d:"M18.5011497,0 C10.7291032,0 8.7217078,5.58612362 8.88726615,11.9244473 C9.05282451,18.262771 12.2881114,30.1526079 12.2881114,30.1526079 L18.4965509,30.1526079 L18.5011497,0 Z",id:"\\u8DEF\\u5F84",fill:"#420E04"}),s.createElement("path",{d:"M14.2564166,26.7815518 C11.9891865,29.1996673 7.8778199,30.5010196 3.9780001,31.1309294 C0.0781803048,31.7608392 0,35.9948487 0,37.2177506 L0,43 L18.5011497,43 L18.5011497,26.7815518 L14.2564166,26.7815518 Z",id:"\\u8DEF\\u5F84",fill:"#EAE9E8"}),s.createElement("path",{d:"M18.5011497,21.5807577 L14.1736374,21.5807577 L14.1736374,27.196877 C14.1736374,28.0298347 15.5532906,30.6740717 18.5011497,30.6740717 L18.5011497,21.5807577 Z",id:"\\u8DEF\\u5F84",fill:"#EAC1A4"}),s.createElement("path",{d:"M18.5011497,3.92251556 C12.1202536,3.92251556 11.1751911,8.53723974 11.1751911,14.2502683 C11.1751911,20.0948165 16.693804,24.5872505 18.5011497,24.5872505 L18.5011497,3.92251556 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("path",{d:"M11.0372258,13.419618 C10.5888385,11.7352436 9.97489279,11.7352436 9.71505809,12.1621056 C9.45522339,12.5889676 10.351998,14.2387315 10.3749922,15.6000751 C10.3979864,16.9614187 10.7980859,17.1552372 11.294761,16.663769 C11.7914362,16.1723009 11.0372258,13.419618 11.0372258,13.419618 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#DDDCDB",points:"14.247219 27.1368856 11.4603194 28.8327967 15.6199739 36.09868 18.5011497 30.6740717"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#F4F2F2",points:"14.247219 26.7815518 11.4603194 28.8327967 15.6199739 35.7433462 18.5011497 30.6740717"}),s.createElement("path",{d:"M22.7642782,26.7815518 C25.0338077,29.1996673 29.1451744,30.5010196 33.0426947,31.1309294 C36.940215,31.7608392 37,35.9948487 37,37.2177506 L37,43 L18.5011497,43 L18.5011497,26.7815518 L22.7642782,26.7815518 Z",id:"\\u8DEF\\u5F84",fill:"#DDDCDB"}),s.createElement("path",{d:"M18.5011497,21.5807577 L22.8263626,21.5807577 L22.8263626,27.196877 C22.8263626,28.0298347 21.4467094,30.6740717 18.5011497,30.6740717 L18.5011497,21.5807577 Z",id:"\\u8DEF\\u5F84",fill:"#DDB597"}),s.createElement("path",{d:"M18.5011497,3.92251556 C24.8797464,3.92251556 25.8248089,8.53723974 25.8248089,14.2502683 C25.8248089,20.0948165 20.306196,24.5872505 18.5011497,24.5872505 L18.5011497,3.92251556 Z",id:"\\u8DEF\\u5F84",fill:"#EDC19C"}),s.createElement("path",{d:"M25.9673731,13.419618 C26.4272575,11.7352436 27.0320055,11.7352436 27.2918402,12.1621056 C27.5516748,12.5889676 26.6526008,14.2387315 26.6296066,15.6000751 C26.6066124,16.9614187 26.206513,17.1552372 25.7098378,16.663769 C25.2131626,16.1723009 25.967373,13.4196179 25.9673731,13.419618 Z",id:"\\u8DEF\\u5F84",fill:"#EBCFB7"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#DDDCDB",points:"22.752781 27.1368856 25.5396806 28.8327967 21.3800261 36.09868 18.5011497 30.6740717"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#EFEEED",points:"22.752781 26.7815518 25.5396806 28.8327967 21.3800261 35.7433462 18.5011497 30.6740717"}),s.createElement("path",{d:"M9.10801068,29.8549582 C7.43626653,30.4331409 5.71634854,30.860165 3.96880244,31.1309294 C0.0712820906,31.7608392 0,35.9948487 0,37.2177506 L0,43 L16.3373936,43 L9.10801068,29.848036 L9.10801068,29.8549582 Z",id:"\\u8DEF\\u5F84",fill:"#1D1D1D"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#303030",points:"9.10801068 29.8549582 7.32595862 30.4110324 7.10061524 34.8896222 10.4393761 36.7216678 10.4393761 42.9976927 16.3373936 42.9976927 9.10801068 29.8549582"}),s.createElement("path",{d:"M27.8942887,29.8549582 C29.5652485,30.433138 31.2844029,30.8601635 33.0311976,31.1309294 C36.940215,31.7608392 37,35.9902339 37,37.2177506 L37,43 L20.6741036,43 L27.9034864,29.848036 L27.8942887,29.8549582 Z",id:"\\u8DEF\\u5F84",fill:"#1D1D1D"}),s.createElement("polygon",{id:"\\u8DEF\\u5F84",fill:"#303030",points:"27.8942887 29.8549582 29.6763408 30.4110324 29.8993848 34.8896222 26.5629234 36.7216678 26.5629234 42.9976927 20.6626064 42.9976927"}),s.createElement("path",{d:"M10.8072836,5.07619661 C9.67366851,9.80398152 11.1062085,14.2871861 11.267168,14.7163554 C11.267168,14.7163554 12.1248524,14.8524898 13.3366478,12.6581885 C14.9140514,9.79936683 16.8041763,8.32265508 18.4459636,7.55661088 L18.4459636,0 C14.334597,0 11.6005842,1.79974245 10.8072836,5.07619661 Z",id:"\\u8DEF\\u5F84",fill:"#471207"}),s.createElement("path",{d:"M25.6224598,14.7140481 C25.7742216,14.2871861 27.2067616,9.80398157 26.0823442,5.07388927 C25.2936424,1.80204979 22.5573302,0 18.4459636,0 L18.4459636,7.55661088 C19.5462153,7.03397245 20.7468113,6.75837793 21.9640793,6.74903414 C24.4014667,8.41494958 25.6155615,11.7513952 25.6224598,14.7140481 Z",id:"\\u8DEF\\u5F84",fill:"#370B00"})))))))}const ub=s.forwardRef(db);i.p;var pb;const Ab=["title","titleId"];function gb(){return gb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},gb.apply(null,arguments)}function fb(t,e){let{title:i,titleId:n}=t,r=function(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],-1===e.indexOf(i)&&{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}(t,Ab);return s.createElement("svg",gb({width:"56px",height:"56px",viewBox:"0 0 56 56",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",ref:e,"aria-labelledby":n},r),void 0===i?s.createElement("title",{id:n},"\u5934\u50cf-\u7537"):i?s.createElement("title",{id:n},i):null,pb||(pb=s.createElement("g",{id:"PC\\u7AEF",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},s.createElement("g",{id:"\\u56FE\\u6807",transform:"translate(-792.000000, -166.000000)"},s.createElement("g",{id:"\\u5934\\u50CF-\\u7537",transform:"translate(792.000000, 166.000000)"},s.createElement("rect",{id:"Mask",fill:"#F1F1F1",x:0,y:0,width:56,height:56}),s.createElement("g",{id:"Group-46",transform:"translate(7.671233, 12.041096)"},s.createElement("path",{d:"M20.3287113,17.7016171 L14.8261307,17.7016171 L14.8261307,21.8854179 L14.8261307,24.6737429 C14.8261307,25.7091313 16.5713146,28.9930418 20.3287113,28.9930418 L20.3287113,17.7016171 Z",id:"Fill-2",fill:"#DDB597"}),s.createElement("path",{d:"M18.1163052,33.9077874 C18.1163052,33.9077874 16.9107652,32.9969521 15.601989,31.3099039 C14.2932128,29.6230745 12.4333964,25.9116559 12.4333964,25.9116559 C11.796773,26.003812 11.1961258,26.0999083 10.6276562,26.2001637 L19.059062,43.7260274 L20.3287336,43.7260274 L20.3287336,29.2137349 L18.1163052,33.9077874 Z",id:"Fill-4",fill:"#EFEEED"}),s.createElement("path",{d:"M12.4334858,31.7147341 L8.64391162,30.0953254 L10.2679829,26.2654829 C4.85701892,27.2599373 2.57978853,28.6396525 1.7219446,30.5000682 C0.757736068,32.592078 0,43.7258961 0,43.7258961 L18.0757257,43.7258961 L10.3430638,38.5075824 L12.4334858,31.7147341 Z",id:"Fill-6",fill:"#1D1D1D"}),s.createElement("path",{d:"M20.3287113,17.7016171 L25.8312918,17.7016171 L25.8312918,21.8854179 L25.8312918,24.6737429 C25.8312918,25.7091313 24.0861079,28.9930418 20.3287113,28.9930418 L20.3287113,17.7016171 Z",id:"Fill-8",fill:"#D1AC93"}),s.createElement("path",{d:"M22.5412291,33.9077874 C22.5412291,33.9077874 23.7467691,32.9969521 25.0553218,31.3099039 C26.364098,29.6230745 28.2241379,25.9116559 28.2241379,25.9116559 C28.8607613,26.003812 29.4614085,26.0999083 30.0296546,26.2001637 L21.5984722,43.7260274 L20.3288006,43.7260274 L20.3288006,29.2137349 L22.5412291,33.9077874 Z",id:"Fill-10",fill:"#DDDCDB"}),s.createElement("path",{d:"M28.2240485,31.7147341 L32.0133992,30.0953254 L30.3895513,26.2654829 C35.8005153,27.2599373 38.0777457,28.6396525 38.9353662,30.5000682 C39.8997982,32.592078 40.6575342,43.7258961 40.6575342,43.7258961 L22.5815851,43.7258961 L30.314247,38.5075824 L28.2240485,31.7147341 Z",id:"Fill-12",fill:"#0F0F0F"}),s.createElement("path",{d:"M20.3287113,3.71115593 C14.1291744,3.71115593 13.2107742,8.10203448 13.2107742,13.5180132 C13.2107742,19.5112264 15.9664218,23.3250894 20.3287113,23.3250894 L20.3287113,3.71115593 Z",id:"Fill-14",fill:"#EBCFB7"}),s.createElement("path",{d:"M20.3287113,3.71115593 C26.5282481,3.71115593 27.4466484,8.10203448 27.4466484,13.5180132 C27.4466484,19.5112264 24.6910007,23.3250894 20.3287113,23.3250894 L20.3287113,3.71115593 Z",id:"Fill-16",fill:"#EFC7A6"}),s.createElement("path",{d:"M13.0715617,12.7308772 C12.6353774,11.1337961 12.0383055,11.1337961 11.7858013,11.5387578 C11.5330737,11.9435005 12.4056656,13.5180351 12.4286815,14.8001217 C12.4516974,16.0824272 12.8398388,16.2752765 13.3231721,15.80771 C13.8062819,15.3399246 13.0715617,12.7308772 13.0715617,12.7308772",id:"Fill-18",fill:"#EBCFB7"}),s.createElement("path",{d:"M27.5859726,12.7308772 C28.0221568,11.1337961 28.6192287,11.1337961 28.8717329,11.5387578 C29.1242371,11.9435005 28.2516452,13.5180351 28.2288528,14.8001217 C28.2058369,16.0824272 27.817472,16.2752765 27.3343622,15.80771 C26.8510289,15.3399246 27.5859726,12.7308772 27.5859726,12.7308772",id:"Fill-20",fill:"#EBCFB7"}),s.createElement("path",{d:"M12.3795884,25.9199302 C11.7632994,26.0094596 11.1796348,26.1029291 10.6277008,26.2001199 C10.5054709,26.2217908 10.3870398,26.2436806 10.2679382,26.2655705 L8.64386693,30.0951941 L12.4334411,31.7148217 L10.3430191,38.50767 L18.075681,43.7259836 L19.0591067,43.7259836 L12.3795884,25.9199302 Z",id:"Fill-22",fill:"#3A3939"}),s.createElement("path",{d:"M32.0133992,30.0952379 L30.3895513,26.2656142 C30.2834102,26.2459134 30.1768221,26.2264315 30.0686699,26.2071684 L30.0686699,26.2069495 C30.0628601,26.205855 30.0566033,26.2051983 30.0510169,26.2041039 C30.0438664,26.2027905 29.1706041,26.0423381 28.2939899,25.9223819 L21.6763687,43.5636049 L21.6765921,43.5633861 L21.5986063,43.7260274 L22.5815851,43.7260274 L30.314247,38.5077137 L28.2240485,31.7146466 L32.0133992,30.0952379 Z",id:"Fill-24",fill:"#2D2D2D"}),s.createElement("path",{d:"M20.3287113,6.64640537 L20.3287113,0 C16.3335585,0 13.6766779,1.70762469 12.9146962,4.81335203 C11.8139567,9.29901349 13.0521211,13.3967874 13.2000483,13.8032813 C13.8612518,13.932869 14.0167765,11.6642083 14.0167765,9.24144327 C14.0167765,3.89113401 16.7697427,6.64640537 20.3287113,6.64640537",id:"Fill-26",fill:"#370B00"}),s.createElement("path",{d:"M20.3287113,6.64640537 L20.3287113,0 C24.3238641,0 26.9807446,1.70762469 27.7427263,4.81335203 C28.8434659,9.29901349 27.605078,13.3967874 27.4573742,13.8032813 C26.7961707,13.932869 26.640646,11.6642083 26.640646,9.24144327 C26.640646,3.89113401 23.8876798,6.64640537 20.3287113,6.64640537",id:"Fill-28",fill:"#230600"}),s.createElement("polygon",{id:"Fill-30",fill:"#2A798C",points:"20.3287113 33.2162443 18.6501169 33.2162443 19.425506 43.7259836 20.3287113 43.7259836"}),s.createElement("polygon",{id:"Fill-32",fill:"#266C77",points:"21.23214 43.7259179 22.0073056 33.2161786 20.3287113 33.2161786 20.3287113 43.7259179"}),s.createElement("polygon",{id:"Fill-34",fill:"#3691AD",points:"18.2760532 31.4385503 19.1256293 33.2162224 20.3287113 33.2162224 20.3287113 28.9930199"}),s.createElement("polygon",{id:"Fill-36",fill:"#266C77",points:"22.3812799 31.4385503 20.3286219 28.9930199 20.3286219 33.2162224 21.5317039 33.2162224"}),s.createElement("path",{d:"M23.9005061,25.9844833 L25.8313812,24.1571213 C26.8119019,24.7194707 28.2241379,25.9115902 28.2241379,25.9115902 C28.2241379,25.9115902 26.4673343,29.8497873 25.1587815,31.6071019 C23.8497818,33.3639787 22.4846949,34.4026505 22.4846949,34.4026505 L20.3288006,29.2136692 L20.4320369,29.1004989 L23.9005061,25.9844833 Z",id:"Fill-38",fill:"#CCCCCC"}),s.createElement("path",{d:"M23.7972922,25.9115902 L25.8314035,24.1571213 C26.8119243,24.6969242 28.2241602,25.9115902 28.2241602,25.9115902 C28.2241602,25.9115902 26.3641204,29.6230088 25.0553442,31.3098382 C23.7465679,32.9968864 22.5412514,33.9077218 22.5412514,33.9077218 L20.328823,29.2136692 L20.328823,28.9034905 L23.7972922,25.9115902 Z",id:"Fill-40",fill:"#F4F2F2"}),s.createElement("path",{d:"M16.7568047,25.9844833 L14.826153,24.1571213 C13.8456323,24.7194707 12.4333964,25.9115902 12.4333964,25.9115902 C12.4333964,25.9115902 14.1899765,29.8497873 15.4987527,31.6071019 C16.807529,33.3639787 18.1726158,34.4026505 18.1726158,34.4026505 L20.3287336,29.2136692 L20.2252739,29.1004989 L16.7568047,25.9844833 Z",id:"Fill-42",fill:"#CCCCCC"}),s.createElement("path",{d:"M16.8601303,25.9115902 L14.826019,24.1571213 C13.8454982,24.6969242 12.4334858,25.9115902 12.4334858,25.9115902 C12.4334858,25.9115902 14.2933021,29.6230088 15.6020784,31.3098382 C16.9108546,32.9968864 18.1163946,33.9077218 18.1163946,33.9077218 L20.3285995,29.2136692 L20.3285995,28.9034905 L16.8601303,25.9115902 Z",id:"Fill-44",fill:"#FFFFFF"})))))))}const mb=s.forwardRef(fb);i.p;var vb=i(75087),wb=i.n(vb),bb=i(49461),yb=(i(9056),i(74065)),_b=i.n(yb),xb=i(57469),Eb=i.n(xb),Sb=i(1582),kb=i.n(Sb),Cb=i(80111),Mb=i.n(Cb);function Tb(){return Tb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Tb.apply(null,arguments)}function Pb(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;i[n]=t[n]}return i}const Db=["id","url","error","apis","loading","ttl","cacheName"],Rb=["paramsType","paramsName"],Lb=["data"],Ib=t=>e=>{var i;const n=Object.assign({},{loading:null,ttl:6e6,cacheName:"file-cache"},e),{id:s,error:o,apis:c,loading:d,ttl:u,cacheName:p}=n,A=Pb(n,Db),{apis:g}=(0,a.usePreset)(),f=h()({},g,c);if(!s)return null;if(null==f||null==(i=f.file)||!i.getUrl)return console.warn("\u8bf7\u5728Global\u7ec4\u4ef6\u8bbe\u7f6epreset.apis.file.getUrl\u53c2\u6570"),null;const m=Object.assign({paramsType:"params",paramsName:"id"},f.file.getUrl),{paramsType:v,paramsName:w}=m,b=Pb(m,Rb),y={},_=s.split("?")[0];return y[v]={[w]:_},r().createElement(l(),Tb({},Object.assign({},b,y),{updateType:"refresh",error:o,loading:d,cache:p,ttl:u,render:e=>{let{data:i}=e,n=Pb(e,Lb);return r().createElement(t,Tb({},A,{id:_,data:i,fetchApi:n}))}}))},Fb=["data","children"],Nb=Ib(t=>{let{data:e,children:i}=t;return i(Tb({url:e},Pb(t,Fb)))}),Ob=(t,e)=>{const i=document.createElement("a"),n=new MouseEvent("click");i.download=e,i.target="_blank",i.href=t,i.dispatchEvent(n)},Bb=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file",i=arguments.length>2?arguments[2]:void 0;if(!t)throw new Error((null==i?void 0:i.notFoundFile)||"\u672a\u83b7\u53d6\u5230\u4e0b\u8f7d\u7684\u6587\u4ef6\u4fe1\u606f");if("string"===typeof t&&/blob:http(s)?:/.test(t))return void Ob(t,e);if("[object Blob]"===Object.prototype.toString.call(t)){const i=new Blob([t],{type:t.type});return void Ob(URL.createObjectURL(i),e)}const n=(0,o.getAjax)(),{data:s,headers:r}=await n({url:t,responseType:"blob"}),a=null==r?void 0:r["content-disposition"];if(a){const t=a.match(/filename\*?=(?:UTF-8'')?([^;]+)/i);if(t&&t[1])e=decodeURIComponent(t[1].replace(/['"]/g,""));else{const t=a.match(/filename="?([^"]+)"?/i);t&&(e=t[1])}}Ob(URL.createObjectURL(new Blob([s],{type:null==s?void 0:s.type})),e)},Wb=t=>{let{url:e,staticUrl:i}=t;return/^(blob:)?https?:\/\//.test(e)?e:i+e},jb=t=>{let{url:e,staticUrl:i}=t;var n;const{apis:s}=(0,a.usePreset)(),r=i||(null==(n=s.file)?void 0:n.staticUrl)||"";return Wb({staticUrl:r,url:e})},Ub=["paramsType","paramsName"],zb=["isLoading","data","error","refresh"],Hb=t=>{let{id:e,src:i,filename:n,staticUrl:r,apis:l,onError:c,onSuccess:h}=t;var u,p;const{message:A}=d.App.useApp(),{apis:g}=(0,a.usePreset)(),f=Object.assign({},g,l),m=r||(null==(u=f.file)?void 0:u.staticUrl)||"",[v,w]=(0,s.useState)(!1),b=Object.assign({paramsType:"params",paramsName:"id"},null==(p=f.file)?void 0:p.getUrl),{paramsType:y,paramsName:_}=b,x=Pb(b,Ub),E={};E[y]={[_]:e};const S=(0,o.useFetch)(Object.assign({},x,E,{auto:!1})),{isLoading:k,data:C,error:M,refresh:P}=S,D=Pb(S,zb),R=T()(c||A.error),L=T()(h),I=T()(t=>Bb(Wb({staticUrl:m,url:t}),n).then(L).catch(t=>{R(t.message)}));return(0,s.useEffect)(()=>{k||(M?R(M):C&&(w(!0),I(C).then(()=>{w(!1)})))},[k,M,C,R]),Tb({},D,{isLoading:k||v,download:()=>i?I(i):P(e?E:{})})},Vb={unnamedDownloadFile:"\u672a\u547d\u540d\u4e0b\u8f7d\u6587\u4ef6",fileUpload:"\u4e0a\u4f20\u6587\u4ef6",uploadTips:"\u652f\u6301\u6269\u5c55\u540d{accept}\uff0c\u5355\u4e2a\u6587\u4ef6\u5927\u5c0f\u4e0d\u8d85\u8fc7{fileSize}M\uff0c\u6700\u591a\u4e0a\u4f20{maxLength}\u4e2a\u9644\u4ef6",maxLengthError:"\u4e0a\u4f20\u6587\u4ef6\u4e0d\u80fd\u8d85\u8fc7\u6700\u5927\u5141\u8bb8\u6570\u91cf{maxLength}",fileSizeError:"\u6587\u4ef6{filename}\u4e0d\u80fd\u8d85\u8fc7{fileSize}MB!",uploadError:"\u6587\u4ef6{filename}\u4e0a\u4f20\u9519\u8bef{error}",uploadAnomaly:"\u6587\u4ef6{filename}\u4e0a\u4f20\u5f02\u5e38{error}",fileLoadedError:"\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25",fileNotFoundError:"\u672a\u6307\u5b9a\u6587\u4ef6",pageNotFoundError:"\u672a\u6307\u5b9a\u9875\u9762",unSupportFileType:"\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u7c7b\u578b",unSupportFileTypeDescription:"\u7cfb\u7edf\u4e0d\u652f\u6301\u8be5\u6587\u4ef6\u7c7b\u578b\u9884\u89c8\uff0c\u8bf7\u4e0b\u8f7d\u5230\u672c\u5730\u540e\u8fdb\u884c\u9884\u89c8",uploading:"\u6b63\u5728\u4e0a\u4f20",unNamedDownloadFile:"\u672a\u547d\u540d\u4e0b\u8f7d\u6587\u4ef6",notFoundFile:"\u672a\u83b7\u53d6\u5230\u4e0b\u8f7d\u7684\u6587\u4ef6\u4fe1\u606f",downloadSuccess:"\u4e0b\u8f7d\u6210\u529f",pleaseSetApi:"\u8bf7\u5728Global\u7ec4\u4ef6\u8bbe\u7f6epreset.apis.file.getUrl\u53c2\u6570",filePreview:"\u6587\u4ef6\u9884\u89c8"},Gb=["id","src","filename","api","onSuccess","onError","onClick"],qb=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},{filename:e({id:"unnamedDownloadFile"})},t),{id:n,src:s,filename:a,api:o,onSuccess:l,onError:c,onClick:h}=i,u=Pb(i,Gb),{isLoading:p,download:A}=Hb({id:n,src:s,filename:a,api:o,onError:c,onSuccess:l});return r().createElement(d.Button,Tb({icon:r().createElement(g,null)},D()(u,["locale"]),{loading:p,onClick:function(){h&&h(...arguments),A()}}))});qb.useDownload=Hb,qb.download=Ob,qb.downloadBlobFile=Bb;var Xb="_Cmp6z",Yb="_lmC4r",Kb="_-jyU7",Qb="_lN9hC",Jb="_yaqrz",Zb="_SXsiw",$b="_15U-a",ty="_tpRpL";const ey=["className","url","maxWidth","ignoreContent"],iy=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{let{data:e,apis:i,contentWindowUrl:n}=t;var o;const l=(0,s.useRef)(null),{apis:c}=(0,a.usePreset)(),{formatMessage:h}=(0,R.useIntl)(),d=Object.assign({},c,i),u=n||(null==(o=d.file)?void 0:o.contentWindowUrl)||"https://cdn.jsdelivr.net/npm/@kne/iframe-resizer@0.1.3/dist/contentWindow.js";return(0,s.useEffect)(()=>{const t=(new DOMParser).parseFromString(e,"text/html");t.querySelectorAll("script").forEach(t=>{t.parentElement.removeChild(t)});const i=document.createElement("script");i.src=u,t.head.appendChild(i);const n=document.createElement("style");n.innerText="html,body{height:auto!important;}body{pointer-events: none;background: #FFFFFF;}",t.head.appendChild(n),l.current.srcdoc=t.documentElement.outerHTML},[e]),(0,s.useEffect)(()=>{gt({checkOrigin:!1},l.current)},[]),r().createElement("iframe",{title:h({id:"filePreview"}),frameBorder:"0",width:"100%",ref:l})}),ny=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},t),{className:n,url:s,maxWidth:a,ignoreContent:o}=i,c=Pb(i,ey),h=r().createElement("iframe",{title:e({id:"filePreview"}),src:s,width:"100%",className:ty});return r().createElement("div",{className:mt()(n,Xb),style:{maxWidth:a}},o?h:r().createElement(l(),{url:s,transformResponse:t=>{let{data:e}=t;return{data:{code:200,results:e}}},showError:!1,error:h,render:t=>{let{data:e}=t;return r().createElement(iy,Tb({},c,{url:s,data:e}))}}))}),sy=["url","filename","type"],ry=t=>{var e;let{url:i,filename:n,type:s}=t,o=Pb(t,sy);const{apis:l}=(0,a.usePreset)(),c=Object.assign({},l,o.apis),h=jb({staticUrl:o.staticUrl||(null==(e=c.file)?void 0:e.staticUrl),url:i}),d=s&&vy[s]||wy(n||h);return r().createElement(d,Tb({},o,{url:h}))},ay=["url","apis","className"],oy=t=>{var e;let{url:i,apis:n,className:s}=t,o=Pb(t,ay);const{apis:c}=(0,a.usePreset)(),h=Object.assign({},c,n);return r().createElement(l(),Tb({},(null==(e=h.file)?void 0:e.previewOffice)||{loader:async()=>({data:[{url:"https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(i)),type:"html"}]})},{render:t=>{let{data:e}=t;const{data:i}=e;return i.map(t=>{let{url:e,type:i}=t;return r().createElement(ry,Tb({},o,{type:i,ignoreContent:!0,url:e,className:s,key:e}))})}}))},ly=(0,s.memo)((0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{var e;const{formatMessage:i}=(0,R.useIntl)(),{url:n,apis:o,maxWidth:l,scale:c,rotate:h,className:u,pdfjsUrl:p}=Object.assign({},{autoSize:!0,renderTextLayer:!1,scale:100,rotate:0,maxWidth:1200},t),[A,g]=(0,s.useState)(0),{apis:f}=(0,a.usePreset)(),m=Object.assign({},f,o),v=p||(null==(e=m.file)?void 0:e.pdfjsUrl)||"https://cdn.jsdelivr.net/npm/pdfjs-dist@5.4.296";Gc.workerSrc=v+"/build/pdf.worker.min.mjs";const w=(0,s.useMemo)(()=>({file:n,options:{standardFontDataUrl:v+"/standard_fonts/",cMapUrl:v+"/cmaps/",cMapPacked:!0}}),[v,n]),[b,y]=(0,s.useState)(l),_=(0,Yw.A)(()=>{_.current&&_.current.clientWidth&&y(Math.min(_.current.clientWidth,l))});return r().createElement("div",{ref:_,className:mt()(u,Xb),style:{maxWidth:l}},r().createElement(kw,Tb({},w,{error:i({id:"fileLoadedError"}),loading:r().createElement("div",{className:Yb},r().createElement(d.Spin,null)),noData:i({id:"fileNotFoundError"}),onLoadSuccess:t=>{let{numPages:e}=t;g(e)}}),r().createElement(d.Flex,{vertical:!0,gap:8},A>=1&&Array.from(new Array(A),(t,e)=>r().createElement(qw,{key:"page_".concat(e),className:"preview-item",scale:c/100,rotate:h,pageNumber:e+1,width:b,loading:null,renderAnnotationLayer:!1,renderTextLayer:!0,noData:i({id:"pageNotFoundError"})})))))})),cy=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{let{url:e,className:i,maxWidth:n}=t;const{formatMessage:a}=(0,R.useIntl)(),[l,c]=(0,s.useState)(""),[h,u]=(0,s.useState)(!0),[p,A]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(0,o.getAjax)()({url:e,method:"GET"}).then(t=>{let{data:e}=t;c(e),u(!1)},()=>{u(!1),A(!0)})},[e]),r().createElement("div",{className:mt()(i,Xb),style:{maxWidth:n}},h?r().createElement("div",{className:Yb},r().createElement(d.Spin,null)):null,r().createElement("div",{className:Kb},p?r().createElement("div",{className:Qb},a({id:"fileLoadedError"})):r().createElement("div",{className:Jb},l)))}),hy=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{let{maxWidth:e}=t;const{formatMessage:i}=(0,R.useIntl)();return r().createElement("div",{className:Xb,style:{maxWidth:e}},r().createElement("div",{className:Kb},r().createElement(d.Result,{status:"500",title:i({id:"unSupportFileType"}),subTitle:i({id:"unSupportFileTypeDescription"})})))}),dy=["url","scale","rotate","className","maxWidth","origin"],uy=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{let{url:e,scale:i,rotate:n,className:a,maxWidth:o,origin:l}=t,c=Pb(t,dy);const[h,u]=(0,s.useState)(!0),[p,A]=(0,s.useState)(!1),{formatMessage:g}=(0,R.useIntl)();return(0,s.useEffect)(()=>{const t=new Image;t.src=e;const i=()=>{u(!1)},n=()=>{u(!1),A(!0)};return t.addEventListener("load",i),t.addEventListener("error",n),()=>{t.removeEventListener("load",i),t.removeEventListener("error",n)}},[e,i,n]),l?r().createElement("img",Tb({alt:g({id:"filePreview"})},c,{className:a,src:e})):r().createElement("div",{className:mt()(a,Xb),style:{maxWidth:o}},h?r().createElement("div",{className:Yb},r().createElement(d.Spin,null)):null,p?r().createElement("div",{className:Qb},g({id:"fileLoadedError"})):r().createElement("img",Tb({alt:g({id:"filePreview"})},c,{src:e})))}),py=["url","maxWidth"],Ay=t=>{let{url:e,maxWidth:i}=t,n=Pb(t,py);return r().createElement("div",{className:Xb,style:{maxWidth:i}},r().createElement("div",{className:Zb},r().createElement("audio",Tb({},n,{src:e,controls:!0}))))},gy=["url","maxWidth","origin","controls","getElement"],fy=t=>{let{url:e,maxWidth:i,origin:n,controls:a=!0,getElement:o}=t,l=Pb(t,gy);const c=(0,s.useRef)(null),h=T()(o);return(0,s.useEffect)(()=>{h(c.current)},[h]),n?r().createElement("video",Tb({controls:a},l,{src:e,ref:c})):r().createElement("div",{className:Xb,style:{maxWidth:i}},r().createElement("div",{className:$b},r().createElement("video",Tb({controls:a},l,{src:e,ref:c}))))},my=t=>{const e=(t||"").split("?")[0].toLowerCase();return/.txt$/.test(e)?"txt":/.pdf$/.test(e)?"pdf":/.(png|jpg|jpeg)$/.test(e)?"image":/.(html|htm)$/.test(e)?"html":/.(doc|docx|xls|xlsx|ppt|pptx|csv)$/.test(e)?"office":/.(mp3|wav|ogg|aac)$/.test(e)?"audio":/.(mp4|avi|mov|mkv|flv)$/.test(e)?"video":"unknown"},vy={txt:cy,pdf:ly,image:uy,html:ny,office:oy,audio:Ay,video:fy,unknown:hy},wy=t=>vy[my(t)],by=["data","id","staticUrl","className","fetchApi","filename","render"],yy=Ib(t=>{let{data:e,id:i,staticUrl:n,className:s,fetchApi:a,filename:o,render:l}=t,c=Pb(t,by);const h=jb({staticUrl:n,url:e}),d=e&&wy(e)||o&&wy(o);return"function"===typeof l?l({data:e,id:i,staticUrl:n,className:s,fetchApi:a,filename:o,url:h,component:d}):r().createElement(d,Tb({},c,{className:s,url:h}))}),_y=["id","src","originName","filename"],xy=t=>{let{id:e,src:i,originName:n,filename:s}=t,a=Pb(t,_y);return i?r().createElement(ry,Tb({},a,{url:i,filename:s||n})):r().createElement(yy,Tb({},a,{id:e,filename:s||n}))},Ey=["content","onSuccess","onError","onBeforePrint","printProps","contentRef"],Sy=t=>{let{onSuccess:e,onError:i,onBeforePrint:n,printProps:a,contentRef:o}=t,l=Pb(t,Ey);const[c,h]=(0,s.useState)(!1),u=(0,Kw.useReactToPrint)(Tb({contentRef:o,bodyClass:document.body.getAttribute("class"),onBeforePrint:async function(){h(!0),n&&await n(...arguments)},onPrintError:function(){h(!1),i&&i(...arguments)},onAfterPrint:function(){h(!1),e&&e(...arguments)}},a));return r().createElement(d.Button,Tb({},l,{onClick:()=>{h(!0),u()},loading:c}))};var ky=".file-modal-outer {\n min-height: 100px;\n}\n\n.file-title {\n margin-right: 30px;\n}\n\n.ellipse {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n word-break: break-all;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlLm1vZHVsZXMuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFLGlCQUFpQjtBQUNuQjs7QUFFQTtFQUNFLGtCQUFrQjtBQUNwQjs7QUFFQTtFQUNFLGdCQUFnQjtFQUNoQix1QkFBdUI7RUFDdkIsb0JBQW9CO0VBQ3BCLHFCQUFxQjtFQUNyQiw0QkFBNEI7RUFDNUIscUJBQXFCO0FBQ3ZCIiwiZmlsZSI6InN0eWxlLm1vZHVsZXMuc2NzcyIsInNvdXJjZXNDb250ZW50IjpbIi5maWxlLW1vZGFsLW91dGVyIHtcbiAgbWluLWhlaWdodDogMTAwcHg7XG59XG5cbi5maWxlLXRpdGxlIHtcbiAgbWFyZ2luLXJpZ2h0OiAzMHB4O1xufVxuXG4uZWxsaXBzZSB7XG4gIG92ZXJmbG93OiBoaWRkZW47XG4gIHRleHQtb3ZlcmZsb3c6IGVsbGlwc2lzO1xuICBkaXNwbGF5OiAtd2Via2l0LWJveDtcbiAgLXdlYmtpdC1saW5lLWNsYW1wOiAxO1xuICAtd2Via2l0LWJveC1vcmllbnQ6IHZlcnRpY2FsO1xuICB3b3JkLWJyZWFrOiBicmVhay1hbGw7XG59Il19 */";const Cy=["title","filename","originName","openDownload","openPrint","id","src","apis"],My=["renderModal"],Ty=(0,R.createIntlProvider)("zh-CN",Vb,"react-file"),Py=t=>{const e=Object.assign({},{footer:null,openDownload:!1,openPrint:!1},t),{title:i,filename:n,originName:a,openDownload:o,openPrint:l,id:c,src:h,apis:u}=e,p=Pb(e,Cy),[A,g]=Jw()(p,{value:"open",default:"defaultOpen",onChange:"onOpenChange"}),{message:f}=d.App.useApp(),v=(0,s.useRef)();return Tb({},p,{open:A,onOpenChange:g,onCancel:()=>{g(!1)},title:r().createElement(d.Space,{size:10,className:ky["file-title"]},r().createElement("span",{className:ky.ellipse},i||n||a),r().createElement("span",null,o&&r().createElement(Ty,null,t=>{let{formatMessage:e}=t;return r().createElement(qb,{className:"btn-no-padding",type:"link",id:c,src:h,apis:u,filename:n||a,onSuccess:()=>{f.success(e({id:"downloadSuccess"}))}})}),l&&["txt","pdf","image","html"].indexOf(my(n||a))>-1&&r().createElement(Sy,{contentRef:v,type:"link",icon:r().createElement(m,null)}))),children:r().createElement("div",{ref:v,className:ky["file-modal-outer"]},r().createElement(xy,{id:c,src:h,filename:n||a,apis:u}))})},Dy=t=>{const e=Object.assign({},{renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{renderModal:i}=e,n=Pb(e,My),s=Py(n);return Object.assign({},s,{renderModal:t=>i(Object.assign({},s,t))})},Ry=t=>{const{renderModal:e}=Dy(t);return e()},Ly=["filename","originName","id","src","title","modalProps","openDownload","openPrint","children"],Iy=t=>{const[e,i]=(0,s.useState)(!1),n=Object.assign({},{icon:r().createElement(w,null)},t),{filename:a,originName:o,id:l,src:c,title:h,modalProps:u,openDownload:p,openPrint:A,children:g}=n,f=Pb(n,Ly),m=Object.assign({},u,{filename:a||o,id:l,src:c,title:h,open:e,openPrint:A,openDownload:p,onCancel:()=>{i(!1)}});return r().createElement(r().Fragment,null,r().createElement(d.Button,Tb({},f,{onClick:()=>{i(!0)}}),"function"===typeof g?g(a||o):g||a||o),r().createElement(Ry,Tb({},m,{open:e,onOpenChange:i})))},Fy=t=>{let{params:e}=t;const{data:i}=e;return new Promise((t,e)=>{const n=new window.Image;n.src=i,n.addEventListener("load",()=>{t(i)}),n.addEventListener("error",t=>{e(t)})})};var Ny="_H1zfc",Oy="_BAe2W",By="_9kK1I",Wy="_Wwi2N";const jy=["id","src","alt","onClick","loading","error","className","apis","staticUrl"],Uy=["id","src","alt","gender","loading","error","className","gap","icon","children","shape","size","width","height","defaultAvatar","apis","staticUrl"],zy=r().createElement(d.Skeleton.Avatar,{shape:"square",active:!0}),Hy=r().createElement(eb,null),Vy=r().createElement(ob,null),Gy=r().createElement(ub,null),qy=r().createElement(mb,null),Xy=t=>{let{data:e,className:i,alt:n,innerLoading:s,loading:o,error:c,innerError:h,children:d,onClick:u,staticUrl:p}=t;var A;const{apis:g}=(0,a.usePreset)(),f=Object.assign({},g),m=jb({staticUrl:p||(null==(A=f.file)?void 0:A.staticUrl),url:e});return r().createElement(l(),{loader:Fy,params:{data:m},error:h||c,loading:s||o,render:t=>{let{data:e}=t;return"function"===typeof d?d({alt:n,className:mt()(i,Oy),src:e}):r().createElement("img",{alt:n,className:mt()(i,Oy),src:e,onClick:u})}})},Yy=Ib(Xy),Ky=t=>{let{loading:e,error:i,src:n,id:s,alt:a,className:o,children:l,apis:c,onClick:h,staticUrl:d}=t;const u=(t,e)=>{const i=t.type;return!i&&t.render?t.render(Object.assign({},t.props,e)):r().createElement(i,Object.assign({},t.props,e))},p=e&&u(e,{className:By}),A=i&&u(i,{className:Wy});return s?r().createElement(Yy,{alt:a,className:o,id:s,loading:p,innerLoading:p,error:A,innerError:A,apis:c,onClick:h},l):n?r().createElement(Xy,{alt:a,className:o,staticUrl:d,data:n,loading:p,error:A,onClick:h},l):A},Qy=t=>{const e=Object.assign({},{loading:zy,error:Hy},t),{id:i,src:n,alt:s,onClick:a,loading:o,error:l,className:c,apis:h,staticUrl:d}=e,u=Pb(e,jy);return r().createElement("div",Tb({},u,{className:mt()(c,Ny)}),Ky({loading:o,error:l,src:n,id:i,alt:s,className:c,apis:h,onClick:a,staticUrl:d}))};Qy.Avatar=t=>{const e=Object.assign({},{size:100,defaultAvatar:Vy,error:Hy,shape:"circle"},t),{id:i,src:n,alt:s,gender:a,loading:o,error:l,className:c,gap:h,icon:u,children:p,shape:A,size:g,width:f,height:m,defaultAvatar:v,apis:w,staticUrl:b}=e,y=Pb(e,Uy),_=(()=>{const t=f&&m?{style:{width:f,height:m}}:{size:g};let e=A;if(f&&f!==m&&(e="square"),i||n)return Ky({loading:o||r().createElement(d.Skeleton.Avatar,{shape:e,active:!0}),staticUrl:b,error:l,src:n,defaultAvatar:v,id:i,alt:s,className:c,apis:w,children:i=>r().createElement(d.Avatar,Tb({},i,{gap:h,shape:e},t))});if(a){const i=["F","female","f"].indexOf(a)>-1?Gy:["M","male","m"].indexOf(a)>-1?qy:Vy;return r().createElement(d.Avatar,Tb({},y,{src:i,gap:h,shape:e},t))}return r().createElement(d.Avatar,Tb({},y,{gap:h,icon:u,shape:e,size:g,src:v},t),p)})();return r().createElement("div",Tb({},y,{className:mt()(c,Ny),style:{width:f&&m?f:g,height:f&&m?m:g}}),_)};const Jy=t=>{const{item:e,hasPreview:i,getPermission:n,apis:s,onEdit:a,onDelete:o,onPreview:l,renderModal:c}=Object.assign({},{hasPreview:!0,apis:{},getPermission:()=>!0,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{filename:h,id:u,src:p}=e,{onOpenChange:A,renderModal:g}=Dy({apis:s,id:u,src:p,filename:h,renderModal:c});return r().createElement(d.Flex,{justify:"end"},i&&n("preview",e)&&r().createElement(r().Fragment,null,r().createElement(d.Button,{type:"text",icon:r().createElement(y,null),onClick:()=>{l?l(e):A(!0)}}),g()),n("edit",e)&&r().createElement(bb.LoadingButton,{type:"text",icon:r().createElement(x,null),onClick:()=>a&&a(e)}),n("download",e)&&r().createElement(qb,{type:"text",id:u,src:p,filename:h}),n("delete",e)&&r().createElement(bb.ConfirmButton,{type:"text",icon:r().createElement(E.A,null),onClick:()=>o&&o(e)}))};var Zy="_yRMtw",$y="_OivOI",t_="_doPR9",e_="_bLeUP",i_="_mZdoa";const n_=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),{className:i,dataSource:n,getPermission:s,infoItemRenders:a,onDelete:o,onEdit:l,apis:c,renderModal:h}=Object.assign({},{infoItemRenders:[t=>t.userName?r().createElement(d.Typography.Text,null,t.userName):null,t=>t.date?r().createElement(d.Typography.Text,null,Eb()(t.date).format("YYYY-MM-DD HH:mm:ss")):null],getPermission:()=>!0,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t);return r().createElement(d.List,{className:i,dataSource:n.map((t,e)=>(t.index=e,t)),rowKey:t=>"item_".concat(t.uuid&&"uuid_".concat(t.uuid)||t.id&&"id_".concat(t.id)||t.src&&"src_".concat(t.src)),renderItem:t=>{const{type:i,filename:n}=t;return r().createElement(d.List.Item,{className:Zy},r().createElement(d.Row,{justify:"space-between",wrap:!1,className:$y},r().createElement(d.Col,{flex:1},r().createElement("div",{className:t_}),r().createElement(d.Space,{className:"is-block",align:"start",size:4},r().createElement(wb(),{type:_b()(null==n?void 0:n.split(".")),size:14}),n||"")),a&&a.map((e,n)=>r().createElement(d.Col,{span:e.span||4,key:n},"uploading"!==i&&("function"===typeof e?e:e.render)(t),r().createElement("div",{className:t_}))),r().createElement(d.Col,{className:i_},"uploading"!==i?r().createElement(Jy,{getPermission:s,item:t,apis:c,onDelete:o,renderModal:h,onEdit:l}):r().createElement(d.Space,{className:e_},r().createElement(d.Spin,{size:"small"}),r().createElement(d.Typography.Link,null,e({id:"uploading"}))))))},bordered:!0})}),s_=t=>{const{locale:e}=(0,a.useContext)(),{formatMessage:i}=(0,R.createIntl)({locale:e,namespace:"react-file"}),{multiple:n,fileSize:r,maxLength:o,value:l,concurrentCount:c,onAdd:h,onError:u,onSave:p,onChange:A,onUpload:g}=Object.assign({},{concurrentCount:1,value:[]},t),{apis:f}=(0,a.usePreset)(),{message:m}=d.App.useApp(),[v,w]=(0,s.useState)([]),b=(0,s.useRef)(c),y=(0,s.useMemo)(()=>kb()(b.current),[]),_=T()(async t=>{const e=o-l.length;1!==o&&!0===n&&t.length>e?m.error(i({id:"maxLengthError"},{maxLength:o})):await Promise.allSettled(t.map(async t=>{if(t.size>1024*r*1024)return void m.error(i({id:"fileSizeError"},{filename:t.name,fileSize:r}));const e=Mb()(),s=n=>{const s=n.message||i({id:"uploadError"},{filename:t.name,error:n.message?":"+n.message:""});m.error(s),u&&u({file:t,error:n,errMsg:s}),w(t=>{const i=t.slice(0),n=i.findIndex(t=>t.uuid===e);return n>-1&&i.splice(n,1),i})};try{var a;w(1===o||!0!==n?[{uuid:e,type:"uploading",filename:t.name}]:i=>{const n=i.slice(0);return n.unshift({uuid:e,type:"uploading",filename:t.name}),n}),h&&await Promise.resolve(h(t));const r=g||(null==(a=f.file)?void 0:a.upload),{data:l}=await y(()=>r({file:t}));if(0!==l.code)return void s(new Error(i({id:"uploadError"},{filename:t.name,error:l.msg?":"+l.msg:""})));const c=p?await Promise.resolve(p(l,t,e)):Object.assign({},l.data,{filename:l.data.filename||l.data.originName||t.name,id:l.data.id,uuid:e});w(t=>{const i=t.slice(0),n=i.findIndex(t=>t.uuid===e);return n>-1&&i.splice(n,1),i}),A(1===o||!0!==n?[c]:t=>{const e=(t||[]).slice(0);return e.push(c),e})}catch(l){s(l)}}))});return{fileList:v,onFileSelected:_}};var r_="_-hhpT",a_="_FyygJ",o_="_hBEXs",l_="_BMSEY";const c_=[".pdf",".jpg",".png",".jpeg",".doc",".docx",".xls",".xlsx",".html",".msg",".eml",".zip"],h_=["children","className","buttonText","accept","multiple","onChange"],d_=["children"],u_=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=(0,s.useRef)(null),n=Object.assign({},{accept:c_,buttonText:e({id:"fileUpload"}),children:t=>{let{children:e}=t,i=Pb(t,d_);return r().createElement(d.Button,Tb({icon:r().createElement(k,null)},i),l,e)}},t),{children:a,className:o,buttonText:l,accept:c,multiple:h,onChange:u}=n,p=Pb(n,h_);return a(Tb({},p,{className:mt()(o,r_),children:!p.disabled&&r().createElement("input",{ref:i,type:"file",accept:c,multiple:h,className:a_,onChange:t=>{const e=[].slice.call(t.target.files,0);0!==e.length&&(i.current.setAttribute("type","text"),i.current.setAttribute("type","file"),u(e))}})}))}),p_=["className","fileSize","maxLength","multiple","size","accept","children","renderTips","showUploadList","onSave","ossUpload","getPermission","concurrentCount","apis","renderModal"],A_=(0,R.createWithIntlProvider)("zh-CN",Vb,"react-file")(t=>{const{formatMessage:e}=(0,R.useIntl)(),i=Object.assign({},{defaultValue:[],accept:c_,renderTips:t=>t,children:e({id:"fileUpload"}),multiple:!0,showUploadList:!0,maxLength:10,fileSize:30,concurrentCount:10,renderModal:t=>r().createElement(d.Modal,Object.assign({},t))},t),{className:n,fileSize:s,maxLength:a,multiple:o,size:l,accept:c,children:h,renderTips:u,showUploadList:p,onSave:A,ossUpload:g,getPermission:f,concurrentCount:m,apis:v,renderModal:w}=i,b=Pb(i,p_),[y,_]=Jw()(b),x=y||[],{fileList:E,onFileSelected:S}=s_({multiple:o,onSave:A,ossUpload:g,fileSize:s,maxLength:a,value:x,onChange:_,concurrentCount:m});c.map(t=>t.replace(/^\./,"")).join("\u3001");const k=[...x,...E],C=u(e({id:"uploadTips"},{fileSize:s,maxLength:a,accept:c.map(t=>t.replace(/^\./,"")).join(",")}),{fileSize:s,maxLength:a,accept:c});return r().createElement(d.Flex,{vertical:!0,gap:8},r().createElement(d.Flex,{gap:8},r().createElement(u_,Tb({},D()(b,["value","onChange"]),{size:l,multiple:o,accept:c,className:n,buttonText:h,onChange:S})),C&&r().createElement("div",{className:l_},C)),p&&k.length>0&&r().createElement(n_,{className:o_,dataSource:k,infoItemRenders:[],getPermission:f||(t=>["delete","preview"].indexOf(t)>-1),onDelete:t=>{const e=x.slice(0),i=e.indexOf(t);i>-1&&e.splice(i,1),_(e)},apis:v,renderModal:w}))}),g_=(t,e)=>{if(t&&e){const i=Array.isArray(e)?e:e.split(","),n=t.name||"",s=(t.type||"").toLowerCase(),r=s.replace(/\/.*$/,"");return i.some(t=>{const e=t.trim().toLowerCase();return"."===e.charAt(0)?n.toLowerCase().endsWith(e):e.endsWith("/*")?r===e.replace(/\/.*$/,""):s===e})}return!0}},64467(t,e,i){"use strict";i.d(e,{A:()=>s});var n=i(20816);function s(t,e,i){return(e=(0,n.A)(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}},64816(t,e,i){var n=i(47251),s=i(37159),r=i(80438),a=i(69394),o=i(56874);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l},65387(t,e,i){var n=i(87937)(i(56552),"Promise");t.exports=n},68592(t,e,i){var n=i(4262),s=i(56326),r=i(30474);t.exports=function(t){return n(t,r,s)}},69194(t){var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,i){var n=typeof t;return!!(i=null==i?9007199254740991:i)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<i}},69394(t,e,i){var n=i(12622);t.exports=function(t){return n(this,t).has(t)}},69621(t,e,i){var n=i(17529),s=i(57828),r=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(t){return null==t?[]:(t=Object(t),n(a(t),function(e){return r.call(t,e)}))}:s;t.exports=o},70579(t,e,i){"use strict";t.exports=i(51153)},70705(t){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},70914(t,e,i){var n=i(19841);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},71360(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"}},71775(t,e,i){var n=i(5654);t.exports=function(t,e,i){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}},72070(t,e,i){var n=i(87937)(i(56552),"Set");t.exports=n},72154(t,e,i){var n=i(95575),s=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return s.call(e,t)?e[t]:void 0}},73204(t,e,i){var n=i(3343),s=i(22777),r=i(54052),a=i(44543),o=i(69194),l=i(51268),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var i=r(t),h=!i&&s(t),d=!i&&!h&&a(t),u=!i&&!h&&!d&&l(t),p=i||h||d||u,A=p?n(t.length,String):[],g=A.length;for(var f in t)!e&&!c.call(t,f)||p&&("length"==f||d&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||o(f,g))||A.push(f);return A}},74065(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},76272(t,e,i){var n=i(6571),s=i(22761);t.exports=function(t){return s(t)&&n(t)}},76788(t,e,i){var n=i(97160),s=i(85204),r=i(64816);t.exports=function(t,e){var i=this.__data__;if(i instanceof n){var a=i.__data__;if(!s||a.length<199)return a.push([t,e]),this.size=++i.size,this;i=this.__data__=new r(a)}return i.set(t,e),this.size=i.size,this}},77116(t,e,i){var n=i(9812),s=i(22777),r=i(54052),a=n?n.isConcatSpreadable:void 0;t.exports=function(t){return r(t)||s(t)||!!(a&&t&&t[a])}},78420(t,e,i){var n=i(71775),s=i(93211),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,i){var a=t[e];r.call(t,e)&&s(a,i)&&(void 0!==i||e in t)||n(t,e,i)}},79889(t,e,i){var n=i(93950),s=i(46686);t.exports=function(t,e,i){var r=!0,a=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return s(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),n(t,e,{leading:r,maxWait:e,trailing:a})}},80111(t,e,i){var n=i(41069),s=0;t.exports=function(t){var e=++s;return n(t)+e}},80438(t,e,i){var n=i(12622);t.exports=function(t){return n(this,t).get(t)}},80726(t){t.exports=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n&&!1!==e(t[i],i,t););return t}},80755(t,e,i){var n=i(48895),s=i(77116);t.exports=function t(e,i,r,a,o){var l=-1,c=e.length;for(r||(r=s),o||(o=[]);++l<c;){var h=e[l];i>0&&r(h)?i>1?t(h,i-1,r,a,o):n(o,h):a||(o[o.length]=h)}return o}},82211(t,e,i){"use strict";i.d(e,{A:()=>n});const n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"}},82284(t,e,i){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}i.d(e,{A:()=>n})},83223(t,e,i){var n=i(63868),s=i(44353),r=i(38710),a=i(91980),o=i(20310),l=i(22777),c=i(54052),h=i(76272),d=i(44543),u=i(11629),p=i(46686),A=i(12322),g=i(51268),f=i(53737),m=i(91609);t.exports=function(t,e,i,v,w,b,y){var _=f(t,i),x=f(e,i),E=y.get(x);if(E)n(t,i,E);else{var S=b?b(_,x,i+"",t,e,y):void 0,k=void 0===S;if(k){var C=c(x),M=!C&&d(x),T=!C&&!M&&g(x);S=x,C||M||T?c(_)?S=_:h(_)?S=a(_):M?(k=!1,S=s(x,!0)):T?(k=!1,S=r(x,!0)):S=[]:A(x)||l(x)?(S=_,l(_)?S=m(_):p(_)&&!u(_)||(S=o(x))):k=!1}k&&(y.set(x,S),w(S,x,v,b,y),y.delete(x)),n(t,i,S)}}},83713(t,e,i){var n=i(36140),s=i(61143),r=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return s(t);var e=[];for(var i in Object(t))r.call(t,i)&&"constructor"!=i&&e.push(i);return e}},84545(t,e,i){var n=i(97160);t.exports=function(){this.__data__=new n,this.size=0}},84570(t,e,i){var n=i(55647),s=i(60929);t.exports=function(t){return n(function(e,i){var n=-1,r=i.length,a=r>1?i[r-1]:void 0,o=r>2?i[2]:void 0;for(a=t.length>3&&"function"==typeof a?(r--,a):void 0,o&&s(i[0],i[1],o)&&(a=r<3?void 0:a,r=1),e=Object(e);++n<r;){var l=i[n];l&&t(e,l,n,a)}return e})}},85204(t,e,i){var n=i(87937)(i(56552),"Map");t.exports=n},85990(t,e,i){var n=i(13028)(Object.getPrototypeOf,Object);t.exports=n},86578(t){var e=Date.now;t.exports=function(t){var i=0,n=0;return function(){var s=e(),r=16-(s-n);if(n=s,r>0){if(++i>=800)return arguments[0]}else i=0;return t.apply(void 0,arguments)}}},87563(t){t.exports=function(){this.__data__=[],this.size=0}},87937(t,e,i){var n=i(36954),s=i(14657);t.exports=function(t,e){var i=s(t,e);return n(i)?i:void 0}},88140(t,e,i){var n=i(35324),s=i(74065),r=i(21676),a=i(70914);t.exports=function(t,e){return e=n(e,t),null==(t=r(t,e))||delete t[a(s(e))]}},88259(t,e,i){var n=i(15797);t.exports=function(t){var e=n(t,function(t){return 500===i.size&&i.clear(),t}),i=e.cache;return e}},89379(t,e,i){"use strict";i.d(e,{A:()=>r});var n=i(64467);function s(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function r(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?s(Object(i),!0).forEach(function(e){(0,n.A)(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}},91609(t,e,i){var n=i(96614),s=i(30474);t.exports=function(t){return n(t,s(t))}},91980(t){t.exports=function(t,e){var i=-1,n=t.length;for(e||(e=Array(n));++i<n;)e[i]=t[i];return e}},93141(t,e,i){var n;"undefined"!=typeof self&&self,t.exports=(n=i(73884),function(){"use strict";var t={155:function(t){t.exports=n}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};i.r(s),i.d(s,{useReactToPrint:function(){return g}});var r=i(155);const a="printWindow";function o(t){let{level:e="error",messages:i,suppressErrors:n=!1}=t;n||("error"===e?console.error(i):"warning"===e?console.warn(i):console.debug(i))}function l(t,e){if(e||!t){const t=document.getElementById(a);t&&document.body.removeChild(t)}}function c(t){return t instanceof Error?t:new Error("Unknown Error")}function h(t,e){const{documentTitle:i,onAfterPrint:n,onPrintError:s,preserveAfterPrint:r,print:a,suppressErrors:h}=e;setTimeout(()=>{var e,d;if(t.contentWindow){function u(){null==n||n(),l(r)}if(t.contentWindow.focus(),a)a(t).then(u).catch(t=>{s?s("print",c(t)):o({messages:["An error was thrown by the specified `print` function"],suppressErrors:h})});else{if(t.contentWindow.print){const p=null!==(d=null===(e=t.contentDocument)||void 0===e?void 0:e.title)&&void 0!==d?d:"",A=t.ownerDocument.title;i&&(t.ownerDocument.title=i,t.contentDocument&&(t.contentDocument.title=i)),t.contentWindow.print(),i&&(t.ownerDocument.title=A,t.contentDocument&&(t.contentDocument.title=p))}else o({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:h});[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(t=>{var e,i;return(null!==(i=null!==(e=navigator.userAgent)&&void 0!==e?e:navigator.vendor)&&void 0!==i?i:"opera"in window&&window.opera).match(t)})?setTimeout(u,500):u()}}else o({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:h})},500)}function d(t){const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let n=i.nextNode();for(;n;)e.push(n),n=i.nextNode();return e}function u(t,e,i){const n=d(t),s=d(e);if(n.length===s.length)for(let r=0;r<n.length;r++){const t=n[r],e=s[r],a=t.shadowRoot;if(null!==a){const t=e.attachShadow({mode:a.mode});t.innerHTML=a.innerHTML,u(a,t,i)}}else o({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",t,e],suppressErrors:i})}const p='\n @page {\n /* Remove browser default header (title) and footer (url) */\n margin: 0;\n }\n @media print {\n body {\n /* Tell browsers to print background colors */\n color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */\n print-color-adjust: exact; /* Firefox/Safari */\n -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */\n }\n }\n';function A(t,e,i,n){var s,r,a,l,d;const{contentNode:A,clonedContentNode:g,clonedImgNodes:f,clonedVideoNodes:m,numResourcesToLoad:v,originalCanvasNodes:w}=i,{bodyClass:b,fonts:y,ignoreGlobalStyles:_,pageStyle:x,nonce:E,suppressErrors:S,copyShadowRoots:k}=n;t.onload=null;const C=null!==(s=t.contentDocument)&&void 0!==s?s:null===(r=t.contentWindow)||void 0===r?void 0:r.document;if(C){const i=C.body.appendChild(g);k&&u(A,i,!!S),y&&((null===(a=t.contentDocument)||void 0===a?void 0:a.fonts)&&(null===(l=t.contentWindow)||void 0===l?void 0:l.FontFace)?y.forEach(i=>{const n=new FontFace(i.family,i.source,{weight:i.weight,style:i.style});t.contentDocument.fonts.add(n),n.loaded.then(()=>{e(n)}).catch(t=>{e(n,["Failed loading the font:",n,"Load error:",c(t)])})}):(y.forEach(t=>{e(t)}),o({messages:['"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'],suppressErrors:S})));const n=null!=x?x:p,s=C.createElement("style");E&&(s.setAttribute("nonce",E),C.head.setAttribute("nonce",E)),s.appendChild(C.createTextNode(n)),C.head.appendChild(s),b&&C.body.classList.add(...b.split(" "));const r=C.querySelectorAll("canvas");for(let t=0;t<w.length;++t){const e=w[t],i=r[t];if(void 0===i){o({messages:["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.",e],suppressErrors:S});continue}const n=i.getContext("2d");n&&n.drawImage(e,0,0)}for(let t=0;t<f.length;t++){const i=f[t],n=i.getAttribute("src");if(n){const t=new Image;t.onload=()=>{e(i)},t.onerror=(t,n,s,r,a)=>{e(i,["Error loading <img>",i,"Error",a])},t.src=n}else e(i,['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.',i])}for(let t=0;t<m.length;t++){const i=m[t];i.preload="auto";const n=i.getAttribute("poster");if(n){const t=new Image;t.onload=()=>{e(i)},t.onerror=(t,s,r,a,o)=>{e(i,["Error loading video poster",n,"for video",i,"Error:",o])},t.src=n}else i.readyState>=2?e(i):i.src?(i.onloadeddata=()=>{e(i)},i.onerror=(t,n,s,r,a)=>{e(i,["Error loading video",i,"Error",a])},i.onstalled=()=>{e(i,["Loading video stalled, skipping",i])}):e(i,["Error loading video, `src` is empty",i])}const h="select",v=A.querySelectorAll(h),M=C.querySelectorAll(h);for(let t=0;t<v.length;t++)M[t].value=v[t].value;if(!_){const i=document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");for(let n=0,s=i.length;n<s;++n){const s=i[n];if("style"===s.tagName.toLowerCase()){const e=C.createElement(s.tagName),i=s.sheet;if(i){let r="";try{const t=i.cssRules.length;for(let e=0;e<t;++e)"string"==typeof i.cssRules[e].cssText&&(r+="".concat(i.cssRules[e].cssText,"\r\n"))}catch(t){o({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",s,"Original error: ".concat(c(t).message)],level:"warning"})}e.setAttribute("id","react-to-print-".concat(n)),E&&e.setAttribute("nonce",E),e.appendChild(C.createTextNode(r)),C.head.appendChild(e)}}else if(s.getAttribute("href"))if(s.hasAttribute("disabled"))o({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",s],level:"warning"}),e(s);else{const t=C.createElement(s.tagName);for(let e=0,i=s.attributes.length;e<i;++e){const i=s.attributes[e];i&&t.setAttribute(i.nodeName,null!==(d=i.nodeValue)&&void 0!==d?d:"")}t.onload=()=>{e(t)},t.onerror=(i,n,s,r,a)=>{e(t,["Failed to load",t,"Error:",a])},E&&t.setAttribute("nonce",E),C.head.appendChild(t)}else o({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",s],level:"warning"}),e(s)}}}0===v&&h(t,n)}function g(t){let{bodyClass:e,contentRef:i,copyShadowRoots:n,documentTitle:s,fonts:d,ignoreGlobalStyles:u,nonce:p,onAfterPrint:g,onBeforePrint:f,onPrintError:m,pageStyle:v,preserveAfterPrint:w,print:b,printIframeProps:y,suppressErrors:_}=t;const x=(0,r.useCallback)(t=>{function r(){const r={bodyClass:e,contentRef:i,copyShadowRoots:n,documentTitle:s,fonts:d,ignoreGlobalStyles:u,nonce:p,onAfterPrint:g,onBeforePrint:f,onPrintError:m,pageStyle:v,preserveAfterPrint:w,print:b,printIframeProps:y,suppressErrors:_},l=function(t){const e=document.createElement("iframe");return e.width="".concat(document.documentElement.clientWidth,"px"),e.height="".concat(document.documentElement.clientHeight,"px"),e.style.position="absolute",e.style.top="-".concat(document.documentElement.clientHeight+100,"px"),e.style.left="-".concat(document.documentElement.clientWidth+100,"px"),e.id=a,e.srcdoc="<!DOCTYPE html>",t&&(t.allow&&(e.allow=t.allow),void 0!==t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),void 0!==t.sandbox&&(e.sandbox=t.sandbox)),e}(y),c=function(t,e){const{contentRef:i,fonts:n,ignoreGlobalStyles:s,suppressErrors:r}=e,a=function(t){let{contentRef:e,optionalContent:i,suppressErrors:n}=t;return i&&"function"==typeof i?(e&&o({level:"warning",messages:['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']}),i()):e?e.current:void o({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:n})}({contentRef:i,optionalContent:t,suppressErrors:r});if(!a)return;const l=a.cloneNode(!0),c=document.querySelectorAll("link[rel~='stylesheet'], link[as='style']"),h=l.querySelectorAll("img"),d=l.querySelectorAll("video"),u=n?n.length:0;return{contentNode:a,clonedContentNode:l,clonedImgNodes:h,clonedVideoNodes:d,numResourcesToLoad:(s?0:c.length)+h.length+d.length+u,originalCanvasNodes:a.querySelectorAll("canvas")}}(t,r);if(!c)return void o({messages:["There is nothing to print"],suppressErrors:_});const x=function(t,e,i){const{suppressErrors:n}=t,s=[],r=[];return function(a,l){s.includes(a)?o({level:"debug",messages:["Tried to mark a resource that has already been handled",a],suppressErrors:n}):(l?(o({messages:['"react-to-print" was unable to load a resource but will continue attempting to print the page',...l],suppressErrors:n}),r.push(a)):s.push(a),s.length+r.length===e&&h(i,t))}}(r,c.numResourcesToLoad,l);!function(t,e,i,n){t.onload=()=>{A(t,e,i,n)},document.body.appendChild(t)}(l,x,c,r)}l(w,!0),f?f().then(()=>{r()}).catch(t=>{null==m||m("onBeforePrint",c(t))}):r()},[e,i,n,s,d,u,p,g,f,m,v,w,b,_]);return x}return s}())},93211(t){t.exports=function(t,e){return t===e||t!==t&&e!==e}},93950(t,e,i){var n=i(46686),s=i(4757),r=i(40801),a=Math.max,o=Math.min;t.exports=function(t,e,i){var l,c,h,d,u,p,A=0,g=!1,f=!1,m=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function v(e){var i=l,n=c;return l=c=void 0,A=e,d=t.apply(n,i)}function w(t){var i=t-p;return void 0===p||i>=e||i<0||f&&t-A>=h}function b(){var t=s();if(w(t))return y(t);u=setTimeout(b,function(t){var i=e-(t-p);return f?o(i,h-(t-A)):i}(t))}function y(t){return u=void 0,m&&l?v(t):(l=c=void 0,d)}function _(){var t=s(),i=w(t);if(l=arguments,c=this,p=t,i){if(void 0===u)return function(t){return A=t,u=setTimeout(b,e),g?v(t):d}(p);if(f)return clearTimeout(u),u=setTimeout(b,e),v(p)}return void 0===u&&(u=setTimeout(b,e)),d}return e=r(e)||0,n(i)&&(g=!!i.leading,h=(f="maxWait"in i)?a(r(i.maxWait)||0,e):h,m="trailing"in i?!!i.trailing:m),_.cancel=function(){void 0!==u&&clearTimeout(u),A=0,l=p=c=u=void 0},_.flush=function(){return void 0===u?d:y(s())},_}},94258(t,e,i){var n=i(55906)();t.exports=n},95575(t,e,i){var n=i(87937)(Object,"create");t.exports=n},96440(t){"use strict";var e=function(){};t.exports=e},96614(t,e,i){var n=i(78420),s=i(71775);t.exports=function(t,e,i,r){var a=!i;i||(i={});for(var o=-1,l=e.length;++o<l;){var c=e[o],h=r?r(i[c],t[c],c,i,t):void 0;void 0===h&&(h=t[c]),a?s(i,c,h):n(i,c,h)}return i}},96761(t,e,i){var n=i(12322);t.exports=function(t){return n(t)?void 0:t}},96996(t){var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(i){}try{return t+""}catch(i){}}return""}},97132(t,e,i){var n=i(5538),s=i(80726),r=i(78420),a=i(51104),o=i(55119),l=i(44353),c=i(91980),h=i(98124),d=i(29075),u=i(59395),p=i(68592),A=i(26924),g=i(38268),f=i(18630),m=i(20310),v=i(54052),w=i(44543),b=i(57887),y=i(46686),_=i(45921),x=i(28673),E=i(30474),S="[object Arguments]",k="[object Function]",C="[object Object]",M={};M[S]=M["[object Array]"]=M["[object ArrayBuffer]"]=M["[object DataView]"]=M["[object Boolean]"]=M["[object Date]"]=M["[object Float32Array]"]=M["[object Float64Array]"]=M["[object Int8Array]"]=M["[object Int16Array]"]=M["[object Int32Array]"]=M["[object Map]"]=M["[object Number]"]=M[C]=M["[object RegExp]"]=M["[object Set]"]=M["[object String]"]=M["[object Symbol]"]=M["[object Uint8Array]"]=M["[object Uint8ClampedArray]"]=M["[object Uint16Array]"]=M["[object Uint32Array]"]=!0,M["[object Error]"]=M[k]=M["[object WeakMap]"]=!1,t.exports=function t(e,i,T,P,D,R){var L,I=1&i,F=2&i,N=4&i;if(T&&(L=D?T(e,P,D,R):T(e)),void 0!==L)return L;if(!y(e))return e;var O=v(e);if(O){if(L=g(e),!I)return c(e,L)}else{var B=A(e),W=B==k||"[object GeneratorFunction]"==B;if(w(e))return l(e,I);if(B==C||B==S||W&&!D){if(L=F||W?{}:m(e),!I)return F?d(e,o(L,e)):h(e,a(L,e))}else{if(!M[B])return D?e:{};L=f(e,B,I)}}R||(R=new n);var j=R.get(e);if(j)return j;R.set(e,L),_(e)?e.forEach(function(n){L.add(t(n,i,T,n,e,R))}):b(e)&&e.forEach(function(n,s){L.set(s,t(n,i,T,s,e,R))});var U=O?void 0:(N?F?p:u:F?E:x)(e);return s(U||e,function(n,s){U&&(n=e[s=n]),r(L,s,t(n,i,T,s,e,R))}),L}},97160(t,e,i){var n=i(87563),s=i(29935),r=i(24190),a=i(51946),o=i(61714);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l},97685(t,e,i){var n=i(87937)(i(56552),"DataView");t.exports=n},98124(t,e,i){var n=i(96614),s=i(69621);t.exports=function(t,e){return n(t,s(t),e)}},98724(t,e,i){var n=i(27615),s=i(25051),r=i(72154),a=i(48734),o=i(22662);function l(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}l.prototype.clear=n,l.prototype.delete=s,l.prototype.get=r,l.prototype.has=a,l.prototype.set=o,t.exports=l}}]);
|
|
3
|
+
//# sourceMappingURL=4189.4161d40a.chunk.js.map
|