'use client';
import{jsxs as o,jsx as t}from"react/jsx-runtime";import e from"../dropdown-option/VariantOption.js";import i from"../dropdown-option/DropdownOption.js";import{getSelectClass as n}from"../../common/dropdown/classes.js";import{createClass as r,createStyle as a,createAttr as p,If as m}from"@gem-sdk/system";import{getSelectStyle as s}from"../../common/dropdown/styles.js";import{getSelectAttr as d}from"../../common/dropdown/attrs.js";import{useDropdownSwatches as l}from"./hooks/useDropdownSwatches.js";let c=c=>{let{option:h,optionPosition:u,optionNumber:w,variantGroup:f,variants:g,price:j,blankText:v,optionTypography:b,optionTransform:x,initValue:k,hasPreSelected:y,optionTypo:C,combineHeight:N,combineWidth:S,soldOutStyle:D}=c,{optionBgColor:O,optionTextColor:P,optionRounded:A,optionShadow:B,optionHasShadow:R,optionBorder:V}=c,{value:H,preset:M,handleOnChangeSelect:T,checkVariantInStock:q}=l(c),z="disable"===D;f||(O=M?.optionBgColor,P=M?.optionTextColor,V=M?.optionBorder,R=M?.optionHasShadow,B=M?.optionShadow,A=M?.optionRounded);let E=r(n({optionTypo:C,optionTypography:b,optionBgColor:O,optionBorder:V,optionTextColor:P})),F=a(s({width:f?S:M?.width,height:f?N:M?.height,optionTypo:C,optionTypography:b,optionBgColor:O,optionTextColor:P,optionRounded:A,optionShadow:B,optionHasShadow:R,optionBorder:V,optionTransform:x,isCombine:f,textAlign:C?.attrs?.textAlign})),G=p(d({optionName:h?.name,value:H??k,type:"React"}));return o("select",{...G,className:E,style:F,onChange:o=>T(o),children:[m(!y,t("option",{value:"blank",children:v??"Please select an option"})," "),m(f,g?.map(o=>t(e,{disabled:!q(o)&&z,value:o?.id,variant:o,includePrice:j},o?.id)),h?.values?.map(o=>t(i,{value:o,optionName:h.name,optionPosition:u,optionNumber:w,isSoldOutMark:z},o?.id)))]})};export{c as default};
