@dipusevilla/componentes-iu 1.0.49 → 1.0.51

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/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),Yt=require("react-dom");function sc(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const X=sc(b);function rc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nr={exports:{}},ks={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),Jt=require("react-dom");function El(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const H=El(b);function Cl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yr={exports:{}},vr={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ea;function nc(){if(Ea)return ks;Ea=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function s(r,n,a){var o=null;if(a!==void 0&&(o=""+a),n.key!==void 0&&(o=""+n.key),"key"in n){a={};for(var i in n)i!=="key"&&(a[i]=n[i])}else a=n;return n=a.ref,{$$typeof:t,type:r,key:o,ref:n!==void 0?n:null,props:a}}return ks.Fragment=e,ks.jsx=s,ks.jsxs=s,ks}var Ss={};/**
9
+ */var fa;function Al(){if(fa)return vr;fa=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var l in n)l!=="key"&&(a[l]=n[l])}else a=n;return n=a.ref,{$$typeof:e,type:s,key:i,ref:n!==void 0?n:null,props:a}}return vr.Fragment=t,vr.jsx=r,vr.jsxs=r,vr}var yr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,37 +14,37 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Oa;function ac(){return Oa||(Oa=1,process.env.NODE_ENV!=="production"&&function(){function t(A){if(A==null)return null;if(typeof A=="function")return A.$$typeof===I?null:A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case x:return"Fragment";case m:return"Profiler";case v:return"StrictMode";case S:return"Suspense";case T:return"SuspenseList";case _:return"Activity"}if(typeof A=="object")switch(typeof A.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),A.$$typeof){case g:return"Portal";case w:return(A.displayName||"Context")+".Provider";case y:return(A._context.displayName||"Context")+".Consumer";case O:var j=A.render;return A=A.displayName,A||(A=j.displayName||j.name||"",A=A!==""?"ForwardRef("+A+")":"ForwardRef"),A;case C:return j=A.displayName||null,j!==null?j:t(A.type)||"Memo";case N:j=A._payload,A=A._init;try{return t(A(j))}catch{}}return null}function e(A){return""+A}function s(A){try{e(A);var j=!1}catch{j=!0}if(j){j=console;var V=j.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&A[Symbol.toStringTag]||A.constructor.name||"Object";return V.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),e(A)}}function r(A){if(A===x)return"<>";if(typeof A=="object"&&A!==null&&A.$$typeof===N)return"<...>";try{var j=t(A);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function n(){var A=z.A;return A===null?null:A.getOwner()}function a(){return Error("react-stack-top-frame")}function o(A){if(U.call(A,"key")){var j=Object.getOwnPropertyDescriptor(A,"key").get;if(j&&j.isReactWarning)return!1}return A.key!==void 0}function i(A,j){function V(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}V.isReactWarning=!0,Object.defineProperty(A,"key",{get:V,configurable:!0})}function c(){var A=t(this.type);return Z[A]||(Z[A]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),A=this.props.ref,A!==void 0?A:null}function d(A,j,V,B,W,Q,M,J){return V=Q.ref,A={$$typeof:h,type:A,key:j,props:Q,_owner:W},(V!==void 0?V:null)!==null?Object.defineProperty(A,"ref",{enumerable:!1,get:c}):Object.defineProperty(A,"ref",{enumerable:!1,value:null}),A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(A,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(A,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(A,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A}function u(A,j,V,B,W,Q,M,J){var he=j.children;if(he!==void 0)if(B)if(D(he)){for(B=0;B<he.length;B++)f(he[B]);Object.freeze&&Object.freeze(he)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(he);if(U.call(j,"key")){he=t(A);var ge=Object.keys(j).filter(function(Se){return Se!=="key"});B=0<ge.length?"{key: someKey, "+ge.join(": ..., ")+": ...}":"{key: someKey}",ae[he+B]||(ge=0<ge.length?"{"+ge.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ma;function Tl(){return ma||(ma=1,process.env.NODE_ENV!=="production"&&function(){function e(C){if(C==null)return null;if(typeof C=="function")return C.$$typeof===V?null:C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case x:return"Fragment";case m:return"Profiler";case v:return"StrictMode";case N:return"Suspense";case _:return"SuspenseList";case $:return"Activity"}if(typeof C=="object")switch(typeof C.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),C.$$typeof){case g:return"Portal";case y:return(C.displayName||"Context")+".Provider";case w:return(C._context.displayName||"Context")+".Consumer";case T:var k=C.render;return C=C.displayName,C||(C=k.displayName||k.name||"",C=C!==""?"ForwardRef("+C+")":"ForwardRef"),C;case A:return k=C.displayName||null,k!==null?k:e(C.type)||"Memo";case S:k=C._payload,C=C._init;try{return e(C(k))}catch{}}return null}function t(C){return""+C}function r(C){try{t(C);var k=!1}catch{k=!0}if(k){k=console;var I=k.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&C[Symbol.toStringTag]||C.constructor.name||"Object";return I.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),t(C)}}function s(C){if(C===x)return"<>";if(typeof C=="object"&&C!==null&&C.$$typeof===S)return"<...>";try{var k=e(C);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function n(){var C=z.A;return C===null?null:C.getOwner()}function a(){return Error("react-stack-top-frame")}function i(C){if(q.call(C,"key")){var k=Object.getOwnPropertyDescriptor(C,"key").get;if(k&&k.isReactWarning)return!1}return C.key!==void 0}function l(C,k){function I(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",k))}I.isReactWarning=!0,Object.defineProperty(C,"key",{get:I,configurable:!0})}function c(){var C=e(this.type);return te[C]||(te[C]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),C=this.props.ref,C!==void 0?C:null}function d(C,k,I,U,G,ee,M,W){return I=ee.ref,C={$$typeof:h,type:C,key:k,props:ee,_owner:G},(I!==void 0?I:null)!==null?Object.defineProperty(C,"ref",{enumerable:!1,get:c}):Object.defineProperty(C,"ref",{enumerable:!1,value:null}),C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(C,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(C,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(C,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C}function u(C,k,I,U,G,ee,M,W){var me=k.children;if(me!==void 0)if(U)if(D(me)){for(U=0;U<me.length;U++)f(me[U]);Object.freeze&&Object.freeze(me)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(me);if(q.call(k,"key")){me=e(C);var be=Object.keys(k).filter(function(ke){return ke!=="key"});U=0<be.length?"{key: someKey, "+be.join(": ..., ")+": ...}":"{key: someKey}",le[me+U]||(be=0<be.length?"{"+be.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,B,he,ge,he),ae[he+B]=!0)}if(he=null,V!==void 0&&(s(V),he=""+V),o(j)&&(s(j.key),he=""+j.key),"key"in j){V={};for(var de in j)de!=="key"&&(V[de]=j[de])}else V=j;return he&&i(V,typeof A=="function"?A.displayName||A.name||"Unknown":A),d(A,he,Q,W,n(),V,M,J)}function f(A){typeof A=="object"&&A!==null&&A.$$typeof===h&&A._store&&(A._store.validated=1)}var p=b,h=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),w=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),I=Symbol.for("react.client.reference"),z=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,D=Array.isArray,$=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(A){return A()}};var E,Z={},se=p["react-stack-bottom-frame"].bind(p,a)(),q=$(r(a)),ae={};Ss.Fragment=x,Ss.jsx=function(A,j,V,B,W){var Q=1e4>z.recentlyCreatedOwnerStacks++;return u(A,j,V,!1,B,W,Q?Error("react-stack-top-frame"):se,Q?$(r(A)):q)},Ss.jsxs=function(A,j,V,B,W){var Q=1e4>z.recentlyCreatedOwnerStacks++;return u(A,j,V,!0,B,W,Q?Error("react-stack-top-frame"):se,Q?$(r(A)):q)}}()),Ss}var Aa;function oc(){return Aa||(Aa=1,process.env.NODE_ENV==="production"?nr.exports=nc():nr.exports=ac()),nr.exports}var l=oc();function di(t){var e,s,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(s=di(t[e]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s);return r}function ne(){for(var t,e,s=0,r="",n=arguments.length;s<n;s++)(t=arguments[s])&&(e=di(t))&&(r&&(r+=" "),r+=e);return r}const ic={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-10 h-10",full:"w-full h-full"};function Nt({component:t,size:e="sm",className:s,...r}){return l.jsx(t,{className:ne(ic[e],s),"aria-hidden":r["aria-label"]?void 0:!0,...r})}const lc="inline-flex items-center justify-center box-border font-[var(--font-primary)] font-medium rounded-lg transition focus:outline-none",cc={primary:"bg-[var(--color-ds-button-primary-bg)] text-[var(--color-ds-button-primary-text)] hover:animate-pulse",outline:"bg-transparent text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default)] hover:bg-[var(--color-ds-background-accent)] hover:text-[var(--color-ds-text-on-accent)]",ghost:"bg-transparent text-[var(--color-ds-text-primary)] hover:animate-pulse",subtle:"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:text-[var(--color-ds-text-on-accent)] hover:bg-[var(--color-ds-background-accent)]",danger:"bg-[var(--color-ds-background-danger)] text-[var(--color-ds-text-danger)] hover:brightness-105"},dc={xs:"text-[10px] leading-none h-5 px-1.5",sm:"text-ds-sm h-6 px-2",md:"text-ds-md h-10 px-2.5",lg:"text-ds-lg h-12 px-3"},uc={xs:"h-5 w-5 p-0",sm:"h-6 w-6 p-0",md:"h-10 w-10 p-0",lg:"h-12 w-12 p-0"},fc="disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[var(--color-ds-background-disabled)] disabled:text-[var(--color-ds-text-primary)] disabled:ring-1 disabled:ring-inset disabled:ring-[var(--color-ds-border-muted)]";function le({type:t="button",variant:e="primary",size:s="sm",width:r,disabled:n=!1,icon:a,iconPosition:o="left",ariaLabel:i,children:c,onClick:d,className:u,...f}){const p=!!a,h=p&&!c,g=h?uc[s]:dc[s];return l.jsxs("button",{type:t,onClick:d,disabled:n,"aria-label":h?i:void 0,style:r?{width:r}:void 0,className:ne(lc,cc[e],g,fc,u,p&&c&&"gap-2"),...f,children:[a&&o==="left"&&l.jsx(Nt,{component:a,size:s==="xs"?"sm":s}),c,a&&o==="right"&&l.jsx(Nt,{component:a,size:s==="xs"?"sm":s})]})}function hc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const pc=X.forwardRef(hc);function mc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const gc=X.forwardRef(mc);function bc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const xc=X.forwardRef(bc);function vc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const yc=X.forwardRef(vc);function wc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const jc=X.forwardRef(wc);function kc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const qr=X.forwardRef(kc);function Sc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const Nc=X.forwardRef(Sc);function Cc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const ui=X.forwardRef(Cc);function Ec({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Oc=X.forwardRef(Ec);function Ac({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const Tc=X.forwardRef(Ac);function Fc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"}))}const Rc=X.forwardRef(Fc);function _c({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const Ta=X.forwardRef(_c);function Dc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const $c=X.forwardRef(Dc);function Lc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const fi=X.forwardRef(Lc);function Mc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}const Pc=X.forwardRef(Mc);function Ic({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const hi=X.forwardRef(Ic);function Vc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const zc=X.forwardRef(Vc);function Bc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"}))}const Uc=X.forwardRef(Bc);function Kc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const qc=X.forwardRef(Kc);function Wc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const Jc=X.forwardRef(Wc);function Hc({title:t,titleId:e,...s},r){return X.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},s),t?X.createElement("title",{id:e},t):null,X.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const sa=X.forwardRef(Hc),Gc={default:{wrapper:"box-border w-full rounded-lg bg-[var(--color-ds-background-surface)] overflow-hidden",padX:"px-6",padY:"py-4"},plain:{wrapper:"box-border w-full overflow-hidden",padX:"px-0",padY:"py-2"},soft:{wrapper:"box-border w-full rounded-lg bg-[color-mix(in srgb,var(--color-ds-background-surface) 60%, transparent 40%)] overflow-hidden",padX:"px-4",padY:"py-3"},ghost:{wrapper:"box-border w-full overflow-hidden",padX:"px-6",padY:"py-3"}};function ct({title:t,children:e,defaultOpen:s=!0,className:r,type:n="default",contentClassName:a,headerClassName:o}){const[i,c]=b.useState(s),d=b.useRef(null),[u,f]=b.useState(0),p=()=>{d.current&&f(d.current.scrollHeight)};b.useLayoutEffect(()=>{p()},[i]),b.useEffect(()=>{const g=d.current;if(!g)return;const x=new ResizeObserver(()=>p());return x.observe(g),()=>x.disconnect()},[]);const h=Gc[n];return l.jsxs("div",{className:ne("flex flex-col w-full gap-3",r),children:[l.jsxs("button",{type:"button",onClick:()=>c(g=>!g),"aria-expanded":i,className:ne("flex items-center justify-between w-full transition-colors","hover:bg-[var(--color-ds-surface-hover)]",o),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"block w-1 h-5 bg-[var(--color-ds-background-accent)] rounded-sm"}),l.jsx("span",{className:"font-semibold text-[var(--color-ds-text-primary)]",children:t})]}),i?l.jsx(Oc,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"}):l.jsx(qr,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"})]}),l.jsx("div",{className:h.wrapper,children:l.jsx("div",{className:h.padX,children:l.jsx("div",{className:ne("overflow-hidden transition-all duration-300 ease-in-out",i?"opacity-100":"opacity-0"),style:{maxHeight:i?`${u}px`:"0px"},children:l.jsx("div",{ref:d,className:ne(h.padY,a),children:e})})})})]})}const ra="-",Zc=t=>{const e=Xc(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const i=o.split(ra);return i[0]===""&&i.length!==1&&i.shift(),pi(i,e)||Yc(o)},getConflictingClassGroupIds:(o,i)=>{const c=s[o]||[];return i&&r[o]?[...c,...r[o]]:c}}},pi=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const s=t[0],r=e.nextPart.get(s),n=r?pi(t.slice(1),r):void 0;if(n)return n;if(e.validators.length===0)return;const a=t.join(ra);return(o=e.validators.find(({validator:i})=>i(a)))==null?void 0:o.classGroupId},Fa=/^\[(.+)\]$/,Yc=t=>{if(Fa.test(t)){const e=Fa.exec(t)[1],s=e==null?void 0:e.substring(0,e.indexOf(":"));if(s)return"arbitrary.."+s}},Xc=t=>{const{theme:e,classGroups:s}=t,r={nextPart:new Map,validators:[]};for(const n in s)Rn(s[n],r,n,e);return r},Rn=(t,e,s,r)=>{t.forEach(n=>{if(typeof n=="string"){const a=n===""?e:Ra(e,n);a.classGroupId=s;return}if(typeof n=="function"){if(Qc(n)){Rn(n(r),e,s,r);return}e.validators.push({validator:n,classGroupId:s});return}Object.entries(n).forEach(([a,o])=>{Rn(o,Ra(e,a),s,r)})})},Ra=(t,e)=>{let s=t;return e.split(ra).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},Qc=t=>t.isThemeGetter,ed=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=new Map,r=new Map;const n=(a,o)=>{s.set(a,o),e++,e>t&&(e=0,r=s,s=new Map)};return{get(a){let o=s.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return n(a,o),o},set(a,o){s.has(a)?s.set(a,o):n(a,o)}}},_n="!",Dn=":",td=Dn.length,sd=t=>{const{prefix:e,experimentalParseClassName:s}=t;let r=n=>{const a=[];let o=0,i=0,c=0,d;for(let g=0;g<n.length;g++){let x=n[g];if(o===0&&i===0){if(x===Dn){a.push(n.slice(c,g)),c=g+td;continue}if(x==="/"){d=g;continue}}x==="["?o++:x==="]"?o--:x==="("?i++:x===")"&&i--}const u=a.length===0?n:n.substring(c),f=rd(u),p=f!==u,h=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:h}};if(e){const n=e+Dn,a=r;r=o=>o.startsWith(n)?a(o.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(s){const n=r;r=a=>s({className:a,parseClassName:n})}return r},rd=t=>t.endsWith(_n)?t.substring(0,t.length-1):t.startsWith(_n)?t.substring(1):t,nd=t=>{const e=Object.fromEntries(t.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const n=[];let a=[];return r.forEach(o=>{o[0]==="["||e[o]?(n.push(...a.sort(),o),a=[]):a.push(o)}),n.push(...a.sort()),n}},ad=t=>({cache:ed(t.cacheSize),parseClassName:sd(t),sortModifiers:nd(t),...Zc(t)}),od=/\s+/,id=(t,e)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:a}=e,o=[],i=t.trim().split(od);let c="";for(let d=i.length-1;d>=0;d-=1){const u=i[d],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:x}=s(u);if(f){c=u+(c.length>0?" "+c:c);continue}let v=!!x,m=r(v?g.substring(0,x):g);if(!m){if(!v){c=u+(c.length>0?" "+c:c);continue}if(m=r(g),!m){c=u+(c.length>0?" "+c:c);continue}v=!1}const y=a(p).join(":"),w=h?y+_n:y,O=w+m;if(o.includes(O))continue;o.push(O);const S=n(m,v);for(let T=0;T<S.length;++T){const C=S[T];o.push(w+C)}c=u+(c.length>0?" "+c:c)}return c};function ld(){let t=0,e,s,r="";for(;t<arguments.length;)(e=arguments[t++])&&(s=mi(e))&&(r&&(r+=" "),r+=s);return r}const mi=t=>{if(typeof t=="string")return t;let e,s="";for(let r=0;r<t.length;r++)t[r]&&(e=mi(t[r]))&&(s&&(s+=" "),s+=e);return s};function cd(t,...e){let s,r,n,a=o;function o(c){const d=e.reduce((u,f)=>f(u),t());return s=ad(d),r=s.cache.get,n=s.cache.set,a=i,i(c)}function i(c){const d=r(c);if(d)return d;const u=id(c,s);return n(c,u),u}return function(){return a(ld.apply(null,arguments))}}const ze=t=>{const e=s=>s[t]||[];return e.isThemeGetter=!0,e},gi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bi=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dd=/^\d+\/\d+$/,ud=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fd=/\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$/,hd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,md=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,is=t=>dd.test(t),ye=t=>!!t&&!Number.isNaN(Number(t)),It=t=>!!t&&Number.isInteger(Number(t)),an=t=>t.endsWith("%")&&ye(t.slice(0,-1)),Ot=t=>ud.test(t),gd=()=>!0,bd=t=>fd.test(t)&&!hd.test(t),xi=()=>!1,xd=t=>pd.test(t),vd=t=>md.test(t),yd=t=>!oe(t)&&!ie(t),wd=t=>xs(t,wi,xi),oe=t=>gi.test(t),Gt=t=>xs(t,ji,bd),on=t=>xs(t,Cd,ye),_a=t=>xs(t,vi,xi),jd=t=>xs(t,yi,vd),ar=t=>xs(t,ki,xd),ie=t=>bi.test(t),Ns=t=>vs(t,ji),kd=t=>vs(t,Ed),Da=t=>vs(t,vi),Sd=t=>vs(t,wi),Nd=t=>vs(t,yi),or=t=>vs(t,ki,!0),xs=(t,e,s)=>{const r=gi.exec(t);return r?r[1]?e(r[1]):s(r[2]):!1},vs=(t,e,s=!1)=>{const r=bi.exec(t);return r?r[1]?e(r[1]):s:!1},vi=t=>t==="position"||t==="percentage",yi=t=>t==="image"||t==="url",wi=t=>t==="length"||t==="size"||t==="bg-size",ji=t=>t==="length",Cd=t=>t==="number",Ed=t=>t==="family-name",ki=t=>t==="shadow",Od=()=>{const t=ze("color"),e=ze("font"),s=ze("text"),r=ze("font-weight"),n=ze("tracking"),a=ze("leading"),o=ze("breakpoint"),i=ze("container"),c=ze("spacing"),d=ze("radius"),u=ze("shadow"),f=ze("inset-shadow"),p=ze("text-shadow"),h=ze("drop-shadow"),g=ze("blur"),x=ze("perspective"),v=ze("aspect"),m=ze("ease"),y=ze("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...O(),ie,oe],T=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],N=()=>[ie,oe,c],_=()=>[is,"full","auto",...N()],I=()=>[It,"none","subgrid",ie,oe],z=()=>["auto",{span:["full",It,ie,oe]},It,ie,oe],U=()=>[It,"auto",ie,oe],D=()=>["auto","min","max","fr",ie,oe],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...N()],se=()=>[is,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],q=()=>[t,ie,oe],ae=()=>[...O(),Da,_a,{position:[ie,oe]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",Sd,wd,{size:[ie,oe]}],V=()=>[an,Ns,Gt],B=()=>["","none","full",d,ie,oe],W=()=>["",ye,Ns,Gt],Q=()=>["solid","dashed","dotted","double"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[ye,an,Da,_a],he=()=>["","none",g,ie,oe],ge=()=>["none",ye,ie,oe],de=()=>["none",ye,ie,oe],Se=()=>[ye,ie,oe],be=()=>[is,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ot],breakpoint:[Ot],color:[gd],container:[Ot],"drop-shadow":[Ot],ease:["in","out","in-out"],font:[yd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ot],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ot],shadow:[Ot],spacing:["px",ye],text:[Ot],"text-shadow":[Ot],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",is,oe,ie,v]}],container:["container"],columns:[{columns:[ye,oe,ie,i]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[It,"auto",ie,oe]}],basis:[{basis:[is,"full","auto",i,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ye,is,"auto","initial","none",oe]}],grow:[{grow:["",ye,ie,oe]}],shrink:[{shrink:["",ye,ie,oe]}],order:[{order:[It,"first","last","none",ie,oe]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:se()}],w:[{w:[i,"screen",...se()]}],"min-w":[{"min-w":[i,"screen","none",...se()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...se()]}],h:[{h:["screen","lh",...se()]}],"min-h":[{"min-h":["screen","lh","none",...se()]}],"max-h":[{"max-h":["screen","lh",...se()]}],"font-size":[{text:["base",s,Ns,Gt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ie,on]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",an,oe]}],"font-family":[{font:[kd,oe,e]}],"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:[n,ie,oe]}],"line-clamp":[{"line-clamp":[ye,"none",ie,on]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",ie,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ie,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[ye,"from-font","auto",ie,Gt]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[ye,"auto",ie,oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ie,oe]}],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",ie,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},It,ie,oe],radial:["",ie,oe],conic:[It,ie,oe]},Nd,jd]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ye,ie,oe]}],"outline-w":[{outline:["",ye,Ns,Gt]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",u,or,ar]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",f,or,ar]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[ye,Gt]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,or,ar]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[ye,ie,oe]}],"mix-blend":[{"mix-blend":[...M(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":M()}],"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":[ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ie,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"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":O()}],"mask-image-conic-pos":[{"mask-conic":[ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:A()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ie,oe]}],filter:[{filter:["","none",ie,oe]}],blur:[{blur:he()}],brightness:[{brightness:[ye,ie,oe]}],contrast:[{contrast:[ye,ie,oe]}],"drop-shadow":[{"drop-shadow":["","none",h,or,ar]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",ye,ie,oe]}],"hue-rotate":[{"hue-rotate":[ye,ie,oe]}],invert:[{invert:["",ye,ie,oe]}],saturate:[{saturate:[ye,ie,oe]}],sepia:[{sepia:["",ye,ie,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",ie,oe]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ye,ie,oe]}],"backdrop-contrast":[{"backdrop-contrast":[ye,ie,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ye,ie,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ye,ie,oe]}],"backdrop-invert":[{"backdrop-invert":["",ye,ie,oe]}],"backdrop-opacity":[{"backdrop-opacity":[ye,ie,oe]}],"backdrop-saturate":[{"backdrop-saturate":[ye,ie,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",ye,ie,oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ie,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ye,"initial",ie,oe]}],ease:[{ease:["linear","initial",m,ie,oe]}],delay:[{delay:[ye,ie,oe]}],animate:[{animate:["none",y,ie,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ie,oe]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[ie,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"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",ie,oe]}],"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":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",ie,oe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[ye,Ns,Gt,on]}],stroke:[{stroke:["none",...q()]}],"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"]}},Ad=cd(Od);var qs=t=>t.type==="checkbox",Xt=t=>t instanceof Date,Ye=t=>t==null;const Si=t=>typeof t=="object";var Le=t=>!Ye(t)&&!Array.isArray(t)&&Si(t)&&!Xt(t),Ni=t=>Le(t)&&t.target?qs(t.target)?t.target.checked:t.target.value:t,Td=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Ci=(t,e)=>t.has(Td(e)),Fd=t=>{const e=t.constructor&&t.constructor.prototype;return Le(e)&&e.hasOwnProperty("isPrototypeOf")},na=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function We(t){let e;const s=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(na&&(t instanceof Blob||r))&&(s||Le(t)))if(e=s?[]:{},!s&&!Fd(t))e=t;else for(const n in t)t.hasOwnProperty(n)&&(e[n]=We(t[n]));else return t;return e}var Wr=t=>Array.isArray(t)?t.filter(Boolean):[],$e=t=>t===void 0,re=(t,e,s)=>{if(!e||!Le(t))return s;const r=Wr(e.split(/[,[\].]+?/)).reduce((n,a)=>Ye(n)?n:n[a],t);return $e(r)||r===t?$e(t[e])?s:t[e]:r},dt=t=>typeof t=="boolean",aa=t=>/^\w*$/.test(t),Ei=t=>Wr(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Oe=(t,e,s)=>{let r=-1;const n=aa(e)?[e]:Ei(e),a=n.length,o=a-1;for(;++r<a;){const i=n[r];let c=s;if(r!==o){const d=t[i];c=Le(d)||Array.isArray(d)?d:isNaN(+n[r+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;t[i]=c,t=t[i]}};const Cr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},At={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Oi=b.createContext(null),Ws=()=>b.useContext(Oi),Rd=t=>{const{children:e,...s}=t;return b.createElement(Oi.Provider,{value:s},e)};var Ai=(t,e,s,r=!0)=>{const n={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(n,a,{get:()=>{const o=a;return e._proxyFormState[o]!==gt.all&&(e._proxyFormState[o]=!r||gt.all),s&&(s[o]=!0),t[o]}});return n};const oa=typeof window<"u"?X.useLayoutEffect:X.useEffect;function _d(t){const e=Ws(),{control:s=e.control,disabled:r,name:n,exact:a}=t||{},[o,i]=b.useState(s._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return oa(()=>s._subscribe({name:n,formState:c.current,exact:a,callback:d=>{!r&&i({...s._formState,...d})}}),[n,r,a]),b.useEffect(()=>{c.current.isValid&&s._setValid(!0)},[s]),b.useMemo(()=>Ai(o,s,c.current,!1),[o,s])}var Ct=t=>typeof t=="string",Ti=(t,e,s,r,n)=>Ct(t)?(r&&e.watch.add(t),re(s,t,n)):Array.isArray(t)?t.map(a=>(r&&e.watch.add(a),re(s,a))):(r&&(e.watchAll=!0),s);function ia(t){const e=Ws(),{control:s=e.control,name:r,defaultValue:n,disabled:a,exact:o}=t||{},i=b.useRef(n),[c,d]=b.useState(s._getWatch(r,i.current));return oa(()=>s._subscribe({name:r,formState:{values:!0},exact:o,callback:u=>!a&&d(Ti(r,s._names,u.values||s._formValues,!1,i.current))}),[r,s,a,o]),b.useEffect(()=>s._removeUnmounted()),c}function Fi(t){const e=Ws(),{name:s,disabled:r,control:n=e.control,shouldUnregister:a}=t,o=Ci(n._names.array,s),i=ia({control:n,name:s,defaultValue:re(n._formValues,s,re(n._defaultValues,s,t.defaultValue)),exact:!0}),c=_d({control:n,name:s,exact:!0}),d=b.useRef(t),u=b.useRef(n.register(s,{...t.rules,value:i,...dt(t.disabled)?{disabled:t.disabled}:{}})),f=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!re(c.errors,s)},isDirty:{enumerable:!0,get:()=>!!re(c.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!re(c.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!re(c.validatingFields,s)},error:{enumerable:!0,get:()=>re(c.errors,s)}}),[c,s]),p=b.useCallback(v=>u.current.onChange({target:{value:Ni(v),name:s},type:Cr.CHANGE}),[s]),h=b.useCallback(()=>u.current.onBlur({target:{value:re(n._formValues,s),name:s},type:Cr.BLUR}),[s,n._formValues]),g=b.useCallback(v=>{const m=re(n._fields,s);m&&v&&(m._f.ref={focus:()=>v.focus(),select:()=>v.select(),setCustomValidity:y=>v.setCustomValidity(y),reportValidity:()=>v.reportValidity()})},[n._fields,s]),x=b.useMemo(()=>({name:s,value:i,...dt(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:p,onBlur:h,ref:g}),[s,r,c.disabled,p,h,g,i]);return b.useEffect(()=>{const v=n._options.shouldUnregister||a;n.register(s,{...d.current.rules,...dt(d.current.disabled)?{disabled:d.current.disabled}:{}});const m=(y,w)=>{const O=re(n._fields,y);O&&O._f&&(O._f.mount=w)};if(m(s,!0),v){const y=We(re(n._options.defaultValues,s));Oe(n._defaultValues,s,y),$e(re(n._formValues,s))&&Oe(n._formValues,s,y)}return!o&&n.register(s),()=>{(o?v&&!n._state.action:v)?n.unregister(s):m(s,!1)}},[s,n,o,a]),b.useEffect(()=>{n._setDisabledField({disabled:r,name:s})},[r,s,n]),b.useMemo(()=>({field:x,formState:c,fieldState:f}),[x,c,f])}const vt=t=>t.render(Fi(t));var Ri=(t,e,s,r,n)=>e?{...s[t],types:{...s[t]&&s[t].types?s[t].types:{},[r]:n||!0}}:{},Fs=t=>Array.isArray(t)?t:[t],$a=()=>{let t=[];return{get observers(){return t},next:n=>{for(const a of t)a.next&&a.next(n)},subscribe:n=>(t.push(n),{unsubscribe:()=>{t=t.filter(a=>a!==n)}}),unsubscribe:()=>{t=[]}}},$n=t=>Ye(t)||!Si(t);function Ut(t,e){if($n(t)||$n(e))return t===e;if(Xt(t)&&Xt(e))return t.getTime()===e.getTime();const s=Object.keys(t),r=Object.keys(e);if(s.length!==r.length)return!1;for(const n of s){const a=t[n];if(!r.includes(n))return!1;if(n!=="ref"){const o=e[n];if(Xt(a)&&Xt(o)||Le(a)&&Le(o)||Array.isArray(a)&&Array.isArray(o)?!Ut(a,o):a!==o)return!1}}return!0}var Ze=t=>Le(t)&&!Object.keys(t).length,la=t=>t.type==="file",bt=t=>typeof t=="function",Er=t=>{if(!na)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},_i=t=>t.type==="select-multiple",ca=t=>t.type==="radio",Dd=t=>ca(t)||qs(t),ln=t=>Er(t)&&t.isConnected;function $d(t,e){const s=e.slice(0,-1).length;let r=0;for(;r<s;)t=$e(t)?r++:t[e[r++]];return t}function Ld(t){for(const e in t)if(t.hasOwnProperty(e)&&!$e(t[e]))return!1;return!0}function Be(t,e){const s=Array.isArray(e)?e:aa(e)?[e]:Ei(e),r=s.length===1?t:$d(t,s),n=s.length-1,a=s[n];return r&&delete r[a],n!==0&&(Le(r)&&Ze(r)||Array.isArray(r)&&Ld(r))&&Be(t,s.slice(0,-1)),t}var Di=t=>{for(const e in t)if(bt(t[e]))return!0;return!1};function Or(t,e={}){const s=Array.isArray(t);if(Le(t)||s)for(const r in t)Array.isArray(t[r])||Le(t[r])&&!Di(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Or(t[r],e[r])):Ye(t[r])||(e[r]=!0);return e}function $i(t,e,s){const r=Array.isArray(t);if(Le(t)||r)for(const n in t)Array.isArray(t[n])||Le(t[n])&&!Di(t[n])?$e(e)||$n(s[n])?s[n]=Array.isArray(t[n])?Or(t[n],[]):{...Or(t[n])}:$i(t[n],Ye(e)?{}:e[n],s[n]):s[n]=!Ut(t[n],e[n]);return s}var Cs=(t,e)=>$i(t,e,Or(e));const La={value:!1,isValid:!1},Ma={value:!0,isValid:!0};var Li=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!$e(t[0].attributes.value)?$e(t[0].value)||t[0].value===""?Ma:{value:t[0].value,isValid:!0}:Ma:La}return La},Mi=(t,{valueAsNumber:e,valueAsDate:s,setValueAs:r})=>$e(t)?t:e?t===""?NaN:t&&+t:s&&Ct(t)?new Date(t):r?r(t):t;const Pa={isValid:!1,value:null};var Pi=t=>Array.isArray(t)?t.reduce((e,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:e,Pa):Pa;function Ia(t){const e=t.ref;return la(e)?e.files:ca(e)?Pi(t.refs).value:_i(e)?[...e.selectedOptions].map(({value:s})=>s):qs(e)?Li(t.refs).value:Mi($e(e.value)?t.ref.value:e.value,t)}var Md=(t,e,s,r)=>{const n={};for(const a of t){const o=re(e,a);o&&Oe(n,a,o._f)}return{criteriaMode:s,names:[...t],fields:n,shouldUseNativeValidation:r}},Ar=t=>t instanceof RegExp,Es=t=>$e(t)?t:Ar(t)?t.source:Le(t)?Ar(t.value)?t.value.source:t.value:t,Va=t=>({isOnSubmit:!t||t===gt.onSubmit,isOnBlur:t===gt.onBlur,isOnChange:t===gt.onChange,isOnAll:t===gt.all,isOnTouch:t===gt.onTouched});const za="AsyncFunction";var Pd=t=>!!t&&!!t.validate&&!!(bt(t.validate)&&t.validate.constructor.name===za||Le(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===za)),Id=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Ba=(t,e,s)=>!s&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const Rs=(t,e,s,r)=>{for(const n of s||Object.keys(t)){const a=re(t,n);if(a){const{_f:o,...i}=a;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],n)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Rs(i,e))break}else if(Le(i)&&Rs(i,e))break}}};function Ua(t,e,s){const r=re(t,s);if(r||aa(s))return{error:r,name:s};const n=s.split(".");for(;n.length;){const a=n.join("."),o=re(e,a),i=re(t,a);if(o&&!Array.isArray(o)&&s!==a)return{name:s};if(i&&i.type)return{name:a,error:i};n.pop()}return{name:s}}var Vd=(t,e,s,r)=>{s(t);const{name:n,...a}=t;return Ze(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(o=>e[o]===(!r||gt.all))},zd=(t,e,s)=>!t||!e||t===e||Fs(t).some(r=>r&&(s?r===e:r.startsWith(e)||e.startsWith(r))),Bd=(t,e,s,r,n)=>n.isOnAll?!1:!s&&n.isOnTouch?!(e||t):(s?r.isOnBlur:n.isOnBlur)?!t:(s?r.isOnChange:n.isOnChange)?t:!0,Ud=(t,e)=>!Wr(re(t,e)).length&&Be(t,e),Kd=(t,e,s)=>{const r=Fs(re(t,s));return Oe(r,"root",e[s]),Oe(t,s,r),t},wr=t=>Ct(t);function Ka(t,e,s="validate"){if(wr(t)||Array.isArray(t)&&t.every(wr)||dt(t)&&!t)return{type:s,message:wr(t)?t:"",ref:e}}var ls=t=>Le(t)&&!Ar(t)?t:{value:t,message:""},qa=async(t,e,s,r,n,a)=>{const{ref:o,refs:i,required:c,maxLength:d,minLength:u,min:f,max:p,pattern:h,validate:g,name:x,valueAsNumber:v,mount:m}=t._f,y=re(s,x);if(!m||e.has(x))return{};const w=i?i[0]:o,O=U=>{n&&w.reportValidity&&(w.setCustomValidity(dt(U)?"":U||""),w.reportValidity())},S={},T=ca(o),C=qs(o),N=T||C,_=(v||la(o))&&$e(o.value)&&$e(y)||Er(o)&&o.value===""||y===""||Array.isArray(y)&&!y.length,I=Ri.bind(null,x,r,S),z=(U,D,$,E=At.maxLength,Z=At.minLength)=>{const se=U?D:$;S[x]={type:U?E:Z,message:se,ref:o,...I(U?E:Z,se)}};if(a?!Array.isArray(y)||!y.length:c&&(!N&&(_||Ye(y))||dt(y)&&!y||C&&!Li(i).isValid||T&&!Pi(i).isValid)){const{value:U,message:D}=wr(c)?{value:!!c,message:c}:ls(c);if(U&&(S[x]={type:At.required,message:D,ref:w,...I(At.required,D)},!r))return O(D),S}if(!_&&(!Ye(f)||!Ye(p))){let U,D;const $=ls(p),E=ls(f);if(!Ye(y)&&!isNaN(y)){const Z=o.valueAsNumber||y&&+y;Ye($.value)||(U=Z>$.value),Ye(E.value)||(D=Z<E.value)}else{const Z=o.valueAsDate||new Date(y),se=A=>new Date(new Date().toDateString()+" "+A),q=o.type=="time",ae=o.type=="week";Ct($.value)&&y&&(U=q?se(y)>se($.value):ae?y>$.value:Z>new Date($.value)),Ct(E.value)&&y&&(D=q?se(y)<se(E.value):ae?y<E.value:Z<new Date(E.value))}if((U||D)&&(z(!!U,$.message,E.message,At.max,At.min),!r))return O(S[x].message),S}if((d||u)&&!_&&(Ct(y)||a&&Array.isArray(y))){const U=ls(d),D=ls(u),$=!Ye(U.value)&&y.length>+U.value,E=!Ye(D.value)&&y.length<+D.value;if(($||E)&&(z($,U.message,D.message),!r))return O(S[x].message),S}if(h&&!_&&Ct(y)){const{value:U,message:D}=ls(h);if(Ar(U)&&!y.match(U)&&(S[x]={type:At.pattern,message:D,ref:o,...I(At.pattern,D)},!r))return O(D),S}if(g){if(bt(g)){const U=await g(y,s),D=Ka(U,w);if(D&&(S[x]={...D,...I(At.validate,D.message)},!r))return O(D.message),S}else if(Le(g)){let U={};for(const D in g){if(!Ze(U)&&!r)break;const $=Ka(await g[D](y,s),w,D);$&&(U={...$,...I(D,$.message)},O($.message),r&&(S[x]=U))}if(!Ze(U)&&(S[x]={ref:w,...U},!r))return S}}return O(!0),S};const qd={mode:gt.onSubmit,reValidateMode:gt.onChange,shouldFocusError:!0};function Wd(t={}){let e={...qd,...t},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:bt(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const r={};let n=Le(e.defaultValues)||Le(e.values)?We(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:We(n),o={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const p={array:$a(),state:$a()},h=e.criteriaMode===gt.all,g=k=>F=>{clearTimeout(d),d=setTimeout(k,F)},x=async k=>{if(!e.disabled&&(u.isValid||f.isValid||k)){const F=e.resolver?Ze((await C()).errors):await _(r,!0);F!==s.isValid&&p.state.next({isValid:F})}},v=(k,F)=>{!e.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(i.mount)).forEach(L=>{L&&(F?Oe(s.validatingFields,L,F):Be(s.validatingFields,L))}),p.state.next({validatingFields:s.validatingFields,isValidating:!Ze(s.validatingFields)}))},m=(k,F=[],L,ee,Y=!0,G=!0)=>{if(ee&&L&&!e.disabled){if(o.action=!0,G&&Array.isArray(re(r,k))){const ue=L(re(r,k),ee.argA,ee.argB);Y&&Oe(r,k,ue)}if(G&&Array.isArray(re(s.errors,k))){const ue=L(re(s.errors,k),ee.argA,ee.argB);Y&&Oe(s.errors,k,ue),Ud(s.errors,k)}if((u.touchedFields||f.touchedFields)&&G&&Array.isArray(re(s.touchedFields,k))){const ue=L(re(s.touchedFields,k),ee.argA,ee.argB);Y&&Oe(s.touchedFields,k,ue)}(u.dirtyFields||f.dirtyFields)&&(s.dirtyFields=Cs(n,a)),p.state.next({name:k,isDirty:z(k,F),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else Oe(a,k,F)},y=(k,F)=>{Oe(s.errors,k,F),p.state.next({errors:s.errors})},w=k=>{s.errors=k,p.state.next({errors:s.errors,isValid:!1})},O=(k,F,L,ee)=>{const Y=re(r,k);if(Y){const G=re(a,k,$e(L)?re(n,k):L);$e(G)||ee&&ee.defaultChecked||F?Oe(a,k,F?G:Ia(Y._f)):$(k,G),o.mount&&x()}},S=(k,F,L,ee,Y)=>{let G=!1,ue=!1;const ve={name:k};if(!e.disabled){if(!L||ee){(u.isDirty||f.isDirty)&&(ue=s.isDirty,s.isDirty=ve.isDirty=z(),G=ue!==ve.isDirty);const ke=Ut(re(n,k),F);ue=!!re(s.dirtyFields,k),ke?Be(s.dirtyFields,k):Oe(s.dirtyFields,k,!0),ve.dirtyFields=s.dirtyFields,G=G||(u.dirtyFields||f.dirtyFields)&&ue!==!ke}if(L){const ke=re(s.touchedFields,k);ke||(Oe(s.touchedFields,k,L),ve.touchedFields=s.touchedFields,G=G||(u.touchedFields||f.touchedFields)&&ke!==L)}G&&Y&&p.state.next(ve)}return G?ve:{}},T=(k,F,L,ee)=>{const Y=re(s.errors,k),G=(u.isValid||f.isValid)&&dt(F)&&s.isValid!==F;if(e.delayError&&L?(c=g(()=>y(k,L)),c(e.delayError)):(clearTimeout(d),c=null,L?Oe(s.errors,k,L):Be(s.errors,k)),(L?!Ut(Y,L):Y)||!Ze(ee)||G){const ue={...ee,...G&&dt(F)?{isValid:F}:{},errors:s.errors,name:k};s={...s,...ue},p.state.next(ue)}},C=async k=>{v(k,!0);const F=await e.resolver(a,e.context,Md(k||i.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return v(k),F},N=async k=>{const{errors:F}=await C(k);if(k)for(const L of k){const ee=re(F,L);ee?Oe(s.errors,L,ee):Be(s.errors,L)}else s.errors=F;return F},_=async(k,F,L={valid:!0})=>{for(const ee in k){const Y=k[ee];if(Y){const{_f:G,...ue}=Y;if(G){const ve=i.array.has(G.name),ke=Y._f&&Pd(Y._f);ke&&u.validatingFields&&v([ee],!0);const _e=await qa(Y,i.disabled,a,h,e.shouldUseNativeValidation&&!F,ve);if(ke&&u.validatingFields&&v([ee]),_e[G.name]&&(L.valid=!1,F))break;!F&&(re(_e,G.name)?ve?Kd(s.errors,_e,G.name):Oe(s.errors,G.name,_e[G.name]):Be(s.errors,G.name))}!Ze(ue)&&await _(ue,F,L)}}return L.valid},I=()=>{for(const k of i.unMount){const F=re(r,k);F&&(F._f.refs?F._f.refs.every(L=>!ln(L)):!ln(F._f.ref))&&J(k)}i.unMount=new Set},z=(k,F)=>!e.disabled&&(k&&F&&Oe(a,k,F),!Ut(A(),n)),U=(k,F,L)=>Ti(k,i,{...o.mount?a:$e(F)?n:Ct(k)?{[k]:F}:F},L,F),D=k=>Wr(re(o.mount?a:n,k,e.shouldUnregister?re(n,k,[]):[])),$=(k,F,L={})=>{const ee=re(r,k);let Y=F;if(ee){const G=ee._f;G&&(!G.disabled&&Oe(a,k,Mi(F,G)),Y=Er(G.ref)&&Ye(F)?"":F,_i(G.ref)?[...G.ref.options].forEach(ue=>ue.selected=Y.includes(ue.value)):G.refs?qs(G.ref)?G.refs.forEach(ue=>{(!ue.defaultChecked||!ue.disabled)&&(Array.isArray(Y)?ue.checked=!!Y.find(ve=>ve===ue.value):ue.checked=Y===ue.value||!!Y)}):G.refs.forEach(ue=>ue.checked=ue.value===Y):la(G.ref)?G.ref.value="":(G.ref.value=Y,G.ref.type||p.state.next({name:k,values:We(a)})))}(L.shouldDirty||L.shouldTouch)&&S(k,Y,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&ae(k)},E=(k,F,L)=>{for(const ee in F){if(!F.hasOwnProperty(ee))return;const Y=F[ee],G=`${k}.${ee}`,ue=re(r,G);(i.array.has(k)||Le(Y)||ue&&!ue._f)&&!Xt(Y)?E(G,Y,L):$(G,Y,L)}},Z=(k,F,L={})=>{const ee=re(r,k),Y=i.array.has(k),G=We(F);Oe(a,k,G),Y?(p.array.next({name:k,values:We(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&L.shouldDirty&&p.state.next({name:k,dirtyFields:Cs(n,a),isDirty:z(k,G)})):ee&&!ee._f&&!Ye(G)?E(k,G,L):$(k,G,L),Ba(k,i)&&p.state.next({...s}),p.state.next({name:o.mount?k:void 0,values:We(a)})},se=async k=>{o.mount=!0;const F=k.target;let L=F.name,ee=!0;const Y=re(r,L),G=ke=>{ee=Number.isNaN(ke)||Xt(ke)&&isNaN(ke.getTime())||Ut(ke,re(a,L,ke))},ue=Va(e.mode),ve=Va(e.reValidateMode);if(Y){let ke,_e;const wt=F.type?Ia(Y._f):Ni(k),Me=k.type===Cr.BLUR||k.type===Cr.FOCUS_OUT,Kt=!Id(Y._f)&&!e.resolver&&!re(s.errors,L)&&!Y._f.deps||Bd(Me,re(s.touchedFields,L),s.isSubmitted,ve,ue),Dt=Ba(L,i,Me);Oe(a,L,wt),Me?(Y._f.onBlur&&Y._f.onBlur(k),c&&c(0)):Y._f.onChange&&Y._f.onChange(k);const $t=S(L,wt,Me),Lt=!Ze($t)||Dt;if(!Me&&p.state.next({name:L,type:k.type,values:We(a)}),Kt)return(u.isValid||f.isValid)&&(e.mode==="onBlur"?Me&&x():Me||x()),Lt&&p.state.next({name:L,...Dt?{}:$t});if(!Me&&Dt&&p.state.next({...s}),e.resolver){const{errors:Mt}=await C([L]);if(G(wt),ee){const as=Ua(s.errors,r,L),Pt=Ua(Mt,r,as.name||L);ke=Pt.error,L=Pt.name,_e=Ze(Mt)}}else v([L],!0),ke=(await qa(Y,i.disabled,a,h,e.shouldUseNativeValidation))[L],v([L]),G(wt),ee&&(ke?_e=!1:(u.isValid||f.isValid)&&(_e=await _(r,!0)));ee&&(Y._f.deps&&ae(Y._f.deps),T(L,_e,ke,$t))}},q=(k,F)=>{if(re(s.errors,F)&&k.focus)return k.focus(),1},ae=async(k,F={})=>{let L,ee;const Y=Fs(k);if(e.resolver){const G=await N($e(k)?k:Y);L=Ze(G),ee=k?!Y.some(ue=>re(G,ue)):L}else k?(ee=(await Promise.all(Y.map(async G=>{const ue=re(r,G);return await _(ue&&ue._f?{[G]:ue}:ue)}))).every(Boolean),!(!ee&&!s.isValid)&&x()):ee=L=await _(r);return p.state.next({...!Ct(k)||(u.isValid||f.isValid)&&L!==s.isValid?{}:{name:k},...e.resolver||!k?{isValid:L}:{},errors:s.errors}),F.shouldFocus&&!ee&&Rs(r,q,k?Y:i.mount),ee},A=k=>{const F={...o.mount?a:n};return $e(k)?F:Ct(k)?re(F,k):k.map(L=>re(F,L))},j=(k,F)=>({invalid:!!re((F||s).errors,k),isDirty:!!re((F||s).dirtyFields,k),error:re((F||s).errors,k),isValidating:!!re(s.validatingFields,k),isTouched:!!re((F||s).touchedFields,k)}),V=k=>{k&&Fs(k).forEach(F=>Be(s.errors,F)),p.state.next({errors:k?s.errors:{}})},B=(k,F,L)=>{const ee=(re(r,k,{_f:{}})._f||{}).ref,Y=re(s.errors,k)||{},{ref:G,message:ue,type:ve,...ke}=Y;Oe(s.errors,k,{...ke,...F,ref:ee}),p.state.next({name:k,errors:s.errors,isValid:!1}),L&&L.shouldFocus&&ee&&ee.focus&&ee.focus()},W=(k,F)=>bt(k)?p.state.subscribe({next:L=>k(U(void 0,F),L)}):U(k,F,!0),Q=k=>p.state.subscribe({next:F=>{zd(k.name,F.name,k.exact)&&Vd(F,k.formState||u,ce,k.reRenderRoot)&&k.callback({values:{...a},...s,...F})}}).unsubscribe,M=k=>(o.mount=!0,f={...f,...k.formState},Q({...k,formState:f})),J=(k,F={})=>{for(const L of k?Fs(k):i.mount)i.mount.delete(L),i.array.delete(L),F.keepValue||(Be(r,L),Be(a,L)),!F.keepError&&Be(s.errors,L),!F.keepDirty&&Be(s.dirtyFields,L),!F.keepTouched&&Be(s.touchedFields,L),!F.keepIsValidating&&Be(s.validatingFields,L),!e.shouldUnregister&&!F.keepDefaultValue&&Be(n,L);p.state.next({values:We(a)}),p.state.next({...s,...F.keepDirty?{isDirty:z()}:{}}),!F.keepIsValid&&x()},he=({disabled:k,name:F})=>{(dt(k)&&o.mount||k||i.disabled.has(F))&&(k?i.disabled.add(F):i.disabled.delete(F))},ge=(k,F={})=>{let L=re(r,k);const ee=dt(F.disabled)||dt(e.disabled);return Oe(r,k,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:k}},name:k,mount:!0,...F}}),i.mount.add(k),L?he({disabled:dt(F.disabled)?F.disabled:e.disabled,name:k}):O(k,!0,F.value),{...ee?{disabled:F.disabled||e.disabled}:{},...e.progressive?{required:!!F.required,min:Es(F.min),max:Es(F.max),minLength:Es(F.minLength),maxLength:Es(F.maxLength),pattern:Es(F.pattern)}:{},name:k,onChange:se,onBlur:se,ref:Y=>{if(Y){ge(k,F),L=re(r,k);const G=$e(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ue=Dd(G),ve=L._f.refs||[];if(ue?ve.find(ke=>ke===G):G===L._f.ref)return;Oe(r,k,{_f:{...L._f,...ue?{refs:[...ve.filter(ln),G,...Array.isArray(re(n,k))?[{}]:[]],ref:{type:G.type,name:k}}:{ref:G}}}),O(k,!1,void 0,G)}else L=re(r,k,{}),L._f&&(L._f.mount=!1),(e.shouldUnregister||F.shouldUnregister)&&!(Ci(i.array,k)&&o.action)&&i.unMount.add(k)}}},de=()=>e.shouldFocusError&&Rs(r,q,i.mount),Se=k=>{dt(k)&&(p.state.next({disabled:k}),Rs(r,(F,L)=>{const ee=re(r,L);ee&&(F.disabled=ee._f.disabled||k,Array.isArray(ee._f.refs)&&ee._f.refs.forEach(Y=>{Y.disabled=ee._f.disabled||k}))},0,!1))},be=(k,F)=>async L=>{let ee;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let Y=We(a);if(p.state.next({isSubmitting:!0}),e.resolver){const{errors:G,values:ue}=await C();s.errors=G,Y=ue}else await _(r);if(i.disabled.size)for(const G of i.disabled)Oe(Y,G,void 0);if(Be(s.errors,"root"),Ze(s.errors)){p.state.next({errors:{}});try{await k(Y,L)}catch(G){ee=G}}else F&&await F({...s.errors},L),de(),setTimeout(de);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ze(s.errors)&&!ee,submitCount:s.submitCount+1,errors:s.errors}),ee)throw ee},pe=(k,F={})=>{re(r,k)&&($e(F.defaultValue)?Z(k,We(re(n,k))):(Z(k,F.defaultValue),Oe(n,k,We(F.defaultValue))),F.keepTouched||Be(s.touchedFields,k),F.keepDirty||(Be(s.dirtyFields,k),s.isDirty=F.defaultValue?z(k,We(re(n,k))):z()),F.keepError||(Be(s.errors,k),u.isValid&&x()),p.state.next({...s}))},fe=(k,F={})=>{const L=k?We(k):n,ee=We(L),Y=Ze(k),G=Y?n:ee;if(F.keepDefaultValues||(n=L),!F.keepValues){if(F.keepDirtyValues){const ue=new Set([...i.mount,...Object.keys(Cs(n,a))]);for(const ve of Array.from(ue))re(s.dirtyFields,ve)?Oe(G,ve,re(a,ve)):Z(ve,re(G,ve))}else{if(na&&$e(k))for(const ue of i.mount){const ve=re(r,ue);if(ve&&ve._f){const ke=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(Er(ke)){const _e=ke.closest("form");if(_e){_e.reset();break}}}}for(const ue of i.mount)Z(ue,re(G,ue))}a=We(G),p.array.next({values:{...G}}),p.state.next({values:{...G}})}i={mount:F.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!F.keepIsValid||!!F.keepDirtyValues,o.watch=!!e.shouldUnregister,p.state.next({submitCount:F.keepSubmitCount?s.submitCount:0,isDirty:Y?!1:F.keepDirty?s.isDirty:!!(F.keepDefaultValues&&!Ut(k,n)),isSubmitted:F.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:Y?{}:F.keepDirtyValues?F.keepDefaultValues&&a?Cs(n,a):s.dirtyFields:F.keepDefaultValues&&k?Cs(n,k):F.keepDirty?s.dirtyFields:{},touchedFields:F.keepTouched?s.touchedFields:{},errors:F.keepErrors?s.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1})},me=(k,F)=>fe(bt(k)?k(a):k,F),we=(k,F={})=>{const L=re(r,k),ee=L&&L._f;if(ee){const Y=ee.refs?ee.refs[0]:ee.ref;Y.focus&&(Y.focus(),F.shouldSelect&&bt(Y.select)&&Y.select())}},ce=k=>{s={...s,...k}},Te={control:{register:ge,unregister:J,getFieldState:j,handleSubmit:be,setError:B,_subscribe:Q,_runSchema:C,_getWatch:U,_getDirty:z,_setValid:x,_setFieldArray:m,_setDisabledField:he,_setErrors:w,_getFieldArray:D,_reset:fe,_resetDefaultValues:()=>bt(e.defaultValues)&&e.defaultValues().then(k=>{me(k,e.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Se,_subjects:p,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(k){o=k},get _defaultValues(){return n},get _names(){return i},set _names(k){i=k},get _formState(){return s},get _options(){return e},set _options(k){e={...e,...k}}},subscribe:M,trigger:ae,register:ge,handleSubmit:be,watch:W,setValue:Z,getValues:A,reset:me,resetField:pe,clearErrors:V,unregister:J,setError:B,setFocus:we,getFieldState:j};return{...Te,formControl:Te}}function Jd(t={}){const e=b.useRef(void 0),s=b.useRef(void 0),[r,n]=b.useState({isDirty:!1,isValidating:!1,isLoading:bt(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:bt(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:Wd(t),formState:r},t.formControl&&t.defaultValues&&!bt(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const a=e.current.control;return a._options=t,oa(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(i=>({...i,isReady:!0})),a._formState.isReady=!0,o},[a]),b.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),b.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode),t.errors&&!Ze(t.errors)&&a._setErrors(t.errors)},[a,t.errors,t.mode,t.reValidateMode]),b.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==r.isDirty&&a._subjects.state.next({isDirty:o})}},[a,r.isDirty]),b.useEffect(()=>{t.values&&!Ut(t.values,s.current)?(a._reset(t.values,a._options.resetOptions),s.current=t.values,n(o=>({...o}))):a._resetDefaultValues()},[a,t.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=Ai(r,a),e.current}const Ii={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Hd={sm:"h-6",md:"h-10",lg:"h-12"},Gd={sm:"px-2",md:"px-2.5",lg:"px-3"};function Wa(t,e,s,r,n,a,o){const i=e?"datetime-local":"date",c=ne("box-border w-full rounded-lg border outline-none transition font-[var(--font-primary)]",Ii[s],Hd[s],Gd[s],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]"),f=Ad(c,n?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-disabled)] cursor-not-allowed opacity-60":"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",o);return l.jsxs(l.Fragment,{children:[l.jsx("input",{id:t,type:i,disabled:n,"aria-disabled":n,"data-disabled":n?"true":"false",...r,className:f}),l.jsx("div",{children:a!=null&&a.message?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:a.message}):l.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Ms(t){const{control:e,name:s,rules:r,defaultValue:n,showTime:a=!1,size:o="sm",width:i="100%",label:c,labelHidden:d=!1,hasError:u=!1,errorMessage:f="",disabled:p=!1,className:h,onChange:g}=t,x=b.useId(),v=s||x;return l.jsxs("div",{className:ne("flex flex-col",h),style:{width:i,maxWidth:"100%"},children:[c&&l.jsx("label",{htmlFor:v,className:ne("pb-2 text-[var(--color-ds-text-primary)]",Ii[o],d&&"sr-only"),children:c}),e&&s?l.jsx(vt,{name:s,control:e,rules:r,defaultValue:n,render:({field:m,fieldState:y})=>Wa(v,a,o,{value:m.value,onChange:m.onChange,onBlur:m.onBlur},p,y.error,h)}):Wa(v,a,o,{defaultValue:n,onChange:g},p,u?{message:f}:void 0,h)]})}const Zd=({trigger:t,items:e,align:s="left",className:r})=>{const[n,a]=b.useState(!1),o=b.useRef(null),i=b.useRef([]);b.useEffect(()=>{const d=u=>{o.current&&!o.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const c=d=>{var f,p;const u=i.current.findIndex(h=>h===document.activeElement);if(d.key==="Escape")a(!1);else if(d.key==="ArrowDown"){d.preventDefault();const h=(u+1)%e.length;(f=i.current[h])==null||f.focus()}else if(d.key==="ArrowUp"){d.preventDefault();const h=(u-1+e.length)%e.length;(p=i.current[h])==null||p.focus()}};return l.jsxs("div",{className:ne("relative inline-block",r),ref:o,children:[l.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"inline-flex items-center focus:outline-none","aria-haspopup":"menu","aria-expanded":n,children:t}),n&&l.jsx("div",{role:"menu","aria-orientation":"vertical",className:ne("absolute mt-2 min-w-[160px] bg-[var(--color-ds-background-page)]","border border-[var(--color-ds-border-muted)] rounded shadow-lg z-10",s==="right"?"right-0":"left-0"),onKeyDown:c,children:e.map((d,u)=>{const{label:f,onSelect:p,disabled:h,icon:g}=d;return l.jsxs("button",{role:"menuitem",type:"button",disabled:h,ref:x=>{i.current[u]=x},className:ne("w-full flex items-center px-4 py-2 text-[var(--color-ds-text-primary)] text-ds-md transition-colors",h?"opacity-50 cursor-not-allowed":"hover:bg-[var(--color-ds-background-surface)]"),onClick:()=>{h||(p(),a(!1))},children:[g&&l.jsx(g,{className:"w-5 h-5 mr-2 text-[var(--color-ds-text-secondary)]"}),f]},u)})})]})},Yd=(t,e,s,r)=>{var a,o,i,c;const n=[s,{code:e,...r||{}}];if((o=(a=t==null?void 0:t.services)==null?void 0:a.logger)!=null&&o.forward)return t.services.logger.forward(n,"warn","react-i18next::",!0);Qt(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(i=t==null?void 0:t.services)==null?void 0:i.logger)!=null&&c.warn?t.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Ja={},Ln=(t,e,s,r)=>{Qt(s)&&Ja[s]||(Qt(s)&&(Ja[s]=new Date),Yd(t,e,s,r))},Vi=(t,e)=>()=>{if(t.isInitialized)e();else{const s=()=>{setTimeout(()=>{t.off("initialized",s)},0),e()};t.on("initialized",s)}},Mn=(t,e,s)=>{t.loadNamespaces(e,Vi(t,s))},Ha=(t,e,s,r)=>{if(Qt(s)&&(s=[s]),t.options.preload&&t.options.preload.indexOf(e)>-1)return Mn(t,s,r);s.forEach(n=>{t.options.ns.indexOf(n)<0&&t.options.ns.push(n)}),t.loadLanguages(e,Vi(t,r))},Xd=(t,e,s={})=>!e.languages||!e.languages.length?(Ln(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:s.lng,precheck:(r,n)=>{var a;if(((a=s.bindI18n)==null?void 0:a.indexOf("languageChanging"))>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!n(r.isLanguageChangingTo,t))return!1}}),Qt=t=>typeof t=="string",Qd=t=>typeof t=="object"&&t!==null,eu=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,tu={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},su=t=>tu[t],ru=t=>t.replace(eu,su);let nu={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ru};const au=()=>nu;let ou;const iu=()=>ou,lu=b.createContext();class cu{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const du=(t,e)=>{const s=b.useRef();return b.useEffect(()=>{s.current=t},[t,e]),s.current},zi=(t,e,s,r)=>t.getFixedT(e,s,r),uu=(t,e,s,r)=>b.useCallback(zi(t,e,s,r),[t,e,s,r]),da=(t,e={})=>{var O,S,T,C;const{i18n:s}=e,{i18n:r,defaultNS:n}=b.useContext(lu)||{},a=s||r||iu();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new cu),!a){Ln(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const N=(I,z)=>Qt(z)?z:Qd(z)&&Qt(z.defaultValue)?z.defaultValue:Array.isArray(I)?I[I.length-1]:I,_=[N,{},!1];return _.t=N,_.i18n={},_.ready=!1,_}(O=a.options.react)!=null&&O.wait&&Ln(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...au(),...a.options.react,...e},{useSuspense:i,keyPrefix:c}=o;let d=n||((S=a.options)==null?void 0:S.defaultNS);d=Qt(d)?[d]:d||["translation"],(C=(T=a.reportNamespaces).addUsedNamespaces)==null||C.call(T,d);const u=(a.isInitialized||a.initializedStoreOnce)&&d.every(N=>Xd(N,a,o)),f=uu(a,e.lng||null,o.nsMode==="fallback"?d:d[0],c),p=()=>f,h=()=>zi(a,e.lng||null,o.nsMode==="fallback"?d:d[0],c),[g,x]=b.useState(p);let v=d.join();e.lng&&(v=`${e.lng}${v}`);const m=du(v),y=b.useRef(!0);b.useEffect(()=>{const{bindI18n:N,bindI18nStore:_}=o;y.current=!0,!u&&!i&&(e.lng?Ha(a,e.lng,d,()=>{y.current&&x(h)}):Mn(a,d,()=>{y.current&&x(h)})),u&&m&&m!==v&&y.current&&x(h);const I=()=>{y.current&&x(h)};return N&&(a==null||a.on(N,I)),_&&(a==null||a.store.on(_,I)),()=>{y.current=!1,a&&(N==null||N.split(" ").forEach(z=>a.off(z,I))),_&&a&&_.split(" ").forEach(z=>a.store.off(z,I))}},[a,v]),b.useEffect(()=>{y.current&&u&&x(p)},[a,c,u]);const w=[g,a,u];if(w.t=g,w.i18n=a,w.ready=u,u||!u&&!i)return w;throw new Promise(N=>{e.lng?Ha(a,e.lng,d,()=>N()):Mn(a,d,()=>N())})},Pn={sm:"text-sm",md:"text-base",lg:"text-lg"};function Ga(t,e,s,r,n,a,o,i,c){const{t:d}=da(),u=b.useRef(null),f=typeof r=="number"&&e.length>=r,p=()=>{var y;!o&&!f&&((y=u.current)==null||y.click())},h=y=>{const w=y.target.files;if(!w)return;const O=Array.from(w);let S=e.concat(O);r&&(S=S.slice(0,r)),s(S),y.target.value=""},g=y=>{if(y.preventDefault(),o||f)return;const w=Array.from(y.dataTransfer.files);let O=e.concat(w);r&&(O=O.slice(0,r)),s(O)},x=y=>{y.preventDefault()},v=y=>{const w=URL.createObjectURL(y);window.open(w)},m=y=>{const w=e.filter((O,S)=>S!==y);s(w)};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"self-start mb-4 w-auto",children:l.jsx(le,{type:"button",variant:"outline",size:a,icon:Ta,onClick:p,disabled:o||f,children:d("ds.fileUploader.browse","Browse files")})}),!f&&l.jsxs("div",{className:ne("relative flex bg-[var(--color-ds-background-page)] flex-col items-center justify-center border-2 border-dashed border-[var(--color-ds-border-muted)] rounded-lg p-4",o?"opacity-50 cursor-not-allowed":"hover:border-[var(--color-ds-border-default)]",Pn[a],c),onDrop:g,onDragOver:x,children:[l.jsx("input",{id:t,type:"file",ref:u,className:"hidden",multiple:r!==1,accept:n,onChange:h,disabled:o}),l.jsx(Nt,{component:Tc,size:"md",className:"w-8 h-8 text-[var(--color-ds-text-secondary)]"}),l.jsx("p",{className:"mt-3 text-[var(--color-ds-text-secondary)] text-center",children:d("ds.fileUploader.dragDrop","Drag & drop your files here or click to browse")})]}),e.length>0&&l.jsx("ul",{className:"mt-4 space-y-1",children:e.map((y,w)=>l.jsxs("li",{className:"flex items-center justify-between text-[var(--color-ds-text-secondary)] text-sm",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsx(Ta,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),l.jsx("span",{className:"truncate pr-2",children:y.name})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(le,{variant:"ghost",size:"sm",icon:fi,ariaLabel:d("ds.fileUploader.view","View"),onClick:()=>v(y)}),l.jsx(le,{variant:"ghost",size:"sm",icon:sa,ariaLabel:d("ds.fileUploader.remove","Remove"),onClick:()=>m(w)})]})]},w))}),l.jsx("div",{className:"pt-[5px] min-h-[18px] w-full",children:i!=null&&i.message?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:i.message}):l.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Bi(t){const{control:e,name:s,rules:r,defaultValue:n,maxFiles:a,accept:o,size:i="sm",width:c="100%",label:d,labelHidden:u=!1,disabled:f=!1,hasError:p=!1,errorMessage:h="",className:g}=t,x=b.useId(),v=s||x;if(e&&s)return l.jsxs("div",{className:ne("flex flex-col",g),style:{width:c},children:[d&&l.jsx("label",{htmlFor:v,className:ne("pb-[10px] text-[var(--color-ds-text-primary)]",Pn[i],u&&"sr-only"),children:d}),l.jsx(vt,{name:s,control:e,rules:r,defaultValue:n instanceof FileList?Array.from(n):n||[],render:({field:w,fieldState:O})=>Ga(v,w.value,S=>w.onChange(S),a,o,i,f,O.error,g)})]});const[m,y]=b.useState(n instanceof FileList?Array.from(n):n||[]);return l.jsxs("div",{className:ne("flex flex-col",g),style:{width:c},children:[d&&l.jsx("label",{htmlFor:v,className:ne("pb-[10px] text-[var(--color-ds-text-primary)]",Pn[i],u&&"sr-only"),children:d}),Ga(v,m,y,a,o,i,f,p?{message:h}:void 0,g)]})}const ts=({count:t=1,width:e,height:s="1em",variant:r="rect",className:n})=>{const a=Array.from({length:t});return l.jsx(l.Fragment,{children:a.map((o,i)=>l.jsx("span",{role:"status","aria-label":"Cargando...",className:ne("bg-[var(--color-ds-border-muted)] animate-pulse inline-block",r==="circle"?"rounded-full":"rounded",n),style:{width:e??"auto",height:s}},i))})},ir={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},fu={sm:"h-6",md:"h-10",lg:"h-12"},hu={sm:"px-2",md:"px-2.5",lg:"px-3"},Za={sm:"pl-2",md:"pl-2.5",lg:"pl-3"},pu={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function je({id:t,type:e="text",size:s="sm",width:r="100%",label:n,labelHidden:a=!1,hasError:o=!1,errorMessage:i="",prefixIcon:c,suffixIcon:d,separator:u,suffixButton:f,disabled:p=!1,control:h,name:g,rules:x,defaultValue:v,reserveErrorSpace:m,disableErrorPlaceholder:y,loading:w=!1,className:O,...S}){const T=b.useId(),[C,N]=b.useState(!1),_=t||T,I=e==="password",U=c??(e==="number"?Pc:void 0),D=I?C?$c:fi:d,$=typeof m=="boolean"?m:typeof y=="boolean"?!y:!!h,E=ne("box-border w-full rounded-lg border placeholder-[var(--color-ds-text-secondary)] outline-none transition font-[var(--font-primary)] appearance-none",ir[s],fu[s],hu[s],o?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]","bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]","disabled:bg-[var(--color-ds-background-disabled)]","disabled:border-[var(--color-ds-border-muted)]","disabled:text-[var(--color-ds-text-disabled)]","disabled:cursor-not-allowed");return w?l.jsxs("div",{className:"flex flex-col",style:{width:r,maxWidth:"100%"},children:[!a&&n&&l.jsx("label",{htmlFor:_,className:ne("pb-2",ir[s]),children:n}),l.jsx(ts,{width:"100%",height:pu[s],variant:"rect",className:"rounded-lg"}),l.jsx("div",{className:"min-h-[18px] w-full",children:l.jsx("span",{"aria-hidden":"true",children:" "})})]}):h&&g?l.jsx(vt,{name:g,control:h,rules:x,defaultValue:v,render:({field:Z,fieldState:se})=>l.jsxs("div",{className:"flex flex-col",style:{width:r},children:[!a&&n&&l.jsx("label",{htmlFor:_,className:ne("pb-2 text-[var(--color-ds-text-primary)]",ir[s]),children:n}),l.jsxs("div",{className:"relative flex items-center w-full",children:[U&&l.jsx("div",{className:ne("absolute left-0 flex items-center h-full",Za[s]),children:l.jsx(Nt,{component:U,size:s,className:"text-[var(--color-ds-text-secondary)]"})}),l.jsx("input",{...Z,id:_,type:I?C?"text":"password":e,disabled:p,"aria-invalid":!!se.error,className:ne(E,U&&"pl-9",D&&"pr-9",O),onInvalid:q=>q.preventDefault(),style:I&&!C?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&l.jsx("div",{className:"flex items-center h-full",children:u}),f&&l.jsx("div",{className:"flex items-center h-full pr-2",children:f}),D&&l.jsx("button",{type:"button",onClick:()=>N(q=>!q),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:l.jsx(Nt,{component:D,size:s,className:"text-[var(--color-ds-text-secondary)]"})})]}),$?l.jsx("div",{className:"min-h-[18px]",children:se.error?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:se.error.message}):l.jsx("span",{"aria-hidden":"true",children:" "})}):se.error?l.jsx("div",{className:"pt-1",children:l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:se.error.message})}):null]})}):l.jsxs("div",{className:"flex flex-col",style:{width:r},children:[!a&&n&&l.jsx("label",{htmlFor:_,className:ne("pb-2 text-[var(--color-ds-text-primary)]",ir[s]),children:n}),l.jsxs("div",{className:"relative flex items-center w-full",children:[U&&l.jsx("div",{className:ne("absolute left-0 flex items-center h-full",Za[s]),children:l.jsx(Nt,{component:U,size:s,className:"text-[var(--color-ds-text-secondary)]"})}),l.jsx("input",{...S,id:_,type:I?C?"text":"password":e,disabled:p,"aria-invalid":o,className:ne(E,U&&"pl-9",D&&"pr-9",O),onInvalid:Z=>Z.preventDefault(),style:I&&!C?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&l.jsx("div",{className:"flex items-center h-full",children:u}),f&&l.jsx("div",{className:"flex items-center h-full",children:f}),D&&l.jsx("button",{type:"button",onClick:()=>N(Z=>!Z),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:l.jsx(Nt,{component:D,size:s,className:"text-[var(--color-ds-text-secondary)]"})})]}),$?l.jsx("div",{className:"min-h-[18px]",children:o&&i?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:i}):l.jsx("span",{"aria-hidden":"true",children:" "})}):o&&i?l.jsx("div",{className:"pt-1",children:l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:i})}):null]})}const mu={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},cn=400,lr=8,ua=({children:t,size:e="sm",position:s="top",className:r,onClick:n,ariaLabel:a="Más información"})=>{const[o,i]=b.useState(!1),[c,d]=b.useState({x:0,y:0}),u=b.useRef(null),f=b.useId();b.useEffect(()=>{if(o&&u.current){const g=u.current.getBoundingClientRect();let x=0,v=0;switch(s){case"top":x=g.left+g.width/2-cn/2,v=g.top-lr;break;case"bottom":x=g.left+g.width/2-cn/2,v=g.bottom+lr;break;case"left":x=g.left-cn-lr,v=g.top+g.height/2;break;case"right":x=g.right+lr,v=g.top+g.height/2;break}d({x,y:v})}},[o,s]);const p=()=>typeof t=="string"?l.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):l.jsx(l.Fragment,{children:t}),h=o?l.jsx("div",{id:f,role:"tooltip",className:ne("fixed z-50 w-[250px] bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)] text-ds-sm rounded p-2 shadow-lg","pointer-events-none"),style:{top:`${c.y}px`,left:`${c.x}px`,transform:s==="left"||s==="right"?"translateY(-50%)":s==="top"?"translateY(-100%)":void 0},children:p()}):null;return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button","aria-describedby":f,ref:u,"aria-label":a,className:ne("inline-flex items-center justify-center focus:outline-none",mu[e],"text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]",r),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:n,children:l.jsx(hi,{className:"w-full h-full"})}),Yt.createPortal(h,document.body)]})};function gu({name:t,label:e,type:s="text",size:r="sm",width:n,placeholder:a,validation:o,loadingDefaults:i,disabled:c,info:d}){var v;const{control:u,formState:{errors:f}}=Ws(),p=!!f[t],h=((v=f[t])==null?void 0:v.message)||"",g="relative",x=n??"w-full";return l.jsxs("div",{className:g,children:[l.jsx(vt,{name:t,control:u,rules:o,render:({field:m})=>l.jsx(je,{label:e,size:r,width:x,placeholder:a,hasError:p,errorMessage:h,loading:i,type:s,...m,disabled:c,reserveErrorSpace:!0})}),d&&l.jsx(ua,{size:r,position:"left",className:"absolute top-1/2 right-2 -translate-y-1/2",children:d})]})}const fa=b.memo(gu);fa.displayName="FormFieldInput";function bu({title:t,headerButtons:e,children:s,className:r}){return l.jsxs("div",{className:ne("flex flex-col h-full",r),children:[l.jsxs("div",{className:"flex items-center justify-between py-4",children:[l.jsx("div",{className:`bg-[var(--color-ds-background-accent)] \r
22
+ <%s key={someKey} {...props} />`,U,me,be,me),le[me+U]=!0)}if(me=null,I!==void 0&&(r(I),me=""+I),i(k)&&(r(k.key),me=""+k.key),"key"in k){I={};for(var de in k)de!=="key"&&(I[de]=k[de])}else I=k;return me&&l(I,typeof C=="function"?C.displayName||C.name||"Unknown":C),d(C,me,ee,G,n(),I,M,W)}function f(C){typeof C=="object"&&C!==null&&C.$$typeof===h&&C._store&&(C._store.validated=1)}var p=b,h=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),y=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),z=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,D=Array.isArray,P=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(C){return C()}};var E,te={},ne=p["react-stack-bottom-frame"].bind(p,a)(),K=P(s(a)),le={};yr.Fragment=x,yr.jsx=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!1,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)},yr.jsxs=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!0,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)}}()),yr}var ha;function _l(){return ha||(ha=1,process.env.NODE_ENV==="production"?Yr.exports=Al():Yr.exports=Tl()),Yr.exports}var o=_l();function $o(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=$o(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function se(){for(var e,t,r=0,s="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=$o(e))&&(s&&(s+=" "),s+=t);return s}const Fl={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-10 h-10",full:"w-full h-full"};function kt({component:e,size:t="sm",className:r,...s}){return o.jsx(e,{className:se(Fl[t],r),"aria-hidden":s["aria-label"]?void 0:!0,...s})}const Ol="inline-flex items-center justify-center box-border font-[var(--font-primary)] font-medium rounded-lg transition focus:outline-none",Rl={primary:"bg-[var(--color-ds-button-primary-bg)] text-[var(--color-ds-button-primary-text)] hover:animate-pulse",outline:"bg-transparent text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default)] hover:bg-[var(--color-ds-background-accent)] hover:text-[var(--color-ds-text-on-accent)]",ghost:"bg-transparent text-[var(--color-ds-text-primary)] hover:animate-pulse",subtle:"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:text-[var(--color-ds-text-on-accent)] hover:bg-[var(--color-ds-background-accent)]",danger:"bg-[var(--color-ds-background-danger)] text-[var(--color-ds-text-danger)] hover:brightness-105"},Dl={xs:"text-[10px] leading-none h-5 px-1.5",sm:"text-ds-sm h-6 px-2",md:"text-ds-md h-10 px-2.5",lg:"text-ds-lg h-12 px-3"},Ml={xs:"h-5 w-5 p-0",sm:"h-6 w-6 p-0",md:"h-10 w-10 p-0",lg:"h-12 w-12 p-0"},$l="disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[var(--color-ds-background-disabled)] disabled:text-[var(--color-ds-text-primary)] disabled:ring-1 disabled:ring-inset disabled:ring-[var(--color-ds-border-muted)]";function ie({type:e="button",variant:t="primary",size:r="sm",width:s,disabled:n=!1,icon:a,iconPosition:i="left",ariaLabel:l,children:c,onClick:d,className:u,...f}){const p=!!a,h=p&&!c,g=h?Ml[r]:Dl[r];return o.jsxs("button",{type:e,onClick:d,disabled:n,"aria-label":h?l:void 0,style:s?{width:s}:void 0,className:se(Ol,Rl[t],g,$l,u,p&&c&&"gap-2"),...f,children:[a&&i==="left"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r}),c,a&&i==="right"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r})]})}function Ll({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const Pl=H.forwardRef(Ll);function zl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const Il=H.forwardRef(zl);function Vl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const Bl=H.forwardRef(Vl);function Ul({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const ql=H.forwardRef(Ul);function Wl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const Kl=H.forwardRef(Wl);function Gl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Rs=H.forwardRef(Gl);function Jl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const Zl=H.forwardRef(Jl);function Yl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const Lo=H.forwardRef(Yl);function Hl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Xl=H.forwardRef(Hl);function Ql({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const ec=H.forwardRef(Ql);function tc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"}))}const rc=H.forwardRef(tc);function sc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const pa=H.forwardRef(sc);function nc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const ac=H.forwardRef(nc);function oc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const Po=H.forwardRef(oc);function ic({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}const lc=H.forwardRef(ic);function cc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const zo=H.forwardRef(cc);function dc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const uc=H.forwardRef(dc);function fc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"}))}const mc=H.forwardRef(fc);function hc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const pc=H.forwardRef(hc);function bc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const gc=H.forwardRef(bc);function xc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Vn=H.forwardRef(xc),vc={default:{wrapper:"box-border w-full rounded-lg bg-[var(--color-ds-background-surface)] overflow-hidden",padX:"px-6",padY:"py-4"},plain:{wrapper:"box-border w-full overflow-hidden",padX:"px-0",padY:"py-2"},soft:{wrapper:"box-border w-full rounded-lg bg-[color-mix(in srgb,var(--color-ds-background-surface) 60%, transparent 40%)] overflow-hidden",padX:"px-4",padY:"py-3"},ghost:{wrapper:"box-border w-full overflow-hidden",padX:"px-6",padY:"py-3"}};function it({title:e,children:t,defaultOpen:r=!0,className:s,type:n="default",contentClassName:a,headerClassName:i}){const[l,c]=b.useState(r),d=b.useRef(null),[u,f]=b.useState(0),p=()=>{d.current&&f(d.current.scrollHeight)};b.useLayoutEffect(()=>{p()},[l]),b.useEffect(()=>{const g=d.current;if(!g)return;const x=new ResizeObserver(()=>p());return x.observe(g),()=>x.disconnect()},[]);const h=vc[n];return o.jsxs("div",{className:se("flex flex-col w-full gap-3",s),children:[o.jsxs("button",{type:"button",onClick:()=>c(g=>!g),"aria-expanded":l,className:se("flex items-center justify-between w-full transition-colors","hover:bg-[var(--color-ds-surface-hover)]",i),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"block w-1 h-5 bg-[var(--color-ds-background-accent)] rounded-sm"}),o.jsx("span",{className:"font-semibold text-[var(--color-ds-text-primary)]",children:e})]}),l?o.jsx(Xl,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"}):o.jsx(Rs,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"})]}),o.jsx("div",{className:h.wrapper,children:o.jsx("div",{className:h.padX,children:o.jsx("div",{className:se("overflow-hidden transition-all duration-300 ease-in-out",l?"opacity-100":"opacity-0"),style:{maxHeight:l?`${u}px`:"0px"},children:o.jsx("div",{ref:d,className:se(h.padY,a),children:t})})})})]})}const Bn="-",yc=e=>{const t=jc(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const l=i.split(Bn);return l[0]===""&&l.length!==1&&l.shift(),Io(l,t)||wc(i)},getConflictingClassGroupIds:(i,l)=>{const c=r[i]||[];return l&&s[i]?[...c,...s[i]]:c}}},Io=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],s=t.nextPart.get(r),n=s?Io(e.slice(1),s):void 0;if(n)return n;if(t.validators.length===0)return;const a=e.join(Bn);return(i=t.validators.find(({validator:l})=>l(a)))==null?void 0:i.classGroupId},ba=/^\[(.+)\]$/,wc=e=>{if(ba.test(e)){const t=ba.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},jc=e=>{const{theme:t,classGroups:r}=e,s={nextPart:new Map,validators:[]};for(const n in r)xn(r[n],s,n,t);return s},xn=(e,t,r,s)=>{e.forEach(n=>{if(typeof n=="string"){const a=n===""?t:ga(t,n);a.classGroupId=r;return}if(typeof n=="function"){if(kc(n)){xn(n(s),t,r,s);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,i])=>{xn(i,ga(t,a),r,s)})})},ga=(e,t)=>{let r=e;return t.split(Bn).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},kc=e=>e.isThemeGetter,Nc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,s=new Map;const n=(a,i)=>{r.set(a,i),t++,t>e&&(t=0,s=r,r=new Map)};return{get(a){let i=r.get(a);if(i!==void 0)return i;if((i=s.get(a))!==void 0)return n(a,i),i},set(a,i){r.has(a)?r.set(a,i):n(a,i)}}},vn="!",yn=":",Sc=yn.length,Ec=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const a=[];let i=0,l=0,c=0,d;for(let g=0;g<n.length;g++){let x=n[g];if(i===0&&l===0){if(x===yn){a.push(n.slice(c,g)),c=g+Sc;continue}if(x==="/"){d=g;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const u=a.length===0?n:n.substring(c),f=Cc(u),p=f!==u,h=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:h}};if(t){const n=t+yn,a=s;s=i=>i.startsWith(n)?a(i.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(r){const n=s;s=a=>r({className:a,parseClassName:n})}return s},Cc=e=>e.endsWith(vn)?e.substring(0,e.length-1):e.startsWith(vn)?e.substring(1):e,Ac=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const n=[];let a=[];return s.forEach(i=>{i[0]==="["||t[i]?(n.push(...a.sort(),i),a=[]):a.push(i)}),n.push(...a.sort()),n}},Tc=e=>({cache:Nc(e.cacheSize),parseClassName:Ec(e),sortModifiers:Ac(e),...yc(e)}),_c=/\s+/,Fc=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:a}=t,i=[],l=e.trim().split(_c);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:x}=r(u);if(f){c=u+(c.length>0?" "+c:c);continue}let v=!!x,m=s(v?g.substring(0,x):g);if(!m){if(!v){c=u+(c.length>0?" "+c:c);continue}if(m=s(g),!m){c=u+(c.length>0?" "+c:c);continue}v=!1}const w=a(p).join(":"),y=h?w+vn:w,T=y+m;if(i.includes(T))continue;i.push(T);const N=n(m,v);for(let _=0;_<N.length;++_){const A=N[_];i.push(y+A)}c=u+(c.length>0?" "+c:c)}return c};function Oc(){let e=0,t,r,s="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Vo(t))&&(s&&(s+=" "),s+=r);return s}const Vo=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=Vo(e[s]))&&(r&&(r+=" "),r+=t);return r};function Rc(e,...t){let r,s,n,a=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return r=Tc(d),s=r.cache.get,n=r.cache.set,a=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=Fc(c,r);return n(c,u),u}return function(){return a(Oc.apply(null,arguments))}}const ze=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Bo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Uo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dc=/^\d+\/\d+$/,Mc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$c=/\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$/,Lc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nr=e=>Dc.test(e),ve=e=>!!e&&!Number.isNaN(Number(e)),$t=e=>!!e&&Number.isInteger(Number(e)),Ks=e=>e.endsWith("%")&&ve(e.slice(0,-1)),St=e=>Mc.test(e),Ic=()=>!0,Vc=e=>$c.test(e)&&!Lc.test(e),qo=()=>!1,Bc=e=>Pc.test(e),Uc=e=>zc.test(e),qc=e=>!ae(e)&&!oe(e),Wc=e=>hr(e,Go,qo),ae=e=>Bo.test(e),Kt=e=>hr(e,Jo,Vc),Gs=e=>hr(e,Yc,ve),xa=e=>hr(e,Wo,qo),Kc=e=>hr(e,Ko,Uc),Hr=e=>hr(e,Zo,Bc),oe=e=>Uo.test(e),wr=e=>pr(e,Jo),Gc=e=>pr(e,Hc),va=e=>pr(e,Wo),Jc=e=>pr(e,Go),Zc=e=>pr(e,Ko),Xr=e=>pr(e,Zo,!0),hr=(e,t,r)=>{const s=Bo.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},pr=(e,t,r=!1)=>{const s=Uo.exec(e);return s?s[1]?t(s[1]):r:!1},Wo=e=>e==="position"||e==="percentage",Ko=e=>e==="image"||e==="url",Go=e=>e==="length"||e==="size"||e==="bg-size",Jo=e=>e==="length",Yc=e=>e==="number",Hc=e=>e==="family-name",Zo=e=>e==="shadow",Xc=()=>{const e=ze("color"),t=ze("font"),r=ze("text"),s=ze("font-weight"),n=ze("tracking"),a=ze("leading"),i=ze("breakpoint"),l=ze("container"),c=ze("spacing"),d=ze("radius"),u=ze("shadow"),f=ze("inset-shadow"),p=ze("text-shadow"),h=ze("drop-shadow"),g=ze("blur"),x=ze("perspective"),v=ze("aspect"),m=ze("ease"),w=ze("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...T(),oe,ae],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],S=()=>[oe,ae,c],$=()=>[nr,"full","auto",...S()],V=()=>[$t,"none","subgrid",oe,ae],z=()=>["auto",{span:["full",$t,oe,ae]},$t,oe,ae],q=()=>[$t,"auto",oe,ae],D=()=>["auto","min","max","fr",oe,ae],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...S()],ne=()=>[nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],K=()=>[e,oe,ae],le=()=>[...T(),va,xa,{position:[oe,ae]}],C=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",Jc,Wc,{size:[oe,ae]}],I=()=>[Ks,wr,Kt],U=()=>["","none","full",d,oe,ae],G=()=>["",ve,wr,Kt],ee=()=>["solid","dashed","dotted","double"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[ve,Ks,va,xa],me=()=>["","none",g,oe,ae],be=()=>["none",ve,oe,ae],de=()=>["none",ve,oe,ae],ke=()=>[ve,oe,ae],ge=()=>[nr,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[St],breakpoint:[St],color:[Ic],container:[St],"drop-shadow":[St],ease:["in","out","in-out"],font:[qc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[St],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[St],shadow:[St],spacing:["px",ve],text:[St],"text-shadow":[St],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nr,ae,oe,v]}],container:["container"],columns:[{columns:[ve,ae,oe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:N()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[$t,"auto",oe,ae]}],basis:[{basis:[nr,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ve,nr,"auto","initial","none",ae]}],grow:[{grow:["",ve,oe,ae]}],shrink:[{shrink:["",ve,oe,ae]}],order:[{order:[$t,"first","last","none",oe,ae]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],w:[{w:[l,"screen",...ne()]}],"min-w":[{"min-w":[l,"screen","none",...ne()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",r,wr,Kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,oe,Gs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ks,ae]}],"font-family":[{font:[Gc,ae,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:[n,oe,ae]}],"line-clamp":[{"line-clamp":[ve,"none",oe,Gs]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",oe,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[ve,"from-font","auto",oe,Kt]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[ve,"auto",oe,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ae]}],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",oe,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:C()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$t,oe,ae],radial:["",oe,ae],conic:[$t,oe,ae]},Zc,Kc]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ve,oe,ae]}],"outline-w":[{outline:["",ve,wr,Kt]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",u,Xr,Hr]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",f,Xr,Hr]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[ve,Kt]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",p,Xr,Hr]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[ve,oe,ae]}],"mix-blend":[{"mix-blend":[...M(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":M()}],"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":[ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[oe,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:C()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ae]}],filter:[{filter:["","none",oe,ae]}],blur:[{blur:me()}],brightness:[{brightness:[ve,oe,ae]}],contrast:[{contrast:[ve,oe,ae]}],"drop-shadow":[{"drop-shadow":["","none",h,Xr,Hr]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",ve,oe,ae]}],"hue-rotate":[{"hue-rotate":[ve,oe,ae]}],invert:[{invert:["",ve,oe,ae]}],saturate:[{saturate:[ve,oe,ae]}],sepia:[{sepia:["",ve,oe,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ae]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[ve,oe,ae]}],"backdrop-contrast":[{"backdrop-contrast":[ve,oe,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ve,oe,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ve,oe,ae]}],"backdrop-invert":[{"backdrop-invert":["",ve,oe,ae]}],"backdrop-opacity":[{"backdrop-opacity":[ve,oe,ae]}],"backdrop-saturate":[{"backdrop-saturate":[ve,oe,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",ve,oe,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ve,"initial",oe,ae]}],ease:[{ease:["linear","initial",m,oe,ae]}],delay:[{delay:[ve,oe,ae]}],animate:[{animate:["none",w,oe,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,oe,ae]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[oe,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"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",oe,ae]}],"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":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"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",oe,ae]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[ve,wr,Kt,Gs]}],stroke:[{stroke:["none",...K()]}],"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"]}},Qc=Rc(Xc);var Lr=e=>e.type==="checkbox",Zt=e=>e instanceof Date,Ze=e=>e==null;const Yo=e=>typeof e=="object";var De=e=>!Ze(e)&&!Array.isArray(e)&&Yo(e)&&!Zt(e),Ho=e=>De(e)&&e.target?Lr(e.target)?e.target.checked:e.target.value:e,ed=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Xo=(e,t)=>e.has(ed(t)),td=e=>{const t=e.constructor&&e.constructor.prototype;return De(t)&&t.hasOwnProperty("isPrototypeOf")},Un=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function qe(e){let t;const r=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Un&&(e instanceof Blob||s))&&(r||De(e)))if(t=r?[]:{},!r&&!td(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=qe(e[n]));else return e;return t}var Ds=e=>Array.isArray(e)?e.filter(Boolean):[],Re=e=>e===void 0,re=(e,t,r)=>{if(!t||!De(e))return r;const s=Ds(t.split(/[,[\].]+?/)).reduce((n,a)=>Ze(n)?n:n[a],e);return Re(s)||s===e?Re(e[t])?r:e[t]:s},lt=e=>typeof e=="boolean",qn=e=>/^\w*$/.test(e),Qo=e=>Ds(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ce=(e,t,r)=>{let s=-1;const n=qn(t)?[t]:Qo(t),a=n.length,i=a-1;for(;++s<a;){const l=n[s];let c=r;if(s!==i){const d=e[l];c=De(d)||Array.isArray(d)?d:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const gs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ht={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Et={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ei=b.createContext(null),Pr=()=>b.useContext(ei),rd=e=>{const{children:t,...r}=e;return b.createElement(ei.Provider,{value:r},t)};var ti=(e,t,r,s=!0)=>{const n={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const i=a;return t._proxyFormState[i]!==ht.all&&(t._proxyFormState[i]=!s||ht.all),r&&(r[i]=!0),e[i]}});return n};const Wn=typeof window<"u"?H.useLayoutEffect:H.useEffect;function sd(e){const t=Pr(),{control:r=t.control,disabled:s,name:n,exact:a}=e||{},[i,l]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Wn(()=>r._subscribe({name:n,formState:c.current,exact:a,callback:d=>{!s&&l({...r._formState,...d})}}),[n,s,a]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>ti(i,r,c.current,!1),[i,r])}var Nt=e=>typeof e=="string",ri=(e,t,r,s,n)=>Nt(e)?(s&&t.watch.add(e),re(r,e,n)):Array.isArray(e)?e.map(a=>(s&&t.watch.add(a),re(r,a))):(s&&(t.watchAll=!0),r);function Kn(e){const t=Pr(),{control:r=t.control,name:s,defaultValue:n,disabled:a,exact:i}=e||{},l=b.useRef(n),[c,d]=b.useState(r._getWatch(s,l.current));return Wn(()=>r._subscribe({name:s,formState:{values:!0},exact:i,callback:u=>!a&&d(ri(s,r._names,u.values||r._formValues,!1,l.current))}),[s,r,a,i]),b.useEffect(()=>r._removeUnmounted()),c}function si(e){const t=Pr(),{name:r,disabled:s,control:n=t.control,shouldUnregister:a}=e,i=Xo(n._names.array,r),l=Kn({control:n,name:r,defaultValue:re(n._formValues,r,re(n._defaultValues,r,e.defaultValue)),exact:!0}),c=sd({control:n,name:r,exact:!0}),d=b.useRef(e),u=b.useRef(n.register(r,{...e.rules,value:l,...lt(e.disabled)?{disabled:e.disabled}:{}})),f=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!re(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!re(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!re(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!re(c.validatingFields,r)},error:{enumerable:!0,get:()=>re(c.errors,r)}}),[c,r]),p=b.useCallback(v=>u.current.onChange({target:{value:Ho(v),name:r},type:gs.CHANGE}),[r]),h=b.useCallback(()=>u.current.onBlur({target:{value:re(n._formValues,r),name:r},type:gs.BLUR}),[r,n._formValues]),g=b.useCallback(v=>{const m=re(n._fields,r);m&&v&&(m._f.ref={focus:()=>v.focus(),select:()=>v.select(),setCustomValidity:w=>v.setCustomValidity(w),reportValidity:()=>v.reportValidity()})},[n._fields,r]),x=b.useMemo(()=>({name:r,value:l,...lt(s)||c.disabled?{disabled:c.disabled||s}:{},onChange:p,onBlur:h,ref:g}),[r,s,c.disabled,p,h,g,l]);return b.useEffect(()=>{const v=n._options.shouldUnregister||a;n.register(r,{...d.current.rules,...lt(d.current.disabled)?{disabled:d.current.disabled}:{}});const m=(w,y)=>{const T=re(n._fields,w);T&&T._f&&(T._f.mount=y)};if(m(r,!0),v){const w=qe(re(n._options.defaultValues,r));Ce(n._defaultValues,r,w),Re(re(n._formValues,r))&&Ce(n._formValues,r,w)}return!i&&n.register(r),()=>{(i?v&&!n._state.action:v)?n.unregister(r):m(r,!1)}},[r,n,i,a]),b.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),b.useMemo(()=>({field:x,formState:c,fieldState:f}),[x,c,f])}const gt=e=>e.render(si(e));var ni=(e,t,r,s,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:n||!0}}:{},Er=e=>Array.isArray(e)?e:[e],ya=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}},wn=e=>Ze(e)||!Yo(e);function It(e,t){if(wn(e)||wn(t))return e===t;if(Zt(e)&&Zt(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const n of r){const a=e[n];if(!s.includes(n))return!1;if(n!=="ref"){const i=t[n];if(Zt(a)&&Zt(i)||De(a)&&De(i)||Array.isArray(a)&&Array.isArray(i)?!It(a,i):a!==i)return!1}}return!0}var Je=e=>De(e)&&!Object.keys(e).length,Gn=e=>e.type==="file",pt=e=>typeof e=="function",xs=e=>{if(!Un)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ai=e=>e.type==="select-multiple",Jn=e=>e.type==="radio",nd=e=>Jn(e)||Lr(e),Js=e=>xs(e)&&e.isConnected;function ad(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=Re(e)?s++:e[t[s++]];return e}function od(e){for(const t in e)if(e.hasOwnProperty(t)&&!Re(e[t]))return!1;return!0}function Ie(e,t){const r=Array.isArray(t)?t:qn(t)?[t]:Qo(t),s=r.length===1?e:ad(e,r),n=r.length-1,a=r[n];return s&&delete s[a],n!==0&&(De(s)&&Je(s)||Array.isArray(s)&&od(s))&&Ie(e,r.slice(0,-1)),e}var oi=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function vs(e,t={}){const r=Array.isArray(e);if(De(e)||r)for(const s in e)Array.isArray(e[s])||De(e[s])&&!oi(e[s])?(t[s]=Array.isArray(e[s])?[]:{},vs(e[s],t[s])):Ze(e[s])||(t[s]=!0);return t}function ii(e,t,r){const s=Array.isArray(e);if(De(e)||s)for(const n in e)Array.isArray(e[n])||De(e[n])&&!oi(e[n])?Re(t)||wn(r[n])?r[n]=Array.isArray(e[n])?vs(e[n],[]):{...vs(e[n])}:ii(e[n],Ze(t)?{}:t[n],r[n]):r[n]=!It(e[n],t[n]);return r}var jr=(e,t)=>ii(e,t,vs(t));const wa={value:!1,isValid:!1},ja={value:!0,isValid:!0};var li=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Re(e[0].attributes.value)?Re(e[0].value)||e[0].value===""?ja:{value:e[0].value,isValid:!0}:ja:wa}return wa},ci=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>Re(e)?e:t?e===""?NaN:e&&+e:r&&Nt(e)?new Date(e):s?s(e):e;const ka={isValid:!1,value:null};var di=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ka):ka;function Na(e){const t=e.ref;return Gn(t)?t.files:Jn(t)?di(e.refs).value:ai(t)?[...t.selectedOptions].map(({value:r})=>r):Lr(t)?li(e.refs).value:ci(Re(t.value)?e.ref.value:t.value,e)}var id=(e,t,r,s)=>{const n={};for(const a of e){const i=re(t,a);i&&Ce(n,a,i._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:s}},ys=e=>e instanceof RegExp,kr=e=>Re(e)?e:ys(e)?e.source:De(e)?ys(e.value)?e.value.source:e.value:e,Sa=e=>({isOnSubmit:!e||e===ht.onSubmit,isOnBlur:e===ht.onBlur,isOnChange:e===ht.onChange,isOnAll:e===ht.all,isOnTouch:e===ht.onTouched});const Ea="AsyncFunction";var ld=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===Ea||De(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ea)),cd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ca=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Cr=(e,t,r,s)=>{for(const n of r||Object.keys(e)){const a=re(e,n);if(a){const{_f:i,...l}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],n)&&!s)return!0;if(i.ref&&t(i.ref,i.name)&&!s)return!0;if(Cr(l,t))break}else if(De(l)&&Cr(l,t))break}}};function Aa(e,t,r){const s=re(e,r);if(s||qn(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),i=re(t,a),l=re(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(l&&l.type)return{name:a,error:l};n.pop()}return{name:r}}var dd=(e,t,r,s)=>{r(e);const{name:n,...a}=e;return Je(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!s||ht.all))},ud=(e,t,r)=>!e||!t||e===t||Er(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),fd=(e,t,r,s,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?s.isOnBlur:n.isOnBlur)?!e:(r?s.isOnChange:n.isOnChange)?e:!0,md=(e,t)=>!Ds(re(e,t)).length&&Ie(e,t),hd=(e,t,r)=>{const s=Er(re(e,r));return Ce(s,"root",t[r]),Ce(e,r,s),e},fs=e=>Nt(e);function Ta(e,t,r="validate"){if(fs(e)||Array.isArray(e)&&e.every(fs)||lt(e)&&!e)return{type:r,message:fs(e)?e:"",ref:t}}var ar=e=>De(e)&&!ys(e)?e:{value:e,message:""},_a=async(e,t,r,s,n,a)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:f,max:p,pattern:h,validate:g,name:x,valueAsNumber:v,mount:m}=e._f,w=re(r,x);if(!m||t.has(x))return{};const y=l?l[0]:i,T=q=>{n&&y.reportValidity&&(y.setCustomValidity(lt(q)?"":q||""),y.reportValidity())},N={},_=Jn(i),A=Lr(i),S=_||A,$=(v||Gn(i))&&Re(i.value)&&Re(w)||xs(i)&&i.value===""||w===""||Array.isArray(w)&&!w.length,V=ni.bind(null,x,s,N),z=(q,D,P,E=Et.maxLength,te=Et.minLength)=>{const ne=q?D:P;N[x]={type:q?E:te,message:ne,ref:i,...V(q?E:te,ne)}};if(a?!Array.isArray(w)||!w.length:c&&(!S&&($||Ze(w))||lt(w)&&!w||A&&!li(l).isValid||_&&!di(l).isValid)){const{value:q,message:D}=fs(c)?{value:!!c,message:c}:ar(c);if(q&&(N[x]={type:Et.required,message:D,ref:y,...V(Et.required,D)},!s))return T(D),N}if(!$&&(!Ze(f)||!Ze(p))){let q,D;const P=ar(p),E=ar(f);if(!Ze(w)&&!isNaN(w)){const te=i.valueAsNumber||w&&+w;Ze(P.value)||(q=te>P.value),Ze(E.value)||(D=te<E.value)}else{const te=i.valueAsDate||new Date(w),ne=C=>new Date(new Date().toDateString()+" "+C),K=i.type=="time",le=i.type=="week";Nt(P.value)&&w&&(q=K?ne(w)>ne(P.value):le?w>P.value:te>new Date(P.value)),Nt(E.value)&&w&&(D=K?ne(w)<ne(E.value):le?w<E.value:te<new Date(E.value))}if((q||D)&&(z(!!q,P.message,E.message,Et.max,Et.min),!s))return T(N[x].message),N}if((d||u)&&!$&&(Nt(w)||a&&Array.isArray(w))){const q=ar(d),D=ar(u),P=!Ze(q.value)&&w.length>+q.value,E=!Ze(D.value)&&w.length<+D.value;if((P||E)&&(z(P,q.message,D.message),!s))return T(N[x].message),N}if(h&&!$&&Nt(w)){const{value:q,message:D}=ar(h);if(ys(q)&&!w.match(q)&&(N[x]={type:Et.pattern,message:D,ref:i,...V(Et.pattern,D)},!s))return T(D),N}if(g){if(pt(g)){const q=await g(w,r),D=Ta(q,y);if(D&&(N[x]={...D,...V(Et.validate,D.message)},!s))return T(D.message),N}else if(De(g)){let q={};for(const D in g){if(!Je(q)&&!s)break;const P=Ta(await g[D](w,r),y,D);P&&(q={...P,...V(D,P.message)},T(P.message),s&&(N[x]=q))}if(!Je(q)&&(N[x]={ref:y,...q},!s))return N}}return T(!0),N};const pd={mode:ht.onSubmit,reValidateMode:ht.onChange,shouldFocusError:!0};function bd(e={}){let t={...pd,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:pt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const s={};let n=De(t.defaultValues)||De(t.values)?qe(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:qe(n),i={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const p={array:ya(),state:ya()},h=t.criteriaMode===ht.all,g=j=>F=>{clearTimeout(d),d=setTimeout(j,F)},x=async j=>{if(!t.disabled&&(u.isValid||f.isValid||j)){const F=t.resolver?Je((await A()).errors):await $(s,!0);F!==r.isValid&&p.state.next({isValid:F})}},v=(j,F)=>{!t.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((j||Array.from(l.mount)).forEach(R=>{R&&(F?Ce(r.validatingFields,R,F):Ie(r.validatingFields,R))}),p.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},m=(j,F=[],R,X,Y=!0,Z=!0)=>{if(X&&R&&!t.disabled){if(i.action=!0,Z&&Array.isArray(re(s,j))){const ue=R(re(s,j),X.argA,X.argB);Y&&Ce(s,j,ue)}if(Z&&Array.isArray(re(r.errors,j))){const ue=R(re(r.errors,j),X.argA,X.argB);Y&&Ce(r.errors,j,ue),md(r.errors,j)}if((u.touchedFields||f.touchedFields)&&Z&&Array.isArray(re(r.touchedFields,j))){const ue=R(re(r.touchedFields,j),X.argA,X.argB);Y&&Ce(r.touchedFields,j,ue)}(u.dirtyFields||f.dirtyFields)&&(r.dirtyFields=jr(n,a)),p.state.next({name:j,isDirty:z(j,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ce(a,j,F)},w=(j,F)=>{Ce(r.errors,j,F),p.state.next({errors:r.errors})},y=j=>{r.errors=j,p.state.next({errors:r.errors,isValid:!1})},T=(j,F,R,X)=>{const Y=re(s,j);if(Y){const Z=re(a,j,Re(R)?re(n,j):R);Re(Z)||X&&X.defaultChecked||F?Ce(a,j,F?Z:Na(Y._f)):P(j,Z),i.mount&&x()}},N=(j,F,R,X,Y)=>{let Z=!1,ue=!1;const xe={name:j};if(!t.disabled){if(!R||X){(u.isDirty||f.isDirty)&&(ue=r.isDirty,r.isDirty=xe.isDirty=z(),Z=ue!==xe.isDirty);const je=It(re(n,j),F);ue=!!re(r.dirtyFields,j),je?Ie(r.dirtyFields,j):Ce(r.dirtyFields,j,!0),xe.dirtyFields=r.dirtyFields,Z=Z||(u.dirtyFields||f.dirtyFields)&&ue!==!je}if(R){const je=re(r.touchedFields,j);je||(Ce(r.touchedFields,j,R),xe.touchedFields=r.touchedFields,Z=Z||(u.touchedFields||f.touchedFields)&&je!==R)}Z&&Y&&p.state.next(xe)}return Z?xe:{}},_=(j,F,R,X)=>{const Y=re(r.errors,j),Z=(u.isValid||f.isValid)&&lt(F)&&r.isValid!==F;if(t.delayError&&R?(c=g(()=>w(j,R)),c(t.delayError)):(clearTimeout(d),c=null,R?Ce(r.errors,j,R):Ie(r.errors,j)),(R?!It(Y,R):Y)||!Je(X)||Z){const ue={...X,...Z&&lt(F)?{isValid:F}:{},errors:r.errors,name:j};r={...r,...ue},p.state.next(ue)}},A=async j=>{v(j,!0);const F=await t.resolver(a,t.context,id(j||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return v(j),F},S=async j=>{const{errors:F}=await A(j);if(j)for(const R of j){const X=re(F,R);X?Ce(r.errors,R,X):Ie(r.errors,R)}else r.errors=F;return F},$=async(j,F,R={valid:!0})=>{for(const X in j){const Y=j[X];if(Y){const{_f:Z,...ue}=Y;if(Z){const xe=l.array.has(Z.name),je=Y._f&&ld(Y._f);je&&u.validatingFields&&v([X],!0);const Fe=await _a(Y,l.disabled,a,h,t.shouldUseNativeValidation&&!F,xe);if(je&&u.validatingFields&&v([X]),Fe[Z.name]&&(R.valid=!1,F))break;!F&&(re(Fe,Z.name)?xe?hd(r.errors,Fe,Z.name):Ce(r.errors,Z.name,Fe[Z.name]):Ie(r.errors,Z.name))}!Je(ue)&&await $(ue,F,R)}}return R.valid},V=()=>{for(const j of l.unMount){const F=re(s,j);F&&(F._f.refs?F._f.refs.every(R=>!Js(R)):!Js(F._f.ref))&&W(j)}l.unMount=new Set},z=(j,F)=>!t.disabled&&(j&&F&&Ce(a,j,F),!It(C(),n)),q=(j,F,R)=>ri(j,l,{...i.mount?a:Re(F)?n:Nt(j)?{[j]:F}:F},R,F),D=j=>Ds(re(i.mount?a:n,j,t.shouldUnregister?re(n,j,[]):[])),P=(j,F,R={})=>{const X=re(s,j);let Y=F;if(X){const Z=X._f;Z&&(!Z.disabled&&Ce(a,j,ci(F,Z)),Y=xs(Z.ref)&&Ze(F)?"":F,ai(Z.ref)?[...Z.ref.options].forEach(ue=>ue.selected=Y.includes(ue.value)):Z.refs?Lr(Z.ref)?Z.refs.forEach(ue=>{(!ue.defaultChecked||!ue.disabled)&&(Array.isArray(Y)?ue.checked=!!Y.find(xe=>xe===ue.value):ue.checked=Y===ue.value||!!Y)}):Z.refs.forEach(ue=>ue.checked=ue.value===Y):Gn(Z.ref)?Z.ref.value="":(Z.ref.value=Y,Z.ref.type||p.state.next({name:j,values:qe(a)})))}(R.shouldDirty||R.shouldTouch)&&N(j,Y,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&le(j)},E=(j,F,R)=>{for(const X in F){if(!F.hasOwnProperty(X))return;const Y=F[X],Z=`${j}.${X}`,ue=re(s,Z);(l.array.has(j)||De(Y)||ue&&!ue._f)&&!Zt(Y)?E(Z,Y,R):P(Z,Y,R)}},te=(j,F,R={})=>{const X=re(s,j),Y=l.array.has(j),Z=qe(F);Ce(a,j,Z),Y?(p.array.next({name:j,values:qe(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&R.shouldDirty&&p.state.next({name:j,dirtyFields:jr(n,a),isDirty:z(j,Z)})):X&&!X._f&&!Ze(Z)?E(j,Z,R):P(j,Z,R),Ca(j,l)&&p.state.next({...r}),p.state.next({name:i.mount?j:void 0,values:qe(a)})},ne=async j=>{i.mount=!0;const F=j.target;let R=F.name,X=!0;const Y=re(s,R),Z=je=>{X=Number.isNaN(je)||Zt(je)&&isNaN(je.getTime())||It(je,re(a,R,je))},ue=Sa(t.mode),xe=Sa(t.reValidateMode);if(Y){let je,Fe;const vt=F.type?Na(Y._f):Ho(j),Me=j.type===gs.BLUR||j.type===gs.FOCUS_OUT,Vt=!cd(Y._f)&&!t.resolver&&!re(r.errors,R)&&!Y._f.deps||fd(Me,re(r.touchedFields,R),r.isSubmitted,xe,ue),Ft=Ca(R,l,Me);Ce(a,R,vt),Me?(Y._f.onBlur&&Y._f.onBlur(j),c&&c(0)):Y._f.onChange&&Y._f.onChange(j);const Ot=N(R,vt,Me),Rt=!Je(Ot)||Ft;if(!Me&&p.state.next({name:R,type:j.type,values:qe(a)}),Vt)return(u.isValid||f.isValid)&&(t.mode==="onBlur"?Me&&x():Me||x()),Rt&&p.state.next({name:R,...Ft?{}:Ot});if(!Me&&Ft&&p.state.next({...r}),t.resolver){const{errors:Dt}=await A([R]);if(Z(vt),X){const rr=Aa(r.errors,s,R),Mt=Aa(Dt,s,rr.name||R);je=Mt.error,R=Mt.name,Fe=Je(Dt)}}else v([R],!0),je=(await _a(Y,l.disabled,a,h,t.shouldUseNativeValidation))[R],v([R]),Z(vt),X&&(je?Fe=!1:(u.isValid||f.isValid)&&(Fe=await $(s,!0)));X&&(Y._f.deps&&le(Y._f.deps),_(R,Fe,je,Ot))}},K=(j,F)=>{if(re(r.errors,F)&&j.focus)return j.focus(),1},le=async(j,F={})=>{let R,X;const Y=Er(j);if(t.resolver){const Z=await S(Re(j)?j:Y);R=Je(Z),X=j?!Y.some(ue=>re(Z,ue)):R}else j?(X=(await Promise.all(Y.map(async Z=>{const ue=re(s,Z);return await $(ue&&ue._f?{[Z]:ue}:ue)}))).every(Boolean),!(!X&&!r.isValid)&&x()):X=R=await $(s);return p.state.next({...!Nt(j)||(u.isValid||f.isValid)&&R!==r.isValid?{}:{name:j},...t.resolver||!j?{isValid:R}:{},errors:r.errors}),F.shouldFocus&&!X&&Cr(s,K,j?Y:l.mount),X},C=j=>{const F={...i.mount?a:n};return Re(j)?F:Nt(j)?re(F,j):j.map(R=>re(F,R))},k=(j,F)=>({invalid:!!re((F||r).errors,j),isDirty:!!re((F||r).dirtyFields,j),error:re((F||r).errors,j),isValidating:!!re(r.validatingFields,j),isTouched:!!re((F||r).touchedFields,j)}),I=j=>{j&&Er(j).forEach(F=>Ie(r.errors,F)),p.state.next({errors:j?r.errors:{}})},U=(j,F,R)=>{const X=(re(s,j,{_f:{}})._f||{}).ref,Y=re(r.errors,j)||{},{ref:Z,message:ue,type:xe,...je}=Y;Ce(r.errors,j,{...je,...F,ref:X}),p.state.next({name:j,errors:r.errors,isValid:!1}),R&&R.shouldFocus&&X&&X.focus&&X.focus()},G=(j,F)=>pt(j)?p.state.subscribe({next:R=>j(q(void 0,F),R)}):q(j,F,!0),ee=j=>p.state.subscribe({next:F=>{ud(j.name,F.name,j.exact)&&dd(F,j.formState||u,ce,j.reRenderRoot)&&j.callback({values:{...a},...r,...F})}}).unsubscribe,M=j=>(i.mount=!0,f={...f,...j.formState},ee({...j,formState:f})),W=(j,F={})=>{for(const R of j?Er(j):l.mount)l.mount.delete(R),l.array.delete(R),F.keepValue||(Ie(s,R),Ie(a,R)),!F.keepError&&Ie(r.errors,R),!F.keepDirty&&Ie(r.dirtyFields,R),!F.keepTouched&&Ie(r.touchedFields,R),!F.keepIsValidating&&Ie(r.validatingFields,R),!t.shouldUnregister&&!F.keepDefaultValue&&Ie(n,R);p.state.next({values:qe(a)}),p.state.next({...r,...F.keepDirty?{isDirty:z()}:{}}),!F.keepIsValid&&x()},me=({disabled:j,name:F})=>{(lt(j)&&i.mount||j||l.disabled.has(F))&&(j?l.disabled.add(F):l.disabled.delete(F))},be=(j,F={})=>{let R=re(s,j);const X=lt(F.disabled)||lt(t.disabled);return Ce(s,j,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:j}},name:j,mount:!0,...F}}),l.mount.add(j),R?me({disabled:lt(F.disabled)?F.disabled:t.disabled,name:j}):T(j,!0,F.value),{...X?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:kr(F.min),max:kr(F.max),minLength:kr(F.minLength),maxLength:kr(F.maxLength),pattern:kr(F.pattern)}:{},name:j,onChange:ne,onBlur:ne,ref:Y=>{if(Y){be(j,F),R=re(s,j);const Z=Re(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ue=nd(Z),xe=R._f.refs||[];if(ue?xe.find(je=>je===Z):Z===R._f.ref)return;Ce(s,j,{_f:{...R._f,...ue?{refs:[...xe.filter(Js),Z,...Array.isArray(re(n,j))?[{}]:[]],ref:{type:Z.type,name:j}}:{ref:Z}}}),T(j,!1,void 0,Z)}else R=re(s,j,{}),R._f&&(R._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(Xo(l.array,j)&&i.action)&&l.unMount.add(j)}}},de=()=>t.shouldFocusError&&Cr(s,K,l.mount),ke=j=>{lt(j)&&(p.state.next({disabled:j}),Cr(s,(F,R)=>{const X=re(s,R);X&&(F.disabled=X._f.disabled||j,Array.isArray(X._f.refs)&&X._f.refs.forEach(Y=>{Y.disabled=X._f.disabled||j}))},0,!1))},ge=(j,F)=>async R=>{let X;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let Y=qe(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:ue}=await A();r.errors=Z,Y=ue}else await $(s);if(l.disabled.size)for(const Z of l.disabled)Ce(Y,Z,void 0);if(Ie(r.errors,"root"),Je(r.errors)){p.state.next({errors:{}});try{await j(Y,R)}catch(Z){X=Z}}else F&&await F({...r.errors},R),de(),setTimeout(de);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!X,submitCount:r.submitCount+1,errors:r.errors}),X)throw X},he=(j,F={})=>{re(s,j)&&(Re(F.defaultValue)?te(j,qe(re(n,j))):(te(j,F.defaultValue),Ce(n,j,qe(F.defaultValue))),F.keepTouched||Ie(r.touchedFields,j),F.keepDirty||(Ie(r.dirtyFields,j),r.isDirty=F.defaultValue?z(j,qe(re(n,j))):z()),F.keepError||(Ie(r.errors,j),u.isValid&&x()),p.state.next({...r}))},fe=(j,F={})=>{const R=j?qe(j):n,X=qe(R),Y=Je(j),Z=Y?n:X;if(F.keepDefaultValues||(n=R),!F.keepValues){if(F.keepDirtyValues){const ue=new Set([...l.mount,...Object.keys(jr(n,a))]);for(const xe of Array.from(ue))re(r.dirtyFields,xe)?Ce(Z,xe,re(a,xe)):te(xe,re(Z,xe))}else{if(Un&&Re(j))for(const ue of l.mount){const xe=re(s,ue);if(xe&&xe._f){const je=Array.isArray(xe._f.refs)?xe._f.refs[0]:xe._f.ref;if(xs(je)){const Fe=je.closest("form");if(Fe){Fe.reset();break}}}}for(const ue of l.mount)te(ue,re(Z,ue))}a=qe(Z),p.array.next({values:{...Z}}),p.state.next({values:{...Z}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!F.keepIsValid||!!F.keepDirtyValues,i.watch=!!t.shouldUnregister,p.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:Y?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!It(j,n)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Y?{}:F.keepDirtyValues?F.keepDefaultValues&&a?jr(n,a):r.dirtyFields:F.keepDefaultValues&&j?jr(n,j):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},pe=(j,F)=>fe(pt(j)?j(a):j,F),ye=(j,F={})=>{const R=re(s,j),X=R&&R._f;if(X){const Y=X.refs?X.refs[0]:X.ref;Y.focus&&(Y.focus(),F.shouldSelect&&pt(Y.select)&&Y.select())}},ce=j=>{r={...r,...j}},Te={control:{register:be,unregister:W,getFieldState:k,handleSubmit:ge,setError:U,_subscribe:ee,_runSchema:A,_getWatch:q,_getDirty:z,_setValid:x,_setFieldArray:m,_setDisabledField:me,_setErrors:y,_getFieldArray:D,_reset:fe,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(j=>{pe(j,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:V,_disableForm:ke,_subjects:p,_proxyFormState:u,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(j){i=j},get _defaultValues(){return n},get _names(){return l},set _names(j){l=j},get _formState(){return r},get _options(){return t},set _options(j){t={...t,...j}}},subscribe:M,trigger:le,register:be,handleSubmit:ge,watch:G,setValue:te,getValues:C,reset:pe,resetField:he,clearErrors:I,unregister:W,setError:U,setFocus:ye,getFieldState:k};return{...Te,formControl:Te}}function gd(e={}){const t=b.useRef(void 0),r=b.useRef(void 0),[s,n]=b.useState({isDirty:!1,isValidating:!1,isLoading:pt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:bd(e),formState:s},e.formControl&&e.defaultValues&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Wn(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(l=>({...l,isReady:!0})),a._formState.isReady=!0,i},[a]),b.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),b.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!Je(e.errors)&&a._setErrors(e.errors)},[a,e.errors,e.mode,e.reValidateMode]),b.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==s.isDirty&&a._subjects.state.next({isDirty:i})}},[a,s.isDirty]),b.useEffect(()=>{e.values&&!It(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,n(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=ti(s,a),t.current}const ui={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},xd={sm:"h-6",md:"h-10",lg:"h-12"},vd={sm:"px-2",md:"px-2.5",lg:"px-3"};function Fa(e,t,r,s,n,a,i){const l=t?"datetime-local":"date",c=se("box-border w-full rounded-lg border outline-none transition font-[var(--font-primary)]",ui[r],xd[r],vd[r],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]"),f=Qc(c,n?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-disabled)] cursor-not-allowed opacity-60":"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",i);return o.jsxs(o.Fragment,{children:[o.jsx("input",{id:e,type:l,disabled:n,"aria-disabled":n,"data-disabled":n?"true":"false",...s,className:f}),o.jsx("div",{children:a!=null&&a.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:a.message}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Fr(e){const{control:t,name:r,rules:s,defaultValue:n,showTime:a=!1,size:i="sm",width:l="100%",label:c,labelHidden:d=!1,hasError:u=!1,errorMessage:f="",disabled:p=!1,className:h,onChange:g}=e,x=b.useId(),v=r||x;return o.jsxs("div",{className:se("flex flex-col",h),style:{width:l,maxWidth:"100%"},children:[c&&o.jsx("label",{htmlFor:v,className:se("pb-2 text-[var(--color-ds-text-primary)]",ui[i],d&&"sr-only"),children:c}),t&&r?o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n,render:({field:m,fieldState:w})=>Fa(v,a,i,{value:m.value,onChange:m.onChange,onBlur:m.onBlur},p,w.error,h)}):Fa(v,a,i,{defaultValue:n,onChange:g},p,u?{message:f}:void 0,h)]})}const yd=({trigger:e,items:t,align:r="left",className:s})=>{const[n,a]=b.useState(!1),i=b.useRef(null),l=b.useRef([]);b.useEffect(()=>{const d=u=>{i.current&&!i.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const c=d=>{var f,p;const u=l.current.findIndex(h=>h===document.activeElement);if(d.key==="Escape")a(!1);else if(d.key==="ArrowDown"){d.preventDefault();const h=(u+1)%t.length;(f=l.current[h])==null||f.focus()}else if(d.key==="ArrowUp"){d.preventDefault();const h=(u-1+t.length)%t.length;(p=l.current[h])==null||p.focus()}};return o.jsxs("div",{className:se("relative inline-block",s),ref:i,children:[o.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"inline-flex items-center focus:outline-none","aria-haspopup":"menu","aria-expanded":n,children:e}),n&&o.jsx("div",{role:"menu","aria-orientation":"vertical",className:se("absolute mt-2 min-w-[160px] bg-[var(--color-ds-background-page)]","border border-[var(--color-ds-border-muted)] rounded shadow-lg z-10",r==="right"?"right-0":"left-0"),onKeyDown:c,children:t.map((d,u)=>{const{label:f,onSelect:p,disabled:h,icon:g}=d;return o.jsxs("button",{role:"menuitem",type:"button",disabled:h,ref:x=>{l.current[u]=x},className:se("w-full flex items-center px-4 py-2 text-[var(--color-ds-text-primary)] text-ds-md transition-colors",h?"opacity-50 cursor-not-allowed":"hover:bg-[var(--color-ds-background-surface)]"),onClick:()=>{h||(p(),a(!1))},children:[g&&o.jsx(g,{className:"w-5 h-5 mr-2 text-[var(--color-ds-text-secondary)]"}),f]},u)})})]})},wd=(e,t,r,s)=>{var a,i,l,c;const n=[r,{code:t,...s||{}}];if((i=(a=e==null?void 0:e.services)==null?void 0:a.logger)!=null&&i.forward)return e.services.logger.forward(n,"warn","react-i18next::",!0);Yt(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Oa={},jn=(e,t,r,s)=>{Yt(r)&&Oa[r]||(Yt(r)&&(Oa[r]=new Date),wd(e,t,r,s))},fi=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},kn=(e,t,r)=>{e.loadNamespaces(t,fi(e,r))},Ra=(e,t,r,s)=>{if(Yt(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return kn(e,r,s);r.forEach(n=>{e.options.ns.indexOf(n)<0&&e.options.ns.push(n)}),e.loadLanguages(t,fi(e,s))},jd=(e,t,r={})=>!t.languages||!t.languages.length?(jn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(s,n)=>{var a;if(((a=r.bindI18n)==null?void 0:a.indexOf("languageChanging"))>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!n(s.isLanguageChangingTo,e))return!1}}),Yt=e=>typeof e=="string",kd=e=>typeof e=="object"&&e!==null,Nd=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Sd={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Ed=e=>Sd[e],Cd=e=>e.replace(Nd,Ed);let Ad={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Cd};const Td=()=>Ad;let _d;const Fd=()=>_d,Od=b.createContext();class Rd{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Dd=(e,t)=>{const r=b.useRef();return b.useEffect(()=>{r.current=e},[e,t]),r.current},mi=(e,t,r,s)=>e.getFixedT(t,r,s),Md=(e,t,r,s)=>b.useCallback(mi(e,t,r,s),[e,t,r,s]),hi=(e,t={})=>{var T,N,_,A;const{i18n:r}=t,{i18n:s,defaultNS:n}=b.useContext(Od)||{},a=r||s||Fd();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Rd),!a){jn(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const S=(V,z)=>Yt(z)?z:kd(z)&&Yt(z.defaultValue)?z.defaultValue:Array.isArray(V)?V[V.length-1]:V,$=[S,{},!1];return $.t=S,$.i18n={},$.ready=!1,$}(T=a.options.react)!=null&&T.wait&&jn(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...Td(),...a.options.react,...t},{useSuspense:l,keyPrefix:c}=i;let d=n||((N=a.options)==null?void 0:N.defaultNS);d=Yt(d)?[d]:d||["translation"],(A=(_=a.reportNamespaces).addUsedNamespaces)==null||A.call(_,d);const u=(a.isInitialized||a.initializedStoreOnce)&&d.every(S=>jd(S,a,i)),f=Md(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),p=()=>f,h=()=>mi(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),[g,x]=b.useState(p);let v=d.join();t.lng&&(v=`${t.lng}${v}`);const m=Dd(v),w=b.useRef(!0);b.useEffect(()=>{const{bindI18n:S,bindI18nStore:$}=i;w.current=!0,!u&&!l&&(t.lng?Ra(a,t.lng,d,()=>{w.current&&x(h)}):kn(a,d,()=>{w.current&&x(h)})),u&&m&&m!==v&&w.current&&x(h);const V=()=>{w.current&&x(h)};return S&&(a==null||a.on(S,V)),$&&(a==null||a.store.on($,V)),()=>{w.current=!1,a&&(S==null||S.split(" ").forEach(z=>a.off(z,V))),$&&a&&$.split(" ").forEach(z=>a.store.off(z,V))}},[a,v]),b.useEffect(()=>{w.current&&u&&x(p)},[a,c,u]);const y=[g,a,u];if(y.t=g,y.i18n=a,y.ready=u,u||!u&&!l)return y;throw new Promise(S=>{t.lng?Ra(a,t.lng,d,()=>S()):kn(a,d,()=>S())})},Nn={sm:"text-sm",md:"text-base",lg:"text-lg"};function Da(e,t,r,s,n,a,i,l,c){const{t:d}=hi(),u=b.useRef(null),f=typeof s=="number"&&t.length>=s,p=()=>{var w;!i&&!f&&((w=u.current)==null||w.click())},h=w=>{const y=w.target.files;if(!y)return;const T=Array.from(y);let N=t.concat(T);s&&(N=N.slice(0,s)),r(N),w.target.value=""},g=w=>{if(w.preventDefault(),i||f)return;const y=Array.from(w.dataTransfer.files);let T=t.concat(y);s&&(T=T.slice(0,s)),r(T)},x=w=>{w.preventDefault()},v=w=>{const y=URL.createObjectURL(w);window.open(y)},m=w=>{const y=t.filter((T,N)=>N!==w);r(y)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"self-start mb-4 w-auto",children:o.jsx(ie,{type:"button",variant:"outline",size:a,icon:pa,onClick:p,disabled:i||f,children:d("ds.fileUploader.browse","Browse files")})}),!f&&o.jsxs("div",{className:se("relative flex bg-[var(--color-ds-background-page)] flex-col items-center justify-center border-2 border-dashed border-[var(--color-ds-border-muted)] rounded-lg p-4",i?"opacity-50 cursor-not-allowed":"hover:border-[var(--color-ds-border-default)]",Nn[a],c),onDrop:g,onDragOver:x,children:[o.jsx("input",{id:e,type:"file",ref:u,className:"hidden",multiple:s!==1,accept:n,onChange:h,disabled:i}),o.jsx(kt,{component:ec,size:"md",className:"w-8 h-8 text-[var(--color-ds-text-secondary)]"}),o.jsx("p",{className:"mt-3 text-[var(--color-ds-text-secondary)] text-center",children:d("ds.fileUploader.dragDrop","Drag & drop your files here or click to browse")})]}),t.length>0&&o.jsx("ul",{className:"mt-4 space-y-1",children:t.map((w,y)=>o.jsxs("li",{className:"flex items-center justify-between text-[var(--color-ds-text-secondary)] text-sm",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(pa,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),o.jsx("span",{className:"truncate pr-2",children:w.name})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{variant:"ghost",size:"sm",icon:Po,ariaLabel:d("ds.fileUploader.view","View"),onClick:()=>v(w)}),o.jsx(ie,{variant:"ghost",size:"sm",icon:Vn,ariaLabel:d("ds.fileUploader.remove","Remove"),onClick:()=>m(y)})]})]},y))}),o.jsx("div",{className:"pt-[5px] min-h-[18px] w-full",children:l!=null&&l.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l.message}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function pi(e){const{control:t,name:r,rules:s,defaultValue:n,maxFiles:a,accept:i,size:l="sm",width:c="100%",label:d,labelHidden:u=!1,disabled:f=!1,hasError:p=!1,errorMessage:h="",className:g}=e,x=b.useId(),v=r||x;if(t&&r)return o.jsxs("div",{className:se("flex flex-col",g),style:{width:c},children:[d&&o.jsx("label",{htmlFor:v,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",Nn[l],u&&"sr-only"),children:d}),o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n instanceof FileList?Array.from(n):n||[],render:({field:y,fieldState:T})=>Da(v,y.value,N=>y.onChange(N),a,i,l,f,T.error,g)})]});const[m,w]=b.useState(n instanceof FileList?Array.from(n):n||[]);return o.jsxs("div",{className:se("flex flex-col",g),style:{width:c},children:[d&&o.jsx("label",{htmlFor:v,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",Nn[l],u&&"sr-only"),children:d}),Da(v,m,w,a,i,l,f,p?{message:h}:void 0,g)]})}const Xt=({count:e=1,width:t,height:r="1em",variant:s="rect",className:n})=>{const a=Array.from({length:e});return o.jsx(o.Fragment,{children:a.map((i,l)=>o.jsx("span",{role:"status","aria-label":"Cargando...",className:se("bg-[var(--color-ds-border-muted)] animate-pulse inline-block",s==="circle"?"rounded-full":"rounded",n),style:{width:t??"auto",height:r}},l))})},Qr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},$d={sm:"h-6",md:"h-10",lg:"h-12"},Ld={sm:"px-2",md:"px-2.5",lg:"px-3"},Ma={sm:"pl-2",md:"pl-2.5",lg:"pl-3"},Pd={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function we({id:e,type:t="text",size:r="sm",width:s="100%",label:n,labelHidden:a=!1,hasError:i=!1,errorMessage:l="",prefixIcon:c,suffixIcon:d,separator:u,suffixButton:f,disabled:p=!1,control:h,name:g,rules:x,defaultValue:v,reserveErrorSpace:m,disableErrorPlaceholder:w,loading:y=!1,className:T,...N}){const _=b.useId(),[A,S]=b.useState(!1),$=e||_,V=t==="password",q=c??(t==="number"?lc:void 0),D=V?A?ac:Po:d,P=typeof m=="boolean"?m:typeof w=="boolean"?!w:!!h,E=se("box-border w-full rounded-lg border placeholder-[var(--color-ds-text-secondary)] outline-none transition font-[var(--font-primary)] appearance-none",Qr[r],$d[r],Ld[r],i?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]","bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]","disabled:bg-[var(--color-ds-background-disabled)]","disabled:border-[var(--color-ds-border-muted)]","disabled:text-[var(--color-ds-text-disabled)]","disabled:cursor-not-allowed");return y?o.jsxs("div",{className:"flex flex-col",style:{width:s,maxWidth:"100%"},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2",Qr[r]),children:n}),o.jsx(Xt,{width:"100%",height:Pd[r],variant:"rect",className:"rounded-lg"}),o.jsx("div",{className:"min-h-[18px] w-full",children:o.jsx("span",{"aria-hidden":"true",children:" "})})]}):h&&g?o.jsx(gt,{name:g,control:h,rules:x,defaultValue:v,render:({field:te,fieldState:ne})=>o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Ma[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...te,id:$,type:V?A?"text":"password":t,disabled:p,"aria-invalid":!!ne.error,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:K=>K.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full pr-2",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(K=>!K),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:ne.error?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):ne.error?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message})}):null]})}):o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Ma[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...N,id:$,type:V?A?"text":"password":t,disabled:p,"aria-invalid":i,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:te=>te.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(te=>!te),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:i&&l?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l}):o.jsx("span",{"aria-hidden":"true",children:" "})}):i&&l?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l})}):null]})}const zd={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Zs=400,es=8,Zn=({children:e,size:t="sm",position:r="top",className:s,onClick:n,ariaLabel:a="Más información"})=>{const[i,l]=b.useState(!1),[c,d]=b.useState({x:0,y:0}),u=b.useRef(null),f=b.useId();b.useEffect(()=>{if(i&&u.current){const g=u.current.getBoundingClientRect();let x=0,v=0;switch(r){case"top":x=g.left+g.width/2-Zs/2,v=g.top-es;break;case"bottom":x=g.left+g.width/2-Zs/2,v=g.bottom+es;break;case"left":x=g.left-Zs-es,v=g.top+g.height/2;break;case"right":x=g.right+es,v=g.top+g.height/2;break}d({x,y:v})}},[i,r]);const p=()=>typeof e=="string"?o.jsx("div",{dangerouslySetInnerHTML:{__html:e}}):o.jsx(o.Fragment,{children:e}),h=i?o.jsx("div",{id:f,role:"tooltip",className:se("fixed z-50 w-[250px] bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)] text-ds-sm rounded p-2 shadow-lg","pointer-events-none"),style:{top:`${c.y}px`,left:`${c.x}px`,transform:r==="left"||r==="right"?"translateY(-50%)":r==="top"?"translateY(-100%)":void 0},children:p()}):null;return o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button","aria-describedby":f,ref:u,"aria-label":a,className:se("inline-flex items-center justify-center focus:outline-none",zd[t],"text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]",s),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:n,children:o.jsx(zo,{className:"w-full h-full"})}),Jt.createPortal(h,document.body)]})};function Id({name:e,label:t,type:r="text",size:s="sm",width:n,placeholder:a,validation:i,loadingDefaults:l,disabled:c,info:d}){var v;const{control:u,formState:{errors:f}}=Pr(),p=!!f[e],h=((v=f[e])==null?void 0:v.message)||"",g="relative",x=n??"w-full";return o.jsxs("div",{className:g,children:[o.jsx(gt,{name:e,control:u,rules:i,render:({field:m})=>o.jsx(we,{label:t,size:s,width:x,placeholder:a,hasError:p,errorMessage:h,loading:l,type:r,...m,disabled:c,reserveErrorSpace:!0})}),d&&o.jsx(Zn,{size:s,position:"left",className:"absolute top-1/2 right-2 -translate-y-1/2",children:d})]})}const Yn=b.memo(Id);Yn.displayName="FormFieldInput";function Vd({title:e,headerButtons:t,children:r,className:s}){return o.jsxs("div",{className:se("flex flex-col h-full",s),children:[o.jsxs("div",{className:"flex items-center justify-between py-4",children:[o.jsx("div",{className:`bg-[var(--color-ds-background-accent)] \r
23
23
  text-[var(--color-ds-text-on-accent)] \r
24
24
  rounded-tr-[20px] \r
25
25
  pl-4 pr-10\r
26
- text-ds-lg`,children:t}),e&&l.jsx("div",{className:"flex items-center space-x-2",children:e})]}),l.jsx("main",{className:"flex-1 overflow-auto",children:s})]})}const Ya=(t,e,s)=>{if(t&&"reportValidity"in t){const r=re(s,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},Ui=(t,e)=>{for(const s in e.fields){const r=e.fields[s];r&&r.ref&&"reportValidity"in r.ref?Ya(r.ref,s,t):r&&r.refs&&r.refs.forEach(n=>Ya(n,s,t))}},xu=(t,e)=>{e.shouldUseNativeValidation&&Ui(t,e);const s={};for(const r in t){const n=re(e.fields,r),a=Object.assign(t[r]||{},{ref:n&&n.ref});if(vu(e.names||Object.keys(t),r)){const o=Object.assign({},re(s,r));Oe(o,"root",a),Oe(s,r,o)}else Oe(s,r,a)}return s},vu=(t,e)=>{const s=Xa(e);return t.some(r=>Xa(r).match(`^${s}\\.\\d+`))};function Xa(t){return t.replace(/\]|\[/g,"")}function Ki(t,e,s){return s===void 0&&(s={}),function(r,n,a){try{return Promise.resolve(function(o,i){try{var c=(e!=null&&e.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(t[s.mode==="sync"?"validateSync":"validate"](r,Object.assign({abortEarly:!1},e,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&Ui({},a),{values:s.raw?Object.assign({},r):d,errors:{}}}))}catch(d){return i(d)}return c&&c.then?c.then(void 0,i):c}(0,function(o){if(!o.inner)throw o;return{values:{},errors:xu((i=o,c=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(i.inner||[]).reduce(function(d,u){if(d[u.path]||(d[u.path]={message:u.message,type:u.type}),c){var f=d[u.path].types,p=f&&f[u.type];d[u.path]=Ri(u.path,c,d,u.type,p?[].concat(p,u.message):u.message)}return d},{})),a)};var i,c}))}catch(o){return Promise.reject(o)}}}var dn,Qa;function yu(){if(Qa)return dn;Qa=1;function t(m){this._maxSize=m,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(m){return this._values[m]},t.prototype.set=function(m,y){return this._size>=this._maxSize&&this.clear(),m in this._values||this._size++,this._values[m]=y};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,s=/^\d+$/,r=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,o=512,i=new t(o),c=new t(o),d=new t(o);dn={Cache:t,split:f,normalizePath:u,setter:function(m){var y=u(m);return c.get(m)||c.set(m,function(O,S){for(var T=0,C=y.length,N=O;T<C-1;){var _=y[T];if(_==="__proto__"||_==="constructor"||_==="prototype")return O;N=N[y[T++]]}N[y[T]]=S})},getter:function(m,y){var w=u(m);return d.get(m)||d.set(m,function(S){for(var T=0,C=w.length;T<C;)if(S!=null||!y)S=S[w[T++]];else return;return S})},join:function(m){return m.reduce(function(y,w){return y+(h(w)||s.test(w)?"["+w+"]":(y?".":"")+w)},"")},forEach:function(m,y,w){p(Array.isArray(m)?m:f(m),y,w)}};function u(m){return i.get(m)||i.set(m,f(m).map(function(y){return y.replace(a,"$2")}))}function f(m){return m.match(e)||[""]}function p(m,y,w){var O=m.length,S,T,C,N;for(T=0;T<O;T++)S=m[T],S&&(v(S)&&(S='"'+S+'"'),N=h(S),C=!N&&/^\d+$/.test(S),y.call(w,S,N,C,T,m))}function h(m){return typeof m=="string"&&m&&["'",'"'].indexOf(m.charAt(0))!==-1}function g(m){return m.match(r)&&!m.match(s)}function x(m){return n.test(m)}function v(m){return!h(m)&&(g(m)||x(m))}return dn}var es=yu(),un,eo;function wu(){if(eo)return un;eo=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=u=>u.match(t)||[],s=u=>u[0].toUpperCase()+u.slice(1),r=(u,f)=>e(u).join(f).toLowerCase(),n=u=>e(u).reduce((f,p)=>`${f}${f?p[0].toUpperCase()+p.slice(1).toLowerCase():p.toLowerCase()}`,"");return un={words:e,upperFirst:s,camelCase:n,pascalCase:u=>s(n(u)),snakeCase:u=>r(u,"_"),kebabCase:u=>r(u,"-"),sentenceCase:u=>s(r(u," ")),titleCase:u=>e(u).map(s).join(" ")},un}var fn=wu(),cr={exports:{}},to;function ju(){if(to)return cr.exports;to=1,cr.exports=function(n){return t(e(n),n)},cr.exports.array=t;function t(n,a){var o=n.length,i=new Array(o),c={},d=o,u=s(a),f=r(n);for(a.forEach(function(h){if(!f.has(h[0])||!f.has(h[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||p(n[d],d,new Set);return i;function p(h,g,x){if(x.has(h)){var v;try{v=", node was:"+JSON.stringify(h)}catch{v=""}throw new Error("Cyclic dependency"+v)}if(!f.has(h))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(h));if(!c[g]){c[g]=!0;var m=u.get(h)||new Set;if(m=Array.from(m),g=m.length){x.add(h);do{var y=m[--g];p(y,f.get(y),x)}while(g);x.delete(h)}i[--o]=h}}}function e(n){for(var a=new Set,o=0,i=n.length;o<i;o++){var c=n[o];a.add(c[0]),a.add(c[1])}return Array.from(a)}function s(n){for(var a=new Map,o=0,i=n.length;o<i;o++){var c=n[o];a.has(c[0])||a.set(c[0],new Set),a.has(c[1])||a.set(c[1],new Set),a.get(c[0]).add(c[1])}return a}function r(n){for(var a=new Map,o=0,i=n.length;o<i;o++)a.set(n[o],o);return a}return cr.exports}var ku=ju();const Su=rc(ku),Nu=Object.prototype.toString,Cu=Error.prototype.toString,Eu=RegExp.prototype.toString,Ou=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Au=/^Symbol\((.*)\)(.*)$/;function Tu(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function so(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const s=typeof t;if(s==="number")return Tu(t);if(s==="string")return e?`"${t}"`:t;if(s==="function")return"[Function "+(t.name||"anonymous")+"]";if(s==="symbol")return Ou.call(t).replace(Au,"Symbol($1)");const r=Nu.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Cu.call(t)+"]":r==="RegExp"?Eu.call(t):null}function Rt(t,e){let s=so(t,e);return s!==null?s:JSON.stringify(t,function(r,n){let a=so(this[r],e);return a!==null?a:n},2)}function qi(t){return t==null?[]:[].concat(t)}let Wi,Ji,Hi,Fu=/\$\{\s*(\w+)\s*\}/g;Wi=Symbol.toStringTag;class ro{constructor(e,s,r,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[Wi]="Error",this.name="ValidationError",this.value=s,this.path=r,this.type=n,this.errors=[],this.inner=[],qi(e).forEach(a=>{if(rt.isError(a)){this.errors.push(...a.errors);const o=a.inner.length?a.inner:[a];this.inner.push(...o)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Ji=Symbol.hasInstance;Hi=Symbol.toStringTag;class rt extends Error{static formatError(e,s){const r=s.label||s.path||"this";return s=Object.assign({},s,{path:r,originalPath:s.path}),typeof e=="string"?e.replace(Fu,(n,a)=>Rt(s[a])):typeof e=="function"?e(s):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,s,r,n,a){const o=new ro(e,s,r,n);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Hi]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,rt)}static[Ji](e){return ro[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let St={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:s,originalValue:r})=>{const n=r!=null&&r!==s?` (cast from the value \`${Rt(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Rt(s,!0)}\``+n:`${t} must match the configured type. The validated value was: \`${Rt(s,!0)}\``+n}},st={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},zt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},In={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Vn={isValue:"${path} field must be ${value}"},jr={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},kr={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Ru={notType:t=>{const{path:e,value:s,spec:r}=t,n=r.types.length;if(Array.isArray(s)){if(s.length<n)return`${e} tuple value has too few items, expected a length of ${n} but got ${s.length} for value: \`${Rt(s,!0)}\``;if(s.length>n)return`${e} tuple value has too many items, expected a length of ${n} but got ${s.length} for value: \`${Rt(s,!0)}\``}return rt.formatError(St.notType,t)}};Object.assign(Object.create(null),{mixed:St,string:st,number:zt,date:In,object:jr,array:kr,boolean:Vn,tuple:Ru});const Jr=t=>t&&t.__isYupSchema__;class Tr{static fromOptions(e,s){if(!s.then&&!s.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:n,otherwise:a}=s,o=typeof r=="function"?r:(...i)=>i.every(c=>c===r);return new Tr(e,(i,c)=>{var d;let u=o(...i)?n:a;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(e,s){this.fn=void 0,this.refs=e,this.refs=e,this.fn=s}resolve(e,s){let r=this.refs.map(a=>a.getValue(s==null?void 0:s.value,s==null?void 0:s.parent,s==null?void 0:s.context)),n=this.fn(r,e,s);if(n===void 0||n===e)return e;if(!Jr(n))throw new TypeError("conditions must return a schema object");return n.resolve(s)}}const dr={context:"$",value:"."};class ns{constructor(e,s={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===dr.context,this.isValue=this.key[0]===dr.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?dr.context:this.isValue?dr.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&es.getter(this.path,!0),this.map=s.map}getValue(e,s,r){let n=this.isContext?r:this.isValue?e:s;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,s){return this.getValue(e,s==null?void 0:s.parent,s==null?void 0:s.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}ns.prototype.__isYupRef=!0;const xt=t=>t==null;function cs(t){function e({value:s,path:r="",options:n,originalValue:a,schema:o},i,c){const{name:d,test:u,params:f,message:p,skipAbsent:h}=t;let{parent:g,context:x,abortEarly:v=o.spec.abortEarly,disableStackTrace:m=o.spec.disableStackTrace}=n;function y(z){return ns.isRef(z)?z.getValue(s,g,x):z}function w(z={}){const U=Object.assign({value:s,originalValue:a,label:o.spec.label,path:z.path||r,spec:o.spec,disableStackTrace:z.disableStackTrace||m},f,z.params);for(const $ of Object.keys(U))U[$]=y(U[$]);const D=new rt(rt.formatError(z.message||p,U),s,U.path,z.type||d,U.disableStackTrace);return D.params=U,D}const O=v?i:c;let S={path:r,parent:g,type:d,from:n.from,createError:w,resolve:y,options:n,originalValue:a,schema:o};const T=z=>{rt.isError(z)?O(z):z?c(null):O(w())},C=z=>{rt.isError(z)?O(z):i(z)};if(h&&xt(s))return T(!0);let _;try{var I;if(_=u.call(S,s,S),typeof((I=_)==null?void 0:I.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${S.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(_).then(T,C)}}catch(z){C(z);return}T(_)}return e.OPTIONS=t,e}function _u(t,e,s,r=s){let n,a,o;return e?(es.forEach(e,(i,c,d)=>{let u=c?i.slice(1,i.length-1):i;t=t.resolve({context:r,parent:n,value:s});let f=t.type==="tuple",p=d?parseInt(u,10):0;if(t.innerType||f){if(f&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(s&&p>=s.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${i}, in the path: ${e}. because there is no value at that index. `);n=s,s=s&&s[p],t=f?t.spec.types[p]:t.innerType}if(!d){if(!t.fields||!t.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${t.type}")`);n=s,s=s&&s[u],t=t.fields[u]}a=u,o=c?"["+i+"]":"."+i}),{schema:t,parent:n,parentPath:a}):{parent:n,parentPath:e,schema:t}}class Fr extends Set{describe(){const e=[];for(const s of this.values())e.push(ns.isRef(s)?s.describe():s);return e}resolveAll(e){let s=[];for(const r of this.values())s.push(e(r));return s}clone(){return new Fr(this.values())}merge(e,s){const r=this.clone();return e.forEach(n=>r.add(n)),s.forEach(n=>r.delete(n)),r}}function hs(t,e=new Map){if(Jr(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let s;if(t instanceof Date)s=new Date(t.getTime()),e.set(t,s);else if(t instanceof RegExp)s=new RegExp(t),e.set(t,s);else if(Array.isArray(t)){s=new Array(t.length),e.set(t,s);for(let r=0;r<t.length;r++)s[r]=hs(t[r],e)}else if(t instanceof Map){s=new Map,e.set(t,s);for(const[r,n]of t.entries())s.set(r,hs(n,e))}else if(t instanceof Set){s=new Set,e.set(t,s);for(const r of t)s.add(hs(r,e))}else if(t instanceof Object){s={},e.set(t,s);for(const[r,n]of Object.entries(t))s[r]=hs(n,e)}else throw Error(`Unable to clone ${t}`);return s}class ot{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Fr,this._blacklist=new Fr,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(St.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(s=>{s.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const s=Object.create(Object.getPrototypeOf(this));return s.type=this.type,s._typeCheck=this._typeCheck,s._whitelist=this._whitelist.clone(),s._blacklist=this._blacklist.clone(),s.internalTests=Object.assign({},this.internalTests),s.exclusiveTests=Object.assign({},this.exclusiveTests),s.deps=[...this.deps],s.conditions=[...this.conditions],s.tests=[...this.tests],s.transforms=[...this.transforms],s.spec=hs(Object.assign({},this.spec,e)),s}label(e){let s=this.clone();return s.spec.label=e,s}meta(...e){if(e.length===0)return this.spec.meta;let s=this.clone();return s.spec.meta=Object.assign(s.spec.meta||{},e[0]),s}withMutation(e){let s=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=s,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let s=this,r=e.clone();const n=Object.assign({},s.spec,r.spec);return r.spec=n,r.internalTests=Object.assign({},s.internalTests,r.internalTests),r._whitelist=s._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=s._blacklist.merge(e._blacklist,e._whitelist),r.tests=s.tests,r.exclusiveTests=s.exclusiveTests,r.withMutation(a=>{e.tests.forEach(o=>{a.test(o.OPTIONS)})}),r.transforms=[...s.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let s=this;if(s.conditions.length){let r=s.conditions;s=s.clone(),s.conditions=[],s=r.reduce((n,a)=>a.resolve(n,e),s),s=s.resolve(e)}return s}resolveOptions(e){var s,r,n,a;return Object.assign({},e,{from:e.from||[],strict:(s=e.strict)!=null?s:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(n=e.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=e.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(e,s={}){let r=this.resolve(Object.assign({value:e},s)),n=s.assert==="ignore-optionality",a=r._cast(e,s);if(s.assert!==!1&&!r.isType(a)){if(n&&xt(a))return a;let o=Rt(e),i=Rt(a);throw new TypeError(`The value of ${s.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
26
+ text-ds-lg`,children:e}),t&&o.jsx("div",{className:"flex items-center space-x-2",children:t})]}),o.jsx("main",{className:"flex-1 overflow-auto",children:r})]})}const $a=(e,t,r)=>{if(e&&"reportValidity"in e){const s=re(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},bi=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?$a(s.ref,r,e):s&&s.refs&&s.refs.forEach(n=>$a(n,r,e))}},Bd=(e,t)=>{t.shouldUseNativeValidation&&bi(e,t);const r={};for(const s in e){const n=re(t.fields,s),a=Object.assign(e[s]||{},{ref:n&&n.ref});if(Ud(t.names||Object.keys(e),s)){const i=Object.assign({},re(r,s));Ce(i,"root",a),Ce(r,s,i)}else Ce(r,s,a)}return r},Ud=(e,t)=>{const r=La(t);return e.some(s=>La(s).match(`^${r}\\.\\d+`))};function La(e){return e.replace(/\]|\[/g,"")}function gi(e,t,r){return r===void 0&&(r={}),function(s,n,a){try{return Promise.resolve(function(i,l){try{var c=(t!=null&&t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[r.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},t,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&bi({},a),{values:r.raw?Object.assign({},s):d,errors:{}}}))}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}(0,function(i){if(!i.inner)throw i;return{values:{},errors:Bd((l=i,c=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(l.inner||[]).reduce(function(d,u){if(d[u.path]||(d[u.path]={message:u.message,type:u.type}),c){var f=d[u.path].types,p=f&&f[u.type];d[u.path]=ni(u.path,c,d,u.type,p?[].concat(p,u.message):u.message)}return d},{})),a)};var l,c}))}catch(i){return Promise.reject(i)}}}var Ys,Pa;function qd(){if(Pa)return Ys;Pa=1;function e(m){this._maxSize=m,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(m){return this._values[m]},e.prototype.set=function(m,w){return this._size>=this._maxSize&&this.clear(),m in this._values||this._size++,this._values[m]=w};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,s=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,l=new e(i),c=new e(i),d=new e(i);Ys={Cache:e,split:f,normalizePath:u,setter:function(m){var w=u(m);return c.get(m)||c.set(m,function(T,N){for(var _=0,A=w.length,S=T;_<A-1;){var $=w[_];if($==="__proto__"||$==="constructor"||$==="prototype")return T;S=S[w[_++]]}S[w[_]]=N})},getter:function(m,w){var y=u(m);return d.get(m)||d.set(m,function(N){for(var _=0,A=y.length;_<A;)if(N!=null||!w)N=N[y[_++]];else return;return N})},join:function(m){return m.reduce(function(w,y){return w+(h(y)||r.test(y)?"["+y+"]":(w?".":"")+y)},"")},forEach:function(m,w,y){p(Array.isArray(m)?m:f(m),w,y)}};function u(m){return l.get(m)||l.set(m,f(m).map(function(w){return w.replace(a,"$2")}))}function f(m){return m.match(t)||[""]}function p(m,w,y){var T=m.length,N,_,A,S;for(_=0;_<T;_++)N=m[_],N&&(v(N)&&(N='"'+N+'"'),S=h(N),A=!S&&/^\d+$/.test(N),w.call(y,N,S,A,_,m))}function h(m){return typeof m=="string"&&m&&["'",'"'].indexOf(m.charAt(0))!==-1}function g(m){return m.match(s)&&!m.match(r)}function x(m){return n.test(m)}function v(m){return!h(m)&&(g(m)||x(m))}return Ys}var Ht=qd(),Hs,za;function Wd(){if(za)return Hs;za=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=u=>u.match(e)||[],r=u=>u[0].toUpperCase()+u.slice(1),s=(u,f)=>t(u).join(f).toLowerCase(),n=u=>t(u).reduce((f,p)=>`${f}${f?p[0].toUpperCase()+p.slice(1).toLowerCase():p.toLowerCase()}`,"");return Hs={words:t,upperFirst:r,camelCase:n,pascalCase:u=>r(n(u)),snakeCase:u=>s(u,"_"),kebabCase:u=>s(u,"-"),sentenceCase:u=>r(s(u," ")),titleCase:u=>t(u).map(r).join(" ")},Hs}var Xs=Wd(),ts={exports:{}},Ia;function Kd(){if(Ia)return ts.exports;Ia=1,ts.exports=function(n){return e(t(n),n)},ts.exports.array=e;function e(n,a){var i=n.length,l=new Array(i),c={},d=i,u=r(a),f=s(n);for(a.forEach(function(h){if(!f.has(h[0])||!f.has(h[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||p(n[d],d,new Set);return l;function p(h,g,x){if(x.has(h)){var v;try{v=", node was:"+JSON.stringify(h)}catch{v=""}throw new Error("Cyclic dependency"+v)}if(!f.has(h))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(h));if(!c[g]){c[g]=!0;var m=u.get(h)||new Set;if(m=Array.from(m),g=m.length){x.add(h);do{var w=m[--g];p(w,f.get(w),x)}while(g);x.delete(h)}l[--i]=h}}}function t(n){for(var a=new Set,i=0,l=n.length;i<l;i++){var c=n[i];a.add(c[0]),a.add(c[1])}return Array.from(a)}function r(n){for(var a=new Map,i=0,l=n.length;i<l;i++){var c=n[i];a.has(c[0])||a.set(c[0],new Set),a.has(c[1])||a.set(c[1],new Set),a.get(c[0]).add(c[1])}return a}function s(n){for(var a=new Map,i=0,l=n.length;i<l;i++)a.set(n[i],i);return a}return ts.exports}var Gd=Kd();const Jd=Cl(Gd),Zd=Object.prototype.toString,Yd=Error.prototype.toString,Hd=RegExp.prototype.toString,Xd=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Qd=/^Symbol\((.*)\)(.*)$/;function eu(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Va(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return eu(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Xd.call(e).replace(Qd,"Symbol($1)");const s=Zd.call(e).slice(8,-1);return s==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):s==="Error"||e instanceof Error?"["+Yd.call(e)+"]":s==="RegExp"?Hd.call(e):null}function Tt(e,t){let r=Va(e,t);return r!==null?r:JSON.stringify(e,function(s,n){let a=Va(this[s],t);return a!==null?a:n},2)}function xi(e){return e==null?[]:[].concat(e)}let vi,yi,wi,tu=/\$\{\s*(\w+)\s*\}/g;vi=Symbol.toStringTag;class Ba{constructor(t,r,s,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[vi]="Error",this.name="ValidationError",this.value=r,this.path=s,this.type=n,this.errors=[],this.inner=[],xi(t).forEach(a=>{if(tt.isError(a)){this.errors.push(...a.errors);const i=a.inner.length?a.inner:[a];this.inner.push(...i)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}yi=Symbol.hasInstance;wi=Symbol.toStringTag;class tt extends Error{static formatError(t,r){const s=r.label||r.path||"this";return r=Object.assign({},r,{path:s,originalPath:r.path}),typeof t=="string"?t.replace(tu,(n,a)=>Tt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,s,n,a){const i=new Ba(t,r,s,n);if(a)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[wi]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,tt)}static[yi](t){return Ba[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let jt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:s})=>{const n=s!=null&&s!==r?` (cast from the value \`${Tt(s,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Tt(r,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${Tt(r,!0)}\``+n}},et={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Pt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Sn={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},En={isValue:"${path} field must be ${value}"},ms={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},hs={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},ru={notType:e=>{const{path:t,value:r,spec:s}=e,n=s.types.length;if(Array.isArray(r)){if(r.length<n)return`${t} tuple value has too few items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``;if(r.length>n)return`${t} tuple value has too many items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``}return tt.formatError(jt.notType,e)}};Object.assign(Object.create(null),{mixed:jt,string:et,number:Pt,date:Sn,object:ms,array:hs,boolean:En,tuple:ru});const Ms=e=>e&&e.__isYupSchema__;class ws{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:n,otherwise:a}=r,i=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new ws(t,(l,c)=>{var d;let u=i(...l)?n:a;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let s=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),n=this.fn(s,t,r);if(n===void 0||n===t)return t;if(!Ms(n))throw new TypeError("conditions must return a schema object");return n.resolve(r)}}const rs={context:"$",value:"."};class tr{constructor(t,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===rs.context,this.isValue=this.key[0]===rs.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?rs.context:this.isValue?rs.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&Ht.getter(this.path,!0),this.map=r.map}getValue(t,r,s){let n=this.isContext?s:this.isValue?t:r;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}tr.prototype.__isYupRef=!0;const bt=e=>e==null;function or(e){function t({value:r,path:s="",options:n,originalValue:a,schema:i},l,c){const{name:d,test:u,params:f,message:p,skipAbsent:h}=e;let{parent:g,context:x,abortEarly:v=i.spec.abortEarly,disableStackTrace:m=i.spec.disableStackTrace}=n;function w(z){return tr.isRef(z)?z.getValue(r,g,x):z}function y(z={}){const q=Object.assign({value:r,originalValue:a,label:i.spec.label,path:z.path||s,spec:i.spec,disableStackTrace:z.disableStackTrace||m},f,z.params);for(const P of Object.keys(q))q[P]=w(q[P]);const D=new tt(tt.formatError(z.message||p,q),r,q.path,z.type||d,q.disableStackTrace);return D.params=q,D}const T=v?l:c;let N={path:s,parent:g,type:d,from:n.from,createError:y,resolve:w,options:n,originalValue:a,schema:i};const _=z=>{tt.isError(z)?T(z):z?c(null):T(y())},A=z=>{tt.isError(z)?T(z):l(z)};if(h&&bt(r))return _(!0);let $;try{var V;if($=u.call(N,r,N),typeof((V=$)==null?void 0:V.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${N.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve($).then(_,A)}}catch(z){A(z);return}_($)}return t.OPTIONS=e,t}function su(e,t,r,s=r){let n,a,i;return t?(Ht.forEach(t,(l,c,d)=>{let u=c?l.slice(1,l.length-1):l;e=e.resolve({context:s,parent:n,value:r});let f=e.type==="tuple",p=d?parseInt(u,10):0;if(e.innerType||f){if(f&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);n=r,r=r&&r[p],e=f?e.spec.types[p]:e.innerType}if(!d){if(!e.fields||!e.fields[u])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e.type}")`);n=r,r=r&&r[u],e=e.fields[u]}a=u,i=c?"["+l+"]":"."+l}),{schema:e,parent:n,parentPath:a}):{parent:n,parentPath:t,schema:e}}class js extends Set{describe(){const t=[];for(const r of this.values())t.push(tr.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const s of this.values())r.push(t(s));return r}clone(){return new js(this.values())}merge(t,r){const s=this.clone();return t.forEach(n=>s.add(n)),r.forEach(n=>s.delete(n)),s}}function cr(e,t=new Map){if(Ms(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let s=0;s<e.length;s++)r[s]=cr(e[s],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[s,n]of e.entries())r.set(s,cr(n,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const s of e)r.add(cr(s,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[s,n]of Object.entries(e))r[s]=cr(n,t)}else throw Error(`Unable to clone ${e}`);return r}class nt{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new js,this._blacklist=new js,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(jt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=cr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let s=t(this);return this._mutate=r,s}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,s=t.clone();const n=Object.assign({},r.spec,s.spec);return s.spec=n,s.internalTests=Object.assign({},r.internalTests,s.internalTests),s._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),s._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),s.tests=r.tests,s.exclusiveTests=r.exclusiveTests,s.withMutation(a=>{t.tests.forEach(i=>{a.test(i.OPTIONS)})}),s.transforms=[...r.transforms,...s.transforms],s}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let s=r.conditions;r=r.clone(),r.conditions=[],r=s.reduce((n,a)=>a.resolve(n,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,s,n,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(s=t.abortEarly)!=null?s:this.spec.abortEarly,recursive:(n=t.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let s=this.resolve(Object.assign({value:t},r)),n=r.assert==="ignore-optionality",a=s._cast(t,r);if(r.assert!==!1&&!s.isType(a)){if(n&&bt(a))return a;let i=Tt(t),l=Tt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
27
27
 
28
- attempted value: ${o}
29
- `+(i!==o?`result of cast: ${i}`:""))}return a}_cast(e,s){let r=e===void 0?e:this.transforms.reduce((n,a)=>a.call(this,n,e,this),e);return r===void 0&&(r=this.getDefault(s)),r}_validate(e,s={},r,n){let{path:a,originalValue:o=e,strict:i=this.spec.strict}=s,c=e;i||(c=this._cast(c,Object.assign({assert:!1},s)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:a,value:c,originalValue:o,options:s,tests:d},r,u=>{if(u.length)return n(u,c);this.runTests({path:a,value:c,originalValue:o,options:s,tests:this.tests},r,n)})}runTests(e,s,r){let n=!1,{tests:a,value:o,originalValue:i,path:c,options:d}=e,u=x=>{n||(n=!0,s(x,o))},f=x=>{n||(n=!0,r(x,o))},p=a.length,h=[];if(!p)return f([]);let g={value:o,originalValue:i,path:c,options:d,schema:this};for(let x=0;x<a.length;x++){const v=a[x];v(g,u,function(y){y&&(Array.isArray(y)?h.push(...y):h.push(y)),--p<=0&&f(h)})}}asNestedTest({key:e,index:s,parent:r,parentPath:n,originalParent:a,options:o}){const i=e??s;if(i==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof i=="number";let d=r[i];const u=Object.assign({},o,{strict:!0,parent:r,value:d,originalValue:a[i],key:void 0,[c?"index":"key"]:i,path:c||i.includes(".")?`${n||""}[${c?i:`"${i}"`}]`:(n?`${n}.`:"")+e});return(f,p,h)=>this.resolve(u)._validate(d,u,p,h)}validate(e,s){var r;let n=this.resolve(Object.assign({},s,{value:e})),a=(r=s==null?void 0:s.disableStackTrace)!=null?r:n.spec.disableStackTrace;return new Promise((o,i)=>n._validate(e,s,(c,d)=>{rt.isError(c)&&(c.value=d),i(c)},(c,d)=>{c.length?i(new rt(c,d,void 0,void 0,a)):o(d)}))}validateSync(e,s){var r;let n=this.resolve(Object.assign({},s,{value:e})),a,o=(r=s==null?void 0:s.disableStackTrace)!=null?r:n.spec.disableStackTrace;return n._validate(e,Object.assign({},s,{sync:!0}),(i,c)=>{throw rt.isError(i)&&(i.value=c),i},(i,c)=>{if(i.length)throw new rt(i,e,void 0,void 0,o);a=c}),a}isValid(e,s){return this.validate(e,s).then(()=>!0,r=>{if(rt.isError(r))return!1;throw r})}isValidSync(e,s){try{return this.validateSync(e,s),!0}catch(r){if(rt.isError(r))return!1;throw r}}_getDefault(e){let s=this.spec.default;return s==null?s:typeof s=="function"?s.call(this,e):hs(s)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,s){const r=this.clone({nullable:e});return r.internalTests.nullable=cs({message:s,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),r}optionality(e,s){const r=this.clone({optional:e});return r.internalTests.optionality=cs({message:s,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=St.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=St.notNull){return this.nullability(!1,e)}required(e=St.required){return this.clone().withMutation(s=>s.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let s=this.clone();return s.transforms.push(e),s}test(...e){let s;if(e.length===1?typeof e[0]=="function"?s={test:e[0]}:s=e[0]:e.length===2?s={name:e[0],test:e[1]}:s={name:e[0],message:e[1],test:e[2]},s.message===void 0&&(s.message=St.default),typeof s.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),n=cs(s),a=s.exclusive||s.name&&r.exclusiveTests[s.name]===!0;if(s.exclusive&&!s.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return s.name&&(r.exclusiveTests[s.name]=!!s.exclusive),r.tests=r.tests.filter(o=>!(o.OPTIONS.name===s.name&&(a||o.OPTIONS.test===n.OPTIONS.test))),r.tests.push(n),r}when(e,s){!Array.isArray(e)&&typeof e!="string"&&(s=e,e=".");let r=this.clone(),n=qi(e).map(a=>new ns(a));return n.forEach(a=>{a.isSibling&&r.deps.push(a.key)}),r.conditions.push(typeof s=="function"?new Tr(n,s):Tr.fromOptions(n,s)),r}typeError(e){let s=this.clone();return s.internalTests.typeError=cs({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),s}oneOf(e,s=St.oneOf){let r=this.clone();return e.forEach(n=>{r._whitelist.add(n),r._blacklist.delete(n)}),r.internalTests.whiteList=cs({message:s,name:"oneOf",skipAbsent:!0,test(n){let a=this.schema._whitelist,o=a.resolveAll(this.resolve);return o.includes(n)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:o}})}}),r}notOneOf(e,s=St.notOneOf){let r=this.clone();return e.forEach(n=>{r._blacklist.add(n),r._whitelist.delete(n)}),r.internalTests.blacklist=cs({message:s,name:"notOneOf",test(n){let a=this.schema._blacklist,o=a.resolveAll(this.resolve);return o.includes(n)?this.createError({params:{values:Array.from(a).join(", "),resolved:o}}):!0}}),r}strip(e=!0){let s=this.clone();return s.spec.strip=e,s}describe(e){const s=(e?this.resolve(e):this).clone(),{label:r,meta:n,optional:a,nullable:o}=s.spec;return{meta:n,label:r,optional:a,nullable:o,default:s.getDefault(e),type:s.type,oneOf:s._whitelist.describe(),notOneOf:s._blacklist.describe(),tests:s.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(f=>f.name===c.name)===d)}}}ot.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ot.prototype[`${t}At`]=function(e,s,r={}){const{parent:n,parentPath:a,schema:o}=_u(this,e,s,r.context);return o[t](n&&n[a],Object.assign({},r,{parent:n,path:e}))};for(const t of["equals","is"])ot.prototype[t]=ot.prototype.oneOf;for(const t of["not","nope"])ot.prototype[t]=ot.prototype.notOneOf;const Du=()=>!0;function zn(t){return new Gi(t)}class Gi extends ot{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:Du},e))}}zn.prototype=Gi.prototype;function Zi(){return new Yi}class Yi extends ot{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,s,r)=>{if(r.spec.coerce&&!r.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=Vn.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(s){return xt(s)||s===!0}})}isFalse(e=Vn.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(s){return xt(s)||s===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}Zi.prototype=Yi.prototype;const $u=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lu(t){const e=Bn(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let s=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(s=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(s=0-s)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+s,e.second,e.millisecond)}function Bn(t){var e,s;const r=$u.exec(t);return r?{year:Tt(r[1]),month:Tt(r[2],1)-1,day:Tt(r[3],1),hour:Tt(r[4]),minute:Tt(r[5]),second:Tt(r[6]),millisecond:r[7]?Tt(r[7].substring(0,3)):0,precision:(e=(s=r[7])==null?void 0:s.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:Tt(r[10]),minuteOffset:Tt(r[11])}:null}function Tt(t,e=0){return Number(t)||e}let Mu=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Pu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Iu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vu="^\\d{4}-\\d{2}-\\d{2}",zu="\\d{2}:\\d{2}:\\d{2}",Bu="(([+-]\\d{2}(:?\\d{2})?)|Z)",Uu=new RegExp(`${Vu}T${zu}(\\.\\d+)?${Bu}$`),Ku=t=>xt(t)||t===t.trim(),qu={}.toString();function fs(){return new Xi}class Xi extends ot{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,s,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const n=e!=null&&e.toString?e.toString():e;return n===qu?e:n})})}required(e){return super.required(e).withMutation(s=>s.test({message:e||St.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(s=>s.OPTIONS.name!=="required"),e))}length(e,s=st.length){return this.test({message:s,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,s=st.min){return this.test({message:s,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,s=st.max){return this.test({name:"max",exclusive:!0,message:s,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,s){let r=!1,n,a;return s&&(typeof s=="object"?{excludeEmptyString:r=!1,message:n,name:a}=s:n=s),this.test({name:a||"matches",message:n||st.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=st.email){return this.matches(Mu,{name:"email",message:e,excludeEmptyString:!0})}url(e=st.url){return this.matches(Pu,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=st.uuid){return this.matches(Iu,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let s="",r,n;return e&&(typeof e=="object"?{message:s="",allowOffset:r=!1,precision:n=void 0}=e:s=e),this.matches(Uu,{name:"datetime",message:s||st.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:s||st.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:a=>{if(!a||r)return!0;const o=Bn(a);return o?!!o.z:!1}}).test({name:"datetime_precision",message:s||st.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const o=Bn(a);return o?o.precision===n:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=st.trim){return this.transform(s=>s!=null?s.trim():s).test({message:e,name:"trim",test:Ku})}lowercase(e=st.lowercase){return this.transform(s=>xt(s)?s:s.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:s=>xt(s)||s===s.toLowerCase()})}uppercase(e=st.uppercase){return this.transform(s=>xt(s)?s:s.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:s=>xt(s)||s===s.toUpperCase()})}}fs.prototype=Xi.prototype;let Wu=t=>t!=+t;function Qi(){return new el}class el extends ot{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!Wu(e)}}),this.withMutation(()=>{this.transform((e,s,r)=>{if(!r.spec.coerce)return e;let n=e;if(typeof n=="string"){if(n=n.replace(/\s/g,""),n==="")return NaN;n=+n}return r.isType(n)||n===null?n:parseFloat(n)})})}min(e,s=zt.min){return this.test({message:s,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r>=this.resolve(e)}})}max(e,s=zt.max){return this.test({message:s,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r<=this.resolve(e)}})}lessThan(e,s=zt.lessThan){return this.test({message:s,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(r){return r<this.resolve(e)}})}moreThan(e,s=zt.moreThan){return this.test({message:s,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=zt.positive){return this.moreThan(0,e)}negative(e=zt.negative){return this.lessThan(0,e)}integer(e=zt.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:s=>Number.isInteger(s)})}truncate(){return this.transform(e=>xt(e)?e:e|0)}round(e){var s;let r=["ceil","floor","round","trunc"];if(e=((s=e)==null?void 0:s.toLowerCase())||"round",e==="trunc")return this.truncate();if(r.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(n=>xt(n)?n:Math[e](n))}}Qi.prototype=el.prototype;let tl=new Date(""),Ju=t=>Object.prototype.toString.call(t)==="[object Date]";function ha(){return new Js}class Js extends ot{constructor(){super({type:"date",check(e){return Ju(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,s,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Lu(e),isNaN(e)?Js.INVALID_DATE:new Date(e)))})}prepareParam(e,s){let r;if(ns.isRef(e))r=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${s}\` must be a Date or a value that can be \`cast()\` to a Date`);r=n}return r}min(e,s=In.min){let r=this.prepareParam(e,"min");return this.test({message:s,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(n){return n>=this.resolve(r)}})}max(e,s=In.max){let r=this.prepareParam(e,"max");return this.test({message:s,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(n){return n<=this.resolve(r)}})}}Js.INVALID_DATE=tl;ha.prototype=Js.prototype;ha.INVALID_DATE=tl;function Hu(t,e=[]){let s=[],r=new Set,n=new Set(e.map(([o,i])=>`${o}-${i}`));function a(o,i){let c=es.split(o)[0];r.add(c),n.has(`${i}-${c}`)||s.push([i,c])}for(const o of Object.keys(t)){let i=t[o];r.add(o),ns.isRef(i)&&i.isSibling?a(i.path,o):Jr(i)&&"deps"in i&&i.deps.forEach(c=>a(c,o))}return Su.array(Array.from(r),s).reverse()}function no(t,e){let s=1/0;return t.some((r,n)=>{var a;if((a=e.path)!=null&&a.includes(r))return s=n,!0}),s}function sl(t){return(e,s)=>no(t,e)-no(t,s)}const rl=(t,e,s)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return s.isType(r)?r:t};function Sr(t){if("fields"in t){const e={};for(const[s,r]of Object.entries(t.fields))e[s]=Sr(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Sr(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Sr)}):"optional"in t?t.optional():t}const Gu=(t,e)=>{const s=[...es.normalizePath(e)];if(s.length===1)return s[0]in t;let r=s.pop(),n=es.getter(es.join(s),!0)(t);return!!(n&&r in n)};let ao=t=>Object.prototype.toString.call(t)==="[object Object]";function oo(t,e){let s=Object.keys(t.fields);return Object.keys(e).filter(r=>s.indexOf(r)===-1)}const Zu=sl([]);function nl(t){return new al(t)}class al extends ot{constructor(e){super({type:"object",check(s){return ao(s)||typeof s=="function"}}),this.fields=Object.create(null),this._sortErrors=Zu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,s={}){var r;let n=super._cast(e,s);if(n===void 0)return this.getDefault(s);if(!this._typeCheck(n))return n;let a=this.fields,o=(r=s.stripUnknown)!=null?r:this.spec.noUnknown,i=[].concat(this._nodes,Object.keys(n).filter(f=>!this._nodes.includes(f))),c={},d=Object.assign({},s,{parent:c,__validating:s.__validating||!1}),u=!1;for(const f of i){let p=a[f],h=f in n;if(p){let g,x=n[f];d.path=(s.path?`${s.path}.`:"")+f,p=p.resolve({value:x,context:s.context,parent:c});let v=p instanceof ot?p.spec:void 0,m=v==null?void 0:v.strict;if(v!=null&&v.strip){u=u||f in n;continue}g=!s.__validating||!m?p.cast(n[f],d):n[f],g!==void 0&&(c[f]=g)}else h&&!o&&(c[f]=n[f]);(h!==f in c||c[f]!==n[f])&&(u=!0)}return u?c:n}_validate(e,s={},r,n){let{from:a=[],originalValue:o=e,recursive:i=this.spec.recursive}=s;s.from=[{schema:this,value:o},...a],s.__validating=!0,s.originalValue=o,super._validate(e,s,r,(c,d)=>{if(!i||!ao(d)){n(c,d);return}o=o||d;let u=[];for(let f of this._nodes){let p=this.fields[f];!p||ns.isRef(p)||u.push(p.asNestedTest({options:s,key:f,parent:d,parentPath:s.path,originalParent:o}))}this.runTests({tests:u,value:d,originalValue:o,options:s},r,f=>{n(f.sort(this._sortErrors).concat(c),d)})})}clone(e){const s=super.clone(e);return s.fields=Object.assign({},this.fields),s._nodes=this._nodes,s._excludedEdges=this._excludedEdges,s._sortErrors=this._sortErrors,s}concat(e){let s=super.concat(e),r=s.fields;for(let[n,a]of Object.entries(this.fields)){const o=r[n];r[n]=o===void 0?a:o}return s.withMutation(n=>n.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let s={};return this._nodes.forEach(r=>{var n;const a=this.fields[r];let o=e;(n=o)!=null&&n.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[r]})),s[r]=a&&"getDefault"in a?a.getDefault(o):void 0}),s}setFields(e,s){let r=this.clone();return r.fields=e,r._nodes=Hu(e,s),r._sortErrors=sl(Object.keys(e)),s&&(r._excludedEdges=s),r}shape(e,s=[]){return this.clone().withMutation(r=>{let n=r._excludedEdges;return s.length&&(Array.isArray(s[0])||(s=[s]),n=[...r._excludedEdges,...s]),r.setFields(Object.assign(r.fields,e),n)})}partial(){const e={};for(const[s,r]of Object.entries(this.fields))e[s]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Sr(this)}pick(e){const s={};for(const r of e)this.fields[r]&&(s[r]=this.fields[r]);return this.setFields(s,this._excludedEdges.filter(([r,n])=>e.includes(r)&&e.includes(n)))}omit(e){const s=[];for(const r of Object.keys(this.fields))e.includes(r)||s.push(r);return this.pick(s)}from(e,s,r){let n=es.getter(e,!0);return this.transform(a=>{if(!a)return a;let o=a;return Gu(a,e)&&(o=Object.assign({},a),r||delete o[e],o[s]=n(a)),o})}json(){return this.transform(rl)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||jr.exact,test(s){if(s==null)return!0;const r=oo(this.schema,s);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,s=jr.noUnknown){typeof e!="boolean"&&(s=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:s,test(n){if(n==null)return!0;const a=oo(this.schema,n);return!e||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,s=jr.noUnknown){return this.noUnknown(!e,s)}transformKeys(e){return this.transform(s=>{if(!s)return s;const r={};for(const n of Object.keys(s))r[e(n)]=s[n];return r})}camelCase(){return this.transformKeys(fn.camelCase)}snakeCase(){return this.transformKeys(fn.snakeCase)}constantCase(){return this.transformKeys(e=>fn.snakeCase(e).toUpperCase())}describe(e){const s=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[a,o]of Object.entries(s.fields)){var n;let i=e;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[a]})),r.fields[a]=o.describe(i)}return r}}nl.prototype=al.prototype;function Un(t){return new ol(t)}class ol extends ot{constructor(e){super({type:"array",spec:{types:e},check(s){return Array.isArray(s)}}),this.innerType=void 0,this.innerType=e}_cast(e,s){const r=super._cast(e,s);if(!this._typeCheck(r)||!this.innerType)return r;let n=!1;const a=r.map((o,i)=>{const c=this.innerType.cast(o,Object.assign({},s,{path:`${s.path||""}[${i}]`}));return c!==o&&(n=!0),c});return n?a:r}_validate(e,s={},r,n){var a;let o=this.innerType,i=(a=s.recursive)!=null?a:this.spec.recursive;s.originalValue!=null&&s.originalValue,super._validate(e,s,r,(c,d)=>{var u;if(!i||!o||!this._typeCheck(d)){n(c,d);return}let f=new Array(d.length);for(let h=0;h<d.length;h++){var p;f[h]=o.asNestedTest({options:s,index:h,parent:d,parentPath:s.path,originalParent:(p=s.originalValue)!=null?p:e})}this.runTests({value:d,tests:f,originalValue:(u=s.originalValue)!=null?u:e,options:s},r,h=>n(h.concat(c),d))})}clone(e){const s=super.clone(e);return s.innerType=this.innerType,s}json(){return this.transform(rl)}concat(e){let s=super.concat(e);return s.innerType=this.innerType,e.innerType&&(s.innerType=s.innerType?s.innerType.concat(e.innerType):e.innerType),s}of(e){let s=this.clone();if(!Jr(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Rt(e));return s.innerType=e,s.spec=Object.assign({},s.spec,{types:e}),s}length(e,s=kr.length){return this.test({message:s,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,s){return s=s||kr.min,this.test({message:s,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,s){return s=s||kr.max,this.test({message:s,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,s)=>this._typeCheck(e)?e:s==null?[]:[].concat(s))}compact(e){let s=e?(r,n,a)=>!e(r,n,a):r=>!!r;return this.transform(r=>r!=null?r.filter(s):r)}describe(e){const s=(e?this.resolve(e):this).clone(),r=super.describe(e);if(s.innerType){var n;let a=e;(n=a)!=null&&n.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),r.innerType=s.innerType.describe(a)}return r}}Un.prototype=ol.prototype;function Yu(t){return t.validation??{}}function Xu(t){return!!t.multiple}function hn(t){const e=t.maxFiles;return typeof e=="number"?e:void 0}function Ft(t,e){return e.required?t.required(e.requiredMessage||"Requerido"):t}function ur(t,e){var r,n,a;let s=t;return((r=e.minLength)==null?void 0:r.value)!=null&&(s=s.min(e.minLength.value,e.minLength.message||`Mín. ${e.minLength.value} caracteres`)),((n=e.maxLength)==null?void 0:n.value)!=null&&(s=s.max(e.maxLength.value,e.maxLength.message||`Máx. ${e.maxLength.value} caracteres`)),((a=e.pattern)==null?void 0:a.value)instanceof RegExp&&(s=s.matches(e.pattern.value,e.pattern.message||"Formato inválido")),s}function Qu(t){var s;const e=Yu(t);switch(t.type){case"text":case"password":{let r=fs().trim();return r=ur(r,e),Ft(r,e)}case"email":{let r=fs().trim().email(e.emailMessage||"Email inválido");return r=ur(r,e),Ft(r,e)}case"number":{let r=Qi().transform((n,a)=>a===""||a===null?void 0:n).typeError(e.typeError||"Debe ser un número");return((s=e.pattern)==null?void 0:s.value)instanceof RegExp&&(r=r.test("pattern-number",e.pattern.message||"Formato inválido",n=>n==null||e.pattern.value.test(String(n)))),Ft(r,e)}case"select":{if(Xu(t)){const n=Un().of(fs());return Ft(n,e)}let r=fs().trim();return r=ur(r,e),Ft(r,e)}case"checkbox":{let r=Zi();return e.required&&(r=r.oneOf([!0],e.requiredMessage||"Debes marcar esta casilla")),r}case"textarea":{let r=fs().trim();return r=ur(r,e),Ft(r,e)}case"date":{const r=ha().typeError(e.typeError||"Fecha inválida").transform((n,a)=>a?new Date(a):void 0);return Ft(r,e)}case"file":{const r=Un().of(zn()).test("max-files",hn(t)?`Máx. ${hn(t)} fichero(s)`:"Número de ficheros inválido",n=>{const a=hn(t);return!Array.isArray(n)||!a||n.length<=a});return Ft(r,e)}default:{const r=zn();return Ft(r,e)}}}function il(t){const e={};for(const s of t.fields){const r=s;r.name&&(e[r.name]=Qu(r))}return nl(e)}function Hs({options:t,value:e,onChange:s,children:r}){const n=b.useRef(null),[a,o]=b.useState({left:0,width:0});return b.useLayoutEffect(()=>{const i=n.current;if(!i)return;const c=()=>{const d=t.findIndex(v=>v.value===e);if(d<0)return;const u=i.children[d],f=u.querySelector("span"),p=(f==null?void 0:f.offsetWidth)??u.offsetWidth,h=u.offsetWidth,x=u.offsetLeft+(h-p)/2;o({left:x,width:p})};return c(),window.addEventListener("resize",c),i.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),i.removeEventListener("scroll",c)}},[e,t]),l.jsxs("div",{children:[l.jsxs("div",{className:"relative",children:[l.jsx("ul",{ref:n,role:"tablist",className:"flex justify-center overflow-x-auto border-b border-[var(--color-ds-border-default-50)]",children:t.map(i=>{const c=i.value===e;return l.jsx("li",{role:"tab","aria-selected":c,onClick:()=>s(i.value),className:ne("cursor-pointer whitespace-nowrap px-4 py-2 transition-colors duration-150 ease-in-out",c?"text-[var(--color-ds-background-accent)]":"text-[var(--color-ds-text-primary)]"),children:l.jsx("span",{className:"inline-block",children:i.label})},i.value)})}),l.jsx("span",{className:"absolute bottom-0 h-1 bg-[var(--color-ds-background-accent)] transition-all duration-200 ease-in-out rounded-t-full",style:{left:a.left,width:a.width}})]}),l.jsx("div",{className:"mt-4 pb-4 border-b border-[var(--color-ds-border-default-50)]",children:r[e]})]})}const fr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},io={sm:"h-6",md:"h-10",lg:"h-12"},lo={sm:"px-2",md:"px-2.5",lg:"px-3"},co={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function uo({id:t,size:e,disabled:s,error:r,reserveErrorSpace:n,className:a,suffixButton:o,children:i}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative flex items-center w-full",children:[i,o&&l.jsx("div",{className:"flex items-center h-full pr-2",children:o})]}),n?l.jsx("div",{className:"min-h-[18px] w-full",children:r!=null&&r.message?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:r.message}):l.jsx("span",{"aria-hidden":"true",children:" "})}):r!=null&&r.message?l.jsx("div",{className:"pt-1",children:l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:r.message})}):null]})}function nt(t){const{control:e,name:s,rules:r,defaultValue:n,options:a=[],loadOptions:o,reloadDeps:i=[],value:c,onChange:d,size:u="sm",width:f="100%",label:p,labelHidden:h=!1,hasError:g=!1,errorMessage:x="",reserveErrorSpace:v,disableErrorPlaceholder:m,disabled:y=!1,className:w,suffixButton:O,loading:S=!1,coerceFirstValid:T=!0}=t,C=b.useId(),N=s||C,[_,I]=b.useState(a),[z,U]=b.useState(!!o);b.useEffect(()=>{o&&(U(!0),o().then(E=>I(E)).finally(()=>U(!1)))},[o,...i]);const D=E=>E.find(Z=>Z.value!==""&&Z.value!==void 0)??E[0],$=typeof v=="boolean"?v:!!e;if(e&&s){const{field:E,fieldState:Z}=Fi({name:s,control:e,rules:r,defaultValue:n});return b.useEffect(()=>{if(!z&&_.length>0&&T){const se=E.value,q=_.some(ae=>String(ae.value)===String(se));(se===void 0||!q)&&E.onChange(D(_).value)}},[_,z,E,T]),l.jsxs("div",{className:ne("flex flex-col",w),style:{width:f,maxWidth:"100%"},children:[p&&l.jsx("label",{htmlFor:N,className:ne("pb-2 text-[var(--color-ds-text-primary)]",fr[u],h&&"sr-only"),children:p}),S||z?l.jsx(ts,{width:"100%",height:co[u],variant:"rect",className:"rounded-lg"}):l.jsx(uo,{id:N,size:u,disabled:y,error:Z.error,reserveErrorSpace:typeof m=="boolean"?!m:$,className:w,suffixButton:O,children:l.jsx("select",{id:N,value:E.value,onChange:se=>E.onChange(se.target.value),disabled:y,className:ne("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",fr[u],io[u],lo[u],Z.error?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",y?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",w),children:_.map(se=>l.jsx("option",{value:se.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:se.label},se.value))})})]})}return b.useEffect(()=>{if(!e&&_.length>0&&T){const E=_.some(se=>String(se.value)===String(c));(c===void 0||c===""||!E)&&d&&d(D(_).value)}},[_,c,d,e,T]),l.jsxs("div",{className:ne("flex flex-col",w),style:{width:f,maxWidth:"100%"},children:[p&&l.jsx("label",{htmlFor:N,className:ne("pb-2 text-[var(--color-ds-text-primary)]",fr[u],h&&"sr-only"),children:p}),S||z?l.jsx(ts,{width:"100%",height:co[u],variant:"rect",className:"rounded-lg"}):l.jsx(uo,{id:N,size:u,disabled:y,error:g?{message:x}:void 0,reserveErrorSpace:typeof m=="boolean"?!m:!!(v??!1),className:w,suffixButton:O,children:l.jsx("select",{id:N,value:c,onChange:E=>d==null?void 0:d(E.target.value),disabled:y,className:ne("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",fr[u],io[u],lo[u],g?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",y?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",w),children:_.map(E=>l.jsx("option",{value:E.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:E.label},E.value))})})]})}const fo={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function ll({groupLabel:t,inputs:e=[],separator:s=l.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:r=!0,className:n,showVisibleLabel:a=!1,size:o="sm",width:i}){const c=e.length;return l.jsxs("div",{className:ne("flex flex-col",n),style:i?{width:i}:void 0,children:[l.jsx("label",{className:ne("sr-only pb-2",fo[o]),children:t}),a&&l.jsx("label",{className:ne("pb-2",fo[o]),children:t}),l.jsx("div",{className:"flex items-center flex-nowrap",children:e.map((d,u)=>{const{width:f,className:p,options:h,loadOptions:g,...x}=d,v=Array.isArray(h)||typeof g=="function";let m="rounded-lg";!r&&c>1&&(u===0?m="rounded-l-lg rounded-r-none":u===c-1?m="rounded-r-lg rounded-l-none !rounded-l-none":m="rounded-none !rounded-l-none !rounded-r-none");const y=[],w=typeof f=="string"&&f.split(/\s+/).some(C=>C.startsWith("w-")||C.includes(":w-")),O=ne("inline-flex items-center flex-shrink-0",typeof f=="string"&&w?f:void 0,!r&&c>1&&u>0?"-ml-px focus-within:z-10 relative":void 0),S=typeof f=="string"&&!w?{width:f}:void 0,T=ne(p,m,y);return l.jsxs("div",{className:O,style:S,children:[v?l.jsx(nt,{...x,size:o,className:T,options:h,loadOptions:g}):l.jsx(je,{...x,size:o,className:T}),r&&u<c-1&&s]},u)})})]})}const ho={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ef={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function cl({groupLabel:t,options:e,control:s,name:r,rules:n,defaultValue:a,multiple:o=!0,size:i="sm",vertical:c=!0,className:d,showVisibleLabel:u=!0}){return l.jsx(vt,{name:r,control:s,rules:n,defaultValue:a,render:({field:f,fieldState:p})=>{const{value:h,onChange:g}=f;p.error;const x=m=>o?Array.isArray(h)&&h.includes(m):h===m,v=m=>{if(o){const y=Array.isArray(h)?[...h]:[],w=y.indexOf(m);w>=0?y.splice(w,1):y.push(m),g(y)}else g(m)};return l.jsxs("div",{className:ne("w-full",d),children:[l.jsx("label",{className:ne("sr-only pb-2 text-[var(--color-ds-text-primary)]",ho[i]),children:t}),u&&l.jsx("label",{className:ne("block pb-2 text-[var(--color-ds-text-primary)]",ho[i]),children:t}),l.jsx("div",{className:ne(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:e.map(m=>l.jsxs("label",{className:"inline-flex items-center space-x-2 cursor-pointer select-none",children:[l.jsx("input",{type:o?"checkbox":"radio",name:r,value:m.value,checked:x(m.value),onChange:()=>v(m.value),className:ne(ef[i],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]")}),l.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-md",children:m.label})]},m.value))})]})}})}function tf(t){function e(o){var i,c;for(const d of Object.keys(o)){if((i=o[d])!=null&&i.types||(c=o[d])!=null&&c.message)return d;if(typeof o[d]=="object"){const u=e(o[d]);if(u)return`${d}.${u}`}}return null}const s=e(t);if(!s)return;const r=`[name="${s}"]`,n=`[name^="${s}["], [name^="${s}."]`,a=document.querySelector(r)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const sf={success:"bg-green-100 border-green-500 text-green-800",error:"bg-red-100 border-red-500 text-red-800",info:"bg-blue-100 border-blue-500 text-blue-800",warning:"bg-yellow-100 border-yellow-500 text-yellow-800"},dl=({id:t,message:e,variant:s="info",duration:r=5e3,onClose:n})=>(b.useEffect(()=>{const a=setTimeout(()=>n(t),r);return()=>clearTimeout(a)},[t,r,n]),l.jsxs("div",{className:ne("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",sf[s]),role:"alert","aria-live":"assertive",children:[l.jsx("span",{className:"flex-1",children:e}),l.jsx("button",{onClick:()=>n(t),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let hr;const rf=new Uint8Array(16);function nf(){if(!hr&&(hr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hr(rf)}const qe=[];for(let t=0;t<256;++t)qe.push((t+256).toString(16).slice(1));function af(t,e=0){return qe[t[e+0]]+qe[t[e+1]]+qe[t[e+2]]+qe[t[e+3]]+"-"+qe[t[e+4]]+qe[t[e+5]]+"-"+qe[t[e+6]]+qe[t[e+7]]+"-"+qe[t[e+8]]+qe[t[e+9]]+"-"+qe[t[e+10]]+qe[t[e+11]]+qe[t[e+12]]+qe[t[e+13]]+qe[t[e+14]]+qe[t[e+15]]}const of=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),po={randomUUID:of};function lf(t,e,s){if(po.randomUUID&&!t)return po.randomUUID();t=t||{};const r=t.random||(t.rng||nf)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,af(r)}const ul=b.createContext(null),Gs=()=>{const t=b.useContext(ul);if(!t)throw new Error("useToast debe usarse dentro de <ToastProvider>");return t},cf=({children:t})=>{const[e,s]=b.useState([]),r=(a,o="info",i=5e3)=>{const c=lf();s(d=>[...d,{id:c,message:a,variant:o,duration:i}])},n=a=>{s(o=>o.filter(i=>i.id!==a))};return l.jsxs(ul.Provider,{value:{show:r},children:[t,l.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:e.map(a=>l.jsx(dl,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},df=t=>t.type==="inputGroup",uf=t=>t.type==="button",ff=t=>!df(t)&&!uf(t);function hf(t){const e=Array.isArray(t)?t:[];return b.useMemo(()=>{const s={};for(const r of e)ff(r)&&r.name&&(s[r.name]=r);return s},[e])}const fl=b.createContext(null);function pf({children:t,value:e}){return l.jsx(fl.Provider,{value:e,children:t})}function Hr(){const t=b.useContext(fl);if(!t)throw new Error("useAdapters debe usarse dentro de <AdaptersProvider />");return t}const mf=t=>!!t&&typeof t.then=="function";function gf(t){return Array.isArray(t)?t.length>0&&typeof t[0]=="object"&&t[0]!==null?t.map(e=>{var n;if("label"in e&&"value"in e)return e;const r=(n=Object.entries(e)[0])==null?void 0:n[1];return{label:String(r??JSON.stringify(e)),value:String(r??"")}}):t.map(e=>({label:String(e),value:e})):[]}function bf(t){const{services:e}=Hr(),[s,r]=b.useState({}),[n,a]=b.useState(0),o=b.useRef(!0);b.useEffect(()=>(o.current=!0,()=>{o.current=!1}),[]);const i=b.useMemo(()=>t.filter(c=>c.type==="select"&&!c.options&&typeof c.optionSource=="string"&&c.name),[t]);return b.useEffect(()=>{if(i.length===0)return;let c=!1;return(async()=>{a(d=>d+1);try{const d=await Promise.all(i.map(async u=>{var v;const f=u.name,p=u.optionSource,h=(v=e==null?void 0:e.registry)==null?void 0:v[p];if(!h)return[f,[]];const g=mf(h)?await h:await h(),x=gf(g);return[f,x]}));if(c||!o.current)return;r(u=>{const f={...u};for(const[p,h]of d)f[p]=[...h];return f})}finally{!c&&o.current&&a(d=>Math.max(0,d-1))}})(),()=>{c=!0}},[i,e==null?void 0:e.registry]),{optionsMap:s,loadingCount:n}}const xf=t=>t.type==="inputGroup",vf=t=>t.type==="button",yf=t=>!xf(t)&&!vf(t);function wf(t){return typeof t=="object"&&t!==null}const jf=t=>{const e=t.disabledWhen;if(!wf(e))return!1;const s="watchField"in e,r="rule"in e;return s&&!r};function kf(t,e){const s=Array.isArray(t)?t:[],r=b.useMemo(()=>s.filter(yf).filter(jf),[s]),n=b.useMemo(()=>r.map(c=>c.disabledWhen.watchField),[r]),a=ia({control:e,...n.length>0?{name:n}:{}}),o=Array.isArray(a)?a:[],i={};return r.forEach((c,d)=>{const u=o[d];i[c.name??`__unnamed_${d}`]=u===c.disabledWhen.watchValue}),i}const mo={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Sf={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Gr({control:t,name:e,rules:s,defaultValue:r,size:n="sm",width:a="100%",label:o,labelHidden:i=!1,hasError:c=!1,errorMessage:d="",maxLength:u,showCounter:f=!1,className:p,suffixButton:h,...g}){const x=b.useId(),v=e||x,[m,y]=b.useState(r||"");if(t&&e)return l.jsx(vt,{name:e,control:t,rules:s,defaultValue:r||"",render:({field:O,fieldState:S})=>{var T;return l.jsx(Gr,{...g,size:n,width:a,label:o,labelHidden:i,hasError:!!S.error,errorMessage:((T=S.error)==null?void 0:T.message)||"",maxLength:u,showCounter:f,className:p,suffixButton:h,value:O.value,onChange:O.onChange})}});b.useEffect(()=>{y(r||"")},[r]);const w=O=>{var S;u!==void 0&&O.target.value.length>u||(y(O.target.value),(S=g.onChange)==null||S.call(g,O))};return l.jsxs("div",{className:ne("flex flex-col",p),style:{width:a},children:[o&&l.jsx("label",{htmlFor:v,className:ne("pb-2 text-[var(--color-ds-text-primary)]",mo[n],i&&"sr-only"),children:o}),l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.jsx("textarea",{id:v,className:ne("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",mo[n],Sf[n],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:m,onChange:w,maxLength:u,...g}),h?l.jsx("div",{className:"shrink-0",children:h}):null]}),l.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&d?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):l.jsx("span",{"aria-hidden":"true",children:" "}),f&&u!==void 0&&l.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[m.length,"/",u]})]})]})}const Nf={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function ft({control:t=null,name:e,rules:s,defaultValue:r=!1,label:n,labelHidden:a=!1,disabled:o=!1,size:i="sm",className:c,hasError:d=!1,errorMessage:u="",checked:f,onChange:p}){const h=ne(Nf[i],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",o&&"opacity-50 cursor-not-allowed"),g=ne("text-[var(--color-ds-text-primary)] text-ds-md",o&&"text-[var(--color-ds-text-secondary)]",a&&"sr-only");return t?l.jsx("div",{className:ne("flex flex-col",c),children:l.jsx(vt,{name:e||"",control:t,rules:s,defaultValue:r,render:({field:x,fieldState:v})=>{const m=v.error;return l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"flex items-center space-x-2",children:[l.jsx("input",{id:e,type:"checkbox",className:h,checked:!!x.value,onChange:y=>x.onChange(y.target.checked),disabled:o}),n&&l.jsx("span",{className:g,children:n})]}),(d||m)&&((m==null?void 0:m.message)||u)&&l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:(m==null?void 0:m.message)||u})]})}})}):l.jsxs("div",{className:ne("flex flex-col",c),children:[l.jsxs("label",{className:"flex items-center space-x-2",children:[l.jsx("input",{id:e,type:"checkbox",className:h,checked:!!f,onChange:x=>p==null?void 0:p(x.target.checked),disabled:o}),n&&l.jsx("span",{className:g,children:n})]}),d&&!!u&&l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u})]})}function hl({name:t,control:e,searchFn:s,resolveByValue:r,label:n,size:a="sm",width:o="100%",disabled:i=!1,searchMode:c="button",minChars:d=3,debounceMs:u=600}){const f=Ws(),{watch:p,getValues:h,setValue:g}=f,x=ia({control:e,name:t}),[v,m]=b.useState([]),[y,w]=b.useState(!1),[O,S]=b.useState(!1),[T,C]=b.useState(""),N=b.useRef(null),_=b.useRef(null),I=b.useRef(!1),z=b.useRef(!1),U=b.useRef(!0),D=b.useMemo(()=>{const q=new Map;for(const ae of v)q.set(String(ae.value).trim(),ae.label??"");return q},[v]),$=async q=>{const ae=(q??"").trim();if(!ae){m([]),S(!1);return}w(!0);try{const A=await s(ae,{watch:p,getValues:h});m(A??[]),S(!0)}finally{w(!1)}};b.useEffect(()=>{function q(ae){N.current&&!N.current.contains(ae.target)&&S(!1)}if(O)return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[O]),b.useEffect(()=>{if(I.current)return;const ae=(x?String(x):"").trim();if(!ae){C(""),S(!1);return}const A=D.get(ae);if(A){C(A),S(!1),U.current=!0;return}let j=!1;return(async()=>{if(r)try{const V=await r(ae,{watch:p,getValues:h});j||(C((V==null?void 0:V.label)??ae),S(!1),U.current=!0)}catch{j||(C(ae),S(!1),U.current=!0)}else C(ae),S(!1),U.current=!0})(),()=>{j=!0}},[x,D,r,p,h]),b.useEffect(()=>{if(c!=="debounced"||i)return;if(U.current){U.current=!1;return}if(!z.current)return;_.current&&(window.clearTimeout(_.current),_.current=null);const q=(T||"").trim();return q.length>=d?_.current=window.setTimeout(()=>{$(q)},u):(m([]),S(!1)),()=>{_.current&&(window.clearTimeout(_.current),_.current=null)}},[T,c,d,u,i]);const E=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",Z=a==="sm"?"h-6":a==="md"?"h-10":"h-12",se=q=>{if(i)return;const ae=(T||"").trim();q.key==="Enter"&&(q.preventDefault(),c==="debounced"?ae.length>=d&&$(ae):$(ae)),q.key==="Escape"&&S(!1)};return l.jsx(vt,{name:t,control:e,render:({field:q,fieldState:ae})=>{var A;return l.jsxs("div",{ref:N,className:"relative flex flex-col",style:{width:o},children:[n&&l.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${E}`,children:n}),l.jsx(je,{className:c==="button"?"rounded-r-none":void 0,type:"text",size:a,width:"100%",value:T,onChange:j=>{const V=j.target.value;I.current=!0,z.current=!0,C(V),(x?String(x):"").trim()&&g(t,"",{shouldDirty:!0})},onKeyDown:se,onBlur:()=>{I.current=!1},disabled:i,hasError:ae.invalid,errorMessage:(A=ae.error)==null?void 0:A.message,onFocus:()=>{if(I.current=!0,c==="button"&&z.current){const j=(T||"").trim();j&&$(j)}},suffixButton:c==="button"?l.jsx(le,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>$((T||"").trim()),disabled:i,children:"Buscar"}):void 0}),y&&l.jsx("div",{className:"absolute top-14 left-0 right-0 z-10",children:l.jsx(ts,{width:"100%",height:a==="sm"?"1.5rem":a==="md"?"2.5rem":"3rem",variant:"rect",className:"rounded-lg"})}),O&&!y&&v.length>0&&l.jsx("ul",{className:`
28
+ attempted value: ${i}
29
+ `+(l!==i?`result of cast: ${l}`:""))}return a}_cast(t,r){let s=t===void 0?t:this.transforms.reduce((n,a)=>a.call(this,n,t,this),t);return s===void 0&&(s=this.getDefault(r)),s}_validate(t,r={},s,n){let{path:a,originalValue:i=t,strict:l=this.spec.strict}=r,c=t;l||(c=this._cast(c,Object.assign({assert:!1},r)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:a,value:c,originalValue:i,options:r,tests:d},s,u=>{if(u.length)return n(u,c);this.runTests({path:a,value:c,originalValue:i,options:r,tests:this.tests},s,n)})}runTests(t,r,s){let n=!1,{tests:a,value:i,originalValue:l,path:c,options:d}=t,u=x=>{n||(n=!0,r(x,i))},f=x=>{n||(n=!0,s(x,i))},p=a.length,h=[];if(!p)return f([]);let g={value:i,originalValue:l,path:c,options:d,schema:this};for(let x=0;x<a.length;x++){const v=a[x];v(g,u,function(w){w&&(Array.isArray(w)?h.push(...w):h.push(w)),--p<=0&&f(h)})}}asNestedTest({key:t,index:r,parent:s,parentPath:n,originalParent:a,options:i}){const l=t??r;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const u=Object.assign({},i,{strict:!0,parent:s,value:d,originalValue:a[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${n||""}[${c?l:`"${l}"`}]`:(n?`${n}.`:"")+t});return(f,p,h)=>this.resolve(u)._validate(d,u,p,h)}validate(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((i,l)=>n._validate(t,r,(c,d)=>{tt.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new tt(c,d,void 0,void 0,a)):i(d)}))}validateSync(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a,i=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(t,Object.assign({},r,{sync:!0}),(l,c)=>{throw tt.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new tt(l,t,void 0,void 0,i);a=c}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,s=>{if(tt.isError(s))return!1;throw s})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(s){if(tt.isError(s))return!1;throw s}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):cr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const s=this.clone({nullable:t});return s.internalTests.nullable=or({message:r,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(t,r){const s=this.clone({optional:t});return s.internalTests.optionality=or({message:r,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(t=jt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=jt.notNull){return this.nullability(!1,t)}required(t=jt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=jt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=or(r),a=r.exclusive||r.name&&s.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(s.exclusiveTests[r.name]=!!r.exclusive),s.tests=s.tests.filter(i=>!(i.OPTIONS.name===r.name&&(a||i.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let s=this.clone(),n=xi(t).map(a=>new tr(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof r=="function"?new ws(n,r):ws.fromOptions(n,r)),s}typeError(t){let r=this.clone();return r.internalTests.typeError=or({message:t,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=jt.oneOf){let s=this.clone();return t.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=or({message:r,name:"oneOf",skipAbsent:!0,test(n){let a=this.schema._whitelist,i=a.resolveAll(this.resolve);return i.includes(n)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:i}})}}),s}notOneOf(t,r=jt.notOneOf){let s=this.clone();return t.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=or({message:r,name:"notOneOf",test(n){let a=this.schema._blacklist,i=a.resolveAll(this.resolve);return i.includes(n)?this.createError({params:{values:Array.from(a).join(", "),resolved:i}}):!0}}),s}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:s,meta:n,optional:a,nullable:i}=r.spec;return{meta:n,label:s,optional:a,nullable:i,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(f=>f.name===c.name)===d)}}}nt.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])nt.prototype[`${e}At`]=function(t,r,s={}){const{parent:n,parentPath:a,schema:i}=su(this,t,r,s.context);return i[e](n&&n[a],Object.assign({},s,{parent:n,path:t}))};for(const e of["equals","is"])nt.prototype[e]=nt.prototype.oneOf;for(const e of["not","nope"])nt.prototype[e]=nt.prototype.notOneOf;const nu=()=>!0;function Cn(e){return new ji(e)}class ji extends nt{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:nu},t))}}Cn.prototype=ji.prototype;function ki(){return new Ni}class Ni extends nt{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(s.spec.coerce&&!s.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=En.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return bt(r)||r===!0}})}isFalse(t=En.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return bt(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}ki.prototype=Ni.prototype;const au=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function ou(e){const t=An(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function An(e){var t,r;const s=au.exec(e);return s?{year:Ct(s[1]),month:Ct(s[2],1)-1,day:Ct(s[3],1),hour:Ct(s[4]),minute:Ct(s[5]),second:Ct(s[6]),millisecond:s[7]?Ct(s[7].substring(0,3)):0,precision:(t=(r=s[7])==null?void 0:r.length)!=null?t:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ct(s[10]),minuteOffset:Ct(s[11])}:null}function Ct(e,t=0){return Number(e)||t}let iu=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,lu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,cu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,du="^\\d{4}-\\d{2}-\\d{2}",uu="\\d{2}:\\d{2}:\\d{2}",fu="(([+-]\\d{2}(:?\\d{2})?)|Z)",mu=new RegExp(`${du}T${uu}(\\.\\d+)?${fu}$`),hu=e=>bt(e)||e===e.trim(),pu={}.toString();function lr(){return new Si}class Si extends nt{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce||s.isType(t)||Array.isArray(t))return t;const n=t!=null&&t.toString?t.toString():t;return n===pu?t:n})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||jt.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=et.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r=et.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r=et.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}matches(t,r){let s=!1,n,a;return r&&(typeof r=="object"?{excludeEmptyString:s=!1,message:n,name:a}=r:n=r),this.test({name:a||"matches",message:n||et.matches,params:{regex:t},skipAbsent:!0,test:i=>i===""&&s||i.search(t)!==-1})}email(t=et.email){return this.matches(iu,{name:"email",message:t,excludeEmptyString:!0})}url(t=et.url){return this.matches(lu,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=et.uuid){return this.matches(cu,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",s,n;return t&&(typeof t=="object"?{message:r="",allowOffset:s=!1,precision:n=void 0}=t:r=t),this.matches(mu,{name:"datetime",message:r||et.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||et.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const i=An(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:r||et.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const i=An(a);return i?i.precision===n:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=et.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:hu})}lowercase(t=et.lowercase){return this.transform(r=>bt(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toLowerCase()})}uppercase(t=et.uppercase){return this.transform(r=>bt(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toUpperCase()})}}lr.prototype=Si.prototype;let bu=e=>e!=+e;function Ei(){return new Ci}class Ci extends nt{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!bu(t)}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce)return t;let n=t;if(typeof n=="string"){if(n=n.replace(/\s/g,""),n==="")return NaN;n=+n}return s.isType(n)||n===null?n:parseFloat(n)})})}min(t,r=Pt.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s>=this.resolve(t)}})}max(t,r=Pt.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s<=this.resolve(t)}})}lessThan(t,r=Pt.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(s){return s<this.resolve(t)}})}moreThan(t,r=Pt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(s){return s>this.resolve(t)}})}positive(t=Pt.positive){return this.moreThan(0,t)}negative(t=Pt.negative){return this.lessThan(0,t)}integer(t=Pt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>bt(t)?t:t|0)}round(t){var r;let s=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(s.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>bt(n)?n:Math[t](n))}}Ei.prototype=Ci.prototype;let Ai=new Date(""),gu=e=>Object.prototype.toString.call(e)==="[object Date]";function Hn(){return new zr}class zr extends nt{constructor(){super({type:"date",check(t){return gu(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,s)=>!s.spec.coerce||s.isType(t)||t===null?t:(t=ou(t),isNaN(t)?zr.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let s;if(tr.isRef(t))s=t;else{let n=this.cast(t);if(!this._typeCheck(n))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(t,r=Sn.min){let s=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(t,r=Sn.max){let s=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}zr.INVALID_DATE=Ai;Hn.prototype=zr.prototype;Hn.INVALID_DATE=Ai;function xu(e,t=[]){let r=[],s=new Set,n=new Set(t.map(([i,l])=>`${i}-${l}`));function a(i,l){let c=Ht.split(i)[0];s.add(c),n.has(`${l}-${c}`)||r.push([l,c])}for(const i of Object.keys(e)){let l=e[i];s.add(i),tr.isRef(l)&&l.isSibling?a(l.path,i):Ms(l)&&"deps"in l&&l.deps.forEach(c=>a(c,i))}return Jd.array(Array.from(s),r).reverse()}function Ua(e,t){let r=1/0;return e.some((s,n)=>{var a;if((a=t.path)!=null&&a.includes(s))return r=n,!0}),r}function Ti(e){return(t,r)=>Ua(e,t)-Ua(e,r)}const _i=(e,t,r)=>{if(typeof e!="string")return e;let s=e;try{s=JSON.parse(e)}catch{}return r.isType(s)?s:e};function ps(e){if("fields"in e){const t={};for(const[r,s]of Object.entries(e.fields))t[r]=ps(s);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=ps(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(ps)}):"optional"in e?e.optional():e}const vu=(e,t)=>{const r=[...Ht.normalizePath(t)];if(r.length===1)return r[0]in e;let s=r.pop(),n=Ht.getter(Ht.join(r),!0)(e);return!!(n&&s in n)};let qa=e=>Object.prototype.toString.call(e)==="[object Object]";function Wa(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(s=>r.indexOf(s)===-1)}const yu=Ti([]);function Fi(e){return new Oi(e)}class Oi extends nt{constructor(t){super({type:"object",check(r){return qa(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=yu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var s;let n=super._cast(t,r);if(n===void 0)return this.getDefault(r);if(!this._typeCheck(n))return n;let a=this.fields,i=(s=r.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(f=>!this._nodes.includes(f))),c={},d=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),u=!1;for(const f of l){let p=a[f],h=f in n;if(p){let g,x=n[f];d.path=(r.path?`${r.path}.`:"")+f,p=p.resolve({value:x,context:r.context,parent:c});let v=p instanceof nt?p.spec:void 0,m=v==null?void 0:v.strict;if(v!=null&&v.strip){u=u||f in n;continue}g=!r.__validating||!m?p.cast(n[f],d):n[f],g!==void 0&&(c[f]=g)}else h&&!i&&(c[f]=n[f]);(h!==f in c||c[f]!==n[f])&&(u=!0)}return u?c:n}_validate(t,r={},s,n){let{from:a=[],originalValue:i=t,recursive:l=this.spec.recursive}=r;r.from=[{schema:this,value:i},...a],r.__validating=!0,r.originalValue=i,super._validate(t,r,s,(c,d)=>{if(!l||!qa(d)){n(c,d);return}i=i||d;let u=[];for(let f of this._nodes){let p=this.fields[f];!p||tr.isRef(p)||u.push(p.asNestedTest({options:r,key:f,parent:d,parentPath:r.path,originalParent:i}))}this.runTests({tests:u,value:d,originalValue:i,options:r},s,f=>{n(f.sort(this._sortErrors).concat(c),d)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),s=r.fields;for(let[n,a]of Object.entries(this.fields)){const i=s[n];s[n]=i===void 0?a:i}return r.withMutation(n=>n.setFields(s,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let i=t;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),r[s]=a&&"getDefault"in a?a.getDefault(i):void 0}),r}setFields(t,r){let s=this.clone();return s.fields=t,s._nodes=xu(t,r),s._sortErrors=Ti(Object.keys(t)),r&&(s._excludedEdges=r),s}shape(t,r=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),n=[...s._excludedEdges,...r]),s.setFields(Object.assign(s.fields,t),n)})}partial(){const t={};for(const[r,s]of Object.entries(this.fields))t[r]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(t)}deepPartial(){return ps(this)}pick(t){const r={};for(const s of t)this.fields[s]&&(r[s]=this.fields[s]);return this.setFields(r,this._excludedEdges.filter(([s,n])=>t.includes(s)&&t.includes(n)))}omit(t){const r=[];for(const s of Object.keys(this.fields))t.includes(s)||r.push(s);return this.pick(r)}from(t,r,s){let n=Ht.getter(t,!0);return this.transform(a=>{if(!a)return a;let i=a;return vu(a,t)&&(i=Object.assign({},a),s||delete i[t],i[r]=n(a)),i})}json(){return this.transform(_i)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||ms.exact,test(r){if(r==null)return!0;const s=Wa(this.schema,r);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=ms.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:r,test(n){if(n==null)return!0;const a=Wa(this.schema,n);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=t,s}unknown(t=!0,r=ms.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const s={};for(const n of Object.keys(r))s[t(n)]=r[n];return s})}camelCase(){return this.transformKeys(Xs.camelCase)}snakeCase(){return this.transformKeys(Xs.snakeCase)}constantCase(){return this.transformKeys(t=>Xs.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);s.fields={};for(const[a,i]of Object.entries(r.fields)){var n;let l=t;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=i.describe(l)}return s}}Fi.prototype=Oi.prototype;function Tn(e){return new Ri(e)}class Ri extends nt{constructor(t){super({type:"array",spec:{types:t},check(r){return Array.isArray(r)}}),this.innerType=void 0,this.innerType=t}_cast(t,r){const s=super._cast(t,r);if(!this._typeCheck(s)||!this.innerType)return s;let n=!1;const a=s.map((i,l)=>{const c=this.innerType.cast(i,Object.assign({},r,{path:`${r.path||""}[${l}]`}));return c!==i&&(n=!0),c});return n?a:s}_validate(t,r={},s,n){var a;let i=this.innerType,l=(a=r.recursive)!=null?a:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,s,(c,d)=>{var u;if(!l||!i||!this._typeCheck(d)){n(c,d);return}let f=new Array(d.length);for(let h=0;h<d.length;h++){var p;f[h]=i.asNestedTest({options:r,index:h,parent:d,parentPath:r.path,originalParent:(p=r.originalValue)!=null?p:t})}this.runTests({value:d,tests:f,originalValue:(u=r.originalValue)!=null?u:t,options:r},s,h=>n(h.concat(c),d))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(_i)}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!Ms(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Tt(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=hs.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r){return r=r||hs.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r){return r=r||hs.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(s,n,a)=>!t(s,n,a):s=>!!s;return this.transform(s=>s!=null?s.filter(r):s)}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);if(r.innerType){var n;let a=t;(n=a)!=null&&n.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),s.innerType=r.innerType.describe(a)}return s}}Tn.prototype=Ri.prototype;function wu(e){return e.validation??{}}function ju(e){return!!e.multiple}function Qs(e){const t=e.maxFiles;return typeof t=="number"?t:void 0}function At(e,t){return t.required?e.required(t.requiredMessage||"Requerido"):e}function ss(e,t){var s,n,a;let r=e;return((s=t.minLength)==null?void 0:s.value)!=null&&(r=r.min(t.minLength.value,t.minLength.message||`Mín. ${t.minLength.value} caracteres`)),((n=t.maxLength)==null?void 0:n.value)!=null&&(r=r.max(t.maxLength.value,t.maxLength.message||`Máx. ${t.maxLength.value} caracteres`)),((a=t.pattern)==null?void 0:a.value)instanceof RegExp&&(r=r.matches(t.pattern.value,t.pattern.message||"Formato inválido")),r}function ku(e){var r;const t=wu(e);switch(e.type){case"text":case"password":{let s=lr().trim();return s=ss(s,t),At(s,t)}case"email":{let s=lr().trim().email(t.emailMessage||"Email inválido");return s=ss(s,t),At(s,t)}case"number":{let s=Ei().transform((n,a)=>a===""||a===null?void 0:n).typeError(t.typeError||"Debe ser un número");return((r=t.pattern)==null?void 0:r.value)instanceof RegExp&&(s=s.test("pattern-number",t.pattern.message||"Formato inválido",n=>n==null||t.pattern.value.test(String(n)))),At(s,t)}case"select":{if(ju(e)){const n=Tn().of(lr());return At(n,t)}let s=lr().trim();return s=ss(s,t),At(s,t)}case"checkbox":{let s=ki();return t.required&&(s=s.oneOf([!0],t.requiredMessage||"Debes marcar esta casilla")),s}case"textarea":{let s=lr().trim();return s=ss(s,t),At(s,t)}case"date":{const s=Hn().typeError(t.typeError||"Fecha inválida").transform((n,a)=>a?new Date(a):void 0);return At(s,t)}case"file":{const s=Tn().of(Cn()).test("max-files",Qs(e)?`Máx. ${Qs(e)} fichero(s)`:"Número de ficheros inválido",n=>{const a=Qs(e);return!Array.isArray(n)||!a||n.length<=a});return At(s,t)}default:{const s=Cn();return At(s,t)}}}function Di(e){const t={};for(const r of e.fields){const s=r;s.name&&(t[s.name]=ku(s))}return Fi(t)}function Ir({options:e,value:t,onChange:r,children:s}){const n=b.useRef(null),[a,i]=b.useState({left:0,width:0});return b.useLayoutEffect(()=>{const l=n.current;if(!l)return;const c=()=>{const d=e.findIndex(v=>v.value===t);if(d<0)return;const u=l.children[d],f=u.querySelector("span"),p=(f==null?void 0:f.offsetWidth)??u.offsetWidth,h=u.offsetWidth,x=u.offsetLeft+(h-p)/2;i({left:x,width:p})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[t,e]),o.jsxs("div",{children:[o.jsxs("div",{className:"relative",children:[o.jsx("ul",{ref:n,role:"tablist",className:"flex justify-center overflow-x-auto border-b border-[var(--color-ds-border-default-50)]",children:e.map(l=>{const c=l.value===t;return o.jsx("li",{role:"tab","aria-selected":c,onClick:()=>r(l.value),className:se("cursor-pointer whitespace-nowrap px-4 py-2 transition-colors duration-150 ease-in-out",c?"text-[var(--color-ds-background-accent)]":"text-[var(--color-ds-text-primary)]"),children:o.jsx("span",{className:"inline-block",children:l.label})},l.value)})}),o.jsx("span",{className:"absolute bottom-0 h-1 bg-[var(--color-ds-background-accent)] transition-all duration-200 ease-in-out rounded-t-full",style:{left:a.left,width:a.width}})]}),o.jsx("div",{className:"mt-4 pb-4 border-b border-[var(--color-ds-border-default-50)]",children:s[t]})]})}const ns={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Ka={sm:"h-6",md:"h-10",lg:"h-12"},Ga={sm:"px-2",md:"px-2.5",lg:"px-3"},Ja={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function Za({id:e,size:t,disabled:r,error:s,reserveErrorSpace:n,className:a,suffixButton:i,children:l}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative flex items-center w-full",children:[l,i&&o.jsx("div",{className:"flex items-center h-full pr-2",children:i})]}),n?o.jsx("div",{className:"min-h-[18px] w-full",children:s!=null&&s.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):s!=null&&s.message?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message})}):null]})}function rt(e){const{control:t,name:r,rules:s,defaultValue:n,options:a=[],loadOptions:i,reloadDeps:l=[],value:c,onChange:d,size:u="sm",width:f="100%",label:p,labelHidden:h=!1,hasError:g=!1,errorMessage:x="",reserveErrorSpace:v,disableErrorPlaceholder:m,disabled:w=!1,className:y,suffixButton:T,loading:N=!1,coerceFirstValid:_=!0}=e,A=b.useId(),S=r||A,[$,V]=b.useState(a),[z,q]=b.useState(!!i);b.useEffect(()=>{i&&(q(!0),i().then(E=>V(E)).finally(()=>q(!1)))},[i,...l]);const D=E=>E.find(te=>te.value!==""&&te.value!==void 0)??E[0],P=typeof v=="boolean"?v:!!t;if(t&&r){const{field:E,fieldState:te}=si({name:r,control:t,rules:s,defaultValue:n});return b.useEffect(()=>{if(!z&&$.length>0&&_){const ne=E.value,K=$.some(le=>String(le.value)===String(ne));(ne===void 0||!K)&&E.onChange(D($).value)}},[$,z,E,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[p&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ns[u],h&&"sr-only"),children:p}),N||z?o.jsx(Xt,{width:"100%",height:Ja[u],variant:"rect",className:"rounded-lg"}):o.jsx(Za,{id:S,size:u,disabled:w,error:te.error,reserveErrorSpace:typeof m=="boolean"?!m:P,className:y,suffixButton:T,children:o.jsx("select",{id:S,value:E.value,onChange:ne=>E.onChange(ne.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ns[u],Ka[u],Ga[u],te.error?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",y),children:$.map(ne=>o.jsx("option",{value:ne.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:ne.label},ne.value))})})]})}return b.useEffect(()=>{if(!t&&$.length>0&&_){const E=$.some(ne=>String(ne.value)===String(c));(c===void 0||c===""||!E)&&d&&d(D($).value)}},[$,c,d,t,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[p&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ns[u],h&&"sr-only"),children:p}),N||z?o.jsx(Xt,{width:"100%",height:Ja[u],variant:"rect",className:"rounded-lg"}):o.jsx(Za,{id:S,size:u,disabled:w,error:g?{message:x}:void 0,reserveErrorSpace:typeof m=="boolean"?!m:!!(v??!1),className:y,suffixButton:T,children:o.jsx("select",{id:S,value:c,onChange:E=>d==null?void 0:d(E.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ns[u],Ka[u],Ga[u],g?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",y),children:$.map(E=>o.jsx("option",{value:E.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:E.label},E.value))})})]})}const Ya={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function Mi({groupLabel:e,inputs:t=[],separator:r=o.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:n,showVisibleLabel:a=!1,size:i="sm",width:l}){const c=t.length;return o.jsxs("div",{className:se("flex flex-col",n),style:l?{width:l}:void 0,children:[o.jsx("label",{className:se("sr-only pb-2",Ya[i]),children:e}),a&&o.jsx("label",{className:se("pb-2",Ya[i]),children:e}),o.jsx("div",{className:"flex items-center flex-nowrap",children:t.map((d,u)=>{const{width:f,className:p,options:h,loadOptions:g,...x}=d,v=Array.isArray(h)||typeof g=="function";let m="rounded-lg";!s&&c>1&&(u===0?m="rounded-l-lg rounded-r-none":u===c-1?m="rounded-r-lg rounded-l-none !rounded-l-none":m="rounded-none !rounded-l-none !rounded-r-none");const w=[],y=typeof f=="string"&&f.split(/\s+/).some(A=>A.startsWith("w-")||A.includes(":w-")),T=se("inline-flex items-center flex-shrink-0",typeof f=="string"&&y?f:void 0,!s&&c>1&&u>0?"-ml-px focus-within:z-10 relative":void 0),N=typeof f=="string"&&!y?{width:f}:void 0,_=se(p,m,w);return o.jsxs("div",{className:T,style:N,children:[v?o.jsx(rt,{...x,size:i,className:_,options:h,loadOptions:g}):o.jsx(we,{...x,size:i,className:_}),s&&u<c-1&&r]},u)})})]})}const Ha={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Nu={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function $i({groupLabel:e,options:t,control:r,name:s,rules:n,defaultValue:a,multiple:i=!0,size:l="sm",vertical:c=!0,className:d,showVisibleLabel:u=!0}){return o.jsx(gt,{name:s,control:r,rules:n,defaultValue:a,render:({field:f,fieldState:p})=>{const{value:h,onChange:g}=f;p.error;const x=m=>i?Array.isArray(h)&&h.includes(m):h===m,v=m=>{if(i){const w=Array.isArray(h)?[...h]:[],y=w.indexOf(m);y>=0?w.splice(y,1):w.push(m),g(w)}else g(m)};return o.jsxs("div",{className:se("w-full",d),children:[o.jsx("label",{className:se("sr-only pb-2 text-[var(--color-ds-text-primary)]",Ha[l]),children:e}),u&&o.jsx("label",{className:se("block pb-2 text-[var(--color-ds-text-primary)]",Ha[l]),children:e}),o.jsx("div",{className:se(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:t.map(m=>o.jsxs("label",{className:"inline-flex items-center space-x-2 cursor-pointer select-none",children:[o.jsx("input",{type:i?"checkbox":"radio",name:s,value:m.value,checked:x(m.value),onChange:()=>v(m.value),className:se(Nu[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]")}),o.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-md",children:m.label})]},m.value))})]})}})}function Su(e){function t(i){var l,c;for(const d of Object.keys(i)){if((l=i[d])!=null&&l.types||(c=i[d])!=null&&c.message)return d;if(typeof i[d]=="object"){const u=t(i[d]);if(u)return`${d}.${u}`}}return null}const r=t(e);if(!r)return;const s=`[name="${r}"]`,n=`[name^="${r}["], [name^="${r}."]`,a=document.querySelector(s)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const Eu={success:"bg-green-100 border-green-500 text-green-800",error:"bg-red-100 border-red-500 text-red-800",info:"bg-blue-100 border-blue-500 text-blue-800",warning:"bg-yellow-100 border-yellow-500 text-yellow-800"},Li=({id:e,message:t,variant:r="info",duration:s=5e3,onClose:n})=>(b.useEffect(()=>{const a=setTimeout(()=>n(e),s);return()=>clearTimeout(a)},[e,s,n]),o.jsxs("div",{className:se("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",Eu[r]),role:"alert","aria-live":"assertive",children:[o.jsx("span",{className:"flex-1",children:t}),o.jsx("button",{onClick:()=>n(e),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let as;const Cu=new Uint8Array(16);function Au(){if(!as&&(as=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!as))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return as(Cu)}const Ue=[];for(let e=0;e<256;++e)Ue.push((e+256).toString(16).slice(1));function Tu(e,t=0){return Ue[e[t+0]]+Ue[e[t+1]]+Ue[e[t+2]]+Ue[e[t+3]]+"-"+Ue[e[t+4]]+Ue[e[t+5]]+"-"+Ue[e[t+6]]+Ue[e[t+7]]+"-"+Ue[e[t+8]]+Ue[e[t+9]]+"-"+Ue[e[t+10]]+Ue[e[t+11]]+Ue[e[t+12]]+Ue[e[t+13]]+Ue[e[t+14]]+Ue[e[t+15]]}const _u=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Xa={randomUUID:_u};function Fu(e,t,r){if(Xa.randomUUID&&!e)return Xa.randomUUID();e=e||{};const s=e.random||(e.rng||Au)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Tu(s)}const Pi=b.createContext(null),Vr=()=>{const e=b.useContext(Pi);if(!e)throw new Error("useToast debe usarse dentro de <ToastProvider>");return e},Ou=({children:e})=>{const[t,r]=b.useState([]),s=(a,i="info",l=5e3)=>{const c=Fu();r(d=>[...d,{id:c,message:a,variant:i,duration:l}])},n=a=>{r(i=>i.filter(l=>l.id!==a))};return o.jsxs(Pi.Provider,{value:{show:s},children:[e,o.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:t.map(a=>o.jsx(Li,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},Ru=e=>e.type==="inputGroup",Du=e=>e.type==="button",Mu=e=>!Ru(e)&&!Du(e);function $u(e){const t=Array.isArray(e)?e:[];return b.useMemo(()=>{const r={};for(const s of t)Mu(s)&&s.name&&(r[s.name]=s);return r},[t])}const zi=b.createContext(null);function Lu({children:e,value:t}){return o.jsx(zi.Provider,{value:t,children:e})}function $s(){const e=b.useContext(zi);if(!e)throw new Error("useAdapters debe usarse dentro de <AdaptersProvider />");return e}const Pu=e=>!!e&&typeof e.then=="function";function zu(e){return Array.isArray(e)?e.length>0&&typeof e[0]=="object"&&e[0]!==null?e.map(t=>{var n;if("label"in t&&"value"in t)return t;const s=(n=Object.entries(t)[0])==null?void 0:n[1];return{label:String(s??JSON.stringify(t)),value:String(s??"")}}):e.map(t=>({label:String(t),value:t})):[]}function Iu(e){const{services:t}=$s(),[r,s]=b.useState({}),[n,a]=b.useState(0),i=b.useRef(!0);b.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const l=b.useMemo(()=>e.filter(c=>c.type==="select"&&!c.options&&typeof c.optionSource=="string"&&c.name),[e]);return b.useEffect(()=>{if(l.length===0)return;let c=!1;return(async()=>{a(d=>d+1);try{const d=await Promise.all(l.map(async u=>{var v;const f=u.name,p=u.optionSource,h=(v=t==null?void 0:t.registry)==null?void 0:v[p];if(!h)return[f,[]];const g=Pu(h)?await h:await h(),x=zu(g);return[f,x]}));if(c||!i.current)return;s(u=>{const f={...u};for(const[p,h]of d)f[p]=[...h];return f})}finally{!c&&i.current&&a(d=>Math.max(0,d-1))}})(),()=>{c=!0}},[l,t==null?void 0:t.registry]),{optionsMap:r,loadingCount:n}}const Vu=e=>e.type==="inputGroup",Bu=e=>e.type==="button",Uu=e=>!Vu(e)&&!Bu(e);function qu(e){return typeof e=="object"&&e!==null}const Wu=e=>{const t=e.disabledWhen;if(!qu(t))return!1;const r="watchField"in t,s="rule"in t;return r&&!s};function Ku(e,t){const r=Array.isArray(e)?e:[],s=b.useMemo(()=>r.filter(Uu).filter(Wu),[r]),n=b.useMemo(()=>s.map(c=>c.disabledWhen.watchField),[s]),a=Kn({control:t,...n.length>0?{name:n}:{}}),i=Array.isArray(a)?a:[],l={};return s.forEach((c,d)=>{const u=i[d];l[c.name??`__unnamed_${d}`]=u===c.disabledWhen.watchValue}),l}const Qa={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Gu={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Ls({control:e,name:t,rules:r,defaultValue:s,size:n="sm",width:a="100%",label:i,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:u,showCounter:f=!1,className:p,suffixButton:h,...g}){const x=b.useId(),v=t||x,[m,w]=b.useState(s||"");if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s||"",render:({field:T,fieldState:N})=>{var _;return o.jsx(Ls,{...g,size:n,width:a,label:i,labelHidden:l,hasError:!!N.error,errorMessage:((_=N.error)==null?void 0:_.message)||"",maxLength:u,showCounter:f,className:p,suffixButton:h,value:T.value,onChange:T.onChange})}});b.useEffect(()=>{w(s||"")},[s]);const y=T=>{var N;u!==void 0&&T.target.value.length>u||(w(T.target.value),(N=g.onChange)==null||N.call(g,T))};return o.jsxs("div",{className:se("flex flex-col",p),style:{width:a},children:[i&&o.jsx("label",{htmlFor:v,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qa[n],l&&"sr-only"),children:i}),o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsx("textarea",{id:v,className:se("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",Qa[n],Gu[n],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:m,onChange:y,maxLength:u,...g}),h?o.jsx("div",{className:"shrink-0",children:h}):null]}),o.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "}),f&&u!==void 0&&o.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[m.length,"/",u]})]})]})}const Ju={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function dt({control:e=null,name:t,rules:r,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:i=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:u="",checked:f,onChange:p}){const h=se(Ju[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",i&&"opacity-50 cursor-not-allowed"),g=se("text-[var(--color-ds-text-primary)] text-ds-md",i&&"text-[var(--color-ds-text-secondary)]",a&&"sr-only");return e?o.jsx("div",{className:se("flex flex-col",c),children:o.jsx(gt,{name:t||"",control:e,rules:r,defaultValue:s,render:({field:x,fieldState:v})=>{const m=v.error;return o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:h,checked:!!x.value,onChange:w=>x.onChange(w.target.checked),disabled:i}),n&&o.jsx("span",{className:g,children:n})]}),(d||m)&&((m==null?void 0:m.message)||u)&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:(m==null?void 0:m.message)||u})]})}})}):o.jsxs("div",{className:se("flex flex-col",c),children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:h,checked:!!f,onChange:x=>p==null?void 0:p(x.target.checked),disabled:i}),n&&o.jsx("span",{className:g,children:n})]}),d&&!!u&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u})]})}function Ii({name:e,control:t,searchFn:r,resolveByValue:s,label:n,size:a="sm",width:i="100%",disabled:l=!1,searchMode:c="button",minChars:d=3,debounceMs:u=600}){const f=Pr(),{watch:p,getValues:h,setValue:g}=f,x=Kn({control:t,name:e}),[v,m]=b.useState([]),[w,y]=b.useState(!1),[T,N]=b.useState(!1),[_,A]=b.useState(""),S=b.useRef(null),$=b.useRef(null),V=b.useRef(!1),z=b.useRef(!1),q=b.useRef(!0),D=b.useMemo(()=>{const K=new Map;for(const le of v)K.set(String(le.value).trim(),le.label??"");return K},[v]),P=async K=>{const le=(K??"").trim();if(!le){m([]),N(!1);return}y(!0);try{const C=await r(le,{watch:p,getValues:h});m(C??[]),N(!0)}finally{y(!1)}};b.useEffect(()=>{function K(le){S.current&&!S.current.contains(le.target)&&N(!1)}if(T)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[T]),b.useEffect(()=>{if(V.current)return;const le=(x?String(x):"").trim();if(!le){A(""),N(!1);return}const C=D.get(le);if(C){A(C),N(!1),q.current=!0;return}let k=!1;return(async()=>{if(s)try{const I=await s(le,{watch:p,getValues:h});k||(A((I==null?void 0:I.label)??le),N(!1),q.current=!0)}catch{k||(A(le),N(!1),q.current=!0)}else A(le),N(!1),q.current=!0})(),()=>{k=!0}},[x,D,s,p,h]),b.useEffect(()=>{if(c!=="debounced"||l)return;if(q.current){q.current=!1;return}if(!z.current)return;$.current&&(window.clearTimeout($.current),$.current=null);const K=(_||"").trim();return K.length>=d?$.current=window.setTimeout(()=>{P(K)},u):(m([]),N(!1)),()=>{$.current&&(window.clearTimeout($.current),$.current=null)}},[_,c,d,u,l]);const E=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",te=a==="sm"?"h-6":a==="md"?"h-10":"h-12",ne=K=>{if(l)return;const le=(_||"").trim();K.key==="Enter"&&(K.preventDefault(),c==="debounced"?le.length>=d&&P(le):P(le)),K.key==="Escape"&&N(!1)};return o.jsx(gt,{name:e,control:t,render:({field:K,fieldState:le})=>{var C;return o.jsxs("div",{ref:S,className:"relative flex flex-col",style:{width:i},children:[n&&o.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${E}`,children:n}),o.jsx(we,{className:c==="button"?"rounded-r-none":void 0,type:"text",size:a,width:"100%",value:_,onChange:k=>{const I=k.target.value;V.current=!0,z.current=!0,A(I),(x?String(x):"").trim()&&g(e,"",{shouldDirty:!0})},onKeyDown:ne,onBlur:()=>{V.current=!1},disabled:l,hasError:le.invalid,errorMessage:(C=le.error)==null?void 0:C.message,onFocus:()=>{if(V.current=!0,c==="button"&&z.current){const k=(_||"").trim();k&&P(k)}},suffixButton:c==="button"?o.jsx(ie,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>P((_||"").trim()),disabled:l,children:"Buscar"}):void 0}),w&&o.jsx("div",{className:"absolute top-14 left-0 right-0 z-10",children:o.jsx(Xt,{width:"100%",height:a==="sm"?"1.5rem":a==="md"?"2.5rem":"3rem",variant:"rect",className:"rounded-lg"})}),T&&!w&&v.length>0&&o.jsx("ul",{className:`
30
30
  absolute top-14 left-0 right-0
31
31
  border-[var(--color-ds-border-default)]
32
32
  rounded-lg bg-[var(--color-ds-background-page)]
33
33
  shadow-lg ${E} max-h-48 overflow-auto z-10
34
- `,children:v.map(j=>l.jsx("li",{className:`px-2 ${Z} flex items-center cursor-pointer
34
+ `,children:v.map(k=>o.jsx("li",{className:`px-2 ${te} flex items-center cursor-pointer
35
35
  text-[var(--color-ds-text-primary)]
36
- hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const V=String(j.value).trim();g(t,V,{shouldDirty:!0,shouldValidate:!0}),C(j.label??V),I.current=!1,z.current=!1,S(!1)},children:j.label},String(j.value)))})]})}})}const Os=(t,e)=>t[e],go=t=>t instanceof Date?t.getTime():t;function Cf(t,e,s){const r=go(t),n=go(e);return typeof r=="number"&&typeof n=="number"||typeof r=="string"&&typeof n=="string"?s==="gt"?r>n:s==="gte"?r>=n:s==="lt"?r<n:r<=n:!1}function Rr(t,e){if(!t)return!1;switch(t.op){case"eq":return Os(e,t.field)===t.value;case"neq":return Os(e,t.field)!==t.value;case"in":return t.values.includes(Os(e,t.field));case"notIn":return!t.values.includes(Os(e,t.field));case"gt":case"gte":case"lt":case"lte":return Cf(Os(e,t.field),t.value,t.op);case"and":return t.rules.every(s=>Rr(s,e));case"or":return t.rules.some(s=>Rr(s,e));default:return!1}}function bo(t){if(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return}if(typeof t=="object")return t}}function Ef(t,e){var s;return Array.isArray(t)?t.length&&typeof t[0]=="object"&&"value"in t[0]?e?t.map(r=>r.value):((s=t[0])==null?void 0:s.value)??"":e?t:t[0]??"":t&&typeof t=="object"&&"value"in t?t.value:t??(e?[]:"")}const Of=t=>t.type!=="inputGroup"&&t.type!=="button";function pl({schema:t,resolver:e}){const{layout:s,fields:r=[],onSubmit:n,successMessage:a,errorMessage:o,footerButtons:i,defaultValues:c,loadDefaultValues:d,validationSchema:u}=t,{show:f}=Gs(),{t:p}=da(),{services:h}=Hr(),g=b.useMemo(()=>{if(e)return e;try{const A=u??il(t);return Ki(A)}catch{return}},[e,t,u]),x=Jd({resolver:g,mode:"onBlur",reValidateMode:"onChange",defaultValues:c??{}});b.useEffect(()=>{const A=t.defaultSource;if(!A)return;let j=!1;return(async()=>{var V;try{const B=(V=h==null?void 0:h.registry)==null?void 0:V[A];if(!B)return;const W=typeof B=="function"?await B():B;!j&&W&&typeof W=="object"&&x.reset({...t.defaultValues??{},...W})}catch{}})(),()=>{j=!0}},[t,h==null?void 0:h.registry,x.reset]);const{control:v,reset:m,handleSubmit:y,formState:{errors:w,isSubmitting:O}}=x,[S,T]=b.useState(!1);b.useEffect(()=>{d&&(T(!0),d().then(A=>m(A)).finally(()=>T(!1)))},[d,m]);const C=b.useMemo(()=>(r??[]).filter(Of),[r]),{loadingCount:N,optionsMap:_}=bf(C),[I,z]=b.useState({});b.useEffect(()=>{let A=!0;return(async()=>{const V=await Promise.all(C.filter(W=>W.type==="select"&&W.optionSource).map(async W=>{var ge;const Q=W.name,M=W.optionSource,J=bo(W.adapterCtx??W.optionAdapterCtx),he=(ge=h==null?void 0:h.registry)==null?void 0:ge[M];if(typeof he!="function")return[Q,[]];try{const de=await Promise.resolve(he("",{getValues:x.getValues,watch:x.watch,ctx:J})),Se=Array.isArray(de)?de:[];return[Q,Se]}catch{return[Q,[]]}}));if(!A)return;const B={};for(const[W,Q]of V)B[W]=Q;z(B)})(),()=>{A=!1}},[h==null?void 0:h.registry,x.getValues,x.watch,JSON.stringify(C.map(A=>({n:A.name,os:A.optionSource??null,ctx:A.adapterCtx??A.optionAdapterCtx??null,staticLen:Array.isArray(A.options)?A.options.length:-1})))]),b.useEffect(()=>{let A=!0;return(async()=>{var V;for(const B of C){if(B.type!=="select")continue;const W=B.name,Q=B.defaultSource;if(!Q)continue;const M=x.getValues(W);if(!(M==null||(Array.isArray(M)?M.length===0:M==="")))continue;const he=(V=h==null?void 0:h.registry)==null?void 0:V[Q];if(typeof he=="function")try{const ge=bo(B.adapterCtx??B.optionAdapterCtx),de=await Promise.resolve(he("",{getValues:x.getValues,watch:x.watch,ctx:ge}));if(!A)return;const Se=Ef(de,!!B.multiple);x.setValue(W,Se,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{A=!1}},[h==null?void 0:h.registry,x.getValues,x.setValue,JSON.stringify(C.map(A=>({n:A.name,ds:A.defaultSource??null,mult:!!A.multiple})))]);const U=hf(r),D=kf(r,v),$=b.useMemo(()=>{const A={};return s.forEach((j,V)=>{j.type==="tabs"&&(A[V]=j.tabs[0].key)}),A},[s]),[E,Z]=b.useState($),se=b.useCallback((A,j)=>{if(!(A!=null&&A.enabled)||!A.rule)return j;try{return!!Rr(A.rule,x.getValues())}catch{return j}},[x]),q=b.useMemo(()=>r.map(A=>A).filter(A=>{var j;return((j=A.clearWhen)==null?void 0:j.enabled)&&A.clearWhen.rule}).map(A=>({name:A.name,rule:A.clearWhen.rule,clearTo:A.clearWhen.clearTo})),[r]);b.useEffect(()=>{if(!q.length)return;const A=V=>{q.forEach(({name:B,rule:W,clearTo:Q})=>{try{if(!!Rr(W,V)){const J=Q??"";V[B]!==J&&x.setValue(B,J,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};A(x.getValues());const j=x.watch(()=>A(x.getValues()));return()=>{var V;return(V=j==null?void 0:j.unsubscribe)==null?void 0:V.call(j)}},[x,q]);const ae=b.useCallback(A=>{var de,Se,be,pe;let j;if(typeof A=="string"){if(j=U[A],!j){const fe=(r??[]).find(me=>(me==null?void 0:me.name)===A);if(fe)j=fe;else return null}}else j=A;const V=j.visibleWhen;if(!se(V,!0))return null;let W=!!j.disabled;const Q=j.disabledWhen,M=se(Q,!1);if(Q!=null&&Q.enabled&&(W=M),!(Q!=null&&Q.enabled)&&"name"in j&&j.name&&D[j.name]&&(W=!0),j.type==="search"){const fe=typeof j.searchFn=="function",me=j.searchSource,we=async Ce=>{var Te;if(fe)return j.searchFn(Ce,{getValues:x.getValues,watch:x.watch});if(me){const k=(Te=h==null?void 0:h.registry)==null?void 0:Te[me];if(typeof k=="function")return await k(Ce,{getValues:x.getValues,watch:x.watch});if(Array.isArray(k))return k}return[]},ce={};return j.searchMode&&(ce.searchMode=j.searchMode),j.minChars&&(ce.minChars=j.minChars),j.debounceMs&&(ce.debounceMs=j.debounceMs),j.resolveByValue&&(ce.resolveByValue=j.resolveByValue),l.jsx(hl,{name:j.name,control:v,searchFn:we,label:j.label,size:j.size,width:j.width,disabled:W||O,...ce},j.name)}if(j.type==="inputGroup"){const fe=j,me=(fe.inputs??[]).map(we=>{var L;const ce=typeof we=="string"?U[we]??(r??[]).find(ee=>(ee==null?void 0:ee.name)===we):we;if(!ce)return null;const Ce=ce.disabledWhen;let Te=!!ce.disabled;const k=se(Ce,!1);Ce!=null&&Ce.enabled&&(Te=k),!(Ce!=null&&Ce.enabled)&&D[ce.name]&&(Te=!0);const F={name:ce.name,control:v,label:ce.label,size:ce.size,width:ce.width,placeholder:ce.placeholder,hasError:!!w[ce.name],errorMessage:((L=w[ce.name])==null?void 0:L.message)||"",loading:S,disabled:Te||O,suffixButton:ce.suffixButton,reserveErrorSpace:!0};return ce.type==="select"?{...F,options:ce.options??I[ce.name]??_[ce.name]??[],loadOptions:ce.options||ce.optionSource?void 0:ce.loadOptions}:{...F,type:ce.type}}).filter(Boolean);return l.jsx(ll,{groupLabel:fe.groupLabel,inputs:me,separator:fe.separator,useSeparator:fe.useSeparator,className:fe.className,showVisibleLabel:fe.showVisibleLabel,size:fe.size},`inputGroup_${fe.name??fe.groupLabel??"group"}`)}if(j.type==="button"){const fe=j;return l.jsx("div",{className:"self-center",children:l.jsx(le,{type:"button",variant:fe.variant,size:fe.size,width:fe.width,icon:fe.icon,iconPosition:fe.iconPosition,ariaLabel:fe.ariaLabel,onClick:fe.onClick,disabled:W||O,children:fe.label})},fe.name)}const J=j.suffixButton,he=typeof J=="string"?ae(J):J,ge={name:j.name,control:v,disabled:W||O,label:j.label,size:j.size,width:j.width,placeholder:j.placeholder,info:j.info,suffixButton:he};switch(j.type){case"select":{const fe=j.name,me=j.options??I[fe]??_[fe]??[],we=Array.isArray(me)&&me.length?`${me.length}:${me.map(Ce=>String((Ce==null?void 0:Ce.value)??"")).join("|")}`:"0",ce=!j.options&&!j.optionSource&&j.loadOptions;return l.jsx(vt,{name:fe,control:v,render:({field:Ce})=>{var Te;return l.jsx(nt,{...ge,value:Ce.value,onChange:Ce.onChange,options:me,loadOptions:ce||void 0,hasError:!!w[fe],errorMessage:(Te=w[fe])==null?void 0:Te.message,suffixButton:he})}},`${fe}:${we}`)}case"textarea":return l.jsx(vt,{name:j.name,control:v,render:({field:fe,fieldState:me})=>{var we;return l.jsx(Gr,{...ge,value:fe.value,onChange:fe.onChange,maxLength:j.maxLength,showCounter:!!j.showCounter,hasError:!!me.error,errorMessage:((we=me.error)==null?void 0:we.message)||""})}},j.name);case"file":return l.jsx(Bi,{...ge,defaultValue:[],maxFiles:j.maxFiles,accept:j.accept,hasError:!!w[j.name],errorMessage:(de=w[j.name])==null?void 0:de.message},j.name);case"checkbox":return l.jsx(ft,{...ge,defaultValue:!1,hasError:!!w[j.name],errorMessage:(Se=w[j.name])==null?void 0:Se.message,name:j.name},j.name);case"date":return l.jsx(Ms,{...ge,defaultValue:"",showTime:!!j.showTime,hasError:!!w[j.name],errorMessage:(be=w[j.name])==null?void 0:be.message},j.name);case"optionGroup":return l.jsx(cl,{...ge,options:j.options||[],multiple:j.multiple,vertical:j.vertical,groupLabel:j.groupLabel,defaultValue:j.defaultValue,className:j.width?void 0:"w-full",name:j.name},j.name);default:return l.jsx(fa,{...ge,type:j.type,loadingDefaults:S,hasError:!!w[j.name],errorMessage:(pe=w[j.name])==null?void 0:pe.message,suffixButton:he,name:j.name},j.name)}},[r,U,v,w,O,S,_,I,se,D,x.getValues,x.watch,h==null?void 0:h.registry]);return l.jsx(Rd,{...x,children:l.jsxs("form",{noValidate:!0,onSubmit:y(async A=>{await n(A),f(a??p("ds.form.saveSuccess"),"success")},A=>{console.log("❌ errores de validación:",A),tf(A),f(o??p("ds.form.saveError"),"error")}),className:"space-y-6",children:[s.map((A,j)=>A.type==="rows"?l.jsx(b.Fragment,{children:A.sections.map((V,B)=>l.jsx("div",{className:"mb-6",children:l.jsx(ct,{title:V.sectionTitle,defaultOpen:V.defaultOpen,children:V.rows.map((W,Q)=>l.jsxs("div",{children:[W.title&&l.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:W.title}),l.jsx("div",{className:"flex flex-wrap -mx-2",children:W.columns.map((M,J)=>{var he;return l.jsx("div",{className:`${M.width} px-2 flex flex-col`,children:l.jsx("div",{className:"space-y-4",children:M.fields?M.fields.map(ge=>ae(ge)):(he=M.rows)==null?void 0:he.map((ge,de)=>l.jsx("div",{className:"mb-1",children:l.jsx("div",{className:"flex flex-wrap -mx-2",children:ge.columns.map((Se,be)=>{var pe;return l.jsx("div",{className:`${Se.width} px-2`,children:(pe=Se.fields)==null?void 0:pe.map(fe=>ae(fe))},be)})})},de))})},J)})})]},Q))})},B))},j):l.jsx(Hs,{options:A.tabs.map(V=>({label:V.label,value:V.key})),value:E[j],onChange:V=>Z(B=>({...B,[j]:V})),children:Object.fromEntries(A.tabs.map(V=>[V.key,l.jsx("div",{className:"space-y-6",children:V.sections.map((B,W)=>l.jsx("div",{className:"mb-6",children:l.jsx(ct,{title:B.sectionTitle,defaultOpen:B.defaultOpen,children:B.rows.map((Q,M)=>l.jsx("div",{children:l.jsx("div",{className:"flex flex-wrap -mx-2",children:Q.columns.map((J,he)=>{var ge;return l.jsx("div",{className:`${J.width??"flex-1"} px-2 flex flex-col`,children:l.jsx("div",{className:"space-y-4",children:(ge=J.fields)==null?void 0:ge.map((de,Se)=>l.jsx(b.Fragment,{children:ae(de)},Se))})},he)})})},M))})},W))},V.key)]))},j)),l.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:i??l.jsx(le,{type:"submit",variant:"primary",icon:jc,size:"sm",disabled:O||S||N>0,children:p(O?"ds.form.sending":"ds.form.submit")})})]})})}const xe=t=>typeof t=="string",As=()=>{let t,e;const s=new Promise((r,n)=>{t=r,e=n});return s.resolve=t,s.reject=e,s},xo=t=>t==null?"":""+t,Af=(t,e,s)=>{t.forEach(r=>{e[r]&&(s[r]=e[r])})},Tf=/###/g,vo=t=>t&&t.indexOf("###")>-1?t.replace(Tf,"."):t,yo=t=>!t||xe(t),_s=(t,e,s)=>{const r=xe(e)?e.split("."):e;let n=0;for(;n<r.length-1;){if(yo(t))return{};const a=vo(r[n]);!t[a]&&s&&(t[a]=new s),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++n}return yo(t)?{}:{obj:t,k:vo(r[n])}},wo=(t,e,s)=>{const{obj:r,k:n}=_s(t,e,Object);if(r!==void 0||e.length===1){r[n]=s;return}let a=e[e.length-1],o=e.slice(0,e.length-1),i=_s(t,o,Object);for(;i.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),i=_s(t,o,Object),i!=null&&i.obj&&typeof i.obj[`${i.k}.${a}`]<"u"&&(i.obj=void 0);i.obj[`${i.k}.${a}`]=s},Ff=(t,e,s,r)=>{const{obj:n,k:a}=_s(t,e,Object);n[a]=n[a]||[],n[a].push(s)},_r=(t,e)=>{const{obj:s,k:r}=_s(t,e);if(s&&Object.prototype.hasOwnProperty.call(s,r))return s[r]},Rf=(t,e,s)=>{const r=_r(t,s);return r!==void 0?r:_r(e,s)},ml=(t,e,s)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?xe(t[r])||t[r]instanceof String||xe(e[r])||e[r]instanceof String?s&&(t[r]=e[r]):ml(t[r],e[r],s):t[r]=e[r]);return t},ds=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Df=t=>xe(t)?t.replace(/[&<>"'\/]/g,e=>_f[e]):t;class $f{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const s=this.regExpMap.get(e);if(s!==void 0)return s;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const Lf=[" ",",","?","!",";"],Mf=new $f(20),Pf=(t,e,s)=>{e=e||"",s=s||"";const r=Lf.filter(o=>e.indexOf(o)<0&&s.indexOf(o)<0);if(r.length===0)return!0;const n=Mf.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let a=!n.test(t);if(!a){const o=t.indexOf(s);o>0&&!n.test(t.substring(0,o))&&(a=!0)}return a},Kn=(t,e,s=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(s);let n=t;for(let a=0;a<r.length;){if(!n||typeof n!="object")return;let o,i="";for(let c=a;c<r.length;++c)if(c!==a&&(i+=s),i+=r[c],o=n[i],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;a+=c-a+1;break}n=o}return n},Ps=t=>t==null?void 0:t.replace("_","-"),If={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var s,r;(r=(s=console==null?void 0:console[t])==null?void 0:s.apply)==null||r.call(s,console,e)}};class Dr{constructor(e,s={}){this.init(e,s)}init(e,s={}){this.prefix=s.prefix||"i18next:",this.logger=e||If,this.options=s,this.debug=s.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,s,r,n){return n&&!this.debug?null:(xe(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[s](e))}create(e){return new Dr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Dr(this.logger,e)}}var Et=new Dr;class Zr{constructor(){this.observers={}}on(e,s){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const n=this.observers[r].get(s)||0;this.observers[r].set(s,n+1)}),this}off(e,s){if(this.observers[e]){if(!s){delete this.observers[e];return}this.observers[e].delete(s)}}emit(e,...s){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([n,a])=>{for(let o=0;o<a;o++)n(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([n,a])=>{for(let o=0;o<a;o++)n.apply(n,[e,...s])})}}class jo extends Zr{constructor(e,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const s=this.options.ns.indexOf(e);s>-1&&this.options.ns.splice(s,1)}getResource(e,s,r,n={}){var d,u;const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,o=n.ignoreJSONStructure!==void 0?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let i;e.indexOf(".")>-1?i=e.split("."):(i=[e,s],r&&(Array.isArray(r)?i.push(...r):xe(r)&&a?i.push(...r.split(a)):i.push(r)));const c=_r(this.data,i);return!c&&!s&&!r&&e.indexOf(".")>-1&&(e=i[0],s=i[1],r=i.slice(2).join(".")),c||!o||!xe(r)?c:Kn((u=(d=this.data)==null?void 0:d[e])==null?void 0:u[s],r,a)}addResource(e,s,r,n,a={silent:!1}){const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let i=[e,s];r&&(i=i.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(i=e.split("."),n=s,s=i[1]),this.addNamespaces(s),wo(this.data,i,n),a.silent||this.emit("added",e,s,r,n)}addResources(e,s,r,n={silent:!1}){for(const a in r)(xe(r[a])||Array.isArray(r[a]))&&this.addResource(e,s,a,r[a],{silent:!0});n.silent||this.emit("added",e,s,r)}addResourceBundle(e,s,r,n,a,o={silent:!1,skipCopy:!1}){let i=[e,s];e.indexOf(".")>-1&&(i=e.split("."),n=r,r=s,s=i[1]),this.addNamespaces(s);let c=_r(this.data,i)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?ml(c,r,a):c={...c,...r},wo(this.data,i,c),o.silent||this.emit("added",e,s,r)}removeResourceBundle(e,s){this.hasResourceBundle(e,s)&&delete this.data[e][s],this.removeNamespaces(s),this.emit("removed",e,s)}hasResourceBundle(e,s){return this.getResource(e,s)!==void 0}getResourceBundle(e,s){return s||(s=this.options.defaultNS),this.getResource(e,s)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const s=this.getDataByLanguage(e);return!!(s&&Object.keys(s)||[]).find(n=>s[n]&&Object.keys(s[n]).length>0)}toJSON(){return this.data}}var gl={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,s,r,n){return t.forEach(a=>{var o;e=((o=this.processors[a])==null?void 0:o.process(e,s,r,n))??e}),e}};const ko={},So=t=>!xe(t)&&typeof t!="boolean"&&typeof t!="number";class $r extends Zr{constructor(e,s={}){super(),Af(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Et.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,s={interpolation:{}}){const r={...s};if(e==null)return!1;const n=this.resolve(e,r);return(n==null?void 0:n.res)!==void 0}extractFromKey(e,s){let r=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=s.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,i=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Pf(e,r,n);if(o&&!i){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:xe(a)?[a]:a};const d=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(d[0])>-1)&&(a=d.shift()),e=d.join(n)}return{key:e,namespaces:xe(a)?[a]:a}}translate(e,s,r){let n=typeof s=="object"?{...s}:s;if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const a=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:i,namespaces:c}=this.extractFromKey(e[e.length-1],n),d=c[c.length-1];let u=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const f=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return p?a?{res:`${d}${u}${i}`,usedKey:i,exactUsedKey:i,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:`${d}${u}${i}`:a?{res:i,usedKey:i,exactUsedKey:i,usedLng:f,usedNS:d,usedParams:this.getUsedParamsDetails(n)}:i;const h=this.resolve(e,n);let g=h==null?void 0:h.res;const x=(h==null?void 0:h.usedKey)||i,v=(h==null?void 0:h.exactUsedKey)||i,m=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,O=n.count!==void 0&&!xe(n.count),S=$r.hasDefaultValue(n),T=O?this.pluralResolver.getSuffix(f,n.count,n):"",C=n.ordinal&&O?this.pluralResolver.getSuffix(f,n.count,{ordinal:!1}):"",N=O&&!n.ordinal&&n.count===0,_=N&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${T}`]||n[`defaultValue${C}`]||n.defaultValue;let I=g;w&&!g&&S&&(I=_);const z=So(I),U=Object.prototype.toString.apply(I);if(w&&I&&z&&m.indexOf(U)<0&&!(xe(y)&&Array.isArray(I))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,I,{...n,ns:c}):`key '${i} (${this.language})' returned an object instead of string.`;return a?(h.res=D,h.usedParams=this.getUsedParamsDetails(n),h):D}if(o){const D=Array.isArray(I),$=D?[]:{},E=D?v:x;for(const Z in I)if(Object.prototype.hasOwnProperty.call(I,Z)){const se=`${E}${o}${Z}`;S&&!g?$[Z]=this.translate(se,{...n,defaultValue:So(_)?_[Z]:void 0,joinArrays:!1,ns:c}):$[Z]=this.translate(se,{...n,joinArrays:!1,ns:c}),$[Z]===se&&($[Z]=I[Z])}g=$}}else if(w&&xe(y)&&Array.isArray(g))g=g.join(y),g&&(g=this.extendTranslation(g,e,n,r));else{let D=!1,$=!1;!this.isValidLookup(g)&&S&&(D=!0,g=_),this.isValidLookup(g)||($=!0,g=i);const Z=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&$?void 0:g,se=S&&_!==g&&this.options.updateMissing;if($||D||se){if(this.logger.log(se?"updateKey":"missingKey",f,d,i,se?_:g),o){const j=this.resolve(i,{...n,keySeparator:!1});j&&j.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let q=[];const ae=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ae&&ae[0])for(let j=0;j<ae.length;j++)q.push(ae[j]);else this.options.saveMissingTo==="all"?q=this.languageUtils.toResolveHierarchy(n.lng||this.language):q.push(n.lng||this.language);const A=(j,V,B)=>{var Q;const W=S&&B!==g?B:Z;this.options.missingKeyHandler?this.options.missingKeyHandler(j,d,V,W,se,n):(Q=this.backendConnector)!=null&&Q.saveMissing&&this.backendConnector.saveMissing(j,d,V,W,se,n),this.emit("missingKey",j,d,V,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&O?q.forEach(j=>{const V=this.pluralResolver.getSuffixes(j,n);N&&n[`defaultValue${this.options.pluralSeparator}zero`]&&V.indexOf(`${this.options.pluralSeparator}zero`)<0&&V.push(`${this.options.pluralSeparator}zero`),V.forEach(B=>{A([j],i+B,n[`defaultValue${B}`]||_)})}):A(q,i,_))}g=this.extendTranslation(g,e,n,h,r),$&&g===i&&this.options.appendNamespaceToMissingKey&&(g=`${d}${u}${i}`),($||D)&&this.options.parseMissingKeyHandler&&(g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${u}${i}`:i,D?g:void 0,n))}return a?(h.res=g,h.usedParams=this.getUsedParamsDetails(n),h):g}extendTranslation(e,s,r,n,a){var c,d;if((c=this.i18nFormat)!=null&&c.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=xe(e)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(u){const h=e.match(this.interpolator.nestingRegexp);f=h&&h.length}let p=r.replace&&!xe(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),e=this.interpolator.interpolate(e,p,r.lng||this.language||n.usedLng,r),u){const h=e.match(this.interpolator.nestingRegexp),g=h&&h.length;f<g&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...h)=>(a==null?void 0:a[0])===h[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${s[0]}`),null):this.translate(...h,s),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,i=xe(o)?[o]:o;return e!=null&&(i!=null&&i.length)&&r.applyPostProcessor!==!1&&(e=gl.handle(i,e,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,s={}){let r,n,a,o,i;return xe(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,s),u=d.key;n=u;let f=d.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=s.count!==void 0&&!xe(s.count),h=p&&!s.ordinal&&s.count===0,g=s.context!==void 0&&(xe(s.context)||typeof s.context=="number")&&s.context!=="",x=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);f.forEach(v=>{var m,y;this.isValidLookup(r)||(i=v,!ko[`${x[0]}-${v}`]&&((m=this.utils)!=null&&m.hasLoadedNamespace)&&!((y=this.utils)!=null&&y.hasLoadedNamespace(i))&&(ko[`${x[0]}-${v}`]=!0,this.logger.warn(`key "${n}" for languages "${x.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(w=>{var T;if(this.isValidLookup(r))return;o=w;const O=[u];if((T=this.i18nFormat)!=null&&T.addLookupKeys)this.i18nFormat.addLookupKeys(O,u,w,v,s);else{let C;p&&(C=this.pluralResolver.getSuffix(w,s.count,s));const N=`${this.options.pluralSeparator}zero`,_=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(O.push(u+C),s.ordinal&&C.indexOf(_)===0&&O.push(u+C.replace(_,this.options.pluralSeparator)),h&&O.push(u+N)),g){const I=`${u}${this.options.contextSeparator}${s.context}`;O.push(I),p&&(O.push(I+C),s.ordinal&&C.indexOf(_)===0&&O.push(I+C.replace(_,this.options.pluralSeparator)),h&&O.push(I+N))}}let S;for(;S=O.pop();)this.isValidLookup(r)||(a=S,r=this.getResource(w,v,S,s))}))})}),{res:r,usedKey:n,exactUsedKey:a,usedLng:o,usedNS:i}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,s,r,n={}){var a;return(a=this.i18nFormat)!=null&&a.getResource?this.i18nFormat.getResource(e,s,r,n):this.resourceStore.getResource(e,s,r,n)}getUsedParamsDetails(e={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!xe(e.replace);let n=r?e.replace:e;if(r&&typeof e.count<"u"&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!r){n={...n};for(const a of s)delete n[a]}return n}static hasDefaultValue(e){const s="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&s===r.substring(0,s.length)&&e[r]!==void 0)return!0;return!1}}class No{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Et.create("languageUtils")}getScriptPartFromCode(e){if(e=Ps(e),!e||e.indexOf("-")<0)return null;const s=e.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(e){if(e=Ps(e),!e||e.indexOf("-")<0)return e;const s=e.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(e){if(xe(e)&&e.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(e)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let s;return e.forEach(r=>{if(s)return;const n=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(n))&&(s=n)}),!s&&this.options.supportedLngs&&e.forEach(r=>{if(s)return;const n=this.getScriptPartFromCode(r);if(this.isSupportedCode(n))return s=n;const a=this.getLanguagePartFromCode(r);if(this.isSupportedCode(a))return s=a;s=this.options.supportedLngs.find(o=>{if(o===a)return o;if(!(o.indexOf("-")<0&&a.indexOf("-")<0)&&(o.indexOf("-")>0&&a.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===a||o.indexOf(a)===0&&a.length>1))return o})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(e,s){if(!e)return[];if(typeof e=="function"&&(e=e(s)),xe(e)&&(e=[e]),Array.isArray(e))return e;if(!s)return e.default||[];let r=e[s];return r||(r=e[this.getScriptPartFromCode(s)]),r||(r=e[this.formatLanguageCode(s)]),r||(r=e[this.getLanguagePartFromCode(s)]),r||(r=e.default),r||[]}toResolveHierarchy(e,s){const r=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],e),n=[],a=o=>{o&&(this.isSupportedCode(o)?n.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return xe(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):xe(e)&&a(this.formatLanguageCode(e)),r.forEach(o=>{n.indexOf(o)<0&&a(this.formatLanguageCode(o))}),n}}const Co={zero:0,one:1,two:2,few:3,many:4,other:5},Eo={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Vf{constructor(e,s={}){this.languageUtils=e,this.options=s,this.logger=Et.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,s){this.rules[e]=s}clearCache(){this.pluralRulesCache={}}getRule(e,s={}){const r=Ps(e==="dev"?"en":e),n=s.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:r,type:n});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let o;try{o=new Intl.PluralRules(r,{type:n})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Eo;if(!e.match(/-|_/))return Eo;const c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,s)}return this.pluralRulesCache[a]=o,o}needsPlural(e,s={}){let r=this.getRule(e,s);return r||(r=this.getRule("dev",s)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,s,r={}){return this.getSuffixes(e,r).map(n=>`${s}${n}`)}getSuffixes(e,s={}){let r=this.getRule(e,s);return r||(r=this.getRule("dev",s)),r?r.resolvedOptions().pluralCategories.sort((n,a)=>Co[n]-Co[a]).map(n=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${n}`):[]}getSuffix(e,s,r={}){const n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(s)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",s,r))}}const Oo=(t,e,s,r=".",n=!0)=>{let a=Rf(t,e,s);return!a&&n&&xe(s)&&(a=Kn(t,s,r),a===void 0&&(a=Kn(e,s,r))),a},pn=t=>t.replace(/\$/g,"$$$$");class zf{constructor(e={}){var s;this.logger=Et.create("interpolator"),this.options=e,this.format=((s=e==null?void 0:e.interpolation)==null?void 0:s.format)||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:s,escapeValue:r,useRawValueToEscape:n,prefix:a,prefixEscaped:o,suffix:i,suffixEscaped:c,formatSeparator:d,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:x,nestingOptionsSeparator:v,maxReplaces:m,alwaysFormat:y}=e.interpolation;this.escape=s!==void 0?s:Df,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=n!==void 0?n:!1,this.prefix=a?ds(a):o||"{{",this.suffix=i?ds(i):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=p?ds(p):h||ds("$t("),this.nestingSuffix=g?ds(g):x||ds(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=m||1e3,this.alwaysFormat=y!==void 0?y:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(s,r)=>(s==null?void 0:s.source)===r?(s.lastIndex=0,s):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,s,r,n){var h;let a,o,i;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=g=>{if(g.indexOf(this.formatSeparator)<0){const y=Oo(s,c,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...n,...s,interpolationkey:g}):y}const x=g.split(this.formatSeparator),v=x.shift().trim(),m=x.join(this.formatSeparator).trim();return this.format(Oo(s,c,v,this.options.keySeparator,this.options.ignoreJSONStructure),m,r,{...n,...s,interpolationkey:v})};this.resetRegExp();const u=(n==null?void 0:n.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((h=n==null?void 0:n.interpolation)==null?void 0:h.skipOnVariables)!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>pn(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?pn(this.escape(g)):pn(g)}].forEach(g=>{for(i=0;a=g.regex.exec(e);){const x=a[1].trim();if(o=d(x),o===void 0)if(typeof u=="function"){const m=u(e,a,n);o=xe(m)?m:""}else if(n&&Object.prototype.hasOwnProperty.call(n,x))o="";else if(f){o=a[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`),o="";else!xe(o)&&!this.useRawValueToEscape&&(o=xo(o));const v=g.safeValue(o);if(e=e.replace(a[0],v),f?(g.regex.lastIndex+=o.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,s,r={}){let n,a,o;const i=(c,d)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const f=c.split(new RegExp(`${u}[ ]*{`));let p=`{${f[1]}`;c=f[0],p=this.interpolate(p,o);const h=p.match(/'/g),g=p.match(/"/g);(((h==null?void 0:h.length)??0)%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),d&&(o={...d,...o})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,x),`${c}${u}${p}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;n=this.nestingRegexp.exec(e);){let c=[];o={...r},o=o.replace&&!xe(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let d=!1;if(n[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(n[1])){const u=n[1].split(this.formatSeparator).map(f=>f.trim());n[1]=u.shift(),c=u,d=!0}if(a=s(i.call(this,n[1].trim(),o),o),a&&n[0]===e&&!xe(a))return a;xe(a)||(a=xo(a)),a||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),a=""),d&&(a=c.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:n[1].trim()}),a.trim())),e=e.replace(n[0],a),this.regexp.lastIndex=0}return e}}const Bf=t=>{let e=t.toLowerCase().trim();const s={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const n=r[1].substring(0,r[1].length-1);e==="currency"&&n.indexOf(":")<0?s.currency||(s.currency=n.trim()):e==="relativetime"&&n.indexOf(":")<0?s.range||(s.range=n.trim()):n.split(";").forEach(o=>{if(o){const[i,...c]=o.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),u=i.trim();s[u]||(s[u]=d),d==="false"&&(s[u]=!1),d==="true"&&(s[u]=!0),isNaN(d)||(s[u]=parseInt(d,10))}})}return{formatName:e,formatOptions:s}},Ao=t=>{const e={};return(s,r,n)=>{let a=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(a={...a,[n.interpolationkey]:void 0});const o=r+JSON.stringify(a);let i=e[o];return i||(i=t(Ps(r),n),e[o]=i),i(s)}},Uf=t=>(e,s,r)=>t(Ps(s),r)(e);class Kf{constructor(e={}){this.logger=Et.create("formatter"),this.options=e,this.init(e)}init(e,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const r=s.cacheInBuiltFormats?Ao:Uf;this.formats={number:r((n,a)=>{const o=new Intl.NumberFormat(n,{...a});return i=>o.format(i)}),currency:r((n,a)=>{const o=new Intl.NumberFormat(n,{...a,style:"currency"});return i=>o.format(i)}),datetime:r((n,a)=>{const o=new Intl.DateTimeFormat(n,{...a});return i=>o.format(i)}),relativetime:r((n,a)=>{const o=new Intl.RelativeTimeFormat(n,{...a});return i=>o.format(i,a.range||"day")}),list:r((n,a)=>{const o=new Intl.ListFormat(n,{...a});return i=>o.format(i)})}}add(e,s){this.formats[e.toLowerCase().trim()]=s}addCached(e,s){this.formats[e.toLowerCase().trim()]=Ao(s)}format(e,s,r,n={}){const a=s.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(i=>i.indexOf(")")>-1)){const i=a.findIndex(c=>c.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,i)].join(this.formatSeparator)}return a.reduce((i,c)=>{var f;const{formatName:d,formatOptions:u}=Bf(c);if(this.formats[d]){let p=i;try{const h=((f=n==null?void 0:n.formatParams)==null?void 0:f[n.interpolationkey])||{},g=h.locale||h.lng||n.locale||n.lng||r;p=this.formats[d](i,g,{...u,...n,...h})}catch(h){this.logger.warn(h)}return p}else this.logger.warn(`there was no format function for ${d}`);return i},e)}}const qf=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Wf extends Zr{constructor(e,s,r,n={}){var a,o;super(),this.backend=e,this.store=s,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=Et.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],(o=(a=this.backend)==null?void 0:a.init)==null||o.call(a,r,n.backend,n)}queueLoad(e,s,r,n){const a={},o={},i={},c={};return e.forEach(d=>{let u=!0;s.forEach(f=>{const p=`${d}|${f}`;!r.reload&&this.store.hasResourceBundle(d,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,u=!1,o[p]===void 0&&(o[p]=!0),a[p]===void 0&&(a[p]=!0),c[f]===void 0&&(c[f]=!0)))}),u||(i[d]=!0)}),(Object.keys(a).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(a),pending:Object.keys(o),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(c)}}loaded(e,s,r){const n=e.split("|"),a=n[0],o=n[1];s&&this.emit("failedLoading",a,o,s),!s&&r&&this.store.addResourceBundle(a,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=s?-1:2,s&&r&&(this.state[e]=0);const i={};this.queue.forEach(c=>{Ff(c.loaded,[a],o),qf(c,e),s&&c.errors.push(s),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{i[d]||(i[d]={});const u=c.loaded[d];u.length&&u.forEach(f=>{i[d][f]===void 0&&(i[d][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(c=>!c.done)}read(e,s,r,n=0,a=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:s,fcName:r,tried:n,wait:a,callback:o});return}this.readingCalls++;const i=(d,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(d&&u&&n<this.maxRetries){setTimeout(()=>{this.read.call(this,e,s,r,n+1,a*2,o)},a);return}o(d,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(e,s);d&&typeof d.then=="function"?d.then(u=>i(null,u)).catch(i):i(null,d)}catch(d){i(d)}return}return c(e,s,i)}prepareLoading(e,s,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();xe(e)&&(e=this.languageUtils.toResolveHierarchy(e)),xe(s)&&(s=[s]);const a=this.queueLoad(e,s,r,n);if(!a.toLoad.length)return a.pending.length||n(),null;a.toLoad.forEach(o=>{this.loadOne(o)})}load(e,s,r){this.prepareLoading(e,s,{},r)}reload(e,s,r){this.prepareLoading(e,s,{reload:!0},r)}loadOne(e,s=""){const r=e.split("|"),n=r[0],a=r[1];this.read(n,a,"read",void 0,void 0,(o,i)=>{o&&this.logger.warn(`${s}loading namespace ${a} for language ${n} failed`,o),!o&&i&&this.logger.log(`${s}loaded namespace ${a} for language ${n}`,i),this.loaded(e,o,i)})}saveMissing(e,s,r,n,a,o={},i=()=>{}){var c,d,u,f,p;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((f=(u=this.services)==null?void 0:u.utils)!=null&&f.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${r}" as the namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((p=this.backend)!=null&&p.create){const h={...o,isUpdate:a},g=this.backend.create.bind(this.backend);if(g.length<6)try{let x;g.length===5?x=g(e,s,r,n,h):x=g(e,s,r,n),x&&typeof x.then=="function"?x.then(v=>i(null,v)).catch(i):i(null,x)}catch(x){i(x)}else g(e,s,r,n,i,h)}!e||!e[0]||this.store.addResource(e[0],s,r,n)}}}const To=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),xe(t[1])&&(e.defaultValue=t[1]),xe(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const s=t[3]||t[2];Object.keys(s).forEach(r=>{e[r]=s[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Fo=t=>{var e,s;return xe(t.ns)&&(t.ns=[t.ns]),xe(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),xe(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((s=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:s.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},pr=()=>{},Jf=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(s=>{typeof t[s]=="function"&&(t[s]=t[s].bind(t))})};class Is extends Zr{constructor(e={},s){if(super(),this.options=Fo(e),this.services={},this.logger=Et,this.modules={external:[]},Jf(this),s&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,s),this;setTimeout(()=>{this.init(e,s)},0)}}init(e={},s){this.isInitializing=!0,typeof e=="function"&&(s=e,e={}),e.defaultNS==null&&e.ns&&(xe(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=To();this.options={...r,...this.options,...Fo(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const n=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?Et.init(n(this.modules.logger),this.options):Et.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=Kf;const u=new No(this.options);this.store=new jo(this.options.resources,this.options);const f=this.services;f.logger=Et,f.resourceStore=this.store,f.languageUtils=u,f.pluralResolver=new Vf(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=n(d),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new zf(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Wf(n(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(p,...h)=>{this.emit(p,...h)}),this.modules.languageDetector&&(f.languageDetector=n(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=n(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new $r(this.services,this.options),this.translator.on("*",(p,...h)=>{this.emit(p,...h)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,s||(s=pr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...u)=>this.store[d](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...u)=>(this.store[d](...u),this)});const i=As(),c=()=>{const d=(u,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(f),s(u,f)};if(this.languages&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),i}loadResources(e,s=pr){var a,o;let r=s;const n=xe(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((n==null?void 0:n.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(f=>{f!=="cimode"&&i.indexOf(f)<0&&i.push(f)})};n?c(n):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(u=>c(u)),(o=(a=this.options.preload)==null?void 0:a.forEach)==null||o.call(a,d=>c(d)),this.services.backendConnector.load(i,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(e,s,r){const n=As();return typeof e=="function"&&(r=e,e=void 0),typeof s=="function"&&(r=s,s=void 0),e||(e=this.languages),s||(s=this.options.ns),r||(r=pr),this.services.backendConnector.reload(e,s,a=>{n.resolve(),r(a)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&gl.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let s=0;s<this.languages.length;s++){const r=this.languages[s];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,s){this.isLanguageChangingTo=e;const r=As();this.emit("languageChanging",e);const n=i=>{this.language=i,this.languages=this.services.languageUtils.toResolveHierarchy(i),this.resolvedLanguage=void 0,this.setResolvedLanguage(i)},a=(i,c)=>{c?this.isLanguageChangingTo===e&&(n(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),s&&s(i,(...d)=>this.t(...d))},o=i=>{var u,f;!e&&!i&&this.services.languageDetector&&(i=[]);const c=xe(i)?i:i&&i[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(xe(i)?[i]:i);d&&(this.language||n(d),this.translator.language||this.translator.changeLanguage(d),(f=(u=this.services.languageDetector)==null?void 0:u.cacheUserLanguage)==null||f.call(u,d)),this.loadResources(d,p=>{a(p,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,s,r){const n=(a,o,...i)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([a,o].concat(i)):c={...o},c.lng=c.lng||n.lng,c.lngs=c.lngs||n.lngs,c.ns=c.ns||n.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||n.keyPrefix);const d=this.options.keySeparator||".";let u;return c.keyPrefix&&Array.isArray(a)?u=a.map(f=>`${c.keyPrefix}${d}${f}`):u=c.keyPrefix?`${c.keyPrefix}${d}${a}`:a,this.t(u,c)};return xe(e)?n.lng=e:n.lngs=e,n.ns=s,n.keyPrefix=r,n}t(...e){var s;return(s=this.translator)==null?void 0:s.translate(...e)}exists(...e){var s;return(s=this.translator)==null?void 0:s.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,s={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=s.lng||this.resolvedLanguage||this.languages[0],n=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(i,c)=>{const d=this.services.backendConnector.state[`${i}|${c}`];return d===-1||d===0||d===2};if(s.precheck){const i=s.precheck(this,o);if(i!==void 0)return i}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!n||o(a,e)))}loadNamespaces(e,s){const r=As();return this.options.ns?(xe(e)&&(e=[e]),e.forEach(n=>{this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}),this.loadResources(n=>{r.resolve(),s&&s(n)}),r):(s&&s(),Promise.resolve())}loadLanguages(e,s){const r=As();xe(e)&&(e=[e]);const n=this.options.preload||[],a=e.filter(o=>n.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return a.length?(this.options.preload=n.concat(a),this.loadResources(o=>{r.resolve(),s&&s(o)}),r):(s&&s(),Promise.resolve())}dir(e){var n,a;if(e||(e=this.resolvedLanguage||(((n=this.languages)==null?void 0:n.length)>0?this.languages[0]:this.language)),!e)return"rtl";const s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((a=this.services)==null?void 0:a.languageUtils)||new No(To());return s.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},s){return new Is(e,s)}cloneInstance(e={},s=pr){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},a=new Is(n);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(i=>{a[i]=this[i]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r){const i=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((u,f)=>(u[f]={...c[d][f]},u),c[d]),c),{});a.store=new jo(i,n),a.services.resourceStore=a.store}return a.translator=new $r(a.services,n),a.translator.on("*",(i,...c)=>{a.emit(i,...c)}),a.init(n,s),a.translator.options=n,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Fe=Is.createInstance();Fe.createInstance=Is.createInstance;Fe.createInstance;Fe.dir;Fe.init;Fe.loadResources;Fe.reloadResources;Fe.use;Fe.changeLanguage;Fe.getFixedT;Fe.t;Fe.exists;Fe.setDefaultNamespace;Fe.hasLoadedNamespace;Fe.loadNamespaces;Fe.loadLanguages;const Hf={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function bl({icon:t,size:e="md",ariaLabel:s,disabled:r=!1,onClick:n,...a}){return l.jsx("button",{type:"button","aria-label":s,disabled:r,onClick:n,className:ne("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",Hf[e],r?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse"]),...a,children:l.jsx(t,{className:ne(e==="sm"?"h-4 w-4":e==="md"?"h-5 w-5":"h-6 w-6")})})}function xl({dark:t,onToggle:e}){return l.jsx("button",{type:"button","aria-pressed":t,"aria-label":t?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:e,className:ne("relative inline-flex items-center transition-colors focus:outline-none duration-200 ease-in-out","bg-[var(--color-ds-background-accent)]","h-6 w-12 rounded-full"),children:l.jsxs("div",{className:ne("absolute bg-[var(--color-ds-background-page)] flex items-center justify-center rounded-full transition-transform duration-200 ease-in-out","h-5 w-5",t?"translate-x-6":"translate-x-1"),children:[l.jsx(Nt,{component:qc,size:"sm",className:ne("absolute transition-opacity duration-200 ease-in-out",t?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),l.jsx(Nt,{component:zc,size:"sm",className:ne("absolute transition-opacity duration-200 ease-in-out",t?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const vl=b.createContext({theme:"light",toggle:()=>{}});function Gf({children:t}){const[e,s]=b.useState(!1),[r,n]=b.useState("light");b.useEffect(()=>{if(typeof window>"u")return;const o=localStorage.getItem("ds-theme");o==="light"||o==="dark"?n(o):window.matchMedia("(prefers-color-scheme: dark)").matches&&n("dark"),s(!0)},[]),b.useEffect(()=>{e&&(document.documentElement.classList.toggle("dark",r==="dark"),r==="dark"?localStorage.setItem("ds-theme","dark"):localStorage.removeItem("ds-theme"))},[r,e]);const a=()=>n(o=>o==="light"?"dark":"light");return e?l.jsx(vl.Provider,{value:{theme:r,toggle:a},children:t}):null}const yl=()=>b.useContext(vl),Ts={locale:"licytal:ui:locale",theme:"licytal:ui:theme"},wl=({pinnedPages:t,onRemovePinned:e,onBack:s,dark:r,locale:n,languageOptions:a,onChangeLocale:o,profile:i="",profileOptions:c=[],onChangeProfile:d})=>{const u=t.slice(0,3),{toggle:f}=yl(),{t:p,i18n:h}=da(),g=m=>{try{if(typeof(h==null?void 0:h.changeLanguage)=="function"){h.changeLanguage(m);return}if(typeof(Fe==null?void 0:Fe.changeLanguage)=="function"){Fe.changeLanguage(m);return}}catch{}},x=m=>{try{localStorage.setItem(Ts.locale,m)}catch{}g(m),o==null||o(m)},v=()=>{const m=!r;try{localStorage.setItem(Ts.theme,m?"dark":"light")}catch{}f()};return b.useEffect(()=>{try{const m=localStorage.getItem(Ts.locale),y=m||n,w=(h==null?void 0:h.language)??(Fe==null?void 0:Fe.language);y&&y!==w&&(g(y),m&&m!==n&&(o==null||o(m)))}catch{}},[]),b.useEffect(()=>{if(!n)return;const m=(h==null?void 0:h.language)??(Fe==null?void 0:Fe.language);if(n!==m){try{localStorage.setItem(Ts.locale,n)}catch{}g(n)}},[n]),b.useEffect(()=>{try{const m=localStorage.getItem(Ts.theme);if(!m)return;m==="dark"!==r&&f()}catch{}},[]),l.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[l.jsx("div",{className:"flex items-center space-x-2",children:u.map(m=>l.jsxs("div",{className:"flex items-center",children:[l.jsx("a",{href:m.href,className:ne("inline-flex items-center rounded-lg","py-1 px-1 my-1 text-ds-sm","bg-transparent text-[var(--color-ds-text-primary)]","transition-colors duration-200 ease-in-out","hover:bg-[var(--color-ds-border-muted)] hover:animate-pulse"),children:m.label}),l.jsx(bl,{icon:sa,size:"sm",ariaLabel:`${p("remove")} ${m.label}`,onClick:()=>e(m.id)})]},m.id))}),l.jsx("div",{className:"flex-grow"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(nt,{size:"sm",width:"auto",options:a,value:n,onChange:x,disableErrorPlaceholder:!0}),!!c.length&&l.jsx(nt,{size:"sm",width:"auto",options:c,value:i,onChange:m=>d==null?void 0:d(m),disableErrorPlaceholder:!0}),l.jsx(xl,{dark:r,onToggle:v})]})]})},Zf=({loading:t=!1,ariaLabel:e="Cargando..."})=>t?l.jsxs("div",{className:`\r
36
+ hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const I=String(k.value).trim();g(e,I,{shouldDirty:!0,shouldValidate:!0}),A(k.label??I),V.current=!1,z.current=!1,N(!1)},children:k.label},String(k.value)))})]})}})}const Nr=(e,t)=>e[t],eo=e=>e instanceof Date?e.getTime():e;function Zu(e,t,r){const s=eo(e),n=eo(t);return typeof s=="number"&&typeof n=="number"||typeof s=="string"&&typeof n=="string"?r==="gt"?s>n:r==="gte"?s>=n:r==="lt"?s<n:s<=n:!1}function ks(e,t){if(!e)return!1;switch(e.op){case"eq":return Nr(t,e.field)===e.value;case"neq":return Nr(t,e.field)!==e.value;case"in":return e.values.includes(Nr(t,e.field));case"notIn":return!e.values.includes(Nr(t,e.field));case"gt":case"gte":case"lt":case"lte":return Zu(Nr(t,e.field),e.value,e.op);case"and":return e.rules.every(r=>ks(r,t));case"or":return e.rules.some(r=>ks(r,t));default:return!1}}function to(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}if(typeof e=="object")return e}}function Yu(e,t){var r;return Array.isArray(e)?e.length&&typeof e[0]=="object"&&"value"in e[0]?t?e.map(s=>s.value):((r=e[0])==null?void 0:r.value)??"":t?e:e[0]??"":e&&typeof e=="object"&&"value"in e?e.value:e??(t?[]:"")}const Hu=e=>e.type!=="inputGroup"&&e.type!=="button";function Vi({schema:e,resolver:t}){const{layout:r,fields:s=[],onSubmit:n,successMessage:a,errorMessage:i,footerButtons:l,defaultValues:c,loadDefaultValues:d,validationSchema:u}=e,{show:f}=Vr(),{t:p}=hi(),{services:h}=$s(),g=b.useMemo(()=>{if(t)return t;try{const C=u??Di(e);return gi(C)}catch{return}},[t,e,u]),x=gd({resolver:g,mode:"onBlur",reValidateMode:"onChange",defaultValues:c??{}});b.useEffect(()=>{const C=e.defaultSource;if(!C)return;let k=!1;return(async()=>{var I;try{const U=(I=h==null?void 0:h.registry)==null?void 0:I[C];if(!U)return;const G=typeof U=="function"?await U():U;!k&&G&&typeof G=="object"&&x.reset({...e.defaultValues??{},...G})}catch{}})(),()=>{k=!0}},[e,h==null?void 0:h.registry,x.reset]);const{control:v,reset:m,handleSubmit:w,formState:{errors:y,isSubmitting:T}}=x,[N,_]=b.useState(!1);b.useEffect(()=>{d&&(_(!0),d().then(C=>m(C)).finally(()=>_(!1)))},[d,m]);const A=b.useMemo(()=>(s??[]).filter(Hu),[s]),{loadingCount:S,optionsMap:$}=Iu(A),[V,z]=b.useState({});b.useEffect(()=>{let C=!0;return(async()=>{const I=await Promise.all(A.filter(G=>G.type==="select"&&G.optionSource).map(async G=>{var be;const ee=G.name,M=G.optionSource,W=to(G.adapterCtx??G.optionAdapterCtx),me=(be=h==null?void 0:h.registry)==null?void 0:be[M];if(typeof me!="function")return[ee,[]];try{const de=await Promise.resolve(me("",{getValues:x.getValues,watch:x.watch,ctx:W})),ke=Array.isArray(de)?de:[];return[ee,ke]}catch{return[ee,[]]}}));if(!C)return;const U={};for(const[G,ee]of I)U[G]=ee;z(U)})(),()=>{C=!1}},[h==null?void 0:h.registry,x.getValues,x.watch,JSON.stringify(A.map(C=>({n:C.name,os:C.optionSource??null,ctx:C.adapterCtx??C.optionAdapterCtx??null,staticLen:Array.isArray(C.options)?C.options.length:-1})))]),b.useEffect(()=>{let C=!0;return(async()=>{var I;for(const U of A){if(U.type!=="select")continue;const G=U.name,ee=U.defaultSource;if(!ee)continue;const M=x.getValues(G);if(!(M==null||(Array.isArray(M)?M.length===0:M==="")))continue;const me=(I=h==null?void 0:h.registry)==null?void 0:I[ee];if(typeof me=="function")try{const be=to(U.adapterCtx??U.optionAdapterCtx),de=await Promise.resolve(me("",{getValues:x.getValues,watch:x.watch,ctx:be}));if(!C)return;const ke=Yu(de,!!U.multiple);x.setValue(G,ke,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{C=!1}},[h==null?void 0:h.registry,x.getValues,x.setValue,JSON.stringify(A.map(C=>({n:C.name,ds:C.defaultSource??null,mult:!!C.multiple})))]);const q=$u(s),D=Ku(s,v),P=b.useMemo(()=>{const C={};return r.forEach((k,I)=>{k.type==="tabs"&&(C[I]=k.tabs[0].key)}),C},[r]),[E,te]=b.useState(P),ne=b.useCallback((C,k)=>{if(!(C!=null&&C.enabled)||!C.rule)return k;try{return!!ks(C.rule,x.getValues())}catch{return k}},[x]),K=b.useMemo(()=>s.map(C=>C).filter(C=>{var k;return((k=C.clearWhen)==null?void 0:k.enabled)&&C.clearWhen.rule}).map(C=>({name:C.name,rule:C.clearWhen.rule,clearTo:C.clearWhen.clearTo})),[s]);b.useEffect(()=>{if(!K.length)return;const C=I=>{K.forEach(({name:U,rule:G,clearTo:ee})=>{try{if(!!ks(G,I)){const W=ee??"";I[U]!==W&&x.setValue(U,W,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};C(x.getValues());const k=x.watch(()=>C(x.getValues()));return()=>{var I;return(I=k==null?void 0:k.unsubscribe)==null?void 0:I.call(k)}},[x,K]);const le=b.useCallback(C=>{var de,ke,ge,he;let k;if(typeof C=="string"){if(k=q[C],!k){const fe=(s??[]).find(pe=>(pe==null?void 0:pe.name)===C);if(fe)k=fe;else return null}}else k=C;const I=k.visibleWhen;if(!ne(I,!0))return null;let G=!!k.disabled;const ee=k.disabledWhen,M=ne(ee,!1);if(ee!=null&&ee.enabled&&(G=M),!(ee!=null&&ee.enabled)&&"name"in k&&k.name&&D[k.name]&&(G=!0),k.type==="search"){const fe=typeof k.searchFn=="function",pe=k.searchSource,ye=async Se=>{var Te;if(fe)return k.searchFn(Se,{getValues:x.getValues,watch:x.watch});if(pe){const j=(Te=h==null?void 0:h.registry)==null?void 0:Te[pe];if(typeof j=="function")return await j(Se,{getValues:x.getValues,watch:x.watch});if(Array.isArray(j))return j}return[]},ce={};return k.searchMode&&(ce.searchMode=k.searchMode),k.minChars&&(ce.minChars=k.minChars),k.debounceMs&&(ce.debounceMs=k.debounceMs),k.resolveByValue&&(ce.resolveByValue=k.resolveByValue),o.jsx(Ii,{name:k.name,control:v,searchFn:ye,label:k.label,size:k.size,width:k.width,disabled:G||T,...ce},k.name)}if(k.type==="inputGroup"){const fe=k,pe=(fe.inputs??[]).map(ye=>{var R;const ce=typeof ye=="string"?q[ye]??(s??[]).find(X=>(X==null?void 0:X.name)===ye):ye;if(!ce)return null;const Se=ce.disabledWhen;let Te=!!ce.disabled;const j=ne(Se,!1);Se!=null&&Se.enabled&&(Te=j),!(Se!=null&&Se.enabled)&&D[ce.name]&&(Te=!0);const F={name:ce.name,control:v,label:ce.label,size:ce.size,width:ce.width,placeholder:ce.placeholder,hasError:!!y[ce.name],errorMessage:((R=y[ce.name])==null?void 0:R.message)||"",loading:N,disabled:Te||T,suffixButton:ce.suffixButton,reserveErrorSpace:!0};return ce.type==="select"?{...F,options:ce.options??V[ce.name]??$[ce.name]??[],loadOptions:ce.options||ce.optionSource?void 0:ce.loadOptions}:{...F,type:ce.type}}).filter(Boolean);return o.jsx(Mi,{groupLabel:fe.groupLabel,inputs:pe,separator:fe.separator,useSeparator:fe.useSeparator,className:fe.className,showVisibleLabel:fe.showVisibleLabel,size:fe.size},`inputGroup_${fe.name??fe.groupLabel??"group"}`)}if(k.type==="button"){const fe=k;return o.jsx("div",{className:"self-center",children:o.jsx(ie,{type:"button",variant:fe.variant,size:fe.size,width:fe.width,icon:fe.icon,iconPosition:fe.iconPosition,ariaLabel:fe.ariaLabel,onClick:fe.onClick,disabled:G||T,children:fe.label})},fe.name)}const W=k.suffixButton,me=typeof W=="string"?le(W):W,be={name:k.name,control:v,disabled:G||T,label:k.label,size:k.size,width:k.width,placeholder:k.placeholder,info:k.info,suffixButton:me};switch(k.type){case"select":{const fe=k.name,pe=k.options??V[fe]??$[fe]??[],ye=Array.isArray(pe)&&pe.length?`${pe.length}:${pe.map(Se=>String((Se==null?void 0:Se.value)??"")).join("|")}`:"0",ce=!k.options&&!k.optionSource&&k.loadOptions;return o.jsx(gt,{name:fe,control:v,render:({field:Se})=>{var Te;return o.jsx(rt,{...be,value:Se.value,onChange:Se.onChange,options:pe,loadOptions:ce||void 0,hasError:!!y[fe],errorMessage:(Te=y[fe])==null?void 0:Te.message,suffixButton:me})}},`${fe}:${ye}`)}case"textarea":return o.jsx(gt,{name:k.name,control:v,render:({field:fe,fieldState:pe})=>{var ye;return o.jsx(Ls,{...be,value:fe.value,onChange:fe.onChange,maxLength:k.maxLength,showCounter:!!k.showCounter,hasError:!!pe.error,errorMessage:((ye=pe.error)==null?void 0:ye.message)||""})}},k.name);case"file":return o.jsx(pi,{...be,defaultValue:[],maxFiles:k.maxFiles,accept:k.accept,hasError:!!y[k.name],errorMessage:(de=y[k.name])==null?void 0:de.message},k.name);case"checkbox":return o.jsx(dt,{...be,defaultValue:!1,hasError:!!y[k.name],errorMessage:(ke=y[k.name])==null?void 0:ke.message,name:k.name},k.name);case"date":return o.jsx(Fr,{...be,defaultValue:"",showTime:!!k.showTime,hasError:!!y[k.name],errorMessage:(ge=y[k.name])==null?void 0:ge.message},k.name);case"optionGroup":return o.jsx($i,{...be,options:k.options||[],multiple:k.multiple,vertical:k.vertical,groupLabel:k.groupLabel,defaultValue:k.defaultValue,className:k.width?void 0:"w-full",name:k.name},k.name);default:return o.jsx(Yn,{...be,type:k.type,loadingDefaults:N,hasError:!!y[k.name],errorMessage:(he=y[k.name])==null?void 0:he.message,suffixButton:me,name:k.name},k.name)}},[s,q,v,y,T,N,$,V,ne,D,x.getValues,x.watch,h==null?void 0:h.registry]);return o.jsx(rd,{...x,children:o.jsxs("form",{noValidate:!0,onSubmit:w(async C=>{await n(C),f(a??p("ds.form.saveSuccess"),"success")},C=>{console.log("❌ errores de validación:",C),Su(C),f(i??p("ds.form.saveError"),"error")}),className:"space-y-6",children:[r.map((C,k)=>C.type==="rows"?o.jsx(b.Fragment,{children:C.sections.map((I,U)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:I.sectionTitle,defaultOpen:I.defaultOpen,children:I.rows.map((G,ee)=>o.jsxs("div",{children:[G.title&&o.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:G.title}),o.jsx("div",{className:"flex flex-wrap -mx-2",children:G.columns.map((M,W)=>{var me;return o.jsx("div",{className:`${M.width} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:M.fields?M.fields.map(be=>le(be)):(me=M.rows)==null?void 0:me.map((be,de)=>o.jsx("div",{className:"mb-1",children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:be.columns.map((ke,ge)=>{var he;return o.jsx("div",{className:`${ke.width} px-2`,children:(he=ke.fields)==null?void 0:he.map(fe=>le(fe))},ge)})})},de))})},W)})})]},ee))})},U))},k):o.jsx(Ir,{options:C.tabs.map(I=>({label:I.label,value:I.key})),value:E[k],onChange:I=>te(U=>({...U,[k]:I})),children:Object.fromEntries(C.tabs.map(I=>[I.key,o.jsx("div",{className:"space-y-6",children:I.sections.map((U,G)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:U.sectionTitle,defaultOpen:U.defaultOpen,children:U.rows.map((ee,M)=>o.jsx("div",{children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:ee.columns.map((W,me)=>{var be;return o.jsx("div",{className:`${W.width??"flex-1"} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:(be=W.fields)==null?void 0:be.map((de,ke)=>o.jsx(b.Fragment,{children:le(de)},ke))})},me)})})},M))})},G))},I.key)]))},k)),o.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:l??o.jsx(ie,{type:"submit",variant:"primary",icon:Kl,size:"sm",disabled:T||N||S>0,children:p(T?"ds.form.sending":"ds.form.submit")})})]})})}const Xu={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function Bi({icon:e,size:t="md",ariaLabel:r,disabled:s=!1,onClick:n,...a}){return o.jsx("button",{type:"button","aria-label":r,disabled:s,onClick:n,className:se("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",Xu[t],s?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse"]),...a,children:o.jsx(e,{className:se(t==="sm"?"h-4 w-4":t==="md"?"h-5 w-5":"h-6 w-6")})})}function Ui({dark:e,onToggle:t}){return o.jsx("button",{type:"button","aria-pressed":e,"aria-label":e?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:t,className:se("relative inline-flex items-center transition-colors focus:outline-none duration-200 ease-in-out","bg-[var(--color-ds-background-accent)]","h-6 w-12 rounded-full"),children:o.jsxs("div",{className:se("absolute bg-[var(--color-ds-background-page)] flex items-center justify-center rounded-full transition-transform duration-200 ease-in-out","h-5 w-5",e?"translate-x-6":"translate-x-1"),children:[o.jsx(kt,{component:pc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),o.jsx(kt,{component:uc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const ro="licytal:ui:theme",qi=b.createContext({theme:"light",dark:!1,toggle:()=>{}});function Qu({children:e}){const[t,r]=b.useState(!1),[s,n]=b.useState("light");b.useEffect(()=>{if(typeof window>"u")return;const i=localStorage.getItem(ro);i==="light"||i==="dark"?n(i):window.matchMedia("(prefers-color-scheme: dark)").matches&&n("dark"),r(!0)},[]),b.useEffect(()=>{t&&(document.documentElement.classList.toggle("dark",s==="dark"),localStorage.setItem(ro,s))},[s,t]);const a=()=>n(i=>i==="light"?"dark":"light");return t?o.jsx(qi.Provider,{value:{theme:s,dark:s==="dark",toggle:a},children:e}):null}const Xn=()=>b.useContext(qi),Sr={locale:"licytal:ui:locale",theme:"licytal:ui:theme"},Wi=({pinnedPages:e,onRemovePinned:t,onBack:r,dark:s,locale:n,languageOptions:a,onChangeLocale:i,profile:l="",profileOptions:c=[],onChangeProfile:d})=>{const u=e.slice(0,3),{toggle:f}=Xn(),p=g=>{try{localStorage.setItem(Sr.locale,g)}catch{}i==null||i(g)},h=()=>{const g=!s;try{localStorage.setItem(Sr.theme,g?"dark":"light")}catch{}f()};return b.useEffect(()=>{try{const g=localStorage.getItem(Sr.locale);g&&g!==n&&(i==null||i(g))}catch{}},[]),b.useEffect(()=>{if(n)try{localStorage.setItem(Sr.locale,n)}catch{}},[n]),b.useEffect(()=>{try{const g=localStorage.getItem(Sr.theme);if(!g)return;g==="dark"!==s&&f()}catch{}},[]),o.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[o.jsx("div",{className:"flex items-center space-x-2",children:u.map(g=>o.jsxs("div",{className:"flex items-center",children:[o.jsx("a",{href:g.href,className:se("inline-flex items-center rounded-lg","py-1 px-1 my-1 text-ds-sm","bg-transparent text-[var(--color-ds-text-primary)]","transition-colors duration-200 ease-in-out","hover:bg-[var(--color-ds-border-muted)] hover:animate-pulse"),children:g.label}),o.jsx(Bi,{icon:Vn,size:"sm",ariaLabel:`Remove ${g.label}`,onClick:()=>t(g.id)})]},g.id))}),o.jsx("div",{className:"flex-grow"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(rt,{size:"sm",width:"auto",options:a,value:n,onChange:p,disableErrorPlaceholder:!0}),!!c.length&&o.jsx(rt,{size:"sm",width:"auto",options:c,value:l,onChange:g=>d==null?void 0:d(g),disableErrorPlaceholder:!0}),o.jsx(Ui,{dark:s,onToggle:h})]})]})},ef=({loading:e=!1,ariaLabel:t="Cargando..."})=>e?o.jsxs("div",{className:`\r
37
37
  fixed inset-0\r
38
38
  flex items-center justify-center\r
39
39
  bg-[var(--color-ds-background-surface)]/90\r
40
40
  z-50\r
41
- `,role:"status","aria-live":"polite","aria-label":e,children:[l.jsx("div",{className:`\r
41
+ `,role:"status","aria-live":"polite","aria-label":t,children:[o.jsx("div",{className:`\r
42
42
  w-12 h-12\r
43
43
  border-4 rounded-full\r
44
44
  border-gray-200\r
45
45
  border-t-[var(--color-ds-button-primary-bg)]\r
46
46
  animate-spin\r
47
- `}),l.jsx("span",{className:"sr-only",children:e})]}):null,Yf=({isOpen:t,onClose:e,title:s,children:r,footer:n})=>(b.useEffect(()=>{const a=o=>o.key==="Escape"&&e();return t&&(document.addEventListener("keydown",a),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[t,e]),t?Yt.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-[var(--color-ds-text-primary)]/50 z-40",onClick:e}),l.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-4 z-50",children:l.jsxs("div",{className:`\r
47
+ `}),o.jsx("span",{className:"sr-only",children:t})]}):null,tf=({isOpen:e,onClose:t,title:r,children:s,footer:n})=>(b.useEffect(()=>{const a=i=>i.key==="Escape"&&t();return e&&(document.addEventListener("keydown",a),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[e,t]),e?Jt.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-[var(--color-ds-text-primary)]/50 z-40",onClick:t}),o.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-4 z-50",children:o.jsxs("div",{className:`\r
48
48
  relative\r
49
49
  bg-[var(--color-ds-background-page)]\r
50
50
  dark:bg-[var(--color-ds-background-surface)]\r
@@ -52,31 +52,31 @@ attempted value: ${o}
52
52
  shadow-2xl\r
53
53
  w-full max-w-lg\r
54
54
  overflow-hidden\r
55
- `,children:[l.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-ds-border-muted)]",children:[s?l.jsx("h3",{className:"text-ds-lg font-semibold text-[var(--color-ds-text-primary)]",children:s}):l.jsx("div",{}),l.jsxs("button",{onClick:e,className:`\r
55
+ `,children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-ds-border-muted)]",children:[r?o.jsx("h3",{className:"text-ds-lg font-semibold text-[var(--color-ds-text-primary)]",children:r}):o.jsx("div",{}),o.jsxs("button",{onClick:t,className:`\r
56
56
  p-1 rounded-full\r
57
57
  bg-[var(--color-ds-background-page)]\r
58
58
  dark:bg-[var(--color-ds-background-surface)]\r
59
59
  hover:bg-[var(--color-ds-background-accent)]/10\r
60
60
  focus:outline-none\r
61
- `,children:[l.jsx(sa,{className:"w-5 h-5 text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]"}),l.jsx("span",{className:"sr-only",children:"Cerrar modal"})]})]}),l.jsx("div",{className:"px-6 py-6 text-[var(--color-ds-text-primary)]",children:r}),n&&l.jsx("div",{className:"px-6 py-4 border-t border-[var(--color-ds-border-muted)] bg-[var(--color-ds-background-surface)]",children:n})]})})]}),document.body):null),pa=({items:t,selected:e,onSelect:s,level:r=0})=>{const[n,a]=b.useState(new Set),o=i=>{const c=new Set(n);r===0?(c.clear(),n.has(i)||c.add(i)):c.has(i)?c.delete(i):c.add(i),a(c)};return l.jsx("ul",{className:ne(r>0?"mt-1":"mt-0"),children:t.map(i=>{var g;const c=i.value===e,d=n.has(i.value),u=["pl-2","pl-2","pl-2"][r]||"pl-4",f=r===0?d||c?"bg-[var(--color-ds-background-accent)] text-[var(--color-ds-text-on-accent)] rounded-r-lg":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]":c?"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)]":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]",p=r===0&&(d||c)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",h=!!((g=i.children)!=null&&g.length);return l.jsxs("li",{children:[l.jsxs("button",{type:"button",onClick:()=>h?o(i.value):s(i.value),"aria-expanded":h?d:void 0,className:ne("w-full flex items-center justify-between h-8 transition-colors",u,f),children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[r===0&&i.icon&&l.jsx(i.icon,{className:"w-5 h-5 ml-2"}),l.jsx("span",{className:"text-ds-sm",children:i.label})]}),h&&(d?l.jsx(qr,{className:ne("w-4 h-4",p)}):l.jsx(ui,{className:ne("w-4 h-4",p)}))]}),h&&l.jsx("div",{className:ne("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",d?"max-h-screen":"max-h-0"),children:l.jsx(pa,{items:i.children,selected:e,onSelect:s,level:r+1})})]},i.value)})})},Xf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23FFFFFF;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",Qf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23005751;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",jl=({appName:t,orgName:e,username:s,footerText:r,navItems:n,selectedNav:a,onSelectNav:o,width:i="200px"})=>{const{theme:c}=yl(),d=c==="dark"?Xf:Qf;return l.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)]",style:{width:i},children:[l.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[l.jsx("img",{src:d,alt:"Logo Diputación",className:"w-20 h-20"}),l.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg ",children:t}),l.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:e}),l.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:s}),l.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),l.jsx("nav",{className:"flex-1 overflow-auto pt-3",children:l.jsx(pa,{items:n,selected:a,onSelect:o})}),l.jsx("div",{className:"px-4 w-full py-3",children:l.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:r})})]})};function eh({hideSidebar:t=!1,sidebar:e,header:s,children:r}){return l.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!t&&l.jsx(jl,{...e}),l.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${t?"px-0":"px-10"}`,children:[l.jsx(wl,{...s}),l.jsx("main",{className:"flex-1",children:r})]})]})}function th({columns:t,data:e,loadData:s,loading:r,idAccessor:n,multiSelect:a=!1,onSelectionChange:o,pageSize:i=10,initialSort:c,onSort:d,className:u,onRowDoubleClick:f}){const p=e!==void 0,[h,g]=b.useState([]),[x,v]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{var V;if(!s||p)return;(V=m.current)==null||V.abort();const j=new AbortController;return m.current=j,v(!0),s().then(B=>{j.signal.aborted||g(B)}).finally(()=>{j.signal.aborted||v(!1)}),()=>j.abort()},[s,p]);const y=b.useMemo(()=>p?e:h,[e,h,p]),w=r??(s?x:!1),[O,S]=b.useState(new Set),[T,C]=b.useState(1),[N,_]=b.useState(c==null?void 0:c.sortBy),[I,z]=b.useState((c==null?void 0:c.sortDir)??"asc"),U=j=>typeof n=="function"?n(j):j[n],D=b.useRef(null);b.useEffect(()=>{D.current!==y&&(S(new Set),C(1),D.current=y)},[y]);const $=b.useMemo(()=>{if(!N)return y;const j=I==="asc"?1:-1;return[...y].sort((V,B)=>{const W=V[N],Q=B[N];return W==null?-j:Q==null||W>Q?j:W<Q?-j:0})},[y,N,I]),E=Math.max(1,Math.ceil($.length/i)),Z=b.useMemo(()=>{const j=(T-1)*i;return $.slice(j,j+i)},[$,T,i]),se=j=>{const V=new Set(O);V.has(j)?V.delete(j):V.add(j),S(V),o==null||o(y.filter(B=>V.has(U(B))))},q=()=>{const j=Z.every(B=>O.has(U(B))),V=new Set(O);Z.forEach(B=>{j?V.delete(U(B)):V.add(U(B))}),S(V),o==null||o(y.filter(B=>V.has(U(B))))},ae=j=>{if(!j.sortable)return;const V=typeof j.accessor=="string"?j.accessor:j.sortKey;if(N===V){const B=I==="asc"?"desc":"asc";z(B),d==null||d(V,B)}else _(V),z("asc"),d==null||d(V,"asc");C(1)},A=()=>w?l.jsx("tbody",{children:Array.from({length:i}).map((j,V)=>l.jsxs("tr",{children:[a&&l.jsx("td",{children:l.jsx(ts,{width:"1rem",height:"1rem",variant:"circle"})}),t.map((B,W)=>l.jsx("td",{children:l.jsx(ts,{width:"100%",height:"1em",variant:"rect"})},W))]},V))}):Z.length?l.jsx("tbody",{children:Z.map(j=>{const V=U(j);return l.jsxs("tr",{className:ne("hover:bg-gray-50",f&&"cursor-pointer select-none"),onDoubleClick:f?()=>f(j):void 0,title:f?"Doble clic para abrir":void 0,children:[a&&l.jsx("td",{children:l.jsx("input",{type:"checkbox",checked:O.has(V),onChange:()=>se(V),onDoubleClick:B=>B.stopPropagation()})}),t.map((B,W)=>{const Q=B.render?B.render(j):typeof B.accessor=="function"?B.accessor(j):j[B.accessor];return l.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm",children:Q},W)})]},V)})}):l.jsx("tbody",{children:l.jsx("tr",{children:l.jsx("td",{colSpan:t.length+(a?1:0),children:"No hay datos"})})});return l.jsxs("div",{className:ne("w-full overflow-auto",u),children:[l.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[l.jsx("thead",{className:"bg-gray-50",children:l.jsxs("tr",{children:[a&&l.jsx("th",{children:l.jsx("input",{type:"checkbox",checked:Z.length>0&&Z.every(j=>O.has(U(j))),onChange:q,onDoubleClick:j=>j.stopPropagation()})}),t.map(j=>{const V=typeof j.accessor=="string"?j.accessor:j.header,B=N===(typeof j.accessor=="string"?j.accessor:j.sortKey);return l.jsx("th",{className:ne("px-4 py-2 text-left text-sm font-medium text-gray-700",j.width),onClick:()=>ae(j),children:l.jsxs("div",{className:"inline-flex items-center space-x-1 cursor-pointer",children:[l.jsx("span",{children:j.header}),j.sortable&&l.jsx("span",{className:"text-xs",children:B?I==="asc"?"▲":"▼":"⇵"})]})},V)})]})}),A()]}),l.jsxs("div",{className:"flex items-center justify-between py-2 px-4",children:[l.jsx("span",{className:"text-sm text-gray-700",children:w?"Cargando...":`Página ${T} de ${E}`}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(le,{size:"sm",variant:"outline",disabled:w||T<=1,onClick:()=>C(j=>Math.max(1,j-1)),children:"Prev"}),l.jsx(le,{size:"sm",variant:"outline",disabled:w||T>=E,onClick:()=>C(j=>Math.min(E,j+1)),children:"Next"})]})]})]})}function kl({control:t,name:e,rules:s,defaultValue:r=!1,checked:n,onChange:a,disabled:o=!1,label:i,labelPosition:c="right",errorMessage:d="",className:u}){const f=b.useId();if(t&&e)return l.jsx(vt,{name:e,control:t,rules:s,defaultValue:r,render:({field:h,fieldState:g})=>{var x;return l.jsx(kl,{checked:h.value,onChange:h.onChange,disabled:o,label:i,labelPosition:c,errorMessage:((x=g.error)==null?void 0:x.message)||"",className:u})}});const p=!!n;return l.jsxs("div",{className:ne("flex flex-col",u),children:[l.jsxs("label",{className:ne("inline-flex items-center space-x-3 select-none",o&&"opacity-50 cursor-not-allowed"),htmlFor:f,children:[i&&c==="left"&&l.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:i}),l.jsx("button",{id:f,type:"button",role:"switch","aria-checked":p,disabled:o,onClick:()=>!o&&(a==null?void 0:a(!p)),className:ne("relative inline-flex items-center h-8 w-16","bg-[var(--color-ds-background-accent)] rounded-full transition-colors duration-200","focus:outline-none "),children:l.jsx("div",{className:ne("absolute h-6 w-6 bg-[var(--color-ds-background-page)] rounded-full shadow transform transition-transform duration-200",p?"translate-x-9":"translate-x-1")})}),i&&c==="right"&&l.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:i})]}),l.jsx("div",{className:"pt-1 min-h-[18px] w-full",children:d?l.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):l.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Sl({items:t,value:e,onValueChange:s,multiple:r=!0,dense:n=!1,className:a}){const o=b.useMemo(()=>t.filter(g=>g.defaultOpen&&!g.disabled).map(g=>g.id),[t]),[i,c]=b.useState(o),d=e??i,u=g=>{s?s(g):c(g)},f=(g,x)=>{x&&u(r?d.includes(g)?d.filter(v=>v!==g):[...d,g]:d.includes(g)?[]:[g])},p=(g,x,v)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),f(x,v))},h=n?"py-1":"py-2";return l.jsx("div",{className:["divide-y","divide-[var(--color-ds-border-default-50)]",a].filter(Boolean).join(" "),children:t.map(g=>{const x=d.includes(g.id),v=!g.disabled;return l.jsxs("section",{"aria-disabled":g.disabled||void 0,children:[l.jsxs("button",{type:"button",onClick:()=>f(g.id,v),onKeyDown:m=>p(m,g.id,v),"aria-expanded":x,className:["w-full flex items-center justify-between gap-2 text-left select-none",h,"text-[var(--color-ds-text-primary)]",g.disabled?"opacity-60 cursor-not-allowed":"hover:bg-[color-mix(in_srgb,var(--color-ds-background-surface)_80%,transparent)]"].join(" "),children:[l.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[g.leftAdornment&&l.jsx("span",{className:"shrink-0",children:g.leftAdornment}),l.jsx("span",{className:"font-medium truncate",children:g.title})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[g.actions,l.jsx(qr,{className:["h-4 w-4 transition-transform",x?"rotate-180":"",g.disabled?"opacity-40":""].join(" ")})]})]}),x&&l.jsx("div",{className:[n?"py-1":"py-2"].join(" "),children:g.content})]},g.id)})})}const Ro=t=>{let e;const s=new Set,r=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const p=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),s.forEach(h=>h(e,p))}},n=()=>e,i={setState:r,getState:n,getInitialState:()=>c,subscribe:d=>(s.add(d),()=>s.delete(d))},c=e=t(r,n,i);return i},sh=t=>t?Ro(t):Ro,rh=t=>t;function nh(t,e=rh){const s=b.useSyncExternalStore(t.subscribe,b.useCallback(()=>e(t.getState()),[t,e]),b.useCallback(()=>e(t.getInitialState()),[t,e]));return b.useDebugValue(s),s}const _o=t=>{const e=sh(t),s=r=>nh(e,r);return Object.assign(s,e),s},ah=t=>t?_o(t):_o;var Nl=Symbol.for("immer-nothing"),Do=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state"),oh=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function at(t,...e){if(process.env.NODE_ENV!=="production"){const s=oh[t],r=typeof s=="function"?s.apply(null,e):s;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var gs=Object.getPrototypeOf;function bs(t){return!!t&&!!t[ut]}function ss(t){var e;return t?Cl(t)||Array.isArray(t)||!!t[Do]||!!((e=t.constructor)!=null&&e[Do])||Zs(t)||Xr(t):!1}var ih=Object.prototype.constructor.toString();function Cl(t){if(!t||typeof t!="object")return!1;const e=gs(t);if(e===null)return!0;const s=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return s===Object?!0:typeof s=="function"&&Function.toString.call(s)===ih}function Lr(t,e){Yr(t)===0?Reflect.ownKeys(t).forEach(s=>{e(s,t[s],t)}):t.forEach((s,r)=>e(r,s,t))}function Yr(t){const e=t[ut];return e?e.type_:Array.isArray(t)?1:Zs(t)?2:Xr(t)?3:0}function qn(t,e){return Yr(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function El(t,e,s){const r=Yr(t);r===2?t.set(e,s):r===3?t.add(s):t[e]=s}function lh(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Zs(t){return t instanceof Map}function Xr(t){return t instanceof Set}function Zt(t){return t.copy_||t.base_}function Wn(t,e){if(Zs(t))return new Map(t);if(Xr(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const s=Cl(t);if(e===!0||e==="class_only"&&!s){const r=Object.getOwnPropertyDescriptors(t);delete r[ut];let n=Reflect.ownKeys(r);for(let a=0;a<n.length;a++){const o=n[a],i=r[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[o]})}return Object.create(gs(t),r)}else{const r=gs(t);if(r!==null&&s)return{...t};const n=Object.create(r);return Object.assign(n,t)}}function ma(t,e=!1){return Qr(t)||bs(t)||!ss(t)||(Yr(t)>1&&Object.defineProperties(t,{set:{value:mr},add:{value:mr},clear:{value:mr},delete:{value:mr}}),Object.freeze(t),e&&Object.values(t).forEach(s=>ma(s,!0))),t}function mr(){at(2)}function Qr(t){return Object.isFrozen(t)}var ch={};function rs(t){const e=ch[t];return e||at(0,t),e}var Vs;function Ol(){return Vs}function dh(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $o(t,e){e&&(rs("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Jn(t){Hn(t),t.drafts_.forEach(uh),t.drafts_=null}function Hn(t){t===Vs&&(Vs=t.parent_)}function Lo(t){return Vs=dh(Vs,t)}function uh(t){const e=t[ut];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Mo(t,e){e.unfinalizedDrafts_=e.drafts_.length;const s=e.drafts_[0];return t!==void 0&&t!==s?(s[ut].modified_&&(Jn(e),at(4)),ss(t)&&(t=Mr(e,t),e.parent_||Pr(e,t)),e.patches_&&rs("Patches").generateReplacementPatches_(s[ut].base_,t,e.patches_,e.inversePatches_)):t=Mr(e,s,[]),Jn(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Nl?t:void 0}function Mr(t,e,s){if(Qr(e))return e;const r=e[ut];if(!r)return Lr(e,(n,a)=>Po(t,r,e,n,a,s)),e;if(r.scope_!==t)return e;if(!r.modified_)return Pr(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const n=r.copy_;let a=n,o=!1;r.type_===3&&(a=new Set(n),n.clear(),o=!0),Lr(a,(i,c)=>Po(t,r,n,i,c,s,o)),Pr(t,n,!1),s&&t.patches_&&rs("Patches").generatePatches_(r,s,t.patches_,t.inversePatches_)}return r.copy_}function Po(t,e,s,r,n,a,o){if(process.env.NODE_ENV!=="production"&&n===s&&at(5),bs(n)){const i=a&&e&&e.type_!==3&&!qn(e.assigned_,r)?a.concat(r):void 0,c=Mr(t,n,i);if(El(s,r,c),bs(c))t.canAutoFreeze_=!1;else return}else o&&s.add(n);if(ss(n)&&!Qr(n)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Mr(t,n),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Zs(s)?s.has(r):Object.prototype.propertyIsEnumerable.call(s,r))&&Pr(t,n)}}function Pr(t,e,s=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&ma(e,s)}function fh(t,e){const s=Array.isArray(t),r={type_:s?1:0,scope_:e?e.scope_:Ol(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=r,a=ga;s&&(n=[r],a=zs);const{revoke:o,proxy:i}=Proxy.revocable(n,a);return r.draft_=i,r.revoke_=o,i}var ga={get(t,e){if(e===ut)return t;const s=Zt(t);if(!qn(s,e))return hh(t,s,e);const r=s[e];return t.finalized_||!ss(r)?r:r===mn(t.base_,e)?(gn(t),t.copy_[e]=Zn(r,t)):r},has(t,e){return e in Zt(t)},ownKeys(t){return Reflect.ownKeys(Zt(t))},set(t,e,s){const r=Al(Zt(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,s),!0;if(!t.modified_){const n=mn(Zt(t),e),a=n==null?void 0:n[ut];if(a&&a.base_===s)return t.copy_[e]=s,t.assigned_[e]=!1,!0;if(lh(s,n)&&(s!==void 0||qn(t.base_,e)))return!0;gn(t),Gn(t)}return t.copy_[e]===s&&(s!==void 0||e in t.copy_)||Number.isNaN(s)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=s,t.assigned_[e]=!0),!0},deleteProperty(t,e){return mn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,gn(t),Gn(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const s=Zt(t),r=Reflect.getOwnPropertyDescriptor(s,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:s[e]}},defineProperty(){at(11)},getPrototypeOf(t){return gs(t.base_)},setPrototypeOf(){at(12)}},zs={};Lr(ga,(t,e)=>{zs[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});zs.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&at(13),zs.set.call(this,t,e,void 0)};zs.set=function(t,e,s){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&at(14),ga.set.call(this,t[0],e,s,t[0])};function mn(t,e){const s=t[ut];return(s?Zt(s):t)[e]}function hh(t,e,s){var n;const r=Al(e,s);return r?"value"in r?r.value:(n=r.get)==null?void 0:n.call(t.draft_):void 0}function Al(t,e){if(!(e in t))return;let s=gs(t);for(;s;){const r=Object.getOwnPropertyDescriptor(s,e);if(r)return r;s=gs(s)}}function Gn(t){t.modified_||(t.modified_=!0,t.parent_&&Gn(t.parent_))}function gn(t){t.copy_||(t.copy_=Wn(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var ph=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,s,r)=>{if(typeof e=="function"&&typeof s!="function"){const a=s;s=e;const o=this;return function(c=a,...d){return o.produce(c,u=>s.call(this,u,...d))}}typeof s!="function"&&at(6),r!==void 0&&typeof r!="function"&&at(7);let n;if(ss(e)){const a=Lo(this),o=Zn(e,void 0);let i=!0;try{n=s(o),i=!1}finally{i?Jn(a):Hn(a)}return $o(a,r),Mo(n,a)}else if(!e||typeof e!="object"){if(n=s(e),n===void 0&&(n=e),n===Nl&&(n=void 0),this.autoFreeze_&&ma(n,!0),r){const a=[],o=[];rs("Patches").generateReplacementPatches_(e,n,a,o),r(a,o)}return n}else at(1,e)},this.produceWithPatches=(e,s)=>{if(typeof e=="function")return(o,...i)=>this.produceWithPatches(o,c=>e(c,...i));let r,n;return[this.produce(e,s,(o,i)=>{r=o,n=i}),r,n]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){ss(t)||at(8),bs(t)&&(t=mh(t));const e=Lo(this),s=Zn(t,void 0);return s[ut].isManual_=!0,Hn(e),s}finishDraft(t,e){const s=t&&t[ut];(!s||!s.isManual_)&&at(9);const{scope_:r}=s;return $o(r,e),Mo(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let s;for(s=e.length-1;s>=0;s--){const n=e[s];if(n.path.length===0&&n.op==="replace"){t=n.value;break}}s>-1&&(e=e.slice(s+1));const r=rs("Patches").applyPatches_;return bs(t)?r(t,e):this.produce(t,n=>r(n,e))}};function Zn(t,e){const s=Zs(t)?rs("MapSet").proxyMap_(t,e):Xr(t)?rs("MapSet").proxySet_(t,e):fh(t,e);return(e?e.scope_:Ol()).drafts_.push(s),s}function mh(t){return bs(t)||at(10,t),Tl(t)}function Tl(t){if(!ss(t)||Qr(t))return t;const e=t[ut];let s;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,s=Wn(t,e.scope_.immer_.useStrictShallowCopy_)}else s=Wn(t,!0);return Lr(s,(r,n)=>{El(s,r,Tl(n))}),e&&(e.finalized_=!1),s}var gh=new ph,bh=gh.produce;const bn=t=>Number(t.toFixed(2)),ps=t=>Math.max(0,Math.min(100,t??0)),xh={text:{name:"text",label:"Texto"},number:{name:"number",label:"Número"},email:{name:"email",label:"Email"},select:{name:"select",label:"Select"},checkbox:{name:"checkbox",label:"Checkbox"},date:{name:"date",label:"Fecha"},textarea:{name:"textarea",label:"Textarea"},file:{name:"file",label:"Archivo"}},Re=t=>t.layout.find(e=>e.type==="rows"),mt=(t,e)=>{if(e==null)return Re(t);const s=t.layout[e];return s&&s.type==="rows"?s:Re(t)},xn=t=>t<=1?["w-full"]:t===2?["w-1/2","w-1/2"]:t===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:t},()=>"flex-1"),vn={1:["w-full"],2:["w-1/2","w-1/2"],3:["w-1/3","w-1/3","w-1/3"],4:["w-1/4","w-1/4","w-1/4","w-1/4"],"1/3-2/3":["w-1/3","w-2/3"],"2/3-1/3":["w-2/3","w-1/3"],"1/4-3/4":["w-1/4","w-3/4"],"3/4-1/4":["w-3/4","w-1/4"]},Pe=(t,e)=>{for(let s=0;s<t.layout.length;s++){const r=t.layout[s];if((r==null?void 0:r.type)!=="tabs")continue;const n=r.tabs.findIndex(a=>a.key===e);if(n>=0)return{nodeIdx:s,tabIdx:n}}return null},vh=t=>{const e=[];return t.layout.forEach(s=>{s.type==="rows"&&s.sections.forEach(r=>r.rows.forEach(n=>n.columns.forEach(a=>(a.fields??[]).forEach(o=>e.push(o))))),s.type==="tabs"&&s.tabs.forEach(r=>r.sections.forEach(n=>n.rows.forEach(a=>a.columns.forEach(o=>(o.fields??[]).forEach(i=>e.push(i))))))}),e},yh=t=>({type:"rows",sections:[{sectionTitle:t??"Sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}),wh=()=>({type:"tabs",tabs:[{key:`tab_${Date.now().toString(36)}_1`,label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:`tab_${Date.now().toString(36)}_2`,label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]}),us=(t,e)=>vh(t).includes(e),Yn=t=>t.replace(/(?:_copy)+$/i,"").replace(/_(\d+)$/i,""),Fl=t=>t.replace(/\s\((\d+)\)$/i,""),et=(t,e)=>{const s=t||"campo";if(!e.has(s))return s;let r=2;for(;e.has(`${s}_${r}`);)r++;return`${s}_${r}`},lt=(t,e)=>{const s=t||"Campo";if(!e.has(s))return s;let r=2;for(;e.has(`${s} (${r})`);)r++;return`${s} (${r})`},tt=t=>{const e=(t.type??"text").toString(),s=xh[e]??{name:"campo",label:"Campo"},r=t.name?Yn(t.name):s.name,n=t.label?Fl(t.label):s.label;return{baseName:r,baseLabel:n}},jh={layout:[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],fields:[],onSubmit:async()=>{},successMessage:"Guardado",errorMessage:"Error"},H=ah((t,e)=>({schema:jh,selection:{kind:"none"},past:[],future:[],setSchema:s=>{const r=e().schema,n=bh(r,s),a=n;t(o=>({...o,schema:a,past:[...o.past,r],future:[]}))},setSelection:s=>t({selection:s}),undo:()=>t(s=>s.past.length?{schema:s.past[s.past.length-1],past:s.past.slice(0,-1),future:[s.schema,...s.future]}:s),redo:()=>t(s=>s.future.length?{schema:s.future[0],past:[...s.past,s.schema],future:s.future.slice(1)}:s),resetHistory:()=>t(s=>({past:[],future:[]})),addField:s=>e().setSchema(r=>{const{baseName:n,baseLabel:a}=tt(s),o=new Set(r.fields.map(u=>u.name).filter(Boolean)),i=new Set(r.fields.map(u=>u.label??"").filter(Boolean)),c=et(n,o),d=lt(a,i);s.name=c,s.label||(s.label=d),r.fields.push(s)}),addFieldAt:(s,r)=>e().setSchema(n=>{const{baseName:a,baseLabel:o}=tt(s),i=new Set(n.fields.map(p=>p.name).filter(Boolean)),c=new Set(n.fields.map(p=>p.label??"").filter(Boolean)),d=et(a,i),u=lt(o,c);s.name=d,s.label||(s.label=u);const f=Math.max(0,Math.min(r??n.fields.length,n.fields.length));n.fields.splice(f,0,s)}),removeField:s=>e().setSchema(r=>{r.fields=r.fields.filter(n=>n.name!==s),r.layout.forEach(n=>{n.type==="rows"&&n.sections.forEach(a=>a.rows.forEach(o=>o.columns.forEach(i=>{i.fields=(i.fields??[]).filter(c=>c!==s)}))),n.type==="tabs"&&n.tabs.forEach(a=>a.sections.forEach(o=>o.rows.forEach(i=>i.columns.forEach(c=>{c.fields=(c.fields??[]).filter(d=>d!==s)}))))})}),updateField:(s,r)=>e().setSchema(n=>{const a=n.fields.findIndex(o=>o.name===s);a>=0&&r(n.fields[a])}),duplicateField:(s,r)=>e().setSchema(n=>{const a=n.fields.findIndex(g=>g.name===s);if(a<0)return;const o=n.fields[a],i=Yn((r==null?void 0:r.trim())||o.name||""),c=Fl(o.label??""),d=new Set(n.fields.map(g=>g.name).filter(Boolean)),u=new Set(n.fields.map(g=>g.label??"").filter(Boolean)),f=et(i||tt(o).baseName,d),p=lt(c||tt(o).baseLabel,u),h=JSON.parse(JSON.stringify(o));h.name=f,h.label=p,n.fields.splice(a+1,0,h)}),renameField:(s,r)=>e().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===s);if(a<0)return;const o=Yn((r??s).trim()||"campo"),i=new Set(n.fields.map(d=>d.name).filter(Boolean));i.delete(s);const c=et(o,i);n.fields[a].name=c,n.layout.forEach(d=>{d.type==="rows"&&d.sections.forEach(u=>u.rows.forEach(f=>f.columns.forEach(p=>{p.fields&&(p.fields=p.fields.map(h=>h===s?c:h))}))),d.type==="tabs"&&d.tabs.forEach(u=>u.sections.forEach(f=>f.rows.forEach(p=>p.columns.forEach(h=>{h.fields&&(h.fields=h.fields.map(g=>g===s?c:g))}))))})}),addSection:s=>e().setSchema(r=>{const n=Re(r);if(!n)return;const a={sectionTitle:s??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]};n.sections.push(a)}),renameSection:(s,r)=>e().setSchema(n=>{const a=Re(n);if(!a)return;const o=a.sections[s];o&&(o.sectionTitle=(r??"").trim()||"Sección")}),moveSection:(s,r,n)=>t(a=>{const o=[...a.schema.layout],i=o[s];if(!i||i.type!=="rows")return a;const c=[...i.sections],[d]=c.splice(r,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),o[s]={...i,sections:c},{schema:{...a.schema,layout:o}}}),removeSection:s=>e().setSchema(r=>{const n=Re(r);if(!n||s<0||s>=n.sections.length)return;const a=[...n.sections];a.splice(s,1),n.sections=a}),duplicateSection:s=>e().setSchema(r=>{const n=Re(r);if(!n)return;const a=n.sections[s];if(!a)return;const o=JSON.parse(JSON.stringify(a)),i=(a.sectionTitle||"Sección").toString(),c=n.sections.map(f=>f.sectionTitle||""),d=new Set(c);let u=i;if(d.has(u)){let f=2;for(;d.has(`${i} (${f})`);)f++;u=`${i} (${f})`}o.sectionTitle=u,n.sections.splice(s+1,0,o)}),addRowsBlockAt:(s,r)=>e().setSchema(n=>{const a=Math.max(0,Math.min(s,n.layout.length));n.layout.splice(a,0,yh(r))}),addTabsContainerAt:s=>e().setSchema(r=>{const n=Math.max(0,Math.min(s,r.layout.length));r.layout.splice(n,0,wh())}),moveLayoutNode:(s,r)=>e().setSchema(n=>{const a=n.layout.length;if(s<0||s>=a)return;const o=Math.max(0,Math.min(r,a-1));if(s===o)return;const i=[...n.layout],[c]=i.splice(s,1);i.splice(o,0,c),n.layout=i}),removeLayoutNode:s=>e().setSchema(r=>{if(s<0||s>=r.layout.length)return;const n=[...r.layout];n.splice(s,1),r.layout=n}),addTabsContainer:()=>e().setSchema(s=>{const r={type:"tabs",tabs:[{key:"tab1",label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:"tab2",label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]};s.layout.push(r)}),addTabAfter:s=>e().setSchema(r=>{const n=Pe(r,s);if(!n)return;const a=r.layout[n.nodeIdx],o="Nueva pestaña",i=new Set(a.tabs.map(f=>f.label));let c=o,d=2;for(;i.has(c);)c=`${o} (${d++})`;const u={key:`tab_${Date.now().toString(36)}`,label:c,sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]};a.tabs.splice(n.tabIdx+1,0,u)}),removeTab:s=>e().setSchema(r=>{const n=Pe(r,s);if(!n)return;const a=r.layout[n.nodeIdx];a.tabs.length<=1||a.tabs.splice(n.tabIdx,1)}),renameTab:(s,r)=>e().setSchema(n=>{const a=Pe(n,s);if(!a)return;const o=n.layout[a.nodeIdx];o.tabs[a.tabIdx].label=(r??"").trim()||"Pestaña"}),moveTab:(s,r,n)=>t(a=>{const o=[...a.schema.layout],i=o[s];if(!i||i.type!=="tabs")return a;const c=[...i.tabs],[d]=c.splice(r,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),o[s]={...i,tabs:c},{schema:{...a.schema,layout:o}}}),moveTabSection:(s,r,n,a)=>t(o=>{const i=[...o.schema.layout],c=i[s];if(!c||c.type!=="tabs")return o;const d=c.tabs.find(g=>g.key===r);if(!d)return o;const u=[...d.sections],[f]=u.splice(n,1),p=Math.max(0,Math.min(a,u.length));u.splice(p,0,f);const h=c.tabs.map(g=>g.key===r?{...g,sections:u}:g);return i[s]={...c,tabs:h},{schema:{...o.schema,layout:i}}}),addSectionToTab:(s,r)=>e().setSchema(n=>{const a=Pe(n,s);if(!a)return;n.layout[a.nodeIdx].tabs[a.tabIdx].sections.push({sectionTitle:r??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]})}),addRowToTabSection:(s,r)=>e().setSchema(n=>{var i;const a=Pe(n,s);if(!a)return;(i=n.layout[a.nodeIdx].tabs[a.tabIdx].sections[r])==null||i.rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),renameTabSection:(s,r,n)=>e().setSchema(a=>{const o=Pe(a,s);if(!o)return;const c=a.layout[o.nodeIdx].tabs[o.tabIdx].sections[r];c&&(c.sectionTitle=(n??"").trim()||"Sección")}),setTabRowColumns:(s,r,n,a)=>e().setSchema(o=>{var h,g;const i=Pe(o,s);if(!i)return;const d=(g=(h=o.layout[i.nodeIdx].tabs[i.tabIdx].sections[r])==null?void 0:h.rows)==null?void 0:g[n];if(!d)return;const u=(d.columns??[]).flatMap(x=>x.fields??[]),f=xn(a),p=Array.from({length:a},(x,v)=>({width:f[v],fields:[]}));u.forEach((x,v)=>p[v%a].fields.push(x)),d.columns=p}),addColumnToTabRow:(s,r,n)=>e().setSchema(a=>{var d,u;const o=Pe(a,s);if(!o)return;const c=(u=(d=a.layout[o.nodeIdx].tabs[o.tabIdx].sections[r])==null?void 0:d.rows)==null?void 0:u[n];c&&c.columns.push({width:"w-1/2",fields:[]})}),removeTabColumn:(s,r,n,a)=>e().setSchema(o=>{var g,x;const i=Pe(o,s);if(!i)return;const d=(x=(g=o.layout[i.nodeIdx].tabs[i.tabIdx].sections[r])==null?void 0:g.rows)==null?void 0:x[n];if(!d)return;const u=d.columns??[];if(!u[a])return;const f=u[a],p=a>0?a-1:u[a+1]?a+1:-1,h=[...u];h.splice(a,1),p>=0&&h[p]&&(h[p].fields=[...h[p].fields??[],...f.fields??[]]),d.columns=h}),placeFieldInTabColumn:(s,r,n,a,o)=>e().setSchema(i=>{const c=Pe(i,r);if(!c)return;const u=i.layout[c.nodeIdx].tabs[c.tabIdx].sections[n].rows[a].columns[o];let f=s;if(us(i,s)){const p=i.fields.findIndex(h=>h.name===s);if(p>=0){const h=i.fields[p],{baseName:g,baseLabel:x}=tt(h),v=new Set(i.fields.map(O=>O.name).filter(Boolean)),m=new Set(i.fields.map(O=>O.label??"").filter(Boolean));f=et(g,v);const y=lt(x,m),w=JSON.parse(JSON.stringify(h));w.name=f,w.label=y,i.fields.splice(p+1,0,w)}}u.fields=[...u.fields??[],f]}),moveFieldInTab:(s,r)=>e().setSchema(n=>{var h,g,x,v;const a=Pe(n,s.tabKey);if(!a)return;const o=n.layout[a.nodeIdx],i=(g=(h=o.tabs[a.tabIdx].sections[s.s])==null?void 0:h.rows[s.r])==null?void 0:g.columns[s.c],c=(v=(x=o.tabs[a.tabIdx].sections[r.s])==null?void 0:x.rows[r.r])==null?void 0:v.columns[r.c];if(!i||!c)return;const d=[...i.fields??[]];if(s.idx<0||s.idx>=d.length)return;const[u]=d.splice(s.idx,1);i.fields=d;const f=[...c.fields??[]],p=r.idx===void 0?f.length:Math.max(0,Math.min(r.idx,f.length));f.splice(p,0,u),c.fields=f}),removeFieldFromTabLayout:s=>e().setSchema(r=>{var c,d;const n=Pe(r,s.tabKey);if(!n)return;const o=(d=(c=r.layout[n.nodeIdx].tabs[n.tabIdx].sections[s.s])==null?void 0:c.rows[s.r])==null?void 0:d.columns[s.c];if(!o||!o.fields||s.idx<0||s.idx>=o.fields.length)return;const i=[...o.fields];i.splice(s.idx,1),o.fields=i}),moveRowInSection:(s,r,n)=>e().setSchema(a=>{const o=Re(a);if(!o)return;const i=o.sections[s];if(!i)return;const c=[...i.rows];if(r<0||r>=c.length)return;const d=Math.max(0,Math.min(n,c.length-1));if(r===d)return;const[u]=c.splice(r,1);c.splice(d,0,u),i.rows=c}),duplicateRowInSection:(s,r)=>e().setSchema(n=>{const a=Re(n);if(!a)return;const o=a.sections[s];if(!o)return;const i=o.rows[r];if(!i)return;const c=JSON.parse(JSON.stringify(i));o.rows.splice(r+1,0,c)}),removeRowFromSection:(s,r)=>e().setSchema(n=>{const a=Re(n);if(!a)return;const o=a.sections[s];if(!o)return;const i=[...o.rows];r<0||r>=i.length||(i.splice(r,1),i.length===0&&i.push({title:"",columns:[{width:"w-full",fields:[]}]}),o.rows=i)}),setRowColumnsPreset:(s,r,n)=>e().setSchema(a=>{var d,u;const o=Re(a);if(!o)return;const i=(u=(d=o.sections[s])==null?void 0:d.rows)==null?void 0:u[r];if(!i)return;const c=vn[n];c&&yn(i,c)}),setRowResponsive:(s,r,n)=>e().setSchema(a=>{var h,g;const o=Re(a);if(!o)return;const i=(g=(h=o.sections[Number(s)])==null?void 0:h.rows)==null?void 0:g[Number(r)];if(!i)return;const c=Math.max(n.desktop.count??1,n.tablet.count??1,n.mobile.count??1),d=(i.columns??[]).flatMap(x=>x.fields??[]),u=jn(d,c),f=(x,v,m)=>v<(m??0)?ps((x==null?void 0:x[v])??0):null,p=Array.from({length:c},(x,v)=>{const m=f(n.mobile.widths,v,n.mobile.count),y=f(n.tablet.widths,v,n.tablet.count),w=f(n.desktop.widths,v,n.desktop.count);return{width:wn(m,y,w),fields:u[v]??[]}});i.columns=p}),setRowColumnsAt:(s,r,n,a)=>e().setSchema(o=>{var p,h;const i=mt(o,s);if(!i)return;const c=(h=(p=i.sections[r])==null?void 0:p.rows)==null?void 0:h[n];if(!c)return;const d=(c.columns??[]).flatMap(g=>g.fields??[]),u=xn(a),f=Array.from({length:a},(g,x)=>({width:u[x],fields:[]}));d.forEach((g,x)=>f[x%a].fields.push(g)),c.columns=f}),addColumnToRowAt:(s,r,n)=>e().setSchema(a=>{var i,c,d,u;const o=mt(a,s);o&&((u=(d=(c=(i=o.sections[r])==null?void 0:i.rows)==null?void 0:c[n])==null?void 0:d.columns)==null||u.push({width:"w-1/2",fields:[]}))}),removeColumnAt:(s,r,n,a)=>e().setSchema(o=>{var h,g;const i=mt(o,s);if(!i)return;const c=(g=(h=i.sections[r])==null?void 0:h.rows)==null?void 0:g[n];if(!c)return;const d=c.columns??[];if(!d[a])return;const u=d[a],f=a>0?a-1:d[a+1]?a+1:-1,p=[...d];p.splice(a,1),f>=0&&p[f]&&(p[f].fields=[...p[f].fields??[],...u.fields??[]]),c.columns=p}),setRowColumnsPresetAt:(s,r,n,a)=>e().setSchema(o=>{var u,f;const i=mt(o,s);if(!i)return;const c=(f=(u=i.sections[r])==null?void 0:u.rows)==null?void 0:f[n];if(!c)return;const d=vn[a];d&&yn(c,d)}),setRowResponsiveAt:(s,r,n,a)=>e().setSchema(o=>{var g,x;const i=mt(o,s);if(!i)return;const c=(x=(g=i.sections[Number(r)])==null?void 0:g.rows)==null?void 0:x[Number(n)];if(!c)return;const d=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),u=(v,m,y)=>m<(y??0)?ps((v==null?void 0:v[m])??0):null,f=kh(c,d),p=f.flatMap(v=>v.fields??[]),h=jn(p,d);for(let v=0;v<d;v++){const m=u(a.mobile.widths,v,a.mobile.count),y=u(a.tablet.widths,v,a.tablet.count),w=u(a.desktop.widths,v,a.desktop.count);f[v].width=wn(m,y,w),f[v].fields=h[v]??[]}}),placeFieldInColumnAt:(s,r,n,a,o,i)=>e().setSchema(c=>{var g,x,v,m;const d=mt(c,s);if(!d)return;const u=(m=(v=(x=(g=d.sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[o];if(!u)return;let f=r;if(us(c,r)){const y=c.fields.findIndex(w=>w.name===r);if(y>=0){const w=c.fields[y],{baseName:O,baseLabel:S}=tt(w),T=new Set(c.fields.map(I=>I.name).filter(Boolean)),C=new Set(c.fields.map(I=>I.label??"").filter(Boolean));f=et(O,T);const N=lt(S,C),_=JSON.parse(JSON.stringify(w));_.name=f,_.label=N,c.fields.splice(y+1,0,_)}}const p=[...u.fields??[]],h=i===void 0?p.length:Math.max(0,Math.min(i,p.length));p.splice(h,0,f),u.fields=p}),moveFieldAt:(s,r,n,a)=>e().setSchema(o=>{var x,v,m,y,w,O,S,T;const i=mt(o,s),c=mt(o,n);if(!i||!c)return;const d=(y=(m=(v=(x=i.sections[r.s])==null?void 0:x.rows)==null?void 0:v[r.r])==null?void 0:m.columns)==null?void 0:y[r.c],u=(T=(S=(O=(w=c.sections[a.s])==null?void 0:w.rows)==null?void 0:O[a.r])==null?void 0:S.columns)==null?void 0:T[a.c];if(!d||!u)return;const f=[...d.fields??[]];if(r.idx<0||r.idx>=f.length)return;const[p]=f.splice(r.idx,1);d.fields=f;const h=[...u.fields??[]],g=a.idx===void 0?h.length:Math.max(0,Math.min(a.idx,h.length));h.splice(g,0,p),u.fields=h}),removeFieldFromLayoutAt:(s,r)=>e().setSchema(n=>{var c,d,u,f;const a=mt(n,s);if(!a)return;const o=(f=(u=(d=(c=a.sections[r.s])==null?void 0:c.rows)==null?void 0:d[r.r])==null?void 0:u.columns)==null?void 0:f[r.c];if(!o||!o.fields||r.idx<0||r.idx>=o.fields.length)return;const i=[...o.fields];i.splice(r.idx,1),o.fields=i}),insertExistingFieldAtAt:(s,r,n,a,o,i)=>e().setSchema(c=>{var g,x,v,m;const d=mt(c,s);if(!d)return;const u=(m=(v=(x=(g=d.sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[o];if(!u)return;let f=r;if(us(c,r)){const y=c.fields.findIndex(w=>w.name===r);if(y>=0){const w=c.fields[y],{baseName:O,baseLabel:S}=tt(w),T=new Set(c.fields.map(z=>z.name).filter(Boolean)),C=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),N=et(O,T),_=lt(S,C),I=JSON.parse(JSON.stringify(w));I.name=N,I.label=_,c.fields.splice(y+1,0,I),f=N}}const p=[...u.fields??[]],h=Math.max(0,Math.min(i,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceAtAt:(s,r,n,a,o,i)=>e().setSchema(c=>{var O,S,T,C;const{baseName:d,baseLabel:u}=tt(r),f=new Set(c.fields.map(N=>N.name).filter(Boolean)),p=new Set(c.fields.map(N=>N.label??"").filter(Boolean)),h=et(d,f),g=lt(u,p),x=JSON.parse(JSON.stringify(r));x.name=h,x.label||(x.label=g),c.fields.push(x);const v=mt(c,s);if(!v)return;const m=(C=(T=(S=(O=v.sections[n])==null?void 0:O.rows)==null?void 0:S[a])==null?void 0:T.columns)==null?void 0:C[o];if(!m)return;const y=[...m.fields??[]],w=Math.max(0,Math.min(i,y.length));y.splice(w,0,h),m.fields=y}),setTabRowResponsive:(s,r,n,a)=>e().setSchema(o=>{var x,v;const i=Pe(o,s);if(!i)return;const d=(v=(x=o.layout[i.nodeIdx].tabs[i.tabIdx].sections[Number(r)])==null?void 0:x.rows)==null?void 0:v[Number(n)];if(!d)return;const u=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),f=(d.columns??[]).flatMap(m=>m.fields??[]),p=jn(f,u),h=(m,y,w)=>y<(w??0)?ps((m==null?void 0:m[y])??0):null,g=Array.from({length:u},(m,y)=>{const w=h(a.mobile.widths,y,a.mobile.count),O=h(a.tablet.widths,y,a.tablet.count),S=h(a.desktop.widths,y,a.desktop.count);return{width:wn(w,O,S),fields:p[y]??[]}});d.columns=g}),moveTabRow:(s,r,n,a)=>e().setSchema(o=>{const i=Pe(o,s);if(!i)return;const d=o.layout[i.nodeIdx].tabs[i.tabIdx].sections[r];if(!d)return;const u=[...d.rows];if(n<0||n>=u.length)return;const f=Math.max(0,Math.min(a,u.length-1));if(n===f)return;const[p]=u.splice(n,1);u.splice(f,0,p),d.rows=u}),duplicateTabRow:(s,r,n)=>e().setSchema(a=>{const o=Pe(a,s);if(!o)return;const c=a.layout[o.nodeIdx].tabs[o.tabIdx].sections[r];if(!c)return;const d=c.rows[n];if(!d)return;const u=JSON.parse(JSON.stringify(d));c.rows.splice(n+1,0,u)}),removeTabRow:(s,r,n)=>e().setSchema(a=>{const o=Pe(a,s);if(!o)return;const c=a.layout[o.nodeIdx].tabs[o.tabIdx].sections[r];if(!c)return;const d=[...c.rows];n<0||n>=d.length||(d.splice(n,1),d.length===0&&d.push({title:"",columns:[{width:"w-full",fields:[]}]}),c.rows=d)}),setTabRowColumnsPreset:(s,r,n,a)=>e().setSchema(o=>{var f,p;const i=Pe(o,s);if(!i)return;const d=(p=(f=o.layout[i.nodeIdx].tabs[i.tabIdx].sections[r])==null?void 0:f.rows)==null?void 0:p[n];if(!d)return;const u=vn[a];u&&yn(d,u)}),addRowToSection:s=>e().setSchema(r=>{const n=Re(r);n&&n.sections[s].rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),addColumnToRow:(s,r)=>e().setSchema(n=>{const a=Re(n);a&&a.sections[s].rows[r].columns.push({width:"w-1/2",fields:[]})}),setRowColumns:(s,r,n)=>e().setSchema(a=>{const o=Re(a);if(!o)return;const i=o.sections[s].rows[r],c=(i.columns??[]).flatMap(f=>f.fields??[]),d=xn(n),u=Array.from({length:n},(f,p)=>({width:d[p],fields:[]}));c.forEach((f,p)=>u[p%n].fields.push(f)),i.columns=u}),removeColumn:(s,r,n)=>e().setSchema(a=>{const o=Re(a);if(!o)return;const i=o.sections[s].rows[r],c=i.columns??[];if(!c[n])return;const d=c[n],u=n>0?n-1:c[n+1]?n+1:-1,f=[...c];f.splice(n,1),u>=0&&f[u]&&(f[u].fields=[...f[u].fields??[],...d.fields??[]]),i.columns=f}),placeFieldInColumn:(s,r,n,a)=>e().setSchema(o=>{const i=Re(o);if(!i)return;const c=i.sections[r].rows[n].columns[a];let d=s;if(us(o,s)){const u=o.fields.findIndex(f=>f.name===s);if(u>=0){const f=o.fields[u],{baseName:p,baseLabel:h}=tt(f),g=new Set(o.fields.map(w=>w.name).filter(Boolean)),x=new Set(o.fields.map(w=>w.label??"").filter(Boolean)),v=et(p,g),m=lt(h,x),y=JSON.parse(JSON.stringify(f));y.name=v,y.label=m,o.fields.splice(u+1,0,y),d=v}}c.fields=[...c.fields??[],d]}),moveField:(s,r)=>e().setSchema(n=>{var p,h,g,x;const a=Re(n);if(!a)return;const o=(h=(p=a.sections[s.s])==null?void 0:p.rows[s.r])==null?void 0:h.columns[s.c],i=(x=(g=a.sections[r.s])==null?void 0:g.rows[r.r])==null?void 0:x.columns[r.c];if(!o||!i)return;const c=[...o.fields??[]];if(s.idx<0||s.idx>=c.length)return;const[d]=c.splice(s.idx,1);o.fields=c;const u=[...i.fields??[]],f=r.idx===void 0?u.length:Math.max(0,Math.min(r.idx,u.length));u.splice(f,0,d),i.fields=u}),removeFieldFromLayout:s=>e().setSchema(r=>{var i,c;const n=Re(r);if(!n)return;const a=(c=(i=n.sections[s.s])==null?void 0:i.rows[s.r])==null?void 0:c.columns[s.c];if(!a||!a.fields||s.idx<0||s.idx>=a.fields.length)return;const o=[...a.fields];o.splice(s.idx,1),a.fields=o}),addFieldAndPlace:(s,r,n,a)=>e().setSchema(o=>{const{baseName:i,baseLabel:c}=tt(s),d=new Set(o.fields.map(v=>v.name).filter(Boolean)),u=new Set(o.fields.map(v=>v.label??"").filter(Boolean)),f=et(i,d),p=lt(c,u),h=JSON.parse(JSON.stringify(s));h.name=f,h.label||(h.label=p),o.fields.push(h);const g=Re(o);if(!g)return;const x=g.sections[r].rows[n].columns[a];x.fields=[...x.fields??[],f]}),moveFieldWithinColumn:(s,r,n,a,o)=>e().setSchema(i=>{var h,g,x,v;const c=Re(i);if(!c)return;const d=(v=(x=(g=(h=c.sections[s])==null?void 0:h.rows)==null?void 0:g[r])==null?void 0:x.columns)==null?void 0:v[n];if(!d)return;const u=[...d.fields??[]];if(a<0||a>=u.length)return;const[f]=u.splice(a,1),p=Math.max(0,Math.min(o,u.length));u.splice(p,0,f),d.fields=u}),insertExistingFieldAt:(s,r,n,a,o)=>e().setSchema(i=>{var h,g,x,v;const c=Re(i);if(!c)return;const d=(v=(x=(g=(h=c.sections[r])==null?void 0:h.rows)==null?void 0:g[n])==null?void 0:x.columns)==null?void 0:v[a];if(!d)return;let u=s;if(us(i,s)){const m=i.fields.findIndex(y=>y.name===s);if(m>=0){const y=i.fields[m],{baseName:w,baseLabel:O}=tt(y),S=new Set(i.fields.map(I=>I.name).filter(Boolean)),T=new Set(i.fields.map(I=>I.label??"").filter(Boolean)),C=et(w,S),N=lt(O,T),_=JSON.parse(JSON.stringify(y));_.name=C,_.label=N,i.fields.splice(m+1,0,_),u=C}}const f=[...d.fields??[]],p=Math.max(0,Math.min(o,f.length));f.splice(p,0,u),d.fields=f}),addFieldAndPlaceAt:(s,r,n,a,o)=>e().setSchema(i=>{var w,O,S,T;const{baseName:c,baseLabel:d}=tt(s),u=new Set(i.fields.map(C=>C.name).filter(Boolean)),f=new Set(i.fields.map(C=>C.label??"").filter(Boolean)),p=et(c,u),h=lt(d,f),g=JSON.parse(JSON.stringify(s));g.name=p,g.label||(g.label=h),i.fields.push(g);const x=Re(i);if(!x)return;const v=(T=(S=(O=(w=x.sections[r])==null?void 0:w.rows)==null?void 0:O[n])==null?void 0:S.columns)==null?void 0:T[a];if(!v)return;const m=[...v.fields??[]],y=Math.max(0,Math.min(o,m.length));m.splice(y,0,p),v.fields=m}),moveFieldWithinTab:(s,r,n,a,o,i)=>e().setSchema(c=>{var g,x,v,m;const d=Pe(c,s);if(!d)return;const u=(m=(v=(x=(g=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[r])==null?void 0:g.rows)==null?void 0:x[n])==null?void 0:v.columns)==null?void 0:m[a];if(!u)return;const f=[...u.fields??[]];if(o<0||o>=f.length)return;const[p]=f.splice(o,1),h=Math.max(0,Math.min(i,f.length));f.splice(h,0,p),u.fields=f}),insertExistingFieldInTabAt:(s,r,n,a,o,i)=>e().setSchema(c=>{var g,x,v,m;const d=Pe(c,r);if(!d)return;const u=(m=(v=(x=(g=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[o];if(!u)return;let f=s;if(us(c,s)){const y=c.fields.findIndex(w=>w.name===s);if(y>=0){const w=c.fields[y],{baseName:O,baseLabel:S}=tt(w),T=new Set(c.fields.map(z=>z.name).filter(Boolean)),C=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),N=et(O,T),_=lt(S,C),I=JSON.parse(JSON.stringify(w));I.name=N,I.label=_,c.fields.splice(y+1,0,I),f=N}}const p=[...u.fields??[]],h=Math.max(0,Math.min(i,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceInTabAt:(s,r,n,a,o,i)=>e().setSchema(c=>{var O,S,T,C;const d=Pe(c,r);if(!d)return;const{baseName:u,baseLabel:f}=tt(s),p=new Set(c.fields.map(N=>N.name).filter(Boolean)),h=new Set(c.fields.map(N=>N.label??"").filter(Boolean)),g=et(u,p),x=lt(f,h),v=JSON.parse(JSON.stringify(s));v.name=g,v.label||(v.label=x),c.fields.push(v);const m=(C=(T=(S=(O=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:O.rows)==null?void 0:S[a])==null?void 0:T.columns)==null?void 0:C[o];if(!m)return;const y=[...m.fields??[]],w=Math.max(0,Math.min(i,y.length));y.splice(w,0,g),m.fields=y}),changeFieldType:(s,r)=>e().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===s);if(a<0)return;const o=n.fields[a],c={...{name:o.name,label:o.label,width:o.width,size:o.size,info:o.info,disabled:o.disabled,visibleWhen:o.visibleWhen,disabledWhen:o.disabledWhen,clearWhen:o.clearWhen,validation:o.validation,placeholder:o.placeholder},type:r};switch(r){case"text":case"email":case"password":case"number":break;case"textarea":c.maxLength=o.maxLength??void 0,c.showCounter=o.showCounter??!1;break;case"select":c.options=Array.isArray(o.options)?o.options:[],c.multiple=!!o.multiple,c.loadOptions=o.loadOptions??void 0;break;case"checkbox":c.defaultValue=!!o.defaultValue,delete c.placeholder;break;case"date":c.showTime=!!o.showTime;break;case"file":c.maxFiles=o.maxFiles??1,c.accept=o.accept??"",delete c.placeholder;break}r!=="select"&&(delete c.options,delete c.multiple,delete c.loadOptions),r!=="textarea"&&(delete c.maxLength,delete c.showCounter),r!=="checkbox"&&delete c.defaultValue,r!=="date"&&delete c.showTime,r!=="file"&&(delete c.maxFiles,delete c.accept),n.fields[a]=c})}));function yn(t,e){const s=(t.columns??[]).flatMap(a=>a.fields??[]),r=e.length,n=e.map(a=>({width:a,fields:[]}));s.forEach((a,o)=>n[o%r].fields.push(a)),t.columns=n}function wn(t,e,s){const r=[];return t===null?r.push("hidden"):r.push(`w-[${bn(ps(t))}%]`,"block"),e===null?r.push("md:hidden"):r.push(`md:w-[${bn(ps(e))}%]`,"md:block"),s===null?r.push("lg:hidden"):r.push(`lg:w-[${bn(ps(s))}%]`,"lg:block"),r.join(" ")}function kh(t,e){const s=t.columns??[];if(s.length===e)return s;if(s.length<e){const n=e-s.length,a=[...s];for(let o=0;o<n;o++)a.push({width:"w-[100%]",fields:[]});return t.columns=a,a}const r=s.slice(0,e);for(let n=e;n<s.length;n++)r[e-1].fields=[...r[e-1].fields??[],...s[n].fields??[]];return t.columns=r,r}function jn(t,e){const s=Array.from({length:e},()=>[]);return t.forEach((r,n)=>s[n%e].push(r)),s}const en=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ys(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function ba(t){return"nodeType"in t}function Xe(t){var e,s;return t?ys(t)?t:ba(t)&&(e=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?e:window:window}function xa(t){const{Document:e}=Xe(t);return t instanceof e}function Ys(t){return ys(t)?!1:t instanceof Xe(t).HTMLElement}function Rl(t){return t instanceof Xe(t).SVGElement}function ws(t){return t?ys(t)?t.document:ba(t)?xa(t)?t:Ys(t)||Rl(t)?t.ownerDocument:document:document:document}const _t=en?b.useLayoutEffect:b.useEffect;function tn(t){const e=b.useRef(t);return _t(()=>{e.current=t}),b.useCallback(function(){for(var s=arguments.length,r=new Array(s),n=0;n<s;n++)r[n]=arguments[n];return e.current==null?void 0:e.current(...r)},[])}function Sh(){const t=b.useRef(null),e=b.useCallback((r,n)=>{t.current=setInterval(r,n)},[]),s=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,s]}function Bs(t,e){e===void 0&&(e=[t]);const s=b.useRef(t);return _t(()=>{s.current!==t&&(s.current=t)},e),s}function Xs(t,e){const s=b.useRef();return b.useMemo(()=>{const r=t(s.current);return s.current=r,r},[...e])}function Ir(t){const e=tn(t),s=b.useRef(null),r=b.useCallback(n=>{n!==s.current&&(e==null||e(n,s.current)),s.current=n},[]);return[s,r]}function Vr(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let kn={};function sn(t,e){return b.useMemo(()=>{if(e)return e;const s=kn[t]==null?0:kn[t]+1;return kn[t]=s,t+"-"+s},[t,e])}function _l(t){return function(e){for(var s=arguments.length,r=new Array(s>1?s-1:0),n=1;n<s;n++)r[n-1]=arguments[n];return r.reduce((a,o)=>{const i=Object.entries(o);for(const[c,d]of i){const u=a[c];u!=null&&(a[c]=u+t*d)}return a},{...e})}}const ms=_l(1),zr=_l(-1);function Nh(t){return"clientX"in t&&"clientY"in t}function va(t){if(!t)return!1;const{KeyboardEvent:e}=Xe(t.target);return e&&t instanceof e}function Ch(t){if(!t)return!1;const{TouchEvent:e}=Xe(t.target);return e&&t instanceof e}function Br(t){if(Ch(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:s}=t.touches[0];return{x:e,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:s}=t.changedTouches[0];return{x:e,y:s}}}return Nh(t)?{x:t.clientX,y:t.clientY}:null}const Us=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:s}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:s}=t;return"scaleX("+e+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[Us.Translate.toString(t),Us.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:s,easing:r}=t;return e+" "+s+"ms "+r}}}),Io="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eh(t){return t.matches(Io)?t:t.querySelector(Io)}const Oh={display:"none"};function Ah(t){let{id:e,value:s}=t;return b.createElement("div",{id:e,style:Oh},s)}function Th(t){let{id:e,announcement:s,ariaLiveType:r="assertive"}=t;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return b.createElement("div",{id:e,style:n,role:"status","aria-live":r,"aria-atomic":!0},s)}function Fh(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const Dl=b.createContext(null);function Rh(t){const e=b.useContext(Dl);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function _h(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:n,event:a}=r;t.forEach(o=>{var i;return(i=o[n])==null?void 0:i.call(o,a)})},[t]),e]}const Dh={draggable:`
61
+ `,children:[o.jsx(Vn,{className:"w-5 h-5 text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]"}),o.jsx("span",{className:"sr-only",children:"Cerrar modal"})]})]}),o.jsx("div",{className:"px-6 py-6 text-[var(--color-ds-text-primary)]",children:s}),n&&o.jsx("div",{className:"px-6 py-4 border-t border-[var(--color-ds-border-muted)] bg-[var(--color-ds-background-surface)]",children:n})]})})]}),document.body):null),Qn=({items:e,selected:t,onSelect:r,level:s=0})=>{const[n,a]=b.useState(new Set),i=l=>{const c=new Set(n);s===0?(c.clear(),n.has(l)||c.add(l)):c.has(l)?c.delete(l):c.add(l),a(c)};return o.jsx("ul",{className:se(s>0?"mt-1":"mt-0"),children:e.map(l=>{var g;const c=l.value===t,d=n.has(l.value),u=["pl-2","pl-2","pl-2"][s]||"pl-4",f=s===0?d||c?"bg-[var(--color-ds-background-accent)] text-[var(--color-ds-text-on-accent)] rounded-r-lg":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]":c?"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)]":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]",p=s===0&&(d||c)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",h=!!((g=l.children)!=null&&g.length);return o.jsxs("li",{children:[o.jsxs("button",{type:"button",onClick:()=>h?i(l.value):r(l.value),"aria-expanded":h?d:void 0,className:se("w-full flex items-center justify-between h-8 transition-colors",u,f),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[s===0&&l.icon&&o.jsx(l.icon,{className:"w-5 h-5 ml-2"}),o.jsx("span",{className:"text-ds-sm",children:l.label})]}),h&&(d?o.jsx(Rs,{className:se("w-4 h-4",p)}):o.jsx(Lo,{className:se("w-4 h-4",p)}))]}),h&&o.jsx("div",{className:se("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",d?"max-h-screen":"max-h-0"),children:o.jsx(Qn,{items:l.children,selected:t,onSelect:r,level:s+1})})]},l.value)})})},rf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23FFFFFF;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",sf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23005751;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",Ki=({appName:e,orgName:t,username:r,footerText:s,navItems:n,selectedNav:a,onSelectNav:i,width:l="200px"})=>{const{theme:c}=Xn(),d=c==="dark"?rf:sf;return o.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)]",style:{width:l},children:[o.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[o.jsx("img",{src:d,alt:"Logo Diputación",className:"w-20 h-20"}),o.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg ",children:e}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:r}),o.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),o.jsx("nav",{className:"flex-1 overflow-auto pt-3",children:o.jsx(Qn,{items:n,selected:a,onSelect:i})}),o.jsx("div",{className:"px-4 w-full py-3",children:o.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:s})})]})};function nf({hideSidebar:e=!1,sidebar:t,header:r,children:s}){const{dark:n}=Xn(),a={...r,dark:n};return o.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!e&&o.jsx(Ki,{...t}),o.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${e?"px-0":"px-10"}`,children:[o.jsx(Wi,{...a}),o.jsx("main",{className:"flex-1",children:s})]})]})}function af({columns:e,data:t,loadData:r,loading:s,idAccessor:n,multiSelect:a=!1,onSelectionChange:i,pageSize:l=10,initialSort:c,onSort:d,className:u,onRowDoubleClick:f}){const p=t!==void 0,[h,g]=b.useState([]),[x,v]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{var I;if(!r||p)return;(I=m.current)==null||I.abort();const k=new AbortController;return m.current=k,v(!0),r().then(U=>{k.signal.aborted||g(U)}).finally(()=>{k.signal.aborted||v(!1)}),()=>k.abort()},[r,p]);const w=b.useMemo(()=>p?t:h,[t,h,p]),y=s??(r?x:!1),[T,N]=b.useState(new Set),[_,A]=b.useState(1),[S,$]=b.useState(c==null?void 0:c.sortBy),[V,z]=b.useState((c==null?void 0:c.sortDir)??"asc"),q=k=>typeof n=="function"?n(k):k[n],D=b.useRef(null);b.useEffect(()=>{D.current!==w&&(N(new Set),A(1),D.current=w)},[w]);const P=b.useMemo(()=>{if(!S)return w;const k=V==="asc"?1:-1;return[...w].sort((I,U)=>{const G=I[S],ee=U[S];return G==null?-k:ee==null||G>ee?k:G<ee?-k:0})},[w,S,V]),E=Math.max(1,Math.ceil(P.length/l)),te=b.useMemo(()=>{const k=(_-1)*l;return P.slice(k,k+l)},[P,_,l]),ne=k=>{const I=new Set(T);I.has(k)?I.delete(k):I.add(k),N(I),i==null||i(w.filter(U=>I.has(q(U))))},K=()=>{const k=te.every(U=>T.has(q(U))),I=new Set(T);te.forEach(U=>{k?I.delete(q(U)):I.add(q(U))}),N(I),i==null||i(w.filter(U=>I.has(q(U))))},le=k=>{if(!k.sortable)return;const I=typeof k.accessor=="string"?k.accessor:k.sortKey;if(S===I){const U=V==="asc"?"desc":"asc";z(U),d==null||d(I,U)}else $(I),z("asc"),d==null||d(I,"asc");A(1)},C=()=>y?o.jsx("tbody",{children:Array.from({length:l}).map((k,I)=>o.jsxs("tr",{children:[a&&o.jsx("td",{children:o.jsx(Xt,{width:"1rem",height:"1rem",variant:"circle"})}),e.map((U,G)=>o.jsx("td",{children:o.jsx(Xt,{width:"100%",height:"1em",variant:"rect"})},G))]},I))}):te.length?o.jsx("tbody",{children:te.map(k=>{const I=q(k);return o.jsxs("tr",{className:se("hover:bg-gray-50",f&&"cursor-pointer select-none"),onDoubleClick:f?()=>f(k):void 0,title:f?"Doble clic para abrir":void 0,children:[a&&o.jsx("td",{children:o.jsx("input",{type:"checkbox",checked:T.has(I),onChange:()=>ne(I),onDoubleClick:U=>U.stopPropagation()})}),e.map((U,G)=>{const ee=U.render?U.render(k):typeof U.accessor=="function"?U.accessor(k):k[U.accessor];return o.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm",children:ee},G)})]},I)})}):o.jsx("tbody",{children:o.jsx("tr",{children:o.jsx("td",{colSpan:e.length+(a?1:0),children:"No hay datos"})})});return o.jsxs("div",{className:se("w-full overflow-auto",u),children:[o.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[o.jsx("thead",{className:"bg-gray-50",children:o.jsxs("tr",{children:[a&&o.jsx("th",{children:o.jsx("input",{type:"checkbox",checked:te.length>0&&te.every(k=>T.has(q(k))),onChange:K,onDoubleClick:k=>k.stopPropagation()})}),e.map(k=>{const I=typeof k.accessor=="string"?k.accessor:k.header,U=S===(typeof k.accessor=="string"?k.accessor:k.sortKey);return o.jsx("th",{className:se("px-4 py-2 text-left text-sm font-medium text-gray-700",k.width),onClick:()=>le(k),children:o.jsxs("div",{className:"inline-flex items-center space-x-1 cursor-pointer",children:[o.jsx("span",{children:k.header}),k.sortable&&o.jsx("span",{className:"text-xs",children:U?V==="asc"?"▲":"▼":"⇵"})]})},I)})]})}),C()]}),o.jsxs("div",{className:"flex items-center justify-between py-2 px-4",children:[o.jsx("span",{className:"text-sm text-gray-700",children:y?"Cargando...":`Página ${_} de ${E}`}),o.jsxs("div",{className:"space-x-2",children:[o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_<=1,onClick:()=>A(k=>Math.max(1,k-1)),children:"Prev"}),o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_>=E,onClick:()=>A(k=>Math.min(E,k+1)),children:"Next"})]})]})]})}function Gi({control:e,name:t,rules:r,defaultValue:s=!1,checked:n,onChange:a,disabled:i=!1,label:l,labelPosition:c="right",errorMessage:d="",className:u}){const f=b.useId();if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s,render:({field:h,fieldState:g})=>{var x;return o.jsx(Gi,{checked:h.value,onChange:h.onChange,disabled:i,label:l,labelPosition:c,errorMessage:((x=g.error)==null?void 0:x.message)||"",className:u})}});const p=!!n;return o.jsxs("div",{className:se("flex flex-col",u),children:[o.jsxs("label",{className:se("inline-flex items-center space-x-3 select-none",i&&"opacity-50 cursor-not-allowed"),htmlFor:f,children:[l&&c==="left"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l}),o.jsx("button",{id:f,type:"button",role:"switch","aria-checked":p,disabled:i,onClick:()=>!i&&(a==null?void 0:a(!p)),className:se("relative inline-flex items-center h-8 w-16","bg-[var(--color-ds-background-accent)] rounded-full transition-colors duration-200","focus:outline-none "),children:o.jsx("div",{className:se("absolute h-6 w-6 bg-[var(--color-ds-background-page)] rounded-full shadow transform transition-transform duration-200",p?"translate-x-9":"translate-x-1")})}),l&&c==="right"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l})]}),o.jsx("div",{className:"pt-1 min-h-[18px] w-full",children:d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Ji({items:e,value:t,onValueChange:r,multiple:s=!0,dense:n=!1,className:a}){const i=b.useMemo(()=>e.filter(g=>g.defaultOpen&&!g.disabled).map(g=>g.id),[e]),[l,c]=b.useState(i),d=t??l,u=g=>{r?r(g):c(g)},f=(g,x)=>{x&&u(s?d.includes(g)?d.filter(v=>v!==g):[...d,g]:d.includes(g)?[]:[g])},p=(g,x,v)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),f(x,v))},h=n?"py-1":"py-2";return o.jsx("div",{className:["divide-y","divide-[var(--color-ds-border-default-50)]",a].filter(Boolean).join(" "),children:e.map(g=>{const x=d.includes(g.id),v=!g.disabled;return o.jsxs("section",{"aria-disabled":g.disabled||void 0,children:[o.jsxs("button",{type:"button",onClick:()=>f(g.id,v),onKeyDown:m=>p(m,g.id,v),"aria-expanded":x,className:["w-full flex items-center justify-between gap-2 text-left select-none",h,"text-[var(--color-ds-text-primary)]",g.disabled?"opacity-60 cursor-not-allowed":"hover:bg-[color-mix(in_srgb,var(--color-ds-background-surface)_80%,transparent)]"].join(" "),children:[o.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[g.leftAdornment&&o.jsx("span",{className:"shrink-0",children:g.leftAdornment}),o.jsx("span",{className:"font-medium truncate",children:g.title})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[g.actions,o.jsx(Rs,{className:["h-4 w-4 transition-transform",x?"rotate-180":"",g.disabled?"opacity-40":""].join(" ")})]})]}),x&&o.jsx("div",{className:[n?"py-1":"py-2"].join(" "),children:g.content})]},g.id)})})}const so=e=>{let t;const r=new Set,s=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const p=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(h=>h(t,p))}},n=()=>t,l={setState:s,getState:n,getInitialState:()=>c,subscribe:d=>(r.add(d),()=>r.delete(d))},c=t=e(s,n,l);return l},of=e=>e?so(e):so,lf=e=>e;function cf(e,t=lf){const r=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(r),r}const no=e=>{const t=of(e),r=s=>cf(t,s);return Object.assign(r,t),r},df=e=>e?no(e):no;var Zi=Symbol.for("immer-nothing"),ao=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),uf=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function st(e,...t){if(process.env.NODE_ENV!=="production"){const r=uf[e],s=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fr=Object.getPrototypeOf;function mr(e){return!!e&&!!e[ct]}function Qt(e){var t;return e?Yi(e)||Array.isArray(e)||!!e[ao]||!!((t=e.constructor)!=null&&t[ao])||Br(e)||zs(e):!1}var ff=Object.prototype.constructor.toString();function Yi(e){if(!e||typeof e!="object")return!1;const t=fr(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===ff}function Ns(e,t){Ps(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function Ps(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:Br(e)?2:zs(e)?3:0}function _n(e,t){return Ps(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hi(e,t,r){const s=Ps(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function mf(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Br(e){return e instanceof Map}function zs(e){return e instanceof Set}function Gt(e){return e.copy_||e.base_}function Fn(e,t){if(Br(e))return new Map(e);if(zs(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Yi(e);if(t===!0||t==="class_only"&&!r){const s=Object.getOwnPropertyDescriptors(e);delete s[ct];let n=Reflect.ownKeys(s);for(let a=0;a<n.length;a++){const i=n[a],l=s[i];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[i]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[i]})}return Object.create(fr(e),s)}else{const s=fr(e);if(s!==null&&r)return{...e};const n=Object.create(s);return Object.assign(n,e)}}function ea(e,t=!1){return Is(e)||mr(e)||!Qt(e)||(Ps(e)>1&&Object.defineProperties(e,{set:{value:os},add:{value:os},clear:{value:os},delete:{value:os}}),Object.freeze(e),t&&Object.values(e).forEach(r=>ea(r,!0))),e}function os(){st(2)}function Is(e){return Object.isFrozen(e)}var hf={};function er(e){const t=hf[e];return t||st(0,e),t}var Or;function Xi(){return Or}function pf(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function oo(e,t){t&&(er("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function On(e){Rn(e),e.drafts_.forEach(bf),e.drafts_=null}function Rn(e){e===Or&&(Or=e.parent_)}function io(e){return Or=pf(Or,e)}function bf(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function lo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ct].modified_&&(On(t),st(4)),Qt(e)&&(e=Ss(t,e),t.parent_||Es(t,e)),t.patches_&&er("Patches").generateReplacementPatches_(r[ct].base_,e,t.patches_,t.inversePatches_)):e=Ss(t,r,[]),On(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zi?e:void 0}function Ss(e,t,r){if(Is(t))return t;const s=t[ct];if(!s)return Ns(t,(n,a)=>co(e,s,t,n,a,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return Es(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const n=s.copy_;let a=n,i=!1;s.type_===3&&(a=new Set(n),n.clear(),i=!0),Ns(a,(l,c)=>co(e,s,n,l,c,r,i)),Es(e,n,!1),r&&e.patches_&&er("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function co(e,t,r,s,n,a,i){if(process.env.NODE_ENV!=="production"&&n===r&&st(5),mr(n)){const l=a&&t&&t.type_!==3&&!_n(t.assigned_,s)?a.concat(s):void 0,c=Ss(e,n,l);if(Hi(r,s,c),mr(c))e.canAutoFreeze_=!1;else return}else i&&r.add(n);if(Qt(n)&&!Is(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ss(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&(Br(r)?r.has(s):Object.prototype.propertyIsEnumerable.call(r,s))&&Es(e,n)}}function Es(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ea(t,r)}function gf(e,t){const r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:Xi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=s,a=ta;r&&(n=[s],a=Rr);const{revoke:i,proxy:l}=Proxy.revocable(n,a);return s.draft_=l,s.revoke_=i,l}var ta={get(e,t){if(t===ct)return e;const r=Gt(e);if(!_n(r,t))return xf(e,r,t);const s=r[t];return e.finalized_||!Qt(s)?s:s===en(e.base_,t)?(tn(e),e.copy_[t]=Mn(s,e)):s},has(e,t){return t in Gt(e)},ownKeys(e){return Reflect.ownKeys(Gt(e))},set(e,t,r){const s=Qi(Gt(e),t);if(s!=null&&s.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){const n=en(Gt(e),t),a=n==null?void 0:n[ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(mf(r,n)&&(r!==void 0||_n(e.base_,t)))return!0;tn(e),Dn(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return en(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,tn(e),Dn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Gt(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){st(11)},getPrototypeOf(e){return fr(e.base_)},setPrototypeOf(){st(12)}},Rr={};Ns(ta,(e,t)=>{Rr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Rr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&st(13),Rr.set.call(this,e,t,void 0)};Rr.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&st(14),ta.set.call(this,e[0],t,r,e[0])};function en(e,t){const r=e[ct];return(r?Gt(r):e)[t]}function xf(e,t,r){var n;const s=Qi(t,r);return s?"value"in s?s.value:(n=s.get)==null?void 0:n.call(e.draft_):void 0}function Qi(e,t){if(!(t in e))return;let r=fr(e);for(;r;){const s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=fr(r)}}function Dn(e){e.modified_||(e.modified_=!0,e.parent_&&Dn(e.parent_))}function tn(e){e.copy_||(e.copy_=Fn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var vf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const i=this;return function(c=a,...d){return i.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&st(6),s!==void 0&&typeof s!="function"&&st(7);let n;if(Qt(t)){const a=io(this),i=Mn(t,void 0);let l=!0;try{n=r(i),l=!1}finally{l?On(a):Rn(a)}return oo(a,s),lo(n,a)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Zi&&(n=void 0),this.autoFreeze_&&ea(n,!0),s){const a=[],i=[];er("Patches").generateReplacementPatches_(t,n,a,i),s(a,i)}return n}else st(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(i,...l)=>this.produceWithPatches(i,c=>t(c,...l));let s,n;return[this.produce(t,r,(i,l)=>{s=i,n=l}),s,n]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Qt(e)||st(8),mr(e)&&(e=yf(e));const t=io(this),r=Mn(e,void 0);return r[ct].isManual_=!0,Rn(t),r}finishDraft(e,t){const r=e&&e[ct];(!r||!r.isManual_)&&st(9);const{scope_:s}=r;return oo(s,t),lo(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));const s=er("Patches").applyPatches_;return mr(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Mn(e,t){const r=Br(e)?er("MapSet").proxyMap_(e,t):zs(e)?er("MapSet").proxySet_(e,t):gf(e,t);return(t?t.scope_:Xi()).drafts_.push(r),r}function yf(e){return mr(e)||st(10,e),el(e)}function el(e){if(!Qt(e)||Is(e))return e;const t=e[ct];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fn(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Fn(e,!0);return Ns(r,(s,n)=>{Hi(r,s,el(n))}),t&&(t.finalized_=!1),r}var wf=new vf,jf=wf.produce;const rn=e=>Number(e.toFixed(2)),dr=e=>Math.max(0,Math.min(100,e??0)),kf={text:{name:"text",label:"Texto"},number:{name:"number",label:"Número"},email:{name:"email",label:"Email"},select:{name:"select",label:"Select"},checkbox:{name:"checkbox",label:"Checkbox"},date:{name:"date",label:"Fecha"},textarea:{name:"textarea",label:"Textarea"},file:{name:"file",label:"Archivo"}},_e=e=>e.layout.find(t=>t.type==="rows"),mt=(e,t)=>{if(t==null)return _e(e);const r=e.layout[t];return r&&r.type==="rows"?r:_e(e)},sn=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),nn={1:["w-full"],2:["w-1/2","w-1/2"],3:["w-1/3","w-1/3","w-1/3"],4:["w-1/4","w-1/4","w-1/4","w-1/4"],"1/3-2/3":["w-1/3","w-2/3"],"2/3-1/3":["w-2/3","w-1/3"],"1/4-3/4":["w-1/4","w-3/4"],"3/4-1/4":["w-3/4","w-1/4"]},$e=(e,t)=>{for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n}}return null},Nf=e=>{const t=[];return e.layout.forEach(r=>{r.type==="rows"&&r.sections.forEach(s=>s.rows.forEach(n=>n.columns.forEach(a=>(a.fields??[]).forEach(i=>t.push(i))))),r.type==="tabs"&&r.tabs.forEach(s=>s.sections.forEach(n=>n.rows.forEach(a=>a.columns.forEach(i=>(i.fields??[]).forEach(l=>t.push(l))))))}),t},Sf=e=>({type:"rows",sections:[{sectionTitle:e??"Sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}),Ef=()=>({type:"tabs",tabs:[{key:`tab_${Date.now().toString(36)}_1`,label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:`tab_${Date.now().toString(36)}_2`,label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]}),ir=(e,t)=>Nf(e).includes(t),$n=e=>e.replace(/(?:_copy)+$/i,"").replace(/_(\d+)$/i,""),tl=e=>e.replace(/\s\((\d+)\)$/i,""),Xe=(e,t)=>{const r=e||"campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r}_${s}`);)s++;return`${r}_${s}`},ot=(e,t)=>{const r=e||"Campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r} (${s})`);)s++;return`${r} (${s})`},Qe=e=>{const t=(e.type??"text").toString(),r=kf[t]??{name:"campo",label:"Campo"},s=e.name?$n(e.name):r.name,n=e.label?tl(e.label):r.label;return{baseName:s,baseLabel:n}},Cf={layout:[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],fields:[],onSubmit:async()=>{},successMessage:"Guardado",errorMessage:"Error"},J=df((e,t)=>({schema:Cf,selection:{kind:"none"},past:[],future:[],setSchema:r=>{const s=t().schema,n=jf(s,r),a=n;e(i=>({...i,schema:a,past:[...i.past,s],future:[]}))},setSelection:r=>e({selection:r}),undo:()=>e(r=>r.past.length?{schema:r.past[r.past.length-1],past:r.past.slice(0,-1),future:[r.schema,...r.future]}:r),redo:()=>e(r=>r.future.length?{schema:r.future[0],past:[...r.past,r.schema],future:r.future.slice(1)}:r),resetHistory:()=>e(r=>({past:[],future:[]})),addField:r=>t().setSchema(s=>{const{baseName:n,baseLabel:a}=Qe(r),i=new Set(s.fields.map(u=>u.name).filter(Boolean)),l=new Set(s.fields.map(u=>u.label??"").filter(Boolean)),c=Xe(n,i),d=ot(a,l);r.name=c,r.label||(r.label=d),s.fields.push(r)}),addFieldAt:(r,s)=>t().setSchema(n=>{const{baseName:a,baseLabel:i}=Qe(r),l=new Set(n.fields.map(p=>p.name).filter(Boolean)),c=new Set(n.fields.map(p=>p.label??"").filter(Boolean)),d=Xe(a,l),u=ot(i,c);r.name=d,r.label||(r.label=u);const f=Math.max(0,Math.min(s??n.fields.length,n.fields.length));n.fields.splice(f,0,r)}),removeField:r=>t().setSchema(s=>{s.fields=s.fields.filter(n=>n.name!==r),s.layout.forEach(n=>{n.type==="rows"&&n.sections.forEach(a=>a.rows.forEach(i=>i.columns.forEach(l=>{l.fields=(l.fields??[]).filter(c=>c!==r)}))),n.type==="tabs"&&n.tabs.forEach(a=>a.sections.forEach(i=>i.rows.forEach(l=>l.columns.forEach(c=>{c.fields=(c.fields??[]).filter(d=>d!==r)}))))})}),updateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(i=>i.name===r);a>=0&&s(n.fields[a])}),duplicateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(g=>g.name===r);if(a<0)return;const i=n.fields[a],l=$n((s==null?void 0:s.trim())||i.name||""),c=tl(i.label??""),d=new Set(n.fields.map(g=>g.name).filter(Boolean)),u=new Set(n.fields.map(g=>g.label??"").filter(Boolean)),f=Xe(l||Qe(i).baseName,d),p=ot(c||Qe(i).baseLabel,u),h=JSON.parse(JSON.stringify(i));h.name=f,h.label=p,n.fields.splice(a+1,0,h)}),renameField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=$n((s??r).trim()||"campo"),l=new Set(n.fields.map(d=>d.name).filter(Boolean));l.delete(r);const c=Xe(i,l);n.fields[a].name=c,n.layout.forEach(d=>{d.type==="rows"&&d.sections.forEach(u=>u.rows.forEach(f=>f.columns.forEach(p=>{p.fields&&(p.fields=p.fields.map(h=>h===r?c:h))}))),d.type==="tabs"&&d.tabs.forEach(u=>u.sections.forEach(f=>f.rows.forEach(p=>p.columns.forEach(h=>{h.fields&&(h.fields=h.fields.map(g=>g===r?c:g))}))))})}),addSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a={sectionTitle:r??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]};n.sections.push(a)}),renameSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];i&&(i.sectionTitle=(s??"").trim()||"Sección")}),moveSection:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="rows")return a;const c=[...l.sections],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,sections:c},{schema:{...a.schema,layout:i}}}),removeSection:r=>t().setSchema(s=>{const n=_e(s);if(!n||r<0||r>=n.sections.length)return;const a=[...n.sections];a.splice(r,1),n.sections=a}),duplicateSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a=n.sections[r];if(!a)return;const i=JSON.parse(JSON.stringify(a)),l=(a.sectionTitle||"Sección").toString(),c=n.sections.map(f=>f.sectionTitle||""),d=new Set(c);let u=l;if(d.has(u)){let f=2;for(;d.has(`${l} (${f})`);)f++;u=`${l} (${f})`}i.sectionTitle=u,n.sections.splice(r+1,0,i)}),addRowsBlockAt:(r,s)=>t().setSchema(n=>{const a=Math.max(0,Math.min(r,n.layout.length));n.layout.splice(a,0,Sf(s))}),addTabsContainerAt:r=>t().setSchema(s=>{const n=Math.max(0,Math.min(r,s.layout.length));s.layout.splice(n,0,Ef())}),moveLayoutNode:(r,s)=>t().setSchema(n=>{const a=n.layout.length;if(r<0||r>=a)return;const i=Math.max(0,Math.min(s,a-1));if(r===i)return;const l=[...n.layout],[c]=l.splice(r,1);l.splice(i,0,c),n.layout=l}),removeLayoutNode:r=>t().setSchema(s=>{if(r<0||r>=s.layout.length)return;const n=[...s.layout];n.splice(r,1),s.layout=n}),addTabsContainer:()=>t().setSchema(r=>{const s={type:"tabs",tabs:[{key:"tab1",label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:"tab2",label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]};r.layout.push(s)}),addTabAfter:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx],i="Nueva pestaña",l=new Set(a.tabs.map(f=>f.label));let c=i,d=2;for(;l.has(c);)c=`${i} (${d++})`;const u={key:`tab_${Date.now().toString(36)}`,label:c,sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]};a.tabs.splice(n.tabIdx+1,0,u)}),removeTab:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx];a.tabs.length<=1||a.tabs.splice(n.tabIdx,1)}),renameTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;const i=n.layout[a.nodeIdx];i.tabs[a.tabIdx].label=(s??"").trim()||"Pestaña"}),moveTab:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="tabs")return a;const c=[...l.tabs],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,tabs:c},{schema:{...a.schema,layout:i}}}),moveTabSection:(r,s,n,a)=>e(i=>{const l=[...i.schema.layout],c=l[r];if(!c||c.type!=="tabs")return i;const d=c.tabs.find(g=>g.key===s);if(!d)return i;const u=[...d.sections],[f]=u.splice(n,1),p=Math.max(0,Math.min(a,u.length));u.splice(p,0,f);const h=c.tabs.map(g=>g.key===s?{...g,sections:u}:g);return l[r]={...c,tabs:h},{schema:{...i.schema,layout:l}}}),addSectionToTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;n.layout[a.nodeIdx].tabs[a.tabIdx].sections.push({sectionTitle:s??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]})}),addRowToTabSection:(r,s)=>t().setSchema(n=>{var l;const a=$e(n,r);if(!a)return;(l=n.layout[a.nodeIdx].tabs[a.tabIdx].sections[s])==null||l.rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),renameTabSection:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];c&&(c.sectionTitle=(n??"").trim()||"Sección")}),setTabRowColumns:(r,s,n,a)=>t().setSchema(i=>{var h,g;const l=$e(i,r);if(!l)return;const d=(g=(h=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:h.rows)==null?void 0:g[n];if(!d)return;const u=(d.columns??[]).flatMap(x=>x.fields??[]),f=sn(a),p=Array.from({length:a},(x,v)=>({width:f[v],fields:[]}));u.forEach((x,v)=>p[v%a].fields.push(x)),d.columns=p}),addColumnToTabRow:(r,s,n)=>t().setSchema(a=>{var d,u;const i=$e(a,r);if(!i)return;const c=(u=(d=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s])==null?void 0:d.rows)==null?void 0:u[n];c&&c.columns.push({width:"w-1/2",fields:[]})}),removeTabColumn:(r,s,n,a)=>t().setSchema(i=>{var g,x;const l=$e(i,r);if(!l)return;const d=(x=(g=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:g.rows)==null?void 0:x[n];if(!d)return;const u=d.columns??[];if(!u[a])return;const f=u[a],p=a>0?a-1:u[a+1]?a+1:-1,h=[...u];h.splice(a,1),p>=0&&h[p]&&(h[p].fields=[...h[p].fields??[],...f.fields??[]]),d.columns=h}),placeFieldInTabColumn:(r,s,n,a,i)=>t().setSchema(l=>{const c=$e(l,s);if(!c)return;const u=l.layout[c.nodeIdx].tabs[c.tabIdx].sections[n].rows[a].columns[i];let f=r;if(ir(l,r)){const p=l.fields.findIndex(h=>h.name===r);if(p>=0){const h=l.fields[p],{baseName:g,baseLabel:x}=Qe(h),v=new Set(l.fields.map(T=>T.name).filter(Boolean)),m=new Set(l.fields.map(T=>T.label??"").filter(Boolean));f=Xe(g,v);const w=ot(x,m),y=JSON.parse(JSON.stringify(h));y.name=f,y.label=w,l.fields.splice(p+1,0,y)}}u.fields=[...u.fields??[],f]}),moveFieldInTab:(r,s)=>t().setSchema(n=>{var h,g,x,v;const a=$e(n,r.tabKey);if(!a)return;const i=n.layout[a.nodeIdx],l=(g=(h=i.tabs[a.tabIdx].sections[r.s])==null?void 0:h.rows[r.r])==null?void 0:g.columns[r.c],c=(v=(x=i.tabs[a.tabIdx].sections[s.s])==null?void 0:x.rows[s.r])==null?void 0:v.columns[s.c];if(!l||!c)return;const d=[...l.fields??[]];if(r.idx<0||r.idx>=d.length)return;const[u]=d.splice(r.idx,1);l.fields=d;const f=[...c.fields??[]],p=s.idx===void 0?f.length:Math.max(0,Math.min(s.idx,f.length));f.splice(p,0,u),c.fields=f}),removeFieldFromTabLayout:r=>t().setSchema(s=>{var c,d;const n=$e(s,r.tabKey);if(!n)return;const i=(d=(c=s.layout[n.nodeIdx].tabs[n.tabIdx].sections[r.s])==null?void 0:c.rows[r.r])==null?void 0:d.columns[r.c];if(!i||!i.fields||r.idx<0||r.idx>=i.fields.length)return;const l=[...i.fields];l.splice(r.idx,1),i.fields=l}),moveRowInSection:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r];if(!l)return;const c=[...l.rows];if(s<0||s>=c.length)return;const d=Math.max(0,Math.min(n,c.length-1));if(s===d)return;const[u]=c.splice(s,1);c.splice(d,0,u),l.rows=c}),duplicateRowInSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=i.rows[s];if(!l)return;const c=JSON.parse(JSON.stringify(l));i.rows.splice(s+1,0,c)}),removeRowFromSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=[...i.rows];s<0||s>=l.length||(l.splice(s,1),l.length===0&&l.push({title:"",columns:[{width:"w-full",fields:[]}]}),i.rows=l)}),setRowColumnsPreset:(r,s,n)=>t().setSchema(a=>{var d,u;const i=_e(a);if(!i)return;const l=(u=(d=i.sections[r])==null?void 0:d.rows)==null?void 0:u[s];if(!l)return;const c=nn[n];c&&an(l,c)}),setRowResponsive:(r,s,n)=>t().setSchema(a=>{var h,g;const i=_e(a);if(!i)return;const l=(g=(h=i.sections[Number(r)])==null?void 0:h.rows)==null?void 0:g[Number(s)];if(!l)return;const c=Math.max(n.desktop.count??1,n.tablet.count??1,n.mobile.count??1),d=(l.columns??[]).flatMap(x=>x.fields??[]),u=ln(d,c),f=(x,v,m)=>v<(m??0)?dr((x==null?void 0:x[v])??0):null,p=Array.from({length:c},(x,v)=>{const m=f(n.mobile.widths,v,n.mobile.count),w=f(n.tablet.widths,v,n.tablet.count),y=f(n.desktop.widths,v,n.desktop.count);return{width:on(m,w,y),fields:u[v]??[]}});l.columns=p}),setRowColumnsAt:(r,s,n,a)=>t().setSchema(i=>{var p,h;const l=mt(i,r);if(!l)return;const c=(h=(p=l.sections[s])==null?void 0:p.rows)==null?void 0:h[n];if(!c)return;const d=(c.columns??[]).flatMap(g=>g.fields??[]),u=sn(a),f=Array.from({length:a},(g,x)=>({width:u[x],fields:[]}));d.forEach((g,x)=>f[x%a].fields.push(g)),c.columns=f}),addColumnToRowAt:(r,s,n)=>t().setSchema(a=>{var l,c,d,u;const i=mt(a,r);i&&((u=(d=(c=(l=i.sections[s])==null?void 0:l.rows)==null?void 0:c[n])==null?void 0:d.columns)==null||u.push({width:"w-1/2",fields:[]}))}),removeColumnAt:(r,s,n,a)=>t().setSchema(i=>{var h,g;const l=mt(i,r);if(!l)return;const c=(g=(h=l.sections[s])==null?void 0:h.rows)==null?void 0:g[n];if(!c)return;const d=c.columns??[];if(!d[a])return;const u=d[a],f=a>0?a-1:d[a+1]?a+1:-1,p=[...d];p.splice(a,1),f>=0&&p[f]&&(p[f].fields=[...p[f].fields??[],...u.fields??[]]),c.columns=p}),setRowColumnsPresetAt:(r,s,n,a)=>t().setSchema(i=>{var u,f;const l=mt(i,r);if(!l)return;const c=(f=(u=l.sections[s])==null?void 0:u.rows)==null?void 0:f[n];if(!c)return;const d=nn[a];d&&an(c,d)}),setRowResponsiveAt:(r,s,n,a)=>t().setSchema(i=>{var g,x;const l=mt(i,r);if(!l)return;const c=(x=(g=l.sections[Number(s)])==null?void 0:g.rows)==null?void 0:x[Number(n)];if(!c)return;const d=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),u=(v,m,w)=>m<(w??0)?dr((v==null?void 0:v[m])??0):null,f=Af(c,d),p=f.flatMap(v=>v.fields??[]),h=ln(p,d);for(let v=0;v<d;v++){const m=u(a.mobile.widths,v,a.mobile.count),w=u(a.tablet.widths,v,a.tablet.count),y=u(a.desktop.widths,v,a.desktop.count);f[v].width=on(m,w,y),f[v].fields=h[v]??[]}}),placeFieldInColumnAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var g,x,v,m;const d=mt(c,r);if(!d)return;const u=(m=(v=(x=(g=d.sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(V=>V.name).filter(Boolean)),A=new Set(c.fields.map(V=>V.label??"").filter(Boolean));f=Xe(T,_);const S=ot(N,A),$=JSON.parse(JSON.stringify(y));$.name=f,$.label=S,c.fields.splice(w+1,0,$)}}const p=[...u.fields??[]],h=l===void 0?p.length:Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),moveFieldAt:(r,s,n,a)=>t().setSchema(i=>{var x,v,m,w,y,T,N,_;const l=mt(i,r),c=mt(i,n);if(!l||!c)return;const d=(w=(m=(v=(x=l.sections[s.s])==null?void 0:x.rows)==null?void 0:v[s.r])==null?void 0:m.columns)==null?void 0:w[s.c],u=(_=(N=(T=(y=c.sections[a.s])==null?void 0:y.rows)==null?void 0:T[a.r])==null?void 0:N.columns)==null?void 0:_[a.c];if(!d||!u)return;const f=[...d.fields??[]];if(s.idx<0||s.idx>=f.length)return;const[p]=f.splice(s.idx,1);d.fields=f;const h=[...u.fields??[]],g=a.idx===void 0?h.length:Math.max(0,Math.min(a.idx,h.length));h.splice(g,0,p),u.fields=h}),removeFieldFromLayoutAt:(r,s)=>t().setSchema(n=>{var c,d,u,f;const a=mt(n,r);if(!a)return;const i=(f=(u=(d=(c=a.sections[s.s])==null?void 0:c.rows)==null?void 0:d[s.r])==null?void 0:u.columns)==null?void 0:f[s.c];if(!i||!i.fields||s.idx<0||s.idx>=i.fields.length)return;const l=[...i.fields];l.splice(s.idx,1),i.fields=l}),insertExistingFieldAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var g,x,v,m;const d=mt(c,r);if(!d)return;const u=(m=(v=(x=(g=d.sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const p=[...u.fields??[]],h=Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const{baseName:d,baseLabel:u}=Qe(s),f=new Set(c.fields.map(S=>S.name).filter(Boolean)),p=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),h=Xe(d,f),g=ot(u,p),x=JSON.parse(JSON.stringify(s));x.name=h,x.label||(x.label=g),c.fields.push(x);const v=mt(c,r);if(!v)return;const m=(A=(_=(N=(T=v.sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,h),m.fields=w}),setTabRowResponsive:(r,s,n,a)=>t().setSchema(i=>{var x,v;const l=$e(i,r);if(!l)return;const d=(v=(x=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[Number(s)])==null?void 0:x.rows)==null?void 0:v[Number(n)];if(!d)return;const u=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),f=(d.columns??[]).flatMap(m=>m.fields??[]),p=ln(f,u),h=(m,w,y)=>w<(y??0)?dr((m==null?void 0:m[w])??0):null,g=Array.from({length:u},(m,w)=>{const y=h(a.mobile.widths,w,a.mobile.count),T=h(a.tablet.widths,w,a.tablet.count),N=h(a.desktop.widths,w,a.desktop.count);return{width:on(y,T,N),fields:p[w]??[]}});d.columns=g}),moveTabRow:(r,s,n,a)=>t().setSchema(i=>{const l=$e(i,r);if(!l)return;const d=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s];if(!d)return;const u=[...d.rows];if(n<0||n>=u.length)return;const f=Math.max(0,Math.min(a,u.length-1));if(n===f)return;const[p]=u.splice(n,1);u.splice(f,0,p),d.rows=u}),duplicateTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=c.rows[n];if(!d)return;const u=JSON.parse(JSON.stringify(d));c.rows.splice(n+1,0,u)}),removeTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=[...c.rows];n<0||n>=d.length||(d.splice(n,1),d.length===0&&d.push({title:"",columns:[{width:"w-full",fields:[]}]}),c.rows=d)}),setTabRowColumnsPreset:(r,s,n,a)=>t().setSchema(i=>{var f,p;const l=$e(i,r);if(!l)return;const d=(p=(f=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:f.rows)==null?void 0:p[n];if(!d)return;const u=nn[a];u&&an(d,u)}),addRowToSection:r=>t().setSchema(s=>{const n=_e(s);n&&n.sections[r].rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),addColumnToRow:(r,s)=>t().setSchema(n=>{const a=_e(n);a&&a.sections[r].rows[s].columns.push({width:"w-1/2",fields:[]})}),setRowColumns:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=(l.columns??[]).flatMap(f=>f.fields??[]),d=sn(n),u=Array.from({length:n},(f,p)=>({width:d[p],fields:[]}));c.forEach((f,p)=>u[p%n].fields.push(f)),l.columns=u}),removeColumn:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=l.columns??[];if(!c[n])return;const d=c[n],u=n>0?n-1:c[n+1]?n+1:-1,f=[...c];f.splice(n,1),u>=0&&f[u]&&(f[u].fields=[...f[u].fields??[],...d.fields??[]]),l.columns=f}),placeFieldInColumn:(r,s,n,a)=>t().setSchema(i=>{const l=_e(i);if(!l)return;const c=l.sections[s].rows[n].columns[a];let d=r;if(ir(i,r)){const u=i.fields.findIndex(f=>f.name===r);if(u>=0){const f=i.fields[u],{baseName:p,baseLabel:h}=Qe(f),g=new Set(i.fields.map(y=>y.name).filter(Boolean)),x=new Set(i.fields.map(y=>y.label??"").filter(Boolean)),v=Xe(p,g),m=ot(h,x),w=JSON.parse(JSON.stringify(f));w.name=v,w.label=m,i.fields.splice(u+1,0,w),d=v}}c.fields=[...c.fields??[],d]}),moveField:(r,s)=>t().setSchema(n=>{var p,h,g,x;const a=_e(n);if(!a)return;const i=(h=(p=a.sections[r.s])==null?void 0:p.rows[r.r])==null?void 0:h.columns[r.c],l=(x=(g=a.sections[s.s])==null?void 0:g.rows[s.r])==null?void 0:x.columns[s.c];if(!i||!l)return;const c=[...i.fields??[]];if(r.idx<0||r.idx>=c.length)return;const[d]=c.splice(r.idx,1);i.fields=c;const u=[...l.fields??[]],f=s.idx===void 0?u.length:Math.max(0,Math.min(s.idx,u.length));u.splice(f,0,d),l.fields=u}),removeFieldFromLayout:r=>t().setSchema(s=>{var l,c;const n=_e(s);if(!n)return;const a=(c=(l=n.sections[r.s])==null?void 0:l.rows[r.r])==null?void 0:c.columns[r.c];if(!a||!a.fields||r.idx<0||r.idx>=a.fields.length)return;const i=[...a.fields];i.splice(r.idx,1),a.fields=i}),addFieldAndPlace:(r,s,n,a)=>t().setSchema(i=>{const{baseName:l,baseLabel:c}=Qe(r),d=new Set(i.fields.map(v=>v.name).filter(Boolean)),u=new Set(i.fields.map(v=>v.label??"").filter(Boolean)),f=Xe(l,d),p=ot(c,u),h=JSON.parse(JSON.stringify(r));h.name=f,h.label||(h.label=p),i.fields.push(h);const g=_e(i);if(!g)return;const x=g.sections[s].rows[n].columns[a];x.fields=[...x.fields??[],f]}),moveFieldWithinColumn:(r,s,n,a,i)=>t().setSchema(l=>{var h,g,x,v;const c=_e(l);if(!c)return;const d=(v=(x=(g=(h=c.sections[r])==null?void 0:h.rows)==null?void 0:g[s])==null?void 0:x.columns)==null?void 0:v[n];if(!d)return;const u=[...d.fields??[]];if(a<0||a>=u.length)return;const[f]=u.splice(a,1),p=Math.max(0,Math.min(i,u.length));u.splice(p,0,f),d.fields=u}),insertExistingFieldAt:(r,s,n,a,i)=>t().setSchema(l=>{var h,g,x,v;const c=_e(l);if(!c)return;const d=(v=(x=(g=(h=c.sections[s])==null?void 0:h.rows)==null?void 0:g[n])==null?void 0:x.columns)==null?void 0:v[a];if(!d)return;let u=r;if(ir(l,r)){const m=l.fields.findIndex(w=>w.name===r);if(m>=0){const w=l.fields[m],{baseName:y,baseLabel:T}=Qe(w),N=new Set(l.fields.map(V=>V.name).filter(Boolean)),_=new Set(l.fields.map(V=>V.label??"").filter(Boolean)),A=Xe(y,N),S=ot(T,_),$=JSON.parse(JSON.stringify(w));$.name=A,$.label=S,l.fields.splice(m+1,0,$),u=A}}const f=[...d.fields??[]],p=Math.max(0,Math.min(i,f.length));f.splice(p,0,u),d.fields=f}),addFieldAndPlaceAt:(r,s,n,a,i)=>t().setSchema(l=>{var y,T,N,_;const{baseName:c,baseLabel:d}=Qe(r),u=new Set(l.fields.map(A=>A.name).filter(Boolean)),f=new Set(l.fields.map(A=>A.label??"").filter(Boolean)),p=Xe(c,u),h=ot(d,f),g=JSON.parse(JSON.stringify(r));g.name=p,g.label||(g.label=h),l.fields.push(g);const x=_e(l);if(!x)return;const v=(_=(N=(T=(y=x.sections[s])==null?void 0:y.rows)==null?void 0:T[n])==null?void 0:N.columns)==null?void 0:_[a];if(!v)return;const m=[...v.fields??[]],w=Math.max(0,Math.min(i,m.length));m.splice(w,0,p),v.fields=m}),moveFieldWithinTab:(r,s,n,a,i,l)=>t().setSchema(c=>{var g,x,v,m;const d=$e(c,r);if(!d)return;const u=(m=(v=(x=(g=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[s])==null?void 0:g.rows)==null?void 0:x[n])==null?void 0:v.columns)==null?void 0:m[a];if(!u)return;const f=[...u.fields??[]];if(i<0||i>=f.length)return;const[p]=f.splice(i,1),h=Math.max(0,Math.min(l,f.length));f.splice(h,0,p),u.fields=f}),insertExistingFieldInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var g,x,v,m;const d=$e(c,s);if(!d)return;const u=(m=(v=(x=(g=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:g.rows)==null?void 0:x[a])==null?void 0:v.columns)==null?void 0:m[i];if(!u)return;let f=r;if(ir(c,r)){const w=c.fields.findIndex(y=>y.name===r);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const p=[...u.fields??[]],h=Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const d=$e(c,s);if(!d)return;const{baseName:u,baseLabel:f}=Qe(r),p=new Set(c.fields.map(S=>S.name).filter(Boolean)),h=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),g=Xe(u,p),x=ot(f,h),v=JSON.parse(JSON.stringify(r));v.name=g,v.label||(v.label=x),c.fields.push(v);const m=(A=(_=(N=(T=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,g),m.fields=w}),changeFieldType:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=n.fields[a],c={...{name:i.name,label:i.label,width:i.width,size:i.size,info:i.info,disabled:i.disabled,visibleWhen:i.visibleWhen,disabledWhen:i.disabledWhen,clearWhen:i.clearWhen,validation:i.validation,placeholder:i.placeholder},type:s};switch(s){case"text":case"email":case"password":case"number":break;case"textarea":c.maxLength=i.maxLength??void 0,c.showCounter=i.showCounter??!1;break;case"select":c.options=Array.isArray(i.options)?i.options:[],c.multiple=!!i.multiple,c.loadOptions=i.loadOptions??void 0;break;case"checkbox":c.defaultValue=!!i.defaultValue,delete c.placeholder;break;case"date":c.showTime=!!i.showTime;break;case"file":c.maxFiles=i.maxFiles??1,c.accept=i.accept??"",delete c.placeholder;break}s!=="select"&&(delete c.options,delete c.multiple,delete c.loadOptions),s!=="textarea"&&(delete c.maxLength,delete c.showCounter),s!=="checkbox"&&delete c.defaultValue,s!=="date"&&delete c.showTime,s!=="file"&&(delete c.maxFiles,delete c.accept),n.fields[a]=c})}));function an(e,t){const r=(e.columns??[]).flatMap(a=>a.fields??[]),s=t.length,n=t.map(a=>({width:a,fields:[]}));r.forEach((a,i)=>n[i%s].fields.push(a)),e.columns=n}function on(e,t,r){const s=[];return e===null?s.push("hidden"):s.push(`w-[${rn(dr(e))}%]`,"block"),t===null?s.push("md:hidden"):s.push(`md:w-[${rn(dr(t))}%]`,"md:block"),r===null?s.push("lg:hidden"):s.push(`lg:w-[${rn(dr(r))}%]`,"lg:block"),s.join(" ")}function Af(e,t){const r=e.columns??[];if(r.length===t)return r;if(r.length<t){const n=t-r.length,a=[...r];for(let i=0;i<n;i++)a.push({width:"w-[100%]",fields:[]});return e.columns=a,a}const s=r.slice(0,t);for(let n=t;n<r.length;n++)s[t-1].fields=[...s[t-1].fields??[],...r[n].fields??[]];return e.columns=s,s}function ln(e,t){const r=Array.from({length:t},()=>[]);return e.forEach((s,n)=>r[n%t].push(s)),r}const Vs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function br(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ra(e){return"nodeType"in e}function Ye(e){var t,r;return e?br(e)?e:ra(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function sa(e){const{Document:t}=Ye(e);return e instanceof t}function Ur(e){return br(e)?!1:e instanceof Ye(e).HTMLElement}function rl(e){return e instanceof Ye(e).SVGElement}function gr(e){return e?br(e)?e.document:ra(e)?sa(e)?e:Ur(e)||rl(e)?e.ownerDocument:document:document:document}const _t=Vs?b.useLayoutEffect:b.useEffect;function Bs(e){const t=b.useRef(e);return _t(()=>{t.current=e}),b.useCallback(function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];return t.current==null?void 0:t.current(...s)},[])}function Tf(){const e=b.useRef(null),t=b.useCallback((s,n)=>{e.current=setInterval(s,n)},[]),r=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Dr(e,t){t===void 0&&(t=[e]);const r=b.useRef(e);return _t(()=>{r.current!==e&&(r.current=e)},t),r}function qr(e,t){const r=b.useRef();return b.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...t])}function Cs(e){const t=Bs(e),r=b.useRef(null),s=b.useCallback(n=>{n!==r.current&&(t==null||t(n,r.current)),r.current=n},[]);return[r,s]}function As(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let cn={};function Us(e,t){return b.useMemo(()=>{if(t)return t;const r=cn[e]==null?0:cn[e]+1;return cn[e]=r,e+"-"+r},[e,t])}function sl(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];return s.reduce((a,i)=>{const l=Object.entries(i);for(const[c,d]of l){const u=a[c];u!=null&&(a[c]=u+e*d)}return a},{...t})}}const ur=sl(1),Ts=sl(-1);function _f(e){return"clientX"in e&&"clientY"in e}function na(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Ff(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function _s(e){if(Ff(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return _f(e)?{x:e.clientX,y:e.clientY}:null}const Mr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Mr.Translate.toString(e),Mr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:s}=e;return t+" "+r+"ms "+s}}}),uo="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Of(e){return e.matches(uo)?e:e.querySelector(uo)}const Rf={display:"none"};function Df(e){let{id:t,value:r}=e;return b.createElement("div",{id:t,style:Rf},r)}function Mf(e){let{id:t,announcement:r,ariaLiveType:s="assertive"}=e;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return b.createElement("div",{id:t,style:n,role:"status","aria-live":s,"aria-atomic":!0},r)}function $f(){const[e,t]=b.useState("");return{announce:b.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const nl=b.createContext(null);function Lf(e){const t=b.useContext(nl);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Pf(){const[e]=b.useState(()=>new Set),t=b.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[b.useCallback(s=>{let{type:n,event:a}=s;e.forEach(i=>{var l;return(l=i[n])==null?void 0:l.call(i,a)})},[e]),t]}const zf={draggable:`
62
62
  To pick up a draggable item, press the space bar.
63
63
  While dragging, use the arrow keys to move the item.
64
64
  Press space again to drop the item in its new position, or press escape to cancel.
65
- `},$h={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was moved over droppable area "+s.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:s}=t;return s?"Draggable item "+e.id+" was dropped over droppable area "+s.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function Lh(t){let{announcements:e=$h,container:s,hiddenTextDescribedById:r,screenReaderInstructions:n=Dh}=t;const{announce:a,announcement:o}=Fh(),i=sn("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),Rh(b.useMemo(()=>({onDragStart(f){let{active:p}=f;a(e.onDragStart({active:p}))},onDragMove(f){let{active:p,over:h}=f;e.onDragMove&&a(e.onDragMove({active:p,over:h}))},onDragOver(f){let{active:p,over:h}=f;a(e.onDragOver({active:p,over:h}))},onDragEnd(f){let{active:p,over:h}=f;a(e.onDragEnd({active:p,over:h}))},onDragCancel(f){let{active:p,over:h}=f;a(e.onDragCancel({active:p,over:h}))}}),[a,e])),!c)return null;const u=b.createElement(b.Fragment,null,b.createElement(Ah,{id:r,value:n.draggable}),b.createElement(Th,{id:i,announcement:o}));return s?Yt.createPortal(u,s):u}var Ue;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ue||(Ue={}));function Ur(){}function Vo(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function Mh(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return b.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const yt=Object.freeze({x:0,y:0});function Ph(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Ih(t,e){const s=Br(t);if(!s)return"0 0";const r={x:(s.x-e.left)/e.width*100,y:(s.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function Vh(t,e){let{data:{value:s}}=t,{data:{value:r}}=e;return s-r}function zh(t,e){let{data:{value:s}}=t,{data:{value:r}}=e;return r-s}function Bh(t,e){if(!t||t.length===0)return null;const[s]=t;return s[e]}function zo(t,e,s){return e===void 0&&(e=t.left),s===void 0&&(s=t.top),{x:e+t.width*.5,y:s+t.height*.5}}const Uh=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:r}=t;const n=zo(e,e.left,e.top),a=[];for(const o of r){const{id:i}=o,c=s.get(i);if(c){const d=Ph(zo(c),n);a.push({id:i,data:{droppableContainer:o,value:d}})}}return a.sort(Vh)};function Kh(t,e){const s=Math.max(e.top,t.top),r=Math.max(e.left,t.left),n=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height),o=n-r,i=a-s;if(r<n&&s<a){const c=e.width*e.height,d=t.width*t.height,u=o*i,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const $l=t=>{let{collisionRect:e,droppableRects:s,droppableContainers:r}=t;const n=[];for(const a of r){const{id:o}=a,i=s.get(o);if(i){const c=Kh(i,e);c>0&&n.push({id:o,data:{droppableContainer:a,value:c}})}}return n.sort(zh)};function qh(t,e,s){return{...t,scaleX:e&&s?e.width/s.width:1,scaleY:e&&s?e.height/s.height:1}}function Ll(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:yt}function Wh(t){return function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce((o,i)=>({...o,top:o.top+t*i.y,bottom:o.bottom+t*i.y,left:o.left+t*i.x,right:o.right+t*i.x}),{...s})}}const Jh=Wh(1);function Ml(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Hh(t,e,s){const r=Ml(e);if(!r)return t;const{scaleX:n,scaleY:a,x:o,y:i}=r,c=t.left-o-(1-n)*parseFloat(s),d=t.top-i-(1-a)*parseFloat(s.slice(s.indexOf(" ")+1)),u=n?t.width/n:t.width,f=a?t.height/a:t.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Gh={ignoreTransform:!1};function Qs(t,e){e===void 0&&(e=Gh);let s=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=Xe(t).getComputedStyle(t);d&&(s=Hh(s,d,u))}const{top:r,left:n,width:a,height:o,bottom:i,right:c}=s;return{top:r,left:n,width:a,height:o,bottom:i,right:c}}function Bo(t){return Qs(t,{ignoreTransform:!0})}function Zh(t){const e=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:e,bottom:s,width:e,height:s}}function Yh(t,e){return e===void 0&&(e=Xe(t).getComputedStyle(t)),e.position==="fixed"}function Xh(t,e){e===void 0&&(e=Xe(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(n=>{const a=e[n];return typeof a=="string"?s.test(a):!1})}function ya(t,e){const s=[];function r(n){if(e!=null&&s.length>=e||!n)return s;if(xa(n)&&n.scrollingElement!=null&&!s.includes(n.scrollingElement))return s.push(n.scrollingElement),s;if(!Ys(n)||Rl(n)||s.includes(n))return s;const a=Xe(t).getComputedStyle(n);return n!==t&&Xh(n,a)&&s.push(n),Yh(n,a)?s:r(n.parentNode)}return t?r(t):s}function Pl(t){const[e]=ya(t,1);return e??null}function Sn(t){return!en||!t?null:ys(t)?t:ba(t)?xa(t)||t===ws(t).scrollingElement?window:Ys(t)?t:null:null}function Il(t){return ys(t)?t.scrollX:t.scrollLeft}function Vl(t){return ys(t)?t.scrollY:t.scrollTop}function Xn(t){return{x:Il(t),y:Vl(t)}}var Ke;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ke||(Ke={}));function zl(t){return!en||!t?!1:t===document.scrollingElement}function Bl(t){const e={x:0,y:0},s=zl(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},n=t.scrollTop<=e.y,a=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,i=t.scrollLeft>=r.x;return{isTop:n,isLeft:a,isBottom:o,isRight:i,maxScroll:r,minScroll:e}}const Qh={x:.2,y:.2};function ep(t,e,s,r,n){let{top:a,left:o,right:i,bottom:c}=s;r===void 0&&(r=10),n===void 0&&(n=Qh);const{isTop:d,isBottom:u,isLeft:f,isRight:p}=Bl(t),h={x:0,y:0},g={x:0,y:0},x={height:e.height*n.y,width:e.width*n.x};return!d&&a<=e.top+x.height?(h.y=Ke.Backward,g.y=r*Math.abs((e.top+x.height-a)/x.height)):!u&&c>=e.bottom-x.height&&(h.y=Ke.Forward,g.y=r*Math.abs((e.bottom-x.height-c)/x.height)),!p&&i>=e.right-x.width?(h.x=Ke.Forward,g.x=r*Math.abs((e.right-x.width-i)/x.width)):!f&&o<=e.left+x.width&&(h.x=Ke.Backward,g.x=r*Math.abs((e.left+x.width-o)/x.width)),{direction:h,speed:g}}function tp(t){if(t===document.scrollingElement){const{innerWidth:a,innerHeight:o}=window;return{top:0,left:0,right:a,bottom:o,width:a,height:o}}const{top:e,left:s,right:r,bottom:n}=t.getBoundingClientRect();return{top:e,left:s,right:r,bottom:n,width:t.clientWidth,height:t.clientHeight}}function Ul(t){return t.reduce((e,s)=>ms(e,Xn(s)),yt)}function sp(t){return t.reduce((e,s)=>e+Il(s),0)}function rp(t){return t.reduce((e,s)=>e+Vl(s),0)}function Kl(t,e){if(e===void 0&&(e=Qs),!t)return;const{top:s,left:r,bottom:n,right:a}=e(t);Pl(t)&&(n<=0||a<=0||s>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const np=[["x",["left","right"],sp],["y",["top","bottom"],rp]];class wa{constructor(e,s){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ya(s),n=Ul(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,o,i]of np)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=i(r),u=n[a]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ds{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...s)})},this.target=e}add(e,s,r){var n;(n=this.target)==null||n.addEventListener(e,s,r),this.listeners.push([e,s,r])}}function ap(t){const{EventTarget:e}=Xe(t);return t instanceof e?t:ws(t)}function Nn(t,e){const s=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(s**2+r**2)>e:"x"in e&&"y"in e?s>e.x&&r>e.y:"x"in e?s>e.x:"y"in e?r>e.y:!1}var ht;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ht||(ht={}));function Uo(t){t.preventDefault()}function op(t){t.stopPropagation()}var Ae;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ae||(Ae={}));const ql={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},ip=(t,e)=>{let{currentCoordinates:s}=e;switch(t.code){case Ae.Right:return{...s,x:s.x+25};case Ae.Left:return{...s,x:s.x-25};case Ae.Down:return{...s,y:s.y+25};case Ae.Up:return{...s,y:s.y-25}}};class ja{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:s}}=e;this.props=e,this.listeners=new Ds(ws(s)),this.windowListeners=new Ds(Xe(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ht.Resize,this.handleCancel),this.windowListeners.add(ht.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ht.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:s}=this.props,r=e.node.current;r&&Kl(r),s(yt)}handleKeyDown(e){if(va(e)){const{active:s,context:r,options:n}=this.props,{keyboardCodes:a=ql,coordinateGetter:o=ip,scrollBehavior:i="smooth"}=n,{code:c}=e;if(a.end.includes(c)){this.handleEnd(e);return}if(a.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=r.current,u=d?{x:d.left,y:d.top}:yt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(e,{active:s,context:r.current,currentCoordinates:u});if(f){const p=zr(f,u),h={x:0,y:0},{scrollableAncestors:g}=r.current;for(const x of g){const v=e.code,{isTop:m,isRight:y,isLeft:w,isBottom:O,maxScroll:S,minScroll:T}=Bl(x),C=tp(x),N={x:Math.min(v===Ae.Right?C.right-C.width/2:C.right,Math.max(v===Ae.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(v===Ae.Down?C.bottom-C.height/2:C.bottom,Math.max(v===Ae.Down?C.top:C.top+C.height/2,f.y))},_=v===Ae.Right&&!y||v===Ae.Left&&!w,I=v===Ae.Down&&!O||v===Ae.Up&&!m;if(_&&N.x!==f.x){const z=x.scrollLeft+p.x,U=v===Ae.Right&&z<=S.x||v===Ae.Left&&z>=T.x;if(U&&!p.y){x.scrollTo({left:z,behavior:i});return}U?h.x=x.scrollLeft-z:h.x=v===Ae.Right?x.scrollLeft-S.x:x.scrollLeft-T.x,h.x&&x.scrollBy({left:-h.x,behavior:i});break}else if(I&&N.y!==f.y){const z=x.scrollTop+p.y,U=v===Ae.Down&&z<=S.y||v===Ae.Up&&z>=T.y;if(U&&!p.x){x.scrollTo({top:z,behavior:i});return}U?h.y=x.scrollTop-z:h.y=v===Ae.Down?x.scrollTop-S.y:x.scrollTop-T.y,h.y&&x.scrollBy({top:-h.y,behavior:i});break}}this.handleMove(e,ms(zr(f,this.referenceCoordinates),h))}}}handleMove(e,s){const{onMove:r}=this.props;e.preventDefault(),r(s)}handleEnd(e){const{onEnd:s}=this.props;e.preventDefault(),this.detach(),s()}handleCancel(e){const{onCancel:s}=this.props;e.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ja.activators=[{eventName:"onKeyDown",handler:(t,e,s)=>{let{keyboardCodes:r=ql,onActivation:n}=e,{active:a}=s;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const i=a.activatorNode.current;return i&&t.target!==i?!1:(t.preventDefault(),n==null||n({event:t.nativeEvent}),!0)}return!1}}];function Ko(t){return!!(t&&"distance"in t)}function qo(t){return!!(t&&"delay"in t)}class ka{constructor(e,s,r){var n;r===void 0&&(r=ap(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=s;const{event:a}=e,{target:o}=a;this.props=e,this.events=s,this.document=ws(o),this.documentListeners=new Ds(this.document),this.listeners=new Ds(r),this.windowListeners=new Ds(Xe(o)),this.initialCoordinates=(n=Br(a))!=null?n:yt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:s,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ht.Resize,this.handleCancel),this.windowListeners.add(ht.DragStart,Uo),this.windowListeners.add(ht.VisibilityChange,this.handleCancel),this.windowListeners.add(ht.ContextMenu,Uo),this.documentListeners.add(ht.Keydown,this.handleKeydown),s){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(qo(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(Ko(s)){this.handlePending(s);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,s){const{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:e}=this,{onStart:s}=this.props;e&&(this.activated=!0,this.documentListeners.add(ht.Click,op,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ht.SelectionChange,this.removeTextSelection),s(e))}handleMove(e){var s;const{activated:r,initialCoordinates:n,props:a}=this,{onMove:o,options:{activationConstraint:i}}=a;if(!n)return;const c=(s=Br(e))!=null?s:yt,d=zr(n,c);if(!r&&i){if(Ko(i)){if(i.tolerance!=null&&Nn(d,i.tolerance))return this.handleCancel();if(Nn(d,i.distance))return this.handleStart()}if(qo(i)&&Nn(d,i.tolerance))return this.handleCancel();this.handlePending(i,d);return}e.cancelable&&e.preventDefault(),o(c)}handleEnd(){const{onAbort:e,onEnd:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleCancel(){const{onAbort:e,onCancel:s}=this.props;this.detach(),this.activated||e(this.props.active),s()}handleKeydown(e){e.code===Ae.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const lp={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Sa extends ka{constructor(e){const{event:s}=e,r=ws(s.target);super(e,lp,r)}}Sa.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:r}=e;return!s.isPrimary||s.button!==0?!1:(r==null||r({event:s}),!0)}}];const cp={move:{name:"mousemove"},end:{name:"mouseup"}};var Qn;(function(t){t[t.RightClick=2]="RightClick"})(Qn||(Qn={}));class dp extends ka{constructor(e){super(e,cp,ws(e.event.target))}}dp.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:r}=e;return s.button===Qn.RightClick?!1:(r==null||r({event:s}),!0)}}];const Cn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class up extends ka{constructor(e){super(e,Cn)}static setup(){return window.addEventListener(Cn.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Cn.move.name,e)};function e(){}}}up.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:s}=t,{onActivation:r}=e;const{touches:n}=s;return n.length>1?!1:(r==null||r({event:s}),!0)}}];var $s;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})($s||($s={}));var Kr;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Kr||(Kr={}));function fp(t){let{acceleration:e,activator:s=$s.Pointer,canScroll:r,draggingRect:n,enabled:a,interval:o=5,order:i=Kr.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:p}=t;const h=pp({delta:f,disabled:!a}),[g,x]=Sh(),v=b.useRef({x:0,y:0}),m=b.useRef({x:0,y:0}),y=b.useMemo(()=>{switch(s){case $s.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case $s.DraggableRect:return n}},[s,n,c]),w=b.useRef(null),O=b.useCallback(()=>{const T=w.current;if(!T)return;const C=v.current.x*m.current.x,N=v.current.y*m.current.y;T.scrollBy(C,N)},[]),S=b.useMemo(()=>i===Kr.TreeOrder?[...d].reverse():d,[i,d]);b.useEffect(()=>{if(!a||!d.length||!y){x();return}for(const T of S){if((r==null?void 0:r(T))===!1)continue;const C=d.indexOf(T),N=u[C];if(!N)continue;const{direction:_,speed:I}=ep(T,N,y,e,p);for(const z of["x","y"])h[z][_[z]]||(I[z]=0,_[z]=0);if(I.x>0||I.y>0){x(),w.current=T,g(O,o),v.current=I,m.current=_;return}}v.current={x:0,y:0},m.current={x:0,y:0},x()},[e,O,r,x,a,o,JSON.stringify(y),JSON.stringify(h),g,d,S,u,JSON.stringify(p)])}const hp={x:{[Ke.Backward]:!1,[Ke.Forward]:!1},y:{[Ke.Backward]:!1,[Ke.Forward]:!1}};function pp(t){let{delta:e,disabled:s}=t;const r=Vr(e);return Xs(n=>{if(s||!r||!n)return hp;const a={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ke.Backward]:n.x[Ke.Backward]||a.x===-1,[Ke.Forward]:n.x[Ke.Forward]||a.x===1},y:{[Ke.Backward]:n.y[Ke.Backward]||a.y===-1,[Ke.Forward]:n.y[Ke.Forward]||a.y===1}}},[s,e,r])}function mp(t,e){const s=e!=null?t.get(e):void 0,r=s?s.node.current:null;return Xs(n=>{var a;return e==null?null:(a=r??n)!=null?a:null},[r,e])}function gp(t,e){return b.useMemo(()=>t.reduce((s,r)=>{const{sensor:n}=r,a=n.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...s,...a]},[]),[t,e])}var Ks;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ks||(Ks={}));var ea;(function(t){t.Optimized="optimized"})(ea||(ea={}));const Wo=new Map;function bp(t,e){let{dragging:s,dependencies:r,config:n}=e;const[a,o]=b.useState(null),{frequency:i,measure:c,strategy:d}=n,u=b.useRef(t),f=v(),p=Bs(f),h=b.useCallback(function(m){m===void 0&&(m=[]),!p.current&&o(y=>y===null?m:y.concat(m.filter(w=>!y.includes(w))))},[p]),g=b.useRef(null),x=Xs(m=>{if(f&&!s)return Wo;if(!m||m===Wo||u.current!==t||a!=null){const y=new Map;for(let w of t){if(!w)continue;if(a&&a.length>0&&!a.includes(w.id)&&w.rect.current){y.set(w.id,w.rect.current);continue}const O=w.node.current,S=O?new wa(c(O),O):null;w.rect.current=S,S&&y.set(w.id,S)}return y}return m},[t,a,s,f,c]);return b.useEffect(()=>{u.current=t},[t]),b.useEffect(()=>{f||h()},[s,f]),b.useEffect(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),b.useEffect(()=>{f||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{h(),g.current=null},i))},[i,f,h,...r]),{droppableRects:x,measureDroppableContainers:h,measuringScheduled:a!=null};function v(){switch(d){case Ks.Always:return!1;case Ks.BeforeDragging:return s;default:return!s}}}function Na(t,e){return Xs(s=>t?s||(typeof e=="function"?e(t):t):null,[e,t])}function xp(t,e){return Na(t,e)}function vp(t){let{callback:e,disabled:s}=t;const r=tn(e),n=b.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,s]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function rn(t){let{callback:e,disabled:s}=t;const r=tn(e),n=b.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[s]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function yp(t){return new wa(Qs(t),t)}function Jo(t,e,s){e===void 0&&(e=yp);const[r,n]=b.useState(null);function a(){n(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??s)!=null?d:null}const u=e(t);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=vp({callback(c){if(t)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){a();break}}}}),i=rn({callback:a});return _t(()=>{a(),t?(i==null||i.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),o==null||o.disconnect())},[t]),r}function wp(t){const e=Na(t);return Ll(t,e)}const Ho=[];function jp(t){const e=b.useRef(t),s=Xs(r=>t?r&&r!==Ho&&t&&e.current&&t.parentNode===e.current.parentNode?r:ya(t):Ho,[t]);return b.useEffect(()=>{e.current=t},[t]),s}function kp(t){const[e,s]=b.useState(null),r=b.useRef(t),n=b.useCallback(a=>{const o=Sn(a.target);o&&s(i=>i?(i.set(o,Xn(o)),new Map(i)):null)},[]);return b.useEffect(()=>{const a=r.current;if(t!==a){o(a);const i=t.map(c=>{const d=Sn(c);return d?(d.addEventListener("scroll",n,{passive:!0}),[d,Xn(d)]):null}).filter(c=>c!=null);s(i.length?new Map(i):null),r.current=t}return()=>{o(t),o(a)};function o(i){i.forEach(c=>{const d=Sn(c);d==null||d.removeEventListener("scroll",n)})}},[n,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((a,o)=>ms(a,o),yt):Ul(t):yt,[t,e])}function Go(t,e){e===void 0&&(e=[]);const s=b.useRef(null);return b.useEffect(()=>{s.current=null},e),b.useEffect(()=>{const r=t!==yt;r&&!s.current&&(s.current=t),!r&&s.current&&(s.current=null)},[t]),s.current?zr(t,s.current):yt}function Sp(t){b.useEffect(()=>{if(!en)return;const e=t.map(s=>{let{sensor:r}=s;return r.setup==null?void 0:r.setup()});return()=>{for(const s of e)s==null||s()}},t.map(e=>{let{sensor:s}=e;return s}))}function Np(t,e){return b.useMemo(()=>t.reduce((s,r)=>{let{eventName:n,handler:a}=r;return s[n]=o=>{a(o,e)},s},{}),[t,e])}function Wl(t){return b.useMemo(()=>t?Zh(t):null,[t])}const Zo=[];function Cp(t,e){e===void 0&&(e=Qs);const[s]=t,r=Wl(s?Xe(s):null),[n,a]=b.useState(Zo);function o(){a(()=>t.length?t.map(c=>zl(c)?r:new wa(e(c),c)):Zo)}const i=rn({callback:o});return _t(()=>{i==null||i.disconnect(),o(),t.forEach(c=>i==null?void 0:i.observe(c))},[t]),n}function Jl(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Ys(e)?e:t}function Ep(t){let{measure:e}=t;const[s,r]=b.useState(null),n=b.useCallback(d=>{for(const{target:u}of d)if(Ys(u)){r(f=>{const p=e(u);return f?{...f,width:p.width,height:p.height}:p});break}},[e]),a=rn({callback:n}),o=b.useCallback(d=>{const u=Jl(d);a==null||a.disconnect(),u&&(a==null||a.observe(u)),r(u?e(u):null)},[e,a]),[i,c]=Ir(o);return b.useMemo(()=>({nodeRef:i,rect:s,setRef:c}),[s,i,c])}const Op=[{sensor:Sa,options:{}},{sensor:ja,options:{}}],Ap={current:{}},Nr={draggable:{measure:Bo},droppable:{measure:Bo,strategy:Ks.WhileDragging,frequency:ea.Optimized},dragOverlay:{measure:Qs}};class Ls extends Map{get(e){var s;return e!=null&&(s=super.get(e))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:s}=e;return!s})}getNodeFor(e){var s,r;return(s=(r=this.get(e))==null?void 0:r.node.current)!=null?s:void 0}}const Tp={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ls,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ur},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nr,measureDroppableContainers:Ur,windowRect:null,measuringScheduled:!1},Hl={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ur,draggableNodes:new Map,over:null,measureDroppableContainers:Ur},er=b.createContext(Hl),Gl=b.createContext(Tp);function Fp(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ls}}}function Rp(t,e){switch(e.type){case Ue.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ue.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Ue.DragEnd:case Ue.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ue.RegisterDroppable:{const{element:s}=e,{id:r}=s,n=new Ls(t.droppable.containers);return n.set(r,s),{...t,droppable:{...t.droppable,containers:n}}}case Ue.SetDroppableDisabled:{const{id:s,key:r,disabled:n}=e,a=t.droppable.containers.get(s);if(!a||r!==a.key)return t;const o=new Ls(t.droppable.containers);return o.set(s,{...a,disabled:n}),{...t,droppable:{...t.droppable,containers:o}}}case Ue.UnregisterDroppable:{const{id:s,key:r}=e,n=t.droppable.containers.get(s);if(!n||r!==n.key)return t;const a=new Ls(t.droppable.containers);return a.delete(s),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function _p(t){let{disabled:e}=t;const{active:s,activatorEvent:r,draggableNodes:n}=b.useContext(er),a=Vr(r),o=Vr(s==null?void 0:s.id);return b.useEffect(()=>{if(!e&&!r&&a&&o!=null){if(!va(a)||document.activeElement===a.target)return;const i=n.get(o);if(!i)return;const{activatorNode:c,node:d}=i;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Eh(u);if(f){f.focus();break}}})}},[r,e,n,o,a]),null}function Zl(t,e){let{transform:s,...r}=e;return t!=null&&t.length?t.reduce((n,a)=>a({transform:n,...r}),s):s}function Dp(t){return b.useMemo(()=>({draggable:{...Nr.draggable,...t==null?void 0:t.draggable},droppable:{...Nr.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Nr.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function $p(t){let{activeNode:e,measure:s,initialRect:r,config:n=!0}=t;const a=b.useRef(!1),{x:o,y:i}=typeof n=="boolean"?{x:n,y:n}:n;_t(()=>{if(!o&&!i||!e){a.current=!1;return}if(a.current||!r)return;const d=e==null?void 0:e.node.current;if(!d||d.isConnected===!1)return;const u=s(d),f=Ll(u,r);if(o||(f.x=0),i||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Pl(d);p&&p.scrollBy({top:f.y,left:f.x})}},[e,o,i,r,s])}const nn=b.createContext({...yt,scaleX:1,scaleY:1});var Bt;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Bt||(Bt={}));const Lp=b.memo(function(e){var s,r,n,a;let{id:o,accessibility:i,autoScroll:c=!0,children:d,sensors:u=Op,collisionDetection:f=$l,measuring:p,modifiers:h,...g}=e;const x=b.useReducer(Rp,void 0,Fp),[v,m]=x,[y,w]=_h(),[O,S]=b.useState(Bt.Uninitialized),T=O===Bt.Initialized,{draggable:{active:C,nodes:N,translate:_},droppable:{containers:I}}=v,z=C!=null?N.get(C):null,U=b.useRef({initial:null,translated:null}),D=b.useMemo(()=>{var K;return C!=null?{id:C,data:(K=z==null?void 0:z.data)!=null?K:Ap,rect:U}:null},[C,z]),$=b.useRef(null),[E,Z]=b.useState(null),[se,q]=b.useState(null),ae=Bs(g,Object.values(g)),A=sn("DndDescribedBy",o),j=b.useMemo(()=>I.getEnabled(),[I]),V=Dp(p),{droppableRects:B,measureDroppableContainers:W,measuringScheduled:Q}=bp(j,{dragging:T,dependencies:[_.x,_.y],config:V.droppable}),M=mp(N,C),J=b.useMemo(()=>se?Br(se):null,[se]),he=te(),ge=xp(M,V.draggable.measure);$p({activeNode:C!=null?N.get(C):null,config:he.layoutShiftCompensation,initialRect:ge,measure:V.draggable.measure});const de=Jo(M,V.draggable.measure,ge),Se=Jo(M?M.parentElement:null),be=b.useRef({activatorEvent:null,active:null,activeNode:M,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=I.getNodeFor((s=be.current.over)==null?void 0:s.id),fe=Ep({measure:V.dragOverlay.measure}),me=(r=fe.nodeRef.current)!=null?r:M,we=T?(n=fe.rect)!=null?n:de:null,ce=!!(fe.nodeRef.current&&fe.rect),Ce=wp(ce?null:de),Te=Wl(me?Xe(me):null),k=jp(T?pe??M:null),F=Cp(k),L=Zl(h,{transform:{x:_.x-Ce.x,y:_.y-Ce.y,scaleX:1,scaleY:1},activatorEvent:se,active:D,activeNodeRect:de,containerNodeRect:Se,draggingNodeRect:we,over:be.current.over,overlayNodeRect:fe.rect,scrollableAncestors:k,scrollableAncestorRects:F,windowRect:Te}),ee=J?ms(J,_):null,Y=kp(k),G=Go(Y),ue=Go(Y,[de]),ve=ms(L,G),ke=we?Jh(we,L):null,_e=D&&ke?f({active:D,collisionRect:ke,droppableRects:B,droppableContainers:j,pointerCoordinates:ee}):null,wt=Bh(_e,"id"),[Me,Kt]=b.useState(null),Dt=ce?L:ms(L,ue),$t=qh(Dt,(a=Me==null?void 0:Me.rect)!=null?a:null,de),Lt=b.useRef(null),Mt=b.useCallback((K,Ne)=>{let{sensor:Ie,options:De}=Ne;if($.current==null)return;const Qe=N.get($.current);if(!Qe)return;const Je=K.nativeEvent,He=new Ie({active:$.current,activeNode:Qe,event:Je,options:De,context:be,onAbort(Ve){if(!N.get(Ve))return;const{onDragAbort:it}=ae.current,pt={id:Ve};it==null||it(pt),y({type:"onDragAbort",event:pt})},onPending(Ve,jt,it,pt){if(!N.get(Ve))return;const{onDragPending:Wt}=ae.current,kt={id:Ve,constraint:jt,initialCoordinates:it,offset:pt};Wt==null||Wt(kt),y({type:"onDragPending",event:kt})},onStart(Ve){const jt=$.current;if(jt==null)return;const it=N.get(jt);if(!it)return;const{onDragStart:pt}=ae.current,qt={activatorEvent:Je,active:{id:jt,data:it.data,rect:U}};Yt.unstable_batchedUpdates(()=>{pt==null||pt(qt),S(Bt.Initializing),m({type:Ue.DragStart,initialCoordinates:Ve,active:jt}),y({type:"onDragStart",event:qt}),Z(Lt.current),q(Je)})},onMove(Ve){m({type:Ue.DragMove,coordinates:Ve})},onEnd:Ge(Ue.DragEnd),onCancel:Ge(Ue.DragCancel)});Lt.current=He;function Ge(Ve){return async function(){const{active:it,collisions:pt,over:qt,scrollAdjustedTranslate:Wt}=be.current;let kt=null;if(it&&Wt){const{cancelDrop:Jt}=ae.current;kt={activatorEvent:Je,active:it,collisions:pt,delta:Wt,over:qt},Ve===Ue.DragEnd&&typeof Jt=="function"&&await Promise.resolve(Jt(kt))&&(Ve=Ue.DragCancel)}$.current=null,Yt.unstable_batchedUpdates(()=>{m({type:Ve}),S(Bt.Uninitialized),Kt(null),Z(null),q(null),Lt.current=null;const Jt=Ve===Ue.DragEnd?"onDragEnd":"onDragCancel";if(kt){const js=ae.current[Jt];js==null||js(kt),y({type:Jt,event:kt})}})}}},[N]),as=b.useCallback((K,Ne)=>(Ie,De)=>{const Qe=Ie.nativeEvent,Je=N.get(De);if($.current!==null||!Je||Qe.dndKit||Qe.defaultPrevented)return;const He={active:Je};K(Ie,Ne.options,He)===!0&&(Qe.dndKit={capturedBy:Ne.sensor},$.current=De,Mt(Ie,Ne))},[N,Mt]),Pt=gp(u,as);Sp(u),_t(()=>{de&&O===Bt.Initializing&&S(Bt.Initialized)},[de,O]),b.useEffect(()=>{const{onDragMove:K}=ae.current,{active:Ne,activatorEvent:Ie,collisions:De,over:Qe}=be.current;if(!Ne||!Ie)return;const Je={active:Ne,activatorEvent:Ie,collisions:De,delta:{x:ve.x,y:ve.y},over:Qe};Yt.unstable_batchedUpdates(()=>{K==null||K(Je),y({type:"onDragMove",event:Je})})},[ve.x,ve.y]),b.useEffect(()=>{const{active:K,activatorEvent:Ne,collisions:Ie,droppableContainers:De,scrollAdjustedTranslate:Qe}=be.current;if(!K||$.current==null||!Ne||!Qe)return;const{onDragOver:Je}=ae.current,He=De.get(wt),Ge=He&&He.rect.current?{id:He.id,rect:He.rect.current,data:He.data,disabled:He.disabled}:null,Ve={active:K,activatorEvent:Ne,collisions:Ie,delta:{x:Qe.x,y:Qe.y},over:Ge};Yt.unstable_batchedUpdates(()=>{Kt(Ge),Je==null||Je(Ve),y({type:"onDragOver",event:Ve})})},[wt]),_t(()=>{be.current={activatorEvent:se,active:D,activeNode:M,collisionRect:ke,collisions:_e,droppableRects:B,draggableNodes:N,draggingNode:me,draggingNodeRect:we,droppableContainers:I,over:Me,scrollableAncestors:k,scrollAdjustedTranslate:ve},U.current={initial:we,translated:ke}},[D,M,_e,ke,N,me,we,B,I,Me,k,ve]),fp({...he,delta:_,draggingRect:ke,pointerCoordinates:ee,scrollableAncestors:k,scrollableAncestorRects:F});const R=b.useMemo(()=>({active:D,activeNode:M,activeNodeRect:de,activatorEvent:se,collisions:_e,containerNodeRect:Se,dragOverlay:fe,draggableNodes:N,droppableContainers:I,droppableRects:B,over:Me,measureDroppableContainers:W,scrollableAncestors:k,scrollableAncestorRects:F,measuringConfiguration:V,measuringScheduled:Q,windowRect:Te}),[D,M,de,se,_e,Se,fe,N,I,B,Me,W,k,F,V,Q,Te]),P=b.useMemo(()=>({activatorEvent:se,activators:Pt,active:D,activeNodeRect:de,ariaDescribedById:{draggable:A},dispatch:m,draggableNodes:N,over:Me,measureDroppableContainers:W}),[se,Pt,D,de,m,A,N,Me,W]);return b.createElement(Dl.Provider,{value:w},b.createElement(er.Provider,{value:P},b.createElement(Gl.Provider,{value:R},b.createElement(nn.Provider,{value:$t},d)),b.createElement(_p,{disabled:(i==null?void 0:i.restoreFocus)===!1})),b.createElement(Lh,{...i,hiddenTextDescribedById:A}));function te(){const K=(E==null?void 0:E.autoScrollEnabled)===!1,Ne=typeof c=="object"?c.enabled===!1:c===!1,Ie=T&&!K&&!Ne;return typeof c=="object"?{...c,enabled:Ie}:{enabled:Ie}}}),Mp=b.createContext(null),Yo="button",Pp="Draggable";function tr(t){let{id:e,data:s,disabled:r=!1,attributes:n}=t;const a=sn(Pp),{activators:o,activatorEvent:i,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:p}=b.useContext(er),{role:h=Yo,roleDescription:g="draggable",tabIndex:x=0}=n??{},v=(c==null?void 0:c.id)===e,m=b.useContext(v?nn:Mp),[y,w]=Ir(),[O,S]=Ir(),T=Np(o,e),C=Bs(s);_t(()=>(f.set(e,{id:e,key:a,node:y,activatorNode:O,data:C}),()=>{const _=f.get(e);_&&_.key===a&&f.delete(e)}),[f,e]);const N=b.useMemo(()=>({role:h,tabIndex:x,"aria-disabled":r,"aria-pressed":v&&h===Yo?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[r,h,x,v,g,u.draggable]);return{active:c,activatorEvent:i,activeNodeRect:d,attributes:N,isDragging:v,listeners:r?void 0:T,node:y,over:p,setNodeRef:w,setActivatorNodeRef:S,transform:m}}function Ip(){return b.useContext(Gl)}const Vp="Droppable",zp={timeout:25};function sr(t){let{data:e,disabled:s=!1,id:r,resizeObserverConfig:n}=t;const a=sn(Vp),{active:o,dispatch:i,over:c,measureDroppableContainers:d}=b.useContext(er),u=b.useRef({disabled:s}),f=b.useRef(!1),p=b.useRef(null),h=b.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:v}={...zp,...n},m=Bs(x??r),y=b.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),h.current=null},v)},[v]),w=rn({callback:y,disabled:g||!o}),O=b.useCallback((N,_)=>{w&&(_&&(w.unobserve(_),f.current=!1),N&&w.observe(N))},[w]),[S,T]=Ir(O),C=Bs(e);return b.useEffect(()=>{!w||!S.current||(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),b.useEffect(()=>(i({type:Ue.RegisterDroppable,element:{id:r,key:a,disabled:s,node:S,rect:p,data:C}}),()=>i({type:Ue.UnregisterDroppable,key:a,id:r})),[r]),b.useEffect(()=>{s!==u.current.disabled&&(i({type:Ue.SetDroppableDisabled,id:r,key:a,disabled:s}),u.current.disabled=s)},[r,a,s,i]),{active:o,rect:p,isOver:(c==null?void 0:c.id)===r,node:S,over:c,setNodeRef:T}}function Bp(t){let{animation:e,children:s}=t;const[r,n]=b.useState(null),[a,o]=b.useState(null),i=Vr(s);return!s&&!r&&i&&n(i),_t(()=>{if(!a)return;const c=r==null?void 0:r.key,d=r==null?void 0:r.props.id;if(c==null||d==null){n(null);return}Promise.resolve(e(d,a)).then(()=>{n(null)})},[e,r,a]),b.createElement(b.Fragment,null,s,r?b.cloneElement(r,{ref:o}):null)}const Up={x:0,y:0,scaleX:1,scaleY:1};function Kp(t){let{children:e}=t;return b.createElement(er.Provider,{value:Hl},b.createElement(nn.Provider,{value:Up},e))}const qp={position:"fixed",touchAction:"none"},Wp=t=>va(t)?"transform 250ms ease":void 0,Jp=b.forwardRef((t,e)=>{let{as:s,activatorEvent:r,adjustScale:n,children:a,className:o,rect:i,style:c,transform:d,transition:u=Wp}=t;if(!i)return null;const f=n?d:{...d,scaleX:1,scaleY:1},p={...qp,width:i.width,height:i.height,top:i.top,left:i.left,transform:Us.Transform.toString(f),transformOrigin:n&&r?Ih(r,i):void 0,transition:typeof u=="function"?u(r):u,...c};return b.createElement(s,{className:o,style:p,ref:e},a)}),Hp=t=>e=>{let{active:s,dragOverlay:r}=e;const n={},{styles:a,className:o}=t;if(a!=null&&a.active)for(const[i,c]of Object.entries(a.active))c!==void 0&&(n[i]=s.node.style.getPropertyValue(i),s.node.style.setProperty(i,c));if(a!=null&&a.dragOverlay)for(const[i,c]of Object.entries(a.dragOverlay))c!==void 0&&r.node.style.setProperty(i,c);return o!=null&&o.active&&s.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(n))s.node.style.setProperty(c,d);o!=null&&o.active&&s.node.classList.remove(o.active)}},Gp=t=>{let{transform:{initial:e,final:s}}=t;return[{transform:Us.Transform.toString(e)},{transform:Us.Transform.toString(s)}]},Zp={duration:250,easing:"ease",keyframes:Gp,sideEffects:Hp({styles:{active:{opacity:"0"}}})};function Yp(t){let{config:e,draggableNodes:s,droppableContainers:r,measuringConfiguration:n}=t;return tn((a,o)=>{if(e===null)return;const i=s.get(a);if(!i)return;const c=i.node.current;if(!c)return;const d=Jl(o);if(!d)return;const{transform:u}=Xe(o).getComputedStyle(o),f=Ml(u);if(!f)return;const p=typeof e=="function"?e:Xp(e);return Kl(c,n.draggable.measure),p({active:{id:a,data:i.data,node:c,rect:n.draggable.measure(c)},draggableNodes:s,dragOverlay:{node:o,rect:n.dragOverlay.measure(d)},droppableContainers:r,measuringConfiguration:n,transform:f})})}function Xp(t){const{duration:e,easing:s,sideEffects:r,keyframes:n}={...Zp,...t};return a=>{let{active:o,dragOverlay:i,transform:c,...d}=a;if(!e)return;const u={x:i.rect.left-o.rect.left,y:i.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/i.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/i.rect.height:1},p={x:c.x-u.x,y:c.y-u.y,...f},h=n({...d,active:o,dragOverlay:i,transform:{initial:c,final:p}}),[g]=h,x=h[h.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const v=r==null?void 0:r({active:o,dragOverlay:i,...d}),m=i.node.animate(h,{duration:e,easing:s,fill:"forwards"});return new Promise(y=>{m.onfinish=()=>{v==null||v(),y()}})}}let Xo=0;function Qp(t){return b.useMemo(()=>{if(t!=null)return Xo++,Xo},[t])}const em=b.memo(t=>{let{adjustScale:e=!1,children:s,dropAnimation:r,style:n,transition:a,modifiers:o,wrapperElement:i="div",className:c,zIndex:d=999}=t;const{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggableNodes:g,droppableContainers:x,dragOverlay:v,over:m,measuringConfiguration:y,scrollableAncestors:w,scrollableAncestorRects:O,windowRect:S}=Ip(),T=b.useContext(nn),C=Qp(f==null?void 0:f.id),N=Zl(o,{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:w,scrollableAncestorRects:O,transform:T,windowRect:S}),_=Na(p),I=Yp({config:r,draggableNodes:g,droppableContainers:x,measuringConfiguration:y}),z=_?v.setRef:void 0;return b.createElement(Kp,null,b.createElement(Bp,{animation:I},f&&C?b.createElement(Jp,{key:C,id:f.id,ref:z,as:i,activatorEvent:u,adjustScale:e,className:c,transition:a,rect:_,style:{zIndex:d,...n},transform:N},s):null))});function tm(){return{label:"Texto",type:"text",width:"w-full md:w-1/2",placeholder:"Escribe…",size:"sm"}}function sm(){return{label:"Número",type:"number",width:"w-full md:w-1/3",placeholder:"0",size:"sm",validation:{required:!1}}}function rm(){return{label:"Email",type:"email",width:"w-full md:w-1/2",placeholder:"usuario@dominio.com",size:"sm"}}function nm(){return{label:"Selecciona una opción",type:"select",width:"w-full md:w-1/3",size:"sm",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}]}}function am(){return{label:"Aceptar condiciones",type:"checkbox",width:"w-full md:w-1/3",size:"sm",defaultValue:!1}}function om(){return{label:"Comentario",type:"textarea",width:"w-full",size:"sm",maxLength:300,showCounter:!0,placeholder:"Escribe tu comentario…"}}function im(){return{label:"Fecha",type:"date",width:"w-full md:w-1/3",size:"sm",showTime:!1}}function lm(){return{label:"Documento",type:"file",width:"w-full md:w-1/2",maxFiles:1,accept:".pdf,.doc,.docx"}}const cm={text:tm,number:sm,email:rm,select:nm,checkbox:am,textarea:om,date:im,file:lm},dm=()=>l.jsx(je,{label:"Texto",placeholder:"Escribe…",size:"sm",reserveErrorSpace:!1}),um=()=>l.jsx(je,{type:"number",label:"Número",placeholder:"0",size:"sm",reserveErrorSpace:!1}),fm=()=>l.jsx(je,{type:"email",label:"Email",placeholder:"usuario@dominio.com",size:"sm",reserveErrorSpace:!1}),hm=()=>l.jsx(nt,{label:"Select",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}],size:"sm"}),pm=()=>l.jsx(ft,{label:"Aceptar condiciones",defaultValue:!1,name:"__prev_checkbox__"}),mm=()=>l.jsx(Gr,{label:"Comentario",placeholder:"Escribe tu comentario…",size:"sm",maxLength:120,showCounter:!0}),gm=()=>l.jsx(Ms,{label:"Fecha",defaultValue:"",showTime:!1,name:"__prev_date__"}),bm=()=>l.jsxs("div",{children:[l.jsx("label",{className:"text-ds-xs block mb-1 opacity-80",children:"Documento"}),l.jsx("div",{className:"w-full rounded-xl border border-dashed p-4 text-ds-xs opacity-70",children:"Arrastra o selecciona archivo…"})]}),xm=()=>l.jsx("div",{className:"p-2 rounded-md bg-[var(--color-ds-background-page)]",children:l.jsx(Hs,{options:[{label:"Tab 1",value:"t1"},{label:"Tab 2",value:"t2"}],value:"t1",onChange:()=>{},children:{t1:l.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 1"}),t2:l.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 2"})}})}),vm=()=>l.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[l.jsx("div",{className:"px-3 py-2 border-b border-[var(--color-ds-border-default-50)] text-ds-sm",children:"Sección"}),l.jsx("div",{className:"p-3 text-ds-xs opacity-70",children:"Fila con 1 columna (w-full). Modifícala desde el lienzo."})]}),gr=[{kind:"text",title:"Texto",category:"basics",renderPreview:l.jsx(dm,{}),detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsxs("li",{children:["Props: ",l.jsx("code",{children:"placeholder"}),", ",l.jsx("code",{children:"size"}),", ",l.jsx("code",{children:"width"}),", ",l.jsx("code",{children:"info"})]}),l.jsxs("li",{children:["Validación: ",l.jsx("code",{children:"required"}),", ",l.jsx("code",{children:"minLength"}),", ",l.jsx("code",{children:"maxLength"}),", ",l.jsx("code",{children:"pattern"})]})]})},{kind:"number",title:"Número",category:"basics",renderPreview:l.jsx(um,{}),detail:l.jsx("ul",{className:"list-disc pl-4 space-y-1",children:l.jsxs("li",{children:["Validación: ",l.jsx("code",{children:"numberMin"}),", ",l.jsx("code",{children:"numberMax"}),", ",l.jsx("code",{children:"step"}),", ",l.jsx("code",{children:"integerOnly"}),", ",l.jsx("code",{children:"positiveOnly"})]})})},{kind:"email",title:"Email",category:"basics",renderPreview:l.jsx(fm,{}),detail:l.jsx("ul",{className:"list-disc pl-4 space-y-1",children:l.jsx("li",{children:"Preset de patrón disponible"})})},{kind:"select",title:"Select",category:"basics",renderPreview:l.jsx(hm,{}),hint:"Admite optionSource",detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsxs("li",{children:["Opciones: ",l.jsx("code",{children:"options"})," o ",l.jsx("code",{children:"optionSource"})]}),l.jsxs("li",{children:["Default: ",l.jsx("code",{children:"defaultSource"})]}),l.jsxs("li",{children:["Soporta ",l.jsx("code",{children:"multiple"})," y ",l.jsx("code",{children:"adapterCtx"})]})]})},{kind:"checkbox",title:"Checkbox",category:"basics",renderPreview:l.jsx(pm,{}),detail:l.jsx("ul",{className:"list-disc pl-4 space-y-1",children:l.jsxs("li",{children:["Devuelve ",l.jsx("code",{children:"boolean"})]})})},{kind:"date",title:"Fecha",category:"basics",renderPreview:l.jsx(gm,{}),detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsxs("li",{children:["Prop: ",l.jsx("code",{children:"showTime"})]}),l.jsxs("li",{children:["Validación: ",l.jsx("code",{children:"dateMin"}),", ",l.jsx("code",{children:"dateMax"}),", ",l.jsx("code",{children:"disallowPast"}),", ",l.jsx("code",{children:"disallowFuture"})]})]})},{kind:"textarea",title:"Textarea",category:"content",renderPreview:l.jsx(mm,{}),detail:l.jsx("ul",{className:"list-disc pl-4 space-y-1",children:l.jsxs("li",{children:["Props: ",l.jsx("code",{children:"maxLength"}),", ",l.jsx("code",{children:"showCounter"})]})})},{kind:"file",title:"Archivo",category:"content",renderPreview:l.jsx(bm,{}),detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsxs("li",{children:["Props: ",l.jsx("code",{children:"accept"}),", ",l.jsx("code",{children:"maxFiles"})]}),l.jsxs("li",{children:["Validación: ",l.jsx("code",{children:"fileMaxSizeMB"})]})]})},{kind:"section-layout",title:"Sección",category:"layout",renderPreview:l.jsx(vm,{}),isLayout:!0,hint:"Contenedor de layout",detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsx("li",{children:"Inserta un bloque de filas/columnas (rows) con una fila vacía."}),l.jsx("li",{children:"Después puedes añadir columnas y colocar campos."})]})},{kind:"tabs-layout",title:"Pestañas",category:"layout",renderPreview:l.jsx(xm,{}),isLayout:!0,hint:"Contenedor de layout (no es un campo)",detail:l.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[l.jsxs("li",{children:["Inserta un contenedor de ",l.jsx("code",{children:"tabs"})," en el layout."]}),l.jsx("li",{children:"Cada pestaña contiene sus propias secciones y filas."}),l.jsx("li",{children:"Útil para agrupar campos por temática."})]})}];function Yl({title:t,onAdd:e,onInfo:s,dragging:r=!1}){return l.jsxs("div",{className:["hover:text-[var(--color-ds-text-on-accent)] relative",r?"opacity-70":""].join(" "),children:[l.jsx(le,{size:"sm",variant:"outline",onClick:e,className:["w-full rounded-xl p-2 text-left justify-start","border-dashed ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:ring-[var(--color-ds-border-default)] hover:shadow-sm","cursor-grab active:cursor-grabbing"].join(" "),title:`Añadir ${t}`,"aria-label":`Añadir ${t}`,children:l.jsx("div",{className:"text-ds-sm",children:t})}),l.jsx("div",{className:"absolute top-1 right-1",children:l.jsx(ua,{size:"sm",position:"right",ariaLabel:`Más info de ${t}`,onClick:s,children:l.jsxs("div",{className:"max-w-[240px]",children:["Pulsa para ver un ejemplo y detalles de ",l.jsx("strong",{children:t}),"."]})})})]})}function Qo({kind:t,title:e,onAdd:s,onInfo:r}){const{attributes:n,listeners:a,setNodeRef:o,isDragging:i}=tr({id:`palette:${t}:${e}`,data:{kind:"palette-field",factoryKind:t}});return l.jsx("div",{ref:o,...n,...a,role:"button","aria-label":`Arrastrar ${e}`,className:"touch-none select-none",children:l.jsx(Yl,{title:e,onAdd:s,onInfo:r,dragging:i})})}function ym(){var x;const t=H(v=>v.addField),e=H(v=>v.addTabsContainerAt),s=H(v=>v.addRowsBlockAt),r=H(v=>v.schema),{show:n}=Gs(),[a,o]=b.useState(""),[i,c]=b.useState(null),d=b.useMemo(()=>gr.filter(v=>v.category==="basics"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),u=b.useMemo(()=>gr.filter(v=>v.category==="content"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),f=b.useMemo(()=>gr.filter(v=>v.category==="layout"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),p=b.useMemo(()=>gr.find(v=>v.kind===i)??null,[i]),h=b.useCallback(v=>{const m=cm[v];if(!m){n("Tipo de campo no soportado.","warning");return}const y=m();t(y),n(`Añadido “${y.label}”. Ahora arrástralo al formulario o usa “Colocar último campo”.`,"success")},[t,n]),g=b.useCallback(v=>{var y;const m=((y=r==null?void 0:r.layout)==null?void 0:y.length)??0;if(v==="section-layout"){typeof s=="function"?(s(m,"Nueva sección"),n("Sección añadida al layout.","success")):n("Acción addRowsBlockAt no disponible en el store.","warning");return}if(v==="tabs-layout"){typeof e=="function"?(e(m),n("Contenedor de pestañas añadido al layout.","success")):n("Acción addTabsContainerAt no disponible en el store.","warning");return}n("Tipo de layout no soportado.","warning")},[(x=r==null?void 0:r.layout)==null?void 0:x.length,s,e,n]);if(p){const v=!!p.isLayout;return l.jsxs("aside",{className:"border-r bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)] flex items-center",children:[l.jsx("h3",{className:"font-semibold text-[1rem] flex-1 truncate",children:p.title}),l.jsx(le,{size:"sm",variant:"ghost",onClick:()=>c(null),className:"ml-auto",children:"← Volver"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"border border-[var(--color-ds-border-default-50)] p-4 bg-[var(--color-ds-background-surface)]",children:p.renderPreview}),l.jsxs("div",{className:"p-2",children:[l.jsxs("div",{className:"flex items-center gap-2 justify-center mb-4",children:[l.jsx(le,{size:"sm",variant:"primary",onClick:()=>v?g(p.kind):h(p.kind),title:"Añadir rápidamente",children:"Añadir al lienzo"}),l.jsx("span",{className:"text-ds-xs opacity-70",children:"o arrástrame al formulario"})]}),l.jsxs("div",{className:"rounded-xl border border-[var(--color-ds-border-default-50)] p-3",children:[l.jsxs("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] mb-2",children:["Acerca de ",l.jsx("strong",{children:p.title})]}),l.jsxs("div",{className:"text-ds-sm space-y-2",children:[p.hint?l.jsx("div",{className:"opacity-80",children:p.hint}):null,p.detail]})]})]})]})]})}return l.jsxs("aside",{className:"bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)]",children:[l.jsx("h3",{className:"font-semibold text-[1rem]",children:"Paleta"}),l.jsxs("p",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm mt-1",children:["Clic en una tarjeta para ",l.jsx("strong",{children:"añadir"})," al catálogo, o ",l.jsx("strong",{children:"arrastra"})," al formulario para colocar. Usa el icono"," ",l.jsx(hi,{className:"inline w-4 h-4 align-[-2px]"})," para ver detalles."]}),l.jsx("div",{className:"mt-3",children:l.jsx(je,{size:"sm",placeholder:"Buscar componente…",value:a,onChange:v=>o(v.target.value),reserveErrorSpace:!1})})]}),l.jsxs("div",{className:"p-4 space-y-6",children:[l.jsxs("section",{className:"space-y-3",children:[l.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Inputs básicos"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.map(v=>l.jsx(Qo,{kind:v.kind,title:v.title,onAdd:()=>h(v.kind),onInfo:()=>c(v.kind)},v.kind)),d.length===0&&l.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),l.jsxs("section",{className:"space-y-3",children:[l.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Contenido"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.map(v=>l.jsx(Qo,{kind:v.kind,title:v.title,onAdd:()=>h(v.kind),onInfo:()=>c(v.kind)},v.kind)),u.length===0&&l.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),l.jsxs("section",{className:"space-y-3",children:[l.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Estructura"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.map(v=>l.jsx(Yl,{title:v.title,onAdd:()=>v.isLayout?g(v.kind):h(v.kind),onInfo:()=>c(v.kind)},v.kind)),f.length===0&&l.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]})]})]})}function Xl(t){const e=t.trim();if(/^(true|false)$/i.test(e))return e.toLowerCase()==="true";const s=Number(e);return!Number.isNaN(s)&&e!==""?s:e}function wm(t){return t.split(",").map(e=>e.trim()).filter(e=>e.length>0).map(Xl)}function br(t){return typeof t=="boolean"?t?"true":"false":typeof t=="number"?String(t):typeof t=="string"?t:""}const En=(t,e)=>JSON.stringify(t??null)===JSON.stringify(e??null);function jm({value:t,onChange:e,fieldOptions:s}){const r=b.useRef(e);b.useEffect(()=>{r.current=e},[e]);const[n,a]=b.useState((t==null?void 0:t.op)??"eq"),[o,i]=b.useState(t&&"field"in t&&typeof t.field=="string"?t.field:""),[c,d]=b.useState(t&&"value"in t?br(t.value):""),[u,f]=b.useState(t&&"values"in t&&Array.isArray(t.values)?t.values.map(br).join(","):""),p=(S={})=>{const T=S.op??n,C=S.field??o,N=S.val??c,_=S.vals??u;if(!C)return;if(T==="in"||T==="notIn"){const z=wm(_);return T==="in"?{op:"in",field:C,values:z}:{op:"notIn",field:C,values:z}}const I=N.trim()===""?"":Xl(N);return{op:T,field:C,value:I}},h=()=>p({}),g=b.useRef(!1);b.useEffect(()=>{const S=h();if(En(t,S))return;if(g.current=!0,!t){a("eq"),i(""),d(""),f(""),g.current=!1;return}const T=t.op??"eq";a(T),i("field"in t&&typeof t.field=="string"?t.field:""),T==="in"||T==="notIn"?(f("values"in t&&Array.isArray(t.values)?t.values.map(br).join(","):""),d("")):(f(""),d("value"in t?br(t.value):"")),g.current=!1},[t]);const x=b.useRef(void 0),v=b.useRef(null),m=S=>{g.current||S&&(En(x.current,S)||(x.current=S,r.current(S)))},y=()=>{if(g.current)return;const S=h();S&&(En(x.current,S)||(v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{x.current=S,r.current(S)},200)))};b.useEffect(()=>()=>{v.current&&window.clearTimeout(v.current)},[]);const w=b.useMemo(()=>[{value:"eq",label:"igual a"},{value:"neq",label:"distinto de"},{value:"in",label:"en lista"},{value:"notIn",label:"no en lista"},{value:"gt",label:"mayor que"},{value:"gte",label:"mayor o igual"},{value:"lt",label:"menor que"},{value:"lte",label:"menor o igual"}],[]),O=b.useMemo(()=>[{label:"— campo —",value:""},...s],[s]);return l.jsxs("div",{className:"space-y-2",children:[l.jsx(nt,{label:"Operador",value:n,onChange:S=>{const T=S;a(T),T==="in"||T==="notIn"?d(""):f(""),m(p({op:T,val:T==="in"||T==="notIn"?"":c,vals:T==="in"||T==="notIn"?u:""}))},options:w,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),l.jsx(nt,{label:"Campo",value:o,onChange:S=>{const T=S;i(T),m(p({field:T}))},options:O,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),n==="in"||n==="notIn"?l.jsx(je,{size:"sm",label:"Valores (coma)",placeholder:"valor1, valor2, ...",value:u,onChange:S=>{f(S.target.value),y()},reserveErrorSpace:!1}):l.jsx(je,{size:"sm",label:"Valor",placeholder:"true/false, 123, texto",value:c,onChange:S=>{d(S.target.value),y()},reserveErrorSpace:!1})]})}const km=["w-full","w-1/2","w-1/3","w-2/3","w-1/4","w-3/4","w-full md:w-1/2","w-full md:w-1/3","w-full md:w-1/4"],Sm=["sm","md","lg"],Nm=[{value:"text",label:"Texto"},{value:"number",label:"Número"},{value:"email",label:"Email"},{value:"password",label:"Password"},{value:"textarea",label:"Textarea"},{value:"select",label:"Select"},{value:"checkbox",label:"Checkbox"},{value:"date",label:"Fecha"},{value:"file",label:"Archivo"}],Cm=t=>(t==null?void 0:t.enabled)??!!(t!=null&&t.rule),ei=(t,e)=>({...t??{},enabled:e}),Em=(t,e)=>({...t??{},rule:e}),Om=(t,e)=>({...t??{},clearTo:e}),Am=t=>{try{return JSON.stringify(t,null,2)}catch{return""}};async function Tm(){try{const t=await navigator.clipboard.readText(),e=JSON.parse(t);if(e&&typeof e=="object"&&"op"in e)return e}catch{}}function Fm(t){return typeof t=="number"||typeof t=="string"||t instanceof Date}function Ql(t,e){if(!t)return{ok:!1,reason:"Sin regla"};if(!("op"in t))return{ok:!1,reason:"Operador inválido"};if(t.op==="and"||t.op==="or"){if(!Array.isArray(t.rules)||t.rules.length===0)return{ok:!1,reason:`Lista de reglas vacía en "${t.op}"`};for(const s of t.rules){const r=Ql(s,e);if(!r.ok)return r}return{ok:!0}}if(!t.field||typeof t.field!="string")return{ok:!1,reason:"Campo no especificado"};if(!e.includes(t.field))return{ok:!1,reason:`Campo "${t.field}" no existe`};switch(t.op){case"eq":case"neq":return"value"in t?{ok:!0}:{ok:!1,reason:"Valor requerido"};case"in":case"notIn":return Array.isArray(t.values)&&t.values.length>0?{ok:!0}:{ok:!1,reason:"Lista de valores vacía"};case"gt":case"gte":case"lt":case"lte":return"value"in t?Fm(t.value)?{ok:!0}:{ok:!1,reason:"Valor no comparable (número, string o Date)"}:{ok:!1,reason:"Valor requerido"};default:return{ok:!1,reason:`Operador no soportado: ${t.op}`}}}function Rm(t,e){for(let s=0;s<t.layout.length;s++){const r=t.layout[s];if((r==null?void 0:r.type)!=="tabs")continue;const n=r.tabs.findIndex(a=>a.key===e);if(n>=0)return{nodeIdx:s,tabIdx:n,node:r,tab:r.tabs[n]}}return null}function _m(){var j,V,B,W,Q,M,J,he,ge,de,Se,be,pe,fe,me,we,ce,Ce,Te,k,F,L,ee,Y,G,ue,ve,ke,_e,wt,Me,Kt,Dt,$t,Lt,Mt,as,Pt;const t=H(R=>R.selection),e=H(R=>R.schema),s=H(R=>R.updateField),r=H(R=>R.removeField),n=H(R=>R.renameField),a=H(R=>R.duplicateField),o=H(R=>R.changeFieldType),i=H(R=>R.addTabAfter),c=H(R=>R.removeTab),d=H(R=>R.renameTab),u=H(R=>R.moveTab),f=H(R=>R.addSectionToTab),{services:p}=Hr(),{show:h}=Gs(),g=o??((R,P)=>s(R,te=>{te.type=P})),x=b.useMemo(()=>e.fields.map(R=>R.name).filter(Boolean).map(R=>({label:R,value:R})),[e.fields]),v=b.useMemo(()=>x.map(R=>R.value),[x]),m=b.useMemo(()=>{if(t.kind==="field")return e.fields.find(R=>R.name===t.name)},[t,e.fields]),y=(m==null?void 0:m.type)==="select",w=(m==null?void 0:m.type)==="textarea",O=(m==null?void 0:m.type)==="file",S=(m==null?void 0:m.type)==="date",T=(m==null?void 0:m.type)==="number",C=b.useMemo(()=>Object.keys((p==null?void 0:p.registry)??{}),[p]),N=b.useMemo(()=>[{label:"— ninguno —",value:""},...C.map(R=>({label:R,value:R}))],[C]),[_,I]=b.useState(!1),[z,U]=b.useState(null),[D,$]=b.useState([]),[E,Z]=b.useState(""),se=async()=>{var te;const R=m==null?void 0:m.optionSource;if(!R){U("Debes elegir una clave en 'Option source'."),h("Elige la clave del adapter en 'Option source'.","warning");return}const P=(te=p==null?void 0:p.registry)==null?void 0:te[R];if(typeof P!="function"){U(`No existe un provider en services.registry["${R}"]`),h(`Provider no encontrado: ${R}`,"error");return}I(!0),U(null);try{let K;if(E.trim())try{K=JSON.parse(E)}catch{U("Contexto JSON inválido."),h("Contexto JSON inválido.","error"),I(!1);return}const Ne=K!=null?{getValues:()=>K}:void 0,Ie=await Promise.resolve(P("",Ne)),De=Array.isArray(Ie)?Ie:[];$(De),h(De.length?`Cargadas ${De.length} opciones.`:"El adapter devolvió 0 opciones.",De.length?"success":"info")}catch(K){U((K==null?void 0:K.message)||String(K)),h("Error al cargar opciones desde adapter.","error")}finally{I(!1)}},q=()=>{m!=null&&m.name&&(s(m.name,R=>{R.options=[...D],delete R.optionSource,delete R.loadOptions}),h("Opciones copiadas al campo (options).","success"))},ae=({title:R,fieldKey:P,showClearTo:te})=>{const K=(m==null?void 0:m[P])??{},Ne=Cm(K),Ie=Am(K.rule??null),De=Ee=>s(m.name,Ht=>{Ht[P]=Ee}),[Qe,Je]=b.useState(""),He=b.useRef(null),Ge=Ee=>{He.current&&window.clearTimeout(He.current),Je(Ee),He.current=window.setTimeout(()=>Je(""),1500)};b.useEffect(()=>()=>{He.current!=null&&window.clearTimeout(He.current)},[]);const Ve=Ee=>{var os;if(Ee.rule)return Ee;const Ht=((os=x[0])==null?void 0:os.value)??"";return{...Ee,rule:{op:"eq",field:Ht,value:!0}}},jt=Ee=>{De(Ee?Ve(ei(K,Ee)):ei(K,Ee)),Ge(Ee?"Regla activada":"Regla desactivada"),h(Ee?"Regla activada":"Regla desactivada","info")},it=Ee=>{De(Em(K,Ee)),Ge("Regla actualizada")},pt=Ee=>{De(Om(K,Ee)),Ge("clearTo actualizado"),h("clearTo actualizado","info")},qt="__quick_placeholder__",Wt=Ee=>{var Ca;if(!Ee||Ee===qt)return;const Ht=((Ca=x[0])==null?void 0:Ca.value)??"",os={...K??{},enabled:!0};Ee==="eq:true"&&De({...os,rule:{op:"eq",field:Ht,value:!0}}),Ee==="eq:false"&&De({...os,rule:{op:"eq",field:Ht,value:!1}}),Ee==="eq:empty"&&De({...os,rule:{op:"eq",field:Ht,value:""}}),Ge("Atajo aplicado"),h("Atajo aplicado","success")},kt=async()=>{try{await navigator.clipboard.writeText(Ie||""),Ge("Copiado"),h("Regla copiada al portapapeles","success")}catch{Ge("No se pudo copiar"),h("No se pudo copiar al portapapeles","error")}},Jt=async()=>{const Ee=await Tm();Ee?(De({...K??{},enabled:!0,rule:Ee}),Ge("Pegado"),h("Regla pegada desde portapapeles","success")):(Ge("Portapapeles no válido"),h("El contenido del portapapeles no es una regla válida","warning"))},js=()=>{it(void 0),Ge("Regla borrada"),h("Regla borrada","info")},rr=Ql(K.rule,v),ec=Ne?rr.ok?"text-[var(--color-success-600)]":"text-[var(--color-danger-600)]":"text-[var(--color-ds-text-secondary)]",tc=Ne?rr.ok?"border-[var(--color-success-400)]":"border-[var(--color-danger-400)]":"border-[var(--color-ds-border-default-50)]";return l.jsxs("div",{className:"rounded-md border border-[var(--color-ds-border-default-50)] p-2 space-y-2",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ft,{size:"sm",checked:Ne,onChange:jt,label:R}),l.jsxs("span",{className:`ml-2 flex items-center gap-1 text-[11px] ${ec}`,children:[l.jsx("span",{className:"inline-block w-2 h-2 rounded-full border border-black/10 bg-current opacity-70"}),Ne?rr.ok?"OK":rr.reason:"Inactiva"]})]})}),l.jsx("div",{className:"text-[11px] h-4 text-[var(--color-ds-text-secondary)]","aria-live":"polite",children:Qe||l.jsx("span",{"aria-hidden":"true",children:" "})}),l.jsx(nt,{label:"Atajo rápido",value:"__quick_placeholder__",onChange:Ee=>Wt(Ee),options:[{label:"— Atajo rápido —",value:"__quick_placeholder__"},{label:"Campo = true",value:"eq:true"},{label:"Campo = false",value:"eq:false"},{label:"Campo = '' (vacío)",value:"eq:empty"}],size:"sm",reserveErrorSpace:!1}),l.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[l.jsx(le,{size:"sm",variant:"outline",onClick:kt,title:"Copiar JSON",children:"Copiar"}),l.jsx(le,{size:"sm",variant:"outline",onClick:Jt,title:"Pegar JSON",children:"Pegar"}),l.jsx(le,{size:"sm",variant:"outline",onClick:js,title:"Borrar regla",children:"Borrar"})]}),l.jsx("div",{className:Ne?"":"opacity-60 pointer-events-none",children:l.jsx(jm,{value:K.rule,fieldOptions:x,onChange:Ee=>it(Ee)})}),l.jsx("div",{className:`rounded p-2 bg-[var(--color-ds-background-surface)] border ${tc}`,children:l.jsx("pre",{className:"m-0 text-[11px] leading-snug whitespace-pre-wrap break-all text-[var(--color-ds-text-primary)]",children:Ie||"—"})}),te&&l.jsx(je,{label:"clearTo",value:K.clearTo??"",onChange:Ee=>pt(Ee.target.value)})]})};if(t.kind==="tab"){const R=Rm(e,t.tabKey);if(!R)return l.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Pestaña no encontrada."});const{tab:P}=R,[te,K]=b.useState(P.label??"");return b.useEffect(()=>{K(P.label??"")},[P.label]),l.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector de pestaña"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(t.tabKey,"left"),children:"← Mover"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>u(t.tabKey,"right"),children:"Mover →"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>i(t.tabKey),children:"+ Pestaña a la derecha"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>c(t.tabKey),children:"Eliminar pestaña"})]})]}),l.jsx(ct,{title:"Identidad",type:"plain",defaultOpen:!0,children:l.jsx("div",{className:"grid gap-2",children:l.jsx(je,{size:"sm",label:"Label de la pestaña",value:te,onChange:Ne=>K(Ne.target.value),onBlur:()=>d(t.tabKey,te)})})}),l.jsx(ct,{title:"Estructura",type:"plain",defaultOpen:!0,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(le,{size:"sm",variant:"outline",onClick:()=>f(t.tabKey),children:"+ Añadir sección"}),l.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Esta acción agrega una sección con una fila y una columna vacía dentro de la pestaña."})]})}),l.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Selecciona una sección o un campo para ver sus propiedades específicas."})]})}if(t.kind!=="field")return l.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Selecciona un campo o una pestaña…"});if(!m)return l.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Campo no encontrado."});const A=R=>{s(m.name,P=>{var Ne;const te=(Ne=P.validation)==null?void 0:Ne.pattern;if(R==="none"){P.validation={...P.validation??{},pattern:void 0};return}const K=R==="email"?/^[^\s@]+@[^\s@]+\.[^\s@]+$/:/^\+?\d{7,15}$/;P.validation={...P.validation??{},pattern:{value:K,message:(te==null?void 0:te.message)||(R==="email"?"Email inválido":"Teléfono inválido")}}}),h(R==="none"?"Patrón eliminado":"Patrón aplicado","info")};return l.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(le,{size:"sm",variant:"outline",onClick:()=>a(m.name,`${m.name}`),children:"Duplicar"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>r(m.name),children:"Eliminar"})]})]}),l.jsxs(ct,{title:"Identidad",type:"plain",defaultOpen:!0,children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(je,{size:"sm",label:"Name",value:m.name??"",onChange:R=>n(m.name,R.target.value)}),l.jsx(je,{size:"sm",label:"Label",value:m.label??"",onChange:R=>s(m.name,P=>{P.label=R.target.value})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(nt,{label:"Tipo",value:m.type,onChange:R=>g(m.name,R),options:Nm}),l.jsx(je,{size:"sm",label:"Info (tooltip/ayuda)",value:m.info??"",onChange:R=>s(m.name,P=>{P.info=R.target.value})})]})]}),l.jsx(ct,{title:"Layout",type:"plain",defaultOpen:!0,children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(nt,{label:"Width",value:m.width??"",onChange:R=>s(m.name,P=>{P.width=R}),options:[{label:"— custom —",value:""},...km.map(R=>({label:R,value:R}))]}),l.jsx(nt,{label:"Size",value:m.size??"sm",onChange:R=>s(m.name,P=>{P.size=R}),options:Sm.map(R=>({label:R,value:R}))}),!["checkbox","file"].includes(m.type)&&l.jsx(je,{size:"sm",label:"Placeholder",value:m.placeholder??"",onChange:R=>s(m.name,P=>{P.placeholder=R.target.value})})]})}),y&&l.jsxs(ct,{title:"Select",type:"plain",defaultOpen:!0,children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(nt,{label:"Option source (registry key)",value:m.optionSource??"",onChange:R=>s(m.name,P=>{P.optionSource=R||void 0,P.optionSource&&(delete P.options,delete P.loadOptions)}),options:N}),l.jsx(je,{size:"sm",label:"Contexto (JSON) para adapter (opcional)",placeholder:'{"cifOrga":"A12345678","tipoContrato":"OB"}',value:E,onChange:R=>Z(R.target.value)}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(le,{size:"sm",variant:"outline",onClick:se,disabled:_||!C.length,children:_?"Cargando…":"Cargar opciones"}),!!D.length&&l.jsx(le,{size:"sm",variant:"outline",onClick:q,title:"Copiar vista previa a options",children:"Aplicar al campo"})]}),z&&l.jsx("div",{className:"text-xs text-[var(--color-ds-text-primary)]",children:z}),!!D.length&&l.jsxs("div",{className:"rounded border p-2 max-h-40 overflow-auto border-[var(--color-ds-border-default-50)]",children:[l.jsxs("div",{className:"text-[11px] mb-1 opacity-70",children:["Vista previa (",D.length,"):"]}),l.jsxs("ul",{className:"text-[12px] space-y-1",children:[D.slice(0,50).map((R,P)=>l.jsxs("li",{children:[l.jsx("code",{className:"opacity-70",children:R.value})," — ",R.label]},`${R.value}-${P}`)),D.length>50&&l.jsx("li",{className:"opacity-60 text-[11px]",children:"… (truncado)"})]})]})]}),l.jsxs("div",{className:"pt-2 space-y-2",children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)]",children:"Opciones estáticas (se ignoran si defines optionSource)"}),(m.options??[]).map((R,P)=>l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(je,{size:"sm",label:"Etiqueta",value:R.label??"",onChange:te=>s(m.name,K=>{const Ne=Array.isArray(K.options)?[...K.options]:[];Ne[P]={...Ne[P],label:te.target.value},K.options=Ne})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{size:"sm",label:"Valor",value:R.value??"",onChange:te=>s(m.name,K=>{const Ne=Array.isArray(K.options)?[...K.options]:[];Ne[P]={...Ne[P],value:te.target.value},K.options=Ne})}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>s(m.name,te=>{const K=Array.isArray(te.options)?[...te.options]:[];K.splice(P,1),te.options=K}),"aria-label":"Eliminar opción",title:"Eliminar opción",children:"✕"})]})]},P)),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>s(m.name,R=>{const P=Array.isArray(R.options)?[...R.options]:[];P.push({label:"Opción",value:`opt_${P.length+1}`}),R.options=P}),children:"+ Añadir opción"})]}),l.jsx("div",{className:"pt-2",children:l.jsx(ft,{size:"sm",label:"Múltiple",checked:!!m.multiple,onChange:R=>s(m.name,P=>{P.multiple=R})})})]}),w&&l.jsxs(ct,{title:"Textarea",type:"plain",defaultOpen:!0,children:[l.jsx(je,{size:"sm",type:"number",label:"Máx. caracteres",value:m.maxLength??"",onChange:R=>s(m.name,P=>{const te=R.target.value;P.maxLength=te?Number(te):void 0}),className:"w-32"}),l.jsx(ft,{size:"sm",label:"Mostrar contador",checked:!!m.showCounter,onChange:R=>s(m.name,P=>{P.showCounter=R})})]}),O&&l.jsxs(ct,{title:"Archivo",type:"plain",defaultOpen:!0,children:[l.jsx(je,{size:"sm",label:"Extensiones permitidas (accept)",placeholder:".pdf,.jpg",value:m.accept??"",onChange:R=>s(m.name,P=>{P.accept=R.target.value})}),l.jsx(je,{size:"sm",type:"number",label:"Máx. ficheros",value:m.maxFiles??"",onChange:R=>s(m.name,P=>{const te=R.target.value;P.maxFiles=te?Number(te):void 0}),className:"w-32"})]}),S&&l.jsx(ct,{title:"Fecha",type:"plain",defaultOpen:!0,children:l.jsx(ft,{size:"sm",label:"Incluir hora",checked:!!m.showTime,onChange:R=>s(m.name,P=>{P.showTime=R})})}),l.jsx(ct,{title:"Reglas",type:"plain",defaultOpen:!0,children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ae,{title:"visibleWhen",fieldKey:"visibleWhen"}),l.jsx(ae,{title:"disabledWhen",fieldKey:"disabledWhen"}),l.jsx(ae,{title:"clearWhen",fieldKey:"clearWhen",showClearTo:!0})]})}),l.jsxs(ct,{title:"Validación",type:"plain",defaultOpen:!0,children:[l.jsx(ft,{size:"sm",label:"Requerido",checked:!!((j=m.validation)!=null&&j.required),onChange:R=>s(m.name,P=>{P.validation={...P.validation??{},required:R}})}),l.jsx("div",{className:"grid gap-2",children:l.jsx(nt,{label:"Preset de patrón",value:"__none__",onChange:R=>A(R==="email"?"email":R==="phone"?"phone":"none"),options:[{label:"— ninguno —",value:"__none__"},{label:"Email básico",value:"email"},{label:"Teléfono (+999…)",value:"phone"}],size:"sm",reserveErrorSpace:!1})}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"minLength"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{type:"number",value:((B=(V=m.validation)==null?void 0:V.minLength)==null?void 0:B.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},minLength:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.minLength)==null?void 0:K.message)??"Muy corto"}:void 0}}),className:"w-24"}),l.jsx(je,{placeholder:"mensaje",value:((Q=(W=m.validation)==null?void 0:W.minLength)==null?void 0:Q.message)??"",onChange:R=>s(m.name,P=>{var K;const te=(K=P.validation)==null?void 0:K.minLength;P.validation={...P.validation??{},minLength:te?{...te,message:R.target.value}:{value:0,message:R.target.value}}})})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"maxLength"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{type:"number",value:((J=(M=m.validation)==null?void 0:M.maxLength)==null?void 0:J.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},maxLength:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.maxLength)==null?void 0:K.message)??"Muy largo"}:void 0}}),className:"w-24"}),l.jsx(je,{placeholder:"mensaje",value:((ge=(he=m.validation)==null?void 0:he.maxLength)==null?void 0:ge.message)??"",onChange:R=>s(m.name,P=>{var K;const te=(K=P.validation)==null?void 0:K.maxLength;P.validation={...P.validation??{},maxLength:te?{...te,message:R.target.value}:{value:0,message:R.target.value}}})})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"pattern (RegExp)"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{placeholder:"^\\\\d+$",value:((be=(Se=(de=m.validation)==null?void 0:de.pattern)==null?void 0:Se.value)==null?void 0:be.source)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},pattern:R.target.value?{value:new RegExp(R.target.value),message:((K=(te=P.validation)==null?void 0:te.pattern)==null?void 0:K.message)??"Formato inválido"}:void 0}})}),l.jsx(je,{placeholder:"mensaje",value:((fe=(pe=m.validation)==null?void 0:pe.pattern)==null?void 0:fe.message)??"",onChange:R=>s(m.name,P=>{var K;const te=(K=P.validation)==null?void 0:K.pattern;P.validation={...P.validation??{},pattern:te?{...te,message:R.target.value}:{value:/.*/,message:R.target.value}}})})]})]})]}),T&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Número"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{type:"number",label:"min",className:"w-28",value:((we=(me=m.validation)==null?void 0:me.numberMin)==null?void 0:we.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},numberMin:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.numberMin)==null?void 0:K.message)??"Demasiado pequeño"}:void 0}})}),l.jsx(je,{type:"number",label:"max",className:"w-28",value:((Ce=(ce=m.validation)==null?void 0:ce.numberMax)==null?void 0:Ce.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},numberMax:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.numberMax)==null?void 0:K.message)??"Demasiado grande"}:void 0}})}),l.jsx(je,{type:"number",label:"step",className:"w-28",value:((k=(Te=m.validation)==null?void 0:Te.step)==null?void 0:k.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},step:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.step)==null?void 0:K.message)??"Incremento inválido"}:void 0}})})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsx(ft,{size:"sm",label:"Solo enteros",checked:!!((L=(F=m.validation)==null?void 0:F.integerOnly)!=null&&L.value),onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},integerOnly:R?{value:!0,message:((K=(te=P.validation)==null?void 0:te.integerOnly)==null?void 0:K.message)??"Debe ser entero"}:void 0}})}),l.jsx(ft,{size:"sm",label:"Solo positivos",checked:!!((Y=(ee=m.validation)==null?void 0:ee.positiveOnly)!=null&&Y.value),onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},positiveOnly:R?{value:!0,message:((K=(te=P.validation)==null?void 0:te.positiveOnly)==null?void 0:K.message)??"Debe ser positivo"}:void 0}})})]})]}),y&&m.multiple&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Select (múltiple)"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(je,{type:"number",label:"mín. seleccionados",className:"w-40",value:((ue=(G=m.validation)==null?void 0:G.selectMin)==null?void 0:ue.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},selectMin:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.selectMin)==null?void 0:K.message)??"Selecciona más opciones"}:void 0}})}),l.jsx(je,{type:"number",label:"máx. seleccionados",className:"w-40",value:((ke=(ve=m.validation)==null?void 0:ve.selectMax)==null?void 0:ke.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},selectMax:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.selectMax)==null?void 0:K.message)??"Demasiadas opciones"}:void 0}})})]})]}),S&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Fecha"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Ms,{size:"sm",label:"minDate",className:"w-44",showTime:!!m.showTime,defaultValue:((wt=(_e=m.validation)==null?void 0:_e.dateMin)==null?void 0:wt.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},dateMin:R.target.value?{value:R.target.value,message:((K=(te=P.validation)==null?void 0:te.dateMin)==null?void 0:K.message)??"Demasiado antigua"}:void 0}})}),l.jsx(Ms,{size:"sm",label:"maxDate",className:"w-44",showTime:!!m.showTime,defaultValue:((Kt=(Me=m.validation)==null?void 0:Me.dateMax)==null?void 0:Kt.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},dateMax:R.target.value?{value:R.target.value,message:((K=(te=P.validation)==null?void 0:te.dateMax)==null?void 0:K.message)??"Demasiado futura"}:void 0}})})]}),l.jsxs("div",{className:"flex gap-4",children:[l.jsx(ft,{size:"sm",label:"No permitir pasado",checked:!!(($t=(Dt=m.validation)==null?void 0:Dt.disallowPast)!=null&&$t.value),onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},disallowPast:R?{value:!0,message:((K=(te=P.validation)==null?void 0:te.disallowPast)==null?void 0:K.message)??"No se permiten fechas pasadas"}:void 0}})}),l.jsx(ft,{size:"sm",label:"No permitir futuro",checked:!!((Mt=(Lt=m.validation)==null?void 0:Lt.disallowFuture)!=null&&Mt.value),onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},disallowFuture:R?{value:!0,message:((K=(te=P.validation)==null?void 0:te.disallowFuture)==null?void 0:K.message)??"No se permiten fechas futuras"}:void 0}})})]})]}),O&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Archivo"}),l.jsx(je,{type:"number",label:"Tamaño máx. por archivo (MB)",className:"w-56",value:((Pt=(as=m.validation)==null?void 0:as.fileMaxSizeMB)==null?void 0:Pt.value)??"",onChange:R=>s(m.name,P=>{var te,K;P.validation={...P.validation??{},fileMaxSizeMB:R.target.value?{value:Number(R.target.value),message:((K=(te=P.validation)==null?void 0:te.fileMaxSizeMB)==null?void 0:K.message)??"Archivo demasiado grande"}:void 0}})})]})]})]})}function Dm(t){return typeof t.type=="string"}function $m(t){const e=t.validation;return e===void 0||typeof e=="object"}function Lm(t){const e=t.options;return Array.isArray(e)}function Mm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Vt(t){return String(t).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function Pm(t){var a,o,i,c,d;const e=Dm(t)&&t.type?t.type:"string";let s="yup.string()";switch(e){case"number":s="yup.number()";break;case"checkbox":s="yup.boolean()";break;case"date":s="yup.date().nullable()";break;case"file":s="yup.array()";break;case"select":case"text":case"email":case"password":case"textarea":default:s="yup.string()";break}const r=$m(t)&&t.validation?t.validation:{},n=[s];if(r.required){const u=typeof r.required=="string"?r.required:r.requiredMessage||"Requerido";n.push(`.required(\`${Vt(u)}\`)`)}if(((a=r.minLength)==null?void 0:a.value)!=null&&n.push(`.min(${Number(r.minLength.value)}, \`${Vt(r.minLength.message??"Muy corto")}\`)`),((o=r.maxLength)==null?void 0:o.value)!=null&&n.push(`.max(${Number(r.maxLength.value)}, \`${Vt(r.maxLength.message??"Muy largo")}\`)`),(i=r.pattern)!=null&&i.value&&Mm(r.pattern.value)){const u=r.pattern.value.source,f=r.pattern.value.flags||"";n.push(`.matches(new RegExp(\`${Vt(u)}\`, \`${Vt(f)}\`), \`${Vt(r.pattern.message??"Formato inválido")}\`)`)}if(e==="number"&&(((c=r.min)==null?void 0:c.value)!=null&&n.push(`.min(${Number(r.min.value)}, \`${Vt(r.min.message??"Demasiado pequeño")}\`)`),((d=r.max)==null?void 0:d.value)!=null&&n.push(`.max(${Number(r.max.value)}, \`${Vt(r.max.message??"Demasiado grande")}\`)`)),e==="select"&&Lm(t)&&t.options&&t.options.length){const u=t.options.map(f=>JSON.stringify(String(f.value)));n.push(`.oneOf([${u.join(", ")}])`)}return n.join("")}function Im(t,e="validationSchema"){const s=[],r=t.fields??[];for(const o of r){const i=o;!i.name||typeof i.name!="string"||s.push(` ${i.name}: ${Pm(i)},`)}const n=s.join(`
65
+ `},If={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Vf(e){let{announcements:t=If,container:r,hiddenTextDescribedById:s,screenReaderInstructions:n=zf}=e;const{announce:a,announcement:i}=$f(),l=Us("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),Lf(b.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:h}=f;t.onDragMove&&a(t.onDragMove({active:p,over:h}))},onDragOver(f){let{active:p,over:h}=f;a(t.onDragOver({active:p,over:h}))},onDragEnd(f){let{active:p,over:h}=f;a(t.onDragEnd({active:p,over:h}))},onDragCancel(f){let{active:p,over:h}=f;a(t.onDragCancel({active:p,over:h}))}}),[a,t])),!c)return null;const u=b.createElement(b.Fragment,null,b.createElement(Df,{id:s,value:n.draggable}),b.createElement(Mf,{id:l,announcement:i}));return r?Jt.createPortal(u,r):u}var Ve;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ve||(Ve={}));function Fs(){}function fo(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Bf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const xt=Object.freeze({x:0,y:0});function Uf(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qf(e,t){const r=_s(e);if(!r)return"0 0";const s={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function Wf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return r-s}function Kf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return s-r}function Gf(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function mo(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Jf=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=mo(t,t.left,t.top),a=[];for(const i of s){const{id:l}=i,c=r.get(l);if(c){const d=Uf(mo(c),n);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(Wf)};function Zf(e,t){const r=Math.max(t.top,e.top),s=Math.max(t.left,e.left),n=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=n-s,l=a-r;if(s<n&&r<a){const c=t.width*t.height,d=e.width*e.height,u=i*l,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const al=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=[];for(const a of s){const{id:i}=a,l=r.get(i);if(l){const c=Zf(l,t);c>0&&n.push({id:i,data:{droppableContainer:a,value:c}})}}return n.sort(Kf)};function Yf(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function ol(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xt}function Hf(e){return function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return n.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Xf=Hf(1);function il(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Qf(e,t,r){const s=il(t);if(!s)return e;const{scaleX:n,scaleY:a,x:i,y:l}=s,c=e.left-i-(1-n)*parseFloat(r),d=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),u=n?e.width/n:e.width,f=a?e.height/a:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const em={ignoreTransform:!1};function Wr(e,t){t===void 0&&(t=em);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=Ye(e).getComputedStyle(e);d&&(r=Qf(r,d,u))}const{top:s,left:n,width:a,height:i,bottom:l,right:c}=r;return{top:s,left:n,width:a,height:i,bottom:l,right:c}}function ho(e){return Wr(e,{ignoreTransform:!0})}function tm(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function rm(e,t){return t===void 0&&(t=Ye(e).getComputedStyle(e)),t.position==="fixed"}function sm(e,t){t===void 0&&(t=Ye(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(n=>{const a=t[n];return typeof a=="string"?r.test(a):!1})}function aa(e,t){const r=[];function s(n){if(t!=null&&r.length>=t||!n)return r;if(sa(n)&&n.scrollingElement!=null&&!r.includes(n.scrollingElement))return r.push(n.scrollingElement),r;if(!Ur(n)||rl(n)||r.includes(n))return r;const a=Ye(e).getComputedStyle(n);return n!==e&&sm(n,a)&&r.push(n),rm(n,a)?r:s(n.parentNode)}return e?s(e):r}function ll(e){const[t]=aa(e,1);return t??null}function dn(e){return!Vs||!e?null:br(e)?e:ra(e)?sa(e)||e===gr(e).scrollingElement?window:Ur(e)?e:null:null}function cl(e){return br(e)?e.scrollX:e.scrollLeft}function dl(e){return br(e)?e.scrollY:e.scrollTop}function Ln(e){return{x:cl(e),y:dl(e)}}var Be;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Be||(Be={}));function ul(e){return!Vs||!e?!1:e===document.scrollingElement}function fl(e){const t={x:0,y:0},r=ul(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},n=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:n,isLeft:a,isBottom:i,isRight:l,maxScroll:s,minScroll:t}}const nm={x:.2,y:.2};function am(e,t,r,s,n){let{top:a,left:i,right:l,bottom:c}=r;s===void 0&&(s=10),n===void 0&&(n=nm);const{isTop:d,isBottom:u,isLeft:f,isRight:p}=fl(e),h={x:0,y:0},g={x:0,y:0},x={height:t.height*n.y,width:t.width*n.x};return!d&&a<=t.top+x.height?(h.y=Be.Backward,g.y=s*Math.abs((t.top+x.height-a)/x.height)):!u&&c>=t.bottom-x.height&&(h.y=Be.Forward,g.y=s*Math.abs((t.bottom-x.height-c)/x.height)),!p&&l>=t.right-x.width?(h.x=Be.Forward,g.x=s*Math.abs((t.right-x.width-l)/x.width)):!f&&i<=t.left+x.width&&(h.x=Be.Backward,g.x=s*Math.abs((t.left+x.width-i)/x.width)),{direction:h,speed:g}}function om(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:s,bottom:n}=e.getBoundingClientRect();return{top:t,left:r,right:s,bottom:n,width:e.clientWidth,height:e.clientHeight}}function ml(e){return e.reduce((t,r)=>ur(t,Ln(r)),xt)}function im(e){return e.reduce((t,r)=>t+cl(r),0)}function lm(e){return e.reduce((t,r)=>t+dl(r),0)}function hl(e,t){if(t===void 0&&(t=Wr),!e)return;const{top:r,left:s,bottom:n,right:a}=t(e);ll(e)&&(n<=0||a<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const cm=[["x",["left","right"],im],["y",["top","bottom"],lm]];class oa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=aa(r),n=ml(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of cm)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(s),u=n[a]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ar{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=t}add(t,r,s){var n;(n=this.target)==null||n.addEventListener(t,r,s),this.listeners.push([t,r,s])}}function dm(e){const{EventTarget:t}=Ye(e);return e instanceof t?e:gr(e)}function un(e,t){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+s**2)>t:"x"in t&&"y"in t?r>t.x&&s>t.y:"x"in t?r>t.x:"y"in t?s>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function po(e){e.preventDefault()}function um(e){e.stopPropagation()}var Ae;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ae||(Ae={}));const pl={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},fm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ae.Right:return{...r,x:r.x+25};case Ae.Left:return{...r,x:r.x-25};case Ae.Down:return{...r,y:r.y+25};case Ae.Up:return{...r,y:r.y-25}}};class ia{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Ar(gr(r)),this.windowListeners=new Ar(Ye(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,s=t.node.current;s&&hl(s),r(xt)}handleKeyDown(t){if(na(t)){const{active:r,context:s,options:n}=this.props,{keyboardCodes:a=pl,coordinateGetter:i=fm,scrollBehavior:l="smooth"}=n,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=s.current,u=d?{x:d.left,y:d.top}:xt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=i(t,{active:r,context:s.current,currentCoordinates:u});if(f){const p=Ts(f,u),h={x:0,y:0},{scrollableAncestors:g}=s.current;for(const x of g){const v=t.code,{isTop:m,isRight:w,isLeft:y,isBottom:T,maxScroll:N,minScroll:_}=fl(x),A=om(x),S={x:Math.min(v===Ae.Right?A.right-A.width/2:A.right,Math.max(v===Ae.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(v===Ae.Down?A.bottom-A.height/2:A.bottom,Math.max(v===Ae.Down?A.top:A.top+A.height/2,f.y))},$=v===Ae.Right&&!w||v===Ae.Left&&!y,V=v===Ae.Down&&!T||v===Ae.Up&&!m;if($&&S.x!==f.x){const z=x.scrollLeft+p.x,q=v===Ae.Right&&z<=N.x||v===Ae.Left&&z>=_.x;if(q&&!p.y){x.scrollTo({left:z,behavior:l});return}q?h.x=x.scrollLeft-z:h.x=v===Ae.Right?x.scrollLeft-N.x:x.scrollLeft-_.x,h.x&&x.scrollBy({left:-h.x,behavior:l});break}else if(V&&S.y!==f.y){const z=x.scrollTop+p.y,q=v===Ae.Down&&z<=N.y||v===Ae.Up&&z>=_.y;if(q&&!p.x){x.scrollTo({top:z,behavior:l});return}q?h.y=x.scrollTop-z:h.y=v===Ae.Down?x.scrollTop-N.y:x.scrollTop-_.y,h.y&&x.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ur(Ts(f,this.referenceCoordinates),h))}}}handleMove(t,r){const{onMove:s}=this.props;t.preventDefault(),s(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ia.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:s=pl,onActivation:n}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(s.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0)}return!1}}];function bo(e){return!!(e&&"distance"in e)}function go(e){return!!(e&&"delay"in e)}class la{constructor(t,r,s){var n;s===void 0&&(s=dm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=gr(i),this.documentListeners=new Ar(this.document),this.listeners=new Ar(s),this.windowListeners=new Ar(Ye(i)),this.initialCoordinates=(n=_s(a))!=null?n:xt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,po),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,po),this.documentListeners.add(ut.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(go(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(bo(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:s,onPending:n}=this.props;n(s,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,um,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:s,initialCoordinates:n,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!n)return;const c=(r=_s(t))!=null?r:xt,d=Ts(n,c);if(!s&&l){if(bo(l)){if(l.tolerance!=null&&un(d,l.tolerance))return this.handleCancel();if(un(d,l.distance))return this.handleStart()}if(go(l)&&un(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ae.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const mm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ca extends la{constructor(t){const{event:r}=t,s=gr(r.target);super(t,mm,s)}}ca.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const hm={move:{name:"mousemove"},end:{name:"mouseup"}};var Pn;(function(e){e[e.RightClick=2]="RightClick"})(Pn||(Pn={}));class pm extends la{constructor(t){super(t,hm,gr(t.event.target))}}pm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return r.button===Pn.RightClick?!1:(s==null||s({event:r}),!0)}}];const fn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class bm extends la{constructor(t){super(t,fn)}static setup(){return window.addEventListener(fn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fn.move.name,t)};function t(){}}}bm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;const{touches:n}=r;return n.length>1?!1:(s==null||s({event:r}),!0)}}];var Tr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tr||(Tr={}));var Os;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Os||(Os={}));function gm(e){let{acceleration:t,activator:r=Tr.Pointer,canScroll:s,draggingRect:n,enabled:a,interval:i=5,order:l=Os.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:p}=e;const h=vm({delta:f,disabled:!a}),[g,x]=Tf(),v=b.useRef({x:0,y:0}),m=b.useRef({x:0,y:0}),w=b.useMemo(()=>{switch(r){case Tr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tr.DraggableRect:return n}},[r,n,c]),y=b.useRef(null),T=b.useCallback(()=>{const _=y.current;if(!_)return;const A=v.current.x*m.current.x,S=v.current.y*m.current.y;_.scrollBy(A,S)},[]),N=b.useMemo(()=>l===Os.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!a||!d.length||!w){x();return}for(const _ of N){if((s==null?void 0:s(_))===!1)continue;const A=d.indexOf(_),S=u[A];if(!S)continue;const{direction:$,speed:V}=am(_,S,w,t,p);for(const z of["x","y"])h[z][$[z]]||(V[z]=0,$[z]=0);if(V.x>0||V.y>0){x(),y.current=_,g(T,i),v.current=V,m.current=$;return}}v.current={x:0,y:0},m.current={x:0,y:0},x()},[t,T,s,x,a,i,JSON.stringify(w),JSON.stringify(h),g,d,N,u,JSON.stringify(p)])}const xm={x:{[Be.Backward]:!1,[Be.Forward]:!1},y:{[Be.Backward]:!1,[Be.Forward]:!1}};function vm(e){let{delta:t,disabled:r}=e;const s=As(t);return qr(n=>{if(r||!s||!n)return xm;const a={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Be.Backward]:n.x[Be.Backward]||a.x===-1,[Be.Forward]:n.x[Be.Forward]||a.x===1},y:{[Be.Backward]:n.y[Be.Backward]||a.y===-1,[Be.Forward]:n.y[Be.Forward]||a.y===1}}},[r,t,s])}function ym(e,t){const r=t!=null?e.get(t):void 0,s=r?r.node.current:null;return qr(n=>{var a;return t==null?null:(a=s??n)!=null?a:null},[s,t])}function wm(e,t){return b.useMemo(()=>e.reduce((r,s)=>{const{sensor:n}=s,a=n.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...r,...a]},[]),[e,t])}var $r;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})($r||($r={}));var zn;(function(e){e.Optimized="optimized"})(zn||(zn={}));const xo=new Map;function jm(e,t){let{dragging:r,dependencies:s,config:n}=t;const[a,i]=b.useState(null),{frequency:l,measure:c,strategy:d}=n,u=b.useRef(e),f=v(),p=Dr(f),h=b.useCallback(function(m){m===void 0&&(m=[]),!p.current&&i(w=>w===null?m:w.concat(m.filter(y=>!w.includes(y))))},[p]),g=b.useRef(null),x=qr(m=>{if(f&&!r)return xo;if(!m||m===xo||u.current!==e||a!=null){const w=new Map;for(let y of e){if(!y)continue;if(a&&a.length>0&&!a.includes(y.id)&&y.rect.current){w.set(y.id,y.rect.current);continue}const T=y.node.current,N=T?new oa(c(T),T):null;y.rect.current=N,N&&w.set(y.id,N)}return w}return m},[e,a,r,f,c]);return b.useEffect(()=>{u.current=e},[e]),b.useEffect(()=>{f||h()},[r,f]),b.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),b.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{h(),g.current=null},l))},[l,f,h,...s]),{droppableRects:x,measureDroppableContainers:h,measuringScheduled:a!=null};function v(){switch(d){case $r.Always:return!1;case $r.BeforeDragging:return r;default:return!r}}}function da(e,t){return qr(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function km(e,t){return da(e,t)}function Nm(e){let{callback:t,disabled:r}=e;const s=Bs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function qs(e){let{callback:t,disabled:r}=e;const s=Bs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function Sm(e){return new oa(Wr(e),e)}function vo(e,t,r){t===void 0&&(t=Sm);const[s,n]=b.useState(null);function a(){n(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const i=Nm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=qs({callback:a});return _t(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),s}function Em(e){const t=da(e);return ol(e,t)}const yo=[];function Cm(e){const t=b.useRef(e),r=qr(s=>e?s&&s!==yo&&e&&t.current&&e.parentNode===t.current.parentNode?s:aa(e):yo,[e]);return b.useEffect(()=>{t.current=e},[e]),r}function Am(e){const[t,r]=b.useState(null),s=b.useRef(e),n=b.useCallback(a=>{const i=dn(a.target);i&&r(l=>l?(l.set(i,Ln(i)),new Map(l)):null)},[]);return b.useEffect(()=>{const a=s.current;if(e!==a){i(a);const l=e.map(c=>{const d=dn(c);return d?(d.addEventListener("scroll",n,{passive:!0}),[d,Ln(d)]):null}).filter(c=>c!=null);r(l.length?new Map(l):null),s.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const d=dn(c);d==null||d.removeEventListener("scroll",n)})}},[n,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ur(a,i),xt):ml(e):xt,[e,t])}function wo(e,t){t===void 0&&(t=[]);const r=b.useRef(null);return b.useEffect(()=>{r.current=null},t),b.useEffect(()=>{const s=e!==xt;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?Ts(e,r.current):xt}function Tm(e){b.useEffect(()=>{if(!Vs)return;const t=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function _m(e,t){return b.useMemo(()=>e.reduce((r,s)=>{let{eventName:n,handler:a}=s;return r[n]=i=>{a(i,t)},r},{}),[e,t])}function bl(e){return b.useMemo(()=>e?tm(e):null,[e])}const jo=[];function Fm(e,t){t===void 0&&(t=Wr);const[r]=e,s=bl(r?Ye(r):null),[n,a]=b.useState(jo);function i(){a(()=>e.length?e.map(c=>ul(c)?s:new oa(t(c),c)):jo)}const l=qs({callback:i});return _t(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),n}function gl(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ur(t)?t:e}function Om(e){let{measure:t}=e;const[r,s]=b.useState(null),n=b.useCallback(d=>{for(const{target:u}of d)if(Ur(u)){s(f=>{const p=t(u);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=qs({callback:n}),i=b.useCallback(d=>{const u=gl(d);a==null||a.disconnect(),u&&(a==null||a.observe(u)),s(u?t(u):null)},[t,a]),[l,c]=Cs(i);return b.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const Rm=[{sensor:ca,options:{}},{sensor:ia,options:{}}],Dm={current:{}},bs={draggable:{measure:ho},droppable:{measure:ho,strategy:$r.WhileDragging,frequency:zn.Optimized},dragOverlay:{measure:Wr}};class _r extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,s;return(r=(s=this.get(t))==null?void 0:s.node.current)!=null?r:void 0}}const Mm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _r,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Fs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bs,measureDroppableContainers:Fs,windowRect:null,measuringScheduled:!1},xl={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Fs,draggableNodes:new Map,over:null,measureDroppableContainers:Fs},Kr=b.createContext(xl),vl=b.createContext(Mm);function $m(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _r}}}function Lm(e,t){switch(t.type){case Ve.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ve.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ve.DragEnd:case Ve.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ve.RegisterDroppable:{const{element:r}=t,{id:s}=r,n=new _r(e.droppable.containers);return n.set(s,r),{...e,droppable:{...e.droppable,containers:n}}}case Ve.SetDroppableDisabled:{const{id:r,key:s,disabled:n}=t,a=e.droppable.containers.get(r);if(!a||s!==a.key)return e;const i=new _r(e.droppable.containers);return i.set(r,{...a,disabled:n}),{...e,droppable:{...e.droppable,containers:i}}}case Ve.UnregisterDroppable:{const{id:r,key:s}=t,n=e.droppable.containers.get(r);if(!n||s!==n.key)return e;const a=new _r(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Pm(e){let{disabled:t}=e;const{active:r,activatorEvent:s,draggableNodes:n}=b.useContext(Kr),a=As(s),i=As(r==null?void 0:r.id);return b.useEffect(()=>{if(!t&&!s&&a&&i!=null){if(!na(a)||document.activeElement===a.target)return;const l=n.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Of(u);if(f){f.focus();break}}})}},[s,t,n,i,a]),null}function yl(e,t){let{transform:r,...s}=t;return e!=null&&e.length?e.reduce((n,a)=>a({transform:n,...s}),r):r}function zm(e){return b.useMemo(()=>({draggable:{...bs.draggable,...e==null?void 0:e.draggable},droppable:{...bs.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bs.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Im(e){let{activeNode:t,measure:r,initialRect:s,config:n=!0}=e;const a=b.useRef(!1),{x:i,y:l}=typeof n=="boolean"?{x:n,y:n}:n;_t(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!s)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=ol(u,s);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=ll(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,s,r])}const Ws=b.createContext({...xt,scaleX:1,scaleY:1});var zt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(zt||(zt={}));const Vm=b.memo(function(t){var r,s,n,a;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:u=Rm,collisionDetection:f=al,measuring:p,modifiers:h,...g}=t;const x=b.useReducer(Lm,void 0,$m),[v,m]=x,[w,y]=Pf(),[T,N]=b.useState(zt.Uninitialized),_=T===zt.Initialized,{draggable:{active:A,nodes:S,translate:$},droppable:{containers:V}}=v,z=A!=null?S.get(A):null,q=b.useRef({initial:null,translated:null}),D=b.useMemo(()=>{var B;return A!=null?{id:A,data:(B=z==null?void 0:z.data)!=null?B:Dm,rect:q}:null},[A,z]),P=b.useRef(null),[E,te]=b.useState(null),[ne,K]=b.useState(null),le=Dr(g,Object.values(g)),C=Us("DndDescribedBy",i),k=b.useMemo(()=>V.getEnabled(),[V]),I=zm(p),{droppableRects:U,measureDroppableContainers:G,measuringScheduled:ee}=jm(k,{dragging:_,dependencies:[$.x,$.y],config:I.droppable}),M=ym(S,A),W=b.useMemo(()=>ne?_s(ne):null,[ne]),me=Q(),be=km(M,I.draggable.measure);Im({activeNode:A!=null?S.get(A):null,config:me.layoutShiftCompensation,initialRect:be,measure:I.draggable.measure});const de=vo(M,I.draggable.measure,be),ke=vo(M?M.parentElement:null),ge=b.useRef({activatorEvent:null,active:null,activeNode:M,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=V.getNodeFor((r=ge.current.over)==null?void 0:r.id),fe=Om({measure:I.dragOverlay.measure}),pe=(s=fe.nodeRef.current)!=null?s:M,ye=_?(n=fe.rect)!=null?n:de:null,ce=!!(fe.nodeRef.current&&fe.rect),Se=Em(ce?null:de),Te=bl(pe?Ye(pe):null),j=Cm(_?he??M:null),F=Fm(j),R=yl(h,{transform:{x:$.x-Se.x,y:$.y-Se.y,scaleX:1,scaleY:1},activatorEvent:ne,active:D,activeNodeRect:de,containerNodeRect:ke,draggingNodeRect:ye,over:ge.current.over,overlayNodeRect:fe.rect,scrollableAncestors:j,scrollableAncestorRects:F,windowRect:Te}),X=W?ur(W,$):null,Y=Am(j),Z=wo(Y),ue=wo(Y,[de]),xe=ur(R,Z),je=ye?Xf(ye,R):null,Fe=D&&je?f({active:D,collisionRect:je,droppableRects:U,droppableContainers:k,pointerCoordinates:X}):null,vt=Gf(Fe,"id"),[Me,Vt]=b.useState(null),Ft=ce?R:ur(R,ue),Ot=Yf(Ft,(a=Me==null?void 0:Me.rect)!=null?a:null,de),Rt=b.useRef(null),Dt=b.useCallback((B,Ne)=>{let{sensor:Le,options:Oe}=Ne;if(P.current==null)return;const He=S.get(P.current);if(!He)return;const We=B.nativeEvent,Ke=new Le({active:P.current,activeNode:He,event:We,options:Oe,context:ge,onAbort(Pe){if(!S.get(Pe))return;const{onDragAbort:at}=le.current,ft={id:Pe};at==null||at(ft),w({type:"onDragAbort",event:ft})},onPending(Pe,yt,at,ft){if(!S.get(Pe))return;const{onDragPending:Ut}=le.current,wt={id:Pe,constraint:yt,initialCoordinates:at,offset:ft};Ut==null||Ut(wt),w({type:"onDragPending",event:wt})},onStart(Pe){const yt=P.current;if(yt==null)return;const at=S.get(yt);if(!at)return;const{onDragStart:ft}=le.current,Bt={activatorEvent:We,active:{id:yt,data:at.data,rect:q}};Jt.unstable_batchedUpdates(()=>{ft==null||ft(Bt),N(zt.Initializing),m({type:Ve.DragStart,initialCoordinates:Pe,active:yt}),w({type:"onDragStart",event:Bt}),te(Rt.current),K(We)})},onMove(Pe){m({type:Ve.DragMove,coordinates:Pe})},onEnd:Ge(Ve.DragEnd),onCancel:Ge(Ve.DragCancel)});Rt.current=Ke;function Ge(Pe){return async function(){const{active:at,collisions:ft,over:Bt,scrollAdjustedTranslate:Ut}=ge.current;let wt=null;if(at&&Ut){const{cancelDrop:qt}=le.current;wt={activatorEvent:We,active:at,collisions:ft,delta:Ut,over:Bt},Pe===Ve.DragEnd&&typeof qt=="function"&&await Promise.resolve(qt(wt))&&(Pe=Ve.DragCancel)}P.current=null,Jt.unstable_batchedUpdates(()=>{m({type:Pe}),N(zt.Uninitialized),Vt(null),te(null),K(null),Rt.current=null;const qt=Pe===Ve.DragEnd?"onDragEnd":"onDragCancel";if(wt){const xr=le.current[qt];xr==null||xr(wt),w({type:qt,event:wt})}})}}},[S]),rr=b.useCallback((B,Ne)=>(Le,Oe)=>{const He=Le.nativeEvent,We=S.get(Oe);if(P.current!==null||!We||He.dndKit||He.defaultPrevented)return;const Ke={active:We};B(Le,Ne.options,Ke)===!0&&(He.dndKit={capturedBy:Ne.sensor},P.current=Oe,Dt(Le,Ne))},[S,Dt]),Mt=wm(u,rr);Tm(u),_t(()=>{de&&T===zt.Initializing&&N(zt.Initialized)},[de,T]),b.useEffect(()=>{const{onDragMove:B}=le.current,{active:Ne,activatorEvent:Le,collisions:Oe,over:He}=ge.current;if(!Ne||!Le)return;const We={active:Ne,activatorEvent:Le,collisions:Oe,delta:{x:xe.x,y:xe.y},over:He};Jt.unstable_batchedUpdates(()=>{B==null||B(We),w({type:"onDragMove",event:We})})},[xe.x,xe.y]),b.useEffect(()=>{const{active:B,activatorEvent:Ne,collisions:Le,droppableContainers:Oe,scrollAdjustedTranslate:He}=ge.current;if(!B||P.current==null||!Ne||!He)return;const{onDragOver:We}=le.current,Ke=Oe.get(vt),Ge=Ke&&Ke.rect.current?{id:Ke.id,rect:Ke.rect.current,data:Ke.data,disabled:Ke.disabled}:null,Pe={active:B,activatorEvent:Ne,collisions:Le,delta:{x:He.x,y:He.y},over:Ge};Jt.unstable_batchedUpdates(()=>{Vt(Ge),We==null||We(Pe),w({type:"onDragOver",event:Pe})})},[vt]),_t(()=>{ge.current={activatorEvent:ne,active:D,activeNode:M,collisionRect:je,collisions:Fe,droppableRects:U,draggableNodes:S,draggingNode:pe,draggingNodeRect:ye,droppableContainers:V,over:Me,scrollableAncestors:j,scrollAdjustedTranslate:xe},q.current={initial:ye,translated:je}},[D,M,Fe,je,S,pe,ye,U,V,Me,j,xe]),gm({...me,delta:$,draggingRect:je,pointerCoordinates:X,scrollableAncestors:j,scrollableAncestorRects:F});const O=b.useMemo(()=>({active:D,activeNode:M,activeNodeRect:de,activatorEvent:ne,collisions:Fe,containerNodeRect:ke,dragOverlay:fe,draggableNodes:S,droppableContainers:V,droppableRects:U,over:Me,measureDroppableContainers:G,scrollableAncestors:j,scrollableAncestorRects:F,measuringConfiguration:I,measuringScheduled:ee,windowRect:Te}),[D,M,de,ne,Fe,ke,fe,S,V,U,Me,G,j,F,I,ee,Te]),L=b.useMemo(()=>({activatorEvent:ne,activators:Mt,active:D,activeNodeRect:de,ariaDescribedById:{draggable:C},dispatch:m,draggableNodes:S,over:Me,measureDroppableContainers:G}),[ne,Mt,D,de,m,C,S,Me,G]);return b.createElement(nl.Provider,{value:y},b.createElement(Kr.Provider,{value:L},b.createElement(vl.Provider,{value:O},b.createElement(Ws.Provider,{value:Ot},d)),b.createElement(Pm,{disabled:(l==null?void 0:l.restoreFocus)===!1})),b.createElement(Vf,{...l,hiddenTextDescribedById:C}));function Q(){const B=(E==null?void 0:E.autoScrollEnabled)===!1,Ne=typeof c=="object"?c.enabled===!1:c===!1,Le=_&&!B&&!Ne;return typeof c=="object"?{...c,enabled:Le}:{enabled:Le}}}),Bm=b.createContext(null),ko="button",Um="Draggable";function Gr(e){let{id:t,data:r,disabled:s=!1,attributes:n}=e;const a=Us(Um),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:p}=b.useContext(Kr),{role:h=ko,roleDescription:g="draggable",tabIndex:x=0}=n??{},v=(c==null?void 0:c.id)===t,m=b.useContext(v?Ws:Bm),[w,y]=Cs(),[T,N]=Cs(),_=_m(i,t),A=Dr(r);_t(()=>(f.set(t,{id:t,key:a,node:w,activatorNode:T,data:A}),()=>{const $=f.get(t);$&&$.key===a&&f.delete(t)}),[f,t]);const S=b.useMemo(()=>({role:h,tabIndex:x,"aria-disabled":s,"aria-pressed":v&&h===ko?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[s,h,x,v,g,u.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:S,isDragging:v,listeners:s?void 0:_,node:w,over:p,setNodeRef:y,setActivatorNodeRef:N,transform:m}}function qm(){return b.useContext(vl)}const Wm="Droppable",Km={timeout:25};function Jr(e){let{data:t,disabled:r=!1,id:s,resizeObserverConfig:n}=e;const a=Us(Wm),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Kr),u=b.useRef({disabled:r}),f=b.useRef(!1),p=b.useRef(null),h=b.useRef(null),{disabled:g,updateMeasurementsFor:x,timeout:v}={...Km,...n},m=Dr(x??s),w=b.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),h.current=null},v)},[v]),y=qs({callback:w,disabled:g||!i}),T=b.useCallback((S,$)=>{y&&($&&(y.unobserve($),f.current=!1),S&&y.observe(S))},[y]),[N,_]=Cs(T),A=Dr(t);return b.useEffect(()=>{!y||!N.current||(y.disconnect(),f.current=!1,y.observe(N.current))},[N,y]),b.useEffect(()=>(l({type:Ve.RegisterDroppable,element:{id:s,key:a,disabled:r,node:N,rect:p,data:A}}),()=>l({type:Ve.UnregisterDroppable,key:a,id:s})),[s]),b.useEffect(()=>{r!==u.current.disabled&&(l({type:Ve.SetDroppableDisabled,id:s,key:a,disabled:r}),u.current.disabled=r)},[s,a,r,l]),{active:i,rect:p,isOver:(c==null?void 0:c.id)===s,node:N,over:c,setNodeRef:_}}function Gm(e){let{animation:t,children:r}=e;const[s,n]=b.useState(null),[a,i]=b.useState(null),l=As(r);return!r&&!s&&l&&n(l),_t(()=>{if(!a)return;const c=s==null?void 0:s.key,d=s==null?void 0:s.props.id;if(c==null||d==null){n(null);return}Promise.resolve(t(d,a)).then(()=>{n(null)})},[t,s,a]),b.createElement(b.Fragment,null,r,s?b.cloneElement(s,{ref:i}):null)}const Jm={x:0,y:0,scaleX:1,scaleY:1};function Zm(e){let{children:t}=e;return b.createElement(Kr.Provider,{value:xl},b.createElement(Ws.Provider,{value:Jm},t))}const Ym={position:"fixed",touchAction:"none"},Hm=e=>na(e)?"transform 250ms ease":void 0,Xm=b.forwardRef((e,t)=>{let{as:r,activatorEvent:s,adjustScale:n,children:a,className:i,rect:l,style:c,transform:d,transition:u=Hm}=e;if(!l)return null;const f=n?d:{...d,scaleX:1,scaleY:1},p={...Ym,width:l.width,height:l.height,top:l.top,left:l.left,transform:Mr.Transform.toString(f),transformOrigin:n&&s?qf(s,l):void 0,transition:typeof u=="function"?u(s):u,...c};return b.createElement(r,{className:i,style:p,ref:t},a)}),Qm=e=>t=>{let{active:r,dragOverlay:s}=t;const n={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[l,c]of Object.entries(a.active))c!==void 0&&(n[l]=r.node.style.getPropertyValue(l),r.node.style.setProperty(l,c));if(a!=null&&a.dragOverlay)for(const[l,c]of Object.entries(a.dragOverlay))c!==void 0&&s.node.style.setProperty(l,c);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&s.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(n))r.node.style.setProperty(c,d);i!=null&&i.active&&r.node.classList.remove(i.active)}},eh=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Mr.Transform.toString(t)},{transform:Mr.Transform.toString(r)}]},th={duration:250,easing:"ease",keyframes:eh,sideEffects:Qm({styles:{active:{opacity:"0"}}})};function rh(e){let{config:t,draggableNodes:r,droppableContainers:s,measuringConfiguration:n}=e;return Bs((a,i)=>{if(t===null)return;const l=r.get(a);if(!l)return;const c=l.node.current;if(!c)return;const d=gl(i);if(!d)return;const{transform:u}=Ye(i).getComputedStyle(i),f=il(u);if(!f)return;const p=typeof t=="function"?t:sh(t);return hl(c,n.draggable.measure),p({active:{id:a,data:l.data,node:c,rect:n.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:i,rect:n.dragOverlay.measure(d)},droppableContainers:s,measuringConfiguration:n,transform:f})})}function sh(e){const{duration:t,easing:r,sideEffects:s,keyframes:n}={...th,...e};return a=>{let{active:i,dragOverlay:l,transform:c,...d}=a;if(!t)return;const u={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},p={x:c.x-u.x,y:c.y-u.y,...f},h=n({...d,active:i,dragOverlay:l,transform:{initial:c,final:p}}),[g]=h,x=h[h.length-1];if(JSON.stringify(g)===JSON.stringify(x))return;const v=s==null?void 0:s({active:i,dragOverlay:l,...d}),m=l.node.animate(h,{duration:t,easing:r,fill:"forwards"});return new Promise(w=>{m.onfinish=()=>{v==null||v(),w()}})}}let No=0;function nh(e){return b.useMemo(()=>{if(e!=null)return No++,No},[e])}const ah=b.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:s,style:n,transition:a,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggableNodes:g,droppableContainers:x,dragOverlay:v,over:m,measuringConfiguration:w,scrollableAncestors:y,scrollableAncestorRects:T,windowRect:N}=qm(),_=b.useContext(Ws),A=nh(f==null?void 0:f.id),S=yl(i,{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:y,scrollableAncestorRects:T,transform:_,windowRect:N}),$=da(p),V=rh({config:s,draggableNodes:g,droppableContainers:x,measuringConfiguration:w}),z=$?v.setRef:void 0;return b.createElement(Zm,null,b.createElement(Gm,{animation:V},f&&A?b.createElement(Xm,{key:A,id:f.id,ref:z,as:l,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:$,style:{zIndex:d,...n},transform:S},r):null))});function oh(){return{label:"Texto",type:"text",width:"w-full md:w-1/2",placeholder:"Escribe…",size:"sm"}}function ih(){return{label:"Número",type:"number",width:"w-full md:w-1/3",placeholder:"0",size:"sm",validation:{required:!1}}}function lh(){return{label:"Email",type:"email",width:"w-full md:w-1/2",placeholder:"usuario@dominio.com",size:"sm"}}function ch(){return{label:"Selecciona una opción",type:"select",width:"w-full md:w-1/3",size:"sm",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}]}}function dh(){return{label:"Aceptar condiciones",type:"checkbox",width:"w-full md:w-1/3",size:"sm",defaultValue:!1}}function uh(){return{label:"Comentario",type:"textarea",width:"w-full",size:"sm",maxLength:300,showCounter:!0,placeholder:"Escribe tu comentario…"}}function fh(){return{label:"Fecha",type:"date",width:"w-full md:w-1/3",size:"sm",showTime:!1}}function mh(){return{label:"Documento",type:"file",width:"w-full md:w-1/2",maxFiles:1,accept:".pdf,.doc,.docx"}}const hh={text:oh,number:ih,email:lh,select:ch,checkbox:dh,textarea:uh,date:fh,file:mh},ph=()=>o.jsx(we,{label:"Texto",placeholder:"Escribe…",size:"sm",reserveErrorSpace:!1}),bh=()=>o.jsx(we,{type:"number",label:"Número",placeholder:"0",size:"sm",reserveErrorSpace:!1}),gh=()=>o.jsx(we,{type:"email",label:"Email",placeholder:"usuario@dominio.com",size:"sm",reserveErrorSpace:!1}),xh=()=>o.jsx(rt,{label:"Select",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}],size:"sm"}),vh=()=>o.jsx(dt,{label:"Aceptar condiciones",defaultValue:!1,name:"__prev_checkbox__"}),yh=()=>o.jsx(Ls,{label:"Comentario",placeholder:"Escribe tu comentario…",size:"sm",maxLength:120,showCounter:!0}),wh=()=>o.jsx(Fr,{label:"Fecha",defaultValue:"",showTime:!1,name:"__prev_date__"}),jh=()=>o.jsxs("div",{children:[o.jsx("label",{className:"text-ds-xs block mb-1 opacity-80",children:"Documento"}),o.jsx("div",{className:"w-full rounded-xl border border-dashed p-4 text-ds-xs opacity-70",children:"Arrastra o selecciona archivo…"})]}),kh=()=>o.jsx("div",{className:"p-2 rounded-md bg-[var(--color-ds-background-page)]",children:o.jsx(Ir,{options:[{label:"Tab 1",value:"t1"},{label:"Tab 2",value:"t2"}],value:"t1",onChange:()=>{},children:{t1:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 1"}),t2:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 2"})}})}),Nh=()=>o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--color-ds-border-default-50)] text-ds-sm",children:"Sección"}),o.jsx("div",{className:"p-3 text-ds-xs opacity-70",children:"Fila con 1 columna (w-full). Modifícala desde el lienzo."})]}),is=[{kind:"text",title:"Texto",category:"basics",renderPreview:o.jsx(ph,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"placeholder"}),", ",o.jsx("code",{children:"size"}),", ",o.jsx("code",{children:"width"}),", ",o.jsx("code",{children:"info"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"required"}),", ",o.jsx("code",{children:"minLength"}),", ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"pattern"})]})]})},{kind:"number",title:"Número",category:"basics",renderPreview:o.jsx(bh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"numberMin"}),", ",o.jsx("code",{children:"numberMax"}),", ",o.jsx("code",{children:"step"}),", ",o.jsx("code",{children:"integerOnly"}),", ",o.jsx("code",{children:"positiveOnly"})]})})},{kind:"email",title:"Email",category:"basics",renderPreview:o.jsx(gh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsx("li",{children:"Preset de patrón disponible"})})},{kind:"select",title:"Select",category:"basics",renderPreview:o.jsx(xh,{}),hint:"Admite optionSource",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Opciones: ",o.jsx("code",{children:"options"})," o ",o.jsx("code",{children:"optionSource"})]}),o.jsxs("li",{children:["Default: ",o.jsx("code",{children:"defaultSource"})]}),o.jsxs("li",{children:["Soporta ",o.jsx("code",{children:"multiple"})," y ",o.jsx("code",{children:"adapterCtx"})]})]})},{kind:"checkbox",title:"Checkbox",category:"basics",renderPreview:o.jsx(vh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Devuelve ",o.jsx("code",{children:"boolean"})]})})},{kind:"date",title:"Fecha",category:"basics",renderPreview:o.jsx(wh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Prop: ",o.jsx("code",{children:"showTime"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"dateMin"}),", ",o.jsx("code",{children:"dateMax"}),", ",o.jsx("code",{children:"disallowPast"}),", ",o.jsx("code",{children:"disallowFuture"})]})]})},{kind:"textarea",title:"Textarea",category:"content",renderPreview:o.jsx(yh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"showCounter"})]})})},{kind:"file",title:"Archivo",category:"content",renderPreview:o.jsx(jh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"accept"}),", ",o.jsx("code",{children:"maxFiles"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"fileMaxSizeMB"})]})]})},{kind:"section-layout",title:"Sección",category:"layout",renderPreview:o.jsx(Nh,{}),isLayout:!0,hint:"Contenedor de layout",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsx("li",{children:"Inserta un bloque de filas/columnas (rows) con una fila vacía."}),o.jsx("li",{children:"Después puedes añadir columnas y colocar campos."})]})},{kind:"tabs-layout",title:"Pestañas",category:"layout",renderPreview:o.jsx(kh,{}),isLayout:!0,hint:"Contenedor de layout (no es un campo)",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Inserta un contenedor de ",o.jsx("code",{children:"tabs"})," en el layout."]}),o.jsx("li",{children:"Cada pestaña contiene sus propias secciones y filas."}),o.jsx("li",{children:"Útil para agrupar campos por temática."})]})}];function wl({title:e,onAdd:t,onInfo:r,dragging:s=!1}){return o.jsxs("div",{className:["hover:text-[var(--color-ds-text-on-accent)] relative",s?"opacity-70":""].join(" "),children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:t,className:["w-full rounded-xl p-2 text-left justify-start","border-dashed ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:ring-[var(--color-ds-border-default)] hover:shadow-sm","cursor-grab active:cursor-grabbing"].join(" "),title:`Añadir ${e}`,"aria-label":`Añadir ${e}`,children:o.jsx("div",{className:"text-ds-sm",children:e})}),o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(Zn,{size:"sm",position:"right",ariaLabel:`Más info de ${e}`,onClick:r,children:o.jsxs("div",{className:"max-w-[240px]",children:["Pulsa para ver un ejemplo y detalles de ",o.jsx("strong",{children:e}),"."]})})})]})}function So({kind:e,title:t,onAdd:r,onInfo:s}){const{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Gr({id:`palette:${e}:${t}`,data:{kind:"palette-field",factoryKind:e}});return o.jsx("div",{ref:i,...n,...a,role:"button","aria-label":`Arrastrar ${t}`,className:"touch-none select-none",children:o.jsx(wl,{title:t,onAdd:r,onInfo:s,dragging:l})})}function Sh(){var x;const e=J(v=>v.addField),t=J(v=>v.addTabsContainerAt),r=J(v=>v.addRowsBlockAt),s=J(v=>v.schema),{show:n}=Vr(),[a,i]=b.useState(""),[l,c]=b.useState(null),d=b.useMemo(()=>is.filter(v=>v.category==="basics"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),u=b.useMemo(()=>is.filter(v=>v.category==="content"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),f=b.useMemo(()=>is.filter(v=>v.category==="layout"&&v.title.toLowerCase().includes(a.toLowerCase())),[a]),p=b.useMemo(()=>is.find(v=>v.kind===l)??null,[l]),h=b.useCallback(v=>{const m=hh[v];if(!m){n("Tipo de campo no soportado.","warning");return}const w=m();e(w),n(`Añadido “${w.label}”. Ahora arrástralo al formulario o usa “Colocar último campo”.`,"success")},[e,n]),g=b.useCallback(v=>{var w;const m=((w=s==null?void 0:s.layout)==null?void 0:w.length)??0;if(v==="section-layout"){typeof r=="function"?(r(m,"Nueva sección"),n("Sección añadida al layout.","success")):n("Acción addRowsBlockAt no disponible en el store.","warning");return}if(v==="tabs-layout"){typeof t=="function"?(t(m),n("Contenedor de pestañas añadido al layout.","success")):n("Acción addTabsContainerAt no disponible en el store.","warning");return}n("Tipo de layout no soportado.","warning")},[(x=s==null?void 0:s.layout)==null?void 0:x.length,r,t,n]);if(p){const v=!!p.isLayout;return o.jsxs("aside",{className:"border-r bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)] flex items-center",children:[o.jsx("h3",{className:"font-semibold text-[1rem] flex-1 truncate",children:p.title}),o.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>c(null),className:"ml-auto",children:"← Volver"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"border border-[var(--color-ds-border-default-50)] p-4 bg-[var(--color-ds-background-surface)]",children:p.renderPreview}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"flex items-center gap-2 justify-center mb-4",children:[o.jsx(ie,{size:"sm",variant:"primary",onClick:()=>v?g(p.kind):h(p.kind),title:"Añadir rápidamente",children:"Añadir al lienzo"}),o.jsx("span",{className:"text-ds-xs opacity-70",children:"o arrástrame al formulario"})]}),o.jsxs("div",{className:"rounded-xl border border-[var(--color-ds-border-default-50)] p-3",children:[o.jsxs("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] mb-2",children:["Acerca de ",o.jsx("strong",{children:p.title})]}),o.jsxs("div",{className:"text-ds-sm space-y-2",children:[p.hint?o.jsx("div",{className:"opacity-80",children:p.hint}):null,p.detail]})]})]})]})]})}return o.jsxs("aside",{className:"bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)]",children:[o.jsx("h3",{className:"font-semibold text-[1rem]",children:"Paleta"}),o.jsxs("p",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm mt-1",children:["Clic en una tarjeta para ",o.jsx("strong",{children:"añadir"})," al catálogo, o ",o.jsx("strong",{children:"arrastra"})," al formulario para colocar. Usa el icono"," ",o.jsx(zo,{className:"inline w-4 h-4 align-[-2px]"})," para ver detalles."]}),o.jsx("div",{className:"mt-3",children:o.jsx(we,{size:"sm",placeholder:"Buscar componente…",value:a,onChange:v=>i(v.target.value),reserveErrorSpace:!1})})]}),o.jsxs("div",{className:"p-4 space-y-6",children:[o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Inputs básicos"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.map(v=>o.jsx(So,{kind:v.kind,title:v.title,onAdd:()=>h(v.kind),onInfo:()=>c(v.kind)},v.kind)),d.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Contenido"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.map(v=>o.jsx(So,{kind:v.kind,title:v.title,onAdd:()=>h(v.kind),onInfo:()=>c(v.kind)},v.kind)),u.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Estructura"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.map(v=>o.jsx(wl,{title:v.title,onAdd:()=>v.isLayout?g(v.kind):h(v.kind),onInfo:()=>c(v.kind)},v.kind)),f.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]})]})]})}function jl(e){const t=e.trim();if(/^(true|false)$/i.test(t))return t.toLowerCase()==="true";const r=Number(t);return!Number.isNaN(r)&&t!==""?r:t}function Eh(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(jl)}function ls(e){return typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):typeof e=="string"?e:""}const mn=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Ch({value:e,onChange:t,fieldOptions:r}){const s=b.useRef(t);b.useEffect(()=>{s.current=t},[t]);const[n,a]=b.useState((e==null?void 0:e.op)??"eq"),[i,l]=b.useState(e&&"field"in e&&typeof e.field=="string"?e.field:""),[c,d]=b.useState(e&&"value"in e?ls(e.value):""),[u,f]=b.useState(e&&"values"in e&&Array.isArray(e.values)?e.values.map(ls).join(","):""),p=(N={})=>{const _=N.op??n,A=N.field??i,S=N.val??c,$=N.vals??u;if(!A)return;if(_==="in"||_==="notIn"){const z=Eh($);return _==="in"?{op:"in",field:A,values:z}:{op:"notIn",field:A,values:z}}const V=S.trim()===""?"":jl(S);return{op:_,field:A,value:V}},h=()=>p({}),g=b.useRef(!1);b.useEffect(()=>{const N=h();if(mn(e,N))return;if(g.current=!0,!e){a("eq"),l(""),d(""),f(""),g.current=!1;return}const _=e.op??"eq";a(_),l("field"in e&&typeof e.field=="string"?e.field:""),_==="in"||_==="notIn"?(f("values"in e&&Array.isArray(e.values)?e.values.map(ls).join(","):""),d("")):(f(""),d("value"in e?ls(e.value):"")),g.current=!1},[e]);const x=b.useRef(void 0),v=b.useRef(null),m=N=>{g.current||N&&(mn(x.current,N)||(x.current=N,s.current(N)))},w=()=>{if(g.current)return;const N=h();N&&(mn(x.current,N)||(v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{x.current=N,s.current(N)},200)))};b.useEffect(()=>()=>{v.current&&window.clearTimeout(v.current)},[]);const y=b.useMemo(()=>[{value:"eq",label:"igual a"},{value:"neq",label:"distinto de"},{value:"in",label:"en lista"},{value:"notIn",label:"no en lista"},{value:"gt",label:"mayor que"},{value:"gte",label:"mayor o igual"},{value:"lt",label:"menor que"},{value:"lte",label:"menor o igual"}],[]),T=b.useMemo(()=>[{label:"— campo —",value:""},...r],[r]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx(rt,{label:"Operador",value:n,onChange:N=>{const _=N;a(_),_==="in"||_==="notIn"?d(""):f(""),m(p({op:_,val:_==="in"||_==="notIn"?"":c,vals:_==="in"||_==="notIn"?u:""}))},options:y,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),o.jsx(rt,{label:"Campo",value:i,onChange:N=>{const _=N;l(_),m(p({field:_}))},options:T,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),n==="in"||n==="notIn"?o.jsx(we,{size:"sm",label:"Valores (coma)",placeholder:"valor1, valor2, ...",value:u,onChange:N=>{f(N.target.value),w()},reserveErrorSpace:!1}):o.jsx(we,{size:"sm",label:"Valor",placeholder:"true/false, 123, texto",value:c,onChange:N=>{d(N.target.value),w()},reserveErrorSpace:!1})]})}const Ah=["w-full","w-1/2","w-1/3","w-2/3","w-1/4","w-3/4","w-full md:w-1/2","w-full md:w-1/3","w-full md:w-1/4"],Th=["sm","md","lg"],_h=[{value:"text",label:"Texto"},{value:"number",label:"Número"},{value:"email",label:"Email"},{value:"password",label:"Password"},{value:"textarea",label:"Textarea"},{value:"select",label:"Select"},{value:"checkbox",label:"Checkbox"},{value:"date",label:"Fecha"},{value:"file",label:"Archivo"}],Fh=e=>(e==null?void 0:e.enabled)??!!(e!=null&&e.rule),Eo=(e,t)=>({...e??{},enabled:t}),Oh=(e,t)=>({...e??{},rule:t}),Rh=(e,t)=>({...e??{},clearTo:t}),Dh=e=>{try{return JSON.stringify(e,null,2)}catch{return""}};async function Mh(){try{const e=await navigator.clipboard.readText(),t=JSON.parse(e);if(t&&typeof t=="object"&&"op"in t)return t}catch{}}function $h(e){return typeof e=="number"||typeof e=="string"||e instanceof Date}function kl(e,t){if(!e)return{ok:!1,reason:"Sin regla"};if(!("op"in e))return{ok:!1,reason:"Operador inválido"};if(e.op==="and"||e.op==="or"){if(!Array.isArray(e.rules)||e.rules.length===0)return{ok:!1,reason:`Lista de reglas vacía en "${e.op}"`};for(const r of e.rules){const s=kl(r,t);if(!s.ok)return s}return{ok:!0}}if(!e.field||typeof e.field!="string")return{ok:!1,reason:"Campo no especificado"};if(!t.includes(e.field))return{ok:!1,reason:`Campo "${e.field}" no existe`};switch(e.op){case"eq":case"neq":return"value"in e?{ok:!0}:{ok:!1,reason:"Valor requerido"};case"in":case"notIn":return Array.isArray(e.values)&&e.values.length>0?{ok:!0}:{ok:!1,reason:"Lista de valores vacía"};case"gt":case"gte":case"lt":case"lte":return"value"in e?$h(e.value)?{ok:!0}:{ok:!1,reason:"Valor no comparable (número, string o Date)"}:{ok:!1,reason:"Valor requerido"};default:return{ok:!1,reason:`Operador no soportado: ${e.op}`}}}function Lh(e,t){for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n,node:s,tab:s.tabs[n]}}return null}function Ph(){var k,I,U,G,ee,M,W,me,be,de,ke,ge,he,fe,pe,ye,ce,Se,Te,j,F,R,X,Y,Z,ue,xe,je,Fe,vt,Me,Vt,Ft,Ot,Rt,Dt,rr,Mt;const e=J(O=>O.selection),t=J(O=>O.schema),r=J(O=>O.updateField),s=J(O=>O.removeField),n=J(O=>O.renameField),a=J(O=>O.duplicateField),i=J(O=>O.changeFieldType),l=J(O=>O.addTabAfter),c=J(O=>O.removeTab),d=J(O=>O.renameTab),u=J(O=>O.moveTab),f=J(O=>O.addSectionToTab),{services:p}=$s(),{show:h}=Vr(),g=i??((O,L)=>r(O,Q=>{Q.type=L})),x=b.useMemo(()=>t.fields.map(O=>O.name).filter(Boolean).map(O=>({label:O,value:O})),[t.fields]),v=b.useMemo(()=>x.map(O=>O.value),[x]),m=b.useMemo(()=>{if(e.kind==="field")return t.fields.find(O=>O.name===e.name)},[e,t.fields]),w=(m==null?void 0:m.type)==="select",y=(m==null?void 0:m.type)==="textarea",T=(m==null?void 0:m.type)==="file",N=(m==null?void 0:m.type)==="date",_=(m==null?void 0:m.type)==="number",A=b.useMemo(()=>Object.keys((p==null?void 0:p.registry)??{}),[p]),S=b.useMemo(()=>[{label:"— ninguno —",value:""},...A.map(O=>({label:O,value:O}))],[A]),[$,V]=b.useState(!1),[z,q]=b.useState(null),[D,P]=b.useState([]),[E,te]=b.useState(""),ne=async()=>{var Q;const O=m==null?void 0:m.optionSource;if(!O){q("Debes elegir una clave en 'Option source'."),h("Elige la clave del adapter en 'Option source'.","warning");return}const L=(Q=p==null?void 0:p.registry)==null?void 0:Q[O];if(typeof L!="function"){q(`No existe un provider en services.registry["${O}"]`),h(`Provider no encontrado: ${O}`,"error");return}V(!0),q(null);try{let B;if(E.trim())try{B=JSON.parse(E)}catch{q("Contexto JSON inválido."),h("Contexto JSON inválido.","error"),V(!1);return}const Ne=B!=null?{getValues:()=>B}:void 0,Le=await Promise.resolve(L("",Ne)),Oe=Array.isArray(Le)?Le:[];P(Oe),h(Oe.length?`Cargadas ${Oe.length} opciones.`:"El adapter devolvió 0 opciones.",Oe.length?"success":"info")}catch(B){q((B==null?void 0:B.message)||String(B)),h("Error al cargar opciones desde adapter.","error")}finally{V(!1)}},K=()=>{m!=null&&m.name&&(r(m.name,O=>{O.options=[...D],delete O.optionSource,delete O.loadOptions}),h("Opciones copiadas al campo (options).","success"))},le=({title:O,fieldKey:L,showClearTo:Q})=>{const B=(m==null?void 0:m[L])??{},Ne=Fh(B),Le=Dh(B.rule??null),Oe=Ee=>r(m.name,Wt=>{Wt[L]=Ee}),[He,We]=b.useState(""),Ke=b.useRef(null),Ge=Ee=>{Ke.current&&window.clearTimeout(Ke.current),We(Ee),Ke.current=window.setTimeout(()=>We(""),1500)};b.useEffect(()=>()=>{Ke.current!=null&&window.clearTimeout(Ke.current)},[]);const Pe=Ee=>{var sr;if(Ee.rule)return Ee;const Wt=((sr=x[0])==null?void 0:sr.value)??"";return{...Ee,rule:{op:"eq",field:Wt,value:!0}}},yt=Ee=>{Oe(Ee?Pe(Eo(B,Ee)):Eo(B,Ee)),Ge(Ee?"Regla activada":"Regla desactivada"),h(Ee?"Regla activada":"Regla desactivada","info")},at=Ee=>{Oe(Oh(B,Ee)),Ge("Regla actualizada")},ft=Ee=>{Oe(Rh(B,Ee)),Ge("clearTo actualizado"),h("clearTo actualizado","info")},Bt="__quick_placeholder__",Ut=Ee=>{var ua;if(!Ee||Ee===Bt)return;const Wt=((ua=x[0])==null?void 0:ua.value)??"",sr={...B??{},enabled:!0};Ee==="eq:true"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!0}}),Ee==="eq:false"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!1}}),Ee==="eq:empty"&&Oe({...sr,rule:{op:"eq",field:Wt,value:""}}),Ge("Atajo aplicado"),h("Atajo aplicado","success")},wt=async()=>{try{await navigator.clipboard.writeText(Le||""),Ge("Copiado"),h("Regla copiada al portapapeles","success")}catch{Ge("No se pudo copiar"),h("No se pudo copiar al portapapeles","error")}},qt=async()=>{const Ee=await Mh();Ee?(Oe({...B??{},enabled:!0,rule:Ee}),Ge("Pegado"),h("Regla pegada desde portapapeles","success")):(Ge("Portapapeles no válido"),h("El contenido del portapapeles no es una regla válida","warning"))},xr=()=>{at(void 0),Ge("Regla borrada"),h("Regla borrada","info")},Zr=kl(B.rule,v),Nl=Ne?Zr.ok?"text-[var(--color-success-600)]":"text-[var(--color-danger-600)]":"text-[var(--color-ds-text-secondary)]",Sl=Ne?Zr.ok?"border-[var(--color-success-400)]":"border-[var(--color-danger-400)]":"border-[var(--color-ds-border-default-50)]";return o.jsxs("div",{className:"rounded-md border border-[var(--color-ds-border-default-50)] p-2 space-y-2",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dt,{size:"sm",checked:Ne,onChange:yt,label:O}),o.jsxs("span",{className:`ml-2 flex items-center gap-1 text-[11px] ${Nl}`,children:[o.jsx("span",{className:"inline-block w-2 h-2 rounded-full border border-black/10 bg-current opacity-70"}),Ne?Zr.ok?"OK":Zr.reason:"Inactiva"]})]})}),o.jsx("div",{className:"text-[11px] h-4 text-[var(--color-ds-text-secondary)]","aria-live":"polite",children:He||o.jsx("span",{"aria-hidden":"true",children:" "})}),o.jsx(rt,{label:"Atajo rápido",value:"__quick_placeholder__",onChange:Ee=>Ut(Ee),options:[{label:"— Atajo rápido —",value:"__quick_placeholder__"},{label:"Campo = true",value:"eq:true"},{label:"Campo = false",value:"eq:false"},{label:"Campo = '' (vacío)",value:"eq:empty"}],size:"sm",reserveErrorSpace:!1}),o.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:wt,title:"Copiar JSON",children:"Copiar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:qt,title:"Pegar JSON",children:"Pegar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:xr,title:"Borrar regla",children:"Borrar"})]}),o.jsx("div",{className:Ne?"":"opacity-60 pointer-events-none",children:o.jsx(Ch,{value:B.rule,fieldOptions:x,onChange:Ee=>at(Ee)})}),o.jsx("div",{className:`rounded p-2 bg-[var(--color-ds-background-surface)] border ${Sl}`,children:o.jsx("pre",{className:"m-0 text-[11px] leading-snug whitespace-pre-wrap break-all text-[var(--color-ds-text-primary)]",children:Le||"—"})}),Q&&o.jsx(we,{label:"clearTo",value:B.clearTo??"",onChange:Ee=>ft(Ee.target.value)})]})};if(e.kind==="tab"){const O=Lh(t,e.tabKey);if(!O)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Pestaña no encontrada."});const{tab:L}=O,[Q,B]=b.useState(L.label??"");return b.useEffect(()=>{B(L.label??"")},[L.label]),o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector de pestaña"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"left"),children:"← Mover"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"right"),children:"Mover →"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>l(e.tabKey),children:"+ Pestaña a la derecha"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>c(e.tabKey),children:"Eliminar pestaña"})]})]}),o.jsx(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:o.jsx("div",{className:"grid gap-2",children:o.jsx(we,{size:"sm",label:"Label de la pestaña",value:Q,onChange:Ne=>B(Ne.target.value),onBlur:()=>d(e.tabKey,Q)})})}),o.jsx(it,{title:"Estructura",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>f(e.tabKey),children:"+ Añadir sección"}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Esta acción agrega una sección con una fila y una columna vacía dentro de la pestaña."})]})}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Selecciona una sección o un campo para ver sus propiedades específicas."})]})}if(e.kind!=="field")return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Selecciona un campo o una pestaña…"});if(!m)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Campo no encontrado."});const C=O=>{r(m.name,L=>{var Ne;const Q=(Ne=L.validation)==null?void 0:Ne.pattern;if(O==="none"){L.validation={...L.validation??{},pattern:void 0};return}const B=O==="email"?/^[^\s@]+@[^\s@]+\.[^\s@]+$/:/^\+?\d{7,15}$/;L.validation={...L.validation??{},pattern:{value:B,message:(Q==null?void 0:Q.message)||(O==="email"?"Email inválido":"Teléfono inválido")}}}),h(O==="none"?"Patrón eliminado":"Patrón aplicado","info")};return o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>a(m.name,`${m.name}`),children:"Duplicar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>s(m.name),children:"Eliminar"})]})]}),o.jsxs(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(we,{size:"sm",label:"Name",value:m.name??"",onChange:O=>n(m.name,O.target.value)}),o.jsx(we,{size:"sm",label:"Label",value:m.label??"",onChange:O=>r(m.name,L=>{L.label=O.target.value})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Tipo",value:m.type,onChange:O=>g(m.name,O),options:_h}),o.jsx(we,{size:"sm",label:"Info (tooltip/ayuda)",value:m.info??"",onChange:O=>r(m.name,L=>{L.info=O.target.value})})]})]}),o.jsx(it,{title:"Layout",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Width",value:m.width??"",onChange:O=>r(m.name,L=>{L.width=O}),options:[{label:"— custom —",value:""},...Ah.map(O=>({label:O,value:O}))]}),o.jsx(rt,{label:"Size",value:m.size??"sm",onChange:O=>r(m.name,L=>{L.size=O}),options:Th.map(O=>({label:O,value:O}))}),!["checkbox","file"].includes(m.type)&&o.jsx(we,{size:"sm",label:"Placeholder",value:m.placeholder??"",onChange:O=>r(m.name,L=>{L.placeholder=O.target.value})})]})}),w&&o.jsxs(it,{title:"Select",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Option source (registry key)",value:m.optionSource??"",onChange:O=>r(m.name,L=>{L.optionSource=O||void 0,L.optionSource&&(delete L.options,delete L.loadOptions)}),options:S}),o.jsx(we,{size:"sm",label:"Contexto (JSON) para adapter (opcional)",placeholder:'{"cifOrga":"A12345678","tipoContrato":"OB"}',value:E,onChange:O=>te(O.target.value)}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:ne,disabled:$||!A.length,children:$?"Cargando…":"Cargar opciones"}),!!D.length&&o.jsx(ie,{size:"sm",variant:"outline",onClick:K,title:"Copiar vista previa a options",children:"Aplicar al campo"})]}),z&&o.jsx("div",{className:"text-xs text-[var(--color-ds-text-primary)]",children:z}),!!D.length&&o.jsxs("div",{className:"rounded border p-2 max-h-40 overflow-auto border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"text-[11px] mb-1 opacity-70",children:["Vista previa (",D.length,"):"]}),o.jsxs("ul",{className:"text-[12px] space-y-1",children:[D.slice(0,50).map((O,L)=>o.jsxs("li",{children:[o.jsx("code",{className:"opacity-70",children:O.value})," — ",O.label]},`${O.value}-${L}`)),D.length>50&&o.jsx("li",{className:"opacity-60 text-[11px]",children:"… (truncado)"})]})]})]}),o.jsxs("div",{className:"pt-2 space-y-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)]",children:"Opciones estáticas (se ignoran si defines optionSource)"}),(m.options??[]).map((O,L)=>o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(we,{size:"sm",label:"Etiqueta",value:O.label??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],label:Q.target.value},B.options=Ne})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{size:"sm",label:"Valor",value:O.value??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],value:Q.target.value},B.options=Ne})}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,Q=>{const B=Array.isArray(Q.options)?[...Q.options]:[];B.splice(L,1),Q.options=B}),"aria-label":"Eliminar opción",title:"Eliminar opción",children:"✕"})]})]},L)),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,O=>{const L=Array.isArray(O.options)?[...O.options]:[];L.push({label:"Opción",value:`opt_${L.length+1}`}),O.options=L}),children:"+ Añadir opción"})]}),o.jsx("div",{className:"pt-2",children:o.jsx(dt,{size:"sm",label:"Múltiple",checked:!!m.multiple,onChange:O=>r(m.name,L=>{L.multiple=O})})})]}),y&&o.jsxs(it,{title:"Textarea",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",type:"number",label:"Máx. caracteres",value:m.maxLength??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxLength=Q?Number(Q):void 0}),className:"w-32"}),o.jsx(dt,{size:"sm",label:"Mostrar contador",checked:!!m.showCounter,onChange:O=>r(m.name,L=>{L.showCounter=O})})]}),T&&o.jsxs(it,{title:"Archivo",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",label:"Extensiones permitidas (accept)",placeholder:".pdf,.jpg",value:m.accept??"",onChange:O=>r(m.name,L=>{L.accept=O.target.value})}),o.jsx(we,{size:"sm",type:"number",label:"Máx. ficheros",value:m.maxFiles??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxFiles=Q?Number(Q):void 0}),className:"w-32"})]}),N&&o.jsx(it,{title:"Fecha",type:"plain",defaultOpen:!0,children:o.jsx(dt,{size:"sm",label:"Incluir hora",checked:!!m.showTime,onChange:O=>r(m.name,L=>{L.showTime=O})})}),o.jsx(it,{title:"Reglas",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(le,{title:"visibleWhen",fieldKey:"visibleWhen"}),o.jsx(le,{title:"disabledWhen",fieldKey:"disabledWhen"}),o.jsx(le,{title:"clearWhen",fieldKey:"clearWhen",showClearTo:!0})]})}),o.jsxs(it,{title:"Validación",type:"plain",defaultOpen:!0,children:[o.jsx(dt,{size:"sm",label:"Requerido",checked:!!((k=m.validation)!=null&&k.required),onChange:O=>r(m.name,L=>{L.validation={...L.validation??{},required:O}})}),o.jsx("div",{className:"grid gap-2",children:o.jsx(rt,{label:"Preset de patrón",value:"__none__",onChange:O=>C(O==="email"?"email":O==="phone"?"phone":"none"),options:[{label:"— ninguno —",value:"__none__"},{label:"Email básico",value:"email"},{label:"Teléfono (+999…)",value:"phone"}],size:"sm",reserveErrorSpace:!1})}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"minLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((U=(I=m.validation)==null?void 0:I.minLength)==null?void 0:U.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},minLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.minLength)==null?void 0:B.message)??"Muy corto"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((ee=(G=m.validation)==null?void 0:G.minLength)==null?void 0:ee.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.minLength;L.validation={...L.validation??{},minLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"maxLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((W=(M=m.validation)==null?void 0:M.maxLength)==null?void 0:W.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},maxLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.maxLength)==null?void 0:B.message)??"Muy largo"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((be=(me=m.validation)==null?void 0:me.maxLength)==null?void 0:be.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.maxLength;L.validation={...L.validation??{},maxLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"pattern (RegExp)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{placeholder:"^\\\\d+$",value:((ge=(ke=(de=m.validation)==null?void 0:de.pattern)==null?void 0:ke.value)==null?void 0:ge.source)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},pattern:O.target.value?{value:new RegExp(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.pattern)==null?void 0:B.message)??"Formato inválido"}:void 0}})}),o.jsx(we,{placeholder:"mensaje",value:((fe=(he=m.validation)==null?void 0:he.pattern)==null?void 0:fe.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.pattern;L.validation={...L.validation??{},pattern:Q?{...Q,message:O.target.value}:{value:/.*/,message:O.target.value}}})})]})]})]}),_&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Número"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"min",className:"w-28",value:((ye=(pe=m.validation)==null?void 0:pe.numberMin)==null?void 0:ye.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMin)==null?void 0:B.message)??"Demasiado pequeño"}:void 0}})}),o.jsx(we,{type:"number",label:"max",className:"w-28",value:((Se=(ce=m.validation)==null?void 0:ce.numberMax)==null?void 0:Se.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMax)==null?void 0:B.message)??"Demasiado grande"}:void 0}})}),o.jsx(we,{type:"number",label:"step",className:"w-28",value:((j=(Te=m.validation)==null?void 0:Te.step)==null?void 0:j.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},step:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.step)==null?void 0:B.message)??"Incremento inválido"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"Solo enteros",checked:!!((R=(F=m.validation)==null?void 0:F.integerOnly)!=null&&R.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},integerOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.integerOnly)==null?void 0:B.message)??"Debe ser entero"}:void 0}})}),o.jsx(dt,{size:"sm",label:"Solo positivos",checked:!!((Y=(X=m.validation)==null?void 0:X.positiveOnly)!=null&&Y.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},positiveOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.positiveOnly)==null?void 0:B.message)??"Debe ser positivo"}:void 0}})})]})]}),w&&m.multiple&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Select (múltiple)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"mín. seleccionados",className:"w-40",value:((ue=(Z=m.validation)==null?void 0:Z.selectMin)==null?void 0:ue.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMin)==null?void 0:B.message)??"Selecciona más opciones"}:void 0}})}),o.jsx(we,{type:"number",label:"máx. seleccionados",className:"w-40",value:((je=(xe=m.validation)==null?void 0:xe.selectMax)==null?void 0:je.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMax)==null?void 0:B.message)??"Demasiadas opciones"}:void 0}})})]})]}),N&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Fecha"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Fr,{size:"sm",label:"minDate",className:"w-44",showTime:!!m.showTime,defaultValue:((vt=(Fe=m.validation)==null?void 0:Fe.dateMin)==null?void 0:vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMin:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMin)==null?void 0:B.message)??"Demasiado antigua"}:void 0}})}),o.jsx(Fr,{size:"sm",label:"maxDate",className:"w-44",showTime:!!m.showTime,defaultValue:((Vt=(Me=m.validation)==null?void 0:Me.dateMax)==null?void 0:Vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMax:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMax)==null?void 0:B.message)??"Demasiado futura"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"No permitir pasado",checked:!!((Ot=(Ft=m.validation)==null?void 0:Ft.disallowPast)!=null&&Ot.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowPast:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowPast)==null?void 0:B.message)??"No se permiten fechas pasadas"}:void 0}})}),o.jsx(dt,{size:"sm",label:"No permitir futuro",checked:!!((Dt=(Rt=m.validation)==null?void 0:Rt.disallowFuture)!=null&&Dt.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowFuture:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowFuture)==null?void 0:B.message)??"No se permiten fechas futuras"}:void 0}})})]})]}),T&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Archivo"}),o.jsx(we,{type:"number",label:"Tamaño máx. por archivo (MB)",className:"w-56",value:((Mt=(rr=m.validation)==null?void 0:rr.fileMaxSizeMB)==null?void 0:Mt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},fileMaxSizeMB:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.fileMaxSizeMB)==null?void 0:B.message)??"Archivo demasiado grande"}:void 0}})})]})]})]})}function zh(e){return typeof e.type=="string"}function Ih(e){const t=e.validation;return t===void 0||typeof t=="object"}function Vh(e){const t=e.options;return Array.isArray(t)}function Bh(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Lt(e){return String(e).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function Uh(e){var a,i,l,c,d;const t=zh(e)&&e.type?e.type:"string";let r="yup.string()";switch(t){case"number":r="yup.number()";break;case"checkbox":r="yup.boolean()";break;case"date":r="yup.date().nullable()";break;case"file":r="yup.array()";break;case"select":case"text":case"email":case"password":case"textarea":default:r="yup.string()";break}const s=Ih(e)&&e.validation?e.validation:{},n=[r];if(s.required){const u=typeof s.required=="string"?s.required:s.requiredMessage||"Requerido";n.push(`.required(\`${Lt(u)}\`)`)}if(((a=s.minLength)==null?void 0:a.value)!=null&&n.push(`.min(${Number(s.minLength.value)}, \`${Lt(s.minLength.message??"Muy corto")}\`)`),((i=s.maxLength)==null?void 0:i.value)!=null&&n.push(`.max(${Number(s.maxLength.value)}, \`${Lt(s.maxLength.message??"Muy largo")}\`)`),(l=s.pattern)!=null&&l.value&&Bh(s.pattern.value)){const u=s.pattern.value.source,f=s.pattern.value.flags||"";n.push(`.matches(new RegExp(\`${Lt(u)}\`, \`${Lt(f)}\`), \`${Lt(s.pattern.message??"Formato inválido")}\`)`)}if(t==="number"&&(((c=s.min)==null?void 0:c.value)!=null&&n.push(`.min(${Number(s.min.value)}, \`${Lt(s.min.message??"Demasiado pequeño")}\`)`),((d=s.max)==null?void 0:d.value)!=null&&n.push(`.max(${Number(s.max.value)}, \`${Lt(s.max.message??"Demasiado grande")}\`)`)),t==="select"&&Vh(e)&&e.options&&e.options.length){const u=e.options.map(f=>JSON.stringify(String(f.value)));n.push(`.oneOf([${u.join(", ")}])`)}return n.join("")}function qh(e,t="validationSchema"){const r=[],s=e.fields??[];for(const i of s){const l=i;!l.name||typeof l.name!="string"||r.push(` ${l.name}: ${Uh(l)},`)}const n=r.join(`
66
66
  `);return`/* eslint-disable */
67
67
  // Auto-generated with generateYupCode(schema)
68
68
  import * as yup from "yup";
69
69
 
70
- export const ${e} = yup.object({
70
+ export const ${t} = yup.object({
71
71
  ${n}
72
72
  });
73
73
 
74
- export type FormValues = yup.InferType<typeof ${e}>;`}function ti(t,e){const s=new Blob([e],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(s),n=document.createElement("a");n.href=r,n.download=t,n.click(),URL.revokeObjectURL(r)}function Vm(t){return t.reduce((e,s)=>s.type==="rows"?e+s.sections.length:e+s.tabs.reduce((r,n)=>r+n.sections.length,0),0)}const On=t=>t.toLowerCase().endsWith(".json")?t:`${t}.json`,si=(t,e)=>`${t.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`;function zm(){var T;const t=H(C=>C.schema),e=H(C=>C.undo),s=H(C=>C.redo),r=H(C=>C.setSchema),n=H(C=>C.resetHistory),a=H(C=>C.past.length),o=H(C=>C.future.length),i=b.useRef(null),{show:c}=Gs(),{fs:d,baseDir:u}=Hr(),f=Vm(t.layout),p=t.fields.length,h=((T=t.title)==null?void 0:T.toString().trim().replace(/\s+/g,"-").toLowerCase())||"form-schema",g=()=>{ti(`${h}.json`,JSON.stringify(t,null,2)),c("Esquema exportado como JSON.","success")},x=()=>{try{const C=Im(t,"validationSchema");ti(`${h}.validation.ts`,C),c("Yup exportado como TypeScript.","success")}catch(C){console.error(C),c("No se pudo generar el Yup.","error")}},v=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(t,null,2)),c("JSON copiado al portapapeles.","success")}catch{c("No se pudo copiar al portapapeles.","error")}},m=()=>{var C;return(C=i.current)==null?void 0:C.click()},y=C=>{var z;const N=(z=C.target.files)==null?void 0:z[0];if(!N)return;if(!window.confirm("Vas a reemplazar el esquema actual. ¿Continuar?")){C.currentTarget.value="";return}const I=new FileReader;I.onload=()=>{try{const U=JSON.parse(String(I.result));if(!Array.isArray(U.layout)||!Array.isArray(U.fields)){c("JSON inválido: faltan layout/fields.","error");return}r(()=>U),n(),c("Esquema importado correctamente.","success")}catch{c("No se pudo parsear el JSON.","error")}},I.readAsText(N),C.currentTarget.value=""},w=()=>{window.confirm("Crear un esquema nuevo vacío (perderás cambios no guardados). ¿Continuar?")&&(r(N=>{N.layout=[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],N.fields=[],N.successMessage="Guardado",N.errorMessage="Error",N.onSubmit=async()=>{}}),n(),c("Esquema nuevo creado.","info"))},O=async()=>{try{const C=si(u,On(`${h}.json`));await d.write(C,JSON.stringify(t,null,2)),c(`Guardado rápido en ${C}`,"success")}catch(C){console.error(C),c("Guardado rápido fallido.","error")}},S=async()=>{try{const C=On(`${h}.json`),N=window.prompt("Guardar como (archivo en baseDir):",C);if(!N)return;const _=si(u,On(N));await d.write(_,JSON.stringify(t,null,2)),c(`Guardado en ${_}`,"success")}catch(C){console.error(C),c("No se pudo guardar el archivo.","error")}};return b.useEffect(()=>{const C=N=>{const _=N.metaKey||N.ctrlKey;if(_&&N.key.toLowerCase()==="z"&&!N.shiftKey){N.preventDefault(),a>0&&e();return}if(_&&N.key.toLowerCase()==="z"&&N.shiftKey||_&&N.key.toLowerCase()==="y"){N.preventDefault(),o>0&&s();return}if(_&&N.key.toLowerCase()==="s"){N.preventDefault(),O();return}};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[a,o,e,s]),l.jsxs("div",{className:"px-4 py-2 border-b border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-page)] flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(le,{variant:"ghost",onClick:e,disabled:a===0,title:"Deshacer (Ctrl/Cmd+Z)",children:"Undo"}),l.jsx(le,{variant:"ghost",onClick:s,disabled:o===0,title:"Rehacer (Ctrl/Cmd+Shift+Z · Ctrl+Y)",children:"Redo"}),l.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),l.jsx(le,{variant:"outline",onClick:m,title:"Importar desde JSON",children:"Importar JSON"}),l.jsx(le,{variant:"outline",onClick:g,title:"Exportar a JSON",children:"Exportar JSON"}),l.jsx(le,{variant:"outline",onClick:x,title:"Exportar Yup como TypeScript",children:"Exportar Yup (.ts)"}),l.jsx(le,{variant:"ghost",onClick:v,title:"Copiar JSON al portapapeles",children:"Copiar JSON"}),l.jsx("input",{ref:i,type:"file",accept:"application/json",className:"hidden",onChange:y}),l.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),l.jsx(le,{variant:"outline",onClick:O,title:"Guardar rápido en baseDir (Ctrl/Cmd+S)",children:"Guardar"}),l.jsx(le,{variant:"outline",onClick:S,title:"Guardar como… en baseDir",children:"Guardar como…"}),l.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),l.jsx(le,{onClick:w,title:"Nuevo esquema",children:"Nuevo"})]}),l.jsxs("div",{className:"flex items-center gap-3 text-[var(--color-ds-text-secondary)] text-ds-sm",children:[l.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Secciones: ",l.jsx("strong",{children:f})]}),l.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Campos: ",l.jsx("strong",{children:p})]})]})]})}const xr="application/x-ds-field-template",ri="application/x-ds-layout-kind";function vr(t){return t.layout.find(e=>(e==null?void 0:e.type)==="rows")}function Bm({className:t,children:e}){var y;const s=H(w=>w.schema),r=H(w=>w.addFieldAndPlace),n=H(w=>w.addRowsBlockAt),a=H(w=>w.addSection),o=H(w=>w.addRowToSection),i=H(w=>w.setRowColumns),c=H(w=>w.moveField),[d,u]=b.useState(!1),f=b.useMemo(()=>{var S;const w=vr(s);if(!w)return[];const O=[];return(S=w.sections)==null||S.forEach((T,C)=>{var N;(N=T.rows)==null||N.forEach((_,I)=>{(_.columns??[]).forEach((z,U)=>{var E;const D=((E=z.fields)==null?void 0:E.length)??0,$=Math.max(1,D+1);for(let Z=0;Z<$;Z++)O.push({kind:"field-slot",sectionIdx:C,rowIdx:I,colIdx:U,insertIdx:Z,key:`s${C}-r${I}-c${U}-i${Z}`})})})}),O},[s]),p=b.useCallback(()=>{var S,T;let w=vr(s);return w?(S=w.sections)!=null&&S.length?(T=w.sections[0].rows)!=null&&T.length?((w.sections[0].rows[0].columns??[]).length||i==null||i(0,0,1),{s:0,r:0,c:0}):(o==null||o(0),{s:0,r:0,c:0}):(a==null||a("Sección 1"),{s:0,r:0,c:0}):(n==null||n(s.layout.length??0,"Sección 1"),{s:0,r:0,c:0})},[s,n,a,o,i]),h=b.useCallback(w=>{var S;const O=((S=w.dataTransfer)==null?void 0:S.types)||[];(O.includes(xr)||O.includes(ri))&&(w.preventDefault(),w.dataTransfer.dropEffect="copy",u(O.includes(xr)?"field":"layout"))},[]),g=b.useCallback(()=>u(!1),[]),x=b.useCallback(w=>{var C;const O=w.dataTransfer.getData(ri);if(!O)return!1;const{kind:S}=JSON.parse(O),T=((C=s==null?void 0:s.layout)==null?void 0:C.length)??0;return S==="section-layout"&&(n==null||n(T,"Nueva sección")),!0},[(y=s==null?void 0:s.layout)==null?void 0:y.length,n]),v=b.useCallback((w,O)=>{const S=O.dataTransfer.getData(xr);if(!S)return!1;const{fieldTemplate:T}=JSON.parse(S);return r(T,w.sectionIdx,w.rowIdx,w.colIdx),queueMicrotask(()=>{var z;const C=H.getState().schema,I=(((z=vr(C).sections[w.sectionIdx].rows[w.rowIdx].columns[w.colIdx].fields)==null?void 0:z.length)??1)-1;w.insertIdx>=0&&w.insertIdx<I&&c({s:w.sectionIdx,r:w.rowIdx,c:w.colIdx,idx:I},{s:w.sectionIdx,r:w.rowIdx,c:w.colIdx,idx:w.insertIdx})}),!0},[r,c]),m=b.useCallback(w=>{if(w.preventDefault(),w.stopPropagation(),x(w)){u(!1);return}const O=w.dataTransfer.getData(xr);if(O){const{fieldTemplate:S}=JSON.parse(O),T=p();r(S,T.s,T.r,T.c)}u(!1)},[x,p,r]);return l.jsxs("div",{className:["relative",t].filter(Boolean).join(" "),onDragOver:h,onDragLeave:g,onDrop:m,children:[e,d&&l.jsxs("div",{className:"absolute inset-0 z-40",children:[l.jsx("div",{className:"absolute inset-0 bg-black/5 pointer-events-none"}),l.jsx("div",{className:"absolute inset-0 px-4 py-4 overflow-auto space-y-4",children:(()=>{var S;const w=vr(s);if(!w||!((S=w.sections)!=null&&S.length)){const T=p(),C={kind:"field-slot",sectionIdx:T.s,rowIdx:T.r,colIdx:T.c,insertIdx:0,key:"init"};return l.jsx("div",{className:"min-h-[220px] border-2 border-dashed rounded-2xl bg-white/70 flex items-center justify-center text-ds-sm",onDragOver:N=>N.preventDefault(),onDrop:N=>{N.preventDefault(),N.stopPropagation(),v(C,N),u(!1)},children:"Suelta aquí para empezar"})}const O=[];return w.sections.forEach((T,C)=>{var N;(N=T.rows)==null||N.forEach((_,I)=>{const z=[];(_.columns??[]).forEach((U,D)=>{const $=f.filter(E=>E.sectionIdx===C&&E.rowIdx===I&&E.colIdx===D);z.push($)}),O.push({key:`s${C}-r${I}`,cols:z})})}),O.map(T=>l.jsx("div",{className:"grid gap-3 pointer-events-none",style:{gridTemplateColumns:`repeat(${T.cols.length||1}, minmax(0,1fr))`},children:T.cols.map((C,N)=>{const _=C.length===1;return l.jsx("div",{className:"pointer-events-auto",children:l.jsx("div",{className:["rounded-xl border-2 border-dashed bg-white/60",_?"min-h-[160px]":"py-2"].join(" "),children:l.jsx("div",{className:"flex flex-col gap-2",children:C.map(I=>l.jsx("div",{className:"h-7 rounded-md border border-transparent hover:border-[var(--color-ds-border-default)] hover:bg-white/80 flex items-center justify-center text-ds-xs text-[var(--color-ds-text-secondary)]",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.stopPropagation(),v(I,z),u(!1)},title:`Insertar en Col ${I.colIdx+1}, posición ${I.insertIdx+1}`,children:_?"Soltar aquí":I.insertIdx===C.length-1?"Añadir al final":"Insertar aquí"},I.key))})})},`${T.key}-c${N}`)})},T.key))})()})]})]})}function Um(t,e,s){const r={...t};return e.top+t.y<=s.top?r.y=s.top-e.top:e.bottom+t.y>=s.top+s.height&&(r.y=s.top+s.height-e.bottom),e.left+t.x<=s.left?r.x=s.left-e.left:e.right+t.x>=s.left+s.width&&(r.x=s.left+s.width-e.right),r}const Km=t=>{let{transform:e,draggingNodeRect:s,windowRect:r}=t;return!s||!r?e:Um(e,s,r)};function qm({children:t}){const e=H(D=>D.moveField),s=H(D=>D.moveFieldInTab),r=H(D=>D.removeFieldFromLayout),n=H(D=>D.removeFieldFromTabLayout),a=H(D=>D.insertExistingFieldAt),o=H(D=>D.insertExistingFieldInTabAt),i=H(D=>D.addField),c=H(D=>D.addFieldAndPlaceInTabAt),d=H(D=>D.placeFieldInTabColumn),u=H(D=>D.placeFieldInColumn),f=H(D=>D.moveFieldAt),p=H(D=>D.removeFieldFromLayoutAt),h=H(D=>D.placeFieldInColumnAt),g=H(D=>D.insertExistingFieldAtAt),x=H(D=>D.addFieldAndPlaceAtAt),v=H(D=>D.moveSection),m=H(D=>D.moveTab),y=H(D=>D.moveTabSection),[w,O]=b.useState(null),[S,T]=b.useState(null),C=Mh(Vo(Sa,{activationConstraint:{distance:6}}),Vo(ja)),N=D=>{var E,Z;const $=(Z=(E=D==null?void 0:D.active)==null?void 0:E.data)==null?void 0:Z.current;$&&O({data:$})},_=D=>{var E,Z;const $=(Z=(E=D==null?void 0:D.over)==null?void 0:E.data)==null?void 0:Z.current;T($??null)},I=(D,$)=>D===void 0?$:Math.max(0,Math.min(D,$)),z=D=>{var se,q;const $=(q=(se=D.active)==null?void 0:se.data)==null?void 0:q.current;let E=null;switch($==null?void 0:$.kind){case"rows-section":E=["rows-section"];break;case"tabs-tab":E=["tabs-tab"];break;case"tab-section":E=["tab-section"];break;case"field-in-rows":E=["rows-column"];break;case"field-in-tabs":E=["tabs-column"];break;case"palette-field":E=["rows-column","tabs-column"];break;default:E=null}const Z=E==null?D.droppableContainers:D.droppableContainers.filter(ae=>{var j,V;const A=(V=(j=ae.data)==null?void 0:j.current)==null?void 0:V.scope;return A&&E.includes(A)});return Z.length?Uh({...D,droppableContainers:Z}):$l(D)},U=D=>{var Z,se,q,ae,A,j,V,B;const $=(se=(Z=D==null?void 0:D.active)==null?void 0:Z.data)==null?void 0:se.current,E=(ae=(q=D==null?void 0:D.over)==null?void 0:q.data)==null?void 0:ae.current;if(O(null),T(null),!(!$||!E)){if($.kind==="rows-section"&&E.scope==="rows-section"){if(typeof v=="function"&&$.nodeIdx===E.nodeIdx){const W=H.getState().schema.layout[$.nodeIdx],Q=((A=W==null?void 0:W.sections)==null?void 0:A.length)??0;v($.nodeIdx,$.sIdx,I(E.insertAt,Q))}return}if($.kind==="tabs-tab"&&E.scope==="tabs-tab"){if(typeof m=="function"&&$.nodeIdx===E.nodeIdx){const W=H.getState().schema.layout[$.nodeIdx],Q=((j=W==null?void 0:W.tabs)==null?void 0:j.length)??0;m($.nodeIdx,$.index,I(E.insertAt,Q))}return}if($.kind==="tab-section"&&E.scope==="tab-section"){if(typeof y=="function"&&$.nodeIdx===E.nodeIdx&&$.tabKey===E.tabKey){const W=H.getState().schema.layout[$.nodeIdx],Q=(V=W==null?void 0:W.tabs)==null?void 0:V.find(J=>J.key===$.tabKey),M=((B=Q==null?void 0:Q.sections)==null?void 0:B.length)??0;y($.nodeIdx,$.tabKey,$.sIdx,I(E.insertAt,M))}return}if($.kind==="field-in-rows"&&E.scope==="rows-column"){const W=$.rowsNodeIdx??0,Q=E.rowsNodeIdx??W;typeof f=="function"&&W!==Q?f(W,$.path,Q,{s:E.s,r:E.r,c:E.c,idx:E.insertAt}):e($.path,{s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if($.kind==="field-in-tabs"&&E.scope==="tabs-column"&&$.tabKey===E.tabKey){s({tabKey:$.tabKey,...$.path},{tabKey:$.tabKey,s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if($.kind==="field-in-tabs"&&E.scope==="tabs-column"&&$.tabKey!==E.tabKey){n({tabKey:$.tabKey,...$.path}),typeof E.insertAt=="number"?o($.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d($.name,E.tabKey,E.s,E.r,E.c);return}if($.kind==="field-in-rows"&&E.scope==="tabs-column"){const W=$.rowsNodeIdx??0;typeof p=="function"?p(W,$.path):r($.path),typeof E.insertAt=="number"?o($.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d($.name,E.tabKey,E.s,E.r,E.c);return}if($.kind==="field-in-tabs"&&E.scope==="rows-column"){n({tabKey:$.tabKey,...$.path});const W=E.rowsNodeIdx??0;if(typeof g=="function"){const Q=typeof E.insertAt=="number"?E.insertAt:void 0;typeof Q=="number"?g(W,$.name,E.s,E.r,E.c,Q):typeof h=="function"?h(W,$.name,E.s,E.r,E.c):u($.name,E.s,E.r,E.c)}else typeof E.insertAt=="number"?a($.name,E.s,E.r,E.c,E.insertAt):u($.name,E.s,E.r,E.c);return}if($.kind==="palette-field"){if(E.scope==="rows-column"){const W=E.rowsNodeIdx??0;if(typeof E.insertAt=="number"&&typeof x=="function")x(W,{type:$.factoryKind},E.s,E.r,E.c,E.insertAt);else{const Q=H.getState().schema.fields.length;i({type:$.factoryKind});const M=H.getState().schema.fields[Q];typeof h=="function"?h(W,M.name,E.s,E.r,E.c):u(M.name,E.s,E.r,E.c)}return}if(E.scope==="tabs-column"){if(typeof E.insertAt=="number"&&typeof c=="function")c({type:$.factoryKind},E.tabKey,E.s,E.r,E.c,E.insertAt);else{const W=H.getState().schema.fields.length;i({type:$.factoryKind});const Q=H.getState().schema.fields[W];d(Q.name,E.tabKey,E.s,E.r,E.c)}return}}}};return l.jsxs(Lp,{sensors:C,collisionDetection:z,onDragStart:N,onDragOver:_,onDragEnd:U,modifiers:[Km],children:[t,l.jsx(em,{children:w?l.jsxs("div",{className:"px-2 py-1 rounded-md border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-surface)] shadow",children:[w.data.kind==="palette-field"&&`Nuevo: ${w.data.factoryKind}`,w.data.kind==="field-in-rows"&&w.data.name,w.data.kind==="field-in-tabs"&&w.data.name,w.data.kind==="rows-section"&&"Sección",w.data.kind==="tabs-tab"&&"Pestaña",w.data.kind==="tab-section"&&"Sección de pestaña"]}):null})]})}function ni(t){const s={...t.scope==="rows-column"?{scope:"rows-column",s:t.s,r:t.r,c:t.c,rowsNodeIdx:t.rowsNodeIdx}:{scope:"tabs-column",tabKey:t.tabKey,s:t.s,r:t.r,c:t.c},insertAt:Number.MAX_SAFE_INTEGER},{setNodeRef:r,isOver:n}=sr({id:JSON.stringify(s),data:s});return l.jsx("div",{ref:r,className:n?"ring-2 ring-[var(--color-ds-border-default)] rounded-md":"","aria-dropeffect":n?"copy":void 0,"data-drop-scope":t.scope,children:t.children})}function yr(t){const s={...t.scope==="rows-column"?{scope:"rows-column",rowsNodeIdx:t.rowsNodeIdx,s:t.s,r:t.r,c:t.c}:{scope:"tabs-column",tabKey:t.tabKey,s:t.s,r:t.r,c:t.c},insertAt:t.insertAt},{setNodeRef:r,isOver:n}=sr({id:JSON.stringify(s),data:s});return l.jsx("div",{ref:r,role:"button","aria-dropeffect":n?"copy":void 0,"aria-label":`Soltar aquí (posición ${t.insertAt+1})`,"data-drop-scope":t.scope,"data-insert-at":t.insertAt,className:["h-2 my-1 w-full","rounded-sm transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent","relative -mx-1 px-1"].join(" ")})}function ai(t){const e=t.kind==="field-in-tabs"?`${t.kind}:${t.tabKey}:${t.name}:${t.path.s}-${t.path.r}-${t.path.c}-${t.path.idx}`:`${t.kind}:${t.rowsNodeIdx}:${t.name}:${t.path.s}-${t.path.r}-${t.path.c}-${t.path.idx}`,s=t.kind==="field-in-rows"?{kind:t.kind,name:t.name,path:t.path,rowsNodeIdx:t.rowsNodeIdx}:{kind:t.kind,name:t.name,path:t.path,tabKey:t.tabKey},{attributes:r,listeners:n,setNodeRef:a,isDragging:o}=tr({id:e,data:s});return l.jsxs("div",{ref:a,className:["text-[var(--color-ds-text-primary)] group flex items-center justify-between gap-2 rounded-md px-2 py-1 w-100",o?"opacity-50":"opacity-100"].join(" "),"data-field-name":t.name,children:[l.jsx("button",{type:"button",className:"text-[var(--color-ds-text-primary)] text-ds-sm hover:underline text-left truncate",title:t.name,onClick:t.onSelect,children:t.name}),l.jsx("div",{...n,...r,role:"button","aria-grabbed":o,"aria-label":`Arrastrar campo ${t.name}`,className:["text-[var(--color-ds-text-primary)] text-[10px] select-none cursor-grab active:cursor-grabbing","px-1 py-0.5 rounded-sm","hover:bg-[var(--color-ds-background-muted)]","focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)]"].join(" "),title:"Arrastra para reordenar",children:"⇅"})]})}function oi({nodeIdx:t,insertAt:e}){const s={scope:"rows-section",nodeIdx:t,insertAt:e},{setNodeRef:r,isOver:n}=sr({id:`rows-section:${t}:${e}`,data:s});return l.jsx("div",{ref:r,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección en posición ${e+1}`})}function Wm({nodeIdx:t,sIdx:e}){const s=`rows-section:${t}:${e}`,r={kind:"rows-section",nodeIdx:t,sIdx:e},{attributes:n,listeners:a,setNodeRef:o,isDragging:i}=tr({id:s,data:r});return l.jsx("div",{ref:o,...n,...a,role:"button",title:"Arrastrar sección","aria-grabbed":i,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}function ii({nodeIdx:t,insertAt:e}){const s={scope:"tabs-tab",nodeIdx:t,insertAt:e},{setNodeRef:r,isOver:n}=sr({id:`tabs-tab:${t}:${e}`,data:s});return l.jsx("div",{ref:r,className:["w-8 h-7 rounded-md transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),title:`Insertar pestaña en posición ${e+1}`})}function Jm({nodeIdx:t,index:e,tabKey:s,label:r}){const n=`tabs-tab:${t}:${e}:${s}`,a={kind:"tabs-tab",nodeIdx:t,index:e,tabKey:s},{attributes:o,listeners:i,setNodeRef:c,isDragging:d}=tr({id:n,data:a});return l.jsxs("div",{ref:c,...o,...i,"aria-grabbed":d,className:["px-2 h-7 inline-flex items-center rounded-full border text-ds-xs cursor-grab active:cursor-grabbing","border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",d?"opacity-50":"opacity-100"].join(" "),title:`Arrastrar pestaña "${r}"`,children:[l.jsx("span",{className:"mr-1",children:"⇅"})," ",r]})}function An({nodeIdx:t,tabKey:e,insertAt:s}){const r={scope:"tab-section",nodeIdx:t,tabKey:e,insertAt:s},{setNodeRef:n,isOver:a}=sr({id:`tab-section:${t}:${e}:${s}`,data:r});return l.jsx("div",{ref:n,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",a?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección de pestaña en posición ${s+1}`})}function Hm({nodeIdx:t,tabKey:e,sIdx:s}){const r=`tab-section:${t}:${e}:${s}`,n={kind:"tab-section",nodeIdx:t,tabKey:e,sIdx:s},{attributes:a,listeners:o,setNodeRef:i,isDragging:c}=tr({id:r,data:n});return l.jsx("div",{ref:i,...a,...o,title:"Arrastrar sección de pestaña","aria-grabbed":c,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}const li=t=>t<=1?["w-full"]:t===2?["w-1/2","w-1/2"]:t===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:t},()=>"flex-1"),ci=[1,2,3,4];function Tn({expanded:t,onClick:e,labelExpanded:s,labelCollapsed:r,titleExpanded:n,titleCollapsed:a,className:o=""}){return l.jsx(le,{size:"xs",variant:"ghost","aria-expanded":t,"aria-label":t?s:r,onClick:e,title:t?n??"Colapsar":a??"Expandir",className:`shrink-0 w-8 h-8 p-0 grid place-items-center ${o}`,children:l.jsx(qr,{className:`w-4 h-4 text-[var(--color-ds-text-primary)] transition-transform duration-150 ${t?"rotate-180":""}`})})}function Gm(){const t=H(M=>M.schema),e=H(M=>M.placeFieldInColumn),s=H(M=>M.removeFieldFromLayout),r=H(M=>M.addColumnToRow),n=H(M=>M.setRowColumns),a=H(M=>M.removeColumn),o=H(M=>M.setSelection),i=H(M=>M.renameSection||M.setSectionTitle),c=H(M=>M.removeSection);H(M=>M.duplicateSection),H(M=>M.addRowToSection);const d=H(M=>M.addTabAfter),u=H(M=>M.removeTab),f=H(M=>M.renameTab),p=H(M=>M.addSectionToTab);H(M=>M.addRowToTabSection);const h=H(M=>M.renameTabSection),g=H(M=>M.setTabRowColumns),x=H(M=>M.addColumnToTabRow),v=H(M=>M.removeTabColumn),m=H(M=>M.placeFieldInTabColumn),y=H(M=>M.removeFieldFromTabLayout);H(M=>M.addRowsBlockAt),H(M=>M.addTabsContainerAt);const w=H(M=>M.removeLayoutNode);H(M=>M.duplicateRowInSection);const O=H(M=>M.removeRowFromSection),S=H(M=>M.duplicateTabRow),T=H(M=>M.removeTabRow),[C,N]=b.useState({}),[_,I]=b.useState({}),[z,U]=b.useState({}),[D,$]=b.useState({}),E=(M,J)=>`${M}:${J}`,Z=(M,J,he)=>`${M}:${J}:${he}`,se=(M,J)=>I(he=>({...he,[E(M,J)]:!he[E(M,J)]})),q=(M,J)=>!!_[E(M,J)],ae=(M,J,he)=>U(ge=>({...ge,[Z(M,J,he)]:!ge[Z(M,J,he)]})),A=(M,J,he)=>!!z[Z(M,J,he)],j=M=>$(J=>({...J,[M]:!J[M]})),V=M=>!!D[M],B=(M,J)=>i==null?void 0:i(M,J),W=M=>c==null?void 0:c(M),Q=b.useMemo(()=>[...t.fields].reverse().find(M=>M.type!=="inputGroup"&&M.type!=="button"),[t.fields]);return l.jsx(qm,{children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(Fn,{at:0}),t.layout.map((M,J)=>{var he;if(M.type==="rows")return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(oi,{nodeIdx:J,insertAt:0}),M.sections.map((ge,de)=>l.jsxs(b.Fragment,{children:[l.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[l.jsx("div",{className:"pr-3 bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:l.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[l.jsx(Tn,{expanded:!q(J,de),onClick:()=>se(J,de),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección"}),l.jsx(Wm,{nodeIdx:J,sIdx:de}),l.jsx(je,{size:"sm",labelHidden:!0,placeholder:"Sección",value:ge.sectionTitle??"",onChange:Se=>B(de,Se.target.value),onBlur:Se=>B(de,Se.target.value.trim()||"Sección"),reserveErrorSpace:!1}),l.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:l.jsx(le,{size:"xs",variant:"danger",onClick:()=>W(de),title:"Eliminar sección",children:"✕"})})]})}),q(J,de)?null:l.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:ge.rows.map((Se,be)=>{const pe=Se.columns??[],fe=pe.length===0,me=li(pe.length);return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",be+1]}),l.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),l.jsxs("div",{className:"flex gap-1 flex-wrap",children:[ci.map(we=>l.jsx(le,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>n(de,be,we),title:`${we} columna(s)`,children:we},we)),l.jsx(le,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>r(de,be),title:"Añadir columna",children:"+ columna"})]})]}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>O==null?void 0:O(de,be),title:"Eliminar fila",children:"✕"})]}),fe?l.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):l.jsx("div",{className:"space-y-3",children:pe.map((we,ce)=>l.jsx(ni,{scope:"rows-column",rowsNodeIdx:J,s:de,r:be,c:ce,children:l.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default-50)]",children:["Col ",ce+1]}),l.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:we.width||me[ce]||"flex-1"})]}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>a(de,be,ce),title:"Eliminar columna",children:"✕"})]}),l.jsxs("div",{className:"p-2",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(yr,{scope:"rows-column",rowsNodeIdx:J,s:de,r:be,c:ce,insertAt:0}),(we.fields??[]).length===0&&l.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(we.fields??[]).map((Ce,Te)=>{const k=typeof Ce=="string"?Ce:Ce.name;return l.jsxs(b.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[l.jsx(ai,{kind:"field-in-rows",rowsNodeIdx:J,name:k,path:{s:de,r:be,c:ce,idx:Te},onSelect:()=>o({kind:"field",name:k})}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>s({s:de,r:be,c:ce,idx:Te}),title:"Quitar del layout",children:"✕"})]}),l.jsx(yr,{scope:"rows-column",rowsNodeIdx:J,s:de,r:be,c:ce,insertAt:Te+1})]},`${k}-${Te}`)})]}),l.jsx("div",{className:"mt-2",children:l.jsx(le,{size:"xs",variant:"outline",onClick:()=>(Q==null?void 0:Q.name)&&e(Q.name,de,be,ce),title:"Colocar el último campo creado en esta columna",children:"Colocar último campo"})})]})]})},`col-${J}-${de}-${be}-${ce}`))})]},be)})})]}),l.jsx(oi,{nodeIdx:J,insertAt:de+1})]},`rows-sec-${J}-${de}`))]}),l.jsx(Fn,{at:J+1})]},`rows-${J}`);if(M.type==="tabs"){const ge=M.tabs.map(be=>({label:be.label,value:be.key})),de=(he=M.tabs[0])==null?void 0:he.key,Se=C[J]??de??"";return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[l.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:l.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1 pr-2",children:[l.jsx(Tn,{expanded:!V(J),onClick:()=>j(J),labelExpanded:"Colapsar pestañas",labelCollapsed:"Expandir pestañas"}),l.jsx("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Pestañas"}),l.jsx("div",{className:"ml-auto",children:l.jsx(le,{size:"xs",variant:"danger",onClick:()=>w(J),title:"Eliminar bloque",children:"✕"})})]})}),V(J)?null:l.jsxs("div",{className:"bg-[var(--color-ds-background)]",children:[l.jsxs("div",{className:"px-2 py-2 flex items-center gap-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Orden pestañas"}),l.jsx(ii,{nodeIdx:J,insertAt:0}),M.tabs.map((be,pe)=>l.jsxs(b.Fragment,{children:[l.jsx(Jm,{nodeIdx:J,index:pe,tabKey:be.key,label:be.label}),l.jsx(ii,{nodeIdx:J,insertAt:pe+1})]},`tabchip-${J}-${be.key}`))]}),l.jsx("div",{className:"border-b border-[var(--color-ds-border-default-50)]",children:l.jsx(Hs,{options:ge,value:Se,onChange:be=>N(pe=>({...pe,[J]:be})),children:M.tabs.reduce((be,pe)=>(be[pe.key]=l.jsxs("div",{className:"space-y-3",children:[Se===pe.key&&l.jsxs("div",{className:"p-2 flex flex-wrap items-center gap-2",children:[l.jsx(je,{size:"sm",label:"Nombre pestaña",value:pe.label,onChange:fe=>f==null?void 0:f(pe.key,fe.target.value),className:"w-48",reserveErrorSpace:!1}),l.jsx(le,{size:"xs",variant:"outline",onClick:()=>d==null?void 0:d(pe.key),children:"+ pestaña"}),l.jsx(le,{size:"xs",variant:"outline",onClick:()=>p==null?void 0:p(pe.key,"Nueva sección"),children:"+ sección"}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>u==null?void 0:u(pe.key),disabled:M.tabs.length<=1,children:"eliminar pestaña"})]}),pe.sections.length===0?l.jsx("div",{className:"px-2",children:l.jsx(An,{nodeIdx:J,tabKey:pe.key,insertAt:0})}):null,pe.sections.map((fe,me)=>l.jsxs(b.Fragment,{children:[me===0?l.jsx("div",{className:"px-2",children:l.jsx(An,{nodeIdx:J,tabKey:pe.key,insertAt:0})}):null,l.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[l.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:l.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[l.jsx(Tn,{expanded:!A(J,pe.key,me),onClick:()=>ae(J,pe.key,me),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección",className:"ml-2"}),l.jsx(Hm,{nodeIdx:J,tabKey:pe.key,sIdx:me}),l.jsx(je,{size:"sm",labelHidden:!0,placeholder:"Sección",value:fe.sectionTitle??"",onChange:we=>h==null?void 0:h(pe.key,me,we.target.value),onBlur:we=>h==null?void 0:h(pe.key,me,we.target.value.trim()||"Sección"),reserveErrorSpace:!1})]})}),A(J,pe.key,me)?null:l.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:fe.rows.map((we,ce)=>{const Ce=we.columns??[],Te=Ce.length===0,k=li(Ce.length);return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ce+1]}),l.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),l.jsxs("div",{className:"flex gap-1 flex-wrap",children:[ci.map(F=>l.jsx(le,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>g==null?void 0:g(pe.key,me,ce,F),title:`${F} columna(s)`,children:F},F)),l.jsx(le,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>x==null?void 0:x(pe.key,me,ce),title:"Añadir columna",children:"+ columna"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(le,{size:"xs",variant:"subtle",onClick:()=>S==null?void 0:S(pe.key,me,ce),title:"Duplicar fila",children:"duplicar"}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>T==null?void 0:T(pe.key,me,ce),title:"Eliminar fila",children:"eliminar"})]})]}),Te?l.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):l.jsx("div",{className:"space-y-3",children:Ce.map((F,L)=>l.jsx(ni,{scope:"tabs-column",tabKey:pe.key,s:me,r:ce,c:L,children:l.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border border-[var(--color-ds-border-default-50)]",children:["Col ",L+1]}),l.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:F.width||k[L]||"flex-1"})]}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>v==null?void 0:v(pe.key,me,ce,L),children:"✕"})]}),l.jsxs("div",{className:"p-2",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(yr,{scope:"tabs-column",tabKey:pe.key,s:me,r:ce,c:L,insertAt:0}),(F.fields??[]).length===0&&l.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(F.fields??[]).map((ee,Y)=>{const G=typeof ee=="string"?ee:ee.name;return l.jsxs(b.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[l.jsx(ai,{kind:"field-in-tabs",tabKey:pe.key,name:G,path:{s:me,r:ce,c:L,idx:Y},onSelect:()=>o({kind:"field",name:G})}),l.jsx(le,{size:"xs",variant:"danger",onClick:()=>y==null?void 0:y({tabKey:pe.key,s:me,r:ce,c:L,idx:Y}),children:"✕"})]}),l.jsx(yr,{scope:"tabs-column",tabKey:pe.key,s:me,r:ce,c:L,insertAt:Y+1})]},`${G}-${Y}`)})]}),l.jsx("div",{className:"mt-2",children:l.jsx(le,{size:"xs",variant:"outline",onClick:()=>(Q==null?void 0:Q.name)&&(m==null?void 0:m(Q.name,pe.key,me,ce,L)),children:"Colocar último campo"})})]})]})},`tcol-${pe.key}-${ce}-${L}`))})]},`trow-${pe.key}-${ce}`)})})]}),l.jsx("div",{className:"px-2",children:l.jsx(An,{nodeIdx:J,tabKey:pe.key,insertAt:me+1})})]},`tsec-${pe.key}-${me}`))]}),be),{})})})]})]}),l.jsx(Fn,{at:J+1})]},`tabs-${J}`)}return null})]})})}function Fn({at:t}){const e=H(r=>r.addRowsBlockAt),s=H(r=>r.addTabsContainerAt);return l.jsxs("div",{className:"my-2 flex items-center justify-center gap-2",children:[l.jsx(le,{size:"xs",variant:"outline",onClick:()=>e(t,"Sección"),title:"Añadir sección aquí",children:"+ Sección aquí"}),l.jsx(le,{size:"xs",variant:"outline",onClick:()=>s(t),title:"Añadir pestañas aquí",children:"+ Pestañas aquí"})]})}function Zm(){const t=H(s=>s.schema),e=b.useMemo(()=>{try{const s=il(t);return Ki(s)}catch{return}},[t]);return l.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-[calc(100vh-80px)]",children:[l.jsx(zm,{}),l.jsxs("div",{className:"grid grid-cols-[260px_1fr_320px] min-h-0",children:[l.jsxs("div",{className:"overflow-auto border-r border-[var(--color-ds-border-default)] ",children:[l.jsx(ym,{}),l.jsx("div",{className:"h-px bg-[var(--color-ds-border-default-50)] my-2"}),l.jsx(Gm,{})]}),l.jsxs(Bm,{className:"overflow-auto",children:[l.jsx("div",{className:"px-4 py-2 border-b text-[var(--color-ds-text-primary)] bg-[var(--color-ds-background-surface)] flex items-center gap-2",children:l.jsx("strong",{children:"Preview"})}),l.jsx("div",{className:"p-4",children:l.jsx(pl,{schema:t,resolver:e})})]}),l.jsx(_m,{})]})]})}function Ym({title:t="Form Schema Editor",baseDir:e="src/schemas",fs:s,services:r,onSchemaChange:n,rightPanel:a,rightPanelWidth:o="320px",rightPanelDefaultOpen:i=!1,rightPanelOpen:c,onRightPanelOpenChange:d,className:u}){const f=H(O=>O.schema),p=typeof c=="boolean",[h,g]=b.useState(i),x=p?c:h,v=O=>{p||g(O),d==null||d(O)};b.useEffect(()=>{n==null||n(f)},[f,n]),b.useEffect(()=>{(!(s!=null&&s.list)||!(s!=null&&s.read)||!(s!=null&&s.write)||!(s!=null&&s.remove))&&console.warn("[SchemaEditorHost] fs adapter incompleto."),r!=null&&r.registry||console.warn("[SchemaEditorHost] services.adapter sin registry.")},[s,r]);const m=!!a,y=a&&x?{paddingRight:o}:void 0,w={width:o};return l.jsx(pf,{value:{fs:s,services:r,baseDir:e},children:l.jsxs("div",{className:["grid grid-rows-[auto_1fr] h-full min-h-[480px]",u].filter(Boolean).join(" "),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-[var(--color-ds-border-default)] border-b bg-[var(--color-ds-background-page)]",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("h1",{className:"text-lg font-semibold text-[var(--color-ds-text-primary)]",children:t}),m&&l.jsx("button",{type:"button",onClick:()=>v(!x),className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs\r
74
+ export type FormValues = yup.InferType<typeof ${t}>;`}function Co(e,t){const r=new Blob([t],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=e,n.click(),URL.revokeObjectURL(s)}function Wh(e){return e.reduce((t,r)=>r.type==="rows"?t+r.sections.length:t+r.tabs.reduce((s,n)=>s+n.sections.length,0),0)}const hn=e=>e.toLowerCase().endsWith(".json")?e:`${e}.json`,Ao=(e,t)=>`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`;function Kh(){var _;const e=J(A=>A.schema),t=J(A=>A.undo),r=J(A=>A.redo),s=J(A=>A.setSchema),n=J(A=>A.resetHistory),a=J(A=>A.past.length),i=J(A=>A.future.length),l=b.useRef(null),{show:c}=Vr(),{fs:d,baseDir:u}=$s(),f=Wh(e.layout),p=e.fields.length,h=((_=e.title)==null?void 0:_.toString().trim().replace(/\s+/g,"-").toLowerCase())||"form-schema",g=()=>{Co(`${h}.json`,JSON.stringify(e,null,2)),c("Esquema exportado como JSON.","success")},x=()=>{try{const A=qh(e,"validationSchema");Co(`${h}.validation.ts`,A),c("Yup exportado como TypeScript.","success")}catch(A){console.error(A),c("No se pudo generar el Yup.","error")}},v=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(e,null,2)),c("JSON copiado al portapapeles.","success")}catch{c("No se pudo copiar al portapapeles.","error")}},m=()=>{var A;return(A=l.current)==null?void 0:A.click()},w=A=>{var z;const S=(z=A.target.files)==null?void 0:z[0];if(!S)return;if(!window.confirm("Vas a reemplazar el esquema actual. ¿Continuar?")){A.currentTarget.value="";return}const V=new FileReader;V.onload=()=>{try{const q=JSON.parse(String(V.result));if(!Array.isArray(q.layout)||!Array.isArray(q.fields)){c("JSON inválido: faltan layout/fields.","error");return}s(()=>q),n(),c("Esquema importado correctamente.","success")}catch{c("No se pudo parsear el JSON.","error")}},V.readAsText(S),A.currentTarget.value=""},y=()=>{window.confirm("Crear un esquema nuevo vacío (perderás cambios no guardados). ¿Continuar?")&&(s(S=>{S.layout=[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],S.fields=[],S.successMessage="Guardado",S.errorMessage="Error",S.onSubmit=async()=>{}}),n(),c("Esquema nuevo creado.","info"))},T=async()=>{try{const A=Ao(u,hn(`${h}.json`));await d.write(A,JSON.stringify(e,null,2)),c(`Guardado rápido en ${A}`,"success")}catch(A){console.error(A),c("Guardado rápido fallido.","error")}},N=async()=>{try{const A=hn(`${h}.json`),S=window.prompt("Guardar como (archivo en baseDir):",A);if(!S)return;const $=Ao(u,hn(S));await d.write($,JSON.stringify(e,null,2)),c(`Guardado en ${$}`,"success")}catch(A){console.error(A),c("No se pudo guardar el archivo.","error")}};return b.useEffect(()=>{const A=S=>{const $=S.metaKey||S.ctrlKey;if($&&S.key.toLowerCase()==="z"&&!S.shiftKey){S.preventDefault(),a>0&&t();return}if($&&S.key.toLowerCase()==="z"&&S.shiftKey||$&&S.key.toLowerCase()==="y"){S.preventDefault(),i>0&&r();return}if($&&S.key.toLowerCase()==="s"){S.preventDefault(),T();return}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[a,i,t,r]),o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-page)] flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{variant:"ghost",onClick:t,disabled:a===0,title:"Deshacer (Ctrl/Cmd+Z)",children:"Undo"}),o.jsx(ie,{variant:"ghost",onClick:r,disabled:i===0,title:"Rehacer (Ctrl/Cmd+Shift+Z · Ctrl+Y)",children:"Redo"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:m,title:"Importar desde JSON",children:"Importar JSON"}),o.jsx(ie,{variant:"outline",onClick:g,title:"Exportar a JSON",children:"Exportar JSON"}),o.jsx(ie,{variant:"outline",onClick:x,title:"Exportar Yup como TypeScript",children:"Exportar Yup (.ts)"}),o.jsx(ie,{variant:"ghost",onClick:v,title:"Copiar JSON al portapapeles",children:"Copiar JSON"}),o.jsx("input",{ref:l,type:"file",accept:"application/json",className:"hidden",onChange:w}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:T,title:"Guardar rápido en baseDir (Ctrl/Cmd+S)",children:"Guardar"}),o.jsx(ie,{variant:"outline",onClick:N,title:"Guardar como… en baseDir",children:"Guardar como…"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{onClick:y,title:"Nuevo esquema",children:"Nuevo"})]}),o.jsxs("div",{className:"flex items-center gap-3 text-[var(--color-ds-text-secondary)] text-ds-sm",children:[o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Secciones: ",o.jsx("strong",{children:f})]}),o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Campos: ",o.jsx("strong",{children:p})]})]})]})}const cs="application/x-ds-field-template",To="application/x-ds-layout-kind";function ds(e){return e.layout.find(t=>(t==null?void 0:t.type)==="rows")}function Gh({className:e,children:t}){var w;const r=J(y=>y.schema),s=J(y=>y.addFieldAndPlace),n=J(y=>y.addRowsBlockAt),a=J(y=>y.addSection),i=J(y=>y.addRowToSection),l=J(y=>y.setRowColumns),c=J(y=>y.moveField),[d,u]=b.useState(!1),f=b.useMemo(()=>{var N;const y=ds(r);if(!y)return[];const T=[];return(N=y.sections)==null||N.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{($.columns??[]).forEach((z,q)=>{var E;const D=((E=z.fields)==null?void 0:E.length)??0,P=Math.max(1,D+1);for(let te=0;te<P;te++)T.push({kind:"field-slot",sectionIdx:A,rowIdx:V,colIdx:q,insertIdx:te,key:`s${A}-r${V}-c${q}-i${te}`})})})}),T},[r]),p=b.useCallback(()=>{var N,_;let y=ds(r);return y?(N=y.sections)!=null&&N.length?(_=y.sections[0].rows)!=null&&_.length?((y.sections[0].rows[0].columns??[]).length||l==null||l(0,0,1),{s:0,r:0,c:0}):(i==null||i(0),{s:0,r:0,c:0}):(a==null||a("Sección 1"),{s:0,r:0,c:0}):(n==null||n(r.layout.length??0,"Sección 1"),{s:0,r:0,c:0})},[r,n,a,i,l]),h=b.useCallback(y=>{var N;const T=((N=y.dataTransfer)==null?void 0:N.types)||[];(T.includes(cs)||T.includes(To))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy",u(T.includes(cs)?"field":"layout"))},[]),g=b.useCallback(()=>u(!1),[]),x=b.useCallback(y=>{var A;const T=y.dataTransfer.getData(To);if(!T)return!1;const{kind:N}=JSON.parse(T),_=((A=r==null?void 0:r.layout)==null?void 0:A.length)??0;return N==="section-layout"&&(n==null||n(_,"Nueva sección")),!0},[(w=r==null?void 0:r.layout)==null?void 0:w.length,n]),v=b.useCallback((y,T)=>{const N=T.dataTransfer.getData(cs);if(!N)return!1;const{fieldTemplate:_}=JSON.parse(N);return s(_,y.sectionIdx,y.rowIdx,y.colIdx),queueMicrotask(()=>{var z;const A=J.getState().schema,V=(((z=ds(A).sections[y.sectionIdx].rows[y.rowIdx].columns[y.colIdx].fields)==null?void 0:z.length)??1)-1;y.insertIdx>=0&&y.insertIdx<V&&c({s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:V},{s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:y.insertIdx})}),!0},[s,c]),m=b.useCallback(y=>{if(y.preventDefault(),y.stopPropagation(),x(y)){u(!1);return}const T=y.dataTransfer.getData(cs);if(T){const{fieldTemplate:N}=JSON.parse(T),_=p();s(N,_.s,_.r,_.c)}u(!1)},[x,p,s]);return o.jsxs("div",{className:["relative",e].filter(Boolean).join(" "),onDragOver:h,onDragLeave:g,onDrop:m,children:[t,d&&o.jsxs("div",{className:"absolute inset-0 z-40",children:[o.jsx("div",{className:"absolute inset-0 bg-black/5 pointer-events-none"}),o.jsx("div",{className:"absolute inset-0 px-4 py-4 overflow-auto space-y-4",children:(()=>{var N;const y=ds(r);if(!y||!((N=y.sections)!=null&&N.length)){const _=p(),A={kind:"field-slot",sectionIdx:_.s,rowIdx:_.r,colIdx:_.c,insertIdx:0,key:"init"};return o.jsx("div",{className:"min-h-[220px] border-2 border-dashed rounded-2xl bg-white/70 flex items-center justify-center text-ds-sm",onDragOver:S=>S.preventDefault(),onDrop:S=>{S.preventDefault(),S.stopPropagation(),v(A,S),u(!1)},children:"Suelta aquí para empezar"})}const T=[];return y.sections.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{const z=[];($.columns??[]).forEach((q,D)=>{const P=f.filter(E=>E.sectionIdx===A&&E.rowIdx===V&&E.colIdx===D);z.push(P)}),T.push({key:`s${A}-r${V}`,cols:z})})}),T.map(_=>o.jsx("div",{className:"grid gap-3 pointer-events-none",style:{gridTemplateColumns:`repeat(${_.cols.length||1}, minmax(0,1fr))`},children:_.cols.map((A,S)=>{const $=A.length===1;return o.jsx("div",{className:"pointer-events-auto",children:o.jsx("div",{className:["rounded-xl border-2 border-dashed bg-white/60",$?"min-h-[160px]":"py-2"].join(" "),children:o.jsx("div",{className:"flex flex-col gap-2",children:A.map(V=>o.jsx("div",{className:"h-7 rounded-md border border-transparent hover:border-[var(--color-ds-border-default)] hover:bg-white/80 flex items-center justify-center text-ds-xs text-[var(--color-ds-text-secondary)]",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.stopPropagation(),v(V,z),u(!1)},title:`Insertar en Col ${V.colIdx+1}, posición ${V.insertIdx+1}`,children:$?"Soltar aquí":V.insertIdx===A.length-1?"Añadir al final":"Insertar aquí"},V.key))})})},`${_.key}-c${S}`)})},_.key))})()})]})]})}function Jh(e,t,r){const s={...e};return t.top+e.y<=r.top?s.y=r.top-t.top:t.bottom+e.y>=r.top+r.height&&(s.y=r.top+r.height-t.bottom),t.left+e.x<=r.left?s.x=r.left-t.left:t.right+e.x>=r.left+r.width&&(s.x=r.left+r.width-t.right),s}const Zh=e=>{let{transform:t,draggingNodeRect:r,windowRect:s}=e;return!r||!s?t:Jh(t,r,s)};function Yh({children:e}){const t=J(D=>D.moveField),r=J(D=>D.moveFieldInTab),s=J(D=>D.removeFieldFromLayout),n=J(D=>D.removeFieldFromTabLayout),a=J(D=>D.insertExistingFieldAt),i=J(D=>D.insertExistingFieldInTabAt),l=J(D=>D.addField),c=J(D=>D.addFieldAndPlaceInTabAt),d=J(D=>D.placeFieldInTabColumn),u=J(D=>D.placeFieldInColumn),f=J(D=>D.moveFieldAt),p=J(D=>D.removeFieldFromLayoutAt),h=J(D=>D.placeFieldInColumnAt),g=J(D=>D.insertExistingFieldAtAt),x=J(D=>D.addFieldAndPlaceAtAt),v=J(D=>D.moveSection),m=J(D=>D.moveTab),w=J(D=>D.moveTabSection),[y,T]=b.useState(null),[N,_]=b.useState(null),A=Bf(fo(ca,{activationConstraint:{distance:6}}),fo(ia)),S=D=>{var E,te;const P=(te=(E=D==null?void 0:D.active)==null?void 0:E.data)==null?void 0:te.current;P&&T({data:P})},$=D=>{var E,te;const P=(te=(E=D==null?void 0:D.over)==null?void 0:E.data)==null?void 0:te.current;_(P??null)},V=(D,P)=>D===void 0?P:Math.max(0,Math.min(D,P)),z=D=>{var ne,K;const P=(K=(ne=D.active)==null?void 0:ne.data)==null?void 0:K.current;let E=null;switch(P==null?void 0:P.kind){case"rows-section":E=["rows-section"];break;case"tabs-tab":E=["tabs-tab"];break;case"tab-section":E=["tab-section"];break;case"field-in-rows":E=["rows-column"];break;case"field-in-tabs":E=["tabs-column"];break;case"palette-field":E=["rows-column","tabs-column"];break;default:E=null}const te=E==null?D.droppableContainers:D.droppableContainers.filter(le=>{var k,I;const C=(I=(k=le.data)==null?void 0:k.current)==null?void 0:I.scope;return C&&E.includes(C)});return te.length?Jf({...D,droppableContainers:te}):al(D)},q=D=>{var te,ne,K,le,C,k,I,U;const P=(ne=(te=D==null?void 0:D.active)==null?void 0:te.data)==null?void 0:ne.current,E=(le=(K=D==null?void 0:D.over)==null?void 0:K.data)==null?void 0:le.current;if(T(null),_(null),!(!P||!E)){if(P.kind==="rows-section"&&E.scope==="rows-section"){if(typeof v=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((C=G==null?void 0:G.sections)==null?void 0:C.length)??0;v(P.nodeIdx,P.sIdx,V(E.insertAt,ee))}return}if(P.kind==="tabs-tab"&&E.scope==="tabs-tab"){if(typeof m=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((k=G==null?void 0:G.tabs)==null?void 0:k.length)??0;m(P.nodeIdx,P.index,V(E.insertAt,ee))}return}if(P.kind==="tab-section"&&E.scope==="tab-section"){if(typeof w=="function"&&P.nodeIdx===E.nodeIdx&&P.tabKey===E.tabKey){const G=J.getState().schema.layout[P.nodeIdx],ee=(I=G==null?void 0:G.tabs)==null?void 0:I.find(W=>W.key===P.tabKey),M=((U=ee==null?void 0:ee.sections)==null?void 0:U.length)??0;w(P.nodeIdx,P.tabKey,P.sIdx,V(E.insertAt,M))}return}if(P.kind==="field-in-rows"&&E.scope==="rows-column"){const G=P.rowsNodeIdx??0,ee=E.rowsNodeIdx??G;typeof f=="function"&&G!==ee?f(G,P.path,ee,{s:E.s,r:E.r,c:E.c,idx:E.insertAt}):t(P.path,{s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey===E.tabKey){r({tabKey:P.tabKey,...P.path},{tabKey:P.tabKey,s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey!==E.tabKey){n({tabKey:P.tabKey,...P.path}),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-rows"&&E.scope==="tabs-column"){const G=P.rowsNodeIdx??0;typeof p=="function"?p(G,P.path):s(P.path),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-tabs"&&E.scope==="rows-column"){n({tabKey:P.tabKey,...P.path});const G=E.rowsNodeIdx??0;if(typeof g=="function"){const ee=typeof E.insertAt=="number"?E.insertAt:void 0;typeof ee=="number"?g(G,P.name,E.s,E.r,E.c,ee):typeof h=="function"?h(G,P.name,E.s,E.r,E.c):u(P.name,E.s,E.r,E.c)}else typeof E.insertAt=="number"?a(P.name,E.s,E.r,E.c,E.insertAt):u(P.name,E.s,E.r,E.c);return}if(P.kind==="palette-field"){if(E.scope==="rows-column"){const G=E.rowsNodeIdx??0;if(typeof E.insertAt=="number"&&typeof x=="function")x(G,{type:P.factoryKind},E.s,E.r,E.c,E.insertAt);else{const ee=J.getState().schema.fields.length;l({type:P.factoryKind});const M=J.getState().schema.fields[ee];typeof h=="function"?h(G,M.name,E.s,E.r,E.c):u(M.name,E.s,E.r,E.c)}return}if(E.scope==="tabs-column"){if(typeof E.insertAt=="number"&&typeof c=="function")c({type:P.factoryKind},E.tabKey,E.s,E.r,E.c,E.insertAt);else{const G=J.getState().schema.fields.length;l({type:P.factoryKind});const ee=J.getState().schema.fields[G];d(ee.name,E.tabKey,E.s,E.r,E.c)}return}}}};return o.jsxs(Vm,{sensors:A,collisionDetection:z,onDragStart:S,onDragOver:$,onDragEnd:q,modifiers:[Zh],children:[e,o.jsx(ah,{children:y?o.jsxs("div",{className:"px-2 py-1 rounded-md border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-surface)] shadow",children:[y.data.kind==="palette-field"&&`Nuevo: ${y.data.factoryKind}`,y.data.kind==="field-in-rows"&&y.data.name,y.data.kind==="field-in-tabs"&&y.data.name,y.data.kind==="rows-section"&&"Sección",y.data.kind==="tabs-tab"&&"Pestaña",y.data.kind==="tab-section"&&"Sección de pestaña"]}):null})]})}function _o(e){const r={...e.scope==="rows-column"?{scope:"rows-column",s:e.s,r:e.r,c:e.c,rowsNodeIdx:e.rowsNodeIdx}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:Number.MAX_SAFE_INTEGER},{setNodeRef:s,isOver:n}=Jr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,className:n?"ring-2 ring-[var(--color-ds-border-default)] rounded-md":"","aria-dropeffect":n?"copy":void 0,"data-drop-scope":e.scope,children:e.children})}function us(e){const r={...e.scope==="rows-column"?{scope:"rows-column",rowsNodeIdx:e.rowsNodeIdx,s:e.s,r:e.r,c:e.c}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:e.insertAt},{setNodeRef:s,isOver:n}=Jr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,role:"button","aria-dropeffect":n?"copy":void 0,"aria-label":`Soltar aquí (posición ${e.insertAt+1})`,"data-drop-scope":e.scope,"data-insert-at":e.insertAt,className:["h-2 my-1 w-full","rounded-sm transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent","relative -mx-1 px-1"].join(" ")})}function Fo(e){const t=e.kind==="field-in-tabs"?`${e.kind}:${e.tabKey}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`:`${e.kind}:${e.rowsNodeIdx}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`,r=e.kind==="field-in-rows"?{kind:e.kind,name:e.name,path:e.path,rowsNodeIdx:e.rowsNodeIdx}:{kind:e.kind,name:e.name,path:e.path,tabKey:e.tabKey},{attributes:s,listeners:n,setNodeRef:a,isDragging:i}=Gr({id:t,data:r});return o.jsxs("div",{ref:a,className:["text-[var(--color-ds-text-primary)] group flex items-center justify-between gap-2 rounded-md px-2 py-1 w-100",i?"opacity-50":"opacity-100"].join(" "),"data-field-name":e.name,children:[o.jsx("button",{type:"button",className:"text-[var(--color-ds-text-primary)] text-ds-sm hover:underline text-left truncate",title:e.name,onClick:e.onSelect,children:e.name}),o.jsx("div",{...n,...s,role:"button","aria-grabbed":i,"aria-label":`Arrastrar campo ${e.name}`,className:["text-[var(--color-ds-text-primary)] text-[10px] select-none cursor-grab active:cursor-grabbing","px-1 py-0.5 rounded-sm","hover:bg-[var(--color-ds-background-muted)]","focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)]"].join(" "),title:"Arrastra para reordenar",children:"⇅"})]})}function Oo({nodeIdx:e,insertAt:t}){const r={scope:"rows-section",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Jr({id:`rows-section:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección en posición ${t+1}`})}function Hh({nodeIdx:e,sIdx:t}){const r=`rows-section:${e}:${t}`,s={kind:"rows-section",nodeIdx:e,sIdx:t},{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Gr({id:r,data:s});return o.jsx("div",{ref:i,...n,...a,role:"button",title:"Arrastrar sección","aria-grabbed":l,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}function Ro({nodeIdx:e,insertAt:t}){const r={scope:"tabs-tab",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Jr({id:`tabs-tab:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["w-8 h-7 rounded-md transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),title:`Insertar pestaña en posición ${t+1}`})}function Xh({nodeIdx:e,index:t,tabKey:r,label:s}){const n=`tabs-tab:${e}:${t}:${r}`,a={kind:"tabs-tab",nodeIdx:e,index:t,tabKey:r},{attributes:i,listeners:l,setNodeRef:c,isDragging:d}=Gr({id:n,data:a});return o.jsxs("div",{ref:c,...i,...l,"aria-grabbed":d,className:["px-2 h-7 inline-flex items-center rounded-full border text-ds-xs cursor-grab active:cursor-grabbing","border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",d?"opacity-50":"opacity-100"].join(" "),title:`Arrastrar pestaña "${s}"`,children:[o.jsx("span",{className:"mr-1",children:"⇅"})," ",s]})}function pn({nodeIdx:e,tabKey:t,insertAt:r}){const s={scope:"tab-section",nodeIdx:e,tabKey:t,insertAt:r},{setNodeRef:n,isOver:a}=Jr({id:`tab-section:${e}:${t}:${r}`,data:s});return o.jsx("div",{ref:n,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",a?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección de pestaña en posición ${r+1}`})}function Qh({nodeIdx:e,tabKey:t,sIdx:r}){const s=`tab-section:${e}:${t}:${r}`,n={kind:"tab-section",nodeIdx:e,tabKey:t,sIdx:r},{attributes:a,listeners:i,setNodeRef:l,isDragging:c}=Gr({id:s,data:n});return o.jsx("div",{ref:l,...a,...i,title:"Arrastrar sección de pestaña","aria-grabbed":c,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}const Do=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),Mo=[1,2,3,4];function bn({expanded:e,onClick:t,labelExpanded:r,labelCollapsed:s,titleExpanded:n,titleCollapsed:a,className:i=""}){return o.jsx(ie,{size:"xs",variant:"ghost","aria-expanded":e,"aria-label":e?r:s,onClick:t,title:e?n??"Colapsar":a??"Expandir",className:`shrink-0 w-8 h-8 p-0 grid place-items-center ${i}`,children:o.jsx(Rs,{className:`w-4 h-4 text-[var(--color-ds-text-primary)] transition-transform duration-150 ${e?"rotate-180":""}`})})}function ep(){const e=J(M=>M.schema),t=J(M=>M.placeFieldInColumn),r=J(M=>M.removeFieldFromLayout),s=J(M=>M.addColumnToRow),n=J(M=>M.setRowColumns),a=J(M=>M.removeColumn),i=J(M=>M.setSelection),l=J(M=>M.renameSection||M.setSectionTitle),c=J(M=>M.removeSection);J(M=>M.duplicateSection),J(M=>M.addRowToSection);const d=J(M=>M.addTabAfter),u=J(M=>M.removeTab),f=J(M=>M.renameTab),p=J(M=>M.addSectionToTab);J(M=>M.addRowToTabSection);const h=J(M=>M.renameTabSection),g=J(M=>M.setTabRowColumns),x=J(M=>M.addColumnToTabRow),v=J(M=>M.removeTabColumn),m=J(M=>M.placeFieldInTabColumn),w=J(M=>M.removeFieldFromTabLayout);J(M=>M.addRowsBlockAt),J(M=>M.addTabsContainerAt);const y=J(M=>M.removeLayoutNode);J(M=>M.duplicateRowInSection);const T=J(M=>M.removeRowFromSection),N=J(M=>M.duplicateTabRow),_=J(M=>M.removeTabRow),[A,S]=b.useState({}),[$,V]=b.useState({}),[z,q]=b.useState({}),[D,P]=b.useState({}),E=(M,W)=>`${M}:${W}`,te=(M,W,me)=>`${M}:${W}:${me}`,ne=(M,W)=>V(me=>({...me,[E(M,W)]:!me[E(M,W)]})),K=(M,W)=>!!$[E(M,W)],le=(M,W,me)=>q(be=>({...be,[te(M,W,me)]:!be[te(M,W,me)]})),C=(M,W,me)=>!!z[te(M,W,me)],k=M=>P(W=>({...W,[M]:!W[M]})),I=M=>!!D[M],U=(M,W)=>l==null?void 0:l(M,W),G=M=>c==null?void 0:c(M),ee=b.useMemo(()=>[...e.fields].reverse().find(M=>M.type!=="inputGroup"&&M.type!=="button"),[e.fields]);return o.jsx(Yh,{children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(gn,{at:0}),e.layout.map((M,W)=>{var me;if(M.type==="rows")return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Oo,{nodeIdx:W,insertAt:0}),M.sections.map((be,de)=>o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"pr-3 bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(bn,{expanded:!K(W,de),onClick:()=>ne(W,de),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección"}),o.jsx(Hh,{nodeIdx:W,sIdx:de}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:be.sectionTitle??"",onChange:ke=>U(de,ke.target.value),onBlur:ke=>U(de,ke.target.value.trim()||"Sección"),reserveErrorSpace:!1}),o.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>G(de),title:"Eliminar sección",children:"✕"})})]})}),K(W,de)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:be.rows.map((ke,ge)=>{const he=ke.columns??[],fe=he.length===0,pe=Do(he.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ge+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Mo.map(ye=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>n(de,ge,ye),title:`${ye} columna(s)`,children:ye},ye)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>s(de,ge),title:"Añadir columna",children:"+ columna"})]})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>T==null?void 0:T(de,ge),title:"Eliminar fila",children:"✕"})]}),fe?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:he.map((ye,ce)=>o.jsx(_o,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default-50)]",children:["Col ",ce+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:ye.width||pe[ce]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>a(de,ge,ce),title:"Eliminar columna",children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(us,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:0}),(ye.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(ye.fields??[]).map((Se,Te)=>{const j=typeof Se=="string"?Se:Se.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(Fo,{kind:"field-in-rows",rowsNodeIdx:W,name:j,path:{s:de,r:ge,c:ce,idx:Te},onSelect:()=>i({kind:"field",name:j})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>r({s:de,r:ge,c:ce,idx:Te}),title:"Quitar del layout",children:"✕"})]}),o.jsx(us,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:Te+1})]},`${j}-${Te}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&t(ee.name,de,ge,ce),title:"Colocar el último campo creado en esta columna",children:"Colocar último campo"})})]})]})},`col-${W}-${de}-${ge}-${ce}`))})]},ge)})})]}),o.jsx(Oo,{nodeIdx:W,insertAt:de+1})]},`rows-sec-${W}-${de}`))]}),o.jsx(gn,{at:W+1})]},`rows-${W}`);if(M.type==="tabs"){const be=M.tabs.map(ge=>({label:ge.label,value:ge.key})),de=(me=M.tabs[0])==null?void 0:me.key,ke=A[W]??de??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1 pr-2",children:[o.jsx(bn,{expanded:!I(W),onClick:()=>k(W),labelExpanded:"Colapsar pestañas",labelCollapsed:"Expandir pestañas"}),o.jsx("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Pestañas"}),o.jsx("div",{className:"ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>y(W),title:"Eliminar bloque",children:"✕"})})]})}),I(W)?null:o.jsxs("div",{className:"bg-[var(--color-ds-background)]",children:[o.jsxs("div",{className:"px-2 py-2 flex items-center gap-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Orden pestañas"}),o.jsx(Ro,{nodeIdx:W,insertAt:0}),M.tabs.map((ge,he)=>o.jsxs(b.Fragment,{children:[o.jsx(Xh,{nodeIdx:W,index:he,tabKey:ge.key,label:ge.label}),o.jsx(Ro,{nodeIdx:W,insertAt:he+1})]},`tabchip-${W}-${ge.key}`))]}),o.jsx("div",{className:"border-b border-[var(--color-ds-border-default-50)]",children:o.jsx(Ir,{options:be,value:ke,onChange:ge=>S(he=>({...he,[W]:ge})),children:M.tabs.reduce((ge,he)=>(ge[he.key]=o.jsxs("div",{className:"space-y-3",children:[ke===he.key&&o.jsxs("div",{className:"p-2 flex flex-wrap items-center gap-2",children:[o.jsx(we,{size:"sm",label:"Nombre pestaña",value:he.label,onChange:fe=>f==null?void 0:f(he.key,fe.target.value),className:"w-48",reserveErrorSpace:!1}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>d==null?void 0:d(he.key),children:"+ pestaña"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>p==null?void 0:p(he.key,"Nueva sección"),children:"+ sección"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>u==null?void 0:u(he.key),disabled:M.tabs.length<=1,children:"eliminar pestaña"})]}),he.sections.length===0?o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,he.sections.map((fe,pe)=>o.jsxs(b.Fragment,{children:[pe===0?o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(bn,{expanded:!C(W,he.key,pe),onClick:()=>le(W,he.key,pe),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección",className:"ml-2"}),o.jsx(Qh,{nodeIdx:W,tabKey:he.key,sIdx:pe}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:fe.sectionTitle??"",onChange:ye=>h==null?void 0:h(he.key,pe,ye.target.value),onBlur:ye=>h==null?void 0:h(he.key,pe,ye.target.value.trim()||"Sección"),reserveErrorSpace:!1})]})}),C(W,he.key,pe)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:fe.rows.map((ye,ce)=>{const Se=ye.columns??[],Te=Se.length===0,j=Do(Se.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ce+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Mo.map(F=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>g==null?void 0:g(he.key,pe,ce,F),title:`${F} columna(s)`,children:F},F)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>x==null?void 0:x(he.key,pe,ce),title:"Añadir columna",children:"+ columna"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"subtle",onClick:()=>N==null?void 0:N(he.key,pe,ce),title:"Duplicar fila",children:"duplicar"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>_==null?void 0:_(he.key,pe,ce),title:"Eliminar fila",children:"eliminar"})]})]}),Te?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:Se.map((F,R)=>o.jsx(_o,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border border-[var(--color-ds-border-default-50)]",children:["Col ",R+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:F.width||j[R]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>v==null?void 0:v(he.key,pe,ce,R),children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(us,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:0}),(F.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(F.fields??[]).map((X,Y)=>{const Z=typeof X=="string"?X:X.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(Fo,{kind:"field-in-tabs",tabKey:he.key,name:Z,path:{s:pe,r:ce,c:R,idx:Y},onSelect:()=>i({kind:"field",name:Z})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>w==null?void 0:w({tabKey:he.key,s:pe,r:ce,c:R,idx:Y}),children:"✕"})]}),o.jsx(us,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:Y+1})]},`${Z}-${Y}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&(m==null?void 0:m(ee.name,he.key,pe,ce,R)),children:"Colocar último campo"})})]})]})},`tcol-${he.key}-${ce}-${R}`))})]},`trow-${he.key}-${ce}`)})})]}),o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:pe+1})})]},`tsec-${he.key}-${pe}`))]}),ge),{})})})]})]}),o.jsx(gn,{at:W+1})]},`tabs-${W}`)}return null})]})})}function gn({at:e}){const t=J(s=>s.addRowsBlockAt),r=J(s=>s.addTabsContainerAt);return o.jsxs("div",{className:"my-2 flex items-center justify-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>t(e,"Sección"),title:"Añadir sección aquí",children:"+ Sección aquí"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>r(e),title:"Añadir pestañas aquí",children:"+ Pestañas aquí"})]})}function tp(){const e=J(r=>r.schema),t=b.useMemo(()=>{try{const r=Di(e);return gi(r)}catch{return}},[e]);return o.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-[calc(100vh-80px)]",children:[o.jsx(Kh,{}),o.jsxs("div",{className:"grid grid-cols-[260px_1fr_320px] min-h-0",children:[o.jsxs("div",{className:"overflow-auto border-r border-[var(--color-ds-border-default)] ",children:[o.jsx(Sh,{}),o.jsx("div",{className:"h-px bg-[var(--color-ds-border-default-50)] my-2"}),o.jsx(ep,{})]}),o.jsxs(Gh,{className:"overflow-auto",children:[o.jsx("div",{className:"px-4 py-2 border-b text-[var(--color-ds-text-primary)] bg-[var(--color-ds-background-surface)] flex items-center gap-2",children:o.jsx("strong",{children:"Preview"})}),o.jsx("div",{className:"p-4",children:o.jsx(Vi,{schema:e,resolver:t})})]}),o.jsx(Ph,{})]})]})}function rp({title:e="Form Schema Editor",baseDir:t="src/schemas",fs:r,services:s,onSchemaChange:n,rightPanel:a,rightPanelWidth:i="320px",rightPanelDefaultOpen:l=!1,rightPanelOpen:c,onRightPanelOpenChange:d,className:u}){const f=J(T=>T.schema),p=typeof c=="boolean",[h,g]=b.useState(l),x=p?c:h,v=T=>{p||g(T),d==null||d(T)};b.useEffect(()=>{n==null||n(f)},[f,n]),b.useEffect(()=>{(!(r!=null&&r.list)||!(r!=null&&r.read)||!(r!=null&&r.write)||!(r!=null&&r.remove))&&console.warn("[SchemaEditorHost] fs adapter incompleto."),s!=null&&s.registry||console.warn("[SchemaEditorHost] services.adapter sin registry.")},[r,s]);const m=!!a,w=a&&x?{paddingRight:i}:void 0,y={width:i};return o.jsx(Lu,{value:{fs:r,services:s,baseDir:t},children:o.jsxs("div",{className:["grid grid-rows-[auto_1fr] h-full min-h-[480px]",u].filter(Boolean).join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-[var(--color-ds-border-default)] border-b bg-[var(--color-ds-background-page)]",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h1",{className:"text-lg font-semibold text-[var(--color-ds-text-primary)]",children:e}),m&&o.jsx("button",{type:"button",onClick:()=>v(!x),className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs\r
75
75
  border-[var(--color-ds-border-default-50)]\r
76
76
  text-[var(--color-ds-text-primary)]\r
77
- hover:bg-[var(--color-ds-background-surface)]`,title:x?"Ocultar panel":"Mostrar panel","aria-pressed":x,"aria-label":"Alternar panel derecho",children:x?l.jsxs(l.Fragment,{children:[l.jsx(ui,{className:"w-4 h-4"}),"Ocultar panel"]}):l.jsxs(l.Fragment,{children:[l.jsx(Nc,{className:"w-4 h-4"}),"Mostrar panel"]})})]}),l.jsxs("div",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:["baseDir: ",l.jsx("code",{children:e})]})]}),l.jsxs("div",{className:"relative min-h-0",children:[l.jsx("div",{className:"min-h-0 h-full overflow-hidden",style:y,children:l.jsx(Zm,{})}),a&&x&&l.jsx("aside",{className:"absolute inset-y-0 right-0 border-l min-h-0 overflow-auto bg-[var(--color-ds-background-page)]",style:w,children:a})]})]})})}function Xm({name:t,canUp:e,canDown:s,canLeft:r,canRight:n,onSelect:a,onUp:o,onDown:i,onLeft:c,onRight:d,onDuplicate:u,onRemove:f}){return l.jsxs("div",{className:`group flex items-center justify-between gap-2 rounded-md border px-2 py-1\r
77
+ hover:bg-[var(--color-ds-background-surface)]`,title:x?"Ocultar panel":"Mostrar panel","aria-pressed":x,"aria-label":"Alternar panel derecho",children:x?o.jsxs(o.Fragment,{children:[o.jsx(Lo,{className:"w-4 h-4"}),"Ocultar panel"]}):o.jsxs(o.Fragment,{children:[o.jsx(Zl,{className:"w-4 h-4"}),"Mostrar panel"]})})]}),o.jsxs("div",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:["baseDir: ",o.jsx("code",{children:t})]})]}),o.jsxs("div",{className:"relative min-h-0",children:[o.jsx("div",{className:"min-h-0 h-full overflow-hidden",style:w,children:o.jsx(tp,{})}),a&&x&&o.jsx("aside",{className:"absolute inset-y-0 right-0 border-l min-h-0 overflow-auto bg-[var(--color-ds-background-page)]",style:y,children:a})]})]})})}function sp({name:e,canUp:t,canDown:r,canLeft:s,canRight:n,onSelect:a,onUp:i,onDown:l,onLeft:c,onRight:d,onDuplicate:u,onRemove:f}){return o.jsxs("div",{className:`group flex items-center justify-between gap-2 rounded-md border px-2 py-1\r
78
78
  bg-[var(--color-ds-background-surface)]\r
79
79
  border-[var(--color-ds-border-default)]\r
80
- text-[var(--color-ds-text-primary)]`,children:[l.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm hover:underline",onClick:a,children:[l.jsx(Rc,{className:"h-4 w-4 opacity-70"}),t]}),l.jsxs("div",{className:"invisible group-hover:visible flex items-center gap-1",children:[l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Subir",icon:yc,disabled:!e,onClick:o}),l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Bajar",icon:pc,disabled:!s,onClick:i}),l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Izquierda",icon:gc,disabled:!r,onClick:c}),l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Derecha",icon:xc,disabled:!n,onClick:d}),l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Duplicar",icon:Uc,onClick:u}),l.jsx(le,{type:"button",variant:"ghost",ariaLabel:"Quitar",icon:Jc,onClick:f})]})]})}function ta({widthLabel:t,fields:e,indices:s,canMoveLeft:r,canMoveRight:n,onSelect:a,onMove:o,onDuplicate:i,onRemoveAt:c,onPlaceLast:d,placeDisabled:u,readOnly:f=!1}){const{sIdx:p,rIdx:h,cIdx:g}=s;return l.jsxs("div",{className:`flex-1 rounded-lg p-2 border border-dashed\r
80
+ text-[var(--color-ds-text-primary)]`,children:[o.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm hover:underline",onClick:a,children:[o.jsx(rc,{className:"h-4 w-4 opacity-70"}),e]}),o.jsxs("div",{className:"invisible group-hover:visible flex items-center gap-1",children:[o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Subir",icon:ql,disabled:!t,onClick:i}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Bajar",icon:Pl,disabled:!r,onClick:l}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Izquierda",icon:Il,disabled:!s,onClick:c}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Derecha",icon:Bl,disabled:!n,onClick:d}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Duplicar",icon:mc,onClick:u}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Quitar",icon:gc,onClick:f})]})]})}function In({widthLabel:e,fields:t,indices:r,canMoveLeft:s,canMoveRight:n,onSelect:a,onMove:i,onDuplicate:l,onRemoveAt:c,onPlaceLast:d,placeDisabled:u,readOnly:f=!1}){const{sIdx:p,rIdx:h,cIdx:g}=r;return o.jsxs("div",{className:`flex-1 rounded-lg p-2 border border-dashed\r
81
81
  bg-[var(--color-ds-background-page)]\r
82
- border-[var(--color-ds-border-muted)]`,children:[l.jsx("div",{className:"text-[10px] mb-2 text-[var(--color-ds-text-secondary)]",children:t||"flex-1"}),l.jsx("ul",{className:"space-y-1",children:e.map((x,v)=>l.jsx("li",{children:l.jsx(Xm,{name:x,canUp:v>0,canDown:v<e.length-1,canLeft:r,canRight:n,onSelect:()=>a(x),onUp:()=>o({s:p,r:h,c:g,idx:v},{idx:v-1}),onDown:()=>o({s:p,r:h,c:g,idx:v},{idx:v+1}),onLeft:()=>r&&o({s:p,r:h,c:g,idx:v},{c:g-1,idx:void 0}),onRight:()=>n&&o({s:p,r:h,c:g,idx:v},{c:g+1,idx:void 0}),onDuplicate:()=>i(x),onRemove:()=>c({s:p,r:h,c:g,idx:v})})},`${x}-${v}`))}),l.jsx("div",{className:"mt-3",children:l.jsx(le,{type:"button",variant:"outline",onClick:d,disabled:f||u,"aria-disabled":f||u,children:"Colocar último campo"})})]})}const Qm=t=>t.type!=="inputGroup"&&t.type!=="button";function eg(){const t=H(u=>u.schema),e=H(u=>u.setSelection),s=H(u=>u.moveField),r=H(u=>u.removeFieldFromLayout),n=H(u=>u.placeFieldInColumn),a=H(u=>u.duplicateField),[o,i]=b.useState({}),c=b.useMemo(()=>[...t.fields].reverse().find(Qm),[t.fields]),d=b.useMemo(()=>{const u=[];return t.layout.forEach((f,p)=>{var h;if(f.type==="rows"&&f.sections.forEach((g,x)=>{const v=l.jsx("div",{className:"space-y-2",children:g.rows.map((m,y)=>l.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${m.columns.length}, minmax(0, 1fr))`},children:m.columns.map((w,O)=>l.jsx(ta,{widthLabel:w.width||"flex-1",fields:w.fields??[],indices:{sIdx:x,rIdx:y,cIdx:O},canMoveLeft:O>0,canMoveRight:O<m.columns.length-1,onSelect:S=>e({kind:"field",name:S}),onMove:(S,T)=>s(S,{s:S.s,r:S.r,c:T.c??S.c,idx:T.idx}),onDuplicate:S=>a(S,`${S}_copy`),onRemoveAt:S=>r(S),onPlaceLast:()=>(c==null?void 0:c.name)&&n(c.name,x,y,O),placeDisabled:!(c!=null&&c.name)},`col-${x}-${y}-${O}`))},`row-${x}-${y}`))});u.push({id:`rows-${p}-sec-${x}`,title:g.sectionTitle,defaultOpen:g.defaultOpen,content:v})}),f.type==="tabs"){const g=f.tabs.map(w=>({label:w.label,value:w.key})),x=(h=f.tabs[0])==null?void 0:h.key,v=o[p]??x,m={};f.tabs.forEach(w=>{const O=l.jsx("div",{className:"space-y-4",children:w.sections.map((S,T)=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:S.sectionTitle}),S.rows.map((C,N)=>l.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${C.columns.length}, minmax(0, 1fr))`},children:C.columns.map((_,I)=>l.jsx(ta,{widthLabel:_.width||"flex-1",fields:_.fields??[],indices:{sIdx:0,rIdx:0,cIdx:0},canMoveLeft:!1,canMoveRight:!1,onSelect:z=>e({kind:"field",name:z}),onMove:()=>{},onDuplicate:()=>{},onRemoveAt:()=>{},onPlaceLast:()=>{},placeDisabled:!0,readOnly:!0},`tab-${w.key}-col-${N}-${I}`))},`tab-${w.key}-row-${N}`))]},`tab-${w.key}-sec-${T}`))});m[w.key]=O});const y=l.jsx("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)]",children:l.jsx("div",{className:"p-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:l.jsx(Hs,{options:g,value:v,onChange:w=>i(O=>({...O,[p]:w})),children:m})})});u.push({id:`tabs-${p}`,title:"Contenedor de pestañas",defaultOpen:!0,content:y})}}),u},[t.layout,c==null?void 0:c.name,a,s,n,r,e,o]);return l.jsx("div",{className:"p-3",children:l.jsx(Sl,{items:d})})}exports.Button=le;exports.Canvas=eg;exports.Checkbox=ft;exports.CollapsibleSection=ct;exports.ColumnDropZone=ta;exports.CompactAccordion=Sl;exports.DateInput=Ms;exports.DropdownMenu=Zd;exports.FileUploader=Bi;exports.FormFieldInput=fa;exports.FormPageLayout=bu;exports.FormRenderer=pl;exports.Header=wl;exports.Icon=Nt;exports.IconButton=bl;exports.InfoButton=ua;exports.Input=je;exports.InputGroup=ll;exports.LoadingScreen=Zf;exports.Modal=Yf;exports.OptionGroup=cl;exports.PageLayout=eh;exports.SchemaEditorHost=Ym;exports.SearchField=hl;exports.Select=nt;exports.Sidebar=jl;exports.SidebarNav=pa;exports.SkeletonLoader=ts;exports.Table=th;exports.Tabs=Hs;exports.TextArea=Gr;exports.ThemeProvider=Gf;exports.ThemeToggle=xl;exports.Toast=dl;exports.ToastProvider=cf;exports.ToggleSwitch=kl;exports.useToast=Gs;
82
+ border-[var(--color-ds-border-muted)]`,children:[o.jsx("div",{className:"text-[10px] mb-2 text-[var(--color-ds-text-secondary)]",children:e||"flex-1"}),o.jsx("ul",{className:"space-y-1",children:t.map((x,v)=>o.jsx("li",{children:o.jsx(sp,{name:x,canUp:v>0,canDown:v<t.length-1,canLeft:s,canRight:n,onSelect:()=>a(x),onUp:()=>i({s:p,r:h,c:g,idx:v},{idx:v-1}),onDown:()=>i({s:p,r:h,c:g,idx:v},{idx:v+1}),onLeft:()=>s&&i({s:p,r:h,c:g,idx:v},{c:g-1,idx:void 0}),onRight:()=>n&&i({s:p,r:h,c:g,idx:v},{c:g+1,idx:void 0}),onDuplicate:()=>l(x),onRemove:()=>c({s:p,r:h,c:g,idx:v})})},`${x}-${v}`))}),o.jsx("div",{className:"mt-3",children:o.jsx(ie,{type:"button",variant:"outline",onClick:d,disabled:f||u,"aria-disabled":f||u,children:"Colocar último campo"})})]})}const np=e=>e.type!=="inputGroup"&&e.type!=="button";function ap(){const e=J(u=>u.schema),t=J(u=>u.setSelection),r=J(u=>u.moveField),s=J(u=>u.removeFieldFromLayout),n=J(u=>u.placeFieldInColumn),a=J(u=>u.duplicateField),[i,l]=b.useState({}),c=b.useMemo(()=>[...e.fields].reverse().find(np),[e.fields]),d=b.useMemo(()=>{const u=[];return e.layout.forEach((f,p)=>{var h;if(f.type==="rows"&&f.sections.forEach((g,x)=>{const v=o.jsx("div",{className:"space-y-2",children:g.rows.map((m,w)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${m.columns.length}, minmax(0, 1fr))`},children:m.columns.map((y,T)=>o.jsx(In,{widthLabel:y.width||"flex-1",fields:y.fields??[],indices:{sIdx:x,rIdx:w,cIdx:T},canMoveLeft:T>0,canMoveRight:T<m.columns.length-1,onSelect:N=>t({kind:"field",name:N}),onMove:(N,_)=>r(N,{s:N.s,r:N.r,c:_.c??N.c,idx:_.idx}),onDuplicate:N=>a(N,`${N}_copy`),onRemoveAt:N=>s(N),onPlaceLast:()=>(c==null?void 0:c.name)&&n(c.name,x,w,T),placeDisabled:!(c!=null&&c.name)},`col-${x}-${w}-${T}`))},`row-${x}-${w}`))});u.push({id:`rows-${p}-sec-${x}`,title:g.sectionTitle,defaultOpen:g.defaultOpen,content:v})}),f.type==="tabs"){const g=f.tabs.map(y=>({label:y.label,value:y.key})),x=(h=f.tabs[0])==null?void 0:h.key,v=i[p]??x,m={};f.tabs.forEach(y=>{const T=o.jsx("div",{className:"space-y-4",children:y.sections.map((N,_)=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:N.sectionTitle}),N.rows.map((A,S)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${A.columns.length}, minmax(0, 1fr))`},children:A.columns.map(($,V)=>o.jsx(In,{widthLabel:$.width||"flex-1",fields:$.fields??[],indices:{sIdx:0,rIdx:0,cIdx:0},canMoveLeft:!1,canMoveRight:!1,onSelect:z=>t({kind:"field",name:z}),onMove:()=>{},onDuplicate:()=>{},onRemoveAt:()=>{},onPlaceLast:()=>{},placeDisabled:!0,readOnly:!0},`tab-${y.key}-col-${S}-${V}`))},`tab-${y.key}-row-${S}`))]},`tab-${y.key}-sec-${_}`))});m[y.key]=T});const w=o.jsx("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)]",children:o.jsx("div",{className:"p-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:o.jsx(Ir,{options:g,value:v,onChange:y=>l(T=>({...T,[p]:y})),children:m})})});u.push({id:`tabs-${p}`,title:"Contenedor de pestañas",defaultOpen:!0,content:w})}}),u},[e.layout,c==null?void 0:c.name,a,r,n,s,t,i]);return o.jsx("div",{className:"p-3",children:o.jsx(Ji,{items:d})})}exports.Button=ie;exports.Canvas=ap;exports.Checkbox=dt;exports.CollapsibleSection=it;exports.ColumnDropZone=In;exports.CompactAccordion=Ji;exports.DateInput=Fr;exports.DropdownMenu=yd;exports.FileUploader=pi;exports.FormFieldInput=Yn;exports.FormPageLayout=Vd;exports.FormRenderer=Vi;exports.Header=Wi;exports.Icon=kt;exports.IconButton=Bi;exports.InfoButton=Zn;exports.Input=we;exports.InputGroup=Mi;exports.LoadingScreen=ef;exports.Modal=tf;exports.OptionGroup=$i;exports.PageLayout=nf;exports.SchemaEditorHost=rp;exports.SearchField=Ii;exports.Select=rt;exports.Sidebar=Ki;exports.SidebarNav=Qn;exports.SkeletonLoader=Xt;exports.Table=af;exports.Tabs=Ir;exports.TextArea=Ls;exports.ThemeProvider=Qu;exports.ThemeToggle=Ui;exports.Toast=Li;exports.ToastProvider=Ou;exports.ToggleSwitch=Gi;exports.useToast=Vr;