import{Flex as k,Modal as ne,ModalBody as re,ModalCloseButton as ie,ModalContent as le,ModalHeader as se,ModalOverlay as de,Text as x,useToast as ae}from"@chakra-ui/react";import{Flex as S,Spinner as Z,Text as I}from"@chakra-ui/react";import ee from"@emotion/styled";import{useEffect as y,useState as G}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 B from"react";import{createMultiStyleConfigHelpers as P,defineStyle as $,FormControl as _,Input as W,InputGroup as E,Text as g}from"@chakra-ui/react";import{inputAnatomy as O}from"@chakra-ui/anatomy";import{jsx as b,jsxs as w}from"react/jsx-runtime";var z=B.forwardRef(({label:e,error:o,placeholder:s,helperText:t,isInvalid:n,as:r=W,InputLeftAddon:i,InputRightAddon:f,...a},m)=>{let{disabled:d}=a;return w(_,{isInvalid:n,opacity:d?.4:1,children:[e&&b(g,{color:n?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:e}),w(E,{mt:"2",children:[i,b(r,{variant:"",placeholder:s,...a,ref:m}),f]}),t&&b(g,{fontSize:"xs",mt:2,color:"mutedForeground",children:t}),n&&o&&b(g,{fontSize:"xs",mt:2,color:"destructive",children:o})]})}),{definePartsStyle:D,defineMultiStyleConfig:H}=P(O.keys),U=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"}}}),j=$({borderRadius:"md"}),A={sm:D({field:j})},me=H({baseStyle:U,sizes:A});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;
`,M=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:s,value:t,onError:n})=>{let[r,i]=G(e);return y(()=>{s(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(M,{variant:"outline",onClick:()=>{t>e&&i(d=>t-1)},disabled:t===1,children:c(Y,{})}),c(Q,{value:t,onChange:d=>{let F=Number(d.target.value);i(F)}}),c(M,{variant:"outline",onClick:()=>{o?t<o&&i(d=>t+1):i(d=>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 T}from"react/jsx-runtime";var oe=ee(S)`
  position: relative;
`,te=({duration:e,setDuration:o,loading:s,subTotalPrice:t,payUsing:n})=>T(oe,{paddingY:4,flexDir:"column",alignItems:"center",children:[u(v,{initialState:1,maxState:1e4,onChange:o,onError:()=>{},value:e}),T(S,{w:"full",justifyContent:"space-between",alignItems:"center",children:[u(I,{fontSize:14,mt:4,fontWeight:"bold",children:`${e} year registration`}),T(S,{alignItems:"flex-end",justifyContent:"center",mt:4,children:[s?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})]})]})]}),R=te;import{jsx as l,jsxs as p}from"react/jsx-runtime";var ce=({selectedDomain:e,duration:o,selectDuration:s,onOpen:t,onClose:n,isOpen:r,loading:i,subTotalPrice:f,payUsing:a})=>{let m=ae();return p(k,{justifyContent:"space-between",children:[p(k,{alignItems:"center",children:[l(x,{fontSize:"12",mr:"1",children:"Duration:"}),l(x,{textDecoration:"underline",fontSize:"12",cursor:"pointer",onClick:()=>{if(!e)return m({title:"Select Domain",status:"warning"});t()},children:"Edit"})]}),l(x,{fontSize:"12",mr:"1",children:`${o} Year`}),p(ne,{blockScrollOnMount:!1,isOpen:r,onClose:n,isCentered:!0,children:[l(de,{}),p(le,{children:[l(se,{children:"Registration duration"}),l(ie,{}),p(re,{children:[l(x,{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(R,{duration:o,setDuration:s,loading:i,subTotalPrice:f,payUsing:a})]})]})]})]})},Be=ce;export{Be as default};
