1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5119],{9024:function(e,t,r){var n=r(5893);t.Z=e=>{let{title:t,className:r}=e;return(0,n.jsx)("h1",{className:"".concat(r," text-2xl text-secondary font-extrabold mb-3 "),children:t})}},3816:function(e,t,r){var n=r(5893);r(7294),t.Z=e=>{let{type:t,placeholder:r,value:s,onChange:l,className:i,...a}=e;return(0,n.jsx)("input",{type:t,placeholder:r,value:s,onChange:l,className:"w-full px-4 py-2 rounded-lg bg-white focus:border-primary focus:ring-2 focus:ring-primary focus:outline-none ".concat(i),...a})}},5906:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5893),s=r(7294),l=r(1163),i=r(2370),a=r(2286),o=r.n(a),c=r(623),d=r(2627);let u=()=>{let[e,t]=(0,s.useState)(null),[r,n]=(0,s.useState)(null),[l,a]=(0,s.useState)(!1),{setShowLoginModal:u}=(0,d.a)();return{signIn:async(e,r)=>{a(!0);try{let n=await (0,i.e5)(c.I8,e,r),s=await n.user.getIdToken();o().set(void 0,"token",s,{path:"/"}),t(n),u(!1)}catch(e){console.log("error",e),n(e),t(null)}finally{a(!1)}},result:e,error:r,loading:l}};var m=r(3816),p=r(223),x=r(1664),h=r.n(x),f=e=>{var t;let{device:r}=e,i=(0,l.useRouter)(),[a,o]=(0,s.useState)((null==i?void 0:null===(t=i.query)||void 0===t?void 0:t.email)||""),[c,d]=(0,s.useState)(""),{signIn:x,result:f,error:v,loading:b}=u();return(0,n.jsx)("div",{className:" flex items-center justify-center",children:(0,n.jsxs)("div",{className:"p-1 rounded-lg w-full max-w-md",children:[(0,n.jsx)("h2",{className:"text-2xl font-bold mb-6 text-center text-primary",children:"Login"}),(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),a&&c&&x(a,c)},className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium mb-2 ml-1",children:"Email"}),(0,n.jsx)(m.Z,{placeholder:"Email",type:"email",value:a,onChange:e=>o(e.target.value),className:"border border-mediumGray"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium mb-2 ml-1",children:" Password "}),(0,n.jsx)(m.Z,{placeholder:"Password",type:"password",value:c,onChange:e=>d(e.target.value),className:"border border-mediumGray"})]}),(0,n.jsx)("div",{children:(0,n.jsx)("button",{type:"submit",disabled:b,className:" w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white ".concat(b?"bg-mediumGray":"bg-primary hover:bg-primary/85 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary"),children:b?"Signing In...":"Sign In"})}),(0,n.jsx)(h(),{className:"w-full flex justify-center text-sm",href:"Apple"===r?"https://apps.apple.com/gb/app/muslamica/id6446053818":"https://play.google.com/store/apps/details?id=com.muslamica.muslamicaNew&pcampaignid=web_share",children:"Register"})," "]}),v&&(0,n.jsx)(p.Z,{className:"text-red mt-4 text-center",text:"Invalid email or password"})]})})}},8698:function(e,t,r){var n=r(5893);t.Z=e=>{let{isVisible:t,onClose:r,children:s}=e;return t?(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 p-10",children:(0,n.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-md w-full max-w-md relative",children:[(0,n.jsx)("button",{onClick:r,className:"absolute top-1 right-3 text-mediumGray text-3xl hover:text-primary",children:"\xd7"}),s]})}):null}},354:function(e,t,r){var n=r(5893);t.Z=()=>(0,n.jsx)("div",{className:"flex justify-center items-center",children:(0,n.jsx)("div",{className:"w-8 h-8 border-4 border-t-4 border-t-secondary border-primary rounded-full animate-spin"})})},1323:function(e,t,r){r.d(t,{Qb:function(){return s},Vy:function(){return n}});let n="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png",s={USD:{country:"United States",symbol:"$",currency:"USD"},GBP:{country:"United Kingdom",symbol:"\xa3",currency:"GBP"},AED:{country:"United Arab Emirates",symbol:"AED",currency:"AED"},EUR:{country:"Eurozone (Various Countries)",symbol:"â¬",currency:"EUR"}}},5119:function(e,t,r){r.r(t),r.d(t,{default:function(){return N}});var n=r(5893),s=r(7294),l=r(5675),i=r.n(l),a=r(1163),o=r(9024);let c=(0,r(2859).J)("pk_live_51P3SZyRriQXjYqzEDwrJ3XOA0MVBKjoDfwhsIzGSnph9Yz3JvfPAxktVJP0VLEAmkC5e95KGBwizkcOXzQQ3mQdh00eIKuhCA5");var d=()=>
1{let[e,t]=(0,s.useState)(!1);return{handlePurchase:async e=>{let{priceId:r,uid:n,customer_email:s,currency:l}=e;t(!0);try{let e=await fetch("/api/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({priceId:r,uid:n,customer_email:s,currency:l})});if(!e.ok)throw Error("Network response was not ok");let t=await e.json();if(!t.id)throw Error("Failed to create a session.");let i=await c,a=await i.redirectToCheckout({sessionId:t.id});a.error&&console.error(a.error.message)}catch(e){console.error("Error:",e)}finally{t(!1)}},loading:e}},u=r(223),m=e=>{let{onClose:t}=e;return(0,n.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50",children:(0,n.jsxs)("div",{className:"bg-white p-5 rounded shadow-lg text-center",children:[(0,n.jsx)(u.Z,{className:"text-xl font-bold mb-4",text:"Purchase Successful!"}),(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsx)("button",{onClick:t,className:"bg-primary text-white p-2 rounded",children:"Close"})})]})})},p=r(2627),x=r(8698),h=r(5906),f=r(1323),v=e=>{let{product:t,selectedProduct:r,handleOptionClick:s}=e,l=f.Qb[t.price.currency.toUpperCase()||"GBP"].symbol,i=t.name,a=t.price.unitAmount,o=t.price.unitAmount;return(0,n.jsxs)("div",{onClick:()=>s(t),className:"transition transform hover:scale-105 hover:shadow-xl p-10 border border-secondary/25 rounded cursor-pointer text-center flex items-center justify-center flex-col hover:border-secondary ".concat(r.price.unitAmount===o?"bg-primary":""),children:[(0,n.jsx)("span",{children:(0,n.jsx)(u.Z,{text:i,className:"font-bold text-lg ".concat(r.price.unitAmount===o?"text-white":"text-black")})}),(0,n.jsx)(u.Z,{text:"".concat(l).concat(a),className:"text-sm ".concat(r.price.unitAmount===o?"text-white":"text-mediumGray")})]},t.id)},b=r(2286),y=r.n(b),j=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],[r,n]=(0,s.useState)(t),[l,i]=(0,s.useState)(t[0]),[a,o]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=async e=>{o(!0);try{let t=await fetch("".concat("https://muslamica.app/","/api/getStripeProducts?currency=").concat(e)),r=await t.json();t.ok?(n(r.products),i(r.products[0])):console.error(r.error)}catch(e){console.error("Error fetching products:",e)}finally{o(!1)}};e&&(t(e),y().set(null,"currency",e,{path:"/"}))},[e]),{products:r,selectedProduct:l,setSelectedProduct:i,loading:a}},g=r(354);let w=["USD","EUR","GBP","AED"];var N=e=>{var t,r,l,c;let{products:u=[],device:b}=e,{user:y,showLoginModal:N,setShowLoginModal:S}=(0,p.a)(),[k,C]=(0,s.useState)(null),{products:E,selectedProduct:P,setSelectedProduct:A,loading:Z}=j(k,u),{handlePurchase:G,loading:I}=d(),[U,_]=(0,s.useState)(!1),D=(0,a.useRouter)(),O=null===(t=f.Qb[null==P?void 0:null===(r=P.price)||void 0===r?void 0:r.currency.toUpperCase()])||void 0===t?void 0:t.symbol,z=null===(l=f.Qb[null==P?void 0:null===(c=P.price)||void 0===c?void 0:c.currency.toUpperCase()])||void 0===l?void 0:l.currency;(0,s.useEffect)(()=>{let{session_id:e}=D.query;e&&_(!0)},[D.query]);let Q=e=>{A(e)},F=e=>{C(e.target.value)},L=()=>{var e,t;if(!y){S(!0);return}let r=null==P?void 0:null===(e=P.price)||void 0===e?void 0:e.priceId,n=null==P?void 0:null===(t=P.price)||void 0===t?void 0:t.currency,s=null==P?void 0:P.price.unitAmount;G({priceId:r,uid:y.uid,customer_email:y.email,currency:n,unitAmount:s})};return(0,n.jsxs)("div",{className:"min-h-full flex flex-col items-center p-10",children:[(0,n.jsx)(x.Z,{isVisible:N,onClose:()=>{S(!1)},children:(0,n.jsx)(h.Z,{device:b})}),(0,n.jsx)(o.Z,{title:"Purchase Coins"}),(0,n.jsxs)("div",{className:"w-full md:px-[5%] xl:px-[15%] mt-5",children:[(0,n.jsxs)("div",{className:"mb-10 p-5 mx-10 bg-lightGray flex items-center justify-between shadow-lg rounded-lg",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(i(),{src:(null==y?void 0:y.avi)||f.Vy,alt:"User Avatar",width:50,height:50,className:"rounded-full mr-4"}),y?(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"block text-mediumGray font-bold",children:y.username}),(0,n.jsxs)("span",{className:"text-secondary font-semibold",children:[y.coins," COINS"]})]}):(0,n.jsx)("button",{onClick:()=>S(!0),className:"block text-mediumGray font-bold",disabled:I||Z,children:"LOGIN"})]}),(0,n.jsxs)("div",{className:"md:flex hidden items-center justify-center",children:[Z?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("select",{disabled:Z,value:k||z,onChange:F,className:"mr-5 p-2 border rounded",children:w.map(e=>(0,n.jsx)("option",{value:e,children:e},e))}),(0,n.jsxs)("div",{className:"mr-5",children:[(0,n.jsxs)("span",{className:"text-lg font-bold",children:["Total: ",O,null==P?void 0:P.price.unitAmou
1nt]}),(0,n.jsxs)("span",{className:"text-xs text-secondary font-semibold flex flex-col mt-0.5",children:["+",(null==P?void 0:P.name)||0," COINS"]})]})]}),(0,n.jsx)("button",{onClick:L,className:"bg-primary text-white p-5 rounded hover:bg-primary/75",disabled:I||Z,children:I?"Processing...":"Purchase Now"})]})]}),Z?(0,n.jsx)("div",{className:"flex justify-center items-center",children:(0,n.jsx)(g.Z,{})}):(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 md:gap-8 mb-20",children:E.map(e=>(0,n.jsx)(v,{product:e,selectedProduct:P,handleOptionClick:Q},e.id))}),(0,n.jsxs)("div",{className:"md:hidden fixed bottom-0 left-0 right-0 bg-white p-5 shadow-lg flex justify-between items-center",children:[Z?(0,n.jsx)(g.Z,{}):(0,n.jsxs)("div",{className:"flex flex-row justify-between items-center flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("span",{className:"text-lg font-bold",children:["Total: ",O,null==P?void 0:P.price.unitAmount]}),(0,n.jsxs)("span",{className:"text-xs text-secondary font-semibold",children:["+",null==P?void 0:P.name," COINS"]})]}),(0,n.jsx)("select",{disabled:Z,value:k||z,onChange:F,className:"mr-3 p-1 border rounded",children:w.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]}),(0,n.jsx)("button",{onClick:L,className:"block bg-primary text-white p-3 rounded hover:bg-primary/75",disabled:I||Z,children:I?"Processing...":"Purchase Now"})]})]}),U?(0,n.jsx)(m,{onClose:()=>{_(!1),D.replace(D.pathname,void 0,{shallow:!0})}}):null]})}},223:function(e,t,r){var n=r(5893);t.Z=e=>{let{text:t,className:r}=e;return(0,n.jsx)("h1",{className:"text-md leading-7 text-black ".concat(r),children:t})}},2859:function(e,t,r){r.d(t,{J:function(){return h}});var n,s="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(s,'"]')),t=0;t<e.length;t++){var r=e[t];if(l.test(r.src))return r}return null},a=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(s).concat(t);var n=document.head||document.body;if(!n)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},o=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"4.0.0",startTime:t})},c=null,d=null,u=null,m=function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return o(n,r),n},p=!1,x=function(){return n||(n=(null!==c?c:(c=new Promise(function(e,t){if("undefined"==typeof window||"undefined"==typeof document){e(null);return}if(window.Stripe,window.Stripe){e(window.Stripe);return}try{var r,n=i();n?n&&null!==u&&null!==d&&(n.removeEventListener("load",u),n.removeEventListener("error",d),null===(r=n.parentNode)||void 0===r||r.removeChild(n),n=a(null)):n=a(null),u=function(){window.Stripe?e(window.Stripe):t(Error("Stripe.js not available"))},d=function(){t(Error("Failed to load Stripe.js"))},n.addEventListener("load",u),n.addEventListener("error",d)}catch(e){t(e);return}})).catch(function(e){return c=null,Promise.reject(e)})).catch(function(e){return n=null,Promise.reject(e)}))};Promise.resolve().then(function(){return x()}).catch(function(e){p||console.warn(e)});var h=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];p=!0;var n=Date.now();return x().then(function(e){return m(e,t,n)})}}}]);
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.