/*!
 * Nutrient Web SDK 1.16.0-2012f75 (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={},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,i),n.exports}i.m=r,i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>"nutrient-viewer-lib/chunk-"+e+"-"+{340:"d03c1041cc3d6957",567:"d83c1c56bbd94e3e"}[e]+".js",i.miniCssF=e=>{},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="NutrientViewer:",i.l=(n,r,o,a)=>{if(e[n])e[n].push(r);else{var s,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var f=c[u];if(f.getAttribute("src")==n||f.getAttribute("data-webpack")==t+o){s=f;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.setAttribute("data-webpack",t+o),s.src=i.tu(n)),e[n]=[r];var p=(t,r)=>{s.onerror=s.onload=null,clearTimeout(m);var o=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(e=>e(r)),t)return t(r)},m=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.tt=()=>(void 0===n&&(n={createScriptURL:e=>e},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(n=trustedTypes.createPolicy("nutrient-web-sdk#webpack",n))),n),i.tu=e=>i.tt().createScriptURL(e),i.p="",(()=>{var e={374:0};i.f.j=(t,n)=>{var r=i.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=e[t]=[n,o]);n.push(r[2]=o);var a=i.p+i.u(t),s=new Error;i.l(a,n=>{if(i.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,r[1](s)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,o,[a,s,l]=n,c=0;if(a.some(t=>0!==e[t])){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(l)l(i)}for(t&&t(n);c<a.length;c++)o=a[c],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},n=globalThis.webpackChunkNutrientViewer=globalThis.webpackChunkNutrientViewer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var a={};i.r(a),i.d(a,{default:()=>ve});const s=function e(t){let n;return n=t instanceof Error?t:new Error(t),Object.setPrototypeOf(n,e.prototype),n};s.prototype=Object.create(Error.prototype,{name:{value:"PSPDFKitError",enumerable:!1}});const l=s;function c(e,t){if(!e)throw new l(`Assertion failed: ${t||"Condition not met"}\n\nFor further assistance, please go to: https://www.nutrient.io/support/request`)}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function f(){console.warn(...arguments)}["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 p(e){return p="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},p(e)}function m(e){var t=function(e,t){if("object"!=p(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==p(t)?t:t+""}function d(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new WeakMap;const{entries:h,setPrototypeOf:g,isFrozen:y,getPrototypeOf:b,getOwnPropertyDescriptor:w}=Object;let{freeze:T,seal:E,create:S}=Object,{apply:A,construct:_}="undefined"!=typeof Reflect&&Reflect;T||(T=function(e){return e}),E||(E=function(e){return e}),A||(A=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),_||(_=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const v=q(Array.prototype.forEach),N=q(Array.prototype.lastIndexOf),R=q(Array.prototype.pop),I=q(Array.prototype.push),D=q(Array.prototype.splice),O=Array.isArray,k=q(String.prototype.toLowerCase),C=q(String.prototype.toString),x=q(String.prototype.match),L=q(String.prototype.replace),M=q(String.prototype.indexOf),U=q(String.prototype.trim),F=q(Number.prototype.toString),P=q(Boolean.prototype.toString),z="undefined"==typeof BigInt?null:q(BigInt.prototype.toString),$="undefined"==typeof Symbol?null:q(Symbol.prototype.toString),j=q(Object.prototype.hasOwnProperty),H=q(Object.prototype.toString),B=q(RegExp.prototype.test),W=(G=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _(G,t)});var G;function q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return A(e,t,r)}}function Y(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k;if(g&&g(e,null),!O(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(y(t)||(t[r]=e),o=e)}e[o]=!0}return e}function V(e){for(let t=0;t<e.length;t++){j(e,t)||(e[t]=null)}return e}function X(e){const t=S(null);for(const[n,r]of h(e)){j(e,n)&&(O(r)?t[n]=V(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=X(r):t[n]=r)}return t}function K(e,t){for(;null!==e;){const n=w(e,t);if(n){if(n.get)return q(n.get);if("function"==typeof n.value)return q(n.value)}e=b(e)}return function(){return null}}const Z=T(["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"]),Q=T(["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"]),J=T(["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"]),ee=T(["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"]),te=T(["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"]),ne=T(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),re=T(["#text"]),oe=T(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","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"]),ie=T(["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"]),ae=T(["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"]),se=T(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),le=E(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ce=E(/<%[\w\W]*|[\w\W]*%>/gm),ue=E(/\$\{[\w\W]*/gm),fe=E(/^data-[\-\w.\u00B7-\uFFFF]+$/),pe=E(/^aria-[\-\w]+$/),me=E(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),de=E(/^(?:\w+script|data):/i),he=E(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ge=E(/^html$/i),ye=E(/^[a-z][.\w]*(-[.\w]+)+$/i);var be=Object.freeze({__proto__:null,ARIA_ATTR:pe,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:ye,DATA_ATTR:fe,DOCTYPE_NAME:ge,ERB_EXPR:ce,IS_ALLOWED_URI:me,IS_SCRIPT_OR_DATA:de,MUSTACHE_EXPR:le,TMPLIT_EXPR:ue});const we=1,Te=3,Ee=7,Se=8,Ae=9,_e=function(){return"undefined"==typeof window?null:window};var ve=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_e();const n=t=>e(t);if(n.version="3.4.2",n.removed=[],!t||!t.document||t.document.nodeType!==Ae||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const o=r,i=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:d}=t,g=c.prototype,y=K(g,"cloneNode"),b=K(g,"remove"),w=K(g,"nextSibling"),E=K(g,"childNodes"),A=K(g,"parentNode");if("function"==typeof s){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let _,G="";const{implementation:q,createNodeIterator:V,createDocumentFragment:le,getElementsByTagName:ce}=r,{importNode:ue}=o;let fe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof h&&"function"==typeof A&&q&&void 0!==q.createHTMLDocument;const{MUSTACHE_EXPR:pe,ERB_EXPR:de,TMPLIT_EXPR:he,DATA_ATTR:ye,ARIA_ATTR:ve,IS_SCRIPT_OR_DATA:Ne,ATTR_WHITESPACE:Re,CUSTOM_ELEMENT:Ie}=be;let{IS_ALLOWED_URI:De}=be,Oe=null;const ke=Y({},[...Z,...Q,...J,...te,...re]);let Ce=null;const xe=Y({},[...oe,...ie,...ae,...se]);let Le=Object.seal(S(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}})),Me=null,Ue=null;const Fe=Object.seal(S(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pe=!0,ze=!0,$e=!1,je=!0,He=!1,Be=!0,We=!1,Ge=!1,qe=!1,Ye=!1,Ve=!1,Xe=!1,Ke=!0,Ze=!1;const Qe="user-content-";let Je=!0,et=!1,tt={},nt=null;const rt=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ot=null;const it=Y({},["audio","video","img","source","image","track"]);let at=null;const st=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lt="http://www.w3.org/1998/Math/MathML",ct="http://www.w3.org/2000/svg",ut="http://www.w3.org/1999/xhtml";let ft=ut,pt=!1,mt=null;const dt=Y({},[lt,ct,ut],C);let ht=Y({},["mi","mo","mn","ms","mtext"]),gt=Y({},["annotation-xml"]);const yt=Y({},["title","style","font","a","script"]);let bt=null;const wt=["application/xhtml+xml","text/html"];let Tt=null,Et=null;const St=r.createElement("form"),At=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Et&&Et===e)return;e&&"object"==typeof e||(e={}),e=X(e),bt=-1===wt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Tt="application/xhtml+xml"===bt?C:k,Oe=j(e,"ALLOWED_TAGS")&&O(e.ALLOWED_TAGS)?Y({},e.ALLOWED_TAGS,Tt):ke,Ce=j(e,"ALLOWED_ATTR")&&O(e.ALLOWED_ATTR)?Y({},e.ALLOWED_ATTR,Tt):xe,mt=j(e,"ALLOWED_NAMESPACES")&&O(e.ALLOWED_NAMESPACES)?Y({},e.ALLOWED_NAMESPACES,C):dt,at=j(e,"ADD_URI_SAFE_ATTR")&&O(e.ADD_URI_SAFE_ATTR)?Y(X(st),e.ADD_URI_SAFE_ATTR,Tt):st,ot=j(e,"ADD_DATA_URI_TAGS")&&O(e.ADD_DATA_URI_TAGS)?Y(X(it),e.ADD_DATA_URI_TAGS,Tt):it,nt=j(e,"FORBID_CONTENTS")&&O(e.FORBID_CONTENTS)?Y({},e.FORBID_CONTENTS,Tt):rt,Me=j(e,"FORBID_TAGS")&&O(e.FORBID_TAGS)?Y({},e.FORBID_TAGS,Tt):X({}),Ue=j(e,"FORBID_ATTR")&&O(e.FORBID_ATTR)?Y({},e.FORBID_ATTR,Tt):X({}),tt=!!j(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?X(e.USE_PROFILES):e.USE_PROFILES),Pe=!1!==e.ALLOW_ARIA_ATTR,ze=!1!==e.ALLOW_DATA_ATTR,$e=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,He=e.SAFE_FOR_TEMPLATES||!1,Be=!1!==e.SAFE_FOR_XML,We=e.WHOLE_DOCUMENT||!1,Ye=e.RETURN_DOM||!1,Ve=e.RETURN_DOM_FRAGMENT||!1,Xe=e.RETURN_TRUSTED_TYPE||!1,qe=e.FORCE_BODY||!1,Ke=!1!==e.SANITIZE_DOM,Ze=e.SANITIZE_NAMED_PROPS||!1,Je=!1!==e.KEEP_CONTENT,et=e.IN_PLACE||!1,De=function(e){try{return B(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:me,ft="string"==typeof e.NAMESPACE?e.NAMESPACE:ut,ht=j(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?X(e.MATHML_TEXT_INTEGRATION_POINTS):Y({},["mi","mo","mn","ms","mtext"]),gt=j(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?X(e.HTML_INTEGRATION_POINTS):Y({},["annotation-xml"]);const t=j(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?X(e.CUSTOM_ELEMENT_HANDLING):S(null);if(Le=S(null),j(t,"tagNameCheck")&&At(t.tagNameCheck)&&(Le.tagNameCheck=t.tagNameCheck),j(t,"attributeNameCheck")&&At(t.attributeNameCheck)&&(Le.attributeNameCheck=t.attributeNameCheck),j(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Le.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),He&&(ze=!1),Ve&&(Ye=!0),tt&&(Oe=Y({},re),Ce=S(null),!0===tt.html&&(Y(Oe,Z),Y(Ce,oe)),!0===tt.svg&&(Y(Oe,Q),Y(Ce,ie),Y(Ce,se)),!0===tt.svgFilters&&(Y(Oe,J),Y(Ce,ie),Y(Ce,se)),!0===tt.mathMl&&(Y(Oe,te),Y(Ce,ae),Y(Ce,se))),Fe.tagCheck=null,Fe.attributeCheck=null,j(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Fe.tagCheck=e.ADD_TAGS:O(e.ADD_TAGS)&&(Oe===ke&&(Oe=X(Oe)),Y(Oe,e.ADD_TAGS,Tt))),j(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Fe.attributeCheck=e.ADD_ATTR:O(e.ADD_ATTR)&&(Ce===xe&&(Ce=X(Ce)),Y(Ce,e.ADD_ATTR,Tt))),j(e,"ADD_URI_SAFE_ATTR")&&O(e.ADD_URI_SAFE_ATTR)&&Y(at,e.ADD_URI_SAFE_ATTR,Tt),j(e,"FORBID_CONTENTS")&&O(e.FORBID_CONTENTS)&&(nt===rt&&(nt=X(nt)),Y(nt,e.FORBID_CONTENTS,Tt)),j(e,"ADD_FORBID_CONTENTS")&&O(e.ADD_FORBID_CONTENTS)&&(nt===rt&&(nt=X(nt)),Y(nt,e.ADD_FORBID_CONTENTS,Tt)),Je&&(Oe["#text"]=!0),We&&Y(Oe,["html","head","body"]),Oe.table&&(Y(Oe,["tbody"]),delete Me.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw W('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw W('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=e.TRUSTED_TYPES_POLICY,G=_.createHTML("")}else void 0===_&&(_=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(d,i)),null!==_&&"string"==typeof G&&(G=_.createHTML(""));T&&T(e),Et=e},vt=Y({},[...Q,...J,...ee]),Nt=Y({},[...te,...ne]),Rt=function(e){I(n.removed,{element:e});try{A(e).removeChild(e)}catch(t){b(e)}},It=function(e,t){try{I(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){I(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Ye||Ve)try{Rt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Dt=function(e){let t=null,n=null;if(qe)e="<remove></remove>"+e;else{const t=x(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===bt&&ft===ut&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=_?_.createHTML(e):e;if(ft===ut)try{t=(new m).parseFromString(o,bt)}catch(e){}if(!t||!t.documentElement){t=q.createDocument(ft,"template",null);try{t.documentElement.innerHTML=pt?G:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),ft===ut?ce.call(t,We?"html":"body")[0]:We?t.documentElement:i},Ot=function(e){return V.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},kt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof l&&e instanceof l};function xt(e,t,r){v(e,e=>{e.call(n,t,r,Et)})}const Lt=function(e){let t=null;if(xt(fe.beforeSanitizeElements,e,null),kt(e))return Rt(e),!0;const r=Tt(e.nodeName);if(xt(fe.uponSanitizeElement,e,{tagName:r,allowedTags:Oe}),Be&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&B(/<[/\w!]/g,e.innerHTML)&&B(/<[/\w!]/g,e.textContent))return Rt(e),!0;if(Be&&e.namespaceURI===ut&&"style"===r&&Ct(e.firstElementChild))return Rt(e),!0;if(e.nodeType===Ee)return Rt(e),!0;if(Be&&e.nodeType===Se&&B(/<[/\w]/g,e.data))return Rt(e),!0;if(Me[r]||!(Fe.tagCheck instanceof Function&&Fe.tagCheck(r))&&!Oe[r]){if(!Me[r]&&Ft(r)){if(Le.tagNameCheck instanceof RegExp&&B(Le.tagNameCheck,r))return!1;if(Le.tagNameCheck instanceof Function&&Le.tagNameCheck(r))return!1}if(Je&&!nt[r]){const t=A(e)||e.parentNode,n=E(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const o=y(n[r],!0);t.insertBefore(o,w(e))}}}return Rt(e),!0}return e instanceof c&&!function(e){let t=A(e);t&&t.tagName||(t={namespaceURI:ft,tagName:"template"});const n=k(e.tagName),r=k(t.tagName);return!!mt[e.namespaceURI]&&(e.namespaceURI===ct?t.namespaceURI===ut?"svg"===n:t.namespaceURI===lt?"svg"===n&&("annotation-xml"===r||ht[r]):Boolean(vt[n]):e.namespaceURI===lt?t.namespaceURI===ut?"math"===n:t.namespaceURI===ct?"math"===n&&gt[r]:Boolean(Nt[n]):e.namespaceURI===ut?!(t.namespaceURI===ct&&!gt[r])&&!(t.namespaceURI===lt&&!ht[r])&&!Nt[n]&&(yt[n]||!vt[n]):!("application/xhtml+xml"!==bt||!mt[e.namespaceURI]))}(e)?(Rt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!B(/<\/no(script|embed|frames)/i,e.innerHTML)?(He&&e.nodeType===Te&&(t=e.textContent,v([pe,de,he],e=>{t=L(t,e," ")}),e.textContent!==t&&(I(n.removed,{element:e.cloneNode()}),e.textContent=t)),xt(fe.afterSanitizeElements,e,null),!1):(Rt(e),!0)},Mt=function(e,t,n){if(Ue[t])return!1;if(Ke&&("id"===t||"name"===t)&&(n in r||n in St))return!1;const o=Ce[t]||Fe.attributeCheck instanceof Function&&Fe.attributeCheck(t,e);if(ze&&!Ue[t]&&B(ye,t));else if(Pe&&B(ve,t));else if(!o||Ue[t]){if(!(Ft(e)&&(Le.tagNameCheck instanceof RegExp&&B(Le.tagNameCheck,e)||Le.tagNameCheck instanceof Function&&Le.tagNameCheck(e))&&(Le.attributeNameCheck instanceof RegExp&&B(Le.attributeNameCheck,t)||Le.attributeNameCheck instanceof Function&&Le.attributeNameCheck(t,e))||"is"===t&&Le.allowCustomizedBuiltInElements&&(Le.tagNameCheck instanceof RegExp&&B(Le.tagNameCheck,n)||Le.tagNameCheck instanceof Function&&Le.tagNameCheck(n))))return!1}else if(at[t]);else if(B(De,L(n,Re,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==M(n,"data:")||!ot[e]){if($e&&!B(Ne,L(n,Re,"")));else if(n)return!1}else;return!0},Ut=Y({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ft=function(e){return!Ut[k(e)]&&B(Ie,e)},Pt=function(e){xt(fe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||kt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ce,forceKeepAttr:void 0};let o=t.length;for(;o--;){const i=t[o],{name:a,namespaceURI:s,value:l}=i,c=Tt(a),u=l;let f="value"===a?u:U(u);if(r.attrName=c,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,xt(fe.uponSanitizeAttribute,e,r),f=r.attrValue,!Ze||"id"!==c&&"name"!==c||0===M(f,Qe)||(It(a,e),f=Qe+f),Be&&B(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){It(a,e);continue}if("attributename"===c&&x(f,"href")){It(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){It(a,e);continue}if(!je&&B(/\/>/i,f)){It(a,e);continue}He&&v([pe,de,he],e=>{f=L(f,e," ")});const p=Tt(e.nodeName);if(Mt(p,c,f)){if(_&&"object"==typeof d&&"function"==typeof d.getAttributeType)if(s);else switch(d.getAttributeType(p,c)){case"TrustedHTML":f=_.createHTML(f);break;case"TrustedScriptURL":f=_.createScriptURL(f)}if(f!==u)try{s?e.setAttributeNS(s,a,f):e.setAttribute(a,f),kt(e)?Rt(e):R(n.removed)}catch(t){It(a,e)}}else It(a,e)}xt(fe.afterSanitizeAttributes,e,null)},zt=function(e){let t=null;const n=Ot(e);for(xt(fe.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)xt(fe.uponSanitizeShadowNode,t,null),Lt(t),Pt(t),t.content instanceof a&&zt(t.content);xt(fe.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,s=null,c=null;if(pt=!e,pt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ct(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return F(e);case"boolean":return P(e);case"bigint":return z?z(e):"0";case"symbol":return $?$(e):"Symbol()";case"undefined":default:return H(e);case"function":case"object":{if(null===e)return H(e);const t=e,n=K(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:H(e)}return H(e)}}}(e)))throw W("dirty is not a string, aborting");if(!n.isSupported)return e;if(Ge||_t(t),n.removed=[],"string"==typeof e&&(et=!1),et){const t=e.nodeName;if("string"==typeof t){const e=Tt(t);if(!Oe[e]||Me[e])throw W("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)r=Dt("\x3c!----\x3e"),i=r.ownerDocument.importNode(e,!0),i.nodeType===we&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i);else{if(!Ye&&!He&&!We&&-1===e.indexOf("<"))return _&&Xe?_.createHTML(e):e;if(r=Dt(e),!r)return Ye?null:Xe?G:""}r&&qe&&Rt(r.firstChild);const u=Ot(et?e:r);for(;s=u.nextNode();)Lt(s),Pt(s),s.content instanceof a&&zt(s.content);if(et)return e;if(Ye){if(He){r.normalize();let e=r.innerHTML;v([pe,de,he],t=>{e=L(e,t," ")}),r.innerHTML=e}if(Ve)for(c=le.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return(Ce.shadowroot||Ce.shadowrootmode)&&(c=ue.call(o,c,!0)),c}let f=We?r.outerHTML:r.innerHTML;return We&&Oe["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&B(ge,r.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+f),He&&v([pe,de,he],e=>{f=L(f,e," ")}),_&&Xe?_.createHTML(f):f},n.setConfig=function(){_t(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ge=!0},n.clearConfig=function(){Et=null,Ge=!1},n.isValidAttribute=function(e,t,n){Et||_t({});const r=Tt(e),o=Tt(t);return Mt(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&I(fe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=N(fe[e],t);return-1===n?void 0:D(fe[e],n,1)[0]}return R(fe[e])},n.removeHooks=function(e){fe[e]=[]},n.removeAllHooks=function(){fe={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"]);async function Ne(e){const t=(await async function(e){try{const t=await fetch(e).catch(t=>{throw new l(`Error fetching dynamic fonts file ${e}. ${t}`)});if(200!==t.status)throw new l(`Error fetching dynamic fonts file ${e}. Status code: ${t.status}`);return t}catch(e){throw e}}(e)).json().catch(t=>{throw new l(`Error parsing dynamic fonts file ${e}. ${t}`)});return t}let Re=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 Ie=/^data:([^;,]+)?;base64,(.*)$/i,De=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,Oe=new Set(["original","fixed","fit-width","fit-height","fit-max"]),ke=new Set(["png","jpg","gif","bmp","tif"]),Ce={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tif","image/x-tiff":"tif"};async function xe(e){const t={urlImageReferences:[]},n=Le(e.model,"$.model",t);if(t.urlImageReferences.length>0){const e=await async function(e){const t=Array.from(new Set(e.map(e=>e.normalizedUrl))),n=new Map;for(const t of e){if(!t.preferredFormat)continue;const e=n.get(t.normalizedUrl);if(e){if(e.format!==t.preferredFormat)throw new Error(`Conflicting image formats for URL "${t.normalizedUrl}" between ${e.path} and ${t.path}.`)}else n.set(t.normalizedUrl,{format:t.preferredFormat,path:t.path})}const r=await Promise.all(t.map(e=>async function(e,t){let n;try{n=await fetch(e)}catch(t){throw new Error(`Failed to fetch ${e}. This can happen when the URL is cross-origin without CORS headers. Configure CORS or pass base64/data URL instead.`)}if(!n.ok)throw new Error(`Failed to fetch ${e}: ${n.status} ${n.statusText}.`);const r=new Uint8Array(await n.arrayBuffer()),o=n.headers.get("content-type");if(o?.toLowerCase().includes("image/svg+xml"))throw new Error("svg format is not supported in this release.");const i=function(e){if(!e)return;const t=e.toLowerCase().split(";")[0].trim();return Ce[t]}(o),a=function(e){try{const t=new URL(e).pathname,n=t.split(".").pop()?.toLowerCase();if(!n)return;return Pe(n)??void 0}catch(e){return}}(e),s=t??i??a;if(!s)throw new Error(`Failed to infer image format for ${e}. Provide "format" in the image object.`);return{normalizedUrl:e,base64Data:Me(r),format:s}}(e,n.get(e)?.format)));return new Map(r.map(e=>[e.normalizedUrl,e]))}(t.urlImageReferences);!function(e,t){for(const n of e){const e=t.get(n.normalizedUrl);n.image.source="base64",n.image.data=e.base64Data,null==n.image.format&&e.format&&(n.image.format=e.format),delete n.image.url,delete n.image.path}}(t.urlImageReferences,e)}const r=function(e){if(null==e)return{delimiter:{start:"{",end:"}"}};if(!u(e))throw new Error("$.config must be a valid object.");const t={...e},n=t.delimiter;return t.delimiter=function(e){if(null==e)return{start:"{",end:"}"};if(!u(e))throw new Error("$.config.delimiter must be a valid object.");const t={...e},{start:n,end:r,objectDelimiter:o}=t;if(null!=n&&"string"!=typeof n)throw new Error("$.config.delimiter.start must be a string.");if(null!=r&&"string"!=typeof r)throw new Error("$.config.delimiter.end must be a string.");if(null!=o&&"string"!=typeof o)throw new Error("$.config.delimiter.objectDelimiter must be a string.");return t.start="string"==typeof n?n:"{",t.end="string"==typeof r?r:"}",t}(n),t}(e.config);return{serializedData:JSON.stringify({config:r,model:n},null,2)}}function Le(e,t,n){if(Array.isArray(e))return e.map((e,r)=>Le(e,`${t}[${r}]`,n));if(!u(e))return e;if(function(e){return u(e)&&"image"===e._type}(e))return function(e,t,n){const r={...e},o=function(e,t){if("string"!=typeof e)throw new Error(`${t}.source must be a string.`);if("dataUrl"===e)return"base64";if("base64"===e||"url"===e)return e;if("file"===e)throw new Error(`${t}.source "file" is not supported in public APIs. Use "base64" (or "dataUrl") or "url".`);throw new Error(`${t}.source must be one of "base64", "dataUrl", or "url". Received "${e}".`)}(r.source,t);r.source=o,function(e,t){if(void 0===e.sizing)return;if(!Oe.has(e.sizing))throw new Error(`${t}.sizing must be one of "original", "fixed", "fit-width", "fit-height", "fit-max".`);switch(e.sizing){case"fixed":case"fit-max":Fe(e.width,`${t}.width`),Fe(e.height,`${t}.height`);break;case"fit-width":Fe(e.width,`${t}.width`);break;case"fit-height":Fe(e.height,`${t}.height`)}}(r,t),function(e,t){if(void 0===e.pageNumber)return;if(!Number.isInteger(e.pageNumber)||e.pageNumber<=0)throw new Error(`${t}.pageNumber must be a positive integer.`)}(r,t);const i=function(e,t){if(void 0===e)return;if("string"!=typeof e)throw new Error(`${t}.format must be a string.`);if("svg"===e.toLowerCase().trim())throw new Error(`${t}.format svg is not supported in this release.`);const n=Pe(e);if(!n)throw new Error(`${t}.format must be one of "png", "jpg"/"jpeg", "gif", "bmp", "tif"/"tiff".`);return n}(r.format,t);i&&(r.format=i);switch(o){case"base64":{const e=r.data;if("string"!=typeof e||""===e.trim())throw new Error(`${t}.data must be a non-empty string.`);const n=function(e,t){const n=Ie.exec(e.trim());if(n){const e=(n[1]||"").toLowerCase(),r=n[2];if(!r)throw new Error(`${t} must contain non-empty base64 data.`);if("image/svg+xml"===e)throw new Error(`${t} does not support svg images in this release.`);return Ue(r,t),{isDataUrl:!0}}return Ue(e.trim(),t),{isDataUrl:!1}}(e,`${t}.data`);if(!n.isDataUrl&&!r.format)throw new Error(`${t}.format must be supplied when source is raw base64 data.`);break}case"url":{const e="string"==typeof r.url&&""!==r.url.trim()?r.url.trim():"string"==typeof r.path&&""!==r.path.trim()?r.path.trim():null;if(!e)throw new Error(`${t}.url must be supplied when source is "url".`);const o=function(e,t){let n;try{n=new URL(e.trim())}catch(e){throw new Error(`${t} must be a valid absolute URL.`)}if(!["http:","https:"].includes(n.protocol))throw new Error(`${t} must use http or https.`);return n.toString()}(e,`${t}.url`);r.url=o,n.urlImageReferences.push({path:t,image:r,normalizedUrl:o,preferredFormat:r.format});break}}return r}(e,t,n);const r={};for(const[o,i]of Object.entries(e))r[o]=Le(i,`${t}${ze(o)}`,n);return r}function Me(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");let t="";for(let n=0;n<e.length;n+=32768){const r=e.subarray(n,n+32768);t+=String.fromCharCode(...r)}return btoa(t)}function Ue(e,t){const n=e.replace(/\s+/g,"");if(""===n||!De.test(n))throw new Error(`${t} must be valid base64 data.`)}function Fe(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<=0)throw new Error(`${t} must be a positive number.`)}function Pe(e){const t=e.toLowerCase().trim();return"jpeg"===t?"jpg":"tiff"===t?"tif":ke.has(t)?t:null}function ze(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`.${e}`:`[${JSON.stringify(e)}]`}const $e=/^(?:[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 je=function(e){return"string"==typeof e&&$e.test(e)};const He=function(e){if(!je(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)};const Be=[];for(let e=0;e<256;++e)Be.push((e+256).toString(16).slice(1));function We(e,t=0){return(Be[e[t+0]]+Be[e[t+1]]+Be[e[t+2]]+Be[e[t+3]]+"-"+Be[e[t+4]]+Be[e[t+5]]+"-"+Be[e[t+6]]+Be[e[t+7]]+"-"+Be[e[t+8]]+Be[e[t+9]]+"-"+Be[e[t+10]]+Be[e[t+11]]+Be[e[t+12]]+Be[e[t+13]]+Be[e[t+14]]+Be[e[t+15]]).toLowerCase()}let Ge;const qe=new Uint8Array(16);function Ye(e){return 14+(e+64>>>9<<4)+1}function Ve(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function Xe(e,t,n,r,o,i){return Ve((a=Ve(Ve(t,e),Ve(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function Ke(e,t,n,r,o,i,a){return Xe(t&n|~t&r,e,t,o,i,a)}function Ze(e,t,n,r,o,i,a){return Xe(t&r|n&~r,e,t,o,i,a)}function Qe(e,t,n,r,o,i,a){return Xe(t^n^r,e,t,o,i,a)}function Je(e,t,n,r,o,i,a){return Xe(n^(t|~r),e,t,o,i,a)}const et=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(Ye(t)).fill(0);n.set(e),n[t>>5]|=128<<t%32,n[n.length-1]=t,e=n;let r=1732584193,o=-271733879,i=-1732584194,a=271733878;for(let t=0;t<e.length;t+=16){const n=r,s=o,l=i,c=a;r=Ke(r,o,i,a,e[t],7,-680876936),a=Ke(a,r,o,i,e[t+1],12,-389564586),i=Ke(i,a,r,o,e[t+2],17,606105819),o=Ke(o,i,a,r,e[t+3],22,-1044525330),r=Ke(r,o,i,a,e[t+4],7,-176418897),a=Ke(a,r,o,i,e[t+5],12,1200080426),i=Ke(i,a,r,o,e[t+6],17,-1473231341),o=Ke(o,i,a,r,e[t+7],22,-45705983),r=Ke(r,o,i,a,e[t+8],7,1770035416),a=Ke(a,r,o,i,e[t+9],12,-1958414417),i=Ke(i,a,r,o,e[t+10],17,-42063),o=Ke(o,i,a,r,e[t+11],22,-1990404162),r=Ke(r,o,i,a,e[t+12],7,1804603682),a=Ke(a,r,o,i,e[t+13],12,-40341101),i=Ke(i,a,r,o,e[t+14],17,-1502002290),o=Ke(o,i,a,r,e[t+15],22,1236535329),r=Ze(r,o,i,a,e[t+1],5,-165796510),a=Ze(a,r,o,i,e[t+6],9,-1069501632),i=Ze(i,a,r,o,e[t+11],14,643717713),o=Ze(o,i,a,r,e[t],20,-373897302),r=Ze(r,o,i,a,e[t+5],5,-701558691),a=Ze(a,r,o,i,e[t+10],9,38016083),i=Ze(i,a,r,o,e[t+15],14,-660478335),o=Ze(o,i,a,r,e[t+4],20,-405537848),r=Ze(r,o,i,a,e[t+9],5,568446438),a=Ze(a,r,o,i,e[t+14],9,-1019803690),i=Ze(i,a,r,o,e[t+3],14,-187363961),o=Ze(o,i,a,r,e[t+8],20,1163531501),r=Ze(r,o,i,a,e[t+13],5,-1444681467),a=Ze(a,r,o,i,e[t+2],9,-51403784),i=Ze(i,a,r,o,e[t+7],14,1735328473),o=Ze(o,i,a,r,e[t+12],20,-1926607734),r=Qe(r,o,i,a,e[t+5],4,-378558),a=Qe(a,r,o,i,e[t+8],11,-2022574463),i=Qe(i,a,r,o,e[t+11],16,1839030562),o=Qe(o,i,a,r,e[t+14],23,-35309556),r=Qe(r,o,i,a,e[t+1],4,-1530992060),a=Qe(a,r,o,i,e[t+4],11,1272893353),i=Qe(i,a,r,o,e[t+7],16,-155497632),o=Qe(o,i,a,r,e[t+10],23,-1094730640),r=Qe(r,o,i,a,e[t+13],4,681279174),a=Qe(a,r,o,i,e[t],11,-358537222),i=Qe(i,a,r,o,e[t+3],16,-722521979),o=Qe(o,i,a,r,e[t+6],23,76029189),r=Qe(r,o,i,a,e[t+9],4,-640364487),a=Qe(a,r,o,i,e[t+12],11,-421815835),i=Qe(i,a,r,o,e[t+15],16,530742520),o=Qe(o,i,a,r,e[t+2],23,-995338651),r=Je(r,o,i,a,e[t],6,-198630844),a=Je(a,r,o,i,e[t+7],10,1126891415),i=Je(i,a,r,o,e[t+14],15,-1416354905),o=Je(o,i,a,r,e[t+5],21,-57434055),r=Je(r,o,i,a,e[t+12],6,1700485571),a=Je(a,r,o,i,e[t+3],10,-1894986606),i=Je(i,a,r,o,e[t+10],15,-1051523),o=Je(o,i,a,r,e[t+1],21,-2054922799),r=Je(r,o,i,a,e[t+8],6,1873313359),a=Je(a,r,o,i,e[t+15],10,-30611744),i=Je(i,a,r,o,e[t+6],15,-1560198380),o=Je(o,i,a,r,e[t+13],21,1309151649),r=Je(r,o,i,a,e[t+4],6,-145523070),a=Je(a,r,o,i,e[t+11],10,-1120210379),i=Je(i,a,r,o,e[t+2],15,718787259),o=Je(o,i,a,r,e[t+9],21,-343485551),r=Ve(r,n),o=Ve(o,s),i=Ve(i,l),a=Ve(a,c)}return Uint32Array.of(r,o,i,a)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(Ye(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 tt="6ba7b810-9dad-11d1-80b4-00c04fd430c8",nt="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function rt(e,t,n,r,o,i){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?He(r):r;if("string"==typeof r&&(r=He(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(s),l.set(a,s.length),l=t(l),l[6]=15&l[6]|e,l[8]=63&l[8]|128,o){i=i||0;for(let e=0;e<16;++e)o[i+e]=l[e];return o}return We(l)}function ot(e,t,n,r){return rt(48,et,e,t,n,r)}ot.DNS=tt,ot.URL=nt;const it={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};const at=function(e,t,n){if(it.randomUUID&&!t&&!e)return it.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Ge){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ge=crypto.getRandomValues.bind(crypto)}return Ge(qe)}();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 We(r)};function st(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 lt(e,t){return e<<t|e>>>32-t}const ct=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 o=(e=r).length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let t=0;t<i;++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[i-1][14]=8*(e.length-1)/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++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]=lt(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let o=n[0],i=n[1],s=n[2],l=n[3],c=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),a=lt(o,5)+st(n,i,s,l)+c+t[n]+r[e]>>>0;c=l,l=s,s=lt(i,30)>>>0,i=o,o=a}n[0]=n[0]+o>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+l>>>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 ut(e,t,n,r){return rt(80,ct,e,t,n,r)}ut.DNS=tt,ut.URL=nt;function ft(){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=at();return window.localStorage.setItem(e,t),t}catch{return null}}class pt{constructor(){d(this,"maxQueueSize",1e3),d(this,"flushTimer",null),d(this,"visibilityChangeHandler",null),d(this,"isFlushing",!1),d(this,"queue",[]),d(this,"allEvents",[])}static getInstance(){return pt.instance||(pt.instance=new pt),pt.instance}emit(e){this.collect(e)}configure(e){const{hmacSecret:t,endpoint:n,flushInterval:r,maxQueueSize:o,clientInfo:i}=e;this.clientInfo=i,this.hmacSecret=this.hexStringToHmacSecret(t),this.endpoint=n,void 0!==o&&(this.maxQueueSize=o),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(){pt.instance&&(pt.instance.cleanup(),pt.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 t=await this.uploadBatch(e);this.requeue(t)}finally{this.isFlushing=!1}}async uploadBatch(e){try{const t=await this.prepareUpload(e);if(!t)return e;const n=`${this.endpoint}/proto/metrics`,r=await fetch(n,{method:"POST",headers:t.headers,body:t.body,keepalive:!0});return r.ok?[]:413===r.status?this.splitAndRetryBatch(e):e}catch(t){return e}}async splitAndRetryBatch(e){if(e.length<=1)return f("Dropping one analytics event: metrics endpoint rejected a single-event payload as too large (HTTP 413)."),[];const t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t);return[...await this.uploadBatch(n),...await this.uploadBatch(r)]}async prepareUpload(e){const{prepareUpload:t}=await Promise.all([i.e(340),i.e(567)]).then(i.bind(i,23948));return t({clientInfo:{...this.clientInfo,tag:ft()??void 0},hmacSecret:this.hmacSecret},this.buildMetrics(e))}buildMetrics(e){return 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}))}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 mt(e){var t,n;t="convert|from|office",n={feature:"office_conversion",mimeType:e},pt.getInstance().emit({name:t,attributes:n??{},timestamp:Date.now()})}d(pt,"instance",void 0);const dt="/create.pdf",ht="/save.pdf",gt="/create.docx",yt="/save.docx",bt="/templateData.json",wt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;let Tt=null,Et=null;function St(e){let t;c(Et,"GdPicture WebAssembly is not loaded.");for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(const e of r)t=Object.assign(r[0],e);const i=JSON.stringify({type:e,...t}),a=JSON.parse(Et.CommandHandler(i));if(!a.success)throw new Error(a.errorReason+": "+a.errorMessage+"\n"+a.error);return a}const At={allMarkup:0,simpleMarkup:1,noMarkup:2,original:3},_t=At.noMarkup,vt={documentMarkupMode:_t};function Nt(e){if(!e)return vt;if(!e.documentMarkupMode)return{...e,documentMarkupMode:_t};if(!(e.documentMarkupMode in At))throw new Error(`Invalid documentMarkupMode value: ${e.documentMarkupMode}. Allowed values are: ${Object.keys(At).join(", ")}`);return{...e,documentMarkupMode:At[e.documentMarkupMode]}}const Rt={"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"},It=new class{_mountCustomFonts(e,t){c(Tt,"WebAssembly module not loaded."),Tt.FS.mkdir(t);{const n=wt?Tt.FS.filesystems.WORKERFS:Tt.FS.filesystems.MEMFS;Tt.FS.mount(n,{blobs:e},t)}}async loadModule(e,t,n,r,o,i,a){const{Assemblies:s,Module:l}=await async function(e,t){if("string"==typeof e){const n="nutrient-viewer-lib/",r=`${n}gdpicture-249e54e8/jit`,o=`${n}gdpicture-249e54e8/aot`;let i,a;t?(i=`${e}${o}/initDotnet.js`,a=`${e}${o}`):(i=`${e}${r}/initDotnet.js`,a=`${e}${r}`);const{initDotnet:s}=await import(i);return s(a,(e,t,n,r,o)=>"blazor.boot.json"===t?fetch(n,{credentials:"same-origin"}):null)}throw new Error("GdPicture WASM loader not implemented")}(e,t);Et=s.GdPictureWasm.API,Tt=l,St("gdpicture/setLicense",{origin:n},{licenseKey:r||"DEMO_PSPDFKIT_WEB"});const c=o?"/fonts":"";if(o&&!Tt.FS.analyzePath(c).exists&&(this._mountCustomFonts(o,c),St("gdpicture/setFonts",{fontPaths:[c]})),i){const e=await Ne(i);St("gdpicture/setDynamicFontLoading",{baseUrl:i.split("/").slice(0,-1).join("/"),allowedFonts:e.availableFonts,v:1})}a&&St("gdpicture/setFontSubstitutions",{fontSubstitutions:a})}toPdf(e,t,n,r,o){let i=dt;if(o&&"pdf"!==o&&Object.values(Rt).includes(o)){mt(Object.keys(Rt).find(e=>Rt[e].toLowerCase()===o.toLowerCase()).toLowerCase()),i+=`.${o}`}else if(r&&"application/pdf"!==r){const e=r.toLowerCase();mt(e);const t=Rt.hasOwnProperty(e)&&Rt[e];t&&(i+=`.${t}`)}Tt.FS.writeFile(i,new Uint8Array(e),{canOwn:!0});const a={file:ht,format:"pdf",conformance:t&&t in Re?t:void 0,officeConversionSettings:Nt(n)};try{return St("gdpicture/process",{input:{file:i},output:a}),Tt.FS.readFile(ht).buffer}finally{try{Tt.FS.unlink(ht),Tt.FS.unlink(i)}catch(e){}}}toOffice(e,t){Tt.FS.writeFile(dt,new Uint8Array(e));const n=`/save.${t}`;try{return St("gdpicture/process",{input:{file:dt},output:{file:n,format:t}}),Tt.FS.readFile(n).buffer}finally{try{Tt.FS.unlink(n),Tt.FS.unlink(dt)}catch(e){console.log(e.message)}}}async populateDocumentTemplate(e,t){Tt.FS.writeFile(gt,new Uint8Array(e));const{serializedData:n}=await xe(t);Tt.FS.writeFile(bt,n);try{return St("gdpicture/process-office-template",{inputFile:gt,modelAndConfigFile:bt,outputFile:yt}),Tt.FS.readFile(yt).buffer}finally{try{Tt.FS.unlink(yt),Tt.FS.unlink(bt),Tt.FS.unlink(gt)}catch(e){console.log(e.message)}}}},Dt=self;return Dt.global=Dt,Dt.module={},Dt.addEventListener("message",async e=>{let t,n,{data:r}=e;try{const e=await It[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 o=[...r.args].filter(e=>e instanceof ArrayBuffer);o.length>0&&(n=o),t={id:r.id,error:e.message||e.toString(),callArgs:r.args}}Dt.postMessage(t,n)}),{}})());