import{r as a,j as n,Q as _,w as H,x as S,y as I,D as P,E as z,F as G,I as K,N as U,V as X}from"./index-E6IUtMcU.js";const Q=a.forwardRef(({className:t,...o},r)=>n.jsx("textarea",{className:_("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...o}));Q.displayName="Textarea";var y="Checkbox",[V,ee]=H(y),[$,N]=V(y);function J(t){const{__scopeCheckbox:o,checked:r,children:l,defaultChecked:c,disabled:e,form:p,name:b,onCheckedChange:d,required:x,value:k="on",internal_do_not_use_render:u}=t,[f,v]=U({prop:r,defaultProp:c??!1,onChange:d,caller:y}),[m,C]=a.useState(null),[g,s]=a.useState(null),i=a.useRef(!1),E=m?!!p||!!m.closest("form"):!0,R={checked:f,disabled:e,setChecked:v,control:m,setControl:C,name:b,form:p,value:k,hasConsumerStoppedPropagationRef:i,required:x,defaultChecked:h(c)?!1:c,isFormControl:E,bubbleInput:g,setBubbleInput:s};return n.jsx($,{scope:o,...R,children:W(u)?u(R):l})}var T="CheckboxTrigger",B=a.forwardRef(({__scopeCheckbox:t,onKeyDown:o,onClick:r,...l},c)=>{const{control:e,value:p,disabled:b,checked:d,required:x,setControl:k,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:v,bubbleInput:m}=N(T,t),C=S(c,k),g=a.useRef(d);return a.useEffect(()=>{const s=e==null?void 0:e.form;if(s){const i=()=>u(g.current);return s.addEventListener("reset",i),()=>s.removeEventListener("reset",i)}},[e,u]),n.jsx(I.button,{type:"button",role:"checkbox","aria-checked":h(d)?"mixed":d,"aria-required":x,"data-state":F(d),"data-disabled":b?"":void 0,disabled:b,value:p,...l,ref:C,onKeyDown:P(o,s=>{s.key==="Enter"&&s.preventDefault()}),onClick:P(r,s=>{u(i=>h(i)?!0:!i),m&&v&&(f.current=s.isPropagationStopped(),f.current||s.stopPropagation())})})});B.displayName=T;var j=a.forwardRef((t,o)=>{const{__scopeCheckbox:r,name:l,checked:c,defaultChecked:e,required:p,disabled:b,value:d,onCheckedChange:x,form:k,...u}=t;return n.jsx(J,{__scopeCheckbox:r,checked:c,defaultChecked:e,disabled:b,required:p,onCheckedChange:x,name:l,form:k,value:d,internal_do_not_use_render:({isFormControl:f})=>n.jsxs(n.Fragment,{children:[n.jsx(B,{...u,ref:o,__scopeCheckbox:r}),f&&n.jsx(D,{__scopeCheckbox:r})]})})});j.displayName=y;var M="CheckboxIndicator",q=a.forwardRef((t,o)=>{const{__scopeCheckbox:r,forceMount:l,...c}=t,e=N(M,r);return n.jsx(z,{present:l||h(e.checked)||e.checked===!0,children:n.jsx(I.span,{"data-state":F(e.checked),"data-disabled":e.disabled?"":void 0,...c,ref:o,style:{pointerEvents:"none",...t.style}})})});q.displayName=M;var A="CheckboxBubbleInput",D=a.forwardRef(({__scopeCheckbox:t,...o},r)=>{const{control:l,hasConsumerStoppedPropagationRef:c,checked:e,defaultChecked:p,required:b,disabled:d,name:x,value:k,form:u,bubbleInput:f,setBubbleInput:v}=N(A,t),m=S(r,v),C=G(e),g=K(l);a.useEffect(()=>{const i=f;if(!i)return;const E=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(E,"checked").set,L=!c.current;if(C!==e&&w){const O=new Event("click",{bubbles:L});i.indeterminate=h(e),w.call(i,h(e)?!1:e),i.dispatchEvent(O)}},[f,C,e,c]);const s=a.useRef(h(e)?!1:e);return n.jsx(I.input,{type:"checkbox","aria-hidden":!0,defaultChecked:p??s.current,required:b,disabled:d,name:x,value:k,form:u,...o,tabIndex:-1,ref:m,style:{...o.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});D.displayName=A;function W(t){return typeof t=="function"}function h(t){return t==="indeterminate"}function F(t){return h(t)?"indeterminate":t?"checked":"unchecked"}const Y=a.forwardRef(({className:t,...o},r)=>n.jsx(j,{ref:r,className:_("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...o,children:n.jsx(q,{className:_("flex items-center justify-center text-current"),children:n.jsx(X,{className:"h-4 w-4"})})}));Y.displayName=j.displayName;export{Y as C,Q as T};