import{Flex as B,Modal as ne,ModalBody as re,ModalCloseButton as ie,ModalContent as le,ModalHeader as de,ModalOverlay as se,Text as b,useToast as ae}from"@chakra-ui/react";import{Flex as T,Spinner as Z,Text as I}from"@chakra-ui/react";import ee from"@emotion/styled";import"react";import{useEffect as y,useState as U}from"react";import h from"@emotion/styled";import{AddIcon as V,MinusIcon as Y}from"@chakra-ui/icons";import{Box as q,Button as N,Flex as J,Text as K}from"@chakra-ui/react";import R from"react";import{createMultiStyleConfigHelpers as $,defineStyle as _,FormControl as W,Input as E,InputGroup as O,Text as g}from"@chakra-ui/react";import{inputAnatomy as P}from"@chakra-ui/anatomy";import{jsx as x,jsxs as F}from"react/jsx-runtime";var z=R.forwardRef(({label:e,error:o,placeholder:d,helperText:t,isInvalid:n,as:r=E,InputLeftAddon:i,InputRightAddon:f,...a},m)=>{let{disabled:s}=a;return F(W,{isInvalid:n,opacity:s?.4:1,children:[e&&x(g,{color:n?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),F(O,{mt:"2",children:[i,x(r,{variant:"",placeholder:d,...a,ref:m}),f]}),t&&x(g,{fontSize:"xs",mt:2,color:"mutedForeground",children:t}),n&&o&&x(g,{fontSize:"xs",mt:2,color:"destructive",children:o})]})}),{definePartsStyle:M,defineMultiStyleConfig:H}=$(P.keys),j=M({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"}}}),A=_({borderRadius:"md"}),G={sm:M({field:A})},me=H({baseStyle:j,sizes:G});import{jsx as c,jsxs as C}from"react/jsx-runtime";var L=h(q)`
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  height: 40px;
  border-radius: 12px;
`,D=h(N)`
  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=h(z)`
  justify-content: center;
  font-size: 18px;
  min-width: 60px;
  user-select: none;
  border: none;
  box-shadow: none;
  max-width: 80px;
  text-align: center;
`,X=({initialState:e=1,maxState:o,onChange:d,value:t,onError:n})=>{let[r,i]=U(e);return y(()=>{d(r)},[r]),y(()=>{i(e)},[e]),y(()=>{o>0&&t>o||r<1?n(!0):n(!1)},[o,t,r]),C(J,{flexDirection:"column",alignItems:"flex-end",children:[C(L,{children:[c(D,{variant:"outline",onClick:()=>{t>e&&i(s=>t-1)},disabled:t===1,children:c(Y,{})}),c(Q,{value:t,onChange:s=>{let w=Number(s.target.value);i(w)}}),c(D,{variant:"outline",onClick:()=>{o?t<o&&i(s=>t+1):i(s=>t+1)},disabled:o===t||!o,children:c(V,{})})]}),(o>0&&t>o||r<1)&&C(K,{fontSize:12,mt:10,color:"#E11900",children:["Enter quantity between 1 to ",o]})]})},v=X;import{jsx as u,jsxs as S}from"react/jsx-runtime";var oe=ee(T)`
  position: relative;
`,te=({duration:e,setDuration:o,loading:d,subTotalPrice:t,payUsing:n})=>S(oe,{paddingY:4,flexDir:"column",alignItems:"center",children:[u(v,{initialState:1,maxState:1e4,onChange:o,onError:()=>{},value:e}),S(T,{w:"full",justifyContent:"space-between",alignItems:"center",children:[u(I,{fontSize:14,mt:4,fontWeight:"bold",children:`${e} year registration`}),S(T,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[d?u(Z,{size:"xs",mb:"1.5"}):u(I,{fontSize:14,fontWeight:"bold",children:`${t?.toFixed(5)}`}),u(I,{ml:"1",fontSize:14,fontWeight:"bold",children:n?.ticker})]})]})]}),k=te;import{jsx as l,jsxs as p}from"react/jsx-runtime";var ce=({selectedDomain:e,duration:o,selectDuration:d,onOpen:t,onClose:n,isOpen:r,loading:i,subTotalPrice:f,payUsing:a})=>{let m=ae();return p(B,{justifyContent:"space-between",children:[p(B,{alignItems:"center",children:[l(b,{fontSize:"12",mr:"1",children:"Duration:"}),l(b,{textDecoration:"underline",fontSize:"12",cursor:"pointer",onClick:()=>{if(!e)return m({title:"Select Domain",status:"warning"});t()},children:"Edit"})]}),l(b,{fontSize:"12",mr:"1",children:`${o} Year`}),p(ne,{blockScrollOnMount:!1,isOpen:r,onClose:n,isCentered:!0,children:[l(se,{}),p(le,{children:[l(de,{children:"Registration duration"}),l(ie,{}),p(re,{children:[l(b,{fontSize:"12",py:"2",px:"4",borderColor:"mutedForeground",borderWidth:"1px",borderStyle:"solid",borderRadius:"8",children:"Extending for multiple years will save money on network costs by avoiding yearly transactions."}),l(k,{duration:o,setDuration:d,loading:i,subTotalPrice:f,payUsing:a})]})]})]})]})},_e=ce;export{_e as default};
