import{c as O,r as i,j as n,n as z,P as _,k as G,i as M,f as N,Z as K,g as U,b as w}from"./index-BOOC9B8a.js";import{a as X}from"./index-B5GDSPpp.js";import{C as Z}from"./textarea-B_fuluJO.js";const re=O("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);var g="Checkbox",[V]=U(g),[$,I]=V(g);function J(t){const{__scopeCheckbox:s,checked:r,children:l,defaultChecked:a,disabled:e,form:p,name:h,onCheckedChange:d,required:k,value:m="on",internal_do_not_use_render:u}=t,[f,v]=G({prop:r,defaultProp:a??!1,onChange:d,caller:g}),[C,x]=i.useState(null),[y,o]=i.useState(null),c=i.useRef(!1),E=C?!!p||!!C.closest("form"):!0,R={checked:f,disabled:e,setChecked:v,control:C,setControl:x,name:h,form:p,value:m,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:b(a)?!1:a,isFormControl:E,bubbleInput:y,setBubbleInput:o};return n.jsx($,{scope:s,...R,children:Q(u)?u(R):l})}var S="CheckboxTrigger",B=i.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:r,...l},a)=>{const{control:e,value:p,disabled:h,checked:d,required:k,setControl:m,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:v,bubbleInput:C}=I(S,t),x=M(a,m),y=i.useRef(d);return i.useEffect(()=>{const o=e?.form;if(o){const c=()=>u(y.current);return o.addEventListener("reset",c),()=>o.removeEventListener("reset",c)}},[e,u]),n.jsx(_.button,{type:"button",role:"checkbox","aria-checked":b(d)?"mixed":d,"aria-required":k,"data-state":D(d),"data-disabled":h?"":void 0,disabled:h,value:p,...l,ref:x,onKeyDown:N(s,o=>{o.key==="Enter"&&o.preventDefault()}),onClick:N(r,o=>{u(c=>b(c)?!0:!c),C&&v&&(f.current=o.isPropagationStopped(),f.current||o.stopPropagation())})})});B.displayName=S;var P=i.forwardRef((t,s)=>{const{__scopeCheckbox:r,name:l,checked:a,defaultChecked:e,required:p,disabled:h,value:d,onCheckedChange:k,form:m,...u}=t;return n.jsx(J,{__scopeCheckbox:r,checked:a,defaultChecked:e,disabled:h,required:p,onCheckedChange:k,name:l,form:m,value:d,internal_do_not_use_render:({isFormControl:f})=>n.jsxs(n.Fragment,{children:[n.jsx(B,{...u,ref:s,__scopeCheckbox:r}),f&&n.jsx(L,{__scopeCheckbox:r})]})})});P.displayName=g;var q="CheckboxIndicator",T=i.forwardRef((t,s)=>{const{__scopeCheckbox:r,forceMount:l,...a}=t,e=I(q,r);return n.jsx(z,{present:l||b(e.checked)||e.checked===!0,children:n.jsx(_.span,{"data-state":D(e.checked),"data-disabled":e.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...t.style}})})});T.displayName=q;var A="CheckboxBubbleInput",L=i.forwardRef(({__scopeCheckbox:t,...s},r)=>{const{control:l,hasConsumerStoppedPropagationRef:a,checked:e,defaultChecked:p,required:h,disabled:d,name:k,value:m,form:u,bubbleInput:f,setBubbleInput:v}=I(A,t),C=M(r,v),x=X(e),y=K(l);i.useEffect(()=>{const c=f;if(!c)return;const E=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(E,"checked").set,F=!a.current;if(x!==e&&j){const H=new Event("click",{bubbles:F});c.indeterminate=b(e),j.call(c,b(e)?!1:e),c.dispatchEvent(H)}},[f,x,e,a]);const o=i.useRef(b(e)?!1:e);return n.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:p??o.current,required:h,disabled:d,name:k,value:m,form:u,...s,tabIndex:-1,ref:C,style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});L.displayName=A;function Q(t){return typeof t=="function"}function b(t){return t==="indeterminate"}function D(t){return b(t)?"indeterminate":t?"checked":"unchecked"}const W=i.forwardRef(({className:t,...s},r)=>n.jsx(P,{ref:r,className:w("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),...s,children:n.jsx(T,{className:w("flex items-center justify-center text-current"),children:n.jsx(Z,{className:"h-4 w-4"})})}));W.displayName=P.displayName;export{re as B,W as C};
