PageSourceSearch

https://app.blackbox.ai/_next/static/chunks/8438.a68bb8cd3a371e7b.js

js blackbox.ai collected 2026-09-24 08:41:57 UTC 53,640 bytes, 21 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8438],{27808:function(e,t,r){r.d(t,{Z:function(){return n}});var a=r(40292);/**
2 * @license lucide-react v0.300.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */let n=(0,a.Z)("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},47291:function(e,t,r){r.d(t,{Z:function(){return n}});var a=r(40292);/**
7 * @license lucide-react v0.300.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */let n=(0,a.Z)("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},52848:function(e,t,r){r.d(t,{Z:function(){return n}});var a=r(40292);/**
12 * @license lucide-react v0.300.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */let n=(0,a.Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},8112:function(e,t,r){r.d(t,{Z:function(){return n}});var a=r(40292);/**
17 * @license lucide-react v0.300.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */let n=(0,a.Z)("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]])},78657:function(e,t,r){r.d(t,{Jh:function(){return n},UH:function(){return i}}),r(44714),r(46432);var a=r(82579);(0,a.$)("6a4692febce44803745e9c610910f4c2adc27b7a"),(0,a.$)("f77ac2eaa5d4ee6078c5a6d8d807a25e928fa25f"),(0,a.$)("d7483d55ade8ba7083a8e77a48f9b151a9a24ac5"),(0,a.$)("90b25f3738210a899588b41101b2b0233ce98973"),(0,a.$)("1e77e745c766a7dc36d2f08de61e848b4a3fff30"),(0,a.$)("8329845f074770b25dd98cdeadd8c768b888be4a"),(0,a.$)("4e692a831daec6ab27c040746023f3aea5dc4539"),(0,a.$)("2bfe05129dea4fe8293f8039399fb816cf9c3f00"),(0,a.$)("d6073cb0fb4407342d6a705ff8aa90c8e6cc25ff");var n=(0,a.$)("196e3ec4331c2074be951a3fdcfacf314a8dd93f");(0,a.$)("39e12171ab0af2502320eba814e2ec636d3ba45b"),(0,a.$)("e092e92b688100d9fd7120f8ea688a2a28048939"),(0,a.$)("1d865a892d64c5c5387ec3b696b4870b1959fcf7"),(0,a.$)("c85f5bf68f142067014430f92faa075b55989fd8"),(0,a.$)("2a41ac32a3a1d304d955c6ab657fa07cab443714"),(0,a.$)("bcb042165e5a9f9a6ee930a72467ab2040783c9c");var i=(0,a.$)("eddeab4c84b11e0ed0a1a5dc62c270c83e94ade1");(0,a.$)("ff21ba1fe140197bb3a60527077db32f762103e6"),(0,a.$)("318fedd2ddd087262c2a26e09ba44d435372964e"),(0,a.$)("01f321cbe525923e99357e123bb5d8836b447572"),(0,a.$)("6321f73d5a554b19179294812f89a2367b81433c")},98438:function(e,t,r){r.r(t),r.d(t,{default:function(){return Checkout}});var a=r(19745),n=r(80833),i=r(66280),s=r(51384),o=r(51268),l=r(45994),c=r(10185),d=r(47291),u=r(27808),m=r(8112),p=r(5217),f=r(35786),x=r(10181),g=r(20288),h=r(23117),b=r(8849),y=r(86747);r(13475);var v=r(47034),N=r(3524),j=r(44432),S=r(20457),w=r(56831),P=r(65249),k=r(55225),C=r(32880),A=r(78657),I=r(15856),E=r(3531),T=r(49269),D=r(78034),U=r(38216),O=r(61038);let R=null,L=[{url:"https://ipapi.co/json/",parser:e=>e.country_code||e.country,timeout:3e3},{url:"https://api.country.is/",parser:e=>e.country,timeout:3e3},{url:"https://ipinfo.io/json",parser:e=>e.country,timeout:3e3},{url:"https://api.ipgeolocation.io/ipgeo?apiKey=free",parser:e=>e.country_code2,timeout:3e3},{url:"https://freegeoip.app/json/",parser:e=>e.country_code,timeout:3e3}];async function getUserCountry(){let e=(0,O.TA)();if(e)return console.log("Using cached country data:",e.country),e.country;if(R)return console.log("Using in-memory cached location:",R.country),R.country;try{let e=await tryGeolocationServices();if(e)return e;let t=await tryBrowserDetection();if(t)return t;let r=await tryServerHeaders();if(r)return r;return console.warn("All geolocation methods failed, defaulting to US"),R={country:"US",currency:"USD"},(0,O.Pi)("US","USD"),"US"}catch(e){return console.error("Geolocation detection failed:",e),R={country:"US",currency:"USD"},(0,O.Pi)("US","USD"),"US"}}async function tryGeolocationServices(){for(let e of(console.log("Trying geolocation services..."),L))try{console.log("Trying service: ".concat(e.url));let t=new AbortController,r=setTimeout(()=>t.abort(),e.timeout),a=await fetch(e.url,{signal:t.signal,headers:{Accept:"application/json","User-Agent":"Mozilla/5.0 (compatible; BLACKBOXAI/1.0)"},mode:"cors"});if(clearTimeout(r),a.ok){let t=await a.json(),r=e.parser(t);if(r&&"string"==typeof r){let t=r.toUpperCase(),a=D.kk[t]||"USD";return console.log("Successfully detected country: ".concat(t," via ").concat(e.url)),R={country:t,currency:a},(0,O.Pi)(t,a),t}}}catch(t){console.warn("Service ".concat(e.url," failed:"),t);continue}return null}async function tryBrowserDetection(){console.log("Trying browser-based detection...");try{var e;let t=Intl.DateTimeFormat().resolvedOptions().timeZone,r=getCountryFromTimezone(t);if(r){console.log("Country detected from timezone: ".concat(r));let e=D.kk[r]||"USD";return R={country:r,currency:e},(0,O.Pi)(r,e),r}let a=window.navigator.language,n=null===(e=a.split("-")[1])||void 0===e?void 0:e.toUpperCase();if(n&&D.kk[n]){console.log("Country detected from locale: ".concat(n));let e=D.kk[n];return R={country:n,currency:e},(0,O.Pi)(n,e),n}}catch(e){console.warn("Browser detection failed:",e)}return null}async function tryServerHeaders(){try{let e=await fetch("/api/geo-headers",{method:"GET",headers:{Accept:"application/json"}});if(e.ok){let t=await e.json();if(t.country){let e=t.country.toUpperCase(),r=D.kk[e]||"USD";return console.log("Country detected from server headers: ".concat(e)),R={country:e,currency:r},(0,O.Pi)(e,r),e}}}catch(e){console.log("Server headers not available")}return null}
21function getCountryFromTimezone(e){let t={"America/New_York":"US","America/Chicago":"US","America/Denver":"US","America/Los_Angeles":"US","America/Phoenix":"US","America/Anchorage":"US","America/Toronto":"CA","America/Vancouver":"CA","America/Montreal":"CA","America/Mexico_City":"MX","Europe/London":"GB","Europe/Dublin":"IE","Europe/Paris":"FR","Europe/Berlin":"DE","Europe/Rome":"IT","Europe/Madrid":"ES","Europe/Amsterdam":"NL","Europe/Brussels":"BE","Europe/Vienna":"AT","Europe/Zurich":"CH","Europe/Stockholm":"SE","Europe/Oslo":"NO","Europe/Copenhagen":"DK","Europe/Helsinki":"FI","Europe/Warsaw":"PL","Europe/Prague":"CZ","Europe/Budapest":"HU","Europe/Bucharest":"RO","Europe/Sofia":"BG","Europe/Athens":"GR","Europe/Istanbul":"TR","Europe/Moscow":"RU","Europe/Kiev":"UA","Asia/Tokyo":"JP","Asia/Shanghai":"CN","Asia/Hong_Kong":"HK","Asia/Singapore":"SG","Asia/Seoul":"KR","Asia/Taipei":"TW","Asia/Bangkok":"TH","Asia/Jakarta":"ID","Asia/Manila":"PH","Asia/Kuala_Lumpur":"MY","Asia/Ho_Chi_Minh":"VN","Asia/Kolkata":"IN","Asia/Mumbai":"IN","Asia/Dubai":"AE","Asia/Riyadh":"SA","Asia/Tehran":"IR","Asia/Baghdad":"IQ","Asia/Jerusalem":"IL","Australia/Sydney":"AU","Australia/Melbourne":"AU","Australia/Brisbane":"AU","Australia/Perth":"AU","Australia/Adelaide":"AU","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","America/Buenos_Aires":"AR","America/Santiago":"CL","America/Lima":"PE","America/Bogota":"CO","America/Caracas":"VE","Africa/Cairo":"EG","Africa/Lagos":"NG","Africa/Johannesburg":"ZA","Africa/Nairobi":"KE","Africa/Casablanca":"MA"};if(t[e])return t[e];for(let[r,a]of Object.entries(t))if(e.includes(r.split("/")[1]))return a;return null}async function getUserCurrency(){try{let e=(0,O.TA)();if(e)return e.currency;let t=await getUserCountry(),r=D.kk[t]||"USD";return R||(R={country:t,currency:r}),r}catch(e){return console.warn("Error getting user currency, defaulting to USD:",e),"USD"}}async function getLocalizedPricing(){try{let e=await getUserCurrency(),t=D.Z[e];if(!t||!t.pro||!t.business||!t.unlimited||!t.ultimate)return console.warn("Invalid pricing data for currency:",e,"using default USD"),(0,D.ri)();return console.log("Using pricing for currency: ".concat(e)),t}catch(e){return console.warn("Error getting localized pricing, using default USD:",e),(0,D.ri)()}}var B=r(61250),M=r(28070);let _=(0,N.J)(M.env.NEXT_PUBLIC_STRIPE_PUBLISH_KEY||"pk_live_51GtzANBxEiMqIgSoGSA52MLoUm7u6mM6MOxWuK87gqmP3at6dM2XNtladQsQ5sJJH59lCBx8ONex8TOGWwrjlOOp00XFxXuKFR"),z=M.env.NEXT_PUBLIC_PAYMENT_SERVER||"https://payment.blackbox.ai",F=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function getPriceIdForPlan(e,t,r){let a=e?({PRO:"ultra","PRO PLUS":"ultra","PRO MAX":"ultimate",UNLIMITED:"business"})[e.toUpperCase()]:void 0;return(0,C.A)({source:r,billing:t?"yearly":"monthly",plan:a})}function StripePaymentForm(e){let{clientSecret:t,onSuccess:r,userEmail:i,isSetupIntent:s=!1,setupIntentId:o,customerId:l,priceId:c,billingCycle:d,isProcessing:u,setIsProcessing:m,source:p,planName:f,onCustomerIdCreated:x,appliedCoupon:g,submitButtonRef:h,logEvent:b}=e,y=(0,j.MD)(),v=(0,j.lq)(),[N,S]=(0,n.useState)(null),w=n.useRef(null),handleSubmit=async e=>{if(e&&e.preventDefault(),!y||!v){S("Payment system not ready. Please wait a moment and try again."),m(!1);return}if(!i||!F.test(i.trim())){S("Please enter a valid email before completing payment."),m(!1);return}m(!0),S(null);try{if(s){let{error:e,setupIntent:t}=await y.confirmSetup({elements:v,redirect:"if_required",confirmParams:{payment_method_data:{billing_details:{email:i.trim()}}}});if(e){console.error("❌ SetupIntent confirmation failed:",e),S(e.message||"An error occurred"),m(!1);return}if(t&&"succeeded"===t.status){let e=t.id||o;if(!e){S("Missing subscription data. Please try again."),m(!1);return}let a="annually"===d,n=getPriceIdForPlan(f,a,"pricing-dialog"),getDocumentCookie=e=>{if("undefined"==typeof document)return;let t="; ".concat(document.cookie),r=t.split("; ".concat(e,"="));if(2===r.length){var a;return null===(a=r.pop())||void 0===a?void 0:a.split(";").shift()}},s=getDocumentCookie("partner_key_valid"),c=getDocumentCookie("affiliate-code"),u=f&&({PRO:"pro","PRO PLUS":"ultra","PRO MAX":"ultimate",UNLIMITED:"business"})[f.toUpperCase()]||"pro",h=await fetch("/api/create-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({setupIntentId:e,customerId:l||null,priceId:n,billing:"annually"===d?"yearly":"monthly",plan:u,partnerKey:s,affiliateCode:c,source:p,email:i.trim(),couponCode:(null==g?void 0:g.couponId)||(null==g?void 0:g.promotionCodeId)||null})}),b=await h.json();if(!h.ok){S(b.error||"Failed to create subscription"),m(!1);return}if(b.customerId&&!l&&x&&x(b.customerId),b.requiresAction&&b.clientSecret){let{error:e}=await y.confirmCardPayment(b.clientSecret);
21if(e){S(e.message||"Authentication failed"),m(!1);return}}await r()}}else{let{error:e}=await y.confirmPayment({elements:v,confirmParams:{return_url:"".concat(window.location.origin,"/?newPayment=true&newUpgrade=true"),payment_method_data:{billing_details:{email:i.trim()}}}});e?(S(e.message||"An error occurred"),m(!1)):await r()}}catch(e){S(e.message||"An unexpected error occurred"),m(!1)}};return n.useEffect(()=>(h&&(h.current=()=>{handleSubmit()}),()=>{h&&(h.current=null)}),[y,v,i,s,d,f,l,p,g]),(0,a.jsxs)("form",{ref:w,onSubmit:handleSubmit,className:"space-y-4","data-stripe-form":!0,children:[(0,a.jsx)(j.Hn,{options:{layout:"tabs",paymentMethodOrder:["card"],wallets:{applePay:"never",googlePay:"never"},fields:{billingDetails:{name:"auto",email:i?"never":"auto",phone:"auto",address:{country:"auto",postalCode:"auto"}}},terms:{card:"never"}}}),N&&(0,a.jsx)("div",{className:"p-3 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded-lg",children:(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:N})})]})}function getPSCookie(e){if("undefined"==typeof document)return;let t="; ".concat(document.cookie),r=t.split("; ".concat(e,"="));if(2===r.length){var a;return null===(a=r.pop())||void 0===a?void 0:a.split(";").shift()}}function CheckoutContent(){var e,t,N,C;let R,L,M;let{isOpen:G,source:K,plan:H,initialBillingCycle:$,closeDialog:Z}=(0,f.t)(),{isGuestCheckout:V,guestEmail:J,setGuestEmail:Y,setPendingSubscriptionData:q}=(0,x.w)(),{data:X,status:W}=(0,S.kP)(),{theme:Q,resolvedTheme:ee}=(0,i.F)(),[et,er]=(0,n.useState)(!1),[ea,en]=(0,n.useState)($||"monthly"),[ei,es]=(0,n.useState)(""),[eo,el]=(0,n.use
21State)(""),[ec,ed]=(0,n.useState)(!0),[eu,em]=(0,n.useState)(""),[ep,ef]=(0,n.useState)(!1),[ex,eg]=(0,n.useState)(null),[eh,eb]=(0,n.useState)(!1),[ey,ev]=(0,n.useState)(!1),[eN,ej]=(0,n.useState)(!1),[eS,ew]=(0,n.useState)(null),[eP,ek]=(0,n.useState)(null),[eC,eA]=(0,n.useState)(null),[eI,eE]=(0,n.useState)(null),[eT,eD]=(0,n.useState)([]),[eU,eO]=(0,n.useState)(!0),[eR,eL]=(0,n.useState)(!1),[eB,eM]=(0,n.useState)(!1),[e_,ez]=(0,n.useState)(!1),[eF,eG]=(0,n.useState)(!1),[eK,eH]=(0,n.useState)(!1),[e$,eZ]=(0,n.useState)(null),[eV,eJ]=(0,n.useState)(null),[eY,eq]=(0,n.useState)(!0),[eX,eW]=(0,n.useState)(""),[eQ,e0]=(0,n.useState)(null),[e1,e2]=(0,n.useState)(null),[e4,e3]=(0,n.useState)(!1),[e5,e8]=(0,n.useState)(!1),e7=n.useRef(null),e9=(0,v.Z)(),e6=(0,s.e)(),te=n.useRef(null);if(!te.current){let e="string"==typeof e6?e6.replace(/[^a-zA-Z0-9]/g,"").slice(-24):"",t=e||Math.random().toString(36).slice(2,10);te.current="guest-".concat(t,"@pending.blackbox.ai")}let tt=null!==(C=te.current)&&void 0!==C?C:"[email protected]",tr=eu.trim(),ta=!V||F.test(tr);(0,E.usePathname)(),(0,E.useRouter)();let{checkSubscription:tn,updateSubscriptionCache:ti,invalidateSubscriptionCache:ts}=(0,P.v)(),getDocumentCookie=e=>{if("undefined"==typeof document)return;let t="; ".concat(document.cookie),r=t.split("; ".concat(e,"="));if(2===r.length){var a;return null===(a=r.pop())||void 0===a?void 0:a.split(";").shift()}};getDocumentCookie("partner_key_valid"),getDocumentCookie("affiliate-code"),(0,n.useEffect)(()=>{(0,B.u)()},[]);let to=(e=>{let t={starter:"PRO",pro:"ProPlus",ultra:"ProMax",ultimate:"ProMax",business:"Business"};if(e&&t[e]){let a=t[e],n=r(19816).sU(a);if(n)return{name:n.name,displayName:n.displayName,monthlyPrice:n.basePrice,yearlyPrice:12*n.basePrice,description:n.description,features:n.features,ctaText:n.ctaText,priceId:n.priceIds}}return(0,k.tO)(K)})(H);(0,n.useEffect)(()=>{let fetchLocalizedPricing=async()=>{try{eq(!0);let e=(0,O.TA)();if(e){let e=await getLocalizedPricing();eJ(e),eq(!1);return}let t=getLocalizedPricing(),r=new Promise(e=>{setTimeout(()=>e((0,D.ri)()),2e3)}),a=await Promise.race([t,r]);eJ(a)}catch(e){console.warn("Error fetching localized pricing, using USD:",e),eJ((0,D.ri)())}finally{eq(!1)}};eJ((0,D.ri)()),eq(!1),fetchLocalizedPricing()},[]);let tl=eV||(0,D.ri)();if(!tl||!tl.pro||!tl.business||!tl.unlimited||!tl.ultimate){console.error("Invalid pricing structure detected in checkout, using defaults");let e=(0,D.ri)();eJ(e)}let tc=getPSCookie("ps_xid"),td=(0,D.hg)(),formatBillingDisplay=(e,t)=>{let r=e.price;if(t){let t=e.yearlyPrice||12*r;return{displayPrice:(0,T.xG)({...e,price:t/12}),originalPrice:void 0,interval:"month",subText:"Billed yearly"}}return{displayPrice:(0,T.xG)({...e,price:r}),originalPrice:void 0,interval:"month",subText:"Billed monthly"}},getPromotionalPricingDisplay=(e,t)=>({promotionalDisplay:(0,T.xG)({...e,price:t}),regularDisplay:(0,T.xG)(e),fullMessage:"Limited offer"}),tu={pro:tc?.499*tl.pro.price:tl.pro.price*td.pro,business:tl.business.price*td.business,ultimate:tl.ultimate.price*td.ultimate,unlimited:tl.unlimited.price*td.unlimited};switch(to.name){case"PRO":R=tl.pro,L=formatBillingDisplay(tl.pro,!1),M=formatBillingDisplay(tl.pro,!0),getPromotionalPricingDisplay(tl.pro,tu.pro);let tm=tl.pro.price;(0,T.xG)({...tl.pro,price:tm});break;case"ProPlus":R=tl.business,L=formatBillingDisplay(tl.business,!1),M=formatBillingDisplay(tl.business,!0),getPromotionalPricingDisplay(tl.business,tu.business);let tp=tl.business.price;(0,T.xG)({...tl.business,price:tp});break;case"ProMax":R=tl.ultimate,L=formatBillingDisplay(tl.ultimate,!1),M=formatBillingDisplay(tl.ultimate,!0),getPromotionalPricingDisplay(tl.ultimate,tu.ultimate);let tf=tl.ultimate.price;(0,T.xG)({...tl.ultimate,price:tf});break;case"Business":R=tl.unlimited,L=formatBillingDisplay(tl.unlimited,!1),M=formatBillingDisplay(tl.unlimited,!0),getPromotionalPricingDisplay(tl.unlimited,tu.unlimited);let tx=tl.unlimited.price;(0,T.xG)({...tl.unlimited,price:tx});break;default:R=tl.pro,L=formatBillingDisplay(tl.pro,!1),M=formatBillingDisplay(tl.pro,!0)}let tg=R.price,th=R.yearlyPrice||12*tg,tb="monthly"===ea?L.displayPrice:M.displayPrice,ty=(0,k.c8)(K),tv=(0,k.KZ)(K,H||void 0),tN=H&&({pro:"PRO",ultra:"PRO PLUS",ultimate:"PRO MAX",business:"UNLIMITED"})[H]||ty;(0,n.useEffect)(()=>{er(!0)},[]),(0,n.useEffect)(()=>{G&&$&&$!==ea&&en($)},[G]),(0,n.useEffect)(()=>
21{if(G){var e;(0,I.X)(p.uS.other,e6,{tag:"pricing-dialog-opened",type:K,mode:e9?"mobile":"desktop",posthog:!0,id:null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email})}},[G,e6,K,e9,null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email]),(0,n.useEffect)(()=>{let cleanupStripeParams=()=>{{let e=new URL(window.location.href),t=new URLSearchParams(e.search),r=new URLSearchParams;t.has("newPayment")&&r.set("newPayment",t.get("newPayment")),t.has("newUpgrade")&&r.set("newUpgrade",t.get("newUpgrade"));let a=r.toString()?"".concat(e.pathname,"?").concat(r.toString()):e.pathname;window.history.replaceState({},"",a)}};return cleanupStripeParams(),window.addEventListener("popstate",cleanupStripeParams),()=>window.removeEventListener("popstate",cleanupStripeParams)},[]),(0,n.useEffect)(()=>{G&&V?(ef(!0),ed(!0)):ef(!1)},[G,V]),(0,n.useEffect)(()=>{V&&J&&J!==eu&&em(J)},[V,J]),(0,n.useEffect)(()=>{if(!V)return;let e=setTimeout(()=>{ta&&J!==tr?Y(tr):!ta&&J&&0===tr.length&&Y(null)},300);return()=>clearTimeout(e)},[V,ta,tr,J,Y]),(0,n.useEffect)(()=>{let checkSubscription=async()=>{var e;if(V){eO(!1);return}if(G&&(null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email)&&"authenticated"===W){eO(!0);try{let e=await fetch("/api/check-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:X.user.email})});if(e.ok){let t=await e.json();if(t.customerId){let e=await fetch("".concat(z,"/api/check-subscription"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({customerId:t.customerId})});if(e.ok){let t=await e.json();eE(t)}}else eE(t)}}catch(e){console.error("Error checking subscription:",e)}finally{eO(!1)}}};checkSubscription()},[G,null==X?void 0:null===(t=X.user)||void 0===t?void 0:t.email,W]);let fetchSubscriptionList=async()=>{var e;if(null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email)try{let e=await fetch("/api/subscriptions/list");if(e.ok){let t=await e.json();eD(t.data||[])}}catch(e){console.error("Error fetching subscription list:",e)}};(0,n.useEffect)(()=>{eR&&0===eT.length&&fetchSubscriptionList()},[eR]),(0,n.useEffect)(()=>{var e;(null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.name)&&es(X.user.name)},[X]),(0,n.useEffect)(()=>{if(!G||!V&&("authenticated"!==W||(null==eI?void 0:eI.hasActiveSubscription))||eK||ex)return;let createPaymentIntent=async()=>{eH(!0),ev(!0),ej(!0);try{var e;let t=V?ta?tr:null!=J?J:tt:(null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email)||"[email protected]",r="".concat(t,"-").concat(Date.now()),a=to.priceId.monthly,n=await fetch("/api/create-payment-intent",{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":r},body:JSON.stringify({email:t,billingCycle:"monthly",name:ei,businessName:eo,source:K,priceId:a,isGuestCheckout:V})}),i=await n.json();i.clientSecret?(eg(i.clientSecret),i.setupIntentId?(eb(!0),ew(i.setupIntentId),ek(i.customerId)):eb(!1)):console.error("❌ No client secret in response:",i)}catch(e){console.error("❌ Error creating payment intent:",e)}finally{setTimeout(()=>{ev(!1),ej(!1)},e9?400:200),eH(!1)}};createPaymentIntent()},[G,W,null==eI?void 0:eI.hasActiveSubscription,V,ta,tr,J,tt]);let verifyCoupon=async()=>{if(!eX.trim()){e2("Please enter a coupon code");return}e3(!0),e2(null);try{let e="annually"===ea,t=getPriceIdForPlan(tN,e,K),r=await fetch("/api/verify-coupon",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({couponCode:eX.trim(),priceId:t})}),a=await r.json();if(!r.ok){a.rateLimited?(e2(a.error||"Too many attempts. Please try again later."),U.Am.error(a.error||"Too many attempts. Please try again later.")):e2(a.error||"Invalid coupon code"),e0(null);return}if(a.valid){console.log("✅ Coupon verification response:",{originalAmount:a.discount.originalAmount,discountAmount:a.discount.discountAmount,finalAmount:a.discount.finalAmount,percentOff:a.discount.percentOff,type:a.discount.type}),e0(a),e2(null);let e="";if("fixed"===a.discount.type){let t=a.discount.discountAmount/100,r=a.discount.originalAmount/100,n="monthly"===ea?R.price:th;e=(0,T.xG)({...R,price:n*(t/r)})}else e="".concat(a.discount.percentOff,"%");U.Am.success("Coupon applied! You save ".concat(e))}else e2(a.error||"Invalid coupon code"),e0(null)}catch(e){console.error("Error verifying coupon:",e),e2("Failed to verify coupon. Please try again."),e0(null)}finally{e3(!1)}};(0,n.useEffect)(()=>{eQ&&(e0(null),eW(""),e2(null))},[ea]);let handlePaymentSuccess=async()=>{var e,t;if((0,I.X)(p.uS.other,e6,{tag:"payment-success",type:K,from:"pricing-dialog",mode:e9?"mobile":"desktop",posthog:!0,id:(null==X?void 0:null===(e=X.user)||void 0===e?void 0:e.email)||eu}),!eF){if(eG(!0),eM(!0),V){q({customerId:eP,email:eu,source:K,timestamp:Date.now(),billingCycle:ea}),localStorage.setItem("pending_subscription_data",JSON.stringify({customerId:eP,email:eu,source:K,timestamp:Date.now(),billingCycle:ea})),U.Am.success("Payment successful! Please create your account to continue."),await new Promise(e=>setTimeout(e,2e3)),Z();let{setIsOpen:e}=r(90925).O.getState();e(!0);return}if(await (0,A.Jh)(eP,null==X?void 0:X.user.email),await new Promise(e=>setTimeout(e,2e3)),!(null==X?void 0:null===(t=X.user)||void 0===t?void 0:t.email)){eG(!1);return}try{ts();let e=await fetch("/api/check-subscription",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:X.user.email})});if(!e.ok)return;let t=await e.json(),r=await tn(X.user.email,!0,!1,X.user.email);"PREMIUM"===r.status||t.hasActiveSubscription?t.customerId&&(eE({hasActiveSubscription:t.hasActiveSubscription,isTrialSubscription:t.isTrialSubscription||!1,customerId:t.customerId,expiryTimestamp:t.expiryTimestamp,isTeam:t.isTeam||!1,numSeats:t.numSeats||1,previouslySubscribed:t.previouslySubscribed||!1,plan:t.plan,billing:t.billing,source:t.source}),ti(X.user.email,{status:"PREMIUM",customerId:t.customerId,expiryTimestamp:t.expiryTimestamp,isTrialSubscription:t.isTrialSubscription||!1,plan:t.plan,billing:t.billing,source:t.source,isTeam:t.isTeam||!1,numSeats:t.numSeats||1,previouslySubscribed:!0}
21),t.previouslySubscribed?await fetchSubscriptionList():console.error("❌ [PRICING-DIALOG] No customer ID available for credit initialization")):eE({hasActiveSubscription:!1,isTrialSubscription:!1,customerId:r.customerId,expiryTimestamp:null,isTeam:!1,numSeats:1,previouslySubscribed:r.previouslySubscribed||!1}),Z();let a="monthly"===t.billing&&t.hasActiveSubscription&&!t.isTeam;a?window.location.href="/?newPayment=true&newUpgrade=true":window.location.href="/"}catch(e){console.error("❌ Error in payment success handler:",e),eG(!1)}finally{ez(!1)}}};(0,n.useEffect)(()=>{G||(eG(!1),eH(!1),eZ(null),eg(null),ew(null),ek(null),eA(null))},[G]);let formatDate=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"N/A",renderMobileSubmitSection=e=>(0,a.jsxs)("div",{className:(0,p.cn)("space-y-3",e),children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(b.X,{id:"terms-mobile",checked:ec,onCheckedChange:e=>ed(e),className:"mt-0.5"}),(0,a.jsx)("label",{htmlFor:"terms-mobile",className:"text-xs text-muted-foreground cursor-pointer leading-relaxed",children:"Your Blackbox subscription will auto-renew each billing period."})]}),(0,a.jsx)(g.z,{type:"button",variant:"default",disabled:e_,className:"w-full font-medium h-11 rounded-lg disabled:opacity-50",onClick:()=>{e7.current&&(ez(!0),e7.current())},children:e_?(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)(w.tx,{className:"size-4 animate-spin"}),"Processing..."]}):"Get Deal"})]}),tj=(0,a.jsx)("div",{className:"flex flex-col w-full flex-grow",children:(null==eI?void 0:eI.hasActiveSubscription)&&(null==eT?void 0:eT.length)>0?(0,a.jsxs)("div",{className:"space-y-4",children:[eU?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.O,{className:"size-7 rounded-full mb-4"}),(0,a.jsx)("div",{className:"flex items-start gap-4 mb-6",children:(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)(y.O,{className:"h-8 w-64"}),(0,a.jsx)(y.O,{className:"h-4 w-96"})]})}),(0,a.jsx)("div",{className:"space-y-4 p-6 border border-border rounded-lg bg-muted/30",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.O,{className:"h-3 w-12"}),(0,a.jsx)(y.O,{className:"h-4 w-24"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.O,{className:"h-3 w-12"}),(0,a.jsx)(y.O,{className:"h-4 w-20"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.O,{className:"h-3 w-16"}),(0,a.jsx)(y.O,{className:"h-4 w-32"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(y.O,{className:"h-3 w-12"}),(0,a.jsx)(y.O,{className:"h-4 w-8"})]})]})}),(0,a.jsxs)("div",{className:"flex gap-3 flex-col sm:flex-row",children:[(0,a.jsx)(y.O,{className:"flex-1 h-10"}),(0,a.jsx)(y.O,{className:"flex-1 h-10"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-7 rounded-full bg-green-500 mb-4",children:(0,a.jsx)(d.Z,{className:"size-4 text-white"})}),(0,a.jsx)("div",{className:"flex items-start gap-4 mb-6",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold text-foreground mb-2",children:"Subscription Activated!"}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["You currently have an active ",eI.isTrialSubscription?"trial":""," subscription"]})]})}),(0,a.jsx)("div",{className:"space-y-4 p-6 border border-border rounded-lg bg-muted/30",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(h._,{className:"text-xs text-muted-foreground",children:"Plan"}),(0,a.jsxs)("p",{className:"text-sm font-medium mt-1",children:[eI.plan||"Plus"," ",eI.isTeam?"(Team)":""]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(h._,{className:"text-xs text-muted-foreground",children:"Billing"}),(0,a.jsx)("p",{className:"text-sm font-medium mt-1 capitalize",children:eI.billing||"Monthly"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(h._,{className:"text-xs text-muted-foreground",children:eI.isTrialSubscription?"Trial Ends":"Renews On"}
21),(0,a.jsx)("p",{className:"text-sm font-medium mt-1",children:formatDate(eI.expiryTimestamp)})]}),eI.isTeam&&(0,a.jsxs)("div",{children:[(0,a.jsx)(h._,{className:"text-xs text-muted-foreground",children:"Seats"}),(0,a.jsx)("p",{className:"text-sm font-medium mt-1",children:eI.numSeats})]})]})})]}),!eU&&eI.hasPaymentVerificationFailure&&(0,a.jsxs)("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-950/20 border border-yellow-200 dark:border-yellow-800 rounded-lg flex items-start gap-3",children:[(0,a.jsx)(u.Z,{className:"size-5 text-yellow-600 dark:text-yellow-400 mt-0.5"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold text-yellow-900 dark:text-yellow-100",children:"Payment Verification Required"}),(0,a.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 mt-1",children:eI.requiresAuthentication?"Your payment requires additional authentication. Please update your payment method.":"There was an issue verifying your payment method. Please update it to continue your subscription."})]})]}),!eU&&(0,a.jsxs)("div",{className:"flex gap-3 flex-col sm:flex-row",children:[(0,a.jsxs)(g.z,{onClick:()=>{(null==eI?void 0:eI.customerId)&&window.open("/api/stripe/billing-portal?customerId=".concat(eI.customerId),"_blank")},className:"flex-1 h-10",children:[(0,a.jsx)(m.Z,{className:"size-4 mr-2"}),"Manage Subscription"]}),eI.previouslySubscribed&&(0,a.jsxs)(g.z,{onClick:()=>eL(!eR),variant:"outline",className:"flex-1 h-10",children:[eR?"Hide":"View"," All Subscriptions"]})]}),eR&&(0,a.jsxs)("div",{className:"space-y-3 mt-4",children:[(0,a.jsx)(h._,{className:"text-sm text-muted-foreground",children:"Your Subscriptions"}),0===eT.length?(0,a.jsx)("div",{className:"p-4 text-center text-sm text-muted-foreground border border-border rounded-lg",children:"Loading subscriptions..."}):(0,a.jsx)("div",{className:"space-y-2",children:eT.map(e=>(0,a.jsxs)("div",{className:"p-3 border border-border rounded-lg bg-background flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.email||e.name||"Subscription"}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Created: ",e.created?formatDate(e.created):"N/A"]})]}),(0,a.jsx)("span",{className:(0,p.cn)("px-2 py-1 text-xs font-medium rounded","active"===e.status?"text-white bg-green-500":"trialing"===e.status?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300"),children:e.status})]},e.id))})]})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("div",{className:"flex items-center gap-3 mb-3",children:(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:tv.title}),(0,a.jsx)("span",{className:"text-[10px] font-medium text-orange-600 dark:text-orange-400 uppercase tracking-wide px-1.5 py-0.5 bg-orange-100 dark:bg-orange-900/30 rounded",children:"Limited offer"})]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground truncate hidden md:block",children:tv.subtitle})]})}),(0,a.jsxs)("div",{className:"flex flex-col md:grid md:grid-cols-2 gap-8 items-start",children:[(0,a.jsxs)("div",{className:"space-y-4 md:order-1 order-2",children:[V&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(h._,{className:"text-sm font-medium",children:"Email"}),ep?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"email",value:eu,onChange:e=>em(e.target.value),placeholder:"Enter your email address",className:(0,p.cn)("flex-1 h-10 rounded-lg border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary"),required:!0}),(0,a.jsx)(g.z,{type:"button",variant:"secondary",onClick:async()=>{if(!ta){U.Am.error("Please enter a valid email address");return}Y(tr),eH(!0),ev(!0),ej(!0);try{let e="".concat(tr,"-").concat(Date.now()),t=to.priceId.monthly,r=await fetch("/api/create-payment-intent",{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":e},body:JSON.stringify({email:tr,billingCycle:"monthly",name:ei,businessName:eo,source:K,priceId:t,isGuestCheckout:!0})}),a=await r.json();a.clientSecret?(eg(a.clientSecret),a.setupIntentId?(eb(!0),ew(a.setupIntentId),ek(a.customerId)):eb(!1)):(console.error("❌ No client secret in response:",a),U.Am.error("Failed to initialize payment. Please try again."))}catch(e){console.error("❌ Error creating payment intent:",e),U.Am.error("Failed to initialize payment. Please try again.")}finally{setTimeout(()=>{ev(!1),ej(!1)},e9?400:200),eH(!1)}},className:"h-10 px-4 shrink-0",disabled:!ta||eK,children:eK?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2 text-sm font-medium",children:[(0,a.jsx)(w.tx,{className:"size-4 animate-spin"}),ex?"Updating...":"Preparing..."]}):ex?"Update Email":"Continue to payment"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"We'll use this email to create your account and send receipts."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("div",{className:"flex-1 h-10 rounded-lg bg-muted"}),(0,a.jsx)("div",{className:"h-10 w-[140px] rounded-lg bg-muted"})]}
21),(0,a.jsx)("div",{className:"h-4 w-64 rounded bg-muted mt-1"})]})]}),(0,a.jsxs)("div",{className:"relative min-h-[275px]",children:[(0,a.jsxs)("div",{"aria-hidden":"true",className:(0,p.cn)("pointer-events-none absolute inset-0 z-10 flex flex-col",eN||!ex?"opacity-100":"opacity-0 invisible"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 py-2 mb-1",children:[(0,a.jsx)("div",{className:"h-5 w-5 rounded bg-muted"}),(0,a.jsx)("div",{className:"h-5 w-48 rounded bg-muted"}),(0,a.jsx)("div",{className:"h-4 w-4 rounded bg-muted"})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("div",{className:"h-4 w-24 rounded bg-muted mb-1"}),(0,a.jsx)("div",{className:"h-11 w-full rounded-lg bg-muted"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 w-28 rounded bg-muted mb-2"}),(0,a.jsx)("div",{className:"h-11 w-full rounded-lg bg-muted"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 w-24 rounded bg-muted mb-1"}),(0,a.jsx)("div",{className:"h-11 w-full rounded-lg bg-muted"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 w-16 rounded bg-muted mb-1"}),(0,a.jsx)("div",{className:"h-11 w-full rounded-lg bg-muted"})]})]}),(0,a.jsx)("div",{className:(0,p.cn)("relative flex h-full flex-col gap-3",eN||!ex?"opacity-0 pointer-events-none":"opacity-100"),children:ex&&(0,a.jsx)(j.eK,{stripe:_,options:{clientSecret:ex,loader:"never",appearance:et&&("dark"===ee||"dark"===Q)?{theme:"night",variables:{colorPrimary:"#f0f6fc",colorBackground:"#070707",colorText:"#f0f6fc",colorDanger:"#ef4444",fontFamily:"system-ui, sans-serif",spacingUnit:"4px",borderRadius:"8px"},rules:{".Input":{backgroundColor:"#131313",color:"#f0f6fc"},".Input:focus":{border:"1px solid #fff",boxShadow:"0 0 0 1px #fff"},".Label":{color:"rgb(156, 163, 175)",fontSize:"14px"},".Tab":{backgroundColor:"#131313",border:"1px solid hsl(var(--border))",color:"#f0f6fc"},".Tab:hover":{backgroundColor:"#2D2F34",color:"#f0f6fc",border:"1px solid #f0f6fc"},".Tab--selected":{backgroundColor:"transparent",color:"#f0f6fc",border:"1px solid #f0f6fc"},".Tab--selected:hover":{backgroundColor:"#2D2F34",color:"#f0f6fc",border:"1px solid #f0f6fc"},".Error":{color:"#ef4444"}}}:{variables:{colorPrimary:"#070707",colorBackground:"#ffffff",colorText:"#1f2937",colorDanger:"#ef4444",fontFamily:"system-ui, sans-serif",spacingUnit:"4px",borderRadius:"8px"},rules:{".Input":{backgroundColor:"#ffffff",border:"1px solid #e5e7eb",color:"#1f2937"},".Input:focus":{border:"1px solid #070707",boxShadow:"0 0 0 1px #070707"},".Label":{color:"#6b7280",fontSize:"14px"},".Tab":{backgroundColor:"#ffffff",border:"1px solid #e5e7eb",color:"#1f2937"},".Tab:hover":{backgroundColor:"#f9fafb",border:"1px solid #070707"},".Tab--selected":{backgroundColor:"transparent",color:"#1f2937",border:"1px solid #red"},".Error":{color:"#ef4444"}}}},children:(0,a.jsx)(StripePaymentForm,{clientSecret:ex,onSuccess:handlePaymentSuccess,userEmail:(null==X?void 0:null===(N=X.user)||void 0===N?void 0:N.email)||eu.trim()||void 0,isSetupIntent:eh,setupIntentId:eS||void 0,customerId:eP||void 0,priceId:eC||void 0,billingCycle:ea,isProcessing:e_,setIsProcessing:ez,source:K,planName:tN,onCustomerIdCreated:e=>ek(e),appliedCoupon:eQ,submitButtonRef:e7})},ex)})]})]}),(0,a.jsxs)("div",{className:"space-y-4 md:order-2 order-1",children:[(0,a.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,a.jsx)("h3",{className:"text-base font-medium text-foreground",children:"Billing options"}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center gap-2 md:gap-3",children:[(0,a.jsxs)("div",{className:"inline-flex p-1 bg-muted rounded-full border border-border w-fit",children:[(0,a.jsx)("button",{type:"button",onClick:()=>en("monthly"),className:(0,p.cn)("px-4 py-1.5 text-sm font-medium rounded-full","monthly"===ea?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Monthly"}),(0,a.jsx)("button",{type:"button",onClick:()=>en("annually"),className:(0,p.cn)("px-4 py-1.5 text-sm font-medium rounded-full","annually"===ea?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Yearly"})]}),(0,a.jsx)("span",{className:"text-xs md:text-sm text-muted-foreground md:text-foreground",children:"monthly"===ea?(0,a.jsxs)(a.Fragment,{children:["Save ",Math.round((1-th/(12*tg))*100),"% with yearly"]}):(0,a.jsxs)(a.Fragment,{children:["You're saving ",(0,T.xG)("PRO"===to.name?{...tl.pro,price:12*tg-th}:"ProPlus"===to.name?{...tl.business,price:12*tg-th}:"ProMax"===to.name?{...tl.ultimate,price:12*tg-th}:"Business"===to.name?{...tl.unlimited,price:12*tg-th}:{...tl.pro,price:12*tg-th}
21)," with annual billing"]})})]}),(0,a.jsxs)("div",{className:"p-4 rounded-lg border border-border bg-muted/30",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Total for ","monthly"===ea?"1 month":"1 year"]}),(0,a.jsxs)("div",{className:"text-right",children:["annually"===ea&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground line-through mr-2",children:(0,T.xG)("PRO"===to.name?{...tl.pro,price:12*tg}:"ProPlus"===to.name?{...tl.business,price:12*tg}:"ProMax"===to.name?{...tl.ultimate,price:12*tg}:"Business"===to.name?{...tl.unlimited,price:12*tg}:{...tl.pro,price:12*tg})}),(0,a.jsx)("span",{className:"text-xl font-bold text-foreground",children:"monthly"===ea?tb:(0,T.xG)("PRO"===to.name?{...tl.pro,price:th}:"ProPlus"===to.name?{...tl.business,price:th}:"ProMax"===to.name?{...tl.ultimate,price:th}:"Business"===to.name?{...tl.unlimited,price:th}:{...tl.pro,price:th})})]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"monthly"===ea?"Billed monthly":"Billed annually"})]})]}),(0,a.jsx)("div",{children:e5||eQ?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"flex-1 relative",children:[(0,a.jsx)("input",{type:"text",value:eX,onChange:e=>{eW(e.target.value),e2(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),verifyCoupon())},placeholder:"Enter coupon code",disabled:e4||!!eQ,className:(0,p.cn)("w-full h-9 rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary",eQ&&"border-green-500 bg-green-50 dark:bg-green-950/20",e1&&"border-red-500")}),eQ&&(0,a.jsx)(d.Z,{className:"absolute right-3 top-1/2 -translate-y-1/2 size-4 text-green-600 dark:text-green-400"})]}),eQ?(0,a.jsx)(g.z,{type:"button",variant:"outline",size:"sm",onClick:()=>{e0(null),eW(""),e2(null)},className:"h-9",children:"Remove"}):(0,a.jsx)(g.z,{type:"button",size:"sm",onClick:verifyCoupon,disabled:!eX.trim()||e4,className:"h-9",children:e4?(0,a.jsx)(w.tx,{className:"size-4 animate-spin"}):"Apply"})]}),e1&&(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:e1}),eQ&&(0,a.jsxs)("p",{className:"text-xs text-green-600 dark:text-green-400",children:["fixed"===eQ.discount.type?(()=>{let e=eQ.discount.discountAmount/100,t=eQ.discount.originalAmount/100,r=R.price*(e/t);return"".concat((0,T.xG)({...R,price:r})," discount applied")})():"".concat(eQ.discount.percentOff,"% discount applied"),"once"===eQ.duration&&" (first payment only)","repeating"===eQ.duration&&eQ.durationInMonths&&" (for ".concat(eQ.durationInMonths," months)")]})]}):(0,a.jsx)("button",{type:"button",onClick:()=>e8(!0),className:"text-sm text-primary hover:underline",children:"Have a coupon code?"})}),(0,a.jsxs)("div",{className:"flex items-center justify-between py-3 px-4 border border-border rounded-lg bg-muted/20 hidden md:flex",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"Total:"}),(0,a.jsxs)("div",{className:"text-right",children:[eQ&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground line-through mr-2",children:"monthly"===ea?tb:(0,T.xG)("PRO"===to.name?{...tl.pro,price:th}:"ProPlus"===to.name?{...tl.business,price:th}:"ProMax"===to.name?{...tl.ultimate,price:th}:"Business"===to.name?{...tl.unlimited,price:th}:{...tl.pro,price:th})}),(0,a.jsx)("span",{className:"text-2xl font-bold text-foreground",children:eQ?(()=>{let e="monthly"===ea?R.price:th,t=e;if("percentage"===eQ.discount.type)t=e*(1-eQ.discount.percentOff/100);else{let r=eQ.discount.discountAmount/100,a=eQ.discount.originalAmount/100;t=e*(1-r/a)}return(0,T.xG)({...R,price:t})})():"monthly"===ea?tb:(0,T.xG)("PRO"===to.name?{...tl.pro,price:th}:"ProPlus"===to.name?{...tl.business,price:th}:"ProMax"===to.name?{...tl.ultimate,price:th}:"Business"===to.name?{...tl.unlimited,price:th}:{...tl.pro,price:th})}),(0,a.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:"monthly"===ea?" / month":" / year"})]})]}),(0,a.jsxs)("div",{className:"hidden md:flex items-start gap-2 pt-2",children:[(0,a.jsx)(b.X,{id:"terms-right",checked:ec,onCheckedChange:e=>ed(e),className:"mt-0.5"}),(0,a.jsx)("label",{htmlFor:"terms-right",className:"text-xs text-muted-foreground cursor-pointer leading-relaxed",children:"Your Blackbox subscription will auto-renew each billing period."})]}),(0,a.jsx)(g.z,{type:"button",disabled:e_,className:"inline-flex items-center justify-center text-sm r
21ing-offset-background focus-visible:outline-none disabled:pointer-events-none bg-primary text-primary-foreground shadow-none hover:bg-primary/90 h-8 px-4 w-full font-medium py-5 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed hidden md:flex",onClick:()=>{e7.current&&(ez(!0),e7.current())},children:e_?(0,a.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,a.jsx)(w.tx,{className:"size-4 animate-spin"}),"Processing..."]}):"Get Deal"})]}),!e9&&renderMobileSubmitSection("md:hidden order-3")]})]})});return e9?G?(0,a.jsxs)("div",{className:"fixed inset-0 z-[99999] bg-background flex flex-col w-screen h-dvh overflow-hidden",children:[(0,a.jsxs)("button",{onClick:Z,className:"absolute right-1 top-4 p-2 opacity-70 hover:opacity-100 z-[100000]",children:[(0,a.jsx)(c.Pxu,{className:"h-6 w-6"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6 pb-6",children:tj}),(0,a.jsx)("div",{className:"p-6 pt-4 pb-6 border-t border-border bg-background shadow-[0_-12px_24px_-18px_rgba(0,0,0,0.45)]",children:renderMobileSubmitSection()})]}):null:(0,a.jsx)(o.Vq,{open:G,onOpenChange:e=>!e&&Z(),children:(0,a.jsxs)(o.PK,{children:[(0,a.jsx)(o.t9,{}),(0,a.jsxs)(l.VY,{className:(0,p.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-5xl translate-x-[-50%] translate-y-[-50%]","gap-6 border bg-background shadow-lg","duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","sm:rounded-lg","flex flex-col p-5 w-[95%] rounded-xl max-h-[90vh] overflow-y-auto","outline-none focus:outline-none focus-visible:outline-none"),children:[tj,(0,a.jsxs)(l.x8,{className:"absolute right-4 top-4 roun
21ded-sm opacity-70 hover:opacity-100",onClick:Z,children:[(0,a.jsx)(c.Pxu,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})})}function Checkout(){return(0,a.jsx)(CheckoutContent,{})}},13475:function(e,t,r){r.d(t,{F$:function(){return l},Q5:function(){return c},qE:function(){return o}});var a=r(19745),n=r(80833),i=r(54534),s=r(5217);let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)(i.fC,{ref:t,className:(0,s.cn)("relative flex h-20 w-20 shrink-0 overflow-hidden",r),...n})});o.displayName=i.fC.displayName;let l=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)(i.Ee,{ref:t,className:(0,s.cn)("aspect-square h-full w-full",r),...n})});l.displayName=i.Ee.displayName;let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)(i.NY,{ref:t,className:(0,s.cn)("flex h-full w-full items-center justify-center bg-muted",r),...n})});c.displayName=i.NY.displayName},8849:function(e,t,r){r.d(t,{X:function(){return C}});var a=r(19745),n=r(80833),i=r(43869),s=r(74525),o=r(28100),l=r(79277),c=r(36916),d=r(56193),u=r(61489),m=r(3843),p="Checkbox",[f,x]=(0,s.b)(p),[g,h]=f(p);function CheckboxProvider(e){let{__scopeCheckbox:t,checked:r,children:i,defaultChecked:s,disabled:o,form:c,name:d,onCheckedChange:u,required:m,value:f="on",internal_do_not_use_render:x}=e,[h,b]=(0,l.T)({prop:r,defaultProp:s??!1,onChange:u,caller:p}),[y,v]=n.useState(null),[N,j]=n.useState(null),S=n.useRef(!1),w=!y||!!c||!!y.closest("form"),P={checked:h,disabled:o,setChecked:b,control:y,setControl:v,name:d,form:c,value:f,hasConsumerStoppedPropagationRef:S,required:m,defaultChecked:!isIndeterminate(s)&&s,isFormControl:w,bubbleInput:N,setBubbleInput:j};return(0,a.jsx)(g,{scope:t,...P,children:isFunction(x)?x(P):i})}var b="CheckboxTrigger",y=n.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},l)=>{let{control:c,value:d,disabled:u,checked:p,required:f,setControl:x,setChecked:g,hasConsumerStoppedPropagationRef:y,isFormControl:v,bubbleInput:N}=h(b,e),j=(0,i.e)(l,x),S=n.useRef(p);return n.useEffect(()=>{let e=c?.form;if(e){let reset=()=>g(S.current);return e.addEventListener("reset",reset),()=>e.removeEventListener("reset",reset)}},[c,g]),(0,a.jsx)(m.WV.button,{type:"button",role:"checkbox","aria-checked":isIndeterminate(p)?"mixed":p,"aria-required":f,"data-state":getState(p),"data-disabled":u?"":void 0,disabled:u,value:d,...s,ref:j,onKeyDown:(0,o.M)(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,o.M)(r,e=>{g(e=>!!isIndeterminate(e)||!e),N&&v&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})})});y.displayName=b;var v=n.forwardRef((e,t)=>{let{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:l,value:c,onCheckedChange:d,form:u,...m}=e;return(0,a.jsx)(CheckboxProvider,{__scopeCheckbox:r,checked:i,defaultChecked:s,disabled:l,required:o,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{...m,ref:t,__scopeCheckbox:r}),e&&(0,a.jsx)(w,{__scopeCheckbox:r})]})})});v.displayName=p;var N="CheckboxIndicator",j=n.forwardRef((e,t)=>{let{__scopeCheckbox:r,forceMount:n,...i}=e,s=h(N,r);return(0,a.jsx)(u.z,{present:n||isIndeterminate(s.checked)||!0===s.checked,children:(0,a.jsx)(m.WV.span,{"data-state":getState(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});j.displayName=N;var S="CheckboxBubbleInput",w=n.forwardRef(({__scopeCheckbox:e,...t},r)=>{let{control:s,hasConsumerStoppedPropagationRef:o,checked:l,defaultChecked:u,required:p,disabled:f,name:x,value:g,form:b,bubbleInput:y,setBubbleInput:v}=h(S,e),N=(0,i.e)(r,v),j=(0,c.D)(l),w=(0,d.t)(s);n.useEffect(()=>{if(!y)return;let e=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(e,"checked"),r=t.set,a=!o.current;if(j!==l&&r){let e=new Event("click",{bubbles:a});y.indeterminate=isIndeterminate(l),r.call(y,!isIndeterminate(l)&&l),y.dispatchEvent(e)}},[y,j,l,o]);let P=n.useRef(!isIndeterminate(l)&&l);return(0,a.jsx)(m.WV.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??P.current,required:p,disabled:f,name:x,value:g,form:b,...t,tabIndex:-1,ref:N,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function isFunction(e){return"function"==typeof e}function isIndeterminate(e){return"indeterminate"===e}function getState(e){return isIndeterminate(e)?"indeterminate":e?"checked":"unchecked"}w.displayName=S;var P=r(52848),k=r(5217);let C=n.forwardRef((e,t)=>
21{let{className:r,...n}=e;return(0,a.jsx)(v,{ref:t,className:(0,k.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",r),...n,children:(0,a.jsx)(j,{className:(0,k.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(P.Z,{className:"h-4 w-4"})})})});C.displayName=v.displayName},23117:function(e,t,r){r.d(t,{_:function(){return c}});var a=r(19745),n=r(80833),i=r(72851),s=r(71057),o=r(5217);let l=(0,s.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)(i.f,{ref:t,className:(0,o.cn)(l(),r),...n})});c.displayName=i.f.displayName},86747:function(e,t,r){r.d(t,{O:function(){return Skeleton}});var a=r(19745),n=r(5217);function Skeleton(e){let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,n.cn)("animate-pulse rounded-md bg-black/10 dark:bg-white/10",t),...r})}},49269:function(e,t,r){function formatCurrency(e,t){let{showCode:r=!1,decimals:a=0}=t||{},n={DKK:(e,t)=>"".concat(formatNumber(e,a)).concat(t),NOK:(e,t)=>"".concat(formatNumber(e,a)).concat(t),SEK:(e,t)=>"".concat(formatNumber(e,a)).concat(t),ISK:(e,t)=>"".concat(t).concat(formatNumber(e,a)),CZK:(e,t)=>"".concat(t).concat(formatNumber(e,a)),PLN:(e,t)=>"".concat(t).concat(formatNumber(e,a)),HUF:(e,t)=>"".concat(t).concat(formatNumber(e,a)),RON:(e,t)=>"".concat(t).concat(formatNumber(e,a)),BGN:(e,t)=>"".concat(t).concat(formatNumber(e,a)),HRK:(e,t)=>"".concat(t).concat(formatNumber(e,a)),RSD:(e,t)=>"".concat(t).concat(formatNumber(e,a)),RUB:(e,t)=>"".concat(t).concat(formatNumber(e,a)),TRY:(e,t)=>"".concat(t).concat(formatNumber(e,a)),BRL:(e,t)=>"".concat(t," ").concat(formatNumber(e,a)),CHF:(e,t)=>"".concat(t," ").concat(formatNumber(e,a)),EUR:(e,t)=>"".concat(t).concat(formatNumber(e,a)),HKD:(e,t)=>"HK".concat(t).concat(formatNumber(e,a))};if(n[e.code]){let t=n[e.code](e.price,e.symbol);return r?"".concat(t," ").concat(e.code):t}let i=formatNumber(e.price,a),s="".concat(e.symbol).concat(i);return r?"".concat(s," ").concat(e.code):s}function formatNumber(e,t){let r=void 0!==t?t:0,a=e.toFixed(r),n=a.split(".");return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r>0?n.join("."):n[0]}r.d(t,{xG:function(){return formatCurrency}})},82579:function(e,t,r){Object.defineProperty(t,"$",{enumerable:!0,get:function(){return createServerReference}});let a=r(44714);function createServerReference(e){let{createServerReference:t}=r(67437);return t(e,a.callServer)}},46432:function(e,t){Symbol.for("react.server.reference")},54534:function(e,t,r){r.d(t,{NY:function(){return j},Ee:function(){return N},fC:function(){return v}});var a=r(80833),n=r(74525),i=r(92178),s=r(24332),o=r(3843),l=r(92696);function useIsHydrated(){return(0,l.useSyncExternalStore)(subscribe,()=>!0,()=>!1)}function subscribe(){return()=>{}}var c=r(19745),d="Avatar",[u,m]=(0,n.b)(d),[p,f]=u(d),x=a.forwardRef((e,t)=>{let{__scopeAvatar:r,...n}=e,[i,s]=a.useState("idle");return(0,c.jsx)(p,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:(0,c.jsx)(o.WV.span,{...n,ref:t})})});x.displayName=d;var g="AvatarImage",h=a.forwardRef((e,t)=>{let{__scopeAvatar:r,src:a,onLoadingStatusChange:n=()=>{},...l}=e,d=f(g,r),u=useImageLoadingStatus(a,l),m=(0,i.W)(e=>{n(e),d.onImageLoadingStatusChange(e)});return(0,s.b)(()=>{"idle"!==u&&m(u)},[u,m]),"loaded"===u?(0,c.jsx)(o.WV.img,{...l,ref:t,src:a}):null});h.displayName=g;var b="AvatarFallback",y=a.forwardRef((e,t)=>{let{__scopeAvatar:r,delayMs:n,...i}=e,s=f(b,r),[l,d]=a.useState(void 0===n);return a.useEffect(()=>{if(void 0!==n){let e=window.setTimeout(()=>d(!0),n);return()=>window.clearTimeout(e)}},[n]),l&&"loaded"!==s.imageLoadingStatus?(0,c.jsx)(o.WV.span,{...i,ref:t}):null});function resolveLoadingStatus(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function useImageLoadingStatus(e,{referrerPolicy:t,crossOrigin:r}){let n=useIsHydrated(),i=a.useRef(null),o=n?(i.current||(i.current=ne
21w window.Image),i.current):null,[l,c]=a.useState(()=>resolveLoadingStatus(o,e));return(0,s.b)(()=>{c(resolveLoadingStatus(o,e))},[o,e]),(0,s.b)(()=>{let updateStatus=e=>()=>{c(e)};if(!o)return;let e=updateStatus("loaded"),a=updateStatus("error");return o.addEventListener("load",e),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",e),o.removeEventListener("error",a)}},[o,r,t]),l}y.displayName=b;var v=x,N=h,j=y},72851:function(e,t,r){r.d(t,{f:function(){return o}});var a=r(80833),n=r(3843),i=r(19745),s=a.forwardRef((e,t)=>(0,i.jsx)(n.WV.label,{...e,ref:t,onMouseDown:t=>{let r=t.target;r.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=s}}]);

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.