/*!
 * Nutrient Web SDK 1.12.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/
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NutrientViewer=t():e.NutrientViewer=t()}(globalThis,()=>(()=>{"use strict";var e,t,n,r={},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,n)=>(o.f[n](e,t),t),[])),o.u=e=>"nutrient-viewer-lib/chunk-"+e+"-"+{340:"36f122ac3222a5b9",837:"118163c12ee1ee2a"}[e]+".js",o.miniCssF=e=>{},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="NutrientViewer:",o.l=(n,r,i,a)=>{if(e[n])e[n].push(r);else{var s,u;if(void 0!==i)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var f=l[c];if(f.getAttribute("src")==n||f.getAttribute("data-webpack")==t+i){s=f;break}}s||(u=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",t+i),s.src=o.tu(n)),e[n]=[r];var d=(t,r)=>{s.onerror=s.onload=null,clearTimeout(p);var i=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach(e=>e(r)),t)return t(r)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),u&&document.head.appendChild(s)}},o.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nutrient-web-sdk#webpack",n))),n),o.tu=e=>o.tt().createScriptURL(e),o.p="",(()=>{var e={374:0};o.f.j=(t,n)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise((n,i)=>r=e[t]=[n,i]);n.push(r[2]=i);var a=o.p+o.u(t),s=new Error;o.l(a,n=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,r[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,i,[a,s,u]=n,l=0;if(a.some(t=>0!==e[t])){for(r in s)o.o(s,r)&&(o.m[r]=s[r]);if(u)u(o)}for(t&&t(n);l<a.length;l++)i=a[l],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();const a=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};a.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const s=a;function u(e,t){if(!e)throw new s(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}["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 l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e){var t=function(e,t){if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==l(t)?t:t+""}function f(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new WeakMap;async function d(e){const t=(await async function(e){try{const t=await fetch(e).catch(t=>{throw new s(`Error fetching dynamic fonts file ${e}. ${t}`)});if(200!==t.status)throw new s(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return t}catch(e){throw e}}(e)).json().catch(t=>{throw new s(`Error parsing dynamic fonts file ${e}. ${t}`)});return t}let p=function(e){return e[e.pdf_a_1a=0]="pdf_a_1a",e[e.pdf_a_1b=1]="pdf_a_1b",e[e.pdf_a_2a=2]="pdf_a_2a",e[e.pdf_a_2u=3]="pdf_a_2u",e[e.pdf_a_2b=4]="pdf_a_2b",e[e.pdf_a_3a=5]="pdf_a_3a",e[e.pdf_a_3u=6]="pdf_a_3u",e[e.pdf_a_3b=7]="pdf_a_3b",e[e.pdf_a_4=8]="pdf_a_4",e[e.pdf_a_4e=9]="pdf_a_4e",e[e.pdf_a_4f=10]="pdf_a_4f",e}({});const h=/^(?:[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 m=function(e){return"string"==typeof e&&h.test(e)};const y=function(e){if(!m(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)},g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).slice(1));function b(e,t=0){return(g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]).toLowerCase()}let w;const v=new Uint8Array(16);function S(e){return 14+(e+64>>>9<<4)+1}function _(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function E(e,t,n,r,i,o){return _((a=_(_(t,e),_(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function F(e,t,n,r,i,o,a){return E(t&n|~t&r,e,t,i,o,a)}function A(e,t,n,r,i,o,a){return E(t&r|n&~r,e,t,i,o,a)}function k(e,t,n,r,i,o,a){return E(t^n^r,e,t,i,o,a)}function I(e,t,n,r,i,o,a){return E(n^(t|~r),e,t,i,o,a)}const U=function(e){return function(e){const t=new Uint8Array(4*e.length);for(let n=0;n<4*e.length;n++)t[n]=e[n>>2]>>>n%4*8&255;return t}(function(e,t){const n=new Uint32Array(S(t)).fill(0);n.set(e),n[t>>5]|=128<<t%32,n[n.length-1]=t,e=n;let r=1732584193,i=-271733879,o=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const n=r,s=i,u=o,l=a;r=F(r,i,o,a,e[t],7,-680876936),a=F(a,r,i,o,e[t+1],12,-389564586),o=F(o,a,r,i,e[t+2],17,606105819),i=F(i,o,a,r,e[t+3],22,-1044525330),r=F(r,i,o,a,e[t+4],7,-176418897),a=F(a,r,i,o,e[t+5],12,1200080426),o=F(o,a,r,i,e[t+6],17,-1473231341),i=F(i,o,a,r,e[t+7],22,-45705983),r=F(r,i,o,a,e[t+8],7,1770035416),a=F(a,r,i,o,e[t+9],12,-1958414417),o=F(o,a,r,i,e[t+10],17,-42063),i=F(i,o,a,r,e[t+11],22,-1990404162),r=F(r,i,o,a,e[t+12],7,1804603682),a=F(a,r,i,o,e[t+13],12,-40341101),o=F(o,a,r,i,e[t+14],17,-1502002290),i=F(i,o,a,r,e[t+15],22,1236535329),r=A(r,i,o,a,e[t+1],5,-165796510),a=A(a,r,i,o,e[t+6],9,-1069501632),o=A(o,a,r,i,e[t+11],14,643717713),i=A(i,o,a,r,e[t],20,-373897302),r=A(r,i,o,a,e[t+5],5,-701558691),a=A(a,r,i,o,e[t+10],9,38016083),o=A(o,a,r,i,e[t+15],14,-660478335),i=A(i,o,a,r,e[t+4],20,-405537848),r=A(r,i,o,a,e[t+9],5,568446438),a=A(a,r,i,o,e[t+14],9,-1019803690),o=A(o,a,r,i,e[t+3],14,-187363961),i=A(i,o,a,r,e[t+8],20,1163531501),r=A(r,i,o,a,e[t+13],5,-1444681467),a=A(a,r,i,o,e[t+2],9,-51403784),o=A(o,a,r,i,e[t+7],14,1735328473),i=A(i,o,a,r,e[t+12],20,-1926607734),r=k(r,i,o,a,e[t+5],4,-378558),a=k(a,r,i,o,e[t+8],11,-2022574463),o=k(o,a,r,i,e[t+11],16,1839030562),i=k(i,o,a,r,e[t+14],23,-35309556),r=k(r,i,o,a,e[t+1],4,-1530992060),a=k(a,r,i,o,e[t+4],11,1272893353),o=k(o,a,r,i,e[t+7],16,-155497632),i=k(i,o,a,r,e[t+10],23,-1094730640),r=k(r,i,o,a,e[t+13],4,681279174),a=k(a,r,i,o,e[t],11,-358537222),o=k(o,a,r,i,e[t+3],16,-722521979),i=k(i,o,a,r,e[t+6],23,76029189),r=k(r,i,o,a,e[t+9],4,-640364487),a=k(a,r,i,o,e[t+12],11,-421815835),o=k(o,a,r,i,e[t+15],16,530742520),i=k(i,o,a,r,e[t+2],23,-995338651),r=I(r,i,o,a,e[t],6,-198630844),a=I(a,r,i,o,e[t+7],10,1126891415),o=I(o,a,r,i,e[t+14],15,-1416354905),i=I(i,o,a,r,e[t+5],21,-57434055),r=I(r,i,o,a,e[t+12],6,1700485571),a=I(a,r,i,o,e[t+3],10,-1894986606),o=I(o,a,r,i,e[t+10],15,-1051523),i=I(i,o,a,r,e[t+1],21,-2054922799),r=I(r,i,o,a,e[t+8],6,1873313359),a=I(a,r,i,o,e[t+15],10,-30611744),o=I(o,a,r,i,e[t+6],15,-1560198380),i=I(i,o,a,r,e[t+13],21,1309151649),r=I(r,i,o,a,e[t+4],6,-145523070),a=I(a,r,i,o,e[t+11],10,-1120210379),o=I(o,a,r,i,e[t+2],15,718787259),i=I(i,o,a,r,e[t+9],21,-343485551),r=_(r,n),i=_(i,s),o=_(o,u),a=_(a,l)}return Uint32Array.of(r,i,o,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(S(8*e.length)).fill(0);for(let n=0;n<e.length;n++)t[n>>2]|=(255&e[n])<<n%4*8;return t}(e),8*e.length))};const M="6ba7b810-9dad-11d1-80b4-00c04fd430c8",x="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function T(e,t,n,r,i,o){const a="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,s="string"==typeof r?y(r):r;if("string"==typeof r&&(r=y(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=t(u),u[6]=15&u[6]|e,u[8]=63&u[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=u[e];return i}return b(u)}function j(e,t,n,r){return T(48,U,e,t,n,r)}j.DNS=M,j.URL=x;const C={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const P=function(e,t,n){if(C.randomUUID&&!t&&!e)return C.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!w){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");w=crypto.getRandomValues.bind(crypto)}return w(v)}();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,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return b(r)};function $(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function O(e,t){return e<<t|e>>>32-t}const D=function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,o=Math.ceil(i/16),a=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];a[t]=n}a[o-1][14]=8*(e.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=a[e][t];for(let e=16;e<80;++e)r[e]=O(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],o=n[1],s=n[2],u=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),a=O(i,5)+$(n,o,s,u)+l+t[n]+r[e]>>>0;l=u,u=s,s=O(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]+l>>>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 N(e,t,n,r){return T(80,D,e,t,n,r)}N.DNS=M,N.URL=x;function L(){const e="nutrient-analytics-user-id";if(!window||!window.localStorage)return null;try{if(window.localStorage.getItem(e))return window.localStorage.getItem(e);const t=P();return window.localStorage.setItem(e,t),t}catch{return null}}class q{constructor(){f(this,"maxQueueSize",1e3),f(this,"flushTimer",null),f(this,"visibilityChangeHandler",null),f(this,"isFlushing",!1),f(this,"queue",[]),f(this,"allEvents",[])}static getInstance(){return q.instance||(q.instance=new q),q.instance}emit(e){this.collect(e)}configure(e){const{hmacSecret:t,endpoint:n,flushInterval:r,maxQueueSize:i,clientInfo:o}=e;this.clientInfo=o,this.hmacSecret=this.hexStringToHmacSecret(t),this.endpoint=n,void 0!==i&&(this.maxQueueSize=i),this.isE2E()||(this.flushTimer=setInterval(()=>this.flush(),r||3e3),this.visibilityChangeHandler=()=>{"hidden"===document.visibilityState&&this.queue.length>0&&this.flush()},document.addEventListener("visibilitychange",this.visibilityChangeHandler))}cleanup(){null!==this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),null!==this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}static cleanup(){q.instance&&(q.instance.cleanup(),q.instance=void 0)}shouldBeIgnored(e){switch(e.name){case"content|editor|save":return!!this.allEvents.find(t=>t.name===e.name&&Math.abs(t.timestamp-e.timestamp)<1e3);case"form|creator|field|add":return!this.allEvents.find(e=>"form|creator|enter"===e.name);case"annotation|edit":return!!this.allEvents.find(t=>t.name===e.name&&Math.abs(t.timestamp-e.timestamp)<100);default:return!1}}collect(e){if(this.isE2E()){const t=window;if(t.__PSPDFKIT_ANALYTICS_EVENTS__??=[],this.shouldBeIgnored(e))return;return this.allEvents.push(e),void t.__PSPDFKIT_ANALYTICS_EVENTS__.push(e)}this.shouldBeIgnored(e)||(this.allEvents.push(e),this.queue.length>=this.maxQueueSize&&this.queue.shift(),this.queue.push(e))}async flush(){if(this.isFlushing||this.isE2E()||0===this.queue.length)return;this.isFlushing=!0;const e=this.queue.splice(0,this.queue.length);try{const{prepareUpload:t}=await Promise.all([o.e(340),o.e(837)]).then(o.bind(o,1837)),n=e.map(e=>({type:"counter",name:e.name,attributes:Object.fromEntries(Object.entries(e.attributes).map(e=>{let[t,n]=e;return[t,String(n)]})),timestamp:e.timestamp})),r=await t({clientInfo:{...this.clientInfo,tag:L()??void 0},hmacSecret:this.hmacSecret},n);if(!r)return void this.requeue(e);const i=`${this.endpoint}/proto/metrics`,a=await fetch(i,{method:"POST",headers:r.headers,body:r.body,keepalive:!0});if(!a.ok)throw new Error(`Analytics request failed with status ${a.status}`)}catch(t){this.requeue(e)}finally{this.isFlushing=!1}}requeue(e){const t=this.maxQueueSize-this.queue.length;if(t<=0)return;const n=e.slice(0,t);this.queue.unshift(...n)}isE2E(){return"undefined"!=typeof window&&Boolean(window.__E2E_TEST__)}hexStringToHmacSecret(e){if(128!==e.length)throw new Error(`Invalid hex string length: expected 128 characters, got ${e.length}`);return new Uint8Array(Array.from(e,e=>e.charCodeAt(0)))}}function R(e){var t,n;t="convert|from|office",n={feature:"office_conversion",mimeType:e},q.getInstance().emit({name:t,attributes:n??{},timestamp:Date.now()})}f(q,"instance",void 0);const V="/create.pdf",B="/save.pdf",H="/create.docx",W="/save.docx",z="/templateData.json",K="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let G=null,Q=null;function J(e){let t;u(Q,"GdPicture WebAssembly is not loaded.");for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(const e of r)t=Object.assign(r[0],e);const o=JSON.stringify({type:e,...t}),a=JSON.parse(Q.CommandHandler(o));if(!a.success)throw new Error(a.errorReason+": "+a.errorMessage+"\n"+a.error);return a}const Y={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},X=Y.noMarkup,Z={documentMarkupMode:X};function ee(e){if(!e)return Z;if(!e.documentMarkupMode)return{...e,documentMarkupMode:X};if(!(e.documentMarkupMode in Y))throw new Error(`Invalid documentMarkupMode value: ${e.documentMarkupMode}. Allowed values are: ${Object.keys(Y).join(", ")}`);return{...e,documentMarkupMode:Y[e.documentMarkupMode]}}const te={"application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","text/plain":"txt"},ne=new class{_mountCustomFonts(e,t){u(G,"WebAssembly module not loaded."),G.FS.mkdir(t);{const n=K?G.FS.filesystems.WORKERFS:G.FS.filesystems.MEMFS;G.FS.mount(n,{blobs:e},t)}}async loadModule(e,t,n,r,i,o,a){const{Assemblies:s,Module:u}=await async function(e,t){if("string"==typeof e){const n="nutrient-viewer-lib/",r=`${n}gdpicture-935f5ee6/jit`,i=`${n}gdpicture-935f5ee6/aot`;let o,a;t?(o=`${e}${i}/initDotnet.js`,a=`${e}${i}`):(o=`${e}${r}/initDotnet.js`,a=`${e}${r}`);const{initDotnet:s}=await import(o);return s(a,(e,t,n,r,i)=>"blazor.boot.json"===t?fetch(n,{credentials:"same-origin"}):null)}throw new Error("GdPicture WASM loader not implemented")}(e,t);Q=s.GdPictureWasm.API,G=u,J("gdpicture/setLicense",{origin:n},{licenseKey:r||"DEMO_PSPDFKIT_WEB"});const l=i?"/fonts":"";if(i&&!G.FS.analyzePath(l).exists&&(this._mountCustomFonts(i,l),J("gdpicture/setFonts",{fontPaths:[l]})),o){const e=await d(o);J("gdpicture/setDynamicFontLoading",{baseUrl:o.split("/").slice(0,-1).join("/"),allowedFonts:e.availableFonts,v:1})}a&&J("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(e,t,n,r,i){let o=V;if(i&&"pdf"!==i&&Object.values(te).includes(i)){R(Object.keys(te).find(e=>te[e].toLowerCase()===i.toLowerCase()).toLowerCase()),o+=`.${i}`}else if(r&&"application/pdf"!==r){const e=r.toLowerCase();R(e);const t=te.hasOwnProperty(e)&&te[e];t&&(o+=`.${t}`)}G.FS.writeFile(o,new Uint8Array(e));const a={file:B,format:"pdf",conformance:t&&t in p?t:void 0,officeConversionSettings:ee(n)};try{return J("gdpicture/process",{input:{file:o},output:a}),G.FS.readFile(B).buffer}finally{try{G.FS.unlink(B),G.FS.unlink(o)}catch(e){}}}toOffice(e,t){G.FS.writeFile(V,new Uint8Array(e));const n=`/save.${t}`;try{return J("gdpicture/process",{input:{file:V},output:{file:n,format:t}}),G.FS.readFile(n).buffer}finally{try{G.FS.unlink(n),G.FS.unlink(V)}catch(e){console.log(e.message)}}}async populateDocumentTemplate(e,t){let n;G.FS.writeFile(H,new Uint8Array(e));try{n=JSON.stringify(t,null,2)}catch(e){throw new Error("Invalid config data")}G.FS.writeFile(z,n);try{return J("gdpicture/process-office-template",{inputFile:H,modelAndConfigFile:z,outputFile:W}),G.FS.readFile(W).buffer}finally{try{G.FS.unlink(W),G.FS.unlink(z),G.FS.unlink(H)}catch(e){console.log(e.message)}}}},re=self;return re.global=re,re.module={},re.onmessage=async e=>{let t,n,{data:r}=e;try{const e=await ne[r.action](...r.args);if(t={id:r.id,result:e},Array.isArray(e)){const t=e.filter(e=>e instanceof ArrayBuffer);t.length>0&&(n=t)}e instanceof ArrayBuffer&&(n=[e])}catch(e){const i=[...r.args].filter(e=>e instanceof ArrayBuffer);i.length>0&&(n=i),t={id:r.id,error:e.message||e.toString(),callArgs:r.args}}re.postMessage(t,n)},{}})());