1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[664],{10664:(e,s,i)=>{"use strict";i.r(s),i.d(s,{default:()=>x});var a=i(95155),l=i(12115),t=i(24897),n=i(88909);i(14881);var c=i(65289),r=i(39030);i(6599);var o=i(84014),d=i(82276),h=i(88907),p=i(35263),u=i(10547);let x=e=>{var s;let{isCardClicked:i,setisCardClicked:x,coins:g,packageData:m,couponValue:f,setcouponValue:j,reducedCoins:v,setreducedCoins:N,buyPackage:w,discountValue:y,setdiscountValue:b}=e,[k,C]=(0,l.useState)(!1),[_,S]=(0,l.useState)(""),[M,A]=(0,l.useState)(null==m?void 0:m.price),[B,E]=(0,l.useState)(""),[P,D]=(0,l.useState)(""),T=(0,l.useRef)(!0),F=o.A.get("token"),I=(0,r.Ay)(c.A)(e=>{let{theme:s}=e;return{width:28,height:16,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:15},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(9px)"}},"& .MuiSwitch-switchBase":{padding:2,"&.Mui-checked":{transform:"translateX(12px)",color:"#fff","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#00A575"}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:12,height:12,borderRadius:6,transition:s.transitions.create(["width"],{duration:200})},"& .MuiSwitch-track":{backgroundColor:"#BFBFBF"},"& .Mui-checked + .MuiSwitch-track":{backgroundColor:"#00A575"}}}),R=async()=>{let e={coupon:f,current_price:M,subscription:null==m?void 0:m.id};try{let s=await (0,u.Bv)(F,e),i=await s.json();if(null==i?void 0:i.error){S(""),E(i&&(null==i?void 0:i.error)),D("");return}S(f),A(i.final_price),b(i&&i.coupon_discount),E(""),D("Coupon applied")}catch(e){console.log("error",e)}},X=async()=>{try{let e=await (0,u.hu)(F,{current_price:M,coins:g||0,subscription:null==m?void 0:m.id}),s=await e.json();if(null==s?void 0:s.error)return void E(s&&(null==s?void 0:s.error));A(e=>e-s.coin_used),N(s.coin_used)}catch(e){console.log(e)}};return(0,l.useEffect)(()=>{if(T.current){T.current=!1;return}k?X():(console.log("packageData?.price - reducedCoins",null==m?void 0:m.price,v),A((null==m?void 0:m.price)-y),N(0))},[k]),(0,l.useEffect)(()=>{b(0),D(""),S("")},[f]),(0,l.useEffect)(()=>{A((null==m?void 0:m.price)-y-v)},[null==m?void 0:m.price,y,v]),(0,a.jsx)(t.A,{open:i,onClose:()=>{x(!1)},className:"d-flex-full a-flex-jsc",children:(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"apply-coins-main-container d-flex-col gap-8",children:[(0,a.jsx)(h.default,{src:d.A,alt:"alt",width:150,height:50,className:"apply-coins-logo"}),(0,a.jsxs)("div",{className:"apply-coins-package-details-container",children:[(0,a.jsx)("center",{children:(0,a.jsx)("p",{className:"titles1",children:"Package Details"})}),(0,a.jsxs)("div",{className:"d-flex-col gap-8",children:[(0,a.jsxs)("p",{className:"titles",children:[(0,a.jsx)("span",{className:"highlight-text",children:"Plan Duration: "}),null==m?void 0:m.term_in_months," Months"]}),(0,a.jsxs)("p",{className:"titles plan-tier",children:[(0,a.jsx)("span",{className:"highlight-text",children:"Plan Tier : "}),null==m?void 0:m.subscription_tier]}),(0,a.jsx)("p",{className:"highlight-text",children:"Package Includes"}),(0,a.jsx)("div",{className:"d-flex-col",children:null==m||null==(s=m.categories)?void 0:s.map((e,s)=>(0,a.jsxs)("li",{className:"titles d-flex-al gap-8",children:[(0,a.jsx)(h.default,{src:p.A,width:16,height:16,alt:""}),"Mcq"===e.name?"MCQ":"Test_Series"===e.name?"Test Series":e.name]},s))})]})]}),(0,a.jsxs)("div",{className:"apply-coins-input-container d-flex-col gap-8",children:[(0,a.jsxs)("span",{className:"highlight-text",children:["Price of the package:"," ",(0,a.jsx)("strong",{className:"titles",children:M})]}),(0,a.jsxs)("span",{className:"highlight-text",children:["Total Coins you have :"," ",(0,a.jsx)("strong",{className:"titles",children:g?g-v:0})]})]}),(0,a.jsxs)("div",{className:"apply-coins-input-container d-flex-full swith-container",children:[(0,a.jsx)("span",{className:"highlight-text",children:"Apply Coins for Discount"}),(0,a.jsx)(n.A,{direction:"row",spacing:1,sx:{alignItems:"center"},children:(0,a.jsx)(I,{checked:k,inputProps:{"aria-label":"ant design"},onChange:()=>C(e=>!e)})}),k&&!B&&(0,a.jsx)("span",{className:"green-text",children:g>0&&v>0?"Coins applied":g>0&&0==v?"Coins can't apply for this pack":"You don't have coins"})]}),(0,a.jsxs)("div",{className:"apply-coins-input-container d-flex-col gap-8",children:[(0,a.jsx)("span",{className:"highlight-text",children:"Enter Coupon"}),(0,a.jsxs)("div",{className:"d-flex gap-8",children:[(0,a.jsx)("input",{type:"text",placeholder:"Enter coupon",onChange:e=>j(e.target.value)}),(0,a.jsx)("button",{disabled:!f.trim()||!!_&&_===f,className:"cursor-ptr apply-btn",onClick:()=>R(),children:"Apply"})]}),(0,a.jsx)("span",{className:"apply-coins-coupon-error",children:B}),!B&&(0,a.jsx)("span",{className:"coupon-applyed-text",children:P})]}),(0,a.jsx)("span",{className:"apply-coins-or-text",children:"or"}),(0,a.jsx)("button",{className:"cursor-ptr buy-btn",onClick:e=>w(e,null==m?void 0:m.subscription_tier,null==m?void 0:m.id,M),children:"Buy"})]})})})}},14881:()=>{},82276:(e,s,i)=>{"use strict";i.d(s,{A:()=>a});let a={src:"/_next/static/media/medsyLogo.1fabe393.svg",height:32,width:106,blurWidth:0,blurHeight:0}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.