@embedpdf/snippet 2.0.0-next.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(e,t,n,o,i,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,i)}function n(e){return function(){var n=this,o=arguments;return new Promise(function(i,r){var a=e.apply(n,o);function s(e){t(a,i,r,s,l,"next",e)}function l(e){t(a,i,r,s,l,"throw",e)}s(void 0)})}}function o(e,t,n){return t=l(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,b(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=x(e))||t){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function s(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t){if(null==e)return{};var n,o,i=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(){
2
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
+ var e,t,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function r(n,o,i,r){var l=o&&o.prototype instanceof s?o:s,c=Object.create(l.prototype);return p(c,"_invoke",function(n,o,i){var r,s,l,c=0,d=i||[],u=!1,h={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return r=t,s=0,l=e,h.n=n,a}};function m(n,o){for(s=n,l=o,t=0;!u&&c&&!i&&t<d.length;t++){var i,r=d[t],m=h.p,g=r[2];n>3?(i=g===o)&&(l=r[(s=r[4])?5:(s=3,3)],r[4]=r[5]=e):r[0]<=m&&((i=n<2&&m<r[1])?(s=0,h.v=o,h.n=r[1]):m<g&&(i=n<3||r[0]>o||o>g)&&(r[4]=n,r[5]=o,h.n=g,s=0))}if(i||n>1)return a;throw u=!0,o}return function(i,d,g){if(c>1)throw TypeError("Generator is already running");for(u&&1===d&&m(d,g),s=d,l=g;(t=s<2?e:l)||!u;){r||(s?s<3?(s>1&&(h.n=-1),m(s,l)):h.n=l:h.v=l);try{if(c=2,r){if(s||(i="next"),t=r[i]){if(!(t=t.call(r,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=r.return)&&t.call(r),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);r=e}else if((t=(u=h.n<0)?l:n.call(o,h))!==a)break}catch(t){r=e,s=1,l=t}finally{c=1}}return{value:t,done:u}}}(n,i,r),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var d=[][o]?t(t([][o]())):(p(t={},o,function(){return this}),t),u=c.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,p(e,i,"GeneratorFunction")),e.prototype=Object.create(u),e}return l.prototype=c,p(u,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,i,"GeneratorFunction"),p(u),p(u,i,"Generator"),p(u,o,function(){return this}),p(u,"toString",function(){return"[object Generator]"}),(g=function(){return{w:r,m:h}})()}function p(e,t,n,o){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,o){function r(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},p(e,t,n,o)}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,r,a,s=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t);else for(;!(l=(o=r.call(n)).done)&&(s.push(o.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||x(e,t)||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.")}()}function y(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function w(e){return w="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},w(e)}function x(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}var C,I,S,k,D,M,P,A,T,z,E,_,R={},N=[],O=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,L=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function j(e,t,n){var o,i,r,a={};for(r in t)"key"==r?o=t[r]:"ref"==r?i=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?C.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===a[r]&&(a[r]=e.defaultProps[r]);return H(e,a,o,i,null)}function H(e,t,n,o,i){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++S:i,__i:-1,__u:0};return null==i&&null!=I.vnode&&I.vnode(r),r}function U(e){return e.children}function W(e,t){this.props=e,this.context=t}function B(e,t){if(null==t)return e.__?B(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?B(e):null}function q(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return q(e)}}function G(e){(!e.__d&&(e.__d=!0)&&k.push(e)&&!V.__r++||D!=I.debounceRendering)&&((D=I.debounceRendering)||M)(V)}function V(){for(var e,t,n,o,i,r,a,s=1;k.length;)k.length>s&&k.sort(P),e=k.shift(),s=k.length,e.__d&&(n=void 0,o=void 0,i=(o=(t=e).__v).__e,r=[],a=[],t.__P&&((n=$({},o)).__v=o.__v+1,I.vnode&&I.vnode(n),te(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[i]:null,r,null==i?B(o):i,!!(32&o.__u),a),n.__v=o.__v,n.__.__k[n.__i]=n,oe(r,n,a),o.__e=o.__=null,n.__e!=i&&q(n)));V.__r=0}function Z(e,t,n,o,i,r,a,s,l,c,d){var u,h,m,g,p,v,f,y=o&&o.__k||N,b=t.length;for(l=function(e,t,n,o,i){var r,a,s,l,c,d=n.length,u=d,h=0;for(e.__k=new Array(i),r=0;r<i;r++)null!=(a=t[r])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[r]=H(null,a,null,null,null):L(a)?a=e.__k[r]=H(U,{children:a},null,null,null):null==a.constructor&&a.__b>0?a=e.__k[r]=H(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,l=r+h,a.__=e,a.__b=e.__b+1,-1!=(c=a.__i=X(a,n,l,u))&&(u--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[r]=null;if(u)for(r=0;r<d;r++)null!=(s=n[r])&&!(2&s.__u)&&(s.__e==o&&(o=B(s)),se(s,s));return o}(n,t,y,l,b),u=0;u<b;u++)null!=(m=n.__k[u])&&(h=-1==m.__i?R:y[m.__i]||R,m.__i=u,v=te(e,m,h,i,r,a,s,l,c,d),g=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&ae(h.ref,null,m),d.push(m.ref,m.__c||g,m)),null==p&&null!=g&&(p=g),(f=!!(4&m.__u))||h.__k===m.__k?l=K(m,l,e,f):"function"==typeof m.type&&void 0!==v?l=v:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=p,l}function K(e,t,n,o){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=K(i[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=B(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Y(e,t){return t=t||[],null==e||"boolean"==typeof e||(L(e)?e.some(function(e){Y(e,t)}):t.push(e)),t}function X(e,t,n,o){var i,r,a,s=e.key,l=e.type,c=t[n],d=null!=c&&!(2&c.__u);if(null===c&&null==s||d&&s==c.key&&l==c.type)return n;if(o>(d?1:0))for(i=n-1,r=n+1;i>=0||r<t.length;)if(null!=(c=t[a=i>=0?i--:r++])&&!(2&c.__u)&&s==c.key&&l==c.type)return a;return-1}function Q(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||O.test(t)?n:n+"px"}function J(e,t,n,o,i){var r,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Q(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Q(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(A,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o?n.u=o.u:(n.u=T,e.addEventListener(t,r?E:z,r)):e.removeEventListener(t,r?E:z,r);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function ee(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=T++;else if(t.t<n.u)return;return n(I.event?I.event(t):t)}}}function te(e,t,n,o,i,r,a,s,l,c){var d,u,h,m,g,p,v,f,y,b,w,x,C,S,k,D,M,P=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[s=t.__e=n.__e]),(d=I.__b)&&d(t);e:if("function"==typeof P)try{if(f=t.props,y="prototype"in P&&P.prototype.render,b=(d=P.contextType)&&o[d.__c],w=d?b?b.props.value:d.__:o,n.__c?v=(u=t.__c=n.__c).__=u.__E:(y?t.__c=u=new P(f,w):(t.__c=u=new W(f,w),u.constructor=P,u.render=le),b&&b.sub(u),u.state||(u.state={}),u.__n=o,h=u.__d=!0,u.__h=[],u._sb=[]),y&&null==u.__s&&(u.__s=u.state),y&&null!=P.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=$({},u.__s)),$(u.__s,P.getDerivedStateFromProps(f,u.__s))),m=u.props,g=u.state,u.__v=t,h)y&&null==P.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),y&&null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(y&&null==P.getDerivedStateFromProps&&f!==m&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(f,w),t.__v==n.__v||!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(f,u.__s,w)){for(t.__v!=n.__v&&(u.props=f,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(f,u.__s,w),y&&null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(m,g,p)})}if(u.context=w,u.props=f,u.__P=e,u.__e=!1,C=I.__r,S=0,y){for(u.state=u.__s,u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++S<25);u.state=u.__s,null!=u.getChildContext&&(o=$($({},o),u.getChildContext())),y&&!h&&null!=u.getSnapshotBeforeUpdate&&(p=u.getSnapshotBeforeUpdate(m,g)),D=d,null!=d&&d.type===U&&null==d.key&&(D=ie(d.props.children)),s=Z(e,L(D)?D:[D],t,n,o,i,r,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),v&&(u.__E=u.__=null)}catch(e){if(t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,t.__e=s}else{for(M=r.length;M--;)F(r[M]);ne(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ne(t);I.__e(e,t,n)}else null==r&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=re(n.__e,t,n,o,i,r,a,l,c);return(d=I.diffed)&&d(t),128&t.__u?void 0:s}function ne(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ne)}function oe(e,t,n){for(var o=0;o<n.length;o++)ae(n[o],n[++o],n[++o]);I.__c&&I.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){I.__e(e,t.__v)}})}function ie(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:L(e)?e.map(ie):$({},e)}function re(e,t,n,o,i,r,a,s,l){var c,d,u,h,m,g,p,v=n.props||R,f=t.props,y=t.type;if("svg"==y?i="http://www.w3.org/2000/svg":"math"==y?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;c<r.length;c++)if((m=r[c])&&"setAttribute"in m==!!y&&(y?m.localName==y:3==m.nodeType)){e=m,r[c]=null;break}if(null==e){if(null==y)return document.createTextNode(f);e=document.createElementNS(i,y,f.is&&f),s&&(I.__m&&I.__m(t,r),s=!1),r=null}if(null==y)v===f||s&&e.data==f||(e.data=f);else{if(r=r&&C.call(e.childNodes),!s&&null!=r)for(v={},c=0;c<e.attributes.length;c++)v[(m=e.attributes[c]).name]=m.value;for(c in v)if(m=v[c],"children"==c);else if("dangerouslySetInnerHTML"==c)u=m;else if(!(c in f)){if("value"==c&&"defaultValue"in f||"checked"==c&&"defaultChecked"in f)continue;J(e,c,null,m,i)}for(c in f)m=f[c],"children"==c?h=m:"dangerouslySetInnerHTML"==c?d=m:"value"==c?g=m:"checked"==c?p=m:s&&"function"!=typeof m||v[c]===m||J(e,c,m,v[c],i);if(d)s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),Z("template"==t.type?e.content:e,L(h)?h:[h],t,n,o,"foreignObject"==y?"http://www.w3.org/1999/xhtml":i,r,a,r?r[0]:n.__k&&B(n,0),s,l),null!=r)for(c=r.length;c--;)F(r[c]);s||(c="value","progress"==y&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==y&&!g||"option"==y&&g!=v[c])&&J(e,c,g,v[c],i),c="checked",null!=p&&p!=e[c]&&J(e,c,p,v[c],i))}return e}function ae(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){I.__e(e,n)}}function se(e,t,n){var o,i;if(I.unmount&&I.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ae(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){I.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&se(o[i],t,n||"function"!=typeof e.type);n||F(e.__e),e.__c=e.__=e.__e=void 0}function le(e,t,n){return this.constructor(e,n)}function ce(e,t,n){var o,i,r;t==document&&(t=document.documentElement),I.__&&I.__(e,t),o=!1?null:t.__k,i=[],r=[],te(t,e=t.__k=j(U,null,[e]),o||R,R,t.namespaceURI,o?null:t.firstChild?C.call(t.childNodes):null,i,o?o.__e:t.firstChild,false,r),oe(i,e,r)}function de(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,G(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+_++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}C=N.slice,I={__e:function(e,t,n,o){for(var i,r,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,o||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},S=0,W.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=$({},this.state),"function"==typeof e&&(e=e($({},n),this.props)),e&&$(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),G(this))},W.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),G(this))},W.prototype.render=U,k=[],M="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,P=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,A=/(PointerCapture)$|Capture$/i,T=0,z=ee(!1),E=ee(!0),_=0;var ue,he,me,ge,pe=0,ve=[],fe=I,ye=fe.__b,be=fe.__r,we=fe.diffed,xe=fe.__c,Ce=fe.unmount,Ie=fe.__;function Se(e,t){fe.__h&&fe.__h(he,e,pe||t),pe=0;var n=he.__H||(he.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ke(e){return pe=1,De(Fe,e)}function De(e,t,n){var o=Se(ue++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Fe(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=he,!he.__f)){var i=function(e,t,n){if(!o.__c.__H)return!0;var i=o.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!r||r.call(this,e,t,n);var a=o.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),r&&r.call(this,e,t,n)||a};he.__f=!0;var r=he.shouldComponentUpdate,a=he.componentWillUpdate;he.componentWillUpdate=function(e,t,n){if(this.__e){var o=r;r=void 0,i(e,t,n),r=o}a&&a.call(this,e,t,n)},he.shouldComponentUpdate=i}return o.__N||o.__}function Me(e,t){var n=Se(ue++,3);!fe.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__H.__h.push(n))}function Pe(e,t){var n=Se(ue++,4);!fe.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__h.push(n))}function Ae(e){return pe=5,Te(function(){return{current:e}},[])}function Te(e,t){var n=Se(ue++,7);return $e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ze(e,t){return pe=8,Te(function(){return e},t)}function Ee(e){var t=he.context[e.__c],n=Se(ue++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(he)),t.props.value):e.__}function _e(){for(var e;e=ve.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oe),e.__H.__h.forEach(Le),e.__H.__h=[]}catch(t){e.__H.__h=[],fe.__e(t,e.__v)}}fe.__b=function(e){he=null,ye&&ye(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ie&&Ie(e,t)},fe.__r=function(e){be&&be(e),ue=0;var t=(he=e.__c).__H;t&&(me===he?(t.__h=[],he.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Oe),t.__h.forEach(Le),t.__h=[],ue=0)),me=he},fe.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ve.push(t)&&ge===fe.requestAnimationFrame||((ge=fe.requestAnimationFrame)||Ne)(_e)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),me=he=null},fe.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Oe),e.__h=e.__h.filter(function(e){return!e.__||Le(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],fe.__e(n,e.__v)}}),xe&&xe(e,t)},fe.unmount=function(e){Ce&&Ce(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Oe(e)}catch(e){t=e}}),n.__H=void 0,t&&fe.__e(t,n.__v))};var Re="function"==typeof requestAnimationFrame;function Ne(e){var t,n=function(){clearTimeout(o),Re&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Re&&(t=requestAnimationFrame(n))}function Oe(e){var t=he,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),he=t}function Le(e){var t=he;e.__c=e.__(),he=t}function $e(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Fe(e,t){return"function"==typeof t?t(e):t}var je='/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n :root, :host {\n --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",\n "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n "Courier New", monospace;\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-yellow-500: oklch(79.5% 0.184 86.047);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-teal-500: oklch(70.4% 0.14 182.503);\n --color-blue-500: oklch(62.3% 0.214 259.815);\n --color-blue-600: oklch(54.6% 0.245 262.881);\n --color-blue-700: oklch(48.8% 0.243 264.376);\n --color-indigo-500: oklch(58.5% 0.233 277.117);\n --color-purple-500: oklch(62.7% 0.265 303.9);\n --color-pink-500: oklch(65.6% 0.241 354.308);\n --color-gray-50: oklch(98.5% 0.002 247.839);\n --color-gray-200: oklch(92.8% 0.006 264.531);\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-white: #fff;\n --spacing: 0.25rem;\n --container-sm: 24rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --leading-relaxed: 1.625;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n --color-bg-app: var(--ep-background-app);\n --color-bg-surface: var(--ep-background-surface);\n --color-bg-surface-alt: var(--ep-background-surface-alt);\n --color-bg-elevated: var(--ep-background-elevated);\n --color-bg-overlay: var(--ep-background-overlay);\n --color-bg-input: var(--ep-background-input);\n --color-fg-primary: var(--ep-foreground-primary);\n --color-fg-secondary: var(--ep-foreground-secondary);\n --color-fg-muted: var(--ep-foreground-muted);\n --color-fg-disabled: var(--ep-foreground-disabled);\n --color-fg-on-accent: var(--ep-foreground-on-accent);\n --color-border-default: var(--ep-border-default);\n --color-border-subtle: var(--ep-border-subtle);\n --color-border-strong: var(--ep-border-strong);\n --color-accent: var(--ep-accent-primary);\n --color-accent-hover: var(--ep-accent-primary-hover);\n --color-accent-light: var(--ep-accent-primary-light);\n --color-accent-fg: var(--ep-accent-primary-foreground);\n --color-interactive-hover: var(--ep-interactive-hover);\n --color-interactive-active: var(--ep-interactive-active);\n --color-interactive-selected: var(--ep-interactive-selected);\n --color-interactive-focus-ring: var(--ep-interactive-focus-ring);\n --color-state-error: var(--ep-state-error);\n --color-state-error-light: var(--ep-state-error-light);\n --color-state-info-light: var(--ep-state-info-light);\n --color-tooltip-bg: var(--ep-tooltip-background);\n --color-tooltip-fg: var(--ep-tooltip-foreground);\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::-moz-placeholder {\n opacity: 1;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::-moz-placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n ::placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {\n -webkit-appearance: button;\n -moz-appearance: button;\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden="until-found"])) {\n display: none !important;\n }\n}\n@layer utilities {\n .pointer-events-auto {\n pointer-events: auto;\n }\n .pointer-events-none {\n pointer-events: none;\n }\n .visible {\n visibility: visible;\n }\n .absolute {\n position: absolute;\n }\n .fixed {\n position: fixed;\n }\n .relative {\n position: relative;\n }\n .static {\n position: static;\n }\n .sticky {\n position: sticky;\n }\n .inset-0 {\n inset: calc(var(--spacing) * 0);\n }\n .inset-x-0 {\n inset-inline: calc(var(--spacing) * 0);\n }\n .inset-y-0 {\n inset-block: calc(var(--spacing) * 0);\n }\n .top-0 {\n top: calc(var(--spacing) * 0);\n }\n .top-1\\/2 {\n top: calc(1/2 * 100%);\n }\n .top-4 {\n top: calc(var(--spacing) * 4);\n }\n .top-6 {\n top: calc(var(--spacing) * 6);\n }\n .right-0 {\n right: calc(var(--spacing) * 0);\n }\n .right-1 {\n right: calc(var(--spacing) * 1);\n }\n .right-4 {\n right: calc(var(--spacing) * 4);\n }\n .bottom-0 {\n bottom: calc(var(--spacing) * 0);\n }\n .left-0 {\n left: calc(var(--spacing) * 0);\n }\n .left-1\\/2 {\n left: calc(1/2 * 100%);\n }\n .z-10 {\n z-index: 10;\n }\n .z-40 {\n z-index: 40;\n }\n .z-50 {\n z-index: 50;\n }\n .z-100 {\n z-index: 100;\n }\n .col-start-1 {\n grid-column-start: 1;\n }\n .row-start-1 {\n grid-row-start: 1;\n }\n .container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n }\n .mx-4 {\n margin-inline: calc(var(--spacing) * 4);\n }\n .my-2 {\n margin-block: calc(var(--spacing) * 2);\n }\n .my-4 {\n margin-block: calc(var(--spacing) * 4);\n }\n .mt-0\\.5 {\n margin-top: calc(var(--spacing) * 0.5);\n }\n .mt-1 {\n margin-top: calc(var(--spacing) * 1);\n }\n .mt-2 {\n margin-top: calc(var(--spacing) * 2);\n }\n .mt-3 {\n margin-top: calc(var(--spacing) * 3);\n }\n .mt-4 {\n margin-top: calc(var(--spacing) * 4);\n }\n .mt-5 {\n margin-top: calc(var(--spacing) * 5);\n }\n .mt-6 {\n margin-top: calc(var(--spacing) * 6);\n }\n .mr-2 {\n margin-right: calc(var(--spacing) * 2);\n }\n .mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n }\n .mb-1\\.5 {\n margin-bottom: calc(var(--spacing) * 1.5);\n }\n .mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n }\n .mb-3 {\n margin-bottom: calc(var(--spacing) * 3);\n }\n .mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n }\n .mb-6 {\n margin-bottom: calc(var(--spacing) * 6);\n }\n .ml-1 {\n margin-left: calc(var(--spacing) * 1);\n }\n .block {\n display: block;\n }\n .contents {\n display: contents;\n }\n .flex {\n display: flex;\n }\n .grid {\n display: grid;\n }\n .hidden {\n display: none;\n }\n .inline {\n display: inline;\n }\n .inline-block {\n display: inline-block;\n }\n .inline-flex {\n display: inline-flex;\n }\n .h-1 {\n height: calc(var(--spacing) * 1);\n }\n .h-1\\.5 {\n height: calc(var(--spacing) * 1.5);\n }\n .h-2 {\n height: calc(var(--spacing) * 2);\n }\n .h-3 {\n height: calc(var(--spacing) * 3);\n }\n .h-3\\.5 {\n height: calc(var(--spacing) * 3.5);\n }\n .h-4 {\n height: calc(var(--spacing) * 4);\n }\n .h-5 {\n height: calc(var(--spacing) * 5);\n }\n .h-6 {\n height: calc(var(--spacing) * 6);\n }\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n .h-8 {\n height: calc(var(--spacing) * 8);\n }\n .h-9 {\n height: calc(var(--spacing) * 9);\n }\n .h-10 {\n height: calc(var(--spacing) * 10);\n }\n .h-16 {\n height: calc(var(--spacing) * 16);\n }\n .h-18 {\n height: calc(var(--spacing) * 18);\n }\n .h-\\[32px\\] {\n height: 32px;\n }\n .h-full {\n height: 100%;\n }\n .h-px {\n height: 1px;\n }\n .max-h-48 {\n max-height: calc(var(--spacing) * 48);\n }\n .max-h-60 {\n max-height: calc(var(--spacing) * 60);\n }\n .min-h-0 {\n min-height: calc(var(--spacing) * 0);\n }\n .\\!w-full {\n width: 100% !important;\n }\n .w-2 {\n width: calc(var(--spacing) * 2);\n }\n .w-3 {\n width: calc(var(--spacing) * 3);\n }\n .w-3\\.5 {\n width: calc(var(--spacing) * 3.5);\n }\n .w-4 {\n width: calc(var(--spacing) * 4);\n }\n .w-5 {\n width: calc(var(--spacing) * 5);\n }\n .w-6 {\n width: calc(var(--spacing) * 6);\n }\n .w-8 {\n width: calc(var(--spacing) * 8);\n }\n .w-9 {\n width: calc(var(--spacing) * 9);\n }\n .w-10 {\n width: calc(var(--spacing) * 10);\n }\n .w-12 {\n width: calc(var(--spacing) * 12);\n }\n .w-16 {\n width: calc(var(--spacing) * 16);\n }\n .w-18 {\n width: calc(var(--spacing) * 18);\n }\n .w-32 {\n width: calc(var(--spacing) * 32);\n }\n .w-36 {\n width: calc(var(--spacing) * 36);\n }\n .w-\\[32px\\] {\n width: 32px;\n }\n .w-auto {\n width: auto;\n }\n .w-full {\n width: 100%;\n }\n .w-px {\n width: 1px;\n }\n .max-w-\\[150px\\] {\n max-width: 150px;\n }\n .max-w-\\[240px\\] {\n max-width: 240px;\n }\n .max-w-sm {\n max-width: var(--container-sm);\n }\n .min-w-0 {\n min-width: calc(var(--spacing) * 0);\n }\n .min-w-\\[8rem\\] {\n min-width: 8rem;\n }\n .min-w-\\[32px\\] {\n min-width: 32px;\n }\n .min-w-\\[120px\\] {\n min-width: 120px;\n }\n .min-w-\\[200px\\] {\n min-width: 200px;\n }\n .flex-1 {\n flex: 1;\n }\n .flex-shrink-0 {\n flex-shrink: 0;\n }\n .shrink-0 {\n flex-shrink: 0;\n }\n .-translate-x-1\\/2 {\n --tw-translate-x: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-x-\\[1px\\] {\n --tw-translate-x: 1px;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .-translate-y-1\\/2 {\n --tw-translate-y: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-y-\\[1px\\] {\n --tw-translate-y: 1px;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .scale-95 {\n --tw-scale-x: 95%;\n --tw-scale-y: 95%;\n --tw-scale-z: 95%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .scale-100 {\n --tw-scale-x: 100%;\n --tw-scale-y: 100%;\n --tw-scale-z: 100%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .rotate-45 {\n rotate: 45deg;\n }\n .transform {\n transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n }\n .animate-pulse {\n animation: var(--animate-pulse);\n }\n .animate-spin {\n animation: var(--animate-spin);\n }\n .cursor-default {\n cursor: default;\n }\n .cursor-grab {\n cursor: grab;\n }\n .cursor-not-allowed {\n cursor: not-allowed;\n }\n .cursor-pointer {\n cursor: pointer;\n }\n .touch-none {\n touch-action: none;\n }\n .resize {\n resize: both;\n }\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n .grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n .grid-cols-6 {\n grid-template-columns: repeat(6, minmax(0, 1fr));\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-row {\n flex-direction: row;\n }\n .flex-wrap {\n flex-wrap: wrap;\n }\n .items-center {\n align-items: center;\n }\n .items-end {\n align-items: flex-end;\n }\n .items-start {\n align-items: flex-start;\n }\n .justify-between {\n justify-content: space-between;\n }\n .justify-center {\n justify-content: center;\n }\n .justify-end {\n justify-content: flex-end;\n }\n .justify-start {\n justify-content: flex-start;\n }\n .gap-1 {\n gap: calc(var(--spacing) * 1);\n }\n .gap-2 {\n gap: calc(var(--spacing) * 2);\n }\n .gap-3 {\n gap: calc(var(--spacing) * 3);\n }\n .gap-4 {\n gap: calc(var(--spacing) * 4);\n }\n .space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-3 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-4 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-6 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .gap-x-1 {\n -moz-column-gap: calc(var(--spacing) * 1);\n column-gap: calc(var(--spacing) * 1);\n }\n .space-x-2 {\n :where(& > :not(:last-child)) {\n --tw-space-x-reverse: 0;\n margin-inline-start: calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));\n margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));\n }\n }\n .space-x-3 {\n :where(& > :not(:last-child)) {\n --tw-space-x-reverse: 0;\n margin-inline-start: calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));\n margin-inline-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)));\n }\n }\n .gap-y-4 {\n row-gap: calc(var(--spacing) * 4);\n }\n .divide-y {\n :where(& > :not(:last-child)) {\n --tw-divide-y-reverse: 0;\n border-bottom-style: var(--tw-border-style);\n border-top-style: var(--tw-border-style);\n border-top-width: calc(1px * var(--tw-divide-y-reverse));\n border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));\n }\n }\n .divide-border-subtle {\n :where(& > :not(:last-child)) {\n border-color: var(--color-border-subtle);\n }\n }\n .truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .overflow-auto {\n overflow: auto;\n }\n .overflow-hidden {\n overflow: hidden;\n }\n .overflow-x-auto {\n overflow-x: auto;\n }\n .overflow-y-auto {\n overflow-y: auto;\n }\n .rounded {\n border-radius: 0.25rem;\n }\n .rounded-\\[3px\\] {\n border-radius: 3px;\n }\n .rounded-full {\n border-radius: calc(infinity * 1px);\n }\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n .rounded-md {\n border-radius: var(--radius-md);\n }\n .rounded-none {\n border-radius: 0;\n }\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n .rounded-t-2xl {\n border-top-left-radius: var(--radius-2xl);\n border-top-right-radius: var(--radius-2xl);\n }\n .rounded-t-lg {\n border-top-left-radius: var(--radius-lg);\n border-top-right-radius: var(--radius-lg);\n }\n .rounded-l-md {\n border-top-left-radius: var(--radius-md);\n border-bottom-left-radius: var(--radius-md);\n }\n .rounded-r-md {\n border-top-right-radius: var(--radius-md);\n border-bottom-right-radius: var(--radius-md);\n }\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n .border-0 {\n border-style: var(--tw-border-style);\n border-width: 0px;\n }\n .border-2 {\n border-style: var(--tw-border-style);\n border-width: 2px;\n }\n .border-3 {\n border-style: var(--tw-border-style);\n border-width: 3px;\n }\n .border-4 {\n border-style: var(--tw-border-style);\n border-width: 4px;\n }\n .border-t {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n }\n .border-r {\n border-right-style: var(--tw-border-style);\n border-right-width: 1px;\n }\n .border-r-0 {\n border-right-style: var(--tw-border-style);\n border-right-width: 0px;\n }\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n .border-b-2 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 2px;\n }\n .border-l {\n border-left-style: var(--tw-border-style);\n border-left-width: 1px;\n }\n .border-none {\n --tw-border-style: none;\n border-style: none;\n }\n .border-\\[\\#cfd4da\\] {\n border-color: #cfd4da;\n }\n .border-accent {\n border-color: var(--color-accent);\n }\n .border-border-default {\n border-color: var(--color-border-default);\n }\n .border-border-strong {\n border-color: var(--color-border-strong);\n }\n .border-border-subtle {\n border-color: var(--color-border-subtle);\n }\n .border-gray-200 {\n border-color: var(--color-gray-200);\n }\n .border-gray-300 {\n border-color: var(--color-gray-300);\n }\n .border-state-error {\n border-color: var(--color-state-error);\n }\n .border-transparent {\n border-color: transparent;\n }\n .border-t-accent {\n border-top-color: var(--color-accent);\n }\n .border-r-accent {\n border-right-color: var(--color-accent);\n }\n .border-b-accent {\n border-bottom-color: var(--color-accent);\n }\n .border-b-transparent {\n border-bottom-color: transparent;\n }\n .bg-\\[\\#f8f9fa\\] {\n background-color: #f8f9fa;\n }\n .bg-accent {\n background-color: var(--color-accent);\n }\n .bg-accent-light {\n background-color: var(--color-accent-light);\n }\n .bg-bg-app {\n background-color: var(--color-bg-app);\n }\n .bg-bg-elevated {\n background-color: var(--color-bg-elevated);\n }\n .bg-bg-input {\n background-color: var(--color-bg-input);\n }\n .bg-bg-overlay {\n background-color: var(--color-bg-overlay);\n }\n .bg-bg-surface {\n background-color: var(--color-bg-surface);\n }\n .bg-bg-surface-alt {\n background-color: var(--color-bg-surface-alt);\n }\n .bg-bg-surface\\/80 {\n background-color: var(--color-bg-surface);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-bg-surface) 80%, transparent);\n }\n }\n .bg-blue-500 {\n background-color: var(--color-blue-500);\n }\n .bg-blue-600 {\n background-color: var(--color-blue-600);\n }\n .bg-border-default {\n background-color: var(--color-border-default);\n }\n .bg-border-subtle {\n background-color: var(--color-border-subtle);\n }\n .bg-green-500 {\n background-color: var(--color-green-500);\n }\n .bg-indigo-500 {\n background-color: var(--color-indigo-500);\n }\n .bg-inherit {\n background-color: inherit;\n }\n .bg-interactive-hover {\n background-color: var(--color-interactive-hover);\n }\n .bg-interactive-selected {\n background-color: var(--color-interactive-selected);\n }\n .bg-pink-500 {\n background-color: var(--color-pink-500);\n }\n .bg-purple-500 {\n background-color: var(--color-purple-500);\n }\n .bg-red-500 {\n background-color: var(--color-red-500);\n }\n .bg-state-error-light {\n background-color: var(--color-state-error-light);\n }\n .bg-state-info-light {\n background-color: var(--color-state-info-light);\n }\n .bg-teal-500 {\n background-color: var(--color-teal-500);\n }\n .bg-tooltip-bg {\n background-color: var(--color-tooltip-bg);\n }\n .bg-transparent {\n background-color: transparent;\n }\n .bg-white {\n background-color: var(--color-white);\n }\n .bg-yellow-500 {\n background-color: var(--color-yellow-500);\n }\n .p-0 {\n padding: calc(var(--spacing) * 0);\n }\n .p-1 {\n padding: calc(var(--spacing) * 1);\n }\n .p-1\\.5 {\n padding: calc(var(--spacing) * 1.5);\n }\n .p-2 {\n padding: calc(var(--spacing) * 2);\n }\n .p-3 {\n padding: calc(var(--spacing) * 3);\n }\n .p-4 {\n padding: calc(var(--spacing) * 4);\n }\n .p-5 {\n padding: calc(var(--spacing) * 5);\n }\n .p-6 {\n padding: calc(var(--spacing) * 6);\n }\n .p-8 {\n padding: calc(var(--spacing) * 8);\n }\n .p-\\[5px\\] {\n padding: 5px;\n }\n .px-1 {\n padding-inline: calc(var(--spacing) * 1);\n }\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n .px-4 {\n padding-inline: calc(var(--spacing) * 4);\n }\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n .py-1 {\n padding-block: calc(var(--spacing) * 1);\n }\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n .py-2\\.5 {\n padding-block: calc(var(--spacing) * 2.5);\n }\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n .py-4 {\n padding-block: calc(var(--spacing) * 4);\n }\n .pt-2 {\n padding-top: calc(var(--spacing) * 2);\n }\n .pt-4 {\n padding-top: calc(var(--spacing) * 4);\n }\n .pr-2 {\n padding-right: calc(var(--spacing) * 2);\n }\n .pr-3 {\n padding-right: calc(var(--spacing) * 3);\n }\n .pr-7 {\n padding-right: calc(var(--spacing) * 7);\n }\n .pr-9 {\n padding-right: calc(var(--spacing) * 9);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pl-2 {\n padding-left: calc(var(--spacing) * 2);\n }\n .pl-3 {\n padding-left: calc(var(--spacing) * 3);\n }\n .pl-4 {\n padding-left: calc(var(--spacing) * 4);\n }\n .pl-8 {\n padding-left: calc(var(--spacing) * 8);\n }\n .text-center {\n text-align: center;\n }\n .text-left {\n text-align: left;\n }\n .text-right {\n text-align: right;\n }\n .text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n }\n .text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n }\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n .text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n }\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n .text-\\[13px\\] {\n font-size: 13px;\n }\n .leading-none {\n --tw-leading: 1;\n line-height: 1;\n }\n .leading-relaxed {\n --tw-leading: var(--leading-relaxed);\n line-height: var(--leading-relaxed);\n }\n .font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n }\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n .whitespace-nowrap {\n white-space: nowrap;\n }\n .text-accent {\n color: var(--color-accent);\n }\n .text-accent-fg {\n color: var(--color-accent-fg);\n }\n .text-fg-disabled {\n color: var(--color-fg-disabled);\n }\n .text-fg-muted {\n color: var(--color-fg-muted);\n }\n .text-fg-on-accent {\n color: var(--color-fg-on-accent);\n }\n .text-fg-primary {\n color: var(--color-fg-primary);\n }\n .text-fg-secondary {\n color: var(--color-fg-secondary);\n }\n .text-gray-700 {\n color: var(--color-gray-700);\n }\n .text-state-error {\n color: var(--color-state-error);\n }\n .text-tooltip-fg {\n color: var(--color-tooltip-fg);\n }\n .text-white {\n color: var(--color-white);\n }\n .uppercase {\n text-transform: uppercase;\n }\n .italic {\n font-style: italic;\n }\n .underline {\n text-decoration-line: underline;\n }\n .placeholder-fg-muted {\n &::-moz-placeholder {\n color: var(--color-fg-muted);\n }\n &::placeholder {\n color: var(--color-fg-muted);\n }\n }\n .accent-accent {\n accent-color: var(--color-accent);\n }\n .opacity-0 {\n opacity: 0%;\n }\n .opacity-50 {\n opacity: 50%;\n }\n .opacity-100 {\n opacity: 100%;\n }\n .shadow {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-2xl {\n --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-lg {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-sm {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-1 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-2 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-accent {\n --tw-ring-color: var(--color-accent);\n }\n .ring-border-default {\n --tw-ring-color: var(--color-border-default);\n }\n .ring-interactive-focus-ring {\n --tw-ring-color: var(--color-interactive-focus-ring);\n }\n .outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n }\n .outline-1 {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n }\n .outline-2 {\n outline-style: var(--tw-outline-style);\n outline-width: 2px;\n }\n .-outline-offset-1 {\n outline-offset: calc(1px * -1);\n }\n .outline-offset-2 {\n outline-offset: 2px;\n }\n .outline-accent {\n outline-color: var(--color-accent);\n }\n .outline-border-default {\n outline-color: var(--color-border-default);\n }\n .backdrop-blur {\n --tw-backdrop-blur: blur(8px);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter, display, content-visibility, overlay, pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-\\[height\\] {\n transition-property: height;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-all {\n transition-property: all;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-colors {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-opacity {\n transition-property: opacity;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .duration-150 {\n --tw-duration: 150ms;\n transition-duration: 150ms;\n }\n .duration-200 {\n --tw-duration: 200ms;\n transition-duration: 200ms;\n }\n .duration-300 {\n --tw-duration: 300ms;\n transition-duration: 300ms;\n }\n .ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n }\n .ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n }\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n .select-none {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n .group-hover\\:opacity-100 {\n &:is(:where(.group):hover *) {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .peer-checked\\:opacity-100 {\n &:is(:where(.peer):checked ~ *) {\n opacity: 100%;\n }\n }\n .placeholder\\:text-fg-muted {\n &::-moz-placeholder {\n color: var(--color-fg-muted);\n }\n &::placeholder {\n color: var(--color-fg-muted);\n }\n }\n .first\\:mt-0 {\n &:first-child {\n margin-top: calc(var(--spacing) * 0);\n }\n }\n .checked\\:border-accent {\n &:checked {\n border-color: var(--color-accent);\n }\n }\n .checked\\:bg-accent {\n &:checked {\n background-color: var(--color-accent);\n }\n }\n .hover\\:border-b-accent {\n &:hover {\n @media (hover: hover) {\n border-bottom-color: var(--color-accent);\n }\n }\n }\n .hover\\:border-b-fg-muted {\n &:hover {\n @media (hover: hover) {\n border-bottom-color: var(--color-fg-muted);\n }\n }\n }\n .hover\\:\\!bg-accent-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent-hover) !important;\n }\n }\n }\n .hover\\:\\!bg-blue-700 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-blue-700) !important;\n }\n }\n }\n .hover\\:bg-accent {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent);\n }\n }\n }\n .hover\\:bg-accent-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent-hover);\n }\n }\n }\n .hover\\:bg-border-default {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-border-default);\n }\n }\n }\n .hover\\:bg-gray-50 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-gray-50);\n }\n }\n }\n .hover\\:bg-interactive-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-interactive-hover);\n }\n }\n }\n .hover\\:bg-transparent {\n &:hover {\n @media (hover: hover) {\n background-color: transparent;\n }\n }\n }\n .hover\\:text-accent-hover {\n &:hover {\n @media (hover: hover) {\n color: var(--color-accent-hover);\n }\n }\n }\n .hover\\:text-fg-on-accent {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-on-accent);\n }\n }\n }\n .hover\\:text-fg-primary {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-primary);\n }\n }\n }\n .hover\\:text-fg-secondary {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-secondary);\n }\n }\n }\n .hover\\:shadow-md {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring-0 {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring-accent {\n &:hover {\n @media (hover: hover) {\n --tw-ring-color: var(--color-accent);\n }\n }\n }\n .hover\\:ring-transparent {\n &:hover {\n @media (hover: hover) {\n --tw-ring-color: transparent;\n }\n }\n }\n .focus\\:border-accent {\n &:focus {\n border-color: var(--color-accent);\n }\n }\n .focus\\:border-blue-500 {\n &:focus {\n border-color: var(--color-blue-500);\n }\n }\n .focus\\:border-transparent {\n &:focus {\n border-color: transparent;\n }\n }\n .focus\\:ring-1 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .focus\\:ring-2 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .focus\\:ring-accent {\n &:focus {\n --tw-ring-color: var(--color-accent);\n }\n }\n .focus\\:ring-blue-500 {\n &:focus {\n --tw-ring-color: var(--color-blue-500);\n }\n }\n .focus\\:outline-none {\n &:focus {\n --tw-outline-style: none;\n outline-style: none;\n }\n }\n .active\\:cursor-grabbing {\n &:active {\n cursor: grabbing;\n }\n }\n .active\\:bg-interactive-active {\n &:active {\n background-color: var(--color-interactive-active);\n }\n }\n .disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n }\n .disabled\\:opacity-40 {\n &:disabled {\n opacity: 40%;\n }\n }\n .disabled\\:opacity-50 {\n &:disabled {\n opacity: 50%;\n }\n }\n .disabled\\:hover\\:bg-transparent {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n background-color: transparent;\n }\n }\n }\n }\n .disabled\\:hover\\:ring-0 {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n }\n .md\\:flex {\n @media (width >= 48rem) {\n display: flex;\n }\n }\n .md\\:h-auto {\n @media (width >= 48rem) {\n height: auto;\n }\n }\n .md\\:max-h-\\[80vh\\] {\n @media (width >= 48rem) {\n max-height: 80vh;\n }\n }\n .md\\:w-\\[28rem\\] {\n @media (width >= 48rem) {\n width: 28rem;\n }\n }\n .md\\:max-w-\\[90vw\\] {\n @media (width >= 48rem) {\n max-width: 90vw;\n }\n }\n .md\\:flex-none {\n @media (width >= 48rem) {\n flex: none;\n }\n }\n .md\\:items-center {\n @media (width >= 48rem) {\n align-items: center;\n }\n }\n .md\\:justify-center {\n @media (width >= 48rem) {\n justify-content: center;\n }\n }\n .md\\:rounded-lg {\n @media (width >= 48rem) {\n border-radius: var(--radius-lg);\n }\n }\n .md\\:border {\n @media (width >= 48rem) {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n }\n .md\\:border-border-subtle {\n @media (width >= 48rem) {\n border-color: var(--color-border-subtle);\n }\n }\n .md\\:shadow-lg {\n @media (width >= 48rem) {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n}\n@import url(\'https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap\');\n:host {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-rotate-x: rotateX(0);\n --tw-rotate-y: rotateY(0);\n --tw-rotate-z: rotateZ(0);\n --tw-skew-x: skewX(0);\n --tw-skew-y: skewY(0);\n --tw-border-style: solid;\n --tw-gradient-from: #0000;\n --tw-gradient-via: #0000;\n --tw-gradient-to: #0000;\n --tw-gradient-from-position: 0%;\n --tw-gradient-via-position: 50%;\n --tw-gradient-to-position: 100%;\n --tw-shadow: 0 0 #0000;\n --tw-inset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-outline-style: solid;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n font-family: \'Open Sans\', system-ui, sans-serif;\n color: var(--ep-foreground-primary);\n background-color: var(--ep-background-surface);\n}\n:host *::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n:host *::-webkit-scrollbar-track {\n background: var(--ep-scrollbar-track);\n}\n:host *::-webkit-scrollbar-thumb {\n background: var(--ep-scrollbar-thumb);\n border-radius: 4px;\n}\n:host *::-webkit-scrollbar-thumb:hover {\n background: var(--ep-scrollbar-thumb-hover);\n}\n@property --tw-translate-x {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-y {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-z {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-scale-x {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-y {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-z {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-rotate-x {\n syntax: "*";\n inherits: false;\n}\n@property --tw-rotate-y {\n syntax: "*";\n inherits: false;\n}\n@property --tw-rotate-z {\n syntax: "*";\n inherits: false;\n}\n@property --tw-skew-x {\n syntax: "*";\n inherits: false;\n}\n@property --tw-skew-y {\n syntax: "*";\n inherits: false;\n}\n@property --tw-space-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-space-x-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-divide-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-leading {\n syntax: "*";\n inherits: false;\n}\n@property --tw-font-weight {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-inset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: "<length>";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: "*";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-outline-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-backdrop-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-duration {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ease {\n syntax: "*";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *, ::before, ::after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-scale-z: 1;\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-space-y-reverse: 0;\n --tw-space-x-reverse: 0;\n --tw-divide-y-reverse: 0;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-outline-style: solid;\n --tw-backdrop-blur: initial;\n --tw-backdrop-brightness: initial;\n --tw-backdrop-contrast: initial;\n --tw-backdrop-grayscale: initial;\n --tw-backdrop-hue-rotate: initial;\n --tw-backdrop-invert: initial;\n --tw-backdrop-opacity: initial;\n --tw-backdrop-saturate: initial;\n --tw-backdrop-sepia: initial;\n --tw-duration: initial;\n --tw-ease: initial;\n }\n }\n}\n',He=0;function Ue(e,t,n,o,i,r){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)"ref"==s?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--He,__i:-1,__u:0,__source:i,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return I.vnode&&I.vnode(c),c}var We=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(We||{});function Be(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function qe(e){return{width:Math.ceil(e.width),height:Math.ceil(e.height)}}function Ge(e){return{origin:Be(e.origin),size:qe(e.size)}}function Ve(e){const{width:t,height:n}=e;return{width:n,height:t}}function Ze(e,t,n){return{width:(e=t%2==0?e:Ve(e)).width*n,height:e.height*n}}function Ke(e){const t=[e.p1.x,e.p2.x,e.p3.x,e.p4.x],n=[e.p1.y,e.p2.y,e.p3.y,e.p4.y];return{origin:{x:Math.min(...t),y:Math.min(...n)},size:{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}}}function Ye(e){return{p1:{x:e.origin.x,y:e.origin.y},p2:{x:e.origin.x+e.size.width,y:e.origin.y},p3:{x:e.origin.x+e.size.width,y:e.origin.y+e.size.height},p4:{x:e.origin.x,y:e.origin.y+e.size.height}}}function Xe(e,t,n){let o=t.x,i=t.y;switch(n){case 0:o=t.x,i=t.y;break;case 1:o=e.height-t.y,i=t.x;break;case 2:o=e.width-t.x,i=e.height-t.y;break;case 3:o=t.y,i=e.width-t.x}return{x:o,y:i}}function Qe(e,t){return{x:e.x*t,y:e.y*t}}function Je(e){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const t=e.map(e=>e.x),n=e.map(e=>e.y),o=Math.min(...t),i=Math.min(...n);return{origin:{x:o,y:i},size:{width:Math.max(...t)-o,height:Math.max(...n)-i}}}function et(e,t){return{origin:{x:e.origin.x-t,y:e.origin.y-t},size:{width:e.size.width+2*t,height:e.size.height+2*t}}}function tt(e,t,n){let o=t.origin.x,i=t.origin.y,r=t.size;switch(n){case 0:break;case 1:o=e.height-t.origin.y-t.size.height,i=t.origin.x,r=Ve(t.size);break;case 2:o=e.width-t.origin.x-t.size.width,i=e.height-t.origin.y-t.size.height;break;case 3:o=t.origin.y,i=e.width-t.origin.x-t.size.width,r=Ve(t.size)}return{origin:{x:o,y:i},size:{width:r.width,height:r.height}}}function nt(e,t){return{origin:{x:e.origin.x*t,y:e.origin.y*t},size:{width:e.size.width*t,height:e.size.height*t}}}function ot(e,t,n,o){return nt(tt(e,t,n),o)}function it(e){if(0===e.length)return null;let t=e[0].origin.x,n=e[0].origin.y,o=e[0].origin.x+e[0].size.width,i=e[0].origin.y+e[0].size.height;for(const r of e)t=Math.min(t,r.origin.x),n=Math.min(n,r.origin.y),o=Math.max(o,r.origin.x+r.size.width),i=Math.max(i,r.origin.y+r.size.height);return{origin:{x:t,y:n},size:{width:o-t,height:i-n}}}function rt(e,t,n,o){const i=e.origin.x,r=e.origin.y,a=e.size.width,s=e.size.height,l=n/a,c=o/s,d=n/s,u=o/a;switch(t){case 0:return{a:l,b:0,c:0,d:c,e:-l*i,f:-c*r};case 3:return{a:0,b:-u,c:d,d:0,e:-d*r,f:u*(i+a)};case 2:return{a:-l,b:0,c:0,d:-c,e:l*(i+a),f:c*(r+s)};case 1:return{a:0,b:u,c:-d,d:0,e:d*(r+s),f:-u*i}}}class at{isEnabled(){return!1}debug(){}info(){}warn(){}error(){}perf(){}}class st{isEnabled(){return!0}debug(e,t,...n){console.debug(`${e}.${t}`,...n)}info(e,t,...n){console.info(`${e}.${t}`,...n)}warn(e,t,...n){console.warn(`${e}.${t}`,...n)}error(e,t,...n){console.error(`${e}.${t}`,...n)}perf(e,t,n,o,...i){console.info(`${e}.${t}.${n}.${o}`,...i)}}class lt{constructor(e,t){this.logger=e,this.level=t}isEnabled(e){return this.level<={debug:0,info:1,warn:2,error:3}[e]}debug(e,t,...n){this.level<=0&&this.logger.debug(e,t,...n)}info(e,t,...n){this.level<=1&&this.logger.info(e,t,...n)}warn(e,t,...n){this.level<=2&&this.logger.warn(e,t,...n)}error(e,t,...n){this.level<=3&&this.logger.error(e,t,...n)}perf(e,t,n,o,...i){this.logger.perf(e,t,n,o,...i)}}class ct{constructor(){this.marks=new Map}isEnabled(){return!1}debug(e,t,...n){}info(e,t,...n){}warn(e,t,...n){}error(e,t,...n){}perf(e,t,n,o,i,...r){const a=`${e}.${t}.${n}.${o}.${i}`;switch(o){case"Begin":globalThis.performance.mark(a,{detail:r}),this.marks.set(`${e}.${t}.${n}.${i}`,Date.now());break;case"End":globalThis.performance.mark(a,{detail:r});const o=`${e}.${t}.${n}.Measure.${i}`,s=`${e}.${t}.${n}.Begin.${i}`;globalThis.performance.measure(o,s,a);const l=this.marks.get(`${e}.${t}.${n}.${i}`);if(l){const o=Date.now()-l;console.info(`⏱️ ${e}.${t}.${n}.${i}: ${o}ms`),this.marks.delete(`${e}.${t}.${n}.${i}`)}}}}class dt{constructor(e){this.loggers=e}isEnabled(e){return this.loggers.some(t=>t.isEnabled(e))}debug(e,t,...n){for(const o of this.loggers)o.debug(e,t,...n)}info(e,t,...n){for(const o of this.loggers)o.info(e,t,...n)}warn(e,t,...n){for(const o of this.loggers)o.warn(e,t,...n)}error(e,t,...n){for(const o of this.loggers)o.error(e,t,...n)}perf(e,t,n,o,...i){for(const r of this.loggers)r.perf(e,t,n,o,...i)}}var ut=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(ut||{});class ht extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError",this.reason=e}}class mt extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError",this.reason=e}}class gt{constructor(){this.state={stage:0},this.resolvedCallbacks=[],this.rejectedCallbacks=[],this._promise=null,this.progressCbs=[]}toPromise(){return this._promise||(this._promise=new Promise((e,t)=>{this.wait(t=>e(t),e=>{"abort"===e.type?t(new ht(e.reason)):t(new mt(e.reason))})})),this._promise}wait(e,t){switch(this.state.stage){case 0:this.resolvedCallbacks.push(e),this.rejectedCallbacks.push(t);break;case 1:e(this.state.result);break;case 2:t({type:"reject",reason:this.state.reason});break;case 3:t({type:"abort",reason:this.state.reason})}}resolve(e){if(0===this.state.stage){this.state={stage:1,result:e};for(const t of this.resolvedCallbacks)try{t(e)}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}reject(e){if(0===this.state.stage){this.state={stage:2,reason:e};for(const t of this.rejectedCallbacks)try{t({type:"reject",reason:e})}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}abort(e){if(0===this.state.stage){this.state={stage:3,reason:e};for(const t of this.rejectedCallbacks)try{t({type:"abort",reason:e})}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}fail(e){"abort"===e.type?this.abort(e.reason):this.reject(e.reason)}onProgress(e){this.progressCbs.push(e)}progress(e){for(const t of this.progressCbs)t(e)}static all(e){const t=new gt;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let o=0,i=!1;return e.forEach((r,a)=>{r.wait(r=>{i||(n[a]=r,o++,o===e.length&&(i=!0,t.resolve(n)))},e=>{i||(i=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static allSettled(e){const t=new gt;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let o=0;return e.forEach((i,r)=>{i.wait(i=>{n[r]={status:"resolved",value:i},o++,o===e.length&&t.resolve(n)},i=>{n[r]={status:"abort"===i.type?"aborted":"rejected",reason:i.reason},o++,o===e.length&&t.resolve(n)})}),t}static race(e){const t=new gt;if(0===e.length)return t.reject("No tasks provided"),t;let n=!1;return e.forEach(e=>{e.wait(e=>{n||(n=!0,t.resolve(e))},e=>{n||(n=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static withProgress(e,t){const n=gt.all(e);if(t){let n=0;e.forEach(o=>{o.wait(()=>{n++,t(n,e.length)},()=>{n++,t(n,e.length)})})}return n}}const pt=Object.freeze(["­","​","⁠","\ufeff","￾","￿"]),vt=new RegExp(`[${pt.join("")}]`,"g");function ft(e){return e.replace(vt,"")}var yt=(e=>(e[e.Unknown=0]="Unknown",e[e.XYZ=1]="XYZ",e[e.FitPage=2]="FitPage",e[e.FitHorizontal=3]="FitHorizontal",e[e.FitVertical=4]="FitVertical",e[e.FitRectangle=5]="FitRectangle",e[e.FitBoundingBox=6]="FitBoundingBox",e[e.FitBoundingBoxHorizontal=7]="FitBoundingBoxHorizontal",e[e.FitBoundingBoxVertical=8]="FitBoundingBoxVertical",e))(yt||{}),bt=(e=>(e[e.NotSet=0]="NotSet",e[e.True=1]="True",e[e.False=2]="False",e[e.Unknown=3]="Unknown",e))(bt||{}),wt=(e=>(e[e.Unknown=-1]="Unknown",e[e.Courier=0]="Courier",e[e.Courier_Bold=1]="Courier_Bold",e[e.Courier_BoldOblique=2]="Courier_BoldOblique",e[e.Courier_Oblique=3]="Courier_Oblique",e[e.Helvetica=4]="Helvetica",e[e.Helvetica_Bold=5]="Helvetica_Bold",e[e.Helvetica_BoldOblique=6]="Helvetica_BoldOblique",e[e.Helvetica_Oblique=7]="Helvetica_Oblique",e[e.Times_Roman=8]="Times_Roman",e[e.Times_Bold=9]="Times_Bold",e[e.Times_BoldItalic=10]="Times_BoldItalic",e[e.Times_Italic=11]="Times_Italic",e[e.Symbol=12]="Symbol",e[e.ZapfDingbats=13]="ZapfDingbats",e))(wt||{}),xt=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(xt||{}),Ct=(e=>(e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom",e))(Ct||{}),It=(e=>(e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e))(It||{}),St=(e=>(e[e.Contain=0]="Contain",e[e.Cover=1]="Cover",e[e.Stretch=2]="Stretch",e))(St||{}),kt=(e=>(e[e.Unsupported=0]="Unsupported",e[e.Goto=1]="Goto",e[e.RemoteGoto=2]="RemoteGoto",e[e.URI=3]="URI",e[e.LaunchAppOrOpenFile=4]="LaunchAppOrOpenFile",e))(kt||{}),Dt=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.LINK=2]="LINK",e[e.FREETEXT=3]="FREETEXT",e[e.LINE=4]="LINE",e[e.SQUARE=5]="SQUARE",e[e.CIRCLE=6]="CIRCLE",e[e.POLYGON=7]="POLYGON",e[e.POLYLINE=8]="POLYLINE",e[e.HIGHLIGHT=9]="HIGHLIGHT",e[e.UNDERLINE=10]="UNDERLINE",e[e.SQUIGGLY=11]="SQUIGGLY",e[e.STRIKEOUT=12]="STRIKEOUT",e[e.STAMP=13]="STAMP",e[e.CARET=14]="CARET",e[e.INK=15]="INK",e[e.POPUP=16]="POPUP",e[e.FILEATTACHMENT=17]="FILEATTACHMENT",e[e.SOUND=18]="SOUND",e[e.MOVIE=19]="MOVIE",e[e.WIDGET=20]="WIDGET",e[e.SCREEN=21]="SCREEN",e[e.PRINTERMARK=22]="PRINTERMARK",e[e.TRAPNET=23]="TRAPNET",e[e.WATERMARK=24]="WATERMARK",e[e.THREED=25]="THREED",e[e.RICHMEDIA=26]="RICHMEDIA",e[e.XFAWIDGET=27]="XFAWIDGET",e[e.REDACT=28]="REDACT",e))(Dt||{}),Mt=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(Mt||{}),Pt=(e=>(e[e.Unknown=-1]="Unknown",e[e.Comment=0]="Comment",e[e.Key=1]="Key",e[e.Note=2]="Note",e[e.Help=3]="Help",e[e.NewParagraph=4]="NewParagraph",e[e.Paragraph=5]="Paragraph",e[e.Insert=6]="Insert",e[e.Graph=7]="Graph",e[e.PushPin=8]="PushPin",e[e.Paperclip=9]="Paperclip",e[e.Tag=10]="Tag",e[e.Speaker=11]="Speaker",e[e.Mic=12]="Mic",e[e.Approved=13]="Approved",e[e.Experimental=14]="Experimental",e[e.NotApproved=15]="NotApproved",e[e.AsIs=16]="AsIs",e[e.Expired=17]="Expired",e[e.NotForPublicRelease=18]="NotForPublicRelease",e[e.Confidential=19]="Confidential",e[e.Final=20]="Final",e[e.Sold=21]="Sold",e[e.Departmental=22]="Departmental",e[e.ForComment=23]="ForComment",e[e.TopSecret=24]="TopSecret",e[e.Draft=25]="Draft",e[e.ForPublicRelease=26]="ForPublicRelease",e))(Pt||{}),At=(e=>(e[e.None=0]="None",e[e.Square=1]="Square",e[e.Circle=2]="Circle",e[e.Diamond=3]="Diamond",e[e.OpenArrow=4]="OpenArrow",e[e.ClosedArrow=5]="ClosedArrow",e[e.Butt=6]="Butt",e[e.ROpenArrow=7]="ROpenArrow",e[e.RClosedArrow=8]="RClosedArrow",e[e.Slash=9]="Slash",e[e.Unknown=10]="Unknown",e))(At||{}),Tt=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.PUSHBUTTON=1]="PUSHBUTTON",e[e.CHECKBOX=2]="CHECKBOX",e[e.RADIOBUTTON=3]="RADIOBUTTON",e[e.COMBOBOX=4]="COMBOBOX",e[e.LISTBOX=5]="LISTBOX",e[e.TEXTFIELD=6]="TEXTFIELD",e[e.SIGNATURE=7]="SIGNATURE",e[e.XFA=8]="XFA",e[e.XFA_CHECKBOX=9]="XFA_CHECKBOX",e[e.XFA_COMBOBOX=10]="XFA_COMBOBOX",e[e.XFA_IMAGEFIELD=11]="XFA_IMAGEFIELD",e[e.XFA_LISTBOX=12]="XFA_LISTBOX",e[e.XFA_PUSHBUTTON=13]="XFA_PUSHBUTTON",e[e.XFA_SIGNATURE=14]="XFA_SIGNATURE",e[e.XFA_TEXTFIELD=15]="XFA_TEXTFIELD",e))(Tt||{}),zt=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e))(zt||{}),Et=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.SOLID=1]="SOLID",e[e.DASHED=2]="DASHED",e[e.BEVELED=3]="BEVELED",e[e.INSET=4]="INSET",e[e.UNDERLINE=5]="UNDERLINE",e[e.CLOUDY=6]="CLOUDY",e))(Et||{}),_t=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.PATH=2]="PATH",e[e.IMAGE=3]="IMAGE",e[e.SHADING=4]="SHADING",e[e.FORM=5]="FORM",e))(_t||{});const Rt=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),Nt=Object.entries(Rt).reduce((e,[t,n])=>(e[n]=Number(t),e),{});function Ot(e){return Object.keys(Rt).filter(t=>0!==(e&t)).map(e=>Rt[e])}function Lt(e){return e.reduce((e,t)=>e|Nt[t],0)}var $t=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))($t||{}),Ft=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(Ft||{}),jt=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(jt||{}),Ht=(e=>(e[e.Ok=0]="Ok",e[e.Unknown=1]="Unknown",e[e.NotFound=2]="NotFound",e[e.WrongFormat=3]="WrongFormat",e[e.Password=4]="Password",e[e.Security=5]="Security",e[e.PageError=6]="PageError",e[e.XFALoad=7]="XFALoad",e[e.XFALayout=8]="XFALayout",e[e.Cancelled=9]="Cancelled",e[e.Initialization=10]="Initialization",e[e.NotReady=11]="NotReady",e[e.NotSupport=12]="NotSupport",e[e.LoadDoc=13]="LoadDoc",e[e.DocNotOpen=14]="DocNotOpen",e[e.CantCloseDoc=15]="CantCloseDoc",e[e.CantCreateNewDoc=16]="CantCreateNewDoc",e[e.CantImportPages=17]="CantImportPages",e[e.CantCreateAnnot=18]="CantCreateAnnot",e[e.CantSetAnnotRect=19]="CantSetAnnotRect",e[e.CantSetAnnotContent=20]="CantSetAnnotContent",e[e.CantRemoveInkList=21]="CantRemoveInkList",e[e.CantAddInkStoke=22]="CantAddInkStoke",e[e.CantReadAttachmentSize=23]="CantReadAttachmentSize",e[e.CantReadAttachmentContent=24]="CantReadAttachmentContent",e[e.CantFocusAnnot=25]="CantFocusAnnot",e[e.CantSelectText=26]="CantSelectText",e[e.CantSelectOption=27]="CantSelectOption",e[e.CantCheckField=28]="CantCheckField",e[e.CantSetAnnotString=29]="CantSetAnnotString",e))(Ht||{});class Ut{static create(){return new gt}static resolve(e){const t=new gt;return t.resolve(e),t}static reject(e){const t=new gt;return t.reject(e),t}static abort(e){const t=new gt;return t.reject(e),t}}function Wt(e){const t=e=>(e=>Math.max(0,Math.min(255,e)))(e).toString(16).padStart(2,"0");return`#${t(e.red)}${t(e.green)}${t(e.blue)}`}function Bt(e){/^#?[0-9a-f]{3}$/i.test(e)&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3").toLowerCase());const[,t,n,o]=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e)??(()=>{throw new Error(`Invalid hex colour: "${e}"`)})();return{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(o,16)}}function qt(e){return(e=>Math.max(0,Math.min(255,e)))(e)/255}function Gt(e){return((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*e))}function Vt(e){if(!(null==e?void 0:e.startsWith("D:"))||e.length<16)return;const t=+e.slice(2,6),n=+e.slice(6,8)-1,o=+e.slice(8,10),i=+e.slice(10,12),r=+e.slice(12,14),a=+e.slice(14,16);return new Date(Date.UTC(t,n,o,i,r,a))}function Zt(e=new Date){const t=(e,t=2)=>e.toString().padStart(t,"0");return`D:${e.getUTCFullYear()}${t(e.getUTCMonth()+1)}${t(e.getUTCDate())}${t(e.getUTCHours())}${t(e.getUTCMinutes())}${t(e.getUTCSeconds())}`}const Kt=Object.freeze([{id:xt.Left,label:"Left",css:"left"},{id:xt.Center,label:"Center",css:"center"},{id:xt.Right,label:"Right",css:"right"}]),Yt=Kt.reduce((e,t)=>(e[t.id]=t,e),{});function Xt(e){return function(e){return Yt[e]??Yt[xt.Left]}(e).css}Kt.reduce((e,t)=>(e[t.css]=t.id,e),{}),Kt.map(e=>({value:e.id,label:e.label}));var Qt=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(Qt||{});const Jt=wt.Helvetica,en={id:wt.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},tn=Object.freeze([{id:wt.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:wt.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:'"Courier-Bold", Courier, monospace'},{id:wt.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:'"Courier-BoldOblique", Courier, monospace'},{id:wt.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:'"Courier-Oblique", Courier, monospace'},en,{id:wt.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:'"Helvetica-Bold", Arial, sans-serif'},{id:wt.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:'"Helvetica-BoldOblique", Arial, sans-serif'},{id:wt.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:'"Helvetica-Oblique", Arial, sans-serif'},{id:wt.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:wt.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman Bold", Times, serif'},{id:wt.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman Bold Italic", Times, serif'},{id:wt.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman Italic", Times, serif'},{id:wt.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol"},{id:wt.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats"}]),nn=tn.reduce((e,t)=>(e[t.id]=t,e),{}),on=new Map;for(const e of tn)on.set(`${e.family}_${e.bold}_${e.italic}`,e.id);function rn(e){return nn[e]??en}function an(e){return rn(e).bold}function sn(e){return rn(e).italic}function ln(e,{bold:t,italic:n}){return on.get(`${e}_${t}_${n}`)??Jt}Object.values(Qt).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e}));const cn=[...new Set(tn.map(e=>e.family))];function dn(e){switch(e){case"Courier":return"Courier";case"Helvetica":default:return"Helvetica";case"Times":return"Times";case"Symbol":return"Symbol";case"ZapfDingbats":return"ZapfDingbats"}}const un=Object.freeze([{id:It.Normal,label:"Normal",css:"normal"},{id:It.Multiply,label:"Multiply",css:"multiply"},{id:It.Screen,label:"Screen",css:"screen"},{id:It.Overlay,label:"Overlay",css:"overlay"},{id:It.Darken,label:"Darken",css:"darken"},{id:It.Lighten,label:"Lighten",css:"lighten"},{id:It.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:It.ColorBurn,label:"Color Burn",css:"color-burn"},{id:It.HardLight,label:"Hard Light",css:"hard-light"},{id:It.SoftLight,label:"Soft Light",css:"soft-light"},{id:It.Difference,label:"Difference",css:"difference"},{id:It.Exclusion,label:"Exclusion",css:"exclusion"},{id:It.Hue,label:"Hue",css:"hue"},{id:It.Saturation,label:"Saturation",css:"saturation"},{id:It.Color,label:"Color",css:"color"},{id:It.Luminosity,label:"Luminosity",css:"luminosity"}]),hn=un.reduce((e,t)=>(e[t.id]=t,e),{});function mn(e){return function(e){return hn[e]??hn[It.Normal]}(e).css}un.reduce((e,t)=>(e[t.css]=t.id,e),{}),un.map(e=>({value:e.id,label:e.label}));const gn=un.map(e=>e.id);function pn(e){if(e instanceof at)return{type:"noop"};if(e instanceof st)return{type:"console"};if(e instanceof ct)return{type:"perf"};if(e instanceof lt){const t=e;return{type:"level",config:{level:t.level,logger:pn(t.logger)}}}if(e instanceof dt){return{type:"all",config:{loggers:e.loggers.map(pn)}}}return{type:"noop"}}const vn=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function fn(e){return vn.test(e)}function yn(){var e;if("function"==typeof(null==(e=globalThis.crypto)?void 0:e.randomUUID))return globalThis.crypto.randomUUID();const t=function(e){var t;if("function"==typeof(null==(t=globalThis.crypto)?void 0:t.getRandomValues))return globalThis.crypto.getRandomValues(new Uint8Array(e));if("function"==typeof require)try{const{randomBytes:t}=require("crypto");return t(e)}catch{}const n=new Uint8Array(e);for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}(16);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}class bn extends gt{constructor(e={}){super(),this.children=new Map,this.childResults=[],this.completedCount=0,this.expectedCount=0,this.isFinalized=!1,this.config={aggregate:e.aggregate??(e=>e),onChildComplete:e.onChildComplete??(()=>{}),failFast:e.failFast??!0}}addChild(e,t){if(this.state.stage!==ut.Pending)return this.state.stage===ut.Aborted&&e.abort(this.state.reason),this;const n=t??this.expectedCount;return this.expectedCount=Math.max(this.expectedCount,n+1),this.children.set(e,n),e.wait(t=>this.handleChildSuccess(e,t,n),t=>this.handleChildError(e,t,n)),this}finalize(){return this.isFinalized||(this.isFinalized=!0,0===this.expectedCount&&this.resolve(this.config.aggregate([]))),this}handleChildSuccess(e,t,n){if(this.state.stage!==ut.Pending)return;this.childResults[n]=t,this.completedCount++,this.children.delete(e);const o=this.config.onChildComplete(this.completedCount,this.expectedCount,t,n);if(void 0!==o&&this.progress(o),this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}handleChildError(e,t,n){if(this.state.stage===ut.Pending)if(this.children.delete(e),this.config.failFast){for(const[e]of this.children)e.abort("Sibling task failed");this.children.clear(),this.fail(t)}else if(this.childResults[n]=void 0,this.completedCount++,this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}abort(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.abort(e)}reject(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.reject(e)}getPendingCount(){return this.children.size}getCompletedCount(){return this.completedCount}static gather(e){const t=new bn({aggregate:e=>e,onChildComplete:(e,t)=>({completed:e,total:t})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherIndexed(e){const t=new bn({aggregate:e=>{const t={};return e.forEach((e,n)=>{t[n]=e}),t},onChildComplete:(e,t,n,o)=>({page:o,result:n})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherFrom(e,t){const n=new bn(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new bn({aggregate:e=>e[0],failFast:!1});return n.handleChildSuccess=(e,o)=>{if(!t){t=!0;for(const[t]of n.children)t!==e&&t.abort("Race won by sibling");n.resolve(o)}},e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}}function wn(){}class xn{constructor(){this.dependencyGraph=new Map}addNode(e,t=[]){this.dependencyGraph.set(e,new Set(t))}hasCircularDependencies(){const e=new Set,t=new Set,n=o=>{e.add(o),t.add(o);const i=this.dependencyGraph.get(o)||new Set;for(const o of i)if(e.has(o)){if(t.has(o))return!0}else if(n(o))return!0;return t.delete(o),!1};for(const t of this.dependencyGraph.keys())if(!e.has(t)&&n(t))return!0;return!1}resolveLoadOrder(){if(this.hasCircularDependencies())throw new Error("Circular dependencies detected");const e=[],t=new Set,n=new Set,o=i=>{if(n.has(i))throw new Error("Circular dependency");if(t.has(i))return;n.add(i);const r=this.dependencyGraph.get(i)||new Set;for(const e of r)o(e);n.delete(i),t.add(i),e.push(i)};for(const e of this.dependencyGraph.keys())t.has(e)||o(e);return e}}class Cn extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class In extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class Sn extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class kn extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class Dn{constructor(e,t){this.store=e,this.pluginId=t}getState(){return this.store.getState().plugins[this.pluginId]}dispatch(e){return this.store.dispatchToPlugin(this.pluginId,e)}subscribeToState(e){return this.store.subscribeToPlugin(this.pluginId,(t,n,o)=>{e(t,n,o)})}onAction(e,t){return this.store.onAction(e,(e,n,o)=>{t(e,n.plugins[this.pluginId],o.plugins[this.pluginId])})}}const Mn="START_LOADING_DOCUMENT",Pn="UPDATE_DOCUMENT_LOADING_PROGRESS",An="SET_DOCUMENT_LOADED",Tn="SET_DOCUMENT_ERROR",zn="RETRY_LOADING_DOCUMENT",En="CLOSE_DOCUMENT",_n="SET_ACTIVE_DOCUMENT",Rn="REORDER_DOCUMENTS",Nn="MOVE_DOCUMENT",On="REFRESH_PAGES",Ln="SET_SCALE",$n="SET_ROTATION",Fn=[Mn,Pn,An,En,_n,Tn,zn,"REFRESH_DOCUMENT",On,"SET_PAGES",Ln,$n,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",Rn,Nn],jn=(e,t,n,o,i,r)=>({type:Mn,payload:{documentId:e,name:t,scale:n,rotation:o,passwordProvided:i,autoActivate:r}}),Hn=(e,t)=>({type:En,payload:{documentId:e,nextActiveDocumentId:t}}),Un=(e,t)=>({type:On,payload:{documentId:e,pageIndexes:t}}),Wn=(e,t)=>({type:$n,payload:{rotation:e,documentId:t}});class Bn{constructor(e,t){this.initialCoreState=t,this.pluginReducers={},this.listeners=[],this.pluginListeners={},this.isDispatching=!1,this.state={core:t,plugins:{}},this.coreReducer=e}addPluginReducer(e,t,n){this.state.plugins[e]=n,this.pluginReducers[e]=t}dispatchToCore(e){if(!this.coreReducer)return this.getState();if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.state.core=this.coreReducer(this.state.core,e)}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const o=this.getState();n(e,o,t)}),this.getState()}dispatchToPlugin(e,t,n=!0){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const o=this.getState(),i=this.pluginReducers[e];if(!i)return o.plugins[e];const r=o.plugins[e];try{this.isDispatching=!0;const n=i(r,t);this.state.plugins[e]=n}finally{this.isDispatching=!1}return n&&this.listeners.forEach(e=>{const n=this.getState();e(t,n,o)}),this.pluginListeners[e]&&this.pluginListeners[e].forEach(n=>{const o=this.getState().plugins[e];n(t,o,r)}),this.getState().plugins[e]}dispatch(e){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.isCoreAction(e)&&(this.state.core=this.coreReducer(this.state.core,e));for(const n in this.pluginReducers){const o=this.pluginReducers[n],i=t.plugins[n];o&&(this.state.plugins[n]=o(i,e))}}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const o=this.getState();n(e,o,t)}),this.getState()}getState(){if(this.isDispatching)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return{core:{...this.state.core},plugins:{...this.state.plugins}}}subscribe(e){if(this.isDispatching)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state.");return this.listeners.push(e),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.listeners=this.listeners.filter(t=>t!==e)}}subscribeToPlugin(e,t){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);if(this.isDispatching)throw new Error("You may not call store.subscribeToPlugin() while the reducer is executing.");return this.pluginListeners[e]||(this.pluginListeners[e]=[]),this.pluginListeners[e].push(t),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.pluginListeners[e]=this.pluginListeners[e].filter(e=>e!==t),0===this.pluginListeners[e].length&&delete this.pluginListeners[e]}}onAction(e,t){return this.subscribe((n,o,i)=>{n.type===e&&t(n,o,i)})}getPluginStore(e){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);return new Dn(this,e)}isCoreAction(e){return Fn.includes(e.type)}destroy(){var e,t;this.listeners.length=0;for(const n in this.pluginListeners)null==(t=null==(e=this.pluginListeners[n])?void 0:e.splice)||t.call(e,0);this.pluginListeners={},this.pluginReducers={},this.state.plugins={},this.state.core={...this.initialCoreState}}}function qn(e,t,n){const o=e.activeDocumentId;if(o!==t)return o;if(void 0!==n)return n&&e.documents[n]?n:null;const i=e.documentOrder.indexOf(t);return-1===i?null:i>0?e.documentOrder[i-1]:i<e.documentOrder.length-1?e.documentOrder[i+1]:null}const Gn=(e,t)=>{switch(t.type){case Mn:{const{documentId:n,name:o,scale:i,rotation:r,passwordProvided:a,autoActivate:s=!0}=t.payload,l={id:n,name:o,status:"loading",loadingProgress:0,error:null,document:null,scale:i??e.defaultScale,rotation:r??e.defaultRotation,passwordProvided:a??!1,pageRefreshVersions:{},loadStartedAt:Date.now()};return{...e,documents:{...e.documents,[n]:l},documentOrder:[...e.documentOrder,n],activeDocumentId:s||!e.activeDocumentId?n:e.activeDocumentId}}case Pn:{const{documentId:n,progress:o}=t.payload,i=e.documents[n];return i&&"loading"===i.status?{...e,documents:{...e.documents,[n]:{...i,loadingProgress:o}}}:e}case An:{const{documentId:n,document:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,status:"loaded",document:o,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:void 0,loadedAt:Date.now()}}}:e}case Tn:{const{documentId:n,error:o,errorCode:i,errorDetails:r}=t.payload,a=e.documents[n];return a?{...e,documents:{...e.documents,[n]:{...a,status:"error",error:o,errorCode:i,errorDetails:r}}}:e}case zn:{const{documentId:n,passwordProvided:o}=t.payload,i=e.documents[n];return i&&"error"===i.status?{...e,documents:{...e.documents,[n]:{...i,status:"loading",loadingProgress:0,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:o??!1,loadStartedAt:Date.now()}}}:e}case En:{const{documentId:n,nextActiveDocumentId:o}=t.payload,{[n]:i,...r}=e.documents;return{...e,documents:r,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:qn(e,n,o)}}case Nn:{const{documentId:n,toIndex:o}=t.payload,i=function(e,t,n){const o=e.indexOf(t);if(-1===o)return null;if(n<0||n>=e.length)return null;if(o===n)return null;const i=[...e];return i.splice(o,1),i.splice(n,0,t),i}(e.documentOrder,n,o);return i?{...e,documentOrder:i}:e}case Rn:return{...e,documentOrder:t.payload};case _n:return{...e,activeDocumentId:t.payload};case Ln:{const{scale:n,documentId:o}=t.payload,i=o??e.activeDocumentId;if(!i)return e;const r=e.documents[i];return r?{...e,documents:{...e.documents,[i]:{...r,scale:n}}}:e}case $n:{const{rotation:n,documentId:o}=t.payload,i=o??e.activeDocumentId;if(!i)return e;const r=e.documents[i];return r?{...e,documents:{...e.documents,[i]:{...r,rotation:n}}}:e}case On:{const{documentId:n,pageIndexes:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.pageRefreshVersions};for(const e of o)r[e]=(r[e]||0)+1;return{...e,documents:{...e.documents,[n]:{...i,pageRefreshVersions:r}}}}default:return e}};class Vn{constructor(e,t){this.plugins=new Map,this.manifests=new Map,this.capabilities=new Map,this.status=new Map,this.configurations=new Map,this.initPromise=null,this.pendingRegistrations=[],this.processingRegistrations=[],this.initialized=!1,this.isInitializing=!1,this.pluginsReadyPromise=null,this.destroyed=!1,this.resolver=new xn,this.engine=e,this.initialCoreState=(e=>({documents:{},documentOrder:[],activeDocumentId:null,defaultScale:(null==e?void 0:e.defaultScale)??1,defaultRotation:(null==e?void 0:e.defaultRotation)??We.Degree0}))(t),this.store=new Bn(Gn,this.initialCoreState),this.logger=(null==t?void 0:t.logger)??new at}getLogger(){return this.logger}registerPlugin(e,t){if(this.initialized&&!this.isInitializing)throw new Cn("Cannot register plugins after initialization");this.validateManifest(e.manifest),this.store.addPluginReducer(e.manifest.id,e.reducer,"function"==typeof e.initialState?e.initialState(this.initialCoreState,{...e.manifest.defaultConfig,...t}):e.initialState),this.pendingRegistrations.push({package:e,config:t})}getStore(){return this.store}getEngine(){return this.engine}pluginsReady(){return this.pluginsReadyPromise||(this.pluginsReadyPromise=(async()=>{this.initialized||await this.initialize();const e=Array.from(this.plugins.values()).map(e=>"function"==typeof e.ready?e.ready():Promise.resolve());await Promise.all(e)})()),this.pluginsReadyPromise}async initialize(){if(this.destroyed)throw new Cn("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new Cn("Registry is already initialized");this.isInitializing=!0;try{if(this.destroyed)return;for(;this.pendingRegistrations.length>0;){if(this.destroyed)return;this.processingRegistrations=[...this.pendingRegistrations],this.pendingRegistrations=[];for(const e of this.processingRegistrations){const t=new Set,n=[...e.package.manifest.requires,...e.package.manifest.optional];for(const e of n){const n=this.processingRegistrations.find(t=>t.package.manifest.provides.includes(e));n&&t.add(n.package.manifest.id)}this.resolver.addNode(e.package.manifest.id,[...t])}const e=this.resolver.resolveLoadOrder();for(const t of e){const e=this.processingRegistrations.find(e=>e.package.manifest.id===t);this.instantiatePlugin(e.package.manifest,e.package.create,e.config)}for(const t of e)await this.runPluginInitialization(t);this.processingRegistrations=[],this.resolver=new xn}this.initialized=!0}catch(e){if(e instanceof Error)throw new Sn(`Failed to resolve plugin dependencies: ${e.message}`);throw e}finally{this.isInitializing=!1}})()),this.initPromise}instantiatePlugin(e,t,n){const o={...e.defaultConfig,...n};this.validateConfig(e.id,o,e.defaultConfig);const i=t(this,o);this.validatePlugin(i);for(const t of e.provides){if(this.capabilities.has(t))throw new Cn(`Capability ${t} is already provided by plugin ${this.capabilities.get(t)}`);this.capabilities.set(t,e.id)}this.plugins.set(e.id,i),this.manifests.set(e.id,e),this.status.set(e.id,"registered"),this.configurations.set(e.id,o)}async runPluginInitialization(e){const t=this.plugins.get(e);if(!t)return;const n=this.manifests.get(e),o=this.configurations.get(e);for(const t of n.requires)if(!this.capabilities.has(t))throw new Cn(`Missing required capability: ${t} for plugin ${e}`);this.logger.debug("PluginRegistry","InitializePlugin",`Initializing plugin ${e}`);try{t.initialize&&await t.initialize(o),this.status.set(e,"active"),this.logger.info("PluginRegistry","PluginInitialized",`Plugin ${e} initialized successfully`)}catch(t){throw this.status.set(e,"error"),this.logger.error("PluginRegistry","InitializationFailed",`Plugin ${e} initialization failed`,{error:t}),t}}getPluginConfig(e){const t=this.configurations.get(e);if(!t)throw new In(`Configuration for plugin ${e} not found`);return t}validateConfig(e,t,n){const o=Object.keys(n).filter(e=>!t.hasOwnProperty(e));if(o.length>0)throw new kn(`Missing required configuration keys for plugin ${e}: ${o.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new In(`Plugin ${e} not found`);const o=this.manifests.get(e),i=this.configurations.get(e);if(!o||!i)throw new In(`Plugin ${e} not found`);const r={...i,...t};this.validateConfig(e,r,o.defaultConfig),this.configurations.set(e,r),n.initialize&&await n.initialize(r)}registerPluginBatch(e){for(const t of e)this.registerPlugin(t.package,t.config)}async unregisterPlugin(e){const t=this.plugins.get(e);if(!t)throw new In(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new In(`Manifest for plugin ${e} not found`);for(const[t,o]of this.manifests.entries()){if(t===e)continue;if([...o.requires,...o.optional].some(e=>n.provides.includes(e)))throw new Cn(`Cannot unregister plugin ${e}: plugin ${t} depends on it`)}try{t.destroy&&await t.destroy();for(const e of n.provides)this.capabilities.delete(e);this.plugins.delete(e),this.manifests.delete(e),this.status.delete(e)}catch(t){if(t instanceof Error)throw new Error(`Failed to unregister plugin ${e}: ${t.message}`);throw t}}getPlugin(e){const t=this.plugins.get(e);return t||null}getCapabilityProvider(e){const t=this.capabilities.get(e);return t?this.getPlugin(t):null}hasCapability(e){return this.capabilities.has(e)}getAllPlugins(){return Array.from(this.plugins.values())}getPluginStatus(e){const t=this.status.get(e);if(!t)throw new In(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new Cn("Plugin must have an id")}validateManifest(e){if(!e.id)throw new Cn("Manifest must have an id");if(!e.name)throw new Cn("Manifest must have a name");if(!e.version)throw new Cn("Manifest must have a version");if(!Array.isArray(e.provides))throw new Cn("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new Cn("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new Cn("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new Cn("Registry has already been destroyed");this.destroyed=!0;try{await this.initPromise}catch{}for(const t of Array.from(this.plugins.values()).reverse())await(null==(e=t.destroy)?void 0:e.call(t));this.store.destroy(),this.plugins.clear(),this.manifests.clear(),this.capabilities.clear(),this.status.clear(),this.pendingRegistrations.length=0,this.processingRegistrations.length=0}}function Zn(e,t){return{package:e,config:t}}function Kn(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class Yn{constructor(e,t){if(this.id=e,this.registry=t,this.cooldownActions={},this.debouncedTimeouts={},this.unsubscribeFromState=null,this.unsubscribeFromCoreStore=null,this.unsubscribeFromStartLoadingDocument=null,this.unsubscribeFromSetDocumentLoaded=null,this.unsubscribeFromCloseDocument=null,this.unsubscribeFromSetScale=null,this.unsubscribeFromSetRotation=null,e!==this.constructor.id)throw new Error(`Plugin ID mismatch: ${e} !== ${this.constructor.id}`);this.engine=this.registry.getEngine(),this.logger=this.registry.getLogger(),this.coreStore=this.registry.getStore(),this.pluginStore=this.coreStore.getPluginStore(this.id),this.unsubscribeFromState=this.pluginStore.subscribeToState((e,t,n)=>{this.onStoreUpdated(n,t)}),this.unsubscribeFromCoreStore=this.coreStore.subscribe((e,t,n)=>{this.onCoreStoreUpdated(n,t),t.core.activeDocumentId!==n.core.activeDocumentId&&this.onActiveDocumentChanged(n.core.activeDocumentId,t.core.activeDocumentId)}),this.unsubscribeFromStartLoadingDocument=this.coreStore.onAction(Mn,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(An,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(En,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction(Ln,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction($n,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onRotationChanged(n,e.payload.rotation)}),this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.readyResolve()}provides(){if(!this._capability){const e=this.buildCapability();this._capability=Object.freeze(e)}return this._capability}get state(){return this.pluginStore.getState()}get coreState(){return this.coreStore.getState()}getState(){return this.pluginStore.getState()}getCoreState(){return this.coreStore.getState()}dispatchCoreAction(e){return this.coreStore.dispatchToCore(e)}dispatchToAllPlugins(e){return this.coreStore.dispatch(e)}dispatch(e){return this.pluginStore.dispatch(e)}cooldownDispatch(e,t=100){const n=Date.now();return n-(this.cooldownActions[e.type]||0)>=t&&(this.cooldownActions[e.type]=n,this.dispatch(e),!0)}debouncedDispatch(e,t=100){const n=e.type;this.debouncedTimeouts[n]&&clearTimeout(this.debouncedTimeouts[n]),this.debouncedTimeouts[n]=setTimeout(()=>{this.dispatch(e),delete this.debouncedTimeouts[n]},t)}cancelDebouncedDispatch(e){this.debouncedTimeouts[e]&&(clearTimeout(this.debouncedTimeouts[e]),delete this.debouncedTimeouts[e])}subscribe(e){return this.pluginStore.subscribeToState(e)}subscribeToCoreStore(e){return this.coreStore.subscribe(e)}onStoreUpdated(e,t){}onCoreStoreUpdated(e,t){}onDocumentLoadingStarted(e){}onDocumentLoaded(e){}onDocumentClosed(e){}onActiveDocumentChanged(e,t){}onScaleChanged(e,t){}onRotationChanged(e,t){}destroy(){Object.values(this.debouncedTimeouts).forEach(e=>{clearTimeout(e)}),this.debouncedTimeouts={},this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=null),this.unsubscribeFromCoreStore&&(this.unsubscribeFromCoreStore(),this.unsubscribeFromCoreStore=null),this.unsubscribeFromStartLoadingDocument&&(this.unsubscribeFromStartLoadingDocument(),this.unsubscribeFromStartLoadingDocument=null),this.unsubscribeFromSetDocumentLoaded&&(this.unsubscribeFromSetDocumentLoaded(),this.unsubscribeFromSetDocumentLoaded=null),this.unsubscribeFromCloseDocument&&(this.unsubscribeFromCloseDocument(),this.unsubscribeFromCloseDocument=null),this.unsubscribeFromSetScale&&(this.unsubscribeFromSetScale(),this.unsubscribeFromSetScale=null),this.unsubscribeFromSetRotation&&(this.unsubscribeFromSetRotation(),this.unsubscribeFromSetRotation=null)}ready(){return this.readyPromise}markReady(){this.readyResolve()}resetReady(){this.readyPromise=new Promise(e=>{this.readyResolve=e})}getActiveDocumentId(){const e=this.coreState.core.activeDocumentId;if(!e)throw new Error("No active document");return e}getActiveDocumentIdOrNull(){return this.coreState.core.activeDocumentId}getCoreDocument(e){const t=e??this.getActiveDocumentIdOrNull();return t?this.coreState.core.documents[t]??null:null}getCoreDocumentOrThrow(e){const t=this.getCoreDocument(e);if(!t)throw new Error(`Document not found: ${e??"active"}`);return t}}class Xn{constructor(e,t){this.handler=e,this.options=t,this.lastRun=0,this.handle=e=>{"debounce"===this.options.mode?this.debounce(e):this.throttle(e)}}debounce(e){this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.timeoutId=void 0},this.options.wait)}throttle(e){if("debounce"===this.options.mode)return;const t=Date.now(),n=this.options.throttleMode||"leading-trailing";t-this.lastRun>=this.options.wait&&("leading-trailing"===n&&this.handler(e),this.lastRun=t),this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.lastRun=Date.now(),this.timeoutId=void 0},this.options.wait-(t-this.lastRun))}destroy(){this.timeoutId&&window.clearTimeout(this.timeoutId)}}class Qn{constructor(e,t){this.handler=e,this.options=t,this.controls=new Map,this.handle=e=>{const t=String(this.options.keyExtractor(e));let n=this.controls.get(t);n||(n=new Xn(this.handler,this.baseOptions),this.controls.set(t,n)),n.handle(e)},this.baseOptions={mode:t.mode,wait:t.wait,..."throttle"===t.mode&&"throttleMode"in t?{throttleMode:t.throttleMode}:{}}}destroy(){for(const e of this.controls.values())e.destroy();this.controls.clear()}}function Jn(e){return"keyExtractor"in e}function eo(e,t,n){return e<t?t:e>n?n:e}function to(e,t,n){if(e===t)return!0;if(null==e||null==t)return e===t;const o=typeof e;if(o!==typeof t)return!1;if("object"===o){n||(n=new Set);const o=function(e,t){return`${io(e)}__${io(t)}`}(e,t);if(n.has(o))return!0;n.add(o);const i=Array.isArray(e),r=Array.isArray(t);return i&&r?function(e,t,n){if(e.length!==t.length)return!1;const o=new Array(t.length).fill(!1);e:for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<t.length;e++)if(!o[e]&&to(r,t[e],n)){o[e]=!0;continue e}return!1}return!0}(e,t,n):!i&&!r&&function(e,t,n){const o=Object.keys(e).sort(),i=Object.keys(t).sort();if(o.length!==i.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==i[e])return!1;for(const i of o){if(!to(e[i],t[i],n))return!1}return!0}(e,t,n)}return!1}let no=0;const oo=new WeakMap;function io(e){return oo.has(e)||oo.set(e,++no),oo.get(e)}function ro(){const e=new Set;return{emit:(t=void 0)=>e.forEach(e=>e(t)),on:t=>(e.add(t),()=>e.delete(t)),off:t=>e.delete(t),clear:()=>e.clear()}}function ao(e,t=to){const n=new Set,o=new Map;let i=e;const r=(e,t)=>{let r=e,a=()=>{};if(t){if(Jn(t)){const n=new Qn(e,t);r=n.handle,a=()=>n.destroy()}else{const n=new Xn(e,t);r=n.handle,a=()=>n.destroy()}o.set(e,{wrapped:r,destroy:a})}return void 0!==i&&r(i),n.add(r),()=>{n.delete(r),a(),o.delete(e)}};return{get value(){return i},emit(e=void 0){void 0!==i&&t(i,e)||(i=e,(e=>{n.forEach(t=>t(e))})(e))},on:r,off(e){const t=o.get(e);t?(n.delete(t.wrapped),t.destroy(),o.delete(e)):n.delete(e)},clear(){n.clear(),o.forEach(e=>e.destroy()),o.clear()},select:(e,t=to)=>(n,o)=>{let a;if(void 0!==i){const t=e(i);a=t,n(t)}return r(o=>{const i=e(o);void 0!==a&&t(a,i)||(a=i,n(i))},o)}}}function so(e,t){const n=(null==t?void 0:t.cache)??!0,o=(null==t?void 0:t.equality)??to,i=new Map,r=new Map,a=new Map,s=new Set,l=new Map,c=e=>String(e);return{emit(t,a){const l=c(t);if(n){const e=i.get(l);if(void 0!==e&&o(e,a))return;i.set(l,a)}const d=r.get(l);d&&d.forEach(e=>e(a));const u=e(t,a);s.forEach(e=>e(u))},forScope(e){const t=c(e);return(e,o)=>{const s=(e=>{let t=r.get(e);return t||(t=new Set,r.set(e,t)),t})(t),l=(e=>{let t=a.get(e);return t||(t=new Map,a.set(e,t)),t})(t);let c=e,d=()=>{};if(o){if(Jn(o)){const t=new Qn(e,o);c=t.handle,d=()=>t.destroy()}else{const t=new Xn(e,o);c=t.handle,d=()=>t.destroy()}l.set(e,{wrapped:c,destroy:d})}if(n){const e=i.get(t);void 0!==e&&c(e)}return s.add(c),()=>{s.delete(c),d(),l.delete(e),0===s.size&&r.delete(t),0===l.size&&a.delete(t)}}},onGlobal:(e,t)=>{let n=e,o=()=>{};if(t){if(Jn(t)){const i=new Qn(e,t);n=i.handle,o=()=>i.destroy()}else{const i=new Xn(e,t);n=i.handle,o=()=>i.destroy()}l.set(e,{wrapped:n,destroy:o})}return s.add(n),()=>{s.delete(n),o(),l.delete(e)}},getValue:e=>n?i.get(c(e)):void 0,getScopes:()=>n?Array.from(i.keys()):Array.from(r.keys()),clearScope(e){const t=c(e);n&&i.delete(t);const o=r.get(t);o&&(o.clear(),r.delete(t));const s=a.get(t);s&&(s.forEach(e=>e.destroy()),s.clear(),a.delete(t))},clear(){n&&i.clear(),r.forEach(e=>e.clear()),r.clear(),a.forEach(e=>{e.forEach(e=>e.destroy()),e.clear()}),a.clear(),s.clear(),l.forEach(e=>e.destroy()),l.clear()}}}class lo{constructor(e){this.autoMountElements=[],this.package=e}addUtility(e){return this.autoMountElements.push({component:e,type:"utility"}),this}addWrapper(e){return this.autoMountElements.push({component:e,type:"wrapper"}),this}build(){return{...this.package,autoMountElements:()=>this.autoMountElements}}}function co(e){return new lo(e)}const uo=de({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function ho({plugins:e,children:t}){const{utilities:n,wrappers:o}=Te(()=>{const t=[],n=[];for(const o of e){const e=o.package;if(Kn(e)){const o=e.autoMountElements()||[];for(const e of o)"utility"===e.type?t.push(e.component):"wrapper"===e.type&&n.push(e.component)}}return{utilities:t,wrappers:n}},[e]);return Ue(U,{children:[o.reduce((e,t)=>Ue(t,{children:e}),t),n.map((e,t)=>Ue(e,{},`utility-${t}`))]})}function mo({engine:e,logger:t,onInitialized:n,plugins:o,children:i,autoMountDomElements:r=!0}){const[a,s]=ke(null),[l,c]=ke(null),[d,u]=ke(!0),[h,m]=ke(!1),g=Ae(n);Me(()=>{g.current=n},[n]),Me(()=>{const n=new Vn(e,{logger:t});n.registerPluginBatch(o);let i;return(async()=>{var e;if(await n.initialize(),n.isDestroyed())return;const t=n.getStore();c(t.getState().core);const o=t.subscribe((e,n,o)=>{t.isCoreAction(e)&&n.core!==o.core&&c(n.core)});if(await(null==(e=g.current)?void 0:e.call(g,n)),!n.isDestroyed())return n.pluginsReady().then(()=>{n.isDestroyed()||m(!0)}),s(n),u(!1),o;o()})().then(e=>{i=e}).catch(console.error),()=>{null==i||i(),n.destroy(),s(null),c(null),u(!0),m(!1)}},[e,o]);const p=Te(()=>{const e=(null==l?void 0:l.activeDocumentId)??null,t=(null==l?void 0:l.documents)??{},n=(null==l?void 0:l.documentOrder)??[],o=e&&t[e]?t[e]:null,i=n.map(e=>t[e]).filter(e=>null!=e);return{registry:a,coreState:l,isInitializing:d,pluginsReady:h,activeDocumentId:e,activeDocument:o,documents:t,documentStates:i}},[a,l,d,h]),v="function"==typeof i?i(p):i;return Ue(uo.Provider,{value:p,children:h&&r?Ue(ho,{plugins:o,children:v}):v})}function go(e){const{registry:t}=function(){const e=Ee(uo);if(void 0===e)throw new Error("useCapability must be used within a PDFContext.Provider");const{registry:t,isInitializing:n}=e;if(n)return e;if(null===t)throw new Error("PDF registry failed to initialize properly");return e}();if(null===t)return{plugin:null,isLoading:!0,ready:new Promise(()=>{})};const n=t.getPlugin(e);if(!n)throw new Error(`Plugin ${e} not found`);return{plugin:n,isLoading:!1,ready:n.ready()}}function po(e){const{plugin:t,isLoading:n,ready:o}=go(e);if(!t)return{provides:null,isLoading:n,ready:o};if(!t.provides)throw new Error(`Plugin ${e} does not provide a capability`);return{provides:t.provides(),isLoading:n,ready:o}}function vo(){const{coreState:e}=Ee(uo);return e}function fo(e){const t=vo();return Te(()=>t&&e?t.documents[e]??null:null,[t,e])}const yo="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.0.1/dist/pdfium.wasm";de(void 0);const bo="viewport",wo={id:bo,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},xo="INIT_VIEWPORT_STATE",Co="CLEANUP_VIEWPORT_STATE",Io="REGISTER_VIEWPORT",So="UNREGISTER_VIEWPORT",ko="SET_VIEWPORT_METRICS",Do="SET_VIEWPORT_SCROLL_METRICS",Mo="SET_VIEWPORT_GAP",Po="SET_SCROLL_ACTIVITY",Ao="SET_SMOOTH_SCROLL_ACTIVITY",To="ADD_VIEWPORT_GATE",zo="REMOVE_VIEWPORT_GATE";function Eo(e,t){return{type:Ao,payload:{documentId:e,isSmoothScrolling:t}}}const _o={viewportMetrics:{width:0,height:0,scrollTop:0,scrollLeft:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,clientLeft:0,clientTop:0,relativePosition:{x:0,y:0}},isScrolling:!1,isSmoothScrolling:!1,gates:new Set},Ro={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},No=class extends Yn{constructor(e,t,n){var o;super(e,t),this.id=e,this.viewportResize$=ao(),this.viewportMetrics$=ao(),this.scrollMetrics$=ao(),this.scrollActivity$=ao(),this.gateState$=ao(),this.scrollRequests$=new Map,n.viewportGap&&this.dispatch((o=n.viewportGap,{type:Mo,payload:o})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:xo,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,ro()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:Co,payload:{documentId:e}}}(e)),null==(t=this.scrollRequests$.get(e))||t.clear(),this.scrollRequests$.delete(e),this.logger.debug("ViewportPlugin","DocumentClosed",`Cleaned up viewport state for document: ${e}`)}buildCapability(){return{getViewportGap:()=>this.state.viewportGap,getMetrics:()=>this.getMetrics(),scrollTo:e=>this.scrollTo(e),isScrolling:()=>this.isScrolling(),isSmoothScrolling:()=>this.isSmoothScrolling(),isGated:e=>this.isGated(e),hasGate:(e,t)=>this.hasGate(e,t),getGates:e=>this.getGates(e),forDocument:e=>this.createViewportScope(e),gate:(e,t)=>this.gate(e,t),releaseGate:(e,t)=>this.releaseGate(e,t),isViewportMounted:e=>this.state.activeViewports.has(e),onViewportChange:this.viewportMetrics$.on,onViewportResize:this.viewportResize$.on,onScrollChange:this.scrollMetrics$.on,onScrollActivity:this.scrollActivity$.on,onGateChange:this.gateState$.on}}createViewportScope(e){return{getMetrics:()=>this.getMetrics(e),scrollTo:t=>this.scrollTo(t,e),isScrolling:()=>this.isScrolling(e),isSmoothScrolling:()=>this.isSmoothScrolling(e),isGated:()=>this.isGated(e),hasGate:t=>this.hasGate(t,e),getGates:()=>this.getGates(e),gate:t=>this.gate(t,e),releaseGate:t=>this.releaseGate(t,e),onViewportChange:t=>this.viewportMetrics$.on(n=>{n.documentId===e&&t(n.metrics)}),onScrollChange:t=>this.scrollMetrics$.on(n=>{n.documentId===e&&t(n.scrollMetrics)}),onScrollActivity:t=>this.scrollActivity$.on(n=>{n.documentId===e&&t(n.activity)}),onGateChange:t=>this.gateState$.on(n=>{(null==n?void 0:n.documentId)===e&&t(n)})}}registerViewport(e){if(!this.state.documents[e])throw new Error(`Cannot register viewport for ${e}: document state not found. Document must be opened before registering viewport.`);this.state.activeViewports.has(e)||(this.dispatch(function(e){return{type:Io,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","RegisterViewport",`Registered viewport (DOM mounted) for document: ${e}`))}unregisterViewport(e){this.registry.isDestroyed()||this.state.activeViewports.has(e)&&(this.dispatch(function(e){return{type:So,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","UnregisterViewport",`Unregistered viewport (DOM unmounted) for document: ${e}. State preserved.`))}setViewportResizeMetrics(e,t){if(this.registry.isDestroyed())return;this.dispatch(function(e,t){return{type:ko,payload:{documentId:e,metrics:t}}}(e,t));const n=this.state.documents[e];n&&this.viewportResize$.emit({documentId:e,metrics:n.viewportMetrics})}setViewportScrollMetrics(e,t){if(this.registry.isDestroyed())return;const n=this.state.documents[e];n&&(t.scrollTop===n.viewportMetrics.scrollTop&&t.scrollLeft===n.viewportMetrics.scrollLeft||(this.dispatch(function(e,t){return{type:Do,payload:{documentId:e,scrollMetrics:t}}}(e,t)),this.bumpScrollActivity(e),this.scrollMetrics$.emit({documentId:e,scrollMetrics:t})))}onScrollRequest(e,t){const n=this.scrollRequests$.get(e);if(!n)throw new Error(`Cannot subscribe to scroll requests for ${e}: document state not initialized`);return n.on(t)}gate(e,t){const n=this.state.documents[t];n?n.gates.has(e)||(this.dispatch(function(e,t){return{type:To,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateAdded",`Added gate '${e}' for document: ${t}. Total gates: ${n.gates.size+1}`)):this.logger.warn("ViewportPlugin","GateViewport",`Cannot gate viewport for ${t}: document not found`)}releaseGate(e,t){const n=this.state.documents[t];n?n.gates.has(e)&&(this.dispatch(function(e,t){return{type:zo,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateReleased",`Released gate '${e}' for document: ${t}. Remaining gates: ${n.gates.size-1}`)):this.logger.warn("ViewportPlugin","ReleaseGate",`Cannot release gate for ${t}: document not found`)}getViewportState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Viewport state not found for document: ${t}`);return n}getMetrics(e){return this.getViewportState(e).viewportMetrics}isScrolling(e){return this.getViewportState(e).isScrolling}isSmoothScrolling(e){return this.getViewportState(e).isSmoothScrolling}isGated(e){return this.getViewportState(e).gates.size>0}hasGate(e,t){return this.getViewportState(t).gates.has(e)}getGates(e){const t=this.getViewportState(e);return Array.from(t.gates)}scrollTo(e,t){const n=t??this.getActiveDocumentId(),o=this.getViewportState(n),{x:i,y:r,alignX:a,alignY:s,behavior:l="auto"}=e;"smooth"===l&&this.dispatch(Eo(n,!0));const c=o.viewportMetrics;let d=i,u=r;void 0!==a&&(d=i-c.clientWidth*(a/100)),void 0!==s&&(u=r-c.clientHeight*(s/100));const h=this.scrollRequests$.get(n);h&&h.emit({x:d,y:u,behavior:l})}bumpScrollActivity(e){this.debouncedDispatch(function(e,t){return{type:Po,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(Eo(e,!1),this.scrollEndDelay)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];if(o!==i&&(this.viewportMetrics$.emit({documentId:n,metrics:i.viewportMetrics}),!o||o.isScrolling===i.isScrolling&&o.isSmoothScrolling===i.isSmoothScrolling||this.scrollActivity$.emit({documentId:n,activity:{isScrolling:i.isScrolling,isSmoothScrolling:i.isSmoothScrolling}}),o&&o.gates!==i.gates)){const e=Array.from(o.gates),t=Array.from(i.gates),r=t.find(t=>!e.includes(t)),a=e.find(e=>!t.includes(e));this.gateState$.emit({documentId:n,isGated:i.gates.size>0,gates:t,addedGate:r,removedGate:a}),this.logger.debug("ViewportPlugin","GateStateChanged",`Gate state changed for document ${n}. Gates: [${t.join(", ")}], Gated: ${i.gates.size>0}`)}}}async initialize(e){this.logger.info("ViewportPlugin","Initialize","Viewport plugin initialized")}async destroy(){this.viewportMetrics$.clear(),this.viewportResize$.clear(),this.scrollMetrics$.clear(),this.scrollActivity$.clear(),this.gateState$.clear(),this.scrollRequests$.forEach(e=>e.clear()),this.scrollRequests$.clear(),super.destroy()}};No.id="viewport";let Oo=No;const Lo={manifest:wo,create:(e,t)=>new Oo(bo,e,t),reducer:(e=Ro,t)=>{switch(t.type){case xo:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{..._o,gates:new Set}}}}case Co:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents,r=new Set(e.activeViewports);return r.delete(n),{...e,documents:i,activeViewports:r,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case Io:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.add(n),{...e,activeViewports:o,activeDocumentId:e.activeDocumentId??n}}case So:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.delete(n),{...e,activeViewports:o}}case"SET_ACTIVE_VIEWPORT_DOCUMENT":return{...e,activeDocumentId:t.payload};case Mo:return{...e,viewportGap:t.payload};case ko:{const{documentId:n,metrics:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,viewportMetrics:{width:o.width,height:o.height,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,clientWidth:o.clientWidth,clientHeight:o.clientHeight,scrollWidth:o.scrollWidth,scrollHeight:o.scrollHeight,clientLeft:o.clientLeft,clientTop:o.clientTop,relativePosition:{x:o.scrollWidth<=o.clientWidth?0:o.scrollLeft/(o.scrollWidth-o.clientWidth),y:o.scrollHeight<=o.clientHeight?0:o.scrollTop/(o.scrollHeight-o.clientHeight)}}}}}:e}case Do:{const{documentId:n,scrollMetrics:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,viewportMetrics:{...i.viewportMetrics,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft},isScrolling:!0}}}:e}case Po:{const{documentId:n,isScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isScrolling:o}}}:e}case Ao:{const{documentId:n,isSmoothScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isSmoothScrolling:o}}}:e}case To:{const{documentId:n,key:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(i.gates);return r.add(o),{...e,documents:{...e.documents,[n]:{...i,gates:r}}}}case zo:{const{documentId:n,key:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(i.gates);return r.delete(o),{...e,documents:{...e.documents,[n]:{...i,gates:r}}}}default:return e}},initialState:Ro},$o=de(null),Fo=()=>po(Oo.id);function jo(e){const{plugin:t}=go(Oo.id),n=Ae(null);return Pe(()=>{if(!t)return;const o=n.current;if(!o)return;try{t.registerViewport(e)}catch(t){return void console.error(`Failed to register viewport for document ${e}:`,t)}const i=()=>{t.setViewportScrollMetrics(e,{scrollTop:o.scrollTop,scrollLeft:o.scrollLeft})};o.addEventListener("scroll",i);const r=new ResizeObserver(()=>{t.setViewportResizeMetrics(e,{width:o.offsetWidth,height:o.offsetHeight,clientWidth:o.clientWidth,clientHeight:o.clientHeight,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,scrollWidth:o.scrollWidth,scrollHeight:o.scrollHeight,clientLeft:o.clientLeft,clientTop:o.clientTop})});r.observe(o);const a=t.onScrollRequest(e,({x:e,y:t,behavior:n="auto"})=>{requestAnimationFrame(()=>{o.scrollTo({left:e,top:t,behavior:n})})});return()=>{t.unregisterViewport(e),r.disconnect(),o.removeEventListener("scroll",i),a()}},[t,e]),n}function Ho({children:e,documentId:t,...n}){const[o,i]=ke(0),r=jo(t),{provides:a}=Fo(),s=(e=>{const{provides:t}=Fo(),[n,o]=ke((null==t?void 0:t.isGated(e))??!1);return Me(()=>{if(t)return o(t.isGated(e)),t.onGateChange(t=>{t.documentId===e&&o(t.isGated)})},[t,e]),n})(t);Me(()=>{a&&i(a.getViewportGap())},[a]);const{style:l,...c}=n;return Ue($o.Provider,{value:r,children:Ue("div",{...c,ref:r,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof l?l:{},padding:`${o}px`},children:!s&&e})})}var Uo=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{});class Wo{constructor(e){this.pageGap=e.pageGap??20,this.viewportGap=e.viewportGap??20,this.bufferSize=e.bufferSize??2}getVisibleRange(e,t,n){const o=this.getScrollOffset(e),i=o,r=o+this.getClientSize(e);let a=0;for(;a<t.length&&(t[a].offset+t[a].height)*n<=i;)a++;let s=a;for(;s<t.length&&t[s].offset*n<=r;)s++;return{start:Math.max(0,a-this.bufferSize),end:Math.min(t.length-1,s+this.bufferSize-1)}}handleScroll(e,t,n){const o=this.getVisibleRange(e,t,n),i=t.slice(o.start,o.end+1),r=this.calculatePageVisibility(i,e,n),a=r.map(e=>e.pageNumber),s=t.slice(o.start,o.end+1).flatMap(e=>e.index),l=this.determineCurrentPage(r),c=t[o.start],d=t[o.end],u=c?c.offset*n:0,h=d?(t[t.length-1].offset+t[t.length-1].height)*n-(d.offset+d.height)*n:0;return{currentPage:l,visiblePages:a,pageVisibilityMetrics:r,renderedPageIndexes:s,scrollOffset:{x:e.scrollLeft,y:e.scrollTop},startSpacing:u,endSpacing:h}}calculatePageVisibility(e,t,n){const o=[];return e.forEach(e=>{e.pageLayouts.forEach(i=>{const r=e.x*n,a=e.y*n,s=r+i.x*n,l=a+i.y*n,c=i.rotatedWidth*n,d=i.rotatedHeight*n,u=t.scrollLeft,h=t.scrollTop,m=u+t.clientWidth,g=h+t.clientHeight,p=Math.max(s,u),v=Math.max(l,h),f=Math.min(s+c,m),y=Math.min(l+d,g);if(p<f&&v<y){const e=f-p,t=y-v,r=c*d,a=e*t;o.push({pageNumber:i.pageNumber,viewportX:p-u,viewportY:v-h,visiblePercentage:a/r*100,original:{pageX:(p-s)/n,pageY:(v-l)/n,visibleWidth:e/n,visibleHeight:t/n,scale:1},scaled:{pageX:p-s,pageY:v-l,visibleWidth:e,visibleHeight:t,scale:n}})}})}),o}determineCurrentPage(e){if(0===e.length)return 1;const t=Math.max(...e.map(e=>e.visiblePercentage)),n=e.filter(e=>e.visiblePercentage===t);return 1===n.length?n[0].pageNumber:n.sort((e,t)=>e.pageNumber-t.pageNumber)[0].pageNumber}getRectLocationForPage(e,t,n){const o=t.find(t=>t.pageNumbers.includes(e));if(!o)return null;const i=o.pageLayouts.find(t=>t.pageNumber===e);if(!i)return null;let r=0;if(n){const e=n.width;o.width<e&&(r=(e-o.width)/2)}return{origin:{x:o.x+i.x+r,y:o.y+i.y},size:{width:i.width,height:i.height}}}getScrollPositionForPage(e,t,n,o,i){const r=this.getTotalContentSize(t),a=this.getRectLocationForPage(e,t,r);if(!a)return null;const s=Qe(a.origin,n);if(i){const e=function(e,t,n,o){return Qe(Xe(e,t,n),o)}({width:a.size.width,height:a.size.height},{x:i.x,y:i.y},o,n);return{x:s.x+e.x+this.viewportGap,y:s.y+e.y+this.viewportGap}}return{x:s.x+this.viewportGap,y:s.y+this.viewportGap}}getRectPositionForPage(e,t,n,o,i){const r=this.getTotalContentSize(t),a=this.getRectLocationForPage(e,t,r);if(!a)return null;const s=Qe(a.origin,n),l=ot({width:a.size.width,height:a.size.height},i,o,n);return{origin:{x:s.x+l.origin.x,y:s.y+l.origin.y},size:l.size}}}class Bo extends Wo{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(o<e.length-1?this.pageGap:0),0),a=Math.max(...e.map(e=>e.rotatedSize.height)),s={id:`item-${n}`,x:0,y:t,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=a+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:Math.max(...e.map(e=>e.width)),height:e[e.length-1].y+e[e.length-1].height}}getScrollOffset(e){return e.scrollTop}getClientSize(e){return e.clientHeight}}class qo extends Wo{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(o<e.length-1?this.pageGap:0),0),a=Math.max(...e.map(e=>e.rotatedSize.height)),s={id:`item-${n}`,x:t,y:0,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=r+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:e[e.length-1].x+e[e.length-1].width,height:Math.max(...e.map(e=>e.height))}}getScrollOffset(e){return e.scrollLeft}getClientSize(e){return e.clientWidth}}const Go="INIT_SCROLL_STATE",Vo="CLEANUP_SCROLL_STATE",Zo="UPDATE_DOCUMENT_SCROLL_STATE",Ko="SET_SCROLL_STRATEGY";function Yo(e,t){return{type:Zo,payload:{documentId:e,state:t}}}const Xo={isChanging:!1,targetPage:1,fromPage:1,startTime:0},Qo=class extends Yn{constructor(e,t,n){var o,i;super(e,t),this.id=e,this.config=n,this.strategies=new Map,this.layoutReady=new Set,this.initialLayoutFired=new Set,this.scrollerLayoutEmitters=new Map,this.pageChange$=ao(),this.scroll$=ao(),this.layoutChange$=ao(),this.pageChangeState$=ao(),this.layoutReady$=ao(),this.state$=ao(),this.viewport=this.registry.getPlugin("viewport").provides(),this.spread=(null==(o=this.registry.getPlugin("spread"))?void 0:o.provides())??null,this.viewport.onScrollActivity(e=>{const t=this.getDocumentState(e.documentId);(null==t?void 0:t.pageChangeState.isChanging)&&!e.activity.isSmoothScrolling&&this.completePageChange(e.documentId)}),null==(i=this.spread)||i.onSpreadChange(e=>{this.refreshDocumentLayout(e.documentId)}),this.viewport.onViewportChange(e=>{const t=this.getDocumentState(e.documentId);if(!t)return;const n=this.computeMetrics(e.documentId,e.metrics);this.layoutReady.has(e.documentId)?this.commitMetrics(e.documentId,n):this.commitMetrics(e.documentId,{...n,scrollOffset:t.scrollOffset})})}onDocumentLoadingStarted(e){const t=this.getCoreDocument(e);if(!t)return;const n=this.createDocumentState(t);this.dispatch(function(e,t){return{type:Go,payload:{documentId:e,state:t}}}(e,n));const o=this.createStrategy(n.strategy);this.strategies.set(e,o),this.scrollerLayoutEmitters.set(e,ao())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(Yo(e,{totalPages:(null==(t=n.document)?void 0:t.pageCount)??0})),this.refreshDocumentLayout(e),this.logger.debug("ScrollPlugin","DocumentOpened",`Initialized scroll state for document: ${e}`))}onDocumentClosed(e){this.strategies.delete(e),this.layoutReady.delete(e),this.initialLayoutFired.delete(e);const t=this.scrollerLayoutEmitters.get(e);t&&(t.clear(),this.scrollerLayoutEmitters.delete(e)),this.dispatch(function(e){return{type:Vo,payload:e}}(e)),this.logger.debug("ScrollPlugin","DocumentClosed",`Cleaned up scroll state for document: ${e}`)}onScaleChanged(e){const t=this.coreState.core.documents[e];if(!t||"loaded"!==t.status)return;const n=this.viewport.forDocument(e),o=this.computeMetrics(e,n.getMetrics());this.commitMetrics(e,o)}onRotationChanged(e){this.refreshDocumentLayout(e)}onScrollerData(e,t){const n=this.scrollerLayoutEmitters.get(e);if(!n)throw new Error(`No scroller layout emitter found for document: ${e}`);return n.on(t)}getScrollerLayout(e){const t=this.getDocumentState(e),n=this.getCoreDocumentOrThrow(e);if(!t||!n)throw new Error(`Cannot get scroller layout for document: ${e}`);return o=t,i=n.scale,{startSpacing:o.startSpacing,endSpacing:o.endSpacing,totalWidth:o.totalContentSize.width*i,totalHeight:o.totalContentSize.height*i,pageGap:o.pageGap*i,strategy:o.strategy,items:o.renderedPageIndexes.map(e=>({...o.virtualItems[e],pageLayouts:o.virtualItems[e].pageLayouts.map(e=>({...e,rotatedWidth:e.rotatedWidth*i,rotatedHeight:e.rotatedHeight*i,width:e.width*i,height:e.height*i}))}))};var o,i}setLayoutReady(e){if(this.layoutReady.has(e))return;const t=this.getDocumentState(e);if(!t)return;this.layoutReady.add(e);const n=!this.initialLayoutFired.has(e);n&&this.initialLayoutFired.add(e);this.viewport.forDocument(e).scrollTo({...t.scrollOffset,behavior:"instant"}),this.layoutReady$.emit({documentId:e,isInitial:n,pageNumber:t.currentPage,totalPages:t.totalPages})}clearLayoutReady(e){this.layoutReady.delete(e)}buildCapability(){return{getCurrentPage:()=>this.getCurrentPage(),getTotalPages:()=>this.getTotalPages(),getPageChangeState:()=>this.getPageChangeState(),scrollToPage:e=>this.scrollToPage(e),scrollToNextPage:e=>this.scrollToNextPage(e),scrollToPreviousPage:e=>this.scrollToPreviousPage(e),getMetrics:e=>this.getMetrics(e),getLayout:()=>this.getLayout(),getRectPositionForPage:(e,t,n,o)=>this.getRectPositionForPage(e,t,n,o),forDocument:e=>this.createScrollScope(e),setScrollStrategy:(e,t)=>this.setScrollStrategyForDocument(e,t),getPageGap:()=>this.state.defaultPageGap,onPageChange:this.pageChange$.on,onScroll:this.scroll$.on,onLayoutChange:this.layoutChange$.on,onLayoutReady:this.layoutReady$.on,onPageChangeState:this.pageChangeState$.on,onStateChange:this.state$.on}}createScrollScope(e){return{getCurrentPage:()=>this.getCurrentPage(e),getTotalPages:()=>this.getTotalPages(e),getPageChangeState:()=>this.getPageChangeState(e),scrollToPage:t=>this.scrollToPage(t,e),scrollToNextPage:t=>this.scrollToNextPage(t,e),scrollToPreviousPage:t=>this.scrollToPreviousPage(t,e),getSpreadPagesWithRotatedSize:()=>this.getSpreadPagesWithRotatedSize(e),getMetrics:t=>this.getMetrics(t,e),getLayout:()=>this.getLayout(e),getRectPositionForPage:(t,n,o,i)=>this.getRectPositionForPage(t,n,o,i,e),setScrollStrategy:t=>this.setScrollStrategyForDocument(t,e),onPageChange:t=>this.pageChange$.on(n=>{n.documentId===e&&t(n)}),onScroll:t=>this.scroll$.on(n=>{n.documentId===e&&t(n.metrics)}),onLayoutChange:t=>this.layoutChange$.on(n=>{n.documentId===e&&t(n.layout)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Scroll state not found for document: ${e??"active"}`);return t}getStrategy(e){const t=e??this.getActiveDocumentId(),n=this.strategies.get(t);if(!n)throw new Error(`Strategy not found for document: ${t}`);return n}createStrategy(e){const t={pageGap:this.state.defaultPageGap,viewportGap:this.viewport.getViewportGap(),bufferSize:this.state.defaultBufferSize};return e===Uo.Horizontal?new qo(t):new Bo(t)}createDocumentState(e){var t;return{virtualItems:[],totalPages:(null==(t=e.document)?void 0:t.pageCount)??0,currentPage:1,totalContentSize:{width:0,height:0},strategy:this.state.defaultStrategy,pageGap:this.state.defaultPageGap,visiblePages:[],pageVisibilityMetrics:[],renderedPageIndexes:[],scrollOffset:{x:0,y:0},startSpacing:0,endSpacing:0,pageChangeState:Xo}}startPageChange(e,t,n="smooth"){const o=this.getDocumentState(e);if(!o)return;const i={isChanging:!0,targetPage:t,fromPage:o.currentPage,startTime:Date.now()};this.dispatch(Yo(e,{pageChangeState:i})),"instant"===n&&this.completePageChange(e)}completePageChange(e){const t=this.getDocumentState(e);if(!t||!t.pageChangeState.isChanging)return;const n={isChanging:!1,targetPage:t.pageChangeState.targetPage,fromPage:t.pageChangeState.fromPage,startTime:t.pageChangeState.startTime};this.dispatch(Yo(e,{pageChangeState:n}))}computeLayout(e,t){const n=this.getStrategy(e),o=n.createVirtualItems(t);return{virtualItems:o,totalContentSize:n.getTotalContentSize(o)}}computeMetrics(e,t,n){const o=this.getCoreDocumentOrThrow(e),i=this.getDocumentState(e),r=this.getStrategy(e);if(!i)throw new Error(`Document state not found: ${e}`);return r.handleScroll(t,n??i.virtualItems,o.scale)}commitMetrics(e,t){const n=this.getDocumentState(e);n&&(this.dispatch(Yo(e,t)),this.scroll$.emit({documentId:e,metrics:t}),t.currentPage!==n.currentPage&&this.pageChange$.emit({documentId:e,pageNumber:t.currentPage,totalPages:n.totalPages}),this.pushScrollerLayout(e))}pushScrollerLayout(e){const t=this.scrollerLayoutEmitters.get(e);if(t)try{const n=this.getScrollerLayout(e);t.emit(n)}catch(e){}}refreshDocumentLayout(e){const t=this.coreState.core.documents[e],n=this.getDocumentState(e);if(!t||!n||"loaded"!==t.status)return;const o=this.getSpreadPagesWithRotatedSize(e),i=this.computeLayout(e,o),r=this.viewport.forDocument(e),a=this.computeMetrics(e,r.getMetrics(),i.virtualItems);this.dispatch(Yo(e,{...i,...a})),this.layoutChange$.emit({documentId:e,layout:i}),this.pushScrollerLayout(e)}getSpreadPagesWithRotatedSize(e){var t,n;const o=e??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!i)throw new Error(`Document ${o} not loaded`);return((null==(t=this.spread)?void 0:t.forDocument(o).getSpreadPages())||(null==(n=i.document)?void 0:n.pages.map(e=>[e]))||[]).map(e=>e.map(e=>({...e,rotatedSize:Ze(e.size,i.rotation,1)})))}getCurrentPage(e){return this.getDocumentStateOrThrow(e).currentPage}getTotalPages(e){return this.getDocumentStateOrThrow(e).totalPages}getPageChangeState(e){return this.getDocumentStateOrThrow(e).pageChangeState}scrollToPage(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.getCoreDocumentOrThrow(n),{pageNumber:a,behavior:s="smooth",pageCoordinates:l,alignX:c,alignY:d}=e;this.startPageChange(n,a,s);const u=i.getScrollPositionForPage(a,o.virtualItems,r.scale,r.rotation,l);if(u){this.viewport.forDocument(n).scrollTo({...u,behavior:s,alignX:c,alignY:d})}else this.completePageChange(n)}scrollToNextPage(e="smooth",t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.getCoreDocumentOrThrow(n),a=o.virtualItems.findIndex(e=>e.pageNumbers.includes(o.currentPage));if(a>=0&&a<o.virtualItems.length-1){const t=o.virtualItems[a+1].pageNumbers[0];this.startPageChange(n,t,e);const s=i.getScrollPositionForPage(t,o.virtualItems,r.scale,r.rotation);if(s){this.viewport.forDocument(n).scrollTo({...s,behavior:e})}else this.completePageChange(n)}}scrollToPreviousPage(e="smooth",t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.coreState.core.documents[n],a=o.virtualItems.findIndex(e=>e.pageNumbers.includes(o.currentPage));if(a>0){const t=o.virtualItems[a-1].pageNumbers[0];this.startPageChange(n,t,e);const s=i.getScrollPositionForPage(t,o.virtualItems,r.scale,r.rotation);if(s){this.viewport.forDocument(n).scrollTo({...s,behavior:e})}else this.completePageChange(n)}}getMetrics(e,t){const n=t??this.getActiveDocumentId();if(e)return this.computeMetrics(n,e);const o=this.viewport.forDocument(n);return this.computeMetrics(n,o.getMetrics())}getLayout(e){const t=this.getDocumentStateOrThrow(e);return{virtualItems:t.virtualItems,totalContentSize:t.totalContentSize}}getRectPositionForPage(e,t,n,o,i){const r=i??this.getActiveDocumentId(),a=this.getDocumentStateOrThrow(r),s=this.getStrategy(r),l=this.getCoreDocumentOrThrow(r);return s.getRectPositionForPage(e+1,a.virtualItems,n??l.scale,o??l.rotation,t)}setScrollStrategyForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o||o.strategy===e)return;const i=this.createStrategy(e);this.strategies.set(n,i),this.dispatch(function(e,t){return{type:Ko,payload:{documentId:e,strategy:t}}}(n,e)),this.refreshDocumentLayout(n)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit(i),(null==o?void 0:o.pageChangeState)!==i.pageChangeState&&this.pageChangeState$.emit({documentId:n,state:i.pageChangeState}),this.pushScrollerLayout(n))}}async initialize(){this.logger.info("ScrollPlugin","Initialize","Scroll plugin initialized")}async destroy(){this.strategies.clear(),this.layoutReady.clear(),this.initialLayoutFired.clear();for(const e of this.scrollerLayoutEmitters.values())e.clear();this.scrollerLayoutEmitters.clear(),this.pageChange$.clear(),this.scroll$.clear(),this.layoutChange$.clear(),this.pageChangeState$.clear(),this.layoutReady$.clear(),this.state$.clear(),super.destroy()}};Qo.id="scroll";let Jo=Qo;const ei="scroll",ti={manifest:{id:ei,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:Uo.Vertical}},create:(e,t)=>new Jo(ei,e,t),reducer:(e,t)=>{switch(t.type){case Go:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Vo:{const{[t.payload]:n,...o}=e.documents;return{...e,documents:o}}case Zo:{const{documentId:n,state:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,...o}}}:e}case Ko:{const{documentId:n,strategy:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,strategy:o}}}:e}default:return e}},initialState:(e,t)=>((e,t)=>({defaultStrategy:t.defaultStrategy??Uo.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},ni=()=>po(Jo.id),oi=e=>{const{provides:t}=ni(),[n,o]=ke(1),[i,r]=ke(1);return Me(()=>{if(!t||!e)return;const n=t.forDocument(e);return o(n.getCurrentPage()),r(n.getTotalPages()),t.onPageChange(t=>{t.documentId===e&&(o(t.pageNumber),r(t.totalPages))})},[t,e]),{provides:(null==t?void 0:t.forDocument(e))??null,state:{currentPage:n,totalPages:i}}};function ii({documentId:e,renderPage:t,...n}){const{plugin:o}=go(Jo.id),[i,r]=ke({layout:null,docId:null});Me(()=>{if(!o||!e)return;const t=o.onScrollerData(e,t=>{r({layout:t,docId:e})});return()=>{t(),r({layout:null,docId:null}),o.clearLayoutReady(e)}},[o,e]);const a=i.docId===e?i.layout:null;return Pe(()=>{o&&e&&a&&o.setLayoutReady(e)},[o,e,a]),a?Ue("div",{...n,style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===Uo.Horizontal&&{display:"flex",flexDirection:"row"}},children:[Ue("div",{style:{...a.strategy===Uo.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}}),Ue("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===Uo.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>Ue("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>Ue("div",{style:{width:`${e.rotatedWidth}px`,height:`${e.rotatedHeight}px`},children:t({...e})},e.pageNumber))},e.pageNumbers[0]))}),Ue("div",{style:{...a.strategy===Uo.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}}})]}):null}var ri=(e=>(e.None="none",e.Odd="odd",e.Even="even",e))(ri||{});const ai="SPREAD/INIT_STATE",si="SPREAD/CLEANUP_STATE",li="SPREAD/SET_SPREAD_MODE",ci="SPREAD/SET_PAGE_GROUPING";function di(e,t){return{type:ci,payload:{documentId:e,grouping:t}}}const ui=class extends Yn{constructor(e,t,n){var o;super(e,t),this.spreadEmitter$=ao(),this.defaultSpreadMode=n.defaultSpreadMode??ri.None,this.viewport=(null==(o=t.getPlugin("viewport"))?void 0:o.provides())??null}onDocumentLoadingStarted(e){var t;const n={spreadMode:this.defaultSpreadMode};this.dispatch(function(e,t){return{type:ai,payload:{documentId:e,state:t}}}(e,n)),null==(t=this.viewport)||t.gate("spread",e),this.logger.debug("SpreadPlugin","DocumentOpened",`Initialized spread state for document: ${e}`)}onDocumentLoaded(e){var t;const n=this.coreState.core.documents[e];if(null==n?void 0:n.document){const t=this.calculatePageGrouping(e,n.document.pages.length);this.dispatch(di(e,t))}null==(t=this.viewport)||t.releaseGate("spread",e)}onDocumentClosed(e){this.dispatch(function(e){return{type:si,payload:e}}(e)),this.logger.debug("SpreadPlugin","DocumentClosed",`Cleaned up spread state for document: ${e}`)}buildCapability(){return{setSpreadMode:e=>this.setSpreadModeForDocument(e),getSpreadMode:()=>this.getSpreadModeForDocument(),getSpreadPages:()=>this.getSpreadPages(),forDocument:e=>this.createSpreadScope(e),onSpreadChange:this.spreadEmitter$.on}}createSpreadScope(e){return{setSpreadMode:t=>this.setSpreadModeForDocument(t,e),getSpreadMode:()=>this.getSpreadModeForDocument(e),getSpreadPages:()=>this.getSpreadPages(e),onSpreadChange:t=>this.spreadEmitter$.on(n=>{n.documentId===e&&t(n.spreadMode)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Spread state not found for document: ${e??"active"}`);return t}setSpreadModeForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.coreState.core.documents[n];if(!(null==i?void 0:i.document))throw new Error(`Document ${n} not loaded`);if(o.spreadMode!==e){this.dispatch(function(e,t){return{type:li,payload:{documentId:e,spreadMode:t}}}(n,e));const t=this.calculatePageGrouping(n,i.document.pages.length);this.dispatch(di(n,t)),this.spreadEmitter$.emit({documentId:n,spreadMode:e})}}getSpreadModeForDocument(e){return this.getDocumentStateOrThrow(e).spreadMode}calculatePageGrouping(e,t){switch(this.getDocumentStateOrThrow(e).spreadMode){case ri.None:return Array.from({length:t},(e,t)=>[t]);case ri.Odd:return Array.from({length:Math.ceil(t/2)},(e,n)=>{const o=[2*n];return 2*n+1<t&&o.push(2*n+1),o});case ri.Even:return[[0],...Array.from({length:Math.ceil((t-1)/2)},(e,n)=>{const o=[1+2*n];return 1+2*n+1<t&&o.push(1+2*n+1),o})];default:return Array.from({length:t},(e,t)=>[t])}}getSpreadPages(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t],o=this.getDocumentStateOrThrow(t);if(!(null==n?void 0:n.document))throw new Error(`Document ${t} not loaded`);const i=o.pageGrouping??[],r=n.document.pages;return i.map(e=>e.map(e=>r[e]).filter(Boolean))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.spreadMode)!==i.spreadMode&&this.logger.debug("SpreadPlugin","SpreadModeChanged",`Spread mode changed for document ${n}: ${(null==o?void 0:o.spreadMode)??ri.None} -> ${i.spreadMode}`)}}async initialize(e){this.logger.info("SpreadPlugin","Initialize","Spread plugin initialized")}async destroy(){this.spreadEmitter$.clear(),super.destroy()}};ui.id="spread";let hi=ui;const mi="spread",gi={id:mi,name:"Spread Plugin",version:"1.0.0",provides:["spread"],requires:[],optional:["viewport"],defaultConfig:{}};ri.None;const pi={documents:{},activeDocumentId:null},vi={manifest:gi,create:(e,t)=>new hi(mi,e,t),reducer:(e=pi,t)=>{switch(t.type){case ai:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case si:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"SPREAD/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case li:{const{documentId:n,spreadMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,spreadMode:o}}}:e}case ci:{const{documentId:n,grouping:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,pageGrouping:o}}}:e}default:return e}},initialState:pi},fi="ui",yi={id:fi,name:"UI Plugin",version:"1.0.0",provides:["ui"],requires:["commands"],optional:["i18n"],defaultConfig:{schema:{id:"empty",version:"1.0.0",toolbars:{},menus:{},sidebars:{},modals:{},selectionMenus:{}}}},bi="UI/INIT_STATE",wi="UI/CLEANUP_STATE",xi="UI/SET_ACTIVE_TOOLBAR",Ci="UI/CLOSE_TOOLBAR_SLOT",Ii="UI/SET_ACTIVE_SIDEBAR",Si="UI/CLOSE_SIDEBAR_SLOT",ki="UI/SET_SIDEBAR_TAB",Di="UI/OPEN_MODAL",Mi="UI/CLOSE_MODAL",Pi="UI/CLEAR_MODAL",Ai="UI/OPEN_MENU",Ti="UI/CLOSE_MENU",zi="UI/CLOSE_ALL_MENUS",Ei="UI/SET_DISABLED_CATEGORIES",_i="UI/SET_HIDDEN_ITEMS",Ri=(e,t,n,o,i)=>({type:Ii,payload:{documentId:e,placement:t,slot:n,sidebarId:o,activeTab:i}}),Ni=(e,t,n)=>({type:Si,payload:{documentId:e,placement:t,slot:n}}),Oi=(e,t)=>({type:Ai,payload:{documentId:e,menuState:t}}),Li=(e,t)=>({type:Ti,payload:{documentId:e,menuId:t}}),$i=e=>({type:Ei,payload:{categories:e}}),Fi=e=>({type:_i,payload:{hiddenItems:e}});function ji(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,items:o.items??n[e].items,responsive:o.responsive??n[e].responsive}:n[e]=o;return n}function Hi(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,items:o.items??n[e].items}:n[e]=o;return n}function Ui(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,content:o.content??n[e].content}:n[e]=o;return n}function Wi(e,t){var n;if(!(null==(n=e.responsive)?void 0:n.breakpoints))return null;const o=function(e,t,n){if(!n||!(null==t?void 0:t.groups))return e;const o=t.groups.find(e=>e.locales.includes(n));if(!o)return e;const i={};for(const[t,n]of Object.entries(e)){const e=o.breakpoints[t];e?i[t]={minWidth:n.minWidth,maxWidth:n.maxWidth,hide:e.replaceHide?e.replaceHide:[...n.hide||[],...e.hide||[]],show:e.replaceShow?e.replaceShow:[...n.show||[],...e.show||[]]}:i[t]=n}return i}(e.responsive.breakpoints,e.responsive.localeOverrides,t),i=new Map,r=new Map;for(const[e,t]of Object.entries(o))r.set(e,{minWidth:t.minWidth,maxWidth:t.maxWidth});const a=new Set,s=e=>{e.forEach(e=>{a.add(e.id),"group"===e.type&&e.items&&s(e.items),"tab-group"===e.type&&e.tabs&&s(e.tabs),"section"===e.type&&e.items&&s(e.items)})};s(e.items);for(const e of a){const t=[];let n=!0;const r=Array.from(Object.entries(o)).sort((e,t)=>(e[1].minWidth??0)-(t[1].minWidth??0));r.forEach(([o,i],r)=>{var a,s;const l=null==(a=i.hide)?void 0:a.includes(e),c=null==(s=i.show)?void 0:s.includes(e);(l||c)&&(t.push({breakpointId:o,minWidth:i.minWidth,maxWidth:i.maxWidth,visible:c||!l,priority:r}),0===r&&(n=c||!l))}),t.length>0&&i.set(e,{itemId:e,shouldRender:!0,visibilityRules:t,defaultVisible:n})}return{items:i,breakpoints:r}}const Bi="data-epdf",qi="data-epdf-s",Gi="data-epdf-i",Vi="data-epdf-cat",Zi="data-epdf-dis",Ki="data-epdf-hid",Yi={ROOT:`[${Bi}]`,STYLES:`[${qi}]`,ITEM:e=>`[${Gi}="${e}"]`,CATEGORIES:e=>`[${Vi}~="${e}"]`,DISABLED_CATEGORY:e=>`[${Zi}~="${e}"]`,HIDDEN_ITEM:e=>`[${Ki}~="${e}"]`},Xi={useContainerQueries:!0};function Qi(e,t={}){const n={...Xi,...t.config},o=t.locale,i=er(e,o),r=[];r.push(function(e){const t=e?` (locale: ${e})`:"";return`/* ═══════════════════════════════════════════════════════════════════════════ */\n/* EmbedPDF UI Stylesheet - Auto-generated${t} */\n/* DO NOT EDIT MANUALLY - This file is generated from your UI schema */\n/* ═══════════════════════════════════════════════════════════════════════════ */`}(o));const a=function(e,t){const n=[],o=t.useContainerQueries?"@container":"@media",i=new Set;return e.responsiveItems.forEach((e,t)=>{if(i.has(t))return;i.add(t);const r=function(e,t,n){if(0===t.visibilityRules.length)return null;const o=[],i=Yi.ITEM(e);t.defaultVisible||o.push(`${i} { display: none; }`);for(const e of t.visibilityRules){const t=[];if(void 0!==e.minWidth&&t.push(`(min-width: ${e.minWidth}px)`),void 0!==e.maxWidth&&t.push(`(max-width: ${e.maxWidth}px)`),t.length>0){const r=e.visible?"flex":"none";o.push(`${n} ${t.join(" and ")} {\n ${i} { display: ${r}; }\n}`)}}return o.length>0?o.join("\n"):null}(t,e,o);r&&n.push(r)}),0===n.length?"":`/* ─── Responsive Visibility Rules ─── */\n/* Items show/hide based on container width */\n\n${n.join("\n\n")}`}(i,n);a&&r.push(a);const s=function(e){if(0===e.categories.size)return"";const t=[],n=Array.from(e.categories).sort();for(const e of n)t.push(`${Yi.ROOT}[${Zi}~="${e}"] [${Vi}~="${e}"] {\n display: none !important;\n}`);return`/* ─── Category Visibility Rules ─── */\n/* Items hide when ANY of their categories is disabled */\n/* Use: data-disabled-categories="category1 category2" on root element */\n\n${t.join("\n\n")}`}(i);s&&r.push(s);const l=function(e,t){if(0===e.dependencies.length)return"";const n=[],o=t.useContainerQueries?"@container":"@media";for(const t of e.dependencies){const i=hr(t,e,o);i.length>0&&n.push(...i)}return 0===n.length?"":`/* ─── Dependency Visibility Rules ─── */\n/* Container elements hide when all their dependencies are hidden */\n\n${n.join("\n\n")}`}(i,n);return l&&r.push(l),r.filter(e=>e.trim()).join("\n\n")}function Ji(e,t){const n=new Set(t),o=[];return e.forEach((e,t)=>{e.some(e=>n.has(e))&&o.push(t)}),o}function er(e,t){const n=new Set,o=new Map,i=[],r=new Map,a=new Map;for(const[s,l]of Object.entries(e.menus))tr(s,l,n,o,i,r,a,t);for(const[r,s]of Object.entries(e.toolbars))rr(r,s,n,o,i,a,t);for(const[t,r]of Object.entries(e.sidebars))lr(t,r,n,o,i);for(const[r,s]of Object.entries(e.selectionMenus||{}))cr(r,s,n,o,i,a,t);return{categories:n,itemCategories:o,dependencies:i,menuBreakpoints:r,responsiveItems:a}}function tr(e,t,n,o,i,r,a,s){ur(e,t.categories,t.visibilityDependsOn,n,o,i),nr(t.items,n,o,i);const l=Wi(t,s);l&&l.items.forEach((e,t)=>{a.set(t,e)});const c=function(e,t,n){var o;const i=[],r=Wi(e,n);if((null==(o=e.responsive)?void 0:o.breakpoints)&&r){const e=Array.from(r.breakpoints.entries()).sort((e,t)=>(e[1].minWidth??0)-(t[1].minWidth??0));for(const[n,o]of e){const e=ir(r,o),n=new Set;for(const o of e){const e=t.get(o);e&&e.forEach(e=>n.add(e))}i.push({minWidth:o.minWidth,maxWidth:o.maxWidth,visibleItemIds:e,visibleCategories:n})}}else{const n=[],o=new Set;or(e.items,t,n,o),i.push({visibleItemIds:n,visibleCategories:o})}return i}(t,o,s);r.set(e,c)}function nr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"section"===i.type&&nr(i.items,t,n,o)}function or(e,t,n,o){for(const i of e){n.push(i.id);const e=t.get(i.id);e&&e.forEach(e=>o.add(e)),"section"===i.type&&or(i.items,t,n,o)}}function ir(e,t){const n=[];return e.items.forEach((e,o)=>{let i=e.defaultVisible;for(const n of e.visibilityRules){(void 0===n.minWidth||void 0!==t.minWidth&&t.minWidth>=n.minWidth)&&(void 0===n.maxWidth||void 0!==t.maxWidth&&t.maxWidth<=n.maxWidth)&&(i=n.visible)}i&&n.push(o)}),n}function rr(e,t,n,o,i,r,a){ur(e,t.categories,t.visibilityDependsOn,n,o,i);const s=Wi(t,a);s&&s.items.forEach((e,t)=>{r.set(t,e)}),ar(t.items,n,o,i)}function ar(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&ar(i.items,t,n,o),"tab-group"===i.type&&i.tabs&&sr(i.tabs,t,n,o)}function sr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o)}function lr(e,t,n,o,i){if(ur(e,t.categories,t.visibilityDependsOn,n,o,i),"tabs"===t.content.type)for(const e of t.content.tabs)ur(e.id,e.categories,e.visibilityDependsOn,n,o,i)}function cr(e,t,n,o,i,r,a){if(ur(e,t.categories,t.visibilityDependsOn,n,o,i),t.responsive){const e=Wi(t,a);e&&e.items.forEach((e,t)=>{r.set(t,e)})}dr(t.items,n,o,i)}function dr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&dr(i.items,t,n,o)}function ur(e,t,n,o,i,r){var a;(null==t?void 0:t.length)&&(t.forEach(e=>o.add(e)),i.set(e,t)),n&&(n.menuId||(null==(a=n.itemIds)?void 0:a.length))&&r.push({itemId:e,dependsOnMenuId:n.menuId,dependsOnItemIds:n.itemIds})}function hr(e,t,n,o){var i;const r=[];if(e.dependsOnMenuId){const o=t.menuBreakpoints.get(e.dependsOnMenuId);if(o&&o.length>0){r.push(`/* "${e.itemId}" depends on menu "${e.dependsOnMenuId}" */`);for(const t of o){if(0===t.visibleItemIds.length)continue;const o=t.visibleItemIds.sort().map(e=>Yi.HIDDEN_ITEM(e)).join(""),i=`${Yi.ROOT}${o} ${Yi.ITEM(e.itemId)} {\n display: none !important;\n}`,a=[];void 0!==t.minWidth&&a.push(`(min-width: ${t.minWidth}px)`),void 0!==t.maxWidth&&a.push(`(max-width: ${t.maxWidth}px)`),a.length>0?r.push(`${n} ${a.join(" and ")} {\n ${i}\n}`):r.push(i)}}}if(null==(i=e.dependsOnItemIds)?void 0:i.length){r.push(`/* "${e.itemId}" depends on items: ${e.dependsOnItemIds.join(", ")} */`);const t=e.dependsOnItemIds.sort().map(e=>Yi.HIDDEN_ITEM(e)).join("");r.push(`${Yi.ROOT}${t} ${Yi.ITEM(e.itemId)} {\n display: none !important;\n}`)}return r}function mr(e,t){var n;return{[Gi]:e.id,[Vi]:(null==(n=e.categories)?void 0:n.join(" "))||void 0,...t}}const gr=class extends Yn{constructor(e,t,n){var o,i;if(super(e,t),this.cachedStylesheet=null,this.cachedLocale=null,this.i18n=null,this.i18nCleanup=null,this.categoryChanged$=ao(),this.stylesheetInvalidated$=ro(),this.toolbarChanged$=so((e,t)=>({documentId:e,...t}),{cache:!1}),this.sidebarChanged$=so((e,t)=>({documentId:e,...t}),{cache:!1}),this.modalChanged$=so((e,t)=>({documentId:e,...t}),{cache:!1}),this.menuChanged$=so((e,t)=>({documentId:e,...t}),{cache:!1}),this.schema=n.schema,this.stylesheetConfig=n.stylesheetConfig||{},this.itemCategories=er(this.schema).itemCategories,null==(o=n.disabledCategories)?void 0:o.length){this.dispatch($i(n.disabledCategories));const e=Ji(this.itemCategories,n.disabledCategories);this.dispatch(Fi(e))}this.i18n=(null==(i=t.getPlugin("i18n"))?void 0:i.provides())??null,this.i18n&&(this.i18nCleanup=this.i18n.onLocaleChange(({currentLocale:e})=>{this.handleLocaleChange(e)}),this.cachedLocale=this.i18n.getLocale())}async initialize(){this.logger.info("UIPlugin","Initialize","UI plugin initialized")}async destroy(){this.i18nCleanup&&(this.i18nCleanup(),this.i18nCleanup=null),this.toolbarChanged$.clear(),this.sidebarChanged$.clear(),this.modalChanged$.clear(),this.menuChanged$.clear(),this.stylesheetInvalidated$.clear(),super.destroy()}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:bi,payload:{documentId:e,schema:t}}))(e,this.schema))}onDocumentClosed(e){this.dispatch((e=>({type:wi,payload:{documentId:e}}))(e)),this.toolbarChanged$.clearScope(e),this.sidebarChanged$.clearScope(e),this.modalChanged$.clearScope(e),this.menuChanged$.clearScope(e)}handleLocaleChange(e){this.cachedLocale!==e&&(this.logger.debug("UIPlugin","LocaleChange",`Locale changed: ${this.cachedLocale} -> ${e}`),this.cachedLocale=e,this.invalidateStylesheet(),this.stylesheetInvalidated$.emit())}getStylesheet(){var e;const t=(null==(e=this.i18n)?void 0:e.getLocale())??null;return this.cachedStylesheet&&this.cachedLocale===t||(this.cachedStylesheet=Qi(this.schema,{config:this.stylesheetConfig,locale:t??void 0}),this.cachedLocale=t),this.cachedStylesheet}getLocale(){var e;return(null==(e=this.i18n)?void 0:e.getLocale())??null}invalidateStylesheet(){this.cachedStylesheet=null}onStylesheetInvalidated(e){return this.stylesheetInvalidated$.on(e)}disableCategoryImpl(e){const t=new Set(this.state.disabledCategories);if(!t.has(e)){t.add(e);const n=Array.from(t);this.dispatch($i(n));const o=Ji(this.itemCategories,n);this.dispatch(Fi(o)),this.categoryChanged$.emit({disabledCategories:n,hiddenItems:o})}}enableCategoryImpl(e){const t=new Set(this.state.disabledCategories);if(t.has(e)){t.delete(e);const n=Array.from(t);this.dispatch($i(n));const o=Ji(this.itemCategories,n);this.dispatch(Fi(o)),this.categoryChanged$.emit({disabledCategories:n,hiddenItems:o})}}toggleCategoryImpl(e){this.state.disabledCategories.includes(e)?this.enableCategoryImpl(e):this.disableCategoryImpl(e)}setDisabledCategoriesImpl(e){this.dispatch($i(e));const t=Ji(this.itemCategories,e);this.dispatch(Fi(t)),this.categoryChanged$.emit({disabledCategories:e,hiddenItems:t})}buildCapability(){return{setActiveToolbar:(e,t,n,o)=>this.setToolbarForDocument(e,t,n,o),setActiveSidebar:(e,t,n,o,i)=>this.setSidebarForDocument(e,t,n,o,i),toggleSidebar:(e,t,n,o,i)=>this.toggleSidebarForDocument(e,t,n,o,i),openModal:(e,t)=>this.openModalForDocument(e,t),openMenu:(e,t,n,o)=>this.openMenuForDocument(e,t,n,o),toggleMenu:(e,t,n,o)=>this.toggleMenuForDocument(e,t,n,o),forDocument:e=>this.createUIScope(e),getSchema:()=>this.schema,mergeSchema:e=>{var t,n;this.schema=(t=this.schema,n=e,{...t,...n,toolbars:ji(t.toolbars,n.toolbars),menus:Hi(t.menus,n.menus),sidebars:Ui(t.sidebars,n.sidebars)})},disableCategory:e=>this.disableCategoryImpl(e),enableCategory:e=>this.enableCategoryImpl(e),toggleCategory:e=>this.toggleCategoryImpl(e),setDisabledCategories:e=>this.setDisabledCategoriesImpl(e),getDisabledCategories:()=>this.state.disabledCategories,isCategoryDisabled:e=>this.state.disabledCategories.includes(e),getHiddenItems:()=>this.state.hiddenItems,onToolbarChanged:this.toolbarChanged$.onGlobal,onSidebarChanged:this.sidebarChanged$.onGlobal,onModalChanged:this.modalChanged$.onGlobal,onMenuChanged:this.menuChanged$.onGlobal,onCategoryChanged:this.categoryChanged$.on}}createUIScope(e){return{setActiveToolbar:(t,n,o)=>this.setToolbarForDocument(t,n,o,e),getActiveToolbar:(t,n)=>this.getToolbarForDocument(t,n,e),closeToolbarSlot:(t,n)=>this.closeToolbarForDocument(t,n,e),isToolbarOpen:(t,n,o)=>this.isToolbarOpenForDocument(t,n,o,e),setActiveSidebar:(t,n,o,i)=>this.setSidebarForDocument(t,n,o,e,i),getActiveSidebar:(t,n)=>this.getSidebarForDocument(t,n,e),closeSidebarSlot:(t,n)=>this.closeSidebarForDocument(t,n,e),toggleSidebar:(t,n,o,i)=>this.toggleSidebarForDocument(t,n,o,e,i),isSidebarOpen:(t,n,o)=>this.isSidebarOpenForDocument(t,n,o,e),setSidebarTab:(t,n)=>this.setSidebarTabForDocument(t,n,e),getSidebarTab:t=>this.getSidebarTabForDocument(t,e),openModal:t=>this.openModalForDocument(t,e),closeModal:()=>this.closeModalForDocument(e),clearModal:()=>this.clearModalForDocument(e),getActiveModal:()=>this.getActiveModalForDocument(e),isModalOpen:()=>this.isModalOpenForDocument(e),openMenu:(t,n,o)=>this.openMenuForDocument(t,n,o,e),closeMenu:t=>this.closeMenuForDocument(t,e),toggleMenu:(t,n,o)=>this.toggleMenuForDocument(t,n,o,e),closeAllMenus:()=>this.closeAllMenusForDocument(e),isMenuOpen:t=>this.isMenuOpenForDocument(t,e),getOpenMenus:()=>this.getOpenMenusForDocument(e),getSchema:()=>this.schema,getState:()=>this.getDocumentStateOrThrow(e),onToolbarChanged:this.toolbarChanged$.forScope(e),onSidebarChanged:this.sidebarChanged$.forScope(e),onModalChanged:this.modalChanged$.forScope(e),onMenuChanged:this.menuChanged$.forScope(e)}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`UI state not found for document: ${e??"active"}`);return t}setToolbarForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();this.dispatch(((e,t,n,o)=>({type:xi,payload:{documentId:e,placement:t,slot:n,toolbarId:o}}))(i,e,t,n)),this.toolbarChanged$.emit(i,{placement:e,slot:t,toolbarId:n})}getToolbarForDocument(e,t,n){const o=`${e}-${t}`,i=this.getDocumentStateOrThrow(n).activeToolbars[o];return(null==i?void 0:i.isOpen)?i.toolbarId:null}closeToolbarForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Ci,payload:{documentId:e,placement:t,slot:n}}))(o,e,t)),this.toolbarChanged$.emit(o,{placement:e,slot:t,toolbarId:""})}isToolbarOpenForDocument(e,t,n,o){const i=`${e}-${t}`,r=this.getDocumentStateOrThrow(o).activeToolbars[i];return!(!r||!r.isOpen)&&(!n||r.toolbarId===n)}setSidebarForDocument(e,t,n,o,i){const r=o??this.getActiveDocumentId();this.dispatch(Ri(r,e,t,n,i)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:n})}getSidebarForDocument(e,t,n){const o=`${e}-${t}`,i=this.getDocumentStateOrThrow(n).activeSidebars[o];return(null==i?void 0:i.isOpen)?i.sidebarId:null}closeSidebarForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(Ni(o,e,t)),this.sidebarChanged$.emit(o,{placement:e,slot:t,sidebarId:""})}toggleSidebarForDocument(e,t,n,o,i){const r=o??this.getActiveDocumentId(),a=`${e}-${t}`,s=this.getDocumentStateOrThrow(r).activeSidebars[a];(null==s?void 0:s.sidebarId)===n&&(null==s?void 0:s.isOpen)?(this.dispatch(Ni(r,e,t)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:""})):(this.dispatch(Ri(r,e,t,n,i)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:n}))}isSidebarOpenForDocument(e,t,n,o){const i=`${e}-${t}`,r=this.getDocumentStateOrThrow(o).activeSidebars[i];return!(!r||!r.isOpen)&&(!n||r.sidebarId===n)}setSidebarTabForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:ki,payload:{documentId:e,sidebarId:t,tabId:n}}))(o,e,t))}getSidebarTabForDocument(e,t){return this.getDocumentStateOrThrow(t).sidebarTabs[e]??null}openModalForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(((e,t)=>({type:Di,payload:{documentId:e,modalId:t}}))(n,e)),this.modalChanged$.emit(n,{modalId:e,isOpen:!0})}closeModalForDocument(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).activeModal;this.dispatch((e=>({type:Mi,payload:{documentId:e}}))(t)),this.modalChanged$.emit(t,{modalId:(null==n?void 0:n.modalId)??null,isOpen:!1})}clearModalForDocument(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:Pi,payload:{documentId:e}}))(t))}getActiveModalForDocument(e){return this.getDocumentStateOrThrow(e).activeModal}isModalOpenForDocument(e){const t=this.getDocumentStateOrThrow(e).activeModal;return(null==t?void 0:t.isOpen)??!1}openMenuForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();this.dispatch(Oi(i,{menuId:e,triggeredByCommandId:t,triggeredByItemId:n})),this.menuChanged$.emit(i,{menuId:e,isOpen:!0})}closeMenuForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Li(n,e)),this.menuChanged$.emit(n,{menuId:e,isOpen:!1})}toggleMenuForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();!!this.getDocumentStateOrThrow(i).openMenus[e]?(this.dispatch(Li(i,e)),this.menuChanged$.emit(i,{menuId:e,isOpen:!1})):(this.dispatch(Oi(i,{menuId:e,triggeredByCommandId:t,triggeredByItemId:n})),this.menuChanged$.emit(i,{menuId:e,isOpen:!0}))}closeAllMenusForDocument(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:zi,payload:{documentId:e}}))(t))}isMenuOpenForDocument(e,t){return!!this.getDocumentStateOrThrow(t).openMenus[e]}getOpenMenusForDocument(e){return Object.values(this.getDocumentStateOrThrow(e).openMenus)}};gr.id="ui";let pr=gr;const vr={activeToolbars:{},activeSidebars:{},activeModal:null,openMenus:{},sidebarTabs:{}},fr={documents:{},disabledCategories:[],hiddenItems:[]};function yr(e,t){const n=function(e){return e.ui??null}(e);return(null==n?void 0:n.documents[t])??null}function br(e,t){return`${e}-${t}`}function wr(e,t,n,o,i){const r=function(e,t,n,o){const i=yr(e,t);return i?i.activeToolbars[br(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.toolbarId===i)}function xr(e,t,n,o,i){const r=function(e,t,n,o){const i=yr(e,t);return i?i.activeSidebars[br(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.sidebarId===i)}const Cr={manifest:yi,create:(e,t)=>new pr(fi,e,t),reducer:(e=fr,t)=>{var n;switch(t.type){case bi:{const{documentId:n,schema:o}=t.payload,i={};return Object.values(o.toolbars).forEach(e=>{if(e.permanent&&e.position){const t=`${e.position.placement}-${e.position.slot}`;i[t]={toolbarId:e.id,isOpen:!0}}}),{...e,documents:{...e.documents,[n]:{...vr,activeToolbars:i}}}}case wi:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case xi:{const{documentId:n,placement:o,slot:i,toolbarId:r}=t.payload,a=e.documents[n]||vr,s=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...a,activeToolbars:{...a.activeToolbars,[s]:{toolbarId:r,isOpen:!0}}}}}}case Ci:{const{documentId:n,placement:o,slot:i}=t.payload,r=e.documents[n];if(!r)return e;const a=`${o}-${i}`,s=r.activeToolbars[a];return s?{...e,documents:{...e.documents,[n]:{...r,activeToolbars:{...r.activeToolbars,[a]:{...s,isOpen:!1}}}}}:e}case Ii:{const{documentId:n,placement:o,slot:i,sidebarId:r,activeTab:a}=t.payload,s=e.documents[n]||vr,l=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...s,activeSidebars:{...s.activeSidebars,[l]:{sidebarId:r,isOpen:!0}},...a&&{sidebarTabs:{...s.sidebarTabs,[r]:a}}}}}}case Si:{const{documentId:n,placement:o,slot:i}=t.payload,r=e.documents[n];if(!r)return e;const a=`${o}-${i}`,s=r.activeSidebars[a];return s?{...e,documents:{...e.documents,[n]:{...r,activeSidebars:{...r.activeSidebars,[a]:{...s,isOpen:!1}}}}}:e}case ki:{const{documentId:n,sidebarId:o,tabId:i}=t.payload,r=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...r,sidebarTabs:{...r.sidebarTabs,[o]:i}}}}}case Di:{const{documentId:n,modalId:o}=t.payload,i=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...i,activeModal:{modalId:o,isOpen:!0},openMenus:{}}}}}case Mi:{const{documentId:n}=t.payload,o=e.documents[n];return(null==o?void 0:o.activeModal)?{...e,documents:{...e.documents,[n]:{...o,activeModal:{...o.activeModal,isOpen:!1}}}}:e}case Pi:{const{documentId:o}=t.payload,i=e.documents[o];return i?(null==(n=i.activeModal)?void 0:n.isOpen)?e:{...e,documents:{...e.documents,[o]:{...i,activeModal:null}}}:e}case Ai:{const{documentId:n,menuState:o}=t.payload,i=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...i,openMenus:{[o.menuId]:o}}}}}case Ti:{const{documentId:n,menuId:o}=t.payload,i=e.documents[n];if(!i)return e;const{[o]:r,...a}=i.openMenus;return{...e,documents:{...e.documents,[n]:{...i,openMenus:a}}}}case zi:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,openMenus:{}}}}:e}case Ei:return{...e,disabledCategories:t.payload.categories};case _i:return{...e,hiddenItems:t.payload.hiddenItems};default:return e}},initialState:fr},Ir=()=>po(pr.id),Sr=e=>{const{provides:t}=Ir(),[n,o]=ke(null);return Me(()=>{if(!t)return;const n=t.forDocument(e);o(n.getState());const i=n.onToolbarChanged(()=>o(n.getState())),r=n.onSidebarChanged(()=>o(n.getState())),a=n.onModalChanged(()=>o(n.getState())),s=n.onMenuChanged(()=>o(n.getState()));return()=>{i(),r(),a(),s()}},[t,e]),n},kr=de(null);function Dr(){const e=Ee(kr);if(!e)throw new Error("useUIContainer must be used within a UIProvider");return e}const Mr=de(null);function Pr({children:e}){const t=Ae(new Map),n={register:ze((e,n,o)=>{const i=`${e}:${n}`;t.current.set(i,o)},[]),unregister:ze((e,n)=>{const o=`${e}:${n}`;t.current.delete(o)},[]),getAnchor:ze((e,n)=>{const o=`${e}:${n}`;return t.current.get(o)||null},[])};return Ue(Mr.Provider,{value:n,children:e})}function Ar(){const e=Ee(Mr);if(!e)throw new Error("useAnchorRegistry must be used within UIProvider");return e}function Tr(e,t){const n=Ar(),o=Ae(null),i=Ae(e),r=Ae(t);return i.current=e,r.current=t,ze(e=>{const t=o.current;o.current=e,e?e!==t&&n.register(i.current,r.current,e):t&&n.unregister(i.current,r.current)},[n])}const zr=de(null);function Er({children:e,initialComponents:t={}}){const n=Ae(new Map(Object.entries(t))),o={register:ze((e,t)=>{n.current.set(e,t)},[]),unregister:ze(e=>{n.current.delete(e)},[]),get:ze(e=>n.current.get(e),[]),has:ze(e=>n.current.has(e),[]),getRegisteredIds:ze(()=>Array.from(n.current.keys()),[])};return Ue(zr.Provider,{value:o,children:e})}function _r(){const e=function(){const e=Ee(zr);if(!e)throw new Error("useComponentRegistry must be used within UIProvider");return e}();return{renderCustomComponent:(t,n,o)=>{const i=e.get(t);return i?Ue(i,{documentId:n,...o||{}}):(console.error(`Component "${t}" not found in registry`),null)}}}const Rr=de(null);function Nr({children:e,renderers:t}){return Ue(Rr.Provider,{value:t,children:e})}function Or(){const e=Ee(Rr);if(!e)throw new Error("useRenderers must be used within UIProvider");return e}function Lr(e,t){var n;const{provides:o}=Ir(),i=Or(),r=ze(n=>{var r;const a=null==o?void 0:o.getSchema(),s=null==(r=null==a?void 0:a.selectionMenus)?void 0:r[e];if(!s)return null;if(!n.selected)return null;return Ue(i.selectionMenu,{schema:s,documentId:t,props:n})},[o,i,e,t]),a=null==o?void 0:o.getSchema();if(null==(n=null==a?void 0:a.selectionMenus)?void 0:n[e])return r}function $r({container:e,documentId:t}){const n=Sr(t),{provides:o}=Ir(),i=Ar(),r=Or(),[a,s]=ke(null),l=(null==n?void 0:n.openMenus)||{},c=null==o?void 0:o.getSchema();Me(()=>{const e=Object.keys(l);if(e.length>0){const n=e[0];if(!n)return void s(null);const o=l[n];if(o&&o.triggeredByItemId){const e=i.getAnchor(t,o.triggeredByItemId);s({menuId:n,anchorEl:e})}else s(null)}else s(null)},[l,i,t]);if(!a||!c)return null;const d=c.menus[a.menuId];if(!d)return console.warn(`Menu "${a.menuId}" not found in schema`),null;return Ue(r.menu,{schema:d,documentId:t,anchorEl:a.anchorEl,onClose:()=>{a&&(null==o||o.forDocument(t).closeMenu(a.menuId))},container:e})}function Fr({children:e,style:t,...n}){const{plugin:o}=go(pr.id),{provides:i}=Ir(),[r,a]=ke([]),[s,l]=ke([]),c=Ae(null),d=Ae(null),u=Ae(null),h=Ae(null),m=Te(()=>({containerRef:h,getContainer:()=>h.current}),[]),g=ze(e=>{const t=u.current;if(u.current=e,h.current=e,e&&e!==t&&o){const t=function(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:document.head}(e);d.current=t;const n=t.querySelector(Yi.STYLES);if(n)return c.current=n,void(n.textContent=o.getStylesheet());const i=o.getStylesheet(),r=document.createElement("style");r.setAttribute(qi,""),r.textContent=i,t instanceof ShadowRoot?t.insertBefore(r,t.firstChild):t.appendChild(r),c.current=r}},[o]);Me(()=>()=>{var e;(null==(e=c.current)?void 0:e.parentNode)&&!u.current&&c.current.remove(),c.current=null,d.current=null},[]),Me(()=>{if(o)return o.onStylesheetInvalidated(()=>{c.current&&(c.current.textContent=o.getStylesheet())})},[o]),Me(()=>{if(i)return a(i.getDisabledCategories()),l(i.getHiddenItems()),i.onCategoryChanged(({disabledCategories:e,hiddenItems:t})=>{a(e),l(t)})},[i]);const p=Te(()=>r.length>0?r.join(" "):void 0,[r]),v=Te(()=>s.length>0?s.join(" "):void 0,[s]),f=Te(()=>{const e={containerType:"inline-size"};return t&&"object"==typeof t?{...e,...t}:e},[t]),y={[Bi]:"",[Zi]:p,[Ki]:v};return Ue(kr.Provider,{value:m,children:Ue("div",{ref:g,...y,...n,style:f,children:e})})}function jr({children:e,documentId:t,components:n={},renderers:o,menuContainer:i,...r}){return Ue(Pr,{children:Ue(Er,{initialComponents:n,children:Ue(Nr,{renderers:o,children:Ue(Fr,{...r,children:[e,Ue($r,{documentId:t,container:i})]})})})})}const Hr=class extends Yn{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=ao(),this.documentClosed$=ao(),this.activeDocumentChanged$=ao(),this.documentError$=ao(),this.documentOrderChanged$=ao(),this.openFileRequest$=ro(),this.loadOptions=new Map,this.maxDocuments=null==n?void 0:n.maxDocuments}buildCapability(){return{openFileDialog:e=>this.openFileDialog(e),openDocumentUrl:e=>this.openDocumentUrl(e),openDocumentBuffer:e=>this.openDocumentBuffer(e),retryDocument:(e,t)=>this.retryDocument(e,t),closeDocument:e=>this.closeDocument(e),closeAllDocuments:()=>this.closeAllDocuments(),setActiveDocument:e=>{if(!this.isDocumentOpen(e))throw new Error(`Cannot set active document: ${e} is not open`);this.dispatchCoreAction((e=>({type:_n,payload:e}))(e))},getActiveDocumentId:()=>this.coreState.core.activeDocumentId,getActiveDocument:()=>{var e;const t=this.coreState.core.activeDocumentId;return t?(null==(e=this.coreState.core.documents[t])?void 0:e.document)??null:null},getDocumentOrder:()=>this.coreState.core.documentOrder,moveDocument:(e,t)=>{this.dispatchCoreAction(((e,t)=>({type:Nn,payload:{documentId:e,toIndex:t}}))(e,t))},swapDocuments:(e,t)=>{const n=this.coreState.core.documentOrder,o=n.indexOf(e),i=n.indexOf(t);if(-1===o||-1===i)throw new Error("One or both documents not found in order");const r=[...n];[r[o],r[i]]=[r[i],r[o]],this.dispatchCoreAction((e=>({type:Rn,payload:e}))(r))},getDocument:e=>{var t;return(null==(t=this.coreState.core.documents[e])?void 0:t.document)??null},getDocumentState:e=>this.coreState.core.documents[e]??null,getOpenDocuments:()=>this.coreState.core.documentOrder.map(e=>this.coreState.core.documents[e]).filter(e=>null!==e),isDocumentOpen:e=>this.isDocumentOpen(e),getDocumentCount:()=>Object.keys(this.coreState.core.documents).length,getDocumentIndex:e=>this.coreState.core.documentOrder.indexOf(e),onDocumentOpened:this.documentOpened$.on,onDocumentClosed:this.documentClosed$.on,onDocumentError:this.documentError$.on,onActiveDocumentChanged:this.activeDocumentChanged$.on,onDocumentOrderChanged:this.documentOrderChanged$.on}}isDocumentOpen(e){return!!this.coreState.core.documents[e]}onDocumentLoaded(e){const t=this.coreState.core.documents[e];t&&"loaded"===t.status&&(this.loadOptions.delete(e),this.documentOpened$.emit(t),this.logger.info("DocumentManagerPlugin","DocumentOpened",`Document ${e} opened successfully`,{name:t.name}))}onDocumentClosed(e){this.loadOptions.delete(e),this.documentClosed$.emit(e),this.logger.info("DocumentManagerPlugin","DocumentClosed",`Document ${e} closed`)}onActiveDocumentChanged(e,t){this.activeDocumentChanged$.emit({previousDocumentId:e,currentDocumentId:t}),this.logger.info("DocumentManagerPlugin","ActiveDocumentChanged",`Active document changed from ${e} to ${t}`)}onCoreStoreUpdated(e,t){e.core.documentOrder!==t.core.documentOrder&&this.documentOrderChanged$.emit({order:t.core.documentOrder})}onOpenFileRequest(e){return this.openFileRequest$.on(e)}openDocumentUrl(e){const t=new gt,n=e.documentId||this.generateDocumentId(),o=this.checkDocumentLimit();if(o)return t.reject(o),t;const i=e.name??this.extractNameFromUrl(e.url);this.loadOptions.set(n,e),this.dispatchCoreAction(jn(n,i,e.scale,e.rotation,!!e.password,e.autoActivate)),this.logger.info("DocumentManagerPlugin","OpenDocumentUrl",`Starting to load document from URL: ${e.url}`,{documentId:n,passwordProvided:!!e.password});const r={id:n,url:e.url},a=this.engine.openDocumentUrl(r,{password:e.password,mode:e.mode,requestOptions:e.requestOptions});return t.resolve({documentId:n,task:a}),this.handleLoadTask(n,a,"OpenDocumentUrl"),t}openDocumentBuffer(e){const t=new gt,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const o=e.documentId||this.generateDocumentId();this.loadOptions.set(o,e),this.dispatchCoreAction(jn(o,e.name,e.scale,e.rotation,!!e.password,e.autoActivate)),this.logger.info("DocumentManagerPlugin","OpenDocumentBuffer",`Starting to load document from buffer: ${e.name}`,{documentId:o,passwordProvided:!!e.password});const i={id:o,content:e.buffer},r=this.engine.openDocumentBuffer(i,{password:e.password});return t.resolve({documentId:o,task:r}),this.handleLoadTask(o,r,"OpenDocumentBuffer"),t}retryDocument(e,t){const n=new gt,o=this.validateRetry(e);if(!o.valid)return n.reject(o.error),n;const i={...this.loadOptions.get(e),...(null==t?void 0:t.password)&&{password:t.password}};this.loadOptions.set(e,i),this.dispatchCoreAction(((e,t)=>({type:zn,payload:{documentId:e,passwordProvided:t}}))(e,!!(null==t?void 0:t.password))),this.logger.info("DocumentManagerPlugin","RetryDocument",`Retrying to load document ${e}`,{passwordProvided:!!(null==t?void 0:t.password)});const r="url"in i?this.retryUrlDocument(e,i):this.retryBufferDocument(e,i);return n.resolve({documentId:e,task:r}),this.handleLoadTask(e,r,"RetryDocument"),n}openFileDialog(e){const t=new gt;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new gt,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(Hn(e)),t.resolve()},n=>{this.logger.error("DocumentManagerPlugin","CloseDocument",`Failed to close document ${e}`,n),t.fail(n)}):(this.logger.info("DocumentManagerPlugin","CloseDocument",`Closing document ${e} in ${n.status} state (skipping engine close)`),this.dispatchCoreAction(Hn(e)),t.resolve()),t):(this.logger.warn("DocumentManagerPlugin","CloseDocument",`Cannot close document ${e}: not found in state`),t.resolve(),t)}closeAllDocuments(){const e=Object.keys(this.coreState.core.documents),t=e.map(e=>this.closeDocument(e));return this.logger.info("DocumentManagerPlugin","CloseAllDocuments",`Closing ${e.length} documents`),gt.all(t)}checkDocumentLimit(){return this.maxDocuments&&Object.keys(this.coreState.core.documents).length>=this.maxDocuments?{code:Ht.Unknown,message:`Maximum number of documents (${this.maxDocuments}) reached`}:null}validateRetry(e){const t=this.coreState.core.documents[e];return t?"loaded"===t.status?{valid:!1,error:{code:Ht.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:Ht.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:Ht.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:Ht.NotFound,message:`Document ${e} not found`}}}retryUrlDocument(e,t){const n={id:e,url:t.url};return this.engine.openDocumentUrl(n,{password:t.password,mode:t.mode,requestOptions:t.requestOptions})}retryBufferDocument(e,t){const n={id:e,content:t.buffer};return this.engine.openDocumentBuffer(n,{password:t.password})}handleLoadTask(e,t,n){t.wait(t=>{this.dispatchCoreAction(((e,t)=>({type:An,payload:{documentId:e,document:t}}))(e,t))},t=>{this.handleLoadError(e,t,n)})}handleLoadError(e,t,n){var o,i,r;const a=(null==(o=t.reason)?void 0:o.message)||"Failed to load document";this.logger.error("DocumentManagerPlugin",n,"Failed to load document",t),this.dispatchCoreAction(((e,t,n,o)=>({type:Tn,payload:{documentId:e,error:t,errorCode:n,errorDetails:o}}))(e,a,null==(i=t.reason)?void 0:i.code,t.reason)),this.documentError$.emit({documentId:e,message:a,code:null==(r=t.reason)?void 0:r.code,reason:t.reason})}generateDocumentId(){return`doc-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}extractNameFromUrl(e){try{const t=new URL(e),n=t.pathname.split("/").pop();if(!n)return;let o=decodeURIComponent(n);return o.toLowerCase().endsWith(".pdf")||(o+=".pdf"),o}catch{return}}async initialize(e){var t;if(this.logger.info("DocumentManagerPlugin","Initialize","Document Manager Plugin initialized",{maxDocuments:this.maxDocuments,initialDocumentsCount:(null==(t=e.initialDocuments)?void 0:t.length)??0}),e.initialDocuments&&e.initialDocuments.length>0)for(const t of e.initialDocuments)try{"buffer"in t?this.openDocumentBuffer(t):"url"in t&&this.openDocumentUrl(t)}catch(e){this.logger.error("DocumentManagerPlugin","Initialize","Failed to initiate initial document load",e)}}async destroy(){await this.closeAllDocuments().toPromise(),this.loadOptions.clear(),this.documentOpened$.clear(),this.documentClosed$.clear(),this.activeDocumentChanged$.clear(),this.documentOrderChanged$.clear(),this.documentError$.clear(),super.destroy()}};Hr.id="document-manager";let Ur=Hr;const Wr="document-manager";function Br({documentId:e,children:t}){const n=fo(e);if(!n)return null;return Ue(U,{children:t({documentState:n,isLoading:"loading"===n.status,isError:"error"===n.status,isLoaded:"loaded"===n.status})})}const qr=()=>po(Ur.id);const Gr=co({manifest:{id:Wr,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new Ur(Wr,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=go(Ur.id),{provides:t}=qr(),n=Ae(null),o=Ae(null),i=Ae(void 0);return Me(()=>{if(!(null==e?void 0:e.onOpenFileRequest))return;return e.onOpenFileRequest(({task:e,options:t})=>{var r;o.current=e,i.current=t,null==(r=n.current)||r.click()})},[e]),Ue("input",{ref:n,type:"file",accept:"application/pdf",style:{display:"none"},onChange:async e=>{var n,r,a,s,l;const c=null==(n=e.currentTarget.files)?void 0:n[0];if(!c||!t)return;const d=await c.arrayBuffer();t.openDocumentBuffer({name:c.name,buffer:d,documentId:null==(r=i.current)?void 0:r.documentId,scale:null==(a=i.current)?void 0:a.scale,rotation:null==(s=i.current)?void 0:s.rotation,autoActivate:null==(l=i.current)?void 0:l.autoActivate}).wait(e=>{var t;null==(t=o.current)||t.resolve(e)},e=>{var t;null==(t=o.current)||t.fail(e)})}})}).build(),Vr="commands",Zr={id:Vr,name:"Commands Plugin",version:"1.0.0",provides:["commands"],requires:[],optional:["i18n"],defaultConfig:{commands:{}}},Kr="COMMANDS/SET_DISABLED_CATEGORIES",Yr=e=>({type:Kr,payload:e}),Xr=class extends Yn{constructor(e,t,n){var o;super(e,t),this.commands=new Map,this.i18n=null,this.shortcutMap=new Map,this.commandExecuted$=ro(),this.commandStateChanged$=ro(),this.shortcutExecuted$=ro(),this.categoryChanged$=ao(),this.previousStates=new Map;const i=t.getPlugin("i18n");this.i18n=(null==i?void 0:i.provides())??null,(null==(o=n.disabledCategories)?void 0:o.length)&&this.dispatch(Yr(n.disabledCategories)),Object.values(n.commands).forEach(e=>{this.registerCommand(e)}),this.registry.getStore().subscribe((e,t)=>{this.onGlobalStoreChange(t)})}onDocumentClosed(e){this.previousStates.delete(e),this.logger.debug("CommandsPlugin","DocumentClosed",`Cleaned up command state cache for document: ${e}`)}async initialize(){this.logger.info("CommandsPlugin","Initialize","Commands plugin initialized")}async destroy(){this.commandExecuted$.clear(),this.commandStateChanged$.clear(),this.shortcutExecuted$.clear(),this.categoryChanged$.clear(),this.commands.clear(),this.shortcutMap.clear(),this.previousStates.clear(),super.destroy()}disableCategoryImpl(e){const t=new Set(this.state.disabledCategories);t.has(e)||(t.add(e),this.dispatch(Yr(Array.from(t))),this.categoryChanged$.emit({disabledCategories:Array.from(t)}))}enableCategoryImpl(e){const t=new Set(this.state.disabledCategories);t.has(e)&&(t.delete(e),this.dispatch(Yr(Array.from(t))),this.categoryChanged$.emit({disabledCategories:Array.from(t)}))}toggleCategoryImpl(e){this.state.disabledCategories.includes(e)?this.enableCategoryImpl(e):this.disableCategoryImpl(e)}setDisabledCategoriesImpl(e){this.dispatch(Yr(e)),this.categoryChanged$.emit({disabledCategories:e})}isCommandCategoryDisabled(e){var t;return!!(null==(t=e.categories)?void 0:t.length)&&e.categories.some(e=>this.state.disabledCategories.includes(e))}buildCapability(){return{resolve:(e,t)=>this.resolve(e,t),execute:(e,t,n="ui")=>this.execute(e,t,n),getAllCommands:e=>this.getAllCommands(e),getCommandsByCategory:(e,t)=>this.getCommandsByCategory(e,t),getCommandByShortcut:e=>this.getCommandByShortcut(e),getAllShortcuts:()=>new Map(this.shortcutMap),forDocument:e=>this.createCommandScope(e),registerCommand:e=>this.registerCommand(e),unregisterCommand:e=>this.unregisterCommand(e),disableCategory:e=>this.disableCategoryImpl(e),enableCategory:e=>this.enableCategoryImpl(e),toggleCategory:e=>this.toggleCategoryImpl(e),setDisabledCategories:e=>this.setDisabledCategoriesImpl(e),getDisabledCategories:()=>this.state.disabledCategories,isCategoryDisabled:e=>this.state.disabledCategories.includes(e),onCommandExecuted:this.commandExecuted$.on,onCommandStateChanged:this.commandStateChanged$.on,onShortcutExecuted:this.shortcutExecuted$.on,onCategoryChanged:this.categoryChanged$.on}}createCommandScope(e){return{resolve:t=>this.resolve(t,e),execute:(t,n="ui")=>this.execute(t,e,n),getAllCommands:()=>this.getAllCommands(e),getCommandsByCategory:t=>this.getCommandsByCategory(t,e),onCommandStateChanged:t=>this.commandStateChanged$.on(n=>{if(n.documentId===e){const{documentId:e,...o}=n;t(o)}})}}resolve(e,t){const n=t??this.getActiveDocumentId(),o=this.commands.get(e);if(!o)throw new Error(`Command not found: ${e}`);const i=this.registry.getStore().getState(),r=this.resolveLabel(o,i,n),a=o.shortcuts?Array.isArray(o.shortcuts)?o.shortcuts:[o.shortcuts]:void 0,s=this.resolveDynamic(o.disabled,i,n)??!1,l=this.isCommandCategoryDisabled(o),c=s||l;return{id:o.id,label:r,icon:this.resolveDynamic(o.icon,i,n),iconProps:this.resolveDynamic(o.iconProps,i,n),active:this.resolveDynamic(o.active,i,n)??!1,disabled:c,visible:this.resolveDynamic(o.visible,i,n)??!0,shortcuts:a,shortcutLabel:o.shortcutLabel,categories:o.categories,description:o.description,execute:()=>o.action({registry:this.registry,state:i,documentId:n})}}resolveLabel(e,t,n){if(e.labelKey&&this.i18n){const o=this.resolveDynamic(e.labelParams,t,n);return this.i18n.t(e.labelKey,{params:o,documentId:n})}return e.label?e.label:e.id}resolveDynamic(e,t,n){if(void 0!==e)return"function"==typeof e?e({state:t,documentId:n}):e}execute(e,t,n="ui"){const o=t??this.getActiveDocumentId(),i=this.resolve(e,o);i.disabled?this.logger.warn("CommandsPlugin","ExecutionBlocked",`Command '${e}' is disabled for document '${o}'`):i.visible?(i.execute(),this.commandExecuted$.emit({commandId:e,documentId:o,source:n}),this.logger.debug("CommandsPlugin","CommandExecuted",`Command '${e}' executed for document '${o}' (source: ${n})`)):this.logger.warn("CommandsPlugin","ExecutionBlocked",`Command '${e}' is not visible for document '${o}'`)}registerCommand(e){if(this.commands.has(e.id)&&this.logger.warn("CommandsPlugin","CommandOverwrite",`Command '${e.id}' already exists and will be overwritten`),this.commands.set(e.id,e),e.shortcuts){(Array.isArray(e.shortcuts)?e.shortcuts:[e.shortcuts]).forEach(t=>{const n=this.normalizeShortcut(t);this.shortcutMap.set(n,e.id)})}this.logger.debug("CommandsPlugin","CommandRegistered",`Command '${e.id}' registered`)}unregisterCommand(e){const t=this.commands.get(e);if(t){if(t.shortcuts){(Array.isArray(t.shortcuts)?t.shortcuts:[t.shortcuts]).forEach(e=>{const t=this.normalizeShortcut(e);this.shortcutMap.delete(t)})}this.commands.delete(e),this.logger.debug("CommandsPlugin","CommandUnregistered",`Command '${e}' unregistered`)}}getCommandByShortcut(e){const t=this.normalizeShortcut(e),n=this.shortcutMap.get(t);return n?this.commands.get(n)??null:null}normalizeShortcut(e){return e.toLowerCase().split("+").sort().join("+")}getAllCommands(e){const t=e??this.getActiveDocumentId();return Array.from(this.commands.keys()).map(e=>this.resolve(e,t))}getCommandsByCategory(e,t){const n=t??this.getActiveDocumentId();return Array.from(this.commands.values()).filter(t=>{var n;return null==(n=t.categories)?void 0:n.includes(e)}).map(e=>this.resolve(e.id,n))}onGlobalStoreChange(e){Object.keys(e.core.documents).forEach(t=>{this.detectCommandChanges(t,e)})}detectCommandChanges(e,t){const n=this.previousStates.get(e)??new Map;this.commands.forEach((t,o)=>{const i=this.resolve(o,e),r=n.get(o);if(!r)return void n.set(o,i);const a={};r.active!==i.active&&(a.active=i.active),r.disabled!==i.disabled&&(a.disabled=i.disabled),r.visible!==i.visible&&(a.visible=i.visible),r.label!==i.label&&(a.label=i.label),to(r.iconProps,i.iconProps)||(a.iconProps=i.iconProps),Object.keys(a).length>0&&(n.set(o,i),this.commandStateChanged$.emit({commandId:o,documentId:e,changes:a}))}),this.previousStates.set(e,n)}};Xr.id="commands";let Qr=Xr;const Jr={disabledCategories:[]},ea=()=>po(Qr.id),ta=(e,t)=>{const{provides:n}=ea(),[o,i]=ke(()=>n?n.resolve(e,t):null);return Me(()=>{if(!n)return void i(null);i(n.resolve(e,t));return n.onCommandStateChanged(o=>{o.commandId===e&&o.documentId===t&&i(n.resolve(e,t))})},[n,e,t]),o};const na=co({manifest:Zr,create:(e,t)=>new Qr(Vr,e,t),reducer:(e=Jr,t)=>t.type===Kr?{...e,disabledCategories:t.payload}:e,initialState:Jr}).addUtility(function(){const{provides:e}=ea();return Me(()=>{if(!e)return;const t=function(e){return t=>{const n=t.composedPath()[0]||t.target;if("INPUT"===n.tagName||"TEXTAREA"===n.tagName||n.isContentEditable)return;const o=function(e){const t=[];e.ctrlKey&&t.push("ctrl"),e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta");const n=e.key.toLowerCase();return["control","shift","alt","meta"].includes(n)?null:[...t,n].sort().join("+")}(t);if(!o)return;const i=e.getCommandByShortcut(o);if(!i)return;const r=e.resolve(i.id);!r.disabled&&r.visible&&(t.preventDefault(),t.stopPropagation(),e.execute(i.id,void 0,"keyboard"))}}(e);return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e]),null}).build(),oa="i18n",ia={id:oa,name:"I18n Plugin",version:"1.0.0",provides:["i18n"],requires:[],optional:[],defaultConfig:{defaultLocale:"en",locales:[{code:"en",name:"English",translations:{commands:{zoom:{in:"Zoom In",out:"Zoom Out",fitWidth:"Fit to Width",fitPage:"Fit to Page",automatic:"Automatic",level:"Zoom Level ({level}%)",inArea:"Zoom In Area"},fullscreen:{enter:"Enter Full Screen",exit:"Exit Full Screen"},rotate:{clockwise:"Rotate Clockwise",counterclockwise:"Rotate Counter-Clockwise"},menu:"Menu",sidebar:"Sidebar",search:"Search",comment:"Comment",download:"Download",print:"Print",openFile:"Open PDF",save:"Save",settings:"Settings",view:"View",annotate:"Annotate",shapes:"Shapes",redact:"Redact",fillAndSign:"Fill and Sign",form:"Form",pan:"Pan",pointer:"Pointer",undo:"Undo",redo:"Redo",copy:"Copy",screenshot:"Screenshot",nextPage:"Next Page",previousPage:"Previous Page"}}},{code:"es",name:"Español",translations:{commands:{zoom:{in:"Acercar",out:"Alejar",fitWidth:"Ajustar al ancho",fitPage:"Ajustar a la página",automatic:"Automático",level:"Nivel de zoom ({level}%)",inArea:"Acercar área"},fullscreen:{enter:"Pantalla completa",exit:"Salir de pantalla completa"},rotate:{clockwise:"Girar a la derecha",counterclockwise:"Girar a la izquierda"},menu:"Menú",sidebar:"Barra lateral",search:"Buscar",comment:"Comentario",download:"Descargar",print:"Imprimir",openFile:"Abrir PDF",save:"Guardar",settings:"Configuración",view:"Ver",annotate:"Anotar",shapes:"Formas",redact:"Redactar",fillAndSign:"Rellenar y firmar",form:"Formulario",pan:"Desplazar",pointer:"Puntero",undo:"Deshacer",redo:"Rehacer",copy:"Copiar",screenshot:"Captura de pantalla",nextPage:"Página siguiente",previousPage:"Página anterior"}}}]}},ra="I18N/SET_LOCALE",aa="I18N/REGISTER_LOCALE",sa=e=>({type:ra,payload:e}),la=e=>({type:aa,payload:e}),ca=class extends Yn{constructor(e,t,n){super(e,t),this.locales=new Map,this.paramResolvers=new Map,this.paramsCache=new Map,this.localeChange$=ro(),this.paramsChanged$=so((e,t)=>({documentId:e,...t}),{cache:!1}),this.config=n,n.locales.forEach(e=>{this.locales.set(e.code,e),this.dispatch(la(e.code))}),n.paramResolvers&&Object.entries(n.paramResolvers).forEach(([e,t])=>{this.paramResolvers.set(e,t)}),this.dispatch(sa(n.defaultLocale)),this.registry.getStore().subscribe((e,t)=>{this.detectParamChanges(t)})}async initialize(){this.logger.info("I18nPlugin","Initialize","I18n plugin initialized")}async destroy(){this.localeChange$.clear(),this.paramsChanged$.clear(),this.paramResolvers.clear(),this.paramsCache.clear(),super.destroy()}onDocumentClosed(e){this.paramsCache.delete(e),this.paramsChanged$.clearScope(e),this.logger.debug("I18nPlugin","DocumentClosed",`Cleaned up params cache for document: ${e}`)}buildCapability(){return{t:(e,t)=>this.translate(e,t),forDocument:e=>this.createI18nScope(e),registerParamResolver:(e,t)=>this.registerParamResolver(e,t),unregisterParamResolver:e=>this.unregisterParamResolver(e),setLocale:e=>this.setLocale(e),getLocale:()=>this.state.currentLocale,getAvailableLocales:()=>[...this.state.availableLocales],getLocaleInfo:e=>this.locales.get(e)??null,registerLocale:e=>this.registerLocale(e),hasLocale:e=>this.locales.has(e),onLocaleChange:this.localeChange$.on,onParamsChanged:this.paramsChanged$.onGlobal}}createI18nScope(e){return{t:(t,n)=>this.translate(t,{documentId:e,...n}),onParamsChanged:this.paramsChanged$.forScope(e)}}translate(e,t){const n=this.locales.get(this.state.currentLocale),o=this.config.fallbackLocale?this.locales.get(this.config.fallbackLocale):null;let i=this.getNestedValue(null==n?void 0:n.translations,e);if(!i&&o&&(i=this.getNestedValue(o.translations,e)),!i){if(!(null==t?void 0:t.fallback))return this.logger.warn("I18nPlugin","MissingTranslation",`Translation not found for key: ${e}`),e;i=t.fallback}let r=null==t?void 0:t.params;return!r&&this.paramResolvers.has(e)&&(r=this.resolveParams(e,null==t?void 0:t.documentId)),this.interpolate(i,r)}resolveParams(e,t){const n=this.paramResolvers.get(e);if(!n)return;const o=this.registry.getStore().getState();try{return n({state:o,documentId:t})}catch(t){return void this.logger.error("I18nPlugin","ParamResolverError",`Error resolving params for key "${e}":`,t)}}getNestedValue(e,t){if(!e)return;const n=t.split(".");let o=e;for(const e of n){if(null==o)return;o=o[e]}return"string"==typeof o?o:void 0}interpolate(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>{const o=t[n];return void 0!==o?String(o):e}):e}detectParamChanges(e){Object.keys(e.core.documents).forEach(t=>{this.detectDocumentParamChanges(t,e)})}detectDocumentParamChanges(e,t){const n=this.paramsCache.get(e),o=[];this.paramResolvers.forEach((i,r)=>{try{const a=i({state:t,documentId:e});to(null==n?void 0:n.get(r),a)||(o.push(r),this.paramsCache.has(e)||this.paramsCache.set(e,new Map),this.paramsCache.get(e).set(r,a))}catch(e){this.logger.error("I18nPlugin","ParamDetectionError",`Error detecting param changes for key "${r}":`,e)}}),o.length>0&&(this.paramsChanged$.emit(e,{changedKeys:o}),this.logger.debug("I18nPlugin","ParamsChanged",`Translation params changed for document ${e}:`,o))}registerParamResolver(e,t){this.paramResolvers.has(e)&&this.logger.warn("I18nPlugin","ResolverOverwrite",`Param resolver for "${e}" already exists and will be overwritten`),this.paramResolvers.set(e,t),this.paramsCache.forEach(t=>{t.delete(e)}),this.logger.debug("I18nPlugin","ResolverRegistered",`Param resolver registered for: ${e}`)}unregisterParamResolver(e){this.paramResolvers.delete(e)&&(this.paramsCache.forEach(t=>{t.delete(e)}),this.logger.debug("I18nPlugin","ResolverUnregistered",`Param resolver unregistered for: ${e}`))}setLocale(e){if(!this.locales.has(e))return void this.logger.warn("I18nPlugin","LocaleNotFound",`Locale '${e}' is not registered`);const t=this.state.currentLocale;t!==e&&(this.dispatch(sa(e)),this.localeChange$.emit({previousLocale:t,currentLocale:e}),this.logger.info("I18nPlugin","LocaleChanged",`Locale changed to: ${e}`))}registerLocale(e){this.locales.has(e.code)?this.logger.warn("I18nPlugin","LocaleAlreadyRegistered",`Locale '${e.code}' is already registered`):(this.locales.set(e.code,e),this.dispatch(la(e.code)),this.logger.info("I18nPlugin","LocaleRegistered",`Locale registered: ${e.code}`))}};ca.id="i18n";let da=ca;const ua={currentLocale:"en",availableLocales:[]},ha={manifest:ia,create:(e,t)=>new da(oa,e,t),reducer:(e=ua,t)=>{switch(t.type){case ra:{const n=t.payload;return e.availableLocales.includes(n)?{...e,currentLocale:n}:(console.warn(`I18nPlugin: Locale '${n}' not available`),e)}case aa:{const n=t.payload;return e.availableLocales.includes(n)?e:{...e,availableLocales:[...e.availableLocales,n]}}default:return e}},initialState:ua},ma=e=>{const{provides:t}=po(da.id),[,n]=De(e=>e+1,0),o=ze((n,o)=>t?t.t(n,{documentId:e,params:null==o?void 0:o.params,fallback:null==o?void 0:o.fallback}):(null==o?void 0:o.fallback)??n,[t,e]);return Me(()=>{if(!t)return;const o=t.onLocaleChange(()=>{n()}),i=e?t.forDocument(e).onParamsChanged(()=>{n()}):t.onParamsChanged(()=>{n()});return()=>{o(),i()}},[t,e]),{translate:o,locale:(null==t?void 0:t.getLocale())??"en"}};var ga=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(ga||{}),pa=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(pa||{});const va="zoom",fa={id:va,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:ga.Automatic,minZoom:.2,maxZoom:60,zoomStep:.1,zoomRanges:[{min:.2,max:.5,step:.05},{min:.5,max:1,step:.1},{min:1,max:2,step:.2},{min:2,max:4,step:.4},{min:4,max:10,step:.8},{min:10,max:20,step:1.6},{min:20,max:40,step:3.2},{min:40,max:60,step:6.4}],presets:[{name:"Fit Page",value:ga.FitPage},{name:"Fit Width",value:ga.FitWidth},{name:"Automatic",value:ga.Automatic},{name:"25%",value:.25},{name:"50%",value:.5},{name:"100%",value:1},{name:"125%",value:1.25},{name:"150%",value:1.5},{name:"200%",value:2},{name:"400%",value:4},{name:"800%",value:8},{name:"1600%",value:16}]}},ya="ZOOM/INIT_STATE",ba="ZOOM/CLEANUP_STATE",wa="ZOOM/SET_ZOOM_LEVEL",xa="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const Ca={zoomLevel:ga.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},Ia={documents:{},activeDocumentId:null};const Sa=class extends Yn{constructor(e,t,n){var o,i,r;super(e,t),this.zoom$=ro(),this.state$=ao(),this.viewportPlugin=t.getPlugin("viewport"),this.viewport=this.viewportPlugin.provides(),this.scroll=t.getPlugin("scroll").provides();const a=t.getPlugin("interaction-manager");this.interactionManager=(null==a?void 0:a.provides())??null;const s=t.getPlugin("spread");this.spread=(null==s?void 0:s.provides())??null,this.minZoom=n.minZoom??.25,this.maxZoom=n.maxZoom??10,this.zoomStep=n.zoomStep??.1,this.defaultZoomLevel=n.defaultZoomLevel,this.presets=n.presets??[],this.zoomRanges=this.normalizeRanges(n.zoomRanges??[]),this.viewport.onViewportResize(e=>this.recalcAuto(e.documentId,pa.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(o=this.spread)||o.onSpreadChange(e=>{this.recalcAuto(e.documentId,pa.Top)}),null==(i=this.interactionManager)||i.registerMode({id:"marqueeZoom",scope:"page",exclusive:!0,cursor:"zoom-in"}),null==(r=this.interactionManager)||r.onModeChange(e=>{const t="marqueeZoom"===e.activeMode,n=this.getDocumentState(e.documentId);var o;n&&n.isMarqueeZoomActive!==t&&this.dispatch((o=e.documentId,{type:xa,payload:{documentId:o,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...Ca,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:ya,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,pa.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:ba,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,pa.Top)}buildCapability(){return{requestZoom:(e,t)=>this.requestZoom(e,t),requestZoomBy:(e,t)=>this.requestZoomBy(e,t),zoomIn:()=>this.zoomIn(),zoomOut:()=>this.zoomOut(),zoomToArea:(e,t)=>this.zoomToArea(e,t),enableMarqueeZoom:()=>this.enableMarqueeZoom(),disableMarqueeZoom:()=>this.disableMarqueeZoom(),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createZoomScope(e),registerMarqueeOnPage:e=>this.registerMarqueeOnPage(e),getPresets:()=>this.presets,onZoomChange:this.zoom$.on,onStateChange:this.state$.on}}createZoomScope(e){return{requestZoom:(t,n)=>this.requestZoom(t,n,e),requestZoomBy:(t,n)=>this.requestZoomBy(t,n,e),zoomIn:()=>this.zoomIn(e),zoomOut:()=>this.zoomOut(e),zoomToArea:(t,n)=>this.zoomToArea(t,n,e),enableMarqueeZoom:()=>this.enableMarqueeZoom(e),disableMarqueeZoom:()=>this.disableMarqueeZoom(e),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(e),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(e),getState:()=>this.getDocumentStateOrThrow(e),onZoomChange:t=>this.zoom$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Zoom state not found for document: ${e??"active"}`);return t}requestZoom(e,t,n){this.handleRequest({level:e,center:t},n)}requestZoomBy(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentStateOrThrow(o).currentZoomLevel,r=this.toZoom(i+e);this.handleRequest({level:r,center:t},o)}zoomIn(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:this.stepFor(n)},t)}zoomOut(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:-this.stepFor(n)},t)}zoomToArea(e,t,n){const o=n??this.getActiveDocumentId();this.handleZoomToArea(o,e,t)}enableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activate("marqueeZoom")}disableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activateDefaultMode()}toggleMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManager)?void 0:t.forDocument(n);"marqueeZoom"===(null==o?void 0:o.getActiveMode())?o.activateDefaultMode():null==o||o.activate("marqueeZoom")}isMarqueeZoomActive(e){var t;const n=e??this.getActiveDocumentId();return"marqueeZoom"===(null==(t=this.interactionManager)?void 0:t.forDocument(n).getActiveMode())}handleRequest({level:e,delta:t=0,center:n,focus:o=pa.Center,align:i="keep"},r){const a=r??this.getActiveDocumentId(),s=this.getDocumentStateOrThrow(a);if(!this.coreState.core.documents[a])return;const l=this.viewport.forDocument(a),c=l.getMetrics(),d=s.currentZoomLevel;if(0===c.clientWidth||0===c.clientHeight)return;const u="number"==typeof e?e:this.computeZoomForMode(a,e,c);if(!1===u)return;const h=eo(u+t,this.minZoom,this.maxZoom),m=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:o===pa.Top?0:c.clientHeight/2},{desiredScrollLeft:p,desiredScrollTop:v}=this.computeScrollForZoomChange(a,c,d,m,g,i);isNaN(p)||isNaN(v)||this.viewportPlugin.setViewportScrollMetrics(a,{scrollLeft:p,scrollTop:v}),this.dispatch(function(e,t,n){return{type:wa,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(a,"number"==typeof e?m:e,m)),this.dispatchCoreAction(((e,t)=>({type:Ln,payload:{scale:e,documentId:t}}))(m,a)),this.viewport.isGated(a)&&this.viewport.releaseGate("zoom",a),l.scrollTo({x:p,y:v,behavior:"instant"});const f={documentId:a,oldZoom:d,newZoom:m,level:e,center:g,desiredScrollLeft:p,desiredScrollTop:v,viewport:c};this.zoom$.emit(f)}computeZoomForMode(e,t,n){if(!this.coreState.core.documents[e])return!1;const o=this.scroll.forDocument(e),i=o?this.scroll.getPageGap():0,r=this.viewport.getViewportGap(),a=o.getSpreadPagesWithRotatedSize();if(!a.length)return!1;if(0===n.clientWidth||0===n.clientHeight)return!1;const s=n.clientWidth-2*r,l=n.clientHeight-2*r;if(s<=0||l<=0)return!1;let c=0,d=0;switch(a.forEach(e=>{const t=e.reduce((e,t,n)=>e+t.rotatedSize.width+(n?i:0),0),n=Math.max(...e.map(e=>e.rotatedSize.height));c=Math.max(c,t),d=Math.max(d,n)}),t){case ga.FitWidth:return s/c;case ga.FitPage:return Math.min(s/c,l/d);case ga.Automatic:return Math.min(s/c,1);default:return 1}}computeScrollForZoomChange(e,t,n,o,i,r="keep"){const a=this.scroll.forDocument(e).getLayout(),s=this.viewport.getViewportGap(),l=a.totalContentSize.width,c=a.totalContentSize.height,d=t.clientWidth-2*s,u=t.clientHeight-2*s,h=(e,t,n)=>t*n<e?(e-t*n)/2:0,m=h(d,l,n),g=h(u,c,n),p=h(d,l,o),v=h(u,c,o),f=(t.scrollLeft+i.vx-s-m)/n*o+s+p,y=(t.scrollTop+i.vy-s-g)/n*o+s+v,b="center"===r?f-t.clientWidth/2:f-i.vx,w="center"===r?y-t.clientHeight/2:y-i.vy;return{desiredScrollLeft:Math.max(0,b),desiredScrollTop:Math.max(0,w)}}handleZoomToArea(e,t,n){const o=this.coreState.core.documents[e];if(!o)return;const i=o.rotation,r=this.viewport.forDocument(e).getMetrics(),a=this.viewport.getViewportGap(),s=this.getDocumentStateOrThrow(e).currentZoomLevel,l=r.clientWidth-2*a,c=r.clientHeight-2*a,d=this.scroll.forDocument(e).getLayout(),u=d.virtualItems.find(e=>e.pageLayouts.some(e=>e.pageIndex===t));if(!u)return;const h=u.pageLayouts.find(e=>e.pageIndex===t),m=tt({width:h.width,height:h.height},n,i),g=this.toZoom(Math.min(l/m.size.width,c/m.size.height)),p=u.x+h.x,v=u.y+h.y,f=p+m.origin.x+m.size.width/2,y=v+m.origin.y+m.size.height/2,b=(e,t,n)=>t*n<e?(e-t*n)/2:0,w=b(l,d.totalContentSize.width,s),x=b(c,d.totalContentSize.height,s),C=a+w+f*s-r.scrollLeft,I=a+x+y*s-r.scrollTop;this.handleRequest({level:g,center:{vx:C,vy:I},align:"center"},e)}recalcAuto(e,t){const n=this.getDocumentState(e);n&&(n.zoomLevel!==ga.Automatic&&n.zoomLevel!==ga.FitPage&&n.zoomLevel!==ga.FitWidth||this.handleRequest({level:n.zoomLevel,focus:t},e))}normalizeRanges(e){return[...e].filter(e=>e.step>0&&e.max>e.min).sort((e,t)=>e.min-t.min)}stepFor(e){const t=this.zoomRanges.find(t=>e>=t.min&&e<t.max);return t?t.step:this.zoomStep}toZoom(e){return parseFloat(eo(e,this.minZoom,this.maxZoom).toFixed(2))}registerMarqueeOnPage(e){if(!this.interactionManager)return this.logger.warn("ZoomPlugin","MissingDependency","Interaction manager plugin not loaded, marquee zoom disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!t||!t.document)return this.logger.warn("ZoomPlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("ZoomPlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r,onSmallDrag:a}=e;let s=null,l=null;return{onPointerDown:(e,t)=>{var n;s=e,l={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(l),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!s)return;const n=eo(e.x,0,t.width),o=eo(e.y,0,t.height);l={origin:{x:Math.min(s.x,n),y:Math.min(s.y,o)},size:{width:Math.abs(n-s.x),height:Math.abs(o-s.y)}},null==i||i(l)},onPointerUp:(e,t)=>{var c;l&&(Math.max(l.size.width,l.size.height)*n>o?null==r||r(l):null==a||a()),s=null,l=null,null==i||i(null),null==(c=t.releasePointerCapture)||c.call(t)},onPointerCancel:(e,t)=>{var n;s=null,l=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;this.zoomToArea(e.pageIndex,t,e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t)},onSmallDrag:()=>{var t,n;this.zoomIn(e.documentId),null==(n=(t=e.callback).onSmallDrag)||n.call(t)}});return this.interactionManager.registerHandlers({documentId:e.documentId,modeId:"marqueeZoom",handlers:o,pageIndex:e.pageIndex})}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o&&i&&(o.currentZoomLevel!==i.currentZoomLevel||o.zoomLevel!==i.zoomLevel||o.isMarqueeZoomActive!==i.isMarqueeZoomActive)&&this.state$.emit({documentId:n,state:i})}}async initialize(){this.logger.info("ZoomPlugin","Initialize","Zoom plugin initialized")}async destroy(){this.zoom$.clear(),this.state$.clear(),super.destroy()}};Sa.id="zoom";let ka=Sa;const Da={manifest:fa,create:(e,t)=>new ka(va,e,t),reducer:(e=Ia,t)=>{switch(t.type){case ya:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case ba:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ZOOM/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case wa:{const{documentId:n,zoomLevel:o,currentZoomLevel:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,zoomLevel:o,currentZoomLevel:i}}}:e}case xa:{const{documentId:n,isActive:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isMarqueeZoomActive:o}}}:e}default:return e}},initialState:Ia},Ma=()=>po(ka.id);function Pa(e){const[t,n]=[e[0],e[1]],o=n.clientX-t.clientX,i=n.clientY-t.clientY;return Math.hypot(o,i)}function Aa(e,t={}){const{provides:n}=po("viewport"),{provides:o}=Ma(),i=Ee($o),r=Ae(null);return Pe(()=>{const a=r.current,s=null==i?void 0:i.current;if(a&&s&&o)return function({element:e,container:t,documentId:n,zoomProvides:o,viewportGap:i=0,options:r={}}){const{enablePinch:a=!0,enableWheel:s=!0}=r;if("undefined"==typeof window)return()=>{};const l=o.forDocument(n),c=()=>l.getState();let d=0,u=1,h=!1,m=0,g=null,p=1,v=0,f=0,y=0,b=0,w=0,x=0,C=0,I=0,S=0,k=0,D=0,M=0,P=0;const A=(e,t,n)=>Math.min(Math.max(e,t),n),T=()=>{const n=t.clientWidth-2*i,o=e.offsetWidth,r=o<n?(n-o)/2:0;e.style.marginLeft=`${r}px`},z=e=>{const t=v*e,n=f*e;let o=S*(1-e);const i=I-t/2-y,r=k-P*e-y,a=Math.max(0,t-C),s=.3*C,l=Math.min(1,a/s);let c=i+(r-i)*l;return n>x-2*M&&(o=A(b+o,x-M-n,M)-b),t>w-2*M&&(c=A(y+c,w-M-t,M)-y),{tx:c,ty:o,blend:l,finalWidth:t}},E=t=>{u=t;const{tx:n,ty:o}=z(t);e.style.transformOrigin="0 0",e.style.transform=`translate(${n}px, ${o}px) scale(${t})`},_=()=>{e.style.transform="none",e.style.transformOrigin="0 0",u=1},R=()=>{const{tx:e,finalWidth:t}=z(u),n=(u-1)*d;let o,i=D;if(t<=C)o=I;else{const t=1-u;o=Math.abs(t)>.001?y+e/t:k}l.requestZoomBy(n,{vx:o,vy:i}),_(),d=0},N=(n,o)=>{const r=t.getBoundingClientRect(),a=e.getBoundingClientRect();M=i,v=a.width,f=a.height,y=a.left-r.left,b=a.top-r.top,w=r.width,x=r.height,C=t.clientWidth,I=t.clientLeft+C/2;const s=n-a.left;S=o-a.top,k=n-r.left,D=o-r.top,P=v<C?k*v/C:s},O=e=>{if(2!==e.touches.length)return;h=!0,d=c().currentZoomLevel,m=Pa(e.touches);const t=function(e){const[t,n]=[e[0],e[1]];return{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}(e.touches);N(t.x,t.y),e.preventDefault()},L=e=>{if(!h||2!==e.touches.length)return;const t=Pa(e.touches);E(t/m),e.preventDefault()},$=e=>{h&&(e.touches.length>=2||(h=!1,R()))},F=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),null===g?(d=c().currentZoomLevel,p=1,N(e.clientX,e.clientY)):clearTimeout(g);const t=1-.01*e.deltaY;p*=t,p=Math.max(.1,Math.min(10,p)),E(p),g=setTimeout(()=>{g=null,R(),p=1},150)},j=l.onStateChange(()=>T()),H=new ResizeObserver(()=>T());return H.observe(e),H.observe(t),T(),a&&(t.addEventListener("touchstart",O,{passive:!1}),t.addEventListener("touchmove",L,{passive:!1}),t.addEventListener("touchend",$),t.addEventListener("touchcancel",$)),s&&t.addEventListener("wheel",F,{passive:!1}),()=>{a&&(t.removeEventListener("touchstart",O),t.removeEventListener("touchmove",L),t.removeEventListener("touchend",$),t.removeEventListener("touchcancel",$)),s&&t.removeEventListener("wheel",F),g&&clearTimeout(g),j(),H.disconnect(),_(),e.style.marginLeft=""}}({element:a,container:s,documentId:e,zoomProvides:o,viewportGap:(null==n?void 0:n.getViewportGap())||0,options:t})},[n,o,e,i,t.enablePinch,t.enableWheel]),{elementRef:r}}function Ta({children:e,documentId:t,style:n,enablePinch:o=!0,enableWheel:i=!0,...r}){const a=Te(()=>({enablePinch:o,enableWheel:i}),[o,i]),{elementRef:s}=Aa(t,a);return Ue("div",{ref:s,...r,style:{...n,display:"inline-block",overflow:"visible",boxSizing:"border-box"},children:e})}const za=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="rgba(33,150,243,0.8)",fill:r="rgba(33,150,243,0.15)"})=>{const{provides:a}=Ma(),s=fo(e),[l,c]=ke(null),d=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Me(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?Ue("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null},Ea=class extends Yn{constructor(e,t,n){super(e,t),this.config=n}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e)}}renderPage({pageIndex:e,options:t},n){const o=n??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))throw new Error(`Document ${o} not loaded`);const r=i.document.pages.find(t=>t.index===e);if(!r)throw new Error(`Page ${e} not found in document ${o}`);const a={...t??{},withForms:(null==t?void 0:t.withForms)??this.config.withForms??!1,withAnnotations:(null==t?void 0:t.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==t?void 0:t.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==t?void 0:t.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPage(i.document,r,a)}renderPageRect({pageIndex:e,rect:t,options:n},o){const i=o??this.getActiveDocumentId(),r=this.coreState.core.documents[i];if(!(null==r?void 0:r.document))throw new Error(`Document ${i} not loaded`);const a=r.document.pages.find(t=>t.index===e);if(!a)throw new Error(`Page ${e} not found in document ${i}`);const s={...n??{},withForms:(null==n?void 0:n.withForms)??this.config.withForms??!1,withAnnotations:(null==n?void 0:n.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==n?void 0:n.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==n?void 0:n.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPageRect(r.document,a,t,s)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};Ea.id="render";let _a=Ea;const Ra="render",Na={manifest:{id:Ra,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new _a(Ra,e,t),reducer:()=>{},initialState:{}};function Oa({documentId:e,pageIndex:t,scale:n,dpr:o,style:i,...r}){const{provides:a}=po(_a.id),s=fo(e),[l,c]=ke(null),d=Ae(null),u=Te(()=>s&&s.pageRefreshVersions[t]||0,[s,t]),h=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),m=Te(()=>void 0!==o?o:window.devicePixelRatio,[o]);Me(()=>{if(!a)return;const n=a.forDocument(e).renderPage({pageIndex:t,options:{scaleFactor:h,dpr:m}});return n.wait(e=>{const t=URL.createObjectURL(e);c(t),d.current=t},wn),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):n.abort({code:Ht.Cancelled,message:"canceled render task"})}},[e,t,h,m,a,u]);return Ue(U,{children:l&&Ue("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...r,style:{width:"100%",height:"100%",...i||{}}})})}const La="rotate",$a={id:La,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const Fa="ROTATE/INIT_STATE",ja="ROTATE/CLEANUP_STATE",Ha="ROTATE/SET_ROTATION";const Ua=class extends Yn{constructor(e,t,n){super(e,t),this.rotate$=ao(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:Fa,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(Wn(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:ja,payload:e}}(e)),this.logger.debug("RotatePlugin","DocumentClosed",`Cleaned up rotation state for document: ${e}`)}buildCapability(){return{setRotation:e=>this.setRotationForDocument(e),getRotation:()=>this.getRotationForDocument(),rotateForward:()=>this.rotateForward(),rotateBackward:()=>this.rotateBackward(),forDocument:e=>this.createRotateScope(e),onRotateChange:this.rotate$.on}}createRotateScope(e){return{setRotation:t=>this.setRotationForDocument(t,e),getRotation:()=>this.getRotationForDocument(e),rotateForward:()=>this.rotateForward(e),rotateBackward:()=>this.rotateBackward(e),onRotateChange:t=>this.rotate$.on(n=>{n.documentId===e&&t(n.rotation)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Rotation state not found for document: ${e??"active"}`);return t}setRotationForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.coreState.core.documents[n];if(!(null==o?void 0:o.document))throw new Error(`Document ${n} not loaded`);this.dispatch(function(e,t){return{type:Ha,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(Wn(e,n)),this.rotate$.emit({documentId:n,rotation:e})}getRotationForDocument(e){return this.getDocumentStateOrThrow(e).rotation}rotateForward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),o=(n+1)%4;this.setRotationForDocument(o,t)}rotateBackward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),o=(n+3)%4;this.setRotationForDocument(o,t)}getMatrixAsString(e){return function(e,t,n){const[o,i,r,a,s,l]=function(e,t,n){let o=1,i=0,r=0,a=1,s=0,l=0;switch(e){case 1:o=0,i=1,r=-1,a=0,s=n;break;case 2:o=-1,i=0,r=0,a=-1,s=t,l=n;break;case 3:o=0,i=-1,r=1,a=0,l=t}return[o,i,r,a,s,l]}(e,t,n);return`matrix(${o},${i},${r},${a},${s},${l})`}(e.rotation,e.width,e.height)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.rotation)!==i.rotation&&this.logger.debug("RotatePlugin","RotationChanged",`Rotation changed for document ${n}: ${(null==o?void 0:o.rotation)??0} -> ${i.rotation}`)}}async initialize(e){this.logger.info("RotatePlugin","Initialize","Rotate plugin initialized")}async destroy(){this.rotate$.clear(),super.destroy()}};Ua.id="rotate";let Wa=Ua;const Ba={documents:{},activeDocumentId:null},qa={manifest:$a,create:(e,t)=>new Wa(La,e,t),reducer:(e=Ba,t)=>{switch(t.type){case Fa:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case ja:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ROTATE/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Ha:{const{documentId:n,rotation:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,rotation:o}}}:e}default:return e}},initialState:Ba};function Ga({children:e,documentId:t,pageIndex:n,rotation:o,scale:i,style:r,...a}){var s,l,c,d;const{plugin:u}=go(Wa.id),h=fo(t),m=null==(l=null==(s=null==h?void 0:h.document)?void 0:s.pages)?void 0:l[n],g=(null==(c=null==m?void 0:m.size)?void 0:c.width)??0,p=(null==(d=null==m?void 0:m.size)?void 0:d.height)??0,v=o??(null==h?void 0:h.rotation)??0,f=i??(null==h?void 0:h.scale)??1,y=(null==u?void 0:u.getMatrixAsString({width:g*f,height:p*f,rotation:v}))??"matrix(1, 0, 0, 1, 0, 0)";return m?Ue("div",{...a,style:{position:"absolute",transformOrigin:"0 0",transform:y,...r},children:e}):null}const Va="SEARCH/INIT_STATE",Za="SEARCH/CLEANUP_STATE",Ka="SEARCH/START_SEARCH_SESSION",Ya="SEARCH/STOP_SEARCH_SESSION",Xa="SEARCH/SET_SEARCH_FLAGS",Qa="SEARCH/SET_SHOW_ALL_RESULTS",Ja="SEARCH/START_SEARCH",es="SEARCH/SET_SEARCH_RESULTS",ts="SEARCH/APPEND_SEARCH_RESULTS",ns="SEARCH/SET_ACTIVE_RESULT_INDEX";function os(e,t){return{type:Qa,payload:{documentId:e,showAll:t}}}function is(e,t,n,o){return{type:es,payload:{documentId:e,results:t,total:n,activeResultIndex:o}}}function rs(e,t){return{type:ns,payload:{documentId:e,index:t}}}const as={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},ss={documents:{}},ls=(e,t,n)=>{const o=e.documents[t]||as;return{...e,documents:{...e.documents,[t]:{...o,...n}}}},cs=class extends Yn{constructor(e,t,n){super(e,t),this.searchStop$=ao(),this.searchStart$=ao(),this.searchResult$=ao(),this.searchActiveResultChange$=ao(),this.searchResultState$=ao(),this.searchState$=ao(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...as,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:Va,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:Za,payload:e}}(e)),this.currentTask.delete(e)}async initialize(){}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.searchState$.emit({documentId:n,state:i}),o&&o.results===i.results&&o.activeResultIndex===i.activeResultIndex&&o.showAllResults===i.showAllResults&&o.active===i.active||this.searchResultState$.emit({documentId:n,state:{results:i.results,activeResultIndex:i.activeResultIndex,showAllResults:i.showAllResults,active:i.active}}))}}buildCapability(){const e=e=>e??this.getActiveDocumentId(),t=t=>{const n=e(t),o=this.state.documents[n];if(!o)throw new Error(`Search state not found for document ${n}`);return o};return{startSearch:t=>this.startSearchSession(e(t)),stopSearch:t=>this.stopSearchSession(e(t)),searchAllPages:(t,n)=>this.searchAllPages(t,e(n)),nextResult:t=>this.nextResult(e(t)),previousResult:t=>this.previousResult(e(t)),goToResult:(t,n)=>this.goToResult(t,e(n)),setShowAllResults:(t,n)=>this.dispatch(os(e(n),t)),getShowAllResults:e=>t(e).showAllResults,getFlags:e=>t(e).flags,setFlags:(t,n)=>this.setFlags(t,e(n)),getState:e=>t(e),forDocument:this.createSearchScope.bind(this),onSearchResult:this.searchResult$.on,onSearchStart:this.searchStart$.on,onSearchStop:this.searchStop$.on,onActiveResultChange:this.searchActiveResultChange$.on,onSearchResultStateChange:this.searchResultState$.on,onStateChange:this.searchState$.on}}createSearchScope(e){const t=()=>{const t=this.state.documents[e];if(!t)throw new Error(`Search state not found for document ${e}`);return t};return{startSearch:()=>this.startSearchSession(e),stopSearch:()=>this.stopSearchSession(e),searchAllPages:t=>this.searchAllPages(t,e),nextResult:()=>this.nextResult(e),previousResult:()=>this.previousResult(e),goToResult:t=>this.goToResult(t,e),setShowAllResults:t=>this.dispatch(os(e,t)),getShowAllResults:()=>t().showAllResults,getFlags:()=>t().flags,setFlags:t=>this.setFlags(t,e),getState:t,onSearchResult:t=>this.searchResult$.on(n=>{n.documentId===e&&t(n.results)}),onSearchStart:t=>this.searchStart$.on(n=>{n.documentId===e&&t()}),onSearchStop:t=>this.searchStop$.on(n=>{n.documentId===e&&t()}),onActiveResultChange:t=>this.searchActiveResultChange$.on(n=>{n.documentId===e&&t(n.index)}),onSearchResultStateChange:t=>this.searchResultState$.on(n=>{n.documentId===e&&t(n.state)}),onStateChange:t=>this.searchState$.on(n=>{n.documentId===e&&t(n.state)})}}setFlags(e,t){this.dispatch(function(e,t){return{type:Xa,payload:{documentId:e,flags:t}}}(t,e));const n=this.state.documents[t];(null==n?void 0:n.active)&&this.searchAllPages(n.query,t,!0)}notifySearchStart(e){this.searchStart$.emit({documentId:e})}notifySearchStop(e){this.searchStop$.emit({documentId:e})}notifyActiveResultChange(e,t){this.searchActiveResultChange$.emit({documentId:e,index:t})}startSearchSession(e){this.getCoreDocument(e)&&(this.dispatch(function(e){return{type:Ka,payload:{documentId:e}}}(e)),this.notifySearchStart(e))}stopSearchSession(e){var t;const n=this.state.documents[e];if(!(null==n?void 0:n.active))return;const o=this.currentTask.get(e);if(o){try{null==(t=o.abort)||t.call(o,{code:Ht.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:Ya,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var o;const i=this.state.documents[t];if(!i)return Ut.reject({code:Ht.NotFound,message:"Search state not initialized"});const r=this.getCoreDocument(t);if(!(null==r?void 0:r.document))return Ut.reject({code:Ht.NotFound,message:"Document not loaded"});const a=e.trim();if(i.query===a&&!n)return Ut.resolve({results:i.results,total:i.total});const s=this.currentTask.get(t);if(s){try{null==(o=s.abort)||o.call(s,{code:Ht.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:Ja,payload:{documentId:e,query:t}}}(t,a)),!a)return this.dispatch(is(t,[],0,-1)),Ut.resolve({results:[],total:0});i.active||this.startSearchSession(t);const l=this.engine.searchAllPages(r.document,a,{flags:i.flags});return this.currentTask.set(t,l),l.onProgress(e=>{var n;(null==(n=null==e?void 0:e.results)?void 0:n.length)&&this.currentTask.get(t)===l&&(this.dispatch(function(e,t){return{type:ts,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(rs(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch(is(t,e.results,e.total,n)),this.searchResult$.emit({documentId:t,results:e}),e.total>0&&this.notifyActiveResultChange(t,0)},e=>{var n;(null==(n=null==e?void 0:e.reason)?void 0:n.code)!==Ht.Cancelled&&(console.error("Error during search:",e),this.dispatch(is(t,[],0,-1))),this.currentTask.delete(t)}),l}nextResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex>=t.results.length-1?0:t.activeResultIndex+1;return this.goToResult(n,e)}previousResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex<=0?t.results.length-1:t.activeResultIndex-1;return this.goToResult(n,e)}goToResult(e,t){const n=this.state.documents[t];return!n||0===n.results.length||e<0||e>=n.results.length?-1:(this.dispatch(rs(t,e)),this.notifyActiveResultChange(t,e),e)}async destroy(){for(const e of Object.keys(this.state.documents))this.stopSearchSession(e);this.searchResult$.clear(),this.searchStart$.clear(),this.searchStop$.clear(),this.searchActiveResultChange$.clear(),this.searchResultState$.clear(),this.searchState$.clear(),super.destroy()}};cs.id="search";let ds=cs;const us="search",hs={manifest:{id:us,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new ds(us,e,t),reducer:(e=ss,t)=>{switch(t.type){case Va:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case Za:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Ka:return ls(e,t.payload.documentId,{active:!0});case Ya:return ls(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case Xa:return ls(e,t.payload.documentId,{flags:t.payload.flags});case Qa:return ls(e,t.payload.documentId,{showAllResults:t.payload.showAll});case Ja:return ls(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case ts:{const{documentId:n,results:o}=t.payload,i=e.documents[n];if(!i)return e;const r=[...i.results,...o],a=-1===i.activeResultIndex&&r.length>0?0:i.activeResultIndex;return ls(e,n,{results:r,total:r.length,activeResultIndex:a,loading:!0})}case es:{const{documentId:n,results:o,total:i,activeResultIndex:r}=t.payload;return ls(e,n,{results:o,total:i,activeResultIndex:r,loading:!1})}case ns:return ls(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:ss},ms=()=>po(ds.id);function gs({documentId:e,pageIndex:t,scale:n,style:o,highlightColor:i="#FFFF00",activeHighlightColor:r="#FFBF00",...a}){const{provides:s}=ms(),[l,c]=ke(null),d=fo(e),u=Te(()=>null==s?void 0:s.forDocument(e),[s,e]),h=Te(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);if(Me(()=>{if(!u)return void c(null);const e=u.getState();return c({results:e.results,activeResultIndex:e.activeResultIndex,showAllResults:e.showAllResults,active:e.active}),u.onSearchResultStateChange(e=>{c(e)})},[u]),!l||!l.active)return null;return Ue("div",{style:{...o,pointerEvents:"none"},...a,children:l.results.map((e,t)=>({result:e,originalIndex:t})).filter(({result:e})=>e.pageIndex===t).filter(({originalIndex:e})=>l.showAllResults||e===l.activeResultIndex).map(({result:e,originalIndex:t})=>e.rects.map((e,n)=>Ue("div",{style:{position:"absolute",top:e.origin.y*h,left:e.origin.x*h,width:e.size.width*h,height:e.size.height*h,backgroundColor:t===l.activeResultIndex?r:i,mixBlendMode:"multiply",transform:"scale(1.02)",transformOrigin:"center",transition:"opacity .3s ease-in-out",opacity:1}},`${t}-${n}`)))})}const ps="selection",vs={id:ps,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},fs="SELECTION/INIT_STATE",ys="SELECTION/CLEANUP_STATE",bs="SELECTION/CACHE_PAGE_GEOMETRY",ws="SELECTION/SET_SELECTION",xs="SELECTION/START_SELECTION",Cs="SELECTION/END_SELECTION",Is="SELECTION/CLEAR_SELECTION",Ss="SELECTION/SET_RECTS",ks="SELECTION/SET_SLICES",Ds={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},Ms={documents:{}},Ps=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function As(e,t){return e.rects[t]??[]}function Ts(e,t){return it(As(e,t))}function zs(e){const t=[],n=e.rects;for(const e in n){const o=Number(e),i=it(n[o]);i&&t.push({page:o,rect:i})}return t}function Es(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const o=Ts(e,t);return o?{pageIndex:t,rect:o,segmentRects:n}:null}function _s(e){const t=[],n=Object.keys(e.rects).map(Number);for(const o of n){const n=e.rects[o]||[];if(0===n.length)continue;const i=Ts(e,o);i&&t.push({pageIndex:o,rect:i,segmentRects:n})}return t}function Rs(e,t){for(const n of e.runs){if(!(t.y>=n.rect.y&&t.y<=n.rect.y+n.rect.height&&t.x>=n.rect.x&&t.x<=n.rect.x+n.rect.width))continue;const e=n.glyphs.findIndex(e=>t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height);if(-1!==e)return n.charStart+e}return-1}function Ns(e,t,n){if(!e||!t)return null;if(n<e.start.page||n>e.end.page)return null;const o=n===e.start.page?e.start.index:0,i=t.runs[t.runs.length-1],r=i.charStart+i.glyphs.length-1;return{from:o,to:n===e.end.page?e.end.index:r}}function Os(e,t,n,o=!0){const i=[];for(const o of e.runs){const e=o.charStart,r=e+o.glyphs.length-1;if(r<t||e>n)continue;const a=Math.max(t,e)-e,s=Math.min(n,r)-e;let l=1/0,c=-1/0,d=1/0,u=-1/0,h=0;for(let e=a;e<=s;e++){const t=o.glyphs[e];2!==t.flags&&(l=Math.min(l,t.x),c=Math.max(c,t.x+t.width),d=Math.min(d,t.y),u=Math.max(u,t.y+t.height),h++)}l!==1/0&&h>0&&i.push({rect:{origin:{x:l,y:d},size:{width:c-l,height:u-d}},charCount:h})}return o?function(e){const t=[];let n=null,o=null;for(const i of e)n&&o?js(n,i)?o=Ls(o,i.rect):(t.push(o),o=i.rect):o=i.rect,n=i;o&&!$s(o)&&t.push(o);return t}(i):i.map(e=>e.rect)}function Ls(e,t){const n=Math.min(e.origin.x,t.origin.x),o=Math.min(e.origin.y,t.origin.y);return{origin:{x:n,y:o},size:{width:Math.max(e.origin.x+e.size.width,t.origin.x+t.size.width)-n,height:Math.max(e.origin.y+e.size.height,t.origin.y+t.size.height)-o}}}function $s(e){return e.size.width<=0||e.size.height<=0}function Fs(e,t){if($s(e)||$s(t))return 0;const n=Ls(e,t);if(n.size.height===e.size.height||n.size.height===t.size.height)return 1;const o=function(e,t){const n=Math.max(e.origin.x,t.origin.x),o=Math.max(e.origin.y,t.origin.y),i=Math.min(e.origin.x+e.size.width,t.origin.x+t.size.width),r=Math.min(e.origin.y+e.size.height,t.origin.y+t.size.height);return{origin:{x:n,y:o},size:{width:Math.max(0,i-n),height:Math.max(0,r-o)}}}(e,t);return o.size.height/n.size.height}function js(e,t){const n=e.rect,o=t.rect;if(Fs(n,o)<.8)return!1;const i=1*n.size.width/e.charCount,r=1*o.size.width/t.charCount,a=n.origin.x-i,s=n.origin.x+n.size.width+i,l=o.origin.x-r;return a<o.origin.x+o.size.width+r&&s>l}const Hs=class extends Yn{constructor(e,t,n){var o,i,r;super(e,t),this.enabledModesPerDoc=new Map,this.selecting=new Map,this.anchor=new Map,this.pageCallbacks=new Map,this.menuPlacement$=so((e,t)=>({documentId:e,placement:t})),this.selChange$=so((e,t)=>({documentId:e,selection:t})),this.textRetrieved$=so((e,t)=>({documentId:e,text:t})),this.copyToClipboard$=so((e,t)=>({documentId:e,text:t}),{cache:!1}),this.beginSelection$=so((e,t)=>({documentId:e,page:t.page,index:t.index}),{cache:!1}),this.endSelection$=so(e=>({documentId:e}),{cache:!1}),this.viewportCapability=null,this.scrollCapability=null,this.menuHeight=n.menuHeight??40;const a=t.getPlugin("interaction-manager");if(!a)throw new Error("SelectionPlugin: InteractionManagerPlugin is required.");this.interactionManagerCapability=a.provides(),this.viewportCapability=(null==(o=t.getPlugin("viewport"))?void 0:o.provides())??null,this.scrollCapability=(null==(i=t.getPlugin("scroll"))?void 0:i.provides())??null,this.coreStore.onAction(On,e=>{const{documentId:t,pageIndexes:n}=e.payload,o=n.map(e=>this.getNewPageGeometryAndCache(t,e));gt.all(o).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},wn)}),null==(r=this.viewportCapability)||r.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:fs,payload:{documentId:e,state:t}}))(e,Ds)),this.enabledModesPerDoc.set(e,new Set(["pointerMode"])),this.pageCallbacks.set(e,new Map),this.selecting.set(e,!1),this.anchor.set(e,void 0)}onDocumentClosed(e){this.dispatch((e=>({type:ys,payload:e}))(e)),this.enabledModesPerDoc.delete(e),this.pageCallbacks.delete(e),this.selecting.delete(e),this.anchor.delete(e),this.selChange$.clearScope(e),this.textRetrieved$.clearScope(e),this.copyToClipboard$.clearScope(e),this.beginSelection$.clearScope(e),this.endSelection$.clearScope(e),this.menuPlacement$.clearScope(e)}async initialize(){}async destroy(){this.selChange$.clear(),this.textRetrieved$.clear(),this.copyToClipboard$.clear(),this.beginSelection$.clear(),this.endSelection$.clear(),this.menuPlacement$.clear(),super.destroy()}buildCapability(){const e=e=>e??this.getActiveDocumentId();return{getFormattedSelection:t=>_s(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>Es(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>As(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>Ts(this.getDocumentState(e(n)),t),getBoundingRects:t=>zs(this.getDocumentState(e(t))),getSelectedText:t=>this.getSelectedText(e(t)),clear:t=>this.clearSelection(e(t)),copyToClipboard:t=>this.copyToClipboard(e(t)),getState:t=>this.getDocumentState(e(t)),enableForMode:(t,n)=>{var o;return null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.add(t)},isEnabledForMode:(t,n)=>{var o;return(null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.has(t))??!1},forDocument:this.createSelectionScope.bind(this),onCopyToClipboard:this.copyToClipboard$.onGlobal,onSelectionChange:this.selChange$.onGlobal,onTextRetrieved:this.textRetrieved$.onGlobal,onBeginSelection:this.beginSelection$.onGlobal,onEndSelection:this.endSelection$.onGlobal}}createSelectionScope(e){return{getFormattedSelection:()=>_s(this.getDocumentState(e)),getFormattedSelectionForPage:t=>Es(this.getDocumentState(e),t),getHighlightRectsForPage:t=>As(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>Ts(this.getDocumentState(e),t),getBoundingRects:()=>zs(this.getDocumentState(e)),getSelectedText:()=>this.getSelectedText(e),clear:()=>this.clearSelection(e),copyToClipboard:()=>this.copyToClipboard(e),getState:()=>this.getDocumentState(e),onSelectionChange:this.selChange$.forScope(e),onTextRetrieved:this.textRetrieved$.forScope(e),onCopyToClipboard:this.copyToClipboard$.forScope(e),onBeginSelection:this.beginSelection$.forScope(e),onEndSelection:this.endSelection$.forScope(e)}}getDocumentState(e){const t=this.state.documents[e];if(!t)throw new Error(`Selection state not found for document: ${e}`);return t}onMenuPlacement(e,t){return this.menuPlacement$.forScope(e)(t)}registerSelectionOnPage(e){var t;const{documentId:n,pageIndex:o,onRectsChange:i}=e,r=this.state.documents[n];if(!r)return this.logger.warn("SelectionPlugin","RegisterFailed",`Cannot register selection on page ${o} for document ${n}: document state not initialized.`),()=>{};null==(t=this.pageCallbacks.get(n))||t.set(o,i);const a=this.getOrLoadGeometry(n,o),s=this.interactionManagerCapability.forDocument(n),l=this.enabledModesPerDoc.get(n);i({rects:As(r,o),boundingRect:Ts(r,o)});const c={onPointerDown:(e,t,i)=>{if(!(null==l?void 0:l.has(i)))return;this.clearSelection(n);const r=this.getDocumentState(n).geometry[o];if(r){const t=Rs(r,e);-1!==t&&this.beginSelection(n,o,t)}},onPointerMove:(e,t,i)=>{if(!(null==l?void 0:l.has(i)))return;const r=this.getDocumentState(n).geometry[o];if(r){const t=Rs(r,e);-1!==t?s.setCursor("selection-text","text",10):s.removeCursor("selection-text"),this.selecting.get(n)&&-1!==t&&this.updateSelection(n,o,t)}},onPointerUp:(e,t,o)=>{(null==l?void 0:l.has(o))&&this.endSelection(n)},onHandlerActiveEnd:e=>{(null==l?void 0:l.has(e))&&this.clearSelection(n)}},d=this.interactionManagerCapability.registerAlways({scope:{type:"page",documentId:n,pageIndex:o},handlers:c});return()=>{var e;d(),null==(e=this.pageCallbacks.get(n))||e.delete(o),a.abort({code:Ht.Cancelled,message:"Cleanup"})}}getPlacementMetrics(e,t,n,o){var i;const r=null==(i=this.scrollCapability)?void 0:i.forDocument(e),a=null==r?void 0:r.getRectPositionForPage(t,n);if(!a)return null;const s=a.origin.y-o.scrollTop,l=a.origin.y+a.size.height-o.scrollTop;return{pageIndex:t,rect:n,spaceAbove:s,spaceBelow:o.clientHeight-l,isBottomVisible:l>0&&l<=o.clientHeight,isTopVisible:s>=0&&s<o.clientHeight}}recalculateMenuPlacement(e){const t=this.state.documents[e];if(!t)return;if(t.selecting||null===t.selection)return void this.menuPlacement$.emit(e,null);const n=zs(t);if(0===n.length)return void this.menuPlacement$.emit(e,null);const o=n[n.length-1];if(!this.viewportCapability||!this.scrollCapability)return void this.menuPlacement$.emit(e,{pageIndex:o.page,rect:o.rect,spaceAbove:0,spaceBelow:1/0,suggestTop:!1,isVisible:!0});const i=this.viewportCapability.forDocument(e).getMetrics(),r=n[0],a=this.getPlacementMetrics(e,o.page,o.rect,i),s=this.getPlacementMetrics(e,r.page,r.rect,i);a&&a.isBottomVisible&&a.spaceBelow>this.menuHeight?this.menuPlacement$.emit(e,{...a,suggestTop:!1,isVisible:!0}):s&&s.isTopVisible?this.menuPlacement$.emit(e,{...s,suggestTop:!0,isVisible:!0}):a&&a.isBottomVisible?this.menuPlacement$.emit(e,{...a,suggestTop:!1,isVisible:!0}):this.menuPlacement$.emit(e,null)}notifyPage(e,t){var n;const o=null==(n=this.pageCallbacks.get(e))?void 0:n.get(t);if(o){const n=this.getDocumentState(e);o("pointerMode"===this.interactionManagerCapability.forDocument(e).getActiveMode()?{rects:As(n,t),boundingRect:Ts(n,t)}:{rects:[],boundingRect:null})}}notifyAllPages(e){var t;null==(t=this.pageCallbacks.get(e))||t.forEach((t,n)=>{this.notifyPage(e,n)})}getNewPageGeometryAndCache(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return Ut.reject({code:Ht.NotFound,message:"Doc Not Found"});const o=n.document.pages.find(e=>e.index===t),i=this.engine.getPageGeometry(n.document,o);return i.wait(n=>{this.dispatch(((e,t,n)=>({type:bs,payload:{documentId:e,page:t,geo:n}}))(e,t,n))},wn),i}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?Ut.resolve(n):this.getNewPageGeometryAndCache(e,t)}beginSelection(e,t,n){this.selecting.set(e,!0),this.anchor.set(e,{page:t,index:n}),this.dispatch((e=>({type:xs,payload:{documentId:e}}))(e)),this.beginSelection$.emit(e,{page:t,index:n}),this.recalculateMenuPlacement(e)}endSelection(e){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:Cs,payload:{documentId:e}}))(e)),this.endSelection$.emit(e),this.recalculateMenuPlacement(e)}clearSelection(e){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:Is,payload:{documentId:e}}))(e)),this.selChange$.emit(e,null),this.menuPlacement$.emit(e,null),this.notifyAllPages(e)}updateSelection(e,t,n){if(!this.selecting.get(e)||!this.anchor.get(e))return;const o=this.anchor.get(e),i=t>o.page||t===o.page&&n>=o.index,r={start:i?o:{page:t,index:n},end:i?{page:t,index:n}:o};this.dispatch(((e,t)=>({type:ws,payload:{documentId:e,selection:t}}))(e,r)),this.updateRectsAndSlices(e,r),this.selChange$.emit(e,r);for(let t=r.start.page;t<=r.end.page;t++)this.notifyPage(e,t)}updateRectsAndSlices(e,t){const n=this.getDocumentState(e),o={},i={};for(let e=t.start.page;e<=t.end.page;e++){const r=n.geometry[e],a=Ns(t,r,e);a&&(o[e]=Os(r,a.from,a.to),i[e]={start:a.from,count:a.to-a.from+1})}this.dispatch(((e,t)=>({type:Ss,payload:{documentId:e,rects:t}}))(e,o)),this.dispatch(((e,t)=>({type:ks,payload:{documentId:e,slices:t}}))(e,i))}getSelectedText(e){const t=this.getCoreDocument(e),n=this.getDocumentState(e);if(!(null==t?void 0:t.document)||!n.selection)return Ut.reject({code:Ht.NotFound,message:"Doc Not Found or No Selection"});const o=n.selection,i=[];for(let e=o.start.page;e<=o.end.page;e++){const t=n.slices[e];t&&i.push({pageIndex:e,charIndex:t.start,charCount:t.count})}if(0===i.length)return Ut.resolve([]);const r=this.engine.getTextSlices(t.document,i);return r.wait(t=>{this.textRetrieved$.emit(e,t)},wn),r}copyToClipboard(e){this.getSelectedText(e).wait(t=>{this.copyToClipboard$.emit(e,t.join("\n"))},wn)}};Hs.id="selection";let Us=Hs;const Ws={manifest:vs,create:(e,t)=>new Us(ps,e,t),reducer:(e=Ms,t)=>{switch(t.type){case fs:{const{documentId:n,state:o}=t.payload;return Ps(e,n,o)}case ys:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case bs:{const{documentId:n,page:o,geo:i}=t.payload,r=e.documents[n];return r?Ps(e,n,{...r,geometry:{...r.geometry,[o]:i}}):e}case ws:{const{documentId:n,selection:o}=t.payload,i=e.documents[n];return i?Ps(e,n,{...i,selection:o,active:!0}):e}case xs:{const{documentId:n}=t.payload,o=e.documents[n];return o?Ps(e,n,{...o,selecting:!0,selection:null,rects:{}}):e}case Cs:{const{documentId:n}=t.payload,o=e.documents[n];return o?Ps(e,n,{...o,selecting:!1}):e}case Is:{const{documentId:n}=t.payload,o=e.documents[n];return o?Ps(e,n,{...o,selecting:!1,selection:null,rects:{},active:!1}):e}case Ss:{const{documentId:n,rects:o}=t.payload,i=e.documents[n];return i?Ps(e,n,{...i,rects:o}):e}case ks:{const{documentId:n,slices:o}=t.payload,i=e.documents[n];return i?Ps(e,n,{...i,slices:o}):e}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?Ps(e,n,Ds):e}default:return e}},initialState:Ms};const Bs="onDblClick";function qs({children:e,...t}){const{rect:n,rotation:o}=t,{matrix:i,width:r,height:a}=function(e,t){const{width:n,height:o}=e.size;switch(t%4){case 1:return{matrix:`matrix(0, -1, 1, 0, 0, ${o})`,width:o,height:n};case 2:return{matrix:`matrix(-1, 0, 0, -1, ${n}, ${o})`,width:n,height:o};case 3:return{matrix:`matrix(0, 1, -1, 0, ${n}, 0)`,width:o,height:n};default:return{matrix:"matrix(1, 0, 0, 1, 0, 0)",width:n,height:o}}}(n,o),s=Ae(null);Me(()=>{const e=s.current;if(!e)return;const t=e=>{e.stopPropagation()},n=e=>{e.stopPropagation()};return e.addEventListener("pointerdown",t,{capture:!0}),e.addEventListener("touchstart",n,{capture:!0}),()=>{e.removeEventListener("pointerdown",t,{capture:!0}),e.removeEventListener("touchstart",n,{capture:!0})}},[]);return Ue(U,{children:e({menuWrapperProps:{style:{position:"absolute",left:n.origin.x,top:n.origin.y,transform:i,transformOrigin:"0 0",width:r,height:a,pointerEvents:"none",zIndex:3},ref:e=>{s.current=e}},matrix:i,rect:{origin:{x:n.origin.x,y:n.origin.y},size:{width:r,height:a}}})})}class Gs{constructor(e,t){this.config=e,this.onUpdate=t,this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.currentVertices=[],this.currentVertices=e.vertices||[]}updateConfig(e){this.config={...this.config,...e},this.currentVertices=e.vertices||[]}startDrag(e,t){this.state="dragging",this.startPoint={x:e,y:t},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"move",changes:{rect:this.startElement}}})}startResize(e,t,n){this.state="resizing",this.activeHandle=e,this.startPoint={x:t,y:n},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"resize",changes:{rect:this.startElement},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}startVertexEdit(e,t,n){this.currentVertices=[...this.config.vertices??this.currentVertices],e<0||e>=this.currentVertices.length||(this.state="vertex-editing",this.activeVertexIndex=e,this.startPoint={x:t,y:n},this.startVertices=[...this.currentVertices],this.onUpdate({state:"start",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:e}}}))}move(e,t){if("idle"!==this.state&&this.startPoint)if("dragging"===this.state&&this.startElement){const n=this.calculateDelta(e,t),o=this.calculateDragPosition(n);this.currentPosition=o,this.onUpdate({state:"move",transformData:{type:"move",changes:{rect:o}}})}else if("resizing"===this.state&&this.activeHandle&&this.startElement){const n=this.calculateDelta(e,t),o=this.calculateResizePosition(n,this.activeHandle);this.currentPosition=o,this.onUpdate({state:"move",transformData:{type:"resize",changes:{rect:o},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}else if("vertex-editing"===this.state&&null!==this.activeVertexIndex){const n=this.calculateVertexPosition(e,t);this.currentVertices=n,this.onUpdate({state:"move",transformData:{type:"vertex-edit",changes:{vertices:n},metadata:{vertexIndex:this.activeVertexIndex}}})}}end(){if("idle"===this.state)return;const e=this.state,t=this.activeHandle,n=this.activeVertexIndex;if("vertex-editing"===e)this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.currentVertices},metadata:{vertexIndex:n||void 0}}});else{const n=this.getCurrentPosition();this.onUpdate({state:"end",transformData:{type:"dragging"===e?"move":"resize",changes:{rect:n},metadata:"dragging"===e?void 0:{handle:t||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}})}this.reset()}cancel(){"idle"!==this.state&&("vertex-editing"===this.state?this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:this.activeVertexIndex||void 0}}}):this.startElement&&this.onUpdate({state:"end",transformData:{type:"dragging"===this.state?"move":"resize",changes:{rect:this.startElement},metadata:"dragging"===this.state?void 0:{handle:this.activeHandle||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}}),this.reset())}reset(){this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[]}getCurrentPosition(){return this.currentPosition||this.config.element}calculateDelta(e,t){if(!this.startPoint)return{x:0,y:0};const n={x:e-this.startPoint.x,y:t-this.startPoint.y};return this.transformDelta(n)}transformDelta(e){const{pageRotation:t=0,scale:n=1}=this.config,o=t*Math.PI/2,i=Math.cos(o),r=Math.sin(o),a=e.x/n,s=e.y/n;return{x:i*a+r*s,y:-r*a+i*s}}clampPoint(e){var t;const n=null==(t=this.config.constraints)?void 0:t.boundingBox;return n?{x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}:e}calculateVertexPosition(e,t){if(null===this.activeVertexIndex)return this.startVertices;const n=this.calculateDelta(e,t),o=[...this.startVertices],i=o[this.activeVertexIndex],r={x:i.x+n.x,y:i.y+n.y};return o[this.activeVertexIndex]=this.clampPoint(r),o}calculateDragPosition(e){if(!this.startElement)return this.config.element;const t={origin:{x:this.startElement.origin.x+e.x,y:this.startElement.origin.y+e.y},size:{width:this.startElement.size.width,height:this.startElement.size.height}};return this.applyConstraints(t)}calculateResizePosition(e,t){var n;if(!this.startElement)return this.config.element;let{origin:{x:o,y:i},size:{width:r,height:a}}=this.startElement;switch(t){case"se":r+=e.x,a+=e.y;break;case"sw":o+=e.x,r-=e.x,a+=e.y;break;case"ne":r+=e.x,i+=e.y,a-=e.y;break;case"nw":o+=e.x,r-=e.x,i+=e.y,a-=e.y;break;case"n":i+=e.y,a-=e.y;break;case"s":a+=e.y;break;case"e":r+=e.x;break;case"w":o+=e.x,r-=e.x}if(this.config.maintainAspectRatio&&this.startElement){const e=this.startElement.size.width/this.startElement.size.height;if(["n","s","e","w"].includes(t))if("n"===t||"s"===t){const t=a*e,n=t-r;r=t,o-=n/2}else{const n=r/e,s=n-a;a=n,"w"===t&&(o=this.startElement.origin.x+this.startElement.size.width-r),i-=s/2}else{Math.abs(r-this.startElement.size.width)>Math.abs(a-this.startElement.size.height)?a=r/e:r=a*e,t.includes("w")&&(o=this.startElement.origin.x+this.startElement.size.width-r),t.includes("n")&&(i=this.startElement.origin.y+this.startElement.size.height-a)}}const s=null==(n=this.config.constraints)?void 0:n.boundingBox;if(s)switch(t){case"e":r=Math.min(r,s.width-o);break;case"s":a=Math.min(a,s.height-i);break;case"se":r=Math.min(r,s.width-o),a=Math.min(a,s.height-i);break;case"w":o<0&&(r+=o,o=0);break;case"n":i<0&&(a+=i,i=0);break;case"sw":o<0&&(r+=o,o=0),a=Math.min(a,s.height-i);break;case"nw":o<0&&(r+=o,o=0),i<0&&(a+=i,i=0);break;case"ne":r=Math.min(r,s.width-o),i<0&&(a+=i,i=0)}return this.applyConstraints({origin:{x:o,y:i},size:{width:r,height:a}})}applyConstraints(e){const{constraints:t}=this.config;if(!t)return e;let{origin:{x:n,y:o},size:{width:i,height:r}}=e;return i=Math.max(t.minWidth||1,i),r=Math.max(t.minHeight||1,r),t.maxWidth&&(i=Math.min(t.maxWidth,i)),t.maxHeight&&(r=Math.min(t.maxHeight,r)),t.boundingBox&&(n=Math.max(0,Math.min(n,t.boundingBox.width-i)),o=Math.max(0,Math.min(o,t.boundingBox.height-r))),{origin:{x:n,y:o},size:{width:i,height:r}}}}function Vs(e,t){return"n"===e||"s"===e?"ns-resize":"e"===e||"w"===e?"ew-resize":t%2==0?{nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"}[e]:{nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"}[e]}function Zs(e,t,n){const o=-e/2;return"center"===n?o:"outside"===n?o-t:o+t}function Ks(e){const{controller:t,resizeUI:n,vertexUI:o,includeVertices:i=!1,handleAttrs:r,vertexAttrs:a}=e,{dragProps:s,createResizeProps:l,createVertexProps:c}=function(e){const{onUpdate:t,enabled:n=!0,...o}=e,i=Ae(null),r=Ae(t);Me(()=>{r.current=t},[t]),Me(()=>{i.current?i.current.updateConfig(o):i.current=new Gs(o,e=>{var t;return null==(t=r.current)?void 0:t.call(r,e)})},[o.element,o.constraints,o.maintainAspectRatio,o.pageRotation,o.scale,o.vertices]);const a=ze(e=>{var t;n&&(e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.startDrag(e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},[n]),s=ze(e=>{var t;e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.move(e.clientX,e.clientY)},[]),l=ze(e=>{var t,n,o;e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.end(),null==(o=(n=e.currentTarget).releasePointerCapture)||o.call(n,e.pointerId)},[]),c=ze(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startResize(e,t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:s,onPointerUp:l,onPointerCancel:l}),[n,s,l]),d=ze(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startVertexEdit(e,t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:s,onPointerUp:l,onPointerCancel:l}),[n,s,l]);return{dragProps:n?{onPointerDown:a,onPointerMove:s,onPointerUp:l,onPointerCancel:l}:{},createResizeProps:c,createVertexProps:d}}(t),d=Te(()=>function(e,t={}){const{handleSize:n=8,spacing:o=1,offsetMode:i="outside",includeSides:r=!1,zIndex:a=3,rotationAwareCursor:s=!0}=t,l=(e.pageRotation??0)%4,c=e=>({[e]:Zs(n,o,i)+"px"});return[["nw",{...c("top"),...c("left")}],["ne",{...c("top"),...c("right")}],["sw",{...c("bottom"),...c("left")}],["se",{...c("bottom"),...c("right")}],...r?[["n",{...c("top"),left:`calc(50% - ${n/2}px)`}],["s",{...c("bottom"),left:`calc(50% - ${n/2}px)`}],["w",{...c("left"),top:`calc(50% - ${n/2}px)`}],["e",{...c("right"),top:`calc(50% - ${n/2}px)`}]]:[]].map(([e,t])=>({handle:e,style:{position:"absolute",width:n+"px",height:n+"px",borderRadius:"50%",zIndex:a,cursor:s?Vs(e,l):"default",touchAction:"none",...t},attrs:{"data-epdf-handle":e}}))}(t,n).map(e=>{var t;return{key:null==(t=e.attrs)?void 0:t["data-epdf-handle"],style:e.style,...l(e.handle),...e.attrs??{},...(null==r?void 0:r(e.handle))??{}}}),[t.element.origin.x,t.element.origin.y,t.element.size.width,t.element.size.height,t.scale,t.pageRotation,t.maintainAspectRatio,null==n?void 0:n.handleSize,null==n?void 0:n.spacing,null==n?void 0:n.offsetMode,null==n?void 0:n.includeSides,null==n?void 0:n.zIndex,null==n?void 0:n.rotationAwareCursor,l,r]),u=Te(()=>{if(!i)return[];const e=function(e,t={},n){const{vertexSize:o=12,zIndex:i=4}=t,r=e.element,a=e.scale??1;return(n??e.vertices??[]).map((e,t)=>({handle:"nw",style:{position:"absolute",left:(e.x-r.origin.x)*a-o/2+"px",top:(e.y-r.origin.y)*a-o/2+"px",width:o+"px",height:o+"px",borderRadius:"50%",cursor:"pointer",zIndex:i,touchAction:"none"},attrs:{"data-epdf-vertex":t}}))}(t,o,t.vertices);return e.map((e,t)=>({key:t,style:e.style,...c(t),...e.attrs??{},...(null==a?void 0:a(t))??{}}))},[i,t.element.origin.x,t.element.origin.y,t.element.size.width,t.element.size.height,t.scale,t.vertices,null==o?void 0:o.vertexSize,null==o?void 0:o.zIndex,c,a]);return{dragProps:s,resize:d,vertices:u}}const Ys=()=>po(Us.id);function Xs({documentId:e,pageIndex:t,scale:n,rotation:o,background:i="rgba(33,150,243)",selectionMenu:r}){const{plugin:a}=go(Us.id),s=fo(e),[l,c]=ke([]),[d,u]=ke(null),[h,m]=ke(null);Me(()=>{if(a&&e)return a.registerSelectionOnPage({documentId:e,pageIndex:t,onRectsChange:({rects:e,boundingRect:t})=>{c(e),u(t)}})},[a,e,t]),Me(()=>{if(a&&e)return a.onMenuPlacement(e,e=>{m(e)})},[a,e]);const g=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),p=Te(()=>void 0!==o?o:(null==s?void 0:s.rotation)??We.Degree0,[o,null==s?void 0:s.rotation]),v=r&&h&&h.pageIndex===t&&h.isVisible;return d?Ue(U,{children:[Ue("div",{style:{position:"absolute",left:d.origin.x*g,top:d.origin.y*g,width:d.size.width*g,height:d.size.height*g,mixBlendMode:"multiply",isolation:"isolate",pointerEvents:"none"},children:l.map((e,t)=>Ue("div",{style:{position:"absolute",left:(e.origin.x-d.origin.x)*g,top:(e.origin.y-d.origin.y)*g,width:e.size.width*g,height:e.size.height*g,background:i}},t))}),v&&Ue(qs,{rect:{origin:{x:h.rect.origin.x*g,y:h.rect.origin.y*g},size:{width:h.rect.size.width*g,height:h.rect.size.height*g}},rotation:p,children:e=>r({...e,context:{type:"selection",pageIndex:t},selected:!0,placement:h})})]}):null}const Qs=co(Ws).addUtility(function(){const{provides:e}=Ys();return Me(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}).build(),Js="tiling",el={id:Js,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},tl="TILING/INIT_STATE",nl="TILING/CLEANUP_STATE",ol="TILING/UPDATE_VISIBLE_TILES",il="TILING/MARK_TILE_STATUS",rl=(e,t)=>({type:ol,payload:{documentId:e,tiles:t}}),al=(e,t,n,o)=>({type:il,payload:{documentId:e,pageIndex:t,tileId:n,status:o}}),sl={visibleTiles:{}};function ll({tileSize:e=768,overlapPx:t=2.5,extraRings:n=0,scale:o,rotation:i,page:r,metric:a}){const s=r.size.width*o,l=r.size.height*o,c=e-t,d=function(e,t,n,o){return nt(tt(e,t,(4-n)%4),1/o)}(Ze(r.size,i,o),{origin:{x:a.scaled.pageX,y:a.scaled.pageY},size:{width:a.scaled.visibleWidth,height:a.scaled.visibleHeight}},i,1),u=d.origin.x,h=d.origin.y,m=u+d.size.width,g=h+d.size.height,p=Math.floor((s-1)/c),v=Math.floor((l-1)/c),f=Math.max(0,Math.floor(u/c)-n),y=Math.min(p,Math.floor((m-1)/c)+n),b=Math.max(0,Math.floor(h/c)-n),w=Math.min(v,Math.floor((g-1)/c)+n),x=[];for(let t=f;t<=y;t++){const n=t*c,i=Math.min(e,s-n),a=n/o,d=i/o;for(let s=b;s<=w;s++){const u=s*c,h=Math.min(e,l-u),m=u/o,g=h/o;x.push({id:`p${r.index}-${o}-x${n}-y${u}-w${i}-h${h}`,col:t,row:s,pageRect:{origin:{x:a,y:m},size:{width:d,height:g}},screenRect:{origin:{x:n,y:u},size:{width:i,height:h}},status:"queued",srcScale:o,isFallback:!1})}}return x}const cl=class extends Yn{constructor(e,t,n){super(e,t),this.tileRendering$=ao(),this.config=n,this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=this.registry.getPlugin("scroll").provides(),this.viewportCapability=this.registry.getPlugin("viewport").provides(),this.scrollCapability.onScroll(e=>this.calculateVisibleTiles(e.documentId,e.metrics),{mode:"throttle",wait:50,throttleMode:"trailing"}),this.coreStore.onAction(On,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:tl,payload:{documentId:e,state:t}}))(e,sl))}onDocumentClosed(e){this.dispatch((e=>({type:nl,payload:e}))(e))}onScaleChanged(e){this.recalculateTilesForDocument(e)}onRotationChanged(e){this.recalculateTilesForDocument(e)}recalculateTilesForDocument(e){const t=this.scrollCapability.forDocument(e),n=this.viewportCapability.forDocument(e),o=t.getMetrics(n.getMetrics());this.calculateVisibleTiles(e,o)}async recalculateTiles(e){const{documentId:t,pageIndexes:n}=e,o=this.getCoreDocument(t);if(!o||!o.document)return;const i=this.scrollCapability.forDocument(t),r=this.viewportCapability.forDocument(t),a=i.getMetrics(r.getMetrics()),s={},l=Date.now(),c=o.scale,d=o.rotation;for(const e of n){const t=a.pageVisibilityMetrics.find(t=>t.pageNumber===e+1);if(!t)continue;const n=o.document.pages[e];n&&(s[e]=ll({page:n,metric:t,scale:c,rotation:d,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings}).map(e=>({...e,id:`${e.id}-r${l}`})))}Object.keys(s).length>0&&this.dispatch(rl(t,s))}async initialize(){}calculateVisibleTiles(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return;const o=n.scale,i=n.rotation,r={};for(const e of t.pageVisibilityMetrics){const t=e.pageNumber-1,a=n.document.pages[t];if(!a)continue;const s=ll({page:a,metric:e,scale:o,rotation:i,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings});r[t]=s}this.dispatch(rl(e,r))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&this.tileRendering$.emit({documentId:n,tiles:i.visibleTiles})}}buildCapability(){return{renderTile:this.renderTile.bind(this),forDocument:this.createTilingScope.bind(this),onTileRendering:this.tileRendering$.on}}createTilingScope(e){return{renderTile:t=>this.renderTile(t,e),onTileRendering:t=>this.tileRendering$.on(n=>{n.documentId===e&&t(n.tiles)})}}renderTile(e,t){const n=t??this.getActiveDocumentId();if(!this.renderCapability)throw new Error("Render capability not available.");this.dispatch(al(n,e.pageIndex,e.tile.id,"rendering"));const o=this.renderCapability.forDocument(n).renderPageRect({pageIndex:e.pageIndex,rect:e.tile.pageRect,options:{scaleFactor:e.tile.srcScale,dpr:e.dpr}});return o.wait(()=>{this.dispatch(al(n,e.pageIndex,e.tile.id,"ready"))},wn),o}};cl.id="tiling";let dl=cl;const ul={manifest:el,create:(e,t)=>new dl(Js,e,t),reducer:(e,t)=>((e,t)=>{var n,o;switch(t.type){case tl:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case nl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case ol:{const{documentId:o,tiles:i}=t.payload,r=e.documents[o];if(!r)return e;const a={...r.visibleTiles};for(const e in i){const t=Number(e),o=i[t],r=a[t]??[],s=null==(n=r.find(e=>!e.isFallback))?void 0:n.srcScale,l=o.length>0?o[0].srcScale:s;if(void 0!==s&&s!==l){const e=r.filter(e=>!e.isFallback&&"ready"===e.status).map(e=>({...e,isFallback:!0})),n=e.length>0?[]:r.filter(e=>e.isFallback);a[t]=[...n,...e,...o]}else{const e=new Set(o.map(e=>e.id)),n=[],i=new Set;for(const t of r)(t.isFallback||e.has(t.id))&&(n.push(t),i.add(t.id));for(const e of o)i.has(e.id)||n.push(e);a[t]=n}}return{...e,documents:{...e.documents,[o]:{...r,visibleTiles:a}}}}case il:{const{documentId:n,pageIndex:i,tileId:r,status:a}=t.payload,s=e.documents[n];if(!s)return e;const l=(null==(o=s.visibleTiles[i])?void 0:o.map(e=>e.id===r?{...e,status:a}:e))??[],c=l.filter(e=>!e.isFallback),d=c.length>0&&c.every(e=>"ready"===e.status),u=d?c:l;return{...e,documents:{...e.documents,[n]:{...s,visibleTiles:{...s.visibleTiles,[i]:u}}}}}default:return e}})(e,t),initialState:{documents:{}}},hl=()=>po(dl.id);function ml({documentId:e,pageIndex:t,tile:n,dpr:o,scale:i}){const{provides:r}=hl(),a=Te(()=>null==r?void 0:r.forDocument(e),[r,e]),[s,l]=ke(),c=Ae(null),d=i/n.srcScale;Me(()=>{if("ready"===n.status&&c.current)return;if(!a)return;const e=a.renderTile({pageIndex:t,tile:n,dpr:o});return e.wait(e=>{const t=URL.createObjectURL(e);c.current=t,l(t)},wn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:Ht.Cancelled,message:"canceled render task"})}},[a,t,n.id]);return s?Ue("img",{src:s,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},style:{position:"absolute",left:n.screenRect.origin.x*d,top:n.screenRect.origin.y*d,width:n.screenRect.size.width*d,height:n.screenRect.size.height*d,display:"block"}}):null}function gl({documentId:e,pageIndex:t,scale:n,style:o,...i}){const{provides:r}=hl(),a=fo(e),[s,l]=ke([]);Me(()=>{if(r)return r.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[r,e,t]);const c=Te(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]);return Ue("div",{style:{...o},...i,children:null==s?void 0:s.map(n=>Ue(ml,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const pl="thumbnail",vl={id:pl,name:"Thumbnail Plugin",version:"1.0.0",provides:["thumbnail"],requires:["render"],optional:["scroll"],defaultConfig:{width:150,gap:10,buffer:3,labelHeight:16,autoScroll:!0,scrollBehavior:"smooth",imagePadding:0,paddingY:0}},fl="THUMBNAIL/INIT_STATE",yl="THUMBNAIL/CLEANUP_STATE",bl="THUMBNAIL/SET_WINDOW_STATE",wl="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function xl(e,t){return{type:fl,payload:{documentId:e,state:t}}}const Cl={thumbs:[],window:null,viewportH:0,scrollY:0},Il={documents:{},activeDocumentId:null},Sl=class extends Yn{constructor(e,t,n){var o;super(e,t),this.cfg=n,this.scrollCapability=null,this.taskCaches=new Map,this.canAutoScroll=new Map,this.window$=so((e,t)=>({documentId:e,window:t})),this.scrollTo$=so((e,t)=>({documentId:e,options:t})),this.refreshPages$=so((e,t)=>({documentId:e,pages:t}),{cache:!1}),this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=(null==(o=this.registry.getPlugin("scroll"))?void 0:o.provides())??null,this.coreStore.onAction(On,e=>{const t=e.payload.documentId??this.getActiveDocumentId(),n=e.payload.pageIndexes;this.refreshPages$.emit(t,n);const o=this.taskCaches.get(t);if(o)for(const e of n)o.delete(e)}),this.scrollCapability&&!1!==this.cfg.autoScroll&&(this.scrollCapability.onPageChangeState(({documentId:e,state:t})=>{this.canAutoScroll.set(e,!t.isChanging),t.isChanging||this.scrollToThumb(t.targetPage-1,e)}),this.scrollCapability.onPageChange(({documentId:e,pageNumber:t})=>{!1!==this.canAutoScroll.get(e)&&this.scrollToThumb(t-1,e)}))}onDocumentLoadingStarted(e){this.dispatch(xl(e,{...Cl})),this.taskCaches.set(e,new Map),this.canAutoScroll.set(e,!0),this.logger.debug("ThumbnailPlugin","DocumentOpened",`Initialized thumbnail state for document: ${e}`)}onDocumentLoaded(e){this.calculateWindowState(e)}onDocumentClosed(e){this.dispatch(function(e){return{type:yl,payload:e}}(e));const t=this.taskCaches.get(e);t&&(t.forEach(e=>{e.abort({code:"cancelled",message:"Document closed"})}),t.clear(),this.taskCaches.delete(e)),this.canAutoScroll.delete(e),this.window$.clearScope(e),this.scrollTo$.clearScope(e),this.refreshPages$.clearScope(e),this.logger.debug("ThumbnailPlugin","DocumentClosed",`Cleaned up thumbnail state for document: ${e}`)}onRotationChanged(e){this.calculateWindowState(e)}buildCapability(){return{scrollToThumb:e=>this.scrollToThumb(e),renderThumb:(e,t)=>this.renderThumb(e,t),updateWindow:(e,t)=>this.updateWindow(e,t),getWindow:()=>this.getWindow(),forDocument:e=>this.createThumbnailScope(e),onWindow:this.window$.onGlobal,onScrollTo:this.scrollTo$.onGlobal,onRefreshPages:this.refreshPages$.onGlobal}}createThumbnailScope(e){return{scrollToThumb:t=>this.scrollToThumb(t,e),renderThumb:(t,n)=>this.renderThumb(t,n,e),updateWindow:(t,n)=>this.updateWindow(t,n,e),getWindow:()=>this.getWindow(e),onWindow:this.window$.forScope(e),onScrollTo:this.scrollTo$.forScope(e),onRefreshPages:this.refreshPages$.forScope(e)}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}calculateWindowState(e){const t=this.coreState.core.documents[e];if(!(null==t?void 0:t.document))return;const n=this.cfg.width??120,o=this.cfg.labelHeight??16,i=this.cfg.gap??8,r=this.cfg.imagePadding??0,a=this.cfg.paddingY??0,s=Math.max(1,n-2*r);let l=a;const c=t.document.pages.map(e=>{const t=e.size.height/e.size.width,n=Math.round(s*t),a=r+n+r+o,c={pageIndex:e.index,width:s,height:n,wrapperHeight:a,top:l,labelHeight:o,padding:r};return l+=a+i,c}),d={start:-1,end:-1,items:[],totalHeight:l-i+a},u=this.getDocumentState(e);u&&(this.dispatch(xl(e,{...u,thumbs:c,window:d})),u.viewportH>0?this.updateWindow(u.scrollY,u.viewportH,e):this.window$.emit(e,d))}updateWindow(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentState(o);if(!i||!i.window||0===i.thumbs.length)return;const r=this.cfg.buffer??3;this.dispatch(function(e,t,n){return{type:wl,payload:{documentId:e,scrollY:t,viewportH:n}}}(o,e,t));let a=0,s=i.thumbs.length-1,l=0;for(;a<=s;){const t=a+s>>1,n=i.thumbs[t];n.top+n.wrapperHeight<e?a=t+1:(l=t,s=t-1)}let c=l;const d=e+t;for(;c+1<i.thumbs.length&&i.thumbs[c].top<d;)c++;c=Math.min(i.thumbs.length-1,c+r);const u=Math.max(0,l-r);if(u===i.window.start&&c===i.window.end)return;const h={start:u,end:c,items:i.thumbs.slice(u,c+1),totalHeight:i.window.totalHeight};this.dispatch(function(e,t){return{type:bl,payload:{documentId:e,window:t}}}(o,h)),this.window$.emit(o,h)}getWindow(e){const t=this.getDocumentState(e);return(null==t?void 0:t.window)??null}scrollToThumb(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o||!o.window)return;const i=o.thumbs[e];if(!i)return;const r=this.cfg.scrollBehavior??"smooth",a=this.cfg.paddingY??0;if(o.viewportH<=0){const e=Math.max(a,i.top-i.wrapperHeight);return void this.scrollTo$.emit(n,{top:e,behavior:r})}const s=i.top,l=i.top+i.wrapperHeight,c=s<o.scrollY+8+a,d=l>o.scrollY+o.viewportH-8;c?this.scrollTo$.emit(n,{top:Math.max(0,s-a),behavior:r}):d&&this.scrollTo$.emit(n,{top:Math.max(0,l-o.viewportH+a),behavior:r})}renderThumb(e,t,n){const o=n??this.getActiveDocumentId(),i=this.taskCaches.get(o);if(!i)throw new Error(`Task cache not found for document: ${o}`);if(i.has(e))return i.get(e);const r=this.coreState.core.documents[o];if(!(null==r?void 0:r.document))throw new Error(`Document not found: ${o}`);const a=r.document.pages[e];if(!a)throw new Error(`Page ${e} not found in document: ${o}`);const s=this.cfg.width??120,l=this.cfg.imagePadding??0,c=Math.max(1,s-2*l)/a.size.width,d=this.renderCapability.forDocument(o).renderPageRect({pageIndex:e,rect:{origin:{x:0,y:0},size:a.size},options:{scaleFactor:c,dpr:t}});return i.set(e,d),d.wait(wn,()=>i.delete(e)),d}async initialize(){this.logger.info("ThumbnailPlugin","Initialize","Thumbnail plugin initialized")}async destroy(){this.window$.clear(),this.refreshPages$.clear(),this.scrollTo$.clear(),this.taskCaches.forEach(e=>{e.forEach(e=>{e.abort({code:"cancelled",message:"Plugin destroyed"})}),e.clear()}),this.taskCaches.clear(),this.canAutoScroll.clear(),super.destroy()}};Sl.id="thumbnail";let kl=Sl;const Dl={manifest:vl,create:(e,t)=>new kl(pl,e,t),reducer:(e=Il,t)=>{switch(t.type){case fl:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case yl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"THUMBNAIL/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case bl:{const{documentId:n,window:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,window:o}}}:e}case wl:{const{documentId:n,scrollY:o,viewportH:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,scrollY:o,viewportH:i}}}:e}default:return e}},initialState:Il},Ml=()=>go(kl.id);function Pl({documentId:e,style:t,children:n,...o}){const{plugin:i}=Ml(),r=Ae(null),[a,s]=ke({window:null,docId:null}),l=a.docId===e?a.window:null;Me(()=>{if(!i)return;const t=i.provides().forDocument(e),n=t.getWindow();n&&s({window:n,docId:e});const o=t.onWindow(t=>{s({window:t,docId:e})});return()=>{o(),s({window:null,docId:null})}},[i,e]),Me(()=>{const t=r.current;if(!t||!i)return;const n=i.provides().forDocument(e),o=()=>n.updateWindow(t.scrollTop,t.clientHeight);return t.addEventListener("scroll",o),()=>t.removeEventListener("scroll",o)},[i,e]),Me(()=>{const t=r.current;if(!t||!i)return;const n=i.provides().forDocument(e),o=new ResizeObserver(()=>{n.updateWindow(t.scrollTop,t.clientHeight)});return o.observe(t),()=>o.disconnect()},[i,e]),Me(()=>{const t=r.current;if(!t||!i)return;i.provides().forDocument(e).updateWindow(t.scrollTop,t.clientHeight)},[l,i,e]),Me(()=>{const t=r.current;if(!t||!i||!l)return;return i.provides().forDocument(e).onScrollTo(({top:e,behavior:n})=>{t.scrollTo({top:e,behavior:n})})},[i,e,!!l]);const c=(null==i?void 0:i.cfg.paddingY)??0;return Ue("div",{ref:r,style:{overflowY:"auto",position:"relative",paddingTop:c,paddingBottom:c,height:"100%",...t},...o,children:Ue("div",{style:{height:(null==l?void 0:l.totalHeight)??0,position:"relative"},children:null==l?void 0:l.items.map(e=>n(e))})})}function Al({documentId:e,meta:t,style:n,...o}){const{provides:i}=po(kl.id),{plugin:r}=Ml(),[a,s]=ke(),l=Ae(null),[c,d]=ke(0);Me(()=>{if(!r)return;return r.provides().forDocument(e).onRefreshPages(e=>{e.includes(t.pageIndex)&&d(e=>e+1)})},[r,e,t.pageIndex]),Me(()=>{const n=null==i?void 0:i.forDocument(e),o=null==n?void 0:n.renderThumb(t.pageIndex,window.devicePixelRatio);return null==o||o.wait(e=>{const t=URL.createObjectURL(e);l.current=t,s(t)},wn),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==o||o.abort({code:Ht.Cancelled,message:"canceled render task"})}},[i,e,t.pageIndex,c]);return a?Ue("img",{src:a,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...o}):null}const Tl="annotation",zl={id:Tl,name:"Annotation Plugin",version:"1.0.0",provides:["annotation"],requires:["interaction-manager","selection"],optional:["history"],defaultConfig:{autoCommit:!0,annotationAuthor:"Guest",deactivateToolAfterCreate:!1,selectAfterCreate:!0}},El="ANNOTATION/INIT_STATE",_l="ANNOTATION/CLEANUP_STATE",Rl="ANNOTATION/SET_ANNOTATIONS",Nl="ANNOTATION/SELECT_ANNOTATION",Ol="ANNOTATION/DESELECT_ANNOTATION",Ll="ANNOTATION/SET_ACTIVE_TOOL_ID",$l="ANNOTATION/CREATE_ANNOTATION",Fl="ANNOTATION/PATCH_ANNOTATION",jl="ANNOTATION/DELETE_ANNOTATION",Hl="ANNOTATION/COMMIT",Ul="ANNOTATION/PURGE_ANNOTATION",Wl="ANNOTATION/ADD_COLOR_PRESET",Bl="ANNOTATION/SET_TOOL_DEFAULTS",ql="ANNOTATION/ADD_TOOL";const Gl=e=>({type:Ol,payload:{documentId:e}}),Vl=(e,t)=>({type:Ll,payload:{documentId:e,toolId:t}}),Zl=(e,t,n)=>({type:$l,payload:{documentId:e,pageIndex:t,annotation:n}}),Kl=(e,t,n,o)=>({type:Fl,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),Yl=(e,t,n)=>({type:jl,payload:{documentId:e,pageIndex:t,id:n}}),Xl=(e,t)=>({type:Ul,payload:{documentId:e,uid:t}});function Ql(e){return e.object.type===Dt.INK}function Jl(e){return e.object.type===Dt.CIRCLE}function ec(e){return e.object.type===Dt.POLYGON}function tc(e){return e.object.type===Dt.SQUARE}function nc(e){return e.object.type===Dt.LINE}function oc(e){return e.object.type===Dt.POLYLINE}function ic(e){return e.object.type===Dt.HIGHLIGHT}function rc(e){return e.object.type===Dt.UNDERLINE}function ac(e){return e.object.type===Dt.STRIKEOUT}function sc(e){return e.object.type===Dt.SQUIGGLY}function lc(e){return e.object.type===Dt.FREETEXT}function cc(e){return e.object.type===Dt.STAMP}function dc(e){return e.object.type===Dt.TEXT}function uc(e){return function(e){return ic(e)||rc(e)||ac(e)||sc(e)}(e)||Ql(e)||tc(e)||Jl(e)||ec(e)||nc(e)||oc(e)||lc(e)||cc(e)}const hc=(e,t)=>(e.pages[t]??[]).map(t=>e.byUid[t]),mc=(e,t)=>e.byUid[t]??null,gc=(e,t)=>{if(!e.selectedUid)return null;return(e.pages[t]??[]).includes(e.selectedUid)?e.byUid[e.selectedUid]:null};function pc(e,t){const n=e.tools.find(e=>e.id===t);return null==n?void 0:n.defaults}const vc=[{id:"highlight",name:"Highlight",matchScore:e=>e.type===Dt.HIGHLIGHT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Dt.HIGHLIGHT,color:"#FFCD45",opacity:1,blendMode:It.Multiply}},{id:"underline",name:"Underline",matchScore:e=>e.type===Dt.UNDERLINE?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Dt.UNDERLINE,color:"#E44234",opacity:1}},{id:"strikeout",name:"Strikeout",matchScore:e=>e.type===Dt.STRIKEOUT?1:0,interaction:{exclusive:!1,textSelection:!0},defaults:{type:Dt.STRIKEOUT,color:"#E44234",opacity:1}},{id:"squiggly",name:"Squiggly",matchScore:e=>e.type===Dt.SQUIGGLY?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Dt.SQUIGGLY,color:"#E44234",opacity:1}},{id:"ink",name:"Pen",matchScore:e=>e.type===Dt.INK&&"InkHighlight"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Dt.INK,color:"#E44234",opacity:1,strokeWidth:6}},{id:"inkHighlighter",name:"Ink Highlighter",matchScore:e=>e.type===Dt.INK&&"InkHighlight"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Dt.INK,intent:"InkHighlight",color:"#FFCD45",opacity:1,strokeWidth:14,blendMode:It.Multiply}},{id:"circle",name:"Circle",matchScore:e=>e.type===Dt.CIRCLE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Dt.CIRCLE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:Et.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"square",name:"Square",matchScore:e=>e.type===Dt.SQUARE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Dt.SQUARE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:Et.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"line",name:"Line",matchScore:e=>e.type===Dt.LINE&&"LineArrow"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Dt.LINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"lineArrow",name:"Arrow",matchScore:e=>e.type===Dt.LINE&&"LineArrow"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Dt.LINE,intent:"LineArrow",color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",lineEndings:{start:At.None,end:At.OpenArrow}},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"polyline",name:"Polyline",matchScore:e=>e.type===Dt.POLYLINE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Dt.POLYLINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"polygon",name:"Polygon",matchScore:e=>e.type===Dt.POLYGON?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Dt.POLYGON,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"freeText",name:"Free Text",matchScore:e=>e.type===Dt.FREETEXT?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Dt.FREETEXT,contents:"Insert text",fontSize:14,fontColor:"#E44234",fontFamily:wt.Helvetica,textAlign:xt.Left,verticalAlign:Ct.Top,backgroundColor:"transparent",opacity:1},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20},defaultContent:"Insert text"}},{id:"stamp",name:"Image",matchScore:e=>e.type===Dt.STAMP?1:0,interaction:{exclusive:!1,cursor:"copy",isDraggable:!0,isResizable:!0,lockAspectRatio:!0},defaults:{type:Dt.STAMP}}],fc=["#E44234","#FF8D00","#FFCD45","#5CC96E","#25D2D1","#597CE2","#C544CE","#7D2E25","#000000","#FFFFFF"],yc=(e,t,n)=>{const o=e.byUid[t];return o?{...e,byUid:{...e.byUid,[t]:{...o,commitState:"synced"===o.commitState?"dirty":o.commitState,object:{...o.object,...n}}},hasPendingChanges:!0}:e};function bc(e){let t=e;return[()=>t,e=>{t=e}]}const wc={annotationType:Dt.INK,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=bc([]),[s,l]=bc(!1),c={current:null},d=e=>({x:eo(e.x,0,i.width),y:eo(e.y,0,i.height)}),u=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},h=()=>{const e=r();if(0===e.length||0===e[0].points.length)return null;const t=u();if(!t)return null;const n=e.flatMap(e=>e.points),o=et(Je(n),t.strokeWidth/2);return{type:Dt.INK,bounds:o,data:{...t,rect:o,inkList:e}}};return{onPointerDown:(e,t)=>{var o;const i=d(e);l(!0),c.current&&clearTimeout(c.current);const s=[...r(),{points:[i]}];a(s),n(h()),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{if(!s())return;const t=r();if(0===t.length)return;const o=d(e);t[t.length-1].points.push(o),a(t),n(h())},onPointerUp:(o,i)=>{var s;l(!1),null==(s=i.releasePointerCapture)||s.call(i),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{const o=r();if(o.length>0&&o[0].points.length>1){const n=u();if(!n)return;const i=o.flatMap(e=>e.points),r=et(Je(i),n.strokeWidth/2);t({...n,inkList:o,rect:r,type:Dt.INK,pageIndex:e.pageIndex,id:yn(),created:new Date})}a([]),n(null)},800)},onPointerCancel:(e,t)=>{var o;a([]),l(!1),n(null),c.current&&clearTimeout(c.current),null==(o=t.releasePointerCapture)||o.call(t)}}}};function xc({threshold:e=5,getTool:t,onClickDetected:n}){const[o,i]=bc(null),[r,a]=bc(!1);return{onStart:e=>{i(e),a(!1)},onMove:t=>{const n=o();if(!n||r())return;Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))>e&&a(!0)},onEnd:e=>{var s;if(o()&&!r()){const o=t();o&&"clickBehavior"in o&&(null==(s=o.clickBehavior)?void 0:s.enabled)&&n(e,o)}i(null),a(!1)},hasMoved:r,reset:()=>{i(null),a(!1)}}}const Cc={annotationType:Dt.FREETEXT,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i,pageIndex:r}=e,[a,s]=bc(null),l=e=>({x:eo(e.x,0,i.width),y:eo(e.y,0,i.height)}),c=()=>{const e=o();return e?{...e.defaults,fontColor:e.defaults.fontColor??"#000000",opacity:e.defaults.opacity??1,fontSize:e.defaults.fontSize??12,fontFamily:e.defaults.fontFamily??wt.Helvetica,backgroundColor:e.defaults.backgroundColor??"transparent",textAlign:e.defaults.textAlign??xt.Left,verticalAlign:e.defaults.verticalAlign??Ct.Top,contents:e.defaults.contents??"Insert text here",flags:e.defaults.flags??["print"]}:null},d=xc({threshold:5,getTool:o,onClickDetected:(e,n)=>{const o=c();if(!o)return;const a=n.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h={origin:{x:eo(e.x-d,0,i.width-s),y:eo(e.y-u,0,i.height-l)},size:{width:s,height:l}},m=a.defaultContent??o.contents,g={...o,contents:m,type:Dt.FREETEXT,rect:h,pageIndex:r,id:yn(),created:new Date};t(g)}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o={origin:{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)},size:{width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}};return{type:Dt.FREETEXT,bounds:o,data:{...n,rect:o}}};return{onPointerDown:(e,t)=>{var o;const i=l(e);s(i),d.onStart(i),n(u(i)),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&n(u(t))},onPointerUp:(o,i)=>{var r;const u=a();if(!u)return;const h=c();if(!h)return;const m=l(o);if(d.hasMoved()){const n={origin:{x:Math.min(u.x,m.x),y:Math.min(u.y,m.y)},size:{width:Math.abs(u.x-m.x),height:Math.abs(u.y-m.y)}},o={...h,type:Dt.FREETEXT,rect:n,pageIndex:e.pageIndex,id:yn(),created:new Date};t(o)}else d.onEnd(m);s(null),n(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var o;s(null),n(null),d.reset(),null==(o=t.releasePointerCapture)||o.call(t)},onPointerCancel:(e,t)=>{var o;s(null),n(null),d.reset(),null==(o=t.releasePointerCapture)||o.call(t)}}}};function Ic(e){const t=e=>{const t=9*e,n=Math.PI/6;return{x:-t*Math.cos(n),y:t*Math.sin(n)}};return{getSvgPath:n=>{const{x:o,y:i}=t(n);return e?`M 0 0 L ${o} ${i} L ${o} ${-i} Z`:`M ${o} ${i} L 0 0 L ${o} ${-i}`},getLocalPoints:e=>{const{x:n,y:o}=t(e);return[{x:0,y:0},{x:n,y:o},{x:n,y:-o}]},getRotation:e=>e,filled:e}}function Sc(e,t){const n=t=>t*e/2;return{getSvgPath:e=>{const t=n(e);return`M ${-t} 0 L ${t} 0`},getLocalPoints:e=>{const t=n(e);return[{x:-t,y:0},{x:t,y:0}]},getRotation:t,filled:!1}}const kc=Ic(!1),Dc=Ic(!0),Mc={[At.OpenArrow]:kc,[At.ClosedArrow]:Dc,[At.ROpenArrow]:{...kc,getRotation:e=>e+Math.PI},[At.RClosedArrow]:{...Dc,getRotation:e=>e+Math.PI},[At.Circle]:{getSvgPath:e=>{const t=5*e/2;return`M ${t} 0 A ${t} ${t} 0 1 1 ${-t} 0 A ${t} ${t} 0 1 1 ${t} 0`},getLocalPoints:e=>{const t=5*e/2;return[{x:-t,y:-t},{x:t,y:t}]},getRotation:()=>0,filled:!0},[At.Square]:{getSvgPath:e=>{const t=6*e/2;return`M ${-t} ${-t} L ${t} ${-t} L ${t} ${t} L ${-t} ${t} Z`},getLocalPoints:e=>{const t=6*e/2;return[{x:-t,y:-t},{x:t,y:-t},{x:t,y:t},{x:-t,y:t}]},getRotation:e=>e,filled:!0},[At.Diamond]:{getSvgPath:e=>{const t=6*e/2;return`M 0 ${-t} L ${t} 0 L 0 ${t} L ${-t} 0 Z`},getLocalPoints:e=>{const t=6*e/2;return[{x:0,y:-t},{x:t,y:0},{x:0,y:t},{x:-t,y:0}]},getRotation:e=>e,filled:!0},[At.Butt]:Sc(6,e=>e+Math.PI/2),[At.Slash]:Sc(18,e=>e+Math.PI/1.5)};function Pc(e,t,n){if(!e||0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const o=[...e],i=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),r=(e,n,i)=>{if(!e)return;const r=Mc[e];if(!r)return;const a=r.getLocalPoints(t),s=r.getRotation(i),l=a.map(e=>function(e,t,n){const o=Math.cos(t),i=Math.sin(t),r=e.x*o-e.y*i,a=e.x*i+e.y*o;return{x:r+n.x,y:a+n.y}}(e,s,n));o.push(...l)};if(e.length>=2){const t=i(e[1],e[0]);r(null==n?void 0:n.start,e[0],t);const o=e.length-1,a=i(e[o-1],e[o]);r(null==n?void 0:n.end,e[o],a)}if(o.length<=1){const n=e[0]||{x:0,y:0},o=t;return{origin:{x:n.x-o,y:n.y-o},size:{width:2*o,height:2*o}}}return et(Je(o),t/2+1.2*t)}class Ac{constructor(){this.patches=new Map}register(e,t){this.patches.set(e,t)}transform(e,t){const n=this.patches.get(e.type);return n?n(e,t):t.changes}}const Tc=new Ac,zc=Object.freeze(Object.defineProperty({__proto__:null,LINE_ENDING_HANDLERS:Mc,PatchRegistry:Ac,createEnding:function(e,t,n,o,i){if(!e)return null;const r=Mc[e];if(!r)return null;const a=r.getRotation(n);return{d:r.getSvgPath(t),transform:`translate(${o} ${i}) rotate(${(e=>180*e/Math.PI)(a)})`,filled:r.filled}},lineRectWithEndings:Pc,patchRegistry:Tc},Symbol.toStringTag,{value:"Module"})),Ec={annotationType:Dt.LINE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=bc(null),l=e=>({x:eo(e.x,0,r.width),y:eo(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:At.None,end:At.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeStyle:e.defaults.strokeStyle??Et.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],strokeColor:e.defaults.strokeColor??"#000000",flags:e.defaults.flags??["print"]}:null},d=xc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const r=o.clickBehavior;if(!(null==r?void 0:r.enabled))return;const a=r.defaultAngle??0,s=r.defaultLength/2,d=e.x-s*Math.cos(a),u=e.y-s*Math.sin(a),h=e.x+s*Math.cos(a),m=e.y+s*Math.sin(a),g=l({x:d,y:u}),p=l({x:h,y:m}),v=Pc([g,p],i.strokeWidth,i.lineEndings);n({...i,rect:v,linePoints:{start:g,end:p},pageIndex:t,id:yn(),created:new Date,type:Dt.LINE})}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=Pc([t,e],n.strokeWidth,n.lineEndings);return{type:Dt.LINE,bounds:o,data:{...n,rect:o,linePoints:{start:t,end:e}}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;const u=a();if(!u)return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;if(Math.abs(h.x-u.x)>2||Math.abs(h.y-u.y)>2){const o=Pc([u,h],e.strokeWidth,e.lineEndings);n({...e,rect:o,linePoints:{start:u,end:h},pageIndex:t,id:yn(),flags:["print"],created:new Date,type:Dt.LINE})}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},_c={annotationType:Dt.POLYLINE,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=bc([]),[s,l]=bc(null),c=e=>({x:eo(e.x,0,i.width),y:eo(e.y,0,i.height)}),d=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:At.None,end:At.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Et.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],flags:e.defaults.flags??["print"]}:null},u=()=>{const e=r(),t=s();if(0===e.length||!t)return null;const n=d();if(!n)return null;const o=[...e,t],i=Pc(o,n.strokeWidth,n.lineEndings);return{type:Dt.POLYLINE,bounds:i,data:{...n,rect:i,vertices:o,currentVertex:t}}};return{onClick:e=>{const t=c(e),o=r(),i=o[o.length-1];i&&Math.abs(i.x-t.x)<1&&Math.abs(i.y-t.y)<1||(a([...o,t]),l(t),n(u()))},onDoubleClick:()=>{(()=>{const o=r();if(o.length<2)return;const i=d();if(!i)return;const s=Pc(o,i.strokeWidth,i.lineEndings),c={...i,vertices:o,rect:s,type:Dt.POLYLINE,pageIndex:e.pageIndex,id:yn(),created:new Date};t(c),a([]),l(null),n(null)})()},onPointerMove:e=>{if(r().length>0){const t=c(e);l(t),n(u())}},onPointerCancel:()=>{a([]),l(null),n(null)}}}},Rc={annotationType:Dt.POLYGON,create(e){const{onCommit:t,onPreview:n,getTool:o,scale:i,pageSize:r}=e,[a,s]=bc([]),[l,c]=bc(null),d=e=>({x:eo(e.x,0,r.width),y:eo(e.y,0,r.height)}),u=()=>{const e=o();return e?{...e.defaults,color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeWidth:e.defaults.strokeWidth??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Et.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],flags:e.defaults.flags??["print"]}:null},h=()=>{const o=a();if(o.length<3)return;const i=u();if(!i)return;const r=et(Je(o),i.strokeWidth/2),l={...i,vertices:o,rect:r,type:Dt.POLYGON,pageIndex:e.pageIndex,id:yn(),created:new Date};t(l),s([]),c(null),n(null)},m=()=>{const e=a(),t=l();if(0===e.length||!t)return null;const n=u();if(!n)return null;const o=et(Je([...e,t]),n.strokeWidth/2);return{type:Dt.POLYGON,bounds:o,data:{...n,rect:o,vertices:e,currentVertex:t}}};return{onClick:e=>{const t=d(e);if((e=>{const t=a();if(t.length<2)return!1;const n=14/i/2,o=t[0];return e.x>=o.x-n&&e.x<=o.x+n&&e.y>=o.y-n&&e.y<=o.y+n})(t)&&a().length>=3)return void h();const o=a(),r=o[o.length-1];r&&Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(s([...o,t]),c(t),n(m()))},onDoubleClick:e=>{h()},onPointerMove:e=>{if(a().length>0){const t=d(e);c(t),n(m())}},onPointerCancel:e=>{s([]),c(null),n(null)}}}},Nc={annotationType:Dt.SQUARE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=bc(null),l=e=>({x:eo(e.x,0,r.width),y:eo(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,flags:e.defaults.flags??["print"],strokeWidth:e.defaults.strokeWidth??2,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Et.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1}:null},d=xc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const a=o.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h=eo(e.x-d,0,r.width-s),m=eo(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,v={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},f={...i,type:Dt.SQUARE,created:new Date,id:yn(),pageIndex:t,rect:v};n(f)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:Dt.SQUARE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:Dt.SQUARE,created:new Date,id:yn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Oc={annotationType:Dt.STAMP,create(e){const{services:t,onCommit:n,getTool:o,pageSize:i}=e;return{onPointerDown:r=>{const a=o();if(!a)return;const{imageSrc:s,imageSize:l}=a.defaults,c=(t,o,s)=>{const l=r.x-o/2,c=r.y-s/2,d={origin:{x:eo(l,0,i.width-o),y:eo(c,0,i.height-s)},size:{width:o,height:s}},u={...a.defaults,rect:d,type:Dt.STAMP,icon:a.defaults.icon??Pt.Draft,subject:a.defaults.subject??"Stamp",flags:a.defaults.flags??["print"],pageIndex:e.pageIndex,id:yn(),created:new Date};n(u,{imageData:t})};s?t.processImage({source:s,maxWidth:i.width,maxHeight:i.height,onComplete:e=>c(e.imageData,(null==l?void 0:l.width)??e.width,(null==l?void 0:l.height)??e.height)}):t.requestFile({accept:"image/png,image/jpeg",onFile:e=>{t.processImage({source:e,maxWidth:i.width,maxHeight:i.height,onComplete:e=>c(e.imageData,e.width,e.height)})}})}}}},Lc={annotationType:Dt.CIRCLE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=bc(null),l=e=>({x:eo(e.x,0,r.width),y:eo(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??2,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Et.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},d=xc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const a=o.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h=eo(e.x-d,0,r.width-s),m=eo(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,v={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},f={...i,type:Dt.CIRCLE,created:new Date,id:yn(),pageIndex:t,rect:v};n(f)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:Dt.CIRCLE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:Dt.CIRCLE,flags:["print"],created:new Date,id:yn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},$c=(e,t)=>{var n;switch(t.type){case"vertex-edit":default:return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.inkList.map(e=>({points:e.points.map(e=>({x:e.x+n,y:e.y+o}))}));return{rect:t.changes.rect,inkList:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=(e,t)=>({origin:{x:e.origin.x+t,y:e.origin.y+t},size:{width:Math.max(1,e.size.width-2*t),height:Math.max(1,e.size.height-2*t)}}),c=Math.min(t.changes.rect.size.width/o.size.width,t.changes.rect.size.height/o.size.height),d=Math.max(1,Math.round(e.strokeWidth*c)),u=l(o,e.strokeWidth/2),h=l(t.changes.rect,d/2),m=h.size.width/Math.max(u.size.width,1e-6),g=h.size.height/Math.max(u.size.height,1e-6),p=e.inkList.map(e=>({points:e.points.map(e=>({x:h.origin.x+(e.x-u.origin.x)*m,y:h.origin.y+(e.y-u.origin.y)*g}))}));return{rect:t.changes.rect,inkList:p,strokeWidth:d}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth){const n={...e,...t.changes},o=n.inkList.flatMap(e=>e.points),i=et(Je(o),n.strokeWidth/2);return{...t.changes,rect:i}}return t.changes}},Fc=(e,t)=>{var n;switch(t.type){case"vertex-edit":if(t.changes.linePoints){const{start:n,end:o}=t.changes.linePoints;return{rect:Pc([n,o],e.strokeWidth,e.lineEndings),linePoints:{start:n,end:o}}}return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y;return{rect:t.changes.rect,linePoints:{start:{x:e.linePoints.start.x+n,y:e.linePoints.start.y+o},end:{x:e.linePoints.end.x+n,y:e.linePoints.end.y+o}}}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l={start:{x:t.changes.rect.origin.x+(e.linePoints.start.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.linePoints.start.y-o.origin.y)*a},end:{x:t.changes.rect.origin.x+(e.linePoints.end.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.linePoints.end.y-o.origin.y)*a}};return{rect:t.changes.rect,linePoints:l}}return t.changes;case"property-update":if(t.changes.strokeWidth||t.changes.lineEndings){const n={...e,...t.changes},o=Pc([n.linePoints.start,n.linePoints.end],n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},jc=(e,t)=>{var n;switch(t.type){case"vertex-edit":return t.changes.vertices&&t.changes.vertices.length?{rect:Pc(t.changes.vertices,e.strokeWidth,e.lineEndings),vertices:t.changes.vertices}:t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.vertices.map(e=>({x:e.x+n,y:e.y+o}));return{rect:t.changes.rect,vertices:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=e.vertices.map(e=>({x:t.changes.rect.origin.x+(e.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.y-o.origin.y)*a}));return{rect:t.changes.rect,vertices:l}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth||void 0!==t.changes.lineEndings){const n={...e,...t.changes},o=Pc(n.vertices,n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},Hc=(e,t)=>{var n;switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=e.strokeWidth/2;return{rect:et(Je(t.changes.vertices),n),vertices:t.changes.vertices}}return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.vertices.map(e=>({x:e.x+n,y:e.y+o}));return{rect:t.changes.rect,vertices:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=e.vertices.map(e=>({x:t.changes.rect.origin.x+(e.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.y-o.origin.y)*a}));return{rect:t.changes.rect,vertices:l}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth){const n={...e,...t.changes},o=n.strokeWidth/2,i=et(Je(n.vertices),o);return{...t.changes,rect:i}}return t.changes;default:return t.changes}},Uc=class extends Yn{constructor(e,t,n){var o,i,r;super(e,t),this.ANNOTATION_HISTORY_TOPIC="annotations",this.state$=ao(),this.pendingContexts=new Map,this.isInitialLoadComplete=new Map,this.importQueue=new Map,this.handlerFactories=new Map,this.activeTool$=ao(),this.events$=ao(),this.toolsChange$=ao(),this.patchRegistry=new Ac,this.config=n,this.selection=(null==(o=t.getPlugin("selection"))?void 0:o.provides())??null,this.history=(null==(i=t.getPlugin("history"))?void 0:i.provides())??null,this.interactionManager=(null==(r=t.getPlugin("interaction-manager"))?void 0:r.provides())??null,this.registerHandlerFactories(),this.registerBuiltInPatches()}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:El,payload:{documentId:e,state:t}}}(e,{pages:{},byUid:{},selectedUid:null,activeToolId:null,hasPendingChanges:!1})),this.pendingContexts.set(e,new Map),this.isInitialLoadComplete.set(e,!1),this.importQueue.set(e,[]),this.logger.debug("AnnotationPlugin","DocumentOpened",`Initialized annotation state for document: ${e}`)}onDocumentLoaded(e){const t=this.getCoreDocument(e);if((null==t?void 0:t.document)&&this.getAllAnnotations(e,t.document),this.selection)for(const e of this.state.tools)e.interaction.textSelection&&this.selection.enableForMode(e.interaction.mode??e.id)}onDocumentClosed(e){this.dispatch(function(e){return{type:_l,payload:e}}(e)),this.pendingContexts.delete(e),this.isInitialLoadComplete.delete(e),this.importQueue.delete(e),this.logger.debug("AnnotationPlugin","DocumentClosed",`Cleaned up annotation state for document: ${e}`)}registerHandlerFactories(){this.handlerFactories.set(Dt.CIRCLE,Lc),this.handlerFactories.set(Dt.SQUARE,Nc),this.handlerFactories.set(Dt.STAMP,Oc),this.handlerFactories.set(Dt.POLYGON,Rc),this.handlerFactories.set(Dt.POLYLINE,_c),this.handlerFactories.set(Dt.LINE,Ec),this.handlerFactories.set(Dt.INK,wc),this.handlerFactories.set(Dt.FREETEXT,Cc)}registerBuiltInPatches(){this.patchRegistry.register(Dt.INK,$c),this.patchRegistry.register(Dt.LINE,Fc),this.patchRegistry.register(Dt.POLYLINE,jc),this.patchRegistry.register(Dt.POLYGON,Hc)}async initialize(){var e,t;this.state.tools.forEach(e=>this.registerInteractionForTool(e)),this.history&&this.history.onHistoryChange(e=>{e.topic===this.ANNOTATION_HISTORY_TOPIC&&!1!==this.config.autoCommit&&this.commit(e.documentId)}),null==(e=this.interactionManager)||e.onModeChange(e=>{var t,n;const o=(null==(t=this.state.tools.find(t=>(t.interaction.mode??t.id)===e.activeMode))?void 0:t.id)??null;o!==((null==(n=this.state.documents[e.documentId])?void 0:n.activeToolId)??null)&&e.documentId&&this.dispatch(Vl(e.documentId,o))}),null==(t=this.selection)||t.onEndSelection(({documentId:e})=>{var t,n,o;const i=this.getActiveTool(e);if(!i||!i.interaction.textSelection)return;const r=null==(t=this.selection)?void 0:t.getFormattedSelection(),a=null==(n=this.selection)?void 0:n.getSelectedText();if(r&&a){for(const t of r)a.wait(n=>{const o=yn();this.createAnnotation(t.pageIndex,{...i.defaults,rect:t.rect,segmentRects:t.segmentRects,pageIndex:t.pageIndex,created:new Date,id:o,custom:{text:n.join("\n")}},void 0,e),this.getToolBehavior(i,"deactivateToolAfterCreate")&&this.setActiveTool(null,e),this.getToolBehavior(i,"selectAfterCreate")&&this.selectAnnotation(t.pageIndex,o,e)},wn);null==(o=this.selection)||o.clear()}})}registerInteractionForTool(e){var t;null==(t=this.interactionManager)||t.registerMode({id:e.interaction.mode??e.id,scope:"page",exclusive:e.interaction.exclusive,cursor:e.interaction.cursor})}buildCapability(){return{getActiveTool:()=>this.getActiveTool(),setActiveTool:e=>this.setActiveTool(e),getState:()=>this.getDocumentState(),getPageAnnotations:e=>this.getPageAnnotations(e),getSelectedAnnotation:()=>this.getSelectedAnnotation(),getAnnotationById:e=>this.getAnnotationById(e),selectAnnotation:(e,t)=>this.selectAnnotation(e,t),deselectAnnotation:()=>this.deselectAnnotation(),importAnnotations:e=>this.importAnnotations(e),createAnnotation:(e,t,n)=>this.createAnnotation(e,t,n),updateAnnotation:(e,t,n)=>this.updateAnnotation(e,t,n),deleteAnnotation:(e,t)=>this.deleteAnnotation(e,t),renderAnnotation:e=>this.renderAnnotation(e),commit:()=>this.commit(),forDocument:e=>this.createAnnotationScope(e),getTools:()=>this.state.tools,getTool:e=>this.getTool(e),addTool:e=>{this.dispatch((e=>({type:ql,payload:e}))(e)),this.registerInteractionForTool(e)},findToolForAnnotation:e=>this.findToolForAnnotation(e),setToolDefaults:(e,t)=>this.dispatch(((e,t)=>({type:Bl,payload:{toolId:e,patch:t}}))(e,t)),getColorPresets:()=>[...this.state.colorPresets],addColorPreset:e=>this.dispatch((e=>({type:Wl,payload:e}))(e)),transformAnnotation:(e,t)=>this.transformAnnotation(e,t),registerPatchFunction:(e,t)=>this.registerPatchFunction(e,t),onStateChange:this.state$.on,onActiveToolChange:this.activeTool$.on,onAnnotationEvent:this.events$.on,onToolsChange:this.toolsChange$.on}}createAnnotationScope(e){return{getState:()=>this.getDocumentState(e),getPageAnnotations:t=>this.getPageAnnotations(t,e),getSelectedAnnotation:()=>this.getSelectedAnnotation(e),getAnnotationById:t=>this.getAnnotationById(t,e),selectAnnotation:(t,n)=>this.selectAnnotation(t,n,e),deselectAnnotation:()=>this.deselectAnnotation(e),getActiveTool:()=>this.getActiveTool(e),setActiveTool:t=>this.setActiveTool(t,e),findToolForAnnotation:e=>this.findToolForAnnotation(e),importAnnotations:t=>this.importAnnotations(t,e),createAnnotation:(t,n,o)=>this.createAnnotation(t,n,o,e),updateAnnotation:(t,n,o)=>this.updateAnnotation(t,n,o,e),deleteAnnotation:(t,n)=>this.deleteAnnotation(t,n,e),renderAnnotation:t=>this.renderAnnotation(t,e),commit:()=>this.commit(e),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)}),onAnnotationEvent:t=>this.events$.on(n=>{n.documentId===e&&t(n)}),onActiveToolChange:t=>this.activeTool$.on(n=>{n.documentId===e&&t(n.tool)})}}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit({documentId:n,state:i}),o&&o.activeToolId!==i.activeToolId&&this.activeTool$.emit({documentId:n,tool:this.getActiveTool(n)}))}if(e.tools!==t.tools){for(const e in t.documents)this.activeTool$.emit({documentId:e,tool:this.getActiveTool(e)});this.toolsChange$.emit({tools:t.tools})}}registerPatchFunction(e,t){this.patchRegistry.register(e,t)}transformAnnotation(e,t){const n={type:t.type,changes:t.changes,metadata:t.metadata};return this.patchRegistry.transform(e,n)}registerPageHandlers(e,t,n,o){var i;const r=this.getCoreDocument(e),a=null==(i=null==r?void 0:r.document)?void 0:i.pages[t];if(!a)return()=>{};if(!this.interactionManager)return()=>{};const s=[];for(const i of this.state.tools){if(!i.defaults.type)continue;const r=this.handlerFactories.get(i.defaults.type);if(!r)continue;const l={pageIndex:t,pageSize:a.size,scale:n,services:o.services,onPreview:e=>o.onPreview(i.id,e),onCommit:(n,o)=>{this.createAnnotation(t,n,o,e),this.getToolBehavior(i,"deactivateToolAfterCreate")&&this.setActiveTool(null,e),this.getToolBehavior(i,"selectAfterCreate")&&this.selectAnnotation(t,n.id,e)},getTool:()=>this.state.tools.find(e=>e.id===i.id)},c=this.interactionManager.registerHandlers({documentId:e,modeId:i.interaction.mode??i.id,handlers:r.create(l),pageIndex:t});s.push(c)}return()=>s.forEach(e=>e())}getDocumentState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Annotation state not found for document: ${t}`);return n}getAllAnnotations(e,t){this.engine.getAllAnnotations(t).wait(t=>{this.dispatch(((e,t)=>({type:Rl,payload:{documentId:e,annotations:t}}))(e,t)),this.isInitialLoadComplete.set(e,!0);const n=this.importQueue.get(e);n&&n.length>0&&this.processImportQueue(e),this.events$.emit({type:"loaded",documentId:e,total:Object.values(t).reduce((e,t)=>e+t.length,0)})},wn)}getPageAnnotations(e,t){const{pageIndex:n}=e,o=t??this.getActiveDocumentId(),i=this.getCoreDocument(o),r=null==i?void 0:i.document;if(!r)return Ut.reject({code:Ht.NotFound,message:"Document not found"});const a=r.pages.find(e=>e.index===n);return a?this.engine.getPageAnnotations(r,a):Ut.reject({code:Ht.NotFound,message:"Page not found"})}getSelectedAnnotation(e){return(e=>e.selectedUid?e.byUid[e.selectedUid]:null)(this.getDocumentState(e))}getAnnotationById(e,t){const n=this.getDocumentState(t);return mc(n,e)}renderAnnotation({pageIndex:e,annotation:t,options:n},o){const i=o??this.getActiveDocumentId(),r=this.getCoreDocument(i),a=null==r?void 0:r.document;if(!a)return Ut.reject({code:Ht.NotFound,message:"Document not found"});const s=a.pages.find(t=>t.index===e);return s?this.engine.renderPageAnnotation(a,s,t,n):Ut.reject({code:Ht.NotFound,message:"Page not found"})}importAnnotations(e,t){const n=t??this.getActiveDocumentId();if(!this.isInitialLoadComplete.get(n)){const t=this.importQueue.get(n)||[];return t.push(...e),void this.importQueue.set(n,t)}this.processImportItems(n,e)}processImportQueue(e){const t=this.importQueue.get(e);if(!t||0===t.length)return;const n=[...t];this.importQueue.set(e,[]),this.processImportItems(e,n)}processImportItems(e,t){const n=this.pendingContexts.get(e);if(n){for(const o of t){const{annotation:t,ctx:i}=o,r=t.pageIndex,a=t.id;this.dispatch(Zl(e,r,t)),i&&n.set(a,i)}!1!==this.config.autoCommit&&this.commit(e)}}createAnnotation(e,t,n,o){const i=t.id,r=o??this.getActiveDocumentId(),a=this.pendingContexts.get(r);if(!a)return;const s={...t,author:t.author??this.config.annotationAuthor},l=()=>{this.dispatch(Zl(r,e,s)),n&&a.set(i,n),this.events$.emit({type:"create",documentId:r,annotation:s,pageIndex:e,ctx:n,committed:!1})};if(!this.history)return l(),void(this.config.autoCommit&&this.commit(r));const c={execute:l,undo:()=>{a.delete(i),this.dispatch(Gl(r)),this.dispatch(Yl(r,e,i)),this.events$.emit({type:"delete",documentId:r,annotation:s,pageIndex:e,committed:!1})}};this.history.forDocument(r).register(c,this.ANNOTATION_HISTORY_TOPIC)}buildPatch(e,t){return"rect"in t?t:this.transformAnnotation(e,{type:"property-update",changes:t})}updateAnnotation(e,t,n,o){const i=o??this.getActiveDocumentId(),r=this.getDocumentState(i).byUid[t].object,a=this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),s=()=>{this.dispatch(Kl(i,e,t,a)),this.events$.emit({type:"update",documentId:i,annotation:r,pageIndex:e,patch:a,committed:!1})};if(!this.history)return s(),void(!1!==this.config.autoCommit&&this.commit(i));const l=Object.fromEntries(Object.keys(n).map(e=>[e,r[e]])),c={execute:s,undo:()=>{this.dispatch(Kl(i,e,t,l)),this.events$.emit({type:"update",documentId:i,annotation:r,pageIndex:e,patch:l,committed:!1})}};this.history.forDocument(i).register(c,this.ANNOTATION_HISTORY_TOPIC)}deleteAnnotation(e,t,n){var o;const i=n??this.getActiveDocumentId(),r=null==(o=this.getDocumentState(i).byUid[t])?void 0:o.object;if(!r)return;const a=()=>{this.dispatch(Gl(i)),this.dispatch(Yl(i,e,t)),this.events$.emit({type:"delete",documentId:i,annotation:r,pageIndex:e,committed:!1})};if(!this.history)return a(),void(!1!==this.config.autoCommit&&this.commit(i));const s={execute:a,undo:()=>{this.dispatch(Zl(i,e,r)),this.events$.emit({type:"create",documentId:i,annotation:r,pageIndex:e,committed:!1})}};this.history.forDocument(i).register(s,this.ANNOTATION_HISTORY_TOPIC)}selectAnnotation(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Nl,payload:{documentId:e,pageIndex:t,id:n}}))(o,e,t))}deselectAnnotation(e){const t=e??this.getActiveDocumentId();this.dispatch(Gl(t))}getActiveTool(e){const t=this.getDocumentState(e);return t.activeToolId?this.state.tools.find(e=>e.id===t.activeToolId)??null:null}setActiveTool(e,t){var n,o;const i=t??this.getActiveDocumentId(),r=this.getDocumentState(i);if(e===r.activeToolId)return;this.dispatch(Vl(i,e));const a=this.state.tools.find(t=>t.id===e);a?null==(n=this.interactionManager)||n.forDocument(i).activate(a.interaction.mode??a.id):null==(o=this.interactionManager)||o.forDocument(i).activateDefaultMode()}getTool(e){return this.state.tools.find(t=>t.id===e)}findToolForAnnotation(e){let t=null,n=0;for(const o of this.state.tools){const i=o.matchScore(e);i>n&&(n=i,t=o)}return t}commit(e){const t=new gt,n=e??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o.hasPendingChanges)return Ut.resolve(!0);const i=this.getCoreDocument(n),r=null==i?void 0:i.document;if(!r)return Ut.reject({code:Ht.NotFound,message:"Document not found"});const a=this.pendingContexts.get(n);if(!a)return Ut.resolve(!0);const s=[],l=[],c=[];for(const[e,t]of Object.entries(o.byUid)){if("synced"===t.commitState)continue;const o=r.pages.find(e=>e.index===t.object.pageIndex);if(o)switch(t.commitState){case"new":const i=a.get(t.object.id),d=this.engine.createPageAnnotation(r,o,t.object,i);d.wait(()=>{this.events$.emit({type:"create",documentId:n,annotation:t.object,pageIndex:t.object.pageIndex,ctx:i,committed:!0}),a.delete(t.object.id)},wn),s.push(d);break;case"dirty":const u=this.engine.updatePageAnnotation(r,o,t.object);u.wait(()=>{this.events$.emit({type:"update",documentId:n,annotation:t.object,pageIndex:t.object.pageIndex,patch:t.object,committed:!0})},wn),l.push(u);break;case"deleted":c.push({ta:t,uid:e})}}const d=[];for(const{ta:e,uid:t}of c){const o=r.pages.find(t=>t.index===e.object.pageIndex);if("deleted"===e.commitState&&e.object.id){const i=new gt;this.engine.removePageAnnotation(r,o,e.object).wait(()=>{this.dispatch(Xl(n,t)),this.events$.emit({type:"delete",documentId:n,annotation:e.object,pageIndex:e.object.pageIndex,committed:!0}),i.resolve(!0)},i.fail),d.push(i)}else this.dispatch(Xl(n,t))}const u=[...s,...l,...d];return gt.allSettled(u).wait(()=>{this.dispatch((e=>({type:Hl,payload:{documentId:e}}))(n)),t.resolve(!0)},t.fail),t}getToolBehavior(e,t){var n;return void 0!==(null==(n=e.behavior)?void 0:n[t])?e.behavior[t]:!1!==this.config[t]}};Uc.id="annotation";let Wc=Uc;function Bc(e){return t=>(null==t?void 0:t.id)===e}const qc=Bc("highlight"),Gc=Bc("squiggly"),Vc=Bc("underline"),Zc=Bc("strikeout"),Kc={manifest:zl,create:(e,t)=>new Wc(Tl,e,t),reducer:(e,t)=>{switch(t.type){case El:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case _l:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ANNOTATION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Rl:{const{documentId:n,annotations:o}=t.payload,i=e.documents[n];if(!i)return e;const r={},a={};for(const[e,t]of Object.entries(o)){const n=Number(e),o=i.pages[n]||[];for(const e of o)delete a[e];const s=t.map(e=>{const t=e.id;return a[t]={commitState:"synced",object:e},t});r[n]=s}return{...e,documents:{...e.documents,[n]:{...i,pages:r,byUid:a}}}}case Nl:{const{documentId:n,id:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUid:o}}}:e}case Ol:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedUid:null}}}:e}case Ll:{const{documentId:n,toolId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeToolId:o}}}:e}case $l:{const{documentId:n,pageIndex:o,annotation:i}=t.payload,r=e.documents[n];if(!r)return e;const a=i.id;return{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:[...r.pages[o]??[],a]},byUid:{...r.byUid,[a]:{commitState:"new",object:i}},hasPendingChanges:!0}}}}case jl:{const{documentId:n,pageIndex:o,id:i}=t.payload,r=e.documents[n];return r&&r.byUid[i]?{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:(r.pages[o]??[]).filter(e=>e!==i)},byUid:{...r.byUid,[i]:{...r.byUid[i],commitState:"deleted"}},hasPendingChanges:!0}}}:e}case Fl:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:yc(r,o,i)}}:e}case Hl:{const{documentId:n}=t.payload,o=e.documents[n];if(!o)return e;const i={};for(const[e,t]of Object.entries(o.byUid))i[e]={...t,commitState:"dirty"===t.commitState||"new"===t.commitState?"synced":t.commitState};return{...e,documents:{...e.documents,[n]:{...o,byUid:i,hasPendingChanges:!1}}}}case Ul:{const{documentId:n,uid:o}=t.payload,i=e.documents[n];if(!i)return e;const{[o]:r,...a}=i.byUid;return{...e,documents:{...e.documents,[n]:{...i,byUid:a}}}}case ql:{const n=new Map(e.tools.map(e=>[e.id,e]));return n.set(t.payload.id,t.payload),{...e,tools:Array.from(n.values())}}case Bl:{const{toolId:n,patch:o}=t.payload;return{...e,tools:e.tools.map(e=>e.id===n?{...e,defaults:{...e.defaults,...o}}:e)}}case Wl:return e.colorPresets.includes(t.payload)?e:{...e,colorPresets:[...e.colorPresets,t.payload]};default:return e}},initialState:(e,t)=>(e=>{const t=new Map;return vc.forEach(e=>t.set(e.id,e)),(e.tools||[]).forEach(e=>t.set(e.id,e)),{documents:{},activeDocumentId:null,tools:Array.from(t.values()),colorPresets:e.colorPresets??fc}})(t)},Yc="INTERACTION/INIT_STATE",Xc="INTERACTION/CLEANUP_STATE",Qc="INTERACTION/ACTIVATE_MODE",Jc="INTERACTION/PAUSE",ed="INTERACTION/RESUME",td="INTERACTION/SET_CURSOR",nd="INTERACTION/SET_DEFAULT_MODE",od="INTERACTION/SET_EXCLUSION_RULES",id="INTERACTION/ADD_EXCLUSION_CLASS",rd="INTERACTION/REMOVE_EXCLUSION_CLASS",ad="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",sd="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function ld(e){return{type:nd,payload:{mode:e}}}function cd(e){return{type:od,payload:{rules:e}}}const dd="pointerMode",ud=class extends Yn{constructor(e,t,n){super(e,t),this.modes=new Map,this.cursorClaims=new Map,this.buckets=new Map,this.alwaysGlobal=new Map,this.alwaysPage=new Map,this.onModeChange$=ro(),this.onHandlerChange$=ro(),this.onCursorChange$=ro(),this.onStateChange$=ao(),this.registerMode({id:dd,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(ld(dd)),n.exclusionRules&&this.dispatch(cd(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:Yc,payload:{documentId:e,state:t}}}(e,t)),this.cursorClaims.set(e,new Map),this.buckets.set(e,new Map),this.alwaysGlobal.set(e,new Set),this.alwaysPage.set(e,new Map);const n=this.buckets.get(e);for(const e of this.modes.keys())n.set(e,{global:new Set,page:new Map});this.logger.debug("InteractionManagerPlugin","DocumentOpened",`Initialized interaction state for document: ${e}`)}onDocumentClosed(e){this.cursorClaims.delete(e),this.buckets.delete(e),this.alwaysGlobal.delete(e),this.alwaysPage.delete(e),this.dispatch(function(e){return{type:Xc,payload:e}}(e)),this.logger.debug("InteractionManagerPlugin","DocumentClosed",`Cleaned up interaction state for document: ${e}`)}buildCapability(){return{getActiveMode:()=>this.getActiveMode(),getActiveInteractionMode:()=>this.getActiveInteractionMode(),activate:e=>this.activate(e),activateDefaultMode:()=>this.activateDefaultMode(),setCursor:(e,t,n)=>this.setCursor(e,t,n),getCurrentCursor:()=>this.getCurrentCursor(),removeCursor:e=>this.removeCursor(e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(),pause:()=>this.pause(),resume:()=>this.resume(),isPaused:()=>this.registry.isDestroyed()||this.isPaused(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createInteractionScope(e),registerMode:e=>this.registerMode(e),registerHandlers:e=>this.registerHandlers(e),registerAlways:e=>this.registerAlways(e),setDefaultMode:e=>this.setDefaultMode(e),getDefaultMode:()=>this.state.defaultMode,getExclusionRules:()=>this.state.exclusionRules,setExclusionRules:e=>this.dispatch(cd(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:id,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:rd,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:ad,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:sd,payload:{attribute:e}}}(e)),onModeChange:this.onModeChange$.on,onCursorChange:this.onCursorChange$.on,onHandlerChange:this.onHandlerChange$.on,onStateChange:this.onStateChange$.on}}createInteractionScope(e){return{getActiveMode:()=>this.getActiveMode(e),getActiveInteractionMode:()=>this.getActiveInteractionMode(e),activate:t=>this.activate(t,e),activateDefaultMode:()=>this.activateDefaultMode(e),setCursor:(t,n,o)=>this.setCursor(t,n,o,e),getCurrentCursor:()=>this.getCurrentCursor(e),removeCursor:t=>this.removeCursor(t,e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(e),pause:()=>this.pause(e),resume:()=>this.resume(e),isPaused:()=>this.isPaused(e),getState:()=>this.getDocumentStateOrThrow(e),onModeChange:t=>this.onModeChange$.on(n=>{n.documentId===e&&t(n.activeMode)}),onCursorChange:t=>this.onCursorChange$.on(n=>{n.documentId===e&&t(n.cursor)}),onStateChange:t=>this.onStateChange$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Interaction state not found for document: ${e??"active"}`);return t}activate(e,t){var n;const o=t??this.getActiveDocumentId(),i=this.getDocumentStateOrThrow(o);if(!this.modes.has(e))throw new Error(`[interaction] unknown mode '${e}'`);if(e===i.activeMode)return;const r=i.activeMode;null==(n=this.cursorClaims.get(o))||n.clear(),this.notifyHandlersInactive(o,r),this.dispatch(function(e,t){return{type:Qc,payload:{documentId:e,mode:t}}}(o,e)),this.emitCursor(o),this.notifyHandlersActive(o,e),this.onModeChange$.emit({documentId:o,activeMode:e,previousMode:r})}activateDefaultMode(e){const t=e??this.getActiveDocumentId();this.activate(this.state.defaultMode,t)}setDefaultMode(e){if(!this.modes.has(e))throw new Error(`[interaction] cannot set unknown mode '${e}' as default`);this.dispatch(ld(e))}getActiveMode(e){return this.getDocumentStateOrThrow(e).activeMode}getActiveInteractionMode(e){const t=this.getDocumentState(e);return t?this.modes.get(t.activeMode)??null:null}activeModeIsExclusive(e){const t=this.getActiveInteractionMode(e);return!!(null==t?void 0:t.exclusive)}pause(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:Jc,payload:e}}(t))}resume(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:ed,payload:e}}(t))}isPaused(e){return this.getDocumentStateOrThrow(e).paused}registerMode(e){this.modes.set(e.id,e);for(const t of this.buckets.keys()){const n=this.buckets.get(t);n.has(e.id)||n.set(e.id,{global:new Set,page:new Map})}}registerHandlers({documentId:e,modeId:t,handlers:n,pageIndex:o}){const i=Array.isArray(t)?t:[t],r=[],a=this.buckets.get(e);if(!a)throw new Error(`No buckets found for document: ${e}`);for(const e of i){const t=a.get(e);if(!t)throw new Error(`unknown mode '${e}'`);if(null==o)t.global.add(n);else{const e=t.page.get(o)??new Set;e.add(n),t.page.set(o,e)}r.push(()=>{if(null==o)t.global.delete(n);else{const e=t.page.get(o);e&&(e.delete(n),0===e.size&&t.page.delete(o))}})}return this.onHandlerChange$.emit({...this.state}),()=>{r.forEach(e=>e()),this.onHandlerChange$.emit({...this.state})}}registerAlways({scope:e,handlers:t}){if("global"===e.type){const n=this.alwaysGlobal.get(e.documentId)??new Set;return n.add(t),this.alwaysGlobal.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{n.delete(t),this.onHandlerChange$.emit({...this.state})}}const n=this.alwaysPage.get(e.documentId)??new Map,o=n.get(e.pageIndex)??new Set;return o.add(t),n.set(e.pageIndex,o),this.alwaysPage.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{o.delete(t),this.onHandlerChange$.emit({...this.state})}}getHandlersForScope(e){var t;const n=this.getDocumentState(e.documentId);if(!n)return null;const o=this.modes.get(n.activeMode);if(!o)return null;const i=this.buckets.get(e.documentId);if(!i)return null;const r=i.get(o.id);if(!r)return null;const a=(e,t)=>e.size||t.size?function(e){const t=["onPointerDown","onPointerUp","onPointerMove","onPointerEnter","onPointerLeave","onPointerCancel","onMouseDown","onMouseUp","onMouseMove","onMouseEnter","onMouseLeave","onMouseCancel","onClick","onDoubleClick"],n={};for(const o of t)n[o]=(t,n,i)=>{var r;for(const a of e)null==(r=a[o])||r.call(a,t,n,i)};return n}([...e,...t]):null;if("global"===e.type){return a(this.alwaysGlobal.get(e.documentId)??new Set,"global"===o.scope?r.global:new Set)}return a((null==(t=this.alwaysPage.get(e.documentId))?void 0:t.get(e.pageIndex))??new Set,"page"===o.scope?r.page.get(e.pageIndex)??new Set:new Set)}setCursor(e,t,n=0,o){const i=o??this.getActiveDocumentId(),r=this.cursorClaims.get(i);r&&(r.set(e,{cursor:t,priority:n}),this.emitCursor(i))}removeCursor(e,t){const n=t??this.getActiveDocumentId(),o=this.cursorClaims.get(n);o&&(o.delete(e),this.emitCursor(n))}getCurrentCursor(e){return this.getDocumentStateOrThrow(e).cursor}emitCursor(e){var t;const n=this.cursorClaims.get(e);if(!n)return;const o=this.getDocumentState(e);if(!o)return;const i=[...n.values()].sort((e,t)=>t.priority-e.priority)[0]??{cursor:(null==(t=this.modes.get(o.activeMode))?void 0:t.cursor)??"auto"};i.cursor!==o.cursor&&(this.dispatch(function(e,t){return{type:td,payload:{documentId:e,cursor:t}}}(e,i.cursor)),this.onCursorChange$.emit({documentId:e,cursor:i.cursor}))}notifyHandlersActive(e,t){var n,o;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),null==(o=this.alwaysPage.get(e))||o.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})});const i=this.modes.get(t);if(!i)return;const r=this.buckets.get(e);if(!r)return;const a=r.get(t);a&&("global"===i.scope&&a.global.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),"page"===i.scope&&a.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})}))}notifyHandlersInactive(e,t){var n,o;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),null==(o=this.alwaysPage.get(e))||o.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})});const i=this.modes.get(t);if(!i)return;const r=this.buckets.get(e);if(!r)return;const a=r.get(t);a&&("global"===i.scope&&a.global.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),"page"===i.scope&&a.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})}))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&this.onStateChange$.emit({documentId:n,state:i})}}async initialize(e){this.logger.info("InteractionManagerPlugin","Initialize","Interaction Manager Plugin initialized")}async destroy(){this.onModeChange$.clear(),this.onCursorChange$.clear(),this.onHandlerChange$.clear(),this.onStateChange$.clear(),await super.destroy()}};ud.id="interaction-manager";let hd=ud;const md="interaction-manager",gd="pointerMode",pd={activeMode:gd,cursor:"auto",paused:!1},vd={defaultMode:gd,exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},fd={manifest:{id:md,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new hd(md,e,t),reducer:(e=vd,t)=>{switch(t.type){case Yc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Xc:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"INTERACTION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Qc:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeMode:o}}}:e}case td:{const{documentId:n,cursor:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,cursor:o}}}:e}case Jc:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!0}}}:e}case ed:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!1}}}:e}case nd:return{...e,defaultMode:t.payload.mode};case od:return{...e,exclusionRules:t.payload.rules};case id:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case rd:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case ad:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case sd:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:vd},yd=()=>po(hd.id);const bd={pointerdown:"onPointerDown",pointerup:"onPointerUp",pointermove:"onPointerMove",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",pointercancel:"onPointerCancel",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousecancel:"onMouseCancel",click:"onClick",dblclick:"onDoubleClick",touchstart:"onPointerDown",touchend:"onPointerUp",touchmove:"onPointerMove",touchcancel:"onPointerCancel"},wd=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],xd="undefined"!=typeof PointerEvent?wd:[...wd,"touchstart","touchend","touchmove","touchcancel"];function Cd(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function Id(e,t,n,o){const i=e.forDocument(t.documentId);let r=e.getHandlersForScope(t);const a=()=>{var e;return!1!==(null==(e=i.getActiveInteractionMode())?void 0:e.wantsRawTouch)},s={};let l=a();const c=e=>{xd.forEach(t=>{const o=s[t]??(s[t]=f);var i;n.addEventListener(t,o,(i=e,t.startsWith("touch")?{passive:!i}:{passive:!1}))})},d=()=>{xd.forEach(e=>{const t=s[e];t&&n.removeEventListener(e,t)})};c(l),n.style.touchAction=l?"none":"";const u=i.onModeChange(()=>{if("global"===t.type){const e=i.getActiveInteractionMode();n.style.cursor="global"===(null==e?void 0:e.scope)?e.cursor??"auto":"auto"}r=e.getHandlersForScope(t);const o=a();o!==l&&(d(),c(o),l=o,n.style.touchAction=l?"none":"")}),h=e.onHandlerChange(()=>{r=e.getHandlersForScope(t)}),m=i.getActiveInteractionMode(),g=i.getCurrentCursor();n.style.cursor="global"===t.type&&"global"!==(null==m?void 0:m.scope)?"auto":g;const p=i.onCursorChange(e=>{var o;"global"===t.type&&"global"!==(null==(o=i.getActiveInteractionMode())?void 0:o.scope)||(n.style.cursor=e)}),v=(e,t)=>{if(o)return o(e,t);const n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}};function f(t){var o;if(e.isPaused())return;const a=e.getExclusionRules();if(t.target&&function(e,t){var n,o,i;if(!e)return!1;let r=e;for(;r;){if(null==(n=t.classes)?void 0:n.length)for(const e of t.classes)if(null==(o=r.classList)?void 0:o.contains(e))return!0;if(null==(i=t.dataAttributes)?void 0:i.length)for(const e of t.dataAttributes)if(r.hasAttribute(e))return!0;r=r.parentElement}return!1}(t.target,a))return;const s=bd[t.type];if(!s||!(null==r?void 0:r[s]))return;let c,d;if(Cd(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault(),Cd(t)){const e="touchend"===t.type||"touchcancel"===t.type?t.changedTouches[0]:t.touches[0];if(!e)return;c=v(e,n),d={clientX:e.clientX,clientY:e.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,target:t.target,currentTarget:t.currentTarget,setPointerCapture:()=>{},releasePointerCapture:()=>{}}}else{const e=t;c=v(e,n),d={clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,target:e.target,currentTarget:e.currentTarget,setPointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.setPointerCapture)||n.call(t,e.pointerId)},releasePointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.releasePointerCapture)||n.call(t,e.pointerId)}}}null==(o=r[s])||o.call(r,c,d,i.getActiveMode())}return()=>{d(),u(),p(),h()}}const Sd=({children:e,documentId:t,style:n,...o})=>{const i=Ae(null),{provides:r}=yd();return Me(()=>{if(r&&i.current)return Id(r,{type:"global",documentId:t},i.current)},[r,t]),Ue("div",{ref:i,style:{width:"100%",height:"100%",...n},...o,children:e})},kd=({documentId:e,pageIndex:t,children:n,rotation:o,scale:i,convertEventToPoint:r,style:a,...s})=>{var l,c;const d=Ae(null),{provides:u}=yd(),h=function(e){const{provides:t}=yd(),[n,o]=ke(()=>{if(!t)return!1;const n=t.forDocument(e).getActiveInteractionMode();return"page"===(null==n?void 0:n.scope)&&!!n.exclusive});return Me(()=>{if(!t)return;const n=t.forDocument(e);return n.onModeChange(()=>{const e=n.getActiveInteractionMode();o("page"===(null==e?void 0:e.scope)&&!!(null==e?void 0:e.exclusive))})},[t,e]),n}(e),m=fo(e),g=null==(c=null==(l=null==m?void 0:m.document)?void 0:l.pages)?void 0:c[t],p=(null==g?void 0:g.size)??{width:0,height:0},v=o??(null==m?void 0:m.rotation)??0,f=i??(null==m?void 0:m.scale)??1,y=Ze(p,0,f),b=ze((e,t)=>{const n=t.getBoundingClientRect(),o={x:e.clientX-n.left,y:e.clientY-n.top};return function(e,t,n,o){return Qe(Xe(e,t,(4-n)%4),1/o)}(Ze({width:y.width,height:y.height},v,1),o,v,f)},[p,v,f]);return Me(()=>{if(u&&d.current)return Id(u,{type:"page",documentId:e,pageIndex:t},d.current,r||b)},[u,e,t,r,b]),Ue("div",{ref:d,style:{position:"relative",width:y.width,height:y.height,...a},...s,children:[n,h&&Ue("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},Dd={},Md=()=>po(Wc.id),Pd=e=>{var t;const{provides:n}=Md(),[o,i]=ke((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??{pages:{},byUid:{},selectedUid:null,activeToolId:null,hasPendingChanges:!1});return Me(()=>{if(!n)return;const t=n.forDocument(e);return i(t.getState()),t.onStateChange(e=>{i(e)})},[n,e]),{state:o,provides:(null==n?void 0:n.forDocument(e))??null}};function Ad({scale:e,documentId:t,pageIndex:n,rotation:o,pageWidth:i,pageHeight:r,trackedAnnotation:a,children:s,isSelected:l,isDraggable:c,isResizable:d,lockAspectRatio:u=!1,style:h={},vertexConfig:m,selectionMenu:g,outlineOffset:p=1,onDoubleClick:v,onSelect:f,zIndex:y=1,resizeUI:b,vertexUI:w,selectionOutlineColor:x="#007ACC",customAnnotationRenderer:C,...I}){const[S,k]=ke(a.object),{provides:D}=Md(),M=Ae(null),P=Te(()=>D?D.forDocument(t):null,[D,t]),A=S?{...a.object,...S}:a.object,T=(null==b?void 0:b.color)??"#007ACC",z=(null==w?void 0:w.color)??"#007ACC",E=(null==b?void 0:b.size)??12,_=(null==w?void 0:w.size)??12,{dragProps:R,vertices:N,resize:O}=Ks({controller:{element:A.rect,vertices:null==m?void 0:m.extractVertices(A),constraints:{minWidth:10,minHeight:10,boundingBox:{width:i,height:r}},maintainAspectRatio:u,pageRotation:o,scale:e,enabled:l,onUpdate:e=>{var t;if(!(null==(t=e.transformData)?void 0:t.type))return;"start"===e.state&&(M.current=A);const o=e.transformData.type,i=M.current??A,r=e.transformData.changes.vertices?null==m?void 0:m.transformAnnotation(i,e.transformData.changes.vertices):{rect:e.transformData.changes.rect},s=null==D?void 0:D.transformAnnotation(i,{type:o,changes:r,metadata:e.transformData.metadata});s&&k(e=>({...e,...s})),"end"===e.state&&s&&(M.current=null,null==P||P.updateAnnotation(n,a.object.id,s))}},resizeUI:{handleSize:E,spacing:p,offsetMode:"outside",includeSides:!u,zIndex:y+1},vertexUI:{vertexSize:_,zIndex:y+2},includeVertices:!!m}),L=function(e,{delay:t=300,tolerancePx:n=18}={}){const o=Ae({t:0,x:0,y:0}),i=ze(i=>{if(!e)return;if("mouse"===i.pointerType||!1===i.isPrimary)return;const r=performance.now(),a=i.clientX,s=i.clientY,l=r-o.current.t<=t,c=a-o.current.x,d=s-o.current.y;l&&c*c+d*d<=n*n&&(null==e||e(i)),o.current={t:r,x:a,y:s}},[e,t,n]),r=ze(t=>{null==e||e(t)},[e]);return e?{[Bs]:r,onPointerUpCapture:i}:{}}(v);return Me(()=>{k(a.object)},[a.object]),Ue("div",{"data-no-interaction":!0,children:[Ue("div",{...c&&l?R:{},...L,style:{position:"absolute",left:A.rect.origin.x*e,top:A.rect.origin.y*e,width:A.rect.size.width*e,height:A.rect.size.height*e,outline:l?`1px solid ${x}`:"none",outlineOffset:l?`${p}px`:"0px",pointerEvents:l?"auto":"none",touchAction:"none",cursor:l&&c?"move":"default",zIndex:y,...h},...I,children:[(()=>{const t="function"==typeof s?s(A):s,a=null==C?void 0:C({annotation:A,children:t,isSelected:l,scale:e,rotation:o,pageWidth:i,pageHeight:r,pageIndex:n,onSelect:f});return null!=a?a:t})(),l&&d&&O.map(({key:e,...t})=>(null==b?void 0:b.component)?b.component({key:e,...t,backgroundColor:T}):Ue("div",{...t,style:{...t.style,backgroundColor:T}},e)),l&&N.map(({key:e,...t})=>(null==w?void 0:w.component)?w.component({key:e,...t,backgroundColor:z}):Ue("div",{...t,style:{...t.style,backgroundColor:z}},e))]}),g&&Ue(qs,{rect:{origin:{x:A.rect.origin.x*e,y:A.rect.origin.y*e},size:{width:A.rect.size.width*e,height:A.rect.size.height*e}},rotation:o,children:e=>g({...e,context:{type:"annotation",annotation:a,pageIndex:n},selected:l,placement:{suggestTop:!1}})})]})}function Td({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){return Ue(U,{children:n.map((n,s)=>Ue("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:e,opacity:t,pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:void 0,...a}},s))})}function zd({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i;return Ue(U,{children:n.map((n,l)=>Ue("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:Ue("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:s,background:e,opacity:t,pointerEvents:"none"}})},l))})}function Ed({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i;return Ue(U,{children:n.map((n,l)=>Ue("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:Ue("div",{style:{position:"absolute",left:0,top:"50%",width:"100%",height:s,background:e,opacity:t,transform:"translateY(-50%)",pointerEvents:"none"}})},l))})}function _d({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i,l=6*i,c=`url("data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${2*s}" viewBox="0 0 ${l} ${2*s}">\n <path d="M0 ${s} Q ${l/4} 0 ${l/2} ${s} T ${l} ${s}"\n fill="none" stroke="${e}" stroke-width="${s}" stroke-linecap="round"/>\n </svg>`)}")`;return Ue(U,{children:n.map((e,n)=>Ue("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:Ue("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:2*s,backgroundImage:c,backgroundRepeat:"repeat-x",backgroundSize:`${l}px ${2*s}px`,opacity:t,pointerEvents:"none"}})},n))})}function Rd({isSelected:e,color:t="#000000",opacity:n=1,strokeWidth:o,inkList:i,rect:r,scale:a,onClick:s}){const l=Te(()=>i.map(({points:e})=>{let t="";return e.forEach(({x:e,y:n},o)=>{const i=e-r.origin.x,a=n-r.origin.y;t+=(0===o?"M":"L")+i+" "+a+" "}),t.trim()}),[i,r]),c=r.size.width*a,d=r.size.height*a;return Ue("svg",{style:{position:"absolute",width:c,height:d,pointerEvents:"none",zIndex:2,overflow:"visible"},width:c,height:d,viewBox:`0 0 ${r.size.width} ${r.size.height}`,children:l.map((i,r)=>Ue("path",{d:i,fill:"none",opacity:n,onPointerDown:s,onTouchStart:s,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"visibleStroke",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}},r))})}function Nd({isSelected:e,color:t="#000000",strokeColor:n,opacity:o=1,strokeWidth:i,strokeStyle:r=Et.SOLID,strokeDashArray:a,rect:s,scale:l,onClick:c}){const{width:d,height:u,x:h,y:m}=Te(()=>{const e=s.size.width,t=s.size.height;return{width:Math.max(e-i,0),height:Math.max(t-i,0),x:i/2,y:i/2}},[s,i]),g=(d+i)*l,p=(u+i)*l;return Ue("svg",{style:{position:"absolute",width:g,height:p,pointerEvents:"none",zIndex:2},width:g,height:p,viewBox:`0 0 ${d+i} ${u+i}`,children:Ue("rect",{x:h,y:m,width:d,height:u,fill:t,opacity:o,onPointerDown:c,onTouchStart:c,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"transparent"===t?"visibleStroke":"visible",stroke:n??t,strokeWidth:i,...r===Et.DASHED&&{strokeDasharray:null==a?void 0:a.join(",")}}})})}function Od({color:e="#000000",strokeColor:t,opacity:n=1,strokeWidth:o,strokeStyle:i=Et.SOLID,strokeDashArray:r,rect:a,scale:s,onClick:l,isSelected:c}){const{width:d,height:u,cx:h,cy:m,rx:g,ry:p}=Te(()=>{const e=a.size.width,t=a.size.height,n=Math.max(e-o,0),i=Math.max(t-o,0);return{width:e,height:t,cx:o/2+n/2,cy:o/2+i/2,rx:n/2,ry:i/2}},[a,o]),v=d*s,f=u*s;return Ue("svg",{style:{position:"absolute",width:v,height:f,pointerEvents:"none",zIndex:2},width:v,height:f,viewBox:`0 0 ${d} ${u}`,children:Ue("ellipse",{cx:h,cy:m,rx:g,ry:p,fill:e,opacity:n,onPointerDown:l,onTouchStart:l,style:{cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===e?"visibleStroke":"visible",stroke:t??e,strokeWidth:o,...i===Et.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}})})}function Ld({color:e="transparent",opacity:t=1,strokeWidth:n,strokeColor:o="#000000",strokeStyle:i=Et.SOLID,strokeDashArray:r,rect:a,linePoints:s,lineEndings:l,scale:c,onClick:d,isSelected:u}){const{x1:h,y1:m,x2:g,y2:p}=Te(()=>({x1:s.start.x-a.origin.x,y1:s.start.y-a.origin.y,x2:s.end.x-a.origin.x,y2:s.end.y-a.origin.y}),[s,a]),v=Te(()=>{const e=Math.atan2(p-m,g-h);return{start:zc.createEnding(null==l?void 0:l.start,n,e+Math.PI,h,m),end:zc.createEnding(null==l?void 0:l.end,n,e,g,p)}},[l,n,h,m,g,p]),f=a.size.width*c,y=a.size.height*c;return Ue("svg",{style:{position:"absolute",width:f,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:f,height:y,viewBox:`0 0 ${a.size.width} ${a.size.height}`,children:[Ue("line",{x1:h,y1:m,x2:g,y2:p,opacity:t,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",pointerEvents:u?"none":"visibleStroke",stroke:o,strokeWidth:n,strokeLinecap:"butt",...i===Et.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),v.start&&Ue("path",{d:v.start.d,transform:v.start.transform,onPointerDown:d,onTouchStart:d,stroke:o,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":v.start.filled?"visible":"visibleStroke",...i===Et.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:v.start.filled?e:"none"}),v.end&&Ue("path",{d:v.end.d,transform:v.end.transform,stroke:o,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":v.end.filled?"visible":"visibleStroke",...i===Et.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:v.end.filled?e:"none"})]})}function $d({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,scale:a,isSelected:s,onClick:l,lineEndings:c}){const d=Te(()=>t.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[t,e]),u=Te(()=>{if(!d.length)return"";const[e,...t]=d;return`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("").trim()},[d]),h=Te(()=>{if(d.length<2)return{start:null,end:null};const e=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),t=e(d[0],d[1]),n=e(d[d.length-2],d[d.length-1]);return{start:zc.createEnding(null==c?void 0:c.start,r,t+Math.PI,d[0].x,d[0].y),end:zc.createEnding(null==c?void 0:c.end,r,n,d[d.length-1].x,d[d.length-1].y)}},[d,c,r]),m=e.size.width*a,g=e.size.height*a;return Ue("svg",{style:{position:"absolute",width:m,height:g,pointerEvents:"none",zIndex:2,overflow:"visible"},width:m,height:g,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[Ue("path",{d:u,onPointerDown:l,onTouchStart:l,opacity:i,style:{fill:"none",stroke:o??n,strokeWidth:r,cursor:s?"move":"pointer",pointerEvents:s?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"}}),h.start&&Ue("path",{d:h.start.d,transform:h.start.transform,stroke:o,fill:h.start.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.start.filled?"visible":"visibleStroke",strokeLinecap:"butt"}}),h.end&&Ue("path",{d:h.end.d,transform:h.end.transform,stroke:o,fill:h.end.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.end.filled?"visible":"visibleStroke",strokeLinecap:"butt"}})]})}function Fd({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=Et.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,currentVertex:u,handleSize:h=14}){const m=u?[...t,u]:t,g=Te(()=>m.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[m,e]),p=Te(()=>{if(!g.length)return"";const[e,...t]=g,n=!!u;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()},[g,u]),v=u&&t.length>0,f=e.size.width*l,y=e.size.height*l;return Ue("svg",{style:{position:"absolute",width:f,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:f,height:y,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[Ue("path",{d:p,onPointerDown:d,onTouchStart:d,opacity:i,style:{fill:u?"none":n,stroke:o??n,strokeWidth:r,cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===n?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...a===Et.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),v&&t.length>1&&Ue("path",{d:`M ${g[g.length-1].x} ${g[g.length-1].y} L ${g[0].x} ${g[0].y}`,fill:"none",style:{stroke:o,strokeWidth:r,strokeDasharray:"4,4",opacity:.7}}),v&&t.length>=2&&Ue("rect",{x:g[0].x-h/l/2,y:g[0].y-h/l/2,width:h/l,height:h/l,fill:o,opacity:.4,stroke:o,strokeWidth:r/2})]})}function jd({isSelected:e,isEditing:t,annotation:n,pageIndex:o,scale:i,onClick:r}){const a=Ae(null),{provides:s}=Md(),[l,c]=ke(!1);Me(()=>{if(t&&a.current){const e=a.current;e.focus();const t=window.getSelection();if(t){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}},[t]),Pe(()=>{try{const e=navigator,t=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1;c(t)}catch{c(!1)}},[]);const d=n.object.fontSize*i,u=l&&t&&d>0&&d<16,h=u?16:d,m=u?d/16:1,g=u?100/m:100;return Ue("div",{style:{position:"absolute",width:n.object.rect.size.width*i,height:n.object.rect.size.height*i,cursor:e&&!t?"move":"default",pointerEvents:e&&!t?"none":"auto",zIndex:2},onPointerDown:r,onTouchStart:r,children:Ue("span",{ref:a,onBlur:()=>{s&&a.current&&s.updateAnnotation(o,n.object.id,{contents:a.current.innerText})},tabIndex:0,style:{color:n.object.fontColor,fontSize:h,fontFamily:(p=n.object.fontFamily,rn(p).css),textAlign:Xt(n.object.textAlign),flexDirection:"column",justifyContent:n.object.verticalAlign===Ct.Top?"flex-start":n.object.verticalAlign===Ct.Middle?"center":"flex-end",display:"flex",backgroundColor:n.object.backgroundColor,opacity:n.object.opacity,width:u?`${g}%`:"100%",height:u?`${g}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t?"text":"pointer",outline:"none",transform:u?`scale(${m})`:void 0,transformOrigin:"top left"},contentEditable:t,...Dd,children:n.object.contents})});var p}function Hd({documentId:e,pageIndex:t,annotation:n,scaleFactor:o=1,style:i,...r}){const{provides:a}=Md(),[s,l]=ke(null),c=Ae(null),{width:d,height:u}=n.rect.size;Me(()=>{if(a){const i=a.forDocument(e).renderAnnotation({pageIndex:t,annotation:n,options:{scaleFactor:o,dpr:window.devicePixelRatio}});return i.wait(e=>{const t=URL.createObjectURL(e);l(t),c.current=t},wn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):i.abort({code:Ht.Cancelled,message:"canceled render task"})}}},[t,o,a,e,n.id,d,u]);return Ue(U,{children:s&&Ue("img",{src:s,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},...r,style:{width:"100%",height:"100%",display:"block",...i||{}}})})}function Ud({isSelected:e,annotation:t,documentId:n,pageIndex:o,scale:i,onClick:r}){return Ue("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e?"none":"auto",cursor:"pointer"},onPointerDown:r,onTouchStart:r,children:Ue(Hd,{documentId:n,pageIndex:o,annotation:{...t.object,id:t.object.id},scaleFactor:i})})}function Wd(e){const{documentId:t,pageIndex:n,scale:o,selectionMenu:i}=e,{provides:r}=Md(),{provides:a}=Ys(),[s,l]=ke([]),{register:c}=function({modeId:e,pageIndex:t,documentId:n}){const{provides:o}=yd();return{register:(i,r)=>{const a=(null==r?void 0:r.modeId)??e,s=(null==r?void 0:r.pageIndex)??t,l=(null==r?void 0:r.documentId)??n;return a?null==o?void 0:o.registerHandlers({modeId:a,handlers:i,pageIndex:s,documentId:l}):null==o?void 0:o.registerAlways({scope:void 0!==s?{type:"page",documentId:l,pageIndex:s}:{type:"global",documentId:l},handlers:i})}}}({documentId:t,pageIndex:n}),[d,u]=ke(null),[h,m]=ke(null),g=Te(()=>r?r.forDocument(t):null,[r,t]);Me(()=>{if(g){const e=g.getState();return l(hc(e,n)),u(gc(e,n)),g.onStateChange(e=>{l(hc(e,n)),u(gc(e,n))})}},[g,n]);const p=Te(()=>({onPointerDown:(e,t)=>{t.target===t.currentTarget&&g&&(g.deselectAnnotation(),m(null))}}),[g]),v=ze((e,t)=>{e.stopPropagation(),g&&a&&(g.selectAnnotation(n,t.object.id),a.clear(),t.object.id!==h&&m(null))},[g,a,h,n]);return Me(()=>c(p,{documentId:t}),[c,p]),Ue(U,{children:s.map(r=>{const a=(null==d?void 0:d.object.id)===r.object.id,s=h===r.object.id,l=null==g?void 0:g.findToolForAnnotation(r.object);return Ql(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(Rd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):tc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(Nd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):Jl(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(Od,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):rc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(zd,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):ac(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(Ed,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):sc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(_d,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):ic(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:mn(r.object.blendMode??It.Multiply)},...e,children:e=>Ue(Td,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):nc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})},style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(U,{children:Ue(Ld,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):oc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(U,{children:Ue($d,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):ec(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(U,{children:Ue(Fd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):lc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:((null==l?void 0:l.interaction.isDraggable)??!0)&&!s,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},onDoubleClick:e=>{e.stopPropagation(),m(r.object.id)},...e,children:e=>Ue(jd,{isSelected:a,isEditing:s,annotation:{...r,object:e},pageIndex:n,scale:o,onClick:e=>v(e,r)})},r.object.id):cc(r)?Ue(Ad,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:mn(r.object.blendMode??It.Normal)},...e,children:e=>Ue(Ud,{isSelected:a,annotation:r,documentId:t,pageIndex:n,scale:o,onClick:e=>v(e,r)})},r.object.id):null})})}function Bd({documentId:e,pageIndex:t,scale:n}){var o,i,r,a,s,l,c,d,u,h,m,g;const{provides:p}=Ys(),{provides:v}=Md(),[f,y]=ke([]),[b,w]=ke(null),[x,C]=ke(null);if(Me(()=>{if(p)return p.forDocument(e).onSelectionChange(()=>{y(p.forDocument(e).getHighlightRectsForPage(t)),w(p.forDocument(e).getBoundingRectForPage(t))})},[p,e,t]),Me(()=>{if(v)return C(v.forDocument(e).getActiveTool()),v.forDocument(e).onActiveToolChange(e=>C(e))},[v,e]),!b)return null;if(!x||!x.defaults)return null;switch(x.defaults.type){case Dt.UNDERLINE:return Ue("div",{style:{mixBlendMode:mn((null==(o=x.defaults)?void 0:o.blendMode)??It.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Ue(zd,{color:null==(i=x.defaults)?void 0:i.color,opacity:null==(r=x.defaults)?void 0:r.opacity,segmentRects:f,scale:n})});case Dt.HIGHLIGHT:return Ue("div",{style:{mixBlendMode:mn((null==(a=x.defaults)?void 0:a.blendMode)??It.Multiply),pointerEvents:"none",position:"absolute",inset:0},children:Ue(Td,{color:null==(s=x.defaults)?void 0:s.color,opacity:null==(l=x.defaults)?void 0:l.opacity,segmentRects:f,scale:n})});case Dt.STRIKEOUT:return Ue("div",{style:{mixBlendMode:mn((null==(c=x.defaults)?void 0:c.blendMode)??It.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Ue(Ed,{color:null==(d=x.defaults)?void 0:d.color,opacity:null==(u=x.defaults)?void 0:u.opacity,segmentRects:f,scale:n})});case Dt.SQUIGGLY:return Ue("div",{style:{mixBlendMode:mn((null==(h=x.defaults)?void 0:h.blendMode)??It.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Ue(_d,{color:null==(m=x.defaults)?void 0:m.color,opacity:null==(g=x.defaults)?void 0:g.opacity,segmentRects:f,scale:n})});default:return null}}function qd({preview:e,scale:t}){const{bounds:n}=e,o={position:"absolute",left:n.origin.x*t,top:n.origin.y*t,width:n.size.width*t,height:n.size.height*t,pointerEvents:"none",zIndex:10};return e.type===Dt.CIRCLE?Ue("div",{style:o,children:Ue(Od,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.SQUARE?Ue("div",{style:o,children:Ue(Nd,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.POLYGON?Ue("div",{style:o,children:Ue(Fd,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.POLYLINE?Ue("div",{style:o,children:Ue($d,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.LINE?Ue("div",{style:o,children:Ue(Ld,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.INK?Ue("div",{style:o,children:Ue(Rd,{isSelected:!1,scale:t,...e.data})}):e.type===Dt.FREETEXT?Ue("div",{style:o,children:Ue("div",{style:{width:"100%",height:"100%",border:`1px dashed ${e.data.fontColor||"#000000"}`,backgroundColor:"transparent"}})}):null}function Gd({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=go(Wc.id),[i,r]=ke(new Map),a=Ae(null),s=Ae(null),l=Te(()=>({requestFile:({accept:e,onFile:t})=>{if(!a.current)return;const n=a.current;n.accept=e,n.onchange=e=>{var o;const i=null==(o=e.target.files)?void 0:o[0];i&&(t(i),n.value="")},n.click()},processImage:({source:e,maxWidth:t,maxHeight:n,onComplete:o})=>{const i=s.current;if(!i||!i.getContext)return;const r=i.getContext("2d");if(!r)return;const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{let{naturalWidth:s,naturalHeight:l}=a;const c=t?t/s:1,d=n?n/l:1,u=Math.min(c,d,1),h=s*u,m=l*u;i.width=h,i.height=m,r.drawImage(a,0,0,h,m);const g=r.getImageData(0,0,h,m);"string"!=typeof e&&URL.revokeObjectURL(a.src),o({imageData:g,width:h,height:m})},a.src="string"==typeof e?e:URL.createObjectURL(e)}}),[]);return Me(()=>{if(o)return o.registerPageHandlers(e,t,n,{services:l,onPreview:(e,t)=>{r(n=>{const o=new Map(n);return t?o.set(e,t):o.delete(e),o})}})},[e,t,n,o,l]),Ue(U,{children:[Ue("input",{ref:a,type:"file",style:{display:"none"}}),Ue("canvas",{ref:s,style:{display:"none"}}),Array.from(i.entries()).map(([e,t])=>Ue(qd,{preview:t,scale:n},e))]})}function Vd({style:e,documentId:t,pageIndex:n,scale:o,rotation:i,selectionMenu:r,resizeUI:a,vertexUI:s,selectionOutlineColor:l,customAnnotationRenderer:c,...d}){var u,h,m,g;const p=fo(t),v=null==(h=null==(u=null==p?void 0:p.document)?void 0:u.pages)?void 0:h[n],f=(null==(m=null==v?void 0:v.size)?void 0:m.width)??0,y=(null==(g=null==v?void 0:v.size)?void 0:g.height)??0,b=Te(()=>void 0!==o?o:(null==p?void 0:p.scale)??1,[o,null==p?void 0:p.scale]);return Ue("div",{style:{...e},...d,children:[Ue(Wd,{documentId:t,selectionMenu:r,pageIndex:n,scale:b,rotation:Te(()=>void 0!==i?i:(null==p?void 0:p.rotation)??We.Degree0,[i,null==p?void 0:p.rotation]),pageWidth:f,pageHeight:y,resizeUI:a,vertexUI:s,selectionOutlineColor:l,customAnnotationRenderer:c}),Ue(Bd,{documentId:t,pageIndex:n,scale:b}),Ue(Gd,{documentId:t,pageIndex:n,scale:b})]})}const Zd="print",Kd={id:Zd,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},Yd=class extends Yn{constructor(e,t,n){super(e,t),this.printReady$=ro()}buildCapability(){return{print:e=>this.print(e),forDocument:e=>this.createPrintScope(e)}}createPrintScope(e){return{print:t=>this.print(t,e)}}print(e,t){const n=t??this.getActiveDocumentId(),o=e??{},i=new gt;i.progress({stage:"preparing",message:"Preparing document..."});return this.preparePrintDocument(o,n).wait(e=>{i.progress({stage:"document-ready",message:"Document prepared successfully"}),this.printReady$.emit({documentId:n,options:o,buffer:e,task:i})},e=>i.fail(e)),i}preparePrintDocument(e,t){const n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.preparePrintDocument(n.document,e):Ut.reject({code:Ht.DocNotOpen,message:`Document ${t} not found`})}onPrintRequest(e){return this.printReady$.on(e)}async initialize(e){this.logger.info("PrintPlugin","Initialize","Print plugin initialized")}async destroy(){this.printReady$.clear(),await super.destroy()}};Yd.id="print";let Xd=Yd;const Qd=()=>po(Xd.id);const Jd=co({manifest:Kd,create:(e,t)=>new Xd(Zd,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{provides:e}=Qd(),{plugin:t}=go(Xd.id),n=Ae(null),o=Ae(null);return Me(()=>{if(!e||!t)return;const i=t.onPrintRequest(({buffer:e,task:t})=>{const i=n.current;if(!i)return;o.current&&(URL.revokeObjectURL(o.current),o.current=null);const r=URL.createObjectURL(new Blob([e],{type:"application/pdf"}));o.current=r,i.onload=()=>{var n,o;i.src===r&&(t.progress({stage:"iframe-ready",message:"Ready to print"}),null==(n=i.contentWindow)||n.focus(),null==(o=i.contentWindow)||o.print(),t.progress({stage:"printing",message:"Print dialog opened"}),t.resolve(e))},i.src=r});return()=>{i(),o.current&&URL.revokeObjectURL(o.current)}},[e,t]),Ue("iframe",{ref:n,style:{position:"absolute",display:"none"},title:"Print Document",src:"about:blank"})}).build(),eu="fullscreen",tu={id:eu,name:"Fullscreen Plugin",version:"1.0.0",provides:["fullscreen"],requires:[],optional:[],defaultConfig:{}},nu="SET_FULLSCREEN";const ou=class extends Yn{constructor(e,t,n){super(e,t),this.onStateChange$=ao(),this.fullscreenRequest$=ro(),this.config=n}async initialize(e){}buildCapability(){return{isFullscreen:()=>this.state.isFullscreen,enableFullscreen:e=>this.enableFullscreen(e),exitFullscreen:()=>this.exitFullscreen(),toggleFullscreen:e=>this.toggleFullscreen(e),onRequest:this.fullscreenRequest$.on,onStateChange:this.onStateChange$.on}}getTargetSelector(){return this.currentTargetElement??this.config.targetElement}toggleFullscreen(e){this.state.isFullscreen?this.exitFullscreen():this.enableFullscreen(e)}enableFullscreen(e){this.currentTargetElement=e??this.config.targetElement,this.fullscreenRequest$.emit({action:"enter",targetElement:this.currentTargetElement})}exitFullscreen(){this.fullscreenRequest$.emit({action:"exit"}),this.currentTargetElement=void 0}onStoreUpdated(e,t){this.onStateChange$.emit(t)}setFullscreenState(e){this.dispatch({type:nu,payload:e})}async destroy(){this.fullscreenRequest$.clear(),super.destroy()}};ou.id="fullscreen";let iu=ou;const ru=()=>go(iu.id);async function au(e,t,n){if("enter"===e.action){const o=function(e,t,n){if(!t||"enter"!==e.action)return t;let o=null;return n&&(o=t.querySelector(n),o||console.warn(`Fullscreen: Could not find element with selector "${n}" within the wrapper. Falling back to wrapper element.`)),o||(o=t),o}(e,t,n);o&&!document.fullscreenElement&&await o.requestFullscreen()}else document.fullscreenElement&&await document.exitFullscreen()}const su=co({manifest:tu,create:(e,t)=>new iu(eu,e,t),reducer:(e,t)=>t.type===nu?{...e,isFullscreen:t.payload}:e,initialState:{isFullscreen:!1}}).addWrapper(function({children:e,...t}){const{provides:n}=po(iu.id),{plugin:o}=ru(),{plugin:i}=ru(),r=Ae(null);return Me(()=>{if(!n||!o)return;return n.onRequest(async e=>{const t=o.getTargetSelector();await au(e,r.current,t)})},[n,o]),Me(()=>{if(!i)return;const e=()=>i.setFullscreenState(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[i]),Ue("div",{...t,style:{position:"relative",width:"100%",height:"100%",...t.style},ref:r,children:e})}).build(),lu="bookmark",cu={id:lu,name:"Bookmark Plugin",version:"1.0.0",provides:["bookmark"],requires:[],optional:[],defaultConfig:{}},du=class extends Yn{constructor(e,t){super(e,t)}async initialize(e){}buildCapability(){return{getBookmarks:()=>this.getBookmarks(),forDocument:e=>this.createBookmarkScope(e)}}createBookmarkScope(e){return{getBookmarks:()=>this.getBookmarks(e)}}getBookmarks(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))throw new Error(`Document ${t} not loaded`);return this.engine.getBookmarks(n.document)}};du.id="bookmark";let uu=du;const hu={manifest:cu,create:e=>new uu(lu,e),reducer:()=>{},initialState:{}},mu=class extends Yn{constructor(e,t,n){super(e,t),this.downloadRequest$=ro(),this.config=n}buildCapability(){return{saveAsCopy:()=>this.saveAsCopy(),download:()=>this.download(),forDocument:e=>this.createExportScope(e)}}createExportScope(e){return{saveAsCopy:()=>this.saveAsCopy(e),download:()=>this.download(e)}}download(e){const t=e??this.getActiveDocumentId();this.downloadRequest$.emit({documentId:t})}saveAsCopy(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.saveAsCopy(n.document):Ut.reject({code:Ht.DocNotOpen,message:`Document ${t} not found`})}saveAsCopyAndGetBufferAndName(e){const t=new gt,n=this.coreState.core.documents[e];return(null==n?void 0:n.document)?(this.saveAsCopy(e).wait(e=>{t.resolve({buffer:e,name:n.name??this.config.defaultFileName})},e=>t.fail(e)),t):Ut.reject({code:Ht.DocNotOpen,message:`Document ${e} not found`})}onRequest(e){return this.downloadRequest$.on(e)}async initialize(e){this.logger.info("ExportPlugin","Initialize","Export plugin initialized")}async destroy(){this.downloadRequest$.clear(),await super.destroy()}};mu.id="export";let gu=mu;const pu="export";const vu=co({manifest:{id:pu,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{defaultFileName:"document.pdf"}},create:(e,t)=>new gu(pu,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{plugin:e}=go(gu.id),t=Ae(null);return Me(()=>{if(!e)return;return e.onRequest(n=>{const o=t.current;if(!o)return;e.saveAsCopyAndGetBufferAndName(n.documentId).wait(({buffer:e,name:t})=>{const n=URL.createObjectURL(new Blob([e]));o.href=n,o.download=t,o.click(),URL.revokeObjectURL(n)},wn)})},[e]),Ue("a",{style:{display:"none"},ref:t})}).build(),fu="PAN/INIT_STATE",yu="PAN/CLEANUP_STATE",bu="PAN/SET_PAN_MODE";const wu=class extends Yn{constructor(e,t,n){var o,i,r;super(e,t),this.panMode$=ao(),this.documentHandlers=new Map,this.config=n,this.interactionManager=null==(o=t.getPlugin(hd.id))?void 0:o.provides(),this.viewport=null==(i=t.getPlugin(Oo.id))?void 0:i.provides(),this.interactionManager&&(this.interactionManager.registerMode({id:"panMode",scope:"global",exclusive:!1,cursor:"grab",wantsRawTouch:!1}),null==(r=this.interactionManager)||r.onModeChange(e=>{const t="panMode"===e.activeMode,n=this.getDocumentState(e.documentId);n&&n.isPanMode!==t&&this.dispatch(function(e,t){return{type:bu,payload:{documentId:e,isPanMode:t}}}(e.documentId,t))}))}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:fu,payload:{documentId:e,state:t}}}(e,{isPanMode:!1})),this.registerPanHandlersForDocument(e),"always"===this.config.defaultMode&&this.makePanDefault(!0),this.logger.debug("PanPlugin","DocumentOpened",`Initialized pan state for document: ${e}`)}onDocumentClosed(e){const t=this.documentHandlers.get(e);t&&(t(),this.documentHandlers.delete(e)),this.dispatch(function(e){return{type:yu,payload:e}}(e)),this.logger.debug("PanPlugin","DocumentClosed",`Cleaned up pan state for document: ${e}`)}buildCapability(){return{enablePan:()=>this.enablePan(),disablePan:()=>this.disablePan(),togglePan:()=>this.togglePan(),makePanDefault:e=>this.makePanDefault(e),isPanMode:()=>this.isPanMode(),forDocument:e=>this.createPanScope(e),onPanModeChange:this.panMode$.on}}createPanScope(e){return{enablePan:()=>this.enablePan(e),disablePan:()=>this.disablePan(e),togglePan:()=>this.togglePan(e),isPanMode:()=>this.isPanMode(e),onPanModeChange:t=>this.panMode$.on(n=>{n.documentId===e&&t(n.isPanMode)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Pan state not found for document: ${e??"active"}`);return t}enablePan(e){const t=e??this.getActiveDocumentId();this.interactionManager.forDocument(t).activate("panMode")}disablePan(e){const t=e??this.getActiveDocumentId();this.interactionManager.forDocument(t).activateDefaultMode()}togglePan(e){const t=e??this.getActiveDocumentId(),n=this.interactionManager.forDocument(t);"panMode"===n.getActiveMode()?n.activateDefaultMode():n.activate("panMode")}makePanDefault(e=!0){this.interactionManager&&(this.interactionManager.setDefaultMode("panMode"),e&&this.interactionManager.activateDefaultMode())}isPanMode(e){return this.getDocumentStateOrThrow(e).isPanMode}registerPanHandlersForDocument(e){if(!this.interactionManager||!this.viewport)return;let t=null;const n=this.interactionManager.forDocument(e),o=this.viewport.forDocument(e),i={onMouseDown:(e,i)=>{const r=o.getMetrics();t={startX:i.clientX,startY:i.clientY,startLeft:r.scrollLeft,startTop:r.scrollTop},n.setCursor("panMode","grabbing",10)},onMouseMove:(e,n)=>{if(!t)return;const i=n.clientX-t.startX,r=n.clientY-t.startY;o.scrollTo({x:t.startLeft-i,y:t.startTop-r})},onMouseUp:()=>{t&&(t=null,n.removeCursor("panMode"))},onMouseLeave:()=>{t&&(t=null,n.removeCursor("panMode"))},onMouseCancel:()=>{t&&(t=null,n.removeCursor("panMode"))}},r=this.interactionManager.registerHandlers({documentId:e,modeId:"panMode",handlers:i});this.documentHandlers.set(e,r)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.isPanMode)!==i.isPanMode&&(this.panMode$.emit({documentId:n,isPanMode:i.isPanMode}),this.logger.debug("PanPlugin","PanModeChanged",`Pan mode changed for document ${n}: ${(null==o?void 0:o.isPanMode)??!1} -> ${i.isPanMode}`))}}async initialize(e){this.logger.info("PanPlugin","Initialize","Pan plugin initialized")}async destroy(){this.documentHandlers.forEach(e=>e()),this.documentHandlers.clear(),this.panMode$.clear(),await super.destroy()}};wu.id="pan";let xu=wu;const Cu={documents:{},activeDocumentId:null},Iu=co({manifest:{id:"pan",name:"Pan Plugin",version:"1.0.0",provides:["pan"],requires:["interaction-manager","viewport"],optional:[],defaultConfig:{defaultMode:"mobile"}},create:(e,t)=>new xu("pan",e,t),reducer:(e=Cu,t)=>{switch(t.type){case fu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case yu:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"PAN/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case bu:{const{documentId:n,isPanMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isPanMode:o}}}:e}default:return e}},initialState:Cu}).addUtility(()=>{const{provides:e}=po(xu.id),{plugin:t}=go(xu.id);return Me(()=>{var n;if(!e||!t)return;const o=(null==(n=t.config)?void 0:n.defaultMode)??"never",i="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);"mobile"===o&&i&&e.makePanDefault()},[e,t]),null}).build(),Su="capture",ku={id:Su,name:"Capture Plugin",version:"1.0.0",provides:["capture"],requires:["render"],optional:["interaction-manager"],defaultConfig:{scale:1,imageType:"image/png",withAnnotations:!1}};const Du="CAPTURE/INIT_STATE",Mu="CAPTURE/CLEANUP_STATE",Pu="CAPTURE/SET_MARQUEE_CAPTURE_ACTIVE";const Au={isMarqueeCaptureActive:!1},Tu={documents:{},activeDocumentId:null},zu=class extends Yn{constructor(e,t,n){var o;super(e,t),this.captureArea$=ro(),this.state$=ao(),this.config=n,this.renderCapability=this.registry.getPlugin("render").provides(),this.interactionManagerCapability=null==(o=this.registry.getPlugin("interaction-manager"))?void 0:o.provides(),this.interactionManagerCapability&&(this.interactionManagerCapability.registerMode({id:"marqueeCapture",scope:"page",exclusive:!0,cursor:"crosshair"}),this.interactionManagerCapability.onModeChange(e=>{const t="marqueeCapture"===e.activeMode,n=this.getDocumentState(e.documentId);var o;n&&n.isMarqueeCaptureActive!==t&&this.dispatch((o=e.documentId,{type:Pu,payload:{documentId:o,isActive:t}}))}))}onDocumentLoadingStarted(e){const t={...Au};this.dispatch(function(e,t){return{type:Du,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("CapturePlugin","DocumentOpened",`Initialized capture state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:Mu,payload:e}}(e)),this.logger.debug("CapturePlugin","DocumentClosed",`Cleaned up capture state for document: ${e}`)}async initialize(e){}buildCapability(){return{captureArea:(e,t)=>this.captureArea(e,t),enableMarqueeCapture:()=>this.enableMarqueeCapture(),disableMarqueeCapture:()=>this.disableMarqueeCapture(),toggleMarqueeCapture:()=>this.toggleMarqueeCapture(),isMarqueeCaptureActive:()=>this.isMarqueeCaptureActive(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createCaptureScope(e),registerMarqueeOnPage:e=>this.registerMarqueeOnPage(e),onCaptureArea:this.captureArea$.on,onStateChange:this.state$.on}}createCaptureScope(e){return{captureArea:(t,n)=>this.captureArea(t,n,e),enableMarqueeCapture:()=>this.enableMarqueeCapture(e),disableMarqueeCapture:()=>this.disableMarqueeCapture(e),toggleMarqueeCapture:()=>this.toggleMarqueeCapture(e),isMarqueeCaptureActive:()=>this.isMarqueeCaptureActive(e),getState:()=>this.getDocumentStateOrThrow(e),onCaptureArea:t=>this.captureArea$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Capture state not found for document: ${e??"active"}`);return t}registerMarqueeOnPage(e){if(!this.interactionManagerCapability)return this.logger.warn("CapturePlugin","MissingDependency","Interaction manager plugin not loaded, marquee capture disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!t||!t.document)return this.logger.warn("CapturePlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("CapturePlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r}=e;let a=null,s=null;return{onPointerDown:(e,t)=>{var n;a=e,s={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(s),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!a)return;const n=eo(e.x,0,t.width),o=eo(e.y,0,t.height);s={origin:{x:Math.min(a.x,n),y:Math.min(a.y,o)},size:{width:Math.abs(n-a.x),height:Math.abs(o-a.y)}},null==i||i(s)},onPointerUp:(e,t)=>{var l;s&&Math.max(s.size.width,s.size.height)*n>o&&(null==r||r(s)),a=null,s=null,null==i||i(null),null==(l=t.releasePointerCapture)||l.call(t)},onPointerCancel:(e,t)=>{var n;a=null,s=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;this.captureArea(e.pageIndex,t,e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t)}});return this.interactionManagerCapability.registerHandlers({documentId:e.documentId,modeId:"marqueeCapture",handlers:o,pageIndex:e.pageIndex})}captureArea(e,t,n){const o=n??this.getActiveDocumentId();this.disableMarqueeCapture(o);this.renderCapability.forDocument(o).renderPageRect({pageIndex:e,rect:t,options:{imageType:this.config.imageType,scaleFactor:this.config.scale,withAnnotations:this.config.withAnnotations||!1}}).wait(n=>{this.captureArea$.emit({documentId:o,pageIndex:e,rect:t,blob:n,imageType:this.config.imageType||"image/png",scale:this.config.scale||1,withAnnotations:this.config.withAnnotations||!1})},wn)}enableMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate("marqueeCapture")}disableMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activateDefaultMode()}toggleMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);"marqueeCapture"===(null==o?void 0:o.getActiveMode())?o.activateDefaultMode():null==o||o.activate("marqueeCapture")}isMarqueeCaptureActive(e){var t;const n=e??this.getActiveDocumentId();return"marqueeCapture"===(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o&&i&&o.isMarqueeCaptureActive!==i.isMarqueeCaptureActive&&this.state$.emit({documentId:n,state:i})}}async destroy(){this.captureArea$.clear(),this.state$.clear(),super.destroy()}};zu.id="capture";let Eu=zu;const _u={manifest:ku,create:(e,t)=>new Eu(Su,e,t),reducer:(e=Tu,t)=>{switch(t.type){case Du:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Mu:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"CAPTURE/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Pu:{const{documentId:n,isActive:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isMarqueeCaptureActive:o}}}:e}default:return e}},initialState:Tu},Ru=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="rgba(33,150,243,0.8)",fill:r="rgba(33,150,243,0.15)"})=>{const{provides:a}=po(Eu.id),s=fo(e),[l,c]=ke(null),d=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Me(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?Ue("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null},Nu="history",Ou={id:Nu,name:"History Plugin",version:"1.0.0",provides:["history"],requires:[],optional:[],defaultConfig:{}},Lu="HISTORY/INIT_STATE",$u="HISTORY/CLEANUP_STATE",Fu="HISTORY/SET_DOCUMENT_STATE",ju=class extends Yn{constructor(e,t){super(e,t),this.documentHistories=new Map,this.historyChange$=ro()}async initialize(e){this.logger.info("HistoryPlugin","Initialize","History plugin initialized")}onDocumentLoadingStarted(e){this.dispatch((e=>({type:Lu,payload:{documentId:e}}))(e)),this.documentHistories.set(e,{topicHistories:new Map,globalTimeline:[],globalIndex:-1}),this.logger.debug("HistoryPlugin","DocumentOpened",`Initialized history state for document: ${e}`)}onDocumentClosed(e){this.dispatch((e=>({type:$u,payload:{documentId:e}}))(e)),this.documentHistories.delete(e),this.logger.debug("HistoryPlugin","DocumentClosed",`Cleaned up history state for document: ${e}`)}getDocumentHistoryData(e){const t=e??this.getActiveDocumentId(),n=this.documentHistories.get(t);if(!n)throw new Error(`History data not found for document: ${t}`);return n}getDocumentHistoryState(e){const t=this.documentHistories.get(e);if(!t)throw new Error(`History data not found for document: ${e}`);const n={};return Array.from(t.topicHistories.entries()).forEach(([e,t])=>{n[e]={canUndo:t.currentIndex>-1,canRedo:t.currentIndex<t.commands.length-1}}),{global:{canUndo:t.globalIndex>-1,canRedo:t.globalIndex<t.globalTimeline.length-1},topics:n}}emitHistoryChange(e,t){const n=this.getDocumentHistoryState(e);this.dispatch(((e,t)=>({type:Fu,payload:{documentId:e,state:t}}))(e,n)),this.historyChange$.emit({documentId:e,topic:t,state:n})}register(e,t,n){const o=this.getDocumentHistoryData(n);o.topicHistories.has(t)||o.topicHistories.set(t,{commands:[],currentIndex:-1});const i=o.topicHistories.get(t);i.commands.splice(i.currentIndex+1),i.commands.push(e),i.currentIndex++;const r={command:e,topic:t};o.globalTimeline.splice(o.globalIndex+1),o.globalTimeline.push(r),o.globalIndex++,e.execute(),this.emitHistoryChange(n,t)}undo(e,t){const n=this.getDocumentHistoryData(t);let o;if(e){const t=n.topicHistories.get(e);t&&t.currentIndex>-1&&(t.commands[t.currentIndex].undo(),t.currentIndex--,o=e)}else if(n.globalIndex>-1){const e=n.globalTimeline[n.globalIndex];e.command.undo(),n.topicHistories.get(e.topic).currentIndex--,n.globalIndex--,o=e.topic}o&&this.emitHistoryChange(t,o)}redo(e,t){const n=this.getDocumentHistoryData(t);let o;if(e){const t=n.topicHistories.get(e);t&&t.currentIndex<t.commands.length-1&&(t.currentIndex++,t.commands[t.currentIndex].execute(),o=e)}else if(n.globalIndex<n.globalTimeline.length-1){n.globalIndex++;const e=n.globalTimeline[n.globalIndex];e.command.execute(),n.topicHistories.get(e.topic).currentIndex++,o=e.topic}o&&this.emitHistoryChange(t,o)}canUndo(e,t){const n=this.getDocumentHistoryData(t);if(e){const t=n.topicHistories.get(e);return!!t&&t.currentIndex>-1}return n.globalIndex>-1}canRedo(e,t){const n=this.getDocumentHistoryData(t);if(e){const t=n.topicHistories.get(e);return!!t&&t.currentIndex<t.commands.length-1}return n.globalIndex<n.globalTimeline.length-1}createHistoryScope(e){return{register:(t,n)=>this.register(t,n,e),undo:t=>this.undo(t,e),redo:t=>this.redo(t,e),canUndo:t=>this.canUndo(t,e),canRedo:t=>this.canRedo(t,e),getHistoryState:()=>this.getDocumentHistoryState(e),onHistoryChange:t=>this.historyChange$.on(n=>{n.documentId===e&&t(n.topic)})}}buildCapability(){return{register:(e,t)=>{const n=this.getActiveDocumentId();this.register(e,t,n)},undo:e=>{const t=this.getActiveDocumentId();this.undo(e,t)},redo:e=>{const t=this.getActiveDocumentId();this.redo(e,t)},canUndo:e=>{const t=this.getActiveDocumentId();return this.canUndo(e,t)},canRedo:e=>{const t=this.getActiveDocumentId();return this.canRedo(e,t)},getHistoryState:()=>{const e=this.getActiveDocumentId();return this.getDocumentHistoryState(e)},forDocument:e=>this.createHistoryScope(e),onHistoryChange:this.historyChange$.on}}async destroy(){this.historyChange$.clear(),this.documentHistories.clear(),super.destroy()}};ju.id="history";let Hu=ju;const Uu={global:{canUndo:!1,canRedo:!1},topics:{}},Wu={documents:{},activeDocumentId:null},Bu={manifest:Ou,create:e=>new Hu(Nu,e),reducer:(e=Wu,t)=>{switch(t.type){case Lu:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Uu}}}}case $u:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case Fu:{const{documentId:n,state:o}=t.payload;return e.documents[n]?{...e,documents:{...e.documents,[n]:o}}:e}case"HISTORY/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};default:return e}},initialState:Wu};var qu=(e=>(e.MarqueeRedact="marqueeRedact",e.RedactSelection="redactSelection",e))(qu||{});const Gu="REDACTION/INIT_STATE",Vu="REDACTION/CLEANUP_STATE",Zu="START_REDACTION",Ku="END_REDACTION",Yu="ADD_PENDING",Xu="REMOVE_PENDING",Qu="CLEAR_PENDING",Ju="SELECT_PENDING",eh="DESELECT_PENDING";const th=(e,t)=>({type:Yu,payload:{documentId:e,items:t}}),nh=(e,t,n)=>({type:Xu,payload:{documentId:e,page:t,id:n}}),oh=e=>({type:Qu,payload:e}),ih=(e,t)=>({type:Zu,payload:{documentId:e,mode:t}});const rh=e=>Object.values(e).reduce((e,t)=>e+t.length,0),ah={isRedacting:!1,activeType:null,pending:{},pendingCount:0,selected:null},sh={documents:{},activeDocumentId:null},lh=class extends Yn{constructor(e,t,n){var o,i,r;super(e,t),this.redactionSelection$=new Map,this.pending$=ao(),this.selected$=ao(),this.state$=ao(),this.events$=ao(),this.documentUnsubscribers=new Map,this.config=n,this.selectionCapability=null==(o=this.registry.getPlugin("selection"))?void 0:o.provides(),this.interactionManagerCapability=null==(i=this.registry.getPlugin("interaction-manager"))?void 0:i.provides(),this.interactionManagerCapability&&(this.interactionManagerCapability.registerMode({id:qu.MarqueeRedact,scope:"page",exclusive:!0,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:qu.RedactSelection,scope:"page",exclusive:!1})),null==(r=this.interactionManagerCapability)||r.onModeChange(e=>{const t=e.documentId;if(e.activeMode===qu.RedactSelection)this.dispatch(ih(t,qu.RedactSelection));else if(e.activeMode===qu.MarqueeRedact)this.dispatch(ih(t,qu.MarqueeRedact));else{const e=this.getDocumentState(t);(null==e?void 0:e.isRedacting)&&this.dispatch((e=>({type:Ku,payload:e}))(t))}})}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Gu,payload:{documentId:e,state:t}}}(e,{...ah})),this.redactionSelection$.set(e,ao());const t=[];if(this.selectionCapability){const n=this.selectionCapability.forDocument(e),o=n.onSelectionChange(()=>{const t=this.getDocumentState(e);if(!(null==t?void 0:t.isRedacting))return;const o=n.getFormattedSelection(),i=this.redactionSelection$.get(e);null==i||i.emit(o)}),i=n.onEndSelection(()=>{const t=this.getDocumentState(e);if(!(null==t?void 0:t.isRedacting))return;const o=n.getFormattedSelection().map(e=>({id:yn(),kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.dispatch(th(e,o));const i=this.redactionSelection$.get(e);null==i||i.emit([]),n.clear(),this.emitPendingChange(e),o.length&&this.selectPending(o[o.length-1].page,o[o.length-1].id,e)});t.push(o,i)}this.documentUnsubscribers.set(e,t),this.logger.debug("RedactionPlugin","DocumentOpened",`Initialized redaction state for document: ${e}`)}onDocumentLoaded(e){var t;null==(t=this.selectionCapability)||t.enableForMode(qu.RedactSelection,e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Vu,payload:e}}(e));const t=this.redactionSelection$.get(e);null==t||t.clear(),this.redactionSelection$.delete(e);const n=this.documentUnsubscribers.get(e);n&&(n.forEach(e=>e()),this.documentUnsubscribers.delete(e)),this.logger.debug("RedactionPlugin","DocumentClosed",`Cleaned up redaction state for document: ${e}`)}async initialize(e){this.logger.info("RedactionPlugin","Initialize","Redaction plugin initialized")}buildCapability(){return{queueCurrentSelectionAsPending:()=>this.queueCurrentSelectionAsPending(),enableMarqueeRedact:()=>this.enableMarqueeRedact(),toggleMarqueeRedact:()=>this.toggleMarqueeRedact(),isMarqueeRedactActive:()=>this.isMarqueeRedactActive(),enableRedactSelection:()=>this.enableRedactSelection(),toggleRedactSelection:()=>this.toggleRedactSelection(),isRedactSelectionActive:()=>this.isRedactSelectionActive(),addPending:e=>this.addPendingItems(e),removePending:(e,t)=>this.removePendingItem(e,t),clearPending:()=>this.clearPendingItems(),commitAllPending:()=>this.commitAllPending(),commitPending:(e,t)=>this.commitPendingOne(e,t),endRedaction:()=>this.endRedactionMode(),startRedaction:()=>this.startRedactionMode(),selectPending:(e,t)=>this.selectPending(e,t),getSelectedPending:()=>this.getSelectedPending(),deselectPending:()=>this.deselectPending(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createRedactionScope(e),onPendingChange:this.pending$.on,onSelectedChange:this.selected$.on,onRedactionEvent:this.events$.on,onStateChange:this.state$.on}}createRedactionScope(e){return{queueCurrentSelectionAsPending:()=>this.queueCurrentSelectionAsPending(e),enableMarqueeRedact:()=>this.enableMarqueeRedact(e),toggleMarqueeRedact:()=>this.toggleMarqueeRedact(e),isMarqueeRedactActive:()=>this.isMarqueeRedactActive(e),enableRedactSelection:()=>this.enableRedactSelection(e),toggleRedactSelection:()=>this.toggleRedactSelection(e),isRedactSelectionActive:()=>this.isRedactSelectionActive(e),addPending:t=>this.addPendingItems(t,e),removePending:(t,n)=>this.removePendingItem(t,n,e),clearPending:()=>this.clearPendingItems(e),commitAllPending:()=>this.commitAllPending(e),commitPending:(t,n)=>this.commitPendingOne(t,n,e),endRedaction:()=>this.endRedactionMode(e),startRedaction:()=>this.startRedactionMode(e),selectPending:(t,n)=>this.selectPending(t,n,e),getSelectedPending:()=>this.getSelectedPending(e),deselectPending:()=>this.deselectPending(e),getState:()=>this.getDocumentStateOrThrow(e),onPendingChange:t=>this.pending$.on(n=>{n.documentId===e&&t(n.pending)}),onSelectedChange:t=>this.selected$.on(n=>{n.documentId===e&&t(n.selected)}),onRedactionEvent:t=>this.events$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Redaction state not found for document: ${e??"active"}`);return t}addPendingItems(e,t){const n=t??this.getActiveDocumentId();this.dispatch(th(n,e)),this.emitPendingChange(n),this.events$.emit({type:"add",documentId:n,items:e})}removePendingItem(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(nh(o,e,t)),this.emitPendingChange(o),this.events$.emit({type:"remove",documentId:o,page:e,id:t})}clearPendingItems(e){const t=e??this.getActiveDocumentId();this.dispatch(oh(t)),this.emitPendingChange(t),this.events$.emit({type:"clear",documentId:t})}selectPending(e,t,n){var o;const i=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Ju,payload:{documentId:e,page:t,id:n}}))(i,e,t)),null==(o=this.selectionCapability)||o.forDocument(i).clear(),this.emitSelectedChange(i)}getSelectedPending(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.getDocumentState(n))?void 0:t.selected)??null}deselectPending(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:eh,payload:e}))(t)),this.emitSelectedChange(t)}enableRedactSelection(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(qu.RedactSelection)}toggleRedactSelection(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);(null==o?void 0:o.getActiveMode())===qu.RedactSelection?o.activateDefaultMode():null==o||o.activate(qu.RedactSelection)}isRedactSelectionActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===qu.RedactSelection}enableMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(qu.MarqueeRedact)}toggleMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);(null==o?void 0:o.getActiveMode())===qu.MarqueeRedact?o.activateDefaultMode():null==o||o.activate(qu.MarqueeRedact)}isMarqueeRedactActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===qu.MarqueeRedact}startRedactionMode(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(qu.RedactSelection)}endRedactionMode(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activateDefaultMode()}onRedactionSelectionChange(e,t){const n=this.redactionSelection$.get(e);return(null==n?void 0:n.on(t))??(()=>{})}registerMarqueeOnPage(e){if(!this.interactionManagerCapability)return this.logger.warn("RedactionPlugin","MissingDependency","Interaction manager plugin not loaded, marquee redaction disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!(null==t?void 0:t.document))return this.logger.warn("RedactionPlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("RedactionPlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r}=e;let a=null,s=null;return{onPointerDown:(e,t)=>{var n;a=e,s={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(s),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!a)return;const n=eo(e.x,0,t.width),o=eo(e.y,0,t.height);s={origin:{x:Math.min(a.x,n),y:Math.min(a.y,o)},size:{width:Math.abs(n-a.x),height:Math.abs(o-a.y)}},null==i||i(s)},onPointerUp:(e,t)=>{var l;s&&Math.max(s.size.width,s.size.height)*n>o&&(null==r||r(s)),a=null,s=null,null==i||i(null),null==(l=t.releasePointerCapture)||l.call(t)},onPointerCancel:(e,t)=>{var n;a=null,s=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;const i={id:yn(),kind:"area",page:e.pageIndex,rect:t};this.dispatch(th(e.documentId,[i])),this.emitPendingChange(e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t),this.enableRedactSelection(e.documentId),this.selectPending(e.pageIndex,i.id,e.documentId)}}),i=this.interactionManagerCapability.registerAlways({handlers:{onPointerDown:(t,n)=>{n.target===n.currentTarget&&this.deselectPending(e.documentId)}},scope:{type:"page",documentId:e.documentId,pageIndex:e.pageIndex}}),r=this.interactionManagerCapability.registerHandlers({documentId:e.documentId,modeId:qu.MarqueeRedact,handlers:o,pageIndex:e.pageIndex});return()=>{i(),r()}}queueCurrentSelectionAsPending(e){const t=e??this.getActiveDocumentId();if(!this.selectionCapability)return Ut.reject({code:Ht.NotFound,message:"[RedactionPlugin] selection plugin required"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Ut.reject({code:Ht.NotFound,message:"Document not found"});const o=this.selectionCapability.forDocument(t),i=o.getFormattedSelection();if(!i.length)return Ut.resolve(!0);const r=yn(),a=i.map(e=>({id:r,kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.enableRedactSelection(t),this.dispatch(th(t,a)),this.emitPendingChange(t);const s=a[a.length-1];this.selectPending(s.page,s.id,t);const l=this.redactionSelection$.get(t);return null==l||l.emit([]),o.clear(),Ut.resolve(!0)}commitPendingOne(e,t,n){const o=n??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))return Ut.reject({code:Ht.NotFound,message:"Document not found"});const r=this.getDocumentState(o);if(!r)return Ut.reject({code:Ht.NotFound,message:"Document state not found"});const a=(r.pending[e]??[]).find(e=>e.id===t);if(!a)return Ut.resolve(!0);const s="text"===a.kind?a.rects:[a.rect],l=i.document.pages[e];if(!l)return Ut.reject({code:Ht.NotFound,message:"Page not found"});const c=new gt;return this.engine.redactTextInRects(i.document,l,s,{drawBlackBoxes:this.config.drawBlackBoxes}).wait(()=>{this.dispatch(nh(o,e,t)),this.emitPendingChange(o),this.dispatchCoreAction(Un(o,[e])),this.events$.emit({type:"commit",documentId:o,success:!0}),c.resolve(!0)},e=>{this.events$.emit({type:"commit",documentId:o,success:!1,error:e.reason}),c.reject({code:Ht.Unknown,message:"Failed to commit redactions"})}),c}commitAllPending(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Ut.reject({code:Ht.NotFound,message:"Document not found"});const o=this.getDocumentState(t);if(!o)return Ut.reject({code:Ht.NotFound,message:"Document state not found"});const i=new Map;for(const[e,t]of Object.entries(o.pending)){const n=Number(e),o=i.get(n)??[];for(const e of t)"text"===e.kind?o.push(...e.rects):o.push(e.rect);i.set(n,o)}const r=Array.from(i.entries()).filter(([e,t])=>t.length>0).map(([e])=>e),a=[];for(const[e,t]of i){const o=n.document.pages[e];o&&(t.length&&a.push(this.engine.redactTextInRects(n.document,o,t,{drawBlackBoxes:this.config.drawBlackBoxes})))}const s=new gt;return gt.all(a).wait(()=>{this.dispatch(oh(t)),this.dispatchCoreAction(Un(t,r)),this.emitPendingChange(t),this.events$.emit({type:"commit",documentId:t,success:!0}),s.resolve(!0)},e=>{this.events$.emit({type:"commit",documentId:t,success:!1,error:e.reason}),s.reject({code:Ht.Unknown,message:"Failed to commit redactions"})}),s}emitPendingChange(e){const t=this.getDocumentState(e);t&&this.pending$.emit({documentId:e,pending:t.pending})}emitSelectedChange(e){const t=this.getDocumentState(e);t&&this.selected$.emit({documentId:e,selected:t.selected})}emitStateChange(e){const t=this.getDocumentState(e);t&&this.state$.emit({documentId:e,state:t})}onStoreUpdated(e,t){for(const e in t.documents){t.documents[e]&&(this.emitPendingChange(e),this.emitSelectedChange(e),this.emitStateChange(e))}}async destroy(){this.pending$.clear(),this.selected$.clear(),this.state$.clear(),this.events$.clear(),this.redactionSelection$.forEach(e=>e.clear()),this.redactionSelection$.clear(),this.documentUnsubscribers.forEach(e=>{e.forEach(e=>e())}),this.documentUnsubscribers.clear(),await super.destroy()}};lh.id="redaction";let ch=lh;const dh="redaction",uh={manifest:{id:dh,name:"Redaction Plugin",version:"1.0.0",provides:["redaction"],requires:[],optional:["interaction-manager","selection"],defaultConfig:{drawBlackBoxes:!0}},create:(e,t)=>new ch(dh,e,t),reducer:(e=sh,t)=>{switch(t.type){case Gu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Vu:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"REDACTION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Yu:{const{documentId:n,items:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.pending};for(const e of o)r[e.page]=(r[e.page]??[]).concat(e);return{...e,documents:{...e.documents,[n]:{...i,pending:r,pendingCount:rh(r)}}}}case Xu:{const{documentId:n,page:o,id:i}=t.payload,r=e.documents[n];if(!r)return e;const a=(r.pending[o]??[]).filter(e=>e.id!==i),s={...r.pending,[o]:a},l=r.selected&&!(r.selected.page===o&&r.selected.id===i);return{...e,documents:{...e.documents,[n]:{...r,pending:s,pendingCount:rh(s),selected:l?r.selected:null}}}}case Qu:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null}}}:e}case Ju:{const{documentId:n,page:o,id:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,selected:{page:o,id:i}}}}:e}case eh:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selected:null}}}:e}case Zu:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isRedacting:!0,activeType:o}}}:e}case Ku:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null,isRedacting:!1,activeType:null}}}:e}case"SET_ACTIVE_TYPE":{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeType:o}}}:e}default:return e}},initialState:sh},hh=()=>go(ch.id),mh=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="red",fill:r="transparent"})=>{const{plugin:a}=hh(),s=fo(e),[l,c]=ke(null),d=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Me(()=>{if(a&&e)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?Ue("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null};function gh({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:o,rect:i,scale:r,onClick:a,style:s,...l}){return Ue(U,{children:o.map((o,c)=>Ue("div",{onPointerDown:a,onTouchStart:a,style:{position:"absolute",border:n,left:(i?o.origin.x-i.origin.x:o.origin.x)*r,top:(i?o.origin.y-i.origin.y:o.origin.y)*r,width:o.size.width*r,height:o.size.height*r,background:e,opacity:t,pointerEvents:a?"auto":"none",cursor:a?"pointer":"default",zIndex:a?1:void 0,...s},...l},c))})}function ph({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=hh(),[i,r]=ke([]),[a,s]=ke(null);return Me(()=>{if(o)return o.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);r((null==n?void 0:n.segmentRects)??[]),s((null==n?void 0:n.rect)??null)})},[o,e,t]),a?Ue("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:Ue(gh,{color:"transparent",opacity:1,rects:i,scale:n,border:"1px solid red"})}):null}function vh({documentId:e,pageIndex:t,scale:n,bboxStroke:o="rgba(0,0,0,0.8)",rotation:i=We.Degree0,selectionMenu:r}){const{provides:a}=po(ch.id),[s,l]=ke([]),[c,d]=ke(null);Me(()=>{if(!a)return;const n=a.forDocument(e),o=n.getState();l(o.pending[t]??[]),d(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>l(e[t]??[])),r=n.onSelectedChange(e=>{d(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[a,e,t]);const u=ze((n,o)=>{n.stopPropagation(),a&&a.forDocument(e).selectPending(t,o)},[a,e,t]);return s.length?Ue("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:s.map(e=>{if("area"===e.kind){const a=e.rect;return Ue(U,{children:[Ue("div",{style:{position:"absolute",left:a.origin.x*n,top:a.origin.y*n,width:a.size.width*n,height:a.size.height*n,background:"transparent",outline:c===e.id?`1px solid ${o}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>u(t,e.id),onTouchStart:t=>u(t,e.id)}),r&&Ue(qs,{rect:{origin:{x:a.origin.x*n,y:a.origin.y*n},size:{width:a.size.width*n,height:a.size.height*n}},rotation:i,children:n=>r({...n,context:{type:"redaction",item:e,pageIndex:t},selected:c===e.id,placement:{suggestTop:!1}})})]},e.id)}const a=e.rect;return Ue(U,{children:[Ue("div",{style:{position:"absolute",left:a.origin.x*n,top:a.origin.y*n,width:a.size.width*n,height:a.size.height*n,background:"transparent",outline:c===e.id?`1px solid ${o}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:c===e.id?"pointer":"default"},children:Ue(gh,{rect:a,rects:e.rects,color:"transparent",border:"1px solid red",scale:n,onClick:t=>u(t,e.id)})}),r&&Ue(qs,{rect:{origin:{x:a.origin.x*n,y:a.origin.y*n},size:{width:a.size.width*n,height:a.size.height*n}},rotation:i,children:n=>r({...n,context:{type:"redaction",item:e,pageIndex:t},selected:c===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const fh=({documentId:e,pageIndex:t,scale:n,rotation:o,selectionMenu:i})=>{const r=fo(e),a=Te(()=>void 0!==n?n:(null==r?void 0:r.scale)??1,[n,null==r?void 0:r.scale]);return Ue(U,{children:[Ue(vh,{documentId:e,pageIndex:t,scale:a,rotation:Te(()=>void 0!==o?o:(null==r?void 0:r.rotation)??We.Degree0,[o,null==r?void 0:r.rotation]),selectionMenu:i}),Ue(mh,{documentId:e,pageIndex:t,scale:a}),Ue(ph,{documentId:e,pageIndex:t,scale:a})]})},yh=class extends Yn{constructor(e,t){super(e,t)}async initialize(e){}buildCapability(){return{getAttachments:()=>this.getAttachments(),downloadAttachment:e=>this.downloadAttachment(e),forDocument:e=>this.createAttachmentScope(e)}}createAttachmentScope(e){return{getAttachments:()=>this.getAttachments(e),downloadAttachment:t=>this.downloadAttachment(t,e)}}downloadAttachment(e,t){const n=t??this.getActiveDocumentId(),o=this.coreState.core.documents[n];return(null==o?void 0:o.document)?this.engine.readAttachmentContent(o.document,e):Ut.reject({code:Ht.NotFound,message:`Document ${n} not found`})}getAttachments(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.getAttachments(n.document):Ut.reject({code:Ht.NotFound,message:`Document ${t} not found`})}};yh.id="attachment";let bh=yh;const wh="attachment",xh={manifest:{id:wh,name:"Attachment Plugin",version:"1.0.0",provides:["attachment"],requires:[],optional:[],defaultConfig:{}},create:e=>new bh(wh,e),reducer:()=>{},initialState:{}},Ch=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ih="-",Sh=[],kh=e=>{const t=Ph(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Mh(e);const n=e.split(Ih),o=""===n[0]&&n.length>1?1:0;return Dh(n,o,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=o[e],i=n[e];return t?i?((e,t)=>{const n=new Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n})(i,t):t:i||Sh}return n[e]||Sh}}},Dh=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const n=Dh(e,t+1,i);if(n)return n}const r=n.validators;if(null===r)return;const a=0===t?e.join(Ih):e.slice(t).join(Ih),s=r.length;for(let e=0;e<s;e++){const t=r[e];if(t.validator(a))return t.classGroupId}},Mh=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?"arbitrary.."+o:void 0})(),Ph=e=>{const{theme:t,classGroups:n}=e;return Ah(n,t)},Ah=(e,t)=>{const n=Ch();for(const o in e){const i=e[o];Th(i,n,o,t)}return n},Th=(e,t,n,o)=>{const i=e.length;for(let r=0;r<i;r++){const i=e[r];zh(i,t,n,o)}},zh=(e,t,n,o)=>{"string"!=typeof e?"function"!=typeof e?Rh(e,t,n,o):_h(e,t,n,o):Eh(e,t,n)},Eh=(e,t,n)=>{(""===e?t:Nh(t,e)).classGroupId=n},_h=(e,t,n,o)=>{Oh(e)?Th(e(o),t,n,o):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Rh=(e,t,n,o)=>{const i=Object.entries(e),r=i.length;for(let e=0;e<r;e++){const[r,a]=i[e];Th(a,Nh(t,r),n,o)}},Nh=(e,t)=>{let n=e;const o=t.split(Ih),i=o.length;for(let e=0;e<i;e++){const t=o[e];let i=n.nextPart.get(t);i||(i=Ch(),n.nextPart.set(t,i)),n=i}return n},Oh=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Lh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const i=(i,r)=>{n[i]=r,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=o[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}},$h=[],Fh=(e,t,n,o,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:i}),jh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=e=>{const t=[];let n,o=0,i=0,r=0;const a=e.length;for(let s=0;s<a;s++){const a=e[s];if(0===o&&0===i){if(":"===a){t.push(e.slice(r,s)),r=s+1;continue}if("/"===a){n=s;continue}}"["===a?o++:"]"===a?o--:"("===a?i++:")"===a&&i--}const s=0===t.length?e:e.slice(r);let l=s,c=!1;s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0);return Fh(t,c,l,n&&n>r?n-r:void 0)};if(t){const e=t+":",n=o;o=t=>t.startsWith(e)?n(t.slice(e.length)):Fh($h,!1,t,void 0,!0)}if(n){const e=o;o=t=>n({className:t,parseClassName:e})}return o},Hh=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let o=[];for(let i=0;i<e.length;i++){const r=e[i],a="["===r[0],s=t.has(r);a||s?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(r)):o.push(r)}return o.length>0&&(o.sort(),n.push(...o)),n}},Uh=/\s+/,Wh=e=>{if("string"==typeof e)return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Wh(e[o]))&&(n&&(n+=" "),n+=t);return n},Bh=(e,...t)=>{let n,o,i,r;const a=e=>{const t=o(e);if(t)return t;const r=((e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i,sortModifiers:r}=t,a=[],s=e.trim().split(Uh);let l="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=n(t);if(c){l=t+(l.length>0?" "+l:l);continue}let g=!!m,p=o(g?h.substring(0,m):h);if(!p){if(!g){l=t+(l.length>0?" "+l:l);continue}if(p=o(h),!p){l=t+(l.length>0?" "+l:l);continue}g=!1}const v=0===d.length?"":1===d.length?d[0]:r(d).join(":"),f=u?v+"!":v,y=f+p;if(a.indexOf(y)>-1)continue;a.push(y);const b=i(p,g);for(let e=0;e<b.length;++e){const t=b[e];a.push(f+t)}l=t+(l.length>0?" "+l:l)}return l})(e,n);return i(e,r),r};return r=s=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:Lh(e.cacheSize),parseClassName:jh(e),sortModifiers:Hh(e),...kh(e)}))(l),o=n.cache.get,i=n.cache.set,r=a,a(s)},(...e)=>r(((...e)=>{let t,n,o=0,i="";for(;o<e.length;)(t=e[o++])&&(n=Wh(t))&&(i&&(i+=" "),i+=n);return i})(...e))},qh=[],Gh=e=>{const t=t=>t[e]||qh;return t.isThemeGetter=!0,t},Vh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kh=/^\d+\/\d+$/,Yh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,em=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tm=e=>Kh.test(e),nm=e=>!!e&&!Number.isNaN(Number(e)),om=e=>!!e&&Number.isInteger(Number(e)),im=e=>e.endsWith("%")&&nm(e.slice(0,-1)),rm=e=>Yh.test(e),am=()=>!0,sm=e=>Xh.test(e)&&!Qh.test(e),lm=()=>!1,cm=e=>Jh.test(e),dm=e=>em.test(e),um=e=>!mm(e)&&!bm(e),hm=e=>Dm(e,Tm,lm),mm=e=>Vh.test(e),gm=e=>Dm(e,zm,sm),pm=e=>Dm(e,Em,nm),vm=e=>Dm(e,Pm,lm),fm=e=>Dm(e,Am,dm),ym=e=>Dm(e,Rm,cm),bm=e=>Zh.test(e),wm=e=>Mm(e,zm),xm=e=>Mm(e,_m),Cm=e=>Mm(e,Pm),Im=e=>Mm(e,Tm),Sm=e=>Mm(e,Am),km=e=>Mm(e,Rm,!0),Dm=(e,t,n)=>{const o=Vh.exec(e);return!!o&&(o[1]?t(o[1]):n(o[2]))},Mm=(e,t,n=!1)=>{const o=Zh.exec(e);return!!o&&(o[1]?t(o[1]):n)},Pm=e=>"position"===e||"percentage"===e,Am=e=>"image"===e||"url"===e,Tm=e=>"length"===e||"size"===e||"bg-size"===e,zm=e=>"length"===e,Em=e=>"number"===e,_m=e=>"family-name"===e,Rm=e=>"shadow"===e,Nm=Bh(()=>{const e=Gh("color"),t=Gh("font"),n=Gh("text"),o=Gh("font-weight"),i=Gh("tracking"),r=Gh("leading"),a=Gh("breakpoint"),s=Gh("container"),l=Gh("spacing"),c=Gh("radius"),d=Gh("shadow"),u=Gh("inset-shadow"),h=Gh("text-shadow"),m=Gh("drop-shadow"),g=Gh("blur"),p=Gh("perspective"),v=Gh("aspect"),f=Gh("ease"),y=Gh("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",bm,mm],w=()=>[bm,mm,l],x=()=>[tm,"full","auto",...w()],C=()=>[om,"none","subgrid",bm,mm],I=()=>["auto",{span:["full",om,bm,mm]},om,bm,mm],S=()=>[om,"auto",bm,mm],k=()=>["auto","min","max","fr",bm,mm],D=()=>["auto",...w()],M=()=>[tm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],P=()=>[e,bm,mm],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Cm,vm,{position:[bm,mm]}],T=()=>["auto","cover","contain",Im,hm,{size:[bm,mm]}],z=()=>[im,wm,gm],E=()=>["","none","full",c,bm,mm],_=()=>["",nm,wm,gm],R=()=>[nm,im,Cm,vm],N=()=>["","none",g,bm,mm],O=()=>["none",nm,bm,mm],L=()=>["none",nm,bm,mm],$=()=>[nm,bm,mm],F=()=>[tm,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rm],breakpoint:[rm],color:[am],container:[rm],"drop-shadow":[rm],ease:["in","out","in-out"],font:[um],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rm],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rm],shadow:[rm],spacing:["px",nm],text:[rm],"text-shadow":[rm],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",tm,mm,bm,v]}],container:["container"],columns:[{columns:[nm,mm,bm,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[om,"auto",bm,mm]}],basis:[{basis:[tm,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nm,tm,"auto","initial","none",mm]}],grow:[{grow:["",nm,bm,mm]}],shrink:[{shrink:["",nm,bm,mm]}],order:[{order:[om,"first","last","none",bm,mm]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],w:[{w:[s,"screen",...M()]}],"min-w":[{"min-w":[s,"screen","none",...M()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",n,wm,gm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,bm,pm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",im,mm]}],"font-family":[{font:[xm,mm,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,bm,mm]}],"line-clamp":[{"line-clamp":[nm,"none",bm,pm]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",bm,mm]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",bm,mm]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[nm,"from-font","auto",bm,gm]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[nm,"auto",bm,mm]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",bm,mm]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",bm,mm]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},om,bm,mm],radial:["",bm,mm],conic:[om,bm,mm]},Sm,fm]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:E()}],"rounded-s":[{"rounded-s":E()}],"rounded-e":[{"rounded-e":E()}],"rounded-t":[{"rounded-t":E()}],"rounded-r":[{"rounded-r":E()}],"rounded-b":[{"rounded-b":E()}],"rounded-l":[{"rounded-l":E()}],"rounded-ss":[{"rounded-ss":E()}],"rounded-se":[{"rounded-se":E()}],"rounded-ee":[{"rounded-ee":E()}],"rounded-es":[{"rounded-es":E()}],"rounded-tl":[{"rounded-tl":E()}],"rounded-tr":[{"rounded-tr":E()}],"rounded-br":[{"rounded-br":E()}],"rounded-bl":[{"rounded-bl":E()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[nm,bm,mm]}],"outline-w":[{outline:["",nm,wm,gm]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,km,ym]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,km,ym]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[nm,gm]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,km,ym]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[nm,bm,mm]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nm]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[bm,mm]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[nm]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",bm,mm]}],filter:[{filter:["","none",bm,mm]}],blur:[{blur:N()}],brightness:[{brightness:[nm,bm,mm]}],contrast:[{contrast:[nm,bm,mm]}],"drop-shadow":[{"drop-shadow":["","none",m,km,ym]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",nm,bm,mm]}],"hue-rotate":[{"hue-rotate":[nm,bm,mm]}],invert:[{invert:["",nm,bm,mm]}],saturate:[{saturate:[nm,bm,mm]}],sepia:[{sepia:["",nm,bm,mm]}],"backdrop-filter":[{"backdrop-filter":["","none",bm,mm]}],"backdrop-blur":[{"backdrop-blur":N()}],"backdrop-brightness":[{"backdrop-brightness":[nm,bm,mm]}],"backdrop-contrast":[{"backdrop-contrast":[nm,bm,mm]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nm,bm,mm]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nm,bm,mm]}],"backdrop-invert":[{"backdrop-invert":["",nm,bm,mm]}],"backdrop-opacity":[{"backdrop-opacity":[nm,bm,mm]}],"backdrop-saturate":[{"backdrop-saturate":[nm,bm,mm]}],"backdrop-sepia":[{"backdrop-sepia":["",nm,bm,mm]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",bm,mm]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nm,"initial",bm,mm]}],ease:[{ease:["linear","initial",f,bm,mm]}],delay:[{delay:[nm,bm,mm]}],animate:[{animate:["none",y,bm,mm]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,bm,mm]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:O()}],"rotate-x":[{"rotate-x":O()}],"rotate-y":[{"rotate-y":O()}],"rotate-z":[{"rotate-z":O()}],scale:[{scale:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:$()}],"skew-x":[{"skew-x":$()}],"skew-y":[{"skew-y":$()}],transform:[{transform:[bm,mm,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",bm,mm]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",bm,mm]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[nm,wm,gm,pm]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});var Om=["children","onClick","active","disabled","className","anchorRef"];function Lm(e){var t=e.children,n=e.onClick,o=e.active,i=void 0!==o&&o,r=e.disabled,a=void 0!==r&&r,s=e.className,l=void 0===s?"":s,c=e.anchorRef,d=m(e,Om);return j("button",h({ref:c,onClick:n,disabled:a,className:Nm("flex h-[32px] w-auto min-w-[32px] items-center justify-center rounded-md p-[5px] transition-colors hover:bg-interactive-hover hover:ring hover:ring-accent cursor-pointer rounded-none px-2 py-1 text-sm hover:bg-transparent border-b-2 hover:border-b-fg-muted hover:ring-transparent",i?"border-b-accent text-accent hover:border-b-accent":"border-b-transparent",a?"cursor-not-allowed opacity-50":"",l)},d),t)}var $m=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 6l6 6l-6 6"}))},Fm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 6l-6 6l6 6"}))},jm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 9l6 6l6 -6"}))},Hm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),j("path",{d:"M21 21l-6 -6"}))},Um=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M18 6l-12 12"}),j("path",{d:"M6 6l12 12"}))};var Wm={download:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),j("path",{d:"M7 11l5 5l5 -5"}),j("path",{d:"M12 4l0 12"}))},menu:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8l16 0"}),j("path",{d:"M4 16l16 0"}))},fullscreen:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),j("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),j("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),j("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"}))},fullscreenExit:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8v-2c0 -.551 .223 -1.05 .584 -1.412"}),j("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),j("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),j("path",{d:"M16 20h2c.545 0 1.04 -.218 1.4 -.572"}),j("path",{d:"M3 3l18 18"}))},save:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M14 4l0 4l-6 0l0 -4"}))},print:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M17 17h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-14a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2"}),j("path",{d:"M17 9v-4a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v4"}),j("path",{d:"M7 13m0 2a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2z"}))},settings:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"}),j("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"}))},viewSettings:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M12 10.5v1.5"}),j("path",{d:"M12 16v1.5"}),j("path",{d:"M15.031 12.25l-1.299 .75"}),j("path",{d:"M10.268 15l-1.3 .75"}),j("path",{d:"M15 15.803l-1.285 -.773"}),j("path",{d:"M10.285 12.97l-1.285 -.773"}),j("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),j("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}))},rotateClockwise:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5"}))},rotateCounterClockwise:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M19.95 11a8 8 0 1 0 -.5 4m.5 5v-5h-5"}))},singlePage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M5 3m0 1a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1z"}))},doublePage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18"}))},zoomIn:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"}),j("path",{d:"M9 12h6"}),j("path",{d:"M12 9v6"}))},zoomOut:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),j("path",{d:"M9 12l6 0"}))},fitToWidth:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v6"}),j("path",{d:"M10 18h-7"}),j("path",{d:"M21 18h-7"}),j("path",{d:"M6 15l-3 3l3 3"}),j("path",{d:"M18 15l3 3l-3 3"}))},fitToPage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h6"}),j("path",{d:"M18 14v7"}),j("path",{d:"M18 3v7"}),j("path",{d:"M15 18l3 3l3 -3"}),j("path",{d:"M15 6l3 -3l3 3"}))},chevronRight:$m,chevronLeft:Fm,chevronDown:jm,search:Hm,comment:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 11v.01"}),j("path",{d:"M8 11v.01"}),j("path",{d:"M16 11v.01"}),j("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"}))},sidebar:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 18v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),j("path",{d:"M14 18v-12a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2z"}))},dots:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},vertical:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 7l4 -4l4 4"}),j("path",{d:"M8 17l4 4l4 -4"}),j("path",{d:"M12 3l0 18"}))},horizontal:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 8l-4 4l4 4"}),j("path",{d:"M17 8l4 4l-4 4"}),j("path",{d:"M3 12l18 0"}))},book:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),j("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),j("path",{d:"M3 6l0 13"}),j("path",{d:"M12 6l0 13"}),j("path",{d:"M21 6l0 13"}))},book2:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z"}),j("path",{d:"M19 16h-12a2 2 0 0 0 -2 2"}),j("path",{d:"M9 8h6"}))},squares:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 10a2 2 0 0 1 2 -2h9a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-9a2 2 0 0 1 -2 -2z"}),j("path",{d:"M16 8v-3a2 2 0 0 0 -2 -2h-9a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h3"}))},listTree:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 6h11"}),j("path",{d:"M12 12h8"}),j("path",{d:"M15 18h5"}),j("path",{d:"M5 6v.01"}),j("path",{d:"M8 12v.01"}),j("path",{d:"M11 18v.01"}))},paperclip:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5"}))},copy:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),j("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"}))},underline:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 20h16",stroke:a}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("path",{d:"M8 10h8",stroke:"currentColor"}))},squiggly:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("path",{d:"M8 10h8",stroke:"currentColor"}),j("path",{d:"M4 20c1.5 -1.5 3.5 -1.5 5 0s3.5 1.5 5 0 3.5 -1.5 5 0",stroke:a}))},strikethrough:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("path",{d:"M4 10h16",stroke:a}))},highlight:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("rect",{x:"2",y:"6",width:"20",height:"16",rx:"2",fill:a,stroke:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("path",{d:"M8 10h8",stroke:"currentColor"}))},palette:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),j("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},x:Um,fileImport:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),j("path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3"}))},hand:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),j("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),j("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),j("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"}))},zoomInArea:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 13v4"}),j("path",{d:"M13 15h4"}),j("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),j("path",{d:"M22 22l-3 -3"}),j("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),j("path",{d:"M3 11v-1"}),j("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),j("path",{d:"M10 3h1"}),j("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"}))},screenshot:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 19a2 2 0 0 1 -2 -2"}),j("path",{d:"M5 13v-2"}),j("path",{d:"M5 7a2 2 0 0 1 2 -2"}),j("path",{d:"M11 5h2"}),j("path",{d:"M17 5a2 2 0 0 1 2 2"}),j("path",{d:"M19 11v2"}),j("path",{d:"M19 17v4"}),j("path",{d:"M21 19h-4"}),j("path",{d:"M13 19h-2"}))},arrowBackUp:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 14l-4 -4l4 -4"}),j("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"}))},arrowForwardUp:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 14l4 -4l-4 -4"}),j("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"}))},trash:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 7l16 0"}),j("path",{d:"M10 11l0 6"}),j("path",{d:"M14 11l0 6"}),j("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),j("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"}))},deviceFloppy:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M14 4l0 4l-6 0l0 -4"}))},pencilMarker:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":i,class:e.className,role:"img","aria-label":e.title},j("path",{d:"m9.109 16.275 8.856-8.097c.812-.743.87-2.014.127-2.826s-2.014-.869-2.826-.127L6.41 13.322l-.127 2.826zM13.79 6.575l2.7 2.952",stroke:"currentColor"}),j("path",{stroke:a,d:"M19.375 20.125c.569.063-4.05-.562-6.412-.437s-4.759 1.229-6.857 1.625c-1.764.687-3.404-.938-1.981-2.5"}))},circle:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}))},square:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}))},line:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2.2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M20 4l-16 16"}))},lineArrow:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2.2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M20 4l-16 16"}),j("path",{d:"M16 3h5v5"}))},polygon:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M13.163 2.168l8.021 5.828c.694 .504 .984 1.397 .719 2.212l-3.064 9.43a1.978 1.978 0 0 1 -1.881 1.367h-9.916a1.978 1.978 0 0 1 -1.881 -1.367l-3.064 -9.43a1.978 1.978 0 0 1 .719 -2.212l8.021 -5.828a1.978 1.978 0 0 1 2.326 0z"}))},zigzag:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{d:"M12 2.4L21.36 11.76L2.64 12.24L12 21.6"}))},text:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0"}),j("path",{d:"M14 19v-10.5a3.5 3.5 0 0 1 7 0v10.5"}),j("path",{d:"M14 13h7"}),j("path",{d:"M10 12v7"}))},italic:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M11 5l6 0"}),j("path",{d:"M7 19l6 0"}),j("path",{d:"M14 5l-4 14"}))},bold:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),j("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"}))},alignLeft:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M4 12l10 0"}),j("path",{d:"M4 18l14 0"}))},alignCenter:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M8 12l8 0"}),j("path",{d:"M6 18l12 0"}))},alignRight:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M10 12l10 0"}),j("path",{d:"M6 18l14 0"}))},alignTop:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),j("path",{d:"M11 13h2"}),j("path",{d:"M9 10h6"}),j("path",{d:"M10 7h4"}))},alignMiddle:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),j("path",{d:"M11 15h2"}),j("path",{d:"M9 12h6"}),j("path",{d:"M10 9h4"}))},alignBottom:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),j("path",{d:"M11 17h2"}),j("path",{d:"M9 14h6"}),j("path",{d:"M10 11h4"}))},photo:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 8h.01"}),j("path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"}),j("path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"}),j("path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"}))},pointer:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7.904 17.563a1.2 1.2 0 0 0 2.228 .308l2.09 -3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047 -1.047a1.067 1.067 0 0 0 0 -1.509l-4.907 -4.907l3.113 -2.09a1.2 1.2 0 0 0 -.309 -2.228l-13.582 -3.904l3.904 13.563z"}))},redact:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 4h10"}),j("path",{d:"M12 4v8"}),j("defs",null,j("clipPath",{id:"stripeClip"},j("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2"}))),j("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2",fill:"none"}),j("g",{"clip-path":"url(#stripeClip)"},j("path",{d:"M-7 24l12 -12"}),j("path",{d:"M-3 24l12 -12"}),j("path",{d:"M1 24l12 -12"}),j("path",{d:"M5 24l12 -12"}),j("path",{d:"M9 24l12 -12"}),j("path",{d:"M13 24l12 -12"}),j("path",{d:"M17 24l12 -12"}),j("path",{d:"M21 24l12 -12"}),j("path",{d:"M25 24l12 -12"})))},redactArea:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),j("path",{d:"M3 13v-3"}),j("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),j("path",{d:"M10 3h3"}),j("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),j("defs",null,j("clipPath",{id:"redactClip"},j("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2"}))),j("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2",fill:"none"}),j("g",{"clip-path":"url(#redactClip)"},j("path",{d:"M-2 24l14 -14"}),j("path",{d:"M2 24l14 -14"}),j("path",{d:"M6 24l14 -14"}),j("path",{d:"M10 24l15 -15"}),j("path",{d:"M14 24l15 -15"}),j("path",{d:"M18 24l15 -15"})))},check:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M5 12l5 5l10 -10"}))},file:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.className,l=e.title;return j("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:s,"aria-hidden":!l,role:l?"img":"presentation"},l&&j("title",null,l),j("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),j("polyline",{points:"14 2 14 8 20 8"}))},plus:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.className,l=e.title;return j("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:s,"aria-hidden":!l,role:l?"img":"presentation"},l&&j("title",null,l),j("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),j("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))},lock:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:void 0===o?"":o,style:e.style},j("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),j("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))},alertTriangle:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:void 0===o?"":o,style:e.style},j("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),j("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),j("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))}},Bm=new Map,qm=/^[MmZzLlHhVvCcSsQqTtAa0-9\s,.\-eE]+$/;function Gm(e){return qm.test(e.trim())}function Vm(e,t){for(var n=function(e){var t,n;return"path"in e?{viewBox:e.viewBox||"0 0 24 24",paths:[{d:e.path,stroke:null!==(t=e.stroke)&&void 0!==t?t:"primary",fill:null!==(n=e.fill)&&void 0!==n?n:"none",strokeWidth:e.strokeWidth}],strokeLinecap:e.strokeLinecap||"round",strokeLinejoin:e.strokeLinejoin||"round",strokeWidth:e.strokeWidth}:{viewBox:e.viewBox||"0 0 24 24",paths:e.paths,strokeLinecap:e.strokeLinecap||"round",strokeLinejoin:e.strokeLinejoin||"round",strokeWidth:e.strokeWidth}}(t),o=0;o<n.paths.length;o++){var i=n.paths[o];if(!i.d||!Gm(i.d))throw new Error('Invalid path data for icon "'.concat(e,'" at path index ').concat(o,". ")+"Path must only contain valid SVG path commands.")}Bm.set(e,n)}function Zm(e){for(var t=0,n=Object.entries(e);t<n.length;t++){var o=f(n[t],2);Vm(o[0],o[1])}}function Km(e,t,n){return e&&"none"!==e?"primary"===e?t:"secondary"===e?n:"currentColor"===e?"currentColor":e:"none"}function Ym(e){var t,n=e.icon,o=e.title,i=e.size,r=void 0===i?24:i,a=e.strokeWidth,s=void 0===a?2:a,l=e.primaryColor,c=void 0===l?"currentColor":l,d=e.secondaryColor,u=void 0===d?"none":d,h=e.className,m=Wm[n];if(m)return j(m,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o});if(t=n,Bm.has(t)){var g=function(e){return Bm.get(e)}(n);return function(e,t){var n,o=t.size,i=t.strokeWidth,r=t.primaryColor,a=t.secondaryColor,s=t.className,l=t.title,c=null!==(n=e.strokeWidth)&&void 0!==n?n:i;return j("svg",{width:o,height:o,viewBox:e.viewBox,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,class:s,role:"img","aria-label":l},e.paths.map(function(e,t){var n,o=Km(e.stroke,r,a),i=Km(e.fill,r,a),s=null!==(n=e.strokeWidth)&&void 0!==n?n:c;return j("path",{key:t,d:e.d,stroke:o,fill:i,"stroke-width":"none"!==o?s:void 0,opacity:e.opacity})}))}(g,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o})}return console.warn("Icon not found: ".concat(n)),null}var Xm=["id","children","onClick","active","disabled","className","tooltip","elementRef"];function Qm(e){var t=e.id,n=e.children,o=e.onClick,i=e.active,r=void 0!==i&&i,a=e.disabled,s=void 0!==a&&a,l=e.className,c=void 0===l?"":l,d=e.tooltip,u=e.elementRef,g=m(e,Xm);return j("button",h({id:t,ref:u,onClick:o,className:"flex h-[32px] w-auto min-w-[32px] items-center justify-center rounded-md p-[5px] transition-colors ".concat(r?"bg-interactive-selected text-accent ring-accent border-none shadow ring":"hover:bg-interactive-hover hover:ring-accent hover:ring"," ").concat(s?"cursor-not-allowed opacity-50 hover:bg-transparent hover:ring-0":"cursor-pointer"," ").concat(c),title:d},g),n)}const Jm=Math.min,eg=Math.max,tg=Math.round,ng=Math.floor,og=e=>({x:e,y:e}),ig={left:"right",right:"left",bottom:"top",top:"bottom"},rg={start:"end",end:"start"};function ag(e,t,n){return eg(e,Jm(t,n))}function sg(e,t){return"function"==typeof e?e(t):e}function lg(e){return e.split("-")[0]}function cg(e){return e.split("-")[1]}function dg(e){return"x"===e?"y":"x"}function ug(e){return"y"===e?"height":"width"}const hg=new Set(["top","bottom"]);function mg(e){return hg.has(lg(e))?"y":"x"}function gg(e){return dg(mg(e))}function pg(e){return e.replace(/start|end/g,e=>rg[e])}const vg=["left","right"],fg=["right","left"],yg=["top","bottom"],bg=["bottom","top"];function wg(e,t,n,o){const i=cg(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?fg:vg:t?vg:fg;case"left":case"right":return t?yg:bg;default:return[]}}(lg(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(pg)))),r}function xg(e){return e.replace(/left|right|bottom|top/g,e=>ig[e])}function Cg(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ig(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Sg(e,t,n){let{reference:o,floating:i}=e;const r=mg(t),a=gg(t),s=ug(a),l=lg(t),c="y"===r,d=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,h=o[s]/2-i[s]/2;let m;switch(l){case"top":m={x:d,y:o.y-i.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-i.width,y:u};break;default:m={x:o.x,y:o.y}}switch(cg(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function kg(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:r,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=sg(t,e),g=Cg(m),p=s[h?"floating"===u?"reference":"floating":u],v=Ig(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(p)))||n?p:p.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),f="floating"===u?{x:o,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),b=await(null==r.isElement?void 0:r.isElement(y))&&await(null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},w=Ig(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:f,offsetParent:y,strategy:l}):f);return{top:(v.top-w.top+g.top)/b.y,bottom:(w.bottom-v.bottom+g.bottom)/b.y,left:(v.left-w.left+g.left)/b.x,right:(w.right-v.right+g.right)/b.x}}const Dg=new Set(["left","top"]);function Mg(){return"undefined"!=typeof window}function Pg(e){return zg(e)?(e.nodeName||"").toLowerCase():"#document"}function Ag(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Tg(e){var t;return null==(t=(zg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function zg(e){return!!Mg()&&(e instanceof Node||e instanceof Ag(e).Node)}function Eg(e){return!!Mg()&&(e instanceof Element||e instanceof Ag(e).Element)}function _g(e){return!!Mg()&&(e instanceof HTMLElement||e instanceof Ag(e).HTMLElement)}function Rg(e){return!(!Mg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Ag(e).ShadowRoot)}const Ng=new Set(["inline","contents"]);function Og(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=Zg(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Ng.has(i)}const Lg=new Set(["table","td","th"]);function $g(e){return Lg.has(Pg(e))}const Fg=[":popover-open",":modal"];function jg(e){return Fg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Hg=["transform","translate","scale","rotate","perspective"],Ug=["transform","translate","scale","rotate","perspective","filter"],Wg=["paint","layout","strict","content"];function Bg(e){const t=qg(),n=Eg(e)?Zg(e):e;return Hg.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Ug.some(e=>(n.willChange||"").includes(e))||Wg.some(e=>(n.contain||"").includes(e))}function qg(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Gg=new Set(["html","body","#document"]);function Vg(e){return Gg.has(Pg(e))}function Zg(e){return Ag(e).getComputedStyle(e)}function Kg(e){return Eg(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Yg(e){if("html"===Pg(e))return e;const t=e.assignedSlot||e.parentNode||Rg(e)&&e.host||Tg(e);return Rg(t)?t.host:t}function Xg(e){const t=Yg(e);return Vg(t)?e.ownerDocument?e.ownerDocument.body:e.body:_g(t)&&Og(t)?t:Xg(t)}function Qg(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Xg(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=Ag(i);if(r){const e=Jg(a);return t.concat(a,a.visualViewport||[],Og(i)?i:[],e&&n?Qg(e):[])}return t.concat(i,Qg(i,[],n))}function Jg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ep(e){const t=Zg(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=_g(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=tg(n)!==r||tg(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function tp(e){return Eg(e)?e:e.contextElement}function np(e){const t=tp(e);if(!_g(t))return og(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=ep(t);let a=(r?tg(n.width):n.width)/o,s=(r?tg(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const op=og(0);function ip(e){const t=Ag(e);return qg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:op}function rp(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=tp(e);let a=og(1);t&&(o?Eg(o)&&(a=np(o)):a=np(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ag(e))&&t}(r,n,o)?ip(r):og(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,d=i.width/a.x,u=i.height/a.y;if(r){const e=Ag(r),t=o&&Eg(o)?Ag(o):o;let n=e,i=Jg(n);for(;i&&o&&t!==n;){const e=np(i),t=i.getBoundingClientRect(),o=Zg(i),r=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=r,c+=a,n=Ag(i),i=Jg(n)}}return Ig({width:d,height:u,x:l,y:c})}function ap(e,t){const n=Kg(e).scrollLeft;return t?t.left+n:rp(Tg(e)).left+n}function sp(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ap(e,n),y:n.top+t.scrollTop}}const lp=new Set(["absolute","fixed"]);function cp(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Ag(e),o=Tg(e),i=n.visualViewport;let r=o.clientWidth,a=o.clientHeight,s=0,l=0;if(i){r=i.width,a=i.height;const e=qg();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=ap(o);if(c<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-i);a<=25&&(r-=a)}else c<=25&&(r+=c);return{width:r,height:a,x:s,y:l}}(e,n);else if("document"===t)o=function(e){const t=Tg(e),n=Kg(e),o=e.ownerDocument.body,i=eg(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=eg(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+ap(e);const s=-n.scrollTop;return"rtl"===Zg(o).direction&&(a+=eg(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(Tg(e));else if(Eg(t))o=function(e,t){const n=rp(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=_g(e)?np(e):og(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:i*r.x,y:o*r.y}}(t,n);else{const n=ip(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ig(o)}function dp(e,t){const n=Yg(e);return!(n===t||!Eg(n)||Vg(n))&&("fixed"===Zg(n).position||dp(n,t))}function up(e,t,n){const o=_g(t),i=Tg(t),r="fixed"===n,a=rp(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=og(0);function c(){l.x=ap(i)}if(o||!o&&!r)if(("body"!==Pg(t)||Og(i))&&(s=Kg(t)),o){const e=rp(t,!0,r,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();r&&!o&&i&&c();const d=!i||o||r?og(0):sp(i,s);return{x:a.left+s.scrollLeft-l.x-d.x,y:a.top+s.scrollTop-l.y-d.y,width:a.width,height:a.height}}function hp(e){return"static"===Zg(e).position}function mp(e,t){if(!_g(e)||"fixed"===Zg(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Tg(e)===n&&(n=n.ownerDocument.body),n}function gp(e,t){const n=Ag(e);if(jg(e))return n;if(!_g(e)){let t=Yg(e);for(;t&&!Vg(t);){if(Eg(t)&&!hp(t))return t;t=Yg(t)}return n}let o=mp(e,t);for(;o&&$g(o)&&hp(o);)o=mp(o,t);return o&&Vg(o)&&hp(o)&&!Bg(o)?n:o||function(e){let t=Yg(e);for(;_g(t)&&!Vg(t);){if(Bg(t))return t;if(jg(t))return null;t=Yg(t)}return null}(e)||n}const pp={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=Tg(o),s=!!t&&jg(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=og(1);const d=og(0),u=_g(o);if((u||!u&&!r)&&(("body"!==Pg(o)||Og(a))&&(l=Kg(o)),_g(o))){const e=rp(o);c=np(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?og(0):sp(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+h.x,y:n.y*c.y-l.scrollTop*c.y+d.y+h.y}},getDocumentElement:Tg,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?jg(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Qg(e,[],!1).filter(e=>Eg(e)&&"body"!==Pg(e)),i=null;const r="fixed"===Zg(e).position;let a=r?Yg(e):e;for(;Eg(a)&&!Vg(a);){const t=Zg(a),n=Bg(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&lp.has(i.position)||Og(a)&&!n&&dp(e,a))?o=o.filter(e=>e!==a):i=t,a=Yg(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=cp(t,n,i);return e.top=eg(o.top,e.top),e.right=Jm(o.right,e.right),e.bottom=Jm(o.bottom,e.bottom),e.left=eg(o.left,e.left),e},cp(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:gp,getElementRects:async function(e){const t=this.getOffsetParent||gp,n=this.getDimensions,o=await n(e.floating);return{reference:up(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ep(e);return{width:t,height:n}},getScale:np,isElement:Eg,isRTL:function(e){return"rtl"===Zg(e).direction}};function vp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fp(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=o,c=tp(e),d=i||r?[...c?Qg(c):[],...Qg(t)]:[];d.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)});const u=c&&s?function(e,t){let n,o=null;const i=Tg(e);function r(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),r();const c=e.getBoundingClientRect(),{left:d,top:u,width:h,height:m}=c;if(s||t(),!h||!m)return;const g={rootMargin:-ng(u)+"px "+-ng(i.clientWidth-(d+h))+"px "+-ng(i.clientHeight-(u+m))+"px "+-ng(d)+"px",threshold:eg(0,Jm(1,l))||1};let p=!0;function v(t){const o=t[0].intersectionRatio;if(o!==l){if(!p)return a();o?a(!1,o):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==o||vp(c,e.getBoundingClientRect())||a(),p=!1}try{o=new IntersectionObserver(v,{...g,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(v,g)}o.observe(e)}(!0),r}(c,n):null;let h,m=-1,g=null;a&&(g=new ResizeObserver(e=>{let[o]=e;o&&o.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=g)||e.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let p=l?rp(e):null;return l&&function t(){const o=rp(e);p&&!vp(p,o)&&n();p=o,h=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=g)||e.disconnect(),g=null,l&&cancelAnimationFrame(h)}}const yp=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:o,elements:i}=e,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),a=lg(n),s=cg(n),l="y"===mg(n),c=Dg.has(a)?-1:1,d=r&&l?-1:1,u=sg(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof g&&(m="end"===s?-1*g:g),l?{x:m*d,y:h*c}:{x:h*c,y:m*d}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:a}}}}},bp=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=sg(e,t),c={x:n,y:o},d=await kg(t,l),u=mg(lg(i)),h=dg(u);let m=c[h],g=c[u];if(r){const e="y"===h?"bottom":"right";m=ag(m+d["y"===h?"top":"left"],m,m-d[e])}if(a){const e="y"===u?"bottom":"right";g=ag(g+d["y"===u?"top":"left"],g,g-d[e])}const p=s.fn({...t,[h]:m,[u]:g});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[h]:r,[u]:a}}}}}},wp=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...v}=sg(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const f=lg(i),y=mg(s),b=lg(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[xg(s)]:function(e){const t=xg(e);return[pg(e),t,pg(t)]}(s)),C="none"!==g;!h&&C&&x.push(...wg(s,p,g,w));const I=[s,...x],S=await kg(t,v),k=[];let D=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&k.push(S[f]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=cg(e),i=gg(e),r=ug(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=xg(a)),[a,xg(a)]}(i,a,w);k.push(S[e[0]],S[e[1]])}if(D=[...D,{placement:i,overflows:k}],!k.every(e=>e<=0)){var M,P;const e=((null==(M=r.flip)?void 0:M.index)||0)+1,t=I[e];if(t){if(!("alignment"===u&&y!==mg(t))||D.every(e=>mg(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:D},reset:{placement:t}}}let n=null==(P=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(m){case"bestFit":{var A;const e=null==(A=D.filter(e=>{if(C){const t=mg(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:A[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},xp=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=sg(e,t)||{};if(null==c)return{};const u=Cg(d),h={x:n,y:o},m=gg(i),g=ug(m),p=await a.getDimensions(c),v="y"===m,f=v?"top":"left",y=v?"bottom":"right",b=v?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[m]-h[m]-r.floating[g],x=h[m]-r.reference[m],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let I=C?C[b]:0;I&&await(null==a.isElement?void 0:a.isElement(C))||(I=s.floating[b]||r.floating[g]);const S=w/2-x/2,k=I/2-p[g]/2-1,D=Jm(u[f],k),M=Jm(u[y],k),P=D,A=I-p[g]-M,T=I/2-p[g]/2+S,z=ag(P,T,A),E=!l.arrow&&null!=cg(i)&&T!==z&&r.reference[g]/2-(T<P?D:M)-p[g]/2<0,_=E?T<P?T-P:T-A:0;return{[m]:h[m]+_,data:{[m]:z,centerOffset:T-z-_,...E&&{alignmentOffset:_}},reset:E}}}),Cp=(e,t,n)=>{const o=new Map,i={platform:pp,...n},r={...i.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:a}=n,s=r.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=Sg(c,o,l),h=o,m={},g=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:v,y:f,data:y,reset:b}=await p({x:d,y:u,initialPlacement:o,placement:h,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=f?f:u,m={...m,[r]:{...m[r],...y}},b&&g<=50&&(g++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:d,y:u}=Sg(c,h,l))),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:m}})(e,t,{...i,platform:r})};var Ip=function(){function e(){return i(this,e),o(this,e,arguments)}return c(e,W),r(e,[{key:"render",value:function(){return this.props.children}}])}();function Sp(e){var t=e.children,n=e.content,o=e.position,i=void 0===o?"top":o,r=e.className,a=void 0===r?"":r,l=e.delay,c=void 0===l?200:l,d=e.style,u=void 0===d?"dark":d,h=e.trigger,m=void 0===h?"hover":h,g=Ae(null),p=Ae(null),v=Ae(null),y=f(ke(!1),2),b=y[0],w=y[1],x=Ae(null);return Me(function(){var e;if(null!==(e=g.current)&&void 0!==e&&e.base&&p.current)return fp(g.current.base,p.current,function(){Cp(g.current.base,p.current,{placement:i,middleware:[yp(8),wp(),bp({padding:8}),xp({element:v.current,padding:6})]}).then(function(e){var t,n=e.x,o=e.y,i=e.placement,r=e.middlewareData;Object.assign(p.current.style,{left:"".concat(n,"px"),top:"".concat(o,"px")});var a=null!==(t=r.arrow)&&void 0!==t?t:{},l=a.x,c=a.y,d={top:"bottom",bottom:"top",left:"right",right:"left"}[i.split("-")[0]];Object.assign(v.current.style,s({left:null!=l?"".concat(l,"px"):"",top:null!=c?"".concat(c,"px"):"",right:"",bottom:""},d,"-4px"))})})},[i,b]),Me(function(){var e,t=null===(e=g.current)||void 0===e?void 0:e.base,n=p.current;if(t&&n){var o=function(){x.current&&clearTimeout(x.current)},i=function(){o(),x.current=setTimeout(function(){return w(!0)},c)},r=function(){o(),w(!1)},a=function(){return w(function(e){return!e})};return"hover"===m?(t.addEventListener("mouseenter",i),t.addEventListener("mouseleave",r),n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",r),t.addEventListener("pointerdown",r)):"click"===m&&t.addEventListener("click",a),"none"===m&&(x.current&&clearTimeout(x.current),w(!1)),function(){o(),"hover"===m?(t.removeEventListener("mouseenter",i),t.removeEventListener("mouseleave",r),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",r),t.removeEventListener("pointerdown",r)):"click"===m&&t.removeEventListener("click",a)}}},[m,c]),j(U,null,j("div",{ref:p,role:"tooltip",className:"z-100 pointer-events-none absolute select-none whitespace-nowrap rounded-lg px-3 py-2 text-sm shadow-md transition-opacity duration-150 ".concat("dark"===u?"bg-tooltip-bg text-tooltip-fg":"border-border-subtle bg-bg-elevated text-fg-primary border"," ").concat(b?"opacity-100":"opacity-0"," ").concat(a," "),style:{visibility:b?"visible":"hidden"}},n,j("div",{ref:v,className:"absolute h-2 w-2 rotate-45 bg-inherit ".concat("light"===u?"border-border-subtle border":""," ")})),j(Ip,{ref:g},t))}function kp(e){var t=e.commandId,n=e.documentId,o=e.variant,i=void 0===o?"icon":o,r=e.itemId,a=e.className,s=ta(t,n),l=Tr(n,r||t);if(!s||!s.visible)return null;var c=s.iconProps||{};return j(Sp,{content:s.label,position:"bottom",delay:500,trigger:s.active?"none":"hover"},j(Qm,{elementRef:l,onClick:function(){s.disabled||s.execute()},active:s.active,disabled:s.disabled,className:a||"p-1","aria-label":s.label},"text"===i?j("span",{className:"text-sm"},s.label):"icon-text"===i?j(U,null,s.icon&&j(Ym,{icon:s.icon,className:"mr-2 h-5 w-5",primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}),j("span",null,s.label)):"tab"===i?j("span",{className:"px-3 py-1"},s.label):s.icon?j(Ym,{icon:s.icon,className:Nm("h-5 w-5",c.className),primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}):j("span",null,s.label)))}function Dp(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.className,r=void 0===i?"":i;if(!o)return null;var a="secondary"===t.position.slot,s=function(e){switch(e){case"top":return"border-b border-border-default bg-bg-surface px-4 py-2";case"bottom":return"border-t border-border-default bg-bg-surface px-4 py-2";case"left":return"border-r border-border-default bg-bg-surface px-2 py-3 flex-col";case"right":return"border-l border-border-default bg-bg-surface px-2 py-3 flex-col"}}(t.position.placement);return j("div",h({className:Nm("flex items-center gap-2",s,a?"bg-bg-surface-alt":"",r)},mr(t)),t.items.map(function(e){return j(Mp,{key:e.id,item:e,documentId:n})}))}function Mp(e){var t=e.item,n=e.documentId;switch(t.type){case"command-button":return j(Pp,{item:t,documentId:n});case"tab-group":return j(Ap,{item:t,documentId:n});case"divider":return j(Ep,{item:t});case"spacer":return j(_p,{item:t});case"group":return j(Rp,{item:t,documentId:n});case"custom":return j(Np,{item:t,documentId:n});default:return console.warn("Unknown toolbar item type:",t),null}}function Pp(e){var t=e.item,n=e.documentId;return j("div",h({},mr(t)),j(kp,{commandId:t.commandId,documentId:n,itemId:t.id,variant:t.variant}))}function Ap(e){var t=e.item,n=e.documentId;return j("div",h(h({className:"flex items-center gap-2"},mr(t)),{},{role:"tablist"}),t.tabs.map(function(e){return j(Tp,{key:e.id,tab:e,documentId:n})}))}function Tp(e){var t=e.tab,n=e.documentId,o=ta(t.commandId,n),i=Tr(n,t.id);if(!o||!o.visible)return null;return j("div",h({},mr(t)),j(Lm,{anchorRef:i,active:o.active,onClick:function(){o.disabled||o.execute()},disabled:o.disabled},"text"===t.variant&&o.label,"icon"===t.variant&&o.icon&&j(zp,{icon:o.icon,iconProps:o.iconProps}),"icon-text"===t.variant&&j(U,null,o.icon&&j(zp,{icon:o.icon,iconProps:o.iconProps}),o.label)))}function zp(e){var t=e.icon,n=e.iconProps;return j(Ym,{icon:t,className:"h-5 w-5",primaryColor:null==n?void 0:n.primaryColor,secondaryColor:null==n?void 0:n.secondaryColor})}function Ep(e){var t=e.item;return j("div",h({},mr(t)),j("div",{className:"vertical"===t.orientation?"bg-border-default h-6 w-px":"bg-border-default h-px w-6","aria-hidden":"true"}))}function _p(e){var t=e.item;return j("div",h(h({className:t.flex?"flex-1":"w-4"},mr(t)),{},{"aria-hidden":"true"}))}function Rp(e){var t=e.item,n=e.documentId,o=t.gap?"gap-".concat(t.gap):"gap-2",i=function(e){switch(e){case"start":default:return"justify-start";case"center":return"justify-center";case"end":return"justify-end"}}(t.alignment);return j("div",h({className:Nm("flex items-center",o,i)},mr(t)),t.items.map(function(e){return j(Mp,{key:e.id,item:e,documentId:n})}))}function Np(e){var t=e.item,n=e.documentId,o=_r().renderCustomComponent;return j("div",h({},mr(t)),o(t.componentId,n,t.props))}function Op(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Lp(e,t){this.props=e,this.context=t}(Lp.prototype=new W).isPureReactComponent=!0,Lp.prototype.shouldComponentUpdate=function(e,t){return Op(this.props,e)||Op(this.state,t)};var $p=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$p&&$p(e)};var Fp=I.__e;I.__e=function(e,t,n,o){if(e.then)for(var i,r=t;r=r.__;)if((i=r.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);Fp(e,t,n,o)};var jp=I.unmount;function Hp(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Hp(e,t,n)})),e}function Up(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Up(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Wp(){this.__u=0,this.o=null,this.__b=null}function Bp(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function qp(){this.i=null,this.l=null}I.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),jp&&jp(e)},(Wp.prototype=new W).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var i=Bp(o.__v),r=!1,a=function(){r||(r=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Up(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(a,a)},Wp.prototype.componentWillUnmount=function(){this.o=[]},Wp.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Hp(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&j(U,null,e.fallback);return i&&(i.__u&=-33),[j(U,null,t.__a?null:e.children),i]};var Gp=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Vp(e){return this.getChildContext=function(){return e.context},e.children}function Zp(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){ce(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}ce(j(Vp,{context:t.context},e.__v),t.v)}function Kp(e,t){var n=j(Zp,{__v:e,h:t});return n.containerInfo=t,n}(qp.prototype=new W).__a=function(e){var t=this,n=Bp(t.__v),o=t.l.get(e);return o[0]++,function(i){var r=function(){t.props.revealOrder?(o.push(i),Gp(t,e,o)):i()};n?n(r):r()}},qp.prototype.render=function(e){this.i=null,this.l=new Map;var t=Y(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},qp.prototype.componentDidUpdate=qp.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Gp(e,n,t)})};var Yp="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Xp=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qp=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Jp=/[A-Z0-9]/g,ev="undefined"!=typeof document,tv=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};W.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(W.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var nv=I.event;function ov(){}function iv(){return this.cancelBubble}function rv(){return this.defaultPrevented}I.event=function(e){return nv&&(e=nv(e)),e.persist=ov,e.isPropagationStopped=iv,e.isDefaultPrevented=rv,e.nativeEvent=e};var av={enumerable:!1,configurable:!0,get:function(){return this.class}},sv=I.vnode;I.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},i=-1===n.indexOf("-");for(var r in t){var a=t[r];if(!("value"===r&&"defaultValue"in t&&null==a||ev&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===a?a="":"translate"===s&&"no"===a?a=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||tv(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":Qp.test(r)&&(r=s):s=r="oninput":i&&Xp.test(r)?r=r.replace(Jp,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===s&&o[r=s]&&(r="oninputCapture"),o[r]=a}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=Y(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=Y(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",av)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Yp,sv&&sv(e)};var lv=I.__r;I.__r=function(e){lv&&lv(e),e.__c};var cv=I.diffed;I.diffed=function(e){cv&&cv(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};function dv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=Dr().getContainer,a=ke(function(){var e=r();return!!e&&e.clientWidth<768}),s=f(a,2),l=s[0],c=s[1];Me(function(){var e=r();if(e){var t=new ResizeObserver(function(){var t=e.clientWidth;c(t<768)});return t.observe(e),function(){return t.disconnect()}}},[r]);var d=t.position,u=t.content,h=t.width,m=_r().renderCustomComponent,g=r();if(l&&g)return Kp(j(uv,{schema:t,documentId:n,isOpen:o,onClose:i,renderCustomComponent:m,content:u,rootElement:g}),g);if(!o)return null;var p=function(e){switch(e){case"left":return"border-r";case"right":return"border-l";case"top":return"border-b";case"bottom":return"border-t"}}(d.placement),v=h?{width:h}:void 0;return j("div",{className:"".concat(p," border-border-default bg-bg-surface flex flex-col shadow-lg"),style:v,"data-sidebar-id":t.id},j("div",{className:"min-h-0 flex-1"},"tabs"===u.type&&j(hv,{content:u,documentId:n,renderCustomComponent:m}),"component"===u.type&&j(U,null,m(u.componentId,n,{}))))}function uv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.renderCustomComponent,a=e.content,s=e.rootElement,l=f(ke("closed"),2),c=l[0],d=l[1],u=f(ke(!1),2),h=u[0],m=u[1],g=f(ke(0),2),p=g[0],v=g[1],y=f(ke(!1),2),b=y[0],w=y[1],x=Ae(null),C=Ae({y:0,height:0,time:0,state:"half"}),I=Ae({y:0,time:0});Me(function(){if(!o){d("closed");var e=setTimeout(function(){w(!1)},300);return function(){return clearTimeout(e)}}w(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){d("half")})})},[o]);var S=function(e){switch(e){case"closed":return 0;case"half":return 50;case"full":return 100}},k=ze(function(e){if(x.current){var t,n=s.clientHeight,o=x.current.offsetHeight/n*100;t=o>=75?"full":o<=25?"closed":"half",C.current={y:e,height:o,time:Date.now(),state:t},I.current={y:e,time:Date.now()},v(0),t!==c&&d(t),m(!0)}},[s,c]),D=ze(function(e){if(h){var t=s.clientHeight,n=(C.current.y-e)/t*100,o=Math.max(0,Math.min(100,C.current.height+n));I.current={y:e,time:Date.now()};var i=S(C.current.state);v(o-i)}},[h,s]),M=ze(function(){if(h){if(Math.abs(C.current.y-I.current.y)<5)return m(!1),void v(0);var e=S(C.current.state)+p,t=Date.now()-I.current.time,n=I.current.y-C.current.y,o=function(e,t){return Math.abs(t)>.5?t>0?e>50?"half":"closed":e<50?"half":"full":e>=75?"full":e<=25?"closed":"half"}(e,t>0?n/t:0);"closed"===o?(d("closed"),m(!1),v(0),i()):(m(!1),v(0),d(o))}},[h,p,i]),P=ze(function(e){k(e.touches[0].clientY)},[k]),A=ze(function(e){h&&(e.cancelable&&e.preventDefault(),D(e.touches[0].clientY))},[h,D]),T=ze(function(){M()},[M]),z=ze(function(e){e.preventDefault(),k(e.clientY)},[k]);if(Me(function(){if(h){var e=function(e){D(e.clientY)},t=function(){M()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[h,D,M]),!b)return null;var E=S(h?C.current.state:c),_=h?Math.max(0,Math.min(100,E+p)):E,R=.3*Math.min(_/50,1);return j(U,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(0===_?"pointer-events-none":""),style:{opacity:R},onClick:i}),j("div",{ref:x,className:"bg-bg-surface absolute inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl shadow-2xl ".concat(h?"":"transition-[height] duration-300 ease-out"),style:{height:"".concat(_,"%")},"data-sidebar-id":t.id},j("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:P,onTouchMove:A,onTouchEnd:T,onMouseDown:z},j("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),j("div",{className:"min-h-0 flex-1 overflow-hidden"},"tabs"===a.type&&j(hv,{content:a,documentId:n,renderCustomComponent:r}),"component"===a.type&&j(U,null,r(a.componentId,n,{})))))}function hv(e){var t,n=e.content,o=e.documentId,i=e.renderCustomComponent,r=f(ke((null===(t=n.tabs[0])||void 0===t?void 0:t.id)||""),2),a=r[0],s=r[1];return j("div",{className:"flex h-full flex-1 flex-col"},j("div",{role:"tablist",className:"bg-bg-surface mx-4 my-4 flex flex-shrink-0 overflow-hidden"},n.tabs.map(function(e,t,n){var o=a===e.id,i=0===t,r=t===n.length-1;return j("button",{key:e.id,role:"tab","aria-selected":o,tabIndex:o?0:-1,onClick:function(){return s(e.id)},className:"relative flex h-7 flex-1 cursor-pointer items-center justify-center border outline-none transition-colors ".concat(i?"rounded-l-md":""," ").concat(r?"rounded-r-md":""," ").concat(r?"":"border-r-0"," ").concat(o?"border-accent bg-accent text-fg-on-accent":"border-border-default text-fg-secondary hover:bg-interactive-hover")},e.icon&&j(Ym,{icon:e.icon,className:"h-5 w-5"}))})),j("div",{className:"min-h-0 flex-1 overflow-auto"},n.tabs.filter(function(e){return e.id===a}).map(function(e){return j(U,{key:e.id},i(e.componentId,o,{}))})))}function mv(e){var t=e.schema,n=e.documentId,o=e.anchorEl,i=e.onClose,r=Dr().getContainer,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:768,n=f(ke(function(){var n=e();return!!n&&n.clientWidth<t}),2),o=n[0],i=n[1];return Me(function(){var n=e();if(n){var o=new ResizeObserver(function(){i(n.clientWidth<t)});return o.observe(n),function(){return o.disconnect()}}},[e,t]),o}(r,768),s=r(),l=(()=>{const{provides:e}=Ir();return(null==e?void 0:e.getSchema())??null})(),c=f(ke([{menuId:t.id,schema:t,title:void 0}]),2),d=c[0],u=c[1];Me(function(){u([{menuId:t.id,schema:t,title:void 0}])},[t]);var h=d[d.length-1],m=ze(function(e,t){if(l){var n=l.menus[e];n?u(function(o){return[].concat(y(o),[{menuId:e,schema:n,title:t}])}):console.warn("Submenu schema not found: ".concat(e))}},[l]),g=ze(function(){d.length>1&&u(function(e){return e.slice(0,-1)})},[d.length]);return h?a&&s?Kp(j(gv,{currentMenu:h,menuStack:d,documentId:n,onClose:i,onNavigateBack:g,onNavigateToSubmenu:m,container:s}),s):j(pv,{currentMenu:h,documentId:n,anchorEl:o,onClose:i,onNavigateToSubmenu:m}):null}function gv(e){var t=e.currentMenu,n=e.menuStack,o=e.documentId,i=e.onClose,r=e.onNavigateBack,a=e.onNavigateToSubmenu,s=e.container,l=f(ke(!1),2),c=l[0],d=l[1],u=f(ke(!1),2),m=u[0],g=u[1],p=f(ke(0),2),v=p[0],y=p[1],b=Ae(null),w=Ae(null),x=Ae({isDragging:!1,startY:0,currentY:0,startTime:0,sheetHeight:0});Me(function(){d(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){g(!0)})})},[]);var C=f(ke(null),2),I=C[0],S=C[1];Me(function(){if(w.current){var e=(n.length>1?60:0)+w.current.scrollHeight+24,t=.8*s.clientHeight;S(Math.min(e,t))}},[t,n.length,s]);var k=ze(function(){g(!1),setTimeout(function(){d(!1),i()},300)},[i]),D=ze(function(e){b.current&&(x.current={isDragging:!0,startY:e,currentY:e,startTime:Date.now(),sheetHeight:b.current.offsetHeight})},[]),M=ze(function(e){if(x.current.isDragging){var t=e-x.current.startY,n=Math.max(0,t);x.current.currentY=e,y(n)}},[]),P=ze(function(){if(x.current.isDragging){var e=x.current,t=e.startY,n=e.currentY,o=e.startTime,i=e.sheetHeight,r=Math.abs(t-n);if(x.current.isDragging=!1,r<5)y(0);else{var a=n-t,s=a/i*100,l=Date.now()-o;s>30||(l>0?a/l:0)>.5?k():y(0)}}},[k]),A=ze(function(e){D(e.touches[0].clientY)},[D]),T=ze(function(e){x.current.isDragging&&e.cancelable&&e.preventDefault(),M(e.touches[0].clientY)},[M]),z=ze(function(){P()},[P]),E=ze(function(e){e.preventDefault(),D(e.clientY)},[D]);if(Me(function(){if(x.current.isDragging){var e=function(e){return M(e.clientY)},t=function(){return P()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[M,P]),Me(function(){var e=function(e){"Escape"===e.key&&k()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[k]),!c)return null;var _=m?v:I||400;return j(U,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(m?"opacity-100":"opacity-0"),onClick:k}),j("div",h({ref:b,className:"bg-bg-surface absolute inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl shadow-2xl ".concat(x.current.isDragging?"":"transition-transform duration-300 ease-out"),style:{maxHeight:"80%",transform:"translateY(".concat(_,"px)")}},mr(t.schema)),j("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:A,onTouchMove:T,onTouchEnd:z,onMouseDown:E},j("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),n.length>1&&j("div",{className:"border-border-subtle flex items-center gap-3 border-b px-4 pb-3"},j("button",{onClick:r,className:"hover:bg-interactive-hover rounded-full p-1"},j(Fm,{className:"h-5 w-5"})),j("h3",{className:"text-fg-primary font-semibold"},t.title||"Menu")),j("div",{ref:w,className:"flex-1 overflow-y-auto py-2"},t.schema.items.map(function(e){return j(vv,{key:e.id,item:e,documentId:o,onClose:k,isMobile:!0,onNavigateToSubmenu:a})}))))}function pv(e){var t=e.currentMenu,n=e.documentId,o=e.anchorEl,i=e.onClose,r=e.onNavigateToSubmenu,a=Ae(null),s=f(ke(null),2),l=s[0],c=s[1];Me(function(){if(o){var e=function(){var e,t=o.getBoundingClientRect(),n=(null===(e=a.current)||void 0===e?void 0:e.offsetWidth)||200,i=t.bottom+4,r=t.left;r+n>window.innerWidth&&(r=window.innerWidth-n-8),r<8&&(r=8),c({top:i,left:r})};return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),function(){window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}},[o]),Me(function(){var e=function(e){if(a.current){var t=e.composedPath(),n=t.includes(a.current),r=o&&t.includes(o);n||r||i()}},t=setTimeout(function(){document.addEventListener("mousedown",e)},0);return function(){clearTimeout(t),document.removeEventListener("mousedown",e)}},[i,o]),Me(function(){var e=function(e){"Escape"===e.key&&i()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[i]);var d=l?{position:"fixed",top:"".concat(l.top,"px"),left:"".concat(l.left,"px"),zIndex:1e3}:{display:"none"};return j("div",h(h({ref:a},mr(t.schema)),{},{className:"border-border-default bg-bg-elevated min-w-[200px] rounded-lg border py-2 shadow-lg",style:d}),t.schema.items.map(function(e){return j(vv,{key:e.id,item:e,documentId:n,onClose:i,isMobile:!1,onNavigateToSubmenu:r})}))}function vv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu;switch(t.type){case"command":return j(fv,{item:t,documentId:n,onClose:o,isMobile:i});case"submenu":return j(yv,{item:t,documentId:n,isMobile:i,onNavigateToSubmenu:r});case"divider":return j("div",h({},mr(t)),j("hr",{className:"border-border-subtle my-2"}));case"section":return j(bv,{item:t,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r});default:return null}}function fv(e){var t,n,o=e.item,i=e.documentId,r=e.onClose,a=e.isMobile,s=ta(o.commandId,i);if(!s||!s.visible)return null;var l,c,d=function(){s.disabled||(s.execute(),r())};return a?j("button",h(h({},mr(o)),{},{onClick:d,disabled:s.disabled,className:"active:bg-interactive-active flex w-full items-center gap-3 px-4 py-3 text-left text-base transition-colors ".concat(s.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"," ").concat(s.active?"bg-interactive-selected text-accent":"text-fg-secondary"),role:"menuitem"}),s.icon&&j(Ym,{icon:s.icon,className:"h-5 w-5",primaryColor:null===(l=s.iconProps)||void 0===l?void 0:l.primaryColor,secondaryColor:null===(c=s.iconProps)||void 0===c?void 0:c.secondaryColor}),j("span",{className:"flex-1"},s.label)):j("button",h(h({},mr(o)),{},{onClick:d,disabled:s.disabled,className:"flex w-full items-center justify-between gap-2 px-4 py-1 text-left ".concat(s.disabled?"pointer-events-none cursor-not-allowed opacity-50":"cursor-pointer"," ").concat(s.active&&!s.disabled?"bg-accent text-fg-on-accent":"text-fg-muted hover:bg-accent hover:text-fg-on-accent"),role:"menuitem"}),j("div",{className:"flex items-center gap-2"},j("div",{className:"flex h-6 w-6 items-center justify-center"},s.icon&&j(Ym,{icon:s.icon,className:"h-6 w-6",primaryColor:null===(t=s.iconProps)||void 0===t?void 0:t.primaryColor,secondaryColor:null===(n=s.iconProps)||void 0===n?void 0:n.secondaryColor})),j("span",{className:"text-sm"},s.label)))}function yv(e){var t=e.item,n=e.documentId,o=e.isMobile,i=e.onNavigateToSubmenu,r=ma(n).translate,a=t.labelKey?r(t.labelKey):t.label||"",s=function(){return i(t.menuId,a)};return o?j("button",h(h({},mr(t)),{},{onClick:s,className:"text-fg-secondary active:bg-interactive-active flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left text-base transition-colors",role:"menuitem"}),j("span",{className:"flex-1"},a),j($m,{className:"h-4 w-4"})):j("button",h(h({},mr(t)),{},{onClick:s,className:"text-fg-muted hover:bg-accent hover:text-fg-on-accent flex w-full cursor-pointer items-center justify-between gap-2 px-4 py-1 text-left",role:"menuitem"}),j("span",{className:"text-sm"},a),j($m,{className:"h-6 w-6"}))}function bv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu,a=ma(n).translate,s=t.labelKey?a(t.labelKey):t.label||"";return j("div",h({},mr(t)),j("div",{className:"text-fg-secondary px-4 py-3 text-xs font-medium uppercase"},s),t.items.map(function(e){return j(vv,{key:e.id,item:e,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r})}))}function wv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,a=t.content,s=_r().renderCustomComponent;return"component"!==a.type?(console.warn("SchemaModal only supports component content type, got: ".concat(a.type)),null):j(U,null,s(a.componentId,n,{isOpen:o,onClose:i,onExited:r}))}function xv(e){var t=e.documentId;e.onClose;var n=oi(t),o=n.state,i=n.provides;return j("div",{className:"flex h-full flex-1 flex-col"},j("div",{className:"flex-1 overflow-hidden"},j(Pl,{documentId:t,style:{width:"100%",height:"100%"}},function(e){return j("div",{key:e.pageIndex,style:{position:"absolute",width:"100%",height:e.wrapperHeight,top:e.top,display:"flex",flexDirection:"column",alignItems:"center",cursor:"pointer"},onClick:function(){var t;null==i||null===(t=i.scrollToPage)||void 0===t||t.call(i,{pageNumber:e.pageIndex+1})}},j("div",{style:{width:e.width,height:e.height,border:"2px solid ".concat(o.currentPage===e.pageIndex+1?"var(--ep-accent-primary)":"var(--ep-border-default)"),borderRadius:"4px",overflow:"hidden",boxShadow:o.currentPage===e.pageIndex+1?"0 0 0 2px var(--ep-interactive-focus-ring)":"none"}},j(Al,{documentId:t,meta:e,style:{width:"100%",height:"100%"}})),j("div",{style:{height:e.labelHeight,display:"flex",alignItems:"center",justifyContent:"center",marginTop:"4px"}},j("span",{className:"text-fg-secondary text-xs"},e.pageIndex+1)))})))}function Cv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=f(ke(e),2),o=n[0],i=n[1];return Me(function(){var n=window.setTimeout(function(){return i(e)},t);return function(){return clearTimeout(n)}},[e,t]),o}var Iv=function(e){var t=e.label,n=e.checked,o=e.onChange;return j("label",{className:"text-fg-secondary inline-flex cursor-pointer select-none items-center gap-2 text-xs font-medium"},j("input",{type:"checkbox",checked:n,onChange:function(e){return o(e.target.checked)},className:"border-border-default bg-bg-input checked:border-accent checked:bg-accent peer h-4 w-4 shrink-0 appearance-none rounded-[3px] border transition-all"}),j("svg",{viewBox:"0 0 24 24",className:"/* fine-tune centering */ text-fg-on-accent pointer-events-none absolute h-3.5 w-3.5 translate-x-[1px] translate-y-[1px] opacity-0 peer-checked:opacity-100",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"},j("polyline",{points:"20 6 9 17 4 12"})),t)},Sv=function(e){var t=e.hit,n=e.onClick,o=e.active,i=Ae(null);return Me(function(){o&&i.current&&i.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[o]),j("button",{ref:i,onClick:n,className:"w-full rounded border p-2 text-left text-sm transition-colors ".concat(o?"border-accent bg-accent-light text-fg-primary":"border-border-subtle bg-bg-surface text-fg-secondary hover:bg-interactive-hover")},j("span",null,t.context.truncatedLeft&&"… ",t.context.before,j("span",{className:"text-accent font-bold"},t.context.match),t.context.after,t.context.truncatedRight&&" …"))};function kv(e){var t=e.documentId;e.onClose;var n=(e=>{const{provides:t}=ms(),[n,o]=ke(as),i=Te(()=>null==t?void 0:t.forDocument(e),[t,e]);return Me(()=>{if(i)return o(i.getState()),i.onStateChange(e=>o(e));o(as)},[i]),{state:n,provides:i??null}})(t),o=n.state,i=n.provides,r=ni().provides,a=ma(t).translate,s=Ae(null),l=f(ke(""),2),c=l[0],d=l[1];Me(function(){},[]),Me(function(){o.query&&!c&&d(o.query)},[o.query]),Me(function(){void 0!==o.activeResultIndex&&o.activeResultIndex>=0&&!o.loading&&m(o.activeResultIndex)});var u=Cv(c,300);Me(function(){u!==o.query&&(null==i||i.searchAllPages(u))},[u,i,o.query]);var h=function(e,t){t?null==i||i.setFlags([].concat(y(o.flags),[e])):null==i||i.setFlags(o.flags.filter(function(t){return t!==e}))},m=function(e){var n,i=o.results[e];if(i){var a=i.rects.reduce(function(e,t){return{x:Math.min(e.x,t.origin.x),y:Math.min(e.y,t.origin.y)}},{x:1/0,y:1/0});null==r||null===(n=r.forDocument(t))||void 0===n||n.scrollToPage({pageNumber:i.pageIndex+1,pageCoordinates:a,alignX:50,alignY:25})}},g=function(e){var t={};return e.forEach(function(e,n){t[e.pageIndex]||(t[e.pageIndex]=[]),t[e.pageIndex].push({hit:e,index:n})}),t}(o.results);return j("div",{className:"bg-bg-surface flex h-full flex-col"},j("div",{className:"p-4"},j("div",{className:"relative"},j("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2"},j(Hm,{className:"text-fg-muted h-4 w-4"})),j("input",{ref:s,type:"text",placeholder:a("search.placeholder"),value:c,onInput:function(e){var t=e.target;d(t.value)},className:"border-border-default bg-bg-input focus:border-accent focus:ring-accent w-full rounded-md border py-1 pl-8 pr-9 text-base focus:outline-none focus:ring-1"}),c&&j("div",{className:"absolute inset-y-0 right-0 flex cursor-pointer items-center pr-3",onClick:function(){d(""),s.current&&s.current.focus()}},j(Um,{className:"text-fg-muted hover:text-fg-secondary h-4 w-4"}))),j("div",{className:"mt-3 flex flex-col gap-2"},j(Iv,{label:a("search.caseSensitive"),checked:o.flags.includes(Ft.MatchCase),onChange:function(e){return h(Ft.MatchCase,e)}}),j(Iv,{label:a("search.wholeWord"),checked:o.flags.includes(Ft.MatchWholeWord),onChange:function(e){return h(Ft.MatchWholeWord,e)}})),j("hr",{className:"border-border-subtle mb-2 mt-5"}),o.active&&j("div",{className:"flex h-[32px] flex-row items-center justify-between"},j("div",{className:"text-fg-muted text-xs"},a("search.resultsFound",{params:{count:o.total}})),o.total>1&&j("div",{className:"flex flex-row"},j(Qm,{onClick:function(){null==i||i.previousResult()}},j(Fm,{className:"h-4 w-4"})),j(Qm,{onClick:function(){null==i||i.nextResult()}},j($m,{className:"h-4 w-4"}))))),j("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4"},Object.entries(g).map(function(e){var t=f(e,2),n=t[0],r=t[1];return j("div",{key:n,className:"mt-2 first:mt-0"},j("div",{className:"bg-bg-surface/80 text-fg-muted py-2 text-xs backdrop-blur"},a("search.page",{params:{page:Number(n)+1}})),j("div",{className:"flex flex-col gap-2"},r.map(function(e){var t=e.hit,n=e.index;return j(Sv,{key:n,hit:t,active:n===o.activeResultIndex,onClick:function(){null==i||i.goToResult(n)}})})))}),j("div",null)))}function Dv(e){var t=e.documentId,n=po(uu.id).provides,o=ni().provides,i=ma(t).translate,r=fo(t),a=f(ke([]),2),s=a[0],l=a[1],c=f(ke(new Set),2),d=c[0],u=c[1],h=f(ke(!0),2),m=h[0],g=h[1];Me(function(){if(n&&null!=r&&r.document){g(!0);var e=n.getBookmarks();return e.wait(function(e){var t=e.bookmarks;l(t);var n=t.map(function(e,t){return"bookmark-".concat(t)});u(new Set(n)),g(!1)},function(){g(!1)}),function(){e.abort({code:Ht.Cancelled,message:"Bookmark task cancelled"})}}},[n,null==r?void 0:r.document]);var p=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a="bookmark-".concat(t),s=e.children&&e.children.length>0,l=d.has(a);return j("div",{key:a,className:"select-none"},j("div",{className:"hover:bg-interactive-hover flex cursor-pointer items-center gap-1 px-2 py-1",style:{paddingLeft:"".concat(16*i+8,"px")},onClick:function(){return function(e){if(o&&e.target){var t;if("action"===e.target.type){var n=e.target.action;if(n.type===kt.Goto||n.type===kt.RemoteGoto)t=n.destination;else if(n.type===kt.URI)return void window.open(n.uri,"_blank")}else"destination"===e.target.type&&(t=e.target.destination);if(t)if(t.zoom.mode===yt.XYZ){var i,a=null==r||null===(i=r.document)||void 0===i?void 0:i.pages.find(function(e){return e.index===t.pageIndex});if(!a)return;o.scrollToPage({pageNumber:t.pageIndex+1,pageCoordinates:t.zoom.params?{x:t.zoom.params.x,y:a.size.height-t.zoom.params.y}:void 0,behavior:"smooth"})}else o.scrollToPage({pageNumber:t.pageIndex+1,behavior:"smooth"})}}(e)}},s&&j("button",{onClick:function(e){e.stopPropagation(),function(e){u(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}(a)},className:"flex h-4 w-4 items-center justify-center"},j(l?jm:$m,{className:"h-3 w-3"})),!s&&j("div",{className:"w-4"}),j("span",{className:"text-fg-secondary text-sm"},e.title)),s&&l&&j("div",null,null===(n=e.children)||void 0===n?void 0:n.map(function(e,t){return p(e,t,i+1)})))};return null==r||!r.document||m?j("div",{className:"text-fg-secondary flex h-full flex-col gap-3 p-4 text-sm"},j("div",{className:"text-fg-primary font-medium"},i("outline.title")),j("p",null,i("outline.loading"))):0===s.length?j("div",{className:"flex h-full items-center justify-center p-6"},j("div",{className:"text-fg-muted text-center"},j("div",{className:"text-sm"},i("outline.noOutline")),j("div",{className:"mt-1 text-xs"},i("outline.noBookmarks")))):j("div",{className:"bg-bg-surface flex h-full flex-col"},j("div",{className:"flex-1 overflow-y-auto"},j("div",{className:"outline-tree"},s.map(function(e,t){return p(e,t)}))))}function Mv(e){var t=e.size,n=void 0===t?"md":t,o=e.text,i=e.className,r={sm:"w-6 h-6",md:"w-10 h-10",lg:"w-16 h-16"};return j("div",{className:"flex flex-col items-center justify-center gap-3 ".concat(void 0===i?"":i)},j("div",{className:"relative"},j("div",{className:"".concat(r[n]," border-border-default animate-spin rounded-full border-4")}),j("div",{className:"".concat(r[n]," border-r-accent border-t-accent absolute left-0 top-0 animate-spin rounded-full border-4 border-transparent")})),o&&j("p",{className:"".concat({sm:"text-sm",md:"text-base",lg:"text-lg"}[n]," text-fg-secondary animate-pulse font-medium")},o))}function Pv(e){var t=e.size,n=void 0===t?"md":t,o=e.className,i=void 0===o?"":o;return j("div",{className:"".concat({sm:"w-4 h-4 border-2",md:"w-6 h-6 border-2",lg:"w-8 h-8 border-3"}[n]," border-border-default border-t-accent animate-spin rounded-full ").concat(i)})}var Av,Tv=function(){var e=function(e){const{provides:t}=yd(),[n,o]=ke(pd);return Me(()=>{if(t)return t.forDocument(e).onStateChange(e=>{o(e)})},[t]),{provides:(null==t?void 0:t.forDocument(e))??null,state:n}}().provides,t=f(ke({show:!1,mode:null,isAnimating:!1}),2),n=t[0],o=t[1];Me(function(){if(e)return e.onModeChange(function(e){var t=e.activeMode;if("marqueeZoom"===t||"marqueeCapture"===t){o({show:!0,mode:t,isAnimating:!0});var n=setTimeout(function(){o(function(e){return h(h({},e),{},{show:!1})})},3e3);return function(){return clearTimeout(n)}}o({show:!1,mode:null,isAnimating:!1})})},[e]);if(!n.show&&!n.isAnimating)return null;var i="marqueeZoom"===n.mode?"Drag to select area to zoom":"Drag to select area to capture",r="marqueeZoom"===n.mode?"rgba(33,150,243,0.8)":"rgba(76,175,80,0.8)";return j("div",{className:"hint-overlay ".concat(n.show?"hint-show":"hint-hide"),onAnimationEnd:function(){n.show||o(function(e){return h(h({},e),{},{isAnimating:!1,mode:null})})},style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"20px"}},j("div",{className:"hint-text",style:{background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 20px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",textAlign:"center",maxWidth:"250px"}},i),j("div",{className:"drag-demo",style:{position:"relative",width:"150px",height:"100px"}},j("div",{style:{position:"absolute",top:"20px",left:"20px",width:"110px",height:"60px",border:"2px dashed ".concat(r),borderRadius:"4px",opacity:.6}}),j("div",{className:"animated-rect",style:{position:"absolute",top:"20px",left:"20px",border:"2px solid ".concat(r),backgroundColor:"".concat(r.replace("0.8","0.15")),borderRadius:"4px"}}),j("div",{className:"cursor-demo",style:{position:"absolute",width:"20px",height:"20px"}},j("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},j("path",{d:"M3.5 2.5L16.5 10L10 11.5L7.5 16.5L3.5 2.5Z",fill:"rgba(0,0,0,0.3)",transform:"translate(1,1)"}),j("path",{d:"M3 2L16 10L10 11.5L7.5 16L3 2Z",fill:"white",stroke:"black",strokeWidth:"1"}),j("path",{d:"M4 3.5L13.5 9.5L9.5 10.5L7.5 14L4 3.5Z",fill:"rgba(255,255,255,0.8)"})))),j("style",{jsx:!0},"\n .hint-overlay {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n }\n\n .hint-show {\n animation-name: hintFadeIn;\n }\n\n .hint-hide {\n animation-name: hintFadeOut;\n }\n\n @keyframes hintFadeIn {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes hintFadeOut {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-10px);\n }\n }\n\n .animated-rect {\n animation: rectGrow 2s ease-in-out infinite;\n }\n\n @keyframes rectGrow {\n 0% {\n width: 0;\n height: 0;\n }\n 50% {\n width: 110px;\n height: 60px;\n }\n 100% {\n width: 110px;\n height: 60px;\n opacity: 0.7;\n }\n }\n\n .cursor-demo {\n animation: cursorMove 2s ease-in-out infinite;\n }\n\n @keyframes cursorMove {\n 0% {\n top: 20px;\n left: 20px;\n }\n 50% {\n top: 50px;\n left: 80px;\n }\n 100% {\n top: 80px;\n left: 130px;\n }\n }\n\n .hint-text {\n animation: textPulse 0.6s ease-in-out;\n }\n\n @keyframes textPulse {\n 0% {\n transform: scale(0.9);\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n }\n }\n "))},zv=function(e){var t=e.placeholder,n=e.onSubmit,o=e.inputRef,i=e.isFocused,r=f(ke(""),2),a=r[0],s=r[1];return j("form",{className:"border-border-subtle mt-4 flex items-end space-x-2 border-t pt-4",onClick:function(e){return e.stopPropagation()},onSubmit:function(e){null==e||e.preventDefault(),a.trim()&&(n(a),s(""))}},j("input",{ref:o,type:"text",placeholder:t,value:a,onInput:function(e){return s(e.currentTarget.value)},className:"bg-bg-input text-fg-primary placeholder-fg-muted w-full rounded-lg border px-3 py-1 text-base transition-colors focus:border-transparent focus:outline-none focus:ring-2 ".concat(i?"border-accent focus:ring-accent":"border-border-default focus:ring-accent")}),j("button",{type:"submit",disabled:!a.trim(),className:"bg-accent text-fg-on-accent hover:bg-accent-hover disabled:bg-interactive-disabled rounded-lg p-2 transition-colors disabled:cursor-not-allowed"},j("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},j("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"}))))},Ev=["bg-red-500","bg-blue-500","bg-green-500","bg-yellow-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-teal-500"],_v=function(e){if(!e)return Ev[0];var t=e.length>0?e.charCodeAt(0)%Ev.length:0;return Ev[t]},Rv=function(e){var t=e.name,n=e.className,o=void 0===n?"":n;return j("div",{className:"flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium text-white ".concat(_v(t)," ").concat(o)},function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"G"}(t))},Nv=function(e){var t,n,o=e.onEdit,i=e.onDelete,r=e.onClose,a=e.documentId,s=Ae(null),l=ma(a).translate;Me(function(){var e=function(e){t.current&&!t.current.contains(e.target)&&n()};return document.addEventListener("click",e),function(){document.removeEventListener("click",e)}},[t=s,n=r]);return j("div",{ref:s,className:"bg-bg-elevated ring-border-default absolute right-0 top-6 z-10 w-32 rounded-md shadow-lg ring-1"},j("div",{className:"py-1"},j("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),o(),r()},className:"text-fg-secondary hover:bg-interactive-hover block w-full px-4 py-2 text-left text-sm"},l("comments.edit")),j("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),i(),r()},className:"text-state-error hover:bg-interactive-hover block w-full px-4 py-2 text-left text-sm"},l("comments.delete"))))},Ov=function(e){var t=e.initialText,n=e.onSave,o=e.onCancel,i=e.autoFocus,r=void 0!==i&&i,a=e.documentId,s=f(ke(t),2),l=s[0],c=s[1],d=Ae(null),u=ma(a).translate;Me(function(){r&&d.current&&(d.current.focus(),d.current.setSelectionRange(l.length,l.length))},[r,l.length]);return j("div",{className:"flex-1 space-y-2"},j("textarea",{ref:d,value:l,onInput:function(e){return c(e.currentTarget.value)},className:"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent w-full rounded-md border px-3 py-2 text-base focus:outline-none focus:ring-1",rows:3}),j("div",{className:"flex flex-wrap gap-2"},j("button",{onClick:function(e){e.stopPropagation(),n(l)},className:"bg-accent text-fg-on-accent hover:bg-accent-hover whitespace-nowrap rounded-md px-3 py-1 text-sm"},u("comments.save")),j("button",{onClick:function(e){e.stopPropagation(),o()},className:"bg-interactive-hover text-fg-secondary hover:bg-border-default whitespace-nowrap rounded-md px-3 py-1 text-sm"},u("comments.cancel"))))},Lv=function(e){if(!e)return"(no date)";try{return(e instanceof Date?e:new Date(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch(t){return"string"==typeof e?e:"(no date)"}},$v=function(e){var t=e.annotation,n=e.onSave,o=e.onDelete,i=e.isReply,r=void 0!==i&&i,a=e.documentId,s=f(ke(!1),2),l=s[0],c=s[1],d=f(ke(!1),2),u=d[0],h=d[1],m=t.author||"Guest";return u?j("div",{className:"flex w-full items-start space-x-3",onClick:function(e){return e.stopPropagation()}},r&&j(Rv,{name:m,className:"h-8 w-8"}),j(Ov,{initialText:t.contents||"",onSave:function(e){n(e),h(!1)},onCancel:function(){h(!1)},autoFocus:!0,documentId:a})):j("div",{className:"flex items-start space-x-3"},r&&j(Rv,{name:m,className:"h-8 w-8"}),j("div",{className:"min-w-0 flex-1"},r&&j("div",{className:"flex items-center justify-between"},j("div",{className:"leading-none"},j("h5",{className:"text-fg-primary text-sm font-medium"},m),j("span",{className:"text-fg-muted text-xs"},Lv(t.modified||t.created))),j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),c(!0)},className:"text-fg-muted hover:bg-interactive-hover rounded-md p-1"},j("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},j("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"}))),l&&j(Nv,{onEdit:function(){return h(!0)},onDelete:o,onClose:function(){return c(!1)},documentId:a}))),j("p",{className:"text-fg-primary mt-2 text-sm"},t.contents)))},Fv=(s(s(s(s(s(s(s(s(s(s(Av={},Dt.HIGHLIGHT,{label:"Highlight",icon:"highlight",iconProps:function(e){return{primaryColor:e.color||"#ffff00"}}}),Dt.CIRCLE,{label:"Circle",icon:"circle",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Dt.SQUARE,{label:"Square",icon:"square",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Dt.LINE,{label:"Line",icon:"line",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Dt.UNDERLINE,{label:"Underline",icon:"underline",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Dt.SQUIGGLY,{label:"Squiggly",icon:"squiggly",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Dt.STRIKEOUT,{label:"Strikethrough",icon:"strikethrough",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Dt.INK,{label:"Ink",icon:"pencilMarker",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Dt.FREETEXT,{label:"Text",icon:"text",iconProps:function(e){return{primaryColor:e.fontColor||"#000000"}}}),Dt.POLYGON,{label:"Polygon",icon:"polygon",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),s(s(Av,Dt.POLYLINE,{label:"Polyline",icon:"zigzag",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Dt.STAMP,{label:"Stamp",icon:"deviceFloppy",iconProps:function(){return{primaryColor:"#dc2626"}}})),jv=function(e){var t=e.text,n=e.maxWords,o=void 0===n?16:n,i=e.className,r=void 0===i?"":i,a=e.documentId,s=f(ke(!1),2),l=s[0],c=s[1],d=ma(a).translate,u=t.split(" ");return u.length>o?j("div",{className:r},l?t:u.slice(0,o).join(" ")+"..."," ",j("button",{onClick:function(e){e.stopPropagation(),c(!l)},className:"text-accent hover:text-accent-hover text-sm font-medium focus:outline-none"},d(l?"comments.showLess":"comments.showMore"))):j("div",{className:r},t)},Hv=function(e){var t=e.annotation,n=e.config,o=e.className,i=void 0===o?"":o,r=n.iconProps(t.object);return j("div",{className:"bg-bg-surface-alt flex items-center justify-center rounded-full ".concat(i),title:n.label},j(Ym,h({icon:n.icon},r)))},Uv=function(e){var t,n=e.entry,o=e.isSelected,i=e.onSelect,r=e.onUpdate,a=e.onDelete,s=e.onReply,l=e.documentId,c=n.annotation,d=n.replies,u=f(ke(!1),2),h=u[0],m=u[1],g=f(ke(!1),2),p=g[0],v=g[1],y=ma(l).translate,b=function(e){return uc(e)?Fv[e.object.type]:null}(c),w=!!c.object.contents,x=d.length>0,C=!w&&!x,I=Ae(null),S=c.object.author||"Guest";if(Me(function(){var e;o&&(null===(e=I.current)||void 0===e||e.focus({preventScroll:!0}))},[o,n]),!b)return null;return j("div",{onClick:i,className:"bg-bg-surface cursor-pointer rounded-lg border shadow-sm transition-all hover:shadow-md ".concat(o?"border-accent ring-interactive-focus-ring ring-2":"border-border-subtle")},j("div",{className:"p-4"},j("div",{className:"flex items-start space-x-3"},j(Hv,{annotation:c,config:b,className:"h-8 w-8"}),j("div",{className:"min-w-0 flex-1"},j("div",{className:"flex items-center justify-between"},j("div",{className:"leading-none"},j("h4",{className:"text-fg-primary text-sm font-medium"},S),j("span",{className:"text-fg-disabled text-xs"},Lv(c.object.modified||c.object.created))),j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),m(!0)},className:"text-fg-disabled hover:bg-interactive-hover hover:text-fg-secondary rounded-md p-1"},j("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},j("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"}))),h&&j(Nv,{onEdit:function(){return v(!0)},onDelete:function(){return a(c)},onClose:function(){return m(!1)},documentId:l}))),(null===(t=c.object.custom)||void 0===t?void 0:t.text)&&j(jv,{text:c.object.custom.text,maxWords:14,className:"text-fg-muted mt-2 text-sm",documentId:l}),j("div",{className:"mt-2"},p?j(Ov,{initialText:c.object.contents||"",onSave:function(e){r(c.object.id,e),v(!1)},onCancel:function(){v(!1)},autoFocus:!0,documentId:l}):w?j("p",{className:"text-fg-primary text-sm"},c.object.contents):null))),x&&j("div",{className:"border-border-subtle mt-4 space-y-4 border-t pt-4"},d.map(function(e){return j($v,{key:e.object.id,annotation:e.object,onSave:function(t){return r(e.object.id,t)},onDelete:function(){return a(e)},isReply:!0,documentId:l})})),!p&&j(zv,{inputRef:I,isFocused:o,placeholder:y(C?"comments.addComment":"comments.addReply"),onSubmit:function(e){C?r(c.object.id,e):s(c.object.id,e)}})))},Wv=function(e){var t=e.documentId,n=ma(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(Ym,{icon:"comment",className:"h-18 w-18 text-fg-muted"}),j("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("comments.emptyState")))},Bv=function(e){var t=e.documentId,n=Md().provides,o=Pd(t).state,i=ni().provides,r=ma(t).translate,s=Ae({}),l=Ae(null),c=o.selectedUid?mc(o,o.selectedUid):null,d=(e=>{const t={};for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&dc(n)){const e=n.object.inReplyToId;e&&(t[e]||(t[e]=[])).push(n)}}const n={};for(const[o,i]of Object.entries(e.pages)){const r=Number(o),a=[];for(const n of i){const o=e.byUid[n];o&&uc(o)&&a.push({page:r,annotation:o,replies:t[o.object.id]??[]})}a.length>0&&(n[r]=a)}return n})(o);Me(function(){if(c&&l.current){var e=s.current[c.object.id];if(e&&l.current){var t=l.current,n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.top-n.top+t.scrollTop-t.clientHeight/2+o.height/2;t.scrollTo({top:i,behavior:"smooth"})}}},[c]);var u=function(e,t){var o=p(e);o&&(null==n||n.updateAnnotation(o.object.pageIndex,e,{contents:t,modified:new Date}))},h=function(e){null==n||n.deleteAnnotation(e.object.pageIndex,e.object.id)},m=function(e,t){var o=p(e);o&&(null==n||n.createAnnotation(o.object.pageIndex,{id:yn(),rect:{origin:{x:o.object.rect.origin.x,y:o.object.rect.origin.y},size:{width:24,height:24}},pageIndex:o.object.pageIndex,created:new Date,modified:new Date,type:Dt.TEXT,contents:t,inReplyToId:o.object.id,flags:["noRotate","noZoom","print"],icon:Pt.Comment}))},g=Object.keys(d).map(Number).sort(function(e,t){return e-t}),p=function(e){var t,n=a(g);try{for(n.s();!(t=n.n()).done;){var o,i=t.value,r=a(d[i]);try{for(r.s();!(o=r.n()).done;){var s=o.value;if(s.annotation.object.id===e)return s.annotation;var l=s.replies.find(function(t){return t.object.id===e});if(l)return l}}catch(e){r.e(e)}finally{r.f()}}}catch(e){n.e(e)}finally{n.f()}};return 0===g.length?j(Wv,{documentId:t}):j("div",{ref:l,className:"h-full overflow-y-auto"},j("div",{className:"space-y-6 p-3"},g.map(function(e){return j("div",{key:e,className:"space-y-3"},j("div",{className:"bg-bg-surface sticky top-0 z-10 px-1"},j("div",{className:"border-border-subtle border-b py-2"},j("h3",{className:"text-md text-fg-primary font-semibold"},r("comments.page",{params:{page:e+1}})),j("p",{className:"text-fg-muted text-sm"},1===d[e].length?r("comments.commentCount",{params:{count:1}}):r("comments.commentCountPlural",{params:{count:d[e].length}})))),j("div",{className:"space-y-3 px-1"},d[e].map(function(e){return j("div",{key:e.annotation.object.id,ref:function(t){t&&(s.current[e.annotation.object.id]=t)}},j(Uv,{entry:e,isSelected:(null==c?void 0:c.object.id)===e.annotation.object.id,onSelect:function(){return t=e.annotation,null==n||n.selectAnnotation(t.object.pageIndex,t.object.id),void(null==i||i.scrollToPage({pageNumber:t.object.pageIndex+1,pageCoordinates:{x:t.object.rect.origin.x,y:t.object.rect.origin.y},alignX:50,alignY:25,behavior:"smooth"}));var t},onUpdate:u,onDelete:h,onReply:m,documentId:t}))})))})))};function qv(e){var t=e.documentId,n=(e=>{const{provides:t}=Ma(),[n,o]=ke(Ca);return Me(()=>{if(!t)return;const n=t.forDocument(e);return o(n.getState()),n.onStateChange(e=>{o(e)})},[t,e]),{state:n,provides:(null==t?void 0:t.forDocument(e))??null}})(t),o=n.state,i=n.provides,r=f(ke(""),2),a=r[0],s=r[1];if(!i)return null;var l=Math.round(100*o.currentZoomLevel);Me(function(){s(l.toString())},[l]);return j("div",{className:"relative"},j("div",{className:"bg-interactive-hover flex items-center rounded"},j("form",{onSubmit:function(e){e.preventDefault();var t=e.target,n=new FormData(t),o=parseFloat(n.get("zoom")||a);!isNaN(o)&&o>0&&i.requestZoom(o/100)},className:"block"},j("input",{name:"zoom",type:"text",inputMode:"numeric",pattern:"\\d*",className:"h-6 w-8 border-0 bg-transparent p-0 text-right text-sm outline-none focus:outline-none","aria-label":"Set zoom",autoFocus:!1,value:a,onInput:function(e){var t=e.target.value.replace(/[^0-9]/g,"");s(t)},onBlur:function(){(!a||parseFloat(a)<=0)&&s(l.toString())}}),j("span",{className:"text-sm"},"%")),j(kp,{commandId:"zoom:toggle-menu",documentId:t,itemId:"zoom-menu-button"}),j(kp,{commandId:"zoom:out",documentId:t}),j(kp,{commandId:"zoom:in",documentId:t})))}var Gv,Vv=["position"],Zv=function(){var e=f(ke(!1),2),t=e[0],n=e[1],o=Ae(null),i=Ae(null);return Me(function(){if(t){var e=function(e){o.current&&!o.current.contains(e.target)&&n(!1)};return document.addEventListener("click",e),function(){return document.removeEventListener("click",e)}}},[t]),Me(function(){t&&i.current&&i.current.scrollIntoView({block:"center",inline:"start"})},[t]),{open:t,setOpen:n,rootRef:o,selectedItemRef:i}},Kv=function(e){var t=e.value,n=e.onChange,o=e.options,i=e.getOptionKey,r=e.renderValue,a=e.renderOption,s=e.triggerClass,l=void 0===s?"px-3 py-2":s,c=Zv(),d=c.open,u=c.setOpen,h=c.rootRef,m=c.selectedItemRef;return j("div",{ref:h,class:"relative inline-block w-full"},j("button",{type:"button",class:"border-border-default bg-bg-input flex w-full items-center justify-between gap-2 rounded border ".concat(l),onClick:function(){return u(function(e){return!e})}},r(t),j("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},j("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z",clipRule:"evenodd"}))),d&&j("div",{class:"border-border-default bg-bg-elevated absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded border p-1 shadow-lg"},o.map(function(e){var o=i(e)===i(t);return j("button",{ref:o?m:null,key:i(e),class:"hover:bg-interactive-hover block w-full rounded text-left ".concat(o?"bg-interactive-hover":""),onClick:function(){n(e),u(!1)}},a(e,o))})))},Yv=function(e){var t=e.children,n=e.className;return j("label",{class:"text-fg-primary mb-2 block text-sm font-medium ".concat(void 0===n?"":n)},t)},Xv=function(e){var t=e.children,n=e.className;return j("span",{class:"text-fg-muted text-xs ".concat(void 0===n?"":n)},t)},Qv=function(e){var t=e.children,n=e.className;return j("section",{class:"mb-6 ".concat(void 0===n?"":n)},t)},Jv=function(e){var t=e.value,n=e.min,o=void 0===n?0:n,i=e.max,r=void 0===i?1:i,a=e.step,s=void 0===a?.1:a,l=e.onChange;return j("input",{type:"range",class:"range-sm bg-border-subtle mb-2 h-1 w-full cursor-pointer appearance-none rounded-lg",value:t,min:o,max:r,step:s,onInput:function(e){return l(parseFloat(e.target.value))}})},ef=function(e){var t=e.color,n=e.active,o=e.onSelect,i=function(e){return"transparent"===e||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*0\s*\)$/i.test(e)||/^#([0-9a-f]{8})$/i.test(e)&&"00"===e.slice(-2).toLowerCase()||/^#([0-9a-f]{4})$/i.test(e)&&"0"===e.slice(-1).toLowerCase()}(t)?{backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, transparent 40%, red 40%, red 60%, transparent 60%)",backgroundSize:"100% 100%"}:{backgroundColor:t};return j("button",{title:t,class:"border-border-strong h-5 w-5 rounded-full border ".concat(n?"outline-accent outline outline-2 outline-offset-2":""),style:i,onClick:function(){return o(t)}})},tf=[{id:Et.SOLID},{id:Et.DASHED,dash:[6,2]},{id:Et.DASHED,dash:[8,4]},{id:Et.DASHED,dash:[3,3]},{id:Et.DASHED,dash:[1,2]},{id:Et.DASHED,dash:[4,2,1,2]},{id:Et.DASHED,dash:[8,4,1,4]}],nf=function(e){return j("svg",{width:"80",height:"8",viewBox:"0 0 80 8"},j("line",{x1:"0",y1:"4",x2:"80",y2:"4",style:{strokeDasharray:null==e?void 0:e.join(" "),stroke:"currentColor",strokeWidth:"2"}}))},of=function(e){return j(Kv,h(h({},e),{},{options:tf,getOptionKey:function(e){var t;return e.id+((null===(t=e.dash)||void 0===t?void 0:t.join("-"))||"")},renderValue:function(e){return nf(e.dash)},renderOption:function(e){return j("div",{class:"px-1 py-2"},nf(e.dash))}}))},rf=[At.None,At.Square,At.Circle,At.Diamond,At.OpenArrow,At.ClosedArrow,At.ROpenArrow,At.RClosedArrow,At.Butt,At.Slash],af=function(e){var t,n=e.ending,o=e.position,i=s(s(s(s(s(s(s(s(s({},At.Square,j("path",{d:"M68 -4 L76 -4 L76 4 L68 4 Z"})),At.Circle,j("circle",{cx:"72",cy:"0",r:"4"})),At.Diamond,j("path",{d:"M72 -5 L77 0 L72 5 L67 0 Z"})),At.OpenArrow,j("path",{d:"M67 -5 L77 0 L67 5",fill:"none"})),At.ClosedArrow,j("path",{d:"M67 -5 L77 0 L67 5 Z"})),At.ROpenArrow,j("path",{d:"M77 -5 L67 0 L77 5",fill:"none"})),At.RClosedArrow,j("path",{d:"M77 -5 L67 0 L77 5 Z"})),At.Butt,j("path",{d:"M72 -5 L72 5",fill:"none"})),At.Slash,j("path",{d:"M67 -5 L77 5",fill:"none"})),r=s(s(s(s(s(s(s(s(s({},At.Square,68),At.Circle,68),At.Diamond,67),At.OpenArrow,76),At.ClosedArrow,67),At.ROpenArrow,67),At.RClosedArrow,67),At.Butt,72),At.Slash,72),a=i[n];return j("svg",{width:"80",height:"20",viewBox:"0 0 80 20",class:"text-fg-primary"},j("g",{transform:"start"===o?"rotate(180 40 10)":""},j("line",{x1:"4",y1:"10",x2:null!==(t=r[n])&&void 0!==t?t:77,y2:"10",stroke:"currentColor","stroke-width":"1.5"}),a&&j("g",{transform:"translate(0, 10)",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5"},a)))},sf=function(e){var t=e.position,n=m(e,Vv);return j(Kv,h(h({},n),{},{options:rf,getOptionKey:function(e){return e},triggerClass:"px-3 py-1",renderValue:function(e){return j(af,{ending:e,position:t})},renderOption:function(e){return j("div",{class:"px-1 py-1"},j(af,{ending:e,position:t}))}}))},lf=function(e){return j(Kv,h(h({},e),{},{options:cn,getOptionKey:function(e){return e},triggerClass:"px-2 py-1 text-sm",renderValue:function(e){return j("span",null,dn(e))},renderOption:function(e){return j("div",{class:"px-2 py-1"},dn(e))}}))},cf=function(e){var t=e.value,n=e.onChange,o=e.options,i=void 0===o?[8,9,10,11,12,14,16,18,24,36,48,72]:o,r=Zv(),a=r.open,s=r.setOpen,l=r.rootRef,c=r.selectedItemRef;return j("div",{ref:l,class:"relative w-full"},j("input",{type:"number",min:"1",class:"border-border-default bg-bg-input w-full rounded border px-2 py-1 pr-7 text-sm",value:t,onInput:function(e){var t=parseInt(e.target.value,10);Number.isFinite(t)&&t>0&&n(t)},onClick:function(){return s(!0)}}),j("button",{type:"button",class:"absolute inset-y-0 right-1 flex items-center",onClick:function(){return s(function(e){return!e})},tabIndex:-1},j("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},j("path",{"fill-rule":"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z","clip-rule":"evenodd"}))),a&&j("div",{class:"border-border-default bg-bg-elevated absolute z-10 mt-1 max-h-48 w-full overflow-y-auto rounded border shadow-lg"},i.map(function(e){var o=e===t;return j("button",{ref:o?c:null,key:e,class:"hover:bg-interactive-hover block w-full px-2 py-1 text-left text-sm ".concat(o?"bg-interactive-hover":""),onClick:function(){n(e),s(!1)}},e)})))},df=(s(s(s(s(s(s(s(s(s(s(Gv={},It.Normal,"blendMode.normal"),It.Multiply,"blendMode.multiply"),It.Screen,"blendMode.screen"),It.Overlay,"blendMode.overlay"),It.Darken,"blendMode.darken"),It.Lighten,"blendMode.lighten"),It.ColorDodge,"blendMode.colorDodge"),It.ColorBurn,"blendMode.colorBurn"),It.HardLight,"blendMode.hardLight"),It.SoftLight,"blendMode.softLight"),s(s(s(s(s(s(Gv,It.Difference,"blendMode.difference"),It.Exclusion,"blendMode.exclusion"),It.Hue,"blendMode.hue"),It.Saturation,"blendMode.saturation"),It.Color,"blendMode.color"),It.Luminosity,"blendMode.luminosity")),uf=function(e){var t,n,o,i,r=e.documentId,a=e.selected,s=e.activeTool,l=e.colorPresets,c=Md().provides,d=ma(r).translate;if(!c)return null;var u=null==a?void 0:a.object,h=null==s?void 0:s.defaults,m=!!u,g=m?u.color:null!==(t=null==h?void 0:h.color)&&void 0!==t?t:"#FFFF00",p=m?u.opacity:null!==(n=null==h?void 0:h.opacity)&&void 0!==n?n:1,v=m?null!==(o=u.blendMode)&&void 0!==o?o:It.Normal:null!==(i=null==h?void 0:h.blendMode)&&void 0!==i?i:It.Normal,y=f(ke(g),2),b=y[0],w=y[1],x=f(ke(p),2),C=x[0],I=x[1],S=f(ke(v),2),k=S[0],D=S[1];Me(function(){return w(g)},[g]),Me(function(){return I(p)},[p]),Me(function(){return D(v)},[v]);var M=Cv(C,300);Me(function(){return A({opacity:M})},[M]);var P=function(e){w(e),A({color:e})};function A(e){c&&(m?c.updateAnnotation(u.pageIndex,u.id,e):s&&c.setToolDefaults(s.id,e))}return j(U,null,j(Qv,null,j(Yv,{className:"mb-3"},d("annotation.color")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},l.map(function(e){return j(ef,{key:e,color:e,active:e===b,onSelect:P})}))),j(Qv,null,j(Yv,null,d("annotation.opacity")),j(Jv,{value:C,min:.1,max:1,step:.05,onChange:I}),j(Xv,null,Math.round(100*C),"%")),j(Qv,null,j(Yv,null,d("annotation.blendMode")),j("select",{class:"border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1 text-sm",value:k,onChange:function(e){return t=parseInt(e.target.value,10),D(n=t),void A({blendMode:n});var t,n}},gn.map(function(e){return j("option",{key:e,value:e},d(df[e]))}))))},hf=function(e){var t,n,o,i,r,a=e.documentId,s=e.selected,l=e.activeTool,c=e.colorPresets,d=Md().provides,u=ma(a).translate;if(!d)return null;var h=null==s?void 0:s.object,m=null==l?void 0:l.defaults,g=!!h,p=g?h.color:null!==(t=null==m?void 0:m.color)&&void 0!==t?t:"#000000",v=g?h.strokeColor:null!==(n=null==m?void 0:m.strokeColor)&&void 0!==n?n:"#000000",y=g?h.opacity:null!==(o=null==m?void 0:m.opacity)&&void 0!==o?o:1,b=g?h.strokeWidth:null!==(i=null==m?void 0:m.strokeWidth)&&void 0!==i?i:2,w=g?{id:h.strokeStyle,dash:h.strokeDashArray}:{id:null!==(r=null==m?void 0:m.strokeStyle)&&void 0!==r?r:Et.SOLID,dash:null==m?void 0:m.strokeDashArray},x=f(ke(p),2),C=x[0],I=x[1],S=f(ke(v),2),k=S[0],D=S[1],M=f(ke(y),2),P=M[0],A=M[1],T=f(ke(b),2),z=T[0],E=T[1],_=f(ke(w),2),R=_[0],N=_[1];Me(function(){return I(p)},[p]),Me(function(){return D(v)},[v]),Me(function(){return A(y)},[y]),Me(function(){return E(b)},[b]),Me(function(){return N(w)},[w]);var O=Cv(P,300),L=Cv(z,300);Me(function(){return H({opacity:O})},[O]),Me(function(){return H({strokeWidth:L})},[L]);var $=function(e){I(e),H({color:e})},F=function(e){D(e),H({strokeColor:e})};function H(e){d&&(g?d.updateAnnotation(h.pageIndex,h.id,e):l&&d.setToolDefaults(l.id,e))}return j(U,null,j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.fillColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return j(ef,{key:e,color:e,active:e===C,onSelect:$})}),j(ef,{color:"transparent",active:"transparent"===C,onSelect:$}))),j(Qv,null,j(Yv,null,u("annotation.opacity")),j(Jv,{value:P,min:.1,max:1,step:.05,onChange:A}),j(Xv,null,Math.round(100*P),"%")),j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.strokeColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return j(ef,{key:e,color:e,active:e===k,onSelect:F})}))),j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.borderStyle")),j(of,{value:R,onChange:function(e){N(e),H({strokeStyle:e.id,strokeDashArray:e.dash})}})),j(Qv,null,j(Yv,null,u("annotation.strokeWidth")),j(Jv,{value:z,min:1,max:30,step:1,onChange:E}),j(Xv,null,z,"px")))},mf=function(e){var t,n,o,i,r,a,s,l=e.documentId,c=e.selected,d=e.activeTool,u=e.colorPresets,h=Md().provides,m=ma(l).translate;if(!h)return null;var g=null==c?void 0:c.object,p=null==d?void 0:d.defaults,v=!!g,y=v?g.color:null!==(t=null==p?void 0:p.color)&&void 0!==t?t:"#000000",b=v?g.strokeColor:null!==(n=null==p?void 0:p.strokeColor)&&void 0!==n?n:"#000000",w=v?g.opacity:null!==(o=null==p?void 0:p.opacity)&&void 0!==o?o:1,x=v?g.strokeWidth:null!==(i=null==p?void 0:p.strokeWidth)&&void 0!==i?i:2,C=v?null!==(r=g.lineEndings)&&void 0!==r?r:{start:At.None,end:At.None}:null!==(a=null==p?void 0:p.lineEndings)&&void 0!==a?a:{start:At.None,end:At.None},I=v?{id:g.strokeStyle,dash:g.strokeDashArray}:{id:null!==(s=null==p?void 0:p.strokeStyle)&&void 0!==s?s:Et.SOLID,dash:null==p?void 0:p.strokeDashArray},S=f(ke(y),2),k=S[0],D=S[1],M=f(ke(b),2),P=M[0],A=M[1],T=f(ke(w),2),z=T[0],E=T[1],_=f(ke(x),2),R=_[0],N=_[1],O=f(ke(I),2),L=O[0],$=O[1],F=f(ke(C.start),2),H=F[0],W=F[1],B=f(ke(C.end),2),q=B[0],G=B[1];Me(function(){return D(y)},[y]),Me(function(){return A(b)},[b]),Me(function(){return E(w)},[w]),Me(function(){return N(x)},[x]),Me(function(){return $(I)},[I]),Me(function(){return W(C.start)},[C.start]),Me(function(){return G(C.end)},[C.end]);var V=Cv(z,300),Z=Cv(R,300);Me(function(){return X({opacity:V})},[V]),Me(function(){return X({strokeWidth:Z})},[Z]);var K=function(e){D(e),X({color:e})},Y=function(e){A(e),X({strokeColor:e})};function X(e){h&&(v?h.updateAnnotation(g.pageIndex,g.id,e):d&&h.setToolDefaults(d.id,e))}return j(U,null,j(Qv,null,j(Yv,{className:"mb-3"},m("annotation.strokeColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return j(ef,{key:e,color:e,active:e===P,onSelect:Y})}),j(ef,{color:"transparent",active:"transparent"===P,onSelect:Y}))),j(Qv,null,j(Yv,null,m("annotation.opacity")),j(Jv,{value:z,min:.1,max:1,step:.05,onChange:E}),j(Xv,null,Math.round(100*z),"%")),j(Qv,null,j(Yv,{className:"mb-3"},m("annotation.borderStyle")),j(of,{value:L,onChange:function(e){$(e),X({strokeStyle:e.id,strokeDashArray:e.dash})}})),j(Qv,null,j(Yv,null,m("annotation.strokeWidth")),j(Jv,{value:R,min:1,max:10,step:1,onChange:N}),j(Xv,null,R)),j(Qv,null,j("div",{class:"grid grid-cols-2 gap-4"},j("div",null,j(Yv,{className:"mb-3"},m("annotation.lineStart")),j(sf,{value:H,onChange:function(e){W(e),X({lineEndings:{start:e,end:q}})},position:"start"})),j("div",null,j(Yv,{className:"mb-3"},m("annotation.lineEnd")),j(sf,{value:q,onChange:function(e){G(e),X({lineEndings:{start:H,end:e}})},position:"end"})))),j(Qv,null,j(Yv,{className:"mb-3"},m("annotation.fillColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return j(ef,{key:e,color:e,active:e===k,onSelect:K})}),j(ef,{color:"transparent",active:"transparent"===k,onSelect:K}))))};function gf(e){var t=e.active,n=void 0!==t&&t,o=e.disabled,i=void 0!==o&&o,r=e.onClick,a=e.title,s=e.children,l=e.className,c=void 0===l?"":l;return j("button",{type:"button",title:a,disabled:i,onClick:r,className:"h-9 w-9 rounded border px-2 py-1 text-sm transition-colors ".concat(n?"border-accent bg-accent text-fg-on-accent":"border-border-default bg-bg-input text-fg-primary hover:bg-interactive-hover"," disabled:cursor-not-allowed disabled:opacity-40 ").concat(c)},s)}var pf,vf=(s(s(s(s(s(s(s(s(s(s(pf={},Dt.INK,{component:function(e){var t,n,o,i,r,a,s=e.documentId,l=e.selected,c=e.activeTool,d=e.colorPresets,u=Md().provides,h=ma(s).translate;if(!u)return null;var m=null==l?void 0:l.object,g=null==c?void 0:c.defaults,p=null!==(t=null!==(n=null==m?void 0:m.color)&&void 0!==n?n:null==g?void 0:g.color)&&void 0!==t?t:"#000000",v=null!==(o=null!==(i=null==m?void 0:m.opacity)&&void 0!==i?i:null==g?void 0:g.opacity)&&void 0!==o?o:1,y=null!==(r=null!==(a=null==m?void 0:m.strokeWidth)&&void 0!==a?a:null==g?void 0:g.strokeWidth)&&void 0!==r?r:2,b=f(ke(p),2),w=b[0],x=b[1],C=f(ke(v),2),I=C[0],S=C[1],k=f(ke(y),2),D=k[0],M=k[1];Me(function(){return x(p)},[p]),Me(function(){return S(v)},[v]),Me(function(){return M(y)},[y]);var P=Cv(I,300),A=Cv(D,300);Me(function(){return z({opacity:P})},[P]),Me(function(){return z({strokeWidth:A})},[A]);var T=function(e){x(e),z({color:e})};function z(e){u&&(m?u.updateAnnotation(m.pageIndex,m.id,e):c&&u.setToolDefaults(c.id,e))}return j(U,null,j(Qv,null,j(Yv,{className:"mb-3"},h("annotation.color")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},d.map(function(e){return j(ef,{key:e,color:e,active:e===w,onSelect:T})}))),j(Qv,null,j(Yv,null,h("annotation.opacity")),j(Jv,{value:I,min:.1,max:1,step:.05,onChange:S}),j(Xv,null,Math.round(100*I),"%")),j(Qv,null,j(Yv,null,h("annotation.strokeWidth")),j(Jv,{value:D,min:1,max:30,step:1,onChange:M}),j(Xv,null,D,"px")))},titleKey:"annotation.ink"}),Dt.POLYGON,{component:function(e){var t,n,o,i,r,a=e.documentId,s=e.selected,l=e.activeTool,c=e.colorPresets,d=Md().provides,u=ma(a).translate;if(!d)return null;var h=null==s?void 0:s.object,m=null==l?void 0:l.defaults,g=!!h,p=g?h.color:null!==(t=null==m?void 0:m.color)&&void 0!==t?t:"#000000",v=g?h.strokeColor:null!==(n=null==m?void 0:m.strokeColor)&&void 0!==n?n:"#000000",y=g?h.opacity:null!==(o=null==m?void 0:m.opacity)&&void 0!==o?o:1,b=g?h.strokeWidth:null!==(i=null==m?void 0:m.strokeWidth)&&void 0!==i?i:2,w=g?{id:h.strokeStyle,dash:h.strokeDashArray}:{id:null!==(r=null==m?void 0:m.strokeStyle)&&void 0!==r?r:Et.SOLID,dash:null==m?void 0:m.strokeDashArray},x=f(ke(p),2),C=x[0],I=x[1],S=f(ke(v),2),k=S[0],D=S[1],M=f(ke(y),2),P=M[0],A=M[1],T=f(ke(b),2),z=T[0],E=T[1],_=f(ke(w),2),R=_[0],N=_[1];Me(function(){return I(p)},[p]),Me(function(){return D(v)},[v]),Me(function(){return A(y)},[y]),Me(function(){return E(b)},[b]),Me(function(){return N(w)},[w]);var O=Cv(P,300),L=Cv(z,300);Me(function(){return H({opacity:O})},[O]),Me(function(){return H({strokeWidth:L})},[L]);var $=function(e){I(e),H({color:e})},F=function(e){D(e),H({strokeColor:e})};function H(e){d&&(g?d.updateAnnotation(h.pageIndex,h.id,e):l&&d.setToolDefaults(l.id,e))}return j(U,null,j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.strokeColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return j(ef,{key:e,color:e,active:e===k,onSelect:F})}),j(ef,{color:"transparent",active:"transparent"===k,onSelect:F}))),j(Qv,null,j(Yv,null,u("annotation.opacity")),j(Jv,{value:P,min:.1,max:1,step:.05,onChange:A}),j(Xv,null,Math.round(100*P),"%")),j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.borderStyle")),j(of,{value:R,onChange:function(e){N(e),H({strokeStyle:e.id,strokeDashArray:e.dash})}})),j(Qv,null,j(Yv,null,u("annotation.strokeWidth")),j(Jv,{value:z,min:1,max:10,step:1,onChange:E}),j(Xv,null,z)),j(Qv,null,j(Yv,{className:"mb-3"},u("annotation.fillColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return j(ef,{key:e,color:e,active:e===C,onSelect:$})}),j(ef,{color:"transparent",active:"transparent"===C,onSelect:$}))))},titleKey:"annotation.polygon"}),Dt.SQUARE,{component:hf,titleKey:"annotation.square"}),Dt.CIRCLE,{component:hf,titleKey:"annotation.circle"}),Dt.LINE,{component:mf,titleKey:function(e){var t;return"lineArrow"===(null===(t=e.activeTool)||void 0===t?void 0:t.id)?"annotation.arrow":"annotation.line"}}),Dt.POLYLINE,{component:mf,titleKey:"annotation.polyline"}),Dt.HIGHLIGHT,{component:uf,titleKey:"annotation.highlight"}),Dt.UNDERLINE,{component:uf,titleKey:"annotation.underline"}),Dt.STRIKEOUT,{component:uf,titleKey:"annotation.strikeout"}),Dt.SQUIGGLY,{component:uf,titleKey:"annotation.squiggly"}),s(s(pf,Dt.FREETEXT,{component:function(e){var t,n,o,i,r,a,s,l=e.documentId,c=e.selected,d=e.activeTool,u=e.colorPresets,h=Md().provides,m=ma(l).translate;if(!h)return null;var g=null==c?void 0:c.object,p=null==d?void 0:d.defaults,v=!!g,y=v?g.fontFamily:null!==(t=null==p?void 0:p.fontFamily)&&void 0!==t?t:wt.Helvetica,b=rn(y).family,w=an(y),x=sn(y),C=v?g.fontColor:null!==(n=null==p?void 0:p.fontColor)&&void 0!==n?n:"#000000",I=v?g.opacity:null!==(o=null==p?void 0:p.opacity)&&void 0!==o?o:1,S=v?g.backgroundColor:null!==(i=null==p?void 0:p.backgroundColor)&&void 0!==i?i:"#000000",k=v?g.fontSize:null!==(r=null==p?void 0:p.fontSize)&&void 0!==r?r:12,D=v?g.textAlign:null!==(a=null==p?void 0:p.textAlign)&&void 0!==a?a:xt.Left,M=v?g.verticalAlign:null!==(s=null==p?void 0:p.verticalAlign)&&void 0!==s?s:Ct.Top,P=f(ke(b),2),A=P[0],T=P[1],z=f(ke(k),2),E=z[0],_=z[1],R=f(ke(w),2),N=R[0],O=R[1],L=f(ke(x),2),$=L[0],F=L[1],H=f(ke(D),2),W=H[0],B=H[1],q=f(ke(M),2),G=q[0],V=q[1],Z=f(ke(C),2),K=Z[0],Y=Z[1],X=f(ke(I),2),Q=X[0],J=X[1],ee=f(ke(S),2),te=ee[0],ne=ee[1];function oe(e){h&&(v?h.updateAnnotation(g.pageIndex,g.id,e):d&&h.setToolDefaults(d.id,e))}Me(function(){T(b),O(w),F(x)},[b,w,x]),Me(function(){return Y(C)},[C]),Me(function(){return J(I)},[I]),Me(function(){return ne(S)},[S]),Me(function(){return _(k)},[k]),Me(function(){return B(D)},[D]),Me(function(){return V(M)},[M]);var ie=Cv(Q,300),re=Cv(te,300);Me(function(){return oe({opacity:ie})},[ie]),Me(function(){return oe({backgroundColor:re})},[re]);var ae=function(e){Y(e),oe({fontColor:e})},se=function(e){ne(e),oe({backgroundColor:e})},le=function(e,t,n){oe({fontFamily:ln(e,{bold:t,italic:n})})},ce=function(e){B(e),oe({textAlign:e})},de=function(e){V(e),oe({verticalAlign:e})};return j(U,null,j(Qv,null,j(Yv,null,m("annotation.font")),j("div",{class:"mb-3 flex gap-2"},j(lf,{value:A,onChange:function(e){var t=an(ln(e,{bold:!0,italic:!1})),n=sn(ln(e,{bold:!1,italic:!0})),o=!!t&&N,i=!!n&&$;T(e),O(o),F(i),le(e,o,i)}}),j("div",{class:"w-36"},j(cf,{value:E,onChange:function(e){!Number.isFinite(e)||e<=0||(_(e),oe({fontSize:e}))}}))),j("div",{class:"flex gap-2"},j(gf,{title:"Bold",active:N,disabled:!an(ln(A,{bold:!0,italic:!1})),onClick:function(){if(an(ln(A,{bold:!0,italic:!1}))){var e=!N;O(e),le(A,e,$)}},className:"font-bold"},j(Ym,{icon:"bold",size:18})),j(gf,{title:"Italic",active:$,disabled:!sn(ln(A,{bold:!1,italic:!0})),onClick:function(){if(sn(ln(A,{bold:!1,italic:!0}))){var e=!$;F(e),le(A,N,e)}},className:"italic"},j(Ym,{icon:"italic",size:18})))),j(Qv,null,j(Yv,null,m("annotation.textAlign")),j("div",{class:"flex gap-2"},j(gf,{title:"Align left",active:W===xt.Left,onClick:function(){return ce(xt.Left)}},j(Ym,{icon:"alignLeft",size:18})),j(gf,{title:"Align center",active:W===xt.Center,onClick:function(){return ce(xt.Center)}},j(Ym,{icon:"alignCenter",size:18})),j(gf,{title:"Align right",active:W===xt.Right,onClick:function(){return ce(xt.Right)}},j(Ym,{icon:"alignRight",size:18})))),j(Qv,null,j(Yv,null,m("annotation.verticalAlign")),j("div",{class:"flex gap-2"},j(gf,{title:"Align top",active:G===Ct.Top,onClick:function(){return de(Ct.Top)}},j(Ym,{icon:"alignTop",size:18})),j(gf,{title:"Align middle",active:G===Ct.Middle,onClick:function(){return de(Ct.Middle)}},j(Ym,{icon:"alignMiddle",size:18})),j(gf,{title:"Align bottom",active:G===Ct.Bottom,onClick:function(){return de(Ct.Bottom)}},j(Ym,{icon:"alignBottom",size:18})))),j(Qv,null,j(Yv,{className:"mb-3"},m("annotation.fontColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return j(ef,{key:e,color:e,active:e===K,onSelect:ae})}))),j(Qv,null,j(Yv,{className:"mb-3"},m("annotation.backgroundColor")),j("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return j(ef,{key:e,color:e,active:e===te,onSelect:se})}),j(ef,{color:"transparent",active:"transparent"===te,onSelect:se}))),j(Qv,null,j(Yv,null,m("annotation.opacity")),j(Jv,{value:Q,min:.1,max:1,step:.05,onChange:J}),j(Xv,null,Math.round(100*Q),"%")))},titleKey:"annotation.freeText"}),Dt.STAMP,{component:function(e){var t=e.documentId;return j("div",{className:"text-fg-muted text-sm"},(0,ma(t).translate)("annotation.noStylesStamp"))},titleKey:"annotation.stamp"})),ff=function(e){var t=e.documentId,n=ma(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(Ym,{icon:"palette",className:"h-18 w-18 text-fg-muted"}),j("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("annotation.selectAnnotation")))};function yf(e){var t,n=e.documentId,o=Md().provides,i=Pd(n),r=i.provides,a=i.state,s=ma(n).translate;if(!o||!r)return null;var l=null!==(t=null==o?void 0:o.getColorPresets())&&void 0!==t?t:[],c=null,d=null,u=a.selectedUid?mc(a,a.selectedUid):null;if(u)c=r.findToolForAnnotation(u.object),d=u.object.type;else if(a.activeToolId){var m,g,p;d=null!==(g=null===(p=c=null!==(m=r.getActiveTool())&&void 0!==m?m:null)||void 0===p?void 0:p.defaults.type)&&void 0!==g?g:null}if(null===d)return Ue(ff,{documentId:n});var v=vf[d];if(!v)return Ue(ff,{documentId:n});var f=v.component,y=v.titleKey,b={documentId:n,selected:u,activeTool:c,colorPresets:l},w="function"==typeof y?y(b):y,x=w?s(w):"",C=x?s(u?"annotation.styles":"annotation.defaults",{params:{type:x}}):"";return Ue("div",{class:"h-full overflow-y-auto p-4",children:[C&&Ue("h2",{class:"text-md mb-4 font-medium",children:C}),Ue(f,h({},b))]})}function bf(e){var t=e.schema,n=e.documentId,o=e.props,i=o.menuWrapperProps,r=o.rect,a=o.placement,s={position:"absolute",pointerEvents:"auto",cursor:"default",left:"50%",transform:"translateX(-50%)"};return null!=a&&a.suggestTop?s.top=-48:s.top=r.size.height+8,j("div",h(h({},i),mr(t)),j("div",{style:s,className:"border-border-subtle bg-bg-elevated rounded-lg border shadow-lg"},j("div",{className:"flex items-center gap-1 p-1"},t.items.map(function(e){return j(wf,{key:e.id,item:e,documentId:n,props:o})}))))}function wf(e){var t,n=e.item,o=e.documentId,i=e.props;switch(n.type){case"command-button":return j("div",h({},mr(n)),j(kp,{commandId:n.commandId,documentId:o,variant:n.variant}));case"divider":return j("div",h({},mr(n)),j("div",{className:"bg-border-default h-6 w-px","aria-hidden":"true"}));case"group":return j("div",h({className:"flex items-center gap-".concat(null!==(t=n.gap)&&void 0!==t?t:1)},mr(n)),n.items.map(function(e){return j(wf,{key:e.id,item:e,documentId:o,props:i})}));default:return null}}function xf(e){var t,n,o=e.schema,i=e.documentId,r=e.className,a=o.content,s=o.position,l=_r().renderCustomComponent,c=(t=s.anchor,(n={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"})[t]||n["bottom-center"]),d=function(e){if(e){var t={};return e.top&&(t.top=e.top),e.right&&(t.right=e.right),e.bottom&&(t.bottom=e.bottom),e.left&&(t.left=e.left),Object.keys(t).length>0?t:void 0}}(s.offset);return j("div",{className:"absolute ".concat(c," ").concat(r||""),style:d,"data-overlay-id":o.id},l(a.componentId,i,{}))}function Cf(e){var t=e.open,n=e.title,o=e.children,i=e.onClose,r=e.onExited,a=e.className,s=e.showCloseButton,l=void 0===s||s;e.maxWidth;var c=Ae(null),d=f(ke(t),2),u=d[0],h=d[1],m=f(ke(!1),2),g=m[0],p=m[1];Me(function(){if(t)h(!0),requestAnimationFrame(function(){p(!0)});else if(u){p(!1);var e=setTimeout(function(){h(!1),null==r||r()},200);return function(){return clearTimeout(e)}}},[t,u,r]),Me(function(){if(t){var e=function(e){"Escape"===e.key&&(null==i||i())};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}},[t,i]);return Me(function(){return document.body.style.overflow=u?"hidden":"",function(){document.body.style.overflow=""}},[u]),u?Ue("div",{ref:c,className:"fixed inset-0 z-50 transition-opacity duration-200 md:flex md:items-center md:justify-center ".concat(g&&t?"bg-bg-overlay":"bg-transparent"),onClick:function(e){e.target===c.current&&(null==i||i())},children:Ue("div",{className:"bg-bg-surface md:border-border-subtle relative flex h-full w-full flex-col transition-all duration-200 md:h-auto md:w-[28rem] md:max-w-[90vw] md:rounded-lg md:border md:shadow-lg ".concat(g&&t?"scale-100 opacity-100":"scale-95 opacity-0"," ").concat(a),onClick:function(e){return e.stopPropagation()},children:[(n||l)&&Ue("div",{className:"border-border-subtle flex flex-shrink-0 items-center justify-between border-b px-6 py-4",children:[n&&Ue("h2",{className:"text-fg-primary text-lg font-semibold",children:n}),l&&Ue(Qm,{onClick:i,className:"hover:bg-interactive-hover p-1",children:Ue(Ym,{icon:"x",className:"h-5 w-5"})})]}),Ue("div",{className:"flex-1 overflow-y-auto px-6 py-4 md:max-h-[80vh] md:flex-none",children:o})]})}):null}function If(e){var t=e.documentId,n=e.isOpen,o=e.onClose,i=e.onExited,r=ni().provides,a=Qd().provides,s=f(ke("all"),2),l=s[0],c=s[1],d=f(ke(""),2),u=d[0],h=d[1],m=f(ke(!0),2),g=m[0],p=m[1],v=f(ke(!1),2),y=v[0],b=v[1],w=f(ke(""),2),x=w[0],C=w[1],I=null==r?void 0:r.forDocument(t).getMetrics(),S=(null==I?void 0:I.currentPage)||1,k=(null==r?void 0:r.forDocument(t).getTotalPages())||0;Me(function(){n&&(c("all"),h(""),p(!0),b(!1),C(""))},[n]);var D=("custom"!==l||u.trim().length>0)&&!y;return j(Cf,{open:null!=n&&n,title:"Print Settings",onClose:o,onExited:i,maxWidth:"32rem"},j("div",{className:"space-y-6"},j("div",null,j("label",{className:"text-fg-secondary mb-3 block text-sm font-medium"},"Pages to print"),j("div",{className:"space-y-2"},j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"all",checked:"all"===l,onChange:function(){return c("all")},disabled:y,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},"All pages")),j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"current",checked:"current"===l,onChange:function(){return c("current")},disabled:y,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},"Current page (",S,")")),j("label",{className:"flex items-start"},j("input",{type:"radio",name:"pageRange",value:"custom",checked:"custom"===l,onChange:function(){return c("custom")},disabled:y,className:"accent-accent mr-2 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary mb-1 block text-sm"},"Specify pages"),j("input",{type:"text",placeholder:"e.g., 1-3, 5, 8-10",value:u,onInput:function(e){return h(e.target.value)},disabled:"custom"!==l||y,className:"w-full rounded-md border px-3 py-1 text-base ".concat("custom"!==l||y?"bg-interactive-disabled text-fg-muted":"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent"," focus:outline-none focus:ring-1")}),"custom"===l&&u.trim()&&k>0&&j("p",{className:"text-fg-muted mt-1 text-xs"},"Total pages in document: ",k))))),j("div",null,j("label",{className:"flex items-center"},j("input",{type:"checkbox",checked:g,onChange:function(e){return p(e.target.checked)},disabled:y,className:"accent-accent mr-2"}),j("span",{className:"text-fg-secondary text-sm font-medium"},"Include annotations"))),y&&j("div",{className:"bg-state-info-light flex items-center space-x-3 rounded-md p-3"},j(Pv,{className:"text-accent"}),j("span",{className:"text-accent text-sm"},x)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Qm,{onClick:o,disabled:y,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},"Cancel"),j(Qm,{onClick:function(){var e;"current"===l?e=String(S):"custom"===l&&(e=u.trim()||void 0);var n={includeAnnotations:g,pageRange:e};try{b(!0),C("Preparing document...");var i=null==a?void 0:a.forDocument(t).print(n);i&&(i.onProgress(function(e){C(e.message)}),i.wait(function(){b(!1),C(""),null==o||o()},function(e){console.error("Print failed:",e),b(!1),C("")}))}catch(e){console.error("Print failed:",e),b(!1),C("")}},disabled:!D,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover flex items-center space-x-2 rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},y&&j(Pv,{size:"sm"}),j("span",null,y?"Printing...":"Print")))))}function Sf(e){var t=e.documentId,n=Fo().provides,o=oi(t),i=o.provides,r=o.state,a=r.currentPage,s=r.totalPages,l=f(ke(!1),2),c=l[0],d=l[1],u=f(ke(!1),2),h=u[0],m=u[1],g=Ae(null),p=f(ke(a.toString()),2),v=p[0],y=p[1],b=Ae(null);Me(function(){y(a.toString())},[a]);var w=ze(function(){g.current&&clearTimeout(g.current),g.current=setTimeout(function(){h||d(!1)},4e3)},[h]);Me(function(){if(n)return n.onScrollActivity(function(e){e.documentId===t&&(d(!0),w())})},[n,t,w]),Me(function(){return function(){g.current&&clearTimeout(g.current)}},[]);return s<=1?null:j("div",{onMouseEnter:function(){m(!0),d(!0),g.current&&clearTimeout(g.current)},onMouseLeave:function(){m(!1),w()},className:"pointer-events-auto"},j("div",{className:"border-border-default bg-bg-surface flex items-center gap-1 rounded-lg border p-1 shadow-lg transition-opacity duration-300 ".concat(c?"opacity-100":"opacity-0")},j(kp,{commandId:"scroll:previous-page",documentId:t,variant:"icon"}),j("div",{className:"flex items-center gap-1 px-1"},j("input",{ref:b,type:"text",inputMode:"numeric",pattern:"[0-9]*",value:v,onChange:function(e){var t=e.target.value.replace(/[^0-9]/g,"");y(t)},onFocus:function(){setTimeout(function(){var e;return null===(e=b.current)||void 0===e?void 0:e.select()},0)},onBlur:function(){var e,t=parseInt(v,10);!isNaN(t)&&t>=1&&t<=s?null==i||null===(e=i.scrollToPage)||void 0===e||e.call(i,{pageNumber:t}):y(a.toString())},onKeyDown:function(e){"Enter"===e.key?e.target.blur():"Escape"===e.key&&(y(a.toString()),e.target.blur())},className:"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent h-7 w-10 rounded border px-1 text-center text-base focus:outline-none focus:ring-1"}),j("span",{className:"text-fg-secondary text-sm"},"  ",s)),j(kp,{commandId:"scroll:next-page",documentId:t,variant:"icon"})))}var kf={colors:{background:{app:"#f3f4f6",surface:"#ffffff",surfaceAlt:"#f1f3f5",elevated:"#ffffff",overlay:"rgba(0, 0, 0, 0.5)",input:"#ffffff"},foreground:{primary:"#111827",secondary:"#374151",muted:"#6b7280",disabled:"#9ca3af",onAccent:"#ffffff"},border:{default:"#d1d5db",subtle:"#e5e7eb",strong:"#9ca3af"},accent:{primary:"#3b82f6",primaryHover:"#2563eb",primaryActive:"#1d4ed8",primaryLight:"#eff6ff",primaryForeground:"#ffffff"},interactive:{hover:"#f3f4f6",active:"#e5e7eb",selected:"#eff6ff",focus:"#3b82f6",focusRing:"#bfdbfe"},state:{error:"#ef4444",errorLight:"#fef2f2",warning:"#f59e0b",warningLight:"#fffbeb",success:"#22c55e",successLight:"#f0fdf4",info:"#3b82f6",infoLight:"#eff6ff"},tooltip:{background:"#111827",foreground:"#ffffff"},scrollbar:{track:"#f3f4f6",thumb:"#d1d5db",thumbHover:"#9ca3af"}}},Df={colors:{background:{app:"#111827",surface:"#1f2937",surfaceAlt:"#374151",elevated:"#1f2937",overlay:"rgba(0, 0, 0, 0.7)",input:"#374151"},foreground:{primary:"#f9fafb",secondary:"#e5e7eb",muted:"#9ca3af",disabled:"#6b7280",onAccent:"#111827"},border:{default:"#4b5563",subtle:"#374151",strong:"#6b7280"},accent:{primary:"#60a5fa",primaryHover:"#3b82f6",primaryActive:"#2563eb",primaryLight:"#1e3a5f",primaryForeground:"#111827"},interactive:{hover:"#374151",active:"#4b5563",selected:"#1e3a5f",focus:"#60a5fa",focusRing:"#1e40af"},state:{error:"#f87171",errorLight:"#7f1d1d",warning:"#fbbf24",warningLight:"#78350f",success:"#4ade80",successLight:"#14532d",info:"#60a5fa",infoLight:"#1e3a5f"},tooltip:{background:"#f9fafb",foreground:"#111827"},scrollbar:{track:"#1f2937",thumb:"#4b5563",thumbHover:"#6b7280"}}};function Mf(e,t){var n=h({},e);for(var o in t){var i=t[o];i&&"object"===w(i)&&!Array.isArray(i)?n[o]=Mf(e[o]||{},i):void 0!==i&&(n[o]=i)}return n}function Pf(e,t){return{colors:Mf(e.colors,t)}}function Af(e){return"system"===e?"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Tf(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function zf(e){return":host {\n".concat(function(e){var t=[];return function e(n,o){for(var i=0,r=Object.entries(n);i<r.length;i++){var a=f(r[i],2),s=a[0],l=a[1];l&&"object"===w(l)?e(l,"".concat(o,"-").concat(Tf(s))):void 0!==l&&t.push(" --ep".concat(o,"-").concat(Tf(s),": ").concat(l,";"))}}(e.colors,""),t.join("\n")}(e),"\n}")}function Ef(e){var t=e.documentStates,n=e.activeDocumentId,o=e.visibility,i=void 0===o?"multiple":o,r=e.allowOpenFile,a=void 0===r||r,s=qr().provides,l=ze(function(e){null==s||s.setActiveDocument(e)},[s]),c=ze(function(e){null==s||s.closeDocument(e)},[s]),d=ze(function(){null==s||s.openFileDialog()},[s]);return"always"===i||"multiple"===i&&t.length>1?j("div",{className:"bg-bg-surface-alt flex items-end pr-2 pt-2"},j("div",{className:"flex flex-1 items-end overflow-x-auto pl-4"},t.map(function(e){var t,o,i=n===e.id;return j("div",{key:e.id,onClick:function(){return l(e.id)},role:"tab",tabIndex:0,"aria-selected":i,onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l(e.id))},className:"group relative flex min-w-[120px] max-w-[240px] cursor-pointer items-center gap-2 rounded-t-lg px-4 py-2 text-sm font-medium transition-all ".concat(i?"bg-bg-surface text-fg-primary z-10":"bg-bg-surface-alt text-fg-secondary hover:bg-interactive-hover hover:text-fg-primary")},j("span",{className:"min-w-0 flex-1 truncate"},null!==(t=e.name)&&void 0!==t?t:"Document ".concat(e.id.slice(0,8))),i&&j("button",{onClick:function(t){t.stopPropagation(),c(e.id)},"aria-label":"Close ".concat(null!==(o=e.name)&&void 0!==o?o:"document"),className:"hover:bg-interactive-hover flex-shrink-0 cursor-pointer rounded-full p-1 transition-all ".concat(i?"opacity-100":"opacity-0 group-hover:opacity-100")},j(Ym,{icon:"x",size:14})))}),a&&j("button",{onClick:d,className:"text-fg-secondary hover:bg-interactive-hover hover:text-fg-primary mb-1.5 ml-1 flex-shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":"Open File",title:"Open File"},j(Ym,{icon:"plus",size:14})))):null}function _f(){var e=qr().provides,t=ma().translate;return j("div",{className:"bg-bg-app flex h-full w-full items-center justify-center"},j("div",{className:"flex max-w-sm flex-col items-center text-center"},j("div",{className:"bg-accent-light mb-6 rounded-full p-5"},j(Ym,{icon:"file",size:48,className:"text-accent"})),j("h2",{className:"text-fg-primary mb-2 text-xl font-semibold"},t("emptyState.title")),j("p",{className:"text-fg-secondary mb-6 text-sm leading-relaxed"},t("emptyState.description"),j("br",null),t("emptyState.descriptionMulti")),j("button",{onClick:function(){null==e||e.openFileDialog()},className:"bg-accent hover:bg-accent-hover text-accent-fg inline-flex cursor-pointer items-center gap-2 rounded-md px-5 py-2.5 text-sm font-medium shadow-sm transition-all"},j(Ym,{icon:"plus",size:16}),t("emptyState.openButton")),j("p",{className:"text-fg-muted mt-4 text-xs"},t("emptyState.supportedFormats"))))}function Rf(e){var t=e.documentState,o=qr().provides,i=ma().translate,r=f(ke(""),2),a=r[0],s=r[1],l=f(ke(!1),2),c=l[0],d=l[1];if(!t)return null;var u=t.name,h=t.errorCode,m=t.passwordProvided,p=h===Ht.Password,v=p&&!m,y=p&&m;if(!p)return j("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},j("div",{className:"bg-bg-surface border-border-default flex max-w-sm flex-col items-center rounded-xl border p-6 text-center shadow-lg"},j("div",{className:"bg-state-error-light mb-4 rounded-full p-4"},j(Ym,{icon:"alertTriangle",size:28,className:"text-state-error"})),j("h3",{className:"text-fg-primary text-lg font-semibold"},i("documentError.title")),j("p",{className:"text-fg-secondary mt-2 text-sm"},t.error||i("documentError.unknown")),h&&j("p",{className:"text-fg-muted mt-1 text-xs"},i("documentError.errorCode",{params:{code:String(h)}})),j("button",{onClick:function(){return null==o?void 0:o.closeDocument(t.id)},className:"bg-accent hover:bg-accent-hover text-accent-fg mt-5 w-full cursor-pointer rounded-md px-4 py-2.5 text-sm font-medium transition-colors"},i("documentError.close"))));var b=function(){var e=n(g().m(function e(){return g().w(function(e){for(;;)switch(e.n){case 0:if(o&&a.trim()){e.n=1;break}return e.a(2);case 1:d(!0),o.retryDocument(t.id,{password:a}).wait(function(){s(""),d(!1)},function(e){console.error("Retry failed:",e),d(!1)});case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return j("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},j("div",{className:"bg-bg-surface border-border-default w-full max-w-sm rounded-xl border p-6 shadow-lg"},j("div",{className:"flex flex-col items-center text-center"},j("div",{className:"bg-accent-light mb-4 rounded-full p-4"},j(Ym,{icon:"lock",size:28,className:"text-accent"})),j("h3",{className:"text-fg-primary text-lg font-semibold"},i("passwordPrompt.title")),u&&j("p",{className:"text-fg-muted mt-1 text-sm"},u)),j("p",{className:"text-fg-secondary mt-4 text-center text-sm"},v&&i("passwordPrompt.required"),y&&i("passwordPrompt.incorrect")),j("div",{className:"mt-5"},j("label",{className:"text-fg-primary mb-1.5 block text-sm font-medium"},i("passwordPrompt.label")),j("input",{type:"password",value:a,onInput:function(e){return s(e.target.value)},onKeyDown:function(e){return"Enter"===e.key&&!c&&a.trim()&&b()},disabled:c,placeholder:i("passwordPrompt.placeholder"),className:"bg-bg-input border-border-default focus:border-accent focus:ring-accent text-fg-primary placeholder:text-fg-muted block w-full rounded-md border px-3 py-2.5 text-sm focus:outline-none focus:ring-1 disabled:opacity-50",autoFocus:!0})),y&&j("div",{className:"bg-state-error-light border-state-error mt-3 flex items-center gap-2 rounded-md border p-3"},j(Ym,{icon:"alertTriangle",size:16,className:"text-state-error flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},i("passwordPrompt.incorrectWarning"))),j("div",{className:"mt-6 flex gap-3"},j("button",{onClick:function(){return null==o?void 0:o.closeDocument(t.id)},disabled:c,className:"border-border-default text-fg-secondary hover:bg-interactive-hover flex-1 cursor-pointer rounded-md border px-4 py-2.5 text-sm font-medium transition-colors disabled:opacity-50"},i("passwordPrompt.cancel")),j("button",{onClick:b,disabled:c||!a.trim(),className:"bg-accent hover:bg-accent-hover text-accent-fg flex-1 cursor-pointer rounded-md px-4 py-2.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50"},i(c?"passwordPrompt.opening":"passwordPrompt.open")))))}function Nf(e){var t=e.documentId,n=e.className,o=ta("mode:view",t),i=ta("mode:annotate",t),r=ta("mode:shapes",t),a=ta("mode:redact",t),s=ta("tabs:overflow-menu",t),l=Te(function(){return[o,i,r,a].find(function(e){return null==e?void 0:e.active})||o},[o,i,r,a]),c=ze(function(e){e.preventDefault(),e.stopPropagation(),s&&!s.disabled&&s.execute()},[s]);if(!s||!s.visible)return null;var d=s.active;return j("div",{style:{maxWidth:"100px",width:"100px"},className:n},j(Qm,{className:"bg-bg-surface col-start-1 row-start-1 !w-full appearance-none rounded-md py-1.5 pl-3 pr-2 text-[13px] ".concat(d?"bg-interactive-selected ring-accent border-none shadow ring":"border-border-default outline-border-default hover:bg-interactive-hover hover:ring-accent outline outline-1 -outline-offset-1 hover:ring"," flex flex-row items-center justify-between gap-2"),onClick:c,disabled:s.disabled,style:{height:34}},j("span",{className:"min-w-0 flex-1 truncate text-left ".concat(d?"text-accent":"text-fg-primary")},null==l?void 0:l.label),j(Ym,{icon:"chevronDown",className:"h-4 w-4 ".concat(d?"text-accent":"text-fg-secondary")})))}var Of={documentManager:{},commands:{commands:{"zoom:in":{id:"zoom:in",labelKey:"zoom.in",icon:"zoomIn",shortcuts:["Ctrl+=","Meta+=","Ctrl+NumpadAdd","Meta+NumpadAdd"],categories:["zoom","zoom-in"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).zoomIn()}},"zoom:out":{id:"zoom:out",labelKey:"zoom.out",icon:"zoomOut",shortcuts:["Ctrl+-","Meta+-","Ctrl+NumpadSubtract","Meta+NumpadSubtract"],categories:["zoom","zoom-out"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).zoomOut()}},"zoom:fit-page":{id:"zoom:fit-page",labelKey:"zoom.fitPage",icon:"fitToPage",shortcuts:["Ctrl+0","Meta+0"],categories:["zoom","zoom-fit-page"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(ga.FitPage)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)===ga.FitPage}},"zoom:fit-width":{id:"zoom:fit-width",labelKey:"zoom.fitWidth",icon:"fitToWidth",shortcuts:["Ctrl+1","Meta+1"],categories:["zoom","zoom-fit-width"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(ga.FitWidth)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)===ga.FitWidth}},"zoom:marquee":{id:"zoom:marquee",labelKey:"zoom.marquee",icon:"zoomInArea",shortcuts:["Ctrl+M","Meta+M"],categories:["zoom","zoom-marquee"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMarqueeZoom()},active:function(e){var t,n,o=e.state,i=e.documentId;return null!==(t=null===(n=o.plugins.zoom)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.isMarqueeZoomActive)&&void 0!==t&&t}},"zoom:25":{id:"zoom:25",label:"25%",categories:["zoom","zoom-level","zoom-level-25"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(.25)},active:function(e){var t,n=e.state,o=e.documentId;return.25===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:50":{id:"zoom:50",label:"50%",categories:["zoom","zoom-level","zoom-level-50"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(.5)},active:function(e){var t,n=e.state,o=e.documentId;return.5===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:100":{id:"zoom:100",label:"100%",categories:["zoom","zoom-level","zoom-level-100"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1)},active:function(e){var t,n=e.state,o=e.documentId;return 1===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:125":{id:"zoom:125",label:"125%",categories:["zoom","zoom-level","zoom-level-125"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1.25)},active:function(e){var t,n=e.state,o=e.documentId;return 1.25===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:150":{id:"zoom:150",label:"150%",categories:["zoom","zoom-level","zoom-level-150"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1.5)},active:function(e){var t,n=e.state,o=e.documentId;return 1.5===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:200":{id:"zoom:200",label:"200%",categories:["zoom","zoom-level","zoom-level-200"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(2)},active:function(e){var t,n=e.state,o=e.documentId;return 2===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:400":{id:"zoom:400",label:"400%",categories:["zoom","zoom-level","zoom-level-400"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(4)},active:function(e){var t,n=e.state,o=e.documentId;return 4===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:800":{id:"zoom:800",label:"800%",categories:["zoom","zoom-level","zoom-level-800"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(8)},active:function(e){var t,n=e.state,o=e.documentId;return 8===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:1600":{id:"zoom:1600",label:"1600%",categories:["zoom","zoom-level","zoom-level-1600"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(16)},active:function(e){var t,n=e.state,o=e.documentId;return 16===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:toggle-menu":{id:"zoom:toggle-menu",labelKey:"zoom.menu",icon:"chevronDown",iconProps:{className:"h-3.5 w-3.5"},categories:["zoom","zoom-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMenu("zoom-menu","zoom:toggle-menu","zoom-menu-button")},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["zoom-menu"])}},"zoom:toggle-menu-mobile":{id:"zoom:toggle-menu-mobile",labelKey:"zoom.menu",icon:"zoomIn",categories:["zoom","zoom-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMenu("zoom-menu","zoom:toggle-menu-mobile","zoom-menu-button")},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["zoom-menu"])}},"pan:toggle":{id:"pan:toggle",labelKey:"pan.toggle",icon:"hand",shortcuts:["h"],categories:["tools","pan"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("pan"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).togglePan()},active:function(e){var t,n,o=e.state,i=e.documentId;return null!==(t=null===(n=o.plugins.pan)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.isPanMode)&&void 0!==t&&t}},"pointer:toggle":{id:"pointer:toggle",labelKey:"pointer.toggle",icon:"pointer",shortcuts:["p"],categories:["tools","pointer"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("interaction-manager"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).activate("pointerMode")},active:function(e){var t,n=e.state,o=e.documentId;return"pointerMode"===(null===(t=n.plugins["interaction-manager"])||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.activeMode)}},"left-action-menu:overflow-menu":{id:"left-action-menu:overflow-menu",labelKey:"menu.moreOptions",icon:"dots",categories:["ui","ui-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.toggleMenu("left-action-menu","left-action-menu:overflow-menu","overflow-left-action-menu-button",o)},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["left-action-menu"])}},"capture:screenshot":{id:"capture:screenshot",labelKey:"capture.screenshot",icon:"screenshot",shortcuts:["Ctrl+Shift+S","Meta+Shift+S"],categories:["tools","capture","capture-screenshot"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("capture"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r.isMarqueeCaptureActive()?r.disableMarqueeCapture():r.enableMarqueeCapture()}},active:function(e){var t,n=e.state,o=e.documentId;return"marqueeCapture"===(null===(t=n.plugins["interaction-manager"].documents[o])||void 0===t?void 0:t.activeMode)}},"document:menu":{id:"document:menu",labelKey:"document.menu",icon:"menu",categories:["document","document-menu"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleMenu("document-menu","document:menu","document-menu-button")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["document-menu"])}},"document:open":{id:"document:open",labelKey:"document.open",icon:"fileImport",shortcuts:["Ctrl+O","Meta+O"],categories:["document","document-open"],action:function(e){var t,n=null===(t=e.registry.getPlugin("document-manager"))||void 0===t?void 0:t.provides();null==n||n.openFileDialog()}},"document:close":{id:"document:close",labelKey:"document.close",icon:"x",shortcuts:["Ctrl+W","Meta+W"],categories:["document","document-close"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("document-manager"))||void 0===t?void 0:t.provides();null==i||i.closeDocument(o)}},"document:print":{id:"document:print",labelKey:"document.print",icon:"print",shortcuts:["Ctrl+P","Meta+P"],categories:["document","document-print"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).openModal("print-modal")}}},"document:export":{id:"document:export",labelKey:"document.export",icon:"download",categories:["document","document-export"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("export"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).download()}},"document:fullscreen":{id:"document:fullscreen",labelKey:"document.fullscreen",icon:function(e){var t;return null!==(t=e.state.plugins.fullscreen)&&void 0!==t&&t.isFullscreen?"fullscreenExit":"fullscreen"},shortcuts:["F11"],categories:["document","document-fullscreen"],action:function(e){var t,n=null===(t=e.registry.getPlugin("fullscreen"))||void 0===t?void 0:t.provides();n&&(n.isFullscreen()?n.exitFullscreen():n.enableFullscreen())},active:function(e){var t,n;return null!==(t=null===(n=e.state.plugins.fullscreen)||void 0===n?void 0:n.isFullscreen)&&void 0!==t&&t}},"panel:toggle-sidebar":{id:"panel:toggle-sidebar",labelKey:"panel.sidebar",icon:"sidebar",categories:["panel","panel-sidebar"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("left","main","sidebar-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"left","main","sidebar-panel")}},"panel:toggle-search":{id:"panel:toggle-search",labelKey:"panel.search",icon:"search",shortcuts:["Ctrl+F","Meta+F"],categories:["panel","panel-search"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("right","main","search-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"right","main","search-panel")}},"panel:toggle-comment":{id:"panel:toggle-comment",labelKey:"panel.comment",icon:"comment",categories:["panel","panel-comment"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("right","main","comment-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"right","main","comment-panel")}},"panel:toggle-annotation-style":{id:"panel:toggle-annotation-style",labelKey:"panel.annotationStyle",icon:"palette",categories:["panel","panel-annotation-style"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("left","main","annotation-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"left","main","annotation-panel")}},"page:settings":{id:"page:settings",labelKey:"page.settings",icon:"viewSettings",categories:["page","page-settings"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleMenu("page-settings-menu","page:settings","page-settings-button")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["page-settings-menu"])}},"spread:none":{id:"spread:none",labelKey:"page.single",icon:"singlePage",categories:["page","spread","spread-none"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.None)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.None}},"spread:odd":{id:"spread:odd",labelKey:"page.twoOdd",icon:"doublePage",categories:["page","spread","spread-odd"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.Odd)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.Odd}},"spread:even":{id:"spread:even",labelKey:"page.twoEven",icon:"book2",categories:["page","spread","spread-even"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.Even)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.Even}},"rotate:clockwise":{id:"rotate:clockwise",labelKey:"rotate.clockwise",icon:"rotateClockwise",shortcuts:["Ctrl+]","Meta+]"],categories:["page","rotate","rotate-clockwise"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("rotate"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).rotateForward()}},"rotate:counter-clockwise":{id:"rotate:counter-clockwise",labelKey:"rotate.counterClockwise",icon:"rotateCounterClockwise",shortcuts:["Ctrl+[","Meta+["],categories:["page","rotate","rotate-counter-clockwise"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("rotate"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).rotateBackward()}},"scroll:vertical":{id:"scroll:vertical",labelKey:"page.vertical",icon:"vertical",categories:["page","scroll","scroll-vertical"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setScrollStrategy(Uo.Vertical)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.strategy)===Uo.Vertical}},"scroll:horizontal":{id:"scroll:horizontal",labelKey:"page.horizontal",icon:"horizontal",categories:["page","scroll","scroll-horizontal"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setScrollStrategy(Uo.Horizontal)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.strategy)===Uo.Horizontal}},"scroll:next-page":{id:"scroll:next-page",labelKey:"page.next",icon:"chevronRight",categories:["page","navigation","navigation-next"],shortcuts:["Ctrl+]","Meta+]","ArrowRight"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToNextPage()},disabled:function(e){var t,n,o=e.state,i=e.documentId;return(null===(t=o.plugins.scroll)||void 0===t||null===(t=t.documents[i])||void 0===t?void 0:t.currentPage)>=(null===(n=o.plugins.scroll)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.totalPages)}},"scroll:previous-page":{id:"scroll:previous-page",labelKey:"page.previous",icon:"chevronLeft",categories:["page","navigation","navigation-previous"],shortcuts:["Ctrl+[","Meta+[","ArrowLeft"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToPreviousPage()},disabled:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.currentPage)<=1}},"mode:view":{id:"mode:view",labelKey:"mode.view",categories:["mode","mode-view"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("ui"))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("interaction-manager"))||void 0===n?void 0:n.provides();if(r&&a){var s=a.forDocument(i);s&&(s.activate("pointerMode"),r.forDocument(i).closeToolbarSlot("top","secondary"))}},active:function(e){var t=e.state,n=e.documentId;return!wr(t.plugins,n,"top","secondary")}},"mode:annotate":{id:"mode:annotate",labelKey:"mode.annotate",categories:["mode","mode-annotate","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","annotation-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","annotation-toolbar")}},"mode:shapes":{id:"mode:shapes",labelKey:"mode.shapes",categories:["mode","mode-shapes","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","shapes-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","shapes-toolbar")}},"mode:redact":{id:"mode:redact",labelKey:"mode.redact",categories:["mode","mode-redact","redaction"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","redaction-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","redaction-toolbar")}},"tabs:overflow-menu":{id:"tabs:overflow-menu",labelKey:"tabs.overflowMenu",icon:"dots",categories:["ui","ui-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.toggleMenu("mode-tabs-overflow-menu","tabs:overflow-menu","overflow-tabs-button",o)},active:function(e){var t,n=e.state,o=e.documentId;return void 0!==(null===(t=n.plugins.ui)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.openMenus["mode-tabs-overflow-menu"])}},"annotation:add-highlight":{id:"annotation:add-highlight",labelKey:"annotation.highlight",icon:"highlight",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"highlight"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-highlight"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(ps))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=s.getTool("highlight");if(h&&qc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=a(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=yn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Dt.HIGHLIGHT,blendMode:It.Multiply,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},wn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("highlight"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"highlight"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("highlight")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"highlight"===(null==i?void 0:i.activeToolId)}},"annotation:add-underline":{id:"annotation:add-underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"underline"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-underline"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(ps))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=s.getTool("underline");if(h&&Vc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=a(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=yn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Dt.UNDERLINE,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},wn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("underline"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"underline"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("underline")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"underline"===(null==i?void 0:i.activeToolId)}},"annotation:add-strikeout":{id:"annotation:add-strikeout",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"strikeout"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-strikeout"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(ps))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=s.getTool("strikeout");if(h&&Zc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=a(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=yn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Dt.STRIKEOUT,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},wn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("strikeout"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"strikeout"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("strikeout")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"strikeout"===(null==i?void 0:i.activeToolId)}},"annotation:add-squiggly":{id:"annotation:add-squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"squiggly"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-squiggly"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(ps))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=s.getTool("squiggly");if(h&&Gc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=a(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=yn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Dt.SQUIGGLY,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},wn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("squiggly"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"squiggly"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("squiggly")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"squiggly"===(null==i?void 0:i.activeToolId)}},"annotation:add-ink":{id:"annotation:add-ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"ink"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-ink"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("ink"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("ink"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"ink"===(null==i?void 0:i.activeToolId)}},"annotation:add-text":{id:"annotation:add-text",labelKey:"annotation.text",icon:"text",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"freeText"))||void 0===t?void 0:t.fontColor}},categories:["annotation","annotation-text"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("freeText"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("freeText"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"freeText"===(null==i?void 0:i.activeToolId)}},"annotation:add-stamp":{id:"annotation:add-stamp",labelKey:"annotation.stamp",icon:"photo",categories:["annotation","annotation-stamp"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("stamp"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("stamp"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"stamp"===(null==i?void 0:i.activeToolId)}},"annotation:add-rectangle":{id:"annotation:add-rectangle",labelKey:"annotation.rectangle",icon:"square",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=pc(o.plugins.annotation,"square"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=pc(o.plugins.annotation,"square"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-rectangle"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("square"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("square"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"square"===(null==i?void 0:i.activeToolId)}},"annotation:add-circle":{id:"annotation:add-circle",labelKey:"annotation.circle",icon:"circle",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=pc(o.plugins.annotation,"circle"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=pc(o.plugins.annotation,"circle"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-circle"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("circle"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("circle"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"circle"===(null==i?void 0:i.activeToolId)}},"annotation:add-line":{id:"annotation:add-line",labelKey:"annotation.line",icon:"line",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"line"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-line"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("line"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("line"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"line"===(null==i?void 0:i.activeToolId)}},"annotation:add-arrow":{id:"annotation:add-arrow",labelKey:"annotation.arrow",icon:"lineArrow",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"line"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-arrow"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("lineArrow"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("lineArrow"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"lineArrow"===(null==i?void 0:i.activeToolId)}},"annotation:add-polygon":{id:"annotation:add-polygon",labelKey:"annotation.polygon",icon:"polygon",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=pc(o.plugins.annotation,"polygon"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=pc(o.plugins.annotation,"polygon"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-polygon"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("polygon"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("polygon"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"polygon"===(null==i?void 0:i.activeToolId)}},"annotation:add-polyline":{id:"annotation:add-polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){var t;return{primaryColor:null===(t=pc(e.state.plugins.annotation,"polyline"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-polyline"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tl))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("polyline"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("polyline"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tl])||void 0===t?void 0:t.documents[o];return"polyline"===(null==i?void 0:i.activeToolId)}},"annotation:delete-selected":{id:"annotation:delete-selected",labelKey:"annotation.deleteSelected",icon:"trash",categories:["annotation","annotation-delete"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tl))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o);if(r){var a=r.getSelectedAnnotation();a&&r.deleteAnnotation(a.object.pageIndex,a.object.id)}}},"annotation:overflow-tools":{id:"annotation:overflow-tools",labelKey:"annotation.moreTools",icon:"dots",categories:["annotation","annotation-overflow"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r&&r.toggleMenu("annotation-tools-menu","annotation:overflow-tools","overflow-annotation-tools")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["annotation-tools-menu"])}},"annotation:overflow-shapes":{id:"annotation:overflow-shapes",labelKey:"annotation.moreTools",icon:"dots",categories:["annotation","annotation-shape","annotation-overflow"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r&&r.toggleMenu("shapes-tools-menu","annotation:overflow-shapes","overflow-shapes-tools")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["shapes-tools-menu"])}},"redaction:redact-area":{id:"redaction:redact-area",labelKey:"redaction.area",icon:"redactArea",categories:["redaction","redaction-area"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).toggleMarqueeRedact()},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===qu.MarqueeRedact}},"redaction:redact-text":{id:"redaction:redact-text",labelKey:"redaction.text",icon:"redact",categories:["redaction","redaction-text"],action:function(e){var t,n,o,i,r=e.registry,a=e.documentId,s=null===(t=r.getPlugin("redaction"))||void 0===t?void 0:t.provides(),l=null===(n=r.getPlugin(ps))||void 0===n?void 0:n.provides(),c=null===(o=r.getPlugin("ui"))||void 0===o?void 0:o.provides();if(s&&l&&c){var d=s.forDocument(a),u=null==l?void 0:l.forDocument(a);(null!==(i=null==u?void 0:u.getFormattedSelection())&&void 0!==i?i:[]).length>0?(d.queueCurrentSelectionAsPending(),c.setActiveToolbar("top","secondary","redaction-toolbar",a)):d.toggleRedactSelection()}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===qu.RedactSelection}},"redaction:apply-all":{id:"redaction:apply-all",labelKey:"redaction.applyAll",icon:"check",categories:["redaction","redaction-apply"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).commitAllPending()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)}},"redaction:clear-all":{id:"redaction:clear-all",labelKey:"redaction.clearAll",icon:"x",categories:["redaction","redaction-clear"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).clearPending()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)}},"redaction:delete-selected":{id:"redaction:delete-selected",labelKey:"redaction.deleteSelected",icon:"trash",categories:["redaction","redaction-delete"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o).getSelectedPending();r&&(null==i||i.forDocument(o).removePending(r.page,r.id))}},"redaction:commit-selected":{id:"redaction:commit-selected",labelKey:"redaction.commitSelected",icon:"check",categories:["redaction","redaction-commit"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o).getSelectedPending();r&&(null==i||i.forDocument(o).commitPending(r.page,r.id))}},"selection:copy-to-clipboard":{id:"selection:copy-to-clipboard",labelKey:"selection.copyToClipboard",icon:"copy",shortcuts:["Ctrl+C","Meta+C"],categories:["selection","selection-copy-to-clipboard"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin("selection"),i=null==o?void 0:o.provides().forDocument(n);null==i||i.copyToClipboard()}},"selection:copy":{id:"selection:copy",labelKey:"selection.copy",icon:"copy",categories:["selection","selection-copy"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin("selection"),i=null==o?void 0:o.provides().forDocument(n);null==i||i.copyToClipboard(),null==i||i.clear()}},"history:undo":{id:"history:undo",labelKey:"history.undo",icon:"arrowBackUp",shortcuts:["Ctrl+Z","Meta+Z"],categories:["history","history-undo"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Nu))||void 0===t?void 0:t.provides();i&&i.forDocument(o).undo()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Nu])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canUndo)}},"history:redo":{id:"history:redo",labelKey:"history.redo",icon:"arrowForwardUp",shortcuts:["Ctrl+Y","Meta+Shift+Z"],categories:["history","history-redo"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Nu))||void 0===t?void 0:t.provides();i&&i.forDocument(o).redo()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Nu])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canRedo)}}}},i18n:{defaultLocale:"en",locales:[{code:"en",name:"English",translations:{search:{placeholder:"Search",caseSensitive:"Case sensitive",wholeWord:"Whole word",resultsFound:"{count} results found",page:"Page {page}"},zoom:{in:"Zoom In",out:"Zoom Out",fitWidth:"Fit to Width",fitPage:"Fit to Page",marquee:"Marquee Zoom",menu:"Zoom Menu",level:"Zoom Level ({level}%)"},pan:{toggle:"Toggle Pan Mode"},pointer:{toggle:"Toggle Pointer Mode"},capture:{screenshot:"Screenshot"},document:{menu:"Document Menu",open:"Open",close:"Close",print:"Print",export:"Export",fullscreen:"Fullscreen",loading:"Loading document..."},emptyState:{title:"No Documents Open",description:"Open a PDF document to get started.",descriptionMulti:"You can view multiple documents using tabs.",openButton:"Open Document",supportedFormats:"Supported format: PDF"},passwordPrompt:{title:"Password Required",required:"This document is password protected. Please enter the password to open it.",incorrect:"The password you entered was incorrect. Please try again.",incorrectWarning:"Incorrect password. Please check and try again.",label:"Password",placeholder:"Enter document password",open:"Open",opening:"Opening...",cancel:"Cancel",close:"Close"},documentError:{title:"Error loading document",unknown:"An unknown error occurred",errorCode:"Error Code: {code}",close:"Close Document"},panel:{sidebar:"Sidebar",search:"Search",comment:"Comment",thumbnails:"Thumbnails",outline:"Outline",annotationStyle:"Annotation Style"},menu:{viewControls:"View Controls",zoomControls:"Zoom Controls",moreOptions:"More Options"},outline:{title:"Outline",loading:"Loading outline...",noOutline:"No outline available",noBookmarks:"This document doesn't contain bookmarks"},page:{settings:"Page Settings",single:"Single Page",twoOdd:"Two Page (Odd)",twoEven:"Two Page (Even)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Spread Mode",scrollLayout:"Scroll Layout",rotation:"Page Rotation",next:"Next Page",previous:"Previous Page"},rotate:{clockwise:"Rotate Clockwise",counterClockwise:"Rotate Counter-Clockwise"},selection:{copy:"Copy Selection"},mode:{view:"View",annotate:"Annotate",shapes:"Shapes",redact:"Redact"},annotation:{text:"Text",highlight:"Highlight",strikeout:"Strikethrough",underline:"Underline",squiggly:"Squiggly",rectangle:"Rectangle",circle:"Circle",line:"Line",arrow:"Arrow",polygon:"Polygon",polyline:"Polyline",ink:"Ink",stamp:"Stamp",freeText:"Free Text",square:"Square",styles:"{type} Styles",defaults:"{type} Defaults",color:"Color",opacity:"Opacity",blendMode:"Blend mode",strokeWidth:"Stroke width",strokeColor:"Stroke color",borderStyle:"Border style",fillColor:"Fill color",fontSize:"Font size",fontFamily:"Font",textAlign:"Text alignment",verticalAlign:"Vertical alignment",lineEnding:"Line ending",lineStart:"Line start",lineEnd:"Line end",font:"Font",fontColor:"Font color",backgroundColor:"Background color",noStyles:"There are no styles for this annotation.",noStylesStamp:"There are no styles for stamps.",selectAnnotation:"Select an annotation to see styles",deleteSelected:"Delete selected annotation",moreTools:"More Tools"},redaction:{area:"Redact Area",text:"Redact Text",applyAll:"Apply All",clearAll:"Clear All"},history:{undo:"Undo",redo:"Redo"},comments:{page:"Page {page}",commentCount:"{count} comment",commentCountPlural:"{count} comments",addComment:"Add comment...",addReply:"Add reply...",save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",showMore:"more",showLess:"less",emptyState:"Add annotations to be able to comment on them."},blendMode:{normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten",colorDodge:"Color Dodge",colorBurn:"Color Burn",hardLight:"Hard Light",softLight:"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"}}},{code:"nl",name:"Nederlands",translations:{search:{placeholder:"Zoeken",caseSensitive:"Hoofdlettergevoelig",wholeWord:"Heel woord",resultsFound:"{count} resultaten gevonden",page:"Pagina {page}"},zoom:{in:"Inzoomen",out:"Uitzoomen",fitWidth:"Aanbreedte aanpassen",fitPage:"Aan pagina aanpassen",marquee:"Lijstzoom",menu:"Zoommenu",level:"Zoomniveau ({level}%)"},pan:{toggle:"Pan-modus wisselen"},pointer:{toggle:"Aanwijzermodus wisselen"},capture:{screenshot:"Schermafbeelding"},document:{menu:"Documentmenu",open:"Openen",close:"Sluiten",print:"Afdrukken",export:"Exporteren",fullscreen:"Volledig scherm",loading:"Document laden..."},emptyState:{title:"Geen documenten geopend",description:"Open een PDF-document om te beginnen.",descriptionMulti:"U kunt meerdere documenten bekijken met tabs.",openButton:"Document openen",supportedFormats:"Ondersteund formaat: PDF"},passwordPrompt:{title:"Wachtwoord vereist",required:"Dit document is beveiligd met een wachtwoord. Voer het wachtwoord in om te openen.",incorrect:"Het ingevoerde wachtwoord was onjuist. Probeer het opnieuw.",incorrectWarning:"Onjuist wachtwoord. Controleer en probeer opnieuw.",label:"Wachtwoord",placeholder:"Voer documentwachtwoord in",open:"Openen",opening:"Openen...",cancel:"Annuleren",close:"Sluiten"},documentError:{title:"Fout bij laden van document",unknown:"Er is een onbekende fout opgetreden",errorCode:"Foutcode: {code}",close:"Document sluiten"},panel:{sidebar:"Zijbalk",search:"Zoeken",comment:"Opmerking",thumbnails:"Miniaturen",outline:"Overzicht",annotationStyle:"Annotatiestijl"},menu:{viewControls:"Weergave-instellingen",zoomControls:"Zoom-instellingen",moreOptions:"Meer opties"},outline:{title:"Overzicht",loading:"Overzicht laden...",noOutline:"Geen overzicht beschikbaar",noBookmarks:"Dit document bevat geen bladwijzers"},page:{settings:"Pagina-instellingen",single:"Enkele pagina",twoOdd:"Twee pagina's (Oneven)",twoEven:"Twee pagina's (Even)",vertical:"Verticaal",horizontal:"Horizontaal",spreadMode:"Spreidingsmodus",scrollLayout:"Scrollindeling",rotation:"Paginarotatie",next:"Volgende pagina",previous:"Vorige pagina"},rotate:{clockwise:"Met de klok mee draaien",counterClockwise:"Tegen de klok in draaien"},selection:{copy:"Selectie kopiëren"},mode:{view:"Weergave",annotate:"Annoteren",shapes:"Vormen",redact:"Redigeren"},annotation:{text:"Tekst",highlight:"Markeren",strikeout:"Doorhalen",underline:"Onderstrepen",squiggly:"Golflijn",rectangle:"Rechthoek",circle:"Cirkel",line:"Lijn",arrow:"Pijl",polygon:"Veelhoek",polyline:"Polylijn",ink:"Inkt",stamp:"Stempel",freeText:"Vrije tekst",square:"Vierkant",styles:"{type} stijlen",defaults:"{type} standaardwaarden",color:"Kleur",opacity:"Dekking",blendMode:"Overvloeimodus",strokeWidth:"Lijndikte",strokeColor:"Lijnkleur",borderStyle:"Randstijl",fillColor:"Vulkleur",fontSize:"Lettergrootte",fontFamily:"Lettertype",textAlign:"Tekstuitlijning",verticalAlign:"Verticale uitlijning",lineEnding:"Lijneinde",lineStart:"Lijnbegin",lineEnd:"Lijneinde",font:"Lettertype",fontColor:"Tekstkleur",backgroundColor:"Achtergrondkleur",noStyles:"Er zijn geen stijlen voor deze annotatie.",noStylesStamp:"Er zijn geen stijlen voor stempels.",selectAnnotation:"Selecteer een annotatie om stijlen te zien",deleteSelected:"Geselecteerde annotatie verwijderen",moreTools:"Meer gereedschappen"},redaction:{area:"Gebied redigeren",text:"Tekst redigeren",applyAll:"Alles toepassen",clearAll:"Alles wissen"},history:{undo:"Ongedaan maken",redo:"Opnieuw doen"},comments:{page:"Pagina {page}",commentCount:"{count} opmerking",commentCountPlural:"{count} opmerkingen",addComment:"Opmerking toevoegen...",addReply:"Antwoord toevoegen...",save:"Opslaan",cancel:"Annuleren",edit:"Bewerken",delete:"Verwijderen",showMore:"meer",showLess:"minder",emptyState:"Voeg annotaties toe om erop te kunnen reageren."},blendMode:{normal:"Normaal",multiply:"Vermenigvuldigen",screen:"Bleken",overlay:"Bedekken",darken:"Donkerder",lighten:"Lichter",colorDodge:"Kleur tegenhouden",colorBurn:"Kleur doordrukken",hardLight:"Hard licht",softLight:"Zacht licht",difference:"Verschil",exclusion:"Uitsluiting",hue:"Kleurtoon",saturation:"Verzadiging",color:"Kleur",luminosity:"Helderheid"}}},{code:"de",name:"Deutsch",translations:{search:{placeholder:"Suchen",caseSensitive:"Groß-/Kleinschreibung",wholeWord:"Ganzes Wort",resultsFound:"{count} Ergebnisse gefunden",page:"Seite {page}"},zoom:{in:"Vergrößern",out:"Verkleinern",fitWidth:"An Breite anpassen",fitPage:"An Seite anpassen",marquee:"Laufrahmen-Zoom",menu:"Zoom-Menü",level:"Zoomstufe ({level}%)"},pan:{toggle:"Verschieben-Modus umschalten"},pointer:{toggle:"Zeiger-Modus umschalten"},capture:{screenshot:"Screenshot"},document:{menu:"Dokument-Menü",open:"Öffnen",close:"Schließen",print:"Drucken",export:"Exportieren",fullscreen:"Vollbild",loading:"Dokument wird geladen..."},emptyState:{title:"Keine Dokumente geöffnet",description:"Öffnen Sie ein PDF-Dokument, um zu beginnen.",descriptionMulti:"Sie können mehrere Dokumente mit Tabs anzeigen.",openButton:"Dokument öffnen",supportedFormats:"Unterstütztes Format: PDF"},passwordPrompt:{title:"Passwort erforderlich",required:"Dieses Dokument ist passwortgeschützt. Bitte geben Sie das Passwort ein.",incorrect:"Das eingegebene Passwort war falsch. Bitte versuchen Sie es erneut.",incorrectWarning:"Falsches Passwort. Bitte überprüfen und erneut versuchen.",label:"Passwort",placeholder:"Dokumentpasswort eingeben",open:"Öffnen",opening:"Öffnen...",cancel:"Abbrechen",close:"Schließen"},documentError:{title:"Fehler beim Laden des Dokuments",unknown:"Ein unbekannter Fehler ist aufgetreten",errorCode:"Fehlercode: {code}",close:"Dokument schließen"},panel:{sidebar:"Seitenleiste",search:"Suchen",comment:"Kommentar",thumbnails:"Miniaturansichten",outline:"Gliederung",annotationStyle:"Anmerkungsstil"},menu:{viewControls:"Ansichtseinstellungen",zoomControls:"Zoom-Einstellungen",moreOptions:"Weitere Optionen"},outline:{title:"Gliederung",loading:"Gliederung wird geladen...",noOutline:"Keine Gliederung verfügbar",noBookmarks:"Dieses Dokument enthält keine Lesezeichen"},page:{settings:"Seiteneinstellungen",single:"Einzelseite",twoOdd:"Zwei Seiten (Ungerade)",twoEven:"Zwei Seiten (Gerade)",vertical:"Vertikal",horizontal:"Horizontal",spreadMode:"Doppelseiten-Modus",scrollLayout:"Scroll-Layout",rotation:"Seitendrehung",next:"Nächste Seite",previous:"Vorherige Seite"},rotate:{clockwise:"Im Uhrzeigersinn drehen",counterClockwise:"Gegen den Uhrzeigersinn drehen"},selection:{copy:"Auswahl kopieren"},mode:{view:"Ansicht",annotate:"Annotieren",shapes:"Formen",redact:"Schwärzen"},annotation:{text:"Text",highlight:"Markieren",strikeout:"Durchstreichen",underline:"Unterstreichen",squiggly:"Wellenlinie",rectangle:"Rechteck",circle:"Kreis",line:"Linie",arrow:"Pfeil",polygon:"Polygon",polyline:"Polylinie",ink:"Freihand",stamp:"Stempel",freeText:"Freitext",square:"Quadrat",styles:"{type}-Stile",defaults:"{type}-Standardwerte",color:"Farbe",opacity:"Deckkraft",blendMode:"Mischmodus",strokeWidth:"Strichstärke",strokeColor:"Strichfarbe",borderStyle:"Rahmenstil",fillColor:"Füllfarbe",fontSize:"Schriftgröße",fontFamily:"Schriftart",textAlign:"Textausrichtung",verticalAlign:"Vertikale Ausrichtung",lineEnding:"Linienende",lineStart:"Linienanfang",lineEnd:"Linienende",font:"Schriftart",fontColor:"Schriftfarbe",backgroundColor:"Hintergrundfarbe",noStyles:"Für diese Anmerkung gibt es keine Stile.",noStylesStamp:"Für Stempel gibt es keine Stile.",selectAnnotation:"Wählen Sie eine Anmerkung aus, um Stile anzuzeigen",deleteSelected:"Ausgewählte Anmerkung löschen",moreTools:"Weitere Werkzeuge"},redaction:{area:"Bereich schwärzen",text:"Text schwärzen",applyAll:"Alle anwenden",clearAll:"Alle löschen"},history:{undo:"Rückgängig",redo:"Wiederholen"},comments:{page:"Seite {page}",commentCount:"{count} Kommentar",commentCountPlural:"{count} Kommentare",addComment:"Kommentar hinzufügen...",addReply:"Antwort hinzufügen...",save:"Speichern",cancel:"Abbrechen",edit:"Bearbeiten",delete:"Löschen",showMore:"mehr",showLess:"weniger",emptyState:"Fügen Sie Anmerkungen hinzu, um sie kommentieren zu können."},blendMode:{normal:"Normal",multiply:"Multiplizieren",screen:"Negativ multiplizieren",overlay:"Ineinanderkopieren",darken:"Abdunkeln",lighten:"Aufhellen",colorDodge:"Farbig abwedeln",colorBurn:"Farbig nachbelichten",hardLight:"Hartes Licht",softLight:"Weiches Licht",difference:"Differenz",exclusion:"Ausschluss",hue:"Farbton",saturation:"Sättigung",color:"Farbe",luminosity:"Luminanz"}}},{code:"fr",name:"Français",translations:{search:{placeholder:"Rechercher",caseSensitive:"Respecter la casse",wholeWord:"Mot entier",resultsFound:"{count} résultats trouvés",page:"Page {page}"},zoom:{in:"Zoom avant",out:"Zoom arrière",fitWidth:"Ajuster à la largeur",fitPage:"Ajuster à la page",marquee:"Zoom de sélection",menu:"Menu Zoom",level:"Niveau de zoom ({level}%)"},pan:{toggle:"Basculer le mode déplacement"},pointer:{toggle:"Basculer le mode pointeur"},capture:{screenshot:"Capture d'écran"},document:{menu:"Menu Document",open:"Ouvrir",close:"Fermer",print:"Imprimer",export:"Exporter",fullscreen:"Plein écran",loading:"Chargement du document..."},emptyState:{title:"Aucun document ouvert",description:"Ouvrez un document PDF pour commencer.",descriptionMulti:"Vous pouvez afficher plusieurs documents avec des onglets.",openButton:"Ouvrir un document",supportedFormats:"Format pris en charge : PDF"},passwordPrompt:{title:"Mot de passe requis",required:"Ce document est protégé par mot de passe. Veuillez entrer le mot de passe.",incorrect:"Le mot de passe saisi est incorrect. Veuillez réessayer.",incorrectWarning:"Mot de passe incorrect. Veuillez vérifier et réessayer.",label:"Mot de passe",placeholder:"Entrer le mot de passe du document",open:"Ouvrir",opening:"Ouverture...",cancel:"Annuler",close:"Fermer"},documentError:{title:"Erreur lors du chargement du document",unknown:"Une erreur inconnue est survenue",errorCode:"Code erreur : {code}",close:"Fermer le document"},panel:{sidebar:"Barre latérale",search:"Rechercher",comment:"Commentaire",thumbnails:"Miniatures",outline:"Plan",annotationStyle:"Style d'annotation"},menu:{viewControls:"Contrôles d'affichage",zoomControls:"Contrôles de zoom",moreOptions:"Plus d'options"},outline:{title:"Plan",loading:"Chargement du plan...",noOutline:"Aucun plan disponible",noBookmarks:"Ce document ne contient pas de signets"},page:{settings:"Paramètres de page",single:"Page unique",twoOdd:"Deux pages (Impair)",twoEven:"Deux pages (Pair)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Mode double page",scrollLayout:"Disposition de défilement",rotation:"Rotation de page",next:"Page suivante",previous:"Page précédente"},rotate:{clockwise:"Tourner dans le sens horaire",counterClockwise:"Tourner dans le sens antihoraire"},selection:{copy:"Copier la sélection"},mode:{view:"Affichage",annotate:"Annoter",shapes:"Formes",redact:"Caviarder"},annotation:{text:"Texte",highlight:"Surligner",strikeout:"Barrer",underline:"Souligner",squiggly:"Ondulé",rectangle:"Rectangle",circle:"Cercle",line:"Ligne",arrow:"Flèche",polygon:"Polygone",polyline:"Polyligne",ink:"Encre",stamp:"Tampon",freeText:"Texte libre",square:"Carré",styles:"Styles de {type}",defaults:"Valeurs par défaut de {type}",color:"Couleur",opacity:"Opacité",blendMode:"Mode de fusion",strokeWidth:"Épaisseur du trait",strokeColor:"Couleur du trait",borderStyle:"Style de bordure",fillColor:"Couleur de remplissage",fontSize:"Taille de police",fontFamily:"Police",textAlign:"Alignement du texte",verticalAlign:"Alignement vertical",lineEnding:"Fin de ligne",lineStart:"Début de ligne",lineEnd:"Fin de ligne",font:"Police",fontColor:"Couleur du texte",backgroundColor:"Couleur de fond",noStyles:"Il n'y a pas de styles pour cette annotation.",noStylesStamp:"Il n'y a pas de styles pour les tampons.",selectAnnotation:"Sélectionnez une annotation pour voir les styles",deleteSelected:"Supprimer l'annotation sélectionnée",moreTools:"Plus d'outils"},redaction:{area:"Caviarder la zone",text:"Caviarder le texte",applyAll:"Tout appliquer",clearAll:"Tout effacer"},history:{undo:"Annuler",redo:"Refaire"},comments:{page:"Page {page}",commentCount:"{count} commentaire",commentCountPlural:"{count} commentaires",addComment:"Ajouter un commentaire...",addReply:"Ajouter une réponse...",save:"Enregistrer",cancel:"Annuler",edit:"Modifier",delete:"Supprimer",showMore:"plus",showLess:"moins",emptyState:"Ajoutez des annotations pour pouvoir les commenter."},blendMode:{normal:"Normal",multiply:"Produit",screen:"Superposition",overlay:"Incrustation",darken:"Obscurcir",lighten:"Éclaircir",colorDodge:"Densité couleur -",colorBurn:"Densité couleur +",hardLight:"Lumière crue",softLight:"Lumière tamisée",difference:"Différence",exclusion:"Exclusion",hue:"Teinte",saturation:"Saturation",color:"Couleur",luminosity:"Luminosité"}}},{code:"es",name:"Español",translations:{search:{placeholder:"Buscar",caseSensitive:"Distinguir mayúsculas",wholeWord:"Palabra completa",resultsFound:"{count} resultados encontrados",page:"Página {page}"},zoom:{in:"Acercar",out:"Alejar",fitWidth:"Ajustar al ancho",fitPage:"Ajustar a la página",marquee:"Zoom de selección",menu:"Menú de zoom",level:"Nivel de zoom ({level}%)"},pan:{toggle:"Alternar modo desplazamiento"},pointer:{toggle:"Alternar modo puntero"},capture:{screenshot:"Captura de pantalla"},document:{menu:"Menú del documento",open:"Abrir",close:"Cerrar",print:"Imprimir",export:"Exportar",fullscreen:"Pantalla completa",loading:"Cargando documento..."},emptyState:{title:"No hay documentos abiertos",description:"Abra un documento PDF para comenzar.",descriptionMulti:"Puede ver varios documentos usando pestañas.",openButton:"Abrir documento",supportedFormats:"Formato compatible: PDF"},passwordPrompt:{title:"Contraseña requerida",required:"Este documento está protegido con contraseña. Por favor, ingrese la contraseña para abrirlo.",incorrect:"La contraseña ingresada es incorrecta. Por favor, inténtelo de nuevo.",incorrectWarning:"Contraseña incorrecta. Por favor, verifique e inténtelo de nuevo.",label:"Contraseña",placeholder:"Ingrese la contraseña del documento",open:"Abrir",opening:"Abriendo...",cancel:"Cancelar",close:"Cerrar"},documentError:{title:"Error al cargar el documento",unknown:"Ha ocurrido un error desconocido",errorCode:"Código de error: {code}",close:"Cerrar documento"},panel:{sidebar:"Barra lateral",search:"Buscar",comment:"Comentario",thumbnails:"Miniaturas",outline:"Esquema",annotationStyle:"Estilo de anotación"},menu:{viewControls:"Controles de vista",zoomControls:"Controles de zoom",moreOptions:"Más opciones"},outline:{title:"Esquema",loading:"Cargando esquema...",noOutline:"No hay esquema disponible",noBookmarks:"Este documento no contiene marcadores"},page:{settings:"Configuración de página",single:"Página única",twoOdd:"Dos páginas (Impar)",twoEven:"Dos páginas (Par)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Modo de doble página",scrollLayout:"Diseño de desplazamiento",rotation:"Rotación de página",next:"Página siguiente",previous:"Página anterior"},rotate:{clockwise:"Rotar en sentido horario",counterClockwise:"Rotar en sentido antihorario"},selection:{copy:"Copiar selección"},mode:{view:"Ver",annotate:"Anotar",shapes:"Formas",redact:"Redactar"},annotation:{text:"Texto",highlight:"Resaltar",strikeout:"Tachar",underline:"Subrayar",squiggly:"Ondulado",rectangle:"Rectángulo",circle:"Círculo",line:"Línea",arrow:"Flecha",polygon:"Polígono",polyline:"Polilínea",ink:"Tinta",stamp:"Sello",freeText:"Texto libre",square:"Cuadrado",styles:"Estilos de {type}",defaults:"Valores predeterminados de {type}",color:"Color",opacity:"Opacidad",blendMode:"Modo de fusión",strokeWidth:"Grosor del trazo",strokeColor:"Color del trazo",borderStyle:"Estilo del borde",fillColor:"Color de relleno",fontSize:"Tamaño de fuente",fontFamily:"Fuente",textAlign:"Alineación del texto",verticalAlign:"Alineación vertical",lineEnding:"Final de línea",lineStart:"Inicio de línea",lineEnd:"Final de línea",font:"Fuente",fontColor:"Color de fuente",backgroundColor:"Color de fondo",noStyles:"No hay estilos para esta anotación.",noStylesStamp:"No hay estilos para los sellos.",selectAnnotation:"Seleccione una anotación para ver los estilos",deleteSelected:"Eliminar anotación seleccionada",moreTools:"Más herramientas"},redaction:{area:"Redactar área",text:"Redactar texto",applyAll:"Aplicar todo",clearAll:"Borrar todo"},history:{undo:"Deshacer",redo:"Rehacer"},comments:{page:"Página {page}",commentCount:"{count} comentario",commentCountPlural:"{count} comentarios",addComment:"Añadir comentario...",addReply:"Añadir respuesta...",save:"Guardar",cancel:"Cancelar",edit:"Editar",delete:"Eliminar",showMore:"más",showLess:"menos",emptyState:"Añada anotaciones para poder comentarlas."},blendMode:{normal:"Normal",multiply:"Multiplicar",screen:"Trama",overlay:"Superponer",darken:"Oscurecer",lighten:"Aclarar",colorDodge:"Sobreexponer color",colorBurn:"Subexponer color",hardLight:"Luz fuerte",softLight:"Luz suave",difference:"Diferencia",exclusion:"Exclusión",hue:"Tono",saturation:"Saturación",color:"Color",luminosity:"Luminosidad"}}}],paramResolvers:{"zoom.level":function(e){var t,n,o=e.state,i=e.documentId,r=i&&null!==(t=null===(n=o.plugins[va])||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.currentZoomLevel)&&void 0!==t?t:1;return{level:Math.round(100*r)}}}},ui:{schema:{id:"pdf-viewer-ui",version:"1.0.0",toolbars:{"main-toolbar":{id:"main-toolbar",position:{placement:"top",slot:"main",order:0},permanent:!0,responsive:{localeOverrides:{groups:[{id:"germanic-languages",locales:["de","nl"],breakpoints:{md:{replaceShow:["view-mode","annotate-mode","zoom-toolbar","pan-button","pointer-button","divider-3","overflow-tabs-button"]}}}]},breakpoints:{xxxs:{maxWidth:400,hide:["annotate-mode","view-mode","shapes-mode","redact-mode","zoom-toolbar","pan-button","pointer-button","divider-3","page-settings-button","zoom-menu-button","divider-2","overflow-tabs-button"],show:["mode-select-button"]},xxs:{minWidth:400,show:["page-settings-button","zoom-menu-button","divider-2"],hide:["overflow-left-action-menu-button"]},xs:{minWidth:500,maxWidth:640,show:["pan-button","pointer-button","divider-3"]},sm:{minWidth:640,maxWidth:768,hide:["shapes-mode","redact-mode","zoom-toolbar","mode-select-button"],show:["view-mode","annotate-mode","overflow-tabs-button","pan-button","pointer-button","divider-3"]},md:{minWidth:768,show:["view-mode","annotate-mode","shapes-mode","zoom-toolbar","pan-button","pointer-button","divider-3","overflow-tabs-button"],hide:["zoom-menu-button","mode-select-button"]},lg:{minWidth:1024,show:["shapes-mode","redact-mode"],hide:["overflow-tabs-button"]}}},items:[{type:"group",id:"left-group",alignment:"start",gap:2,items:[{type:"command-button",id:"document-menu-button",commandId:"document:menu",variant:"icon",categories:["document","document-menu"]},{type:"divider",id:"divider-1",orientation:"vertical"},{type:"command-button",id:"sidebar-button",commandId:"panel:toggle-sidebar",variant:"icon",categories:["panel","panel-sidebar"]},{type:"command-button",id:"overflow-left-action-menu-button",commandId:"left-action-menu:overflow-menu",variant:"icon",categories:["ui","ui-menu"]},{type:"command-button",id:"page-settings-button",commandId:"page:settings",variant:"icon",categories:["page","page-settings"]}]},{type:"divider",id:"divider-2",orientation:"vertical"},{type:"group",id:"center-group",alignment:"center",gap:2,items:[{type:"command-button",id:"zoom-menu-button",commandId:"zoom:toggle-menu-mobile",variant:"icon",categories:["zoom","zoom-menu"]},{type:"custom",id:"zoom-toolbar",componentId:"zoom-toolbar",categories:["zoom"]},{type:"divider",id:"divider-3",orientation:"vertical",visibilityDependsOn:{itemIds:["zoom-toolbar","zoom-menu-button"]}},{type:"command-button",id:"pan-button",commandId:"pan:toggle",variant:"icon",categories:["tools","pan"]},{type:"command-button",id:"pointer-button",commandId:"pointer:toggle",variant:"icon",categories:["tools","pointer"]}]},{type:"spacer",id:"spacer-1",flex:!0},{type:"custom",id:"mode-select-button",componentId:"mode-select-button",categories:["mode"],visibilityDependsOn:{menuId:"mode-tabs-overflow-menu"}},{type:"tab-group",id:"mode-tabs",tabs:[{id:"view-mode",commandId:"mode:view",variant:"text",categories:["mode","mode-view"],visibilityDependsOn:{itemIds:["annotate-mode","shapes-mode","redact-mode"]}},{id:"annotate-mode",commandId:"mode:annotate",variant:"text",categories:["mode","mode-annotate","annotation"]},{id:"shapes-mode",commandId:"mode:shapes",variant:"text",categories:["mode","mode-shapes","annotation"]},{id:"redact-mode",commandId:"mode:redact",variant:"text",categories:["mode","mode-redact","redaction"]},{id:"overflow-tabs-button",commandId:"tabs:overflow-menu",variant:"icon",categories:["ui","ui-menu"],visibilityDependsOn:{menuId:"mode-tabs-overflow-menu"}}]},{type:"spacer",id:"spacer-2",flex:!0},{type:"group",id:"right-group",alignment:"end",gap:2,items:[{type:"command-button",id:"search-button",commandId:"panel:toggle-search",variant:"icon",categories:["panel","panel-search"]},{type:"command-button",id:"comment-button",commandId:"panel:toggle-comment",variant:"icon",categories:["panel","panel-comment"]}]}]},"annotation-toolbar":{id:"annotation-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-text","add-stamp"],show:["overflow-annotation-tools"]},md:{minWidth:640,hide:["overflow-annotation-tools"],show:["add-text","add-stamp"]}}},permanent:!1,categories:["annotation"],items:[{type:"spacer",id:"spacer-3",flex:!0},{type:"group",id:"annotation-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-highlight",commandId:"annotation:add-highlight",variant:"icon",categories:["annotation","annotation-markup","annotation-highlight"]},{type:"command-button",id:"add-strikeout",commandId:"annotation:add-strikeout",variant:"icon",categories:["annotation","annotation-markup","annotation-strikeout"]},{type:"command-button",id:"add-underline",commandId:"annotation:add-underline",variant:"icon",categories:["annotation","annotation-markup","annotation-underline"]},{type:"command-button",id:"add-ink",commandId:"annotation:add-ink",variant:"icon",categories:["annotation","annotation-ink"]},{type:"command-button",id:"add-text",commandId:"annotation:add-text",variant:"icon",categories:["annotation","annotation-text"]},{type:"command-button",id:"add-stamp",commandId:"annotation:add-stamp",variant:"icon",categories:["annotation","annotation-stamp"]},{type:"command-button",id:"overflow-annotation-tools",commandId:"annotation:overflow-tools",variant:"icon",categories:["annotation","annotation-overflow"]},{type:"divider",id:"annotation-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"annotation-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-4",flex:!0}]},"shapes-toolbar":{id:"shapes-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-polygon","add-polyline"],show:["overflow-shapes-tools"]},md:{minWidth:640,hide:["overflow-shapes-tools"],show:["add-polygon","add-polyline"]}}},permanent:!1,categories:["annotation","annotation-shape"],items:[{type:"spacer",id:"spacer-5",flex:!0},{type:"group",id:"shapes-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-rectangle",commandId:"annotation:add-rectangle",variant:"icon",categories:["annotation","annotation-shape","annotation-rectangle"]},{type:"command-button",id:"add-circle",commandId:"annotation:add-circle",variant:"icon",categories:["annotation","annotation-shape","annotation-circle"]},{type:"command-button",id:"add-line",commandId:"annotation:add-line",variant:"icon",categories:["annotation","annotation-shape","annotation-line"]},{type:"command-button",id:"add-arrow",commandId:"annotation:add-arrow",variant:"icon",categories:["annotation","annotation-shape","annotation-arrow"]},{type:"command-button",id:"add-polygon",commandId:"annotation:add-polygon",variant:"icon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command-button",id:"add-polyline",commandId:"annotation:add-polyline",variant:"icon",categories:["annotation","annotation-shape","annotation-polyline"]},{type:"command-button",id:"overflow-shapes-tools",commandId:"annotation:overflow-shapes",variant:"icon",categories:["annotation","annotation-shape","annotation-overflow"]},{type:"divider",id:"shapes-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"shapes-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-6",flex:!0}]},"redaction-toolbar":{id:"redaction-toolbar",position:{placement:"top",slot:"secondary",order:0},permanent:!1,categories:["redaction"],items:[{type:"spacer",id:"spacer-7",flex:!0},{type:"group",id:"redaction-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]},{type:"command-button",id:"redact-area",commandId:"redaction:redact-area",variant:"icon",categories:["redaction","redaction-area"]},{type:"divider",id:"divider-5",orientation:"vertical"},{type:"command-button",id:"apply-redactions",commandId:"redaction:apply-all",variant:"icon",categories:["redaction","redaction-apply"]},{type:"command-button",id:"clear-redactions",commandId:"redaction:clear-all",variant:"icon",categories:["redaction","redaction-clear"]}]},{type:"spacer",id:"spacer-8",flex:!0}]}},menus:{"left-action-menu":{id:"left-action-menu",categories:["ui"],items:[{type:"submenu",id:"page-settings-submenu",labelKey:"menu.viewControls",label:"View Controls",icon:"viewSettings",menuId:"page-settings-menu",categories:["page"]},{type:"submenu",id:"zoom-submenu",labelKey:"menu.zoomControls",label:"Zoom Controls",icon:"zoomIn",menuId:"zoom-menu",categories:["zoom"]},{type:"divider",id:"divider-15"},{type:"command",id:"pan-button-menu",commandId:"pan:toggle",categories:["tools","pan"]},{type:"command",id:"pointer-button-menu",commandId:"pointer:toggle",categories:["tools","pointer"]}]},"mode-tabs-overflow-menu":{id:"mode-tabs-overflow-menu",items:[{type:"command",id:"mode:view",commandId:"mode:view",categories:["mode","mode-view"]},{type:"command",id:"mode:annotate",commandId:"mode:annotate",categories:["mode","mode-annotate","annotation"]},{type:"command",id:"mode:shapes",commandId:"mode:shapes",categories:["mode","mode-shapes","annotation"]},{type:"command",id:"mode:redact",commandId:"mode:redact",categories:["mode","mode-redact","redaction"]}],responsive:{breakpoints:{xs:{maxWidth:640,show:["mode:view","mode:annotate","mode:shapes","mode:redact"]},sm:{minWidth:640,maxWidth:768,hide:["mode:view","mode:annotate"]},md:{minWidth:768,hide:["mode:view","mode:annotate","mode:shapes"]}},localeOverrides:{groups:[{id:"germanic-languages",locales:["de","nl"],breakpoints:{md:{replaceHide:["mode:view","mode:annotate"]}}}]}}},"zoom-levels-menu":{id:"zoom-levels-menu",categories:["zoom","zoom-level"],items:[{type:"command",id:"zoom-levels-menu:25",commandId:"zoom:25",categories:["zoom","zoom-level","zoom-level-25"]},{type:"command",id:"zoom-levels-menu:50",commandId:"zoom:50",categories:["zoom","zoom-level","zoom-level-50"]},{type:"command",id:"zoom-levels-menu:100",commandId:"zoom:100",categories:["zoom","zoom-level","zoom-level-100"]},{type:"command",id:"zoom-levels-menu:125",commandId:"zoom:125",categories:["zoom","zoom-level","zoom-level-125"]},{type:"command",id:"zoom-levels-menu:150",commandId:"zoom:150",categories:["zoom","zoom-level","zoom-level-150"]},{type:"command",id:"zoom-levels-menu:200",commandId:"zoom:200",categories:["zoom","zoom-level","zoom-level-200"]},{type:"command",id:"zoom-levels-menu:400",commandId:"zoom:400",categories:["zoom","zoom-level","zoom-level-400"]},{type:"command",id:"zoom-levels-menu:800",commandId:"zoom:800",categories:["zoom","zoom-level","zoom-level-800"]},{type:"command",id:"zoom-levels-menu:1600",commandId:"zoom:1600",categories:["zoom","zoom-level","zoom-level-1600"]}]},"zoom-menu":{id:"zoom-menu",categories:["zoom"],items:[{type:"command",id:"zoom-menu:25",commandId:"zoom:25",categories:["zoom","zoom-level","zoom-level-25"]},{type:"command",id:"zoom-menu:50",commandId:"zoom:50",categories:["zoom","zoom-level","zoom-level-50"]},{type:"command",id:"zoom-menu:100",commandId:"zoom:100",categories:["zoom","zoom-level","zoom-level-100"]},{type:"command",id:"zoom-menu:125",commandId:"zoom:125",categories:["zoom","zoom-level","zoom-level-125"]},{type:"command",id:"zoom-menu:150",commandId:"zoom:150",categories:["zoom","zoom-level","zoom-level-150"]},{type:"command",id:"zoom-menu:200",commandId:"zoom:200",categories:["zoom","zoom-level","zoom-level-200"]},{type:"command",id:"zoom-menu:400",commandId:"zoom:400",categories:["zoom","zoom-level","zoom-level-400"]},{type:"command",id:"zoom-menu:800",commandId:"zoom:800",categories:["zoom","zoom-level","zoom-level-800"]},{type:"command",id:"zoom-menu:1600",commandId:"zoom:1600",categories:["zoom","zoom-level","zoom-level-1600"]},{type:"submenu",id:"zoom-levels-submenu",labelKey:"zoom.level",label:"Zoom Levels",menuId:"zoom-levels-menu",categories:["zoom","zoom-level"]},{type:"divider",id:"divider-zoom-in-out"},{type:"command",id:"zoom-menu:in",commandId:"zoom:in",categories:["zoom","zoom-in"]},{type:"command",id:"zoom-menu:out",commandId:"zoom:out",categories:["zoom","zoom-out"]},{type:"divider",id:"divider-8"},{type:"command",id:"zoom:fit-page",commandId:"zoom:fit-page",categories:["zoom","zoom-fit-page"]},{type:"command",id:"zoom:fit-width",commandId:"zoom:fit-width",categories:["zoom","zoom-fit-width"]},{type:"divider",id:"divider-9"},{type:"command",id:"zoom:marquee",commandId:"zoom:marquee",categories:["zoom","zoom-marquee"]}],responsive:{breakpoints:{xs:{maxWidth:640,show:["zoom-levels-submenu","divider-zoom-in-out"],hide:["zoom-menu:25","zoom-menu:50","zoom-menu:100","zoom-menu:125","zoom-menu:150","zoom-menu:200","zoom-menu:400","zoom-menu:800","zoom-menu:1600"]},md:{minWidth:768,show:["zoom-menu:25","zoom-menu:50","zoom-menu:100","zoom-menu:125","zoom-menu:150","zoom-menu:200","zoom-menu:400","zoom-menu:800","zoom-menu:1600"],hide:["zoom-levels-submenu","divider-zoom-in-out","zoom-menu:in","zoom-menu:out"]}}}},"document-menu":{id:"document-menu",categories:["document"],items:[{type:"command",id:"document:open",commandId:"document:open",categories:["document","document-open"]},{type:"command",id:"document:close",commandId:"document:close",categories:["document","document-close"]},{type:"divider",id:"divider-10"},{type:"command",id:"document:print",commandId:"document:print",categories:["document","document-print"]},{type:"command",id:"document:export",commandId:"document:export",categories:["document","document-export"]},{type:"divider",id:"divider-11",visibilityDependsOn:{itemIds:["document:export","document:print"]}},{type:"command",id:"document:fullscreen",commandId:"document:fullscreen",categories:["document","document-fullscreen"]}]},"annotation-tools-menu":{id:"annotation-tools-menu",categories:["annotation"],items:[{type:"command",id:"annotation:add-text",commandId:"annotation:add-text",categories:["annotation","annotation-text"]},{type:"command",id:"annotation:add-stamp",commandId:"annotation:add-stamp",categories:["annotation","annotation-stamp"]}]},"shapes-tools-menu":{id:"shapes-tools-menu",categories:["annotation","annotation-shape"],items:[{type:"command",id:"annotation:add-polygon",commandId:"annotation:add-polygon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command",id:"annotation:add-polyline",commandId:"annotation:add-polyline",categories:["annotation","annotation-shape","annotation-polyline"]}]},"page-settings-menu":{id:"page-settings-menu",categories:["page"],items:[{type:"section",id:"spread-mode-section",labelKey:"page.spreadMode",label:"Spread Mode",categories:["page","spread"],items:[{type:"command",id:"spread:none",commandId:"spread:none",categories:["page","spread","spread-none"]},{type:"command",id:"spread:odd",commandId:"spread:odd",categories:["page","spread","spread-odd"]},{type:"command",id:"spread:even",commandId:"spread:even",categories:["page","spread","spread-even"]}]},{type:"divider",id:"divider-13"},{type:"section",id:"scroll-layout-section",labelKey:"page.scrollLayout",label:"Scroll Layout",categories:["page","scroll"],items:[{type:"command",id:"scroll:vertical",commandId:"scroll:vertical",categories:["page","scroll","scroll-vertical"]},{type:"command",id:"scroll:horizontal",commandId:"scroll:horizontal",categories:["page","scroll","scroll-horizontal"]}]},{type:"divider",id:"divider-14"},{type:"section",id:"page-rotation-section",labelKey:"page.rotation",label:"Page Rotation",categories:["page","rotate"],items:[{type:"command",id:"rotate:clockwise",commandId:"rotate:clockwise",categories:["page","rotate","rotate-clockwise"]},{type:"command",id:"rotate:counter-clockwise",commandId:"rotate:counter-clockwise",categories:["page","rotate","rotate-counter-clockwise"]}]},{type:"divider",id:"divider-15"},{type:"command",id:"document:fullscreen",commandId:"document:fullscreen",categories:["document","document-fullscreen"]}]}},sidebars:{"sidebar-panel":{id:"sidebar-panel",position:{placement:"left",slot:"main",order:0},content:{type:"tabs",tabs:[{id:"thumbnails",labelKey:"panel.thumbnails",label:"Thumbnails",icon:"squares",componentId:"thumbnails-sidebar"},{id:"outline",labelKey:"panel.outline",label:"Outline",icon:"listTree",componentId:"outline-sidebar"}]},width:"250px",collapsible:!0,defaultOpen:!1},"annotation-panel":{id:"annotation-panel",position:{placement:"left",slot:"main",order:0},content:{type:"component",componentId:"annotation-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"search-panel":{id:"search-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"search-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"comment-panel":{id:"comment-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"comment-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1}},modals:{"print-modal":{id:"print-modal",content:{type:"component",componentId:"print-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0}},overlays:{"page-controls":{id:"page-controls",position:{anchor:"bottom-center",offset:{bottom:"1.5rem"}},content:{type:"component",componentId:"page-controls"},defaultEnabled:!0}},selectionMenus:{annotation:{id:"annotation",categories:["annotation"],items:[{type:"command-button",id:"delete-annotation",commandId:"annotation:delete-selected",variant:"icon",categories:["annotation","annotation-delete"]},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"command-button",id:"comment-button",commandId:"panel:toggle-comment",variant:"icon",categories:["panel","panel-comment"]}]},redaction:{id:"redaction",categories:["redaction"],items:[{type:"command-button",id:"delete-redaction",commandId:"redaction:delete-selected",variant:"icon",categories:["redaction","redaction-delete"]},{type:"command-button",id:"commit-redaction",commandId:"redaction:commit-selected",variant:"icon",categories:["redaction","redaction-commit"]}]},selection:{id:"selection",visibilityDependsOn:{itemIds:["copy-selection","add-highlight","add-strikeout","add-underline","add-squiggly","redact-text"]},items:[{type:"command-button",id:"copy-selection",commandId:"selection:copy",variant:"icon",categories:["selection","selection-copy"]},{type:"command-button",id:"add-highlight",commandId:"annotation:add-highlight",variant:"icon",categories:["annotation","annotation-markup","annotation-highlight"]},{type:"command-button",id:"add-strikeout",commandId:"annotation:add-strikeout",variant:"icon",categories:["annotation","annotation-markup","annotation-strikeout"]},{type:"command-button",id:"add-underline",commandId:"annotation:add-underline",variant:"icon",categories:["annotation","annotation-markup","annotation-underline"]},{type:"command-button",id:"add-squiggly",commandId:"annotation:add-squiggly",variant:"icon",categories:["annotation","annotation-markup","annotation-squiggly"]},{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]}]}}}},viewport:{viewportGap:10},scroll:{defaultStrategy:Uo.Vertical},zoom:{defaultZoomLevel:ga.FitPage},spread:{defaultSpreadMode:ri.None},rotation:{defaultRotation:We.Degree0},pan:{},render:{defaultImageType:"image/png"},tiling:{tileSize:768,overlapPx:2.5,extraRings:0},thumbnails:{width:150,gap:10,buffer:3,labelHeight:30},annotations:{},search:{},selection:{},bookmarks:{},attachments:{},capture:{scale:2,imageType:"image/png"},redaction:{drawBlackBoxes:!0},print:{},export:{defaultFileName:"document.pdf"},fullscreen:{},history:{},interactionManager:{}};function Lf(e){var t=e.documentId,n=e.tabBarVisibility,o=void 0===n?"multiple":n,i=function(e){const t=Or(),{provides:n}=Ir(),o=null==n?void 0:n.getSchema(),i=Sr(e);return{renderToolbar:(r,a)=>{if(!o||!n||!i)return null;const s=`${r}-${a}`,l=i.activeToolbars[s];if(!l)return null;const c=o.toolbars[l.toolbarId];if(!c)return console.warn(`Toolbar "${l.toolbarId}" not found in schema`),null;const d=c.permanent?void 0:()=>{n.forDocument(e).closeToolbarSlot(r,a)};return Ue(t.toolbar,{schema:c,documentId:e,isOpen:l.isOpen,onClose:d},l.toolbarId)},renderSidebar:(r,a)=>{var s;if(!o||!n||!i)return null;const l=`${r}-${a}`,c=i.activeSidebars[l];if(!c)return null;const d=null==(s=o.sidebars)?void 0:s[c.sidebarId];return d?Ue(t.sidebar,{schema:d,documentId:e,isOpen:c.isOpen,onClose:()=>{n.forDocument(e).closeSidebarSlot(r,a)}},c.sidebarId):(console.warn(`Sidebar "${c.sidebarId}" not found in schema`),null)},renderModal:()=>{var r;if(!o||!n||!(null==i?void 0:i.activeModal))return null;const{modalId:a,isOpen:s}=i.activeModal,l=null==(r=o.modals)?void 0:r[a];if(!l)return console.warn(`Modal "${a}" not found in schema`),null;const c=t.modal;return c?Ue(c,{schema:l,documentId:e,isOpen:s,onClose:()=>{n.forDocument(e).closeModal()},onExited:()=>{n.forDocument(e).clearModal()}},a):(console.warn("No modal renderer registered"),null)},getActiveToolbars:()=>i?Object.entries(i.activeToolbars).map(([e,t])=>{const[n,o]=e.split("-");return{placement:n,slot:o,toolbarId:t.toolbarId,isOpen:t.isOpen}}):[],getActiveSidebars:()=>i?Object.entries(i.activeSidebars).map(([e,t])=>{const[n,o]=e.split("-");return{placement:n,slot:o,sidebarId:t.sidebarId,isOpen:t.isOpen}}):[],renderOverlays:()=>{if(!(null==o?void 0:o.overlays)||!n)return null;const i=t.overlay;if(!i)return null;const r=Object.values(o.overlays);return 0===r.length?null:Ue(U,{children:r.map(t=>Ue(i,{schema:t,documentId:e},t.id))})}}}(t),r=i.renderToolbar,a=i.renderSidebar,s=i.renderModal,l=i.renderOverlays,c=ma(t).translate,d=Lr("selection",t),u=Lr("annotation",t),h=Lr("redaction",t),m=(e=>{const t=vo();return Te(()=>t?t.documentOrder.map(e=>t.documents[e]).filter(e=>null!=e):[],[t,e])})(),g=(()=>{const e=vo();return Te(()=>{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})();return j(U,null,j(Ef,{documentStates:m,activeDocumentId:g.activeDocumentId,visibility:o}),r("top","main"),r("top","secondary"),j("div",{id:"document-content",className:"bg-bg-surface flex flex-1 overflow-hidden"},a("left","main"),j("div",{className:"flex-1 overflow-hidden"},j(Br,{documentId:t},function(e){var n=e.documentState,o=e.isLoading,i=e.isError,r=e.isLoaded;return j(U,null,o&&j("div",{className:"flex h-full items-center justify-center"},j(Mv,{size:"lg",text:c("document.loading")})),i&&j(Rf,{documentState:n}),r&&j("div",{className:"relative h-full w-full"},j(Sd,{documentId:t},j(Ho,{className:"bg-bg-app",documentId:t},j(Ta,{documentId:t},j(ii,{documentId:t,renderPage:function(e){var n=e.pageIndex;return j(Ga,{documentId:t,pageIndex:n,style:{backgroundColor:"#fff"}},j(kd,{documentId:t,pageIndex:n},j(Oa,{documentId:t,pageIndex:n,scale:.5,style:{pointerEvents:"none"}}),j(gl,{documentId:t,pageIndex:n,style:{pointerEvents:"none"}}),j(gs,{documentId:t,pageIndex:n}),j(za,{documentId:t,pageIndex:n}),j(Ru,{documentId:t,pageIndex:n}),j(Xs,{documentId:t,pageIndex:n,selectionMenu:d}),j(fh,{documentId:t,pageIndex:n,selectionMenu:h}),j(Vd,{documentId:t,pageIndex:n,selectionMenu:u}),j(Tv,null)))}})))),l()))})),a("right","main")),s())}var $f=new dt([new st,new ct]);function Ff(e){var t,o=e.config,i=e.onRegistryReady,r=function(e){const{wasmUrl:t=yo,worker:n=!0,logger:o,encoderPoolSize:i}=e??{},[r,a]=ke(null),[s,l]=ke(!0),[c,d]=ke(null),u=Ae(null);return Me(()=>{let e=!1;return(async()=>{try{const{createPdfiumEngine:e}=n?await import("./worker-engine-B0hxfFhz.js"):await import("./direct-engine-r7QVTV0h.js"),r=await e(t,{logger:o,encoderPoolSize:i});u.current=r,a(r),l(!1)}catch(t){e||(d(t),l(!1))}})(),()=>{var t,n;e=!0,null==(n=null==(t=u.current)?void 0:t.closeAllDocuments)||n.call(t).wait(()=>{var e,t;null==(t=null==(e=u.current)?void 0:e.destroy)||t.call(e),u.current=null},wn)}},[t,n,o]),{engine:r,isLoading:s,error:c}}(h(h({},o.wasmUrl&&{wasmUrl:o.wasmUrl}),{},{worker:o.worker,logger:o.log?$f:void 0})),a=r.engine,s=r.isLoading,l=Te(function(){return{"thumbnails-sidebar":xv,"annotation-sidebar":yf,"zoom-toolbar":qv,"search-sidebar":kv,"outline-sidebar":Dv,"comment-sidebar":Bv,"print-modal":If,"page-controls":Sf,"mode-select-button":Nf}},[]),c=Te(function(){return{toolbar:Dp,sidebar:dv,modal:wv,overlay:xf,menu:mv,selectionMenu:bf}},[]);return j(U,null,j("style",null,je),!a||s?j("div",{className:"flex h-full w-full items-center justify-center"},j(Mv,{size:"lg",text:"Initializing PDF engine..."})):j(mo,{logger:o.log?$f:void 0,onInitialized:(t=n(g().m(function e(t){return g().w(function(e){for(;;)switch(e.n){case 0:i&&t&&i(t);case 1:return e.a(2)}},e)})),function(e){return t.apply(this,arguments)}),engine:a,plugins:[Zn(Gr,h(h(h({},Of.documentManager),o.src&&{initialDocuments:[{url:o.src}]}),o.documentManager)),Zn(na,h(h(h({},Of.commands),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.commands)),Zn(ha,h(h({},Of.i18n),o.i18n)),Zn(Cr,h(h(h({},Of.ui),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.ui)),Zn(Lo,h(h({},Of.viewport),o.viewport)),Zn(ti,h(h({},Of.scroll),o.scroll)),Zn(Da,h(h({},Of.zoom),o.zoom)),Zn(vi,h(h({},Of.spread),o.spread)),Zn(qa,h(h({},Of.rotation),o.rotation)),Zn(Iu,h(h({},Of.pan),o.pan)),Zn(Na,h(h({},Of.render),o.render)),Zn(ul,h(h({},Of.tiling),o.tiling)),Zn(Dl,h(h({},Of.thumbnails),o.thumbnails)),Zn(Kc,h(h({},Of.annotations),o.annotations)),Zn(hs,h(h({},Of.search),o.search)),Zn(Qs,h(h({},Of.selection),o.selection)),Zn(hu,h(h({},Of.bookmarks),o.bookmarks)),Zn(xh,h(h({},Of.attachments),o.attachments)),Zn(_u,h(h({},Of.capture),o.capture)),Zn(uh,h(h({},Of.redaction),o.redaction)),Zn(Jd,h(h({},Of.print),o.print)),Zn(vu,h(h({},Of.export),o.export)),Zn(su,h(h({},Of.fullscreen),o.fullscreen)),Zn(Bu,h(h({},Of.history),o.history)),Zn(fd,h(h({},Of.interactionManager),o.interactionManager))]},function(e){var t=e.pluginsReady,n=e.activeDocumentId;return j(U,null,t?j(U,null,n?j(jr,{documentId:n,components:l,renderers:c,className:"relative flex h-full w-full select-none flex-col"},j(Lf,{documentId:n,tabBarVisibility:o.tabBar})):j(_f,null)):j("div",{className:"flex h-full items-center justify-center"},j(Mv,{size:"lg",text:"Initializing plugins..."})))}))}var jf="undefined"!=typeof HTMLElement?HTMLElement:r(function e(){i(this,e)}),Hf=function(){function e(){var t;return i(this,e),s(t=o(this,e),"_resolveRegistry",null),s(t,"themeStyleEl",null),s(t,"systemPreferenceCleanup",null),s(t,"handleRegistryReady",function(e){t._resolveRegistry&&(t._resolveRegistry(e),t._resolveRegistry=null)}),t.root=t.attachShadow({mode:"open"}),t._registryPromise=new Promise(function(e){t._resolveRegistry=e}),t}return c(e,jf),r(e,[{key:"connectedCallback",value:function(){this._config||(this._config={src:this.getAttribute("src")||"/demo.pdf",worker:"false"!==this.getAttribute("worker"),theme:this.parseThemeAttribute()}),this.setupTheme(),this.renderViewer()}},{key:"disconnectedCallback",value:function(){var e;null===(e=this.systemPreferenceCleanup)||void 0===e||e.call(this),this.systemPreferenceCleanup=null}},{key:"parseThemeAttribute",value:function(){var e=this.getAttribute("theme");if(e)return["light","dark","system"].includes(e)?{preference:e}:void 0}},{key:"config",get:function(){return this._config},set:function(e){this._config=e,e.icons&&Zm(e.icons),this.isConnected&&(this.setupTheme(),this.renderViewer())}},{key:"registry",get:function(){return this._registryPromise}},{key:"themePreference",get:function(){var e;return(null===(e=this._config)||void 0===e||null===(e=e.theme)||void 0===e?void 0:e.preference)||"system"}},{key:"activeColorScheme",get:function(){return Af(this.themePreference)}},{key:"activeTheme",get:function(){return this.resolveActiveTheme()}},{key:"resolveActiveTheme",value:function(){var e,t,n,o=null===(e=this._config)||void 0===e?void 0:e.theme,i=Af((null==o?void 0:o.preference)||"system"),r="dark"===i?Df:kf,a=null==o?void 0:o[i];return n=r,(t=a)?Pf(n,t):n}},{key:"setupTheme",value:function(){var e,t,n=this;null===(e=this.systemPreferenceCleanup)||void 0===e||e.call(this),this.systemPreferenceCleanup=null,"system"===((null===(t=this._config)||void 0===t||null===(t=t.theme)||void 0===t?void 0:t.preference)||"system")&&(this.systemPreferenceCleanup=function(e){if("undefined"==typeof window)return function(){};var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(t){return e(t.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}(function(e){n.injectTheme(),n.dispatchEvent(new CustomEvent("themechange",{detail:{preference:"system",colorScheme:e,theme:n.activeTheme},bubbles:!0}))})),this.injectTheme()}},{key:"injectTheme",value:function(){var e=zf(this.resolveActiveTheme()),t=this.root.querySelector("style[data-embedpdf-theme]");t||((t=document.createElement("style")).setAttribute("data-embedpdf-theme",""),this.root.appendChild(t)),this.themeStyleEl=t,this.themeStyleEl.textContent=e,this.setAttribute("data-color-scheme",this.activeColorScheme)}},{key:"setTheme",value:function(e){this._config&&(this._config.theme="string"==typeof e?h(h({},this._config.theme),{},{preference:e}):h(h({},this._config.theme),e),this.setupTheme(),this.dispatchEvent(new CustomEvent("themechange",{detail:{preference:this.themePreference,colorScheme:this.activeColorScheme,theme:this.activeTheme},bubbles:!0})))}},{key:"registerIcon",value:function(e,t){Vm(e,t)}},{key:"registerIcons",value:function(e){Zm(e)}},{key:"renderViewer",value:function(){this._config&&(ce(j(Ff,{config:this._config,onRegistryReady:this.handleRegistryReady}),this.root),this.injectTheme())}}])}(),Uf=["type","target"],Wf="2.0.1";"undefined"==typeof customElements||customElements.get("embedpdf-container")||customElements.define("embedpdf-container",Hf);var Bf={version:Wf,init:function(e){if("container"===e.type)return function(e){e.type,e.target;var t=m(e,Uf),n=document.createElement("embedpdf-container");return n.config=t,e.target.appendChild(n),n}(e)}};export{Us as $,Mt as A,ot as B,rt as C,yt as D,kt as E,Gt as F,$t as G,bn as H,Wf as I,Hf as J,Bf as K,Uo as L,hi as M,at as N,ri as O,Ht as P,ga as Q,We as R,Jo as S,gt as T,Wa as U,Oo as V,dl as W,kl as X,Wc as Y,ka as Z,ds as _,Ut as a,Eu as a0,ch as a1,qu as a2,pr as a3,da as a4,Qr as a5,Ur as a6,Xd as a7,iu as a8,uu as a9,gu as aa,xu as ab,Hu as ac,bh as ad,_a as ae,hd as af,wn as ag,kf as ah,Df as ai,Pf as aj,Vm as ak,Zm as al,Dt as b,jt as c,ft as d,Pt as e,Et as f,zt as g,At as h,fn as i,St as j,bt as k,Wt as l,qt as m,Zt as n,wt as o,Vt as p,Ke as q,Ye as r,pn as s,_t as t,yn as u,Ot as v,Bt as w,Lt as x,Tt as y,Ge as z};