import{flattenChildren as u,isValidElement as p}from"../../_util/props-util/index.mjs";function f(i){const{key:l,children:d,props:{value:e,disabled:r,...o}}=i,t=d?.default;return{key:l,value:e!==void 0?e:l,children:t,disabled:r||r==="",...o}}function _(i,l=!1){return u(i).map((e,r)=>{if(!p(e)||!e.type)return null;const{type:{isSelectOptGroup:o},key:t,children:n,props:a}=e;if(l||!o)return f(e);const c=n&&n.default?n.default():void 0,s=a?.label||n.label?.()||t;return{key:`__RC_SELECT_GRP__${t===null?r:String(t)}__`,...a,label:s,options:_(c||[])}}).filter(e=>e)}export{_ as convertChildrenToData};
