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