@dipusevilla/componentes-iu 1.1.17 → 1.1.18

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
@@ -95,7 +95,7 @@ attempted value: ${i}
95
95
  shadow-lg ${X} max-h-48 overflow-auto z-10
96
96
  `,children:R.map(de=>s.jsx("li",{className:`px-2 ${q} flex items-center cursor-pointer
97
97
  text-[var(--color-ds-text-primary)]
98
- hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const be=String(de.value).trim();E(e,be,{shouldDirty:!0,shouldValidate:!0}),V(de.label??be),te.current=!1,J.current=!1,Z(!1)},children:de.label},String(de.value)))})]})}})}const qn=(e,t)=>e[t],r0=e=>e instanceof Date?e.getTime():e;function xO(e,t,r){const n=r0(e),o=r0(t);return typeof n=="number"&&typeof o=="number"||typeof n=="string"&&typeof o=="string"?r==="gt"?n>o:r==="gte"?n>=o:r==="lt"?n<o:n<=o:!1}function Ao(e,t){if(!e)return!1;switch(e.op){case"eq":return qn(t,e.field)===e.value;case"neq":return qn(t,e.field)!==e.value;case"in":return e.values.includes(qn(t,e.field));case"notIn":return!e.values.includes(qn(t,e.field));case"gt":case"gte":case"lt":case"lte":return xO(qn(t,e.field),e.value,e.op);case"and":return e.rules.every(r=>Ao(r,t));case"or":return e.rules.some(r=>Ao(r,t));case"always":return!!e.value;default:return!1}}function Ci(e){return!!e&&(typeof e=="function"||typeof e=="object")}function An(e,t){const r=t==="outline"?Cn:Sn,n=r==null?void 0:r[e];return Ci(n)?n:null}const wO=Object.entries(Cn).filter(([e,t])=>e.endsWith("Icon")&&Ci(t)).map(([e,t])=>({name:e,Icon:t,style:"outline"})),yO=Object.entries(Sn).filter(([e,t])=>e.endsWith("Icon")&&Ci(t)).map(([e,t])=>({name:e,Icon:t,style:"solid"})),jO=oi||ai||(e=>s.jsx("svg",{...e})),Wr=({value:e,onChange:t,buttonLabel:r,disabled:n,className:o})=>{const[l,i]=k.useState(!1),[c,u]=k.useState(""),[d,m]=k.useState((e==null?void 0:e.style)??"outline"),f=e&&An(e.name,e.style)||jO,h=k.useCallback((b,v)=>{const g=An(b,v);t==null||t({name:b,style:v},g),i(!1)},[t]),p=k.useCallback(()=>{t==null||t(void 0,void 0),i(!1)},[t]);return s.jsxs(s.Fragment,{children:[s.jsx(ue,{size:"sm",variant:"outline",shape:"circle",className:`rounded-full p-0 w-8 h-8 inline-flex items-center justify-center ${o??""}`,disabled:n,onClick:()=>i(!0),ariaLabel:"Elegir icono",title:r||"Elegir icono",children:s.jsx(f,{className:"h-4 w-4"})}),s.jsx(Nt,{isOpen:l,onClose:()=>i(!1),title:"Seleccionar icono",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ke,{labelHidden:!0,placeholder:"Buscar icono (p. ej. 'user', 'arrow', 'calendar'...)",value:c,onChange:b=>u(b.target.value)}),s.jsx(xr,{options:[{label:"Outline",value:"outline"},{label:"Solid",value:"solid"}],value:d,onChange:b=>m(b),children:{outline:s.jsx(n0,{items:wO,query:c,onPick:b=>h(b,"outline"),onClear:p}),solid:s.jsx(n0,{items:yO,query:c,onPick:b=>h(b,"solid"),onClear:p})}})]})})]})},n0=({items:e,query:t,onPick:r,onClear:n})=>{const o=k.useMemo(()=>{if(!t.trim())return e;const i=t.trim().toLowerCase().replace(/\s+/g,"");return e.filter(c=>c.name.toLowerCase().includes(i))},[e,t]),l=et;return s.jsx("div",{className:"custom-scroll max-h-[60vh] overflow-y-auto",children:s.jsxs("div",{className:"grid gap-2 grid-cols-3 sm:grid-cols-4 md:grid-cols-6",children:[s.jsxs("button",{type:"button",onClick:n,className:"group w-full aspect-square border border-[var(--color-ds-border-default-50)] rounded-lg p-1 bg-[var(--color-ds-background-page)] hover:bg-[var(--color-ds-background-accent)]/5 hover:border-[var(--color-ds-border-default)] transition focus:outline-none",title:"Ninguno","aria-label":"Quitar icono",children:[s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:l?s.jsx(l,{className:"w-6 h-6"}):s.jsx("span",{className:"text-ds-lg",children:"×"})}),s.jsx("div",{className:"mt-1 text-center",children:s.jsx("span",{className:"block text-[11px] leading-tight text-[var(--color-ds-text-secondary)] truncate",children:"Ninguno"})})]}),(o.length===0?e:o).map(({name:i,Icon:c})=>s.jsxs("button",{type:"button",onClick:()=>r(i),className:"group w-full aspect-square border border-[var(--color-ds-border-default-50)] rounded-lg p-1 bg-[var(--color-ds-background-page)] hover:bg-[var(--color-ds-background-accent)]/5 hover:border-[var(--color-ds-border-default)] transition focus:outline-none",title:i,"aria-label":`Elegir ${i}`,children:[s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:s.jsx(c,{className:"w-6 h-6 text-[var(--color-ds-text-primary)]"})}),s.jsx("div",{className:"mt-1 text-center",children:s.jsx("span",{className:"block text-[11px] leading-tight text-[var(--color-ds-text-secondary)] truncate",children:i.replace(/Icon$/,"")})})]},i))]})})};function st(e,t,r=""){if(!t)return r;if(typeof t=="object"&&t!==null){if(t.type==="complex"){const o=[];return t.header&&o.push(`<strong>${t.header}</strong>`),t.template&&o.push(t.template),o.join("<br/>")||r}return r}return e(t,{defaultValue:t})}const kO=({schema:e,renderField:t})=>{var v,g,x;const{control:r}=Tr(),{fields:n,append:o,remove:l}=Bx({control:r,name:e.name}),{label:i,addLabel:c="Añadir",items:u,disabled:d,validation:m,className:f}=e,{formState:{errors:h}}=Tr(),p=((g=(v=h[e.name])==null?void 0:v.root)==null?void 0:g.message)||((x=h[e.name])==null?void 0:x.message),b=typeof p=="string"?p:void 0;return s.jsxs("div",{className:pe("space-y-3",f),children:[i&&s.jsx("div",{className:"flex items-center justify-between",children:s.jsx("label",{className:"block text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:i})}),s.jsx("div",{className:"space-y-4",children:n.map((w,y)=>{const E=`${e.name}.${y}`;return s.jsxs("div",{className:"relative rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] p-4 group",children:[!d&&s.jsx("div",{className:"absolute top-2 right-2",children:s.jsx(ue,{size:"xs",variant:"ghost",className:"text-[var(--color-ds-text-error)] hover:bg-[var(--color-ds-background-error-hover)]",onClick:()=>l(y),title:"Eliminar fila",ariaLabel:"Eliminar fila",children:s.jsx(pt,{className:"w-4 h-4"})})}),s.jsx("div",{className:"grid grid-cols-1 gap-4",children:u.map((j,R)=>s.jsx(k.Fragment,{children:t(j,E)},R))})]},w.id)})}),n.length===0&&s.jsx("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] italic p-2 border border-dashed border-[var(--color-ds-border-default-50)] rounded bg-[var(--color-ds-background-subtle)]",children:"No hay elementos."}),b&&s.jsx("p",{className:"text-xs text-[var(--color-ds-text-error)]",children:b}),!d&&s.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>{o({})},children:[s.jsx(Jt,{className:"w-4 h-4 mr-1"}),c]})]})};function a0(e){return(e??"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9]/g,"").slice(0,24)}function EO(e){return e.replace(/(.{4})/g,"$1 ").trim()}function ts({label:e,labelHidden:t,placeholder:r="ES00 0000 0000 0000 0000 0000",size:n="sm",value:o,onChange:l,onBlur:i,disabled:c,required:u,reserveErrorSpace:d=!0,error:m,errorMessage:f,hasError:h,id:p,name:b,className:v,"aria-label":g}){const x=k.useMemo(()=>a0(o),[o]),w=k.useMemo(()=>EO(x),[x]),y=E=>{const j=a0(E.target.value);l(j)};return s.jsx(ke,{id:p,name:b,label:e,labelHidden:t,placeholder:r,size:n,value:w,onChange:y,onBlur:i,disabled:c,required:u,hasError:h||!!m||!!f,errorMessage:f||m,reserveErrorSpace:d,prefixIcon:Wl,className:v,"aria-label":g,inputMode:"text",autoComplete:"off",spellCheck:!1})}function o0(e){return(e??"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9]/g,"").slice(0,9)}function Si({label:e,labelHidden:t,placeholder:r="12345678A",size:n="sm",value:o,onChange:l,onBlur:i,disabled:c,required:u,reserveErrorSpace:d=!0,error:m,errorMessage:f,hasError:h,id:p,name:b,className:v,"aria-label":g}){const{t:x}=gt(),w=k.useMemo(()=>o0(o),[o]),y=k.useMemo(()=>w,[w]),E=j=>{const R=o0(j.target.value);l(R)};return s.jsx(ke,{id:p,name:b,label:e,labelHidden:t,placeholder:r,size:n,value:y,onChange:E,onBlur:i,disabled:c,required:u,hasError:h||!!m||!!f,errorMessage:f||m,prefixIcon:Ql,className:v,"aria-label":g,inputMode:"text",autoComplete:"off",spellCheck:!1,reserveErrorSpace:d})}function s0(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}if(typeof e=="object")return e}}function RO(e,t){var r;return Array.isArray(e)?e.length&&typeof e[0]=="object"&&"value"in e[0]?t?e.map(n=>n.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 CO=e=>e.type!=="inputGroup"&&e.type!=="button";function SO(){try{return Mt()??void 0}catch{return}}function Ot(e){if(!e||typeof e!="object")return;const t=e.name,r=e.style;if(!(!t||!r))return An(t,r)||void 0}function t1({schema:e,resolver:t,serviceRegistry:r,activeVariantId:n}){var ee;const{layout:o,fields:l=[],onSubmit:i,successMessage:c,errorMessage:u,footerButtons:d,defaultValues:m,loadDefaultValues:f,validationSchema:h}=e,{show:p}=Vr(),{t:b}=gt(),v=SO(),g=r??((ee=v==null?void 0:v.services)==null?void 0:ee.registry)??void 0,x=k.useMemo(()=>{if(t)return t;try{const $=h??ki(e);return wi($)}catch{return}},[t,e,h]),w=gi({resolver:x,mode:"onBlur",reValidateMode:"onChange",defaultValues:m??{}}),y=Jr($=>$.setRuntimeState),E=Jr($=>$.systemContext),j=Jr($=>$.formValues);k.useEffect(()=>{y({isActive:!0});let $=!1;return(async()=>{const D=e.defaultSource,F=e.onloadEndpoint;let T={};if(e.variables&&Array.isArray(e.variables)&&(e.variables.forEach(P=>{P.type==="constant"&&(T[P.key]=P.value)}),e.variables.forEach(P=>{if(P.type==="computed"&&P.value)try{const U=new Function("ctx",`return (${P.value});`);T[P.key]=U(T)}catch(U){console.warn(`[FormRenderer] Error evaluating computed variable "${P.key}":`,U),T[P.key]=null}})),D)try{const P=g==null?void 0:g[D];if(P){const U=typeof P=="function"?await P():P;U&&typeof U=="object"&&(T={...T,...U})}}catch{}y({systemContext:{...T}});const B=[];if(F&&B.push(F),e.onloadEndpoints&&Array.isArray(e.onloadEndpoints)&&B.push(...e.onloadEndpoints),B.length>0){const P=async K=>{if(!K)return{};try{const ne=g==null?void 0:g[K.key];if(!ne)return console.warn("[FormRenderer] Provider not found for key:",K.key),{};const ce=Ar(K.parameters,(()=>({})),{...T,ACTIVE_VARIANT:e.activeVariantId});console.log(`[FormRenderer] Calling ${K.key} with params:`,ce);const he=await Promise.resolve(ne(ce,{getValues:(()=>({})),watch:(()=>{}),params:ce,...T}));let ve=he;if(typeof he=="string")try{ve=JSON.parse(he)}catch(je){console.warn("[FormRenderer] Failed to parse onload response string",je)}return ve&&typeof ve=="object"?ve:(console.warn("[FormRenderer] OnLoad response is not an object:",ve),{})}catch(ne){return console.error("Error in onloadEndpoint",ne),{}}};(await Promise.all(B.map(P))).forEach(K=>{K&&typeof K=="object"&&(T={...T,...K})}),$||y({systemContext:{...T}})}if(!$&&Object.keys(T).length>0){const P={...e.defaultValues??{}};Object.assign(P,T);const U=e.fields.map(K=>K.name);Object.keys(T).forEach(K=>{const ne=K.toLowerCase(),ce=U.find(he=>he.toLowerCase()===ne);ce&&(P[ce]===void 0||P[ce]==="")&&(P[ce]=T[K])}),w.reset(P)}})(),()=>{$=!0,y({isActive:!1,systemContext:{},formValues:{}})}},[e,g,w.reset]);const{control:R,reset:A,handleSubmit:N,formState:{errors:O,isSubmitting:_}}=w,[Z,I]=k.useState(!1);k.useEffect(()=>{f&&(I(!0),f().then($=>A($)).finally(()=>I(!1)))},[f,A]);const V=k.useMemo(()=>(l??[]).filter(CO),[l]),{loadingCount:M,optionsMap:z}=Q5(V),[te,J]=k.useState({}),[ae,oe]=k.useState(0);k.useEffect(()=>{let $;const D=w.watch(()=>{clearTimeout($),$=setTimeout(()=>{oe(F=>F+1)},500)});return()=>{D.unsubscribe(),clearTimeout($)}},[w.watch]);const Q=k.useRef(g);k.useEffect(()=>{Q.current=g},[g]);const S=k.useRef({});k.useEffect(()=>{let $=!0;return(async()=>{const F=await Promise.all(V.filter(B=>B.type==="select"&&(B.optionSource||B.endpointConfig)).map(async B=>{var ve;const P=B.name,U=Co(B.optionSource,B.endpointConfig);if(!U)return[P,[]];const K=B.endpointConfig?Ar(B.endpointConfig.parameters,w.getValues,E):{...E,...w.getValues()},ne=s0(B.adapterCtx??B.optionAdapterCtx),ce=JSON.stringify({key:U,resolvedParams:K,ctx:ne});S.current[P],S.current[P]=ce;const he=(ve=Q.current)==null?void 0:ve[U];if(typeof he!="function")return[P,[]];try{const je=await Promise.resolve(he(K,{getValues:w.getValues,watch:w.watch,ctx:ne,params:K,...E})),ye=Array.isArray(je)?je:[];return[P,ye]}catch{return[P,[]]}}));if(!$)return;const T={};for(const[B,P]of F)T[B]=P;J(B=>Object.entries(T).some(([U,K])=>{const ne=B[U];return!ne||ne.length!==K.length?!0:JSON.stringify(ne)!==JSON.stringify(K)})?T:B)})(),()=>{$=!1}},[ae,JSON.stringify(V.map($=>({n:$.name,os:$.optionSource??null,ec:$.endpointConfig??null,ctx:$.adapterCtx??$.optionAdapterCtx??null}))),E]),k.useEffect(()=>{let $=!0;return(async()=>{for(const F of V){if(F.type!=="select")continue;const T=F.name,B=F.defaultSource;if(!B)continue;const P=w.getValues(T);if(!(P==null||(Array.isArray(P)?P.length===0:P==="")))continue;const K=g==null?void 0:g[B];if(typeof K=="function")try{const ne=s0(F.adapterCtx??F.optionAdapterCtx),ce=await Promise.resolve(K("",{getValues:w.getValues,watch:w.watch,ctx:ne}));if(!$)return;const he=RO(ce,!!F.multiple);w.setValue(T,he,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{$=!1}},[g,w.getValues,w.setValue,JSON.stringify(V.map($=>({n:$.name,ds:$.defaultSource??null,mult:!!$.multiple})))]);const L=J5(l),X=e1(l,R),q=k.useMemo(()=>{const $={};return o.forEach((D,F)=>{D.type==="tabs"&&($[F]=D.tabs[0].key)}),$},[o]),[Y,fe]=k.useState(q),[ie,ge]=k.useState({}),[me,le]=k.useState({}),xe=k.useRef({}),de=k.useCallback(async()=>{const $={},D=l.filter(T=>{var P,U,K;const B=T;return((P=B.visibleWhen)==null?void 0:P.endpoint)||((U=B.disabledWhen)==null?void 0:U.endpoint)||((K=B.clearWhen)==null?void 0:K.endpoint)});if(D.length===0)return;(await Promise.all(D.map(async T=>{const B=T,P=B.name,U={};for(const K of["visibleWhen","disabledWhen","clearWhen"]){const ne=B[K];if(ne!=null&&ne.enabled&&ne.endpoint){const ce=ne.endpoint.key,he=g==null?void 0:g[ce];if(typeof he=="function")try{const ve=Ar(ne.endpoint.parameters,w.getValues,E),je=await Promise.resolve(he(ve,{getValues:w.getValues,watch:w.watch,params:ve,...E}));U[K]=typeof je=="object"&&je!==null?!!je.ok:!!je}catch(ve){console.error(`Error evaluando regla backend para ${P}.${K}:`,ve),U[K]=!1}}}return{fieldName:P,res:U}}))).forEach(({fieldName:T,res:B})=>{Object.keys(B).length>0&&($[T]=B)}),ge($)},[l,g,w,E]),be=k.useCallback(async $=>{var U;const D=$,F=D.name,T=D.asyncValidation.endpoint,B=T.key,P=g==null?void 0:g[B];if(typeof P=="function"){le(K=>({...K,[F]:{...K[F],loading:!0}}));try{const K=Ar(T.parameters,w.getValues,E),ne=await Promise.resolve(P(K,{getValues:w.getValues,watch:w.watch,params:K,...E})),ce=typeof ne=="object"&&ne!==null?!!ne.ok:!!ne,he=typeof ne=="object"&&ne!==null?ne.message:void 0;le(ve=>({...ve,[F]:{ok:ce,message:he,loading:!1}})),ce?((U=w.formState.errors[F])==null?void 0:U.type)==="manual"&&w.clearErrors(F):w.setError(F,{type:"manual",message:he||"Validación externa fallida"})}catch{le(ne=>({...ne,[F]:{ok:!1,message:"Error de conexión",loading:!1}}))}}},[g,w,E]),C=k.useCallback(async($,D,F)=>{const T=l.filter(B=>{var ne,ce;const P=B,U=(ne=P.asyncValidation)==null?void 0:ne.endpoint;if(!U)return!1;const K=U.trigger||P.asyncValidation.trigger||"onBlur";if(F&&K!==F&&!(K==="auto"&&F==="onChange"))return!1;if(D&&F!=="onSubmit"){const he=P.name===D,ve=Object.values(U.parameters||{}).some(ye=>ye.fieldRef===D),je=(ce=U.triggerFields)==null?void 0:ce.includes(D);if(!he&&!ve&&!je)return!1}return!0});for(const B of T){const P=B,U=P.name,K=P.asyncValidation.endpoint;if(F==="onChange"&&K.trigger==="debounced"){xe.current[U]&&clearTimeout(xe.current[U]),xe.current[U]=setTimeout(()=>be(B),K.debounceMs||300);continue}await be(B)}},[l,be]);k.useEffect(()=>{de();const $=w.watch((D,{name:F})=>{de(),F&&C(D,F,"onChange")});return()=>{$.unsubscribe(),Object.values(xe.current).forEach(D=>D&&clearTimeout(D))}},[de,C,w]);const G=k.useCallback(($,D,F,T)=>{var P;if(!($!=null&&$.enabled))return D;let B=!0;if($.rule)try{const U={...w.getValues(),...E,ACTIVE_VARIANT:n};B=!!Ao($.rule,U)}catch{B=D}if(B&&F&&T&&$.endpoint){const U=(P=ie[F])==null?void 0:P[T];if(U===void 0)return!1;B=U}return B},[w,ie,n]),re=k.useMemo(()=>l.map($=>$).filter($=>{var D;return((D=$.clearWhen)==null?void 0:D.enabled)&&($.clearWhen.rule||$.clearWhen.endpoint)}).map($=>({name:$.name,container:$.clearWhen})),[l]);k.useEffect(()=>{if(!re.length)return;const $=F=>{re.forEach(({name:T,container:B})=>{try{if(G(B,!1,T,"clearWhen")){const U=B.clearTo??"";F[T]!==U&&w.setValue(T,U,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};$(w.getValues());const D=w.watch(()=>$(w.getValues()));return()=>{var F;return(F=D==null?void 0:D.unsubscribe)==null?void 0:F.call(D)}},[w,re,G]);const H=k.useCallback($=>{const D=st(b,$);if(!D)return"";const F={...E,...j,sys:E,form:j};return Sl(D,F)},[b,E,j]),W=k.useCallback(($,D)=>{var Oe,_e,ze,nt;let F;if(typeof $=="string"){if(F=L[$],!F){const Se=(l??[]).find(Ne=>(Ne==null?void 0:Ne.name)===$);if(Se)F=Se;else return null}}else F=$;const T=F.name,B=T?D?`${D}.${T}`:T:void 0,P=F.visibleWhen;if(!G(P,!0,T,"visibleWhen"))return null;let K=!!F.disabled;const ne=F.disabledWhen,ce=G(ne,!1,T,"disabledWhen");if(ne!=null&&ne.enabled&&(K=ce),!(ne!=null&&ne.enabled)&&T&&X[T]&&(K=!0),F.type==="search"){const Se=typeof F.searchFn=="function",Ne=Co(F.searchSource,F.endpointConfig),Me=async vt=>{if(Se)return F.searchFn(vt,{getValues:w.getValues,watch:w.watch});if(Ne){const Ze=F.endpointConfig?Ar(F.endpointConfig.parameters,w.getValues,E):{...E,...w.getValues()},qe=g==null?void 0:g[Ne];if(typeof qe=="function")return await qe(vt,{getValues:w.getValues,watch:w.watch,params:Ze,...E});if(Array.isArray(qe))return qe}return[]},Ae={};F.searchMode&&(Ae.searchMode=F.searchMode),F.minChars&&(Ae.minChars=F.minChars),F.debounceMs&&(Ae.debounceMs=F.debounceMs),F.resolveByValue&&(Ae.resolveByValue=F.resolveByValue);const Ie=Ot(F.labelIconLeft??F.labelPrefixIcon),Be=Ot(F.labelIconRight??F.labelSuffixIcon),Ve=Ot(F.prefixIcon),De=Ot(F.suffixIcon);return s.jsx(Ri,{name:B,control:R,searchFn:Me,label:H(F.label),size:F.size,width:F.width,disabled:K||_,labelPrefixIcon:Ie,labelSuffixIcon:Be,prefixIcon:Ve,suffixIcon:De,...Ae},B)}if(F.type==="inputGroup"){const Se=F,Ne=(Se.inputs??[]).map(Me=>{var wr,Dt;const Ae=typeof Me=="string"?L[Me]??(l??[]).find(lr=>(lr==null?void 0:lr.name)===Me):Me;if(!Ae)return null;const Ie=Ae.name,Be=D?`${D}.${Ie}`:Ie,Ve=Ae.disabledWhen;let De=!!Ae.disabled;const vt=G(Ve,!1,Ie,"disabledWhen");Ve!=null&&Ve.enabled&&(De=vt),!(Ve!=null&&Ve.enabled)&&X[Ie]&&(De=!0);const Ze=Ot(Ae.labelIconLeft??Ae.labelPrefixIcon),qe=Ot(Ae.labelIconRight??Ae.labelSuffixIcon),He=Ot(Ae.prefixIcon),at=Ot(Ae.suffixIcon),Qt={name:Be,control:R,label:H(Ae.label),size:Ae.size,width:Ae.width,placeholder:H(Ae.placeholder),hasError:!!(O[Be]||D&&((wr=O[D])!=null&&wr[Ie])),errorMessage:st(b,(Dt=O[Be])==null?void 0:Dt.message),loading:Z,disabled:De||_,suffixButton:Ae.suffixButton,reserveErrorSpace:!0,labelPrefixIcon:Ze,labelSuffixIcon:qe,prefixIcon:He,suffixIcon:at};return Ae.type==="select"?{...Qt,options:Ae.options??te[Ie]??z[Ie]??[],loadOptions:Ae.options||Ae.optionSource?void 0:Ae.loadOptions}:{...Qt,type:Ae.type}}).filter(Boolean);return s.jsx(Ei,{groupLabel:st(b,Se.groupLabel),inputs:Ne,separator:Se.separator,useSeparator:Se.useSeparator,className:Se.className,showVisibleLabel:Se.showVisibleLabel,size:Se.size},`inputGroup_${B??Se.groupLabel??"group"}`)}if(F.type==="button"){const Se=F,Ne=Se.icon,Me=Ne&&typeof Ne=="object"&&Ne.name&&Ne.style?Ot(Ne):void 0;return s.jsx("div",{className:"self-center",children:s.jsx(ue,{type:"button",variant:Se.variant,size:Se.size,width:Se.width,icon:Me,iconPosition:Se.iconPosition,ariaLabel:H(Se.ariaLabel),onClick:Se.onClick,disabled:K||_,children:H(Se.label)})},B??Se.label)}if(F.type==="array"){const Se=F;return s.jsx(kO,{schema:{...Se,name:B},renderField:W},B)}const he=F.suffixButton,ve=typeof he=="string"?W(he):he,je=Ot(F.labelIconLeft??F.labelPrefixIcon),ye=Ot(F.labelIconRight??F.labelSuffixIcon),Fe=Ot(F.prefixIcon),$e=Ot(F.suffixIcon),Ee={name:B,control:R,disabled:K||_,label:H(F.label),size:F.size,width:F.width,placeholder:H(F.placeholder),info:st(b,F.info),suffixButton:ve,labelPrefixIcon:je,labelSuffixIcon:ye,prefixIcon:Fe,suffixIcon:$e,onBlur:()=>{C(w.getValues(),T,"onBlur"),l.filter(Ne=>{const Me=Ne;return["visibleWhen","disabledWhen","clearWhen"].some(Ae=>{var Be;const Ie=(Be=Me[Ae])==null?void 0:Be.endpoint;return(Ie==null?void 0:Ie.trigger)==="onBlur"&&Object.values(Ie.parameters||{}).some(Ve=>Ve.fieldRef===T)})}).length>0&&de()}};switch(F.type){case"select":{const Se=F.options??te[T]??z[T]??[],Ne=Array.isArray(Se)&&Se.length?`${Se.length}:${Se.map(Ae=>String((Ae==null?void 0:Ae.value)??"")).join("|")}`:"0",Me=!F.options&&!F.optionSource&&F.loadOptions;return s.jsx(mt,{name:B,control:R,render:({field:Ae})=>{var Ie;return s.jsx(Ge,{...Ee,value:Ae.value,onChange:Ae.onChange,options:Se,loadOptions:Me||void 0,hasError:!!O[B],errorMessage:st(b,(Ie=O[B])==null?void 0:Ie.message),suffixButton:ve})}},`${B}:${Ne}`)}case"textarea":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(or,{...Ee,value:Se.value,onChange:Se.onChange,maxLength:F.maxLength,showCounter:!!F.showCounter,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message)})}},B);case"file":return s.jsx(xi,{...Ee,defaultValue:[],maxFiles:F.maxFiles,accept:F.accept,hideDropZone:F.hideDropZone,hasError:!!O[B],errorMessage:st(b,(Oe=O[B])==null?void 0:Oe.message)},B);case"checkbox":return s.jsx(tt,{...Ee,defaultValue:!1,hasError:!!O[B],errorMessage:st(b,(_e=O[B])==null?void 0:_e.message),name:B},B);case"date":return s.jsx(Nn,{...Ee,defaultValue:"",showTime:!!F.showTime,hasError:!!O[B],errorMessage:st(b,(ze=O[B])==null?void 0:ze.message)},B);case"optionGroup":return s.jsx(es,{...Ee,options:F.options||[],multiple:F.multiple,vertical:F.vertical,groupLabel:F.groupLabel,defaultValue:F.defaultValue,className:F.width?void 0:"w-full",name:B},B);case"iban":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(ts,{label:H(F.label),placeholder:H(F.placeholder),size:F.size,disabled:K||_,value:Se.value??"",onChange:Se.onChange,onBlur:Se.onBlur,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message),name:B})}},B);case"dni":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(Si,{label:H(F.label),placeholder:H(F.placeholder),size:F.size,disabled:K||_,value:Se.value??"",onChange:Se.onChange,onBlur:Se.onBlur,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message),name:B})}},B);default:return s.jsx(Xo,{...Ee,type:F.type,loadingDefaults:Z,hasError:!!O[B],errorMessage:st(b,(nt=O[B])==null?void 0:nt.message),suffixButton:ve,name:B},B)}},[l,L,R,O,_,Z,z,te,G,X,w.getValues,w.watch,g,b]);return s.jsx(fi,{...w,children:s.jsxs("form",{noValidate:!0,onSubmit:N(async $=>{await C($,void 0,"onSubmit"),!(Object.keys(w.formState.errors).length>0)&&(await i($),p(c??b("ds.form.saveSuccess"),"success"))},$=>{JM($),p(u??b("ds.form.saveError"),"error")}),className:"space-y-6",children:[o.map(($,D)=>$.type==="rows"?s.jsx(k.Fragment,{children:$.sections.map((F,T)=>s.jsx("div",{children:s.jsx(rt,{title:H(F.sectionTitle),defaultOpen:F.defaultOpen,children:F.rows.map((B,P)=>s.jsxs("div",{children:[B.title&&s.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:H(B.title)}),s.jsx("div",{className:"flex flex-wrap -mx-2",children:B.columns.map((U,K)=>{var ne;return s.jsx("div",{className:`${U.width} px-2 flex flex-col`,children:s.jsx("div",{className:"",children:U.fields?U.fields.map(ce=>W(ce)):(ne=U.rows)==null?void 0:ne.map((ce,he)=>s.jsx("div",{className:"mb-1",children:s.jsx("div",{className:"flex flex-wrap -mx-2",children:ce.columns.map((ve,je)=>{var ye;return s.jsx("div",{className:`${ve.width} px-2`,children:(ye=ve.fields)==null?void 0:ye.map(Fe=>W(Fe))},je)})})},he))})},K)})})]},P))})},T))},D):s.jsx(xr,{options:$.tabs.map(F=>{const T=F.icon?An(F.icon.name,F.icon.style):null;return{label:H(F.label),value:F.key,disabled:F.disabled,icon:T?s.jsx(T,{className:"w-4 h-4"}):null}}),value:Y[D],onChange:F=>fe(T=>({...T,[D]:F})),children:Object.fromEntries($.tabs.map(F=>[F.key,s.jsx("div",{className:"space-y-6",children:F.sections.map((T,B)=>s.jsx("div",{className:"mb-6",children:s.jsx(rt,{title:H(T.sectionTitle),defaultOpen:T.defaultOpen,children:T.rows.map((P,U)=>s.jsx("div",{children:s.jsx("div",{className:"flex flex-wrap -mx-2",children:P.columns.map((K,ne)=>{var ce;return s.jsx("div",{className:`${K.width??"flex-1"} px-2 flex flex-col`,children:s.jsx("div",{className:"space-y-4",children:(ce=K.fields)==null?void 0:ce.map((he,ve)=>s.jsx(k.Fragment,{children:W(he)},ve))})},ne)})})},U))})},B))},F.key)]))},D)),s.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:d??s.jsx(ue,{type:"submit",variant:"primary",icon:Gr,size:"sm",disabled:_||Z||M>0,children:b(_?"ds.form.sending":"ds.form.submit")})})]})})}const NO={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function St({icon:e,size:t="md",ariaLabel:r,disabled:n=!1,onClick:o,className:l,...i}){return s.jsx("button",{type:"button","aria-label":r,disabled:n,onClick:o,className:pe("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",NO[t],n?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse","hover:bg-[var(--color-ds-background-neutral-hover)]"],l),...i,children:s.jsx(e,{className:pe(t==="sm"?"h-4 w-4":t==="md"?"h-5 w-5":"h-6 w-6")})})}function r1({dark:e,onToggle:t}){return s.jsx("button",{type:"button","aria-pressed":e,"aria-label":e?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:t,className:pe("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:s.jsxs("div",{className:pe("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:[s.jsx(yt,{component:si,size:"sm",className:pe("absolute transition-opacity duration-200 ease-in-out",e?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),s.jsx(yt,{component:ti,size:"sm",className:pe("absolute transition-opacity duration-200 ease-in-out",e?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const l0="licytal:ui:theme",n1=k.createContext({theme:"light",dark:!1,toggle:()=>{}});function AO({children:e}){const[t,r]=k.useState(!1),[n,o]=k.useState("light");k.useEffect(()=>{if(typeof window>"u")return;const i=localStorage.getItem(l0);i==="light"||i==="dark"?o(i):window.matchMedia("(prefers-color-scheme: dark)").matches&&o("dark"),r(!0)},[]),k.useEffect(()=>{t&&(document.documentElement.classList.toggle("dark",n==="dark"),localStorage.setItem(l0,n))},[n,t]);const l=()=>o(i=>i==="light"?"dark":"light");return t?s.jsx(n1.Provider,{value:{theme:n,dark:n==="dark",toggle:l},children:e}):null}const Ni=()=>k.useContext(n1),Gn={locale:"licytal:ui:locale",theme:"licytal:ui:theme"},a1=({pinnedPages:e,onRemovePinned:t,onBack:r,dark:n,locale:o,languageOptions:l,onChangeLocale:i,profile:c="",profileOptions:u=[],onChangeProfile:d,logoSrc:m,logoAlt:f="Logo aplicación"})=>{const h=e.slice(0,3),{toggle:p}=Ni(),b=g=>{try{localStorage.setItem(Gn.locale,g)}catch{}i==null||i(g)},v=()=>{const g=!n;try{localStorage.setItem(Gn.theme,g?"dark":"light")}catch{}p()};return k.useEffect(()=>{try{const g=localStorage.getItem(Gn.locale);g&&g!==o&&(i==null||i(g))}catch{}},[]),k.useEffect(()=>{if(o)try{localStorage.setItem(Gn.locale,o)}catch{}},[o]),k.useEffect(()=>{try{const g=localStorage.getItem(Gn.theme);if(!g)return;g==="dark"!==n&&p()}catch{}},[]),s.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[s.jsxs("div",{className:"flex items-center space-x-4",children:[m&&s.jsx("img",{src:m,alt:f,className:"h-10 w-auto object-contain"}),s.jsx("div",{className:"flex items-center space-x-2",children:h.map(g=>s.jsxs("div",{className:"flex items-center",children:[s.jsx("a",{href:g.href,className:pe("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}),s.jsx(St,{icon:et,size:"sm",ariaLabel:`Remove ${g.label}`,onClick:()=>t(g.id)})]},g.id))})]}),s.jsx("div",{className:"flex-grow"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ge,{size:"sm",width:"auto",options:l,value:o,onChange:b,disableErrorPlaceholder:!0,label:"Idioma",labelHidden:!0}),!!u.length&&s.jsx(Ge,{size:"sm",width:"auto",options:u,value:c,onChange:g=>d==null?void 0:d(g),disableErrorPlaceholder:!0,label:"Perfil",labelHidden:!0}),s.jsx(r1,{dark:n,onToggle:v})]})]})},MO=({loading:e=!1,ariaLabel:t="Cargando..."})=>e?s.jsxs("div",{className:`\r
98
+ hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const be=String(de.value).trim();E(e,be,{shouldDirty:!0,shouldValidate:!0}),V(de.label??be),te.current=!1,J.current=!1,Z(!1)},children:de.label},String(de.value)))})]})}})}const qn=(e,t)=>e[t],r0=e=>e instanceof Date?e.getTime():e;function xO(e,t,r){const n=r0(e),o=r0(t);return typeof n=="number"&&typeof o=="number"||typeof n=="string"&&typeof o=="string"?r==="gt"?n>o:r==="gte"?n>=o:r==="lt"?n<o:n<=o:!1}function Ao(e,t){if(!e)return!1;switch(e.op){case"eq":return qn(t,e.field)===e.value;case"neq":return qn(t,e.field)!==e.value;case"in":return e.values.includes(qn(t,e.field));case"notIn":return!e.values.includes(qn(t,e.field));case"gt":case"gte":case"lt":case"lte":return xO(qn(t,e.field),e.value,e.op);case"and":return e.rules.every(r=>Ao(r,t));case"or":return e.rules.some(r=>Ao(r,t));case"always":return!!e.value;default:return!1}}function Ci(e){return!!e&&(typeof e=="function"||typeof e=="object")}function An(e,t){const r=t==="outline"?Cn:Sn,n=r==null?void 0:r[e];return Ci(n)?n:null}const wO=Object.entries(Cn).filter(([e,t])=>e.endsWith("Icon")&&Ci(t)).map(([e,t])=>({name:e,Icon:t,style:"outline"})),yO=Object.entries(Sn).filter(([e,t])=>e.endsWith("Icon")&&Ci(t)).map(([e,t])=>({name:e,Icon:t,style:"solid"})),jO=oi||ai||(e=>s.jsx("svg",{...e})),Wr=({value:e,onChange:t,buttonLabel:r,disabled:n,className:o})=>{const[l,i]=k.useState(!1),[c,u]=k.useState(""),[d,m]=k.useState((e==null?void 0:e.style)??"outline"),f=e&&An(e.name,e.style)||jO,h=k.useCallback((b,v)=>{const g=An(b,v);t==null||t({name:b,style:v},g),i(!1)},[t]),p=k.useCallback(()=>{t==null||t(void 0,void 0),i(!1)},[t]);return s.jsxs(s.Fragment,{children:[s.jsx(ue,{size:"sm",variant:"outline",shape:"circle",className:`rounded-full p-0 w-8 h-8 inline-flex items-center justify-center ${o??""}`,disabled:n,onClick:()=>i(!0),ariaLabel:"Elegir icono",title:r||"Elegir icono",children:s.jsx(f,{className:"h-4 w-4"})}),s.jsx(Nt,{isOpen:l,onClose:()=>i(!1),title:"Seleccionar icono",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ke,{labelHidden:!0,placeholder:"Buscar icono (p. ej. 'user', 'arrow', 'calendar'...)",value:c,onChange:b=>u(b.target.value)}),s.jsx(xr,{options:[{label:"Outline",value:"outline"},{label:"Solid",value:"solid"}],value:d,onChange:b=>m(b),children:{outline:s.jsx(n0,{items:wO,query:c,onPick:b=>h(b,"outline"),onClear:p}),solid:s.jsx(n0,{items:yO,query:c,onPick:b=>h(b,"solid"),onClear:p})}})]})})]})},n0=({items:e,query:t,onPick:r,onClear:n})=>{const o=k.useMemo(()=>{if(!t.trim())return e;const i=t.trim().toLowerCase().replace(/\s+/g,"");return e.filter(c=>c.name.toLowerCase().includes(i))},[e,t]),l=et;return s.jsx("div",{className:"custom-scroll max-h-[60vh] overflow-y-auto",children:s.jsxs("div",{className:"grid gap-2 grid-cols-3 sm:grid-cols-4 md:grid-cols-6",children:[s.jsxs("button",{type:"button",onClick:n,className:"group w-full aspect-square border border-[var(--color-ds-border-default-50)] rounded-lg p-1 bg-[var(--color-ds-background-page)] hover:bg-[var(--color-ds-background-accent)]/5 hover:border-[var(--color-ds-border-default)] transition focus:outline-none",title:"Ninguno","aria-label":"Quitar icono",children:[s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:l?s.jsx(l,{className:"w-6 h-6"}):s.jsx("span",{className:"text-ds-lg",children:"×"})}),s.jsx("div",{className:"mt-1 text-center",children:s.jsx("span",{className:"block text-[11px] leading-tight text-[var(--color-ds-text-secondary)] truncate",children:"Ninguno"})})]}),(o.length===0?e:o).map(({name:i,Icon:c})=>s.jsxs("button",{type:"button",onClick:()=>r(i),className:"group w-full aspect-square border border-[var(--color-ds-border-default-50)] rounded-lg p-1 bg-[var(--color-ds-background-page)] hover:bg-[var(--color-ds-background-accent)]/5 hover:border-[var(--color-ds-border-default)] transition focus:outline-none",title:i,"aria-label":`Elegir ${i}`,children:[s.jsx("div",{className:"h-full w-full flex items-center justify-center",children:s.jsx(c,{className:"w-6 h-6 text-[var(--color-ds-text-primary)]"})}),s.jsx("div",{className:"mt-1 text-center",children:s.jsx("span",{className:"block text-[11px] leading-tight text-[var(--color-ds-text-secondary)] truncate",children:i.replace(/Icon$/,"")})})]},i))]})})};function st(e,t,r=""){if(!t)return r;if(typeof t=="object"&&t!==null){if(t.type==="complex"){const o=[];return t.header&&o.push(`<strong>${t.header}</strong>`),t.template&&o.push(t.template),o.join("<br/>")||r}return r}return e(t,{defaultValue:t})}const kO=({schema:e,renderField:t})=>{var v,g,x;const{control:r}=Tr(),{fields:n,append:o,remove:l}=Bx({control:r,name:e.name}),{label:i,addLabel:c="Añadir",items:u,disabled:d,validation:m,className:f}=e,{formState:{errors:h}}=Tr(),p=((g=(v=h[e.name])==null?void 0:v.root)==null?void 0:g.message)||((x=h[e.name])==null?void 0:x.message),b=typeof p=="string"?p:void 0;return s.jsxs("div",{className:pe("space-y-3",f),children:[i&&s.jsx("div",{className:"flex items-center justify-between",children:s.jsx("label",{className:"block text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:i})}),s.jsx("div",{className:"space-y-4",children:n.map((w,y)=>{const E=`${e.name}.${y}`;return s.jsxs("div",{className:"relative rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] p-4 group",children:[!d&&s.jsx("div",{className:"absolute top-2 right-2",children:s.jsx(ue,{size:"xs",variant:"ghost",className:"text-[var(--color-ds-text-error)] hover:bg-[var(--color-ds-background-error-hover)]",onClick:()=>l(y),title:"Eliminar fila",ariaLabel:"Eliminar fila",children:s.jsx(pt,{className:"w-4 h-4"})})}),s.jsx("div",{className:"grid grid-cols-1 gap-4",children:u.map((j,R)=>s.jsx(k.Fragment,{children:t(j,E)},R))})]},w.id)})}),n.length===0&&s.jsx("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] italic p-2 border border-dashed border-[var(--color-ds-border-default-50)] rounded bg-[var(--color-ds-background-subtle)]",children:"No hay elementos."}),b&&s.jsx("p",{className:"text-xs text-[var(--color-ds-text-error)]",children:b}),!d&&s.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>{o({})},children:[s.jsx(Jt,{className:"w-4 h-4 mr-1"}),c]})]})};function a0(e){return(e??"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9]/g,"").slice(0,24)}function EO(e){return e.replace(/(.{4})/g,"$1 ").trim()}function ts({label:e,labelHidden:t,placeholder:r="ES00 0000 0000 0000 0000 0000",size:n="sm",value:o,onChange:l,onBlur:i,disabled:c,required:u,reserveErrorSpace:d=!0,error:m,errorMessage:f,hasError:h,id:p,name:b,className:v,"aria-label":g}){const x=k.useMemo(()=>a0(o),[o]),w=k.useMemo(()=>EO(x),[x]),y=E=>{const j=a0(E.target.value);l(j)};return s.jsx(ke,{id:p,name:b,label:e,labelHidden:t,placeholder:r,size:n,value:w,onChange:y,onBlur:i,disabled:c,required:u,hasError:h||!!m||!!f,errorMessage:f||m,reserveErrorSpace:d,prefixIcon:Wl,className:v,"aria-label":g,inputMode:"text",autoComplete:"off",spellCheck:!1})}function o0(e){return(e??"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9]/g,"").slice(0,9)}function Si({label:e,labelHidden:t,placeholder:r="12345678A",size:n="sm",value:o,onChange:l,onBlur:i,disabled:c,required:u,reserveErrorSpace:d=!0,error:m,errorMessage:f,hasError:h,id:p,name:b,className:v,"aria-label":g}){const{t:x}=gt(),w=k.useMemo(()=>o0(o),[o]),y=k.useMemo(()=>w,[w]),E=j=>{const R=o0(j.target.value);l(R)};return s.jsx(ke,{id:p,name:b,label:e,labelHidden:t,placeholder:r,size:n,value:y,onChange:E,onBlur:i,disabled:c,required:u,hasError:h||!!m||!!f,errorMessage:f||m,prefixIcon:Ql,className:v,"aria-label":g,inputMode:"text",autoComplete:"off",spellCheck:!1,reserveErrorSpace:d})}function s0(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}if(typeof e=="object")return e}}function RO(e,t){var r;return Array.isArray(e)?e.length&&typeof e[0]=="object"&&"value"in e[0]?t?e.map(n=>n.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 CO=e=>e.type!=="inputGroup"&&e.type!=="button";function SO(){try{return Mt()??void 0}catch{return}}function Ot(e){if(!e||typeof e!="object")return;const t=e.name,r=e.style;if(!(!t||!r))return An(t,r)||void 0}function t1({schema:e,resolver:t,serviceRegistry:r,activeVariantId:n}){var ee;const{layout:o,fields:l=[],onSubmit:i,successMessage:c,errorMessage:u,footerButtons:d,defaultValues:m,loadDefaultValues:f,validationSchema:h}=e,{show:p}=Vr(),{t:b}=gt(),v=SO(),g=r??((ee=v==null?void 0:v.services)==null?void 0:ee.registry)??void 0,x=k.useMemo(()=>{if(t)return t;try{const $=h??ki(e);return wi($)}catch{return}},[t,e,h]),w=gi({resolver:x,mode:"onBlur",reValidateMode:"onChange",defaultValues:m??{}}),y=Jr($=>$.setRuntimeState),E=Jr($=>$.systemContext),j=Jr($=>$.formValues);k.useEffect(()=>{y({isActive:!0});let $=!1;return(async()=>{const D=e.defaultSource,F=e.onloadEndpoint;let T={};if(e.variables&&Array.isArray(e.variables)&&(e.variables.forEach(P=>{P.type==="constant"&&(T[P.key]=P.value)}),e.variables.forEach(P=>{if(P.type==="computed"&&P.value)try{const U=new Function("ctx",`return (${P.value});`);T[P.key]=U(T)}catch(U){console.warn(`[FormRenderer] Error evaluating computed variable "${P.key}":`,U),T[P.key]=null}})),D)try{const P=g==null?void 0:g[D];if(P){const U=typeof P=="function"?await P():P;U&&typeof U=="object"&&(T={...T,...U})}}catch{}y({systemContext:{...T}});const B=[];if(F&&B.push(F),e.onloadEndpoints&&Array.isArray(e.onloadEndpoints)&&B.push(...e.onloadEndpoints),B.length>0){const P=async K=>{if(!K)return{};try{const ne=g==null?void 0:g[K.key];if(!ne)return console.warn("[FormRenderer] Provider not found for key:",K.key),{};const ce=Ar(K.parameters,(()=>({})),{...T,ACTIVE_VARIANT:e.activeVariantId});console.log(`[FormRenderer] Calling ${K.key} with params:`,ce);const he=await Promise.resolve(ne(ce,{getValues:(()=>({})),watch:(()=>{}),params:ce,...T}));let ve=he;if(typeof he=="string")try{ve=JSON.parse(he)}catch(je){console.warn("[FormRenderer] Failed to parse onload response string",je)}return ve&&typeof ve=="object"?ve:(console.warn("[FormRenderer] OnLoad response is not an object:",ve),{})}catch(ne){return console.error("Error in onloadEndpoint",ne),{}}};(await Promise.all(B.map(P))).forEach(K=>{K&&typeof K=="object"&&(T={...T,...K})}),$||y({systemContext:{...T}})}if(!$&&Object.keys(T).length>0){const P={...e.defaultValues??{}};Object.assign(P,T);const U=e.fields.map(K=>K.name);Object.keys(T).forEach(K=>{const ne=K.toLowerCase(),ce=U.find(he=>he.toLowerCase()===ne);ce&&(P[ce]===void 0||P[ce]==="")&&(P[ce]=T[K])}),w.reset(P)}})(),()=>{$=!0,y({isActive:!1,systemContext:{},formValues:{}})}},[e,g,w.reset]);const{control:R,reset:A,handleSubmit:N,formState:{errors:O,isSubmitting:_}}=w,[Z,I]=k.useState(!1);k.useEffect(()=>{f&&(I(!0),f().then($=>A($)).finally(()=>I(!1)))},[f,A]);const V=k.useMemo(()=>(l??[]).filter(CO),[l]),{loadingCount:M,optionsMap:z}=Q5(V),[te,J]=k.useState({}),[ae,oe]=k.useState(0);k.useEffect(()=>{let $;const D=w.watch(()=>{clearTimeout($),$=setTimeout(()=>{oe(F=>F+1)},500)});return()=>{D.unsubscribe(),clearTimeout($)}},[w.watch]);const Q=k.useRef(g);k.useEffect(()=>{Q.current=g},[g]);const S=k.useRef({});k.useEffect(()=>{let $=!0;return(async()=>{const F=await Promise.all(V.filter(B=>B.type==="select"&&(B.optionSource||B.endpointConfig)).map(async B=>{var ve;const P=B.name,U=Co(B.optionSource,B.endpointConfig);if(!U)return[P,[]];const K=B.endpointConfig?Ar(B.endpointConfig.parameters,w.getValues,E):{...E,...w.getValues()},ne=s0(B.adapterCtx??B.optionAdapterCtx),ce=JSON.stringify({key:U,resolvedParams:K,ctx:ne});S.current[P],S.current[P]=ce;const he=(ve=Q.current)==null?void 0:ve[U];if(typeof he!="function")return[P,[]];try{const je=await Promise.resolve(he(K,{getValues:w.getValues,watch:w.watch,ctx:ne,params:K,...E})),ye=Array.isArray(je)?je:[];return[P,ye]}catch{return[P,[]]}}));if(!$)return;const T={};for(const[B,P]of F)T[B]=P;J(B=>Object.entries(T).some(([U,K])=>{const ne=B[U];return!ne||ne.length!==K.length?!0:JSON.stringify(ne)!==JSON.stringify(K)})?T:B)})(),()=>{$=!1}},[ae,JSON.stringify(V.map($=>({n:$.name,os:$.optionSource??null,ec:$.endpointConfig??null,ctx:$.adapterCtx??$.optionAdapterCtx??null}))),E]),k.useEffect(()=>{let $=!0;return(async()=>{for(const F of V){if(F.type!=="select")continue;const T=F.name,B=F.defaultSource;if(!B)continue;const P=w.getValues(T);if(!(P==null||(Array.isArray(P)?P.length===0:P==="")))continue;const K=g==null?void 0:g[B];if(typeof K=="function")try{const ne=s0(F.adapterCtx??F.optionAdapterCtx),ce=await Promise.resolve(K("",{getValues:w.getValues,watch:w.watch,ctx:ne}));if(!$)return;const he=RO(ce,!!F.multiple);w.setValue(T,he,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{$=!1}},[g,w.getValues,w.setValue,JSON.stringify(V.map($=>({n:$.name,ds:$.defaultSource??null,mult:!!$.multiple})))]);const L=J5(l),X=e1(l,R),q=k.useMemo(()=>{const $={};return o.forEach((D,F)=>{D.type==="tabs"&&($[F]=D.tabs[0].key)}),$},[o]),[Y,fe]=k.useState(q),[ie,ge]=k.useState({}),[me,le]=k.useState({}),xe=k.useRef({}),de=k.useCallback(async()=>{const $={},D=l.filter(T=>{var P,U,K;const B=T;return((P=B.visibleWhen)==null?void 0:P.endpoint)||((U=B.disabledWhen)==null?void 0:U.endpoint)||((K=B.clearWhen)==null?void 0:K.endpoint)});if(D.length===0)return;(await Promise.all(D.map(async T=>{const B=T,P=B.name,U={};for(const K of["visibleWhen","disabledWhen","clearWhen"]){const ne=B[K];if(ne!=null&&ne.enabled&&ne.endpoint){const ce=ne.endpoint.key,he=g==null?void 0:g[ce];if(typeof he=="function")try{const ve=Ar(ne.endpoint.parameters,w.getValues,E),je=await Promise.resolve(he(ve,{getValues:w.getValues,watch:w.watch,params:ve,...E}));U[K]=typeof je=="object"&&je!==null?!!je.ok:!!je}catch(ve){console.error(`Error evaluando regla backend para ${P}.${K}:`,ve),U[K]=!1}}}return{fieldName:P,res:U}}))).forEach(({fieldName:T,res:B})=>{Object.keys(B).length>0&&($[T]=B)}),ge($)},[l,g,w,E]),be=k.useCallback(async $=>{var U;const D=$,F=D.name,T=D.asyncValidation.endpoint,B=T.key,P=g==null?void 0:g[B];if(typeof P=="function"){le(K=>({...K,[F]:{...K[F],loading:!0}}));try{const K=Ar(T.parameters,w.getValues,E),ne=await Promise.resolve(P(K,{getValues:w.getValues,watch:w.watch,params:K,...E})),ce=typeof ne=="object"&&ne!==null?!!ne.ok:!!ne,he=typeof ne=="object"&&ne!==null?ne.message:void 0;le(ve=>({...ve,[F]:{ok:ce,message:he,loading:!1}})),ce?((U=w.formState.errors[F])==null?void 0:U.type)==="manual"&&w.clearErrors(F):w.setError(F,{type:"manual",message:he||"Validación externa fallida"})}catch{le(ne=>({...ne,[F]:{ok:!1,message:"Error de conexión",loading:!1}}))}}},[g,w,E]),C=k.useCallback(async($,D,F)=>{const T=l.filter(B=>{var ne,ce;const P=B,U=(ne=P.asyncValidation)==null?void 0:ne.endpoint;if(!U)return!1;const K=U.trigger||P.asyncValidation.trigger||"onBlur";if(F&&K!==F&&!(K==="auto"&&F==="onChange"))return!1;if(D&&F!=="onSubmit"){const he=P.name===D,ve=Object.values(U.parameters||{}).some(ye=>ye.fieldRef===D),je=(ce=U.triggerFields)==null?void 0:ce.includes(D);if(!he&&!ve&&!je)return!1}return!0});for(const B of T){const P=B,U=P.name,K=P.asyncValidation.endpoint;if(F==="onChange"&&K.trigger==="debounced"){xe.current[U]&&clearTimeout(xe.current[U]),xe.current[U]=setTimeout(()=>be(B),K.debounceMs||300);continue}await be(B)}},[l,be]);k.useEffect(()=>{de();const $=w.watch((D,{name:F})=>{de(),F&&C(D,F,"onChange")});return()=>{$.unsubscribe(),Object.values(xe.current).forEach(D=>D&&clearTimeout(D))}},[de,C,w]);const G=k.useCallback(($,D,F,T)=>{var P;if(!($!=null&&$.enabled))return D;let B=!0;if($.rule)try{const U={...w.getValues(),...E,ACTIVE_VARIANT:n};B=!!Ao($.rule,U)}catch{B=D}if(B&&F&&T&&$.endpoint){const U=(P=ie[F])==null?void 0:P[T];if(U===void 0)return!1;B=U}return B},[w,ie,n]),re=k.useMemo(()=>l.map($=>$).filter($=>{var D;return((D=$.clearWhen)==null?void 0:D.enabled)&&($.clearWhen.rule||$.clearWhen.endpoint)}).map($=>({name:$.name,container:$.clearWhen})),[l]);k.useEffect(()=>{if(!re.length)return;const $=F=>{re.forEach(({name:T,container:B})=>{try{if(G(B,!1,T,"clearWhen")){const U=B.clearTo??"";F[T]!==U&&w.setValue(T,U,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};$(w.getValues());const D=w.watch(()=>$(w.getValues()));return()=>{var F;return(F=D==null?void 0:D.unsubscribe)==null?void 0:F.call(D)}},[w,re,G]);const H=k.useCallback($=>{const D=st(b,$);if(!D)return"";const F={...E,...j,sys:E,form:j};return Sl(D,F)},[b,E,j]),W=k.useCallback(($,D)=>{var Oe,_e,ze,nt;let F;if(typeof $=="string"){if(F=L[$],!F){const Se=(l??[]).find(Ne=>(Ne==null?void 0:Ne.name)===$);if(Se)F=Se;else return null}}else F=$;const T=F.name,B=T?D?`${D}.${T}`:T:void 0,P=F.visibleWhen;if(!G(P,!0,T,"visibleWhen"))return null;let K=!!F.disabled;const ne=F.disabledWhen,ce=G(ne,!1,T,"disabledWhen");if(ne!=null&&ne.enabled&&(K=ce),!(ne!=null&&ne.enabled)&&T&&X[T]&&(K=!0),F.type==="search"){const Se=typeof F.searchFn=="function",Ne=Co(F.searchSource,F.endpointConfig),Me=async vt=>{if(Se)return F.searchFn(vt,{getValues:w.getValues,watch:w.watch});if(Ne){const Ze=F.endpointConfig?Ar(F.endpointConfig.parameters,w.getValues,E):{...E,...w.getValues()},qe=g==null?void 0:g[Ne];if(typeof qe=="function")return await qe(vt,{getValues:w.getValues,watch:w.watch,params:Ze,...E});if(Array.isArray(qe))return qe}return[]},Ae={};F.searchMode&&(Ae.searchMode=F.searchMode),F.minChars&&(Ae.minChars=F.minChars),F.debounceMs&&(Ae.debounceMs=F.debounceMs),F.resolveByValue&&(Ae.resolveByValue=F.resolveByValue);const Ie=Ot(F.labelIconLeft??F.labelPrefixIcon),Be=Ot(F.labelIconRight??F.labelSuffixIcon),Ve=Ot(F.prefixIcon),De=Ot(F.suffixIcon);return s.jsx(Ri,{name:B,control:R,searchFn:Me,label:H(F.label),size:F.size,width:F.width,disabled:K||_,labelPrefixIcon:Ie,labelSuffixIcon:Be,prefixIcon:Ve,suffixIcon:De,...Ae},B)}if(F.type==="inputGroup"){const Se=F,Ne=(Se.inputs??[]).map(Me=>{var wr,Dt;const Ae=typeof Me=="string"?L[Me]??(l??[]).find(lr=>(lr==null?void 0:lr.name)===Me):Me;if(!Ae)return null;const Ie=Ae.name,Be=D?`${D}.${Ie}`:Ie,Ve=Ae.disabledWhen;let De=!!Ae.disabled;const vt=G(Ve,!1,Ie,"disabledWhen");Ve!=null&&Ve.enabled&&(De=vt),!(Ve!=null&&Ve.enabled)&&X[Ie]&&(De=!0);const Ze=Ot(Ae.labelIconLeft??Ae.labelPrefixIcon),qe=Ot(Ae.labelIconRight??Ae.labelSuffixIcon),He=Ot(Ae.prefixIcon),at=Ot(Ae.suffixIcon),Qt={name:Be,control:R,label:H(Ae.label),size:Ae.size,width:Ae.width,placeholder:H(Ae.placeholder),hasError:!!(O[Be]||D&&((wr=O[D])!=null&&wr[Ie])),errorMessage:st(b,(Dt=O[Be])==null?void 0:Dt.message),loading:Z,disabled:De||_,suffixButton:Ae.suffixButton,reserveErrorSpace:!0,labelPrefixIcon:Ze,labelSuffixIcon:qe,prefixIcon:He,suffixIcon:at};return Ae.type==="select"?{...Qt,options:Ae.options??te[Ie]??z[Ie]??[],loadOptions:Ae.options||Ae.optionSource?void 0:Ae.loadOptions}:{...Qt,type:Ae.type}}).filter(Boolean);return s.jsx(Ei,{groupLabel:st(b,Se.groupLabel),inputs:Ne,separator:Se.separator,useSeparator:Se.useSeparator,className:Se.className,showVisibleLabel:Se.showVisibleLabel,size:Se.size},`inputGroup_${B??Se.groupLabel??"group"}`)}if(F.type==="button"){const Se=F,Ne=Se.icon,Me=Ne&&typeof Ne=="object"&&Ne.name&&Ne.style?Ot(Ne):void 0;return s.jsx("div",{className:"self-center",children:s.jsx(ue,{type:"button",variant:Se.variant,size:Se.size,width:Se.width,icon:Me,iconPosition:Se.iconPosition,ariaLabel:H(Se.ariaLabel),onClick:Se.onClick,disabled:K||_,children:H(Se.label)})},B??Se.label)}if(F.type==="array"){const Se=F;return s.jsx(kO,{schema:{...Se,name:B},renderField:W},B)}const he=F.suffixButton,ve=typeof he=="string"?W(he):he,je=Ot(F.labelIconLeft??F.labelPrefixIcon),ye=Ot(F.labelIconRight??F.labelSuffixIcon),Fe=Ot(F.prefixIcon),$e=Ot(F.suffixIcon),Ee={name:B,control:R,disabled:K||_,label:H(F.label),size:F.size,width:F.width,placeholder:H(F.placeholder),info:st(b,F.info),suffixButton:ve,labelPrefixIcon:je,labelSuffixIcon:ye,prefixIcon:Fe,suffixIcon:$e,onBlur:()=>{C(w.getValues(),T,"onBlur"),l.filter(Ne=>{const Me=Ne;return["visibleWhen","disabledWhen","clearWhen"].some(Ae=>{var Be;const Ie=(Be=Me[Ae])==null?void 0:Be.endpoint;return(Ie==null?void 0:Ie.trigger)==="onBlur"&&Object.values(Ie.parameters||{}).some(Ve=>Ve.fieldRef===T)})}).length>0&&de()}};switch(F.type){case"select":{const Se=F.options??te[T]??z[T]??[],Ne=Array.isArray(Se)&&Se.length?`${Se.length}:${Se.map(Ae=>String((Ae==null?void 0:Ae.value)??"")).join("|")}`:"0",Me=!F.options&&!F.optionSource&&F.loadOptions;return s.jsx(mt,{name:B,control:R,render:({field:Ae})=>{var Ie;return s.jsx(Ge,{...Ee,value:Ae.value,onChange:Ae.onChange,options:Se,loadOptions:Me||void 0,hasError:!!O[B],errorMessage:st(b,(Ie=O[B])==null?void 0:Ie.message),suffixButton:ve})}},`${B}:${Ne}`)}case"textarea":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(or,{...Ee,value:Se.value,onChange:Se.onChange,maxLength:F.maxLength,showCounter:!!F.showCounter,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message)})}},B);case"file":return s.jsx(xi,{...Ee,defaultValue:[],maxFiles:F.maxFiles,accept:F.accept,hideDropZone:F.hideDropZone,hasError:!!O[B],errorMessage:st(b,(Oe=O[B])==null?void 0:Oe.message)},B);case"checkbox":return s.jsx(tt,{...Ee,defaultValue:!1,hasError:!!O[B],errorMessage:st(b,(_e=O[B])==null?void 0:_e.message),name:B},B);case"date":return s.jsx(Nn,{...Ee,defaultValue:"",showTime:!!F.showTime,hasError:!!O[B],errorMessage:st(b,(ze=O[B])==null?void 0:ze.message)},B);case"optionGroup":return s.jsx(es,{...Ee,options:F.options||[],multiple:F.multiple,vertical:F.vertical,groupLabel:F.groupLabel,defaultValue:F.defaultValue,className:F.width?void 0:"w-full",name:B},B);case"iban":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(ts,{label:H(F.label),placeholder:H(F.placeholder),size:F.size,disabled:K||_,value:Se.value??"",onChange:Se.onChange,onBlur:Se.onBlur,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message),name:B})}},B);case"dni":return s.jsx(mt,{name:B,control:R,render:({field:Se,fieldState:Ne})=>{var Me;return s.jsx(Si,{label:H(F.label),placeholder:H(F.placeholder),size:F.size,disabled:K||_,value:Se.value??"",onChange:Se.onChange,onBlur:Se.onBlur,hasError:!!Ne.error,errorMessage:st(b,(Me=Ne.error)==null?void 0:Me.message),name:B})}},B);default:return s.jsx(Xo,{...Ee,type:F.type,loadingDefaults:Z,hasError:!!O[B],errorMessage:st(b,(nt=O[B])==null?void 0:nt.message),suffixButton:ve,name:B},B)}},[l,L,R,O,_,Z,z,te,G,X,w.getValues,w.watch,g,b]);return s.jsx(fi,{...w,children:s.jsxs("form",{noValidate:!0,onSubmit:N(async $=>{await C($,void 0,"onSubmit"),!(Object.keys(w.formState.errors).length>0)&&(await i($),p(c??b("ds.form.saveSuccess"),"success"))},$=>{JM($),p(u??b("ds.form.saveError"),"error")}),className:"space-y-6",children:[o.map(($,D)=>$.type==="rows"?s.jsx(k.Fragment,{children:$.sections.map((F,T)=>s.jsx("div",{children:s.jsx(rt,{title:H(F.sectionTitle),defaultOpen:F.defaultOpen,children:F.rows.map((B,P)=>s.jsxs("div",{children:[B.title&&s.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:H(B.title)}),s.jsx("div",{className:"flex flex-wrap -mx-2",children:B.columns.map((U,K)=>{var ne;return s.jsx("div",{className:`${U.width} px-2 flex flex-col`,children:s.jsx("div",{className:"",children:U.fields?U.fields.map(ce=>W(ce)):(ne=U.rows)==null?void 0:ne.map((ce,he)=>s.jsx("div",{className:"mb-1",children:s.jsx("div",{className:"flex flex-wrap -mx-2",children:ce.columns.map((ve,je)=>{var ye;return s.jsx("div",{className:`${ve.width} px-2`,children:(ye=ve.fields)==null?void 0:ye.map(Fe=>W(Fe))},je)})})},he))})},K)})})]},P))})},T))},D):s.jsx(xr,{options:$.tabs.map(F=>{const T=F.icon?An(F.icon.name,F.icon.style):null;return{label:H(F.label),value:F.key,disabled:F.disabled,icon:T?s.jsx(T,{className:"w-4 h-4"}):null}}),value:Y[D],onChange:F=>fe(T=>({...T,[D]:F})),children:Object.fromEntries($.tabs.map(F=>[F.key,s.jsx("div",{className:"space-y-6",children:F.sections.map((T,B)=>s.jsx("div",{className:"mb-6",children:s.jsx(rt,{title:H(T.sectionTitle),defaultOpen:T.defaultOpen,children:T.rows.map((P,U)=>s.jsx("div",{children:s.jsx("div",{className:"flex flex-wrap -mx-2",children:P.columns.map((K,ne)=>{var ce;return s.jsx("div",{className:`${K.width??"flex-1"} px-2 flex flex-col`,children:s.jsx("div",{className:"space-y-4",children:(ce=K.fields)==null?void 0:ce.map((he,ve)=>s.jsx(k.Fragment,{children:W(he)},ve))})},ne)})})},U))})},B))},F.key)]))},D)),s.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:d??s.jsx(ue,{type:"submit",variant:"primary",icon:Gr,size:"sm",disabled:_||Z||M>0,children:b(_?"ds.form.sending":"ds.form.submit")})})]})})}const NO={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function St({icon:e,size:t="md",ariaLabel:r,disabled:n=!1,onClick:o,className:l,...i}){return s.jsx("button",{type:"button","aria-label":r,disabled:n,onClick:o,className:pe("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",NO[t],n?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse","hover:bg-[var(--color-ds-background-neutral-hover)]"],l),...i,children:s.jsx(e,{className:pe(t==="sm"?"h-4 w-4":t==="md"?"h-5 w-5":"h-6 w-6")})})}function r1({dark:e,onToggle:t}){return s.jsx("button",{type:"button","aria-pressed":e,"aria-label":e?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:t,className:pe("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:s.jsxs("div",{className:pe("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:[s.jsx(yt,{component:si,size:"sm",className:pe("absolute transition-opacity duration-200 ease-in-out",e?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),s.jsx(yt,{component:ti,size:"sm",className:pe("absolute transition-opacity duration-200 ease-in-out",e?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const l0="licytal:ui:theme",n1=k.createContext({theme:"light",dark:!1,toggle:()=>{}});function AO({children:e}){const[t,r]=k.useState(!1),[n,o]=k.useState("light");k.useEffect(()=>{if(typeof window>"u")return;const i=localStorage.getItem(l0);i==="light"||i==="dark"?o(i):window.matchMedia("(prefers-color-scheme: dark)").matches&&o("dark"),r(!0)},[]),k.useEffect(()=>{t&&(document.documentElement.classList.toggle("dark",n==="dark"),localStorage.setItem(l0,n))},[n,t]);const l=()=>o(i=>i==="light"?"dark":"light");return t?s.jsx(n1.Provider,{value:{theme:n,dark:n==="dark",toggle:l},children:e}):null}const Ni=()=>k.useContext(n1),Gn={locale:"licytal:ui:locale",theme:"licytal:ui:theme"},a1=({pinnedPages:e,onRemovePinned:t,onBack:r,dark:n,locale:o,languageOptions:l,onChangeLocale:i,profile:c="",profileOptions:u=[],onChangeProfile:d,logoSrc:m,logoAlt:f="Logo aplicación"})=>{const h=e.slice(0,3),{toggle:p}=Ni(),b=g=>{try{localStorage.setItem(Gn.locale,g)}catch{}i==null||i(g)},v=()=>{const g=!n;try{localStorage.setItem(Gn.theme,g?"dark":"light")}catch{}p()};return k.useEffect(()=>{try{const g=localStorage.getItem(Gn.locale);g&&g!==o&&(i==null||i(g))}catch{}},[]),k.useEffect(()=>{if(o)try{localStorage.setItem(Gn.locale,o)}catch{}},[o]),k.useEffect(()=>{try{const g=localStorage.getItem(Gn.theme);if(!g)return;g==="dark"!==n&&p()}catch{}},[]),s.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2 px-4",children:[s.jsx("div",{className:"flex-1 flex justify-center",children:m&&s.jsx("img",{src:m,alt:f,className:"h-20 w-auto object-contain"})}),s.jsx("div",{className:"flex items-center space-x-2",children:h.map(g=>s.jsxs("div",{className:"flex items-center",children:[s.jsx("a",{href:g.href,className:pe("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}),s.jsx(St,{icon:et,size:"sm",ariaLabel:`Remove ${g.label}`,onClick:()=>t(g.id)})]},g.id))}),s.jsxs("div",{className:"flex-1 flex justify-end items-center space-x-2",children:[s.jsx(Ge,{size:"sm",width:"auto",options:l,value:o,onChange:b,disableErrorPlaceholder:!0,label:"Idioma",labelHidden:!0}),!!u.length&&s.jsx(Ge,{size:"sm",width:"auto",options:u,value:c,onChange:g=>d==null?void 0:d(g),disableErrorPlaceholder:!0,label:"Perfil",labelHidden:!0}),s.jsx(r1,{dark:n,onToggle:v})]})]})},MO=({loading:e=!1,ariaLabel:t="Cargando..."})=>e?s.jsxs("div",{className:`\r
99
99
  fixed inset-0\r
100
100
  flex items-center justify-center\r
101
101
  bg-[var(--color-ds-background-surface)]/90\r
@@ -106,7 +106,7 @@ attempted value: ${i}
106
106
  border-gray-200\r
107
107
  border-t-[var(--color-ds-button-primary-bg)]\r
108
108
  animate-spin\r
109
- `}),s.jsx("span",{className:"sr-only",children:t})]}):null,Ai=({items:e,selected:t,onSelect:r,level:n=0,openItems:o,onToggle:l})=>{const[i,c]=k.useState(new Set),u=o??i,d=o!==void 0&&l!==void 0,m=f=>{if(d)l(f);else{const h=new Set(i);h.has(f)?h.delete(f):h.add(f),c(h)}};return s.jsx("ul",{className:pe(n>0?"mt-1":"mt-0"),children:e.map(f=>{var w;const h=f.value===t,p=u.has(f.value),b=["pl-2","pl-2","pl-2"][n]||"pl-4",v=n===0?p||h?"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)]":h?"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)]",g=n===0&&(p||h)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",x=!!((w=f.children)!=null&&w.length);return s.jsxs("li",{children:[s.jsxs("button",{type:"button",onClick:()=>x?m(f.value):r(f.value),"aria-expanded":x?p:void 0,className:pe("w-full flex items-center justify-between h-8 transition-colors",b,v),children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[n===0&&f.icon&&s.jsx(f.icon,{className:"w-5 h-5 ml-2"}),s.jsx("span",{className:"text-ds-sm",children:f.label})]}),x&&(p?s.jsx(Kt,{className:pe("w-4 h-4",g)}):s.jsx(Ho,{className:pe("w-4 h-4",g)}))]}),x&&s.jsx("div",{className:pe("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",p?"max-h-screen":"max-h-0"),children:s.jsx(Ai,{items:f.children,selected:t,onSelect:r,level:n+1,openItems:u,onToggle:d?l:m})})]},f.value)})})},OO="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",LO="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",o1=({appName:e,orgName:t,username:r,footerText:n,navItems:o,selectedNav:l,onSelectNav:i,width:c="200px",logoSrc:u,logoAlt:d="Logo aplicación"})=>{const{theme:m}=Ni(),h=u||(m==="dark"?OO:LO);return s.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)] overflow-hidden",style:{width:c},children:[s.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[s.jsx("img",{src:h,alt:d,className:"w-20 h-20 object-contain"}),s.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg",children:e}),s.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),s.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:r}),s.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),s.jsx("nav",{className:"flex-1 min-h-0 overflow-auto custom-scroll scrollbar-hidden pt-3",children:s.jsx(Ai,{items:o,selected:l,onSelect:i})}),s.jsx("div",{className:"px-4 w-full py-3",children:s.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:n})})]})};function $O({hideSidebar:e=!1,sidebar:t,header:r,children:n}){const{dark:o}=Ni(),l={...r,dark:o};return s.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!e&&s.jsx(o1,{...t}),s.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${e?"px-0":"px-10"}`,children:[s.jsx(a1,{...l}),s.jsx("main",{className:"flex-1 min-h-0",children:n})]})]})}function Mo({className:e,children:t,gradientHeight:r=40,disableTop:n=!1,disableBottom:o=!1}){const l=k.useRef(null),[i,c]=k.useState(!1),[u,d]=k.useState(!1),m=()=>{const f=l.current;if(!f)return;const{scrollTop:h,scrollHeight:p,clientHeight:b}=f,v=5;c(h>v),d(h+b<p-v)};return k.useEffect(()=>{const f=l.current;if(!f)return;m(),f.addEventListener("scroll",m);const h=new ResizeObserver(m);return h.observe(f),()=>{f.removeEventListener("scroll",m),h.disconnect()}},[]),s.jsxs("div",{className:"relative w-full h-full",children:[!n&&s.jsx("div",{className:pe("absolute top-0 left-0 right-0 pointer-events-none transition-opacity duration-300 z-10",i?"opacity-50":"opacity-0"),style:{height:`${r}px`,background:`linear-gradient(to bottom,
109
+ `}),s.jsx("span",{className:"sr-only",children:t})]}):null,Ai=({items:e,selected:t,onSelect:r,level:n=0,openItems:o,onToggle:l})=>{const[i,c]=k.useState(new Set),u=o??i,d=o!==void 0&&l!==void 0,m=f=>{if(d)l(f);else{const h=new Set(i);h.has(f)?h.delete(f):h.add(f),c(h)}};return s.jsx("ul",{className:pe(n>0?"mt-1":"mt-0"),children:e.map(f=>{var w;const h=f.value===t,p=u.has(f.value),b=["pl-2","pl-2","pl-2"][n]||"pl-4",v=n===0?p||h?"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)]":h?"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)]",g=n===0&&(p||h)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",x=!!((w=f.children)!=null&&w.length);return s.jsxs("li",{children:[s.jsxs("button",{type:"button",onClick:()=>x?m(f.value):r(f.value),"aria-expanded":x?p:void 0,className:pe("w-full flex items-center justify-between h-8 transition-colors",b,v),children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[n===0&&f.icon&&s.jsx(f.icon,{className:"w-5 h-5 ml-2"}),s.jsx("span",{className:"text-ds-sm",children:f.label})]}),x&&(p?s.jsx(Kt,{className:pe("w-4 h-4",g)}):s.jsx(Ho,{className:pe("w-4 h-4",g)}))]}),x&&s.jsx("div",{className:pe("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",p?"max-h-screen":"max-h-0"),children:s.jsx(Ai,{items:f.children,selected:t,onSelect:r,level:n+1,openItems:u,onToggle:d?l:m})})]},f.value)})})},OO="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",LO="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",o1=({appName:e,orgName:t,username:r,footerText:n,navItems:o,selectedNav:l,onSelectNav:i,width:c="200px",logoSrc:u,logoAlt:d="Logo aplicación",iconLicytal:m})=>{const{theme:f}=Ni(),p=m||(f==="dark"?OO:LO);return s.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)] overflow-hidden",style:{width:c},children:[s.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[s.jsx("img",{src:p,alt:d,className:"w-20 h-20 object-contain"}),s.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),s.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:r}),s.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),s.jsx("nav",{className:"flex-1 min-h-0 overflow-auto custom-scroll scrollbar-hidden pt-3",children:s.jsx(Ai,{items:o,selected:l,onSelect:i})}),s.jsx("div",{className:"px-4 w-full py-3",children:s.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:n})})]})};function $O({hideSidebar:e=!1,sidebar:t,header:r,children:n}){const{dark:o}=Ni(),l={...r,dark:o};return s.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!e&&s.jsx(o1,{...t}),s.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${e?"px-0":"px-10"}`,children:[s.jsx(a1,{...l}),s.jsx("main",{className:"flex-1 min-h-0",children:n})]})]})}function Mo({className:e,children:t,gradientHeight:r=40,disableTop:n=!1,disableBottom:o=!1}){const l=k.useRef(null),[i,c]=k.useState(!1),[u,d]=k.useState(!1),m=()=>{const f=l.current;if(!f)return;const{scrollTop:h,scrollHeight:p,clientHeight:b}=f,v=5;c(h>v),d(h+b<p-v)};return k.useEffect(()=>{const f=l.current;if(!f)return;m(),f.addEventListener("scroll",m);const h=new ResizeObserver(m);return h.observe(f),()=>{f.removeEventListener("scroll",m),h.disconnect()}},[]),s.jsxs("div",{className:"relative w-full h-full",children:[!n&&s.jsx("div",{className:pe("absolute top-0 left-0 right-0 pointer-events-none transition-opacity duration-300 z-10",i?"opacity-50":"opacity-0"),style:{height:`${r}px`,background:`linear-gradient(to bottom,
110
110
  var(--color-ds-border-default-50) 0%,
111
111
  transparent 100%)`}}),s.jsx("div",{ref:l,className:pe("w-full h-full overflow-y-auto custom-scroll scrollbar-hidden",e),children:t}),!o&&s.jsx("div",{className:pe("absolute bottom-0 left-0 right-0 pointer-events-none transition-opacity duration-300 z-10",u?"opacity-50":"opacity-0"),style:{height:`${r}px`,background:`linear-gradient(to top,
112
112
  var(--color-ds-border-default-50) 0%,