@embedpdf/snippet 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{browser-awZxztMA-DP8ttsSz.js → browser-awZxztMA-RDxqV2Sx.js} +1 -1
- package/dist/components/annotation-sidebar/dynamic-sidebar.d.ts +14 -0
- package/dist/components/annotation-sidebar/dynamic-sidebar.d.ts.map +1 -0
- package/dist/components/annotation-sidebar/property-schema.d.ts +41 -0
- package/dist/components/annotation-sidebar/property-schema.d.ts.map +1 -0
- package/dist/components/annotation-sidebar/property-sections.d.ts +12 -0
- package/dist/components/annotation-sidebar/property-sections.d.ts.map +1 -0
- package/dist/components/annotation-sidebar.d.ts.map +1 -1
- package/dist/components/app.d.ts.map +1 -1
- package/dist/components/icons/external-link.d.ts +3 -0
- package/dist/components/icons/external-link.d.ts.map +1 -0
- package/dist/components/icons/group.d.ts +4 -0
- package/dist/components/icons/group.d.ts.map +1 -0
- package/dist/components/icons/index.d.ts.map +1 -1
- package/dist/components/icons/link-off.d.ts +4 -0
- package/dist/components/icons/link-off.d.ts.map +1 -0
- package/dist/components/icons/link.d.ts +4 -0
- package/dist/components/icons/link.d.ts.map +1 -0
- package/dist/components/icons/marquee-select.d.ts +4 -0
- package/dist/components/icons/marquee-select.d.ts.map +1 -0
- package/dist/components/icons/ungroup.d.ts +4 -0
- package/dist/components/icons/ungroup.d.ts.map +1 -0
- package/dist/components/link-modal.d.ts +10 -0
- package/dist/components/link-modal.d.ts.map +1 -0
- package/dist/config/commands.d.ts.map +1 -1
- package/dist/config/translations.d.ts.map +1 -1
- package/dist/config/ui-schema.d.ts.map +1 -1
- package/dist/direct-engine-BDuzMUFV.js +1 -0
- package/dist/embedpdf-CE93i_Sd.js +3 -0
- package/dist/embedpdf.js +1 -1
- package/dist/pdfium.wasm +0 -0
- package/dist/ui/schema-selection-menu.d.ts.map +1 -1
- package/dist/worker-engine-D8W4P9zI.js +1 -0
- package/package.json +30 -30
- package/dist/components/annotation-sidebar/free-text-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/free-text-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/ink-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/ink-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/line-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/line-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/polygon-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/polygon-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/registry.d.ts +0 -20
- package/dist/components/annotation-sidebar/registry.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/shape-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/shape-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/stamp-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/stamp-sidebar.d.ts.map +0 -1
- package/dist/components/annotation-sidebar/text-markup-sidebar.d.ts +0 -5
- package/dist/components/annotation-sidebar/text-markup-sidebar.d.ts.map +0 -1
- package/dist/direct-engine-m4-HnUa2.js +0 -1
- package/dist/embedpdf-T0lTFeLi.js +0 -3
- package/dist/worker-engine-Ch3J8jLj.js +0 -1
|
@@ -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&&f(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 f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function v(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,k,S,P,M,D,A,z,T,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 U(e,a,o,i,null)}function U(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?++k:i,__i:-1,__u:0};return null==i&&null!=I.vnode&&I.vnode(r),r}function H(e){return e.children}function B(e,t){this.props=e,this.context=t}function W(e,t){if(null==t)return e.__?W(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?W(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)&&S.push(e)&&!V.__r++||P!=I.debounceRendering)&&((P=I.debounceRendering)||M)(V)}function V(){for(var e,t,n,o,i,r,a,s=1;S.length;)S.length>s&&S.sort(D),e=S.shift(),s=S.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?W(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 K(e,t,n,o,i,r,a,s,l,c,d){var u,h,m,g,p,f,v,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]=U(null,a,null,null,null):L(a)?a=e.__k[r]=U(H,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[r]=U(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,s=null,-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=W(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?_:y[m.__i]||_,m.__i=u,f=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),(v=!!(4&m.__u))||h.__k===m.__k?l=Z(m,l,e,v):"function"==typeof m.type&&void 0!==f?l=f:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=p,l}function Z(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=Z(i[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=W(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=z,e.addEventListener(t,r?E:T,r)):e.removeEventListener(t,r?E:T,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=z++;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,f,v,y,b,w,x,C,k,S,P,M,D=t.type;if(void 0!==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 D)try{if(v=t.props,y="prototype"in D&&D.prototype.render,b=(d=D.contextType)&&o[d.__c],w=d?b?b.props.value:d.__:o,n.__c?f=(u=t.__c=n.__c).__=u.__E:(y?t.__c=u=new D(v,w):(t.__c=u=new B(v,w),u.constructor=D,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!=D.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=$({},u.__s)),$(u.__s,D.getDerivedStateFromProps(v,u.__s))),m=u.props,g=u.state,u.__v=t,h)y&&null==D.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),y&&null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(y&&null==D.getDerivedStateFromProps&&v!==m&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(v,w),t.__v==n.__v||!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(v,u.__s,w)){for(t.__v!=n.__v&&(u.props=v,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(v,u.__s,w),y&&null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(m,g,p)})}if(u.context=w,u.props=v,u.__P=e,u.__e=!1,C=I.__r,k=0,y){for(u.state=u.__s,u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),S=0;S<u._sb.length;S++)u.__h.push(u._sb[S]);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&&++k<25);u.state=u.__s,null!=u.getChildContext&&(o=$($({},o),u.getChildContext())),y&&!h&&null!=u.getSnapshotBeforeUpdate&&(p=u.getSnapshotBeforeUpdate(m,g)),P=d,null!=d&&d.type===H&&null==d.key&&(P=ie(d.props.children)),s=K(e,L(P)?P:[P],t,n,o,i,r,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),f&&(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,f=n.props||_,v=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(v);e=document.createElementNS(i,y,v.is&&v),s&&(I.__m&&I.__m(t,r),s=!1),r=null}if(null==y)f===v||s&&e.data==v||(e.data=v);else{if(r=r&&C.call(e.childNodes),!s&&null!=r)for(f={},c=0;c<e.attributes.length;c++)f[(m=e.attributes[c]).name]=m.value;for(c in f)if(m=f[c],"children"==c);else if("dangerouslySetInnerHTML"==c)u=m;else if(!(c in v)){if("value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v)continue;J(e,c,null,m,i)}for(c in v)m=v[c],"children"==c?h=m:"dangerouslySetInnerHTML"==c?d=m:"value"==c?g=m:"checked"==c?p=m:s&&"function"!=typeof m||f[c]===m||J(e,c,m,f[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=""),K("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&&W(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!=f[c])&&J(e,c,g,f[c],i),c="checked",null!=p&&p!=e[c]&&J(e,c,p,f[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(H,null,[e]),o||_,_,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"+R++,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}},k=0,B.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))},B.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),G(this))},B.prototype.render=H,S=[],M="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,D=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,A=/(PointerCapture)$|Capture$/i,z=0,T=ee(!1),E=ee(!0),R=0;var ue,he,me,ge,pe=0,fe=[],ve=I,ye=ve.__b,be=ve.__r,we=ve.diffed,xe=ve.__c,Ce=ve.unmount,Ie=ve.__;function ke(e,t){ve.__h&&ve.__h(he,e,pe||t),pe=0;var n=he.__H||(he.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Se(e){return pe=1,Pe(Fe,e)}function Pe(e,t,n){var o=ke(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=ke(ue++,3);!ve.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__H.__h.push(n))}function De(e,t){var n=ke(ue++,4);!ve.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__h.push(n))}function Ae(e){return pe=5,ze(function(){return{current:e}},[])}function ze(e,t){var n=ke(ue++,7);return $e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Te(e,t){return pe=8,ze(function(){return e},t)}function Ee(e){var t=he.context[e.__c],n=ke(ue++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(he)),t.props.value):e.__}function Re(){for(var e;e=fe.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=[],ve.__e(t,e.__v)}}ve.__b=function(e){he=null,ye&&ye(e)},ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ie&&Ie(e,t)},ve.__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},ve.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==fe.push(t)&&ge===ve.requestAnimationFrame||((ge=ve.requestAnimationFrame)||Ne)(Re)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),me=he=null},ve.__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=[],ve.__e(n,e.__v)}}),xe&&xe(e,t)},ve.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&&ve.__e(t,n.__v))};var _e="function"==typeof requestAnimationFrame;function Ne(e){var t,n=function(){clearTimeout(o),_e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);_e&&(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-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-300: oklch(87.2% 0.01 258.338);\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-warning: var(--ep-state-warning);\n --color-state-warning-light: var(--ep-state-warning-light);\n --color-state-success: var(--ep-state-success);\n --color-state-success-light: var(--ep-state-success-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 .invisible {\n visibility: hidden;\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-2 {\n right: calc(var(--spacing) * 2);\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-1 {\n margin-top: calc(var(--spacing) * -1);\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-1 {\n margin-right: calc(var(--spacing) * -1);\n }\n .mr-1\\.5 {\n margin-right: calc(var(--spacing) * 1.5);\n }\n .mr-2 {\n margin-right: calc(var(--spacing) * 2);\n }\n .mr-3 {\n margin-right: calc(var(--spacing) * 3);\n }\n .mr-4 {\n margin-right: calc(var(--spacing) * 4);\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-\\[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-1 {\n grid-template-columns: repeat(1, minmax(0, 1fr));\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-5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 5) * 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-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-accent\\/10 {\n background-color: var(--color-accent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-accent) 10%, transparent);\n }\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-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 {\n background-color: var(--color-state-error);\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-state-success-light {\n background-color: var(--color-state-success-light);\n }\n .bg-state-warning-light {\n background-color: var(--color-state-warning-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 .pr-10 {\n padding-right: calc(var(--spacing) * 10);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\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-6 {\n padding-left: calc(var(--spacing) * 6);\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-state-error {\n color: var(--color-state-error);\n }\n .text-state-success {\n color: var(--color-state-success);\n }\n .text-state-warning {\n color: var(--color-state-warning);\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-accent {\n &:hover {\n @media (hover: hover) {\n border-color: var(--color-accent);\n }\n }\n }\n .hover\\:border-state-error {\n &:hover {\n @media (hover: hover) {\n border-color: var(--color-state-error);\n }\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-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-bg-surface {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-bg-surface);\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-interactive-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-interactive-hover);\n }\n }\n }\n .hover\\:bg-state-error-light {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-state-error-light);\n }\n }\n }\n .hover\\:bg-state-error\\/90 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-state-error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-state-error) 90%, transparent);\n }\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-state-error {\n &:focus {\n border-color: var(--color-state-error);\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 .sm\\:grid-cols-2 {\n @media (width >= 40rem) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\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\\:w-\\[32rem\\] {\n @media (width >= 48rem) {\n width: 32rem;\n }\n }\n .md\\:w-\\[36rem\\] {\n @media (width >= 48rem) {\n width: 36rem;\n }\n }\n .md\\:w-\\[48rem\\] {\n @media (width >= 48rem) {\n width: 48rem;\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',Ue=0;function He(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:--Ue,__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 Be=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(Be||{});function We(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:We(e.origin),size:qe(e.size)}}function Ve(e){const{width:t,height:n}=e;return{width:n,height:t}}function Ke(e,t,n){return{width:(e=t%2==0?e:Ve(e)).width*n,height:e.height*n}}function Ze(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)}const it={origin:{x:0,y:0},size:{width:0,height:0}};function rt(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 at(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 st{isEnabled(){return!1}debug(){}info(){}warn(){}error(){}perf(){}}class lt{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 ct{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 dt{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 ut{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 ht=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(ht||{});class mt extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError",this.reason=e}}class gt extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError",this.reason=e}}class pt{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 mt(e.reason)):t(new gt(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 pt;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 pt;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 pt;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=pt.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 ft=Object.freeze(["","","","\ufeff","",""]),vt=new RegExp(`[${ft.join("")}]`,"g");function yt(e){return e.replace(vt,"")}var bt=(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))(bt||{}),wt=(e=>(e[e.NotSet=0]="NotSet",e[e.True=1]="True",e[e.False=2]="False",e[e.Unknown=3]="Unknown",e))(wt||{}),xt=(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))(xt||{}),Ct=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(Ct||{}),It=(e=>(e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom",e))(It||{}),kt=(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))(kt||{}),St=(e=>(e[e.Contain=0]="Contain",e[e.Cover=1]="Cover",e[e.Stretch=2]="Stretch",e))(St||{}),Pt=(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))(Pt||{}),Mt=(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))(Mt||{}),Dt=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(Dt||{}),At=(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))(At||{}),zt=(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))(zt||{}),Tt=(e=>(e[e.Unknown=0]="Unknown",e[e.Reply=1]="Reply",e[e.Group=2]="Group",e))(Tt||{}),Et=(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))(Et||{}),Rt=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e))(Rt||{}),_t=(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))(_t||{}),Nt=(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))(Nt||{});const Ot=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),Lt=Object.entries(Ot).reduce((e,[t,n])=>(e[n]=Number(t),e),{});function $t(e){return Object.keys(Ot).filter(t=>0!==(e&t)).map(e=>Ot[e])}function Ft(e){return e.reduce((e,t)=>e|Lt[t],0)}var jt=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(jt||{}),Ut=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(Ut||{}),Ht=(e=>(e[e.Print=4]="Print",e[e.ModifyContents=8]="ModifyContents",e[e.CopyContents=16]="CopyContents",e[e.ModifyAnnotations=32]="ModifyAnnotations",e[e.FillForms=256]="FillForms",e[e.ExtractForAccessibility=512]="ExtractForAccessibility",e[e.AssembleDocument=1024]="AssembleDocument",e[e.PrintHighQuality=2048]="PrintHighQuality",e[e.AllowAll=3900]="AllowAll",e))(Ht||{});class Bt extends Error{constructor(e,t){const n=e.map(e=>Ht[e]).join(", ");super(`Permission denied. Required: ${n}`),this.requiredFlags=e,this.currentPermissions=t,this.name="PermissionDeniedError"}}var Wt=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(Wt||{}),qt=(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))(qt||{});class Gt{static create(){return new pt}static resolve(e){const t=new pt;return t.resolve(e),t}static reject(e){const t=new pt;return t.reject(e),t}static abort(e){const t=new pt;return t.reject(e),t}}function Vt(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 Kt(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 Zt(e){return(e=>Math.max(0,Math.min(255,e)))(e)/255}function Yt(e){return((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*e))}function Xt(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 Qt(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 Jt=Object.freeze([{id:Ct.Left,label:"Left",css:"left"},{id:Ct.Center,label:"Center",css:"center"},{id:Ct.Right,label:"Right",css:"right"}]),en=Jt.reduce((e,t)=>(e[t.id]=t,e),{});function tn(e){return function(e){return en[e]??en[Ct.Left]}(e).css}Jt.reduce((e,t)=>(e[t.css]=t.id,e),{}),Jt.map(e=>({value:e.id,label:e.label}));var nn=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(nn||{});const on=xt.Helvetica,rn={id:xt.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},an=Object.freeze([{id:xt.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:xt.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:'"Courier-Bold", Courier, monospace'},{id:xt.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:'"Courier-BoldOblique", Courier, monospace'},{id:xt.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:'"Courier-Oblique", Courier, monospace'},rn,{id:xt.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:'"Helvetica-Bold", Arial, sans-serif'},{id:xt.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:'"Helvetica-BoldOblique", Arial, sans-serif'},{id:xt.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:'"Helvetica-Oblique", Arial, sans-serif'},{id:xt.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:xt.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman Bold", Times, serif'},{id:xt.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman Bold Italic", Times, serif'},{id:xt.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman Italic", Times, serif'},{id:xt.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol"},{id:xt.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats"}]),sn=an.reduce((e,t)=>(e[t.id]=t,e),{}),ln=new Map;for(const e of an)ln.set(`${e.family}_${e.bold}_${e.italic}`,e.id);function cn(e){return sn[e]??rn}function dn(e){return cn(e).family}function un(e){return cn(e).bold}function hn(e){return cn(e).italic}function mn(e,{bold:t,italic:n}){return ln.get(`${e}_${t}_${n}`)??on}Object.values(nn).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e}));const gn=[...new Set(an.map(e=>e.family))];function pn(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 fn=Object.freeze([{id:kt.Normal,label:"Normal",css:"normal"},{id:kt.Multiply,label:"Multiply",css:"multiply"},{id:kt.Screen,label:"Screen",css:"screen"},{id:kt.Overlay,label:"Overlay",css:"overlay"},{id:kt.Darken,label:"Darken",css:"darken"},{id:kt.Lighten,label:"Lighten",css:"lighten"},{id:kt.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:kt.ColorBurn,label:"Color Burn",css:"color-burn"},{id:kt.HardLight,label:"Hard Light",css:"hard-light"},{id:kt.SoftLight,label:"Soft Light",css:"soft-light"},{id:kt.Difference,label:"Difference",css:"difference"},{id:kt.Exclusion,label:"Exclusion",css:"exclusion"},{id:kt.Hue,label:"Hue",css:"hue"},{id:kt.Saturation,label:"Saturation",css:"saturation"},{id:kt.Color,label:"Color",css:"color"},{id:kt.Luminosity,label:"Luminosity",css:"luminosity"}]),vn=fn.reduce((e,t)=>(e[t.id]=t,e),{});function yn(e){return function(e){return vn[e]??vn[kt.Normal]}(e).css}fn.reduce((e,t)=>(e[t.css]=t.id,e),{}),fn.map(e=>({value:e.id,label:e.label}));const bn=fn.map(e=>e.id);function wn(e){if(e instanceof st)return{type:"noop"};if(e instanceof lt)return{type:"console"};if(e instanceof dt)return{type:"perf"};if(e instanceof ct){const t=e;return{type:"level",config:{level:t.level,logger:wn(t.logger)}}}if(e instanceof ut){return{type:"all",config:{loggers:e.loggers.map(wn)}}}return{type:"noop"}}const xn=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Cn(e){return xn.test(e)}function In(){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 kn extends pt{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!==ht.Pending)return this.state.stage===ht.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!==ht.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===ht.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 kn({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 kn({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 kn(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new kn({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 Sn(){}class Pn{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 Mn extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class Dn extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class An extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class zn extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class Tn{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 En="START_LOADING_DOCUMENT",Rn="UPDATE_DOCUMENT_LOADING_PROGRESS",_n="SET_DOCUMENT_LOADED",Nn="SET_DOCUMENT_ERROR",On="RETRY_LOADING_DOCUMENT",Ln="CLOSE_DOCUMENT",$n="SET_ACTIVE_DOCUMENT",Fn="REORDER_DOCUMENTS",jn="MOVE_DOCUMENT",Un="UPDATE_DOCUMENT_SECURITY",Hn="REFRESH_PAGES",Bn="SET_SCALE",Wn="SET_ROTATION",qn=[En,Rn,_n,Ln,$n,Nn,On,"REFRESH_DOCUMENT",Hn,"SET_PAGES",Bn,Wn,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",Fn,jn,Un],Gn=(e,t,n,o,i,r,a)=>({type:En,payload:{documentId:e,name:t,scale:n,rotation:o,passwordProvided:i,autoActivate:r,permissions:a}}),Vn=(e,t)=>({type:Ln,payload:{documentId:e,nextActiveDocumentId:t}}),Kn=(e,t)=>({type:Hn,payload:{documentId:e,pageIndexes:t}}),Zn=(e,t)=>({type:Wn,payload:{rotation:e,documentId:t}});class Yn{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 Tn(this,e)}isCoreAction(e){return qn.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}}}Ht.Print,Ht.ModifyContents,Ht.CopyContents,Ht.ModifyAnnotations,Ht.FillForms,Ht.ExtractForAccessibility,Ht.AssembleDocument,Ht.PrintHighQuality;const Xn=[Ht.Print,Ht.ModifyContents,Ht.CopyContents,Ht.ModifyAnnotations,Ht.FillForms,Ht.ExtractForAccessibility,Ht.AssembleDocument,Ht.PrintHighQuality],Qn={[Ht.Print]:"print",[Ht.ModifyContents]:"modifyContents",[Ht.CopyContents]:"copyContents",[Ht.ModifyAnnotations]:"modifyAnnotations",[Ht.FillForms]:"fillForms",[Ht.ExtractForAccessibility]:"extractForAccessibility",[Ht.AssembleDocument]:"assembleDocument",[Ht.PrintHighQuality]:"printHighQuality"};function Jn(e,t){if(!e)return;if(t in e)return e[t];const n=Qn[t];return n&&n in e?e[n]:void 0}function eo(e,t,n){var o;const i=e.documents[t],r=null==i?void 0:i.permissions,a=e.globalPermissions,s=(null==(o=null==i?void 0:i.document)?void 0:o.permissions)??Ht.AllowAll,l=Jn(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=Jn(null==a?void 0:a.overrides,n);if(void 0!==c)return c;return!((null==r?void 0:r.enforceDocumentPermissions)??(null==a?void 0:a.enforceDocumentPermissions)??!0)||0!==(s&n)}function to(e,t){return Xn.reduce((n,o)=>eo(e,t,o)?n|o:n,0)}function no(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 oo=(e,t)=>{switch(t.type){case En:{const{documentId:n,name:o,scale:i,rotation:r,passwordProvided:a,autoActivate:s=!0,permissions:l}=t.payload,c={id:n,name:o,status:"loading",loadingProgress:0,error:null,document:null,scale:i??e.defaultScale,rotation:r??e.defaultRotation,passwordProvided:a??!1,pageRefreshVersions:{},permissions:l,loadStartedAt:Date.now()};return{...e,documents:{...e.documents,[n]:c},documentOrder:[...e.documentOrder,n],activeDocumentId:s||!e.activeDocumentId?n:e.activeDocumentId}}case Rn:{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 _n:{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 Nn:{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 On:{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 Ln:{const{documentId:n,nextActiveDocumentId:o}=t.payload,{[n]:i,...r}=e.documents;return{...e,documents:r,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:no(e,n,o)}}case jn:{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 Fn:return{...e,documentOrder:t.payload};case $n:return{...e,activeDocumentId:t.payload};case Bn:{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 Wn:{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 Hn:{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}}}}case Un:{const{documentId:n,permissions:o,isOwnerUnlocked:i}=t.payload,r=e.documents[n];return(null==r?void 0:r.document)?{...e,documents:{...e.documents,[n]:{...r,document:{...r.document,permissions:o,isOwnerUnlocked:i}}}}:e}default:return e}};class io{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 Pn,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)??Be.Degree0,globalPermissions:null==e?void 0:e.permissions}))(t),this.store=new Yn(oo,this.initialCoreState),this.logger=(null==t?void 0:t.logger)??new st}getLogger(){return this.logger}registerPlugin(e,t){if(this.initialized&&!this.isInitializing)throw new Mn("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 Mn("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new Mn("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 Pn}this.initialized=!0}catch(e){if(e instanceof Error)throw new An(`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 Mn(`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 Mn(`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 Dn(`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 zn(`Missing required configuration keys for plugin ${e}: ${o.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new Dn(`Plugin ${e} not found`);const o=this.manifests.get(e),i=this.configurations.get(e);if(!o||!i)throw new Dn(`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 Dn(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new Dn(`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 Mn(`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 Dn(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new Mn("Plugin must have an id")}validateManifest(e){if(!e.id)throw new Mn("Manifest must have an id");if(!e.name)throw new Mn("Manifest must have a name");if(!e.version)throw new Mn("Manifest must have a version");if(!Array.isArray(e.provides))throw new Mn("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new Mn("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new Mn("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new Mn("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 ro(e,t){return{package:e,config:t}}function ao(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class so{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(En,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(_n,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(Ln,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction(Bn,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction(Wn,(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}getDocumentPermissions(e){const t=e??this.coreState.core.activeDocumentId;return t?to(this.coreState.core,t):Ht.AllowAll}checkPermission(e,...t){const n=e??this.coreState.core.activeDocumentId;return!n||t.every(e=>eo(this.coreState.core,n,e))}requirePermission(e,...t){const n=e??this.coreState.core.activeDocumentId;if(!n)return;const o=[];for(const e of t)eo(this.coreState.core,n,e)||o.push(e);if(o.length>0){const e=to(this.coreState.core,n);throw new Bt(o,e)}}}class lo{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 co{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 lo(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 uo(e){return"keyExtractor"in e}function ho(e,t,n){return e<t?t:e>n?n:e}function mo(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`${fo(e)}__${fo(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]&&mo(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(!mo(e[i],t[i],n))return!1}return!0}(e,t,n)}return!1}let go=0;const po=new WeakMap;function fo(e){return po.has(e)||po.set(e,++go),po.get(e)}function vo(){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 yo(e,t=mo){const n=new Set,o=new Map;let i=e;const r=(e,t)=>{let r=e,a=()=>{};if(t){if(uo(t)){const n=new co(e,t);r=n.handle,a=()=>n.destroy()}else{const n=new lo(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=mo)=>(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 bo(e,t){const n=(null==t?void 0:t.cache)??!0,o=(null==t?void 0:t.equality)??mo,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(uo(o)){const t=new co(e,o);c=t.handle,d=()=>t.destroy()}else{const t=new lo(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(uo(t)){const i=new co(e,t);n=i.handle,o=()=>i.destroy()}else{const i=new lo(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 wo{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 xo(e){return new wo(e)}const Co=de({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function Io({plugins:e,children:t}){const{utilities:n,wrappers:o}=ze(()=>{const t=[],n=[];for(const o of e){const e=o.package;if(ao(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 He(H,{children:[o.reduce((e,t)=>He(t,{children:e}),t),n.map((e,t)=>He(e,{},`utility-${t}`))]})}function ko({engine:e,config:t,logger:n,onInitialized:o,plugins:i,children:r,autoMountDomElements:a=!0}){const[s,l]=Se(null),[c,d]=Se(null),[u,h]=Se(!0),[m,g]=Se(!1),p=Ae(o);Me(()=>{p.current=o},[o]),Me(()=>{const o={...t,logger:(null==t?void 0:t.logger)??n},r=new io(e,o);r.registerPluginBatch(i);let a;return(async()=>{var e;if(await r.initialize(),r.isDestroyed())return;const t=r.getStore();d(t.getState().core);const n=t.subscribe((e,n,o)=>{t.isCoreAction(e)&&n.core!==o.core&&d(n.core)});if(await(null==(e=p.current)?void 0:e.call(p,r)),!r.isDestroyed())return r.pluginsReady().then(()=>{r.isDestroyed()||g(!0)}),l(r),h(!1),n;n()})().then(e=>{a=e}).catch(console.error),()=>{null==a||a(),r.destroy(),l(null),d(null),h(!0),g(!1)}},[e,i]);const f=ze(()=>{const e=(null==c?void 0:c.activeDocumentId)??null,t=(null==c?void 0:c.documents)??{},n=(null==c?void 0:c.documentOrder)??[],o=e&&t[e]?t[e]:null,i=n.map(e=>t[e]).filter(e=>null!=e);return{registry:s,coreState:c,isInitializing:u,pluginsReady:m,activeDocumentId:e,activeDocument:o,documents:t,documentStates:i}},[s,c,u,m]),v="function"==typeof r?r(f):r;return He(Co.Provider,{value:f,children:m&&a?He(Io,{plugins:i,children:v}):v})}function So(e){const{registry:t}=function(){const e=Ee(Co);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}=So(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 Mo(){const{coreState:e}=Ee(Co);return e}function Do(e){const t=Mo();return ze(()=>t&&e?t.documents[e]??null:null,[t,e])}Ht.Print,Ht.ModifyContents,Ht.CopyContents,Ht.ModifyAnnotations,Ht.FillForms,Ht.ExtractForAccessibility,Ht.AssembleDocument,Ht.PrintHighQuality;const Ao=[Ht.Print,Ht.ModifyContents,Ht.CopyContents,Ht.ModifyAnnotations,Ht.FillForms,Ht.ExtractForAccessibility,Ht.AssembleDocument,Ht.PrintHighQuality],zo={[Ht.Print]:"print",[Ht.ModifyContents]:"modifyContents",[Ht.CopyContents]:"copyContents",[Ht.ModifyAnnotations]:"modifyAnnotations",[Ht.FillForms]:"fillForms",[Ht.ExtractForAccessibility]:"extractForAccessibility",[Ht.AssembleDocument]:"assembleDocument",[Ht.PrintHighQuality]:"printHighQuality"};function To(e,t){if(!e)return;if(t in e)return e[t];const n=zo[t];return n&&n in e?e[n]:void 0}function Eo(e,t,n){var o;const i=e.documents[t],r=null==i?void 0:i.permissions,a=e.globalPermissions,s=(null==(o=null==i?void 0:i.document)?void 0:o.permissions)??Ht.AllowAll,l=To(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=To(null==a?void 0:a.overrides,n);if(void 0!==c)return c;return!((null==r?void 0:r.enforceDocumentPermissions)??(null==a?void 0:a.enforceDocumentPermissions)??!0)||0!==(s&n)}function Ro(e){const t=Mo();return ze(()=>{var n,o;if(!t)return{permissions:Ht.AllowAll,pdfPermissions:Ht.AllowAll,hasPermission:()=>!0,hasAllPermissions:()=>!0,canPrint:!0,canModifyContents:!0,canCopyContents:!0,canModifyAnnotations:!0,canFillForms:!0,canExtractForAccessibility:!0,canAssembleDocument:!0,canPrintHighQuality:!0};const i=function(e,t){return Ao.reduce((n,o)=>Eo(e,t,o)?n|o:n,0)}(t,e),r=n=>Eo(t,e,n);return{permissions:i,pdfPermissions:(null==(o=null==(n=t.documents[e])?void 0:n.document)?void 0:o.permissions)??Ht.AllowAll,hasPermission:r,hasAllPermissions:(...n)=>n.every(n=>Eo(t,e,n)),canPrint:r(Ht.Print),canModifyContents:r(Ht.ModifyContents),canCopyContents:r(Ht.CopyContents),canModifyAnnotations:r(Ht.ModifyAnnotations),canFillForms:r(Ht.FillForms),canExtractForAccessibility:r(Ht.ExtractForAccessibility),canAssembleDocument:r(Ht.AssembleDocument),canPrintHighQuality:r(Ht.PrintHighQuality)}},[t,e])}const _o="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.3.0/dist/pdfium.wasm";de(void 0);const No="viewport",Oo={id:No,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},Lo="INIT_VIEWPORT_STATE",$o="CLEANUP_VIEWPORT_STATE",Fo="REGISTER_VIEWPORT",jo="UNREGISTER_VIEWPORT",Uo="SET_VIEWPORT_METRICS",Ho="SET_VIEWPORT_SCROLL_METRICS",Bo="SET_VIEWPORT_GAP",Wo="SET_SCROLL_ACTIVITY",qo="SET_SMOOTH_SCROLL_ACTIVITY",Go="ADD_VIEWPORT_GATE",Vo="REMOVE_VIEWPORT_GATE";function Ko(e,t){return{type:qo,payload:{documentId:e,isSmoothScrolling:t}}}const Zo={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},Yo={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},Xo=class extends so{constructor(e,t,n){var o;super(e,t),this.id=e,this.viewportResize$=yo(),this.viewportMetrics$=yo(),this.scrollMetrics$=yo(),this.scrollActivity$=yo(),this.gateState$=yo(),this.scrollRequests$=new Map,n.viewportGap&&this.dispatch((o=n.viewportGap,{type:Bo,payload:o})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:Lo,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,vo()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:$o,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:Fo,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:jo,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:Uo,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:Ho,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:Go,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:Vo,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(Ko(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:Wo,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(Ko(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()}};Xo.id="viewport";let Qo=Xo;const Jo={manifest:Oo,create:(e,t)=>new Qo(No,e,t),reducer:(e=Yo,t)=>{switch(t.type){case Lo:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Zo,gates:new Set}}}}case $o:{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 Fo:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.add(n),{...e,activeViewports:o,activeDocumentId:e.activeDocumentId??n}}case jo:{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 Bo:return{...e,viewportGap:t.payload};case Uo:{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 Ho:{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 Wo:{const{documentId:n,isScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isScrolling:o}}}:e}case qo:{const{documentId:n,isSmoothScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isSmoothScrolling:o}}}:e}case Go:{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 Vo:{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:Yo},ei=de(null),ti=()=>Po(Qo.id);function ni(e){const{plugin:t}=So(Qo.id),n=Ae(null);return De(()=>{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 oi({children:e,documentId:t,...n}){const[o,i]=Se(0),r=ni(t),{provides:a}=ti(),s=(e=>{const{provides:t}=ti(),[n,o]=Se((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 He(ei.Provider,{value:r,children:He("div",{...c,ref:r,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof l?l:{},padding:`${o}px`},children:!s&&e})})}var ii=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(ii||{});class ri{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),f=Math.max(l,h),v=Math.min(s+c,m),y=Math.min(l+d,g);if(p<v&&f<y){const e=v-p,t=y-f,r=c*d,a=e*t;o.push({pageNumber:i.pageNumber,viewportX:p-u,viewportY:f-h,visiblePercentage:a/r*100,original:{pageX:(p-s)/n,pageY:(f-l)/n,visibleWidth:e/n,visibleHeight:t/n,scale:1},scaled:{pageX:p-s,pageY:f-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 ai extends ri{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 si extends ri{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 li="INIT_SCROLL_STATE",ci="CLEANUP_SCROLL_STATE",di="UPDATE_DOCUMENT_SCROLL_STATE",ui="SET_SCROLL_STRATEGY";function hi(e,t){return{type:di,payload:{documentId:e,state:t}}}const mi={isChanging:!1,targetPage:1,fromPage:1,startTime:0},gi=class extends so{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$=yo(),this.scroll$=yo(),this.layoutChange$=yo(),this.pageChangeState$=yo(),this.layoutReady$=yo(),this.state$=yo(),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:li,payload:{documentId:e,state:t}}}(e,n));const o=this.createStrategy(n.strategy);this.strategies.set(e,o),this.scrollerLayoutEmitters.set(e,yo())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(hi(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:ci,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===ii.Horizontal?new si(t):new ai(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:mi}}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(hi(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(hi(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(hi(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(hi(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:Ke(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:ui,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()}};gi.id="scroll";let pi=gi;const fi="scroll",vi={manifest:{id:fi,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:ii.Vertical}},create:(e,t)=>new pi(fi,e,t),reducer:(e,t)=>{switch(t.type){case li:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case ci:{const{[t.payload]:n,...o}=e.documents;return{...e,documents:o}}case di:{const{documentId:n,state:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,...o}}}:e}case ui:{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??ii.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},yi=()=>Po(pi.id),bi=e=>{const{provides:t}=yi(),[n,o]=Se(1),[i,r]=Se(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 wi({documentId:e,renderPage:t,...n}){const{plugin:o}=So(pi.id),[i,r]=Se({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 De(()=>{o&&e&&a&&o.setLayoutReady(e)},[o,e,a]),a?He("div",{...n,style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===ii.Horizontal&&{display:"flex",flexDirection:"row"}},children:[He("div",{style:{...a.strategy===ii.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}}),He("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===ii.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>He("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>He("div",{style:{width:`${e.rotatedWidth}px`,height:`${e.rotatedHeight}px`},children:t({...e})},e.pageNumber))},e.pageNumbers[0]))}),He("div",{style:{...a.strategy===ii.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}}})]}):null}var xi=(e=>(e.None="none",e.Odd="odd",e.Even="even",e))(xi||{});const Ci="SPREAD/INIT_STATE",Ii="SPREAD/CLEANUP_STATE",ki="SPREAD/SET_SPREAD_MODE",Si="SPREAD/SET_PAGE_GROUPING";function Pi(e,t){return{type:Si,payload:{documentId:e,grouping:t}}}const Mi=class extends so{constructor(e,t,n){var o;super(e,t),this.spreadEmitter$=yo(),this.defaultSpreadMode=n.defaultSpreadMode??xi.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:Ci,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(Pi(e,t))}null==(t=this.viewport)||t.releaseGate("spread",e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Ii,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:ki,payload:{documentId:e,spreadMode:t}}}(n,e));const t=this.calculatePageGrouping(n,i.document.pages.length);this.dispatch(Pi(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 xi.None:return Array.from({length:t},(e,t)=>[t]);case xi.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 xi.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)??xi.None} -> ${i.spreadMode}`)}}async initialize(e){this.logger.info("SpreadPlugin","Initialize","Spread plugin initialized")}async destroy(){this.spreadEmitter$.clear(),super.destroy()}};Mi.id="spread";let Di=Mi;const Ai="spread",zi={id:Ai,name:"Spread Plugin",version:"1.0.0",provides:["spread"],requires:[],optional:["viewport"],defaultConfig:{}};xi.None;const Ti={documents:{},activeDocumentId:null},Ei={manifest:zi,create:(e,t)=>new Di(Ai,e,t),reducer:(e=Ti,t)=>{switch(t.type){case Ci:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Ii:{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 ki:{const{documentId:n,spreadMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,spreadMode:o}}}:e}case Si:{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:Ti},Ri="ui",_i={id:Ri,name:"UI Plugin",version:"1.0.0",provides:["ui"],requires:[],optional:["i18n"],defaultConfig:{schema:{id:"empty",version:"1.0.0",toolbars:{},menus:{},sidebars:{},modals:{},selectionMenus:{}}}},Ni="UI/INIT_STATE",Oi="UI/CLEANUP_STATE",Li="UI/SET_ACTIVE_TOOLBAR",$i="UI/CLOSE_TOOLBAR_SLOT",Fi="UI/SET_ACTIVE_SIDEBAR",ji="UI/CLOSE_SIDEBAR_SLOT",Ui="UI/SET_SIDEBAR_TAB",Hi="UI/OPEN_MODAL",Bi="UI/CLOSE_MODAL",Wi="UI/CLEAR_MODAL",qi="UI/OPEN_MENU",Gi="UI/CLOSE_MENU",Vi="UI/CLOSE_ALL_MENUS",Ki="UI/SET_OVERLAY_ENABLED",Zi="UI/SET_DISABLED_CATEGORIES",Yi="UI/SET_HIDDEN_ITEMS",Xi=(e,t,n,o,i)=>({type:Fi,payload:{documentId:e,placement:t,slot:n,sidebarId:o,activeTab:i}}),Qi=(e,t,n)=>({type:ji,payload:{documentId:e,placement:t,slot:n}}),Ji=(e,t)=>({type:qi,payload:{documentId:e,menuState:t}}),er=(e,t)=>({type:Gi,payload:{documentId:e,menuId:t}}),tr=(e,t,n)=>({type:Ki,payload:{documentId:e,overlayId:t,enabled:n}}),nr=e=>({type:Zi,payload:{categories:e}}),or=e=>({type:Yi,payload:{hiddenItems:e}});function ir(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 rr(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 ar(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 sr(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 lr="data-epdf",cr="data-epdf-s",dr="data-epdf-i",ur="data-epdf-cat",hr="data-epdf-dis",mr="data-epdf-hid",gr={ROOT:`[${lr}]`,STYLES:`[${cr}]`,ITEM:e=>`[${dr}="${e}"]`,CATEGORIES:e=>`[${ur}~="${e}"]`,DISABLED_CATEGORY:e=>`[${hr}~="${e}"]`,HIDDEN_ITEM:e=>`[${mr}~="${e}"]`},pr={useContainerQueries:!0};function fr(e,t={}){const n={...pr,...t.config},o=t.locale,i=yr(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=gr.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(`${gr.ROOT}[${hr}~="${e}"] [${ur}~="${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=zr(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 vr(e,t){const n=new Set(t),o=[];return e.forEach((e,t)=>{e.some(e=>n.has(e))&&o.push(t)}),o}function yr(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))br(s,l,n,o,i,r,a,t);for(const[r,s]of Object.entries(e.toolbars))Ir(r,s,n,o,i,a,t);for(const[t,r]of Object.entries(e.sidebars))Pr(t,r,n,o,i);for(const[r,s]of Object.entries(e.selectionMenus||{}))Mr(r,s,n,o,i,a,t);return{categories:n,itemCategories:o,dependencies:i,menuBreakpoints:r,responsiveItems:a}}function br(e,t,n,o,i,r,a,s){Ar(e,t.categories,t.visibilityDependsOn,n,o,i),wr(t.items,n,o,i);const l=sr(t,s);l&&l.items.forEach((e,t)=>{a.set(t,e)});const c=function(e,t,n){var o;const i=[],r=sr(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=Cr(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;xr(e.items,t,n,o),i.push({visibleItemIds:n,visibleCategories:o})}return i}(t,o,s);r.set(e,c)}function wr(e,t,n,o){for(const i of e)Ar(i.id,i.categories,i.visibilityDependsOn,t,n,o),"section"===i.type&&wr(i.items,t,n,o)}function xr(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&&xr(i.items,t,n,o)}}function Cr(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 Ir(e,t,n,o,i,r,a){Ar(e,t.categories,t.visibilityDependsOn,n,o,i);const s=sr(t,a);s&&s.items.forEach((e,t)=>{r.set(t,e)}),kr(t.items,n,o,i)}function kr(e,t,n,o){for(const i of e)Ar(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&kr(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)Ar(i.id,i.categories,i.visibilityDependsOn,t,n,o)}function Pr(e,t,n,o,i){if(Ar(e,t.categories,t.visibilityDependsOn,n,o,i),"tabs"===t.content.type)for(const e of t.content.tabs)Ar(e.id,e.categories,e.visibilityDependsOn,n,o,i)}function Mr(e,t,n,o,i,r,a){if(Ar(e,t.categories,t.visibilityDependsOn,n,o,i),t.responsive){const e=sr(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)Ar(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&Dr(i.items,t,n,o)}function Ar(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 zr(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=>gr.HIDDEN_ITEM(e)).join(""),i=`${gr.ROOT}${o} ${gr.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=>gr.HIDDEN_ITEM(e)).join("");r.push(`${gr.ROOT}${t} ${gr.ITEM(e.itemId)} {\n display: none !important;\n}`)}return r}function Tr(e,t){var n;return{[dr]:e.id,[ur]:(null==(n=e.categories)?void 0:n.join(" "))||void 0,...t}}const Er=class extends so{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$=yo(),this.stylesheetInvalidated$=vo(),this.toolbarChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.sidebarChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.modalChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.menuChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.overlayChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.schema=n.schema,this.stylesheetConfig=n.stylesheetConfig||{},this.itemCategories=yr(this.schema).itemCategories,null==(o=n.disabledCategories)?void 0:o.length){this.dispatch(nr(n.disabledCategories));const e=vr(this.itemCategories,n.disabledCategories);this.dispatch(or(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.overlayChanged$.clear(),this.stylesheetInvalidated$.clear(),super.destroy()}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:Ni,payload:{documentId:e,schema:t}}))(e,this.schema))}onDocumentClosed(e){this.dispatch((e=>({type:Oi,payload:{documentId:e}}))(e)),this.toolbarChanged$.clearScope(e),this.sidebarChanged$.clearScope(e),this.modalChanged$.clearScope(e),this.menuChanged$.clearScope(e),this.overlayChanged$.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=fr(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(nr(n));const o=vr(this.itemCategories,n);this.dispatch(or(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(nr(n));const o=vr(this.itemCategories,n);this.dispatch(or(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(nr(e));const t=vr(this.itemCategories,e);this.dispatch(or(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),enableOverlay:(e,t)=>this.enableOverlayForDocument(e,t),disableOverlay:(e,t)=>this.disableOverlayForDocument(e,t),toggleOverlay:(e,t)=>this.toggleOverlayForDocument(e,t),forDocument:e=>this.createUIScope(e),getSchema:()=>this.schema,mergeSchema:e=>{var t,n;this.schema=(t=this.schema,n=e,{...t,...n,toolbars:ir(t.toolbars,n.toolbars),menus:rr(t.menus,n.menus),sidebars:ar(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,onOverlayChanged:this.overlayChanged$.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),enableOverlay:t=>this.enableOverlayForDocument(t,e),disableOverlay:t=>this.disableOverlayForDocument(t,e),toggleOverlay:t=>this.toggleOverlayForDocument(t,e),isOverlayEnabled:t=>this.isOverlayEnabledForDocument(t,e),getEnabledOverlays:()=>this.getEnabledOverlaysForDocument(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),onOverlayChanged:this.overlayChanged$.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:Li,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:$i,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(Xi(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(Qi(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(Qi(r,e,t)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:""})):(this.dispatch(Xi(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:Ui,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:Hi,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:Bi,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:Wi,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(Ji(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(er(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(er(i,e)),this.menuChanged$.emit(i,{menuId:e,isOpen:!1})):(this.dispatch(Ji(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:Vi,payload:{documentId:e}}))(t))}isMenuOpenForDocument(e,t){return!!this.getDocumentStateOrThrow(t).openMenus[e]}getOpenMenusForDocument(e){return Object.values(this.getDocumentStateOrThrow(e).openMenus)}enableOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(tr(n,e,!0)),this.overlayChanged$.emit(n,{overlayId:e,isEnabled:!0})}disableOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(tr(n,e,!1)),this.overlayChanged$.emit(n,{overlayId:e,isEnabled:!1})}toggleOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.isOverlayEnabledForDocument(e,n)?this.disableOverlayForDocument(e,n):this.enableOverlayForDocument(e,n)}isOverlayEnabledForDocument(e,t){return this.getDocumentStateOrThrow(t).enabledOverlays[e]??!0}getEnabledOverlaysForDocument(e){const t=this.getDocumentStateOrThrow(e).enabledOverlays;return Object.entries(t).filter(([,e])=>e).map(([e])=>e)}};Er.id="ui";let Rr=Er;const _r={activeToolbars:{},activeSidebars:{},activeModal:null,openMenus:{},sidebarTabs:{},enabledOverlays:{}},Nr={documents:{},disabledCategories:[],hiddenItems:[]};function Or(e,t){const n=function(e){return e.ui??null}(e);return(null==n?void 0:n.documents[t])??null}function Lr(e,t){return`${e}-${t}`}function $r(e,t,n,o,i){const r=function(e,t,n,o){const i=Or(e,t);return i?i.activeToolbars[Lr(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.toolbarId===i)}function Fr(e,t,n,o,i){const r=function(e,t,n,o){const i=Or(e,t);return i?i.activeSidebars[Lr(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.sidebarId===i)}const jr={manifest:_i,create:(e,t)=>new Rr(Ri,e,t),reducer:(e=Nr,t)=>{var n;switch(t.type){case Ni:{const{documentId:n,schema:o}=t.payload,i={};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}}});const r={};return o.overlays&&Object.values(o.overlays).forEach(e=>{r[e.id]=e.defaultEnabled??!0}),{...e,documents:{...e.documents,[n]:{..._r,activeToolbars:i,enabledOverlays:r}}}}case Oi:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Li:{const{documentId:n,placement:o,slot:i,toolbarId:r}=t.payload,a=e.documents[n]||_r,s=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...a,activeToolbars:{...a.activeToolbars,[s]:{toolbarId:r,isOpen:!0}}}}}}case $i:{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 Fi:{const{documentId:n,placement:o,slot:i,sidebarId:r,activeTab:a}=t.payload,s=e.documents[n]||_r,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 ji:{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 Ui:{const{documentId:n,sidebarId:o,tabId:i}=t.payload,r=e.documents[n]||_r;return{...e,documents:{...e.documents,[n]:{...r,sidebarTabs:{...r.sidebarTabs,[o]:i}}}}}case Hi:{const{documentId:n,modalId:o}=t.payload,i=e.documents[n]||_r;return{...e,documents:{...e.documents,[n]:{...i,activeModal:{modalId:o,isOpen:!0},openMenus:{}}}}}case Bi:{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 Wi:{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 qi:{const{documentId:n,menuState:o}=t.payload,i=e.documents[n]||_r;return{...e,documents:{...e.documents,[n]:{...i,openMenus:{[o.menuId]:o}}}}}case Gi:{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 Vi:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,openMenus:{}}}}:e}case Ki:{const{documentId:n,overlayId:o,enabled:i}=t.payload,r=e.documents[n]||_r;return{...e,documents:{...e.documents,[n]:{...r,enabledOverlays:{...r.enabledOverlays,[o]:i}}}}}case Zi:return{...e,disabledCategories:t.payload.categories};case Yi:return{...e,hiddenItems:t.payload.hiddenItems};default:return e}},initialState:Nr},Ur=()=>Po(Rr.id),Hr=e=>{const{provides:t}=Ur(),[n,o]=Se(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())),l=n.onOverlayChanged(()=>o(n.getState()));return()=>{i(),r(),a(),s(),l()}},[t,e]),n},Br=de(null);function Wr(){const e=Ee(Br);if(!e)throw new Error("useUIContainer must be used within a UIProvider");return e}const qr=de(null);function Gr({children:e}){const t=Ae(new Map),n={register:Te((e,n,o)=>{const i=`${e}:${n}`;t.current.set(i,o)},[]),unregister:Te((e,n)=>{const o=`${e}:${n}`;t.current.delete(o)},[]),getAnchor:Te((e,n)=>{const o=`${e}:${n}`;return t.current.get(o)||null},[])};return He(qr.Provider,{value:n,children:e})}function Vr(){const e=Ee(qr);if(!e)throw new Error("useAnchorRegistry must be used within UIProvider");return e}function Kr(e,t){const n=Vr(),o=Ae(null),i=Ae(e),r=Ae(t);return i.current=e,r.current=t,Te(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 Yr({children:e,initialComponents:t={}}){const n=Ae(new Map(Object.entries(t))),o={register:Te((e,t)=>{n.current.set(e,t)},[]),unregister:Te(e=>{n.current.delete(e)},[]),get:Te(e=>n.current.get(e),[]),has:Te(e=>n.current.has(e),[]),getRegisteredIds:Te(()=>Array.from(n.current.keys()),[])};return He(Zr.Provider,{value:o,children:e})}function Xr(){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?He(i,{documentId:n,...o||{}}):(console.error(`Component "${t}" not found in registry`),null)}}}const Qr=de(null);function Jr({children:e,renderers:t}){return He(Qr.Provider,{value:t,children:e})}function ea(){const e=Ee(Qr);if(!e)throw new Error("useRenderers must be used within UIProvider");return e}function ta(e,t){var n;const{provides:o}=Ur(),i=ea(),r=Te(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 He(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 na({container:e,documentId:t}){const n=Hr(t),{provides:o}=Ur(),i=Vr(),r=ea(),[a,s]=Se(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 He(r.menu,{schema:d,documentId:t,anchorEl:a.anchorEl,onClose:()=>{a&&(null==o||o.forDocument(t).closeMenu(a.menuId))},container:e})}function oa({children:e,style:t,...n}){const{plugin:o}=So(Rr.id),{provides:i}=Ur(),[r,a]=Se([]),[s,l]=Se([]),c=Ae(null),d=Ae(null),u=Ae(null),h=Ae(null),m=ze(()=>({containerRef:h,getContainer:()=>h.current}),[]),g=Te(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(gr.STYLES);if(n)return c.current=n,void(n.textContent=o.getStylesheet());const i=o.getStylesheet(),r=document.createElement("style");r.setAttribute(cr,""),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=ze(()=>r.length>0?r.join(" "):void 0,[r]),f=ze(()=>s.length>0?s.join(" "):void 0,[s]),v=ze(()=>{const e={containerType:"inline-size"};return t&&"object"==typeof t?{...e,...t}:e},[t]),y={[lr]:"",[hr]:p,[mr]:f};return He(Br.Provider,{value:m,children:He("div",{ref:g,...y,...n,style:v,children:e})})}function ia({children:e,documentId:t,components:n={},renderers:o,menuContainer:i,...r}){return He(Gr,{children:He(Yr,{initialComponents:n,children:He(Jr,{renderers:o,children:He(oa,{...r,children:[e,He(na,{documentId:t,container:i})]})})})})}const ra=class extends so{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=yo(),this.documentClosed$=yo(),this.activeDocumentChanged$=yo(),this.documentError$=yo(),this.documentOrderChanged$=yo(),this.openFileRequest$=vo(),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:jn,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:Fn,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),setDocumentEncryption:(e,t)=>this.setDocumentEncryption(e,t),unlockOwnerPermissions:(e,t)=>this.unlockOwnerPermissions(e,t),removeEncryption:e=>this.removeEncryption(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 pt,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(Gn(n,i,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),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 pt,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const o=e.documentId||this.generateDocumentId();this.loadOptions.set(o,e),this.dispatchCoreAction(Gn(o,e.name,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),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 pt,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:On,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 pt;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new pt,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(Vn(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(Vn(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`),pt.all(t)}setDocumentEncryption(e,t){const n=new pt,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:qt.DocNotOpen,message:`Document ${e} is not open`}),n;this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Setting encryption on document ${e}`,{hasUserPassword:!!t.userPassword,allowedFlags:t.allowedFlags});return this.engine.setDocumentEncryption(o.document,t.userPassword??"",t.ownerPassword,t.allowedFlags).wait(t=>{t&&this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Encryption set successfully on document ${e}`),n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","SetDocumentEncryption",`Failed to set encryption on document ${e}`,t),n.fail(t)}),n}unlockOwnerPermissions(e,t){const n=new pt,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:qt.DocNotOpen,message:`Document ${e} is not open`}),n;const i=o.document;this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Attempting to unlock owner permissions on document ${e}`);return this.engine.unlockOwnerPermissions(i,t).wait(t=>{if(t){this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Owner permissions unlocked on document ${e}`);const t=4294967295;this.dispatchCoreAction(((e,t,n)=>({type:Un,payload:{documentId:e,permissions:t,isOwnerUnlocked:n}}))(e,t,!0))}n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","UnlockOwnerPermissions",`Failed to unlock owner permissions on document ${e}`,t),n.fail(t)}),n}removeEncryption(e){const t=new pt,n=this.coreState.core.documents[e];if(!(null==n?void 0:n.document))return t.reject({code:qt.DocNotOpen,message:`Document ${e} is not open`}),t;this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Marking document ${e} for encryption removal on save`);return this.engine.removeEncryption(n.document).wait(n=>{n&&this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Document ${e} marked for encryption removal`),t.resolve(n)},n=>{this.logger.error("DocumentManagerPlugin","RemoveEncryption",`Failed to mark document ${e} for encryption removal`,n),t.fail(n)}),t}checkDocumentLimit(){return this.maxDocuments&&Object.keys(this.coreState.core.documents).length>=this.maxDocuments?{code:qt.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:qt.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:qt.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:qt.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:qt.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:_n,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:Nn,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()}};ra.id="document-manager";let aa=ra;const sa="document-manager";function la({documentId:e,children:t}){const n=Do(e);if(!n)return null;return He(H,{children:t({documentState:n,isLoading:"loading"===n.status,isError:"error"===n.status,isLoaded:"loaded"===n.status})})}const ca=()=>Po(aa.id);const da=xo({manifest:{id:sa,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new aa(sa,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=So(aa.id),{provides:t}=ca(),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]),He("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(),ua="commands",ha={id:ua,name:"Commands Plugin",version:"1.0.0",provides:["commands"],requires:[],optional:["i18n","ui"],defaultConfig:{commands:{}}},ma="COMMANDS/SET_DISABLED_CATEGORIES",ga=e=>({type:ma,payload:e}),pa=class extends so{constructor(e,t,n){var o;super(e,t),this.commands=new Map,this.i18n=null,this.shortcutMap=new Map,this.commandExecuted$=vo(),this.commandStateChanged$=vo(),this.shortcutExecuted$=vo(),this.categoryChanged$=yo(),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(ga(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(ga(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(ga(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(ga(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){const o=this.resolveDynamic(e.labelKey,t,n);if(o&&this.i18n){const i=this.resolveDynamic(e.labelParams,t,n);return this.i18n.t(o,{params:i,documentId:n})}return e.label?e.label:e.id}resolveDynamic(e,t,n){if(void 0!==e)return"function"==typeof e?e({registry:this.registry,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=t.core.documents[e];if(!n||"loaded"!==n.status)return;const o=this.previousStates.get(e)??new Map;this.commands.forEach((t,n)=>{const i=this.resolve(n,e),r=o.get(n);if(!r)return void o.set(n,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),r.icon!==i.icon&&(a.icon=i.icon),mo(r.iconProps,i.iconProps)||(a.iconProps=i.iconProps),Object.keys(a).length>0&&(o.set(n,i),this.commandStateChanged$.emit({commandId:n,documentId:e,changes:a}))}),this.previousStates.set(e,o)}};pa.id="commands";let fa=pa;const va={disabledCategories:[]},ya=()=>Po(fa.id),ba=(e,t)=>{const{provides:n}=ya(),[o,i]=Se(()=>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 wa=xo({manifest:ha,create:(e,t)=>new fa(ua,e,t),reducer:(e=va,t)=>t.type===ma?{...e,disabledCategories:t.payload}:e,initialState:va}).addUtility(function(){const{provides:e}=ya();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(),xa="i18n",Ca={id:xa,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"}}}]}},Ia="I18N/SET_LOCALE",ka="I18N/REGISTER_LOCALE",Sa=e=>({type:Ia,payload:e}),Pa=e=>({type:ka,payload:e}),Ma=class extends so{constructor(e,t,n){super(e,t),this.locales=new Map,this.paramResolvers=new Map,this.paramsCache=new Map,this.localeChange$=vo(),this.paramsChanged$=bo((e,t)=>({documentId:e,...t}),{cache:!1}),this.config=n,n.locales.forEach(e=>{this.locales.set(e.code,e),this.dispatch(Pa(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});mo(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(Pa(e.code)),this.logger.info("I18nPlugin","LocaleRegistered",`Locale registered: ${e.code}`))}};Ma.id="i18n";let Da=Ma;const Aa={currentLocale:"en",availableLocales:[]},za={manifest:Ca,create:(e,t)=>new Da(xa,e,t),reducer:(e=Aa,t)=>{switch(t.type){case Ia:{const n=t.payload;return e.availableLocales.includes(n)?{...e,currentLocale:n}:(console.warn(`I18nPlugin: Locale '${n}' not available`),e)}case ka:{const n=t.payload;return e.availableLocales.includes(n)?e:{...e,availableLocales:[...e.availableLocales,n]}}default:return e}},initialState:Aa},Ta=e=>{const{provides:t}=Po(Da.id),[,n]=Pe(e=>e+1,0),o=Te((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 Ea=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(Ea||{}),Ra=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(Ra||{});const _a="zoom",Na={id:_a,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:Ea.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:Ea.FitPage},{name:"Fit Width",value:Ea.FitWidth},{name:"Automatic",value:Ea.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}]}},Oa="ZOOM/INIT_STATE",La="ZOOM/CLEANUP_STATE",$a="ZOOM/SET_ZOOM_LEVEL",Fa="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const ja={zoomLevel:Ea.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},Ua={documents:{},activeDocumentId:null};const Ha=class extends so{constructor(e,t,n){var o,i,r;super(e,t),this.zoom$=vo(),this.state$=yo(),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,Ra.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(o=this.spread)||o.onSpreadChange(e=>{this.recalcAuto(e.documentId,Ra.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:Fa,payload:{documentId:o,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...ja,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:Oa,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,Ra.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:La,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,Ra.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=Ra.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=ho(u+t,this.minZoom,this.maxZoom),m=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:o===Ra.Top?0:c.clientHeight/2},{desiredScrollLeft:p,desiredScrollTop:f}=this.computeScrollForZoomChange(a,c,d,m,g,i);isNaN(p)||isNaN(f)||this.viewportPlugin.setViewportScrollMetrics(a,{scrollLeft:p,scrollTop:f}),this.dispatch(function(e,t,n){return{type:$a,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(a,"number"==typeof e?m:e,m)),this.dispatchCoreAction(((e,t)=>({type:Bn,payload:{scale:e,documentId:t}}))(m,a)),this.viewport.isGated(a)&&this.viewport.releaseGate("zoom",a),l.scrollTo({x:p,y:f,behavior:"instant"});const v={documentId:a,oldZoom:d,newZoom:m,level:e,center:g,desiredScrollLeft:p,desiredScrollTop:f,viewport:c};this.zoom$.emit(v)}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 Ea.FitWidth:return s/c;case Ea.FitPage:return Math.min(s/c,l/d);case Ea.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),f=h(u,c,o),v=(t.scrollLeft+i.vx-s-m)/n*o+s+p,y=(t.scrollTop+i.vy-s-g)/n*o+s+f,b="center"===r?v-t.clientWidth/2:v-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,f=u.y+h.y,v=p+m.origin.x+m.size.width/2,y=f+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+v*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!==Ea.Automatic&&n.zoomLevel!==Ea.FitPage&&n.zoomLevel!==Ea.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(ho(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=ho(e.x,0,t.width),o=ho(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()}};Ha.id="zoom";let Ba=Ha;const Wa={manifest:Na,create:(e,t)=>new Ba(_a,e,t),reducer:(e=Ua,t)=>{switch(t.type){case Oa:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case La:{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 $a:{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 Fa:{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:Ua},qa=()=>Po(Ba.id);function Ga(e){const[t,n]=[e[0],e[1]],o=n.clientX-t.clientX,i=n.clientY-t.clientY;return Math.hypot(o,i)}function Va(e,t={}){const{provides:n}=Po("viewport"),{provides:o}=qa(),i=Ee(ei),r=Ae(null);return De(()=>{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,f=0,v=0,y=0,b=0,w=0,x=0,C=0,I=0,k=0,S=0,P=0,M=0,D=0;const A=(e,t,n)=>Math.min(Math.max(e,t),n),z=()=>{const n=t.clientWidth-2*i,o=e.offsetWidth,r=o<n?(n-o)/2:0;e.style.marginLeft=`${r}px`},T=e=>{const t=f*e,n=v*e;let o=k*(1-e);const i=I-t/2-y,r=S-D*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}=T(t);e.style.transformOrigin="0 0",e.style.transform=`translate(${n}px, ${o}px) scale(${t})`},R=()=>{e.style.transform="none",e.style.transformOrigin="0 0",u=1},_=()=>{const{tx:e,finalWidth:t}=T(u),n=(u-1)*d;let o,i=P;if(t<=C)o=I;else{const t=1-u;o=Math.abs(t)>.001?y+e/t:S}l.requestZoomBy(n,{vx:o,vy:i}),R(),d=0},N=(n,o)=>{const r=t.getBoundingClientRect(),a=e.getBoundingClientRect();M=i,f=a.width,v=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;k=o-a.top,S=n-r.left,P=o-r.top,D=f<C?S*f/C:s},O=e=>{if(2!==e.touches.length)return;h=!0,d=c().currentZoomLevel,m=Ga(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=Ga(e.touches);E(t/m),e.preventDefault()},$=e=>{h&&(e.touches.length>=2||(h=!1,_()))},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,_(),p=1},150)},j=l.onStateChange(()=>z()),U=new ResizeObserver(()=>z());return U.observe(e),U.observe(t),z(),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(),U.disconnect(),R(),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 Ka({children:e,documentId:t,style:n,enablePinch:o=!0,enableWheel:i=!0,...r}){const a=ze(()=>({enablePinch:o,enableWheel:i}),[o,i]),{elementRef:s}=Va(t,a);return He("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}=qa(),s=Do(e),[l,c]=Se(null),d=ze(()=>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?He("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},Ya=class extends so{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()}};Ya.id="render";let Xa=Ya;const Qa="render",Ja={manifest:{id:Qa,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new Xa(Qa,e,t),reducer:()=>{},initialState:{}};function es({documentId:e,pageIndex:t,scale:n,dpr:o,style:i,...r}){const{provides:a}=Po(Xa.id),s=Do(e),[l,c]=Se(null),d=Ae(null),u=ze(()=>s&&s.pageRefreshVersions[t]||0,[s,t]),h=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),m=ze(()=>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},Sn),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):n.abort({code:qt.Cancelled,message:"canceled render task"})}},[e,t,h,m,a,u]);return He(H,{children:l&&He("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...r,style:{width:"100%",height:"100%",...i||{}}})})}const ts="rotate",ns={id:ts,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const os="ROTATE/INIT_STATE",is="ROTATE/CLEANUP_STATE",rs="ROTATE/SET_ROTATION";const as=class extends so{constructor(e,t,n){super(e,t),this.rotate$=yo(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:os,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(Zn(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:is,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:rs,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(Zn(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()}};as.id="rotate";let ss=as;const ls={documents:{},activeDocumentId:null},cs={manifest:ns,create:(e,t)=>new ss(ts,e,t),reducer:(e=ls,t)=>{switch(t.type){case os:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case is:{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 rs:{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:ls};function ds({children:e,documentId:t,pageIndex:n,rotation:o,scale:i,style:r,...a}){var s,l,c,d;const{plugin:u}=So(ss.id),h=Do(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,f=o??(null==h?void 0:h.rotation)??0,v=i??(null==h?void 0:h.scale)??1,y=(null==u?void 0:u.getMatrixAsString({width:g*v,height:p*v,rotation:f}))??"matrix(1, 0, 0, 1, 0, 0)";return m?He("div",{...a,style:{position:"absolute",transformOrigin:"0 0",transform:y,...r},children:e}):null}const us="SEARCH/INIT_STATE",hs="SEARCH/CLEANUP_STATE",ms="SEARCH/START_SEARCH_SESSION",gs="SEARCH/STOP_SEARCH_SESSION",ps="SEARCH/SET_SEARCH_FLAGS",fs="SEARCH/SET_SHOW_ALL_RESULTS",vs="SEARCH/START_SEARCH",ys="SEARCH/SET_SEARCH_RESULTS",bs="SEARCH/APPEND_SEARCH_RESULTS",ws="SEARCH/SET_ACTIVE_RESULT_INDEX";function xs(e,t){return{type:fs,payload:{documentId:e,showAll:t}}}function Cs(e,t,n,o){return{type:ys,payload:{documentId:e,results:t,total:n,activeResultIndex:o}}}function Is(e,t){return{type:ws,payload:{documentId:e,index:t}}}const ks={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},Ss={documents:{}},Ps=(e,t,n)=>{const o=e.documents[t]||ks;return{...e,documents:{...e.documents,[t]:{...o,...n}}}},Ms=class extends so{constructor(e,t,n){super(e,t),this.searchStop$=yo(),this.searchStart$=yo(),this.searchResult$=yo(),this.searchActiveResultChange$=yo(),this.searchResultState$=yo(),this.searchState$=yo(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...ks,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:us,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:hs,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(xs(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(xs(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:ps,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:ms,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:qt.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:gs,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var o;const i=this.state.documents[t];if(!i)return Gt.reject({code:qt.NotFound,message:"Search state not initialized"});const r=this.getCoreDocument(t);if(!(null==r?void 0:r.document))return Gt.reject({code:qt.NotFound,message:"Document not loaded"});const a=e.trim();if(i.query===a&&!n)return Gt.resolve({results:i.results,total:i.total});const s=this.currentTask.get(t);if(s){try{null==(o=s.abort)||o.call(s,{code:qt.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:vs,payload:{documentId:e,query:t}}}(t,a)),!a)return this.dispatch(Cs(t,[],0,-1)),Gt.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:bs,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(Is(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch(Cs(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)!==qt.Cancelled&&(console.error("Error during search:",e),this.dispatch(Cs(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(Is(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()}};Ms.id="search";let Ds=Ms;const As="search",zs={manifest:{id:As,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new Ds(As,e,t),reducer:(e=Ss,t)=>{switch(t.type){case us:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case hs:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case ms:return Ps(e,t.payload.documentId,{active:!0});case gs:return Ps(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case ps:return Ps(e,t.payload.documentId,{flags:t.payload.flags});case fs:return Ps(e,t.payload.documentId,{showAllResults:t.payload.showAll});case vs:return Ps(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case bs:{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 Ps(e,n,{results:r,total:r.length,activeResultIndex:a,loading:!0})}case ys:{const{documentId:n,results:o,total:i,activeResultIndex:r}=t.payload;return Ps(e,n,{results:o,total:i,activeResultIndex:r,loading:!1})}case ws:return Ps(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:Ss},Ts=()=>Po(Ds.id);function Es({documentId:e,pageIndex:t,scale:n,style:o,highlightColor:i="#FFFF00",activeHighlightColor:r="#FFBF00",...a}){const{provides:s}=Ts(),[l,c]=Se(null),d=Do(e),u=ze(()=>null==s?void 0:s.forDocument(e),[s,e]),h=ze(()=>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 He("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)=>He("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 Rs="selection",_s={id:Rs,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},Ns="SELECTION/INIT_STATE",Os="SELECTION/CLEANUP_STATE",Ls="SELECTION/CACHE_PAGE_GEOMETRY",$s="SELECTION/SET_SELECTION",Fs="SELECTION/START_SELECTION",js="SELECTION/END_SELECTION",Us="SELECTION/CLEAR_SELECTION",Hs="SELECTION/SET_RECTS",Bs="SELECTION/SET_SLICES",Ws={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},qs={documents:{}},Gs=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function Vs(e,t){return e.rects[t]??[]}function Ks(e,t){return rt(Vs(e,t))}function Zs(e){const t=[],n=e.rects;for(const e in n){const o=Number(e),i=rt(n[o]);i&&t.push({page:o,rect:i})}return t}function Ys(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const o=Ks(e,t);return o?{pageIndex:t,rect:o,segmentRects:n}:null}function Xs(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=Ks(e,o);i&&t.push({pageIndex:o,rect:i,segmentRects:n})}return t}function Qs(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 Js(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 el(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?il(n,i)?o=tl(o,i.rect):(t.push(o),o=i.rect):o=i.rect,n=i;o&&!nl(o)&&t.push(o);return t}(i):i.map(e=>e.rect)}function tl(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 nl(e){return e.size.width<=0||e.size.height<=0}function ol(e,t){if(nl(e)||nl(t))return 0;const n=tl(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 il(e,t){const n=e.rect,o=t.rect;if(ol(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 rl=class extends so{constructor(e,t,n){var o,i,r;super(e,t),this.enabledModesPerDoc=new Map,this.selecting=new Map,this.anchor=new Map,this.marqueeEnabled=new Map,this.marqueePage=new Map,this.pageCallbacks=new Map,this.menuPlacement$=bo((e,t)=>({documentId:e,placement:t})),this.selChange$=bo((e,t)=>({documentId:e,selection:t})),this.textRetrieved$=bo((e,t)=>({documentId:e,text:t})),this.copyToClipboard$=bo((e,t)=>({documentId:e,text:t}),{cache:!1}),this.beginSelection$=bo((e,t)=>({documentId:e,page:t.page,index:t.index}),{cache:!1}),this.endSelection$=bo(e=>({documentId:e}),{cache:!1}),this.marqueeChange$=bo((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect}),{cache:!1}),this.marqueeEnd$=bo((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect}),{cache:!1}),this.viewportCapability=null,this.scrollCapability=null,this.config=n,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(Hn,e=>{const{documentId:t,pageIndexes:n}=e.payload,o=n.map(e=>this.getNewPageGeometryAndCache(t,e));pt.all(o).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},Sn)}),null==(r=this.viewportCapability)||r.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:Ns,payload:{documentId:e,state:t}}))(e,Ws)),this.enabledModesPerDoc.set(e,new Map([["pointerMode",{showRects:!0}]])),this.pageCallbacks.set(e,new Map),this.selecting.set(e,!1),this.anchor.set(e,void 0);const t=this.config.marquee;this.marqueeEnabled.set(e,!1!==(null==t?void 0:t.enabled))}onDocumentClosed(e){this.dispatch((e=>({type:Os,payload:e}))(e)),this.enabledModesPerDoc.delete(e),this.pageCallbacks.delete(e),this.selecting.delete(e),this.anchor.delete(e),this.marqueeEnabled.delete(e),this.marqueePage.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),this.marqueeChange$.clearScope(e),this.marqueeEnd$.clearScope(e)}async initialize(){}async destroy(){this.selChange$.clear(),this.textRetrieved$.clear(),this.copyToClipboard$.clear(),this.beginSelection$.clear(),this.endSelection$.clear(),this.menuPlacement$.clear(),this.marqueeChange$.clear(),this.marqueeEnd$.clear(),super.destroy()}buildCapability(){const e=e=>e??this.getActiveDocumentId();return{getFormattedSelection:t=>Xs(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>Ys(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>Vs(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>Ks(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,o)=>{var i;return null==(i=this.enabledModesPerDoc.get(e(o)))?void 0:i.set(t,{showRects:!0,...n})},isEnabledForMode:(t,n)=>{var o;return(null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.has(t))??!1},setMarqueeEnabled:(t,n)=>this.setMarqueeEnabled(e(n),t),isMarqueeEnabled:t=>this.isMarqueeEnabled(e(t)),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,onMarqueeChange:this.marqueeChange$.onGlobal,onMarqueeEnd:this.marqueeEnd$.onGlobal}}createSelectionScope(e){return{getFormattedSelection:()=>Xs(this.getDocumentState(e)),getFormattedSelectionForPage:t=>Ys(this.getDocumentState(e),t),getHighlightRectsForPage:t=>Vs(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>Ks(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),setMarqueeEnabled:t=>this.setMarqueeEnabled(e,t),isMarqueeEnabled:()=>this.isMarqueeEnabled(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),onMarqueeChange:this.marqueeChange$.forScope(e),onMarqueeEnd:this.marqueeEnd$.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:Vs(r,o),boundingRect:Ks(r,o)});const c=function(e){return{onPointerDown:(t,n,o)=>{if(!e.isEnabled(o))return;e.onClear();const i=e.getGeometry();if(i){const o=Qs(i,t);-1!==o&&(e.onBegin(o),n.stopImmediatePropagation())}},onPointerMove:(t,n,o)=>{if(!e.isEnabled(o))return;const i=e.getGeometry();if(i){const o=Qs(i,t);e.setCursor(-1!==o?"text":null),e.isSelecting()&&-1!==o&&(e.onUpdate(o),n.stopImmediatePropagation())}},onPointerUp:(t,n,o)=>{e.isEnabled(o)&&e.onEnd()},onHandlerActiveEnd:t=>{e.isEnabled(t)&&e.onClear()}}}({getGeometry:()=>this.getDocumentState(n).geometry[o],isEnabled:e=>(null==l?void 0:l.has(e))??!1,onBegin:e=>this.beginSelection(n,o,e),onUpdate:e=>this.updateSelection(n,o,e),onEnd:()=>this.endSelection(n),onClear:()=>this.clearSelection(n),isSelecting:()=>this.selecting.get(n)??!1,setCursor:e=>e?s.setCursor("selection-text",e,10):s.removeCursor("selection-text")}),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:qt.Cancelled,message:"Cleanup"})}}registerMarqueeOnPage(e){var t;const{documentId:n,pageIndex:o,scale:i,onRectChange:r}=e;if(!this.state.documents[n])return this.logger.warn("SelectionPlugin","RegisterMarqueeFailed",`Cannot register marquee on page ${o} for document ${n}: document state not initialized.`),()=>{};const a=this.coreState.core.documents[n];if(!a||!a.document)return this.logger.warn("SelectionPlugin","DocumentNotFound",`Cannot register marquee on page ${o}: document not found`),()=>{};const s=a.document.pages[o];if(!s)return this.logger.warn("SelectionPlugin","PageNotFound",`Cannot register marquee on page ${o}: page not found`),()=>{};const l=function(e){const{pageSize:t,scale:n,minDragPx:o=5}=e;let i=null,r=null;return{onPointerDown:(t,n,o)=>{var a;e.isEnabled(o)&&(i=t,r={origin:{x:t.x,y:t.y},size:{width:0,height:0}},e.onBegin(t),null==(a=n.setPointerCapture)||a.call(n))},onPointerMove:(n,o,a)=>{if(!i||!e.isEnabled(a))return;const s=ho(n.x,0,t.width),l=ho(n.y,0,t.height);r={origin:{x:Math.min(i.x,s),y:Math.min(i.y,l)},size:{width:Math.abs(s-i.x),height:Math.abs(l-i.y)}},e.onChange(r)},onPointerUp:(t,a,s)=>{var l;e.isEnabled(s)&&(r&&i&&(Math.max(r.size.width,r.size.height)*n>o?e.onEnd(r):e.onCancel()),i=null,r=null,null==(l=a.releasePointerCapture)||l.call(a))},onPointerCancel:(t,n,o)=>{var a;e.isEnabled(o)&&(i=null,r=null,e.onCancel(),null==(a=n.releasePointerCapture)||a.call(n))}}}({pageSize:s.size,scale:i,minDragPx:(null==(t=this.config.marquee)?void 0:t.minDragPx)??5,isEnabled:()=>!1!==this.marqueeEnabled.get(n),onBegin:e=>this.beginMarquee(n,o,e),onChange:e=>{this.updateMarquee(n,o,e),r(e)},onEnd:e=>{this.endMarquee(n,o,e),r(null)},onCancel:()=>{this.cancelMarquee(n),r(null)}});return this.interactionManagerCapability.registerHandlers({documentId:n,pageIndex:o,modeId:"pointerMode",handlers:l})}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,o;const i=null==(n=this.pageCallbacks.get(e))?void 0:n.get(t);if(i){const n=this.getDocumentState(e),r=this.interactionManagerCapability.forDocument(e).getActiveMode(),a=null==(o=this.enabledModesPerDoc.get(e))?void 0:o.get(r);i(a&&!1!==a.showRects?{rects:Vs(n,t),boundingRect:Ks(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 Gt.reject({code:qt.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:Ls,payload:{documentId:e,page:t,geo:n}}))(e,t,n))},Sn),i}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?Gt.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:Fs,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:js,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:Us,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:$s,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=Js(t,r,e);a&&(o[e]=el(r,a.from,a.to),i[e]={start:a.from,count:a.to-a.from+1})}this.dispatch(((e,t)=>({type:Hs,payload:{documentId:e,rects:t}}))(e,o)),this.dispatch(((e,t)=>({type:Bs,payload:{documentId:e,slices:t}}))(e,i))}getSelectedText(e){if(!this.checkPermission(e,Ht.CopyContents))return this.logger.debug("SelectionPlugin","GetSelectedText",`Cannot get selected text: document ${e} lacks CopyContents permission`),Gt.reject({code:qt.Security,message:"Document lacks CopyContents permission"});const t=this.getCoreDocument(e),n=this.getDocumentState(e);if(!(null==t?void 0:t.document)||!n.selection)return Gt.reject({code:qt.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 Gt.resolve([]);const r=this.engine.getTextSlices(t.document,i);return r.wait(t=>{this.textRetrieved$.emit(e,t)},Sn),r}copyToClipboard(e){if(!this.checkPermission(e,Ht.CopyContents))return void this.logger.debug("SelectionPlugin","CopyToClipboard",`Cannot copy to clipboard: document ${e} lacks CopyContents permission`);this.getSelectedText(e).wait(t=>{this.copyToClipboard$.emit(e,t.join("\n"))},Sn)}beginMarquee(e,t,n){this.marqueePage.set(e,t)}updateMarquee(e,t,n){this.marqueeChange$.emit(e,{pageIndex:t,rect:n})}endMarquee(e,t,n){this.marqueeEnd$.emit(e,{pageIndex:t,rect:n}),this.marqueeChange$.emit(e,{pageIndex:t,rect:null}),this.marqueePage.delete(e)}cancelMarquee(e){const t=this.marqueePage.get(e);void 0!==t&&(this.marqueeChange$.emit(e,{pageIndex:t,rect:null}),this.marqueePage.delete(e))}setMarqueeEnabled(e,t){this.marqueeEnabled.set(e,t)}isMarqueeEnabled(e){return!1!==this.marqueeEnabled.get(e)}};rl.id="selection";let al=rl;const sl={manifest:_s,create:(e,t)=>new al(Rs,e,t),reducer:(e=qs,t)=>{switch(t.type){case Ns:{const{documentId:n,state:o}=t.payload;return Gs(e,n,o)}case Os:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Ls:{const{documentId:n,page:o,geo:i}=t.payload,r=e.documents[n];return r?Gs(e,n,{...r,geometry:{...r.geometry,[o]:i}}):e}case $s:{const{documentId:n,selection:o}=t.payload,i=e.documents[n];return i?Gs(e,n,{...i,selection:o,active:!0}):e}case Fs:{const{documentId:n}=t.payload,o=e.documents[n];return o?Gs(e,n,{...o,selecting:!0,selection:null,rects:{}}):e}case js:{const{documentId:n}=t.payload,o=e.documents[n];return o?Gs(e,n,{...o,selecting:!1}):e}case Us:{const{documentId:n}=t.payload,o=e.documents[n];return o?Gs(e,n,{...o,selecting:!1,selection:null,rects:{},active:!1}):e}case Hs:{const{documentId:n,rects:o}=t.payload,i=e.documents[n];return i?Gs(e,n,{...i,rects:o}):e}case Bs:{const{documentId:n,slices:o}=t.payload,i=e.documents[n];return i?Gs(e,n,{...i,slices:o}):e}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?Gs(e,n,Ws):e}default:return e}},initialState:qs};const ll="onDblClick";function cl({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 He(H,{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 dl{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){if(!this.startElement)return this.config.element;const n=function(e){return{x:e.includes("e")?"left":e.includes("w")?"right":"center",y:e.includes("s")?"top":e.includes("n")?"bottom":"center"}}(t),o=this.startElement.size.width/this.startElement.size.height||1;let i=this.applyResizeDelta(e,n);return this.config.maintainAspectRatio&&(i=this.enforceAspectRatio(i,n,o)),i=this.clampToBounds(i,n,o),this.applyConstraints(i)}applyResizeDelta(e,t){const n=this.startElement;let o=n.origin.x,i=n.origin.y,r=n.size.width,a=n.size.height;return"left"===t.x?r+=e.x:"right"===t.x&&(o+=e.x,r-=e.x),"top"===t.y?a+=e.y:"bottom"===t.y&&(i+=e.y,a-=e.y),{origin:{x:o,y:i},size:{width:r,height:a}}}enforceAspectRatio(e,t,n){const o=this.startElement;let{x:i,y:r}=e.origin,{width:a,height:s}=e.size;if("center"===t.x||"center"===t.y)"center"===t.y?(s=a/n,r=o.origin.y+(o.size.height-s)/2):(a=s*n,i=o.origin.x+(o.size.width-a)/2);else{Math.abs(a-o.size.width)>=Math.abs(s-o.size.height)?s=a/n:a=s*n}return"right"===t.x&&(i=o.origin.x+o.size.width-a),"bottom"===t.y&&(r=o.origin.y+o.size.height-s),{origin:{x:i,y:r},size:{width:a,height:s}}}clampToBounds(e,t,n){var o;const i=null==(o=this.config.constraints)?void 0:o.boundingBox;if(!i)return e;const r=this.startElement;let{x:a,y:s}=e.origin,{width:l,height:c}=e.size;l=Math.max(1,l),c=Math.max(1,c);const d="left"===t.x?r.origin.x:r.origin.x+r.size.width,u="top"===t.y?r.origin.y:r.origin.y+r.size.height,h="left"===t.x?i.width-d:"right"===t.x?d:2*Math.min(r.origin.x,i.width-r.origin.x-r.size.width)+r.size.width,m="top"===t.y?i.height-u:"bottom"===t.y?u:2*Math.min(r.origin.y,i.height-r.origin.y-r.size.height)+r.size.height;if(this.config.maintainAspectRatio){const e=l>h?h/l:1,t=c>m?m/c:1,n=Math.min(e,t);n<1&&(l*=n,c*=n)}else l=Math.min(l,h),c=Math.min(c,m);return a="left"===t.x?d:"right"===t.x?d-l:r.origin.x+(r.size.width-l)/2,s="top"===t.y?u:"bottom"===t.y?u-c:r.origin.y+(r.size.height-c)/2,a=Math.max(0,Math.min(a,i.width-l)),s=Math.max(0,Math.min(s,i.height-c)),{origin:{x:a,y:s},size:{width:l,height:c}}}applyConstraints(e){const{constraints:t}=this.config;if(!t)return e;let{origin:{x:n,y:o},size:{width:i,height:r}}=e;const a=t.minWidth??1,s=t.minHeight??1,l=t.maxWidth,c=t.maxHeight;if(this.config.maintainAspectRatio&&i>0&&r>0){const e=i/r;i<a&&(i=a,r=i/e),r<s&&(r=s,i=r*e),void 0!==l&&i>l&&(i=l,r=i/e),void 0!==c&&r>c&&(r=c,i=r*e)}else i=Math.max(a,i),r=Math.max(s,r),void 0!==l&&(i=Math.min(l,i)),void 0!==c&&(r=Math.min(c,r));return 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 ul(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 hl(e,t,n){const o=-e/2;return"center"===n?o:"outside"===n?o-t:o+t}function ml(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 dl(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=Te(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=Te(e=>{var t;e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.move(e.clientX,e.clientY)},[]),l=Te(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=Te(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=Te(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=ze(()=>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]:hl(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?ul(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=ze(()=>{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 gl=()=>Po(al.id),pl=()=>So(al.id);function fl({documentId:e,pageIndex:t,scale:n,rotation:o,background:i="rgba(33,150,243)",selectionMenu:r}){const{plugin:a}=pl(),s=Do(e),[l,c]=Se([]),[d,u]=Se(null),[h,m]=Se(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=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),p=ze(()=>void 0!==o?o:(null==s?void 0:s.rotation)??Be.Degree0,[o,null==s?void 0:s.rotation]),f=r&&h&&h.pageIndex===t&&h.isVisible;return d?He(H,{children:[He("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)=>He("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))}),f&&He(cl,{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 vl=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="rgba(0,122,204,0.8)",fill:r="rgba(0,122,204,0.15)"})=>{const{plugin:a}=pl(),s=Do(e),[l,c]=Se(null),d=ze(()=>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,onRectChange:c})},[a,e,t,d]),l?He("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 dashed ${i}`,background:r,boxSizing:"border-box",zIndex:1e3},className:o}):null},yl=xo(sl).addUtility(function(){const{provides:e}=gl();return Me(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}).build(),bl="tiling",wl={id:bl,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},xl="TILING/INIT_STATE",Cl="TILING/CLEANUP_STATE",Il="TILING/UPDATE_VISIBLE_TILES",kl="TILING/MARK_TILE_STATUS",Sl=(e,t)=>({type:Il,payload:{documentId:e,tiles:t}}),Pl=(e,t,n,o)=>({type:kl,payload:{documentId:e,pageIndex:t,tileId:n,status:o}}),Ml={visibleTiles:{}};function Dl({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)}(Ke(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),f=Math.floor((l-1)/c),v=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(f,Math.floor((g-1)/c)+n),x=[];for(let t=v;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 Al=class extends so{constructor(e,t,n){super(e,t),this.tileRendering$=yo(),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(Hn,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:xl,payload:{documentId:e,state:t}}))(e,Ml))}onDocumentClosed(e){this.dispatch((e=>({type:Cl,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]=Dl({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(Sl(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=Dl({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(Sl(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(Pl(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(Pl(n,e.pageIndex,e.tile.id,"ready"))},Sn),o}};Al.id="tiling";let zl=Al;const Tl={manifest:wl,create:(e,t)=>new zl(bl,e,t),reducer:(e,t)=>((e,t)=>{var n,o;switch(t.type){case xl:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Cl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Il:{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 kl:{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:{}}},El=()=>Po(zl.id);function Rl({documentId:e,pageIndex:t,tile:n,dpr:o,scale:i}){const{provides:r}=El(),a=ze(()=>null==r?void 0:r.forDocument(e),[r,e]),[s,l]=Se(),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)},Sn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:qt.Cancelled,message:"canceled render task"})}},[a,t,n.id]);return s?He("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 _l({documentId:e,pageIndex:t,scale:n,style:o,...i}){const{provides:r}=El(),a=Do(e),[s,l]=Se([]);Me(()=>{if(r)return r.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[r,e,t]);const c=ze(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]);return He("div",{style:{...o},...i,children:null==s?void 0:s.map(n=>He(Rl,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const Nl="thumbnail",Ol={id:Nl,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}},Ll="THUMBNAIL/INIT_STATE",$l="THUMBNAIL/CLEANUP_STATE",Fl="THUMBNAIL/SET_WINDOW_STATE",jl="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function Ul(e,t){return{type:Ll,payload:{documentId:e,state:t}}}const Hl={thumbs:[],window:null,viewportH:0,scrollY:0},Bl={documents:{},activeDocumentId:null},Wl=class extends so{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$=bo((e,t)=>({documentId:e,window:t})),this.scrollTo$=bo((e,t)=>({documentId:e,options:t})),this.refreshPages$=bo((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(Hn,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(Ul(e,{...Hl})),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:$l,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(Ul(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:jl,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:Fl,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(Sn,()=>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()}};Wl.id="thumbnail";let ql=Wl;const Gl={manifest:Ol,create:(e,t)=>new ql(Nl,e,t),reducer:(e=Bl,t)=>{switch(t.type){case Ll:{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"THUMBNAIL/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Fl:{const{documentId:n,window:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,window:o}}}:e}case jl:{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:Bl},Vl=()=>So(ql.id);function Kl({documentId:e,style:t,children:n,...o}){const{plugin:i}=Vl(),r=Ae(null),[a,s]=Se({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 He("div",{ref:r,style:{overflowY:"auto",position:"relative",paddingTop:c,paddingBottom:c,height:"100%",...t},...o,children:He("div",{style:{height:(null==l?void 0:l.totalHeight)??0,position:"relative"},children:null==l?void 0:l.items.map(e=>n(e))})})}function Zl({documentId:e,meta:t,style:n,...o}){const{provides:i}=Po(ql.id),{plugin:r}=Vl(),[a,s]=Se(),l=Ae(null),[c,d]=Se(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)},Sn),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==o||o.abort({code:qt.Cancelled,message:"canceled render task"})}},[i,e,t.pageIndex,c]);return a?He("img",{src:a,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...o}):null}const Yl="annotation",Xl={id:Yl,name:"Annotation Plugin",version:"1.0.0",provides:["annotation"],requires:["interaction-manager","selection"],optional:["history"],defaultConfig:{autoCommit:!0,annotationAuthor:"Guest",deactivateToolAfterCreate:!1,selectAfterCreate:!0}},Ql="ANNOTATION/INIT_STATE",Jl="ANNOTATION/CLEANUP_STATE",ec="ANNOTATION/SET_ANNOTATIONS",tc="ANNOTATION/SELECT_ANNOTATION",nc="ANNOTATION/DESELECT_ANNOTATION",oc="ANNOTATION/ADD_TO_SELECTION",ic="ANNOTATION/REMOVE_FROM_SELECTION",rc="ANNOTATION/SET_SELECTION",ac="ANNOTATION/SET_ACTIVE_TOOL_ID",sc="ANNOTATION/CREATE_ANNOTATION",lc="ANNOTATION/PATCH_ANNOTATION",cc="ANNOTATION/DELETE_ANNOTATION",dc="ANNOTATION/COMMIT",uc="ANNOTATION/PURGE_ANNOTATION",hc="ANNOTATION/ADD_COLOR_PRESET",mc="ANNOTATION/SET_TOOL_DEFAULTS",gc="ANNOTATION/ADD_TOOL";const pc=e=>({type:nc,payload:{documentId:e}}),fc=(e,t,n)=>({type:oc,payload:{documentId:e,pageIndex:t,id:n}}),vc=(e,t)=>({type:ic,payload:{documentId:e,id:t}}),yc=(e,t)=>({type:rc,payload:{documentId:e,ids:t}}),bc=(e,t)=>({type:ac,payload:{documentId:e,toolId:t}}),wc=(e,t,n)=>({type:sc,payload:{documentId:e,pageIndex:t,annotation:n}}),xc=(e,t,n,o)=>({type:lc,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),Cc=(e,t,n)=>({type:cc,payload:{documentId:e,pageIndex:t,id:n}}),Ic=(e,t)=>({type:uc,payload:{documentId:e,uid:t}});function kc(e){return e.object.type===Mt.INK}function Sc(e){return e.object.type===Mt.CIRCLE}function Pc(e){return e.object.type===Mt.POLYGON}function Mc(e){return e.object.type===Mt.SQUARE}function Dc(e){return e.object.type===Mt.LINE}function Ac(e){return e.object.type===Mt.POLYLINE}function zc(e){return e.object.type===Mt.HIGHLIGHT}function Tc(e){return e.object.type===Mt.UNDERLINE}function Ec(e){return e.object.type===Mt.STRIKEOUT}function Rc(e){return e.object.type===Mt.SQUIGGLY}function _c(e){return e.object.type===Mt.FREETEXT}function Nc(e){return e.object.type===Mt.STAMP}function Oc(e){return e.object.type===Mt.TEXT}function Lc(e){return e.object.type===Mt.LINK}function $c(e){return function(e){return zc(e)||Tc(e)||Ec(e)||Rc(e)}(e)||kc(e)||Mc(e)||Sc(e)||Pc(e)||Dc(e)||Ac(e)||_c(e)||Nc(e)}const Fc=(e,t)=>(e.pages[t]??[]).map(t=>e.byUid[t]),jc=e=>e.selectedUids.map(t=>e.byUid[t]).filter(e=>void 0!==e),Uc=e=>e.selectedUids,Hc=(e,t)=>e.byUid[t]??null;function Bc(e,t){const n=e.tools.find(e=>e.id===t);return null==n?void 0:n.defaults}const Wc=(e,t)=>((e,t,n)=>{const o=[];for(const i of Object.values(e.pages))for(const r of i){const i=e.byUid[r];i&&"inReplyToId"in i.object&&i.object.inReplyToId===t&&n.includes(i.object.type)&&o.push(i)}return o})(e,t,[Mt.LINK]),qc=(e,t)=>{const n=((e,t)=>{const n=e.byUid[t];if(n)return n.object.inReplyToId&&n.object.replyType===Tt.Group?n.object.inReplyToId:t})(e,t);if(!n)return[];const o=[],i=e.byUid[n];i&&i.object.type!==Mt.LINK&&o.push(i);for(const t of Object.values(e.pages))for(const i of t){const t=e.byUid[i];t&&t.object.inReplyToId===n&&t.object.replyType===Tt.Group&&t.object.type!==Mt.LINK&&o.push(t)}return o},Gc=(e,t)=>{const n=e.byUid[t];if(!n)return!1;if(n.object.type===Mt.LINK)return!1;if(n.object.inReplyToId&&n.object.replyType===Tt.Group)return!0;for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&n.object.inReplyToId===t&&n.object.replyType===Tt.Group&&n.object.type!==Mt.LINK)return!0}return!1},Vc=[{id:"highlight",name:"Highlight",matchScore:e=>e.type===Mt.HIGHLIGHT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:Mt.HIGHLIGHT,strokeColor:"#FFCD45",color:"#FFCD45",opacity:1,blendMode:kt.Multiply}},{id:"underline",name:"Underline",matchScore:e=>e.type===Mt.UNDERLINE?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:Mt.UNDERLINE,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"strikeout",name:"Strikeout",matchScore:e=>e.type===Mt.STRIKEOUT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:Mt.STRIKEOUT,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"squiggly",name:"Squiggly",matchScore:e=>e.type===Mt.SQUIGGLY?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:Mt.SQUIGGLY,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"ink",name:"Pen",matchScore:e=>e.type===Mt.INK&&"InkHighlight"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.INK,strokeColor:"#E44234",color:"#E44234",opacity:1,strokeWidth:6}},{id:"inkHighlighter",name:"Ink Highlighter",matchScore:e=>e.type===Mt.INK&&"InkHighlight"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.INK,intent:"InkHighlight",strokeColor:"#FFCD45",color:"#FFCD45",opacity:1,strokeWidth:14,blendMode:kt.Multiply}},{id:"circle",name:"Circle",matchScore:e=>e.type===Mt.CIRCLE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.CIRCLE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:_t.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"square",name:"Square",matchScore:e=>e.type===Mt.SQUARE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.SQUARE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:_t.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"line",name:"Line",matchScore:e=>e.type===Mt.LINE&&"LineArrow"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0},defaults:{type:Mt.LINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"lineArrow",name:"Arrow",matchScore:e=>e.type===Mt.LINE&&"LineArrow"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0},defaults:{type:Mt.LINE,intent:"LineArrow",color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",lineEndings:{start:zt.None,end:zt.OpenArrow}},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"polyline",name:"Polyline",matchScore:e=>e.type===Mt.POLYLINE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0},defaults:{type:Mt.POLYLINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"polygon",name:"Polygon",matchScore:e=>e.type===Mt.POLYGON?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0},defaults:{type:Mt.POLYGON,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"freeText",name:"Free Text",matchScore:e=>e.type===Mt.FREETEXT?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.FREETEXT,contents:"Insert text",fontSize:14,fontColor:"#E44234",fontFamily:xt.Helvetica,textAlign:Ct.Left,verticalAlign:It.Top,color:"transparent",backgroundColor:"transparent",opacity:1},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20},defaultContent:"Insert text"}},{id:"stamp",name:"Image",matchScore:e=>e.type===Mt.STAMP?1:0,interaction:{exclusive:!1,cursor:"copy",isDraggable:!0,isResizable:!0,lockAspectRatio:!0},defaults:{type:Mt.STAMP}}],Kc=["#E44234","#FF8D00","#FFCD45","#5CC96E","#25D2D1","#597CE2","#C544CE","#7D2E25","#000000","#FFFFFF"],Zc=e=>1===e.length?e[0]:null,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 Xc(e){let t=e;return[()=>t,e=>{t=e}]}const Qc={annotationType:Mt.INK,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=Xc([]),[s,l]=Xc(!1),c={current:null},d=e=>({x:ho(e.x,0,i.width),y:ho(e.y,0,i.height)}),u=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,strokeColor:e.defaults.strokeColor??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:Mt.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:Mt.INK,pageIndex:e.pageIndex,id:In(),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 Jc({threshold:e=5,getTool:t,onClickDetected:n}){const[o,i]=Xc(null),[r,a]=Xc(!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 ed={annotationType:Mt.FREETEXT,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i,pageIndex:r}=e,[a,s]=Xc(null),l=e=>({x:ho(e.x,0,i.width),y:ho(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??xt.Helvetica,color:e.defaults.color??e.defaults.backgroundColor??"transparent",textAlign:e.defaults.textAlign??Ct.Left,verticalAlign:e.defaults.verticalAlign??It.Top,contents:e.defaults.contents??"Insert text here",flags:e.defaults.flags??["print"]}:null},d=Jc({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:ho(e.x-d,0,i.width-s),y:ho(e.y-u,0,i.height-l)},size:{width:s,height:l}},m=a.defaultContent??o.contents,g={...o,contents:m,type:Mt.FREETEXT,rect:h,pageIndex:r,id:In(),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:Mt.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:Mt.FREETEXT,rect:n,pageIndex:e.pageIndex,id:In(),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 td(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 nd(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 od=td(!1),id=td(!0),rd={[zt.OpenArrow]:od,[zt.ClosedArrow]:id,[zt.ROpenArrow]:{...od,getRotation:e=>e+Math.PI},[zt.RClosedArrow]:{...id,getRotation:e=>e+Math.PI},[zt.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},[zt.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},[zt.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},[zt.Butt]:nd(6,e=>e+Math.PI/2),[zt.Slash]:nd(18,e=>e+Math.PI/1.5)};function ad(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=rd[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 sd{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 ld=new sd,cd=Object.freeze(Object.defineProperty({__proto__:null,LINE_ENDING_HANDLERS:rd,PatchRegistry:sd,createEnding:function(e,t,n,o,i){if(!e)return null;const r=rd[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:ad,patchRegistry:ld},Symbol.toStringTag,{value:"Module"})),dd={annotationType:Mt.LINE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Xc(null),l=e=>({x:ho(e.x,0,r.width),y:ho(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:zt.None,end:zt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],strokeColor:e.defaults.strokeColor??"#000000",flags:e.defaults.flags??["print"]}:null},d=Jc({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}),f=ad([g,p],i.strokeWidth,i.lineEndings);n({...i,rect:f,linePoints:{start:g,end:p},pageIndex:t,id:In(),created:new Date,type:Mt.LINE})}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=ad([t,e],n.strokeWidth,n.lineEndings);return{type:Mt.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=ad([u,h],e.strokeWidth,e.lineEndings);n({...e,rect:o,linePoints:{start:u,end:h},pageIndex:t,id:In(),flags:["print"],created:new Date,type:Mt.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)}}}},ud={annotationType:Mt.POLYLINE,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=Xc([]),[s,l]=Xc(null),c=e=>({x:ho(e.x,0,i.width),y:ho(e.y,0,i.height)}),d=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:zt.None,end:zt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??_t.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=ad(o,n.strokeWidth,n.lineEndings);return{type:Mt.POLYLINE,bounds:i,data:{...n,rect:i,vertices:o,currentVertex:t}}};return{onClick:(e,t)=>{if(t.metaKey||t.ctrlKey)return;const o=c(e),i=r(),s=i[i.length-1];s&&Math.abs(s.x-o.x)<1&&Math.abs(s.y-o.y)<1||(a([...i,o]),l(o),n(u()))},onDoubleClick:()=>{(()=>{const o=r();if(o.length<2)return;const i=d();if(!i)return;const s=ad(o,i.strokeWidth,i.lineEndings),c={...i,vertices:o,rect:s,type:Mt.POLYLINE,pageIndex:e.pageIndex,id:In(),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)}}}},hd={annotationType:Mt.POLYGON,create(e){const{onCommit:t,onPreview:n,getTool:o,scale:i,pageSize:r}=e,[a,s]=Xc([]),[l,c]=Xc(null),d=e=>({x:ho(e.x,0,r.width),y:ho(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??_t.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:Mt.POLYGON,pageIndex:e.pageIndex,id:In(),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:Mt.POLYGON,bounds:o,data:{...n,rect:o,vertices:e,currentVertex:t}}};return{onClick:(e,t)=>{if(t.metaKey||t.ctrlKey)return;const o=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})(o)&&a().length>=3)return void h();const r=a(),l=r[r.length-1];l&&Math.abs(l.x-o.x)<1&&Math.abs(l.y-o.y)<1||(s([...r,o]),c(o),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)}}}},md={annotationType:Mt.SQUARE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Xc(null),l=e=>({x:ho(e.x,0,r.width),y:ho(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??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1}:null},d=Jc({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=ho(e.x-d,0,r.width-s),m=ho(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,f={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},v={...i,type:Mt.SQUARE,created:new Date,id:In(),pageIndex:t,rect:f};n(v)}}),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:Mt.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:Mt.SQUARE,created:new Date,id:In(),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)}}}},gd={annotationType:Mt.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:ho(l,0,i.width-o),y:ho(c,0,i.height-s)},size:{width:o,height:s}},u={...a.defaults,rect:d,type:Mt.STAMP,icon:a.defaults.icon??At.Draft,subject:a.defaults.subject??"Stamp",flags:a.defaults.flags??["print"],pageIndex:e.pageIndex,id:In(),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)})}})}}}},pd={annotationType:Mt.CIRCLE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Xc(null),l=e=>({x:ho(e.x,0,r.width),y:ho(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??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},d=Jc({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=ho(e.x-d,0,r.width-s),m=ho(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,f={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},v={...i,type:Mt.CIRCLE,created:new Date,id:In(),pageIndex:t,rect:f};n(v)}}),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:Mt.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:Mt.CIRCLE,flags:["print"],created:new Date,id:In(),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)}}}},fd=(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}},vd=(e,t)=>{var n;switch(t.type){case"vertex-edit":if(t.changes.linePoints){const{start:n,end:o}=t.changes.linePoints;return{rect:ad([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=ad([n.linePoints.start,n.linePoints.end],n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},yd=(e,t)=>{var n;switch(t.type){case"vertex-edit":return t.changes.vertices&&t.changes.vertices.length?{rect:ad(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=ad(n.vertices,n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},bd=(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}},wd=class extends so{constructor(e,t,n){var o,i,r;super(e,t),this.ANNOTATION_HISTORY_TOPIC="annotations",this.state$=yo(),this.pendingContexts=new Map,this.isInitialLoadComplete=new Map,this.importQueue=new Map,this.commitInProgress=new Map,this.handlerFactories=new Map,this.activeTool$=yo(),this.events$=yo(),this.toolsChange$=yo(),this.patchRegistry=new sd,this.unifiedDragStates=new Map,this.unifiedDrag$=yo(),this.unifiedResizeStates=new Map,this.unifiedResize$=yo(),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:Ql,payload:{documentId:e,state:t}}}(e,{pages:{},byUid:{},selectedUids:[],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,{showRects:!1})}onDocumentClosed(e){this.dispatch(function(e){return{type:Jl,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(Mt.CIRCLE,pd),this.handlerFactories.set(Mt.SQUARE,md),this.handlerFactories.set(Mt.STAMP,gd),this.handlerFactories.set(Mt.POLYGON,hd),this.handlerFactories.set(Mt.POLYLINE,ud),this.handlerFactories.set(Mt.LINE,dd),this.handlerFactories.set(Mt.INK,Qc),this.handlerFactories.set(Mt.FREETEXT,ed)}registerBuiltInPatches(){this.patchRegistry.register(Mt.INK,fd),this.patchRegistry.register(Mt.LINE,vd),this.patchRegistry.register(Mt.POLYLINE,yd),this.patchRegistry.register(Mt.POLYGON,bd)}async initialize(){var e,t,n;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(bc(e.documentId,o))}),null==(t=this.selection)||t.onMarqueeEnd(({documentId:e,pageIndex:t,rect:n})=>{const o=this.state.documents[e];if(!o)return;const i=(o.pages[t]??[]).map(e=>o.byUid[e]).filter(e=>void 0!==e).filter(e=>!Lc(e)).filter(e=>function(e,t){return!(e.origin.x+e.size.width<t.origin.x||t.origin.x+t.size.width<e.origin.x||e.origin.y+e.size.height<t.origin.y||t.origin.y+t.size.height<e.origin.y)}(n,e.object.rect)).map(e=>e.object.id);if(i.length>0){const t=new Set;for(const n of i)if(this.isInGroupMethod(n,e)){const o=this.getGroupMembersMethod(n,e);for(const e of o)t.add(e.object.id)}else t.add(n);this.setSelectionMethod([...t],e)}}),null==(n=this.selection)||n.onEndSelection(({documentId:e})=>{var t,n,o;if(!this.checkPermission(e,Ht.ModifyAnnotations))return;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=In();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)},Sn);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(),getSelectedAnnotations:()=>this.getSelectedAnnotationsMethod(),getSelectedAnnotationIds:()=>this.getSelectedAnnotationIdsMethod(),getAnnotationById:e=>this.getAnnotationById(e),selectAnnotation:(e,t)=>this.selectAnnotation(e,t),toggleSelection:(e,t)=>this.toggleSelectionMethod(e,t),addToSelection:(e,t)=>this.addToSelectionMethod(e,t),removeFromSelection:e=>this.removeFromSelectionMethod(e),setSelection:e=>this.setSelectionMethod(e),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),updateAnnotations:e=>this.updateAnnotationsMethod(e),deleteAnnotation:(e,t)=>this.deleteAnnotation(e,t),deleteAnnotations:(e,t)=>this.deleteAnnotationsMethod(e,t),renderAnnotation:e=>this.renderAnnotation(e),commit:()=>this.commit(),getAttachedLinks:(e,t)=>this.getAttachedLinksMethod(e,t),hasAttachedLinks:(e,t)=>this.hasAttachedLinksMethod(e,t),deleteAttachedLinks:(e,t)=>this.deleteAttachedLinksMethod(e,t),groupAnnotations:e=>this.groupAnnotationsMethod(e),ungroupAnnotations:(e,t)=>this.ungroupAnnotationsMethod(e,t),getGroupMembers:(e,t)=>this.getGroupMembersMethod(e,t),isInGroup:(e,t)=>this.isInGroupMethod(e,t),forDocument:e=>this.createAnnotationScope(e),getTools:()=>this.state.tools,getTool:e=>this.getTool(e),addTool:e=>{this.dispatch((e=>({type:gc,payload:e}))(e)),this.registerInteractionForTool(e)},findToolForAnnotation:e=>this.findToolForAnnotation(e),setToolDefaults:(e,t)=>this.dispatch(((e,t)=>({type:mc,payload:{toolId:e,patch:t}}))(e,t)),getColorPresets:()=>[...this.state.colorPresets],addColorPreset:e=>this.dispatch((e=>({type:hc,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),getSelectedAnnotations:()=>this.getSelectedAnnotationsMethod(e),getSelectedAnnotationIds:()=>this.getSelectedAnnotationIdsMethod(e),getAnnotationById:t=>this.getAnnotationById(t,e),selectAnnotation:(t,n)=>this.selectAnnotation(t,n,e),toggleSelection:(t,n)=>this.toggleSelectionMethod(t,n,e),addToSelection:(t,n)=>this.addToSelectionMethod(t,n,e),removeFromSelection:t=>this.removeFromSelectionMethod(t,e),setSelection:t=>this.setSelectionMethod(t,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),updateAnnotations:t=>this.updateAnnotationsMethod(t,e),deleteAnnotation:(t,n)=>this.deleteAnnotation(t,n,e),deleteAnnotations:t=>this.deleteAnnotationsMethod(t,e),renderAnnotation:t=>this.renderAnnotation(t,e),commit:()=>this.commit(e),getAttachedLinks:t=>this.getAttachedLinksMethod(t,e),hasAttachedLinks:t=>this.hasAttachedLinksMethod(t,e),deleteAttachedLinks:t=>this.deleteAttachedLinksMethod(t,e),groupAnnotations:()=>this.groupAnnotationsMethod(e),ungroupAnnotations:t=>this.ungroupAnnotationsMethod(t,e),getGroupMembers:t=>this.getGroupMembersMethod(t,e),isInGroup:t=>this.isInGroupMethod(t,e),getGroupingAction:()=>this.getGroupingActionMethod(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:ec,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)})},Sn)}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 Gt.reject({code:qt.NotFound,message:"Document not found"});const a=r.pages.find(e=>e.index===n);return a?this.engine.getPageAnnotations(r,a):Gt.reject({code:qt.NotFound,message:"Page not found"})}getSelectedAnnotation(e){return(e=>e.selectedUids.length>0?e.byUid[e.selectedUids[0]]??null:null)(this.getDocumentState(e))}getAnnotationById(e,t){const n=this.getDocumentState(t);return Hc(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 Gt.reject({code:qt.NotFound,message:"Document not found"});const s=a.pages.find(t=>t.index===e);return s?this.engine.renderPageAnnotation(a,s,t,n):Gt.reject({code:qt.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(wc(e,r,t)),i&&n.set(a,i)}!1!==this.config.autoCommit&&this.commit(e)}}createAnnotation(e,t,n,o){const i=o??this.getActiveDocumentId();if(!this.checkPermission(i,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","CreateAnnotation",`Cannot create annotation: document ${i} lacks ModifyAnnotations permission`);const r=t.id,a=this.pendingContexts.get(i);if(!a)return;const s={...t,author:t.author??this.config.annotationAuthor},l=()=>{this.dispatch(wc(i,e,s)),n&&a.set(r,n),this.events$.emit({type:"create",documentId:i,annotation:s,pageIndex:e,ctx:n,committed:!1})};if(!this.history)return l(),void(this.config.autoCommit&&this.commit(i));const c={execute:l,undo:()=>{a.delete(r),this.dispatch(pc(i)),this.dispatch(Cc(i,e,r)),this.events$.emit({type:"delete",documentId:i,annotation:s,pageIndex:e,committed:!1})}};this.history.forDocument(i).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();if(!this.checkPermission(i,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UpdateAnnotation",`Cannot update annotation: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i).byUid[t].object,a=this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),s=()=>{this.dispatch(xc(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(xc(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();if(!this.checkPermission(i,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","DeleteAnnotation",`Cannot delete annotation: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i),a=null==(o=r.byUid[t])?void 0:o.object;if(!a)return;const s=((e,t)=>{const n=[];for(const o of Object.values(e.pages))for(const i of o){const o=e.byUid[i];o&&"inReplyToId"in o.object&&o.object.inReplyToId===t&&n.push({id:o.object.id,pageIndex:o.object.pageIndex})}return n})(r,t),l=s.map(e=>{var t;return null==(t=r.byUid[e.id])?void 0:t.object}).filter(e=>void 0!==e),c=()=>{var n;for(const e of s){const t=null==(n=r.byUid[e.id])?void 0:n.object;t&&(this.dispatch(Cc(i,e.pageIndex,e.id)),this.events$.emit({type:"delete",documentId:i,annotation:t,pageIndex:e.pageIndex,committed:!1}))}this.dispatch(pc(i)),this.dispatch(Cc(i,e,t)),this.events$.emit({type:"delete",documentId:i,annotation:a,pageIndex:e,committed:!1})};if(!this.history)return c(),void(!1!==this.config.autoCommit&&this.commit(i));const d={execute:c,undo:()=>{this.dispatch(wc(i,e,a)),this.events$.emit({type:"create",documentId:i,annotation:a,pageIndex:e,committed:!1});for(const e of l)this.dispatch(wc(i,e.pageIndex,e)),this.events$.emit({type:"create",documentId:i,annotation:e,pageIndex:e.pageIndex,committed:!1})}};this.history.forDocument(i).register(d,this.ANNOTATION_HISTORY_TOPIC)}deleteAnnotationsMethod(e,t){for(const{pageIndex:n,id:o}of e)this.deleteAnnotation(n,o,t)}selectAnnotation(e,t,n){const o=n??this.getActiveDocumentId();if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o).map(e=>e.object.id);this.dispatch(yc(o,e))}else this.dispatch(((e,t,n)=>({type:tc,payload:{documentId:e,pageIndex:t,id:n}}))(o,e,t))}deselectAnnotation(e){const t=e??this.getActiveDocumentId();this.dispatch(pc(t))}getSelectedAnnotationsMethod(e){return jc(this.getDocumentState(e))}getSelectedAnnotationIdsMethod(e){return Uc(this.getDocumentState(e))}toggleSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentState(o);if(i.selectedUids.includes(t))this.dispatch(vc(o,t));else if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o);for(const t of e)i.selectedUids.includes(t.object.id)||this.dispatch(fc(o,t.object.pageIndex,t.object.id))}else this.dispatch(fc(o,e,t))}addToSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(fc(o,e,t))}removeFromSelectionMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(vc(n,e))}setSelectionMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(yc(n,e))}getAttachedLinksMethod(e,t){return Wc(this.getDocumentState(t),e)}hasAttachedLinksMethod(e,t){return this.getAttachedLinksMethod(e,t).length>0}deleteAttachedLinksMethod(e,t){const n=this.getAttachedLinksMethod(e,t);for(const e of n)this.deleteAnnotation(e.object.pageIndex,e.object.id,t)}groupAnnotationsMethod(e){const t=e??this.getActiveDocumentId();if(!this.checkPermission(t,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","GroupAnnotations",`Cannot group annotations: document ${t} lacks ModifyAnnotations permission`);const n=this.getSelectedAnnotationsMethod(t);if(n.length<2)return void this.logger.debug("AnnotationPlugin","GroupAnnotations","Need at least 2 annotations to group");const o=n[0],i=n.slice(1).map(e=>({pageIndex:e.object.pageIndex,id:e.object.id,patch:{inReplyToId:o.object.id,replyType:Tt.Group}}));this.updateAnnotationsMethod(i,t)}ungroupAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UngroupAnnotations",`Cannot ungroup annotations: document ${n} lacks ModifyAnnotations permission`);const o=this.getGroupMembersMethod(e,n).filter(e=>e.object.inReplyToId&&e.object.replyType===Tt.Group).map(e=>({pageIndex:e.object.pageIndex,id:e.object.id,patch:{inReplyToId:void 0,replyType:void 0}}));o.length>0&&this.updateAnnotationsMethod(o,n)}getGroupMembersMethod(e,t){return qc(this.getDocumentState(t),e)}isInGroupMethod(e,t){return Gc(this.getDocumentState(t),e)}getGroupingActionMethod(e){return(e=>{const t=jc(e);if(0===t.length)return"disabled";const n=t[0].object.id;if(Gc(e,n)){const o=qc(e,n),i=new Set(o.map(e=>e.object.id));if(t.every(e=>i.has(e.object.id)))return"ungroup"}return t.length>=2?"group":"disabled"})(this.getDocumentState(e))}computeCombinedConstraints(e){let t=1/0,n=1/0,o=1/0,i=1/0;for(const r of e){const e=r.rect.origin.y,a=r.pageSize.height-(r.rect.origin.y+r.rect.size.height),s=r.rect.origin.x,l=r.pageSize.width-(r.rect.origin.x+r.rect.size.width);t=Math.min(t,e),n=Math.min(n,a),o=Math.min(o,s),i=Math.min(i,l)}return isFinite(t)||(t=0),isFinite(n)||(n=0),isFinite(o)||(o=0),isFinite(i)||(i=0),{maxUp:t,maxDown:n,maxLeft:o,maxRight:i}}clampDelta(e,t){return{x:Math.max(-t.maxLeft,Math.min(t.maxRight,e.x)),y:Math.max(-t.maxUp,Math.min(t.maxDown,e.y))}}startDrag(e,t){const{annotationIds:n,pageSize:o}=t,i=[];for(const t of n){const n=this.getAttachedLinksMethod(t,e);for(const e of n)i.includes(e.object.id)||i.push(e.object.id)}const r=[...n,...i],a=new Map,s=[];for(const t of r){const n=this.getAnnotationById(t,e);n&&(a.set(t,{...n.object.rect}),s.push({id:t,rect:n.object.rect,pageIndex:n.object.pageIndex,pageSize:o}))}const l={documentId:e,isDragging:!0,primaryIds:n,attachedLinkIds:i,allParticipantIds:r,originalRects:a,delta:{x:0,y:0},combinedConstraints:this.computeCombinedConstraints(s)};this.unifiedDragStates.set(e,l),this.unifiedDrag$.emit({documentId:e,type:"start",state:l,previewPatches:{}})}computeDragPreviewPatches(e,t){const n={};for(const o of e.allParticipantIds){const i=this.getAnnotationById(o,t);if(!i)continue;const r=e.originalRects.get(o);if(!r)continue;const a={...r,origin:{x:r.origin.x+e.delta.x,y:r.origin.y+e.delta.y}};n[o]=this.transformAnnotation(i.object,{type:"move",changes:{rect:a}})}return n}updateDrag(e,t){const n=this.unifiedDragStates.get(e);if(!(null==n?void 0:n.isDragging))return{x:0,y:0};const o=this.clampDelta(t,n.combinedConstraints),i={...n,delta:o};this.unifiedDragStates.set(e,i);const r=this.computeDragPreviewPatches(i,e);return this.unifiedDrag$.emit({documentId:e,type:"update",state:i,previewPatches:r}),o}commitDrag(e){const t=this.unifiedDragStates.get(e);if(!t)return;const n=t.delta;if(0!==n.x||0!==n.y){const o=[];for(const i of t.allParticipantIds){const r=this.getAnnotationById(i,e);if(!r)continue;const a=t.originalRects.get(i)??r.object.rect,s={...a,origin:{x:a.origin.x+n.x,y:a.origin.y+n.y}},l=this.transformAnnotation(r.object,{type:"move",changes:{rect:s}});o.push({pageIndex:r.object.pageIndex,id:i,patch:l})}o.length>0&&this.updateAnnotationsMethod(o,e)}const o=this.computeDragPreviewPatches(t,e);this.unifiedDrag$.emit({documentId:e,type:"end",state:{...t,isDragging:!1},previewPatches:o}),this.unifiedDragStates.delete(e)}cancelDrag(e){const t=this.unifiedDragStates.get(e);t&&(this.unifiedDrag$.emit({documentId:e,type:"cancel",state:{...t,isDragging:!1,delta:{x:0,y:0}},previewPatches:{}}),this.unifiedDragStates.delete(e))}getDragState(e){return this.unifiedDragStates.get(e)??null}get onDragChange(){return this.unifiedDrag$.on}computeUnifiedGroupBoundingBox(e){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};let t=1/0,n=1/0,o=-1/0,i=-1/0;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}}}computeUnifiedRelativePositions(e,t){return e.map(e=>({id:e.id,originalRect:e.rect,pageIndex:e.pageIndex,isAttachedLink:e.isAttachedLink,parentId:e.parentId,relativeX:t.size.width>0?(e.rect.origin.x-t.origin.x)/t.size.width:0,relativeY:t.size.height>0?(e.rect.origin.y-t.origin.y)/t.size.height:0,relativeWidth:t.size.width>0?e.rect.size.width/t.size.width:1,relativeHeight:t.size.height>0?e.rect.size.height/t.size.height:1}))}computeUnifiedResizedRects(e,t,n=10){const o=new Map;for(const i of e){const e=Math.max(n,i.relativeWidth*t.size.width),r=Math.max(n,i.relativeHeight*t.size.height);o.set(i.id,{origin:{x:t.origin.x+i.relativeX*t.size.width,y:t.origin.y+i.relativeY*t.size.height},size:{width:e,height:r}})}return o}computeResizePreviewPatches(e,t){const n={};for(const[o,i]of e){const e=this.getAnnotationById(o,t);e&&(n[o]=this.transformAnnotation(e.object,{type:"resize",changes:{rect:i}}))}return n}startResize(e,t){const{annotationIds:n,pageSize:o,resizeHandle:i}=t,r=[],a=[];for(const t of n){const n=this.getAnnotationById(t,e);if(n){a.push({id:t,rect:n.object.rect,pageIndex:n.object.pageIndex,isAttachedLink:!1});const o=this.getAttachedLinksMethod(t,e);for(const e of o)r.includes(e.object.id)||(r.push(e.object.id),a.push({id:e.object.id,rect:e.object.rect,pageIndex:e.object.pageIndex,isAttachedLink:!0,parentId:t}))}}const s=[...n,...r],l=a.map(e=>e.rect),c=this.computeUnifiedGroupBoundingBox(l),d=this.computeUnifiedRelativePositions(a,c),u=this.computeUnifiedResizedRects(d,c),h={documentId:e,isResizing:!0,primaryIds:n,attachedLinkIds:r,allParticipantIds:s,originalGroupBox:c,currentGroupBox:c,participatingAnnotations:d,resizeHandle:i,computedRects:u};this.unifiedResizeStates.set(e,h);const m=this.computeResizePreviewPatches(u,e);this.unifiedResize$.emit({documentId:e,type:"start",state:h,computedRects:Object.fromEntries(u),previewPatches:m})}updateResize(e,t){const n=this.unifiedResizeStates.get(e);if(!(null==n?void 0:n.isResizing))return{};const o=this.computeUnifiedResizedRects(n.participatingAnnotations,t),i={...n,currentGroupBox:t,computedRects:o};this.unifiedResizeStates.set(e,i);const r=Object.fromEntries(o),a=this.computeResizePreviewPatches(o,e);return this.unifiedResize$.emit({documentId:e,type:"update",state:i,computedRects:r,previewPatches:a}),r}commitResize(e){const t=this.unifiedResizeStates.get(e);if(!t)return;const n=this.computeUnifiedResizedRects(t.participatingAnnotations,t.currentGroupBox),o=[];for(const[t,i]of n){const n=this.getAnnotationById(t,e);if(!n)continue;const r=this.transformAnnotation(n.object,{type:"resize",changes:{rect:i}});o.push({pageIndex:n.object.pageIndex,id:t,patch:r})}o.length>0&&this.updateAnnotationsMethod(o,e);const i=this.computeResizePreviewPatches(n,e);this.unifiedResize$.emit({documentId:e,type:"end",state:{...t,isResizing:!1},computedRects:Object.fromEntries(n),previewPatches:i}),this.unifiedResizeStates.delete(e)}cancelResize(e){const t=this.unifiedResizeStates.get(e);if(!t)return;const n=this.computeUnifiedResizedRects(t.participatingAnnotations,t.originalGroupBox);this.unifiedResize$.emit({documentId:e,type:"cancel",state:{...t,isResizing:!1,currentGroupBox:t.originalGroupBox},computedRects:Object.fromEntries(n),previewPatches:{}}),this.unifiedResizeStates.delete(e)}getResizeState(e){return this.unifiedResizeStates.get(e)??null}get onResizeChange(){return this.unifiedResize$.on}updateAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UpdateAnnotations",`Cannot update annotations: document ${n} lacks ModifyAnnotations permission`);const o=this.getDocumentState(n),i=e.map(({pageIndex:e,id:t,patch:n})=>{var i;const r=null==(i=o.byUid[t])?void 0:i.object;if(!r)return null;return{pageIndex:e,id:t,patch:this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),originalObject:r}}).filter(e=>null!==e);if(0===i.length)return;const r=()=>{for(const{pageIndex:e,id:t,patch:o,originalObject:r}of i)this.dispatch(xc(n,e,t,o)),this.events$.emit({type:"update",documentId:n,annotation:r,pageIndex:e,patch:o,committed:!1})};if(!this.history)return r(),void(!1!==this.config.autoCommit&&this.commit(n));const a=i.map(({pageIndex:e,id:t,patch:n,originalObject:o})=>({pageIndex:e,id:t,originalPatch:Object.fromEntries(Object.keys(n).map(e=>[e,o[e]])),originalObject:o})),s={execute:r,undo:()=>{for(const{pageIndex:e,id:t,originalPatch:o,originalObject:i}of a)this.dispatch(xc(n,e,t,o)),this.events$.emit({type:"update",documentId:n,annotation:i,pageIndex:e,patch:o,committed:!1})}};this.history.forDocument(n).register(s,this.ANNOTATION_HISTORY_TOPIC)}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();if(null!==e&&!this.checkPermission(i,Ht.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","SetActiveTool",`Cannot activate tool: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i);if(e===r.activeToolId)return;this.dispatch(bc(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}collectPendingChanges(e,t){const n=this.getDocumentState(e),o=this.pendingContexts.get(e),i={creations:[],updates:[],deletions:[],committedUids:[],isEmpty:!0};for(const[e,r]of Object.entries(n.byUid)){if("synced"===r.commitState)continue;const n=t.pages.find(e=>e.index===r.object.pageIndex);if(n)switch(i.committedUids.push(e),i.isEmpty=!1,r.commitState){case"new":i.creations.push({uid:e,ta:r,ctx:null==o?void 0:o.get(r.object.id)});break;case"dirty":i.updates.push({uid:e,ta:r});break;case"deleted":i.deletions.push({uid:e,ta:r})}}return i}executeCommitBatch(e,t,n){const o=new pt,i=this.pendingContexts.get(e),r=[];for(const{uid:e,ta:o,ctx:i}of n.creations){const n=t.pages.find(e=>e.index===o.object.pageIndex);if(!n)continue;const a=this.engine.createPageAnnotation(t,n,o.object,i);r.push({type:"create",task:a,ta:o,uid:e,ctx:i})}for(const{uid:e,ta:o}of n.updates){const n=t.pages.find(e=>e.index===o.object.pageIndex);if(!n)continue;const i=this.engine.updatePageAnnotation(t,n,o.object);r.push({type:"update",task:i,ta:o,uid:e})}for(const{uid:o,ta:i}of n.deletions){const n=t.pages.find(e=>e.index===i.object.pageIndex);if(n)if(i.object.id){const e=new pt;this.engine.removePageAnnotation(t,n,i.object).wait(()=>e.resolve(!0),e.fail),r.push({type:"delete",task:e,ta:i,uid:o})}else this.dispatch(Ic(e,o))}const a=r.map(e=>e.task);return pt.allSettled(a).wait(()=>{var t,a;this.emitCommitEvents(e,r,i),this.dispatch((t=e,a=n.committedUids,{type:dc,payload:{documentId:t,committedUids:a}})),o.resolve(!0)},e=>o.fail(e)),o}emitCommitEvents(e,t,n){for(const o of t)if(o.task.state.stage===ht.Resolved)switch(o.type){case"create":this.events$.emit({type:"create",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,ctx:o.ctx,committed:!0}),null==n||n.delete(o.ta.object.id);break;case"update":this.events$.emit({type:"update",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,patch:o.ta.object,committed:!0});break;case"delete":this.dispatch(Ic(e,o.uid)),this.events$.emit({type:"delete",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,committed:!0})}}acquireCommitLock(e){return!this.commitInProgress.get(e)&&(this.commitInProgress.set(e,!0),!0)}releaseCommitLock(e){this.commitInProgress.set(e,!1)}commit(e){const t=e??this.getActiveDocumentId();if(!this.getDocumentState(t).hasPendingChanges)return Gt.resolve(!0);if(!this.acquireCommitLock(t))return Gt.resolve(!0);const n=this.getCoreDocument(t),o=null==n?void 0:n.document;if(!o)return this.releaseCommitLock(t),Gt.reject({code:qt.NotFound,message:"Document not found"});const i=this.collectPendingChanges(t,o);if(i.isEmpty)return this.releaseCommitLock(t),Gt.resolve(!0);const r=new pt;return this.executeCommitBatch(t,o,i).wait(()=>{this.releaseCommitLock(t);this.getDocumentState(t).hasPendingChanges?this.commit(t).wait(e=>r.resolve(e),e=>r.fail(e)):r.resolve(!0)},e=>{this.releaseCommitLock(t),r.fail(e)}),r}getToolBehavior(e,t){var n;return void 0!==(null==(n=e.behavior)?void 0:n[t])?e.behavior[t]:!1!==this.config[t]}};wd.id="annotation";let xd=wd;function Cd(e){return t=>(null==t?void 0:t.id)===e}const Id=Cd("highlight"),kd=Cd("squiggly"),Sd=Cd("underline"),Pd=Cd("strikeout"),Md={manifest:Xl,create:(e,t)=>new xd(Yl,e,t),reducer:(e,t)=>{switch(t.type){case Ql:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Jl:{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 ec:{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 tc:{const{documentId:n,id:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUids:[o],selectedUid:o}}}:e}case nc:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedUids:[],selectedUid:null}}}:e}case oc:{const{documentId:n,id:o}=t.payload,i=e.documents[n];if(!i)return e;if(i.selectedUids.includes(o))return e;const r=[...i.selectedUids,o];return{...e,documents:{...e.documents,[n]:{...i,selectedUids:r,selectedUid:Zc(r)}}}}case ic:{const{documentId:n,id:o}=t.payload,i=e.documents[n];if(!i)return e;const r=i.selectedUids.filter(e=>e!==o);return{...e,documents:{...e.documents,[n]:{...i,selectedUids:r,selectedUid:Zc(r)}}}}case rc:{const{documentId:n,ids:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUids:o,selectedUid:Zc(o)}}}:e}case ac:{const{documentId:n,toolId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeToolId:o}}}:e}case sc:{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 cc:{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 lc:{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 dc:{const{documentId:n,committedUids:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(o),a={};let s=!1;for(const[e,t]of Object.entries(i.byUid))r.has(e)?a[e]={...t,commitState:"dirty"===t.commitState||"new"===t.commitState?"synced":t.commitState}:(a[e]=t,"new"!==t.commitState&&"dirty"!==t.commitState&&"deleted"!==t.commitState||(s=!0));return{...e,documents:{...e.documents,[n]:{...i,byUid:a,hasPendingChanges:s}}}}case uc:{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 gc:{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 mc:{const{toolId:n,patch:o}=t.payload;return{...e,tools:e.tools.map(e=>e.id===n?{...e,defaults:{...e.defaults,...o}}:e)}}case hc: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??Kc}})(t)},Dd="INTERACTION/INIT_STATE",Ad="INTERACTION/CLEANUP_STATE",zd="INTERACTION/ACTIVATE_MODE",Td="INTERACTION/PAUSE",Ed="INTERACTION/RESUME",Rd="INTERACTION/SET_CURSOR",_d="INTERACTION/SET_DEFAULT_MODE",Nd="INTERACTION/SET_EXCLUSION_RULES",Od="INTERACTION/ADD_EXCLUSION_CLASS",Ld="INTERACTION/REMOVE_EXCLUSION_CLASS",$d="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",Fd="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function jd(e){return{type:_d,payload:{mode:e}}}function Ud(e){return{type:Nd,payload:{rules:e}}}const Hd="pointerMode",Bd=class extends so{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$=vo(),this.onHandlerChange$=vo(),this.onCursorChange$=vo(),this.onStateChange$=yo(),this.registerMode({id:Hd,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(jd(Hd)),n.exclusionRules&&this.dispatch(Ud(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:Dd,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:Ad,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(Ud(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:Od,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:Ld,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:$d,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:Fd,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:zd,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.getActiveDocumentIdOrNull();t&&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(jd(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:Td,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){if(n.isImmediatePropagationStopped())break;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:Rd,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()}};Bd.id="interaction-manager";let Wd=Bd;const qd="interaction-manager",Gd={defaultMode:"pointerMode",exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},Vd={manifest:{id:qd,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new Wd(qd,e,t),reducer:(e=Gd,t)=>{switch(t.type){case Dd:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Ad:{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 zd:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeMode:o}}}:e}case Rd:{const{documentId:n,cursor:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,cursor:o}}}:e}case Td:{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 _d:return{...e,defaultMode:t.payload.mode};case Nd:return{...e,exclusionRules:t.payload.rules};case Od:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case Ld:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case $d:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case Fd:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:Gd},Kd=()=>Po(Wd.id);const Zd={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"},Yd=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],Xd="undefined"!=typeof PointerEvent?Yd:[...Yd,"touchstart","touchend","touchmove","touchcancel"];function Qd(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function Jd(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]=v);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)}),f=(e,t)=>{if(o)return o(e,t);const n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}};function v(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=Zd[t.type];if(!s||!(null==r?void 0:r[s]))return;let c,d;Qd(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault();let u=!1;if(Qd(t)){const e="touchend"===t.type||"touchcancel"===t.type?t.changedTouches[0]:t.touches[0];if(!e)return;c=f(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:()=>{},stopImmediatePropagation:()=>{u=!0},isImmediatePropagationStopped:()=>u}}else{const e=t;c=f(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)},stopImmediatePropagation:()=>{u=!0},isImmediatePropagationStopped:()=>u}}null==(o=r[s])||o.call(r,c,d,i.getActiveMode())}return()=>{d(),u(),p(),h()}}const eu=({children:e,documentId:t,style:n,...o})=>{const i=Ae(null),{provides:r}=Kd();return Me(()=>{if(r&&i.current)return Jd(r,{type:"global",documentId:t},i.current)},[r,t]),He("div",{ref:i,style:{width:"100%",height:"100%",...n},...o,children:e})},tu=({documentId:e,pageIndex:t,children:n,rotation:o,scale:i,convertEventToPoint:r,style:a,...s})=>{var l,c;const d=Ae(null),{provides:u}=Kd(),h=function(e){const{provides:t}=Kd(),[n,o]=Se(()=>{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=Do(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},f=o??(null==m?void 0:m.rotation)??0,v=i??(null==m?void 0:m.scale)??1,y=Ke(p,0,v),b=Te((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)}(Ke({width:y.width,height:y.height},f,1),o,f,v)},[p,f,v]);return Me(()=>{if(u&&d.current)return Jd(u,{type:"page",documentId:e,pageIndex:t},d.current,r||b)},[u,e,t,r,b]),He("div",{ref:d,style:{position:"relative",width:y.width,height:y.height,...a},...s,children:[n,h&&He("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},nu={},ou=()=>So(xd.id),iu=()=>Po(xd.id),ru=e=>{var t;const{provides:n}=iu(),[o,i]=Se((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??{pages:{},byUid:{},selectedUids:[],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 au({scale:e,documentId:t,pageIndex:n,rotation:o,pageWidth:i,pageHeight:r,trackedAnnotation:a,children:s,isSelected:l,isMultiSelected:c=!1,isDraggable:d,isResizable:u,lockAspectRatio:h=!1,style:m={},vertexConfig:g,selectionMenu:p,outlineOffset:f=1,onDoubleClick:v,onSelect:y,zIndex:b=1,resizeUI:w,vertexUI:x,selectionOutlineColor:C="#007ACC",customAnnotationRenderer:I,...k}){const[S,P]=Se(a.object),{provides:M}=iu(),{plugin:D}=ou(),{canModifyAnnotations:A}=Ro(t),z=Ae(null),T=A&&d&&!c,E=A&&u&&!c,R=ze(()=>M?M.forDocument(t):null,[M,t]),_=S?{...a.object,...S}:a.object,N=(null==w?void 0:w.color)??"#007ACC",O=(null==x?void 0:x.color)??"#007ACC",L=(null==w?void 0:w.size)??12,$=(null==x?void 0:x.size)??12,F=Ae(null),j=Te(e=>{var o;if(!(null==(o=e.transformData)?void 0:o.type)||c||!D)return;const{type:s,changes:l,metadata:d}=e.transformData,u=a.object.id,h={width:i,height:r};if("start"===e.state&&(F.current=a.object.rect,z.current=a.object,"move"===s?D.startDrag(t,{annotationIds:[u],pageSize:h}):"resize"===s&&D.startResize(t,{annotationIds:[u],pageSize:h,resizeHandle:(null==d?void 0:d.handle)??"se"})),l.rect&&F.current)if("move"===s){const e={x:l.rect.origin.x-F.current.origin.x,y:l.rect.origin.y-F.current.origin.y};D.updateDrag(t,e)}else"resize"===s&&D.updateResize(t,l.rect);if("vertex-edit"===s&&l.vertices&&g){const t=z.current??a.object,o=g.transformAnnotation(t,l.vertices),i=null==M?void 0:M.transformAnnotation(t,{type:s,changes:o,metadata:d});i&&(P(e=>({...e,...i})),"end"===e.state&&(null==R||R.updateAnnotation(n,u,i)))}"end"===e.state&&(F.current=null,z.current=null,"move"===s?D.commitDrag(t):"resize"===s&&D.commitResize(t))},[D,t,a.object,i,r,n,c,g,M,R]),{dragProps:U,vertices:H,resize:B}=ml({controller:{element:_.rect,vertices:null==g?void 0:g.extractVertices(_),constraints:{minWidth:10,minHeight:10,boundingBox:{width:i,height:r}},maintainAspectRatio:h,pageRotation:o,scale:e,enabled:l&&!c,onUpdate:j},resizeUI:{handleSize:L,spacing:f,offsetMode:"outside",includeSides:!h,zIndex:b+1},vertexUI:{vertexSize:$,zIndex:b+2},includeVertices:!!g}),W=function(e,{delay:t=300,tolerancePx:n=18}={}){const o=Ae({t:0,x:0,y:0}),i=Te(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=Te(t=>{null==e||e(t)},[e]);return e?{[ll]:r,onPointerUpCapture:i}:{}}(ze(()=>{if(A&&v)return v},[A,v]));Me(()=>{P(a.object)},[a.object]),Me(()=>{if(!D)return;const e=a.object.id,n=n=>{var o;if(n.documentId!==t)return;const i=null==(o=n.previewPatches)?void 0:o[e];"update"===n.type&&i?P(e=>({...e,...i})):"cancel"===n.type&&P(a.object)},o=[D.onDragChange(n),D.onResizeChange(n)];return()=>o.forEach(e=>e())},[D,t,a.object]);const q=l&&!c;return He("div",{"data-no-interaction":!0,children:[He("div",{...T&&l?U:{},...W,style:{position:"absolute",left:_.rect.origin.x*e,top:_.rect.origin.y*e,width:_.rect.size.width*e,height:_.rect.size.height*e,outline:q?`1px solid ${C}`:"none",outlineOffset:q?`${f}px`:"0px",pointerEvents:l&&!c?"auto":"none",touchAction:"none",cursor:l&&T?"move":"default",zIndex:b,...m},...k,children:[(()=>{const t="function"==typeof s?s(_):s,a=null==I?void 0:I({annotation:_,children:t,isSelected:l,scale:e,rotation:o,pageWidth:i,pageHeight:r,pageIndex:n,onSelect:y});return null!=a?a:t})(),l&&E&&B.map(({key:e,...t})=>(null==w?void 0:w.component)?w.component({key:e,...t,backgroundColor:N}):He("div",{...t,style:{...t.style,backgroundColor:N}},e)),l&&A&&!c&&H.map(({key:e,...t})=>(null==x?void 0:x.component)?x.component({key:e,...t,backgroundColor:O}):He("div",{...t,style:{...t.style,backgroundColor:O}},e))]}),p&&!c&&He(cl,{rect:{origin:{x:_.rect.origin.x*e,y:_.rect.origin.y*e},size:{width:_.rect.size.width*e,height:_.rect.size.height*e}},rotation:o,children:e=>p({...e,context:{type:"annotation",annotation:a,pageIndex:n},selected:l,placement:{suggestTop:!1}})})]})}function su({documentId:e,pageIndex:t,scale:n,rotation:o,pageWidth:i,pageHeight:r,selectedAnnotations:a,isDraggable:s,isResizable:l,resizeUI:c,selectionOutlineColor:d="#007ACC",outlineOffset:u=2,zIndex:h=100,groupSelectionMenu:m}){const{plugin:g}=ou(),p=Ae(null),f=Ae(!1),v=Ae(!1),y=ze(()=>function(e){return rt(e)??it}(a.map(e=>e.object.rect)),[a]),[b,w]=Se(y);Me(()=>{f.current||v.current||w(y)},[y]);const x=Te(t=>{var n,o;if(!(null==(n=t.transformData)?void 0:n.type))return;if(!g)return;const l=t.transformData.type,c="move"===l,d="resize"===l;if(c&&!s)return;"start"===t.state&&(p.current=y,c?(f.current=!0,g.startDrag(e,{annotationIds:a.map(e=>e.object.id),pageSize:{width:i,height:r}})):d&&(v.current=!0,g.startResize(e,{annotationIds:a.map(e=>e.object.id),pageSize:{width:i,height:r},resizeHandle:(null==(o=t.transformData.metadata)?void 0:o.handle)??"se"})));const u=p.current??y;if(c&&t.transformData.changes.rect){const n=t.transformData.changes.rect,o={x:n.origin.x-u.origin.x,y:n.origin.y-u.origin.y},i=g.updateDrag(e,o);w({...u,origin:{x:u.origin.x+i.x,y:u.origin.y+i.y}})}else if(d&&t.transformData.changes.rect){const n=t.transformData.changes.rect;g.updateResize(e,n),w(n)}"end"===t.state&&(p.current=null,c&&f.current?(f.current=!1,g.commitDrag(e)):d&&v.current&&(v.current=!1,g.commitResize(e)))},[g,e,i,r,y,s,a]),C=(null==c?void 0:c.color)??"#007ACC",I=(null==c?void 0:c.size)??12,{dragProps:k,resize:S}=ml({controller:{element:b,constraints:{minWidth:20,minHeight:20,boundingBox:{width:i,height:r}},maintainAspectRatio:!1,pageRotation:o,scale:n,enabled:!0,onUpdate:x},resizeUI:{handleSize:I,spacing:u,offsetMode:"outside",includeSides:!0,zIndex:h+1},vertexUI:{vertexSize:0,zIndex:h},includeVertices:!1});return a.length<2?null:He("div",{"data-group-selection-box":!0,"data-no-interaction":!0,children:[He("div",{...s?k:{onPointerDown:e=>e.stopPropagation()},style:{position:"absolute",left:b.origin.x*n,top:b.origin.y*n,width:b.size.width*n,height:b.size.height*n,outline:`2px dashed ${d}`,outlineOffset:u-1,cursor:s?"move":"default",touchAction:"none",zIndex:h},children:l&&S.map(({key:e,...t})=>(null==c?void 0:c.component)?c.component({key:e,...t,backgroundColor:C}):He("div",{...t,style:{...t.style,backgroundColor:C}},e))}),m&&He(cl,{rect:{origin:{x:b.origin.x*n,y:b.origin.y*n},size:{width:b.size.width*n,height:b.size.height*n}},rotation:o,children:e=>m({...e,context:{type:"group",annotations:a,pageIndex:t},selected:!0,placement:{suggestTop:!1}})})]})}function lu({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00";return He(H,{children:n.map((e,n)=>He("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:s,opacity:t,pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:void 0,...a}},n))})}function cu({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00",l=2*i;return He(H,{children:n.map((e,n)=>He("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:He("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:l,background:s,opacity:t,pointerEvents:"none"}})},n))})}function du({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00",l=2*i;return He(H,{children:n.map((e,n)=>He("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:He("div",{style:{position:"absolute",left:0,top:"50%",width:"100%",height:l,background:s,opacity:t,transform:"translateY(-50%)",pointerEvents:"none"}})},n))})}function uu({strokeColor:e,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??"#FFFF00"}" stroke-width="${s}" stroke-linecap="round"/>\n </svg>`)}")`;return He(H,{children:n.map((e,n)=>He("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:He("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 hu({isSelected:e,strokeColor:t,opacity:n=1,strokeWidth:o,inkList:i,rect:r,scale:a,onClick:s}){const l=t??"#000000",c=ze(()=>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]),d=r.size.width*a,u=r.size.height*a;return He("svg",{style:{position:"absolute",width:d,height:u,pointerEvents:"none",zIndex:2,overflow:"visible"},width:d,height:u,viewBox:`0 0 ${r.size.width} ${r.size.height}`,children:c.map((t,i)=>He("path",{d:t,fill:"none",opacity:n,onPointerDown:s,onTouchStart:s,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"visibleStroke",stroke:l,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}},i))})}function mu({isSelected:e,color:t="#000000",strokeColor:n,opacity:o=1,strokeWidth:i,strokeStyle:r=_t.SOLID,strokeDashArray:a,rect:s,scale:l,onClick:c}){const{width:d,height:u,x:h,y:m}=ze(()=>{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 He("svg",{style:{position:"absolute",width:g,height:p,pointerEvents:"none",zIndex:2},width:g,height:p,viewBox:`0 0 ${d+i} ${u+i}`,children:He("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===_t.DASHED&&{strokeDasharray:null==a?void 0:a.join(",")}}})})}function gu({color:e="#000000",strokeColor:t,opacity:n=1,strokeWidth:o,strokeStyle:i=_t.SOLID,strokeDashArray:r,rect:a,scale:s,onClick:l,isSelected:c}){const{width:d,height:u,cx:h,cy:m,rx:g,ry:p}=ze(()=>{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]),f=d*s,v=u*s;return He("svg",{style:{position:"absolute",width:f,height:v,pointerEvents:"none",zIndex:2},width:f,height:v,viewBox:`0 0 ${d} ${u}`,children:He("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===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}})})}function pu({color:e="transparent",opacity:t=1,strokeWidth:n,strokeColor:o="#000000",strokeStyle:i=_t.SOLID,strokeDashArray:r,rect:a,linePoints:s,lineEndings:l,scale:c,onClick:d,isSelected:u}){const{x1:h,y1:m,x2:g,y2:p}=ze(()=>({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]),f=ze(()=>{const e=Math.atan2(p-m,g-h);return{start:cd.createEnding(null==l?void 0:l.start,n,e+Math.PI,h,m),end:cd.createEnding(null==l?void 0:l.end,n,e,g,p)}},[l,n,h,m,g,p]),v=a.size.width*c,y=a.size.height*c;return He("svg",{style:{position:"absolute",width:v,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:v,height:y,viewBox:`0 0 ${a.size.width} ${a.size.height}`,children:[He("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===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),f.start&&He("path",{d:f.start.d,transform:f.start.transform,onPointerDown:d,onTouchStart:d,stroke:o,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":f.start.filled?"visible":"visibleStroke",...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:f.start.filled?e:"none"}),f.end&&He("path",{d:f.end.d,transform:f.end.transform,stroke:o,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":f.end.filled?"visible":"visibleStroke",...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:f.end.filled?e:"none"})]})}function fu({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=ze(()=>t.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[t,e]),u=ze(()=>{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=ze(()=>{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:cd.createEnding(null==c?void 0:c.start,r,t+Math.PI,d[0].x,d[0].y),end:cd.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 He("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:[He("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&&He("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&&He("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 vu({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=_t.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,currentVertex:u,handleSize:h=14}){const m=u?[...t,u]:t,g=ze(()=>m.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[m,e]),p=ze(()=>{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]),f=u&&t.length>0,v=e.size.width*l,y=e.size.height*l;return He("svg",{style:{position:"absolute",width:v,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:v,height:y,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[He("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===_t.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),f&&t.length>1&&He("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}}),f&&t.length>=2&&He("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 yu({isSelected:e,isEditing:t,annotation:n,pageIndex:o,scale:i,onClick:r}){const a=Ae(null),{provides:s}=iu(),[l,c]=Se(!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]),De(()=>{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 He("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:He("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,cn(p).css),textAlign:tn(n.object.textAlign),flexDirection:"column",justifyContent:n.object.verticalAlign===It.Top?"flex-start":n.object.verticalAlign===It.Middle?"center":"flex-end",display:"flex",backgroundColor:n.object.color??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,...nu,children:n.object.contents})});var p}function bu({documentId:e,pageIndex:t,annotation:n,scaleFactor:o=1,style:i,...r}){const{provides:a}=iu(),[s,l]=Se(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},Sn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):i.abort({code:qt.Cancelled,message:"canceled render task"})}}},[t,o,a,e,n.id,d,u]);return He(H,{children:s&&He("img",{src:s,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},...r,style:{width:"100%",height:"100%",display:"block",...i||{}}})})}function wu({isSelected:e,annotation:t,documentId:n,pageIndex:o,scale:i,onClick:r}){return He("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e?"none":"auto",cursor:"pointer"},onPointerDown:r,onTouchStart:r,children:He(bu,{documentId:n,pageIndex:o,annotation:{...t.object,id:t.object.id},scaleFactor:i})})}function xu({isSelected:e,strokeColor:t="#0000FF",strokeWidth:n=2,strokeStyle:o=_t.UNDERLINE,strokeDashArray:i,rect:r,scale:a,onClick:s,hasIRT:l=!1}){const{width:c,height:d}=ze(()=>({width:r.size.width,height:r.size.height}),[r]),u=c*a,h=d*a,m=ze(()=>{if(o===_t.DASHED)return(null==i?void 0:i.join(","))??`${3*n},${n}`},[o,i,n]),g=o===_t.UNDERLINE;return He("svg",{style:{position:"absolute",width:u,height:h,pointerEvents:"none",zIndex:2},width:u,height:h,viewBox:`0 0 ${c} ${d}`,children:[He("rect",{x:0,y:0,width:c,height:d,fill:"transparent",onPointerDown:l?void 0:s,onTouchStart:l?void 0:s,style:{cursor:l?"default":e?"move":"pointer",pointerEvents:l||e?"none":"visible"}}),g?He("line",{x1:1,y1:d-1,x2:c-1,y2:d-1,stroke:t,strokeWidth:n,strokeDasharray:m,style:{pointerEvents:"none"}}):He("rect",{x:n/2,y:n/2,width:Math.max(c-n,0),height:Math.max(d-n,0),fill:"transparent",stroke:t,strokeWidth:n,strokeDasharray:m,style:{pointerEvents:"none"}})]})}function Cu(e){const{documentId:t,pageIndex:n,scale:o,pageWidth:i,pageHeight:r,selectionMenu:a}=e,{provides:s}=iu(),{provides:l}=gl(),[c,d]=Se([]),{register:u}=function({modeId:e,pageIndex:t,documentId:n}){const{provides:o}=Kd();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}),[h,m]=Se([]),[g,p]=Se(null),f=ze(()=>s?s.forDocument(t):null,[s,t]),v=h.length>1;Me(()=>{if(f){const e=f.getState();return d(Fc(e,n)),m(Uc(e)),f.onStateChange(e=>{d(Fc(e,n)),m(Uc(e))})}},[f,n]);const y=ze(()=>({onPointerDown:(e,t)=>{t.target===t.currentTarget&&f&&(f.deselectAnnotation(),p(null))}}),[f]),b=Te((e,t)=>{if(e.stopPropagation(),f&&l){l.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?f.toggleSelection(n,t.object.id):f.selectAnnotation(n,t.object.id),t.object.id!==g&&p(null)}},[f,l,g,n]),w=Te((e,t)=>{if(e.stopPropagation(),f&&l){if(l.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,n=c.find(t=>t.object.id===e);if(n)return void f.selectAnnotation(n.object.pageIndex,e)}f.selectAnnotation(n,t.object.id)}},[f,l,c,n]);Me(()=>u(y,{documentId:t}),[u,y]);const x=ze(()=>c.filter(e=>h.includes(e.object.id)),[c,h]),C=ze(()=>!(x.length<2)&&x.every(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object);return(null==t?void 0:t.interaction.isGroupDraggable)??(null==t?void 0:t.interaction.isDraggable)??!0}),[x,f]),I=ze(()=>!(x.length<2)&&x.every(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object);return(null==t?void 0:t.interaction.isGroupResizable)??(null==t?void 0:t.interaction.isResizable)??!0}),[x,f]),k=ze(()=>{if(!f)return!1;const e=f.getSelectedAnnotations();return e.length>1&&e.every(e=>e.object.pageIndex===n)},[f,n,h]);return He(H,{children:[c.map(i=>{const r=h.includes(i.object.id),s=g===i.object.id,l=null==f?void 0:f.findToolForAnnotation(i.object);if(kc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(hu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Mc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(mu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Sc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(gu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Tc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(cu,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Ec(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(du,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Rc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(uu,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(zc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:yn(i.object.blendMode??kt.Multiply)},...e,children:e=>He(lu,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Dc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})},style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(H,{children:He(pu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(Ac(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(H,{children:He(fu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(Pc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(H,{children:He(vu,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(_c(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},onDoubleClick:e=>{e.stopPropagation(),p(i.object.id)},...e,children:e=>He(yu,{isSelected:r,isEditing:s,annotation:{...i,object:e},pageIndex:n,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Nc(i))return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,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:a,onSelect:e=>b(e,i),style:{mixBlendMode:yn(i.object.blendMode??kt.Normal)},...e,children:e=>He(wu,{isSelected:r,annotation:i,documentId:t,pageIndex:n,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Lc(i)){const t=!!i.object.inReplyToId;return He(au,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:!1,isResizable:!1,lockAspectRatio:!1,selectionMenu:t?void 0:a,onSelect:e=>w(e,i),...e,children:e=>He(xu,{...e,isSelected:r,scale:o,onClick:e=>w(e,i),hasIRT:t})},i.object.id)}return null}),k&&x.length>=2&&He(su,{documentId:t,pageIndex:n,scale:o,rotation:e.rotation,pageWidth:i,pageHeight:r,selectedAnnotations:x,isDraggable:C,isResizable:I,resizeUI:e.resizeUI,selectionOutlineColor:e.selectionOutlineColor,groupSelectionMenu:e.groupSelectionMenu})]})}function Iu({documentId:e,pageIndex:t,scale:n}){var o,i,r,a,s,l,c,d,u,h,m,g;const{provides:p}=gl(),{provides:f}=iu(),[v,y]=Se([]),[b,w]=Se(null),[x,C]=Se(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(f)return C(f.forDocument(e).getActiveTool()),f.forDocument(e).onActiveToolChange(e=>C(e))},[f,e]),!b)return null;if(!x||!x.defaults)return null;switch(x.defaults.type){case Mt.UNDERLINE:return He("div",{style:{mixBlendMode:yn((null==(o=x.defaults)?void 0:o.blendMode)??kt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(cu,{strokeColor:null==(i=x.defaults)?void 0:i.strokeColor,opacity:null==(r=x.defaults)?void 0:r.opacity,segmentRects:v,scale:n})});case Mt.HIGHLIGHT:return He("div",{style:{mixBlendMode:yn((null==(a=x.defaults)?void 0:a.blendMode)??kt.Multiply),pointerEvents:"none",position:"absolute",inset:0},children:He(lu,{strokeColor:null==(s=x.defaults)?void 0:s.strokeColor,opacity:null==(l=x.defaults)?void 0:l.opacity,segmentRects:v,scale:n})});case Mt.STRIKEOUT:return He("div",{style:{mixBlendMode:yn((null==(c=x.defaults)?void 0:c.blendMode)??kt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(du,{strokeColor:null==(d=x.defaults)?void 0:d.strokeColor,opacity:null==(u=x.defaults)?void 0:u.opacity,segmentRects:v,scale:n})});case Mt.SQUIGGLY:return He("div",{style:{mixBlendMode:yn((null==(h=x.defaults)?void 0:h.blendMode)??kt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(uu,{strokeColor:null==(m=x.defaults)?void 0:m.strokeColor,opacity:null==(g=x.defaults)?void 0:g.opacity,segmentRects:v,scale:n})});default:return null}}function ku({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===Mt.CIRCLE?He("div",{style:o,children:He(gu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.SQUARE?He("div",{style:o,children:He(mu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.POLYGON?He("div",{style:o,children:He(vu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.POLYLINE?He("div",{style:o,children:He(fu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.LINE?He("div",{style:o,children:He(pu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.INK?He("div",{style:o,children:He(hu,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.FREETEXT?He("div",{style:o,children:He("div",{style:{width:"100%",height:"100%",border:`1px dashed ${e.data.fontColor||"#000000"}`,backgroundColor:"transparent"}})}):null}function Su({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=ou(),[i,r]=Se(new Map),a=Ae(null),s=Ae(null),l=ze(()=>({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]),He(H,{children:[He("input",{ref:a,type:"file",style:{display:"none"}}),He("canvas",{ref:s,style:{display:"none"}}),Array.from(i.entries()).map(([e,t])=>He(ku,{preview:t,scale:n},e))]})}function Pu({style:e,documentId:t,pageIndex:n,scale:o,rotation:i,selectionMenu:r,groupSelectionMenu:a,resizeUI:s,vertexUI:l,selectionOutlineColor:c,customAnnotationRenderer:d,...u}){var h,m,g,p;const f=Do(t),v=null==(m=null==(h=null==f?void 0:f.document)?void 0:h.pages)?void 0:m[n],y=(null==(g=null==v?void 0:v.size)?void 0:g.width)??0,b=(null==(p=null==v?void 0:v.size)?void 0:p.height)??0,w=ze(()=>void 0!==o?o:(null==f?void 0:f.scale)??1,[o,null==f?void 0:f.scale]);return He("div",{style:{...e},...u,children:[He(Cu,{documentId:t,selectionMenu:r,groupSelectionMenu:a,pageIndex:n,scale:w,rotation:ze(()=>void 0!==i?i:(null==f?void 0:f.rotation)??Be.Degree0,[i,null==f?void 0:f.rotation]),pageWidth:y,pageHeight:b,resizeUI:s,vertexUI:l,selectionOutlineColor:c,customAnnotationRenderer:d}),He(Iu,{documentId:t,pageIndex:n,scale:w}),He(Su,{documentId:t,pageIndex:n,scale:w})]})}const Mu="print",Du={id:Mu,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},Au=class extends so{constructor(e,t,n){super(e,t),this.printReady$=vo()}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();if(!this.checkPermission(n,Ht.Print))return this.logger.debug("PrintPlugin","Print",`Cannot print: document ${n} lacks Print permission`),Gt.reject({code:qt.Security,message:"Document lacks Print permission"});const o=e??{},i=new pt;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):Gt.reject({code:qt.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()}};Au.id="print";let zu=Au;const Tu=()=>Po(zu.id);const Eu=xo({manifest:Du,create:(e,t)=>new zu(Mu,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{provides:e}=Tu(),{plugin:t}=So(zu.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]),He("iframe",{ref:n,style:{position:"absolute",display:"none"},title:"Print Document",src:"about:blank"})}).build(),Ru="fullscreen",_u={id:Ru,name:"Fullscreen Plugin",version:"1.0.0",provides:["fullscreen"],requires:[],optional:[],defaultConfig:{}},Nu="SET_FULLSCREEN";const Ou=class extends so{constructor(e,t,n){super(e,t),this.onStateChange$=yo(),this.fullscreenRequest$=vo(),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 Lu=Ou;const $u=()=>So(Lu.id);async function Fu(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 ju=xo({manifest:_u,create:(e,t)=>new Lu(Ru,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(Lu.id),{plugin:o}=$u(),{plugin:i}=$u(),r=Ae(null);return Me(()=>{if(!n||!o)return;return n.onRequest(async e=>{const t=o.getTargetSelector();await Fu(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]),He("div",{...t,style:{position:"relative",width:"100%",height:"100%",...t.style},ref:r,children:e})}).build(),Uu="bookmark",Hu={id:Uu,name:"Bookmark Plugin",version:"1.0.0",provides:["bookmark"],requires:[],optional:[],defaultConfig:{}},Bu=class extends so{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)}};Bu.id="bookmark";let Wu=Bu;const qu={manifest:Hu,create:e=>new Wu(Uu,e),reducer:()=>{},initialState:{}},Gu=class extends so{constructor(e,t,n){super(e,t),this.downloadRequest$=vo(),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):Gt.reject({code:qt.DocNotOpen,message:`Document ${t} not found`})}saveAsCopyAndGetBufferAndName(e){const t=new pt,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):Gt.reject({code:qt.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()}};Gu.id="export";let Vu=Gu;const Ku="export";const Zu=xo({manifest:{id:Ku,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{defaultFileName:"document.pdf"}},create:(e,t)=>new Vu(Ku,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{plugin:e}=So(Vu.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)},Sn)})},[e]),He("a",{style:{display:"none"},ref:t})}).build(),Yu="PAN/INIT_STATE",Xu="PAN/CLEANUP_STATE",Qu="PAN/SET_PAN_MODE";const Ju=class extends so{constructor(e,t,n){var o,i,r;super(e,t),this.panMode$=yo(),this.documentHandlers=new Map,this.config=n,this.interactionManager=null==(o=t.getPlugin(Wd.id))?void 0:o.provides(),this.viewport=null==(i=t.getPlugin(Qo.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:Qu,payload:{documentId:e,isPanMode:t}}}(e.documentId,t))}))}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Yu,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:Xu,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()}};Ju.id="pan";let eh=Ju;const th={documents:{},activeDocumentId:null},nh=xo({manifest:{id:"pan",name:"Pan Plugin",version:"1.0.0",provides:["pan"],requires:["interaction-manager","viewport"],optional:[],defaultConfig:{defaultMode:"mobile"}},create:(e,t)=>new eh("pan",e,t),reducer:(e=th,t)=>{switch(t.type){case Yu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Xu:{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 Qu:{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:th}).addUtility(()=>{const{provides:e}=Po(eh.id),{plugin:t}=So(eh.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(),oh="capture",ih={id:oh,name:"Capture Plugin",version:"1.0.0",provides:["capture"],requires:["render"],optional:["interaction-manager"],defaultConfig:{scale:1,imageType:"image/png",withAnnotations:!1}};const rh="CAPTURE/INIT_STATE",ah="CAPTURE/CLEANUP_STATE",sh="CAPTURE/SET_MARQUEE_CAPTURE_ACTIVE";const lh={isMarqueeCaptureActive:!1},ch={documents:{},activeDocumentId:null},dh=class extends so{constructor(e,t,n){var o;super(e,t),this.captureArea$=vo(),this.state$=yo(),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:sh,payload:{documentId:o,isActive:t}}))}))}onDocumentLoadingStarted(e){const t={...lh};this.dispatch(function(e,t){return{type:rh,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:ah,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=ho(e.x,0,t.width),o=ho(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})},Sn)}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()}};dh.id="capture";let uh=dh;const hh={manifest:ih,create:(e,t)=>new uh(oh,e,t),reducer:(e=ch,t)=>{switch(t.type){case rh:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case ah:{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 sh:{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:ch},mh=()=>Po(uh.id),gh=({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}=mh(),s=Do(e),[l,c]=Se(null),d=ze(()=>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?He("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},ph="history",fh={id:ph,name:"History Plugin",version:"1.0.0",provides:["history"],requires:[],optional:[],defaultConfig:{}},vh="HISTORY/INIT_STATE",yh="HISTORY/CLEANUP_STATE",bh="HISTORY/SET_DOCUMENT_STATE",wh=class extends so{constructor(e,t){super(e,t),this.documentHistories=new Map,this.historyChange$=vo()}async initialize(e){this.logger.info("HistoryPlugin","Initialize","History plugin initialized")}onDocumentLoadingStarted(e){this.dispatch((e=>({type:vh,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:yh,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:bh,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()}};wh.id="history";let xh=wh;const Ch={global:{canUndo:!1,canRedo:!1},topics:{}},Ih={documents:{},activeDocumentId:null},kh={manifest:fh,create:e=>new xh(ph,e),reducer:(e=Ih,t)=>{switch(t.type){case vh:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Ch}}}}case yh:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case bh:{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:Ih};var Sh=(e=>(e.MarqueeRedact="marqueeRedact",e.RedactSelection="redactSelection",e))(Sh||{});const Ph="REDACTION/INIT_STATE",Mh="REDACTION/CLEANUP_STATE",Dh="START_REDACTION",Ah="END_REDACTION",zh="ADD_PENDING",Th="REMOVE_PENDING",Eh="CLEAR_PENDING",Rh="SELECT_PENDING",_h="DESELECT_PENDING";const Nh=(e,t)=>({type:zh,payload:{documentId:e,items:t}}),Oh=(e,t,n)=>({type:Th,payload:{documentId:e,page:t,id:n}}),Lh=e=>({type:Eh,payload:e}),$h=(e,t)=>({type:Dh,payload:{documentId:e,mode:t}});const Fh=e=>Object.values(e).reduce((e,t)=>e+t.length,0),jh={isRedacting:!1,activeType:null,pending:{},pendingCount:0,selected:null},Uh={documents:{},activeDocumentId:null},Hh=class extends so{constructor(e,t,n){var o,i,r;super(e,t),this.redactionSelection$=new Map,this.pending$=yo(),this.selected$=yo(),this.state$=yo(),this.events$=yo(),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:Sh.MarqueeRedact,scope:"page",exclusive:!0,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Sh.RedactSelection,scope:"page",exclusive:!1})),null==(r=this.interactionManagerCapability)||r.onModeChange(e=>{const t=e.documentId;if(e.activeMode===Sh.RedactSelection)this.dispatch($h(t,Sh.RedactSelection));else if(e.activeMode===Sh.MarqueeRedact)this.dispatch($h(t,Sh.MarqueeRedact));else{const e=this.getDocumentState(t);(null==e?void 0:e.isRedacting)&&this.dispatch((e=>({type:Ah,payload:e}))(t))}})}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Ph,payload:{documentId:e,state:t}}}(e,{...jh})),this.redactionSelection$.set(e,yo());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;if(!this.checkPermission(e,Ht.ModifyContents))return;const o=n.getFormattedSelection().map(e=>({id:In(),kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.dispatch(Nh(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(Sh.RedactSelection,{showRects:!1},e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Mh,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.checkPermission(n,Ht.ModifyContents)?(this.dispatch(Nh(n,e)),this.emitPendingChange(n),this.events$.emit({type:"add",documentId:n,items:e})):this.logger.debug("RedactionPlugin","AddPendingItems",`Cannot add redactions: document ${n} lacks ModifyContents permission`)}removePendingItem(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(Oh(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(Lh(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:Rh,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:_h,payload:e}))(t)),this.emitSelectedChange(t)}enableRedactSelection(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Ht.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Sh.RedactSelection):this.logger.debug("RedactionPlugin","EnableRedactSelection",`Cannot enable redact selection: document ${n} lacks ModifyContents permission`)}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())===Sh.RedactSelection?o.activateDefaultMode():null==o||o.activate(Sh.RedactSelection)}isRedactSelectionActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Sh.RedactSelection}enableMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Ht.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Sh.MarqueeRedact):this.logger.debug("RedactionPlugin","EnableMarqueeRedact",`Cannot enable marquee redact: document ${n} lacks ModifyContents permission`)}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())===Sh.MarqueeRedact?o.activateDefaultMode():null==o||o.activate(Sh.MarqueeRedact)}isMarqueeRedactActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Sh.MarqueeRedact}startRedactionMode(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Ht.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Sh.RedactSelection):this.logger.debug("RedactionPlugin","StartRedactionMode",`Cannot start redaction mode: document ${n} lacks ModifyContents permission`)}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=ho(e.x,0,t.width),o=ho(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:In(),kind:"area",page:e.pageIndex,rect:t};this.dispatch(Nh(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:Sh.MarqueeRedact,handlers:o,pageIndex:e.pageIndex});return()=>{i(),r()}}queueCurrentSelectionAsPending(e){const t=e??this.getActiveDocumentId();if(!this.selectionCapability)return Gt.reject({code:qt.NotFound,message:"[RedactionPlugin] selection plugin required"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Gt.reject({code:qt.NotFound,message:"Document not found"});const o=this.selectionCapability.forDocument(t),i=o.getFormattedSelection();if(!i.length)return Gt.resolve(!0);const r=In(),a=i.map(e=>({id:r,kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.enableRedactSelection(t),this.dispatch(Nh(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(),Gt.resolve(!0)}commitPendingOne(e,t,n){const o=n??this.getActiveDocumentId();if(!this.checkPermission(o,Ht.ModifyContents))return this.logger.debug("RedactionPlugin","CommitPendingOne",`Cannot commit redaction: document ${o} lacks ModifyContents permission`),Gt.reject({code:qt.Security,message:"Document lacks ModifyContents permission"});const i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))return Gt.reject({code:qt.NotFound,message:"Document not found"});const r=this.getDocumentState(o);if(!r)return Gt.reject({code:qt.NotFound,message:"Document state not found"});const a=(r.pending[e]??[]).find(e=>e.id===t);if(!a)return Gt.resolve(!0);const s="text"===a.kind?a.rects:[a.rect],l=i.document.pages[e];if(!l)return Gt.reject({code:qt.NotFound,message:"Page not found"});const c=new pt;return this.engine.redactTextInRects(i.document,l,s,{drawBlackBoxes:this.config.drawBlackBoxes}).wait(()=>{this.dispatch(Oh(o,e,t)),this.emitPendingChange(o),this.dispatchCoreAction(Kn(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:qt.Unknown,message:"Failed to commit redactions"})}),c}commitAllPending(e){const t=e??this.getActiveDocumentId();if(!this.checkPermission(t,Ht.ModifyContents))return this.logger.debug("RedactionPlugin","CommitAllPending",`Cannot commit redactions: document ${t} lacks ModifyContents permission`),Gt.reject({code:qt.Security,message:"Document lacks ModifyContents permission"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Gt.reject({code:qt.NotFound,message:"Document not found"});const o=this.getDocumentState(t);if(!o)return Gt.reject({code:qt.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 pt;return pt.all(a).wait(()=>{this.dispatch(Lh(t)),this.dispatchCoreAction(Kn(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:qt.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()}};Hh.id="redaction";let Bh=Hh;const Wh="redaction",qh={manifest:{id:Wh,name:"Redaction Plugin",version:"1.0.0",provides:["redaction"],requires:[],optional:["interaction-manager","selection"],defaultConfig:{drawBlackBoxes:!0}},create:(e,t)=>new Bh(Wh,e,t),reducer:(e=Uh,t)=>{switch(t.type){case Ph:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Mh:{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 zh:{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:Fh(r)}}}}case Th:{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:Fh(s),selected:l?r.selected:null}}}}case Eh:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null}}}:e}case Rh:{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 _h:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selected:null}}}:e}case Dh:{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 Ah:{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:Uh},Gh=()=>So(Bh.id),Vh=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="red",fill:r="transparent"})=>{const{plugin:a}=Gh(),s=Do(e),[l,c]=Se(null),d=ze(()=>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?He("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 Kh({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:o,rect:i,scale:r,onClick:a,style:s,...l}){return He(H,{children:o.map((o,c)=>He("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 Zh({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=Gh(),[i,r]=Se([]),[a,s]=Se(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?He("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:He(Kh,{color:"transparent",opacity:1,rects:i,scale:n,border:"1px solid red"})}):null}function Yh({documentId:e,pageIndex:t,scale:n,bboxStroke:o="rgba(0,0,0,0.8)",rotation:i=Be.Degree0,selectionMenu:r}){const{provides:a}=Po(Bh.id),[s,l]=Se([]),[c,d]=Se(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=Te((n,o)=>{n.stopPropagation(),a&&a.forDocument(e).selectPending(t,o)},[a,e,t]);return s.length?He("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:s.map(e=>{if("area"===e.kind){const a=e.rect;return He(H,{children:[He("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&&He(cl,{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 He(H,{children:[He("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:He(Kh,{rect:a,rects:e.rects,color:"transparent",border:"1px solid red",scale:n,onClick:t=>u(t,e.id)})}),r&&He(cl,{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 Xh=({documentId:e,pageIndex:t,scale:n,rotation:o,selectionMenu:i})=>{const r=Do(e),a=ze(()=>void 0!==n?n:(null==r?void 0:r.scale)??1,[n,null==r?void 0:r.scale]);return He(H,{children:[He(Yh,{documentId:e,pageIndex:t,scale:a,rotation:ze(()=>void 0!==o?o:(null==r?void 0:r.rotation)??Be.Degree0,[o,null==r?void 0:r.rotation]),selectionMenu:i}),He(Vh,{documentId:e,pageIndex:t,scale:a}),He(Zh,{documentId:e,pageIndex:t,scale:a})]})},Qh=class extends so{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):Gt.reject({code:qt.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):Gt.reject({code:qt.NotFound,message:`Document ${t} not found`})}};Qh.id="attachment";let Jh=Qh;const em="attachment",tm={manifest:{id:em,name:"Attachment Plugin",version:"1.0.0",provides:["attachment"],requires:[],optional:[],defaultConfig:{}},create:e=>new Jh(em,e),reducer:()=>{},initialState:{}},nm=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),om="-",im=[],rm=e=>{const t=lm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return sm(e);const n=e.split(om),o=""===n[0]&&n.length>1?1:0;return am(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||im}return n[e]||im}}},am=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const n=am(e,t+1,i);if(n)return n}const r=n.validators;if(null===r)return;const a=0===t?e.join(om):e.slice(t).join(om),s=r.length;for(let e=0;e<s;e++){const t=r[e];if(t.validator(a))return t.classGroupId}},sm=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})(),lm=e=>{const{theme:t,classGroups:n}=e;return cm(n,t)},cm=(e,t)=>{const n=nm();for(const o in e){const i=e[o];dm(i,n,o,t)}return n},dm=(e,t,n,o)=>{const i=e.length;for(let r=0;r<i;r++){const i=e[r];um(i,t,n,o)}},um=(e,t,n,o)=>{"string"!=typeof e?"function"!=typeof e?gm(e,t,n,o):mm(e,t,n,o):hm(e,t,n)},hm=(e,t,n)=>{(""===e?t:pm(t,e)).classGroupId=n},mm=(e,t,n,o)=>{fm(e)?dm(e(o),t,n,o):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},gm=(e,t,n,o)=>{const i=Object.entries(e),r=i.length;for(let e=0;e<r;e++){const[r,a]=i[e];dm(a,pm(t,r),n,o)}},pm=(e,t)=>{let n=e;const o=t.split(om),i=o.length;for(let e=0;e<i;e++){const t=o[e];let i=n.nextPart.get(t);i||(i=nm(),n.nextPart.set(t,i)),n=i}return n},fm=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,vm=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)}}},ym=[],bm=(e,t,n,o,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:i}),wm=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 bm(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)):bm(ym,!1,t,void 0,!0)}if(n){const e=o;o=t=>n({className:t,parseClassName:e})}return o},xm=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}},Cm=/\s+/,Im=e=>{if("string"==typeof e)return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Im(e[o]))&&(n&&(n+=" "),n+=t);return n},km=(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(Cm);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 f=0===d.length?"":1===d.length?d[0]:r(d).join(":"),v=u?f+"!":f,y=v+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(v+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:vm(e.cacheSize),parseClassName:wm(e),sortModifiers:xm(e),...rm(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=Im(t))&&(i&&(i+=" "),i+=n);return i})(...e))},Sm=[],Pm=e=>{const t=t=>t[e]||Sm;return t.isThemeGetter=!0,t},Mm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dm=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Am=/^\d+\/\d+$/,zm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tm=/\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$/,Em=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Rm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_m=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nm=e=>Am.test(e),Om=e=>!!e&&!Number.isNaN(Number(e)),Lm=e=>!!e&&Number.isInteger(Number(e)),$m=e=>e.endsWith("%")&&Om(e.slice(0,-1)),Fm=e=>zm.test(e),jm=()=>!0,Um=e=>Tm.test(e)&&!Em.test(e),Hm=()=>!1,Bm=e=>Rm.test(e),Wm=e=>_m.test(e),qm=e=>!Vm(e)&&!Jm(e),Gm=e=>ag(e,dg,Hm),Vm=e=>Mm.test(e),Km=e=>ag(e,ug,Um),Zm=e=>ag(e,hg,Om),Ym=e=>ag(e,lg,Hm),Xm=e=>ag(e,cg,Wm),Qm=e=>ag(e,gg,Bm),Jm=e=>Dm.test(e),eg=e=>sg(e,ug),tg=e=>sg(e,mg),ng=e=>sg(e,lg),og=e=>sg(e,dg),ig=e=>sg(e,cg),rg=e=>sg(e,gg,!0),ag=(e,t,n)=>{const o=Mm.exec(e);return!!o&&(o[1]?t(o[1]):n(o[2]))},sg=(e,t,n=!1)=>{const o=Dm.exec(e);return!!o&&(o[1]?t(o[1]):n)},lg=e=>"position"===e||"percentage"===e,cg=e=>"image"===e||"url"===e,dg=e=>"length"===e||"size"===e||"bg-size"===e,ug=e=>"length"===e,hg=e=>"number"===e,mg=e=>"family-name"===e,gg=e=>"shadow"===e,pg=km(()=>{const e=Pm("color"),t=Pm("font"),n=Pm("text"),o=Pm("font-weight"),i=Pm("tracking"),r=Pm("leading"),a=Pm("breakpoint"),s=Pm("container"),l=Pm("spacing"),c=Pm("radius"),d=Pm("shadow"),u=Pm("inset-shadow"),h=Pm("text-shadow"),m=Pm("drop-shadow"),g=Pm("blur"),p=Pm("perspective"),f=Pm("aspect"),v=Pm("ease"),y=Pm("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Jm,Vm],w=()=>[Jm,Vm,l],x=()=>[Nm,"full","auto",...w()],C=()=>[Lm,"none","subgrid",Jm,Vm],I=()=>["auto",{span:["full",Lm,Jm,Vm]},Lm,Jm,Vm],k=()=>[Lm,"auto",Jm,Vm],S=()=>["auto","min","max","fr",Jm,Vm],P=()=>["auto",...w()],M=()=>[Nm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],D=()=>[e,Jm,Vm],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ng,Ym,{position:[Jm,Vm]}],z=()=>["auto","cover","contain",og,Gm,{size:[Jm,Vm]}],T=()=>[$m,eg,Km],E=()=>["","none","full",c,Jm,Vm],R=()=>["",Om,eg,Km],_=()=>[Om,$m,ng,Ym],N=()=>["","none",g,Jm,Vm],O=()=>["none",Om,Jm,Vm],L=()=>["none",Om,Jm,Vm],$=()=>[Om,Jm,Vm],F=()=>[Nm,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fm],breakpoint:[Fm],color:[jm],container:[Fm],"drop-shadow":[Fm],ease:["in","out","in-out"],font:[qm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fm],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fm],shadow:[Fm],spacing:["px",Om],text:[Fm],"text-shadow":[Fm],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nm,Vm,Jm,f]}],container:["container"],columns:[{columns:[Om,Vm,Jm,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:[Lm,"auto",Jm,Vm]}],basis:[{basis:[Nm,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Om,Nm,"auto","initial","none",Vm]}],grow:[{grow:["",Om,Jm,Vm]}],shrink:[{shrink:["",Om,Jm,Vm]}],order:[{order:[Lm,"first","last","none",Jm,Vm]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":S()}],"auto-rows":[{"auto-rows":S()}],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:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"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,eg,Km]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Jm,Zm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$m,Vm]}],"font-family":[{font:[tg,Vm,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,Jm,Vm]}],"line-clamp":[{"line-clamp":[Om,"none",Jm,Zm]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",Jm,Vm]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Jm,Vm]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Om,"from-font","auto",Jm,Km]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Om,"auto",Jm,Vm]}],"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",Jm,Vm]}],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",Jm,Vm]}],"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:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lm,Jm,Vm],radial:["",Jm,Vm],conic:[Lm,Jm,Vm]},ig,Xm]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:T()}],"gradient-via-pos":[{via:T()}],"gradient-to-pos":[{to:T()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],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:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":R()}],"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:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Om,Jm,Vm]}],"outline-w":[{outline:["",Om,eg,Km]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,rg,Qm]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,rg,Qm]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Om,Km]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,rg,Qm]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Om,Jm,Vm]}],"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":[Om]}],"mask-image-linear-from-pos":[{"mask-linear-from":_()}],"mask-image-linear-to-pos":[{"mask-linear-to":_()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":_()}],"mask-image-t-to-pos":[{"mask-t-to":_()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":_()}],"mask-image-r-to-pos":[{"mask-r-to":_()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":_()}],"mask-image-b-to-pos":[{"mask-b-to":_()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":_()}],"mask-image-l-to-pos":[{"mask-l-to":_()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":_()}],"mask-image-x-to-pos":[{"mask-x-to":_()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":_()}],"mask-image-y-to-pos":[{"mask-y-to":_()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Jm,Vm]}],"mask-image-radial-from-pos":[{"mask-radial-from":_()}],"mask-image-radial-to-pos":[{"mask-radial-to":_()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":[Om]}],"mask-image-conic-from-pos":[{"mask-conic-from":_()}],"mask-image-conic-to-pos":[{"mask-conic-to":_()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"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:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Jm,Vm]}],filter:[{filter:["","none",Jm,Vm]}],blur:[{blur:N()}],brightness:[{brightness:[Om,Jm,Vm]}],contrast:[{contrast:[Om,Jm,Vm]}],"drop-shadow":[{"drop-shadow":["","none",m,rg,Qm]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Om,Jm,Vm]}],"hue-rotate":[{"hue-rotate":[Om,Jm,Vm]}],invert:[{invert:["",Om,Jm,Vm]}],saturate:[{saturate:[Om,Jm,Vm]}],sepia:[{sepia:["",Om,Jm,Vm]}],"backdrop-filter":[{"backdrop-filter":["","none",Jm,Vm]}],"backdrop-blur":[{"backdrop-blur":N()}],"backdrop-brightness":[{"backdrop-brightness":[Om,Jm,Vm]}],"backdrop-contrast":[{"backdrop-contrast":[Om,Jm,Vm]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Om,Jm,Vm]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Om,Jm,Vm]}],"backdrop-invert":[{"backdrop-invert":["",Om,Jm,Vm]}],"backdrop-opacity":[{"backdrop-opacity":[Om,Jm,Vm]}],"backdrop-saturate":[{"backdrop-saturate":[Om,Jm,Vm]}],"backdrop-sepia":[{"backdrop-sepia":["",Om,Jm,Vm]}],"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",Jm,Vm]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Om,"initial",Jm,Vm]}],ease:[{ease:["linear","initial",v,Jm,Vm]}],delay:[{delay:[Om,Jm,Vm]}],animate:[{animate:["none",y,Jm,Vm]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Jm,Vm]}],"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:[Jm,Vm,"","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:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",Jm,Vm]}],"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",Jm,Vm]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Om,eg,Km,Zm]}],stroke:[{stroke:["none",...D()]}],"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 fg=["children","onClick","active","disabled","className","anchorRef"];function vg(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,fg);return j("button",h({ref:c,onClick:n,disabled:a,className:pg("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 yg=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"}))},bg=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"}))},wg=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"}))},xg=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"}))},Cg=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 Ig={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:yg,chevronLeft:bg,chevronDown:wg,search:xg,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:"M10 18v-12a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -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:Cg,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"}))},unlock: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 9.9-1"}))},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"}))},eye: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:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),j("circle",{cx:"12",cy:"12",r:"3"}))},"eye-off":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:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),j("line",{x1:"1",y1:"1",x2:"23",y2:"23"}))},info: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("circle",{cx:"12",cy:"12",r:"10"}),j("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),j("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"}))},link: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 15l6 -6"}),j("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),j("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}))},linkOff: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 15l3 -3m2 -2l1 -1"}),j("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.072 7.071l-.534 .464"}),j("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),j("path",{d:"M3 3l18 18"}))},externalLink:function(e){return j("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e.className},j("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),j("path",{d:"M11 13l9 -9"}),j("path",{d:"M15 4h5v5"}))},marqueeSelect: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 20h6"}),j("path",{d:"M20 17v6"}),j("path",{d:"M4 13v-2"}),j("path",{d:"M4 6v-1a1 1 0 0 1 1 -1h1"}),j("path",{d:"M6 20h-1a1 1 0 0 1 -1 -1v-1"}),j("path",{d:"M11 4h2"}),j("path",{d:"M11 20h2"}),j("path",{d:"M18 4h1a1 1 0 0 1 1 1v1"}),j("path",{d:"M20 11v2"}))},group: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 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M17 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M17 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M5 7v10"}),j("path",{d:"M19 7v10"}),j("path",{d:"M7 5h10"}),j("path",{d:"M7 19h10"}),j("path",{d:"M8 8H12.8V11.2H16V16H11.2V12.8H8V8Z"}))},ungroup: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("rect",{x:"4",y:"4",width:"7",height:"7",rx:"1"}),j("rect",{x:"13",y:"13",width:"7",height:"7",rx:"1"}))}},kg=new Map,Sg=/^[MmZzLlHhVvCcSsQqTtAa0-9\s,.\-eE]+$/;function Pg(e){return Sg.test(e.trim())}function Mg(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||!Pg(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.")}kg.set(e,n)}function Dg(e){for(var t=0,n=Object.entries(e);t<n.length;t++){var o=v(n[t],2);Mg(o[0],o[1])}}function Ag(e,t,n){return e&&"none"!==e?"primary"===e?t:"secondary"===e?n:"currentColor"===e?"currentColor":e:"none"}function zg(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=Ig[n];if(m)return j(m,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o});if(t=n,kg.has(t)){var g=function(e){return kg.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=Ag(e.stroke,r,a),i=Ag(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 Tg=["id","children","onClick","active","disabled","className","tooltip","elementRef"];function Eg(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,Tg);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 Rg=Math.min,_g=Math.max,Ng=Math.round,Og=Math.floor,Lg=e=>({x:e,y:e}),$g={left:"right",right:"left",bottom:"top",top:"bottom"},Fg={start:"end",end:"start"};function jg(e,t,n){return _g(e,Rg(t,n))}function Ug(e,t){return"function"==typeof e?e(t):e}function Hg(e){return e.split("-")[0]}function Bg(e){return e.split("-")[1]}function Wg(e){return"x"===e?"y":"x"}function qg(e){return"y"===e?"height":"width"}const Gg=new Set(["top","bottom"]);function Vg(e){return Gg.has(Hg(e))?"y":"x"}function Kg(e){return Wg(Vg(e))}function Zg(e){return e.replace(/start|end/g,e=>Fg[e])}const Yg=["left","right"],Xg=["right","left"],Qg=["top","bottom"],Jg=["bottom","top"];function ep(e,t,n,o){const i=Bg(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Xg:Yg:t?Yg:Xg;case"left":case"right":return t?Qg:Jg;default:return[]}}(Hg(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(Zg)))),r}function tp(e){return e.replace(/left|right|bottom|top/g,e=>$g[e])}function np(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 op(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 ip(e,t,n){let{reference:o,floating:i}=e;const r=Vg(t),a=Kg(t),s=qg(a),l=Hg(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(Bg(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function rp(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}=Ug(t,e),g=np(m),p=s[h?"floating"===u?"reference":"floating":u],f=op(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})),v="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=op(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(f.top-w.top+g.top)/b.y,bottom:(w.bottom-f.bottom+g.bottom)/b.y,left:(f.left-w.left+g.left)/b.x,right:(w.right-f.right+g.right)/b.x}}const ap=new Set(["left","top"]);function sp(){return"undefined"!=typeof window}function lp(e){return up(e)?(e.nodeName||"").toLowerCase():"#document"}function cp(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function dp(e){var t;return null==(t=(up(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function up(e){return!!sp()&&(e instanceof Node||e instanceof cp(e).Node)}function hp(e){return!!sp()&&(e instanceof Element||e instanceof cp(e).Element)}function mp(e){return!!sp()&&(e instanceof HTMLElement||e instanceof cp(e).HTMLElement)}function gp(e){return!(!sp()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof cp(e).ShadowRoot)}const pp=new Set(["inline","contents"]);function fp(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!pp.has(i)}const vp=new Set(["table","td","th"]);function yp(e){return vp.has(lp(e))}const bp=[":popover-open",":modal"];function wp(e){return bp.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const xp=["transform","translate","scale","rotate","perspective"],Cp=["transform","translate","scale","rotate","perspective","filter"],Ip=["paint","layout","strict","content"];function kp(e){const t=Sp(),n=hp(e)?Dp(e):e;return xp.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Cp.some(e=>(n.willChange||"").includes(e))||Ip.some(e=>(n.contain||"").includes(e))}function Sp(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Pp=new Set(["html","body","#document"]);function Mp(e){return Pp.has(lp(e))}function Dp(e){return cp(e).getComputedStyle(e)}function Ap(e){return hp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zp(e){if("html"===lp(e))return e;const t=e.assignedSlot||e.parentNode||gp(e)&&e.host||dp(e);return gp(t)?t.host:t}function Tp(e){const t=zp(e);return Mp(t)?e.ownerDocument?e.ownerDocument.body:e.body:mp(t)&&fp(t)?t:Tp(t)}function Ep(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Tp(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=cp(i);if(r){const e=Rp(a);return t.concat(a,a.visualViewport||[],fp(i)?i:[],e&&n?Ep(e):[])}return t.concat(i,Ep(i,[],n))}function Rp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _p(e){const t=Dp(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=mp(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=Ng(n)!==r||Ng(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function Np(e){return hp(e)?e:e.contextElement}function Op(e){const t=Np(e);if(!mp(t))return Lg(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=_p(t);let a=(r?Ng(n.width):n.width)/o,s=(r?Ng(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const Lp=Lg(0);function $p(e){const t=cp(e);return Sp()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Lp}function Fp(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=Np(e);let a=Lg(1);t&&(o?hp(o)&&(a=Op(o)):a=Op(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==cp(e))&&t}(r,n,o)?$p(r):Lg(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=cp(r),t=o&&hp(o)?cp(o):o;let n=e,i=Rp(n);for(;i&&o&&t!==n;){const e=Op(i),t=i.getBoundingClientRect(),o=Dp(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=cp(i),i=Rp(n)}}return op({width:d,height:u,x:l,y:c})}function jp(e,t){const n=Ap(e).scrollLeft;return t?t.left+n:Fp(dp(e)).left+n}function Up(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-jp(e,n),y:n.top+t.scrollTop}}const Hp=new Set(["absolute","fixed"]);function Bp(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=cp(e),o=dp(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=Sp();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=jp(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=dp(e),n=Ap(e),o=e.ownerDocument.body,i=_g(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=_g(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+jp(e);const s=-n.scrollTop;return"rtl"===Dp(o).direction&&(a+=_g(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(dp(e));else if(hp(t))o=function(e,t){const n=Fp(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=mp(e)?Op(e):Lg(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=$p(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return op(o)}function Wp(e,t){const n=zp(e);return!(n===t||!hp(n)||Mp(n))&&("fixed"===Dp(n).position||Wp(n,t))}function qp(e,t,n){const o=mp(t),i=dp(t),r="fixed"===n,a=Fp(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=Lg(0);function c(){l.x=jp(i)}if(o||!o&&!r)if(("body"!==lp(t)||fp(i))&&(s=Ap(t)),o){const e=Fp(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?Lg(0):Up(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 Gp(e){return"static"===Dp(e).position}function Vp(e,t){if(!mp(e)||"fixed"===Dp(e).position)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function Kp(e,t){const n=cp(e);if(wp(e))return n;if(!mp(e)){let t=zp(e);for(;t&&!Mp(t);){if(hp(t)&&!Gp(t))return t;t=zp(t)}return n}let o=Vp(e,t);for(;o&&yp(o)&&Gp(o);)o=Vp(o,t);return o&&Mp(o)&&Gp(o)&&!kp(o)?n:o||function(e){let t=zp(e);for(;mp(t)&&!Mp(t);){if(kp(t))return t;if(wp(t))return null;t=zp(t)}return null}(e)||n}const Zp={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=dp(o),s=!!t&&wp(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=Lg(1);const d=Lg(0),u=mp(o);if((u||!u&&!r)&&(("body"!==lp(o)||fp(a))&&(l=Ap(o)),mp(o))){const e=Fp(o);c=Op(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?Lg(0):Up(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:dp,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?wp(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Ep(e,[],!1).filter(e=>hp(e)&&"body"!==lp(e)),i=null;const r="fixed"===Dp(e).position;let a=r?zp(e):e;for(;hp(a)&&!Mp(a);){const t=Dp(a),n=kp(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&Hp.has(i.position)||fp(a)&&!n&&Wp(e,a))?o=o.filter(e=>e!==a):i=t,a=zp(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=Bp(t,n,i);return e.top=_g(o.top,e.top),e.right=Rg(o.right,e.right),e.bottom=Rg(o.bottom,e.bottom),e.left=_g(o.left,e.left),e},Bp(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Kp,getElementRects:async function(e){const t=this.getOffsetParent||Kp,n=this.getDimensions,o=await n(e.floating);return{reference:qp(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}=_p(e);return{width:t,height:n}},getScale:Op,isElement:hp,isRTL:function(e){return"rtl"===Dp(e).direction}};function Yp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xp(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=Np(e),d=i||r?[...c?Ep(c):[],...Ep(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=dp(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:-Og(u)+"px "+-Og(i.clientWidth-(d+h))+"px "+-Og(i.clientHeight-(u+m))+"px "+-Og(d)+"px",threshold:_g(0,Rg(1,l))||1};let p=!0;function f(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||Yp(c,e.getBoundingClientRect())||a(),p=!1}try{o=new IntersectionObserver(f,{...g,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(f,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?Fp(e):null;return l&&function t(){const o=Fp(e);p&&!Yp(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 Qp=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=Hg(n),s=Bg(n),l="y"===Vg(n),c=ap.has(a)?-1:1,d=r&&l?-1:1,u=Ug(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}}}}},Jp=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}=Ug(e,t),c={x:n,y:o},d=await rp(t,l),u=Vg(Hg(i)),h=Wg(u);let m=c[h],g=c[u];if(r){const e="y"===h?"bottom":"right";m=jg(m+d["y"===h?"top":"left"],m,m-d[e])}if(a){const e="y"===u?"bottom":"right";g=jg(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}}}}}},ef=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,...f}=Ug(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=Hg(i),y=Vg(s),b=Hg(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[tp(s)]:function(e){const t=tp(e);return[Zg(e),t,Zg(t)]}(s)),C="none"!==g;!h&&C&&x.push(...ep(s,p,g,w));const I=[s,...x],k=await rp(t,f),S=[];let P=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&S.push(k[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=Bg(e),i=Kg(e),r=qg(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=tp(a)),[a,tp(a)]}(i,a,w);S.push(k[e[0]],k[e[1]])}if(P=[...P,{placement:i,overflows:S}],!S.every(e=>e<=0)){var M,D;const e=((null==(M=r.flip)?void 0:M.index)||0)+1,t=I[e];if(t){if(!("alignment"===u&&y!==Vg(t))||P.every(e=>Vg(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:P},reset:{placement:t}}}let n=null==(D=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:D.placement;if(!n)switch(m){case"bestFit":{var A;const e=null==(A=P.filter(e=>{if(C){const t=Vg(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{}}}},tf=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}=Ug(e,t)||{};if(null==c)return{};const u=np(d),h={x:n,y:o},m=Kg(i),g=qg(m),p=await a.getDimensions(c),f="y"===m,v=f?"top":"left",y=f?"bottom":"right",b=f?"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 k=w/2-x/2,S=I/2-p[g]/2-1,P=Rg(u[v],S),M=Rg(u[y],S),D=P,A=I-p[g]-M,z=I/2-p[g]/2+k,T=jg(D,z,A),E=!l.arrow&&null!=Bg(i)&&z!==T&&r.reference[g]/2-(z<D?P:M)-p[g]/2<0,R=E?z<D?z-D:z-A:0;return{[m]:h[m]+R,data:{[m]:T,centerOffset:z-T-R,...E&&{alignmentOffset:R}},reset:E}}}),nf=(e,t,n)=>{const o=new Map,i={platform:Zp,...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}=ip(c,o,l),h=o,m={},g=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:f,y:v,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!=f?f:d,u=null!=v?v: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}=ip(c,h,l))),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:m}})(e,t,{...i,platform:r})};var of=function(){function e(){return i(this,e),o(this,e,arguments)}return c(e,B),r(e,[{key:"render",value:function(){return this.props.children}}])}();function rf(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),f=Ae(null),y=v(Se(!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 Xp(g.current.base,p.current,function(){nf(g.current.base,p.current,{placement:i,middleware:[Qp(8),ef(),Jp({padding:8}),tf({element:f.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(f.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(H,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:f,className:"absolute h-2 w-2 rotate-45 bg-inherit ".concat("light"===u?"border-border-subtle border":""," ")})),j(of,{ref:g},t))}function af(e){var t=e.commandId,n=e.documentId,o=e.variant,i=void 0===o?"icon":o,r=e.itemId,a=e.className,s=ba(t,n),l=Kr(n,r||t);if(!s||!s.visible)return null;var c=s.iconProps||{};return j(rf,{content:s.label,position:"bottom",delay:500,trigger:s.active||s.disabled?"none":"hover"},j(Eg,{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("span",{className:"flex items-center whitespace-nowrap"},s.icon&&j(zg,{icon:s.icon,className:"mr-1.5 h-5 w-5 flex-shrink-0",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(zg,{icon:s.icon,className:pg("h-5 w-5",c.className),primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}):j("span",null,s.label)))}function sf(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:pg("flex items-center gap-2",s,a?"bg-bg-surface-alt":"",r)},Tr(t)),t.items.map(function(e){return j(lf,{key:e.id,item:e,documentId:n})}))}function lf(e){var t=e.item,n=e.documentId;switch(t.type){case"command-button":return j(cf,{item:t,documentId:n});case"tab-group":return j(df,{item:t,documentId:n});case"divider":return j(mf,{item:t});case"spacer":return j(gf,{item:t});case"group":return j(pf,{item:t,documentId:n});case"custom":return j(ff,{item:t,documentId:n});default:return console.warn("Unknown toolbar item type:",t),null}}function cf(e){var t=e.item,n=e.documentId;return j("div",h({},Tr(t)),j(af,{commandId:t.commandId,documentId:n,itemId:t.id,variant:t.variant}))}function df(e){var t=e.item,n=e.documentId;return j("div",h(h({className:"flex items-center gap-2"},Tr(t)),{},{role:"tablist"}),t.tabs.map(function(e){return j(uf,{key:e.id,tab:e,documentId:n})}))}function uf(e){var t=e.tab,n=e.documentId,o=ba(t.commandId,n),i=Kr(n,t.id);if(!o||!o.visible)return null;return j("div",h({},Tr(t)),j(vg,{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(hf,{icon:o.icon,iconProps:o.iconProps}),"icon-text"===t.variant&&j(H,null,o.icon&&j(hf,{icon:o.icon,iconProps:o.iconProps}),o.label)))}function hf(e){var t=e.icon,n=e.iconProps;return j(zg,{icon:t,className:"h-5 w-5",primaryColor:null==n?void 0:n.primaryColor,secondaryColor:null==n?void 0:n.secondaryColor})}function mf(e){var t=e.item;return j("div",h({},Tr(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 gf(e){var t=e.item;return j("div",h(h({className:t.flex?"flex-1":"w-4"},Tr(t)),{},{"aria-hidden":"true"}))}function pf(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:pg("flex items-center",o,i)},Tr(t)),t.items.map(function(e){return j(lf,{key:e.id,item:e,documentId:n})}))}function ff(e){var t=e.item,n=e.documentId,o=Xr().renderCustomComponent;return j("div",h({},Tr(t)),o(t.componentId,n,t.props))}function vf(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 yf(e,t){this.props=e,this.context=t}(yf.prototype=new B).isPureReactComponent=!0,yf.prototype.shouldComponentUpdate=function(e,t){return vf(this.props,e)||vf(this.state,t)};var bf=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),bf&&bf(e)};var wf=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);wf(e,t,n,o)};var xf=I.unmount;function Cf(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 Cf(e,t,n)})),e}function If(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return If(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 kf(){this.__u=0,this.o=null,this.__b=null}function Sf(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Pf(){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),xf&&xf(e)},(kf.prototype=new B).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var i=Sf(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]=If(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)},kf.prototype.componentWillUnmount=function(){this.o=[]},kf.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]=Cf(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&j(H,null,e.fallback);return i&&(i.__u&=-33),[j(H,null,t.__a?null:e.children),i]};var Mf=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 Df(e){return this.getChildContext=function(){return e.context},e.children}function Af(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(Df,{context:t.context},e.__v),t.v)}function zf(e,t){var n=j(Af,{__v:e,h:t});return n.containerInfo=t,n}(Pf.prototype=new B).__a=function(e){var t=this,n=Sf(t.__v),o=t.l.get(e);return o[0]++,function(i){var r=function(){t.props.revealOrder?(o.push(i),Mf(t,e,o)):i()};n?n(r):r()}},Pf.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},Pf.prototype.componentDidUpdate=Pf.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Mf(e,n,t)})};var Tf="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Ef=/^(?: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]/,Rf=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,_f=/[A-Z0-9]/g,Nf="undefined"!=typeof document,Of=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};B.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(B.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lf=I.event;function $f(){}function Ff(){return this.cancelBubble}function jf(){return this.defaultPrevented}I.event=function(e){return Lf&&(e=Lf(e)),e.persist=$f,e.isPropagationStopped=Ff,e.isDefaultPrevented=jf,e.nativeEvent=e};var Uf={enumerable:!1,configurable:!0,get:function(){return this.class}},Hf=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||Nf&&"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||Of(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":Rf.test(r)&&(r=s):s=r="oninput":i&&Ef.test(r)?r=r.replace(_f,"-$&").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",Uf)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Tf,Hf&&Hf(e)};var Bf=I.__r;I.__r=function(e){Bf&&Bf(e),e.__c};var Wf=I.diffed;I.diffed=function(e){Wf&&Wf(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 qf(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=Wr().getContainer,a=Se(function(){var e=r();return!!e&&e.clientWidth<768}),s=v(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=Xr().renderCustomComponent,g=r();if(l&&g)return zf(j(Gf,{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),f=h?{width:h}:void 0;return j("div",{className:"".concat(p," border-border-default bg-bg-surface flex flex-col shadow-lg"),style:f,"data-sidebar-id":t.id},j("div",{className:"min-h-0 flex-1"},"tabs"===u.type&&j(Vf,{content:u,documentId:n,renderCustomComponent:m}),"component"===u.type&&j(H,null,m(u.componentId,n,{}))))}function Gf(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.renderCustomComponent,a=e.content,s=e.rootElement,l=v(Se("closed"),2),c=l[0],d=l[1],u=v(Se(!1),2),h=u[0],m=u[1],g=v(Se(0),2),p=g[0],f=g[1],y=v(Se(!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 k=function(e){switch(e){case"closed":return 0;case"half":return 50;case"full":return 100}},S=Te(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()},f(0),t!==c&&d(t),m(!0)}},[s,c]),P=Te(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=k(C.current.state);f(o-i)}},[h,s]),M=Te(function(){if(h){if(Math.abs(C.current.y-I.current.y)<5)return m(!1),void f(0);var e=k(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),f(0),i()):(m(!1),f(0),d(o))}},[h,p,i]),D=Te(function(e){S(e.touches[0].clientY)},[S]),A=Te(function(e){h&&(e.cancelable&&e.preventDefault(),P(e.touches[0].clientY))},[h,P]),z=Te(function(){M()},[M]),T=Te(function(e){e.preventDefault(),S(e.clientY)},[S]);if(Me(function(){if(h){var e=function(e){P(e.clientY)},t=function(){M()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[h,P,M]),!b)return null;var E=k(h?C.current.state:c),R=h?Math.max(0,Math.min(100,E+p)):E,_=.3*Math.min(R/50,1);return j(H,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(0===R?"pointer-events-none":""),style:{opacity:_},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(R,"%")},"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:D,onTouchMove:A,onTouchEnd:z,onMouseDown:T},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(Vf,{content:a,documentId:n,renderCustomComponent:r}),"component"===a.type&&j(H,null,r(a.componentId,n,{})))))}function Vf(e){var t,n=e.content,o=e.documentId,i=e.renderCustomComponent,r=v(Se((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(zg,{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(H,{key:e.id},i(e.componentId,o,{}))})))}function Kf(e){var t=e.schema,n=e.documentId,o=e.anchorEl,i=e.onClose,r=Wr().getContainer,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:768,n=v(Se(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}=Ur();return(null==e?void 0:e.getSchema())??null})(),c=v(Se([{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=Te(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=Te(function(){d.length>1&&u(function(e){return e.slice(0,-1)})},[d.length]);return h?a&&s?zf(j(Zf,{currentMenu:h,menuStack:d,documentId:n,onClose:i,onNavigateBack:g,onNavigateToSubmenu:m,container:s}),s):j(Yf,{currentMenu:h,documentId:n,anchorEl:o,onClose:i,onNavigateToSubmenu:m}):null}function Zf(e){var t=e.currentMenu,n=e.menuStack,o=e.documentId,i=e.onClose,r=e.onNavigateBack,a=e.onNavigateToSubmenu,s=e.container,l=v(Se(!1),2),c=l[0],d=l[1],u=v(Se(!1),2),m=u[0],g=u[1],p=v(Se(0),2),f=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=v(Se(null),2),I=C[0],k=C[1];Me(function(){if(w.current){var e=(n.length>1?60:0)+w.current.scrollHeight+24,t=.8*s.clientHeight;k(Math.min(e,t))}},[t,n.length,s]);var S=Te(function(){g(!1),setTimeout(function(){d(!1),i()},300)},[i]),P=Te(function(e){b.current&&(x.current={isDragging:!0,startY:e,currentY:e,startTime:Date.now(),sheetHeight:b.current.offsetHeight})},[]),M=Te(function(e){if(x.current.isDragging){var t=e-x.current.startY,n=Math.max(0,t);x.current.currentY=e,y(n)}},[]),D=Te(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?S():y(0)}}},[S]),A=Te(function(e){P(e.touches[0].clientY)},[P]),z=Te(function(e){x.current.isDragging&&e.cancelable&&e.preventDefault(),M(e.touches[0].clientY)},[M]),T=Te(function(){D()},[D]),E=Te(function(e){e.preventDefault(),P(e.clientY)},[P]);if(Me(function(){if(x.current.isDragging){var e=function(e){return M(e.clientY)},t=function(){return D()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[M,D]),Me(function(){var e=function(e){"Escape"===e.key&&S()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[S]),!c)return null;var R=m?f:I||400;return j(H,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(m?"opacity-100":"opacity-0"),onClick:S}),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(R,"px)")}},Tr(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:z,onTouchEnd:T,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(bg,{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(Xf,{key:e.id,item:e,documentId:o,onClose:S,isMobile:!0,onNavigateToSubmenu:a})}))))}function Yf(e){var t=e.currentMenu,n=e.documentId,o=e.anchorEl,i=e.onClose,r=e.onNavigateToSubmenu,a=Ae(null),s=v(Se(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},Tr(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(Xf,{key:e.id,item:e,documentId:n,onClose:i,isMobile:!1,onNavigateToSubmenu:r})}))}function Xf(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu;switch(t.type){case"command":return j(Qf,{item:t,documentId:n,onClose:o,isMobile:i});case"submenu":return j(Jf,{item:t,documentId:n,isMobile:i,onNavigateToSubmenu:r});case"divider":return j("div",h({},Tr(t)),j("hr",{className:"border-border-subtle my-2"}));case"section":return j(ev,{item:t,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r});default:return null}}function Qf(e){var t,n,o=e.item,i=e.documentId,r=e.onClose,a=e.isMobile,s=ba(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({},Tr(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(zg,{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({},Tr(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(zg,{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 Jf(e){var t=e.item,n=e.documentId,o=e.isMobile,i=e.onNavigateToSubmenu,r=Ta(n).translate,a=t.labelKey?r(t.labelKey):t.label||"",s=function(){return i(t.menuId,a)};return o?j("button",h(h({},Tr(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(yg,{className:"h-4 w-4"})):j("button",h(h({},Tr(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(yg,{className:"h-6 w-6"}))}function ev(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu,a=Ta(n).translate,s=t.labelKey?a(t.labelKey):t.label||"";return j("div",h({},Tr(t)),j("div",{className:"text-fg-secondary px-4 py-3 text-xs font-medium uppercase"},s),t.items.map(function(e){return j(Xf,{key:e.id,item:e,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r})}))}function tv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,a=t.content,s=Xr().renderCustomComponent;return"component"!==a.type?(console.warn("SchemaModal only supports component content type, got: ".concat(a.type)),null):j(H,null,s(a.componentId,n,{isOpen:o,onClose:i,onExited:r}))}function nv(e){var t=e.documentId;e.onClose;var n=bi(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(Kl,{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(Zl,{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 ov(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=v(Se(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)},rv=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 av(e){var t=e.documentId;e.onClose;var n=(e=>{const{provides:t}=Ts(),[n,o]=Se(ks),i=ze(()=>null==t?void 0:t.forDocument(e),[t,e]);return Me(()=>{if(i)return o(i.getState()),i.onStateChange(e=>o(e));o(ks)},[i]),{state:n,provides:i??null}})(t),o=n.state,i=n.provides,r=yi().provides,a=Ta(t).translate,s=Ae(null),l=v(Se(""),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&&m(o.activeResultIndex)},[o.activeResultIndex]);var u=ov(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(xg,{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(Cg,{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(Ut.MatchCase),onChange:function(e){return h(Ut.MatchCase,e)}}),j(iv,{label:a("search.wholeWord"),checked:o.flags.includes(Ut.MatchWholeWord),onChange:function(e){return h(Ut.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(Eg,{onClick:function(){null==i||i.previousResult()}},j(bg,{className:"h-4 w-4"})),j(Eg,{onClick:function(){null==i||i.nextResult()}},j(yg,{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=v(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(rv,{key:n,hit:t,active:n===o.activeResultIndex,onClick:function(){null==i||i.goToResult(n)}})})))}),j("div",null)))}function sv(e){var t=e.documentId,n=Po(Wu.id).provides,o=yi().provides,i=Ta(t).translate,r=Do(t),a=v(Se([]),2),s=a[0],l=a[1],c=v(Se(new Set),2),d=c[0],u=c[1],h=v(Se(!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:qt.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===Pt.Goto||n.type===Pt.RemoteGoto)t=n.destination;else if(n.type===Pt.URI)return void window.open(n.uri,"_blank")}else"destination"===e.target.type&&(t=e.target.destination);if(t)if(t.zoom.mode===bt.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?wg:yg,{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 lv(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 cv(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 dv,uv=function(e){var t=e.documentId,n=Kd().provides,o=v(Se({show:!1,mode:null,isAnimating:!1}),2),i=o[0],r=o[1],a=Ta(t).translate;Me(function(){if(n)return n.onModeChange(function(e){var t=e.activeMode;if("marqueeZoom"===t||"marqueeCapture"===t){r({show:!0,mode:t,isAnimating:!0});var n=setTimeout(function(){r(function(e){return h(h({},e),{},{show:!1})})},3e3);return function(){return clearTimeout(n)}}r({show:!1,mode:null,isAnimating:!1})})},[n]);if(!i.show&&!i.isAnimating)return null;var s="marqueeZoom"===i.mode?a("zoom.dragTip"):a("capture.dragTip"),l="marqueeZoom"===i.mode?"rgba(33,150,243,0.8)":"rgba(76,175,80,0.8)";return j("div",{className:"hint-overlay ".concat(i.show?"hint-show":"hint-hide"),onAnimationEnd:function(){i.show||r(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"}},s),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(l),borderRadius:"4px",opacity:.6}}),j("div",{className:"animated-rect",style:{position:"absolute",top:"20px",left:"20px",border:"2px solid ".concat(l),backgroundColor:"".concat(l.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 "))},hv=function(e){var t=e.placeholder,n=e.onSubmit,o=e.inputRef,i=e.isFocused,r=v(Se(""),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"}))))},mv=["bg-red-500","bg-blue-500","bg-green-500","bg-yellow-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-teal-500"],gv=function(e){if(!e)return mv[0];var t=e.length>0?e.charCodeAt(0)%mv.length:0;return mv[t]},pv=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(gv(t)," ").concat(o)},function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"G"}(t))},fv=function(e){var t,n,o=e.onEdit,i=e.onDelete,r=e.onClose,a=e.documentId,s=Ae(null),l=Ta(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"))))},vv=function(e){var t=e.initialText,n=e.onSave,o=e.onCancel,i=e.autoFocus,r=void 0!==i&&i,a=e.documentId,s=v(Se(t),2),l=s[0],c=s[1],d=Ae(null),u=Ta(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"))))},yv=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)"}},bv=function(e){var t=e.annotation,n=e.onSave,o=e.onDelete,i=e.isReply,r=void 0!==i&&i,a=e.documentId,s=e.isReadOnly,l=void 0!==s&&s,c=v(Se(!1),2),d=c[0],u=c[1],h=v(Se(!1),2),m=h[0],g=h[1],p=t.author||"Guest";return m?j("div",{className:"flex w-full items-start space-x-3",onClick:function(e){return e.stopPropagation()}},r&&j(pv,{name:p,className:"h-8 w-8"}),j(vv,{initialText:t.contents||"",onSave:function(e){n(e),g(!1)},onCancel:function(){g(!1)},autoFocus:!0,documentId:a})):j("div",{className:"flex items-start space-x-3"},r&&j(pv,{name:p,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"},p),j("span",{className:"text-fg-muted text-xs"},yv(t.modified||t.created))),!l&&j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),u(!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"}))),d&&j(fv,{onEdit:function(){return g(!0)},onDelete:o,onClose:function(){return u(!1)},documentId:a}))),j("p",{className:"text-fg-primary mt-2 text-sm"},t.contents)))},wv=(s(s(s(s(s(s(s(s(s(s(dv={},Mt.HIGHLIGHT,{label:"Highlight",labelKey:"annotation.highlight",icon:"highlight",iconProps:function(e){return{primaryColor:e.strokeColor||"#ffff00"}}}),Mt.CIRCLE,{label:"Circle",labelKey:"annotation.circle",icon:"circle",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Mt.SQUARE,{label:"Square",labelKey:"annotation.square",icon:"square",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Mt.LINE,{label:"Line",labelKey:"annotation.line",icon:"line",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.UNDERLINE,{label:"Underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.SQUIGGLY,{label:"Squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.STRIKEOUT,{label:"Strikethrough",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.INK,{label:"Ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.FREETEXT,{label:"Text",labelKey:"annotation.freeText",icon:"text",iconProps:function(e){return{primaryColor:e.fontColor||"#000000"}}}),Mt.POLYGON,{label:"Polygon",labelKey:"annotation.polygon",icon:"polygon",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),s(s(dv,Mt.POLYLINE,{label:"Polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.STAMP,{label:"Stamp",labelKey:"annotation.stamp",icon:"deviceFloppy",iconProps:function(){return{primaryColor:"#dc2626"}}})),xv=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=v(Se(!1),2),l=s[0],c=s[1],d=Ta(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)},Cv=function(e){var t=e.annotation,n=e.config,o=e.className,i=void 0===o?"":o,r=e.title,a=n.iconProps(t.object);return j("div",{className:"bg-bg-surface-alt flex items-center justify-center rounded-full ".concat(i),title:r},j(zg,h({icon:n.icon},a)))},Iv=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=e.isReadOnly,d=void 0!==c&&c,u=n.annotation,h=n.replies,m=v(Se(!1),2),g=m[0],p=m[1],f=v(Se(!1),2),y=f[0],b=f[1],w=Ta(l).translate,x=function(e){return $c(e)?wv[e.object.type]:null}(u),C=!!u.object.contents,I=h.length>0,k=!C&&!I,S=Ae(null),P=u.object.author||"Guest";if(Me(function(){var e;o&&(null===(e=S.current)||void 0===e||e.focus({preventScroll:!0}))},[o,n]),!x)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(Cv,{annotation:u,config:x,title:w(x.labelKey,{fallback:x.label}),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"},P),j("span",{className:"text-fg-disabled text-xs"},yv(u.object.modified||u.object.created))),!d&&j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),p(!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"}))),g&&j(fv,{onEdit:function(){return b(!0)},onDelete:function(){return a(u)},onClose:function(){return p(!1)},documentId:l}))),(null===(t=u.object.custom)||void 0===t?void 0:t.text)&&j(xv,{text:u.object.custom.text,maxWords:14,className:"text-fg-muted mt-2 text-sm",documentId:l}),y?j("div",{className:"mt-2"},j(vv,{initialText:u.object.contents||"",onSave:function(e){r(u.object.id,e),b(!1)},onCancel:function(){b(!1)},autoFocus:!0,documentId:l})):C?j("p",{className:"text-fg-primary mt-2 text-sm"},u.object.contents):null)),I&&j("div",{className:"border-border-subtle mt-4 space-y-4 border-t pt-4"},h.map(function(e){return j(bv,{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,isReadOnly:d})})),!y&&!d&&j(hv,{inputRef:S,isFocused:o,placeholder:w(k?"comments.addComment":"comments.addReply"),onSubmit:function(e){k?r(u.object.id,e):s(u.object.id,e)}})))},kv=function(e){var t=e.documentId,n=Ta(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(zg,{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")))},Sv=function(e){var t=e.documentId,n=iu().provides,o=ru(t).state,i=yi().provides,r=Ta(t).translate,s=Ro(t).canModifyAnnotations,l=Ae({}),c=Ae(null),d=!s,u=o.selectedUid?Hc(o,o.selectedUid):null,h=(e=>{const t={};for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&Oc(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&&$c(o)&&a.push({page:r,annotation:o,replies:t[o.object.id]??[]})}a.length>0&&(n[r]=a)}return n})(o);Me(function(){if(u&&c.current){var e=l.current[u.object.id];if(e&&c.current){var t=c.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"})}}},[u]);var m=function(e,t){var o=v(e);o&&(null==n||n.updateAnnotation(o.object.pageIndex,e,{contents:t,modified:new Date}))},g=function(e){null==n||n.deleteAnnotation(e.object.pageIndex,e.object.id)},p=function(e,t){var o=v(e);o&&(null==n||n.createAnnotation(o.object.pageIndex,{id:In(),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:Mt.TEXT,contents:t,inReplyToId:o.object.id,flags:["noRotate","noZoom","print"],icon:At.Comment}))},f=Object.keys(h).map(Number).sort(function(e,t){return e-t}),v=function(e){var t,n=a(f);try{for(n.s();!(t=n.n()).done;){var o,i=t.value,r=a(h[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===f.length?j(kv,{documentId:t}):j("div",{ref:c,className:"h-full overflow-y-auto"},j("div",{className:"space-y-6 p-3"},f.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===h[e].length?r("comments.commentCount",{params:{count:1}}):r("comments.commentCountPlural",{params:{count:h[e].length}})))),j("div",{className:"space-y-3 px-1"},h[e].map(function(e){return j("div",{key:e.annotation.object.id,ref:function(t){t&&(l.current[e.annotation.object.id]=t)}},j(Iv,{entry:e,isSelected:(null==u?void 0:u.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:m,onDelete:g,onReply:p,documentId:t,isReadOnly:d}))})))})))};function Pv(e){var t=e.documentId,n=(e=>{const{provides:t}=qa(),[n,o]=Se(ja);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=v(Se(""),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(af,{commandId:"zoom:toggle-menu",documentId:t,itemId:"zoom-menu-button"}),j(af,{commandId:"zoom:out",documentId:t}),j(af,{commandId:"zoom:in",documentId:t})))}var Mv,Dv=function(e){var t=e.documentId,n=Ta(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(zg,{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")))},Av={color:{key:"color",type:"colorWithTransparent",labelKey:"annotation.fillColor"},strokeColor:{key:"strokeColor",type:"colorWithTransparent",labelKey:"annotation.strokeColor"},opacity:{key:"opacity",type:"opacity",labelKey:"annotation.opacity",min:.1,max:1,step:.05,debounce:!0},strokeWidth:{key:"strokeWidth",type:"slider",labelKey:"annotation.strokeWidth",min:1,max:30,step:1,unit:"px",debounce:!0},strokeStyle:{key:"strokeStyle",type:"strokeStyle",labelKey:"annotation.borderStyle"},lineEndings:{key:"lineEndings",type:"lineEndings",labelKey:"annotation.lineEndings"},fontFamily:{key:"fontFamily",type:"fontFamily",labelKey:"annotation.fontFamily"},fontSize:{key:"fontSize",type:"fontSize",labelKey:"annotation.fontSize"},fontColor:{key:"fontColor",type:"fontColor",labelKey:"annotation.fontColor"},textAlign:{key:"textAlign",type:"textAlign",labelKey:"annotation.textAlign"},verticalAlign:{key:"verticalAlign",type:"verticalAlign",labelKey:"annotation.verticalAlign"},blendMode:{key:"blendMode",type:"blendMode",labelKey:"annotation.blendMode"}},zv=(s(s(s(s(s(s(s(s(s(s(Mv={},Mt.INK,["strokeColor","opacity","strokeWidth"]),Mt.CIRCLE,["color","opacity","strokeColor","strokeStyle","strokeWidth"]),Mt.SQUARE,["color","opacity","strokeColor","strokeStyle","strokeWidth"]),Mt.POLYGON,["strokeColor","opacity","strokeStyle","strokeWidth","color"]),Mt.LINE,["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color"]),Mt.POLYLINE,["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color"]),Mt.HIGHLIGHT,["strokeColor","opacity","blendMode"]),Mt.UNDERLINE,["strokeColor","opacity","blendMode"]),Mt.STRIKEOUT,["strokeColor","opacity","blendMode"]),Mt.SQUIGGLY,["strokeColor","opacity","blendMode"]),s(Mv,Mt.FREETEXT,["fontFamily","fontSize","fontColor","textAlign","verticalAlign","opacity","color"]));var Tv,Ev=["position"],Rv=function(){var e=v(Se(!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}},_v=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=Rv(),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))})))},Nv=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)},Ov=function(e){var t=e.children,n=e.className;return j("span",{class:"text-fg-muted text-xs ".concat(void 0===n?"":n)},t)},Lv=function(e){var t=e.children,n=e.className;return j("section",{class:"mb-6 ".concat(void 0===n?"":n)},t)},$v=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))}})},Fv=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)}})},jv=[{id:_t.SOLID},{id:_t.DASHED,dash:[6,2]},{id:_t.DASHED,dash:[8,4]},{id:_t.DASHED,dash:[3,3]},{id:_t.DASHED,dash:[1,2]},{id:_t.DASHED,dash:[4,2,1,2]},{id:_t.DASHED,dash:[8,4,1,4]}],Uv=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"}}))},Hv=function(e){return j(_v,h(h({},e),{},{options:jv,getOptionKey:function(e){var t;return e.id+((null===(t=e.dash)||void 0===t?void 0:t.join("-"))||"")},renderValue:function(e){return Uv(e.dash)},renderOption:function(e){return j("div",{class:"px-1 py-2"},Uv(e.dash))}}))},Bv=[zt.None,zt.Square,zt.Circle,zt.Diamond,zt.OpenArrow,zt.ClosedArrow,zt.ROpenArrow,zt.RClosedArrow,zt.Butt,zt.Slash],Wv=function(e){var t,n=e.ending,o=e.position,i=s(s(s(s(s(s(s(s(s({},zt.Square,j("path",{d:"M68 -4 L76 -4 L76 4 L68 4 Z"})),zt.Circle,j("circle",{cx:"72",cy:"0",r:"4"})),zt.Diamond,j("path",{d:"M72 -5 L77 0 L72 5 L67 0 Z"})),zt.OpenArrow,j("path",{d:"M67 -5 L77 0 L67 5",fill:"none"})),zt.ClosedArrow,j("path",{d:"M67 -5 L77 0 L67 5 Z"})),zt.ROpenArrow,j("path",{d:"M77 -5 L67 0 L77 5",fill:"none"})),zt.RClosedArrow,j("path",{d:"M77 -5 L67 0 L77 5 Z"})),zt.Butt,j("path",{d:"M72 -5 L72 5",fill:"none"})),zt.Slash,j("path",{d:"M67 -5 L77 5",fill:"none"})),r=s(s(s(s(s(s(s(s(s({},zt.Square,68),zt.Circle,68),zt.Diamond,67),zt.OpenArrow,76),zt.ClosedArrow,67),zt.ROpenArrow,67),zt.RClosedArrow,67),zt.Butt,72),zt.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)))},qv=function(e){var t=e.position,n=m(e,Ev);return j(_v,h(h({},n),{},{options:Bv,getOptionKey:function(e){return e},triggerClass:"px-3 py-1",renderValue:function(e){return j(Wv,{ending:e,position:t})},renderOption:function(e){return j("div",{class:"px-1 py-1"},j(Wv,{ending:e,position:t}))}}))},Gv=function(e){return j(_v,h(h({},e),{},{options:gn,getOptionKey:function(e){return e},triggerClass:"px-2 py-1 text-sm",renderValue:function(e){return j("span",null,pn(e))},renderOption:function(e){return j("div",{class:"px-2 py-1"},pn(e))}}))},Vv=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=Rv(),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)})))};function Kv(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)}function Zv(e){switch(e.config.type){case"color":return He(Yv,h(h({},e),{},{allowTransparent:!1}));case"colorWithTransparent":return He(Yv,h(h({},e),{},{allowTransparent:!0}));case"opacity":return He(Xv,h({},e));case"slider":return He(Qv,h({},e));case"strokeStyle":return He(Jv,h({},e));case"lineEndings":return He(ey,h({},e));case"fontFamily":return He(ty,h({},e));case"fontSize":return He(ny,h({},e));case"fontColor":return He(oy,h({},e));case"textAlign":return He(iy,h({},e));case"verticalAlign":return He(ry,h({},e));case"blendMode":return He(sy,h({},e));default:return null}}function Yv(e){var t=e.config,n=e.value,o=e.onChange,i=e.colorPresets,r=e.translate,a=e.allowTransparent,s=v(Se(null!=n?n:"#000000"),2),l=s[0],c=s[1];Me(function(){return c(null!=n?n:"#000000")},[n]);var d=function(e){c(e),o(e)};return He(Lv,{children:[He(Nv,{className:"mb-3",children:r(t.labelKey)}),He("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:[i.map(function(e){return He(Fv,{color:e,active:e===l,onSelect:d},e)}),a&&He(Fv,{color:"transparent",active:"transparent"===l,onSelect:d})]})]})}function Xv(e){var t,n,o,i=e.config,r=e.value,a=e.onChange,s=e.translate,l=v(Se(null!=r?r:1),2),c=l[0],d=l[1];Me(function(){return d(null!=r?r:1)},[r]);var u=ov(c,300);return Me(function(){u!==r&&a(u)},[u]),He(Lv,{children:[He(Nv,{children:s(i.labelKey)}),He($v,{value:c,min:null!==(t=i.min)&&void 0!==t?t:.1,max:null!==(n=i.max)&&void 0!==n?n:1,step:null!==(o=i.step)&&void 0!==o?o:.05,onChange:d}),He(Ov,{children:[Math.round(100*c),"%"]})]})}function Qv(e){var t,n,o,i,r,a=e.config,s=e.value,l=e.onChange,c=e.translate,d=v(Se(null!==(t=null!=s?s:a.min)&&void 0!==t?t:1),2),u=d[0],h=d[1];Me(function(){var e;return h(null!==(e=null!=s?s:a.min)&&void 0!==e?e:1)},[s]);var m=ov(u,300);return Me(function(){m!==s&&l(m)},[m]),He(Lv,{children:[He(Nv,{children:c(a.labelKey)}),He($v,{value:u,min:null!==(n=a.min)&&void 0!==n?n:1,max:null!==(o=a.max)&&void 0!==o?o:30,step:null!==(i=a.step)&&void 0!==i?i:1,onChange:h}),He(Ov,{children:[u,null!==(r=a.unit)&&void 0!==r?r:""]})]})}function Jv(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se("object"===w(n)&&null!==n?n:{id:null!=n?n:_t.SOLID}),2),a=r[0],s=r[1];Me(function(){var e="object"===w(n)&&null!==n?n:{id:null!=n?n:_t.SOLID};s(e)},[n]);return He(Lv,{children:[He(Nv,{className:"mb-3",children:i(t.labelKey)}),He(Hv,{value:a,onChange:function(e){s(e),o({strokeStyle:e.id,strokeDashArray:e.dash})}})]})}function ey(e){e.config;var t=e.value,n=e.onChange,o=e.translate,i=null!=t?t:{start:zt.None,end:zt.None},r=v(Se(i.start),2),a=r[0],s=r[1],l=v(Se(i.end),2),c=l[0],d=l[1];Me(function(){s(i.start),d(i.end)},[t]);return He(Lv,{children:He("div",{class:"grid grid-cols-2 gap-4",children:[He("div",{children:[He(Nv,{className:"mb-3",children:o("annotation.lineStart")}),He(qv,{value:a,onChange:function(e){s(e),n({start:e,end:c})},position:"start"})]}),He("div",{children:[He(Nv,{className:"mb-3",children:o("annotation.lineEnd")}),He(qv,{value:c,onChange:function(e){d(e),n({start:a,end:e})},position:"end"})]})]})})}function ty(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=null!=n?n:xt.Helvetica,a=dn(r),s=un(r),l=hn(r),c=v(Se(a),2),d=c[0],u=c[1],h=v(Se(s),2),m=h[0],g=h[1],p=v(Se(l),2),f=p[0],y=p[1];Me(function(){var e=null!=n?n:xt.Helvetica;u(dn(e)),g(un(e)),y(hn(e))},[n]);var b=function(e,t,n){var i=mn(e,{bold:t,italic:n});o(i)};return He(Lv,{children:[He(Nv,{children:i(t.labelKey)}),He("div",{class:"mb-3",children:He(Gv,{value:d,onChange:function(e){var t=un(mn(e,{bold:!0,italic:!1})),n=hn(mn(e,{bold:!1,italic:!0})),o=!!t&&m,i=!!n&&f;u(e),g(o),y(i),b(e,o,i)}})}),He("div",{class:"flex gap-2",children:[He(Kv,{title:"Bold",active:m,disabled:!un(mn(d,{bold:!0,italic:!1})),onClick:function(){if(un(mn(d,{bold:!0,italic:!1}))){var e=!m;g(e),b(d,e,f)}},className:"font-bold",children:He(zg,{icon:"bold",size:18})}),He(Kv,{title:"Italic",active:f,disabled:!hn(mn(d,{bold:!1,italic:!0})),onClick:function(){if(hn(mn(d,{bold:!1,italic:!0}))){var e=!f;y(e),b(d,m,e)}},className:"italic",children:He(zg,{icon:"italic",size:18})})]})]})}function ny(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:12),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:12)},[n]);return He(Lv,{children:[He(Nv,{children:i(t.labelKey)}),He(Vv,{value:a,onChange:function(e){!Number.isFinite(e)||e<=0||(s(e),o(e))}})]})}function oy(e){var t=e.config,n=e.value,o=e.onChange,i=e.colorPresets,r=e.translate,a=v(Se(null!=n?n:"#000000"),2),s=a[0],l=a[1];Me(function(){return l(null!=n?n:"#000000")},[n]);var c=function(e){l(e),o(e)};return He(Lv,{children:[He(Nv,{className:"mb-3",children:r(t.labelKey)}),He("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:i.map(function(e){return He(Fv,{color:e,active:e===s,onSelect:c},e)})})]})}function iy(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Ct.Left),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:Ct.Left)},[n]);var l=function(e){s(e),o(e)};return He(Lv,{children:[He(Nv,{children:i(t.labelKey)}),He("div",{class:"flex gap-2",children:[He(Kv,{title:"Align left",active:a===Ct.Left,onClick:function(){return l(Ct.Left)},children:He(zg,{icon:"alignLeft",size:18})}),He(Kv,{title:"Align center",active:a===Ct.Center,onClick:function(){return l(Ct.Center)},children:He(zg,{icon:"alignCenter",size:18})}),He(Kv,{title:"Align right",active:a===Ct.Right,onClick:function(){return l(Ct.Right)},children:He(zg,{icon:"alignRight",size:18})})]})]})}function ry(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:It.Top),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:It.Top)},[n]);var l=function(e){s(e),o(e)};return He(Lv,{children:[He(Nv,{children:i(t.labelKey)}),He("div",{class:"flex gap-2",children:[He(Kv,{title:"Align top",active:a===It.Top,onClick:function(){return l(It.Top)},children:He(zg,{icon:"alignTop",size:18})}),He(Kv,{title:"Align middle",active:a===It.Middle,onClick:function(){return l(It.Middle)},children:He(zg,{icon:"alignMiddle",size:18})}),He(Kv,{title:"Align bottom",active:a===It.Bottom,onClick:function(){return l(It.Bottom)},children:He(zg,{icon:"alignBottom",size:18})})]})]})}var ay=(s(s(s(s(s(s(s(s(s(s(Tv={},kt.Normal,"blendMode.normal"),kt.Multiply,"blendMode.multiply"),kt.Screen,"blendMode.screen"),kt.Overlay,"blendMode.overlay"),kt.Darken,"blendMode.darken"),kt.Lighten,"blendMode.lighten"),kt.ColorDodge,"blendMode.colorDodge"),kt.ColorBurn,"blendMode.colorBurn"),kt.HardLight,"blendMode.hardLight"),kt.SoftLight,"blendMode.softLight"),s(s(s(s(s(s(Tv,kt.Difference,"blendMode.difference"),kt.Exclusion,"blendMode.exclusion"),kt.Hue,"blendMode.hue"),kt.Saturation,"blendMode.saturation"),kt.Color,"blendMode.color"),kt.Luminosity,"blendMode.luminosity"));function sy(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:kt.Normal),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:kt.Normal)},[n]);return He(Lv,{children:[He(Nv,{children:i(t.labelKey)}),He("select",{class:"border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1 text-sm",value:a,onChange:function(e){var t=parseInt(e.target.value,10);s(t),o(t)},children:bn.map(function(e){return He("option",{value:e,children:i(ay[e])},e)})})]})}function ly(e){var t=e.documentId,n=e.annotations,o=e.activeTool,i=e.colorPresets,r=iu().provides,l=Ta(t).translate;if(!r)return null;var c=n.length>0,d=c?y(new Set(n.map(function(e){return e.object.type}).filter(function(e){return void 0!==e}))):void 0!==(null==o?void 0:o.defaults.type)?[o.defaults.type]:[];if(0===d.length)return null;var u=function(e){var t;if(0===e.length)return[];for(var n=e.map(function(e){var t;return new Set(null!==(t=zv[e])&&void 0!==t?t:[])}),o=n[0],i=1;i<n.length;i++){var r,s=a(o);try{for(s.s();!(r=s.n()).done;){var l=r.value;n[i].has(l)||o.delete(l)}}catch(e){s.e(e)}finally{s.f()}}return(null!==(t=zv[e[0]])&&void 0!==t?t:[]).filter(function(e){return o.has(e)})}(d);if(0===u.length)return null;var h=c?n[0].object:null==o?void 0:o.defaults,m=function(e){r&&(c?r.updateAnnotations(n.map(function(t){return{pageIndex:t.object.pageIndex,id:t.object.id,patch:e}})):o&&r.setToolDefaults(o.id,e))},g=function(e){if(h){var t=Av[e];if(t){if("strokeStyle"===t.type){var n=h;return{id:n.strokeStyle,dash:n.strokeDashArray}}return h[t.key]}}};return j(H,null,u.map(function(e){var t=Av[e];return t?j(Zv,{key:e,config:t,value:g(e),onChange:function(t){return function(e,t){var n=Av[e];n&&("strokeStyle"!==n.type||"object"!==w(t)?"lineEndings"!==n.type?m(s({},n.key,t)):m({lineEndings:t}):m({strokeStyle:t.strokeStyle,strokeDashArray:t.strokeDashArray}))}(e,t)},colorPresets:i,translate:l}):null}))}var cy={1:"annotation.text",3:"annotation.freeText",4:"annotation.line",5:"annotation.square",6:"annotation.circle",7:"annotation.polygon",8:"annotation.polyline",9:"annotation.highlight",10:"annotation.underline",11:"annotation.squiggly",12:"annotation.strikeout",13:"annotation.stamp",15:"annotation.ink"};function dy(e){var t,n=e.documentId,o=iu().provides,i=ru(n),r=i.provides,a=i.state,s=Ta(n).translate;if(!o||!r)return null;var l=null!==(t=null==o?void 0:o.getColorPresets())&&void 0!==t?t:[],c=jc(a),d=r.getActiveTool(),u=c.length>0,h="";if(c.length>1)h=s("annotation.multiSelect",{params:{count:String(c.length)}});else if(u){var m=c[0].object.type,g=cy[m],p=g?s(g):"";h=p?s("annotation.styles",{params:{type:p}}):""}else if(d){var f=d.defaults.type;if(void 0!==f){var v=cy[f],b=v?s(v):"";h=b?s("annotation.defaults",{params:{type:b}}):""}}var w=u?y(new Set(c.map(function(e){return e.object.type}))):void 0!==(null==d?void 0:d.defaults.type)?[d.defaults.type]:[],x=w.length>0&&w.some(function(e){var t,n;return(null!==(t=null===(n=zv[e])||void 0===n?void 0:n.length)&&void 0!==t?t:0)>0});return x||u||d?He("div",{class:"h-full overflow-y-auto p-4",children:[h&&He("h2",{class:"text-md mb-4 font-medium",children:h}),He(ly,{documentId:n,annotations:c,activeTool:d,colorPresets:l})]}):He(Dv,{documentId:n})}function uy(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),Tr(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(my,{key:e.id,item:e,documentId:n,props:o})}))))}function hy(e){var t=e.item,n=e.documentId,o=ba(t.commandId,n);return null!=o&&o.visible?j("div",h({},Tr(t)),j(af,{commandId:t.commandId,documentId:n,variant:t.variant})):null}function my(e){var t,n=e.item,o=e.documentId,i=e.props;switch(n.type){case"command-button":return j(hy,{item:n,documentId:o});case"divider":return j("div",h({},Tr(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)},Tr(n)),n.items.map(function(e){return j(my,{key:e.id,item:e,documentId:o,props:i})}));default:return null}}function gy(e){var t,n,o=e.schema,i=e.documentId,r=e.className,a=o.content,s=o.position,l=Xr().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 py(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,c=Ae(null),d=v(Se(t),2),u=d[0],h=d[1],m=v(Se(!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?He("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:He("div",{className:pg("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",g&&t?"scale-100 opacity-100":"scale-95 opacity-0",a),onClick:function(e){return e.stopPropagation()},children:[(n||l)&&He("div",{className:"border-border-subtle flex flex-shrink-0 items-center justify-between border-b px-6 py-4",children:[n&&He("h2",{className:"text-fg-primary text-lg font-semibold",children:n}),l&&He(Eg,{onClick:i,className:"hover:bg-interactive-hover p-1",children:He(zg,{icon:"x",className:"h-5 w-5"})})]}),He("div",{className:"flex-1 overflow-y-auto px-6 py-4 md:max-h-[80vh] md:flex-none",children:o})]})}):null}function fy(e){var t=e.documentId,n=e.isOpen,o=e.onClose,i=e.onExited,r=yi().provides,a=Tu().provides,s=Ta(t).translate,l=v(Se("all"),2),c=l[0],d=l[1],u=v(Se(""),2),h=u[0],m=u[1],g=v(Se(!0),2),p=g[0],f=g[1],y=v(Se(!1),2),b=y[0],w=y[1],x=v(Se(""),2),C=x[0],I=x[1],k=null==r?void 0:r.forDocument(t).getMetrics(),S=(null==k?void 0:k.currentPage)||1,P=(null==r?void 0:r.forDocument(t).getTotalPages())||0;Me(function(){n&&(d("all"),m(""),f(!0),w(!1),I(""))},[n]);var M=("custom"!==c||h.trim().length>0)&&!b;return j(py,{open:null!=n&&n,title:s("print.title"),onClose:o,onExited:i,className:"md:w-[32rem]"},j("div",{className:"space-y-6"},j("div",null,j("label",{className:"text-fg-secondary mb-3 block text-sm font-medium"},s("print.pages")),j("div",{className:"space-y-2"},j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"all",checked:"all"===c,onChange:function(){return d("all")},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},s("print.all"))),j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"current",checked:"current"===c,onChange:function(){return d("current")},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},s("print.current",{params:{currentPage:S}}))),j("label",{className:"flex items-start"},j("input",{type:"radio",name:"pageRange",value:"custom",checked:"custom"===c,onChange:function(){return d("custom")},disabled:b,className:"accent-accent mr-2 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary mb-1 block text-sm"},s("print.specify")),j("input",{type:"text",placeholder:s("print.specifyEG"),value:h,onInput:function(e){return m(e.target.value)},disabled:"custom"!==c||b,className:"w-full rounded-md border px-3 py-1 text-base ".concat("custom"!==c||b?"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"===c&&h.trim()&&P>0&&j("p",{className:"text-fg-muted mt-1 text-xs"},s("print.current",{params:{totalPages:P}})))))),j("div",null,j("label",{className:"flex items-center"},j("input",{type:"checkbox",checked:p,onChange:function(e){return f(e.target.checked)},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-secondary text-sm font-medium"},s("print.annotation")))),b&&j("div",{className:"bg-state-info-light flex items-center space-x-3 rounded-md p-3"},j(cv,{className:"text-accent"}),j("span",{className:"text-accent text-sm"},C)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Eg,{onClick:o,disabled:b,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"},s("print.cancel")),j(Eg,{onClick:function(){var e;"current"===c?e=String(S):"custom"===c&&(e=h.trim()||void 0);var n={includeAnnotations:p,pageRange:e};try{w(!0),I(s("print.loading"));var i=null==a?void 0:a.forDocument(t).print(n);i&&(i.onProgress(function(e){I(e.message)}),i.wait(function(){w(!1),I(""),null==o||o()},function(e){console.error("Print failed:",e),w(!1),I("")}))}catch(e){console.error("Print failed:",e),w(!1),I("")}},disabled:!M,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"},b&&j(cv,{size:"sm"}),j("span",null,s(b?"print.printing":"print.print"))))))}function vy(e){var t,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,s=yi().provides,l=iu().provides,c=gl().provides,d=Ta(n).translate,u=v(Se("url"),2),h=u[0],m=u[1],g=v(Se(""),2),p=g[0],f=g[1],y=v(Se(1),2),b=y[0],w=y[1],x=(null==s?void 0:s.forDocument(n).getTotalPages())||1,C=null==l?void 0:l.forDocument(n),I=null==c?void 0:c.forDocument(n),k=null==C?void 0:C.getSelectedAnnotation(),S=null!==(t=null==I?void 0:I.getFormattedSelection())&&void 0!==t?t:[];Me(function(){o&&(m("url"),f(""),w(1))},[o]);var P="page"===h||p.trim().length>0;return j(py,{open:null!=o&&o,title:d("link.title")||"Insert Link or Page",onClose:i,onExited:r,className:"md:w-[28rem]"},j("form",{onSubmit:function(e){e.preventDefault(),function(){var e;if("url"===h){if(!p.trim())return;e={type:"action",action:{type:Pt.URI,uri:p.trim()}}}else e={type:"destination",destination:{pageIndex:b-1,zoom:{mode:bt.FitPage},view:[]}};if(k){var t,n="segmentRects"in k.object?k.object.segmentRects:[k.object.rect],o=a(null!=n?n:[]);try{for(o.s();!(t=o.n()).done;){var r=t.value;null==C||C.createAnnotation(k.object.pageIndex,{id:In(),type:Mt.LINK,pageIndex:k.object.pageIndex,rect:r,inReplyToId:k.object.id,replyType:Tt.Group,target:e,strokeStyle:_t.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){o.e(e)}finally{o.f()}}else if(S.length>0){var s,l=null==I?void 0:I.getSelectedText(),c=a(S);try{var d=function(){var t=s.value;null==l||l.wait(function(n){var o,i=In();null==C||C.createAnnotation(t.pageIndex,{id:i,created:new Date,flags:["print"],type:Mt.HIGHLIGHT,blendMode:kt.Multiply,pageIndex:t.pageIndex,rect:t.rect,segmentRects:t.segmentRects,strokeColor:"#FFFFFF",opacity:0,custom:{text:n.join("\n")}});var r,s=a(null!==(o=t.segmentRects)&&void 0!==o?o:[t.rect]);try{for(s.s();!(r=s.n()).done;){var l=r.value;null==C||C.createAnnotation(t.pageIndex,{id:In(),type:Mt.LINK,pageIndex:t.pageIndex,rect:l,inReplyToId:i,replyType:Tt.Group,target:e,strokeStyle:_t.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){s.e(e)}finally{s.f()}null==C||C.selectAnnotation(t.pageIndex,i)},Sn)};for(c.s();!(s=c.n()).done;)d()}catch(e){c.e(e)}finally{c.f()}null==I||I.clear()}null==i||i()}()},className:"space-y-6"},j("div",{className:"border-border-subtle flex border-b"},j(vg,{active:"url"===h,onClick:function(){return m("url")}},d("link.url")||"URL"),j(vg,{active:"page"===h,onClick:function(){return m("page")}},d("link.page")||"Page")),j("div",{className:"bg-bg-muted rounded-lg"},"url"===h?j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},d("link.enterUrl")||"Enter URL"),j("input",{type:"url",value:p,onInput:function(e){return f(e.target.value)},placeholder:"https://example.com",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",autoFocus:!0})):j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},d("link.enterPage")||"Enter Page Number"),j("input",{type:"number",min:1,max:x,value:b,onInput:function(e){var t=parseInt(e.target.value,10);isNaN(t)||w(Math.max(1,Math.min(x,t)))},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",autoFocus:!0}),j("p",{className:"text-fg-muted mt-1 text-xs"},d("link.pageRange",{params:{totalPages:x}})||"Page 1 to ".concat(x)))),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Eg,{type:"button",onClick:i,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},d("common.cancel")||"Cancel"),j(Eg,{type:"submit",disabled:!P,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},d("link.link")||"Link"))))}function yy(e){var t=e.documentId,n=ti().provides,o=bi(t),i=o.provides,r=o.state,a=r.currentPage,s=r.totalPages,l=v(Se(!1),2),c=l[0],d=l[1],u=v(Se(!1),2),h=u[0],m=u[1],g=Ae(null),p=v(Se(a.toString()),2),f=p[0],y=p[1],b=Ae(null);Me(function(){y(a.toString())},[a]);var w=Te(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(af,{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:f,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(f,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(af,{commandId:"scroll:next-page",documentId:t,variant:"icon"})))}var by=function(e,t,n){return!function(e,t,n){return eo(e.core,t,n)}(e,t,n)},wy={"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(Ea.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)===Ea.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(Ea.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)===Ea.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();if(i){var r=i.forDocument(o);"pointerMode"===r.getActiveMode()?r.activateDefaultMode():r.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(Ri);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(Ri);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).openModal("print-modal")}},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.Print)}},"document:protect":{id:"document:protect",labelKey:"document.protect",icon:"lock",categories:["document","document-protect"],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).openModal("protect-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:capture":{id:"document:capture",labelKey:"capture.screenshot",icon:"screenshot",categories:["document","document-capture"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("capture"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).toggleMarqueeCapture()},active:function(e){var t,n=e.state,o=e.documentId;return"marqueeCapture"===(null===(t=n.plugins["interaction-manager"])||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.activeMode)}},"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(Ri);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 Fr(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(Ri);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 Fr(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(Ri);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 Fr(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(Ri);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 Fr(t.plugins,n,"left","main","annotation-panel")},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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(Ri);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(xi.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)===xi.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(xi.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)===xi.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(xi.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)===xi.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(ii.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)===ii.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(ii.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)===ii.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!$r(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 $r(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 $r(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 $r(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=Bc(e.state.plugins.annotation,"highlight"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-highlight"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Yl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Rs))||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&&Id(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=In();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.HIGHLIGHT,blendMode:kt.Multiply,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},Sn)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.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[Yl])||void 0===t?void 0:t.documents[o];return"highlight"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-underline":{id:"annotation:add-underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(e.state.plugins.annotation,"underline"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-underline"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Yl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Rs))||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&&Sd(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=In();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.UNDERLINE,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},Sn)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.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[Yl])||void 0===t?void 0:t.documents[o];return"underline"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-strikeout":{id:"annotation:add-strikeout",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(e.state.plugins.annotation,"strikeout"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-strikeout"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Yl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Rs))||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&&Pd(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=In();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.STRIKEOUT,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},Sn)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.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[Yl])||void 0===t?void 0:t.documents[o];return"strikeout"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-squiggly":{id:"annotation:add-squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(e.state.plugins.annotation,"squiggly"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-squiggly"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Yl))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Rs))||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&&kd(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=In();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.SQUIGGLY,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},Sn)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.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[Yl])||void 0===t?void 0:t.documents[o];return"squiggly"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-ink":{id:"annotation:add-ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"ink"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-text":{id:"annotation:add-text",labelKey:"annotation.text",icon:"text",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"freeText"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"stamp"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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=Bc(o.plugins.annotation,"square"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"square"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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=Bc(o.plugins.annotation,"circle"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"circle"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-line":{id:"annotation:add-line",labelKey:"annotation.line",icon:"line",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"line"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-arrow":{id:"annotation:add-arrow",labelKey:"annotation.arrow",icon:"lineArrow",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"lineArrow"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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=Bc(o.plugins.annotation,"polygon"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"polygon"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-polyline":{id:"annotation:add-polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){var t;return{primaryColor:null===(t=Bc(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(Yl))||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[Yl])||void 0===t?void 0:t.documents[o];return"polyline"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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(Yl))||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)}},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:delete-all-selected":{id:"annotation:delete-all-selected",labelKey:"annotation.deleteAllSelected",icon:"trash",categories:["annotation","annotation-delete","annotation-group"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o);if(r){var a=r.getSelectedAnnotations();0!==a.length&&(r.deleteAnnotations(a.map(function(e){return{pageIndex:e.object.pageIndex,id:e.object.id}})),r.deselectAnnotation())}},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:toggle-group":{id:"annotation:toggle-group",labelKey:function(e){var t,n=e.registry,o=e.documentId;return"ungroup"===(null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o).getGroupingAction())?"annotation.ungroup":"annotation.group"},icon:function(e){var t,n=e.registry,o=e.documentId;return"ungroup"===(null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o).getGroupingAction())?"ungroup":"group"},categories:["annotation","annotation-group"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o);if(i){var r=i.getGroupingAction();if("ungroup"===r){var a=i.getSelectedAnnotations();a.length>0&&i.ungroupAnnotations(a[0].object.id)}else"group"===r&&i.groupAnnotations()}},disabled:function(e){var t,n=e.registry,o=e.state,i=e.documentId;return!!by(o,i,Ht.ModifyAnnotations)||"disabled"===(null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(i).getGroupingAction())}},"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"])},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"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"])},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:add-link":{id:"annotation:add-link",labelKey:"annotation.addLink",icon:"link",categories:["annotation","annotation-link"],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).openModal("link-modal")},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:toggle-annotation-style":{id:"annotation:toggle-annotation-style",labelKey:"annotation.style",icon:"palette",categories:["annotation","annotation-style"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(Ri);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 Fr(t.plugins,n,"left","main","annotation-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==Mt.LINK},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:toggle-link":{id:"annotation:toggle-link",labelKey:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o);if(!i)return"annotation.addLink";var r=i.getSelectedAnnotation();return r&&i.hasAttachedLinks(r.object.id)?"annotation.removeLink":"annotation.addLink"},icon:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o);if(!i)return"link";var r=i.getSelectedAnnotation();return r&&i.hasAttachedLinks(r.object.id)?"linkOff":"link"},categories:["annotation","annotation-link"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Yl))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("ui"))||void 0===n?void 0:n.provides();if(r&&a){var s=r.forDocument(i),l=s.getSelectedAnnotation();l&&(s.hasAttachedLinks(l.object.id)?s.deleteAttachedLinks(l.object.id):a.forDocument(i).openModal("link-modal"))}},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==Mt.LINK},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyAnnotations)}},"annotation:toggle-comment":{id:"annotation:toggle-comment",labelKey:"annotation.comment",icon:"comment",categories:["annotation","annotation-comment"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(Ri);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 Fr(t.plugins,n,"right","main","comment-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==Mt.LINK}},"annotation:goto-link":{id:"annotation:goto-link",labelKey:"annotation.gotoLink",icon:"externalLink",categories:["annotation","annotation-link"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(Yl))||void 0===t?void 0:t.provides(),s=null===(n=i.getPlugin("scroll"))||void 0===n?void 0:n.provides();if(a){var l=a.forDocument(r),c=l.getSelectedAnnotation();if(c){var d=null;if(Lc(c))d=c.object;else{var u=l.getAttachedLinks(c.object.id);u.length>0&&(d=u[0].object)}if(null!==(o=d)&&void 0!==o&&o.target){var h=d.target;if("action"===h.type){var m=h.action;if(m.type===Pt.URI)window.open(m.uri,"_blank","noopener,noreferrer");else if(m.type===Pt.Goto&&s){var g=m.destination;s.forDocument(r).scrollToPage({pageNumber:g.pageIndex+1,behavior:"smooth"})}}else if("destination"===h.type&&s){var p=h.destination;s.forDocument(r).scrollToPage({pageNumber:p.pageIndex+1,behavior:"smooth"})}}}}},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Yl))||void 0===t?void 0:t.provides();if(!i)return!1;var r=i.forDocument(o),a=null==r?void 0:r.getSelectedAnnotation();return!!a&&(a.object.type===Mt.LINK||r.hasAttachedLinks(a.object.id))}},"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[Wh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===Sh.MarqueeRedact},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyContents)}},"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(Rs))||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[Wh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===Sh.RedactSelection},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.ModifyContents)}},"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[Wh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||by(n,o,Ht.ModifyContents)}},"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[Wh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||by(n,o,Ht.ModifyContents)}},"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()},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.CopyContents)}},"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()},disabled:function(e){var t=e.state,n=e.documentId;return by(t,n,Ht.CopyContents)}},"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(ph))||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[ph])||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(ph))||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[ph])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canRedo)}}},xy={"zoom.level":function(e){var t,n,o=e.state,i=e.documentId,r=i&&null!==(t=null===(n=o.plugins[_a])||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)}}},Cy={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"}}},Iy={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 ky(e,t){var n=h({},e);for(var o in t){var i=t[o];i&&"object"===w(i)&&!Array.isArray(i)?n[o]=ky(e[o]||{},i):void 0!==i&&(n[o]=i)}return n}function Sy(e,t){return{colors:ky(e.colors,t)}}function Py(e){return"system"===e?"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function My(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Dy(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=v(r[i],2),s=a[0],l=a[1];l&&"object"===w(l)?e(l,"".concat(o,"-").concat(My(s))):void 0!==l&&t.push(" --ep".concat(o,"-").concat(My(s),": ").concat(l,";"))}}(e.colors,""),t.join("\n")}(e),"\n}")}function Ay(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=ca().provides,l=Te(function(e){null==s||s.setActiveDocument(e)},[s]),c=Te(function(e){null==s||s.closeDocument(e)},[s]),d=Te(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(zg,{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(zg,{icon:"plus",size:14})))):null}function zy(){var e=ca().provides,t=Ta().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(zg,{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(zg,{icon:"plus",size:16}),t("emptyState.openButton")),j("p",{className:"text-fg-muted mt-4 text-xs"},t("emptyState.supportedFormats"))))}function Ty(e){var t=e.documentState,o=ca().provides,i=Ta().translate,r=v(Se(""),2),a=r[0],s=r[1],l=v(Se(!1),2),c=l[0],d=l[1];if(!t)return null;var u=t.name,h=t.errorCode,m=t.passwordProvided,p=h===qt.Password,f=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(zg,{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(zg,{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"},f&&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(zg,{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 Ey(e){var t=e.documentId,n=e.className,o=ba("mode:view",t),i=ba("mode:annotate",t),r=ba("mode:shapes",t),a=ba("mode:redact",t),s=ba("tabs:overflow-menu",t),l=ze(function(){return[o,i,r,a].find(function(e){return null==e?void 0:e.active})||o},[o,i,r,a]),c=Te(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(Eg,{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(zg,{icon:"chevronDown",className:"h-4 w-4 ".concat(d?"text-accent":"text-fg-secondary")})))}function Ry(e){var t=e.documentId,n=mh().provides,o=v(Se(!1),2),i=o[0],r=o[1],a=v(Se(null),2),s=a[0],l=a[1],c=v(Se(null),2),d=c[0],u=c[1],h=v(Se(null),2),m=h[0],g=h[1],p=Ae(null),f=Ae(null),y=Ta(t).translate,b=function(){p.current&&(URL.revokeObjectURL(p.current),p.current=null),m&&(URL.revokeObjectURL(m),g(null)),r(!1),l(null),u(null)};Me(function(){if(n)return n.onCaptureArea(function(e){var t=e.pageIndex,n=e.rect,o=e.blob;l({pageIndex:t,rect:n,blob:o});var i=URL.createObjectURL(o);p.current=i,u(i),r(!0)})},[n]);return j(H,null,j(py,{open:i,onClose:b,title:y("capture.title"),className:"md:w-[48rem]"},j("div",{className:"space-y-6"},j("div",{className:"flex justify-center"},d&&j("img",{src:d,onLoad:function(){p.current&&(URL.revokeObjectURL(p.current),p.current=null)},alt:"Captured PDF area",style:{maxWidth:"100%",maxHeight:"400px",border:"1px solid #e5e7eb",borderRadius:"4px",display:"block"}})),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Eg,{onClick:b,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"},y("capture.cancel")),j(Eg,{onClick:function(){if(s&&f.current){var e=URL.createObjectURL(s.blob);g(e),f.current.href=e,f.current.download="pdf-capture-page-".concat(s.pageIndex+1,".png"),f.current.click(),b()}},disabled:!s,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("capture.download"))))),j("a",{ref:f,style:{display:"none"},href:"",download:""}))}var _y=[{flag:Ht.Print,labelKey:"protect.permissions.print"},{flag:Ht.PrintHighQuality,labelKey:"protect.permissions.printHighQuality"},{flag:Ht.CopyContents,labelKey:"protect.permissions.copy"},{flag:Ht.ExtractForAccessibility,labelKey:"protect.permissions.accessibility"},{flag:Ht.ModifyContents,labelKey:"protect.permissions.modify"},{flag:Ht.ModifyAnnotations,labelKey:"protect.permissions.annotations"},{flag:Ht.FillForms,labelKey:"protect.permissions.fillForms"},{flag:Ht.AssembleDocument,labelKey:"protect.permissions.assemble"}];function Ny(e){var t=e.permissions,n=e.translate,o=e.label;return j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},null!=o?o:n("security.viewPermissions.restrictedActions")),j("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2"},_y.map(function(e){var o,i=(o=e.flag,0!==(t&o));return j("div",{key:e.flag,className:"flex items-center rounded-md p-2 ".concat(i?"text-fg-primary":"text-fg-muted")},j(zg,{icon:i?"check":"x",className:"mr-2 h-4 w-4 flex-shrink-0 ".concat(i?"text-state-success":"text-state-error")}),j("span",{className:"text-sm"},n(e.labelKey)))})))}function Oy(e){var t,n,o,i=e.documentId,r=e.isOpen,s=e.onClose,l=e.onExited,c=Ta(i).translate,d=ca().provides,u=Do(i),h=null==u?void 0:u.document,m=null!==(t=null==h?void 0:h.isEncrypted)&&void 0!==t&&t,g=null!==(n=null==h?void 0:h.isOwnerUnlocked)&&void 0!==n&&n,p=null!==(o=null==h?void 0:h.permissions)&&void 0!==o?o:0,f=v(Se("edit-protection"),2),y=f[0],b=f[1],w=v(Se(""),2),x=w[0],C=w[1],I=v(Se(!1),2),k=I[0],S=I[1],P=v(Se(!1),2),M=P[0],D=P[1],A=v(Se(null),2),z=A[0],T=A[1],E=v(Se(!1),2),R=E[0],_=E[1],N=v(Se(""),2),O=N[0],L=N[1],$=v(Se(""),2),F=$[0],U=$[1],H=v(Se(!1),2),B=H[0],W=H[1],q=v(Se(!1),2),G=q[0],V=q[1],K=v(Se(""),2),Z=K[0],Y=K[1],X=v(Se(""),2),Q=X[0],J=X[1],ee=v(Se(!1),2),te=ee[0],ne=ee[1],oe=Se(new Set(_y.map(function(e){return e.flag}))),ie=v(oe,2),re=ie[0],ae=ie[1],se=v(Se(!1),2),le=se[0],ce=se[1],de=v(Se(null),2),ue=de[0],he=de[1];Me(function(){r&&(C(""),S(!1),D(!1),T(null),_(!1),L(""),U(""),W(!1),V(!1),Y(""),J(""),ne(!1),ae(new Set(_y.map(function(e){return e.flag}))),ce(!1),he(null),b(m&&!g?"unlock":m&&g?"choose-action":"edit-protection"))},[r,m,g]);var me=O===F,ge=Z===Q,pe=!R||O.length>0&&me,fe=!G||Z.length>0&&ge,ve=(R||G)&&pe&&fe&&!le,ye=function(){d&&x&&(D(!0),T(null),d.unlockOwnerPermissions(i,x).wait(function(e){D(!1),e?b("choose-action"):T(c("security.unlock.invalidPassword"))},function(e){var t,n;D(!1),T(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("security.unlock.failed"))}))},be=function(){if(ve&&d){var e=0;if(G){var t,n=a(re);try{for(n.s();!(t=n.n()).done;){e|=t.value}}catch(e){n.e(e)}finally{n.f()}}else e=Ht.AllowAll;var o=R?O:"",r=G?Z:R?O:"";ce(!0),he(null),d.setDocumentEncryption(i,{userPassword:o,ownerPassword:r,allowedFlags:e}).wait(function(e){ce(!1),e?null==s||s():he(c("protect.applyFailed"))},function(e){var t,n;ce(!1),he(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("protect.applyFailed"))})}},we=function(){d&&(ce(!0),he(null),d.removeEncryption(i).wait(function(e){ce(!1),e?null==s||s():he(c("protect.removeFailed"))},function(e){var t,n;ce(!1),he(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("protect.removeFailed"))}))},xe=function(){return j("div",{className:"space-y-6"},j("div",{className:"bg-bg-subtle rounded-lg"},j("label",{className:"flex cursor-pointer items-start"},j("input",{type:"checkbox",checked:R,onChange:function(e){return _(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary block font-medium"},c("protect.openPassword.title")),j("span",{className:"text-fg-muted text-sm"},c("protect.openPassword.description")))),R&&j("div",{className:"mt-4 space-y-3 pl-6"},j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.label")),j("div",{className:"relative"},j("input",{type:B?"text":"password",value:O,onInput:function(e){return L(e.target.value)},placeholder:c("protect.openPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1"}),j("button",{type:"button",onClick:function(){return W(!B)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(zg,{icon:B?"eye-off":"eye",className:"h-4 w-4"})))),j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.confirm")),j("input",{type:B?"text":"password",value:F,onInput:function(e){return U(e.target.value)},placeholder:c("protect.openPassword.confirmPlaceholder"),className:"border-border-default bg-bg-input text-fg-primary focus:ring-accent w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 ".concat(F&&!me?"border-state-error focus:border-state-error":"focus:border-accent")}),F&&!me&&j("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch"))))),j("div",{className:"bg-bg-subtle rounded-lg"},j("label",{className:"flex cursor-pointer items-start"},j("input",{type:"checkbox",checked:G,onChange:function(e){return V(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary block font-medium"},c("protect.permissions.title")),j("span",{className:"text-fg-muted text-sm"},c("protect.permissions.description")))),G&&j("div",{className:"mt-4 space-y-4 pl-6"},j("div",{className:"border-border-subtle border-b pb-4"},j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.label")),j("div",{className:"relative"},j("input",{type:te?"text":"password",value:Z,onInput:function(e){return Y(e.target.value)},placeholder:c("protect.ownerPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1"}),j("button",{type:"button",onClick:function(){return ne(!te)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(zg,{icon:te?"eye-off":"eye",className:"h-4 w-4"})))),j("div",{className:"mt-3"},j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.confirm")),j("input",{type:te?"text":"password",value:Q,onInput:function(e){return J(e.target.value)},placeholder:c("protect.ownerPassword.confirmPlaceholder"),className:"border-border-default bg-bg-input text-fg-primary focus:ring-accent w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 ".concat(Q&&!ge?"border-state-error focus:border-state-error":"focus:border-accent")}),Q&&!ge&&j("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch")))),j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},c("protect.permissions.allowedActions")),j("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2"},_y.map(function(e){return j("label",{key:e.flag,className:"hover:bg-bg-surface flex cursor-pointer items-center rounded-md p-2 transition-colors"},j("input",{type:"checkbox",checked:re.has(e.flag),onChange:function(){return t=e.flag,void ae(function(e){var n=new Set(e);return n.has(t)?n.delete(t):(n.add(t),t===Ht.PrintHighQuality&&n.add(Ht.Print)),n});var t},className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},c(e.labelKey)))}))))),R&&G&&j("div",{className:"bg-state-info-light flex items-start space-x-2 rounded-md p-3"},j(zg,{icon:"info",className:"text-accent mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},c("protect.bothPasswordsNote"))),!R&&!G&&!ue&&j("div",{className:"bg-state-warning-light flex items-start space-x-2 rounded-md p-3"},j(zg,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},c("protect.noProtectionSelected"))),ue&&j("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},j(zg,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},ue)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},m&&g&&j(Eg,{onClick:function(){return b("choose-action")},disabled:le,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"},c("common.back")),j(Eg,{onClick:be,disabled:!ve,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"},le&&j(cv,{size:"sm"}),j("span",null,c(le?"protect.applying":"protect.apply")))))};return j(py,{open:null!=r&&r,title:function(){switch(y){case"unlock":return c("protect.encrypted.title");case"choose-action":return c("protect.modifyProtection.title");case"remove-protection":return c("protect.removeProtection.title");default:return c("protect.title")}}(),onClose:s,onExited:l,className:"md:w-[36rem]"},function(){switch(y){case"unlock":return j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},c("protect.encrypted.description")),j("div",null,j("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},c("protect.encrypted.enterOwnerPassword")),j("div",{className:"relative"},j("input",{type:k?"text":"password",value:x,onInput:function(e){return C(e.target.value)},placeholder:c("protect.ownerPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1",onKeyDown:function(e){"Enter"===e.key&&x&&ye()}}),j("button",{type:"button",onClick:function(){return S(!k)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(zg,{icon:k?"eye-off":"eye",className:"h-4 w-4"}))),z&&j("p",{className:"text-state-error mt-2 text-xs"},z)),j(Ny,{permissions:p,translate:c}),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Eg,{onClick:ye,disabled:!x||M,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"},M&&j(cv,{size:"sm"}),j("span",null,c("protect.encrypted.unlockAndEdit")))));case"choose-action":return j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},c("protect.modifyProtection.description")),j("div",{className:"space-y-3"},j("button",{type:"button",onClick:function(){return b("edit-protection")},className:"border-border-default hover:border-accent hover:bg-bg-subtle flex w-full items-center rounded-lg border p-4 text-left transition-colors"},j("div",{className:"bg-accent/10 mr-4 rounded-full p-2"},j(zg,{icon:"lock",size:20,className:"text-accent"})),j("div",null,j("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.changeOption")),j("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.changeDescription")))),j("button",{type:"button",onClick:function(){return b("remove-protection")},className:"border-border-default hover:border-state-error hover:bg-state-error-light flex w-full items-center rounded-lg border p-4 text-left transition-colors"},j("div",{className:"bg-state-error-light mr-4 rounded-full p-2"},j(zg,{icon:"unlock",size:20,className:"text-state-error"})),j("div",null,j("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.removeOption")),j("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.removeDescription"))))),j("div",{className:"border-border-subtle flex justify-end border-t pt-4"},j(Eg,{onClick:s,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},c("protect.cancel"))));case"remove-protection":return j("div",{className:"space-y-5"},j("div",{className:"bg-state-warning-light flex items-start space-x-3 rounded-lg p-4"},j(zg,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-5 w-5 flex-shrink-0"}),j("div",null,j("p",{className:"text-fg-primary font-medium"},c("protect.removeProtection.warning")),j("p",{className:"text-fg-secondary mt-1 text-sm"},c("protect.removeProtection.description")))),ue&&j("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},j(zg,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},ue)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(Eg,{onClick:function(){return b("choose-action")},disabled:le,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"},c("common.back")),j(Eg,{onClick:we,disabled:le,className:"bg-state-error text-fg-on-accent hover:bg-state-error/90 flex items-center space-x-2 rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},le&&j(cv,{size:"sm"}),j("span",null,c("protect.removeProtection.confirm")))));default:return xe()}}())}function Ly(e){var t,n,o,i=e.documentId,r=Ta(i).translate,a=Ur().provides,s=Do(i),l=null==s?void 0:s.document,c=null!==(t=null==l?void 0:l.isEncrypted)&&void 0!==t&&t,d=null!==(n=null==l?void 0:l.isOwnerUnlocked)&&void 0!==n&&n,u=((null!==(o=null==l?void 0:l.permissions)&&void 0!==o?o:Ht.AllowAll)&Ht.AllowAll)!==Ht.AllowAll,h=c&&!d&&u,m=Te(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay")},[i,a]),g=Te(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay"),null==a||a.forDocument(i).openModal("view-permissions-modal")},[i,a]);return h?j("div",{className:""},j("div",{className:"bg-bg-surface border-border-default flex max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg"},j("div",{className:"bg-accent/10 flex-shrink-0 rounded-full p-2"},j(zg,{icon:"lock",size:20,className:"text-accent"})),j("div",{className:"min-w-0 flex-1"},j("h3",{className:"text-fg-primary text-sm font-semibold"},r("security.protected.title")),j("p",{className:"text-fg-secondary mt-1 text-xs leading-relaxed"},r("security.protected.description")),j("button",{type:"button",onClick:g,className:"text-accent hover:text-accent-hover mt-2 text-xs font-medium"},r("security.protected.viewPermissions"))),j("button",{type:"button",onClick:m,className:"text-fg-muted hover:text-fg-secondary -mr-1 -mt-1 flex-shrink-0 p-1","aria-label":r("common.close")},j(zg,{icon:"x",size:16})))):null}function $y(e){var t,n,o=e.documentId,i=e.isOpen,r=e.onClose,a=e.onExited,s=Ta(o).translate,l=Do(o),c=ca().provides,d=v(Se(""),2),u=d[0],h=d[1],m=v(Se(!1),2),g=m[0],p=m[1],f=v(Se(!1),2),y=f[0],b=f[1],w=v(Se(null),2),x=w[0],C=w[1],I=null==l?void 0:l.document,k=null!==(t=null==I?void 0:I.permissions)&&void 0!==t?t:0,S=null!==(n=null==I?void 0:I.isOwnerUnlocked)&&void 0!==n&&n;Me(function(){i&&(h(""),p(!1),b(!1),C(null))},[i]);var P=function(){c&&u&&(b(!0),C(null),c.unlockOwnerPermissions(o,u).wait(function(e){b(!1),e?h(""):C(s("security.unlock.invalidPassword"))},function(e){var t,n;b(!1),C(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:s("security.unlock.failed"))}))};return j(py,{open:null!=i&&i,title:s("security.viewPermissions.title"),onClose:r,onExited:a,className:"md:w-[32rem]"},j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},s("security.viewPermissions.description")),!S&&j("div",null,j("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},s("security.unlock.label")),j("div",{className:"relative"},j("input",{type:g?"text":"password",value:u,onInput:function(e){return h(e.target.value)},placeholder:s("security.unlock.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1",onKeyDown:function(e){"Enter"===e.key&&u&&P()}}),j("button",{type:"button",onClick:function(){return p(!g)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(zg,{icon:g?"eye-off":"eye",className:"h-4 w-4"}))),x&&j("p",{className:"text-state-error mt-2 text-xs"},x),j(Eg,{onClick:P,disabled:!u||y,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover mt-3 flex items-center space-x-2 rounded-md px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},y&&j(cv,{size:"sm"}),j("span",null,s("security.unlock.button")))),S&&j("div",{className:"bg-state-success-light flex items-center space-x-2 rounded-md p-3"},j(zg,{icon:"check",className:"text-state-success h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},s("security.unlock.success"))),j(Ny,{permissions:k,translate:s}),j("div",{className:"border-border-subtle flex justify-end border-t pt-4"},j(Eg,{onClick:r,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},s("common.close")))))}var Fy={documentManager:{},commands:{commands:wy},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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Toggle Pan Mode"},pointer:{toggle:"Toggle Pointer Mode"},capture:{screenshot:"Screenshot",dragTip:"Drag to select area to capture",title:"Screenshot Preview",download:"Download",cancel:"Cancel"},document:{menu:"Document Menu",open:"Open",close:"Close",print:"Print",protect:"Security",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",style:"Annotation Style",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",deleteAllSelected:"Delete Selected",multiSelect:"{count} annotations selected",group:"Group",ungroup:"Ungroup",moreTools:"More Tools",addLink:"Add Link",removeLink:"Remove Link",gotoLink:"Go to Link",comment:"Comment"},redaction:{area:"Redact Area",text:"Redact Text",applyAll:"Apply All",clearAll:"Clear All",deleteSelected:"Delete selected redaction",commitSelected:"Apply selected redaction"},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"},print:{title:"Print Settings",loading:"Preparing document...",pages:"Pages to print",all:"All pages",current:"Current page ({currentPage})",specify:"Specify pages",specifyEG:"e.g., 1-3, 5, 8-10",total:"Total pages in document: {totalPages}",annotation:"Include annotations",printing:"Printing...",print:"Print",cancel:"Cancel"},protect:{title:"Protect Document",cancel:"Cancel",apply:"Apply Protection",applying:"Applying...",applyFailed:"Failed to apply protection. Please try again.",removeFailed:"Failed to remove protection. Please try again.",passwordMismatch:"Passwords do not match",noProtectionSelected:"Select at least one protection option to apply.",bothPasswordsNote:"Users who open with the document password will have restricted permissions. Use the owner password to unlock full access.",openPassword:{title:"Require password to open",description:"Users must enter a password to view this document.",label:"Document Password",placeholder:"Enter password",confirm:"Confirm Password",confirmPlaceholder:"Confirm password"},ownerPassword:{label:"Owner Password",placeholder:"Enter owner password",confirm:"Confirm Owner Password",confirmPlaceholder:"Confirm owner password"},permissions:{title:"Restrict permissions",description:"Limit what users can do with this document.",allowedActions:"Allowed actions",print:"Print",printHighQuality:"Print high quality",copy:"Copy content",accessibility:"Extract for accessibility",modify:"Modify content",annotations:"Add/modify annotations & comments",fillForms:"Fill forms & sign",assemble:"Assemble & extract pages"},encrypted:{title:"Document is Protected",description:"This document is protected by the owner. Enter the owner password to modify security settings.",enterOwnerPassword:"Enter Owner Password to Modify",unlockAndEdit:"Unlock & Edit"},modifyProtection:{title:"Modify Protection",description:"Choose how you want to modify the document protection.",changeOption:"Change Passwords or Permissions",changeDescription:"Update the document password or permission settings.",removeOption:"Remove All Protection",removeDescription:"Remove password protection from this document."},removeProtection:{title:"Remove Protection",warning:"Are you sure you want to remove protection?",description:"This will remove all password protection from the document. Anyone will be able to open and modify it.",confirm:"Remove Protection"}},security:{protected:{title:"This Document is Protected",description:"This file is protected and some features may be disabled. Go to Security in the document menu to view or unlock permissions.",viewPermissions:"View permissions"},viewPermissions:{title:"Document Permissions",description:"This file is restricted by the owner and requires a password to unlock certain actions.",restrictedActions:"Restricted Actions"},unlock:{label:"Enter Owner Password to Unlock File",placeholder:"Enter owner password",button:"Unlock file",invalidPassword:"Invalid password. Please try again.",failed:"Failed to unlock. Please try again.",success:"Owner permissions unlocked! You now have full access."}},common:{close:"Close",back:"Back",cancel:"Cancel"},link:{title:"Insert Link",url:"URL",page:"Page",enterUrl:"Enter URL",enterPage:"Enter Page Number",pageRange:"Page 1 to {totalPages}",link:"Link"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Pan-modus wisselen"},pointer:{toggle:"Aanwijzermodus wisselen"},capture:{screenshot:"Schermafbeelding",dragTip:"Sleep om een gebied te selecteren om vast te leggen",title:"Screenshot voorbeeld",download:"Downloaden",cancel:"Annuleren"},document:{menu:"Documentmenu",open:"Openen",close:"Sluiten",print:"Afdrukken",protect:"Beveiliging",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",style:"Annotatiestijl",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",deleteAllSelected:"Selectie verwijderen",multiSelect:"{count} annotaties geselecteerd",group:"Groeperen",ungroup:"Groepering opheffen",moreTools:"Meer gereedschappen",addLink:"Link toevoegen",removeLink:"Link verwijderen",gotoLink:"Ga naar link",comment:"Opmerking"},redaction:{area:"Gebied redigeren",text:"Tekst redigeren",applyAll:"Alles toepassen",clearAll:"Alles wissen",deleteSelected:"Geselecteerde redactie verwijderen",commitSelected:"Geselecteerde redactie toepassen"},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"},print:{title:"Afdrukinstellingen",loading:"Document voorbereiden...",pages:"Af te drukken pagina's",all:"Alle pagina's",current:"Huidige pagina ({currentPage})",specify:"Pagina's",specifyEG:"bijv. 1-3, 5, 8-10",total:"Totaal aantal pagina's in document: {totalPages}",annotation:"Inclusief annotaties",printing:"Afdrukken...",print:"Afdrukken",cancel:"Annuleren"},protect:{title:"Document beveiligen",cancel:"Annuleren",apply:"Beveiliging toepassen",applying:"Bezig met toepassen...",applyFailed:"Beveiliging kon niet worden toegepast. Probeer het opnieuw.",removeFailed:"Beveiliging kon niet worden verwijderd. Probeer het opnieuw.",passwordMismatch:"Wachtwoorden komen niet overeen",noProtectionSelected:"Selecteer minimaal één beveiligingsoptie.",bothPasswordsNote:"Gebruikers die openen met het documentwachtwoord hebben beperkte rechten. Gebruik het eigenaarswachtwoord voor volledige toegang.",openPassword:{title:"Wachtwoord vereist om te openen",description:"Gebruikers moeten een wachtwoord invoeren om dit document te bekijken.",label:"Documentwachtwoord",placeholder:"Wachtwoord invoeren",confirm:"Wachtwoord bevestigen",confirmPlaceholder:"Wachtwoord bevestigen"},ownerPassword:{label:"Eigenaarswachtwoord",placeholder:"Eigenaarswachtwoord invoeren",confirm:"Eigenaarswachtwoord bevestigen",confirmPlaceholder:"Eigenaarswachtwoord bevestigen"},permissions:{title:"Rechten beperken",description:"Beperk wat gebruikers met dit document kunnen doen.",allowedActions:"Toegestane acties",print:"Afdrukken",printHighQuality:"Hoge kwaliteit afdrukken",copy:"Inhoud kopiëren",accessibility:"Extraheren voor toegankelijkheid",modify:"Inhoud wijzigen",annotations:"Annotaties & opmerkingen toevoegen/wijzigen",fillForms:"Formulieren invullen & ondertekenen",assemble:"Document samenstellen & pagina's extraheren"},encrypted:{title:"Document is beveiligd",description:"Dit document is beveiligd door de eigenaar. Voer het eigenaarswachtwoord in om beveiligingsinstellingen te wijzigen.",enterOwnerPassword:"Voer eigenaarswachtwoord in om te wijzigen",unlockAndEdit:"Ontgrendelen & Bewerken"},modifyProtection:{title:"Beveiliging wijzigen",description:"Kies hoe u de documentbeveiliging wilt wijzigen.",changeOption:"Wachtwoorden of rechten wijzigen",changeDescription:"Update het documentwachtwoord of rechtinstellingen.",removeOption:"Alle beveiliging verwijderen",removeDescription:"Verwijder wachtwoordbeveiliging van dit document."},removeProtection:{title:"Beveiliging verwijderen",warning:"Weet u zeker dat u de beveiliging wilt verwijderen?",description:"Dit verwijdert alle wachtwoordbeveiliging van het document. Iedereen kan het openen en wijzigen.",confirm:"Beveiliging verwijderen"}},security:{protected:{title:"Dit document is beveiligd",description:"Dit bestand is beveiligd en sommige functies zijn mogelijk uitgeschakeld. Ga naar Beveiliging in het documentmenu om rechten te bekijken of te ontgrendelen.",viewPermissions:"Rechten bekijken"},viewPermissions:{title:"Documentrechten",description:"Dit bestand is beperkt door de eigenaar en vereist een wachtwoord om bepaalde acties te ontgrendelen.",restrictedActions:"Beperkte acties"},unlock:{label:"Voer eigenaarswachtwoord in om te ontgrendelen",placeholder:"Eigenaarswachtwoord invoeren",button:"Bestand ontgrendelen",invalidPassword:"Ongeldig wachtwoord. Probeer het opnieuw.",failed:"Ontgrendelen mislukt. Probeer het opnieuw.",success:"Eigenaarrechten ontgrendeld! U heeft nu volledige toegang."}},common:{close:"Sluiten",back:"Terug",cancel:"Annuleren"},link:{title:"Link invoegen",url:"URL",page:"Pagina",enterUrl:"URL invoeren",enterPage:"Paginanummer invoeren",pageRange:"Pagina 1 tot {totalPages}",link:"Koppelen"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Verschieben-Modus umschalten"},pointer:{toggle:"Zeiger-Modus umschalten"},capture:{screenshot:"Screenshot",dragTip:"Ziehen Sie, um den Bereich zum Erfassen auszuwählen",title:"Screenshot-Vorschau",download:"Herunterladen",cancel:"Abbrechen"},document:{menu:"Dokument-Menü",open:"Öffnen",close:"Schließen",print:"Drucken",protect:"Sicherheit",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",style:"Anmerkungsstil",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",deleteAllSelected:"Ausgewählte löschen",multiSelect:"{count} Anmerkungen ausgewählt",group:"Gruppieren",ungroup:"Gruppierung aufheben",moreTools:"Weitere Werkzeuge",addLink:"Link hinzufügen",removeLink:"Link entfernen",gotoLink:"Zum Link gehen",comment:"Kommentar"},redaction:{area:"Bereich schwärzen",text:"Text schwärzen",applyAll:"Alle anwenden",clearAll:"Alle löschen",deleteSelected:"Ausgewählte Schwärzung löschen",commitSelected:"Ausgewählte Schwärzung anwenden"},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"},print:{title:"Druckeinstellungen",loading:"Dokument wird vorbereitet...",pages:"Zu druckende Seiten",all:"Alle Seiten",current:"Aktuelle Seite ({currentPage})",specify:"Seiten angeben",specifyEG:"z.B. 1-3, 5, 8-10",total:"Gesamtseitenzahl im Dokument: {totalPages}",annotation:"Anmerkungen einbeziehen",printing:"Drucken...",print:"Drucken",cancel:"Abbrechen"},protect:{title:"Dokument schützen",cancel:"Abbrechen",apply:"Schutz anwenden",applying:"Wird angewendet...",applyFailed:"Schutz konnte nicht angewendet werden. Bitte versuchen Sie es erneut.",removeFailed:"Schutz konnte nicht entfernt werden. Bitte versuchen Sie es erneut.",passwordMismatch:"Passwörter stimmen nicht überein",noProtectionSelected:"Wählen Sie mindestens eine Schutzoption aus.",bothPasswordsNote:"Benutzer, die das Dokumentpasswort eingeben, haben eingeschränkte Berechtigungen. Verwenden Sie das Eigentümerpasswort für vollen Zugriff.",openPassword:{title:"Passwort zum Öffnen erforderlich",description:"Benutzer müssen ein Passwort eingeben, um dieses Dokument anzuzeigen.",label:"Dokumentpasswort",placeholder:"Passwort eingeben",confirm:"Passwort bestätigen",confirmPlaceholder:"Passwort bestätigen"},ownerPassword:{label:"Eigentümerpasswort",placeholder:"Eigentümerpasswort eingeben",confirm:"Eigentümerpasswort bestätigen",confirmPlaceholder:"Eigentümerpasswort bestätigen"},permissions:{title:"Berechtigungen einschränken",description:"Beschränken Sie, was Benutzer mit diesem Dokument tun können.",allowedActions:"Erlaubte Aktionen",print:"Drucken",printHighQuality:"In hoher Qualität drucken",copy:"Inhalt kopieren",accessibility:"Für Barrierefreiheit extrahieren",modify:"Inhalt ändern",annotations:"Anmerkungen & Kommentare hinzufügen/ändern",fillForms:"Formulare ausfüllen & unterschreiben",assemble:"Dokument zusammenstellen & Seiten extrahieren"},encrypted:{title:"Dokument ist geschützt",description:"Dieses Dokument ist vom Eigentümer geschützt. Geben Sie das Eigentümerpasswort ein, um die Sicherheitseinstellungen zu ändern.",enterOwnerPassword:"Eigentümerpasswort eingeben zum Ändern",unlockAndEdit:"Entsperren & Bearbeiten"},modifyProtection:{title:"Schutz ändern",description:"Wählen Sie, wie Sie den Dokumentschutz ändern möchten.",changeOption:"Passwörter oder Berechtigungen ändern",changeDescription:"Aktualisieren Sie das Dokumentpasswort oder die Berechtigungseinstellungen.",removeOption:"Gesamten Schutz entfernen",removeDescription:"Passwortschutz von diesem Dokument entfernen."},removeProtection:{title:"Schutz entfernen",warning:"Sind Sie sicher, dass Sie den Schutz entfernen möchten?",description:"Dadurch wird der gesamte Passwortschutz vom Dokument entfernt. Jeder kann es öffnen und bearbeiten.",confirm:"Schutz entfernen"}},security:{protected:{title:"Dieses Dokument ist geschützt",description:"Diese Datei ist geschützt und einige Funktionen sind möglicherweise deaktiviert. Gehen Sie zu Sicherheit im Dokumentmenü, um Berechtigungen anzuzeigen oder freizuschalten.",viewPermissions:"Berechtigungen anzeigen"},viewPermissions:{title:"Dokumentberechtigungen",description:"Diese Datei ist vom Eigentümer eingeschränkt und erfordert ein Passwort, um bestimmte Aktionen freizuschalten.",restrictedActions:"Eingeschränkte Aktionen"},unlock:{label:"Eigentümerpasswort eingeben zum Entsperren",placeholder:"Eigentümerpasswort eingeben",button:"Datei entsperren",invalidPassword:"Ungültiges Passwort. Bitte versuchen Sie es erneut.",failed:"Entsperren fehlgeschlagen. Bitte versuchen Sie es erneut.",success:"Eigentümerberechtigungen entsperrt! Sie haben jetzt vollen Zugriff."}},common:{close:"Schließen",back:"Zurück",cancel:"Abbrechen"},link:{title:"Link einfügen",url:"URL",page:"Seite",enterUrl:"URL eingeben",enterPage:"Seitennummer eingeben",pageRange:"Seite 1 bis {totalPages}",link:"Verknüpfen"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Basculer le mode déplacement"},pointer:{toggle:"Basculer le mode pointeur"},capture:{screenshot:"Capture d'écran",dragTip:"Faites glisser pour sélectionner la zone à capturer",title:"Aperçu de la capture",download:"Télécharger",cancel:"Annuler"},document:{menu:"Menu Document",open:"Ouvrir",close:"Fermer",print:"Imprimer",protect:"Sécurité",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é",style:"Style d'annotation",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",deleteAllSelected:"Supprimer la sélection",multiSelect:"{count} annotations sélectionnées",group:"Grouper",ungroup:"Dissocier",moreTools:"Plus d'outils",addLink:"Ajouter un lien",removeLink:"Supprimer le lien",gotoLink:"Aller au lien",comment:"Commentaire"},redaction:{area:"Caviarder la zone",text:"Caviarder le texte",applyAll:"Tout appliquer",clearAll:"Tout effacer",deleteSelected:"Supprimer la rédaction sélectionnée",commitSelected:"Appliquer la rédaction sélectionnée"},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é"},print:{title:"Paramètres d'impression",loading:"Préparation du document...",pages:"Pages à imprimer",all:"Toutes les pages",current:"Page actuelle ({currentPage})",specify:"Spécifier les pages",specifyEG:"ex : 1-3, 5, 8-10",total:"Nombre total de pages dans le document : {totalPages}",annotation:"Inclure les annotations",printing:"Impression...",print:"Imprimer",cancel:"Annuler"},protect:{title:"Protéger le document",cancel:"Annuler",apply:"Appliquer la protection",applying:"Application en cours...",applyFailed:"Échec de l'application de la protection. Veuillez réessayer.",removeFailed:"Échec de la suppression de la protection. Veuillez réessayer.",passwordMismatch:"Les mots de passe ne correspondent pas",noProtectionSelected:"Sélectionnez au moins une option de protection.",bothPasswordsNote:"Les utilisateurs qui ouvrent avec le mot de passe du document auront des permissions limitées. Utilisez le mot de passe propriétaire pour un accès complet.",openPassword:{title:"Mot de passe requis pour l'ouverture",description:"Les utilisateurs doivent entrer un mot de passe pour voir ce document.",label:"Mot de passe du document",placeholder:"Entrer le mot de passe",confirm:"Confirmer le mot de passe",confirmPlaceholder:"Confirmer le mot de passe"},ownerPassword:{label:"Mot de passe propriétaire",placeholder:"Entrer le mot de passe propriétaire",confirm:"Confirmer le mot de passe propriétaire",confirmPlaceholder:"Confirmer le mot de passe propriétaire"},permissions:{title:"Restreindre les permissions",description:"Limitez ce que les utilisateurs peuvent faire avec ce document.",allowedActions:"Actions autorisées",print:"Imprimer",printHighQuality:"Imprimer en haute qualité",copy:"Copier le contenu",accessibility:"Extraire pour l'accessibilité",modify:"Modifier le contenu",annotations:"Ajouter/modifier les annotations et commentaires",fillForms:"Remplir les formulaires et signer",assemble:"Assembler le document et extraire les pages"},encrypted:{title:"Document protégé",description:"Ce document est protégé par le propriétaire. Entrez le mot de passe propriétaire pour modifier les paramètres de sécurité.",enterOwnerPassword:"Entrer le mot de passe propriétaire pour modifier",unlockAndEdit:"Déverrouiller & Modifier"},modifyProtection:{title:"Modifier la protection",description:"Choisissez comment vous voulez modifier la protection du document.",changeOption:"Modifier les mots de passe ou les permissions",changeDescription:"Mettre à jour le mot de passe du document ou les paramètres de permissions.",removeOption:"Supprimer toute la protection",removeDescription:"Supprimer la protection par mot de passe de ce document."},removeProtection:{title:"Supprimer la protection",warning:"Êtes-vous sûr de vouloir supprimer la protection ?",description:"Cela supprimera toute la protection par mot de passe du document. Tout le monde pourra l'ouvrir et le modifier.",confirm:"Supprimer la protection"}},security:{protected:{title:"Ce document est protégé",description:"Ce fichier est protégé et certaines fonctionnalités peuvent être désactivées. Allez dans Sécurité dans le menu document pour afficher ou déverrouiller les permissions.",viewPermissions:"Voir les permissions"},viewPermissions:{title:"Permissions du document",description:"Ce fichier est restreint par le propriétaire et nécessite un mot de passe pour débloquer certaines actions.",restrictedActions:"Actions restreintes"},unlock:{label:"Entrer le mot de passe propriétaire pour déverrouiller",placeholder:"Entrer le mot de passe propriétaire",button:"Déverrouiller le fichier",invalidPassword:"Mot de passe invalide. Veuillez réessayer.",failed:"Échec du déverrouillage. Veuillez réessayer.",success:"Permissions propriétaire déverrouillées ! Vous avez maintenant un accès complet."}},common:{close:"Fermer",back:"Retour",cancel:"Annuler"},link:{title:"Insérer un lien",url:"URL",page:"Page",enterUrl:"Entrer l'URL",enterPage:"Entrer le numéro de page",pageRange:"Page 1 à {totalPages}",link:"Lier"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Alternar modo desplazamiento"},pointer:{toggle:"Alternar modo puntero"},capture:{screenshot:"Captura de pantalla",dragTip:"Arrastre para seleccionar el área a capturar",title:"Vista previa de la captura",download:"Descargar",cancel:"Cancelar"},document:{menu:"Menú del documento",open:"Abrir",close:"Cerrar",print:"Imprimir",protect:"Seguridad",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",style:"Estilo de anotación",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",deleteAllSelected:"Eliminar selección",multiSelect:"{count} anotaciones seleccionadas",group:"Agrupar",ungroup:"Desagrupar",moreTools:"Más herramientas",addLink:"Agregar enlace",removeLink:"Eliminar enlace",gotoLink:"Ir al enlace",comment:"Comentario"},redaction:{area:"Redactar área",text:"Redactar texto",applyAll:"Aplicar todo",clearAll:"Borrar todo",deleteSelected:"Eliminar redacción seleccionada",commitSelected:"Aplicar redacción seleccionada"},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"},print:{title:"Configuración de impresión",loading:"Preparando documento...",pages:"Páginas a imprimir",all:"Todas las páginas",current:"Página actual ({currentPage})",specify:"Especificar páginas",specifyEG:"ej: 1-3, 5, 8-10",total:"Total de páginas en el documento: {totalPages}",annotation:"Incluir anotaciones",printing:"Imprimiendo...",print:"Imprimir",cancel:"Cancelar"},protect:{title:"Proteger documento",cancel:"Cancelar",apply:"Aplicar protección",applying:"Aplicando...",applyFailed:"No se pudo aplicar la protección. Por favor, inténtelo de nuevo.",removeFailed:"No se pudo eliminar la protección. Por favor, inténtelo de nuevo.",passwordMismatch:"Las contraseñas no coinciden",noProtectionSelected:"Seleccione al menos una opción de protección.",bothPasswordsNote:"Los usuarios que abran con la contraseña del documento tendrán permisos restringidos. Use la contraseña de propietario para acceso completo.",openPassword:{title:"Contraseña requerida para abrir",description:"Los usuarios deben ingresar una contraseña para ver este documento.",label:"Contraseña del documento",placeholder:"Ingresar contraseña",confirm:"Confirmar contraseña",confirmPlaceholder:"Confirmar contraseña"},ownerPassword:{label:"Contraseña de propietario",placeholder:"Ingresar contraseña de propietario",confirm:"Confirmar contraseña de propietario",confirmPlaceholder:"Confirmar contraseña de propietario"},permissions:{title:"Restringir permisos",description:"Limite lo que los usuarios pueden hacer con este documento.",allowedActions:"Acciones permitidas",print:"Imprimir",printHighQuality:"Imprimir alta calidad",copy:"Copiar contenido",accessibility:"Extraer para accesibilidad",modify:"Modificar contenido",annotations:"Añadir/modificar anotaciones y comentarios",fillForms:"Rellenar formularios y firmar",assemble:"Ensamblar documento y extraer páginas"},encrypted:{title:"Documento protegido",description:"Este documento está protegido por el propietario. Ingrese la contraseña de propietario para modificar la configuración de seguridad.",enterOwnerPassword:"Ingrese la contraseña de propietario para modificar",unlockAndEdit:"Desbloquear y Editar"},modifyProtection:{title:"Modificar protección",description:"Elija cómo desea modificar la protección del documento.",changeOption:"Cambiar contraseñas o permisos",changeDescription:"Actualizar la contraseña del documento o la configuración de permisos.",removeOption:"Eliminar toda la protección",removeDescription:"Eliminar la protección por contraseña de este documento."},removeProtection:{title:"Eliminar protección",warning:"¿Está seguro de que desea eliminar la protección?",description:"Esto eliminará toda la protección por contraseña del documento. Cualquiera podrá abrirlo y modificarlo.",confirm:"Eliminar protección"}},security:{protected:{title:"Este documento está protegido",description:"Este archivo está protegido y algunas funciones pueden estar deshabilitadas. Vaya a Seguridad en el menú del documento para ver o desbloquear los permisos.",viewPermissions:"Ver permisos"},viewPermissions:{title:"Permisos del documento",description:"Este archivo está restringido por el propietario y requiere una contraseña para desbloquear ciertas acciones.",restrictedActions:"Acciones restringidas"},unlock:{label:"Ingrese la contraseña de propietario para desbloquear",placeholder:"Ingresar contraseña de propietario",button:"Desbloquear archivo",invalidPassword:"Contraseña inválida. Por favor, inténtelo de nuevo.",failed:"Error al desbloquear. Por favor, inténtelo de nuevo.",success:"¡Permisos de propietario desbloqueados! Ahora tiene acceso completo."}},common:{close:"Cerrar",back:"Atrás",cancel:"Cancelar"},link:{title:"Insertar enlace",url:"URL",page:"Página",enterUrl:"Introducir URL",enterPage:"Introducir número de página",pageRange:"Página 1 a {totalPages}",link:"Enlazar"}}},{code:"zh-CN",name:"简体中文",translations:{search:{placeholder:"搜索",caseSensitive:"大小写敏感",wholeWord:"全词匹配",resultsFound:"{count} 个结果",page:"第{page}页"},zoom:{in:"放大",out:"缩小",fitWidth:"适合宽度",fitPage:"适合页面",marquee:"框选放大",menu:"缩放菜单",level:"缩放比例 ({level}%)",dragTip:"拖动鼠标选择要放大的区域"},pan:{toggle:"拖动模式"},pointer:{toggle:"光标模式"},capture:{screenshot:"截图",dragTip:"拖动鼠标选择要截取的区域",title:"截取的PDF区域",download:"下载",cancel:"取消"},document:{menu:"文件选项",open:"打开",close:"关闭",print:"打印",protect:"安全",export:"导出",fullscreen:"全屏",loading:"文件加载中..."},emptyState:{title:"尚无打开的文件",description:"请点击“+ 打开文件”按钮选择并打开一个PDF文件。",descriptionMulti:"您可以使用标签页同时打开多个文件。",openButton:"打开文件",supportedFormats:"支持的文件格式为: PDF"},passwordPrompt:{title:"请输入密码",required:"该文件设置有密码保护,要打开文件请输入密码。",incorrect:"你输入的密码错误,请重新输入。",incorrectWarning:"密码错误,请检查后重新输入。",label:"密码",placeholder:"请输入文件密码",open:"打开",opening:"打开中...",cancel:"取消",close:"关闭"},documentError:{title:"文件加载出错",unknown:"未知错误",errorCode:"错误码: {code}",close:"关闭文件"},panel:{sidebar:"大纲与书签",search:"搜索",comment:"评论",thumbnails:"缩略图",outline:"大纲",annotationStyle:"批注样式"},menu:{viewControls:"视图控件",zoomControls:"缩放控件",moreOptions:"更多选项"},outline:{title:"大纲",loading:"大纲加载中...",noOutline:"没有大纲",noBookmarks:"该文件不含书签"},page:{settings:"页面设置",single:"单页视图",twoOdd:"双页视图",twoEven:"书籍视图",vertical:"垂直滚动",horizontal:"水平滚动",spreadMode:"跨页模式",scrollLayout:"滚动布局",rotation:"页面转向",next:"下一页",previous:"上一页"},rotate:{clockwise:"顺时针旋转",counterClockwise:"逆时针旋转"},selection:{copy:"复制"},mode:{view:"阅读",annotate:"批注",shapes:"形状",redact:"遮蔽"},annotation:{text:"任意文本",highlight:"高亮",strikeout:"删除线",underline:"下划线",squiggly:"下划曲线",rectangle:"矩形",circle:"圆形",line:"直线",arrow:"带箭头直线",polygon:"多边形",polyline:"多段线",ink:"自由绘制",stamp:"印章",freeText:"任意文本",square:"矩形",style:"批注样式",styles:"{type} 样式",defaults:"{type} 默认值",color:"颜色",opacity:"透明度",blendMode:"混合模式",strokeWidth:"线条宽度",strokeColor:"线条颜色",borderStyle:"线条样式",fillColor:"填充色",fontSize:"字号",fontFamily:"字体",textAlign:"左右对齐",verticalAlign:"上下对齐",lineEnding:"行尾",lineStart:"线条起点",lineEnd:"线条结尾",font:"字体",fontColor:"字色",backgroundColor:"背景色",noStyles:"该批注无需设置样式。",noStylesStamp:"印章无需设置样式。",selectAnnotation:"在此处查看选中批注的样式。",deleteSelected:"删除选中的批注",deleteAllSelected:"删除选中",multiSelect:"已选择 {count} 个批注",group:"分组",ungroup:"取消分组",moreTools:"更多工具",addLink:"添加链接",removeLink:"移除链接",gotoLink:"跳转到链接",comment:"评论"},redaction:{area:"遮蔽区域",text:"遮蔽文本",applyAll:"全部应用",clearAll:"全部取消",deleteSelected:"取消遮蔽",commitSelected:"应用遮蔽"},history:{undo:"撤销",redo:"恢复"},comments:{page:"第{page}页",commentCount:"{count}条评论",commentCountPlural:"{count}条评论",addComment:"新增评论...",addReply:"新增回复...",save:"保存",cancel:"取消",edit:"编辑",delete:"删除",showMore:"展开",showLess:"收起",emptyState:"添加批注后,可以在这里对批注进行评论。"},blendMode:{normal:"正常",multiply:"正片",screen:"屏幕",overlay:"叠加",darken:"变暗",lighten:"变亮",colorDodge:"色彩减淡",colorBurn:"颜色加深",hardLight:"强光",softLight:"柔光",difference:"差值",exclusion:"排除",hue:"色相",saturation:"饱和度",color:"颜色",luminosity:"亮度"},print:{title:"打印设置",loading:"正在处理...",pages:"要打印的页码",all:"所有页",current:"当前页({currentPage})",specify:"指定页",specifyEG:"例如:1-3, 5, 8-10",total:"文档总页数:{totalPages}",annotation:"包含批注",printing:"打印中...",print:"打印",cancel:"取消"},protect:{title:"文档保护",cancel:"取消",apply:"应用保护",applying:"正在应用...",applyFailed:"无法应用保护。请重试。",removeFailed:"无法移除保护。请重试。",passwordMismatch:"密码不匹配",noProtectionSelected:"请至少选择一种保护方式。",bothPasswordsNote:"使用文档密码打开的用户将受到权限限制。使用所有者密码可获得完全访问权限。",openPassword:{title:"需要密码才能打开",description:"用户必须输入密码才能查看此文档。",label:"文档密码",placeholder:"输入密码",confirm:"确认密码",confirmPlaceholder:"确认密码"},ownerPassword:{label:"所有者密码",placeholder:"输入所有者密码",confirm:"确认所有者密码",confirmPlaceholder:"确认所有者密码"},permissions:{title:"限制权限",description:"限制用户对此文档的操作。",allowedActions:"允许的操作",print:"打印",printHighQuality:"高质量打印",copy:"复制内容",accessibility:"提取辅助功能",modify:"修改内容",annotations:"添加/修改批注和评论",fillForms:"填写表单和签名",assemble:"组装文档和提取页面"},encrypted:{title:"文档受保护",description:"此文档已被所有者保护。请输入所有者密码以修改安全设置。",enterOwnerPassword:"输入所有者密码以修改",unlockAndEdit:"解锁并编辑"},modifyProtection:{title:"修改保护",description:"选择如何修改文档保护。",changeOption:"更改密码或权限",changeDescription:"更新文档密码或权限设置。",removeOption:"移除所有保护",removeDescription:"移除此文档的密码保护。"},removeProtection:{title:"移除保护",warning:"确定要移除保护吗?",description:"这将移除文档的所有密码保护。任何人都可以打开和修改它。",confirm:"移除保护"}},security:{protected:{title:"此文档受保护",description:'此文件受保护,某些功能可能被禁用。请在文档菜单中点击"安全"以查看或解锁权限。',viewPermissions:"查看权限"},viewPermissions:{title:"文档权限",description:"此文件受所有者限制,需要密码才能解锁某些操作。",restrictedActions:"受限操作"},unlock:{label:"输入所有者密码以解锁文件",placeholder:"输入所有者密码",button:"解锁文件",invalidPassword:"密码无效。请重试。",failed:"解锁失败。请重试。",success:"所有者权限已解锁!您现在拥有完全访问权限。"}},common:{close:"关闭",back:"返回",cancel:"取消"},link:{title:"插入链接",url:"网址",page:"页面",enterUrl:"输入网址",enterPage:"输入页码",pageRange:"第1页到第{totalPages}页",link:"链接"}}}],paramResolvers:xy},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:"chinese-languages",locales:["zh-CN"],breakpoints:{sm:{replaceHide:["zoom-toolbar","mode-select-button","overflow-tabs-button"],replaceShow:["view-mode","annotate-mode","shapes-mode","redact-mode","pan-button","pointer-button","divider-3"]},md:{replaceShow:["view-mode","annotate-mode","shapes-mode","redact-mode","zoom-toolbar","pan-button","pointer-button","divider-3"],replaceHide:["zoom-menu-button","mode-select-button","overflow-tabs-button"]}}},{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:protect",commandId:"document:protect",categories:["document","document-protect"]},{type:"command",id:"document:capture",commandId:"document:capture",categories:["document","document-capture"]},{type:"command",id:"document:export",commandId:"document:export",categories:["document","document-export"]},{type:"divider",id:"divider-11",visibilityDependsOn:{itemIds:["document:export","document:print","document:capture","document:protect"]}},{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},"protect-modal":{id:"protect-modal",content:{type:"component",componentId:"protect-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0},"view-permissions-modal":{id:"view-permissions-modal",content:{type:"component",componentId:"view-permissions-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0},"link-modal":{id:"link-modal",content:{type:"component",componentId:"link-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},"unlock-owner-overlay":{id:"unlock-owner-overlay",position:{anchor:"bottom-right",offset:{bottom:"1.5rem",right:"1.5rem"}},content:{type:"component",componentId:"unlock-owner-overlay"},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-link",commandId:"annotation:toggle-link",variant:"icon",categories:["annotation","annotation-link"]},{type:"command-button",id:"toggle-annotation-style",commandId:"annotation:toggle-annotation-style",variant:"icon",categories:["annotation","annotation-style"]},{type:"command-button",id:"comment-button",commandId:"annotation:toggle-comment",variant:"icon",categories:["annotation","annotation-comment"]},{type:"command-button",id:"goto-link",commandId:"annotation:goto-link",variant:"icon-text",categories:["annotation","annotation-link"]}]},groupAnnotation:{id:"groupAnnotation",categories:["annotation","annotation-group"],items:[{type:"command-button",id:"toggle-group-annotations",commandId:"annotation:toggle-group",variant:"icon",categories:["annotation","annotation-group"]},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"command-button",id:"delete-all-annotations",commandId:"annotation:delete-all-selected",variant:"icon",categories:["annotation","annotation-delete","annotation-group"]}]},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","add-link","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:"add-link",commandId:"annotation:add-link",variant:"icon",categories:["annotation","annotation-link"]},{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]}]}}}},viewport:{viewportGap:10},scroll:{defaultStrategy:ii.Vertical},zoom:{defaultZoomLevel:Ea.FitPage},spread:{defaultSpreadMode:xi.None},rotation:{defaultRotation:Be.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 jy(e){var t=e.documentId,n=e.tabBarVisibility,o=void 0===n?"multiple":n,i=function(e){const t=ea(),{provides:n}=Ur(),o=null==n?void 0:n.getSchema(),i=Hr(e);return{renderToolbar:(r,a)=>{const s=`${r}-${a}`;if(!o||!n||!i)return null;const l=i.activeToolbars[s],c=l?o.toolbars[l.toolbarId]:null;l&&!c&&console.warn(`Toolbar "${l.toolbarId}" not found in schema`);const d=c&&!c.permanent?()=>n.forDocument(e).closeToolbarSlot(r,a):void 0,u=t.toolbar;return He(H,{children:l&&c&&He(u,{schema:c,documentId:e,isOpen:l.isOpen,onClose:d})},`toolbar-slot-${s}`)},renderSidebar:(r,a)=>{var s;const l=`${r}-${a}`;if(!o||!n||!i)return null;const c=i.activeSidebars[l],d=c?null==(s=o.sidebars)?void 0:s[c.sidebarId]:null;c&&!d&&console.warn(`Sidebar "${c.sidebarId}" not found in schema`);const u=t.sidebar;return He(H,{children:c&&d&&He(u,{schema:d,documentId:e,isOpen:c.isOpen,onClose:()=>{n.forDocument(e).closeSidebarSlot(r,a)}})},`sidebar-slot-${l}`)},renderModal:()=>{var r;if(!o||!n||!i)return null;const a=t.modal;if(!a)return null;const s=i.activeModal,l=s?null==(r=o.modals)?void 0:r[s.modalId]:null;return s&&!l&&console.warn(`Modal "${s.modalId}" not found in schema`),He(H,{children:s&&l&&He(a,{schema:l,documentId:e,isOpen:s.isOpen,onClose:()=>{n.forDocument(e).closeModal()},onExited:()=>{n.forDocument(e).clearModal()}})},"modal-slot")},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(!o||!n||!i)return null;const r=t.overlay;return r?He(H,{children:(o.overlays?Object.values(o.overlays):[]).filter(e=>!1!==i.enabledOverlays[e.id]).map(t=>He(r,{schema:t,documentId:e},t.id))},"overlays-slot"):null}}}(t),r=i.renderToolbar,a=i.renderSidebar,s=i.renderModal,l=i.renderOverlays,c=Ta(t).translate,d=ta("selection",t),u=ta("annotation",t),h=ta("groupAnnotation",t),m=ta("redaction",t),g=(e=>{const t=Mo();return ze(()=>t?t.documentOrder.map(e=>t.documents[e]).filter(e=>null!=e):[],[t,e])})(),p=(()=>{const e=Mo();return ze(()=>{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})();return j(H,null,j(Ay,{documentStates:g,activeDocumentId:p.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(la,{documentId:t},function(e){var n=e.documentState,o=e.isLoading,i=e.isError,r=e.isLoaded;return j(H,null,o&&j("div",{className:"flex h-full items-center justify-center"},j(lv,{size:"lg",text:c("document.loading")})),i&&j(Ty,{documentState:n}),r&&j("div",{className:"relative h-full w-full"},j(eu,{documentId:t},j(oi,{className:"bg-bg-app",documentId:t},j(Ka,{documentId:t},j(wi,{documentId:t,renderPage:function(e){var n=e.pageIndex;return j(ds,{documentId:t,pageIndex:n,style:{backgroundColor:"#fff"}},j(tu,{documentId:t,pageIndex:n},j(es,{documentId:t,pageIndex:n,scale:.5,style:{pointerEvents:"none"}}),j(_l,{documentId:t,pageIndex:n,style:{pointerEvents:"none"}}),j(Es,{documentId:t,pageIndex:n}),j(Za,{documentId:t,pageIndex:n}),j(gh,{documentId:t,pageIndex:n}),j(fl,{documentId:t,pageIndex:n,selectionMenu:d}),j(Xh,{documentId:t,pageIndex:n,selectionMenu:m}),j(Pu,{documentId:t,pageIndex:n,selectionMenu:u,groupSelectionMenu:h}),j(vl,{documentId:t,pageIndex:n})))}})))),l()))})),a("right","main")),s())}var Uy=new ut([new lt,new dt]);function Hy(e){var t,o=e.config,i=e.onRegistryReady,r=function(e){const{wasmUrl:t=_o,worker:n=!0,logger:o,encoderPoolSize:i,fontFallback:r}=e??{},[a,s]=Se(null),[l,c]=Se(!0),[d,u]=Se(null),h=Ae(null);return Me(()=>{let e=!1;return(async()=>{try{const{createPdfiumEngine:e}=n?await import("./worker-engine-D8W4P9zI.js"):await import("./direct-engine-BDuzMUFV.js"),a=await e(t,{logger:o,encoderPoolSize:i,fontFallback:r});h.current=a,s(a),c(!1)}catch(t){e||(u(t),c(!1))}})(),()=>{var t,n;e=!0,null==(n=null==(t=h.current)?void 0:t.closeAllDocuments)||n.call(t).wait(()=>{var e,t;null==(t=null==(e=h.current)?void 0:e.destroy)||t.call(e),h.current=null},Sn)}},[t,n,o,r]),{engine:a,isLoading:l,error:d}}(h(h({},o.wasmUrl&&{wasmUrl:o.wasmUrl}),{},{worker:o.worker,logger:o.log?Uy:void 0})),a=r.engine,s=r.isLoading,l=ze(function(){return{"thumbnails-sidebar":nv,"annotation-sidebar":dy,"zoom-toolbar":Pv,"search-sidebar":av,"outline-sidebar":sv,"comment-sidebar":Sv,"print-modal":fy,"link-modal":vy,"protect-modal":Oy,"unlock-owner-overlay":Ly,"page-controls":yy,"mode-select-button":Ey,"view-permissions-modal":$y}},[]),c=ze(function(){return{toolbar:sf,sidebar:qf,modal:tv,overlay:gy,menu:Kf,selectionMenu:uy}},[]);return j(H,null,j("style",null,je),!a||s?j("div",{className:"flex h-full w-full items-center justify-center"},j(lv,{size:"lg",text:"Initializing PDF engine..."})):j(ko,{config:{logger:o.log?Uy:void 0,permissions:o.permissions},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:[ro(da,h(h(h({},Fy.documentManager),o.src&&{initialDocuments:[{url:o.src}]}),o.documentManager)),ro(wa,h(h(h({},Fy.commands),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.commands)),ro(za,h(h({},Fy.i18n),o.i18n)),ro(jr,h(h(h({},Fy.ui),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.ui)),ro(Jo,h(h({},Fy.viewport),o.viewport)),ro(vi,h(h({},Fy.scroll),o.scroll)),ro(Wa,h(h({},Fy.zoom),o.zoom)),ro(Ei,h(h({},Fy.spread),o.spread)),ro(cs,h(h({},Fy.rotation),o.rotation)),ro(nh,h(h({},Fy.pan),o.pan)),ro(Ja,h(h({},Fy.render),o.render)),ro(Tl,h(h({},Fy.tiling),o.tiling)),ro(Gl,h(h({},Fy.thumbnails),o.thumbnails)),ro(Md,h(h({},Fy.annotations),o.annotations)),ro(zs,h(h({},Fy.search),o.search)),ro(yl,h(h({},Fy.selection),o.selection)),ro(qu,h(h({},Fy.bookmarks),o.bookmarks)),ro(tm,h(h({},Fy.attachments),o.attachments)),ro(hh,h(h({},Fy.capture),o.capture)),ro(qh,h(h({},Fy.redaction),o.redaction)),ro(Eu,h(h({},Fy.print),o.print)),ro(Zu,h(h({},Fy.export),o.export)),ro(ju,h(h({},Fy.fullscreen),o.fullscreen)),ro(kh,h(h({},Fy.history),o.history)),ro(Vd,h(h({},Fy.interactionManager),o.interactionManager))]},function(e){var t=e.pluginsReady,n=e.activeDocumentId;return j(H,null,t?j(H,null,n?j(ia,{documentId:n,components:l,renderers:c,className:"relative flex h-full w-full select-none flex-col"},j(jy,{documentId:n,tabBarVisibility:o.tabBar}),j(Ry,{documentId:n}),j(uv,{documentId:n})):j(zy,null)):j("div",{className:"flex h-full items-center justify-center"},j(lv,{size:"lg",text:"Initializing plugins..."})))}))}var By="undefined"!=typeof HTMLElement?HTMLElement:r(function e(){i(this,e)}),Wy=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,By),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&&Dg(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 Py(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=Py((null==o?void 0:o.preference)||"system"),r="dark"===i?Iy:Cy,a=null==o?void 0:o[i];return n=r,(t=a)?Sy(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=Dy(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){Mg(e,t)}},{key:"registerIcons",value:function(e){Dg(e)}},{key:"renderViewer",value:function(){this._config&&(ce(j(Hy,{config:this._config,onRegistryReady:this.handleRegistryReady}),this.root),this.injectTheme())}}])}(),qy=["type","target"],Gy="2.3.0";"undefined"==typeof customElements||customElements.get("embedpdf-container")||customElements.define("embedpdf-container",Wy);var Vy={version:Gy,init:function(e){if("container"===e.type)return function(e){e.type,e.target;var t=m(e,qy),n=document.createElement("embedpdf-container");return n.config=t,e.target.appendChild(n),n}(e)}};export{Ds as $,Dt as A,Ge as B,ot as C,at as D,bt as E,Pt as F,Yt as G,jt as H,kn as I,Gy as J,Wy as K,Vy as L,ii as M,st as N,Di as O,qt as P,xi as Q,Be as R,pi as S,pt as T,Ea as U,Qo as V,ss as W,zl as X,ql as Y,Ba as Z,xd as _,Gt as a,al as a0,uh as a1,Bh as a2,Sh as a3,Rr as a4,Da as a5,fa as a6,aa as a7,zu as a8,Lu as a9,Wu as aa,Vu as ab,eh as ac,xh as ad,Jh as ae,Xa as af,Wd as ag,Sn as ah,Cy as ai,Iy as aj,Sy as ak,Mg as al,Dg as am,Mt as b,Wt as c,yt as d,At as e,_t as f,Rt as g,zt as h,Cn as i,St as j,wt as k,Vt as l,Zt as m,Tt as n,Qt as o,Xt as p,Ze as q,Ye as r,wn as s,xt as t,In as u,Nt as v,Kt as w,$t as x,Ft as y,Et as z};
|