var E=Object.defineProperty,M=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var F=(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={}))z.call(o,n)&&F(e,n,o[n]);if(f)for(var n of f(o))S.call(o,n)&&F(e,n,o[n]);return e},B=(e,o)=>M(e,j(o));var R=(e,o)=>{var n={};for(var t in e)z.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&f)for(var t of f(e))o.indexOf(t)<0&&S.call(e,t)&&(n[t]=e[t]);return n};import{Flex as y,Spinner as ie,Text as h}from"@chakra-ui/react";import de from"@emotion/styled";import{useEffect as x,useState as P}from"react";import b from"@emotion/styled";import{AddIcon as Q,MinusIcon as X}from"@chakra-ui/icons";import{Box as Z,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 T}from"react/jsx-runtime";var _=A.forwardRef((s,w)=>{var u=s,{label:e,error:o,placeholder:n,helperText:t,isInvalid:r,as:i=q,InputLeftAddon:d,InputRightAddon:I}=u,m=R(u,["label","error","placeholder","helperText","isInvalid","as","InputLeftAddon","InputRightAddon"]);let{disabled:W}=m;return T(V,{isInvalid:r,opacity:W?.4:1,children:[e&&p(a,{color:r?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),T(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:$,defineMultiStyleConfig:J}=G(Y.keys),K=$({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:$({field:L})},ae=J({baseStyle:K,sizes:O});import{jsx as l,jsxs as g}from"react/jsx-runtime";var te=b(Z)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,v=b(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=b(_)`
  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]=P(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(v,{variant:"outline",onClick:()=>{t>e&&d(s=>t-1)},disabled:t===1,children:l(X,{})}),l(ne,{value:t,onChange:s=>{let u=Number(s.target.value);d(u)}}),l(v,{variant:"outline",onClick:()=>{o?t<o&&d(s=>t+1):d(s=>t+1)},disabled:o===t||!o,children:l(Q,{})})]}),(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(h,{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(h,{fontSize:14,fontWeight:"bold",children:`${t==null?void 0:t.toFixed(5)}`}),c(h,{ml:"1",fontSize:14,fontWeight:"bold",children:r==null?void 0:r.ticker})]})]})]}),Te=le;export{Te as default};
