UNPKG

@nutrient-sdk/viewer

Version:

View and annotate PDF files in your web app. Full support for mobile and desktop. Runs in the browser using WASM.

13 lines 197 kB
/*!
 * Nutrient Web SDK 1.20.0 (https://www.nutrient.io/sdk/web)
 *
 * Copyright (c) 2016-2026 PSPDFKit GmbH. All rights reserved.
 *
 * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
 * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 * This notice may not be removed from this file.
 *
 * PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/
 */
"use strict";(globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[]).push([[329],{95202(t,e,n){n.d(e,{default:()=>o});var r=n(58632),i=n.n(r);function o(){return i()('/*!\n * Nutrient Web SDK 1.20.0 (https://www.nutrient.io/sdk/web)\n *\n * Copyright (c) 2016-2026 PSPDFKit GmbH. All rights reserved.\n *\n * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW\n * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.\n * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.\n * This notice may not be removed from this file.\n *\n * PSPDFKit uses several open source third-party components: https://www.nutrient.io/legal/acknowledgements/web-acknowledgements/\n */(()=>{var t={1300(t,e,n){"use strict";var r=n(1711),i=n(9253),o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not a function")}},8777(t,e,n){"use strict";var r=n(7060),i=String,o=TypeError;t.exports=function(t){if(r(t))return t;throw new o(i(t)+" is not an object")}},6335(t,e,n){"use strict";var r=n(7963),i=n(3132),o=n(2676),a=function(t){return function(e,n,a){var s=r(e),u=o(s);if(0===u)return!t&&-1;var c,l=i(a,u);if(t&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4806(t,e,n){"use strict";var r=n(5942);t.exports=r([].slice)},7122(t,e,n){"use strict";var r=n(5942),i=r({}.toString),o=r("".slice);t.exports=function(t){return o(i(t),8,-1)}},2666(t,e,n){"use strict";var r=n(3199),i=n(8133),o=n(8901),a=n(2839);t.exports=function(t,e,n){for(var s=i(e),u=a.f,c=o.f,l=0;l<s.length;l++){var f=s[l];r(t,f)||n&&r(n,f)||u(t,f,c(e,f))}}},7481(t,e,n){"use strict";var r=n(5322),i=n(2839),o=n(1966);t.exports=r?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},1966(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},9422(t,e,n){"use strict";var r=n(1711),i=n(2839),o=n(6437),a=n(2227);t.exports=function(t,e,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:e;if(r(n)&&o(n,c,s),s.global)u?t[e]=n:a(e,n);else{try{s.unsafe?t[e]&&(u=!0):delete t[e]}catch(t){}u?t[e]=n:i.f(t,e,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},2227(t,e,n){"use strict";var r=n(8950),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},5322(t,e,n){"use strict";var r=n(6101);t.exports=!r(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},8269(t,e,n){"use strict";var r=n(8950),i=n(7060),o=r.document,a=i(o)&&i(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},7737(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},7670(t,e,n){"use strict";var r=n(5921);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},2491(t,e,n){"use strict";var r=n(8765);t.exports="NODE"===r},5921(t,e,n){"use strict";var r=n(8950).navigator,i=r&&r.userAgent;t.exports=i?String(i):""},7617(t,e,n){"use strict";var r,i,o=n(8950),a=n(5921),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\\/(\\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\\/(\\d+)/))&&(i=+r[1]),t.exports=i},8765(t,e,n){"use strict";var r=n(8950),i=n(5921),o=n(7122),a=function(t){return i.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},6976(t,e,n){"use strict";var r=n(8950),i=n(8901).f,o=n(7481),a=n(9422),s=n(2227),u=n(2666),c=n(2302);t.exports=function(t,e){var n,l,f,h,p,d=t.target,m=t.global,g=t.stat;if(n=m?r:g?r[d]||s(d,{}):r[d]&&r[d].prototype)for(l in e){if(h=e[l],f=t.dontCallGetSet?(p=i(n,l))&&p.value:n[l],!c(m?l:d+(g?".":"#")+l,t.forced)&&void 0!==f){if(typeof h==typeof f)continue;u(h,f)}(t.sham||f&&f.sham)&&o(h,"sham",!0),a(n,l,h,t)}}},6101(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},5279(t,e,n){"use strict";var r=n(7926),i=Function.prototype,o=i.apply,a=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},1574(t,e,n){"use strict";var r=n(286),i=n(1300),o=n(7926),a=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:o?a(t,e):function(){return t.apply(e,arguments)}}},7926(t,e,n){"use strict";var r=n(6101);t.exports=!r(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},7987(t,e,n){"use strict";var r=n(7926),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},5708(t,e,n){"use strict";var r=n(5322),i=n(3199),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(o,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},286(t,e,n){"use strict";var r=n(7122),i=n(5942);t.exports=function(t){if("Function"===r(t))return i(t)}},5942(t,e,n){"use strict";var r=n(7926),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);t.exports=r?a:function(t){return function(){return o.apply(t,arguments)}}},6109(t,e,n){"use strict";var r=n(8950),i=n(1711);t.exports=function(t,e){return arguments.length<2?(n=r[t],i(n)?n:void 0):r[t]&&r[t][e];var n}},1104(t,e,n){"use strict";var r=n(1300),i=n(2339);t.exports=function(t,e){var n=t[e];return i(n)?void 0:r(n)}},8950(t){"use strict";var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof globalThis&&globalThis)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},3199(t,e,n){"use strict";var r=n(5942),i=n(3815),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},6159(t){"use strict";t.exports={}},8871(t,e,n){"use strict";var r=n(6109);t.exports=r("document","documentElement")},1539(t,e,n){"use strict";var r=n(5322),i=n(6101),o=n(8269);t.exports=!r&&!i(function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},2389(t,e,n){"use strict";var r=n(5942),i=n(6101),o=n(7122),a=Object,s=r("".split);t.exports=i(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===o(t)?s(t,""):a(t)}:a},6960(t,e,n){"use strict";var r=n(5942),i=n(1711),o=n(5531),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(t){return a(t)}),t.exports=o.inspectSource},8751(t,e,n){"use strict";var r,i,o,a=n(3184),s=n(8950),u=n(7060),c=n(7481),l=n(3199),f=n(5531),h=n(4741),p=n(6159),d="Object already initialized",m=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(t,e){if(y.has(t))throw new m(d);return e.facade=t,y.set(t,e),e},i=function(t){return y.get(t)||{}},o=function(t){return y.has(t)}}else{var _=h("state");p[_]=!0,r=function(t,e){if(l(t,_))throw new m(d);return e.facade=t,c(t,_,e),e},i=function(t){return l(t,_)?t[_]:{}},o=function(t){return l(t,_)}}t.exports={set:r,get:i,has:o,enforce:function(t){return o(t)?i(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!u(e)||(n=i(e)).type!==t)throw new m("Incompatible receiver, "+t+" required");return n}}}},1711(t){"use strict";var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},2302(t,e,n){"use strict";var r=n(6101),i=n(1711),o=/#|\\.prototype\\./,a=function(t,e){var n=u[s(t)];return n===l||n!==c&&(i(e)?r(e):!!e)},s=a.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";t.exports=a},2339(t){"use strict";t.exports=function(t){return null==t}},7060(t,e,n){"use strict";var r=n(1711);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},8377(t){"use strict";t.exports=!1},2411(t,e,n){"use strict";var r=n(6109),i=n(1711),o=n(1019),a=n(1514),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return i(e)&&o(e.prototype,s(t))}},2676(t,e,n){"use strict";var r=n(5664);t.exports=function(t){return r(t.length)}},6437(t,e,n){"use strict";var r=n(5942),i=n(6101),o=n(1711),a=n(3199),s=n(5322),u=n(5708).CONFIGURABLE,c=n(6960),l=n(8751),f=l.enforce,h=l.get,p=String,d=Object.defineProperty,m=r("".slice),g=r("".replace),y=r([].join),_=s&&!i(function(){return 8!==d(function(){},"length",{value:8}).length}),v=String(String).split("String"),w=t.exports=function(t,e,n){"Symbol("===m(p(e),0,7)&&(e="["+g(p(e),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?d(t,"name",{value:e,configurable:!0}):t.name=e),_&&n&&a(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=f(t);return a(r,"source")||(r.source=y(v,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return o(this)&&h(this).source||c(this)},"toString")},395(t){"use strict";var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},2839(t,e,n){"use strict";var r=n(5322),i=n(1539),o=n(532),a=n(8777),s=n(6355),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",h="configurable",p="writable";e.f=r?o?function(t,e,n){if(a(t),e=s(e),a(n),"function"==typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var r=l(t,e);r&&r[p]&&(t[e]=n.value,n={configurable:h in n?n[h]:r[h],enumerable:f in n?n[f]:r[f],writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(a(t),e=s(e),a(n),i)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},8901(t,e,n){"use strict";var r=n(5322),i=n(7987),o=n(4695),a=n(1966),s=n(7963),u=n(6355),c=n(3199),l=n(1539),f=Object.getOwnPropertyDescriptor;e.f=r?f:function(t,e){if(t=s(t),e=u(e),l)try{return f(t,e)}catch(t){}if(c(t,e))return a(!i(o.f,t,e),t[e])}},6106(t,e,n){"use strict";var r=n(4658),i=n(7737).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},3375(t,e){"use strict";e.f=Object.getOwnPropertySymbols},1019(t,e,n){"use strict";var r=n(5942);t.exports=r({}.isPrototypeOf)},4658(t,e,n){"use strict";var r=n(5942),i=n(3199),o=n(7963),a=n(6335).indexOf,s=n(6159),u=r([].push);t.exports=function(t,e){var n,r=o(t),c=0,l=[];for(n in r)!i(s,n)&&i(r,n)&&u(l,n);for(;e.length>c;)i(r,n=e[c++])&&(~a(l,n)||u(l,n));return l}},4695(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);e.f=i?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},2592(t,e,n){"use strict";var r=n(7987),i=n(1711),o=n(7060),a=TypeError;t.exports=function(t,e){var n,s;if("string"===e&&i(n=t.toString)&&!o(s=r(n,t)))return s;if(i(n=t.valueOf)&&!o(s=r(n,t)))return s;if("string"!==e&&i(n=t.toString)&&!o(s=r(n,t)))return s;throw new a("Can\'t convert object to primitive value")}},8133(t,e,n){"use strict";var r=n(6109),i=n(5942),o=n(6106),a=n(3375),s=n(8777),u=i([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(s(t)),n=a.f;return n?u(e,n(t)):e}},7460(t,e,n){"use strict";var r=n(2339),i=TypeError;t.exports=function(t){if(r(t))throw new i("Can\'t call method on "+t);return t}},9694(t,e,n){"use strict";var r,i=n(8950),o=n(5279),a=n(1711),s=n(8765),u=n(5921),c=n(4806),l=n(1214),f=i.Function,h=/MSIE .\\./.test(u)||"BUN"===s&&((r=i.Bun.version.split(".")).length<3||"0"===r[0]&&(r[1]<3||"3"===r[1]&&"0"===r[2]));t.exports=function(t,e){var n=e?2:1;return h?function(r,i){var s=l(arguments.length,1)>n,u=a(r)?r:f(r),h=s?c(arguments,n):[],p=s?function(){o(u,this,h)}:u;return e?t(p,i):t(p)}:t}},4741(t,e,n){"use strict";var r=n(2363),i=n(614),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},5531(t,e,n){"use strict";var r=n(8377),i=n(8950),o=n(2227),a="__core-js_shared__",s=t.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.47.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"})},2363(t,e,n){"use strict";var r=n(5531);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},8225(t,e,n){"use strict";var r=n(7617),i=n(6101),o=n(8950).String;t.exports=!!Object.getOwnPropertySymbols&&!i(function(){var t=Symbol("symbol detection");return!o(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41})},2011(t,e,n){"use strict";var r,i,o,a,s=n(8950),u=n(5279),c=n(1574),l=n(1711),f=n(3199),h=n(6101),p=n(8871),d=n(4806),m=n(8269),g=n(1214),y=n(7670),_=n(2491),v=s.setImmediate,w=s.clearImmediate,b=s.process,S=s.Dispatch,O=s.Function,I=s.MessageChannel,E=s.String,x=0,A={},D="onreadystatechange";h(function(){r=s.location});var F=function(t){if(f(A,t)){var e=A[t];delete A[t],e()}},P=function(t){return function(){F(t)}},M=function(t){F(t.data)},T=function(t){s.postMessage(E(t),r.protocol+"//"+r.host)};v&&w||(v=function(t){g(arguments.length,1);var e=l(t)?t:O(t),n=d(arguments,1);return A[++x]=function(){u(e,void 0,n)},i(x),x},w=function(t){delete A[t]},_?i=function(t){b.nextTick(P(t))}:S&&S.now?i=function(t){S.now(P(t))}:I&&!y?(a=(o=new I).port2,o.port1.onmessage=M,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!h(T)?(i=T,s.addEventListener("message",M,!1)):i=D in m("script")?function(t){p.appendChild(m("script"))[D]=function(){p.removeChild(this),F(t)}}:function(t){setTimeout(P(t),0)}),t.exports={set:v,clear:w}},3132(t,e,n){"use strict";var r=n(3817),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},7963(t,e,n){"use strict";var r=n(2389),i=n(7460);t.exports=function(t){return r(i(t))}},3817(t,e,n){"use strict";var r=n(395);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},5664(t,e,n){"use strict";var r=n(3817),i=Math.min;t.exports=function(t){var e=r(t);return e>0?i(e,9007199254740991):0}},3815(t,e,n){"use strict";var r=n(7460),i=Object;t.exports=function(t){return i(r(t))}},3615(t,e,n){"use strict";var r=n(7987),i=n(7060),o=n(2411),a=n(1104),s=n(2592),u=n(1541),c=TypeError,l=u("toPrimitive");t.exports=function(t,e){if(!i(t)||o(t))return t;var n,u=a(t,l);if(u){if(void 0===e&&(e="default"),n=r(u,t,e),!i(n)||o(n))return n;throw new c("Can\'t convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},6355(t,e,n){"use strict";var r=n(3615),i=n(2411);t.exports=function(t){var e=r(t,"string");return i(e)?e:e+""}},9253(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},614(t,e,n){"use strict";var r=n(5942),i=0,o=Math.random(),a=r(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++i+o,36)}},1514(t,e,n){"use strict";var r=n(8225);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},532(t,e,n){"use strict";var r=n(5322),i=n(6101);t.exports=r&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},1214(t){"use strict";var e=TypeError;t.exports=function(t,n){if(t<n)throw new e("Not enough arguments");return t}},3184(t,e,n){"use strict";var r=n(8950),i=n(1711),o=r.WeakMap;t.exports=i(o)&&/native code/.test(String(o))},1541(t,e,n){"use strict";var r=n(8950),i=n(2363),o=n(3199),a=n(614),s=n(8225),u=n(1514),c=r.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){return o(l,t)||(l[t]=s&&o(c,t)?c[t]:f("Symbol."+t)),l[t]}},5282(t,e,n){"use strict";var r=n(6976),i=n(8950),o=n(2011).clear;r({global:!0,bind:!0,enumerable:!0,forced:i.clearImmediate!==o},{clearImmediate:o})},562(t,e,n){"use strict";n(5282),n(2843)},2843(t,e,n){"use strict";var r=n(6976),i=n(8950),o=n(2011).set,a=n(9694),s=i.setImmediate?a(o,!1):o;r({global:!0,bind:!0,enumerable:!0,forced:i.setImmediate!==s},{setImmediate:s})},989(){},5920(t){t.exports="dc5041e4d95eea37"},1211(t){t.exports="0652b1ee47027bdc"}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};n.r(t),n.d(t,{default:()=>Ft});n(562);"object"==typeof window&&(window._babelPolyfill=!1);const e=function t(e){let n;return n=e instanceof Error?e:new Error(e),Object.setPrototypeOf(n,new.target&&new.target.prototype||t.prototype),n};e.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const r=e;function i(t,e){if(!t)throw new r(`Assertion failed: ${e||"Condition not met"}\\n\\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function o(t){console.log(t)}function a(){console.warn(...arguments)}function s(t){console.error(t)}["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",\'[tabindex]:not([tabindex^="-"])\'].join(",");function u(t){return u="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},u(t)}function c(t){var e=function(t,e){if("object"!=u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==u(e)?e:e+""}function l(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}new WeakMap;function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e);else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const p=Object.entries,d=Object.setPrototypeOf,m=Object.isFrozen,g=Object.getPrototypeOf,y=Object.getOwnPropertyDescriptor;let _=Object.freeze,v=Object.seal,w=Object.create,b="undefined"!=typeof Reflect&&Reflect,S=b.apply,O=b.construct;_||(_=function(t){return t}),v||(v=function(t){return t}),S||(S=function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t.apply(e,r)}),O||(O=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return new t(...n)});const I=W(Array.prototype.forEach),E=W(Array.prototype.lastIndexOf),x=W(Array.prototype.pop),A=W(Array.prototype.push),D=W(Array.prototype.splice),F=Array.isArray,P=W(String.prototype.toLowerCase),M=W(String.prototype.toString),T=W(String.prototype.match),k=W(String.prototype.replace),j=W(String.prototype.indexOf),z=W(String.prototype.trim),C=W(Number.prototype.toString),N=W(Boolean.prototype.toString),R="undefined"==typeof BigInt?null:W(BigInt.prototype.toString),L="undefined"==typeof Symbol?null:W(Symbol.prototype.toString),U=W(Object.prototype.hasOwnProperty),B=W(Object.prototype.toString),$=W(RegExp.prototype.test),q=(H=TypeError,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return O(H,e)});var H;function W(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S(t,e,r)}}function J(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P;if(d&&d(t,null),!F(e))return t;let r=e.length;for(;r--;){let i=e[r];if("string"==typeof i){const t=n(i);t!==i&&(m(e)||(e[r]=t),i=t)}t[i]=!0}return t}function K(t){for(let e=0;e<t.length;e++){U(t,e)||(t[e]=null)}return t}function V(t){const e=w(null);for(const r of p(t)){var n=h(r,2);const i=n[0],o=n[1];U(t,i)&&(F(o)?e[i]=K(o):o&&"object"==typeof o&&o.constructor===Object?e[i]=V(o):e[i]=o)}return e}function G(t,e){for(;null!==t;){const n=y(t,e);if(n){if(n.get)return W(n.get);if("function"==typeof n.value)return W(n.value)}t=g(t)}return function(){return null}}const Y=_(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),X=_(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Z=_(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Q=_(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),tt=_(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),et=_(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nt=_(["#text"]),rt=_(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),it=_(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ot=_(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),at=_(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),st=v(/{{[\\w\\W]*|^[\\w\\W]*}}/g),ut=v(/<%[\\w\\W]*|^[\\w\\W]*%>/g),ct=v(/\\${[\\w\\W]*/g),lt=v(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/),ft=v(/^aria-[\\-\\w]+$/),ht=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),pt=v(/^(?:\\w+script|data):/i),dt=v(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),mt=v(/^html$/i),gt=v(/^[a-z][.\\w]*(-[.\\w]+)+$/i),yt=v(/<[/\\w!]/g),_t=v(/<[/\\w]/g),vt=v(/<\\/no(script|embed|frames)/i),wt=v(/\\/>/i),bt=1,St=3,Ot=7,It=8,Et=9,xt=11,At=function(){return"undefined"==typeof window?null:window},Dt=function(t,e,n,r){return U(t,e)&&F(t[e])?J(r.base?V(r.base):{},t[e],r.transform):n};var Ft=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:At();const n=e=>t(e);if(n.version="3.4.11",n.removed=[],!e||!e.document||e.document.nodeType!==Et||!e.Element)return n.isSupported=!1,n;let r=e.document;const i=r,o=i.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,s=e.Node,u=e.Element,c=e.NodeFilter,l=e.NamedNodeMap;void 0===l&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const f=e.DOMParser,h=e.trustedTypes,d=u.prototype,m=G(d,"cloneNode"),g=G(d,"remove"),y=G(d,"nextSibling"),b=G(d,"childNodes"),S=G(d,"parentNode"),O=G(d,"shadowRoot"),H=G(d,"attributes"),W=s&&s.prototype?G(s.prototype,"nodeType"):null,K=s&&s.prototype?G(s.prototype,"nodeName"):null;if("function"==typeof a){const t=r.createElement("template");t.content&&t.content.ownerDocument&&(r=t.content.ownerDocument)}let Ft,Pt,Mt="",Tt=!1,kt=0;const jt=function(){if(kt>0)throw q(\'A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.\')},zt=function(t){jt(),kt++;try{return Ft.createHTML(t)}finally{kt--}},Ct=function(){return Tt||(Pt=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(n=e.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(h,o),Tt=!0),Pt},Nt=r,Rt=Nt.implementation,Lt=Nt.createNodeIterator,Ut=Nt.createDocumentFragment,Bt=Nt.getElementsByTagName,$t=i.importNode;let qt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof p&&"function"==typeof S&&Rt&&void 0!==Rt.createHTMLDocument;const Ht=st,Wt=ut,Jt=ct,Kt=lt,Vt=ft,Gt=pt,Yt=dt,Xt=gt;let Zt=ht,Qt=null;const te=J({},[...Y,...X,...Z,...tt,...nt]);let ee=null;const ne=J({},[...rt,...it,...ot,...at]);let re=Object.seal(w(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,oe=null;const ae=Object.seal(w(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,ue=!0,ce=!1,le=!0,fe=!1,he=!0,pe=!1,de=!1,me=null,ge=null,ye=!1,_e=!1,ve=!1,we=!1,be=!0,Se=!1;const Oe="user-content-";let Ie=!0,Ee=!1,xe={},Ae=null;const De=J({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Fe=null;const Pe=J({},["audio","video","img","source","image","track"]);let Me=null;const Te=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ke="http://www.w3.org/1998/Math/MathML",je="http://www.w3.org/2000/svg",ze="http://www.w3.org/1999/xhtml";let Ce=ze,Ne=!1,Re=null;const Le=J({},[ke,je,ze],M),Ue=_(["mi","mo","mn","ms","mtext"]);let Be=J({},Ue);const $e=_(["annotation-xml"]);let qe=J({},$e);const He=J({},["title","style","font","a","script"]);let We=null;const Je=["application/xhtml+xml","text/html"];let Ke=null,Ve=null;const Ge=r.createElement("form"),Ye=function(t){return t instanceof RegExp||t instanceof Function},Xe=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Ve&&Ve===t)return;t&&"object"==typeof t||(t={}),t=V(t),We=-1===Je.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Ke="application/xhtml+xml"===We?M:P,Qt=Dt(t,"ALLOWED_TAGS",te,{transform:Ke}),ee=Dt(t,"ALLOWED_ATTR",ne,{transform:Ke}),Re=Dt(t,"ALLOWED_NAMESPACES",Le,{transform:M}),Me=Dt(t,"ADD_URI_SAFE_ATTR",Te,{transform:Ke,base:Te}),Fe=Dt(t,"ADD_DATA_URI_TAGS",Pe,{transform:Ke,base:Pe}),Ae=Dt(t,"FORBID_CONTENTS",De,{transform:Ke}),ie=Dt(t,"FORBID_TAGS",V({}),{transform:Ke}),oe=Dt(t,"FORBID_ATTR",V({}),{transform:Ke}),xe=!!U(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?V(t.USE_PROFILES):t.USE_PROFILES),se=!1!==t.ALLOW_ARIA_ATTR,ue=!1!==t.ALLOW_DATA_ATTR,ce=t.ALLOW_UNKNOWN_PROTOCOLS||!1,le=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,fe=t.SAFE_FOR_TEMPLATES||!1,he=!1!==t.SAFE_FOR_XML,pe=t.WHOLE_DOCUMENT||!1,_e=t.RETURN_DOM||!1,ve=t.RETURN_DOM_FRAGMENT||!1,we=t.RETURN_TRUSTED_TYPE||!1,ye=t.FORCE_BODY||!1,be=!1!==t.SANITIZE_DOM,Se=t.SANITIZE_NAMED_PROPS||!1,Ie=!1!==t.KEEP_CONTENT,Ee=t.IN_PLACE||!1,Zt=function(t){try{return $(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:ht,Ce="string"==typeof t.NAMESPACE?t.NAMESPACE:ze,Be=U(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?V(t.MATHML_TEXT_INTEGRATION_POINTS):J({},Ue),qe=U(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?V(t.HTML_INTEGRATION_POINTS):J({},$e);const e=U(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?V(t.CUSTOM_ELEMENT_HANDLING):w(null);if(re=w(null),U(e,"tagNameCheck")&&Ye(e.tagNameCheck)&&(re.tagNameCheck=e.tagNameCheck),U(e,"attributeNameCheck")&&Ye(e.attributeNameCheck)&&(re.attributeNameCheck=e.attributeNameCheck),U(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(re.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),v(re),fe&&(ue=!1),ve&&(_e=!0),xe&&(Qt=J({},nt),ee=w(null),!0===xe.html&&(J(Qt,Y),J(ee,rt)),!0===xe.svg&&(J(Qt,X),J(ee,it),J(ee,at)),!0===xe.svgFilters&&(J(Qt,Z),J(ee,it),J(ee,at)),!0===xe.mathMl&&(J(Qt,tt),J(ee,ot),J(ee,at))),ae.tagCheck=null,ae.attributeCheck=null,U(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?ae.tagCheck=t.ADD_TAGS:F(t.ADD_TAGS)&&(Qt===te&&(Qt=V(Qt)),J(Qt,t.ADD_TAGS,Ke))),U(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?ae.attributeCheck=t.ADD_ATTR:F(t.ADD_ATTR)&&(ee===ne&&(ee=V(ee)),J(ee,t.ADD_ATTR,Ke))),U(t,"ADD_URI_SAFE_ATTR")&&F(t.ADD_URI_SAFE_ATTR)&&J(Me,t.ADD_URI_SAFE_ATTR,Ke),U(t,"FORBID_CONTENTS")&&F(t.FORBID_CONTENTS)&&(Ae===De&&(Ae=V(Ae)),J(Ae,t.FORBID_CONTENTS,Ke)),U(t,"ADD_FORBID_CONTENTS")&&F(t.ADD_FORBID_CONTENTS)&&(Ae===De&&(Ae=V(Ae)),J(Ae,t.ADD_FORBID_CONTENTS,Ke)),Ie&&(Qt["#text"]=!0),pe&&J(Qt,["html","head","body"]),Qt.table&&(J(Qt,["tbody"]),delete ie.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw q(\'TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.\');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw q(\'TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.\');const e=Ft;Ft=t.TRUSTED_TYPES_POLICY;try{Mt=zt("")}catch(t){throw Ft=e,t}}else null===t.TRUSTED_TYPES_POLICY?(Ft=void 0,Mt=""):(void 0===Ft&&(Ft=Ct()),Ft&&"string"==typeof Mt&&(Mt=zt("")));_&&_(t),Ve=t},Ze=J({},[...X,...Z,...Q]),Qe=J({},[...tt,...et]),tn=function(t){let e=S(t);e&&e.tagName||(e={namespaceURI:Ce,tagName:"template"});const n=P(t.tagName),r=P(e.tagName);return!!Re[t.namespaceURI]&&(t.namespaceURI===je?function(t,e,n){return e.namespaceURI===ze?"svg"===t:e.namespaceURI===ke?"svg"===t&&("annotation-xml"===n||Be[n]):Boolean(Ze[t])}(n,e,r):t.namespaceURI===ke?function(t,e,n){return e.namespaceURI===ze?"math"===t:e.namespaceURI===je?"math"===t&&qe[n]:Boolean(Qe[t])}(n,e,r):t.namespaceURI===ze?function(t,e,n){return!(e.namespaceURI===je&&!qe[n])&&!(e.namespaceURI===ke&&!Be[n])&&!Qe[t]&&(He[t]||!Ze[t])}(n,e,r):!("application/xhtml+xml"!==We||!Re[t.namespaceURI]))},en=function(t){A(n.removed,{element:t});try{S(t).removeChild(t)}catch(e){if(g(t),!S(t))throw q("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(t){const e=b(t);if(e){const t=[];I(e,e=>{A(t,e)}),I(t,t=>{try{g(t)}catch(t){}})}const n=H(t);if(n)for(let e=n.length-1;e>=0;--e){const r=n[e],i=r&&r.name;if("string"==typeof i)try{t.removeAttribute(i)}catch(t){}}},rn=function(t,e){try{A(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){A(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t)if(_e||ve)try{en(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},on=function(t){const e=H(t);if(e)for(let n=e.length-1;n>=0;--n){const r=e[n],i=r&&r.name;if("string"==typeof i&&!ee[Ke(i)])try{t.removeAttribute(i)}catch(t){}}},an=function(t){let e=null,n=null;if(ye)t="<remove></remove>"+t;else{const e=T(t,/^[\\r\\n\\t ]+/);n=e&&e[0]}"application/xhtml+xml"===We&&Ce===ze&&(t=\'<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>\'+t+"</body></html>");const i=Ft?zt(t):t;if(Ce===ze)try{e=(new f).parseFromString(i,We)}catch(t){}if(!e||!e.documentElement){e=Rt.createDocument(Ce,"template",null);try{e.documentElement.innerHTML=Ne?Mt:i}catch(t){}}const o=e.body||e.documentElement;return t&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),Ce===ze?Bt.call(e,pe?"html":"body")[0]:pe?e.documentElement:o},sn=function(t){return Lt.call(t.ownerDocument||t,t,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},un=function(t){return t=k(t,Ht," "),t=k(t,Wt," "),t=k(t,Jt," ")},cn=function(t){var e;t.normalize();const n=Lt.call(t.ownerDocument||t,t,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=un(r.data),r=n.nextNode();const i=null===(e=t.querySelectorAll)||void 0===e?void 0:e.call(t,"template");i&&I(i,t=>{fn(t.content)&&cn(t.content)})},ln=function(t){const e=K?K(t):null;return"string"==typeof e&&("form"===Ke(e)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==H(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==W(t)||t.childNodes!==b(t)))},fn=function(t){if(!W||"object"!=typeof t||null===t)return!1;try{return W(t)===xt}catch(t){return!1}},hn=function(t){if(!W||"object"!=typeof t||null===t)return!1;try{return"number"==typeof W(t)}catch(t){return!1}};function pn(t,e,r){0!==t.length&&I(t,t=>{t.call(n,e,r,Ve)})}const dn=function(t){if(pn(qt.beforeSanitizeElements,t,null),ln(t))return en(t),!0;const e=Ke(K?K(t):t.nodeName);if(pn(qt.uponSanitizeElement,t,{tagName:e,allowedTags:Qt}),function(t,e){return!!(he&&t.hasChildNodes()&&!hn(t.firstElementChild)&&$(yt,t.textContent)&&$(yt,t.innerHTML))||!(!he||t.namespaceURI!==ze||"style"!==e||!hn(t.firstElementChild))||t.nodeType===Ot||!(!he||t.nodeType!==It||!$(_t,t.data))}(t,e))return en(t),!0;if(ie[e]||!(ae.tagCheck instanceof Function&&ae.tagCheck(e))&&!Qt[e])return function(t,e){if(!ie[e]&&yn(e)){if(re.tagNameCheck instanceof RegExp&&$(re.tagNameCheck,e))return!1;if(re.tagNameCheck instanceof Function&&re.tagNameCheck(e))return!1}if(Ie&&!Ae[e]){const e=S(t),n=b(t);if(n&&e)for(let r=n.length-1;r>=0;--r){const i=Ee?n[r]:m(n[r],!0);e.insertBefore(i,y(t))}}return en(t),!0}(t,e);if((W?W(t):t.nodeType)===bt&&!tn(t))return en(t),!0;if(("noscript"===e||"noembed"===e||"noframes"===e)&&$(vt,t.innerHTML))return en(t),!0;if(fe&&t.nodeType===St){const e=un(t.textContent);t.textContent!==e&&(A(n.removed,{element:t.cloneNode()}),t.textContent=e)}return pn(qt.afterSanitizeElements,t,null),!1},mn=function(t,e,n){if(oe[e])return!1;if(be&&("id"===e||"name"===e)&&(n in r||n in Ge))return!1;const i=ee[e]||ae.attributeCheck instanceof Function&&ae.attributeCheck(e,t);if(ue&&$(Kt,e));else if(se&&$(Vt,e));else if(i)if(Me[e]);else if($(Zt,k(n,Yt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==j(n,"data:")||!Fe[t]){if(ce&&!$(Gt,k(n,Yt,"")));else if(n)return!1}else;else if(!(yn(t)&&(re.tagNameCheck instanceof RegExp&&$(re.tagNameCheck,t)||re.tagNameCheck instanceof Function&&re.tagNameCheck(t))&&(re.attributeNameCheck instanceof RegExp&&$(re.attributeNameCheck,e)||re.attributeNameCheck instanceof Function&&re.attributeNameCheck(e,t))||"is"===e&&re.allowCustomizedBuiltInElements&&(re.tagNameCheck instanceof RegExp&&$(re.tagNameCheck,n)||re.tagNameCheck instanceof Function&&re.tagNameCheck(n))))return!1;return!0},gn=J({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yn=function(t){return!gn[P(t)]&&$(Xt,t)},_n=function(t,e,n,r){if(Ft&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!n)switch(h.getAttributeType(t,e)){case"TrustedHTML":return zt(r);case"TrustedScriptURL":return function(t){jt(),kt++;try{return Ft.createScriptURL(t)}finally{kt--}}(r)}return r},vn=function(t,e,r,i){try{r?t.setAttributeNS(r,e,i):t.setAttribute(e,i),ln(t)?en(t):x(n.removed)}catch(n){rn(e,t)}},wn=function(t){pn(qt.beforeSanitizeAttributes,t,null);const e=t.attributes;if(!e||ln(t))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0};let r=e.length;const i=Ke(t.nodeName);for(;r--;){const o=e[r],a=o.name,s=o.namespaceURI,u=o.value,c=Ke(a),l=u;let f="value"===a?l:z(l);n.attrName=c,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,pn(qt.uponSanitizeAttribute,t,n),f=n.attrValue,!Se||"id"!==c&&"name"!==c||0===j(f,Oe)||(rn(a,t),f=Oe+f),he&&$(/((--!?|])>)|<\\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?rn(a,t):"attributename"===c&&T(f,"href")?rn(a,t):n.forceKeepAttr||(n.keepAttr&&(le||!$(wt,f))?(fe&&(f=un(f)),mn(i,c,f)?(f=_n(i,c,s,f),f!==l&&vn(t,a,s,f)):rn(a,t)):rn(a,t))}pn(qt.afterSanitizeAttributes,t,null)},bn=function(t){let e=null;const n=sn(t);for(pn(qt.beforeSanitizeShadowDOM,t,null);e=n.nextNode();){pn(qt.uponSanitizeShadowNode,e,null),dn(e),wn(e),fn(e.content)&&bn(e.content);if((W?W(e):e.nodeType)===bt){const t=O(e);fn(t)&&(Sn(t),bn(t))}}pn(qt.afterSanitizeShadowDOM,t,null)},Sn=function(t){const e=[{node:t,shadow:null}];for(;e.length>0;){const t=e.pop();if(t.shadow){bn(t.shadow);continue}const n=t.node,r=(W?W(n):n.nodeType)===bt,i=b(n);if(i)for(let t=i.length-1;t>=0;--t)e.push({node:i[t],shadow:null});if(r){const t=K?K(n):null;if("string"==typeof t&&"template"===Ke(t)){const t=n.content;fn(t)&&e.push({node:t,shadow:null})}}if(r){const t=O(n);fn(t)&&e.push({node:null,shadow:t},{node:t,shadow:null})}}};return n.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,s=null;if(Ne=!t,Ne&&(t="\\x3c!--\\x3e"),"string"!=typeof t&&!hn(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return C(t);case"boolean":return N(t);case"bigint":return R?R(t):"0";case"symbol":return L?L(t):"Symbol()";case"undefined":default:return B(t);case"function":case"object":{if(null===t)return B(t);const e=t,n=G(e,"toString");if("function"==typeof n){const t=n(e);return"string"==typeof t?t:B(t)}return B(t)}}}(t)))throw q("dirty is not a string, aborting");if(!n.isSupported)return t;de?(Qt=me,ee=ge):Xe(e),(qt.uponSanitizeElement.length>0||qt.uponSanitizeAttribute.length>0)&&(Qt=V(Qt)),qt.uponSanitizeAttribute.length>0&&(ee=V(ee)),n.removed=[];const u=Ee&&"string"!=typeof t&&hn(t);if(u){const e=K?K(t):t.nodeName;if("string"==typeof e){const t=Ke(e);if(!Qt[t]||ie[t])throw q("root node is forbidden and cannot be sanitized in-place")}if(ln(t))throw q("root node is clobbered and cannot be sanitized in-place");try{Sn(t)}catch(e){throw nn(t),e}}else if(hn(t))r=an("\\x3c!----\\x3e"),o=r.ownerDocument.importNode(t,!0),o.nodeType===bt&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o),Sn(o);else{if(!_e&&!fe&&!pe&&-1===t.indexOf("<"))return Ft&&we?zt(t):t;if(r=an(t),!r)return _e?null:we?Mt:""}r&&ye&&en(r.firstChild);const c=sn(u?t:r);try{for(;a=c.nextNode();)dn(a),wn(a),fn(a.content)&&bn(a.content)}catch(e){throw u&&nn(t),e}if(u)return I(n.removed,t=>{t.element&&function(t){const e=[t];for(;e.length>0;){const t=e.pop();(W?W(t):t.nodeType)===bt&&on(t);const n=b(t);if(n)for(let t=n.length-1;t>=0;--t)e.push(n[t])}}(t.element)}),fe&&cn(t),t;if(_e){if(fe&&cn(r),ve)for(s=Ut.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(ee.shadowroot||ee.shadowrootmode)&&(s=$t.call(i,s,!0)),s}let l=pe?r.outerHTML:r.innerHTML;return pe&&Qt["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&$(mt,r.ownerDocument.doctype.name)&&(l="<!DOCTYPE "+r.ownerDocument.doctype.name+">\\n"+l),fe&&(l=un(l)),Ft&&we?zt(l):l},n.setConfig=function(){Xe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),de=!0,me=Qt,ge=ee},n.clearConfig=function(){Ve=null,de=!1,me=null,ge=null,Ft=Pt,Mt=""},n.isValidAttribute=function(t,e,n){Ve||Xe({});const r=Ke(t),i=Ke(e);return mn(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&U(qt,t)&&A(qt[t],e)},n.removeHook=function(t,e){if(U(qt,t)){if(void 0!==e){const n=E(qt[t],e);return-1===n?void 0:D(qt[t],n,1)[0]}return x(qt[t])}},n.removeHooks=function(t){U(qt,t)&&(qt[t]=[])},n.removeAllHooks=function(){qt={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();Symbol.for("nutrient.web.trustedTypesPolicy");new Set(["background-color","color","font-family","font-size","font-style","font-weight","text-align","text-decoration"]),new Set(["auto","aqua","black","block","blue","bold","both","bottom","brown","center","collapse","dashed","dotted","fuchsia","gray","green","!important","initial","italic","left","lime","maroon","medium","middle","none","navy","normal","nowrap","olive","pointer","purple","red","right","solid","silver","teal","top","transparent","underline","white","yellow"]);const Pt=Symbol("Comlink.proxy"),Mt=Symbol("Comlink.endpoint"),Tt=Symbol("Comlink.releaseProxy"),kt=Symbol("Comlink.finalizer"),jt=Symbol("Comlink.thrown"),zt=t=>"object"==typeof t&&null!==t||"function"==typeof t,Ct={canHandle:t=>zt(t)&&t[Pt],serialize(t){const{port1:e,port2:n}=new MessageChannel;return Rt(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),Ht(t,n,[],e)}(t))},Nt=new Map([["proxy",Ct],["throw",{canHandle:t=>zt(t)&&jt in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function Rt(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin \'${i.origin}\' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),u=(i.data.argumentList||[]).map(Vt);let c;try{const e=s.slice(0,-1).reduce((t,e)=>t[e],t),n=s.reduce((t,e)=>t[e],t);switch(a){case"GET":c=n;break;case"SET":e[s.slice(-1)[0]]=Vt(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,u);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[Pt]:!0})}(new n(...u));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;Rt(t,n),c=function(t,e){return Jt.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[jt]:0}}Promise.resolve(c).catch(t=>({value:t,[jt]:0})).then(n=>{const[i,s]=Kt(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),Lt(e),kt in t&&"function"==typeof t[kt]&&t[kt]())}).catch(t=>{const[n,r]=Kt({value:new TypeError("Unserializable return value"),[jt]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function Lt(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function Ut(t){if(t)throw new Error("Proxy has been released and is not useable")}function Bt(t){return Gt(t,new Map,{type:"RELEASE"}).then(()=>{Lt(t)})}const $t=new WeakMap,qt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=($t.get(t)||0)-1;$t.set(t,e),0===e&&Bt(t)});function Ht(t,e,n=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,a){if(Ut(i),a===Tt)return()=>{!function(t){qt&&qt.unregister(t)}(o),Bt(t),e.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const r=Gt(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(Vt);return r.then.bind(r)}return Ht(t,e,[...n,a])},set(r,o,a){Ut(i);const[s,u]=Kt(a);return Gt(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:s},u).then(Vt)},apply(r,o,a){Ut(i);const s=n[n.length-1];if(s===Mt)return Gt(t,e,{type:"ENDPOINT"}).then(Vt);if("bind"===s)return Ht(t,e,n.slice(0,-1));const[u,c]=Wt(a);return Gt(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:u},c).then(Vt)},construct(r,o){Ut(i);const[a,s]=Wt(o);return Gt(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:a},s).then(Vt)}});return function(t,e){const n=($t.get(e)||0)+1;$t.set(e,n),qt&&qt.register(t,e,t)}(o,t),o}function Wt(t){const e=t.map(Kt);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const Jt=new WeakMap;function Kt(t){for(const[e,n]of Nt)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},Jt.get(t)||[]]}function Vt(t){switch(t.type){case"HANDLER":return Nt.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Gt(t,e,n,r){return new Promise(i=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}const Yt="function"==typeof Buffer,Xt=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),Zt=(t=>{let e={};return t.forEach((t,n)=>e[t]=n),e})(Xt),Qt=/^(?:[A-Za-z\\d+\\/]{4})*?(?:[A-Za-z\\d+\\/]{2}(?:==)?|[A-Za-z\\d+\\/]{3}=?)?$/,te=String.fromCharCode.bind(String),ee="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),ne=t=>t.replace(/[^A-Za-z0-9\\+\\/]/g,""),re=t=>{let e,n,r,i,o="";const a=t.length%3;for(let a=0;a<t.length;){if((n=t.charCodeAt(a++))>255||(r=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,o+=Xt[e>>18&63]+Xt[e>>12&63]+Xt[e>>6&63]+Xt[63&e]}return a?o.slice(0,a-3)+"===".substring(a):o},ie=t=>{if(t=t.replace(/\\s+/g,""),!Qt.test(t))throw new TypeError("malformed base64.");let e,n,r;t+="==".slice(2-(3&t.length));let i=[];for(let o=0;o<t.length;)e=Zt[t.charAt(o++)]<<18|Zt[t.charAt(o++)]<<12|(n=Zt[t.charAt(o++)])<<6|(r=Zt[t.charAt(o++)]),64===n?i.push(te(e>>16&255)):64===r?i.push(te(e>>16&255,e>>8&255)):i.push(te(e>>16&255,e>>8&255,255&e));return i.join("")},oe="function"==typeof atob?t=>atob(ne(t)):Yt?t=>Buffer.from(t,"base64").toString("binary"):ie,ae=Yt?t=>ee(Buffer.from(t,"base64")):t=>ee(oe(t).split("").map(t=>t.charCodeAt(0))),se=t=>ae(ue(t)),ue=t=>ne(t.replace(/[-_]/g,t=>"-"==t?"+":"/")),ce=se;function le(t){const e={unitFrom:t.scale.unitFrom,unitTo:t.scale.unitTo,from:Number(t.scale.fromValue),to:Number(t.scale.toValue)};return void 0!==t.scale.fromDescription&&(e.fromDescription=t.scale.fromDescription),void 0!==t.scale.toDescription&&(e.toDescription=t.scale.toDescription),{name:t.name,scale:e,precision:t.precision}}var fe=n(5920),he=n.n(fe),pe=n(1211),de=n.n(pe),me=n(989),ge=n.n(me);let ye;ye="object"==typeof process&&"object"==typeof process.versions&&void 0!==process.versions.node?ge():function(t){return"object"==typeof window?new Promise((e,n)=>{const r=document.createElement("script");r.type="text/javascript",r.async=!0,r.onload=()=>e(window.PSPDFModuleInit),r.onerror=n,r.src=t;const{documentElement:o}=document;i(o),o.appendChild(r)}):(self.importScripts(t),Promise.resolve(self.PSPDFModuleInit))};const _e=ye,ve="nutrient-viewer-lib/",we=`${ve}nutrient-viewer${"-"+de()}.wasm.js`,be=`${ve}nutrient-viewer${"-"+he()}.wasm`;function Se(t,e){let n,r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:globalThis;return new Promise(async(u,c)=>{try{n=function(t,e){let n;if("object"==typeof t){n=t.wasm;return{wasmBinaryFile:be,locateFile:t=>t,wasmBinary:n}}const r={wasmBinaryFile:t+be,locateFile:t=>t,wasmBinary:n};{const t=fetch(r.wasmBinaryFile,{credentials:"same-origin"}),n=12039235;t.then(t=>{const e=t.headers?.get("content-length");return e&&parseInt(e)>=n&&a("The WASM binary file is being served without compression. Due to its size, it\'s recommended to configure the server so application/wasm files are served with compression.\\n\\nFind more details in our Standalone performance guides: https://www.nutrient.io/guides/web/best-practices/caching-on-the-web/#gzip-and-brotli"),t}).catch(t=>{throw new Error(`Failed to load WASM binary file: ${t}`)}),r.instantiateWasm=(n,i)=>((async()=>{o(`Start ${r.wasmBinaryFile} download.`);const a=Date.now();let u,c;const l=!e&&"function"==typeof WebAssembly.instantiateStreaming;function f(){return t.then(t=>{if(!t.ok)throw new Error(`Error loading ${r.wasmBinaryFile}: ${t.statusText}`);return t.arrayBuffer()}).then(t=>(c=Date.now(),o(`Download complete, took: ${c-a}ms`),WebAssembly.instantiate(new Uint8Array(t),n)))}u=l?WebAssembly.instantiateStreaming(t,n).then(t=>(c=Date.now(),o(`Download and Instantiation complete, took: ${Date.now()-a}ms`),t)).catch(t=>{if(/mime.*type/i.test(t.message))return s(t.message),null;throw t}):f();let h=await u;null===h&&(s("Streaming instantiation failed! Falling back to classic instantiation. This might result in slower initialization time therefore we highly recommend to follow the troubleshooting instructions in our guides to fix this error: https://www.nutrient.io/guides/web/current/troubleshooting/common-issues/#response-has-unsupported-mime-type-error."),h=await f()),!l&&c&&o(`Compilation and Instantiation complete, took: ${Date.now()-c}ms`),i(h.instance,h.module)})(),{})}return r}(t,e),"string"==typeof t&&(r=await _e(`${t}${we}`)),o("Using WASM method"),function(t){t.PSPDFLoggingServices={error(t,e){s(`[${t}] ${e}`)},warn(t,e){a(`[${t}] ${e}`)},info(t,e){0},debug(t,e){0},trace(t,e){0}},t.PSPDFUnicodeServices={stripDiacritics(t){const e={Á:"A",Ă:"A",Ắ:"A",Ặ:"A",Ằ:"A",Ẳ:"A",Ẵ:"A",Ǎ:"A",Â:"A",Ấ:"A",Ậ:"A",Ầ:"A",Ẩ:"A",Ẫ:"A",Ä:"A",Ǟ:"A",Ȧ:"A",Ǡ:"A",Ạ:"A",Ȁ:"A",À:"A",Ả:"A",Ȃ:"A",Ā:"A",Ą:"A",Å:"A",Ǻ:"A",Ḁ:"A",Ⱥ:"A",Ã:"A",Ꜳ:"AA",Æ:"AE",Ǽ:"AE",Ǣ:"AE",Ꜵ:"AO",Ꜷ:"AU",Ꜹ:"AV",Ꜻ:"AV",Ꜽ:"AY",Ḃ:"B",Ḅ:"B",Ɓ:"B",Ḇ:"B",Ƀ:"B",Ƃ:"B",Ć:"C",Č:"C",Ç:"C",Ḉ:"C",Ĉ:"C",Ċ:"C",Ƈ:"C",Ȼ:"C",Ď:"D",Ḑ:"D",Ḓ:"D",Ḋ:"D",Ḍ:"D",Ɗ:"D",Ḏ:"D",Dz:"D",Dž:"D",Đ:"D",Ƌ:"D",DZ:"DZ",DŽ:"DZ",É:"E",Ĕ:"E",Ě:"E",Ȩ:"E",Ḝ:"E",Ê:"E",Ế:"E",Ệ:"E",Ề:"E",Ể:"E",Ễ:"E",Ḙ:"E",Ë:"E",Ė:"E",Ẹ:"E",Ȅ:"E",È:"E",Ẻ:"E",Ȇ:"E",Ē:"E",Ḗ:"E",Ḕ:"E",Ę:"E",Ɇ:"E",Ẽ:"E",Ḛ:"E",Ꝫ:"ET",Ḟ:"F",Ƒ:"F",Ǵ:"G",Ğ:"G",Ǧ:"G",Ģ:"G",Ĝ:"G",Ġ:"G",Ɠ:"G",Ḡ:"G",Ǥ:"G",Ḫ:"H",Ȟ:"H",Ḩ:"H",Ĥ:"H",Ⱨ:"H",Ḧ:"H",Ḣ:"H",Ḥ:"H",Ħ:"H",Í:"I",Ĭ:"I",Ǐ:"I",Î:"I",Ï:"I",Ḯ:"I",İ:"I",Ị:"I",Ȉ:"I",Ì:"I",Ỉ:"I",Ȋ:"I",Ī:"I",Į:"I",Ɨ:"I",Ĩ:"I",Ḭ:"I",Ꝺ:"D",Ꝼ:"F",Ᵹ:"G",Ꞃ:"R",Ꞅ:"S",Ꞇ:"T",Ꝭ:"IS",Ĵ:"J",Ɉ:"J",Ḱ:"K",Ǩ:"K",Ķ:"K",Ⱪ:"K",Ꝃ:"K",Ḳ:"K",Ƙ:"K",Ḵ:"K",Ꝁ:"K",Ꝅ:"K",Ĺ:"L",Ƚ:"L",Ľ:"L",Ļ:"L",Ḽ:"L",Ḷ:"L",Ḹ:"L",Ⱡ:"L",Ꝉ:"L",Ḻ:"L",Ŀ:"L",Ɫ:"L",Lj:"L",Ł:"L",LJ:"LJ",Ḿ:"M",Ṁ:"M",Ṃ:"M",Ɱ:"M",Ń:"N",Ň:"N",Ņ:"N",Ṋ:"N",Ṅ:"N",Ṇ:"N",Ǹ:"N",Ɲ:"N",Ṉ:"N",Ƞ:"N",Nj:"N",Ñ:"N",NJ:"NJ",Ó:"O",Ŏ:"O",Ǒ:"O",Ô:"O",Ố:"O",Ộ:"O",Ồ:"O",Ổ:"O",Ỗ:"O",Ö:"O",Ȫ:"O",Ȯ:"O",Ȱ:"O",Ọ:"O",Ő:"O",Ȍ:"O",Ò:"O",Ỏ:"O",Ơ:"O",Ớ:"O",Ợ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ȏ:"O",Ꝋ:"O",Ꝍ:"O",Ō:"O",Ṓ:"O",Ṑ:"O",Ɵ:"O",Ǫ:"O",Ǭ:"O",Ø:"O",Ǿ:"O",Õ:"O",Ṍ:"O",Ṏ:"O",Ȭ:"O",Ƣ:"OI",Ꝏ:"OO",Ɛ:"E",Ɔ:"O",Ȣ:"OU",Ṕ:"P",Ṗ:"P",Ꝓ:"P",Ƥ:"P",Ꝕ:"P",Ᵽ:"P",Ꝑ:"P",Ꝙ:"Q",Ꝗ:"Q",Ŕ:"R",Ř:"R",Ŗ:"R",Ṙ:"R",Ṛ:"R",Ṝ:"R",Ȑ:"R",Ȓ:"R",Ṟ:"R",Ɍ:"R",Ɽ:"R",Ꜿ:"C",Ǝ:"E",Ś:"S",Ṥ:"S",Š:"S",Ṧ:"S",Ş:"S",Ŝ:"S",Ș:"S",Ṡ:"S",Ṣ:"S",Ṩ:"S",Ť:"T",Ţ:"T",Ṱ:"T",Ț:"T",Ⱦ:"T",Ṫ:"T",Ṭ:"T",Ƭ:"T",Ṯ:"T",Ʈ:"T",Ŧ:"T",Ɐ:"A",Ꞁ:"L",Ɯ:"M",Ʌ:"V",Ꜩ:"TZ",Ú:"U",Ŭ:"U",Ǔ:"U",Û:"U",Ṷ:"U",Ü:"U",Ǘ:"U",Ǚ:"U",Ǜ:"U",Ǖ:"U",Ṳ:"U",Ụ:"U",Ű:"U",Ȕ:"U",Ù:"U",Ủ:"U",Ư:"U",Ứ:"U",Ự:"U",Ừ:"U",Ử:"U",Ữ:"U",Ȗ:"U",Ū:"U",Ṻ:"U",Ų:"U",Ů:"U",Ũ:"U",Ṹ:"U",Ṵ:"U",Ꝟ:"V",Ṿ:"V",Ʋ:"V",Ṽ:"V",Ꝡ:"VY",Ẃ:"W",Ŵ:"W",Ẅ:"W",Ẇ:"W",Ẉ:"W",Ẁ:"W",Ⱳ:"W",Ẍ:"X",Ẋ:"X",Ý:"Y",Ŷ:"Y",Ÿ:"Y",Ẏ:"Y",Ỵ:"Y",Ỳ:"Y",Ƴ:"Y",Ỷ:"Y",Ỿ:"Y",Ȳ:"Y",Ɏ:"Y",Ỹ:"Y",Ź:"Z",Ž:"Z",Ẑ:"Z",Ⱬ:"Z",Ż:"Z",Ẓ:"Z",Ȥ:"Z",Ẕ:"Z",Ƶ:"Z",IJ:"IJ",Œ:"OE",ᴀ:"A",ᴁ:"AE",ʙ:"B",ᴃ:"B",ᴄ:"C",ᴅ:"D",ᴇ:"E",ꜰ:"F",ɢ:"G",ʛ:"G",ʜ:"H",ɪ:"I",ʁ:"R",ᴊ:"J",ᴋ:"K",ʟ:"L",ᴌ:"L",ᴍ:"M",ɴ:"N",ᴏ:"O",ɶ:"OE",ᴐ:"O",ᴕ:"OU",ᴘ:"P",ʀ:"R",ᴎ:"N",ᴙ:"R",ꜱ:"S",ᴛ:"T",ⱻ:"E",ᴚ:"R",ᴜ:"U",ᴠ:"V",ᴡ:"W",ʏ:"Y",ᴢ:"Z",á:"a",ă:"a",ắ:"a",ặ:"a",ằ:"a",ẳ:"a",ẵ:"a",ǎ:"a",â:"a",ấ:"a",ậ:"a",ầ:"a",ẩ:"a",ẫ:"a",ä:"a",ǟ:"a",ȧ:"a",ǡ:"a",ạ:"a",ȁ:"a",à:"a",ả:"a",ȃ:"a",ā:"a",ą:"a",ᶏ:"a",ẚ:"a",å:"a",ǻ:"a",ḁ:"a",ⱥ:"a",ã:"a",ꜳ:"aa",æ:"ae",ǽ:"ae",ǣ:"ae",ꜵ:"ao",ꜷ:"au",ꜹ:"av",ꜻ:"av",ꜽ:"ay",ḃ:"b",ḅ:"b",ɓ:"b",ḇ:"b",ᵬ:"b",ᶀ:"b",ƀ:"b",ƃ:"b",ɵ:"o",ć:"c",č:"c",ç:"c",ḉ:"c",ĉ:"c",ɕ:"c",ċ:"c",ƈ:"c",ȼ:"c",ď:"d",ḑ:"d",ḓ:"d",ȡ:"d",ḋ:"d",ḍ:"d",ɗ:"d",ᶑ:"d",ḏ:"d",ᵭ:"d",ᶁ:"d",đ:"d",ɖ:"d",ƌ:"d",ı:"i",ȷ:"j",ɟ:"j",ʄ:"j",dz:"dz",dž:"dz",é:"e",ĕ:"e",ě:"e",ȩ:"e",ḝ:"e",ê:"e",ế:"e",ệ:"e",ề:"e",ể:"e",ễ:"e",ḙ:"e",ë:"e",ė:"e",ẹ:"e",ȅ:"e",è:"e",ẻ:"e",ȇ:"e",ē:"e",ḗ:"e",ḕ:"e",ⱸ:"e",ę:"e",ᶒ:"e",ɇ:"e",ẽ:"e",ḛ:"e",ꝫ:"et",ḟ:"f",ƒ:"f",ᵮ:"f",ᶂ:"f",ǵ:"g",ğ:"g",ǧ:"g",ģ:"g",ĝ:"g",ġ:"g",ɠ:"g",ḡ:"g",ᶃ:"g",ǥ:"g",ḫ:"h",ȟ:"h",ḩ:"h",ĥ:"h",ⱨ:"h",ḧ:"h",ḣ:"h",ḥ:"h",ɦ:"h",ẖ:"h",ħ:"h",ƕ:"hv",í:"i",ĭ:"i",ǐ:"i",î:"i",ï:"i",ḯ:"i",ị:"i",ȉ:"i",ì:"i",ỉ:"i",ȋ:"i",ī:"i",į:"i",ᶖ:"i",ɨ:"i",ĩ:"i",ḭ:"i",ꝺ:"d",ꝼ:"f",ᵹ:"g",ꞃ:"r",ꞅ:"s",ꞇ:"t",ꝭ:"is",ǰ:"j",ĵ:"j",ʝ:"j",ɉ:"j",ḱ:"k",ǩ:"k",ķ:"k",ⱪ:"k",ꝃ:"k",ḳ:"k",ƙ:"k",ḵ:"k",ᶄ:"k",ꝁ:"k",ꝅ:"k",ĺ:"l",ƚ:"l",ɬ:"l",ľ:"l",ļ:"l",ḽ:"l",ȴ:"l",ḷ:"l",ḹ:"l",ⱡ:"l",ꝉ:"l",ḻ:"l",ŀ:"l",ɫ:"l",ᶅ:"l",ɭ:"l",ł:"l",lj:"lj",ſ:"s",ẜ:"s",ẛ:"s",ẝ:"s",ḿ:"m",ṁ:"m",ṃ:"m",ɱ:"m",ᵯ:"m",ᶆ:"m",ń:"n",ň:"n",ņ:"n",ṋ:"n",ȵ:"n",ṅ:"n",ṇ:"n",ǹ:"n",ɲ:"n",ṉ:"n",ƞ:"n",ᵰ:"n",ᶇ:"n",ɳ:"n",ñ:"n",nj:"nj",ó:"o",ŏ:"o",ǒ:"o",ô:"o",ố:"o",ộ:"o",ồ:"o",ổ:"o",ỗ:"o",ö:"o",ȫ:"o",ȯ:"o",ȱ:"o",ọ:"o",ő:"o",ȍ:"o",ò:"o",ỏ:"o",ơ:"o",ớ:"o",ợ:"o",ờ:"o",ở:"o",ỡ:"o",ȏ:"o",ꝋ:"o",ꝍ:"o",ⱺ:"o",ō:"o",ṓ:"o",ṑ:"o",ǫ:"o",ǭ:"o",ø:"o",ǿ:"o",õ:"o",ṍ:"o",ṏ:"o",ȭ:"o",ƣ:"oi",ꝏ:"oo",ɛ:"e",ᶓ:"e",ɔ:"o",ᶗ:"o",ȣ:"ou",ṕ:"p",ṗ:"p",ꝓ:"p",ƥ:"p",ᵱ:"p",ᶈ:"p",ꝕ:"p",ᵽ:"p",ꝑ:"p",ꝙ:"q",ʠ:"q",ɋ:"q",ꝗ:"q",ŕ:"r",ř:"r",ŗ:"r",ṙ:"r",ṛ:"r",ṝ:"r",ȑ:"r",ɾ:"r",ᵳ:"r",ȓ:"r",ṟ:"r",ɼ:"r",ᵲ:"r",ᶉ:"r",ɍ:"r",ɽ:"r",ↄ:"c",ꜿ:"c",ɘ:"e",ɿ:"r",ś:"s",ṥ:"s",š:"s",ṧ:"s",ş:"s",ŝ:"s",ș:"s",ṡ:"s",ṣ:"s",ṩ:"s",ʂ:"s",ᵴ:"s",ᶊ:"s",ȿ:"s",ɡ:"g",ᴑ:"o",ᴓ:"o",ᴝ:"u",ť:"t",ţ:"t",ṱ:"t",ț:"t",ȶ:"t",ẗ:"t",ⱦ:"t",ṫ:"t",ṭ:"t",ƭ:"t",ṯ:"t",ᵵ:"t",ƫ:"t",ʈ:"t",ŧ:"t",ᵺ:"th",ɐ:"a",ᴂ:"ae",ǝ:"e",ᵷ:"g",ɥ:"h",ʮ:"h",ʯ:"h",ᴉ:"i",ʞ:"k",ꞁ:"l",ɯ:"m",ɰ:"m",ᴔ:"oe",ɹ:"r",ɻ:"r",ɺ:"r",ⱹ:"r",ʇ:"t",ʌ:"v",ʍ:"w",ʎ:"y",ꜩ:"tz",ú:"u",ŭ:"u",ǔ:"u",û:"u",ṷ:"u",ü:"u",ǘ:"u",ǚ:"u",ǜ:"u",ǖ:"u",ṳ:"u",ụ:"u",ű:"u",ȕ:"u",ù:"u",ủ:"u",ư:"u",ứ:"u",ự:"u",ừ:"u",ử:"u",ữ:"u",ȗ:"u",ū:"u",ṻ:"u",ų:"u",ᶙ:"u",ů:"u",ũ:"u",ṹ:"u",ṵ:"u",ᵫ:"ue",ꝸ:"um",ⱴ:"v",ꝟ:"v",ṿ:"v",ʋ:"v",ᶌ:"v",ⱱ:"v",ṽ:"v",ꝡ:"vy",ẃ:"w",ŵ:"w",ẅ:"w",ẇ:"w",ẉ:"w",ẁ:"w",ⱳ:"w",ẘ:"w",ẍ:"x",ẋ:"x",ᶍ:"x",ý:"y",ŷ:"y",ÿ:"y",ẏ:"y",ỵ:"y",ỳ:"y",ƴ:"y",ỷ:"y",ỿ:"y",ȳ:"y",ẙ:"y",ɏ:"y",ỹ:"y",ź:"z",ž:"z",ẑ:"z",ʑ:"z",ⱬ:"z",ż:"z",ẓ:"z",ȥ:"z",ẕ:"z",ᵶ:"z",ᶎ:"z",ʐ:"z",ƶ:"z",ɀ:"z",ff:"ff",ffi:"ffi",ffl:"ffl",fi:"fi",fl:"fl",ij:"ij",œ:"oe",st:"st",ₐ:"a",ₑ:"e",ᵢ:"i",ⱼ:"j",ₒ:"o",ᵣ:"r",ᵤ:"u",ᵥ:"v",ₓ:"x"};if(!t.normalize)return t;const n=t.replace(/[^A-Za-z0-9[\\] ]/g,function(t){return e[t]||t});return t.normalize("NFC").length==n.normalize("NFC").length?n:""},escapeRegExp:t=>t.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&"),match(t,e,n){const r=new RegExp(e,n?"g":"gi"),i=[];let o=r.exec(t);for(;null!=o;)i.push([o.index,o[0].length]),o=r.exec(t);return i},exec:(t,e)=>new RegExp(t).exec(e)}}(i);u({nativeModule:await r(n)})}catch(t){c(t)}})}function Oe(t){if("arrayBuffer"in t)return t.arrayBuffer().then(t=>new Uint8Array(t));const e=new FileReader;return new Promise((n,r)=>{e.onerror=t=>{r(new Error(t))},e.onload=t=>{n(new Uint8Array(t.target?.result))},e.readAsArrayBuffer(t)})}const Ie="Maui_Android",Ee="Maui_iOS",xe="Maui_MacCatalyst",Ae="Maui_Windows",De="FlutterForWeb",Fe="Electron",Pe="unableToShape",Me="requiresMoreFonts",Te="text",ke="documentA",je="documentB",ze="result",Ce=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const Ne=function(t){return"string"==typeof t&&Ce.test(t)};const Re=function(t){if(!Ne(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,255&e,(e=parseInt(t.slice(9,13),16))>>>8,255&e,(e=parseInt(t.slice(14,18),16))>>>8,255&e,(e=parseInt(t.slice(19,23),16))>>>8,255&e,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,255&e)};const Le=[];for(let t=0;t<256;++t)Le.push((t+256).toString(16).slice(1));function Ue(t,e=0){return(Le[t[e+0]]+Le[t[e+1]]+Le[t[e+2]]+Le[t[e+3]]+"-"+Le[t[e+4]]+Le[t[e+5]]+"-"+Le[t[e+6]]+Le[t[e+7]]+"-"+Le[t[e+8]]+Le[t[e+9]]+"-"+Le[t[e+10]]+Le[t[e+11]]+Le[t[e+12]]+Le[t[e+13]]+Le[t[e+14]]+Le[t[e+15]]).toLowerCase()}let Be;const $e=new Uint8Array(16);function qe(t){return 14+(t+64>>>9<<4)+1}function He(t,e){const n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function We(t,e,n,r,i,o){return He((a=He(He(e,t),He(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function Je(t,e,n,r,i,o,a){return We(e&n|~e&r,t,e,i,o,a)}function Ke(t,e,n,r,i,o,a){return We(e&r|n&~r,t,e,i,o,a)}function Ve(t,e,n,r,i,o,a){return We(e^n^r,t,e,i,o,a)}function Ge(t,e,n,r,i,o,a){return We(n^(e|~r),t,e,i,o,a)}const Ye=function(t){return function(t){const e=new Uint8Array(4*t.length);for(let n=0;n<4*t.length;n++)e[n]=t[n>>2]>>>n%4*8&255;return e}(function(t,e){const n=new Uint32Array(qe(e)).fill(0);n.set(t),n[e>>5]|=128<<e%32,n[n.length-1]=e,t=n;let r=1732584193,i=-271733879,o=-1732584194,a=271733878;for(let e=0;e<t.length;e+=16){const n=r,s=i,u=o,c=a;r=Je(r,i,o,a,t[e],7,-680876936),a=Je(a,r,i,o,t[e+1],12,-389564586),o=Je(o,a,r,i,t[e+2],17,606105819),i=Je(i,o,a,r,t[e+3],22,-1044525330),r=Je(r,i,o,a,t[e+4],7,-176418897),a=Je(a,r,i,o,t[e+5],12,1200080426),o=Je(o,a,r,i,t[e+6],17,-1473231341),i=Je(i,o,a,r,t[e+7],22,-45705983),r=Je(r,i,o,a,t[e+8],7,1770035416),a=Je(a,r,i,o,t[e+9],12,-1958414417),o=Je(o,a,r,i,t[e+10],17,-42063),i=Je(i,o,a,r,t[e+11],22,-1990404162),r=Je(r,i,o,a,t[e+12],7,1804603682),a=Je(a,r,i,o,t[e+13],12,-40341101),o=Je(o,a,r,i,t[e+14],17,-1502002290),i=Je(i,o,a,r,t[e+15],22,1236535329),r=Ke(r,i,o,a,t[e+1],5,-165796510),a=Ke(a,r,i,o,t[e+6],9,-1069501632),o=Ke(o,a,r,i,t[e+11],14,643717713),i=Ke(i,o,a,r,t[e],20,-373897302),r=Ke(r,i,o,a,t[e+5],5,-701558691),a=Ke(a,r,i,o,t[e+10],9,38016083),o=Ke(o,a,r,i,t[e+15],14,-660478335),i=Ke(i,o,a,r,t[e+4],20,-405537848),r=Ke(r,i,o,a,t[e+9],5,568446438),a=Ke(a,r,i,o,t[e+14],9,-1019803690),o=Ke(o,a,r,i,t[e+3],14,-187363961),i=Ke(i,o,a,r,t[e+8],20,1163531501),r=Ke(r,i,o,a,t[e+13],5,-1444681467),a=Ke(a,r,i,o,t[e+2],9,-51403784),o=Ke(o,a,r,i,t[e+7],14,1735328473),i=Ke(i,o,a,r,t[e+12],20,-1926607734),r=Ve(r,i,o,a,t[e+5],4,-378558),a=Ve(a,r,i,o,t[e+8],11,-2022574463),o=Ve(o,a,r,i,t[e+11],16,1839030562),i=Ve(i,o,a,r,t[e+14],23,-35309556),r=Ve(r,i,o,a,t[e+1],4,-1530992060),a=Ve(a,r,i,o,t[e+4],11,1272893353),o=Ve(o,a,r,i,t[e+7],16,-155497632),i=Ve(i,o,a,r,t[e+10],23,-1094730640),r=Ve(r,i,o,a,t[e+13],4,681279174),a=Ve(a,r,i,o,t[e],11,-358537222),o=Ve(o,a,r,i,t[e+3],16,-722521979),i=Ve(i,o,a,r,t[e+6],23,76029189),r=Ve(r,i,o,a,t[e+9],4,-640364487),a=Ve(a,r,i,o,t[e+12],11,-421815835),o=Ve(o,a,r,i,t[e+15],16,530742520),i=Ve(i,o,a,r,t[e+2],23,-995338651),r=Ge(r,i,o,a,t[e],6,-198630844),a=Ge(a,r,i,o,t[e+7],10,1126891415),o=Ge(o,a,r,i,t[e+14],15,-1416354905),i=Ge(i,o,a,r,t[e+5],21,-57434055),r=Ge(r,i,o,a,t[e+12],6,1700485571),a=Ge(a,r,i,o,t[e+3],10,-1894986606),o=Ge(o,a,r,i,t[e+10],15,-1051523),i=Ge(i,o,a,r,t[e+1],21,-2054922799),r=Ge(r,i,o,a,t[e+8],6,1873313359),a=Ge(a,r,i,o,t[e+15],10,-30611744),o=Ge(o,a,r,i,t[e+6],15,-1560198380),i=Ge(i,o,a,r,t[e+13],21,1309151649),r=Ge(r,i,o,a,t[e+4],6,-145523070),a=Ge(a,r,i,o,t[e+11],10,-1120210379),o=Ge(o,a,r,i,t[e+2],15,718787259),i=Ge(i,o,a,r,t[e+9],21,-343485551),r=He(r,n),i=He(i,s),o=He(o,u),a=He(a,c)}return Uint32Array.of(r,i,o,a)}(function(t){if(0===t.length)return new Uint32Array;const e=new Uint32Array(qe(8*t.length)).fill(0);for(let n=0;n<t.length;n++)e[n>>2]|=(255&t[n])<<n%4*8;return e}(t),8*t.length))};const Xe="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Ze="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Qe(t,e,n,r,i,o){const a="string"==typeof n?function(t){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n);return e}(n):n,s="string"==typeof r?Re(r):r;if("string"==typeof r&&(r=Re(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(s),u.set(a,s.length),u=e(u),u[6]=15&u[6]|t,u[8]=63&u[8]|128,i){if((o=o||0)<0||o+16>i.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let t=0;t<16;++t)i[o+t]=u[t];return i}return Ue(u)}function tn(t,e,n,r){return Qe(48,Ye,t,e,n,r)}tn.DNS=Xe,tn.URL=Ze;const en={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const nn=function(t,e,n){if(en.randomUUID&&!e&&!t)return en.randomUUID();const r=(t=t||{}).random??t.rng?.()??function(){if(!Be){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Be=crypto.getRandomValues.bind(crypto)}return Be($e)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Ue(r)};function rn(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function on(t,e){return t<<e|t>>>32-e}const an=function(t){const e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(t.length+1);r.set(t),r[t.length]=128;const i=(t=r).length/4+2,o=Math.ceil(i/16),a=new Array(o);for(let e=0;e<o;++e){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=t[64*e+4*r]<<24|t[64*e+4*r+1]<<16|t[64*e+4*r+2]<<8|t[64*e+4*r+3];a[e]=n}a[o-1][14]=8*(t.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(t.length-1)&4294967295;for(let t=0;t<o;++t){const r=new Uint32Array(80);for(let e=0;e<16;++e)r[e]=a[t][e];for(let t=16;t<80;++t)r[t]=on(r[t-3]^r[t-8]^r[t-14]^r[t-16],1);let i=n[0],o=n[1],s=n[2],u=n[3],c=n[4];for(let t=0;t<80;++t){const n=Math.floor(t/20),a=on(i,5)+rn(n,o,s,u)+c+e[n]+r[t]>>>0;c=u,u=s,s=on(o,30)>>>0,o=i,i=a}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+u>>>0,n[4]=n[4]+c>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])};function sn(t,e,n,r){return Qe(80,an,t,e,n,r)}sn.DNS=Xe,sn.URL=Ze;const un="cms";async function cn(t){try{const e=await fetch(t).catch(e=>{throw new r(`Error fetching dynamic fonts file ${t}. ${e}`)});if(200!==e.status)throw new r(`Error fetching dynamic fonts file ${t}. Status code: ${e.status}`);return e}catch(t){throw t}}const ln=[42,134,72,134,247,13,1,7,2];function fn(t,e){if(e>=t.length)return null;const n=t[e];if(!(128&n))return{length:n,nextOffset:e+1};const r=127&n;if(0===r||r>4||e+1+r>t.length)return null;let i=0;for(let n=0;n<r;n++)if(i=256*i+t[e+1+n],!Number.isSafeInteger(i))return null;return{length:i,nextOffset:e+1+r}}function hn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent??"";return t.indexOf("Trident/")>-1?"trident":t.indexOf("Edge/")>-1?"edge":t.indexOf("Chrome/")>-1?"blink":t.indexOf("AppleWebKit/")>-1?"webkit":t.indexOf("Gecko/")>-1?"gecko":"unknown"}function pn(t,e){const n=new RegExp(` ${e}/(\\\\d+)\\\\.*`);let r;return(r=t.match(n))?Number(r[1]):0}function dn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent??"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis.navigator?.platform??"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:globalThis.navigator?.maxTouchPoints??0;return e.indexOf("MacIntel")>-1&&n>1?"ios":t.indexOf("Win")>-1?"windows":t.indexOf("iPhone")>-1||t.indexOf("iPad")>-1||"iPad"===e?"ios":t.indexOf("Mac")>-1?"macos":t.indexOf("Android")>-1?"android":t.indexOf("CrOS")>-1||t.indexOf("Linux")>-1?"linux":"unknown"}hn();const mn=dn(),gn=(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis.navigator?.userAgent;switch(hn(t)){case"trident":return pn(t,"Trident");case"edge":return pn(t,"Edge");case"blink":return pn(t,"Chrome");case"webkit":return pn(t,"Version");case"gecko":return pn(t,"Firefox");default:;}}(),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dn(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hn();"ios"===t||"android"===t||yn(e)}(),"ios"===mn||yn(),"ios"===mn);function yn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hn();return("undefined"==typeof window||!window.PSPDFKIT_PLAYWRIGHT_TEST)&&("webkit"===t&&"undefined"!=typeof TouchEvent)}let _n;"undefined"!=typeof window&&(window.addEventListener("mousemove",function t(){_n=!1,window.removeEventListener("mousemove",t)}),window.addEventListener("pointermove",function t(e){"mouse"!==e.pointerType&&"pen"!==e.pointerType||(_n=!1),window.removeEventListener("pointermove",t)}));/Mac/i.test(globalThis.navigator?.platform);function vn(){return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron/")>=0}const wn="/create.pdf";function bn(){if(Boolean(!1)){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];console.debug("[OPFS]",...e)}}class Sn{constructor(t){l(this,"_readCount",0),l(this,"_wasmModule",null),this._storage=t}read(t,e){try{const n=this._storage.read(e,t);if(this._readCount+=1,n.length!==t)return bn("OPFSDataProvider.read: short read from storage",{offset:e,requested:t,actual:n.length,readCount:this._readCount,uid:this._storage.getUid()}),{error:!0,data:null};if(!this._wasmModule)throw new Error("OPFSDataProvider.read: wasm module not set");const r=this._wasmModule.allocateMemory(n.byteLength);return r.view.set(n),{error:!1,data:r}}catch(n){return bn("OPFSDataProvider.read: failed",{offset:e,size:t,uid:this._storage.getUid(),error:n instanceof Error?n.message:String(n)}),{error:!0,data:null}}}getSize(){return this._storage.getSize()}getUid(){return this._storage.getUid()}createEmbindProvider(t){return this._wasmModule=t,t.WASMDataProvider.implement({read:(t,e)=>this.read(t,e),getSize:()=>this.getSize(),getUid:()=>this.getUid()})}}const On="Shared push-button page occurrences are read-only in Standalone.";new WeakSet;var In="@@__IMMUTABLE_INDEXED__@@";function En(t){return Boolean(t&&t[In])}var xn="@@__IMMUTABLE_KEYED__@@";function An(t){return Boolean(t&&t[xn])}function Dn(t){return An(t)||En(t)}var Fn="@@__IMMUTABLE_ITERABLE__@@";function Pn(t){return Boolean(t&&t[Fn])}var Mn=function(t){return Pn(t)?t:dr(t)},Tn=function(t){function e(t){return An(t)?t:mr(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mn),kn=function(t){function e(t){return En(t)?t:gr(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mn),jn=function(t){function e(t){return Pn(t)&&!Dn(t)?t:yr(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mn);Mn.Keyed=Tn,Mn.Indexed=kn,Mn.Set=jn;var zn="function"==typeof Symbol&&Symbol.iterator,Cn="@@iterator",Nn=zn||Cn,Rn=function(t){this.next=t};function Ln(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function Un(){return{value:void 0,done:!0}}function Bn(t){return!!Array.isArray(t)||!!Hn(t)}function $n(t){return!(!t||"function"!=typeof t.next)}function qn(t){var e=Hn(t);return e&&e.call(t)}function Hn(t){var e=t&&(zn&&t[zn]||t[Cn]);if("function"==typeof e)return e}Rn.prototype.toString=function(){return"[Iterator]"},Rn.KEYS=0,Rn.VALUES=1,Rn.ENTRIES=2,Rn.prototype.inspect=Rn.prototype.toSource=function(){return this.toString()},Rn.prototype[Nn]=function(){return this};var Wn="delete",Jn=32,Kn=31,Vn={};function Gn(t){t&&(t.value=!0)}function Yn(){}function Xn(t){return void 0===t.size&&(t.size=t.__iterate(Qn)),t.size}function Zn(t,e){if("number"!=typeof e){var n=e>>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?Xn(t)+e:e}function Qn(){return!0}function tr(t,e,n){return(0===t&&!ir(t)||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function er(t,e){return rr(t,e,0)}function nr(t,e){return rr(t,e,e)}function rr(t,e,n){return void 0===t?n:ir(t)?e===1/0?e:0|Math.max(0,e+t):void 0===e||e===t?t:0|Math.min(e,t)}function ir(t){return t<0||0===t&&1/t==-1/0}var or="@@__IMMUTABLE_RECORD__@@";function ar(t){return Boolean(t&&t[or])}function sr(t){return Pn(t)||ar(t)}var ur="@@__IMMUTABLE_ORDERED__@@";function cr(t){return Boolean(t&&t[ur])}var lr="@@__IMMUTABLE_SEQ__@@";function fr(t){return Boolean(t&&t[lr])}var hr=Object.prototype.hasOwnProperty;function pr(t){return!(!Array.isArray(t)&&"string"!=typeof t)||t&&"object"==typeof t&&Number.isInteger(t.length)&&t.length>=0&&(0===t.length?1===Object.keys(t).length:t.hasOwnProperty(t.length-1))}var dr=function(t){function e(t){return null==t?Sr():sr(t)?t.toSeq():function(t){var e=Er(t);if(e)return(r=Hn(n=t))&&r===n.entries?e.fromEntrySeq():function(t){var e=Hn(t);return e&&e===t.keys}(t)?e.toSetSeq():e;var n,r;if("object"==typeof t)return new vr(t);throw new TypeError("Expected Array or collection object of values, or keyed object: "+t)}(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(t,e){var n=this._cache;if(n){for(var r=n.length,i=0;i!==r;){var o=n[e?r-++i:i++];if(!1===t(o[1],o[0],this))break}return i}return this.__iterateUncached(t,e)},e.prototype.__iterator=function(t,e){var n=this._cache;if(n){var r=n.length,i=0;return new Rn(function(){if(i===r)return{value:void 0,done:!0};var o=n[e?r-++i:i++];return Ln(t,o[0],o[1])})}return this.__iteratorUncached(t,e)},e}(Mn),mr=function(t){function e(t){return null==t?Sr().toKeyedSeq():Pn(t)?An(t)?t.toSeq():t.fromEntrySeq():ar(t)?t.toSeq():Or(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(dr),gr=function(t){function e(t){return null==t?Sr():Pn(t)?An(t)?t.entrySeq():t.toIndexedSeq():ar(t)?t.toSeq().entrySeq():Ir(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(dr),yr=function(t){function e(t){return(Pn(t)&&!Dn(t)?t:gr(t)).toSetSeq()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(dr);dr.isSeq=fr,dr.Keyed=mr,dr.Set=yr,dr.Indexed=gr,dr.prototype[lr]=!0;var _r=function(t){function e(t){this._array=t,this.size=t.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return this.has(t)?this._array[Zn(this,t)]:e},e.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length,i=0;i!==r;){var o=e?r-++i:i++;if(!1===t(n[o],o,this))break}return i},e.prototype.__iterator=function(t,e){var n=this._array,r=n.length,i=0;return new Rn(function(){if(i===r)return{value:void 0,done:!0};var o=e?r-++i:i++;return Ln(t,o,n[o])})},e}(gr),vr=function(t){function e(t){var e=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=e,this.size=e.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},e.prototype.has=function(t){return hr.call(this._object,t)},e.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,i=r.length,o=0;o!==i;){var a=r[e?i-++o:o++];if(!1===t(n[a],a,this))break}return o},e.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length,o=0;return new Rn(function(){if(o===i)return{value:void 0,done:!0};var a=r[e?i-++o:o++];return Ln(t,a,n[a])})},e}(mr);vr.prototype[ur]=!0;var wr,br=function(t){function e(t){this._collection=t,this.size=t.length||t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=qn(this._collection),r=0;if($n(n))for(var i;!(i=n.next()).done&&!1!==t(i.value,r++,this););return r},e.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=qn(this._collection);if(!$n(n))return new Rn(Un);var r=0;return new Rn(function(){var e=n.next();return e.done?e:Ln(t,r++,e.value)})},e}(gr);function Sr(){return wr||(wr=new _r([]))}function Or(t){var e=Er(t);if(e)return e.fromEntrySeq();if("object"==typeof t)return new vr(t);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+t)}function Ir(t){var e=Er(t);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+t)}function Er(t){return pr(t)?new _r(t):Bn(t)?new br(t):void 0}function xr(){return this.__ensureOwner()}function Ar(){return this.__ownerID?this:this.__ensureOwner(new Yn)}var Dr="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var n=65535&(t|=0),r=65535&(e|=0);return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0};function Fr(t){return t>>>1&1073741824|3221225471&t}var Pr=Object.prototype.valueOf;function Mr(t){if(null==t)return Tr(t);if("function"==typeof t.hashCode)return Fr(t.hashCode(t));var e,n=(e=t).valueOf!==Pr&&"function"==typeof e.valueOf?e.valueOf(e):e;if(null==n)return Tr(n);switch(typeof n){case"boolean":return n?1108378657:1108378656;case"number":return function(t){if(t!=t||t===1/0)return 0;var e=0|t;e!==t&&(e^=4294967295*t);for(;t>4294967295;)e^=t/=4294967295;return Fr(e)}(n);case"string":return n.length>Hr?function(t){var e=Kr[t];void 0===e&&(e=kr(t),Jr===Wr&&(Jr=0,Kr={}),Jr++,Kr[t]=e);return e}(n):kr(n);case"object":case"function":return function(t){var e;if(Ur&&void 0!==(e=Lr.get(t)))return e;if(e=t[qr],void 0!==e)return e;if(!Nr){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[qr]))return e;if(void 0!==(e=function(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}(t)))return e}if(e=Rr(),Ur)Lr.set(t,e);else{if(void 0!==Cr&&!1===Cr(t))throw new Error("Non-extensible objects are not allowed as keys.");if(Nr)Object.defineProperty(t,qr,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[qr]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[qr]=e}}return e}(n);case"symbol":return function(t){var e=Br[t];if(void 0!==e)return e;return e=Rr(),Br[t]=e,e}(n);default:if("function"==typeof n.toString)return kr(n.toString());throw new Error("Value type "+typeof n+" cannot be hashed.")}}function Tr(t){return null===t?1108378658:1108378659}function kr(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return Fr(e)}var jr=(1048576*Math.random()|1)%1048576||40503;function zr(t){if("string"!=typeof t)return Mr(t);for(var e=0,n=0;n<t.length;n++)e=jr*e+t.charCodeAt(n)|0;return e}var Cr=Object.isExtensible,Nr=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}();function Rr(){var t=++$r;return 1073741824&$r&&($r=0),t}var Lr,Ur="function"==typeof WeakMap;Ur&&(Lr=new WeakMap);var Br=Object.create(null),$r=0,qr="__immutablehash__";"function"==typeof Symbol&&(qr=Symbol(qr));var Hr=16,Wr=255,Jr=0,Kr={},Vr=function(t){function e(t,e){this._iter=t,this._useKeys=e,this.size=t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return this._iter.get(t,e)},e.prototype.has=function(t){return this._iter.has(t)},e.prototype.valueSeq=function(){return this._iter.valueSeq()},e.prototype.reverse=function(){var t=this,e=ti(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},e.prototype.map=function(t,e){var n=this,r=Qr(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},e.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e,r){return t(e,r,n)},e)},e.prototype.__iterator=function(t,e){return this._iter.__iterator(t,e)},e}(mr);Vr.prototype[ur]=!0;var Gr=function(t){function e(t){this._iter=t,this.size=t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.includes=function(t){return this._iter.includes(t)},e.prototype.__iterate=function(t,e){var n=this,r=0;return e&&Xn(this),this._iter.__iterate(function(i){return t(i,e?n.size-++r:r++,n)},e)},e.prototype.__iterator=function(t,e){var n=this,r=this._iter.__iterator(1,e),i=0;return e&&Xn(this),new Rn(function(){var o=r.next();return o.done?o:Ln(t,e?n.size-++i:i++,o.value,o)})},e}(gr),Yr=function(t){function e(t){this._iter=t,this.size=t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.has=function(t){return this._iter.includes(t)},e.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){return t(e,e,n)},e)},e.prototype.__iterator=function(t,e){var n=this._iter.__iterator(1,e);return new Rn(function(){var e=n.next();return e.done?e:Ln(t,e.value,e.value,e)})},e}(yr),Xr=function(t){function e(t){this._iter=t,this.size=t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.entrySeq=function(){return this._iter.toSeq()},e.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){if(e){fi(e);var r=Pn(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}},e)},e.prototype.__iterator=function(t,e){var n=this._iter.__iterator(1,e);return new Rn(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){fi(r);var i=Pn(r);return Ln(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}})},e}(mr);function Zr(t){var e=pi(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=di,e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return!1!==e(n,t,r)},n)},e.__iteratorUncached=function(e,n){if(2===e){var r=t.__iterator(e,n);return new Rn(function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(1===e?0:1,n)},e}function Qr(t,e,n){var r=pi(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var o=t.get(r,Vn);return o===Vn?i:e.call(n,o,r,t)},r.__iterateUncached=function(r,i){var o=this;return t.__iterate(function(t,i,a){return!1!==r(e.call(n,t,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=t.__iterator(2,i);return new Rn(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return Ln(r,s,e.call(n,a[1],s,t),i)})},r}function ti(t,e){var n=pi(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=Zr(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=di,n.__iterate=function(n,r){var i=this,o=0;return r&&Xn(t),t.__iterate(function(t,a){return n(t,e?a:r?i.size-++o:o++,i)},!r)},n.__iterator=function(r,i){var o=0;i&&Xn(t);var a=t.__iterator(2,!i);return new Rn(function(){var t=a.next();if(t.done)return t;var s=t.value;return Ln(r,e?s[0]:i?n.size-++o:o++,s[1],t)})},n}function ei(t,e,n,r){var i=pi(t);return r&&(i.has=function(r){var i=t.get(r,Vn);return i!==Vn&&!!e.call(n,i,r,t)},i.get=function(r,i){var o=t.get(r,Vn);return o!==Vn&&e.call(n,o,r,t)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return t.__iterate(function(t,o,u){if(e.call(n,t,o,u))return s++,i(t,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=t.__iterator(2,o),s=0;return new Rn(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,c=u[0],l=u[1];if(e.call(n,l,c,t))return Ln(i,r?c:s++,l,o)}})},i}function ni(t,e,n,r){var i=t.size;if(tr(e,n,i))return t;if(void 0===i&&(e<0||n<0))return ni(t.toSeq().cacheResult(),e,n,r);var o,a=er(e,i),s=nr(n,i)-a;s==s&&(o=s<0?0:s);var u=pi(t);return u.size=0===o?o:t.size&&o||void 0,!r&&fr(t)&&o>=0&&(u.get=function(e,n){return(e=Zn(this,e))>=0&&e<o?t.get(e+a,n):n}),u.__iterateUncached=function(e,n){var i=this;if(0===o)return 0;if(n)return this.cacheResult().__iterate(e,n);var s=0,u=!0,c=0;return t.__iterate(function(t,n){if(!u||!(u=s++<a))return c++,!1!==e(t,r?n:c-1,i)&&c!==o}),c},u.__iteratorUncached=function(e,n){if(0!==o&&n)return this.cacheResult().__iterator(e,n);if(0===o)return new Rn(Un);var i=t.__iterator(e,n),s=0,u=0;return new Rn(function(){for(;s++<a;)i.next();if(++u>o)return{value:void 0,done:!0};var t=i.next();return r||1===e||t.done?t:Ln(e,u-1,0===e?void 0:t.value[1],t)})},u}function ri(t,e,n,r){var i=pi(t);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return t.__iterate(function(t,o,c){if(!s||!(s=e.call(n,t,o,c)))return u++,i(t,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=t.__iterator(2,o),u=!0,c=0;return new Rn(function(){var t,o,l;do{if((t=s.next()).done)return r||1===i?t:Ln(i,c++,0===i?void 0:t.value[1],t);var f=t.value;o=f[0],l=f[1],u&&(u=e.call(n,l,o,a))}while(u);return 2===i?t:Ln(i,o,l,t)})},i}Gr.prototype.cacheResult=Vr.prototype.cacheResult=Yr.prototype.cacheResult=Xr.prototype.cacheResult=di;var ii=function(t){function e(t){this._wrappedIterables=t.flatMap(function(t){return t._wrappedIterables?t._wrappedIterables:[t]}),this.size=this._wrappedIterables.reduce(function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}},0),this[xn]=this._wrappedIterables[0][xn],this[In]=this._wrappedIterables[0][In],this[ur]=this._wrappedIterables[0][ur]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(t,e){if(0!==this._wrappedIterables.length){if(e)return this.cacheResult().__iterate(t,e);for(var n=0,r=An(this),i=r?2:1,o=this._wrappedIterables[n].__iterator(i,e),a=!0,s=0;a;){for(var u=o.next();u.done;){if(++n===this._wrappedIterables.length)return s;u=(o=this._wrappedIterables[n].__iterator(i,e)).next()}a=!1!==(r?t(u.value[1],u.value[0],this):t(u.value,s,this)),s++}return s}},e.prototype.__iteratorUncached=function(t,e){var n=this;if(0===this._wrappedIterables.length)return new Rn(Un);if(e)return this.cacheResult().__iterator(t,e);var r=0,i=this._wrappedIterables[r].__iterator(t,e);return new Rn(function(){for(var o=i.next();o.done;){if(++r===n._wrappedIterables.length)return o;o=(i=n._wrappedIterables[r].__iterator(t,e)).next()}return o})},e}(dr);function oi(t,e,n){var r=pi(t);return r.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var a=0,s=!1;return function t(u,c){u.__iterate(function(o,u){return(!e||c<e)&&Pn(o)?t(o,c+1):(a++,!1===i(o,n?u:a-1,r)&&(s=!0)),!s},o)}(t,0),a},r.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var o=t.__iterator(r,i),a=[],s=0;return new Rn(function(){for(;o;){var t=o.next();if(!1===t.done){var u=t.value;if(2===r&&(u=u[1]),e&&!(a.length<e)||!Pn(u))return n?t:Ln(r,s++,u,t);a.push(o),o=u.__iterator(r,i)}else o=a.pop()}return{value:void 0,done:!0}})},r}function ai(t,e,n){e||(e=mi);var r=An(t),i=0,o=t.toSeq().map(function(e,r){return[r,e,i++,n?n(e,r,t):e]}).valueSeq().toArray();return o.sort(function(t,n){return e(t[3],n[3])||t[2]-n[2]}).forEach(r?function(t,e){o[e].length=2}:function(t,e){o[e]=t[1]}),r?mr(o):En(t)?gr(o):yr(o)}function si(t,e,n){if(e||(e=mi),n){var r=t.toSeq().map(function(e,r){return[e,n(e,r,t)]}).reduce(function(t,n){return ui(e,t[1],n[1])?n:t});return r&&r[0]}return t.reduce(function(t,n){return ui(e,t,n)?n:t})}function ui(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(null==n||n!=n)||r>0}function ci(t,e,n,r){var i=pi(t),o=new _r(n).map(function(t){return t.size});return i.size=r?o.max():o.min(),i.__iterate=function(t,e){for(var n,r=this.__iterator(1,e),i=0;!(n=r.next()).done&&!1!==t(n.value,i++,this););return i},i.__iteratorUncached=function(t,i){var o=n.map(function(t){return t=Mn(t),qn(i?t.reverse():t)}),a=0,s=!1;return new Rn(function(){var n;return s||(n=o.map(function(t){return t.next()}),s=r?n.every(function(t){return t.done}):n.some(function(t){return t.done})),s?{value:void 0,done:!0}:Ln(t,a++,e.apply(null,n.map(function(t){return t.value})))})},i}function li(t,e){return t===e?t:fr(t)?e:t.constructor(e)}function fi(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function hi(t){return An(t)?Tn:En(t)?kn:jn}function pi(t){return Object.create((An(t)?mr:En(t)?gr:yr).prototype)}function di(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):dr.prototype.cacheResult.call(this)}function mi(t,e){return void 0===t&&void 0===e?0:void 0===t?1:void 0===e?-1:t>e?1:t<e?-1:0}function gi(t){return Boolean(t&&"function"==typeof t.equals&&"function"==typeof t.hashCode)}function yi(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!!(gi(t)&&gi(e)&&t.equals(e))}function _i(t,e,n,r){return go(t,[e],n,r)}function vi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return bi(this,t)}function wi(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];if("function"!=typeof t)throw new TypeError("Invalid merger function: "+t);return bi(this,e,t)}function bi(t,e,n){for(var r=[],i=0;i<e.length;i++){var o=Tn(e[i]);0!==o.size&&r.push(o)}return 0===r.length?t:0!==t.toSeq().size||t.__ownerID||1!==r.length?t.withMutations(function(t){for(var e=n?function(e,r){_i(t,r,Vn,function(t){return t===Vn?e:n(t,e,r)})}:function(e,n){t.set(n,e)},i=0;i<r.length;i++)r[i].forEach(e)}):ar(t)?t:t.constructor(r[0])}var Si=Object.prototype.toString;function Oi(t){if(!t||"object"!=typeof t||"[object Object]"!==Si.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var n=e,r=Object.getPrototypeOf(e);null!==r;)n=r,r=Object.getPrototypeOf(n);return n===e}function Ii(t){return"object"==typeof t&&(sr(t)||Array.isArray(t)||Oi(t))}function Ei(t){return"string"==typeof t&&("__proto__"===t||"constructor"===t)}function xi(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),i=0;i<n;i++)r[i]=t[i+e];return r}function Ai(t){if(Array.isArray(t))return xi(t);var e={};for(var n in t)Ei(n)||hr.call(t,n)&&(e[n]=t[n]);return e}function Di(t,e,n){return Fi(t,e,function(t){function e(n,r,i){return Ii(n)&&Ii(r)&&(o=r,a=dr(n),s=dr(o),En(a)===En(s)&&An(a)===An(s))?Fi(n,[r],e):t?t(n,r,i):r;var o,a,s}return e}(n))}function Fi(t,e,n){if(!Ii(t))throw new TypeError("Cannot merge into non-data-structure value: "+t);if(sr(t))return"function"==typeof n&&t.mergeWith?t.mergeWith.apply(t,[n].concat(e)):t.merge?t.merge.apply(t,e):t.concat.apply(t,e);for(var r=Array.isArray(t),i=t,o=r?kn:Tn,a=r?function(e){i===t&&(i=Ai(i)),i.push(e)}:function(e,r){if(!Ei(r)){var o=hr.call(i,r),a=o&&n?n(i[r],e,r):e;o&&a===i[r]||(i===t&&(i=Ai(i)),i[r]=a)}},s=0;s<e.length;s++)o(e[s]).forEach(a);return i}function Pi(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return Di(this,t)}function Mi(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return Di(this,e,t)}function Ti(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return go(this,t,eo(),function(t){return Di(t,e)})}function ki(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return go(this,t,eo(),function(t){return Fi(t,e)})}function ji(t,e){return function(t,e,n){return go(t,e,Vn,function(){return n})}(this,t,e)}function zi(t,e,n){return 1===arguments.length?t(this):_i(this,t,e,n)}function Ci(t,e,n){return go(this,t,e,n)}function Ni(){return this.__altered}function Ri(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}var Li="@@__IMMUTABLE_MAP__@@";function Ui(t){return Boolean(t&&t[Li])}function Bi(t,e){if(!t)throw new Error(e)}function $i(t){Bi(t!==1/0,"Cannot perform this action with an infinite size.")}var qi=function(t){function e(e){return null==e?eo():Ui(e)&&!cr(e)?e:eo().withMutations(function(n){var r=t(e);$i(r.size),r.forEach(function(t,e){return n.set(e,t)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},e.prototype.set=function(t,e){return no(this,t,e)},e.prototype.remove=function(t){return no(this,t,Vn)},e.prototype.deleteAll=function(t){var e=Mn(t);return 0===e.size?this:this.withMutations(function(t){e.forEach(function(e){return t.remove(e)})})},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):eo()},e.prototype.sort=function(t){return No(ai(this,t))},e.prototype.sortBy=function(t,e){return No(ai(this,e,t))},e.prototype.map=function(t,e){var n=this;return this.withMutations(function(r){r.forEach(function(i,o){r.set(o,t.call(e,i,o,n))})})},e.prototype.__iterator=function(t,e){return new Xi(this,t,e)},e.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?to(this.size,this._root,t,this.__hash):0===this.size?eo():(this.__ownerID=t,this.__altered=!1,this)},e}(Tn);qi.isMap=Ui;var Hi=qi.prototype;Hi[Li]=!0,Hi[Wn]=Hi.remove,Hi.removeAll=Hi.deleteAll,Hi.setIn=ji,Hi.removeIn=Hi.deleteIn=_o,Hi.update=zi,Hi.updateIn=Ci,Hi.merge=Hi.concat=vi,Hi.mergeWith=wi,Hi.mergeDeep=Pi,Hi.mergeDeepWith=Mi,Hi.mergeIn=ki,Hi.mergeDeepIn=Ti,Hi.withMutations=Ri,Hi.wasAltered=Ni,Hi.asImmutable=xr,Hi["@@transducer/init"]=Hi.asMutable=Ar,Hi["@@transducer/step"]=function(t,e){return t.set(e[0],e[1])},Hi["@@transducer/result"]=function(t){return t.asImmutable()};var Wi=function(t,e){this.ownerID=t,this.entries=e};Wi.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,a=i.length;o<a;o++)if(yi(n,i[o][0]))return i[o][1];return r},Wi.prototype.update=function(t,e,n,r,i,o,a){for(var s=i===Vn,u=this.entries,c=0,l=u.length;c<l&&!yi(r,u[c][0]);c++);var f=c<l;if(f?u[c][1]===i:s)return this;if(Gn(a),(s||!f)&&Gn(o),!s||1!==u.length){if(!f&&!s&&u.length>=uo)return function(t,e,n,r){t||(t=new Yn);for(var i=new Gi(t,Mr(n),[n,r]),o=0;o<e.length;o++){var a=e[o];i=i.update(t,0,void 0,a[0],a[1])}return i}(t,u,r,i);var h=t&&t===this.ownerID,p=h?u:xi(u);return f?s?c===l-1?p.pop():p[c]=p.pop():p[c]=[r,i]:p.push([r,i]),h?(this.entries=p,this):new Wi(t,p)}};var Ji=function(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n};Ji.prototype.get=function(t,e,n,r){void 0===e&&(e=Mr(n));var i=1<<((0===t?e:e>>>t)&Kn),o=this.bitmap;return 0===(o&i)?r:this.nodes[ao(o&i-1)].get(t+5,e,n,r)},Ji.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=Mr(r));var s=(0===e?n:n>>>e)&Kn,u=1<<s,c=this.bitmap,l=0!==(c&u);if(!l&&i===Vn)return this;var f=ao(c&u-1),h=this.nodes,p=l?h[f]:void 0,d=ro(p,t,e+5,n,r,i,o,a);if(d===p)return this;if(!l&&d&&h.length>=co)return function(t,e,n,r,i){for(var o=0,a=new Array(Jn),s=0;0!==n;s++,n>>>=1)a[s]=1&n?e[o++]:void 0;return a[r]=i,new Ki(t,o+1,a)}(t,h,c,s,d);if(l&&!d&&2===h.length&&io(h[1^f]))return h[1^f];if(l&&d&&1===h.length&&io(d))return d;var m=t&&t===this.ownerID,g=l?d?c:c^u:c|u,y=l?d?so(h,f,d,m):function(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=new Array(r),o=0,a=0;a<r;a++)a===e&&(o=1),i[a]=t[a+o];return i}(h,f,m):function(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var o=new Array(i),a=0,s=0;s<i;s++)s===e?(o[s]=n,a=-1):o[s]=t[s+a];return o}(h,f,d,m);return m?(this.bitmap=g,this.nodes=y,this):new Ji(t,g,y)};var Ki=function(t,e,n){this.ownerID=t,this.count=e,this.nodes=n};Ki.prototype.get=function(t,e,n,r){void 0===e&&(e=Mr(n));var i=(0===t?e:e>>>t)&Kn,o=this.nodes[i];return o?o.get(t+5,e,n,r):r},Ki.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=Mr(r));var s=(0===e?n:n>>>e)&Kn,u=i===Vn,c=this.nodes,l=c[s];if(u&&!l)return this;var f=ro(l,t,e+5,n,r,i,o,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<lo)return function(t,e,n,r){for(var i=0,o=0,a=new Array(n),s=0,u=1,c=e.length;s<c;s++,u<<=1){var l=e[s];void 0!==l&&s!==r&&(i|=u,a[o++]=l)}return new Ji(t,i,a)}(t,c,h,s)}else h++;var p=t&&t===this.ownerID,d=so(c,s,f,p);return p?(this.count=h,this.nodes=d,this):new Ki(t,h,d)};var Vi=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n,this._index=void 0};Vi.prototype._positionOf=function(t,e){var n=this.entries,r=this._index;if(void 0===r&&e&&n.length>=fo&&(r=this._buildIndex()),void 0!==r){var i=r[zr(t)];if(void 0!==i)for(var o=0;o<i.length;o++){var a=i[o];if(yi(t,n[a][0]))return a}return-1}for(var s=0,u=n.length;s<u;s++)if(yi(t,n[s][0]))return s;return-1},Vi.prototype._buildIndex=function(){for(var t=Object.create(null),e=this.entries,n=0,r=e.length;n<r;n++){var i=zr(e[n][0]),o=t[i];void 0!==o?o.push(n):t[i]=[n]}return this._index=t,t},Vi.prototype.get=function(t,e,n,r){var i=this._positionOf(n,!0);return-1===i?r:this.entries[i][1]},Vi.prototype.update=function(t,e,n,r,i,o,a){void 0===n&&(n=Mr(r));var s=i===Vn;if(n!==this.keyHash)return s?this:(Gn(a),Gn(o),oo(this,t,e,n,[r,i]));var u=this.entries,c=u.length,l=t&&t===this.ownerID,f=this._positionOf(r,l),h=-1===f?c:f,p=-1!==f;if(p?u[h][1]===i:s)return this;if(Gn(a),(s||!p)&&Gn(o),s&&2===c)return new Gi(t,this.keyHash,u[1^h]);var d=l?u:xi(u);if(p)s?(h===c-1?d.pop():d[h]=d.pop(),l&&(this._index=void 0)):d[h]=[r,i];else if(d.push([r,i]),l&&void 0!==this._index){var m=zr(r),g=this._index[m];void 0!==g?g.push(c):this._index[m]=[c]}return l?(this.entries=d,this):new Vi(t,this.keyHash,d)};var Gi=function(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n};Gi.prototype.get=function(t,e,n,r){return yi(n,this.entry[0])?this.entry[1]:r},Gi.prototype.update=function(t,e,n,r,i,o,a){var s=i===Vn,u=yi(r,this.entry[0]);return(u?i===this.entry[1]:s)?this:(Gn(a),s?void Gn(o):u?t&&t===this.ownerID?(this.entry[1]=i,this):new Gi(t,this.keyHash,[r,i]):(Gn(o),oo(this,t,e,Mr(r),[r,i])))},Wi.prototype.iterate=Vi.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;r<=i;r++)if(!1===t(n[e?i-r:r]))return!1},Ji.prototype.iterate=Ki.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;r<=i;r++){var o=n[e?i-r:r];if(o&&!1===o.iterate(t,e))return!1}},Gi.prototype.iterate=function(t,e){return t(this.entry)};var Yi,Xi=function(t){function e(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&Qi(t._root)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n=e.node,r=e.index++,i=void 0;if(n.entry){if(0===r)return Zi(t,n.entry)}else if(n.entries){if(r<=(i=n.entries.length-1))return Zi(t,n.entries[this._reverse?i-r:r])}else if(r<=(i=n.nodes.length-1)){var o=n.nodes[this._reverse?i-r:r];if(o){if(o.entry)return Zi(t,o.entry);e=this._stack=Qi(o,e)}continue}e=this._stack=this._stack.__prev}return{value:void 0,done:!0}},e}(Rn);function Zi(t,e){return Ln(t,e[0],e[1])}function Qi(t,e){return{node:t,index:0,__prev:e}}function to(t,e,n,r){var i=Object.create(Hi);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function eo(){return Yi||(Yi=to(0))}function no(t,e,n){var r,i;if(t._root){var o={value:!1},a={value:!1};if(r=ro(t._root,t.__ownerID,0,void 0,e,n,o,a),!a.value)return t;i=t.size+(o.value?n===Vn?-1:1:0)}else{if(n===Vn)return t;i=1,r=new Wi(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=i,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?to(i,r):eo()}function ro(t,e,n,r,i,o,a,s){return t?t.update(e,n,r,i,o,a,s):o===Vn?t:(Gn(s),Gn(a),new Gi(e,r,[i,o]))}function io(t){return t.constructor===Gi||t.constructor===Vi}function oo(t,e,n,r,i){if(t.keyHash===r)return new Vi(e,r,[t.entry,i]);var o,a=(0===n?t.keyHash:t.keyHash>>>n)&Kn,s=(0===n?r:r>>>n)&Kn,u=a===s?[oo(t,e,n+5,r,i)]:(o=new Gi(e,r,i),a<s?[t,o]:[o,t]);return new Ji(e,1<<a|1<<s,u)}function ao(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)}function so(t,e,n,r){var i=r?t:xi(t);return i[e]=n,i}var uo=8,co=16,lo=8,fo=16;function ho(t){if(pr(t)&&"string"!=typeof t)return t;if(cr(t))return t.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+t)}function po(t){try{return"string"==typeof t?JSON.stringify(t):String(t)}catch(e){return JSON.stringify(t)}}function mo(t,e,n){return sr(t)?t.get(e,n):function(t,e){return sr(t)?t.has(e):Ii(t)&&hr.call(t,e)}(t,e)?"function"==typeof t.get?t.get(e):t[e]:n}function go(t,e,n,r){r||(r=n,n=void 0);var i=yo(sr(t),t,ho(e),0,n,r);return i===Vn?n:i}function yo(t,e,n,r,i,o){var a=e===Vn;if(r===n.length){var s=a?i:e,u=o(s);return u===s?e:u}if(!a&&!Ii(e))throw new TypeError("Cannot update within non-data-structure value in path ["+Array.from(n).slice(0,r).map(po)+"]: "+e);var c=n[r],l=a?Vn:mo(e,c,Vn),f=yo(l===Vn?t:sr(l),l,n,r+1,i,o);return f===l?e:f===Vn?function(t,e){if(!Ii(t))throw new TypeError("Cannot update non-data-structure value: "+t);if(sr(t)){if(!t.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+t);return t.remove(e)}if(!hr.call(t,e))return t;var n=Ai(t);return Array.isArray(n)?n.splice(e,1):delete n[e],n}(e,c):function(t,e,n){if(Ei(e))return t;if(!Ii(t))throw new TypeError("Cannot update non-data-structure value: "+t);if(sr(t)){if(!t.set)throw new TypeError("Cannot update immutable value without .set() method: "+t);return t.set(e,n)}if(hr.call(t,e)&&n===t[e])return t;var r=Ai(t);return r[e]=n,r}(a?t?eo():{}:e,c,f)}function _o(t){return function(t,e){return go(t,e,function(){return Vn})}(this,t)}var vo="@@__IMMUTABLE_LIST__@@";function wo(t){return Boolean(t&&t[vo])}var bo=function(t){function e(e){var n=Ao();if(null==e)return n;if(wo(e))return e;var r=t(e),i=r.size;return 0===i?n:($i(i),i>0&&i<Jn?xo(0,i,5,null,new Oo(r.toArray())):n.withMutations(function(t){t.setSize(i),r.forEach(function(e,n){return t.set(n,e)})}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("List [","]")},e.prototype.get=function(t,e){if((t=Zn(this,t))>=0&&t<this.size){var n=Po(this,t+=this._origin);return n&&n.array[t&Kn]}return e},e.prototype.set=function(t,e){return function(t,e,n){if(e=Zn(t,e),e!=e)return t;if(e>=t.size||e<0)return t.withMutations(function(t){e<0?Mo(t,e).set(0,n):Mo(t,0,e+1).set(e,n)});e+=t._origin;var r=t._tail,i=t._root,o={value:!1};e>=To(t._capacity)?r=Do(r,t.__ownerID,0,e,n,o):i=Do(i,t.__ownerID,t._level,e,n,o);if(!o.value)return t;if(t.__ownerID)return t._root=i,t._tail=r,t.__hash=void 0,t.__altered=!0,t;return xo(t._origin,t._capacity,t._level,i,r)}(this,t,e)},e.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},e.prototype.insert=function(t,e){return this.splice(t,0,e)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Ao()},e.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations(function(n){Mo(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])})},e.prototype.pop=function(){return Mo(this,0,-1)},e.prototype.unshift=function(){var t=arguments;return this.withMutations(function(e){Mo(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])})},e.prototype.shift=function(){return Mo(this,1)},e.prototype.shuffle=function(t){return void 0===t&&(t=Math.random),this.withMutations(function(e){for(var n,r,i=e.size;i;)n=Math.floor(t()*i--),r=e.get(n),e.set(n,e.get(i)),e.set(i,r)})},e.prototype.concat=function(){for(var e=arguments,n=[],r=0;r<arguments.length;r++){var i=e[r],o=t("string"!=typeof i&&Bn(i)?i:[i]);0!==o.size&&n.push(o)}return 0===n.length?this:0!==this.size||this.__ownerID||1!==n.length?this.withMutations(function(t){n.forEach(function(e){return e.forEach(function(e){return t.push(e)})})}):this.constructor(n[0])},e.prototype.setSize=function(t){return Mo(this,0,t)},e.prototype.map=function(t,e){var n=this;return this.withMutations(function(r){for(var i=0;i<n.size;i++)r.set(i,t.call(e,r.get(i),i,n))})},e.prototype.slice=function(t,e){var n=this.size;return tr(t,e,n)?this:Mo(this,er(t,n),nr(e,n))},e.prototype.__iterator=function(t,e){var n=e?this.size:0,r=Eo(this,e);return new Rn(function(){var i=r();return i===Io?{value:void 0,done:!0}:Ln(t,e?--n:n++,i)})},e.prototype.__iterate=function(t,e){for(var n,r=e?this.size:0,i=Eo(this,e);(n=i())!==Io&&!1!==t(n,e?--r:r++,this););return r},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?xo(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):0===this.size?Ao():(this.__ownerID=t,this.__altered=!1,this)},e}(kn);bo.isList=wo;var So=bo.prototype;So[vo]=!0,So[Wn]=So.remove,So.merge=So.concat,So.setIn=ji,So.deleteIn=So.removeIn=_o,So.update=zi,So.updateIn=Ci,So.mergeIn=ki,So.mergeDeepIn=Ti,So.withMutations=Ri,So.wasAltered=Ni,So.asImmutable=xr,So["@@transducer/init"]=So.asMutable=Ar,So["@@transducer/step"]=function(t,e){return t.push(e)},So["@@transducer/result"]=function(t){return t.asImmutable()};var Oo=function(t,e){this.array=t,this.ownerID=e};Oo.prototype.removeBefore=function(t,e,n){if(!(n&(1<<e+5)-1)||0===this.array.length)return this;var r=n>>>e&Kn;if(r>=this.array.length)return new Oo([],t);var i,o=0===r;if(e>0){var a=this.array[r];if((i=a&&a.removeBefore(t,e-5,n))===a&&o)return this}if(o&&!i)return this;var s=Fo(this,t);if(!o)for(var u=0;u<r;u++)s.array[u]=void 0;return i&&(s.array[r]=i),s},Oo.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e+5:Jn)||0===this.array.length)return this;var r,i=n-1>>>e&Kn;if(i>=this.array.length)return this;if(e>0){var o=this.array[i];if((r=o&&o.removeAfter(t,e-5,n))===o&&i===this.array.length-1)return this}var a=Fo(this,t);return a.array.splice(i+1),r&&(a.array[i]=r),a};var Io={};function Eo(t,e){var n=t._origin,r=t._capacity,i=To(r),o=t._tail;return a(t._root,t._level,0);function a(t,s,u){return 0===s?function(t,a){var s=a===i?o&&o.array:t&&t.array,u=a>n?0:n-a,c=r-a;c>Jn&&(c=Jn);return function(){if(u===c)return Io;var t=e?--c:u++;return s&&s[t]}}(t,u):function(t,i,o){var s,u=t&&t.array,c=o>n?0:n-o>>i,l=1+(r-o>>i);l>Jn&&(l=Jn);return function(){for(;;){if(s){var t=s();if(t!==Io)return t;s=null}if(c===l)return Io;var n=e?--l:c++;s=a(u&&u[n],i-5,o+(n<<i))}}}(t,s,u)}}function xo(t,e,n,r,i,o,a){var s=Object.create(So);return s.size=e-t,s._origin=t,s._capacity=e,s._level=n,s._root=r,s._tail=i,s.__ownerID=o,s.__hash=a,s.__altered=!1,s}function Ao(){return xo(0,0,5)}function Do(t,e,n,r,i,o){var a,s=r>>>n&Kn,u=t&&s<t.array.length;if(!u&&void 0===i)return t;if(n>0){var c=t&&t.array[s],l=Do(c,e,n-5,r,i,o);return l===c?t:((a=Fo(t,e)).array[s]=l,a)}return u&&t.array[s]===i?t:(o&&Gn(o),a=Fo(t,e),void 0===i&&s===a.array.length-1?a.array.pop():a.array[s]=i,a)}function Fo(t,e){return e&&t&&e===t.ownerID?t:new Oo(t?t.array.slice():[],e)}function Po(t,e){if(e>=To(t._capacity))return t._tail;if(e<1<<t._level+5){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&Kn],r-=5;return n}}function Mo(t,e,n){!function(t,e,n){var r=t._origin+(void 0===e?0:e),i=void 0===n?t._capacity:n<0?t._capacity+n:t._origin+n;if(Number.isFinite(i)&&i>ko||Number.isFinite(r)&&r<-ko||Number.isFinite(i)&&Number.isFinite(r)&&i-r>ko)throw new RangeError("Invalid List size: a List cannot hold more than "+ko+" (2 ** 30) values.")}(t,e,n),void 0!==e&&(e|=0),void 0!==n&&(n|=0);var r=t.__ownerID||new Yn,i=t._origin,o=t._capacity,a=i+e,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return t;if(a>=s)return t.clear();for(var u=t._level,c=t._root,l=0;a+l<0;)c=new Oo(c&&c.array.length?[void 0,c]:[],r),l+=jo(u+=5);l&&(a+=l,i+=l,s+=l,o+=l);for(var f=To(o),h=To(s);h>=jo(u+5);)c=new Oo(c&&c.array.length?[c]:[],r),u+=5;var p=t._tail,d=h<f?Po(t,s-1):h>f?new Oo([],r):p;if(p&&h>f&&a<o&&p.array.length){for(var m=c=Fo(c,r),g=u;g>5;g-=5){var y=f>>>g&Kn;m=m.array[y]=Fo(m.array[y],r)}m.array[f>>>5&Kn]=p}if(s<o&&(d=d&&d.removeAfter(r,0,s)),a>=h)a-=h,s-=h,u=5,c=null,d=d&&d.removeBefore(r,0,a);else if(a>i||h<f){for(l=0;c;){var _=a>>>u&Kn;if(_!==h>>>u&Kn)break;_&&(l+=(1<<u)*_),u-=5,c=c.array[_]}c&&a>i&&(c=c.removeBefore(r,u,a-l)),c&&h<f&&(c=c.removeAfter(r,u,h-l)),l&&(a-=l,s-=l)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=u,t._root=c,t._tail=d,t.__hash=void 0,t.__altered=!0,t):xo(a,s,u,c,d)}function To(t){return t<Jn?0:t-1>>>5<<5}var ko=Math.pow(2,30);function jo(t){return t<31?1<<t:Math.pow(2,t)}function zo(t){return Ui(t)&&cr(t)}var Co,No=function(t){function e(t){return null==t?Lo():zo(t)?t:Lo().withMutations(function(e){var n=Tn(t);$i(n.size),n.forEach(function(t,n){return e.set(n,t)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("OrderedMap {","}")},e.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):Lo()},e.prototype.set=function(t,e){return Uo(this,t,e)},e.prototype.remove=function(t){return Uo(this,t,Vn)},e.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],n)},e)},e.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},e.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?Ro(e,n,t,this.__hash):0===this.size?Lo():(this.__ownerID=t,this.__altered=!1,this._map=e,this._list=n,this)},e}(qi);function Ro(t,e,n,r){var i=Object.create(No.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Lo(){return Co||(Co=Ro(eo(),Ao()))}function Uo(t,e,n){var r,i,o=t._map,a=t._list,s=o.get(e),u=void 0!==s;if(n===Vn){if(!u)return t;a.size>=Jn&&a.size>=2*o.size?(r=(i=a.filter(function(t,e){return void 0!==t&&s!==e})).toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=o.remove(e),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return t;r=o,i=a.set(s,[e,n])}else r=o.set(e,a.size),i=a.set(a.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t.__altered=!0,t):Ro(r,i)}No.isOrderedMap=zo,No.prototype[ur]=!0,No.prototype[Wn]=No.prototype.remove;var Bo="@@__IMMUTABLE_STACK__@@";function $o(t){return Boolean(t&&t[Bo])}var qo=function(t){function e(t){return null==t?Ko():$o(t)?t:Ko().pushAll(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(t,e){var n=this._head;for(t=Zn(this,t);n&&t--;)n=n.next;return n?n.value:e},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var t=arguments;if(0===arguments.length)return this;for(var e=this.size+arguments.length,n=this._head,r=arguments.length-1;r>=0;r--)n={value:t[r],next:n};return this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Jo(e,n)},e.prototype.pushAll=function(e){if(0===(e=t(e)).size)return this;if(0===this.size&&$o(e))return e;$i(e.size);var n=this.size,r=this._head;return e.__iterate(function(t){n++,r={value:t,next:r}},!0),this.__ownerID?(this.size=n,this._head=r,this.__hash=void 0,this.__altered=!0,this):Jo(n,r)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Ko()},e.prototype.slice=function(e,n){if(tr(e,n,this.size))return this;var r=er(e,this.size);if(nr(n,this.size)!==this.size)return t.prototype.slice.call(this,e,n);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):Jo(i,o)},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Jo(this.size,this._head,t,this.__hash):0===this.size?Ko():(this.__ownerID=t,this.__altered=!1,this)},e.prototype.__iterate=function(t,e){var n=this;if(e)return new _r(this.toArray()).__iterate(function(e,r){return t(e,r,n)},e);for(var r=0,i=this._head;i&&!1!==t(i.value,r++,this);)i=i.next;return r},e.prototype.__iterator=function(t,e){if(e)return new _r(this.toArray()).__iterator(t,e);var n=0,r=this._head;return new Rn(function(){if(r){var e=r.value;return r=r.next,Ln(t,n++,e)}return{value:void 0,done:!0}})},e}(kn);qo.isStack=$o;var Ho,Wo=qo.prototype;function Jo(t,e,n,r){var i=Object.create(Wo);return i.size=t,i._head=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Ko(){return Ho||(Ho=Jo(0))}function Vo(t,e,n,r,i,o){return $i(t.size),t.__iterate(function(t,o,a){i?(i=!1,n=t):n=e.call(r,n,t,o,a)},o),n}function Go(t,e){return e}function Yo(t,e){return[e,t]}function Xo(t){return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return!t.apply(this,e)}}function Zo(t){return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return-t.apply(this,e)}}function Qo(t,e){return t<e?1:t>e?-1:0}function ta(t,e){if(t===e)return!0;if(!Pn(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||An(t)!==An(e)||En(t)!==En(e)||cr(t)!==cr(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!Dn(t);if(cr(t)){var r=t.entries();return e.every(function(t,e){var i=r.next().value;return i&&yi(i[1],t)&&(n||yi(i[0],e))})&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var a=!0,s=e.__iterate(function(e,r){if(n?!t.has(e):i?!yi(e,t.get(r,Vn)):!yi(t.get(r,Vn),e))return a=!1,!1});return a&&t.size===s}Wo[Bo]=!0,Wo.shift=Wo.pop,Wo.unshift=Wo.push,Wo.unshiftAll=Wo.pushAll,Wo.withMutations=Ri,Wo.wasAltered=Ni,Wo.asImmutable=xr,Wo["@@transducer/init"]=Wo.asMutable=Ar,Wo["@@transducer/step"]=function(t,e){return t.unshift(e)},Wo["@@transducer/result"]=function(t){return t.asImmutable()};var ea,na=function(t){function e(t,n,r){if(void 0===r&&(r=1),!(this instanceof e))return new e(t,n,r);if(Bi(0!==r,"Cannot step a Range by 0"),Bi(void 0!==t,"You must define a start value when using Range"),Bi(void 0!==n,"You must define an end value when using Range"),r=Math.abs(r),n<t&&(r=-r),this._start=t,this._end=n,this._step=r,this.size=Math.max(0,Math.ceil((n-t)/r-1)+1),0===this.size){if(ea)return ea;ea=this}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},e.prototype.get=function(t,e){return this.has(t)?this._start+Zn(this,t)*this._step:e},e.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},e.prototype.slice=function(t,n){return tr(t,n,this.size)?this:(t=er(t,this.size),(n=nr(n,this.size))<=t?new e(0,0):new e(this.get(t,this._end),this.get(n,this._end),this._step))},e.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},e.prototype.lastIndexOf=function(t){return this.indexOf(t)},e.prototype.__iterate=function(t,e){for(var n=this.size,r=this._step,i=e?this._start+(n-1)*r:this._start,o=0;o!==n&&!1!==t(i,e?n-++o:o++,this);)i+=e?-r:r;return o},e.prototype.__iterator=function(t,e){var n=this.size,r=this._step,i=e?this._start+(n-1)*r:this._start,o=0;return new Rn(function(){if(o===n)return{value:void 0,done:!0};var a=i;return i+=e?-r:r,Ln(t,e?n-++o:o++,a)})},e.prototype.equals=function(t){return t instanceof e?this._start===t._start&&this._end===t._end&&this._step===t._step:ta(this,t)},e}(gr),ra="@@__IMMUTABLE_SET__@@";function ia(t){return Boolean(t&&t[ra])}var oa=function(t){function e(e){return null==e?la():ia(e)&&!cr(e)?e:la().withMutations(function(n){var r=t(e);$i(r.size),r.forEach(function(t){return n.add(t)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(Tn(t).keySeq())},e.intersect=function(t){return(t=Mn(t).toArray()).length?sa.intersect.apply(e(t.pop()),t):la()},e.union=function(t){return(t=Mn(t).toArray()).length?sa.union.apply(e(t.pop()),t):la()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(t){return this._map.has(t)},e.prototype.add=function(t){return ua(this,this._map.set(t,t))},e.prototype.remove=function(t){return ua(this,this._map.remove(t))},e.prototype.clear=function(){return ua(this,this._map.clear())},e.prototype.map=function(t,e){var n=this,r=!1,i=ua(this,this._map.mapEntries(function(i){var o=i[1],a=t.call(e,o,o,n);return a!==o&&(r=!0),[a,a]},e));return r?i:this},e.prototype.union=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return 0===(e=e.filter(function(t){return 0!==t.size})).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(n){for(var r=0;r<e.length;r++)"string"==typeof e[r]?n.add(e[r]):t(e[r]).forEach(function(t){return n.add(t)})}):this.constructor(e[0])},e.prototype.intersect=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];if(0===e.length)return this;e=e.map(function(e){return t(e)});var r=[];return this.forEach(function(t){e.every(function(e){return e.includes(t)})||r.push(t)}),this.withMutations(function(t){r.forEach(function(e){t.remove(e)})})},e.prototype.subtract=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];if(0===e.length)return this;e=e.map(function(e){return t(e)});var r=[];return this.forEach(function(t){e.some(function(e){return e.includes(t)})&&r.push(t)}),this.withMutations(function(t){r.forEach(function(e){t.remove(e)})})},e.prototype.sort=function(t){return Ia(ai(this,t))},e.prototype.sortBy=function(t,e){return Ia(ai(this,e,t))},e.prototype.wasAltered=function(){return this._map.wasAltered()},e.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate(function(e){return t(e,e,n)},e)},e.prototype.__iterator=function(t,e){return this._map.__iterator(t,e)},e.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):0===this.size?this.__empty():(this.__ownerID=t,this._map=e,this)},e}(jn);oa.isSet=ia;var aa,sa=oa.prototype;function ua(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function ca(t,e){var n=Object.create(sa);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function la(){return aa||(aa=ca(eo()))}function fa(t,e,n){for(var r=ho(e),i=0;i!==r.length;)if((t=mo(t,r[i++],Vn))===Vn)return n;return t}function ha(t,e){return fa(this,t,e)}function pa(){$i(this.size);var t={};return this.__iterate(function(e,n){Ei(n)||(t[n]=e)}),t}function da(t){if(!t||"object"!=typeof t)return t;if(!Pn(t)){if(!Ii(t))return t;t=dr(t)}if(An(t)){var e={};return t.__iterate(function(t,n){Ei(n)||(e[n]=da(t))}),e}var n=[];return t.__iterate(function(t){n.push(da(t))}),n}function ma(t){if(t.size===1/0)return 0;var e=cr(t),n=An(t),r=e?1:0;return t.__iterate(n?e?function(t,e){r=31*r+ga(Mr(t),Mr(e))|0}:function(t,e){r=r+ga(Mr(t),Mr(e))|0}:e?function(t){r=31*r+Mr(t)|0}:function(t){r=r+Mr(t)|0}),function(t,e){return e=Dr(e,3432918353),e=Dr(e<<15|e>>>-15,461845907),e=Dr(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Dr(e^e>>>16,2246822507),e=Dr(e^e>>>13,3266489909),e=Fr(e^e>>>16),e}(t.size,r)}function ga(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}function ya(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}sa[ra]=!0,sa[Wn]=sa.remove,sa.merge=sa.concat=sa.union,sa.withMutations=Ri,sa.asImmutable=xr,sa["@@transducer/init"]=sa.asMutable=Ar,sa["@@transducer/step"]=function(t,e){return t.add(e)},sa["@@transducer/result"]=function(t){return t.asImmutable()},sa.__empty=la,sa.__make=ca,Mn.Iterator=Rn,ya(Mn,{toArray:function(){$i(this.size);var t=new Array(this.size||0),e=An(this),n=0;return this.__iterate(function(r,i){t[n++]=e?[i,r]:r}),t},toIndexedSeq:function(){return new Gr(this)},toJS:function(){return da(this)},toKeyedSeq:function(){return new Vr(this,!0)},toMap:function(){return qi(this.toKeyedSeq())},toObject:pa,toOrderedMap:function(){return No(this.toKeyedSeq())},toOrderedSet:function(){return Ia(An(this)?this.valueSeq():this)},toSet:function(){return oa(An(this)?this.valueSeq():this)},toSetSeq:function(){return new Yr(this)},toSeq:function(){return En(this)?this.toIndexedSeq():An(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return qo(An(this)?this.valueSeq():this)},toList:function(){return bo(An(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return li(this,function(t,e){var n=An(t),r=[t].concat(e).map(function(t){return Pn(t)?n&&(t=Tn(t)):t=n?Or(t):Ir(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===r.length)return t;if(1===r.length){var i=r[0];if(i===t||n&&An(i)||En(t)&&En(i))return i}return new ii(r)}(this,t))},includes:function(t){return this.some(function(e){return yi(e,t)})},entries:function(){return this.__iterator(2)},every:function(t,e){$i(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!t.call(e,r,i,o))return n=!1,!1}),n},filter:function(t,e){return li(this,ei(this,t,e,!0))},partition:function(t,e){return function(t,e,n){var r=An(t),i=[[],[]];t.__iterate(function(o,a){i[e.call(n,o,a,t)?1:0].push(r?[a,o]:o)});var o=hi(t);return i.map(function(e){return li(t,o(e))})}(this,t,e)},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},forEach:function(t,e){return $i(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){$i(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate(function(r){n?n=!1:e+=t,e+=null!=r?r.toString():""}),e},keys:function(){return this.__iterator(0)},map:function(t,e){return li(this,Qr(this,t,e))},reduce:function(t,e,n){return Vo(this,t,e,n,arguments.length<2,!1)},reduceRight:function(t,e,n){return Vo(this,t,e,n,arguments.length<2,!0)},reverse:function(){return li(this,ti(this,!0))},slice:function(t,e){return li(this,ni(this,t,e,!0))},some:function(t,e){$i(this.size);var n=!1;return this.__iterate(function(r,i,o){if(t.call(e,r,i,o))return n=!0,!1}),n},sort:function(t){return li(this,ai(this,t))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return Xn(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return function(t,e,n){var r=qi().asMutable();return t.__iterate(function(i,o){r.update(e.call(n,i,o,t),0,function(t){return t+1})}),r.asImmutable()}(this,t,e)},equals:function(t){return ta(this,t)},entrySeq:function(){var t=this;if(t._cache)return new _r(t._cache);var e=t.toSeq().map(Yo).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Xo(t),e)},findEntry:function(t,e,n){var r=n;return this.__iterate(function(n,i,o){if(t.call(e,n,i,o))return r=[i,n],!1}),r},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(t){return this.find(Qn,null,t)},flatMap:function(t,e){return li(this,function(t,e,n){var r=hi(t);return t.toSeq().map(function(i,o){return r(e.call(n,i,o,t))}).flatten(!0)}(this,t,e))},flatten:function(t){return li(this,oi(this,t,!0))},fromEntrySeq:function(){return new Xr(this)},get:function(t,e){return this.find(function(e,n){return yi(n,t)},void 0,e)},getIn:ha,groupBy:function(t,e){return function(t,e,n){var r=An(t),i=(cr(t)?No():qi()).asMutable();t.__iterate(function(o,a){i.update(e.call(n,o,a,t),function(t){return(t=t||[]).push(r?[a,o]:o),t})});var o=hi(t);return i.map(function(e){return li(t,o(e))}).asImmutable()}(this,t,e)},has:function(t){return this.get(t,Vn)!==Vn},hasIn:function(t){return fa(this,t,Vn)!==Vn},isSubset:function(t){return t="function"==typeof t.includes?t:Mn(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return(t="function"==typeof t.isSubset?t:Mn(t)).isSubset(this)},keyOf:function(t){return this.findKey(function(e){return yi(e,t)})},keySeq:function(){return this.toSeq().map(Go).toIndexedSeq()},last:function(t){return this.toSeq().reverse().first(t)},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return si(this,t)},maxBy:function(t,e){return si(this,e,t)},min:function(t){return si(this,t?Zo(t):Qo)},minBy:function(t,e){return si(this,e?Zo(e):Qo,t)},rest:function(){return this.slice(1)},skip:function(t){return 0===t?this:this.slice(Math.max(0,t))},skipLast:function(t){return 0===t?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return li(this,ri(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Xo(t),e)},sortBy:function(t,e){return li(this,ai(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return li(this,function(t,e,n){var r=pi(t);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return t.__iterate(function(t,i,s){return e.call(n,t,i,s)&&++a&&r(t,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=t.__iterator(2,i),s=!0;return new Rn(function(){if(!s)return{value:void 0,done:!0};var t=a.next();if(t.done)return t;var i=t.value,u=i[0],c=i[1];return e.call(n,c,u,o)?2===r?t:Ln(r,u,c,t):(s=!1,{value:void 0,done:!0})})},r}(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Xo(t),e)},update:function(t){return t(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=ma(this))}});var _a=Mn.prototype;_a[Fn]=!0,_a[Nn]=_a.values,_a.toJSON=_a.toArray,_a.__toStringMapper=po,_a.inspect=_a.toSource=function(){return this.toString()},_a.chain=_a.flatMap,_a.contains=_a.includes,ya(Tn,{flip:function(){return li(this,Zr(this))},mapEntries:function(t,e){var n=this,r=0;return li(this,this.toSeq().map(function(i,o){return t.call(e,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return li(this,this.toSeq().flip().map(function(r,i){return t.call(e,r,i,n)}).flip())}});var va=Tn.prototype;va[xn]=!0,va[Nn]=_a.entries,va.toJSON=pa,va.__toStringMapper=function(t,e){return po(e)+": "+po(t)},ya(kn,{toKeyedSeq:function(){return new Vr(this,!1)},filter:function(t,e){return li(this,ei(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return li(this,ti(this,!1))},slice:function(t,e){return li(this,ni(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(e||0,0),0===n||2===n&&!e)return this;t=er(t,t<0?this.count():this.size);var r=this.slice(0,t);return li(this,1===n?r:r.concat(xi(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return li(this,oi(this,t,!1))},get:function(t,e){return(t=Zn(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,n){return n===t},void 0,e)},has:function(t){return(t=Zn(this,t))>=0&&(void 0!==this.size?this.size===1/0||t<this.size:this.find(function(e,n){return n===t},void 0,Vn)!==Vn)},interpose:function(t){return li(this,function(t,e){var n=pi(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var i=this,o=0;return t.__iterate(function(t){return(!o||!1!==n(e,o++,i))&&!1!==n(t,o++,i)},r),o},n.__iteratorUncached=function(n,r){var i,o=t.__iterator(1,r),a=0;return new Rn(function(){return(!i||a%2)&&(i=o.next()).done?i:a%2?Ln(n,a++,e):Ln(n,a++,i.value,i)})},n}(this,t))},interleave:function(){var t=[this].concat(xi(arguments)),e=ci(this.toSeq(),gr.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),li(this,n)},keySeq:function(){return na(0,this.size)},last:function(t){return this.get(-1,t)},skipWhile:function(t,e){return li(this,ri(this,t,e,!1))},zip:function(){return li(this,ci(this,Sa,[this].concat(xi(arguments))))},zipAll:function(){return li(this,ci(this,Sa,[this].concat(xi(arguments)),!0))},zipWith:function(t){var e=xi(arguments);return e[0]=this,li(this,ci(this,t,e))}});var wa=kn.prototype;wa[In]=!0,wa[ur]=!0,ya(jn,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}});var ba=jn.prototype;function Sa(){return xi(arguments)}function Oa(t){return ia(t)&&cr(t)}ba.has=_a.includes,ba.contains=ba.includes,ba.keys=ba.values,ya(mr,va),ya(gr,wa),ya(yr,ba);var Ia=function(t){function e(t){return null==t?Da():Oa(t)?t:Da().withMutations(function(e){var n=jn(t);$i(n.size),n.forEach(function(t){return e.add(t)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(Tn(t).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(oa);Ia.isOrderedSet=Oa;var Ea,xa=Ia.prototype;function Aa(t,e){var n=Object.create(xa);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Da(){return Ea||(Ea=Aa(Lo()))}xa[ur]=!0,xa.zip=wa.zip,xa.zipWith=wa.zipWith,xa.zipAll=wa.zipAll,xa.__empty=Da,xa.__make=Aa;var Fa=function(t,e){var n;!function(t){if(ar(t))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(sr(t))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===t||"object"!=typeof t)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(t);var r=function(o){var a=this;if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var s=Object.keys(t),u=i._indices={};i._name=e,i._keys=s,i._defaultValues=t;for(var c=0;c<s.length;c++){var l=s[c];u[l]=c,i[l]?"object"==typeof console&&console.warn&&console.warn("Cannot define "+Ta(this)+\' with property "\'+l+\'" since that property name is part of the Record API.\'):ja(i,l)}}return this.__ownerID=void 0,this._values=bo().withMutations(function(t){t.setSize(a._keys.length),Tn(o).forEach(function(e,n){t.set(a._indices[n],e===a._defaultValues[n]?void 0:e)})}),this},i=r.prototype=Object.create(Pa);return i.constructor=r,e&&(r.displayName=e),r};Fa.prototype.toString=function(){for(var t,e=Ta(this)+" { ",n=this._keys,r=0,i=n.length;r!==i;r++)e+=(r?", ":"")+(t=n[r])+": "+po(this.get(t));return e+" }"},Fa.prototype.equals=function(t){return this===t||ar(t)&&ka(this).equals(ka(t))},Fa.prototype.hashCode=function(){return ka(this).hashCode()},Fa.prototype.has=function(t){return this._indices.hasOwnProperty(t)},Fa.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._indices[t],r=this._values.get(n);return void 0===r?this._defaultValues[t]:r},Fa.prototype.set=function(t,e){if(this.has(t)){var n=this._values.set(this._indices[t],e===this._defaultValues[t]?void 0:e);if(n!==this._values&&!this.__ownerID)return Ma(this,n)}return this},Fa.prototype.remove=function(t){return this.set(t)},Fa.prototype.clear=function(){var t=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Ma(this,t)},Fa.prototype.wasAltered=function(){return this._values.wasAltered()},Fa.prototype.toSeq=function(){return ka(this)},Fa.prototype.toJS=function(){return da(this)},Fa.prototype.entries=function(){return this.__iterator(2)},Fa.prototype.__iterator=function(t,e){return ka(this).__iterator(t,e)},Fa.prototype.__iterate=function(t,e){return ka(this).__iterate(t,e)},Fa.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._values.__ensureOwner(t);return t?Ma(this,e,t):(this.__ownerID=t,this._values=e,this)},Fa.isRecord=ar,Fa.getDescriptiveName=Ta;var Pa=Fa.prototype;function Ma(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._values=e,r.__ownerID=n,r}function Ta(t){return t.constructor.displayName||t.constructor.name||"Record"}function ka(t){return Or(t._keys.map(function(e){return[e,t.get(e)]}))}function ja(t,e){try{Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){Bi(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}catch(t){}}Pa[or]=!0,Pa[Wn]=Pa.remove,Pa.deleteIn=Pa.removeIn=_o,Pa.getIn=ha,Pa.hasIn=_a.hasIn,Pa.merge=vi,Pa.mergeWith=wi,Pa.mergeIn=ki,Pa.mergeDeep=Pi,Pa.mergeDeepWith=Mi,Pa.mergeDeepIn=Ti,Pa.setIn=ji,Pa.update=zi,Pa.updateIn=Ci,Pa.withMutations=Ri,Pa.asMutable=Ar,Pa.asImmutable=xr,Pa[Nn]=Pa.entries,Pa.toJSON=Pa.toObject=_a.toObject,Pa.inspect=Pa.toSource=function(){return this.toString()};const za=qi;Object.assign(t=>za(t),{isMap:za.isMap,of:function(){const t=[];for(let e=0;e<arguments.length;e+=2)t.push([e<0||arguments.length<=e?void 0:arguments[e],e+1<0||arguments.length<=e+1?void 0:arguments[e+1]]);return za(t)}});function Ca(t){const e=t.defaultValues||{},n=t.prototype;n._defaultValues={...n._defaultValues||{},...e};const r=Object.keys(n._defaultValues);n._keys=r,n._indices={};for(let t=0;t<r.length;t++){const e=r[t];n._indices[e]=t}r.forEach(t=>{Object.defineProperty(n,t,{get(){return this.get(t)},set(e){this.set(t,e)}})})}const Na=class extends(Fa({})){};var Ra,La,Ua,Ba;class $a extends Na{constructor(t){super(t)}scale(t,e){return this.withMutations(n=>{e||(e=t),n.set("x",this.x*t).set("y",this.y*e)})}translate(t){let{x:e,y:n}=t;return this.withMutations(t=>{t.set("x",this.x+e).set("y",this.y+n)})}translateX(t){return this.translate(new $a({x:t,y:0}))}translateY(t){return this.translate(new $a({x:0,y:t}))}distance(t){return Math.sqrt((t.x-this.x)**2+(t.y-this.y)**2)}rotate(t){t%=360;const{x:e,y:n}=this;switch(t){case 0:return this;case 90:return this.set("x",n).set("y",-e);case 180:return this.set("x",-e).set("y",-n);case 270:return this.set("x",-n).set("y",e);default:{const r=t*Math.PI/180;return this.set("x",Math.cos(r)*e+Math.sin(r)*n).set("y",Math.cos(r)*n-Math.sin(r)*e)}}}apply(t){const[e,n]=t.applyToPoint([this.x,this.y]);return this.withMutations(t=>{t.set("x",e).set("y",n)})}}Ra=$a,l($a,"defaultValues",{x:0,y:0}),Ca(Ra);class qa extends(function(t){return Fa(t)}({width:0,height:0})){constructor(t){super(t)}scale(t){return this.withMutations(e=>{e.set("width",this.width*t).set("height",this.height*t)})}ceil(){return this.withMutations(t=>{t.set("width",Math.ceil(this.width)).set("height",Math.ceil(this.height))})}floor(){return this.withMutations(t=>{t.set("width",Math.floor(this.width)).set("height",Math.floor(this.height))})}swapDimensions(){return this.withMutations(t=>{t.set("width",this.height).set("height",this.width)})}apply(t){const[e,n]=t.applyToVector([this.width,this.height]);return this.withMutations(t=>{t.set("width",Math.abs(e)).set("height",Math.abs(n))})}}class Ha extends Na{constructor(t){super(t)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static fromClientRect(t){let{top:e,left:n,width:r,height:i}=t;return new Ha({top:e,left:n,width:r,height:i})}static fromPoints(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];i(4===e.length,"Rect.fromPoints requires 4 points");const r=Math.min(...e.map(t=>t.x)),o=Math.min(...e.map(t=>t.y)),a=Math.max(...e.map(t=>t.x)),s=Math.max(...e.map(t=>t.y));return new Ha({left:r,top:o,width:a-r,height:s-o})}expandToIncludePoints(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];const r=Math.min(this.left,...e.map(t=>t.x)),i=Math.min(this.top,...e.map(t=>t.y)),o=Math.max(this.left+this.width,...e.map(t=>t.x)),a=Math.max(this.top+this.height,...e.map(t=>t.y));return new Ha({left:r,top:i,width:o-r,height:a-i})}static areRectsCloserThan(t,e,n){return Math.abs(t.left-e.left)<=n&&Math.abs(t.top-e.top)<=n&&Math.abs(t.left+t.width-(e.left+e.width))<=n&&Math.abs(t.top+t.height-(e.top+e.height))<=n}static areVerticallyAligned(t,e,n){return Math.abs(t.top-e.top)<=n&&Math.abs(t.top+t.height-(e.top+e.height))<=n}static union(t){const e=t.map(t=>t.top).min(),n=t.map(t=>t.bottom).max()-e,r=t.map(t=>t.left).min(),i=t.map(t=>t.right).max()-r;return new Ha({left:r,top:e,width:i,height:n})}static getCenteredRect(t,e){return new Ha({left:(e.width-t.width)/2,top:(e.height-t.height)/2,width:t.width,height:t.height})}static fromInset(t){return new Ha({left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top})}translate(t){let{x:e,y:n}=t;return this.withMutations(t=>{t.set("left",this.left+e).set("top",this.top+n)})}translateX(t){return this.set("left",this.left+t)}translateY(t){return this.set("top",this.top+t)}scale(t,e){return this.withMutations(n=>{e||(e=t),n.set("left",this.left*t).set("top",this.top*e).set("width",this.width*t).set("height",this.height*e)})}grow(t){return this.withMutations(e=>{e.set("left",this.left-t).set("top",this.top-t).set("width",this.width+2*t).set("height",this.height+2*t)})}getLocation(){return new $a({x:this.left,y:this.top})}getSize(){return new qa({width:this.width,height:this.height})}getCenter(){return new $a({x:this.left+this.width/2,y:this.top+this.height/2})}setLocation(t){return this.withMutations(e=>{e.set("left",t.x).set("top",t.y)})}roundOverlap(){return this.withMutations(t=>{t.set("left",Math.floor(this.left)).set("top",Math.floor(this.top)).set("width",Math.ceil(this.width)).set("height",Math.ceil(this.height))})}round(){return this.withMutations(t=>{t.set("left",Math.round(this.left)).set("top",Math.round(this.top)).set("width",Math.round(this.width)).set("height",Math.round(this.height))})}isPointInside(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom}isRectInside(t){return this.isPointInside(t.getLocation())&&this.isPointInside(t.getLocation().translate(new $a({x:t.width,y:t.height})))}isRectOverlapping(t){return t.left<this.right&&t.right>this.left&&t.top<this.bottom&&t.bottom>this.top}normalize(){return this.withMutations(t=>t.set("left",this.width<0?this.left+this.width:this.left).set("top",this.height<0?this.top+this.height:this.top).set("width",Math.abs(this.width)).set("height",Math.abs(this.height)))}apply(t){const[e,n]=t.applyToPoint([this.left,this.top]),[r,i]=t.applyToVector([this.width,this.height]);return this.withMutations(t=>t.set("left",e).set("top",n).set("width",r).set("height",i)).normalize()}}La=Ha,l(Ha,"defaultValues",{left:0,top:0,width:0,height:0}),Ca(La);class Wa extends Na{constructor(t){if(super(t),this.constructor===Wa)throw new r("NutrientViewer.Annotations.Annotation is an abstract base class and can not be instantiated")}}Ua=Wa,l(Wa,"defaultValues",{id:null,name:null,subject:null,pdfObjectId:null,pageIndex:null,boundingBox:new Ha,opacity:1,action:null,note:null,creatorName:null,createdAt:new Date,updatedAt:new Date,customData:null,enrichment:void 0,noPrint:!1,noZoom:!1,noRotate:!1,noView:!1,locked:!1,lockedContents:!1,readOnly:!1,hidden:!1,blendMode:"normal",additionalActions:null,isCommentThreadRoot:!1,isAnonymous:!1,group:void 0,isEditable:void 0,isDeletable:void 0,canSetGroup:void 0,canReply:void 0,APStreamCache:void 0,rotation:0}),Ca(Ua);const Ja="__isSharedPushButtonOccurrence";class Ka extends Wa{}Ba=Ka,l(Ka,"defaultValues",{formFieldName:null,borderColor:null,borderStyle:null,borderDashArray:null,borderWidth:null,backgroundColor:null,fontSize:null,font:null,isBold:!1,isItalic:!1,fontColor:null,horizontalAlign:null,verticalAlign:null,additionalActions:null,lineHeightFactor:null,lineSpacing:null,widgetAttachmentId:null,contentType:null,buttonIconUpdatedAt:null}),l(Ka,"readableName","Widget"),Ca(Ba);const Va="_pspdfkit_shared_push_button_occurrence",Ga="/save.pdf",Ya="/embedded.pdf",Xa="WebAssembly module not loaded.";let Za=null,Qa=!1,ts=!1,es=null;const ns={password:void 0,initialPageIndex:void 0};let rs=[],is=ns,os=null,as=null;const ss=new Set,us="/fonts";let cs="";const ls=new Set,fs=new Map,hs={amp:"&",apos:"\'",gt:">",lt:"<",nbsp:" ",quot:\'"\'};function ps(t){return t.replace(/<[^>]*>/g,"").replace(/&(#x[\\da-f]+|#\\d+|[a-z]+);/gi,(t,e)=>{if("#"===e[0]){const n="x"===e[1].toLowerCase()?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return Number.isInteger(n)&&n>=0&&n<=1114111?String.fromCodePoint(n):t}return hs[e.toLowerCase()]??t})}let ds=!1;var ms=function(t){return t[t.Daemon=0]="Daemon",t[t.WASM=1]="WASM",t}(ms||{});const gs=[];const ys=["configurePDFJavaScriptSupport","closeDocument","setFormValues","openDocument","saveDocument","importXFDF","importInstantDocumentJSON"],_s={annotationsAndForms:"annotations_and_forms",assemble:"assemble",extract:"extract",extractAccessibility:"extract_accessibility",fillForms:"fill_forms",modification:"modification",printHighQuality:"print_high_quality",printing:"printing"};function vs(t){i(Za,"WebAssembly module not loaded."),ds&&performance.mark("exec");for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];const o=n.map(t=>function(t){return Array.isArray(t)&&0===t.length}(t)?JSON.stringify(t):t);ys.includes(t)&&Ls();const a=Za[t](...o)||\'{ "success": true }\',s=JSON.parse(a);if(ds&&gs.push({type:ms.WASM,name:t,args:o,time:performance.measure("exec - RECORD_CALLS","exec").duration}),!s.success){const t=new Error(s.error);throw"string"==typeof s.errorCode&&(t.errorCode=s.errorCode),"string"==typeof s.dediconXml&&(t.dediconXml=s.dediconXml),t}return s}const ws=["run_pdf_formatting_scripts","run_pdf_javascript","set_form_values_get_script_changes","edit_document","prepare_sign","sign","on_keystroke_event","save_document","update_annotation","import_document_json"];function bs(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;i(Za,"WebAssembly module not loaded.");const r=JSON.stringify({type:t,...e});let o;if(ds&&performance.mark("daemonExec"),ws.includes(t)&&Ls(),n)try{const t="string"==typeof n?new Uint8Array((a=n,(new TextEncoder).encode(a).buffer)):new Uint8Array(n),e=Za.allocateMemory(t.byteLength);try{e.view.set(t);const n=Za.memoryHandleToVector(e);try{o=Za.dispatchCommandWithBinary(r,n)}finally{n.delete()}}finally{e.delete()}}catch(t){throw t}else o=Za.dispatchCommand(r);var a;if(o.hasError()){const e=new Error(o.getErrorMessage()||"There was an error while executing the command: "+t);throw o.delete(),e}const s=[];for(let t=0;t<o.getRepliesCount();t++)o.hasJSONReply(t)&&s.push(JSON.parse(o.getJSONReply(t))),o.hasBinaryReply(t)&&s.push(o.getBinaryReply(t).slice(0));return ds&&gs.push({type:ms.Daemon,name:t,args:[r],time:performance.measure("daemonExec: RECORD_CALLS","daemonExec").duration}),o.delete(),s}function Ss(t){try{const e=(new TextDecoder).decode(t);return JSON.parse(e)}catch(t){throw t}}function Os(t,e){return`${t}/${e}.pdf`}async function Is(t,e){const n=Math.random().toString(36).slice(-5),r=await Promise.all(Object.entries(e).map(async e=>{let[r,i]=e;return t.forEach(t=>{"document"in t&&t.document===r&&"importDocument"===t.type?(!1===t.treatImportedDocumentAsOnePage&&(t.treatImportedDocumentAsOnePage=void 0),t.document=Os(n,r)):("dataFilePath"in t&&t.dataFilePath===r&&"applyInstantJson"===t.type||"dataFilePath"in t&&t.dataFilePath===r&&"applyXfdf"===t.type)&&(t.dataFilePath=Os(n,r))}),{basename:r,buffer:await Oe(i)}}));return r.forEach(t=>{!function(t,e,n){i(Za,Xa),Za.FS.analyzePath(t).exists||Za.FS.mkdir(t),Za.FS.writeFile(Os(t,e),n)}(n,t.basename,t.buffer)}),function(){r.forEach(t=>{!function(t,e){i(Za,Xa),Za.FS.unlink(Os(t,e))}(n,t.basename)})}}function Es(){ts=!0;const t=vs("configurePDFJavaScriptSupport",!0);return i(t.success,"An error occurred while executing the document level JavaScript."),t.changes||[]}function xs(t,e){try{bs("edit_document",{save_path:e,operations:t})}catch(t){throw new Error(`Error applying operations to document: ${t.message}`)}}const As="standalone_expand_shared_push_button_occurrences";let Ds=null,Fs={},Ps={},Ms=!1,Ts=!1;function ks(t,e){return`${t}:${e}`}function js(t){return"string"==typeof t&&"object"==typeof Fs[t]}function zs(t){if(js(t))throw new Error(On)}function Cs(t){const e="formField"in t?t.formField.annotationIds:t.annotationIds;return e?.some(t=>js(t))??!1}function Ns(){Fs={},Ps={}}function Rs(t){return bs("read_form_json_objects",{include_line_height_factor:!1,[As]:t.expandSharedPushButtonOccurrences})}function Ls(){Ms||(Ds=null,Ts=!1,Ns())}function Us(t){Ms&&!t&&(Ms=!1,Ds&&$s(Ds)),Ms=t}function Bs(){var t;return null===Ds&&(t=Rs({expandSharedPushButtonOccurrences:!0}),Ns(),Ds=t.map(t=>({...t,widgets:t.widgets.map(t=>{const e=t[Va],{[Va]:n,...r}=t;return e&&t.id?(Fs[t.id]=e,Ps[ks(e.pageIndex,e.pdfObjectId)]=t.id,{...r,pdfObjectId:e.pdfObjectId,[Ja]:!0}):r})})),Ts=!1),Ds}function $s(t){if(Ms){if(null===t)throw Ms=!1,new Error("Error enqueuing form JSON objects: form fields JSON is null.");return Ds&&!Ts&&(Ts=!0),void(Ds=t)}if(Ts||!Ms)try{const e=function(t){if(!t.some(Cs))return t;const e=Rs({expandSharedPushButtonOccurrences:!1}),n=new Map(e.map(t=>[t.formField.name,t]));return t.map(t=>{if(!Cs(t))return t;const e=Ds?.find(e=>e.formField.name===t.formField.name);if(e&&JSON.stringify(e)!==JSON.stringify(t))throw new Error(On);const r=n.get(t.formField.name);if(!r)throw new Error(`Error applying form JSON objects to ${wn}: canonical shared push-button form field "${t.formField.name}" not found.`);return r})}(t);Ls(),bs("apply_form_json_objects",{form_fields_with_widgets:e})}catch(t){throw new Error("Error applying form JSON objects to "+wn+": "+t.message)}}function qs(t,e,n,r,o,a,s){const u=Ws(o,{width:n,height:r});if(i("number"==typeof t.pageIndex,"Annotation must have a pageIndex"),!ss.has(t.pdfObjectId))try{i("number"==typeof t.pdfObjectId,"Cannot call renderAnnotation() for an annotation without pdfObjectId.");const e=bs("render_annotation",{page:t.pageIndex,annotation_id:t.pdfObjectId,format:u,bitmap_width:n,bitmap_height:r,appearance_stream_type:a||"normal",render_form_highlight:s??!0});if("bitmap"===u)return e[0];{const t=new Blob([e[0]],{type:`image/${u}`});return URL.createObjectURL(t)}}catch(t){return void 0}}const Hs={SharePoint:"SPO",Salesforce:"SF",[Ee]:"MauiIOS",[Ie]:"MauiAndroid",[xe]:"MauiMacCatalyst",[Ae]:"MauiWindows",[De]:"FlutterForWeb",NodeJS:"NodeJS",Electron:"Electron"};function Ws(t,e){let{width:n,height:r}=e;return"webp"===t&&(n>16383||r>16383)||gn&&n*r>16777216&&"bitmap"===t?"png":t}function Js(t){return t.map(t=>_s[t])}function Ks(t,e){return t.pdfObjectId===e.pdfObjectId}const Vs="nutrient",Gs=".lease.json";function Ys(t){return`${t}${Gs}`}function Xs(t){return t.endsWith(Gs)}class Zs{constructor(){l(this,"_sessionId",null),l(this,"_accessHandle",null),l(this,"_dirHandle",null),l(this,"_fileSize",0),l(this,"_writeCount",0),l(this,"_readCount",0),l(this,"_leaseCreatedAt",null),l(this,"_leaseHeartbeatTimer",null),l(this,"_pendingLeaseWrite",null)}get sessionId(){return this._sessionId}get fileSize(){return this._fileSize}static async checkCapability(){if(this._capabilityCache?.available)return this._capabilityCache;try{if(!navigator.storage?.getDirectory){const t={available:!1,reason:"OPFS API not available"};return this._capabilityCache=t,t}const t=await navigator.storage.getDirectory(),e=await t.getDirectoryHandle(Vs,{create:!0}),n=await e.getFileHandle(".capability-test",{create:!0});(await n.createSyncAccessHandle()).close(),await e.removeEntry(".capability-test");const r={available:!0};return this._capabilityCache=r,r}catch(t){return{available:!1,reason:t instanceof DOMException?t.message:String(t)}}}static async cleanupOrphans(){try{if(!navigator.storage?.getDirectory)return;const t=await navigator.storage.getDirectory();let e;try{e=await t.getDirectoryHandle(Vs)}catch{return}const n=[];for await(const t of e.keys())n.push(t);for(const t of n)if(Xs(t))try{const n=await this.readLease(e,t);if(!n)continue;if(Date.now()-n.lastHeartbeatAt<this.leaseConfig.staleTimeoutMs)continue;await this.removeEntryIfPresent(e,n.fileName),await this.removeEntryIfPresent(e,t)}catch(e){a(`OPFS orphan cleanup: failed to clean ${t}: ${e}`)}}catch(t){a(`OPFS orphan cleanup failed: ${t}`)}}static async readLease(t,e){try{const n=await t.getFileHandle(e),r=await n.getFile(),i=await r.text(),o=JSON.parse(i);return"string"!=typeof o?.sessionId||"string"!=typeof o?.fileName||"number"!=typeof o?.createdAt||"number"!=typeof o?.lastHeartbeatAt?(a(`OPFS orphan cleanup: invalid lease contents in ${e}`),null):{version:1,sessionId:o.sessionId,fileName:o.fileName,createdAt:o.createdAt,lastHeartbeatAt:o.lastHeartbeatAt}}catch(t){return a(`OPFS orphan cleanup: failed to read lease ${e}: ${t}`),null}}static async removeEntryIfPresent(t,e){try{await t.removeEntry(e)}catch(t){if(t instanceof DOMException&&"NotFoundError"===t.name)return;throw t}}getDataFileName(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._sessionId;return i(t,"OPFSStorageManager: not initialized"),`${t}.pdf`}getLeaseFileName(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._sessionId;return i(t,"OPFSStorageManager: not initialized"),Ys(t)}async writeLease(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();i(this._dirHandle,"OPFSStorageManager: directory not initialized"),i(this._sessionId,"OPFSStorageManager: session not initialized");const e=this._leaseCreatedAt??t;this._leaseCreatedAt=e;const n=await this._dirHandle.getFileHandle(this.getLeaseFileName(),{create:!0}),r=await n.createWritable();try{const n={version:1,sessionId:this._sessionId,fileName:this.getDataFileName(),createdAt:e,lastHeartbeatAt:t};await r.write(JSON.stringify(n))}finally{await r.close()}}startLeaseHeartbeat(){this.stopLeaseHeartbeat(),this._leaseHeartbeatTimer=setInterval(()=>{this._pendingLeaseWrite=this.writeLease().catch(t=>{a(`OPFS storage: failed to refresh lease: ${t}`)}).finally(()=>{this._pendingLeaseWrite=null})},Zs.leaseConfig.heartbeatIntervalMs)}stopLeaseHeartbeat(){null!==this._leaseHeartbeatTimer&&(clearInterval(this._leaseHeartbeatTimer),this._leaseHeartbeatTimer=null)}async init(t){const e=await Zs.checkCapability();if(!e.available)return a(`OPFS storage unavailable: ${e.reason}. Falling back to memory.`),!1;try{const e=await navigator.storage.estimate(),n=(e.quota??0)-(e.usage??0);if(n<t)return a(`OPFS storage: insufficient space (need ${t} bytes, ~${n} available). Falling back to memory.`),!1}catch(t){return a(`OPFS storage: quota check failed: ${t}. Falling back to memory.`),!1}try{this._sessionId=nn();const t=await navigator.storage.getDirectory();this._dirHandle=await t.getDirectoryHandle(Vs,{create:!0});const e=await this._dirHandle.getFileHandle(this.getDataFileName(),{create:!0});this._accessHandle=await e.createSyncAccessHandle()}catch(t){return a(`OPFS storage: failed to create file: ${t}. Falling back to memory.`),await this.close(),!1}try{if(!this._accessHandle)throw new Error("OPFSStorageManager: access handle not initialized");this._accessHandle.truncate(t),this._fileSize=t,this._writeCount=0,this._readCount=0,await this.writeLease(),this.startLeaseHeartbeat()}catch(e){return e instanceof DOMException&&"QuotaExceededError"===e.name?a(`OPFS storage: quota exceeded during pre-allocation (${t} bytes). Falling back to memory.`):a(`OPFS storage: pre-allocation failed: ${e}. Falling back to memory.`),await this.close(),!1}return!0}writeChunk(t,e){i(this._accessHandle,"OPFSStorageManager: not initialized"),i(e>=0&&e+t.byteLength<=this._fileSize,`OPFSStorageManager: write out of bounds (offset=${e}, size=${t.byteLength}, fileSize=${this._fileSize})`),this._accessHandle.write(t,{at:e}),this._writeCount+=1}read(t,e){i(this._accessHandle,"OPFSStorageManager: not initialized"),i(t>=0&&e>=0&&t+e<=this._fileSize,`OPFSStorageManager: read out of bounds (offset=${t}, size=${e}, fileSize=${this._fileSize})`);const n=new Uint8Array(e),r=this._accessHandle.read(n,{at:t});return this._readCount+=1,r<e?(bn("read: short read",{sessionId:this._sessionId,offset:t,requested:e,bytesRead:r,readCount:this._readCount,fileSize:this._fileSize}),n.subarray(0,r)):n}getSize(){return i(this._accessHandle,"OPFSStorageManager: not initialized"),this._accessHandle.getSize()}getUid(){return i(this._sessionId,"OPFSStorageManager: not initialized"),`opfs:/nutrient/${this._sessionId}.pdf`}async close(){const t=this._accessHandle,e=this._dirHandle,n=this._sessionId;if(t||e||n){if(this.stopLeaseHeartbeat(),this._pendingLeaseWrite&&(await this._pendingLeaseWrite.catch(()=>{}),this._pendingLeaseWrite=null),this._accessHandle=null,this._dirHandle=null,this._sessionId=null,this._fileSize=0,this._writeCount=0,this._readCount=0,this._leaseCreatedAt=null,t)try{t.close()}catch(t){a(`OPFS storage: error closing access handle: ${t}`)}if(e&&n){try{await Zs.removeEntryIfPresent(e,`${n}.pdf`)}catch(t){a(`OPFS storage: error removing file: ${t}`)}try{await Zs.removeEntryIfPresent(e,Ys(n))}catch(t){a(`OPFS storage: error removing lease: ${t}`)}}}}}function Qs(t,e){const n=WebAssembly.Exception;if(n&&e instanceof n){const n=e.message?`: ${e.message}`:"";throw new Error(`${t} failed${n}`)}throw e}l(Zs,"_capabilityCache",null),l(Zs,"leaseConfig",{heartbeatIntervalMs:3e4,staleTimeoutMs:72e5});const tu="CoreClient",eu="CoreLifecycle";const nu=new class{constructor(){l(this,"_pdfObjectIdsForIds",{}),l(this,"onloadedFn",null),l(this,"_corePDFAccess",null),l(this,"comparisonDocuments",{}),l(this,"lastOpenedComparisonDocument",null),l(this,"persistedOpenDocument",null),l(this,"persistedOpenDocumentConfiguration",ns)}setCorePDFAccess(t){this._corePDFAccess=t}loadNativeModule(t,e){let{disableWebAssemblyStreaming:n,enableAutomaticLinkExtraction:r,overrideMemoryLimit:i}=e;return os=Date.now(),Qa=r,es=i,Se(t,n).then(t=>{let{nativeModule:e}=t;Za=e,this.onloadedFn&&this.onloadedFn(Za);const n=vs("PSPDFKitVersion").version;if(1!==n)throw new Error(`Native version mismatch. Please update the dependencies. Expected 1 but got ${n}.`)})}async load(t,e,n){let r,{mainThreadOrigin:a,customFonts:s,dynamicFonts:u,productId:c,featureFlags:l}=n;i(Za,Xa);try{if(Za.FS.analyzePath(us).exists||Za.FS.mkdir(us),cs=s?`${us}/custom-fonts`:"",s&&!Za.FS.analyzePath(cs).exists&&function(t,e){i(Za,Xa),Za.FS.analyzePath(e).exists||Za.FS.mkdir(e),Za.FS.mount(Za.FS.filesystems.WORKERFS,{blobs:t},e)}(s,cs),vn()&&(i(null==c||c===Fe,`PSPDFKit is running on Electron, but has been setup to be used with ${c}Please contact support to resolve the issue.`),c=Fe),r=Za.initPSPDFKit(null==e?"":e,a,us,"",c&&void 0!==Hs[c]?Hs[c]:"",JSON.stringify(l??[])),u){const t=await cn(u);bs("dynamic_font_loading/set_metadata_file",void 0,await t.arrayBuffer()),as=u.split("/").slice(0,-1).join("/")}}catch(t){throw t}const f=JSON.parse(r);if(os&&o(`Native initialization complete, took: ${Date.now()-os}ms`),!f.success)throw new Error("Failed to initialize PSPDFKit: "+f.error);return f}getNativeModule(){return Za}async openDocument(t,e){try{return i(Za,Xa),null!==es&&vs("overrideMemoryLimit",es),Za.FS.writeFile(wn,new Uint8Array(t),{canOwn:!0}),this.openAndReturnDocumentInfo(e??ns)}catch(t){try{Za?.FS.unlink(wn)}catch{}throw t}finally{this._pdfObjectIdsForIds={},Ns()}}async openCreateFilePathDocument(t){try{return null!==es&&vs("overrideMemoryLimit",es),this.openAndReturnDocumentInfo(t??ns)}finally{this._pdfObjectIdsForIds={},Ns()}}async openDocumentWithOPFS(t){i(Za,Xa),i(this._corePDFAccess,"CorePDFAccess not initialized"),null!==es&&vs("overrideMemoryLimit",es);const e=this._corePDFAccess.opfsStorageManager;i(e,"OPFS storage manager not available");const n=new Sn(e),r=n.createEmbindProvider(Za);this._corePDFAccess.retainOpenDocumentOPFSProvider(n,r);try{is=t??ns;const e=Za.openDocumentWithDataProvider(r,JSON.stringify(is)),n=JSON.parse(e);if(!n.success){a(`OPFS storage: openDocumentWithDataProvider failed: ${n.error}`);const t=new Error(n.error);throw"string"==typeof n.errorCode&&(t.errorCode=n.errorCode),"string"==typeof n.dediconXml&&(t.dediconXml=n.dediconXml),t}return Ls(),this.getDocumentInfoAfterOpen(is)}catch(t){throw this._corePDFAccess.releaseOpenDocumentOPFSProvider(),t}finally{this._pdfObjectIdsForIds={},Ns()}}async getSuggestedLineHeightFactor(t,e){return bs("get_suggested_line_height_factor",{annotation_ids:[t],page:e})[0].line_height_factors[t.toString()]}async getAvailableFontFaces(t){if(!t)return[];const e=bs("get_available_font_faces");return e[0]?.font_faces.reduce((e,n)=>{const r=t.find(t=>t.name===n.path.replace(`${cs}/`,""));return r?e.concat({readableName:n.fullName,name:r.name}):e},[])}async setFontSubstitutions(t){try{bs("set_font_substitutions",{substitutions:t})}catch(t){throw new Error("Error setting fonts substitutions: "+t.message)}}async getClosestSnapPoint(t,e){return bs("get_closest_snap",{q:[t,e]})[0]}async configureSnapper(t){bs("configure_snapper",{page:t})}async reloadDocument(){try{return Us(!1),vs("closeDocument"),this.openAndReturnDocumentInfo(is)}finally{this._pdfObjectIdsForIds={}}}async getDocumentInfoAfterOpen(t){ts&&Es(),bs(Qa?"enable_automatic_link_extraction":"disable_automatic_link_extraction");const e=Ss(bs("document_info",{requested_info:["ID"]})[0]);if(e.pageCount<=0)return e;let n=[];if("number"==typeof t?.initialPageIndex){const r=await this.getPageInfo(t.initialPageIndex);for(let i=0;i<e.pageCount;i++){const e={...r,pageIndex:i,pageLabel:t.initialPageIndex===i?r.pageLabel:String(i+1)};n.push(e)}}else n=await this.getAllPageInfos(e.pageCount);return e.pages=n,e}async openAndReturnDocumentInfo(t){return is=t,vs("openDocument",wn,JSON.stringify(t)),this.getDocumentInfoAfterOpen(t)}async getPageInfo(t){try{const e=bs("page_info",{query:"page_info",page:t});i(1===e.length,"expected page_info result to return 1 result when specifying index.");const n=(new TextDecoder).decode(e[0]);return JSON.parse(n).pageInfo}catch{return s(`Dimensional information for page ${t} unavailable, page will not be displayed.`),{height:0,matrix:[0,0,0,0,0,0],pageLabel:"",reverseMatrix:[0,0,0,0,0,0],transformedBBox:[0,0,0,0],untransformedBBox:[0,0,0,0],width:0,pageIndex:t,rawPdfBoxes:{bleedBox:null,cropBox:null,mediaBox:null,trimBox:null}}}}async preflightRenderAnnotationText(t,e,n,r){const o=()=>"number"==typeof e&&"number"==typeof n?bs("dynamic_font_loading/preflight_annotation",{text:t,annotation_id:e,page:n})[0]:(i(r,`annotation not set: ${r}`),bs("dynamic_font_loading/preflight_annotation",{text:t,annotation_json:r})[0]);try{let t=o();t.preflight_result===Me&&(await this.addDynamicFonts(t.required_fonts),t=o()),"number"==typeof e&&(t.preflight_result===Pe?ss.add(e):ss.delete(e))}catch(n){s(`There was an error testing rendering for annotation ${e} of this text: ${t}: ${n.message}`)}}async addDynamicFonts(t){const e=[],n=[];for(const r of t){if(ls.has(r))continue;const t=fs.get(r);t?e.push(t):n.push(r)}if(0===n.length)return void await Promise.all(e);const r=(async()=>{try{!function(t){i(Za,Xa),t.forEach(t=>{Za.FS.analyzePath(`${us}/${t.name}`).exists||Za.FS.writeFile(`${us}/${t.name}`,new Uint8Array(t.data))})}((await Promise.all(n.map(t=>fetch(`${as}/${t}`).then(t=>t.arrayBuffer())))).map((t,e)=>({name:n[e],data:t}))),n.forEach(t=>{ls.add(t)}),await bs("dynamic_font_loading/notify_fonts_added",{added_fonts:n.map(t=>({remote_file_path:t,local_file_name:t}))})}catch(t){throw n.forEach(t=>{ls.delete(t)}),s(`There was an error loading a font: ${t}`),t}finally{n.forEach(t=>{fs.delete(t)})}})();n.forEach(t=>{fs.set(t,r)}),e.push(r),await Promise.all(e)}async getAllPageInfos(t){const e=[];try{const n=bs("page_info",{query:"page_info",page:"all"});i(n.length===t,"expected the same length of page info response to page count.");for(let t=0;t<n.length;t++){const r=(new TextDecoder).decode(n[t]),i=JSON.parse(r);e.push(i.pageInfo)}}catch{s("There was an error retrieving page information for all pages from core. Reverting to individual queries.");for(let n=0;n<t;n++)try{const t=bs("page_info",{query:"page_info",page:n});i(1===t.length,"expected page_info result to return 1 result when specifying index.");const r=(new TextDecoder).decode(t[0]),o=JSON.parse(r);e.push(o.pageInfo)}catch{s(`Dimensional information for page ${n} unavailable, page will not be displayed.`);const t={height:0,matrix:[0,0,0,0,0,0],pageLabel:"",reverseMatrix:[0,0,0,0,0,0],transformedBBox:[0,0,0,0],untransformedBBox:[0,0,0,0],width:0,pageIndex:n,rawPdfBoxes:{bleedBox:null,cropBox:null,mediaBox:null,trimBox:null}};e.push(t)}}return e}async enablePDFJavaScriptSupport(){return Es()}async runPDFFormattingScripts(t,e){let n;i(ts,"PDF Formatting Scripts can only run after JavaScript is enabled.");try{n=bs("run_pdf_formatting_scripts",{form_fqns:t,only_if_no_ap_stream:e})}catch(t){throw new Error("An error occurred while executing the document level JavaScript formatting.\\n\\n"+t.message)}return n[0].changes||[]}async openDocumentAt(){throw new Error("Should never be called")}async getBookmarks(){const t=bs("get_bookmarks");return i(1===t.length,"expected only one response for getBookmarks"),t[0].bookmarks||[]}async getFormJSON(){return bs("get_form_json")[0]}async getFormValues(){return bs("get_form_values")}async setFormValues(t){const e=Bs();let n=!1;const r=[],i=e.map(e=>{const i=t.find(t=>t.name===e.formField.name);return i?i.value===e.value||Array.isArray(i.value)&&Array.isArray(e.value)&&i.value.every((t,n)=>t===e.value[n])?e:("string"==typeof i.value&&i.value.length>0?r.push({widgets:e.widgets,text:i.value}):e.widgets.forEach(t=>{"number"==typeof t.pdfObjectId&&ss.delete(t.pdfObjectId)}),n=!0,{...e,value:i.value}):e});if(n){if(as)for(let t=0;t<r.length;t++){const e=r[t].widgets;for(let n=0;n<e.length;n++)await this.preflightWidgetAnnotation(e[n],e[n].pdfObjectId,r[t].text)}$s(i)}}async setFormFieldValue(t){await this.setFormValues([t])}async applyOperations(t,e){const n=await Is(t,e);xs(t,wn),n()}async exportPDFWithOperations(t,e){const n=await Is(t,e);let r;i(Za,Xa);try{xs(t,Ga),r=Za.FS.readFile(Ga).buffer}catch(t){throw new Error("Error applying operations: "+t.message)}return n(),r}async getSignaturesInfo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signing_time";try{return bs("get_signatures",{certificate_check_time:t})[0]}catch(t){throw new Error(`Error getting signatures info: ${t.message}`)}}async getComments(){try{return bs("get_comments")}catch(t){throw new Error(`Error getting comments: ${t.message}`)}}async applyComments(t){try{return bs("apply_comments",{comments:t})}catch(t){throw new Error(`Error applying comments: ${t.message}`)}}async prepareSign(t,e,n,r,o,a){let s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"signing_time";const c=!1,l=!1;try{s=bs("get_signatures",{certificate_check_time:u})[0];const t="not_signed"!==s.status;bs("save_document",{file_path:Ga,flatten_annotations:!1,save_incrementally:t,apply_redactions:c,save_for_printing:l,format:"pdf",preserve_change_tracker_state:!1}),vs("openDocument",Ga,JSON.stringify(is))}catch(t){throw new Error(`Error saving document backup for invisible signing: ${t}`)}try{const t=!n&&"not_signed"!==s.status;bs("save_document",{file_path:wn,flatten_annotations:n,save_incrementally:t,apply_redactions:c,save_for_printing:l,format:"pdf",preserve_change_tracker_state:!1}),n&&(vs("openDocument",wn,JSON.stringify(is)),ts&&Es())}catch(t){throw new Error(`Error saving document for invisible signing: ${t}`)}let f;try{f=bs("prepare_sign",{signer_data_source:{...t,field_name:r,position:o,appearance:a,type:"pspdfkit/signer-data-source"},signature_metadata:{...e,type:"pspdfkit/signature-metadata"}})}catch(t){throw new Error(`Error preparing document for signing: ${t}`)}i(Za,Xa);let h=null;return t&&t?.signatureType!==un||(h=Za.FS.readFile(f[0].result.file_contents).buffer),Za.FS.unlink(f[0].result.file_contents),{file:f[0].result.file,hash:f[0].result.hash,signatureFormFieldName:f[0].result.signature_form_fqn,dataToBeSigned:f[0].result.data_to_be_signed,fileContents:h}}async getTimestampRequest(t,e){try{const[n]=bs("get_timestamp_http_request",{timestamp_authority_info:{url:e.url,authenticationInfo:{username:e.username,password:e.password}},data_to_timestamp:t});return{url:n.url,method:n.method,requestData:n.request_data,contentType:n.content_type,token:n.token,username:n.user,password:n.password}}catch(t){throw new Error(`Error getting timestamp request: ${t.message}`)}}async getRevocationRequests(t){try{return bs("get_revocation_http_requests",{signing_certificates:t})}catch(t){throw new Error(`Error getting revocations requests: ${t.message}`)}}async setSignaturesLTV(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"signing_time";try{const n=bs("get_signatures",{certificate_check_time:e,revocation_responses:t})[0];return bs("save_document",{file_path:wn,flatten_annotations:!1,save_incrementally:!0,apply_redactions:!1,save_for_printing:!1,format:"pdf",preserve_change_tracker_state:!1}),n}catch(t){throw new Error(`Error getting signatures info: ${t.message}`)}}async sign(t,e,n,r,i,o,a,s,u){let c;try{let l;const f=ce(i).buffer,h=a?"pkcs7"===a:function(t){try{const e=new Uint8Array(t);if(!e.length)return!1;if(48!==e[0])return!1;const n=fn(e,1);if(!n)return!1;const r=n.nextOffset,i=r+n.length;if(i>e.length)return!1;if(6!==e[r])return!1;const o=fn(e,r+1);if(!o||o.length!==ln.length)return!1;const a=o.nextOffset,s=a+o.length;if(s>i)return!1;for(let t=0;t<ln.length;t++)if(e[a+t]!==ln[t])return!1;if(s>=i||160!==e[s])return!1;const u=fn(e,s+1);if(!u)return!1;const c=u.nextOffset,l=c+u.length;if(l>i)return!1;if(c>=l||48!==e[c])return!1;const f=fn(e,c+1);return!!f&&!(f.nextOffset+f.length>l)}catch(t){throw new Error(`Error checking if the signature is in PKCS#7 format: ${t.message}`)}}(f);h||(l=bs("create_signature",{signatureType:r,hash:n,signed_data:i,certificates:o,timestamp_response:s})),c=bs("sign",{password:is?.password,save_path:wn,file_path:t,signature_form_fqn:e,pkcs7_container:l?.[0].result||i,revocation_responses:u??[]}),vs("openDocument",wn,JSON.stringify(is)),ts&&Es()}catch(t){throw new Error(`Error signing document: ${t}`)}return c[0].result}async restoreToOriginalState(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signing_time";try{vs("openDocument",Ga,JSON.stringify(is)),ts&&Es();const e="not_signed"!==bs("get_signatures",{certificate_check_time:t})[0].status;bs("save_document",{file_path:wn,flatten_annotations:!1,save_incrementally:e,apply_redactions:!1,save_for_printing:!1,format:"pdf",preserve_change_tracker_state:!1}),vs("openDocument",wn,JSON.stringify(is)),ts&&Es()}catch(t){throw new Error(`Could not restore backup document: ${t}`)}}async evalFormValuesActions(t){const e=Bs().reduce((e,n)=>t.find(t=>{let{name:e}=t;return n.formField.name===e})&&"pspdfkit/form-field/text"===n.formField.type?e.concat(n):e,[]);if(as)for(let n=0;n<e.length;n++){const r=e[n].widgets,i=t.find(t=>e[n].formField.name===t.name)?.value;for(let t=0;t<r.length;t++)await this.preflightWidgetAnnotation(r[t],r[t].pdfObjectId,i)}const n=bs("set_form_values_get_script_changes",{form_values:t});return i(1===n.length,"expected only one response for evalFormValuesActions"),this._processChanges(n[0].changes)}async readFormJSONObjects(){return Bs()}async setFormJSONUpdateBatchMode(t){await Us(t)}_processChanges(t){return t.map(t=>"pspdfkit/javascript/effects/importIcon"===t.object.type?{...t,object:{...t.object,id:Object.entries(this._pdfObjectIdsForIds).find(e=>{let[,n]=e;return n===t.object.annotationID})?.[0]}}:t)}async evalScript(t,e,n){const r=bs("run_pdf_javascript",{pdf_javascript_contents:t,pdf_javascript_trigger_event:e,pdf_javascript_form_fqn:n});return i(1===r.length,"expected only one response for evalScript"),this._processChanges(r[0].changes)}async closeDocument(){try{rs=[],is={password:void 0,initialPageIndex:void 0},ts=!1,Ds=null,Ms=!1,Ts=!1,vs("closeDocument")}finally{await(this._corePDFAccess?.closeOPFSStorage()),this._pdfObjectIdsForIds={},Ns()}}async renderAnnotation(t,e,n,r,i,o,a){return qs({...t,pdfObjectId:this._getPdfObjectIdForObject(t)},e&&await Oe(e),n,r,i,o,a)}async renderPageAnnotations(t,e,n,r,i){return e.map((e,o)=>qs({pdfObjectId:e,pageIndex:t},0,n[o],r[o],Ws(i,{width:n[o],height:r[o]})))}async renderDetachedAnnotation(t,e,n,r,o){i(Za,Xa),!as||"pspdfkit/stamp"!==t.type&&"pspdfkit/text"!==t.type||await this.preflightAnnotation(t,t.pdfObjectId);const a=e?await Oe(e):null,s=e?e.type:null;return bs("render_annotation",{annotation_json:{...t,pdfObjectId:this._getPdfObjectIdForObject(t),pageIndex:0},format:o,bitmap_width:n,bitmap_height:r,content_type:s||void 0},a?a.buffer:void 0)[0]}async loadCertificates(t){if(bs("load_certificates",{certificates:t}).length>0)throw new r("Internal error while loading certificates")}async getAttachment(t){let e,n;const r=await this.getEmbeddedFilesList(),i=r?.map(t=>t.id),o=i?.includes(t);if(o)try{bs("extract_embedded_file",{id:t,file_path:Ya}),e=Za.FS.readFile(Ya).buffer}finally{Za.FS.analyzePath(Ya)?.exists&&Za.FS.unlink(Ya)}else{const r=bs("get_annotation_attachment",{attachment_id:t});n=r[0].encoding,e=r[1]}return[e,n]}async annotationsForPageIndex(t){try{const e=bs("get_annotations_for_page_index",{pageIndex:t})[0];return["rollover","down"].forEach(t=>{e.apstream_variants?.[t]?.forEach(n=>{const r=e.annotations.find(t=>t.pdfObjectId===n);r?r[t]=!0:e.annotations.push({pdfObjectId:n,[t]:!0})})}),e.annotations}catch(t){return[]}}async getTabOrder(t){try{null===Ds&&0===Object.keys(Ps).length&&Bs();return bs("get_annotation_tab_order",{page:t})[0].order.map(e=>{const n=Ps[ks(t,e)];if(n)return{id:n,pdfObjectId:Fs[n].pdfObjectId};const r=Object.entries(this._pdfObjectIdsForIds).find(t=>{let[n,r]=t;return r===e});return{id:r?.[0]||String(e),pdfObjectId:e}})}catch(t){return[]}}async setTabOrder(t,e){bs("set_annotation_tab_order",{page:t,order:e.map(t=>this._getPdfObjectIdForObject(t))})}async createAnnotation(t,e){i(Za,Xa),i("number"==typeof t.pageIndex,"Annotation must have a pageIndex");const n=t.pdfObjectId,r=e?await Oe(e):null;t&&this.canPreflightAnnotation(t)&&as&&await this.preflightAnnotation(t,void 0),"pspdfkit/widget"===t.type&&(Us(!1),Ls());const o=bs("add_annotation",{annotation:{...("pspdfkit/shape/ellipse"===t.type||"pspdfkit/shape/rectangle"===t.type)&&t.measurementScale?{...t,measurementBBox:t.bbox}:t,pdfObjectId:void 0}},r?r.buffer:void 0);"number"==typeof n&&"number"==typeof this._pdfObjectIdsForIds[n.toString()]&&delete this._pdfObjectIdsForIds[n.toString()];const a=o[0].annotation_id;return this._pdfObjectIdsForIds[t.id||a.toString()]=a,a}async updateAnnotation(t){"pspdfkit/widget"===t.type&&zs(t.id);const e={...t,pdfObjectId:this._getPdfObjectIdForObject(t)};if(i(e.id,"Annotation must have an ID"),i("number"==typeof e.pageIndex,"Annotation must have a pageIndex"),"pspdfkit/widget"===e.type){const t=Bs(),n="number"==typeof e.pdfObjectId?e.pdfObjectId.toString():e.id;$s(t.map(t=>t.formField.annotationIds.includes(n)||t.formField.annotationIds.includes(String(e.pdfObjectId))?{...t,widgets:t.widgets.map(t=>t.id===n||String(t.pdfObjectId)===n?e:t)}:t))}else t&&this.canPreflightAnnotation(t)&&as&&await this.preflightAnnotation(t,e.pdfObjectId),bs("update_annotation",{annotation:e})}async updateButtonIcon(t,e,n){zs(t.id),bs("update_annotation",{annotation:{...t,pdfObjectId:this._getPdfObjectIdForObject(t),contentType:n}},e)}async deleteAnnotation(t){if("pspdfkit/widget"===t.type&&zs(t.id),t.APStreamCache&&await this.updateAnnotation(t),"pspdfkit/widget"===t.type)try{const e=t.id;$s(Bs().map(n=>{if(n.formField.annotationIds.includes(e)||n.formField.annotationIds.includes(String(t.pdfObjectId))){let r,i=n.value;const o=n.formField.options;if(("pspdfkit/form-field/checkbox"===n.formField.type||"pspdfkit/form-field/radio"===n.formField.type)&&o&&o.length===n.formField.annotationIds.length){const a=n.formField.annotationIds.includes(e)?n.formField.annotationIds.indexOf(e):n.formField.annotationIds.indexOf(String(t.pdfObjectId));r=o.filter((t,e)=>e!==a),r.some(t=>t.value===i)||(i="")}const a=n.widgets.filter(t=>e!==t.id),s=n.formField.annotationIds.filter(n=>n!==e&&n!==String(t.pdfObjectId));return a.length>0&&s.length>0?{...n,formField:{...n.formField,annotationIds:s,...r?{options:r}:null},widgets:a,value:i}:null}return n}).filter(Boolean))}catch(t){throw t}else try{bs("remove_annotations",{annotation_ids:[this._getPdfObjectIdForObject(t)]})}catch{a(`Removing annotation failed for annotation: ${JSON.stringify(t)}`)}delete this._pdfObjectIdsForIds[t.id||t.pdfObjectId?.toString()],ss.delete(t.pdfObjectId)}async createFormField(t,e){const n=Bs().concat([{type:"pspdfkit/form-field-with-widgets",formField:t,widgets:e}]),r=Ms;Ms&&Us(!1),$s(n);const i=Bs();r&&Us(!0);const o=i.find(e=>e.formField.name===t.name);if(!o)throw new Error(`Error creating new form field in ${wn}: created form field not found. ${JSON.stringify({type:"pspdfkit/form-field-with-widgets",formField:t,widgets:e})}`);const a=o.widgets.map(t=>(this._pdfObjectIdsForIds[t.id]=t.pdfObjectId,t.pdfObjectId));return"number"==typeof t.pdfObjectId&&"number"==typeof this._pdfObjectIdsForIds[t.pdfObjectId.toString()]&&delete this._pdfObjectIdsForIds[t.pdfObjectId.toString()],this._pdfObjectIdsForIds[t.id||o.formField.pdfObjectId.toString()]=o.formField.pdfObjectId,a}async updateFormField(t,e){if(Cs(t))throw new Error(On);e.forEach(t=>{zs(t.id)});let n={...t,pdfObjectId:this._pdfObjectIdsForIds[t.id]||this._getPdfObjectIdForObject(t)};const r=Bs();let i=r.find(e=>Ks(e.formField,n)||e.formField.name===t.name);if(!i&&(i=r.find(e=>e.widgets.some(e=>t.annotationIds.includes(e.id)||"number"==typeof e.pdfObjectId&&t.annotationIds.includes(String(e.pdfObjectId)))),i)){const t=i.formField.pdfObjectId;"number"==typeof t?n={...n,pdfObjectId:t,annotationIds:i.formField.annotationIds}:i=void 0}if(!i)throw new Error(`Error updating form field with name "${t.name}" in ${wn}: form field not found. ${JSON.stringify(r)}`);const o=i.formField.name!==t.name;let a=null;if(o&&"pspdfkit/form-field/radio"===n.type){const i=t.name,o=r.find(t=>t.formField.name===i);o&&"pspdfkit/form-field/radio"===o.formField.type&&(n={...n,annotationIds:[...n.annotationIds,...o.formField.annotationIds],options:[...n.options,...o.formField.options]},e=[...e,...o.widgets],a=o)}$s(r.map(r=>{if(a&&a.formField.pdfObjectId===r.formField.pdfObjectId)return null;if(Ks(r.formField,n)||r.formField.name===t.name){const i={type:"pspdfkit/form-field-with-widgets",formField:{...r.formField,...n},widgets:e.reduce((t,e)=>[...t,{...r.widgets.find(t=>t.id===e.id||t.pdfObjectId===e.pdfObjectId),...e}],[]),...void 0!==r.value?{value:r.value}:null};return t.flags||delete i.formField.flags,i}return r}).filter(Boolean));const s=Bs().find(e=>e.formField.name===t.name);if(!s)throw new Error(`Error updating form field "${t.name}" in ${wn}: updated form field not found. ${JSON.stringify({type:"pspdfkit/form-field-with-widgets",formField:t,widgets:e})}`);s.formField.pdfObjectId!==n.pdfObjectId&&(this._pdfObjectIdsForIds[n.id]=s.formField.pdfObjectId),i?.widgets.forEach(t=>{e.some(e=>e.id===t.id)||delete this._pdfObjectIdsForIds[t.id]})}async deleteFormField(t){if(Cs(t))throw new Error(On);const e=Bs(),n=e.find(e=>e.formField.name===t.name);if(!n)return;$s(e.filter(e=>e.formField.name!==t.name));const r=Bs().find(e=>e.formField.name===t.name);if(r)throw new Error(`Error deleting form field with name "${t.name}" in ${wn}: form field still present. ${JSON.stringify(r)}`);n.widgets.forEach(t=>{delete this._pdfObjectIdsForIds[t.id]})}async deleteFormFieldValue(t){$s(Bs().map(e=>e.formField.name===t?{formField:e.formField,widgets:e.widgets,type:e.type}:e))}canPreflightAnnotation(t){return"pspdfkit/text"===t.type||"pspdfkit/stamp"===t.type}async preflightAnnotation(t,e){if(!this.canPreflightAnnotation(t))return;const n=function(t){if("pspdfkit/stamp"===t.type)return t.title;const e=t.text?.value;return"string"!=typeof e?e:"xhtml"===t.text?.format?ps(e):e}(t);"number"!=typeof e||n?n&&await this.preflightRenderAnnotationText(n,e,t.pageIndex,{...t,pdfObjectId:this._getPdfObjectIdForObject(t),pageIndex:0}):ss.delete(e)}async preflightWidgetAnnotation(t,e,n){n||"number"!=typeof e?n&&await this.preflightRenderAnnotationText(n,e,t.pageIndex):ss.delete(e)}async createBookmark(t){try{bs("append_bookmarks",{bookmarks:[t]})}catch(t){throw new Error(`Error creating new bookmark in ${wn}: ${t.message}`)}}async updateBookmark(t){try{bs("remove_bookmarks",{bookmarkIds:[t.id??t.pdfBookmarkId]}),bs("append_bookmarks",{bookmarks:[t]})}catch(t){throw new Error(`Error updating bookmark in ${wn}: ${t.message}`)}}async deleteBookmark(t){try{bs("remove_bookmarks",{bookmarkIds:[t]})}catch(t){throw new Error(`Error deleting bookmark in ${wn}: ${t.message}`)}}async getTextFromRects(t,e){return bs("get_text_from_rects",{page:t,rects:e.map(t=>[t.left,t.top,t.width,t.height])})[0].text}async search(t,e,n,r){return bs("search",{query:t,start_index:e,limit:n,case_sensitive:r,search_type:arguments.length>4&&void 0!==arguments[4]?arguments[4]:Te})}async parseXFDF(t,e,n){try{return Ss(bs("convert_xfdf_to_instant_json",{ignore_page_rotation:e,rich_text_enabled:n},t)[0])}catch(t){throw t}}async getEmbeddedFilesList(){return bs("list_embedded_files")[0].embeddedFiles||null}async getMeasurementSnappingPoints(t){const e=bs("get_snapping_points",{page:t});return e[0].snappingPoints?function(t){const e=[...t.endpoints,...t.intersections,...t.midpoints],n=[];for(let t=0;t<e.length;t+=2){const r=[e[t],e[t+1]];n.push(r)}return n.sort((t,e)=>t[0]==e[0]?t[1]-e[1]:t[0]-e[0])}(e[0].snappingPoints):null}async getSecondaryMeasurementUnit(){try{return bs("get_secondary_measurement_unit")[0]||null}catch(t){throw new Error(`Error getting secondary measurement: ${t.message}`)}}async setSecondaryMeasurementUnit(t){try{bs("set_secondary_measurement_unit",t?{unitTo:t?.unitTo,precision:t?.precision}:null)}catch{a("Error setting secondary measurement unit")}}async getMeasurementScales(){try{return bs("get_measurement_content_formats")[0]||null}catch(t){throw new Error(`Error getting measurement scales: ${t.message}`)}}async removeMeasurementScale(t){try{bs("remove_measurement_content_format",{measurementContentFormat:le(t)})}catch(e){throw new Error(`Error removing ${t.name} measurement scale: ${e.message}`)}}async addMeasurementScale(t){try{bs("add_measurement_content_format",{measurementContentFormat:le(t)})}catch(e){throw new Error(`Error adding ${t.name} measurement scale: ${e.message}`)}}async getAnnotationsByScale(t){try{return bs("get_annotations_for_measurement_content_format",{measurementContentFormat:le(t)})||null}catch(t){throw t}}async exportFile(t,e,n,r,o,a,s,u){let c,l={mimeType:"application/pdf",extension:"pdf"};try{const i=!1;c=bs("save_document",{file_path:wn,format:r,flatten_annotations:t,save_incrementally:e,apply_redactions:i,save_for_printing:n,remove_all_annotations:o,preserve_change_tracker_state:a,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Js(s.documentPermissions)}:null}),u&&(u.forEach(t=>{let{pageIndex:e,id:n,pdfObjectId:r}=t;bs("electronic_signatures/flatten",{page:e,annotation_id:this._getPdfObjectIdForObject({id:n,pdfObjectId:r})})}),c=bs("save_document",{file_path:Ga,format:r,flatten_annotations:t,save_incrementally:e,apply_redactions:i,save_for_printing:n,remove_all_annotations:o,preserve_change_tracker_state:a,...s?{user_password:s.userPassword,owner_password:s.ownerPassword,document_permissions:Js(s.documentPermissions)}:null}))}catch(t){throw new Error(`Error saving to ${Ga}: ${t.message}`)}const f=c[0];f.format&&(l={mimeType:f.format.mime_type,extension:f.format.extension}),i(Za,Xa);const h=Za.FS.readFile(u?Ga:wn).buffer;return u&&(vs("closeDocument"),vs("openDocument",wn,JSON.stringify(is))),[h,l]}async importXFDF(t,e,n,r){rs.push({source:t,keepCurrentAnnotations:e}),e||function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];t.push("pspdfkit/widget"),bs("remove_all_annotations",{exclude_annotation_types:t,exclude_annotation_ids:e})}(),bs("import_xfdf",{ignore_page_rotation:n,rich_text_enabled:r},t)}async exportXFDF(t){const e=bs("export_xfdf",{ignore_page_rotation:t});return(new TextDecoder).decode(e[0])}async importInstantJSON(t){bs("import_document_json",void 0,JSON.stringify(t))}async exportInstantJSON(t){const e=Ms;Ms&&Us(!1);const n=bs("export_document_json","number"==typeof t?{version:{annotations:t}}:void 0);return e&&Us(!0),Ss(n[0])}async getAnchoringPagePrimitives(t){const e=bs("extract_anchoring_page_primitives",{page:t});return i(1===e.length,"expected only one response for getAnchoringPagePrimitives"),e[0]}async getDocumentOutline(){const t=bs("get_outline");return i(1===t.length,"expected only one response for getDocumentOutline"),t[0].outline||[]}async setDocumentOutline(t){return bs("set_outline",{outline:t})}async getPageGlyphs(t){return bs("get_glyphs",{page:t})[0].glyphs||[]}async onKeystrokeEvent(t){const e=bs("on_keystroke_event",{pdf_javascript_event:t});i(1===e.length,"expected only one response for onKeystrokeEvent");const n=e[0].changes||[];return i(n.length>0&&4===n[0].change_type,"expected onKeystrokeEvent to return at least one JavaScript Event change."),n}async version(){return vs("PSPDFKitVersion").version}getImportedXFDF(){return rs}async applyRedactions(){try{bs("save_document",{file_path:wn,format:"pdf",flatten_annotations:!1,save_incrementally:!1,apply_redactions:!0,save_for_printing:!1,remove_all_annotations:!1})}catch(t){throw new Error(`Error applying redactions and saving to ${wn}: ${t.message}`)}}async clearAPStreamCache(){vs("clearAPStreamCache")}async replaceAuthToken(t){vs("replaceAuthToken",t)}async setComparisonDocument(t,e){this.comparisonDocuments[t]=e||(await this.exportFile(!1,!1,!1,"pdf",!1,!1))[0]}async openComparisonDocument(t){return i(this.comparisonDocuments[t]),t===this.lastOpenedComparisonDocument||t===ke&&null===this.lastOpenedComparisonDocument&&this.persistedOpenDocument instanceof ArrayBuffer?null:(this.lastOpenedComparisonDocument=t,this.openDocument(this.comparisonDocuments[t],this.persistedOpenDocument===t?this.persistedOpenDocumentConfiguration:this.getComparisonOpenDocumentConfiguration()))}async documentCompareAndOpen(t){i(this.comparisonDocuments[ke]&&this.comparisonDocuments[je],"One or both comparison input documents are missing.");const e=`${ke}.pdf`,n=`${je}.pdf`;Za.FS.writeFile(e,new Uint8Array(this.comparisonDocuments[ke])),Za.FS.writeFile(n,new Uint8Array(this.comparisonDocuments[je]));return bs("comparison",{documentA:{strokeColor:t.documentA.strokeColor,pageIndex:t.documentA.pageIndex,filePath:e},documentB:{strokeColor:t.documentB.strokeColor,pageIndex:t.documentB.pageIndex,filePath:n},options:{...t.options,outputFilePath:"output.pdf"}}),await this.closeDocument(),this.comparisonDocuments[ze]=Za.FS.readFile("output.pdf").buffer,this.lastOpenedComparisonDocument=ze,this.openDocument(this.comparisonDocuments[ze],this.getComparisonOpenDocumentConfiguration())}getComparisonOpenDocumentConfiguration(){const{pageCacheSizeInBytes:t}=this.persistedOpenDocumentConfiguration;return"number"==typeof t?{...ns,pageCacheSizeInBytes:t}:ns}async persistOpenDocument(t){if(t)this.persistedOpenDocument=t;else try{this.persistedOpenDocument=(await this.exportFile(!1,!1,!1,"pdf",!1,!0))[0]}catch(t){throw new Error(`Error trying to persist a copy of the currently opened document: ${t.message}`)}this.persistedOpenDocumentConfiguration=is}async cleanupDocumentComparison(){i(this.persistedOpenDocument,"No persisted previous document key or array buffer is available.");const t=this.persistedOpenDocument instanceof ArrayBuffer?this.persistedOpenDocument:this.comparisonDocuments[this.persistedOpenDocument];i(t,"No persisted previous array buffer is available.");try{await this.closeDocument()}catch(t){throw new Error(`Error trying to close the current document: ${t.message}`)}const e=this.openDocument(t,this.persistedOpenDocumentConfiguration);return this.persistedOpenDocument=null,this.persistedOpenDocumentConfiguration=ns,this.lastOpenedComparisonDocument=null,this.comparisonDocuments={},e}_getPdfObjectIdForObject(t){const e=Fs[t.id];return e?e.pdfObjectId:"number"==typeof t.pdfObjectId?t.pdfObjectId:this._pdfObjectIdsForIds[t.id]}async getOCGs(){return bs("ocg/get_ocgs")[0].ocgs}async getOCGVisibilityState(){return{visibleLayerIds:bs("ocg/get_visibility_state")[0].state.visible}}async setOCGVisibilityState(t){return bs("ocg/set_visibility_state",{state:{visible:t.visibleLayerIds}})}async createLayer(t){return bs("ocg/create_layer",{name:t.name})[0].layer}async getCoreCallRecording(){return gs}async enableCoreCallRecording(t){ds=t}getWASMModule(){return Za}recycle(){}destroy(){}},ru=new class{constructor(){l(this,"files",new Map),l(this,"fileDescriptor",0),l(this,"_opfsStorageManager",null),l(this,"_documentOPFSDataProvider",null),l(this,"_documentOPFSProvider",null),l(this,"_linearizedOPFSDataProvider",null),l(this,"_linearizedOPFSProvider",null)}get opfsStorageManager(){return this._opfsStorageManager}async dispatchCommand(t){let e=null;try{if(e=await this.wasmModule.dispatchCommand(t),null===e)throw Error("dispatchCommand returned null");if(e.hasError())return{success:!1,message:e.getErrorMessage(),code:e.getErrorReason()};const n={success:!0,values:[]};for(let t=0;t<e.getRepliesCount();t++)e.hasJSONReply(t)&&n.values.push(JSON.parse(e.getJSONReply(t))),e.hasBinaryReply(t)&&n.values.push(e.getBinaryReply(t).slice(0));return n}finally{e&&e.delete()}}async startProgressiveRender(t){const e=this.wasmModule.allocateMemory(t.byteLength);try{let n;e.view.set(t);try{n=this.wasmModule.startProgressiveRender(e)}catch(t){Qs("startProgressiveRender",t)}try{return{sessionId:n.sessionId,status:n.status,buffer:n.buffer?n.buffer.view.slice():null}}finally{n.buffer?.delete()}}finally{e.delete()}}async continueProgressiveRender(t,e){let n;try{n=this.wasmModule.continueProgressiveRender(t,e)}catch(t){Qs("continueProgressiveRender",t)}try{return{status:n.status,buffer:n.buffer?n.buffer.view.slice():null}}finally{n.buffer?.delete()}}async cancelProgressiveRender(t){try{this.wasmModule.cancelProgressiveRender(t)}catch(t){Qs("cancelProgressiveRender",t)}}async writeFile(t,e){this.wasmModule.FS.writeFile(t,e)}async deleteFile(t){this.wasmModule.FS.unlink(t)}async readFile(t){return this.wasmModule.FS.readFile(t)}openFile(t,e){const n=this.wasmModule.FS.open(t,e);return this.files.set(this.fileDescriptor,n),Promise.resolve(this.fileDescriptor++)}closeFile(t){const e=this.files.get(t);return e&&(this.wasmModule.FS.close(e),this.files.delete(t)),Promise.resolve()}writeData(t,e,n){const r=this.files.get(t);if(!r)throw Error(`Trying to write to a file with descriptor ${t}, but the file is not open.`);return this.wasmModule.FS.write(r,e,0,e.byteLength,n),Promise.resolve()}retainOpenDocumentOPFSProvider(t,e){this._documentOPFSDataProvider=t,this._documentOPFSProvider=e}releaseOpenDocumentOPFSProvider(){(this._documentOPFSDataProvider||this._documentOPFSProvider)&&(this._documentOPFSDataProvider=null,this._documentOPFSProvider=null)}async initOPFSStorage(t){const e=new Zs;this._opfsStorageManager=e;const n=await e.init(t);return n||this._opfsStorageManager!==e||(this._opfsStorageManager=null),n}async prepareLinearizedOPFS(t,e){if(!await this.initOPFSStorage(t))return{success:!1,reason:"init-failed"};try{return i(this._opfsStorageManager,"OPFS not initialized after init"),this._opfsStorageManager.writeChunk(e,0),this._linearizedOPFSDataProvider=new Sn(this._opfsStorageManager),this._linearizedOPFSProvider=this._linearizedOPFSDataProvider.createEmbindProvider(this.wasmModule),this.wasmModule.setLinearizedDataProvider(this._linearizedOPFSProvider),{success:!0}}catch(t){const e=t instanceof Error?t.message:String(t);return bn("CorePDF.prepareLinearizedOPFS: failed",{reason:e}),await this.closeOPFSStorage(),{success:!1,reason:e}}}async writeOPFSChunk(t,e){i(this._opfsStorageManager,"OPFS not initialized"),this._opfsStorageManager.writeChunk(t,e)}async readOPFSBytes(t,e){return i(this._opfsStorageManager,"OPFS not initialized"),this._opfsStorageManager.read(t,e)}async closeOPFSStorage(){const t=this._opfsStorageManager;this.releaseOpenDocumentOPFSProvider(),this._linearizedOPFSProvider=null,this._linearizedOPFSDataProvider=null,t&&(await t.close(),this._opfsStorageManager===t&&(this._opfsStorageManager=null))}async cleanupOPFSOrphans(){await Zs.cleanupOrphans()}};nu.setCorePDFAccess(ru),nu.onloadedFn=t=>{ru.wasmModule=t,iu.postMessage({channel:eu,event:"wasm-ready"})},Rt(ru);const iu=self;iu.global=iu,iu.module={},iu.onmessage=async t=>{let e,n,{data:r}=t;if(r&&r.channel===tu){try{const t=await nu[r.action](...r.args);if(e={id:r.id,result:t,channel:tu},Array.isArray(t)){const e=t.filter(t=>t instanceof ArrayBuffer||t instanceof MessagePort);e.length>0&&(n=e)}t instanceof ArrayBuffer&&(n=[t])}catch(t){const i=[...r.args].filter(t=>t instanceof ArrayBuffer);i.length>0&&(n=i),e={id:r.id,error:t.message||t.toString(),errorCode:t.errorCode,dediconXml:t.dediconXml,callArgs:r.args,channel:tu}}iu.postMessage(e,n)}}})()})();',"Worker",void 0,void 0)}},58632(t){function e(t){var e=function(){var t=self||window;if(void 0===t.trustedTypes)return null;try{return t.trustedTypes.createPolicy("nutrient-web-sdk#webpack-worker",{createScriptURL:function(t){return t}})}catch(e){return t.trustedTypes.defaultPolicy||null}}();return e?e.createScriptURL(t):t}t.exports=function(t,n,r,i){var o=self||window;try{try{var a,s="\n        // Trusted Types policy for worker context - use Webpack's policy naming\n        if (typeof trustedTypes !== 'undefined') {\n          try {\n            var workerPolicy = trustedTypes.createPolicy('nutrient-web-sdk#webpack-worker', {\n              createScriptURL: function(s) { return s; }\n            });\n            // Wrap importScripts to use Trusted Types\n            var originalImportScripts = importScripts;\n            importScripts = function() {\n              var args = Array.prototype.slice.call(arguments);\n              var trustedArgs = args.map(function(url) {\n                return workerPolicy.createScriptURL(url);\n              });\n              return originalImportScripts.apply(this, trustedArgs);\n            };\n          } catch (e) {\n            // Policy creation failed, continue without Trusted Types\n          }\n        }\n      "+t;try{a=new o.Blob([s])}catch(t){(a=new(o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder)).append(s),a=a.getBlob()}var u=o.URL||o.webkitURL,c=u.createObjectURL(a),l=e(c),f=new o[n](l,r);return u.revokeObjectURL(c),f}catch(i){var h=e("data:application/javascript,".concat(encodeURIComponent(t)));return new o[n](h,r)}}catch(t){if(!i)throw Error("Inline worker is not supported");var p=e(i);return new o[n](p,r)}}}}]);