import{j as s,a as e}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{F as n,a as r,i as a,p as c,c as i,b as o,d as l,e as t,k as d}from"./main.chunk.N-eZ2ybB.js";import{S as g,a as f,b as u,c as x,e as m,d as p}from"./select.chunk.BdL8rppi.js";const w=({icon:e})=>"string"==typeof e?s.jsx(d,{src:e,alt:__("Select icon","growfund"),className:"growfund-size-4 growfund-mr-2",fit:"contain"}):s.jsx("span",{className:"growfund-mr-2",children:e});function h({control:d,name:h,label:j,description:v,options:_,disabled:b=!1,className:N,placeholder:S=__("Select an option","growfund"),onChange:k}){return s.jsx(n,{control:d,name:h,render:({field:n,fieldState:d})=>s.jsxs(r,{className:"growfund-w-full growfund-space-y-2",children:[a(j)&&s.jsx(c,{className:"growfund-flex-shrink-0",children:j}),s.jsxs("div",{className:i("growfund-space-y-2",N),children:[s.jsx(o,{children:s.jsxs(g,{onValueChange:s=>{n.onChange(s),k?.(s)},value:n.value??"",disabled:b||0===_.length,children:[s.jsx(o,{children:s.jsx(f,{className:i(d.error&&"growfund-border-border-critical","[&_span]:growfund-flex [&_span]:growfund-items-center",N),children:s.jsx(u,{placeholder:S})})}),s.jsx(x,{children:_.map((n,r)=>n.has_separator_next?s.jsxs(e.Fragment,{children:[s.jsxs(m,{value:String(n.value),className:i("[&>span]:growfund-flex [&>span]:growfund-items-center [&_svg]:growfund-size-4 [&_svg]:growfund-text-icon-primary",n.is_critical&&"growfund-text-fg-critical [&_svg]:growfund-text-icon-critical"),children:[n.icon&&s.jsx(w,{icon:n.icon}),n.label]}),s.jsx(p,{})]},r):s.jsxs(m,{value:String(n.value),className:i("[&>span]:growfund-flex [&>span]:growfund-items-center [&_svg]:growfund-size-4 [&_svg]:growfund-text-icon-primary",n.is_critical&&"growfund-text-fg-critical [&_svg]:growfund-text-icon-critical"),children:[n.icon&&s.jsx(w,{icon:n.icon}),n.label]},r))})]})}),a(v)&&s.jsx(l,{children:v}),s.jsx(t,{})]})]})})}export{h as S};
