var E=Object.create;var m=Object.defineProperty,G=Object.defineProperties,H=Object.getOwnPropertyDescriptor,V=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols,j=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var w=(e,o,n)=>o in e?m(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,k=(e,o)=>{for(var n in o||(o={}))C.call(o,n)&&w(e,n,o[n]);if(b)for(var n of b(o))_.call(o,n)&&w(e,n,o[n]);return e},z=(e,o)=>G(e,V(o));var F=(e,o)=>{var n={};for(var t in e)C.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&b)for(var t of b(e))o.indexOf(t)<0&&_.call(e,t)&&(n[t]=e[t]);return n};var q=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},T=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of W(o))!C.call(e,i)&&i!==n&&m(e,i,{get:()=>o[i],enumerable:!(t=H(o,i))||t.enumerable});return e};var B=(e,o,n)=>(n=e!=null?E(j(e)):{},T(o||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),N=e=>T(m({},"__esModule",{value:!0}),e);var X={};q(X,{default:()=>U});module.exports=N(X);var p=require("react"),h=B(require("@emotion/styled"),1),g=require("@chakra-ui/icons"),c=require("@chakra-ui/react");var R=B(require("react"),1),r=require("@chakra-ui/react"),$=require("@chakra-ui/anatomy");var d=require("react/jsx-runtime"),v=R.default.forwardRef((f,I)=>{var a=f,{label:e,error:o,placeholder:n,helperText:t,isInvalid:i,as:l=r.Input,InputLeftAddon:u,InputRightAddon:y}=a,x=F(a,["label","error","placeholder","helperText","isInvalid","as","InputLeftAddon","InputRightAddon"]);let{disabled:A}=x;return(0,d.jsxs)(r.FormControl,{isInvalid:i,opacity:A?.4:1,children:[e&&(0,d.jsx)(r.Text,{color:i?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),(0,d.jsxs)(r.InputGroup,{mt:"2",children:[u,(0,d.jsx)(l,z(k({variant:"",placeholder:n},x),{ref:I})),y]}),t&&(0,d.jsx)(r.Text,{fontSize:"xs",mt:2,color:"mutedForeground",children:t}),i&&o&&(0,d.jsx)(r.Text,{fontSize:"xs",mt:2,color:"destructive",children:o})]})}),{definePartsStyle:D,defineMultiStyleConfig:P}=(0,r.createMultiStyleConfigHelpers)($.inputAnatomy.keys),J=D({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"}}}),K=(0,r.defineStyle)({borderRadius:"md"}),L={sm:D({field:K})},ee=P({baseStyle:J,sizes:L});var s=require("react/jsx-runtime"),O=(0,h.default)(c.Box)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,M=(0,h.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};
    }
  }
`,Q=(0,h.default)(v)`
  justify-content: center;
  font-size: 18px;
  min-width: 60px;
  user-select: none;
  border: none;
  box-shadow: none;
  max-width: 80px;
  text-align: center;
`,S=({initialState:e=1,maxState:o,onChange:n,value:t,onError:i})=>{let[l,u]=(0,p.useState)(e);return(0,p.useEffect)(()=>{n(l)},[l]),(0,p.useEffect)(()=>{u(e)},[e]),(0,p.useEffect)(()=>{o>0&&t>o||l<1?i(!0):i(!1)},[o,t,l]),(0,s.jsxs)(c.Flex,{flexDirection:"column",alignItems:"flex-end",children:[(0,s.jsxs)(O,{children:[(0,s.jsx)(M,{variant:"outline",onClick:()=>{t>e&&u(f=>t-1)},disabled:t===1,children:(0,s.jsx)(g.MinusIcon,{})}),(0,s.jsx)(Q,{value:t,onChange:f=>{let a=Number(f.target.value);u(a)}}),(0,s.jsx)(M,{variant:"outline",onClick:()=>{o?t<o&&u(f=>t+1):u(f=>t+1)},disabled:o===t||!o,children:(0,s.jsx)(g.AddIcon,{})})]}),(o>0&&t>o||l<1)&&(0,s.jsxs)(c.Text,{fontSize:12,mt:10,color:"#E11900",children:["Enter quantity between 1 to ",o]})]})},U=S;
