var T=Object.create;var m=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var D=(e,o)=>{for(var r in o)m(e,r,{get:o[r],enumerable:!0})},y=(e,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of R(o))!v.call(e,i)&&i!==r&&m(e,i,{get:()=>o[i],enumerable:!(n=B(o,i))||n.enumerable});return e};var I=(e,o,r)=>(r=e!=null?T($(e)):{},y(o||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),M=e=>y(m({},"__esModule",{value:!0}),e);var N={};D(N,{default:()=>q});module.exports=M(N);var f=require("react"),a=I(require("@emotion/styled"),1),b=require("@chakra-ui/icons"),c=require("@chakra-ui/react");var w=I(require("react"),1),t=require("@chakra-ui/react"),_=require("@chakra-ui/anatomy"),d=require("react/jsx-runtime"),k=w.default.forwardRef(({label:e,error:o,placeholder:r,helperText:n,isInvalid:i,as:l=t.Input,InputLeftAddon:u,InputRightAddon:g,...h},x)=>{let{disabled:p}=h;return(0,d.jsxs)(t.FormControl,{isInvalid:i,opacity:p?.4:1,children:[e&&(0,d.jsx)(t.Text,{color:i?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),(0,d.jsxs)(t.InputGroup,{mt:"2",children:[u,(0,d.jsx)(l,{variant:"",placeholder:r,...h,ref:x}),g]}),n&&(0,d.jsx)(t.Text,{fontSize:"xs",mt:2,color:"mutedForeground",children:n}),i&&o&&(0,d.jsx)(t.Text,{fontSize:"xs",mt:2,color:"destructive",children:o})]})}),{definePartsStyle:z,defineMultiStyleConfig:A}=(0,t.createMultiStyleConfigHelpers)(_.inputAnatomy.keys),E=z({field:{color:"foreground",background:"background",boxShadow:"base",borderWidth:"1px",borderStyle:"solid",borderColor:"input",borderRadius:"lg",_focusVisible:{borderColor:"ring"},_hover:{},_disabled:{opacity:1},_placeholder:{color:"mutedForeground"}}}),G=(0,t.defineStyle)({borderRadius:"md"}),H={sm:z({field:G})},J=A({baseStyle:E,sizes:H});var s=require("react/jsx-runtime"),V=(0,a.default)(c.Box)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,F=(0,a.default)(c.Button)`
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 32px;
  width: 32px;
  //border-radius: 12px;
  //border: none;
  //border: 1px solid ${e=>e.theme.colors.border};
  pointer-events: ${e=>e.disabled?"none":"unset"};
  opacity: ${e=>e.disabled?"0.5":"1"};

  &:active {
    border: 1px solid ${e=>e.theme.colors.foreground};
  }

  svg {
    path {
      fill: ${e=>e.theme.colors.foreground};
    }
  }
`,W=(0,a.default)(k)`
  justify-content: center;
  font-size: 18px;
  min-width: 60px;
  user-select: none;
  border: none;
  box-shadow: none;
  max-width: 80px;
  text-align: center;
`,j=({initialState:e=1,maxState:o,onChange:r,value:n,onError:i})=>{let[l,u]=(0,f.useState)(e);return(0,f.useEffect)(()=>{r(l)},[l]),(0,f.useEffect)(()=>{u(e)},[e]),(0,f.useEffect)(()=>{o>0&&n>o||l<1?i(!0):i(!1)},[o,n,l]),(0,s.jsxs)(c.Flex,{flexDirection:"column",alignItems:"flex-end",children:[(0,s.jsxs)(V,{children:[(0,s.jsx)(F,{variant:"outline",onClick:()=>{n>e&&u(p=>n-1)},disabled:n===1,children:(0,s.jsx)(b.MinusIcon,{})}),(0,s.jsx)(W,{value:n,onChange:p=>{let C=Number(p.target.value);u(C)}}),(0,s.jsx)(F,{variant:"outline",onClick:()=>{o?n<o&&u(p=>n+1):u(p=>n+1)},disabled:o===n||!o,children:(0,s.jsx)(b.AddIcon,{})})]}),(o>0&&n>o||l<1)&&(0,s.jsxs)(c.Text,{fontSize:12,mt:10,color:"#E11900",children:["Enter quantity between 1 to ",o]})]})},q=j;
