rharuow-ds 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/rharuow-ds.cjs.js +1 -1
- package/dist/rharuow-ds.es.js +461 -448
- package/dist/styles.css +1 -1
- package/dist/types/src/components/Modal.d.ts +1 -0
- package/dist/types/src/stories/Modal.stories.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -592,6 +592,7 @@ Componente de diálogo modal para exibir conteúdo sobreposto à página princip
|
|
|
592
592
|
|
|
593
593
|
- ✅ Overlay com transparência configurável
|
|
594
594
|
- ✅ Múltiplos tamanhos: sm, md, lg, xl, full
|
|
595
|
+
- ✅ Variantes de cor: default, primary, secondary (usando CSS Variables)
|
|
595
596
|
- ✅ Controle de fechamento via overlay, ESC ou botão X
|
|
596
597
|
- ✅ Prevenção de scroll do body quando aberto
|
|
597
598
|
- ✅ Animações suaves de entrada/saída
|
|
@@ -604,6 +605,7 @@ Props principais:
|
|
|
604
605
|
- `open: boolean` — controla visibilidade do modal
|
|
605
606
|
- `onClose: () => void` — callback chamado ao fechar
|
|
606
607
|
- `size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'` — tamanho do modal (padrão: 'md')
|
|
608
|
+
- `variant?: 'default' | 'primary' | 'secondary'` — variante de cor (padrão: 'default')
|
|
607
609
|
- `closeOnOverlayClick?: boolean` — fecha ao clicar fora (padrão: true)
|
|
608
610
|
- `closeOnEscape?: boolean` — fecha ao pressionar ESC (padrão: true)
|
|
609
611
|
- `showCloseButton?: boolean` — exibe botão X de fechar (padrão: true)
|
|
@@ -737,6 +739,74 @@ function FormModal() {
|
|
|
737
739
|
}
|
|
738
740
|
```
|
|
739
741
|
|
|
742
|
+
Exemplo com variantes de cor:
|
|
743
|
+
|
|
744
|
+
```tsx
|
|
745
|
+
import React from 'react';
|
|
746
|
+
import { Modal, Button } from 'rharuow-ds';
|
|
747
|
+
|
|
748
|
+
function ColorVariants() {
|
|
749
|
+
const [openPrimary, setOpenPrimary] = React.useState(false);
|
|
750
|
+
const [openSecondary, setOpenSecondary] = React.useState(false);
|
|
751
|
+
|
|
752
|
+
return (
|
|
753
|
+
<div>
|
|
754
|
+
{/* Modal com cor primária */}
|
|
755
|
+
<Button onClick={() => setOpenPrimary(true)}>
|
|
756
|
+
Modal Primary
|
|
757
|
+
</Button>
|
|
758
|
+
|
|
759
|
+
<Modal
|
|
760
|
+
open={openPrimary}
|
|
761
|
+
onClose={() => setOpenPrimary(false)}
|
|
762
|
+
variant="primary"
|
|
763
|
+
>
|
|
764
|
+
<Modal.Header>
|
|
765
|
+
<h2 className="text-2xl font-bold">Ação Importante</h2>
|
|
766
|
+
</Modal.Header>
|
|
767
|
+
<Modal.Body>
|
|
768
|
+
<p className="opacity-95">
|
|
769
|
+
Este modal usa as cores primárias da aplicação,
|
|
770
|
+
ideal para destacar ações principais.
|
|
771
|
+
</p>
|
|
772
|
+
</Modal.Body>
|
|
773
|
+
<Modal.Footer>
|
|
774
|
+
<Button variant="outline" onClick={() => setOpenPrimary(false)}>
|
|
775
|
+
Fechar
|
|
776
|
+
</Button>
|
|
777
|
+
</Modal.Footer>
|
|
778
|
+
</Modal>
|
|
779
|
+
|
|
780
|
+
{/* Modal com cor secundária */}
|
|
781
|
+
<Button onClick={() => setOpenSecondary(true)} variant="secondary">
|
|
782
|
+
Modal Secondary
|
|
783
|
+
</Button>
|
|
784
|
+
|
|
785
|
+
<Modal
|
|
786
|
+
open={openSecondary}
|
|
787
|
+
onClose={() => setOpenSecondary(false)}
|
|
788
|
+
variant="secondary"
|
|
789
|
+
>
|
|
790
|
+
<Modal.Header>
|
|
791
|
+
<h2 className="text-2xl font-bold">Aviso</h2>
|
|
792
|
+
</Modal.Header>
|
|
793
|
+
<Modal.Body>
|
|
794
|
+
<p className="opacity-95">
|
|
795
|
+
Este modal usa as cores secundárias da aplicação,
|
|
796
|
+
ideal para avisos e ações alternativas.
|
|
797
|
+
</p>
|
|
798
|
+
</Modal.Body>
|
|
799
|
+
<Modal.Footer>
|
|
800
|
+
<Button variant="secondary" onClick={() => setOpenSecondary(false)}>
|
|
801
|
+
Fechar
|
|
802
|
+
</Button>
|
|
803
|
+
</Modal.Footer>
|
|
804
|
+
</Modal>
|
|
805
|
+
</div>
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
```
|
|
809
|
+
|
|
740
810
|
Veja a story do componente no Storybook para mais exemplos e variações:
|
|
741
811
|
|
|
742
812
|
[Storybook — Modal](https://rharuow.github.io/rharuow-ds-docs/?path=/story/components-modal--basic)
|
package/dist/rharuow-ds.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),Z=require("react-hook-form"),me=require("react-dom");function je(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const t=je(a);function ke(e){var n,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(r=ke(e[n]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function De(){for(var e,n,r=0,o="",l=arguments.length;r<l;r++)(e=arguments[r])&&(n=ke(e))&&(o&&(o+=" "),o+=n);return o}function i(...e){return De(...e)}const Ue=({children:e,variant:n="default",className:r="",...o})=>{const l="px-4 py-2 rounded font-medium transition",h={default:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",outline:"border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"};return a.createElement("button",{className:i(l,h[n],r),...o},e)},Se=e=>e.replace(/\D/g,""),qe=e=>{const r=Se(e).slice(0,11);return r.length<=3?r:r.length<=6?`${r.slice(0,3)}.${r.slice(3)}`:r.length<=9?`${r.slice(0,3)}.${r.slice(3,6)}.${r.slice(6)}`:`${r.slice(0,3)}.${r.slice(3,6)}.${r.slice(6,9)}-${r.slice(9,11)}`},Ne=e=>{const n=Se(e);if(n.length!==11||/^(\d)\1{10}$/.test(n))return!1;let r=0;for(let l=0;l<9;l++)r+=parseInt(n.charAt(l))*(10-l);let o=r*10%11;if((o===10||o===11)&&(o=0),o!==parseInt(n.charAt(9)))return!1;r=0;for(let l=0;l<10;l++)r+=parseInt(n.charAt(l))*(11-l);return o=r*10%11,(o===10||o===11)&&(o=0),o===parseInt(n.charAt(10))},Me=t.forwardRef(({name:e,className:n,type:r="text",label:o,onFocus:l,onBlur:h,onChange:d,Icon:k,iconClassName:v,iconAction:g,containerClassName:u,cpf:x=!1,...s},S)=>{var P,I,G;const[M,L]=t.useState(!1),[y,E]=t.useState(!1),[C,N]=t.useState(null),m=Z.useFormContext(),F=m==null?void 0:m.control,R=m==null?void 0:m.register,B=F&&e?Z.useWatch({control:F,name:e}):void 0,b=s.value??B??"",H=((G=(I=(P=m==null?void 0:m.formState)==null?void 0:P.errors)==null?void 0:I[e])==null?void 0:G.message)||C,T=["date","datetime-local","time","month","week"].includes(r),J=M||!!b||T,ee=r==="password"?y?"text":"password":r,Y=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",fill:"currentColor"})),O=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",fill:"currentColor"})),W=()=>{E(!y)},X=z=>{if(x){const q=z.target.value,D=qe(q);z.target.value=D,D.length===14?Ne(D)?N(null):N("CPF inválido"):N(null)}d&&d(z)};return t.createElement("div",{className:i("relative",u)},t.createElement("input",{id:s.id||e,type:ee,className:i("peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",r==="password"||k?"pr-12":"",H?"border-red-500":"",n),onFocus:z=>{L(!0),l&&l(z)},maxLength:x?14:s.maxLength,inputMode:x?"numeric":s.inputMode,...m&&e?(()=>{const z=R(e,x?{validate:j=>j?j.length<14?"CPF incompleto":Ne(j)?!0:"CPF inválido":"CPF é obrigatório"}:void 0),q=z.onBlur,D=z.onChange;return{...z,ref:j=>{typeof S=="function"?S(j):S&&(S.current=j),z.ref&&z.ref(j)},onBlur:j=>{L(!1),h&&h(j),q&&q(j)},onChange:j=>{X(j),D&&D(j)}}})():{ref:S,onBlur:z=>{L(!1),h&&h(z)},onChange:X},...s}),o&&t.createElement("label",{htmlFor:s.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",J?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},o),r==="password"&&t.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:W,"aria-label":y?"Esconder senha":"Mostrar senha",tabIndex:-1},y?t.createElement(O,null):t.createElement(Y,null)),k&&r!=="password"&&t.createElement("div",{className:i("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",v),onClick:g},t.createElement(k,null)),H&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},H))});Me.displayName="Input";const Le=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,isClearable:h,searchable:d=!1,filterPlaceholder:k="Digite para filtrar...",caseSensitive:v=!1,filterFunction:g,onFocus:u,onBlur:x,...s},S)=>{var ae,oe,f,_;const[M,L]=t.useState(!1),[y,E]=t.useState(!1),[C,N]=t.useState(""),[m,F]=t.useState({top:0,left:0,width:0}),R=t.useRef(null),B=t.useRef(null),b=Z.useFormContext(),H=b==null?void 0:b.control,U=H&&e?Z.useWatch({control:H,name:e}):void 0,T=s.value??U??"",J=(f=(oe=(ae=b==null?void 0:b.formState)==null?void 0:ae.errors)==null?void 0:oe[e])==null?void 0:f.message,Y=g||((c,$)=>{const K=v?c.label:c.label.toLowerCase(),re=v?$:$.toLowerCase();return K.includes(re)}),O=C.trim()?r.filter(c=>Y(c,C.trim())):r,W=r.find(c=>c.value===T),X=d&&y?C:(W==null?void 0:W.label)||"",P=M||!!T||d&&!!C,I=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),G=t.useCallback(()=>{if(R.current&&y){const c=R.current.getBoundingClientRect(),$=I(),K=window.innerHeight,re=window.innerWidth,Q=152;let w=c.bottom+4,V=c.left;if($){const ne=K-c.bottom,p=c.top;ne<Q&&p>Q&&(w=c.top-Q-4);const A=16,te=re-c.width-A;V=Math.min(Math.max(V,A),te)}else K-c.bottom<Q&&(w=c.top-Q-4);F({top:w,left:V,width:c.width})}},[y,I]);t.useEffect(()=>{if(G(),y){const c=()=>G(),$=()=>G();return window.addEventListener("resize",c),window.addEventListener("scroll",$,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",$,!0)}}},[y,G]),t.useEffect(()=>{const c=$=>{R.current&&!R.current.contains($.target)&&(E(!1),L(!1))};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]);const z=()=>{E(c=>!c),L(!0)},q=c=>{L(!0),u&&u(c)},D=c=>{x&&x(c)},j=c=>{N(c.target.value)},le=c=>{if(b&&e&&b.setValue(e,c),s.onChange){const $={target:{value:c}};s.onChange($)}E(!1),L(!1),N("")};return t.createElement("div",{className:i("relative",l),ref:R},t.createElement("div",{id:s.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":y,className:i("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:d?void 0:z,onFocus:d?void 0:q,onBlur:d?void 0:D,ref:S},d?t.createElement("input",{ref:B,type:"text",value:X,onChange:j,onFocus:d?c=>{L(!0),E(!0),u&&u(c)}:void 0,onBlur:d?c=>{x&&x(c)}:void 0,placeholder:n?"":k||"Selecione...",className:i("w-full bg-transparent border-none outline-none text-sm",!T&&!C&&"text-gray-400")}):t.createElement("span",{className:i("block truncate",!T&&"text-gray-400")},((_=r.find(c=>c.value===T))==null?void 0:_.label)||!n&&"Selecione..."),h&&T&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:c=>{if(c.stopPropagation(),b&&e&&b.setValue(e,""),s.onChange){const $={target:{value:""}};s.onChange($)}E(!1),L(!1)}},"✕")),n&&t.createElement("label",{htmlFor:s.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",P?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:i("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",y?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:y?"9.5rem":"0",overflowY:r.length>3?"auto":"hidden",position:"fixed",top:y?`${m.top}px`:"auto",left:y?`${m.left}px`:"auto",width:y?`${m.width}px`:"auto",zIndex:9999,boxShadow:y?"var(--select-dropdown-shadow)":"none"}},O.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):O.map(c=>t.createElement("div",{key:c.value,className:i("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",T===c.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>le(c.value)},c.label))),J&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});Le.displayName="Select";const Fe=t.forwardRef(({name:e,className:n,label:r,onFocus:o,onBlur:l,Icon:h,iconClassName:d,iconAction:k,containerClassName:v,rows:g=4,...u},x)=>{var F,R,B;const[s,S]=t.useState(!1),M=Z.useFormContext(),L=M==null?void 0:M.control,y=M==null?void 0:M.register,E=L&&e?Z.useWatch({control:L,name:e}):void 0,C=u.value??E??"",N=(B=(R=(F=M==null?void 0:M.formState)==null?void 0:F.errors)==null?void 0:R[e])==null?void 0:B.message,m=s||!!C;return t.createElement("div",{className:i("relative",v)},t.createElement("textarea",{id:u.id||e,rows:g,className:i("peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",h?"pr-12":"",n),onFocus:b=>{S(!0),o&&o(b)},...M&&e?(()=>{const b=y(e),H=b.onBlur;return{...b,ref:U=>{typeof x=="function"?x(U):x&&(x.current=U),b.ref&&b.ref(U)},onBlur:U=>{S(!1),l&&l(U),H&&H(U)}}})():{ref:x,onBlur:b=>{S(!1),l&&l(b)}},...u}),r&&t.createElement("label",{htmlFor:u.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",m?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),h&&t.createElement("div",{className:i("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",d),onClick:k},t.createElement(h,null)),N&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},N))});Fe.displayName="Textarea";const Re=t.forwardRef(({name:e,label:n,loadOptions:r,className:o,containerClassName:l,isClearable:h,defaultOptions:d=!1,loadingMessage:k="Carregando...",noOptionsMessage:v="Nenhuma opção encontrada",searchable:g=!1,debounceMs:u=300,onFocus:x,onBlur:s,...S},M)=>{var K,re,Q;const[L,y]=t.useState(!1),[E,C]=t.useState(!1),[N,m]=t.useState([]),[F,R]=t.useState(!1),[B,b]=t.useState(""),[H,U]=t.useState(""),[T,J]=t.useState({top:0,left:0,width:0}),ee=t.useRef(null),Y=t.useRef(null),O=Z.useFormContext(),W=O==null?void 0:O.control,X=W&&e?Z.useWatch({control:W,name:e}):void 0,P=S.value??X??"",I=(Q=(re=(K=O==null?void 0:O.formState)==null?void 0:K.errors)==null?void 0:re[e])==null?void 0:Q.message,G=L||!!P,z=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),q=t.useCallback(()=>{if(ee.current&&E){const w=ee.current.getBoundingClientRect(),V=z(),ne=window.innerHeight,p=window.innerWidth,A=152;let te=w.bottom+4,ie=w.left;if(V){const se=ne-w.bottom,de=w.top;se<A&&de>A&&(te=w.top-A-4);const ce=16,ue=p-w.width-ce;ie=Math.min(Math.max(ie,ce),ue)}else ne-w.bottom<A&&(te=w.top-A-4);J({top:te,left:ie,width:w.width})}},[E,z]);t.useEffect(()=>{if(q(),E){const w=()=>q(),V=()=>q();return window.addEventListener("resize",w),window.addEventListener("scroll",V,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",V,!0)}}},[E,q]),t.useEffect(()=>{const w=setTimeout(()=>{U(B)},u);return()=>clearTimeout(w)},[B,u]),t.useEffect(()=>{(E||d&&N.length===0)&&D(g?H:void 0)},[H,E]),t.useEffect(()=>{d===!0?D():Array.isArray(d)&&m(d)},[]);const D=async w=>{try{R(!0);const V=await r(w);m(V)}catch(V){console.error("Error loading options:",V),m([])}finally{R(!1)}};t.useEffect(()=>{const w=V=>{ee.current&&!ee.current.contains(V.target)&&(C(!1),y(!1),b(""))};return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[]);const j=()=>{E||(C(!0),y(!0),g&&Y.current&&setTimeout(()=>{var w;return(w=Y.current)==null?void 0:w.focus()},0))},le=w=>{y(!0),x&&x(w)},ae=w=>{s&&s(w)},oe=w=>{b(w.target.value)},f=w=>{if(O&&e&&O.setValue(e,w),S.onChange){const V={target:{value:w}};S.onChange(V)}C(!1),y(!1),b("")},_=w=>{if(w.stopPropagation(),O&&e&&O.setValue(e,""),S.onChange){const V={target:{value:""}};S.onChange(V)}C(!1),y(!1),b("")},c=N.find(w=>w.value===P),$=g&&E?B:(c==null?void 0:c.label)||"";return t.createElement("div",{className:i("relative",l),ref:ee},t.createElement("div",{id:S.id||e,tabIndex:g?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":E,className:i("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:j,onFocus:g?void 0:le,onBlur:g?void 0:ae,ref:M},g?t.createElement("input",{ref:Y,type:"text",value:$,onChange:oe,onFocus:le,onBlur:ae,placeholder:n?"":"Selecione...",className:i("w-full bg-transparent border-none outline-none text-sm",!P&&!B&&"text-gray-400")}):t.createElement("span",{className:i("block truncate",!P&&"text-gray-400")},(c==null?void 0:c.label)||!n&&"Selecione..."),F&&t.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),h&&P&&!F&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:_},"✕")),n&&t.createElement("label",{htmlFor:S.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",G?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:i("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",E?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:E?"9.5rem":"0",overflowY:N.length>3?"auto":"hidden",position:"fixed",top:E?`${T.top}px`:"auto",left:E?`${T.left}px`:"auto",width:E?`${T.width}px`:"auto",zIndex:9999,boxShadow:E?"var(--select-dropdown-shadow)":"none"}},F?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},k):N.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):N.map(w=>t.createElement("div",{key:w.value,className:i("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",P===w.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>f(w.value)},w.label))),I&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},I))});Re.displayName="AsyncSelect";const Te=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,isClearable:h,searchable:d=!1,filterPlaceholder:k="Digite para filtrar...",caseSensitive:v=!1,filterFunction:g,onFocus:u,onBlur:x,...s},S)=>{var le,ae,oe;const[M,L]=t.useState(!1),[y,E]=t.useState(!1),[C,N]=t.useState(""),[m,F]=t.useState({top:0,left:0,width:0}),R=t.useRef(null),B=t.useRef(null),b=Z.useFormContext(),H=b==null?void 0:b.control,U=H&&e?Z.useWatch({control:H,name:e}):void 0,T=s.value??U??[],J=(oe=(ae=(le=b==null?void 0:b.formState)==null?void 0:le.errors)==null?void 0:ae[e])==null?void 0:oe.message,Y=g||((f,_)=>{const c=v?f.label:f.label.toLowerCase(),$=v?_:_.toLowerCase();return c.includes($)}),O=C.trim()?r.filter(f=>Y(f,C.trim())):r,W=M||T&&T.length>0||d&&!!C,X=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),P=t.useCallback(()=>{if(R.current&&y){const f=R.current.getBoundingClientRect(),_=X(),c=window.innerHeight,$=window.innerWidth,K=152;let re=f.bottom+4,Q=f.left;if(_){const w=c-f.bottom,V=f.top;w<K&&V>K&&(re=f.top-K-4);const ne=16,p=$-f.width-ne;Q=Math.min(Math.max(Q,ne),p)}else c-f.bottom<K&&(re=f.top-K-4);F({top:re,left:Q,width:f.width})}},[y,X]);t.useEffect(()=>{if(P(),y){const f=()=>P(),_=()=>P();return window.addEventListener("resize",f),window.addEventListener("scroll",_,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",_,!0)}}},[y,P]),t.useEffect(()=>{const f=_=>{R.current&&!R.current.contains(_.target)&&(E(!1),L(!1))};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[]);const I=()=>{E(f=>!f),L(!0)},G=f=>{L(!0),u&&u(f)},z=f=>{x&&x(f)},q=f=>{var c;let _;T.includes(f)?_=T.filter($=>$!==f):_=[...T,f],b&&e&&b.setValue(e,_),s.onChange&&((c=s.onChange)==null||c.call(s,{target:{value:_}})),L(!0)},D=f=>{var _;f.stopPropagation(),b&&e&&b.setValue(e,[]),s.onChange&&((_=s.onChange)==null||_.call(s,{target:{value:[]}})),E(!1),L(!1)},j=f=>{N(f.target.value)};return t.createElement("div",{className:i("relative",l),ref:R},t.createElement("div",{id:s.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":y,className:i("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:d?void 0:I,onFocus:d?void 0:G,onBlur:d?void 0:z,ref:S},t.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},T&&T.length>0?r.filter(f=>T.includes(f.value)).map(f=>t.createElement("span",{key:f.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",style:{maxWidth:"140px"}},t.createElement("span",{className:"truncate",title:f.label},f.label),t.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${f.label}`,tabIndex:-1,onClick:_=>{_.stopPropagation();const c=T.filter($=>$!==f.value);b&&e&&b.setValue(e,c),s.onChange&&s.onChange({target:{value:c}})}},t.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))):!n&&!d&&t.createElement("span",{className:"text-gray-400 text-sm"},"Selecione..."),d&&t.createElement("input",{ref:B,type:"text",value:C,onChange:j,onFocus:f=>{L(!0),E(!0),u&&u(f)},onBlur:f=>{x&&x(f)},placeholder:n?T&&T.length>0?"":k:k||"Selecione...",className:"flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"})),h&&T&&T.length>0&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:D},"✕")),n&&t.createElement("label",{htmlFor:s.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",W?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:i("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",y?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:y?"9.5rem":"0",overflowY:r.length>3?"auto":"hidden",position:"fixed",top:y?`${m.top}px`:"auto",left:y?`${m.left}px`:"auto",width:y?`${m.width}px`:"auto",zIndex:9999,boxShadow:y?"var(--select-dropdown-shadow)":"none"}},O.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):O.map(f=>t.createElement("div",{key:f.value,className:i("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",T.includes(f.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>q(f.value)},t.createElement("input",{type:"checkbox",checked:T.includes(f.value),readOnly:!0,className:"accent-blue-500"}),f.label))),J&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});Te.displayName="MultiSelect";const Be=t.forwardRef(({name:e,label:n,loadOptions:r,className:o,containerClassName:l,isClearable:h,defaultOptions:d=!1,loadingMessage:k="Carregando...",noOptionsMessage:v="Nenhuma opção encontrada",searchable:g=!1,debounceMs:u=300,maxSelectedDisplay:x=3,onFocus:s,onBlur:S,...M},L)=>{var w,V,ne;const[y,E]=t.useState(!1),[C,N]=t.useState(!1),[m,F]=t.useState([]),[R,B]=t.useState(!1),[b,H]=t.useState(""),[U,T]=t.useState(""),[J,ee]=t.useState({top:0,left:0,width:0}),Y=t.useRef(null),O=t.useRef(null),W=Z.useFormContext(),X=W==null?void 0:W.control,P=X&&e?Z.useWatch({control:X,name:e}):void 0,I=M.value??P??[],G=(ne=(V=(w=W==null?void 0:W.formState)==null?void 0:w.errors)==null?void 0:V[e])==null?void 0:ne.message,z=y||I&&I.length>0,q=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),D=t.useCallback(()=>{if(Y.current&&C){const p=Y.current.getBoundingClientRect(),A=q(),te=window.innerHeight,ie=window.innerWidth,se=152;let de=p.bottom+4,ce=p.left;if(A){const ue=te-p.bottom,He=p.top;ue<se&&He>se&&(de=p.top-se-4);const Ce=16,Ve=ie-p.width-Ce;ce=Math.min(Math.max(ce,Ce),Ve)}else te-p.bottom<se&&(de=p.top-se-4);ee({top:de,left:ce,width:p.width})}},[C,q]);t.useEffect(()=>{if(D(),C){const p=()=>D(),A=()=>D();return window.addEventListener("resize",p),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",A,!0)}}},[C,D]),t.useEffect(()=>{const p=setTimeout(()=>{T(b)},u);return()=>clearTimeout(p)},[b,u]),t.useEffect(()=>{(C||d&&m.length===0)&&j(g?U:void 0)},[U,C]),t.useEffect(()=>{d===!0?j():Array.isArray(d)&&F(d)},[]);const j=async p=>{try{B(!0);const A=await r(p);F(A)}catch(A){console.error("Error loading options:",A),F([])}finally{B(!1)}};t.useEffect(()=>{const p=A=>{Y.current&&!Y.current.contains(A.target)&&(N(!1),E(!1),H(""))};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[]);const le=()=>{C||(N(!0),E(!0),g&&O.current&&setTimeout(()=>{var p;return(p=O.current)==null?void 0:p.focus()},0))},ae=p=>{E(!0),s&&s(p)},oe=p=>{S&&S(p)},f=p=>{H(p.target.value)},_=p=>{let A;I.includes(p)?A=I.filter(te=>te!==p):A=[...I,p],W&&e&&W.setValue(e,A),M.onChange&&M.onChange({target:{value:A}}),E(!0)},c=(p,A)=>{A.stopPropagation();const te=I.filter(ie=>ie!==p);W&&e&&W.setValue(e,te),M.onChange&&M.onChange({target:{value:te}})},$=p=>{p.stopPropagation(),W&&e&&W.setValue(e,[]),M.onChange&&M.onChange({target:{value:[]}}),N(!1),E(!1),H("")},K=m.filter(p=>I.includes(p.value)),re=K.slice(0,x),Q=K.length-x;return t.createElement("div",{className:i("relative",l),ref:Y},t.createElement("div",{id:M.id||e,tabIndex:g?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":C,className:i("peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:le,onFocus:g?void 0:ae,onBlur:g?void 0:oe,ref:L},t.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},re.map(p=>t.createElement("span",{key:p.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",style:{maxWidth:"140px"}},t.createElement("span",{className:"truncate",title:p.label},p.label),t.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${p.label}`,tabIndex:-1,onClick:A=>c(p.value,A)},t.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))),Q>0&&t.createElement("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs"},"+",Q," mais"),g?t.createElement("input",{ref:O,type:"text",value:b,onChange:f,onFocus:ae,onBlur:oe,placeholder:I.length===0&&!n?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):I.length===0&&!n&&t.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),R&&t.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),h&&I&&I.length>0&&!R&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:$},"✕")),n&&t.createElement("label",{htmlFor:M.id||e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",z?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:i("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",C?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:C?"9.5rem":"0",overflowY:m.length>3?"auto":"hidden",position:"fixed",top:C?`${J.top}px`:"auto",left:C?`${J.left}px`:"auto",width:C?`${J.width}px`:"auto",zIndex:9999,boxShadow:C?"var(--select-dropdown-shadow)":"none"}},R?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},k):m.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):m.map(p=>t.createElement("div",{key:p.value,className:i("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",I.includes(p.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>_(p.value)},t.createElement("input",{type:"checkbox",checked:I.includes(p.value),readOnly:!0,className:"accent-blue-500"}),p.label))),G&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},G))});Be.displayName="MultiAsyncSelect";const Ye={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},Ie=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,optionClassName:h,direction:d="row",size:k="md",onFocus:v,onBlur:g,...u},x)=>{var C,N,m;const s=Z.useFormContext(),S=s==null?void 0:s.control,M=S&&e?Z.useWatch({control:S,name:e}):void 0,L=u.value??M??"",y=(m=(N=(C=s==null?void 0:s.formState)==null?void 0:C.errors)==null?void 0:N[e])==null?void 0:m.message,E=F=>{s&&e&&s.setValue(e,F),u.onChange&&u.onChange({target:{value:F}})};return t.createElement("div",{className:i("relative",l),ref:x},n&&t.createElement("label",{htmlFor:e,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm transition-all duration-200","top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white")},n),t.createElement("div",{className:i("flex gap-2 w-full pt-6",d==="row"?"flex-row":"flex-col",o),"aria-label":n,tabIndex:-1,onFocus:v,onBlur:g},r.map(F=>t.createElement("button",{key:F.value,type:"button",className:i("relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-hover,#dbeafe)]",Ye[k],L===F.value?"border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]":"border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",h),"aria-pressed":L===F.value,"data-selected":L===F.value,tabIndex:0,onClick:()=>E(F.value),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),E(F.value))}},F.icon&&t.createElement("span",{className:"mr-2 text-lg flex items-center"},F.icon),t.createElement("span",{className:"truncate font-medium"},F.label)))),y&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},y))});Ie.displayName="RadioGroup";const pe=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:i("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4 border-b","bg-[var(--card-header-bg,rgba(249,250,251,0.5))]","border-[var(--card-header-border,#e5e7eb)]","text-[var(--card-text,#111827)]",n),...o},e));pe.displayName="CardHeader";const be=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:i("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",n),...o},e));be.displayName="CardBody";const ge=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:i("px-6 py-4 border-t","bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]","border-[var(--card-footer-border,#e5e7eb)]","text-[var(--card-text,#111827)]",n),...o},e));ge.displayName="CardFooter";const Ge=a.forwardRef(({children:e,className:n,variant:r="default",size:o="md",padding:l="none",rounded:h="lg",constrainWidth:d=!1,allowOverflow:k=!1,...v},g)=>{const u={default:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",outlined:"bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",elevated:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",flat:"bg-[var(--card-bg,#ffffff)] border-0"},x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},s={none:"",sm:"p-3",md:"p-4",lg:"p-6"},S={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return a.createElement("div",{ref:g,className:i("flex flex-col",!k&&"overflow-hidden",u[r],d&&x[o],s[l],S[h],n),...v},e)}),Ke=Object.assign(Ge,{Header:pe,Body:be,Footer:ge}),Pe=a.forwardRef(({children:e,className:n,variant:r="default",size:o="md",responsive:l=!1,stickyHeader:h=!1,...d},k)=>{const v=i("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":r==="bordered"},{"text-sm":o==="sm","text-base":o==="md","text-lg":o==="lg"},n),g=i({"overflow-x-auto":l,"max-h-96 overflow-y-auto":h}),u=a.createElement("table",{ref:k,className:v,...d},e);return l||h?a.createElement("div",{className:g},u):u}),he=a.forwardRef(({children:e,className:n,as:r="thead",...o},l)=>a.createElement(r,{ref:l,className:i("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":r==="thead"},n),...o},e)),ve=a.forwardRef(({children:e,className:n,as:r="tbody",...o},l)=>a.createElement(r,{ref:l,className:i("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",n),...o},e)),xe=a.forwardRef(({children:e,className:n,as:r="tfoot",...o},l)=>a.createElement(r,{ref:l,className:i("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",n),...o},e)),we=a.forwardRef(({children:e,className:n,variant:r="default",...o},l)=>a.createElement("tr",{ref:l,className:i("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":r==="hover","bg-[var(--table-row-selected)]":r==="selected"},n),...o},e)),ye=a.forwardRef(({children:e,className:n,as:r="td",align:o="left",scope:l,colSpan:h,rowSpan:d,...k},v)=>a.createElement(r,{ref:v,scope:r==="th"?l:void 0,colSpan:h,rowSpan:d,className:i("px-4 py-3 text-left",{"font-semibold":r==="th","text-sm":r==="td","text-center":o==="center","text-right":o==="right"},n),...k},e));Pe.displayName="Table";he.displayName="TableHeader";ve.displayName="TableBody";xe.displayName="TableFooter";we.displayName="TableRow";ye.displayName="TableCell";const Je=Object.assign(Pe,{Header:he,Body:ve,Footer:xe,Row:we,Cell:ye}),Qe=({content:e,children:n,position:r="top",className:o="",disabled:l=!1})=>{const[h,d]=a.useState(!1),[k,v]=a.useState(r),[g,u]=a.useState({}),x=a.useRef(null),s=a.useRef(null);a.useEffect(()=>{if(!h||!s.current)return;const m=s.current.getBoundingClientRect();let F=r,R=0,B=0;switch(r){case"top":R=m.top-8,B=m.left+m.width/2;break;case"bottom":R=m.bottom+8,B=m.left+m.width/2;break;case"left":R=m.top+m.height/2,B=m.left-8;break;case"right":R=m.top+m.height/2,B=m.right+8;break}if(x.current){const b=x.current.getBoundingClientRect(),H=window.innerWidth,U=window.innerHeight;r==="top"&&m.top<b.height+16?(F="bottom",R=m.bottom+8):r==="bottom"&&m.bottom+b.height+16>U?(F="top",R=m.top-8):r==="left"&&m.left<b.width+16?(F="right",B=m.right+8):r==="right"&&m.right+b.width+16>H&&(F="left",B=m.left-8)}v(F),u({position:"fixed",top:`${R}px`,left:`${B}px`,zIndex:9999})},[h,r]);const S=()=>{l||d(!0)},M=()=>{d(!1)},L=()=>{l||d(!0)},y=()=>{d(!1)},E=()=>{const N="pointer-events-none";switch(k){case"top":return`${N} transform -translate-x-1/2 -translate-y-full`;case"bottom":return`${N} transform -translate-x-1/2`;case"left":return`${N} transform -translate-x-full -translate-y-1/2`;case"right":return`${N} transform -translate-y-1/2`;default:return`${N} transform -translate-x-1/2 -translate-y-full`}},C=()=>{const N="absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";switch(k){case"top":return`${N} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;case"bottom":return`${N} bottom-full left-1/2 -translate-x-1/2 translate-y-1/2`;case"left":return`${N} left-full top-1/2 -translate-y-1/2 -translate-x-1/2`;case"right":return`${N} right-full top-1/2 -translate-y-1/2 translate-x-1/2`;default:return`${N} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`}};return l||!e?a.createElement(a.Fragment,null,n):a.createElement(a.Fragment,null,a.createElement("div",{className:"relative inline-block",ref:s,onMouseEnter:S,onMouseLeave:M,onFocus:L,onBlur:y},n),h&&typeof document<"u"&&me.createPortal(a.createElement("div",{ref:x,style:g,className:i(E(),"px-2 py-1 text-sm rounded whitespace-nowrap","bg-[var(--tooltip-bg,#374151)] text-[var(--tooltip-text,#fff)]","shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]","transition-opacity duration-200 ease-in-out",o),role:"tooltip","aria-hidden":!h},e,a.createElement("div",{className:C()})),document.body))},Ae=({open:e,onClose:n,side:r="right",size:o="md",closeOnOverlayClick:l=!0,children:h,className:d="",...k})=>{const v=typeof document<"u"?document.body:null,g=o==="sm"?"w-64":o==="md"?"w-96":o==="lg"?"w-[36rem]":void 0,u=typeof o=="string"&&!["sm","md","lg"].includes(o)?{width:o}:void 0,x=a.createElement("div",{"aria-hidden":!e,className:i("fixed inset-0 z-50 flex",e?"pointer-events-auto":"pointer-events-none")},a.createElement("div",{className:i("absolute inset-0 bg-black/40 transition-opacity duration-200",e?"opacity-100":"opacity-0"),onMouseDown:s=>{l&&s.target===s.currentTarget&&n()}}),a.createElement("div",{className:i("relative h-full",r==="right"?"ml-auto":"mr-auto","flex-shrink-0"),style:u},a.createElement("aside",{role:"dialog","aria-modal":!0,className:i("h-full bg-white shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",r==="right"?e?"translate-x-0":"translate-x-full":e?"translate-x-0":"-translate-x-full",g,d),style:u,...k},h)));return v?me.createPortal(x,v):null};Ae.displayName="AsideSheet";const Xe=({avatar:e=!1,value:n,onUpload:r,onRemove:o,accept:l="image/*",maxSize:h,placeholder:d="Selecionar imagem",loading:k=!1,size:v="md",label:g,error:u,disabled:x,className:s,...S})=>{const[M,L]=a.useState(null),[y,E]=a.useState(""),[C,N]=a.useState(!1),m=a.useRef(null),F=!!n,R=!!M,B=F||R,b=k||C,H={sm:e?"w-16 h-16":"w-24 h-16",md:e?"w-24 h-24":"w-32 h-24",lg:e?"w-32 h-32":"w-40 h-32"},T=d||(e?"Adicionar foto":"Selecionar imagem"),J=P=>{var z;const I=(z=P.target.files)==null?void 0:z[0];if(!I)return;if(h&&I.size>h){alert(`Arquivo muito grande. Tamanho máximo: ${(h/1024/1024).toFixed(1)}MB`);return}const G=new FileReader;G.onload=q=>{var D;E((D=q.target)==null?void 0:D.result),L(I)},G.readAsDataURL(I)},ee=async()=>{if(!(!M||!r))try{N(!0);const P=await r(M);L(null),E(""),m.current&&(m.current.value="")}catch(P){console.error("Erro ao fazer upload:",P),alert("Erro ao fazer upload da imagem")}finally{N(!1)}},Y=()=>{L(null),E(""),m.current&&(m.current.value="")},O=async()=>{try{o&&await o(n),L(null),E(""),m.current&&(m.current.value="")}catch(P){console.error("Erro ao remover imagem:",P),alert("Erro ao remover imagem")}},W=()=>{var P;x||b||(P=m.current)==null||P.click()},X=y||n;return a.createElement("div",{className:i("flex flex-col space-y-2",s)},g&&a.createElement("label",{className:"text-sm font-medium text-gray-700"},g),a.createElement("div",{className:"relative flex flex-col items-center"},a.createElement("input",{ref:m,type:"file",accept:l,onChange:J,disabled:x||b,className:"hidden",...S}),a.createElement("div",{onClick:W,className:i("relative border-2 border-dashed border-gray-300 transition-colors cursor-pointer","hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",e?"rounded-full":"rounded-lg",H[v],x&&"opacity-50 cursor-not-allowed",b&&"cursor-wait",u&&"border-red-300",!B&&"bg-gray-50 hover:bg-gray-100",B&&"border-solid border-gray-200")},B?a.createElement("img",{src:X,alt:"Preview",className:i("w-full h-full object-cover",e?"rounded-full":"rounded-lg")}):a.createElement("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 text-sm"},e?a.createElement(a.Fragment,null,a.createElement("svg",{className:"w-8 h-8 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})),a.createElement("span",{className:"text-center px-2 text-xs"},T)):a.createElement(a.Fragment,null,a.createElement("svg",{className:"w-6 h-6 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})),a.createElement("span",{className:"text-center px-2"},T))),b&&a.createElement("div",{className:i("absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center",e?"rounded-full":"rounded-lg")},a.createElement("div",{className:"w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin"}))),B&&!b&&a.createElement("div",{className:"flex justify-center space-x-2 mt-3"},R?a.createElement(a.Fragment,null,a.createElement("button",{onClick:ee,disabled:!r,className:"px-3 py-1 bg-blue-600 text-white text-sm rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"},"Confirmar"),a.createElement("button",{onClick:Y,className:"px-3 py-1 bg-gray-600 text-white text-sm rounded hover:bg-gray-700"},"Cancelar")):a.createElement("button",{onClick:O,disabled:!o,className:"px-3 py-1 bg-red-600 text-white text-sm rounded hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"},"Remover"))),u&&a.createElement("p",{className:"text-sm text-red-600"},u),h&&!B&&a.createElement("p",{className:"text-xs text-gray-500"},"Tamanho máximo: ",(h/1024/1024).toFixed(1),"MB"),e&&!B&&a.createElement("p",{className:"text-xs text-gray-500 text-center"},"Use uma foto com seu rosto centralizado e bem visível"))},_e=a.createContext(null),Ze=()=>{const e=a.useContext(_e);if(!e)throw new Error("AccordionItem must be used within an Accordion");return e};let We=0;const Ee=({title:e,children:n,defaultOpen:r=!1,disabled:o=!1,className:l,headerClassName:h,contentClassName:d,icon:k})=>{const{openItems:v,toggleItem:g,variant:u}=Ze(),[x]=a.useState(()=>We++),s=v.has(x),S=a.useRef(null),[M,L]=a.useState(r?void 0:0);a.useEffect(()=>{if(s){const N=S.current;N&&L(N.scrollHeight)}else L(0)},[s]);const y=()=>{o||g(x)},C={default:{item:"border-b border-[var(--accordion-border,#e5e7eb)] last:border-b-0",header:"",content:""},bordered:{item:"border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-2",header:"border-b border-[var(--accordion-border,#e5e7eb)]",content:""},separated:{item:"border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-3 shadow-sm",header:"",content:""}}[u];return a.createElement("div",{className:i(C.item,l)},a.createElement("button",{type:"button",onClick:y,disabled:o,"aria-expanded":s,className:i("w-full flex items-center justify-between px-4 py-3 text-left transition-colors","bg-[var(--accordion-header-bg,transparent)]","hover:bg-[var(--accordion-header-hover,rgba(0,0,0,0.05))]","text-[var(--accordion-text,#111827)]","font-medium",o&&"opacity-50 cursor-not-allowed",s&&u!=="default"&&C.header,h)},a.createElement("span",{className:"flex items-center gap-2"},k&&a.createElement("span",{className:"flex-shrink-0"},k),e),a.createElement("svg",{className:i("w-5 h-5 transition-transform duration-200 flex-shrink-0","text-[var(--accordion-icon,#6b7280)]",s&&"rotate-180"),fill:"none",strokeWidth:"2",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{d:"M19 9l-7 7-7-7"}))),a.createElement("div",{style:{height:M,overflow:"hidden",transition:"height 0.3s ease-in-out"}},a.createElement("div",{ref:S,className:i("px-4 py-3","text-[var(--accordion-content-text,#374151)]","bg-[var(--accordion-content-bg,transparent)]",d)},n)))};Ee.displayName="AccordionItem";const ze=({children:e,type:n="single",className:r,variant:o="default",collapsible:l=!0})=>{const[h,d]=a.useState(new Set);a.useEffect(()=>{We=0;const v=a.Children.toArray(e),g=new Set;if(v.forEach((u,x)=>{a.isValidElement(u)&&u.props.defaultOpen&&g.add(x)}),n==="single"&&g.size>1){const u=Array.from(g)[0];d(new Set([u]))}else d(g)},[e,n]);const k=v=>{d(g=>{const u=new Set(g);return n==="single"?u.has(v)?l&&u.clear():(u.clear(),u.add(v)):u.has(v)?u.delete(v):u.add(v),u})};return a.createElement(_e.Provider,{value:{type:n,openItems:h,toggleItem:k,collapsible:l,variant:o}},a.createElement("div",{className:i("w-full",r)},e))};ze.Item=Ee;const fe=({open:e,onClose:n,size:r="md",closeOnOverlayClick:o=!0,closeOnEscape:l=!0,showCloseButton:h=!0,children:d,className:k="",...v})=>{const g=typeof document<"u"?document.body:null;a.useEffect(()=>{if(!e||!l)return;const s=S=>{S.key==="Escape"&&n()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,l,n]),a.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]);const u={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-full mx-4"};if(!g||!e)return null;const x=a.createElement("div",{className:i("fixed inset-0 z-50 flex items-center justify-center p-4",e?"pointer-events-auto":"pointer-events-none")},a.createElement("div",{className:i("absolute inset-0 bg-black/50 transition-opacity duration-200",e?"opacity-100":"opacity-0"),onClick:s=>{o&&s.target===s.currentTarget&&n()}}),a.createElement("div",{role:"dialog","aria-modal":!0,className:i("relative bg-white rounded-lg shadow-xl w-full transition-all duration-200",u[r],e?"scale-100 opacity-100":"scale-95 opacity-0",k),...v},h&&a.createElement("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Fechar modal"},a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),a.createElement("div",{className:"p-6"},d)));return me.createPortal(x,g)};fe.Header=function({children:n,className:r="",...o}){return a.createElement("div",{className:i("mb-4 pr-8",r),...o},n)};fe.Body=function({children:n,className:r="",...o}){return a.createElement("div",{className:i("mb-4",r),...o},n)};fe.Footer=function({children:n,className:r="",...o}){return a.createElement("div",{className:i("flex justify-end gap-2 mt-6 pt-4 border-t border-gray-200",r),...o},n)};const $e=a.createContext(null),et=({children:e,position:n="top-right",maxToasts:r=5})=>{const[o,l]=a.useState([]),h=a.useCallback(v=>{const g=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,u={...v,id:g};if(l(x=>[...x,u].slice(-r)),v.duration!==0){const x=v.duration||5e3;setTimeout(()=>{var s;d(g),(s=v.onClose)==null||s.call(v)},x)}return g},[r]),d=a.useCallback(v=>{l(g=>g.filter(u=>u.id!==v))},[]),k=a.useCallback(()=>{l([])},[]);return a.createElement($e.Provider,{value:{toasts:o,addToast:h,removeToast:d,clearAll:k}},e,a.createElement(rt,{toasts:o,position:n,onClose:d}))},Oe=()=>{const e=a.useContext($e);if(!e)throw new Error("useToaster must be used within ToasterProvider");return e},tt=()=>{const{addToast:e}=Oe();return{toast:(n,r)=>e({message:n,...r}),success:(n,r)=>e({message:n,variant:"success",duration:r}),error:(n,r)=>e({message:n,variant:"error",duration:r}),warning:(n,r)=>e({message:n,variant:"warning",duration:r}),info:(n,r)=>e({message:n,variant:"info",duration:r})}},rt=({toasts:e,position:n,onClose:r})=>{const o=typeof document<"u"?document.body:null;if(!o||e.length===0)return null;const l={"top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","top-right":"top-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end"},h=a.createElement("div",{className:i("fixed z-[100] flex flex-col gap-2 pointer-events-none",l[n]),style:{maxWidth:"calc(100vw - 2rem)"}},e.map(d=>a.createElement(at,{key:d.id,toast:d,onClose:r})));return me.createPortal(h,o)},at=({toast:e,onClose:n})=>{const[r,o]=a.useState(!1),l=()=>{o(!0),setTimeout(()=>{var v;n(e.id),(v=e.onClose)==null||v.call(e)},200)},h={success:"bg-green-50 text-green-800 border-green-200",error:"bg-red-50 text-red-800 border-red-200",warning:"bg-yellow-50 text-yellow-800 border-yellow-200",info:"bg-blue-50 text-blue-800 border-blue-200",default:"bg-white text-gray-800 border-gray-200"},d={success:a.createElement("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})),error:a.createElement("svg",{className:"w-5 h-5 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})),warning:a.createElement("svg",{className:"w-5 h-5 text-yellow-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})),info:a.createElement("svg",{className:"w-5 h-5 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})),default:a.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))},k=e.variant||"default";return a.createElement("div",{role:"alert",className:i("pointer-events-auto flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg min-w-[300px] max-w-[500px]","transition-all duration-200 ease-in-out",r?"opacity-0 scale-95 translate-x-4":"opacity-100 scale-100 translate-x-0",h[k])},a.createElement("div",{className:"flex-shrink-0 mt-0.5"},d[k]),a.createElement("p",{className:"flex-1 text-sm font-medium leading-relaxed"},e.message),a.createElement("button",{onClick:l,className:"flex-shrink-0 text-current opacity-60 hover:opacity-100 transition-opacity","aria-label":"Fechar notificação"},a.createElement("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))};exports.Accordion=ze;exports.AccordionItem=Ee;exports.AsideSheet=Ae;exports.AsyncSelect=Re;exports.Button=Ue;exports.Card=Ke;exports.CardBody=be;exports.CardFooter=ge;exports.CardHeader=pe;exports.ImageInput=Xe;exports.Input=Me;exports.Modal=fe;exports.MultiAsyncSelect=Be;exports.MultiSelect=Te;exports.RadioGroup=Ie;exports.Select=Le;exports.Table=Je;exports.TableBody=ve;exports.TableCell=ye;exports.TableFooter=xe;exports.TableHeader=he;exports.TableRow=we;exports.Textarea=Fe;exports.ToasterProvider=et;exports.Tooltip=Qe;exports.useToast=tt;exports.useToaster=Oe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),Z=require("react-hook-form"),me=require("react-dom");function je(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const t=je(a);function ke(e){var n,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(r=ke(e[n]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function De(){for(var e,n,r=0,o="",l=arguments.length;r<l;r++)(e=arguments[r])&&(n=ke(e))&&(o&&(o+=" "),o+=n);return o}function s(...e){return De(...e)}const Ue=({children:e,variant:n="default",className:r="",...o})=>{const l="px-4 py-2 rounded font-medium transition",g={default:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",outline:"border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"};return a.createElement("button",{className:s(l,g[n],r),...o},e)},Se=e=>e.replace(/\D/g,""),qe=e=>{const r=Se(e).slice(0,11);return r.length<=3?r:r.length<=6?`${r.slice(0,3)}.${r.slice(3)}`:r.length<=9?`${r.slice(0,3)}.${r.slice(3,6)}.${r.slice(6)}`:`${r.slice(0,3)}.${r.slice(3,6)}.${r.slice(6,9)}-${r.slice(9,11)}`},Ne=e=>{const n=Se(e);if(n.length!==11||/^(\d)\1{10}$/.test(n))return!1;let r=0;for(let l=0;l<9;l++)r+=parseInt(n.charAt(l))*(10-l);let o=r*10%11;if((o===10||o===11)&&(o=0),o!==parseInt(n.charAt(9)))return!1;r=0;for(let l=0;l<10;l++)r+=parseInt(n.charAt(l))*(11-l);return o=r*10%11,(o===10||o===11)&&(o=0),o===parseInt(n.charAt(10))},Me=t.forwardRef(({name:e,className:n,type:r="text",label:o,onFocus:l,onBlur:g,onChange:d,Icon:S,iconClassName:v,iconAction:h,containerClassName:u,cpf:x=!1,...i},L)=>{var P,I,G;const[M,C]=t.useState(!1),[w,E]=t.useState(!1),[N,k]=t.useState(null),m=Z.useFormContext(),F=m==null?void 0:m.control,R=m==null?void 0:m.register,T=F&&e?Z.useWatch({control:F,name:e}):void 0,b=i.value??T??"",H=((G=(I=(P=m==null?void 0:m.formState)==null?void 0:P.errors)==null?void 0:I[e])==null?void 0:G.message)||N,B=["date","datetime-local","time","month","week"].includes(r),J=M||!!b||B,ee=r==="password"?w?"text":"password":r,Y=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",fill:"currentColor"})),O=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",fill:"currentColor"})),W=()=>{E(!w)},X=z=>{if(x){const q=z.target.value,D=qe(q);z.target.value=D,D.length===14?Ne(D)?k(null):k("CPF inválido"):k(null)}d&&d(z)};return t.createElement("div",{className:s("relative",u)},t.createElement("input",{id:i.id||e,type:ee,className:s("peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",r==="password"||S?"pr-12":"",H?"border-red-500":"",n),onFocus:z=>{C(!0),l&&l(z)},maxLength:x?14:i.maxLength,inputMode:x?"numeric":i.inputMode,...m&&e?(()=>{const z=R(e,x?{validate:j=>j?j.length<14?"CPF incompleto":Ne(j)?!0:"CPF inválido":"CPF é obrigatório"}:void 0),q=z.onBlur,D=z.onChange;return{...z,ref:j=>{typeof L=="function"?L(j):L&&(L.current=j),z.ref&&z.ref(j)},onBlur:j=>{C(!1),g&&g(j),q&&q(j)},onChange:j=>{X(j),D&&D(j)}}})():{ref:L,onBlur:z=>{C(!1),g&&g(z)},onChange:X},...i}),o&&t.createElement("label",{htmlFor:i.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",J?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},o),r==="password"&&t.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:W,"aria-label":w?"Esconder senha":"Mostrar senha",tabIndex:-1},w?t.createElement(O,null):t.createElement(Y,null)),S&&r!=="password"&&t.createElement("div",{className:s("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",v),onClick:h},t.createElement(S,null)),H&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},H))});Me.displayName="Input";const Le=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,isClearable:g,searchable:d=!1,filterPlaceholder:S="Digite para filtrar...",caseSensitive:v=!1,filterFunction:h,onFocus:u,onBlur:x,...i},L)=>{var ae,oe,f,_;const[M,C]=t.useState(!1),[w,E]=t.useState(!1),[N,k]=t.useState(""),[m,F]=t.useState({top:0,left:0,width:0}),R=t.useRef(null),T=t.useRef(null),b=Z.useFormContext(),H=b==null?void 0:b.control,U=H&&e?Z.useWatch({control:H,name:e}):void 0,B=i.value??U??"",J=(f=(oe=(ae=b==null?void 0:b.formState)==null?void 0:ae.errors)==null?void 0:oe[e])==null?void 0:f.message,Y=h||((c,$)=>{const K=v?c.label:c.label.toLowerCase(),re=v?$:$.toLowerCase();return K.includes(re)}),O=N.trim()?r.filter(c=>Y(c,N.trim())):r,W=r.find(c=>c.value===B),X=d&&w?N:(W==null?void 0:W.label)||"",P=M||!!B||d&&!!N,I=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),G=t.useCallback(()=>{if(R.current&&w){const c=R.current.getBoundingClientRect(),$=I(),K=window.innerHeight,re=window.innerWidth,Q=152;let y=c.bottom+4,V=c.left;if($){const ne=K-c.bottom,p=c.top;ne<Q&&p>Q&&(y=c.top-Q-4);const A=16,te=re-c.width-A;V=Math.min(Math.max(V,A),te)}else K-c.bottom<Q&&(y=c.top-Q-4);F({top:y,left:V,width:c.width})}},[w,I]);t.useEffect(()=>{if(G(),w){const c=()=>G(),$=()=>G();return window.addEventListener("resize",c),window.addEventListener("scroll",$,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",$,!0)}}},[w,G]),t.useEffect(()=>{const c=$=>{R.current&&!R.current.contains($.target)&&(E(!1),C(!1))};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]);const z=()=>{E(c=>!c),C(!0)},q=c=>{C(!0),u&&u(c)},D=c=>{x&&x(c)},j=c=>{k(c.target.value)},le=c=>{if(b&&e&&b.setValue(e,c),i.onChange){const $={target:{value:c}};i.onChange($)}E(!1),C(!1),k("")};return t.createElement("div",{className:s("relative",l),ref:R},t.createElement("div",{id:i.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:s("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:d?void 0:z,onFocus:d?void 0:q,onBlur:d?void 0:D,ref:L},d?t.createElement("input",{ref:T,type:"text",value:X,onChange:j,onFocus:d?c=>{C(!0),E(!0),u&&u(c)}:void 0,onBlur:d?c=>{x&&x(c)}:void 0,placeholder:n?"":S||"Selecione...",className:s("w-full bg-transparent border-none outline-none text-sm",!B&&!N&&"text-gray-400")}):t.createElement("span",{className:s("block truncate",!B&&"text-gray-400")},((_=r.find(c=>c.value===B))==null?void 0:_.label)||!n&&"Selecione..."),g&&B&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:c=>{if(c.stopPropagation(),b&&e&&b.setValue(e,""),i.onChange){const $={target:{value:""}};i.onChange($)}E(!1),C(!1)}},"✕")),n&&t.createElement("label",{htmlFor:i.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",P?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:s("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",w?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:r.length>3?"auto":"hidden",position:"fixed",top:w?`${m.top}px`:"auto",left:w?`${m.left}px`:"auto",width:w?`${m.width}px`:"auto",zIndex:9999,boxShadow:w?"var(--select-dropdown-shadow)":"none"}},O.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):O.map(c=>t.createElement("div",{key:c.value,className:s("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",B===c.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>le(c.value)},c.label))),J&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});Le.displayName="Select";const Fe=t.forwardRef(({name:e,className:n,label:r,onFocus:o,onBlur:l,Icon:g,iconClassName:d,iconAction:S,containerClassName:v,rows:h=4,...u},x)=>{var F,R,T;const[i,L]=t.useState(!1),M=Z.useFormContext(),C=M==null?void 0:M.control,w=M==null?void 0:M.register,E=C&&e?Z.useWatch({control:C,name:e}):void 0,N=u.value??E??"",k=(T=(R=(F=M==null?void 0:M.formState)==null?void 0:F.errors)==null?void 0:R[e])==null?void 0:T.message,m=i||!!N;return t.createElement("div",{className:s("relative",v)},t.createElement("textarea",{id:u.id||e,rows:h,className:s("peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",g?"pr-12":"",n),onFocus:b=>{L(!0),o&&o(b)},...M&&e?(()=>{const b=w(e),H=b.onBlur;return{...b,ref:U=>{typeof x=="function"?x(U):x&&(x.current=U),b.ref&&b.ref(U)},onBlur:U=>{L(!1),l&&l(U),H&&H(U)}}})():{ref:x,onBlur:b=>{L(!1),l&&l(b)}},...u}),r&&t.createElement("label",{htmlFor:u.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",m?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),g&&t.createElement("div",{className:s("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",d),onClick:S},t.createElement(g,null)),k&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},k))});Fe.displayName="Textarea";const Re=t.forwardRef(({name:e,label:n,loadOptions:r,className:o,containerClassName:l,isClearable:g,defaultOptions:d=!1,loadingMessage:S="Carregando...",noOptionsMessage:v="Nenhuma opção encontrada",searchable:h=!1,debounceMs:u=300,onFocus:x,onBlur:i,...L},M)=>{var K,re,Q;const[C,w]=t.useState(!1),[E,N]=t.useState(!1),[k,m]=t.useState([]),[F,R]=t.useState(!1),[T,b]=t.useState(""),[H,U]=t.useState(""),[B,J]=t.useState({top:0,left:0,width:0}),ee=t.useRef(null),Y=t.useRef(null),O=Z.useFormContext(),W=O==null?void 0:O.control,X=W&&e?Z.useWatch({control:W,name:e}):void 0,P=L.value??X??"",I=(Q=(re=(K=O==null?void 0:O.formState)==null?void 0:K.errors)==null?void 0:re[e])==null?void 0:Q.message,G=C||!!P,z=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),q=t.useCallback(()=>{if(ee.current&&E){const y=ee.current.getBoundingClientRect(),V=z(),ne=window.innerHeight,p=window.innerWidth,A=152;let te=y.bottom+4,ie=y.left;if(V){const se=ne-y.bottom,de=y.top;se<A&&de>A&&(te=y.top-A-4);const ce=16,ue=p-y.width-ce;ie=Math.min(Math.max(ie,ce),ue)}else ne-y.bottom<A&&(te=y.top-A-4);J({top:te,left:ie,width:y.width})}},[E,z]);t.useEffect(()=>{if(q(),E){const y=()=>q(),V=()=>q();return window.addEventListener("resize",y),window.addEventListener("scroll",V,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",V,!0)}}},[E,q]),t.useEffect(()=>{const y=setTimeout(()=>{U(T)},u);return()=>clearTimeout(y)},[T,u]),t.useEffect(()=>{(E||d&&k.length===0)&&D(h?H:void 0)},[H,E]),t.useEffect(()=>{d===!0?D():Array.isArray(d)&&m(d)},[]);const D=async y=>{try{R(!0);const V=await r(y);m(V)}catch(V){console.error("Error loading options:",V),m([])}finally{R(!1)}};t.useEffect(()=>{const y=V=>{ee.current&&!ee.current.contains(V.target)&&(N(!1),w(!1),b(""))};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[]);const j=()=>{E||(N(!0),w(!0),h&&Y.current&&setTimeout(()=>{var y;return(y=Y.current)==null?void 0:y.focus()},0))},le=y=>{w(!0),x&&x(y)},ae=y=>{i&&i(y)},oe=y=>{b(y.target.value)},f=y=>{if(O&&e&&O.setValue(e,y),L.onChange){const V={target:{value:y}};L.onChange(V)}N(!1),w(!1),b("")},_=y=>{if(y.stopPropagation(),O&&e&&O.setValue(e,""),L.onChange){const V={target:{value:""}};L.onChange(V)}N(!1),w(!1),b("")},c=k.find(y=>y.value===P),$=h&&E?T:(c==null?void 0:c.label)||"";return t.createElement("div",{className:s("relative",l),ref:ee},t.createElement("div",{id:L.id||e,tabIndex:h?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":E,className:s("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:j,onFocus:h?void 0:le,onBlur:h?void 0:ae,ref:M},h?t.createElement("input",{ref:Y,type:"text",value:$,onChange:oe,onFocus:le,onBlur:ae,placeholder:n?"":"Selecione...",className:s("w-full bg-transparent border-none outline-none text-sm",!P&&!T&&"text-gray-400")}):t.createElement("span",{className:s("block truncate",!P&&"text-gray-400")},(c==null?void 0:c.label)||!n&&"Selecione..."),F&&t.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),g&&P&&!F&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:_},"✕")),n&&t.createElement("label",{htmlFor:L.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",G?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:s("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",E?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:E?"9.5rem":"0",overflowY:k.length>3?"auto":"hidden",position:"fixed",top:E?`${B.top}px`:"auto",left:E?`${B.left}px`:"auto",width:E?`${B.width}px`:"auto",zIndex:9999,boxShadow:E?"var(--select-dropdown-shadow)":"none"}},F?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},S):k.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):k.map(y=>t.createElement("div",{key:y.value,className:s("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",P===y.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>f(y.value)},y.label))),I&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},I))});Re.displayName="AsyncSelect";const Be=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,isClearable:g,searchable:d=!1,filterPlaceholder:S="Digite para filtrar...",caseSensitive:v=!1,filterFunction:h,onFocus:u,onBlur:x,...i},L)=>{var le,ae,oe;const[M,C]=t.useState(!1),[w,E]=t.useState(!1),[N,k]=t.useState(""),[m,F]=t.useState({top:0,left:0,width:0}),R=t.useRef(null),T=t.useRef(null),b=Z.useFormContext(),H=b==null?void 0:b.control,U=H&&e?Z.useWatch({control:H,name:e}):void 0,B=i.value??U??[],J=(oe=(ae=(le=b==null?void 0:b.formState)==null?void 0:le.errors)==null?void 0:ae[e])==null?void 0:oe.message,Y=h||((f,_)=>{const c=v?f.label:f.label.toLowerCase(),$=v?_:_.toLowerCase();return c.includes($)}),O=N.trim()?r.filter(f=>Y(f,N.trim())):r,W=M||B&&B.length>0||d&&!!N,X=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),P=t.useCallback(()=>{if(R.current&&w){const f=R.current.getBoundingClientRect(),_=X(),c=window.innerHeight,$=window.innerWidth,K=152;let re=f.bottom+4,Q=f.left;if(_){const y=c-f.bottom,V=f.top;y<K&&V>K&&(re=f.top-K-4);const ne=16,p=$-f.width-ne;Q=Math.min(Math.max(Q,ne),p)}else c-f.bottom<K&&(re=f.top-K-4);F({top:re,left:Q,width:f.width})}},[w,X]);t.useEffect(()=>{if(P(),w){const f=()=>P(),_=()=>P();return window.addEventListener("resize",f),window.addEventListener("scroll",_,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",_,!0)}}},[w,P]),t.useEffect(()=>{const f=_=>{R.current&&!R.current.contains(_.target)&&(E(!1),C(!1))};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[]);const I=()=>{E(f=>!f),C(!0)},G=f=>{C(!0),u&&u(f)},z=f=>{x&&x(f)},q=f=>{var c;let _;B.includes(f)?_=B.filter($=>$!==f):_=[...B,f],b&&e&&b.setValue(e,_),i.onChange&&((c=i.onChange)==null||c.call(i,{target:{value:_}})),C(!0)},D=f=>{var _;f.stopPropagation(),b&&e&&b.setValue(e,[]),i.onChange&&((_=i.onChange)==null||_.call(i,{target:{value:[]}})),E(!1),C(!1)},j=f=>{k(f.target.value)};return t.createElement("div",{className:s("relative",l),ref:R},t.createElement("div",{id:i.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:s("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:d?void 0:I,onFocus:d?void 0:G,onBlur:d?void 0:z,ref:L},t.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},B&&B.length>0?r.filter(f=>B.includes(f.value)).map(f=>t.createElement("span",{key:f.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",style:{maxWidth:"140px"}},t.createElement("span",{className:"truncate",title:f.label},f.label),t.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${f.label}`,tabIndex:-1,onClick:_=>{_.stopPropagation();const c=B.filter($=>$!==f.value);b&&e&&b.setValue(e,c),i.onChange&&i.onChange({target:{value:c}})}},t.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))):!n&&!d&&t.createElement("span",{className:"text-gray-400 text-sm"},"Selecione..."),d&&t.createElement("input",{ref:T,type:"text",value:N,onChange:j,onFocus:f=>{C(!0),E(!0),u&&u(f)},onBlur:f=>{x&&x(f)},placeholder:n?B&&B.length>0?"":S:S||"Selecione...",className:"flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"})),g&&B&&B.length>0&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:D},"✕")),n&&t.createElement("label",{htmlFor:i.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",W?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:s("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",w?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:r.length>3?"auto":"hidden",position:"fixed",top:w?`${m.top}px`:"auto",left:w?`${m.left}px`:"auto",width:w?`${m.width}px`:"auto",zIndex:9999,boxShadow:w?"var(--select-dropdown-shadow)":"none"}},O.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):O.map(f=>t.createElement("div",{key:f.value,className:s("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",B.includes(f.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>q(f.value)},t.createElement("input",{type:"checkbox",checked:B.includes(f.value),readOnly:!0,className:"accent-blue-500"}),f.label))),J&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});Be.displayName="MultiSelect";const Te=t.forwardRef(({name:e,label:n,loadOptions:r,className:o,containerClassName:l,isClearable:g,defaultOptions:d=!1,loadingMessage:S="Carregando...",noOptionsMessage:v="Nenhuma opção encontrada",searchable:h=!1,debounceMs:u=300,maxSelectedDisplay:x=3,onFocus:i,onBlur:L,...M},C)=>{var y,V,ne;const[w,E]=t.useState(!1),[N,k]=t.useState(!1),[m,F]=t.useState([]),[R,T]=t.useState(!1),[b,H]=t.useState(""),[U,B]=t.useState(""),[J,ee]=t.useState({top:0,left:0,width:0}),Y=t.useRef(null),O=t.useRef(null),W=Z.useFormContext(),X=W==null?void 0:W.control,P=X&&e?Z.useWatch({control:X,name:e}):void 0,I=M.value??P??[],G=(ne=(V=(y=W==null?void 0:W.formState)==null?void 0:y.errors)==null?void 0:V[e])==null?void 0:ne.message,z=w||I&&I.length>0,q=t.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),D=t.useCallback(()=>{if(Y.current&&N){const p=Y.current.getBoundingClientRect(),A=q(),te=window.innerHeight,ie=window.innerWidth,se=152;let de=p.bottom+4,ce=p.left;if(A){const ue=te-p.bottom,He=p.top;ue<se&&He>se&&(de=p.top-se-4);const Ce=16,Ve=ie-p.width-Ce;ce=Math.min(Math.max(ce,Ce),Ve)}else te-p.bottom<se&&(de=p.top-se-4);ee({top:de,left:ce,width:p.width})}},[N,q]);t.useEffect(()=>{if(D(),N){const p=()=>D(),A=()=>D();return window.addEventListener("resize",p),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",A,!0)}}},[N,D]),t.useEffect(()=>{const p=setTimeout(()=>{B(b)},u);return()=>clearTimeout(p)},[b,u]),t.useEffect(()=>{(N||d&&m.length===0)&&j(h?U:void 0)},[U,N]),t.useEffect(()=>{d===!0?j():Array.isArray(d)&&F(d)},[]);const j=async p=>{try{T(!0);const A=await r(p);F(A)}catch(A){console.error("Error loading options:",A),F([])}finally{T(!1)}};t.useEffect(()=>{const p=A=>{Y.current&&!Y.current.contains(A.target)&&(k(!1),E(!1),H(""))};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[]);const le=()=>{N||(k(!0),E(!0),h&&O.current&&setTimeout(()=>{var p;return(p=O.current)==null?void 0:p.focus()},0))},ae=p=>{E(!0),i&&i(p)},oe=p=>{L&&L(p)},f=p=>{H(p.target.value)},_=p=>{let A;I.includes(p)?A=I.filter(te=>te!==p):A=[...I,p],W&&e&&W.setValue(e,A),M.onChange&&M.onChange({target:{value:A}}),E(!0)},c=(p,A)=>{A.stopPropagation();const te=I.filter(ie=>ie!==p);W&&e&&W.setValue(e,te),M.onChange&&M.onChange({target:{value:te}})},$=p=>{p.stopPropagation(),W&&e&&W.setValue(e,[]),M.onChange&&M.onChange({target:{value:[]}}),k(!1),E(!1),H("")},K=m.filter(p=>I.includes(p.value)),re=K.slice(0,x),Q=K.length-x;return t.createElement("div",{className:s("relative",l),ref:Y},t.createElement("div",{id:M.id||e,tabIndex:h?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":N,className:s("peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:le,onFocus:h?void 0:ae,onBlur:h?void 0:oe,ref:C},t.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},re.map(p=>t.createElement("span",{key:p.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",style:{maxWidth:"140px"}},t.createElement("span",{className:"truncate",title:p.label},p.label),t.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${p.label}`,tabIndex:-1,onClick:A=>c(p.value,A)},t.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))),Q>0&&t.createElement("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs"},"+",Q," mais"),h?t.createElement("input",{ref:O,type:"text",value:b,onChange:f,onFocus:ae,onBlur:oe,placeholder:I.length===0&&!n?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):I.length===0&&!n&&t.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),R&&t.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),g&&I&&I.length>0&&!R&&t.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:$},"✕")),n&&t.createElement("label",{htmlFor:M.id||e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",z?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),t.createElement("div",{className:s("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",N?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:N?"9.5rem":"0",overflowY:m.length>3?"auto":"hidden",position:"fixed",top:N?`${J.top}px`:"auto",left:N?`${J.left}px`:"auto",width:N?`${J.width}px`:"auto",zIndex:9999,boxShadow:N?"var(--select-dropdown-shadow)":"none"}},R?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},S):m.length===0?t.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):m.map(p=>t.createElement("div",{key:p.value,className:s("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",I.includes(p.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>_(p.value)},t.createElement("input",{type:"checkbox",checked:I.includes(p.value),readOnly:!0,className:"accent-blue-500"}),p.label))),G&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},G))});Te.displayName="MultiAsyncSelect";const Ye={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},Ie=t.forwardRef(({name:e,label:n,options:r,className:o,containerClassName:l,optionClassName:g,direction:d="row",size:S="md",onFocus:v,onBlur:h,...u},x)=>{var N,k,m;const i=Z.useFormContext(),L=i==null?void 0:i.control,M=L&&e?Z.useWatch({control:L,name:e}):void 0,C=u.value??M??"",w=(m=(k=(N=i==null?void 0:i.formState)==null?void 0:N.errors)==null?void 0:k[e])==null?void 0:m.message,E=F=>{i&&e&&i.setValue(e,F),u.onChange&&u.onChange({target:{value:F}})};return t.createElement("div",{className:s("relative",l),ref:x},n&&t.createElement("label",{htmlFor:e,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm transition-all duration-200","top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white")},n),t.createElement("div",{className:s("flex gap-2 w-full pt-6",d==="row"?"flex-row":"flex-col",o),"aria-label":n,tabIndex:-1,onFocus:v,onBlur:h},r.map(F=>t.createElement("button",{key:F.value,type:"button",className:s("relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-hover,#dbeafe)]",Ye[S],C===F.value?"border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]":"border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",g),"aria-pressed":C===F.value,"data-selected":C===F.value,tabIndex:0,onClick:()=>E(F.value),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),E(F.value))}},F.icon&&t.createElement("span",{className:"mr-2 text-lg flex items-center"},F.icon),t.createElement("span",{className:"truncate font-medium"},F.label)))),w&&t.createElement("span",{className:"text-red-500 text-xs mt-1 block"},w))});Ie.displayName="RadioGroup";const pe=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:s("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4 border-b","bg-[var(--card-header-bg,rgba(249,250,251,0.5))]","border-[var(--card-header-border,#e5e7eb)]","text-[var(--card-text,#111827)]",n),...o},e));pe.displayName="CardHeader";const be=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:s("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",n),...o},e));be.displayName="CardBody";const ge=a.forwardRef(({children:e,className:n,as:r="div",...o},l)=>a.createElement(r,{ref:l,className:s("px-6 py-4 border-t","bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]","border-[var(--card-footer-border,#e5e7eb)]","text-[var(--card-text,#111827)]",n),...o},e));ge.displayName="CardFooter";const Ge=a.forwardRef(({children:e,className:n,variant:r="default",size:o="md",padding:l="none",rounded:g="lg",constrainWidth:d=!1,allowOverflow:S=!1,...v},h)=>{const u={default:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",outlined:"bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",elevated:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",flat:"bg-[var(--card-bg,#ffffff)] border-0"},x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},i={none:"",sm:"p-3",md:"p-4",lg:"p-6"},L={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return a.createElement("div",{ref:h,className:s("flex flex-col",!S&&"overflow-hidden",u[r],d&&x[o],i[l],L[g],n),...v},e)}),Ke=Object.assign(Ge,{Header:pe,Body:be,Footer:ge}),Pe=a.forwardRef(({children:e,className:n,variant:r="default",size:o="md",responsive:l=!1,stickyHeader:g=!1,...d},S)=>{const v=s("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":r==="bordered"},{"text-sm":o==="sm","text-base":o==="md","text-lg":o==="lg"},n),h=s({"overflow-x-auto":l,"max-h-96 overflow-y-auto":g}),u=a.createElement("table",{ref:S,className:v,...d},e);return l||g?a.createElement("div",{className:h},u):u}),ve=a.forwardRef(({children:e,className:n,as:r="thead",...o},l)=>a.createElement(r,{ref:l,className:s("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":r==="thead"},n),...o},e)),he=a.forwardRef(({children:e,className:n,as:r="tbody",...o},l)=>a.createElement(r,{ref:l,className:s("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",n),...o},e)),xe=a.forwardRef(({children:e,className:n,as:r="tfoot",...o},l)=>a.createElement(r,{ref:l,className:s("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",n),...o},e)),we=a.forwardRef(({children:e,className:n,variant:r="default",...o},l)=>a.createElement("tr",{ref:l,className:s("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":r==="hover","bg-[var(--table-row-selected)]":r==="selected"},n),...o},e)),ye=a.forwardRef(({children:e,className:n,as:r="td",align:o="left",scope:l,colSpan:g,rowSpan:d,...S},v)=>a.createElement(r,{ref:v,scope:r==="th"?l:void 0,colSpan:g,rowSpan:d,className:s("px-4 py-3 text-left",{"font-semibold":r==="th","text-sm":r==="td","text-center":o==="center","text-right":o==="right"},n),...S},e));Pe.displayName="Table";ve.displayName="TableHeader";he.displayName="TableBody";xe.displayName="TableFooter";we.displayName="TableRow";ye.displayName="TableCell";const Je=Object.assign(Pe,{Header:ve,Body:he,Footer:xe,Row:we,Cell:ye}),Qe=({content:e,children:n,position:r="top",className:o="",disabled:l=!1})=>{const[g,d]=a.useState(!1),[S,v]=a.useState(r),[h,u]=a.useState({}),x=a.useRef(null),i=a.useRef(null);a.useEffect(()=>{if(!g||!i.current)return;const m=i.current.getBoundingClientRect();let F=r,R=0,T=0;switch(r){case"top":R=m.top-8,T=m.left+m.width/2;break;case"bottom":R=m.bottom+8,T=m.left+m.width/2;break;case"left":R=m.top+m.height/2,T=m.left-8;break;case"right":R=m.top+m.height/2,T=m.right+8;break}if(x.current){const b=x.current.getBoundingClientRect(),H=window.innerWidth,U=window.innerHeight;r==="top"&&m.top<b.height+16?(F="bottom",R=m.bottom+8):r==="bottom"&&m.bottom+b.height+16>U?(F="top",R=m.top-8):r==="left"&&m.left<b.width+16?(F="right",T=m.right+8):r==="right"&&m.right+b.width+16>H&&(F="left",T=m.left-8)}v(F),u({position:"fixed",top:`${R}px`,left:`${T}px`,zIndex:9999})},[g,r]);const L=()=>{l||d(!0)},M=()=>{d(!1)},C=()=>{l||d(!0)},w=()=>{d(!1)},E=()=>{const k="pointer-events-none";switch(S){case"top":return`${k} transform -translate-x-1/2 -translate-y-full`;case"bottom":return`${k} transform -translate-x-1/2`;case"left":return`${k} transform -translate-x-full -translate-y-1/2`;case"right":return`${k} transform -translate-y-1/2`;default:return`${k} transform -translate-x-1/2 -translate-y-full`}},N=()=>{const k="absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";switch(S){case"top":return`${k} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;case"bottom":return`${k} bottom-full left-1/2 -translate-x-1/2 translate-y-1/2`;case"left":return`${k} left-full top-1/2 -translate-y-1/2 -translate-x-1/2`;case"right":return`${k} right-full top-1/2 -translate-y-1/2 translate-x-1/2`;default:return`${k} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`}};return l||!e?a.createElement(a.Fragment,null,n):a.createElement(a.Fragment,null,a.createElement("div",{className:"relative inline-block",ref:i,onMouseEnter:L,onMouseLeave:M,onFocus:C,onBlur:w},n),g&&typeof document<"u"&&me.createPortal(a.createElement("div",{ref:x,style:h,className:s(E(),"px-2 py-1 text-sm rounded whitespace-nowrap","bg-[var(--tooltip-bg,#374151)] text-[var(--tooltip-text,#fff)]","shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]","transition-opacity duration-200 ease-in-out",o),role:"tooltip","aria-hidden":!g},e,a.createElement("div",{className:N()})),document.body))},Ae=({open:e,onClose:n,side:r="right",size:o="md",closeOnOverlayClick:l=!0,children:g,className:d="",...S})=>{const v=typeof document<"u"?document.body:null,h=o==="sm"?"w-64":o==="md"?"w-96":o==="lg"?"w-[36rem]":void 0,u=typeof o=="string"&&!["sm","md","lg"].includes(o)?{width:o}:void 0,x=a.createElement("div",{"aria-hidden":!e,className:s("fixed inset-0 z-50 flex",e?"pointer-events-auto":"pointer-events-none")},a.createElement("div",{className:s("absolute inset-0 bg-black/40 transition-opacity duration-200",e?"opacity-100":"opacity-0"),onMouseDown:i=>{l&&i.target===i.currentTarget&&n()}}),a.createElement("div",{className:s("relative h-full",r==="right"?"ml-auto":"mr-auto","flex-shrink-0"),style:u},a.createElement("aside",{role:"dialog","aria-modal":!0,className:s("h-full bg-white shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",r==="right"?e?"translate-x-0":"translate-x-full":e?"translate-x-0":"-translate-x-full",h,d),style:u,...S},g)));return v?me.createPortal(x,v):null};Ae.displayName="AsideSheet";const Xe=({avatar:e=!1,value:n,onUpload:r,onRemove:o,accept:l="image/*",maxSize:g,placeholder:d="Selecionar imagem",loading:S=!1,size:v="md",label:h,error:u,disabled:x,className:i,...L})=>{const[M,C]=a.useState(null),[w,E]=a.useState(""),[N,k]=a.useState(!1),m=a.useRef(null),F=!!n,R=!!M,T=F||R,b=S||N,H={sm:e?"w-16 h-16":"w-24 h-16",md:e?"w-24 h-24":"w-32 h-24",lg:e?"w-32 h-32":"w-40 h-32"},B=d||(e?"Adicionar foto":"Selecionar imagem"),J=P=>{var z;const I=(z=P.target.files)==null?void 0:z[0];if(!I)return;if(g&&I.size>g){alert(`Arquivo muito grande. Tamanho máximo: ${(g/1024/1024).toFixed(1)}MB`);return}const G=new FileReader;G.onload=q=>{var D;E((D=q.target)==null?void 0:D.result),C(I)},G.readAsDataURL(I)},ee=async()=>{if(!(!M||!r))try{k(!0);const P=await r(M);C(null),E(""),m.current&&(m.current.value="")}catch(P){console.error("Erro ao fazer upload:",P),alert("Erro ao fazer upload da imagem")}finally{k(!1)}},Y=()=>{C(null),E(""),m.current&&(m.current.value="")},O=async()=>{try{o&&await o(n),C(null),E(""),m.current&&(m.current.value="")}catch(P){console.error("Erro ao remover imagem:",P),alert("Erro ao remover imagem")}},W=()=>{var P;x||b||(P=m.current)==null||P.click()},X=w||n;return a.createElement("div",{className:s("flex flex-col space-y-2",i)},h&&a.createElement("label",{className:"text-sm font-medium text-gray-700"},h),a.createElement("div",{className:"relative flex flex-col items-center"},a.createElement("input",{ref:m,type:"file",accept:l,onChange:J,disabled:x||b,className:"hidden",...L}),a.createElement("div",{onClick:W,className:s("relative border-2 border-dashed border-gray-300 transition-colors cursor-pointer","hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",e?"rounded-full":"rounded-lg",H[v],x&&"opacity-50 cursor-not-allowed",b&&"cursor-wait",u&&"border-red-300",!T&&"bg-gray-50 hover:bg-gray-100",T&&"border-solid border-gray-200")},T?a.createElement("img",{src:X,alt:"Preview",className:s("w-full h-full object-cover",e?"rounded-full":"rounded-lg")}):a.createElement("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 text-sm"},e?a.createElement(a.Fragment,null,a.createElement("svg",{className:"w-8 h-8 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})),a.createElement("span",{className:"text-center px-2 text-xs"},B)):a.createElement(a.Fragment,null,a.createElement("svg",{className:"w-6 h-6 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})),a.createElement("span",{className:"text-center px-2"},B))),b&&a.createElement("div",{className:s("absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center",e?"rounded-full":"rounded-lg")},a.createElement("div",{className:"w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin"}))),T&&!b&&a.createElement("div",{className:"flex justify-center space-x-2 mt-3"},R?a.createElement(a.Fragment,null,a.createElement("button",{onClick:ee,disabled:!r,className:"px-3 py-1 bg-blue-600 text-white text-sm rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"},"Confirmar"),a.createElement("button",{onClick:Y,className:"px-3 py-1 bg-gray-600 text-white text-sm rounded hover:bg-gray-700"},"Cancelar")):a.createElement("button",{onClick:O,disabled:!o,className:"px-3 py-1 bg-red-600 text-white text-sm rounded hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"},"Remover"))),u&&a.createElement("p",{className:"text-sm text-red-600"},u),g&&!T&&a.createElement("p",{className:"text-xs text-gray-500"},"Tamanho máximo: ",(g/1024/1024).toFixed(1),"MB"),e&&!T&&a.createElement("p",{className:"text-xs text-gray-500 text-center"},"Use uma foto com seu rosto centralizado e bem visível"))},_e=a.createContext(null),Ze=()=>{const e=a.useContext(_e);if(!e)throw new Error("AccordionItem must be used within an Accordion");return e};let We=0;const Ee=({title:e,children:n,defaultOpen:r=!1,disabled:o=!1,className:l,headerClassName:g,contentClassName:d,icon:S})=>{const{openItems:v,toggleItem:h,variant:u}=Ze(),[x]=a.useState(()=>We++),i=v.has(x),L=a.useRef(null),[M,C]=a.useState(r?void 0:0);a.useEffect(()=>{if(i){const k=L.current;k&&C(k.scrollHeight)}else C(0)},[i]);const w=()=>{o||h(x)},N={default:{item:"border-b border-[var(--accordion-border,#e5e7eb)] last:border-b-0",header:"",content:""},bordered:{item:"border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-2",header:"border-b border-[var(--accordion-border,#e5e7eb)]",content:""},separated:{item:"border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-3 shadow-sm",header:"",content:""}}[u];return a.createElement("div",{className:s(N.item,l)},a.createElement("button",{type:"button",onClick:w,disabled:o,"aria-expanded":i,className:s("w-full flex items-center justify-between px-4 py-3 text-left transition-colors","bg-[var(--accordion-header-bg,transparent)]","hover:bg-[var(--accordion-header-hover,rgba(0,0,0,0.05))]","text-[var(--accordion-text,#111827)]","font-medium",o&&"opacity-50 cursor-not-allowed",i&&u!=="default"&&N.header,g)},a.createElement("span",{className:"flex items-center gap-2"},S&&a.createElement("span",{className:"flex-shrink-0"},S),e),a.createElement("svg",{className:s("w-5 h-5 transition-transform duration-200 flex-shrink-0","text-[var(--accordion-icon,#6b7280)]",i&&"rotate-180"),fill:"none",strokeWidth:"2",stroke:"currentColor",viewBox:"0 0 24 24"},a.createElement("path",{d:"M19 9l-7 7-7-7"}))),a.createElement("div",{style:{height:M,overflow:"hidden",transition:"height 0.3s ease-in-out"}},a.createElement("div",{ref:L,className:s("px-4 py-3","text-[var(--accordion-content-text,#374151)]","bg-[var(--accordion-content-bg,transparent)]",d)},n)))};Ee.displayName="AccordionItem";const ze=({children:e,type:n="single",className:r,variant:o="default",collapsible:l=!0})=>{const[g,d]=a.useState(new Set);a.useEffect(()=>{We=0;const v=a.Children.toArray(e),h=new Set;if(v.forEach((u,x)=>{a.isValidElement(u)&&u.props.defaultOpen&&h.add(x)}),n==="single"&&h.size>1){const u=Array.from(h)[0];d(new Set([u]))}else d(h)},[e,n]);const S=v=>{d(h=>{const u=new Set(h);return n==="single"?u.has(v)?l&&u.clear():(u.clear(),u.add(v)):u.has(v)?u.delete(v):u.add(v),u})};return a.createElement(_e.Provider,{value:{type:n,openItems:g,toggleItem:S,collapsible:l,variant:o}},a.createElement("div",{className:s("w-full",r)},e))};ze.Item=Ee;const fe=({open:e,onClose:n,size:r="md",variant:o="default",closeOnOverlayClick:l=!0,closeOnEscape:g=!0,showCloseButton:d=!0,children:S,className:v="",...h})=>{const u=typeof document<"u"?document.body:null;a.useEffect(()=>{if(!e||!g)return;const C=w=>{w.key==="Escape"&&n()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,g,n]),a.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]);const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-full mx-4"},i={default:"bg-white text-gray-900",primary:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)]"},L={default:"text-gray-400 hover:text-gray-600",primary:"text-[var(--primary-text,#fff)] hover:opacity-80",secondary:"text-[var(--secondary-text,#222)] hover:opacity-80"};if(!u||!e)return null;const M=a.createElement("div",{className:s("fixed inset-0 z-50 flex items-center justify-center p-4",e?"pointer-events-auto":"pointer-events-none")},a.createElement("div",{className:s("absolute inset-0 bg-black/50 transition-opacity duration-200",e?"opacity-100":"opacity-0"),onClick:C=>{l&&C.target===C.currentTarget&&n()}}),a.createElement("div",{role:"dialog","aria-modal":!0,className:s("relative rounded-lg shadow-xl w-full transition-all duration-200",x[r],i[o],e?"scale-100 opacity-100":"scale-95 opacity-0",v),...h},d&&a.createElement("button",{onClick:n,className:s("absolute top-4 right-4 transition-colors",L[o]),"aria-label":"Fechar modal"},a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),a.createElement("div",{className:"p-6"},S)));return me.createPortal(M,u)};fe.Header=function({children:n,className:r="",...o}){return a.createElement("div",{className:s("mb-4 pr-8",r),...o},n)};fe.Body=function({children:n,className:r="",...o}){return a.createElement("div",{className:s("mb-4",r),...o},n)};fe.Footer=function({children:n,className:r="",...o}){return a.createElement("div",{className:s("flex justify-end gap-2 mt-6 pt-4 border-t border-gray-200",r),...o},n)};const $e=a.createContext(null),et=({children:e,position:n="top-right",maxToasts:r=5})=>{const[o,l]=a.useState([]),g=a.useCallback(v=>{const h=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,u={...v,id:h};if(l(x=>[...x,u].slice(-r)),v.duration!==0){const x=v.duration||5e3;setTimeout(()=>{var i;d(h),(i=v.onClose)==null||i.call(v)},x)}return h},[r]),d=a.useCallback(v=>{l(h=>h.filter(u=>u.id!==v))},[]),S=a.useCallback(()=>{l([])},[]);return a.createElement($e.Provider,{value:{toasts:o,addToast:g,removeToast:d,clearAll:S}},e,a.createElement(rt,{toasts:o,position:n,onClose:d}))},Oe=()=>{const e=a.useContext($e);if(!e)throw new Error("useToaster must be used within ToasterProvider");return e},tt=()=>{const{addToast:e}=Oe();return{toast:(n,r)=>e({message:n,...r}),success:(n,r)=>e({message:n,variant:"success",duration:r}),error:(n,r)=>e({message:n,variant:"error",duration:r}),warning:(n,r)=>e({message:n,variant:"warning",duration:r}),info:(n,r)=>e({message:n,variant:"info",duration:r})}},rt=({toasts:e,position:n,onClose:r})=>{const o=typeof document<"u"?document.body:null;if(!o||e.length===0)return null;const l={"top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","top-right":"top-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end"},g=a.createElement("div",{className:s("fixed z-[100] flex flex-col gap-2 pointer-events-none",l[n]),style:{maxWidth:"calc(100vw - 2rem)"}},e.map(d=>a.createElement(at,{key:d.id,toast:d,onClose:r})));return me.createPortal(g,o)},at=({toast:e,onClose:n})=>{const[r,o]=a.useState(!1),l=()=>{o(!0),setTimeout(()=>{var v;n(e.id),(v=e.onClose)==null||v.call(e)},200)},g={success:"bg-green-50 text-green-800 border-green-200",error:"bg-red-50 text-red-800 border-red-200",warning:"bg-yellow-50 text-yellow-800 border-yellow-200",info:"bg-blue-50 text-blue-800 border-blue-200",default:"bg-white text-gray-800 border-gray-200"},d={success:a.createElement("svg",{className:"w-5 h-5 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})),error:a.createElement("svg",{className:"w-5 h-5 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})),warning:a.createElement("svg",{className:"w-5 h-5 text-yellow-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})),info:a.createElement("svg",{className:"w-5 h-5 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})),default:a.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))},S=e.variant||"default";return a.createElement("div",{role:"alert",className:s("pointer-events-auto flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg min-w-[300px] max-w-[500px]","transition-all duration-200 ease-in-out",r?"opacity-0 scale-95 translate-x-4":"opacity-100 scale-100 translate-x-0",g[S])},a.createElement("div",{className:"flex-shrink-0 mt-0.5"},d[S]),a.createElement("p",{className:"flex-1 text-sm font-medium leading-relaxed"},e.message),a.createElement("button",{onClick:l,className:"flex-shrink-0 text-current opacity-60 hover:opacity-100 transition-opacity","aria-label":"Fechar notificação"},a.createElement("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))};exports.Accordion=ze;exports.AccordionItem=Ee;exports.AsideSheet=Ae;exports.AsyncSelect=Re;exports.Button=Ue;exports.Card=Ke;exports.CardBody=be;exports.CardFooter=ge;exports.CardHeader=pe;exports.ImageInput=Xe;exports.Input=Me;exports.Modal=fe;exports.MultiAsyncSelect=Te;exports.MultiSelect=Be;exports.RadioGroup=Ie;exports.Select=Le;exports.Table=Je;exports.TableBody=he;exports.TableCell=ye;exports.TableFooter=xe;exports.TableHeader=ve;exports.TableRow=we;exports.Textarea=Fe;exports.ToasterProvider=et;exports.Tooltip=Qe;exports.useToast=tt;exports.useToaster=Oe;
|