import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{a as n,i as r,r as i}from"./emotion-styled.browser.esm.DsRKNFfx.js";import{Xt as a}from"./utils.94RcZhG4.js";import{l as o}from"./protobuf.DC2L68b9.js";import{r as s}from"./StreamlitMarkdown.DJLoxxnS.js";import{t as c}from"./Tooltip.PNC8NIZa.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./styled-components.BwagcMZe.js";import{t as g}from"./WidgetLabelHelpIconInline.DB6cihzP.js";import{n as _}from"./useBasicWidgetState.CpWukz_T.js";var v=e(t(),1);function y({element:e,disabled:t,widgetMgr:y,fragmentId:w}){let[T,E]=_({getStateFromWidgetMgr:b,getDefaultStateFromProto:x,getCurrStateFromProto:S,updateWidgetMgrState:C,element:e,widgetMgr:y,fragmentId:w,formClearBehavior:`resetValueOnly`,queryParamBinding:e.queryParamKey?{paramKey:e.queryParamKey,valueType:`bool_value`,clearable:!1}:void 0}),D=(0,v.useCallback)(e=>{E({value:e,fromUi:!0})},[E]),O=e.type===o.StyleType.TOGGLE,k=n(u,{visibility:a(e.labelVisibility?.value),"data-testid":`stWidgetLabel`,children:[r(s,{source:e.label,allowHTML:!1,isLabel:!0}),e.help&&r(g,{content:e.help,placement:c.TOP_RIGHT,label:e.label})]});return O?r(h,{className:`row-widget stCheckbox`,"data-testid":`stCheckbox`,children:r(l,{isSelected:T,isDisabled:t,onChange:D,"aria-label":e.label,children:({isSelected:e,isHovered:t,isDisabled:a})=>n(i,{children:[r(m,{$isSelected:e,$isHovered:t,$isDisabled:a,children:r(f,{$isSelected:e,$isDisabled:a})}),k]})})}):r(h,{className:`row-widget stCheckbox`,"data-testid":`stCheckbox`,children:r(p,{isSelected:T,isDisabled:t,onChange:D,"aria-label":e.label,children:({isSelected:e,isFocusVisible:t,isDisabled:a})=>n(i,{children:[r(d,{$isSelected:e,$isFocusVisible:t,$isDisabled:a,children:e&&r(`svg`,{viewBox:`0 0 10 8`,"aria-hidden":`true`,children:r(`polyline`,{points:`1 4 4 7 9 1`})})}),k]})})})}function b(e,t){return e.getBoolValue(t)}function x(e){return e.default??!1}function S(e){return e.value??!1}function C(e,t,n,r){t.setBoolValue(e,n.value,{fromUi:n.fromUi},r)}var w=(0,v.memo)(y);export{w as default};