import{c as ne,e as ct,r as l,j as r,f as ve,g as lt,m as dt,b as O,n as je,o as ut,B as y,s as P,d as Ne,a as C,u as mt}from"./index-BL0y_fpc.js";import{C as R,b as se,c as ie,d as ht,a as F}from"./card-CmTQIX9U.js";import{c as Ce,T as ft,O as gt,W as pt,C as xt,a as wt,D as yt,b as De,R as bt,P as vt,d as jt,e as Nt,f as Ct,g as Dt,h as _t,i as St,j as kt,S as Pt}from"./SubscriptionDialog-BTlEObUE.js";import{l as Ot}from"./lionpost_logo-D5RcADIY.js";import{I as H}from"./input-C0ZJbgJ-.js";import{L as U}from"./label-PZFLDDFg.js";import{B as Mt,I as ce,S as le}from"./star-DXm6NWxS.js";import{C as de}from"./calendar-BXSZhH4P.js";import{M as Tt}from"./mail-sgluXWmA.js";import{T as _e,u as At,L as Et,C as Wt}from"./useCustomerPortal-CRVuiLnU.js";import{o as Rt,s as J,Z as Ft}from"./types-3iKgNyo7.js";import{T as Yt}from"./textarea-DH087kis.js";import{T as ue,L as Lt}from"./twitter-CuBPJm_8.js";import{F as me}from"./facebook-7yv2Umin.js";import{C as he}from"./check-bfncYjgZ.js";import{S as qt}from"./send-OP_rWq4V.js";import{I as fe}from"./image-BGXbpKFs.js";import{M as It}from"./message-square-b7ZiXcY2.js";import{C as $t}from"./clock-DExFoz5L.js";import{C as zt}from"./circle-x-CteDGWhg.js";import{C as Ht}from"./circle-check-big-RLYwyypV.js";import"./index-C91EftaG.js";import"./switch-CZGf05Mi.js";import"./index-BzvWNLev.js";import"./currency-BnYXjSXj.js";import"./sparkles-DUpGt3jz.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const re=ne("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bt=ne("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Se=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var ke="AlertDialog",[Xt,$r]=ct(ke,[Ce]),S=Ce(),Pe=e=>{const{__scopeAlertDialog:t,...a}=e,n=S(t);return r.jsx(bt,{...n,...a,modal:!0})};Pe.displayName=ke;var Qt="AlertDialogTrigger",Oe=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,s=S(a);return r.jsx(ft,{...s,...n,ref:t})});Oe.displayName=Qt;var Vt="AlertDialogPortal",Me=e=>{const{__scopeAlertDialog:t,...a}=e,n=S(t);return r.jsx(vt,{...n,...a})};Me.displayName=Vt;var Gt="AlertDialogOverlay",Te=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,s=S(a);return r.jsx(gt,{...s,...n,ref:t})});Te.displayName=Gt;var Y="AlertDialogContent",[Ut,Jt]=Xt(Y),Zt=dt("AlertDialogContent"),Ae=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,children:n,...s}=e,i=S(a),c=l.useRef(null),d=ve(t,c),h=l.useRef(null);return r.jsx(pt,{contentName:Y,titleName:Ee,docsSlug:"alert-dialog",children:r.jsx(Ut,{scope:a,cancelRef:h,children:r.jsxs(xt,{role:"alertdialog",...i,...s,ref:d,onOpenAutoFocus:lt(s.onOpenAutoFocus,u=>{var x;u.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[r.jsx(Zt,{children:n}),r.jsx(ea,{contentRef:c})]})})})});Ae.displayName=Y;var Ee="AlertDialogTitle",We=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,s=S(a);return r.jsx(wt,{...s,...n,ref:t})});We.displayName=Ee;var Re="AlertDialogDescription",Fe=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,s=S(a);return r.jsx(yt,{...s,...n,ref:t})});Fe.displayName=Re;var Kt="AlertDialogAction",Ye=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,s=S(a);return r.jsx(De,{...s,...n,ref:t})});Ye.displayName=Kt;var Le="AlertDialogCancel",qe=l.forwardRef((e,t)=>{const{__scopeAlertDialog:a,...n}=e,{cancelRef:s}=Jt(Le,a),i=S(a),c=ve(t,s);return r.jsx(De,{...i,...n,ref:c})});qe.displayName=Le;var ea=({contentRef:e})=>{const t=`\`${Y}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Y}\` by passing a \`${Re}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Y}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},ta=Pe,aa=Oe,ra=Me,Ie=Te,$e=Ae,ze=Ye,He=qe,Be=We,Xe=Fe;const na=ta,sa=aa,ia=ra,Qe=l.forwardRef(({className:e,...t},a)=>r.jsx(Ie,{className:O("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:a}));Qe.displayName=Ie.displayName;const Ve=l.forwardRef(({className:e,...t},a)=>r.jsxs(ia,{children:[r.jsx(Qe,{}),r.jsx($e,{ref:a,className:O("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 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",e),...t})]}));Ve.displayName=$e.displayName;const Ge=({className:e,...t})=>r.jsx("div",{className:O("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ge.displayName="AlertDialogHeader";const Ue=({className:e,...t})=>r.jsx("div",{className:O("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ue.displayName="AlertDialogFooter";const Je=l.forwardRef(({className:e,...t},a)=>r.jsx(Be,{ref:a,className:O("text-lg font-semibold",e),...t}));Je.displayName=Be.displayName;const Ze=l.forwardRef(({className:e,...t},a)=>r.jsx(Xe,{ref:a,className:O("text-sm text-muted-foreground",e),...t}));Ze.displayName=Xe.displayName;const Ke=l.forwardRef(({className:e,...t},a)=>r.jsx(ze,{ref:a,className:O(je(),e),...t}));Ke.displayName=ze.displayName;const et=l.forwardRef(({className:e,...t},a)=>r.jsx(He,{ref:a,className:O(je({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));et.displayName=He.displayName;function D(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function A(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const tt=6048e5,oa=864e5;let ca={};function K(){return ca}function B(e,t){var d,h,u,x;const a=K(),n=(t==null?void 0:t.weekStartsOn)??((h=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??a.weekStartsOn??((x=(u=a.locale)==null?void 0:u.options)==null?void 0:x.weekStartsOn)??0,s=D(e),i=s.getDay(),c=(i<n?7:0)+i-n;return s.setDate(s.getDate()-c),s.setHours(0,0,0,0),s}function Z(e){return B(e,{weekStartsOn:1})}function at(e){const t=D(e),a=t.getFullYear(),n=A(e,0);n.setFullYear(a+1,0,4),n.setHours(0,0,0,0);const s=Z(n),i=A(e,0);i.setFullYear(a,0,4),i.setHours(0,0,0,0);const c=Z(i);return t.getTime()>=s.getTime()?a+1:t.getTime()>=c.getTime()?a:a-1}function ge(e){const t=D(e);return t.setHours(0,0,0,0),t}function pe(e){const t=D(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}function la(e,t){const a=ge(e),n=ge(t),s=+a-pe(a),i=+n-pe(n);return Math.round((s-i)/oa)}function da(e){const t=at(e),a=A(e,0);return a.setFullYear(t,0,4),a.setHours(0,0,0,0),Z(a)}function ua(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ma(e){if(!ua(e)&&typeof e!="number")return!1;const t=D(e);return!isNaN(Number(t))}function ha(e){const t=D(e),a=A(e,0);return a.setFullYear(t.getFullYear(),0,1),a.setHours(0,0,0,0),a}const fa={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ga=(e,t,a)=>{let n;const s=fa[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+n:n+" ago":n};function te(e){return(t={})=>{const a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}const pa={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xa={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},wa={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ya={date:te({formats:pa,defaultWidth:"full"}),time:te({formats:xa,defaultWidth:"full"}),dateTime:te({formats:wa,defaultWidth:"full"})},ba={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},va=(e,t,a,n)=>ba[e];function $(e){return(t,a)=>{const n=a!=null&&a.context?String(a.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,d=a!=null&&a.width?String(a.width):c;s=e.formattingValues[d]||e.formattingValues[c]}else{const c=e.defaultWidth,d=a!=null&&a.width?String(a.width):e.defaultWidth;s=e.values[d]||e.values[c]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const ja={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Na={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ca={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Da={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},_a={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Sa={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ka=(e,t)=>{const a=Number(e),n=a%100;if(n>20||n<10)switch(n%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},Pa={ordinalNumber:ka,era:$({values:ja,defaultWidth:"wide"}),quarter:$({values:Na,defaultWidth:"wide",argumentCallback:e=>e-1}),month:$({values:Ca,defaultWidth:"wide"}),day:$({values:Da,defaultWidth:"wide"}),dayPeriod:$({values:_a,defaultWidth:"wide",formattingValues:Sa,defaultFormattingWidth:"wide"})};function z(e){return(t,a={})=>{const n=a.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const c=i[0],d=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(d)?Ma(d,b=>b.test(c)):Oa(d,b=>b.test(c));let u;u=e.valueCallback?e.valueCallback(h):h,u=a.valueCallback?a.valueCallback(u):u;const x=t.slice(c.length);return{value:u,rest:x}}}function Oa(e,t){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a}function Ma(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a}function Ta(e){return(t,a={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],i=t.match(e.parsePattern);if(!i)return null;let c=e.valueCallback?e.valueCallback(i[0]):i[0];c=a.valueCallback?a.valueCallback(c):c;const d=t.slice(s.length);return{value:c,rest:d}}}const Aa=/^(\d+)(th|st|nd|rd)?/i,Ea=/\d+/i,Wa={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ra={any:[/^b/i,/^(a|c)/i]},Fa={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ya={any:[/1/i,/2/i,/3/i,/4/i]},La={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},qa={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ia={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},$a={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},za={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ha={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ba={ordinalNumber:Ta({matchPattern:Aa,parsePattern:Ea,valueCallback:e=>parseInt(e,10)}),era:z({matchPatterns:Wa,defaultMatchWidth:"wide",parsePatterns:Ra,defaultParseWidth:"any"}),quarter:z({matchPatterns:Fa,defaultMatchWidth:"wide",parsePatterns:Ya,defaultParseWidth:"any",valueCallback:e=>e+1}),month:z({matchPatterns:La,defaultMatchWidth:"wide",parsePatterns:qa,defaultParseWidth:"any"}),day:z({matchPatterns:Ia,defaultMatchWidth:"wide",parsePatterns:$a,defaultParseWidth:"any"}),dayPeriod:z({matchPatterns:za,defaultMatchWidth:"any",parsePatterns:Ha,defaultParseWidth:"any"})},Xa={code:"en-US",formatDistance:ga,formatLong:ya,formatRelative:va,localize:Pa,match:Ba,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Qa(e){const t=D(e);return la(t,ha(t))+1}function Va(e){const t=D(e),a=+Z(t)-+da(t);return Math.round(a/tt)+1}function rt(e,t){var x,b,v,g;const a=D(e),n=a.getFullYear(),s=K(),i=(t==null?void 0:t.firstWeekContainsDate)??((b=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:b.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(v=s.locale)==null?void 0:v.options)==null?void 0:g.firstWeekContainsDate)??1,c=A(e,0);c.setFullYear(n+1,0,i),c.setHours(0,0,0,0);const d=B(c,t),h=A(e,0);h.setFullYear(n,0,i),h.setHours(0,0,0,0);const u=B(h,t);return a.getTime()>=d.getTime()?n+1:a.getTime()>=u.getTime()?n:n-1}function Ga(e,t){var d,h,u,x;const a=K(),n=(t==null?void 0:t.firstWeekContainsDate)??((h=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((x=(u=a.locale)==null?void 0:u.options)==null?void 0:x.firstWeekContainsDate)??1,s=rt(e,t),i=A(e,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),B(i,t)}function Ua(e,t){const a=D(e),n=+B(a,t)-+Ga(a,t);return Math.round(n/tt)+1}function p(e,t){const a=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return a+n}const k={y(e,t){const a=e.getFullYear(),n=a>0?a:1-a;return p(t==="yy"?n%100:n,t.length)},M(e,t){const a=e.getMonth();return t==="M"?String(a+1):p(a+1,2)},d(e,t){return p(e.getDate(),t.length)},a(e,t){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(e,t){return p(e.getHours()%12||12,t.length)},H(e,t){return p(e.getHours(),t.length)},m(e,t){return p(e.getMinutes(),t.length)},s(e,t){return p(e.getSeconds(),t.length)},S(e,t){const a=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,a-3));return p(s,t.length)}},W={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xe={G:function(e,t,a){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})}},y:function(e,t,a){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return a.ordinalNumber(s,{unit:"year"})}return k.y(e,t)},Y:function(e,t,a,n){const s=rt(e,n),i=s>0?s:1-s;if(t==="YY"){const c=i%100;return p(c,2)}return t==="Yo"?a.ordinalNumber(i,{unit:"year"}):p(i,t.length)},R:function(e,t){const a=at(e);return p(a,t.length)},u:function(e,t){const a=e.getFullYear();return p(a,t.length)},Q:function(e,t,a){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return p(n,2);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,a){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return p(n,2);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,a){const n=e.getMonth();switch(t){case"M":case"MM":return k.M(e,t);case"Mo":return a.ordinalNumber(n+1,{unit:"month"});case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,a){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return p(n+1,2);case"Lo":return a.ordinalNumber(n+1,{unit:"month"});case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,a,n){const s=Ua(e,n);return t==="wo"?a.ordinalNumber(s,{unit:"week"}):p(s,t.length)},I:function(e,t,a){const n=Va(e);return t==="Io"?a.ordinalNumber(n,{unit:"week"}):p(n,t.length)},d:function(e,t,a){return t==="do"?a.ordinalNumber(e.getDate(),{unit:"date"}):k.d(e,t)},D:function(e,t,a){const n=Qa(e);return t==="Do"?a.ordinalNumber(n,{unit:"dayOfYear"}):p(n,t.length)},E:function(e,t,a){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,a,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return p(i,2);case"eo":return a.ordinalNumber(i,{unit:"day"});case"eee":return a.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"});case"eeee":default:return a.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,a,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return p(i,t.length);case"co":return a.ordinalNumber(i,{unit:"day"});case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"});case"cccc":default:return a.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,a){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return p(s,t.length);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return a.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(n,{width:"short",context:"formatting"});case"iiii":default:return a.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,a){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,a){const n=e.getHours();let s;switch(n===12?s=W.noon:n===0?s=W.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,a){const n=e.getHours();let s;switch(n>=17?s=W.evening:n>=12?s=W.afternoon:n>=4?s=W.morning:s=W.night,t){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,a){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),a.ordinalNumber(n,{unit:"hour"})}return k.h(e,t)},H:function(e,t,a){return t==="Ho"?a.ordinalNumber(e.getHours(),{unit:"hour"}):k.H(e,t)},K:function(e,t,a){const n=e.getHours()%12;return t==="Ko"?a.ordinalNumber(n,{unit:"hour"}):p(n,t.length)},k:function(e,t,a){let n=e.getHours();return n===0&&(n=24),t==="ko"?a.ordinalNumber(n,{unit:"hour"}):p(n,t.length)},m:function(e,t,a){return t==="mo"?a.ordinalNumber(e.getMinutes(),{unit:"minute"}):k.m(e,t)},s:function(e,t,a){return t==="so"?a.ordinalNumber(e.getSeconds(),{unit:"second"}):k.s(e,t)},S:function(e,t){return k.S(e,t)},X:function(e,t,a){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return ye(n);case"XXXX":case"XX":return T(n);case"XXXXX":case"XXX":default:return T(n,":")}},x:function(e,t,a){const n=e.getTimezoneOffset();switch(t){case"x":return ye(n);case"xxxx":case"xx":return T(n);case"xxxxx":case"xxx":default:return T(n,":")}},O:function(e,t,a){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+we(n,":");case"OOOO":default:return"GMT"+T(n,":")}},z:function(e,t,a){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+we(n,":");case"zzzz":default:return"GMT"+T(n,":")}},t:function(e,t,a){const n=Math.trunc(e.getTime()/1e3);return p(n,t.length)},T:function(e,t,a){const n=e.getTime();return p(n,t.length)}};function we(e,t=""){const a=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),i=n%60;return i===0?a+String(s):a+String(s)+t+p(i,2)}function ye(e,t){return e%60===0?(e>0?"-":"+")+p(Math.abs(e)/60,2):T(e,t)}function T(e,t=""){const a=e>0?"-":"+",n=Math.abs(e),s=p(Math.trunc(n/60),2),i=p(n%60,2);return a+s+t+i}const be=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},nt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ja=(e,t)=>{const a=e.match(/(P+)(p+)?/)||[],n=a[1],s=a[2];if(!s)return be(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",be(n,t)).replace("{{time}}",nt(s,t))},Za={p:nt,P:Ja},Ka=/^D+$/,er=/^Y+$/,tr=["D","DD","YY","YYYY"];function ar(e){return Ka.test(e)}function rr(e){return er.test(e)}function nr(e,t,a){const n=sr(e,t,a);if(console.warn(n),tr.includes(e))throw new RangeError(n)}function sr(e,t,a){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ir=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,or=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cr=/^'([^]*?)'?$/,lr=/''/g,dr=/[a-zA-Z]/;function ur(e,t,a){var x,b,v,g;const n=K(),s=n.locale??Xa,i=n.firstWeekContainsDate??((b=(x=n.locale)==null?void 0:x.options)==null?void 0:b.firstWeekContainsDate)??1,c=n.weekStartsOn??((g=(v=n.locale)==null?void 0:v.options)==null?void 0:g.weekStartsOn)??0,d=D(e);if(!ma(d))throw new RangeError("Invalid time value");let h=t.match(or).map(f=>{const w=f[0];if(w==="p"||w==="P"){const j=Za[w];return j(f,s.formatLong)}return f}).join("").match(ir).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const w=f[0];if(w==="'")return{isToken:!1,value:mr(f)};if(xe[w])return{isToken:!0,value:f};if(w.match(dr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(h=s.localize.preprocessor(d,h));const u={firstWeekContainsDate:i,weekStartsOn:c,locale:s};return h.map(f=>{if(!f.isToken)return f.value;const w=f.value;(rr(w)||ar(w))&&nr(w,t,String(e));const j=xe[w[0]];return j(d,w,s.localize,u)}).join("")}function mr(e){const t=e.match(cr);return t?t[1].replace(lr,"'"):e}const hr=Rt({occasion:J().trim().min(1,"Occasion is required").max(100),reminder_date:J().min(1,"Date is required"),recipient_name:J().trim().min(1,"Recipient name is required").max(100),recipient_email:J().trim().email("Invalid email address").max(255)}),fr=({userId:e})=>{const[t,a]=l.useState([]),[n,s]=l.useState(!1),[i,c]=l.useState(!1),{toast:d}=ut(),[h,u]=l.useState({occasion:"",reminder_date:"",recipient_name:"",recipient_email:""}),x=async()=>{const{data:g,error:f}=await P.from("occasion_reminders").select("*").eq("user_id",e).order("reminder_date",{ascending:!0});if(f){d({title:"Error",description:"Failed to load reminders",variant:"destructive"});return}a(g||[])};l.useEffect(()=>{x()},[e]);const b=async g=>{g.preventDefault(),c(!0);try{const f=hr.parse(h),{error:w}=await P.from("occasion_reminders").insert({user_id:e,occasion:f.occasion,reminder_date:f.reminder_date,recipient_name:f.recipient_name,recipient_email:f.recipient_email});if(w)throw w;d({title:"Success",description:"Reminder created successfully"}),u({occasion:"",reminder_date:"",recipient_name:"",recipient_email:""}),s(!1),x()}catch(f){f instanceof Ft?d({title:"Validation Error",description:f.errors[0].message,variant:"destructive"}):d({title:"Error",description:"Failed to create reminder",variant:"destructive"})}finally{c(!1)}},v=async g=>{const{error:f}=await P.from("occasion_reminders").delete().eq("id",g);if(f){d({title:"Error",description:"Failed to delete reminder",variant:"destructive"});return}d({title:"Success",description:"Reminder deleted"}),x()};return r.jsxs(R,{children:[r.jsx(se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(ie,{className:"flex items-center gap-2",children:[r.jsx(Mt,{className:"h-5 w-5"}),"Occasion Reminders"]}),r.jsx(ht,{children:"Set email reminders for upcoming occasions"})]}),r.jsxs(jt,{open:n,onOpenChange:s,children:[r.jsx(Nt,{asChild:!0,children:r.jsxs(y,{size:"sm",children:[r.jsx(Se,{className:"h-4 w-4 mr-2"}),"Add Reminder"]})}),r.jsxs(Ct,{children:[r.jsxs(Dt,{children:[r.jsx(_t,{children:"Create Occasion Reminder"}),r.jsx(St,{children:"Set up an email reminder for an upcoming occasion"})]}),r.jsxs("form",{onSubmit:b,children:[r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx(U,{htmlFor:"occasion",children:"Occasion"}),r.jsx(H,{id:"occasion",placeholder:"e.g., Birthday, Anniversary",value:h.occasion,onChange:g=>u({...h,occasion:g.target.value}),required:!0,maxLength:100})]}),r.jsxs("div",{children:[r.jsx(U,{htmlFor:"reminder_date",children:"Reminder Date"}),r.jsx(H,{id:"reminder_date",type:"date",value:h.reminder_date,onChange:g=>u({...h,reminder_date:g.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(U,{htmlFor:"recipient_name",children:"Recipient Name"}),r.jsx(H,{id:"recipient_name",placeholder:"Who is this card for?",value:h.recipient_name,onChange:g=>u({...h,recipient_name:g.target.value}),required:!0,maxLength:100})]}),r.jsxs("div",{children:[r.jsx(U,{htmlFor:"recipient_email",children:"Your Email"}),r.jsx(H,{id:"recipient_email",type:"email",placeholder:"recipient@example.com",value:h.recipient_email,onChange:g=>u({...h,recipient_email:g.target.value}),required:!0,maxLength:255})]})]}),r.jsx(kt,{children:r.jsx(y,{type:"submit",disabled:i,children:i?"Creating...":"Create Reminder"})})]})]})]})]})}),r.jsx(F,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(de,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No reminders set yet"}),r.jsx("p",{className:"text-sm",children:"Create your first occasion reminder"})]}):r.jsx("div",{className:"space-y-3",children:t.map(g=>r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h4",{className:"font-semibold",children:g.occasion}),g.sent&&r.jsx("span",{className:"text-xs bg-green-100 text-green-800 px-2 py-1 rounded",children:"Sent"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(de,{className:"h-3 w-3"}),ur(new Date(g.reminder_date),"PPP")]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Tt,{className:"h-3 w-3"}),g.recipient_name," (",g.recipient_email,")"]})]})]}),r.jsx(y,{variant:"ghost",size:"sm",onClick:()=>v(g.id),children:r.jsx(_e,{className:"h-4 w-4"})})]},g.id))})})]})},ae="https://lionpost-card-studio.lovable.app";function gr(){const{user:e}=Ne(),[t,a]=l.useState(0),[n,s]=l.useState(0),[i,c]=l.useState(""),[d,h]=l.useState(""),[u,x]=l.useState(!1),[b,v]=l.useState(!1),[g,f]=l.useState(!1),w=`I rated LionPost ${"⭐".repeat(t)} (${t}/5)! ${i} Try it: ${ae}`,j=t>0,L=async()=>{var M,I;if(!e||!j)return;const N=d.trim()||((I=(M=e.user_metadata)==null?void 0:M.full_name)==null?void 0:I.split(" ")[0])||"Anonymous";f(!0);try{const{error:V}=await P.from("reviews").insert({user_id:e.id,display_name:N.slice(0,50),rating:t,review_text:i.slice(0,280)});if(V)throw V;v(!0),C.success("Review submitted! It will appear on our homepage once approved. 🎉")}catch{C.error("Failed to submit review. Please try again.")}finally{f(!1)}},E=()=>{window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(w)}`,"_blank")},_=()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ae)}"e=${encodeURIComponent(w)}`,"_blank")},q=()=>{window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(ae)}`,"_blank")},ee=()=>{navigator.clipboard.writeText(w),C.success("Review copied! Opening TikTok..."),window.open("https://www.tiktok.com/upload","_blank")},X=()=>{navigator.clipboard.writeText(w),C.success("Review copied! Paste it in your Instagram post or story."),window.open("https://www.instagram.com/","_blank")},Q=async()=>{await navigator.clipboard.writeText(w),x(!0),C.success("Review copied to clipboard!"),setTimeout(()=>x(!1),2e3)};return b?r.jsx(R,{className:"border-2",children:r.jsxs(F,{className:"py-8 text-center space-y-3",children:[r.jsx("div",{className:"text-4xl",children:"🎉"}),r.jsx("h3",{className:"font-semibold text-lg",children:"Thank you for your review!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your review will appear on our homepage once approved. Share it on social media too!"}),r.jsxs("div",{className:"flex flex-wrap gap-2 justify-center pt-2",children:[r.jsxs(y,{size:"sm",onClick:E,variant:"outline",children:[r.jsx(ue,{className:"w-4 h-4 mr-1"})," X / Twitter"]}),r.jsxs(y,{size:"sm",onClick:_,variant:"outline",children:[r.jsx(me,{className:"w-4 h-4 mr-1"})," Facebook"]}),r.jsxs(y,{size:"sm",onClick:X,variant:"outline",children:[r.jsx(ce,{className:"w-4 h-4 mr-1"})," Instagram"]}),r.jsxs(y,{size:"sm",onClick:Q,variant:"outline",children:[u?r.jsx(he,{className:"w-4 h-4 mr-1"}):r.jsx(re,{className:"w-4 h-4 mr-1"}),u?"Copied!":"Copy"]})]})]})}):r.jsxs(R,{className:"border-2",children:[r.jsx(se,{children:r.jsxs(ie,{className:"flex items-center gap-2",children:[r.jsx(le,{className:"w-5 h-5 text-yellow-500 fill-yellow-500"}),"Leave a Review"]})}),r.jsxs(F,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Love LionPost? Rate us and share your experience on social media!"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(N=>r.jsx("button",{type:"button",onClick:()=>a(N),onMouseEnter:()=>s(N),onMouseLeave:()=>s(0),className:"transition-transform hover:scale-110",children:r.jsx(le,{className:`w-8 h-8 transition-colors ${N<=(n||t)?"text-yellow-500 fill-yellow-500":"text-muted-foreground/30"}`})},N))}),r.jsx(H,{placeholder:"Your name (shown with your review)",value:d,onChange:N=>h(N.target.value.slice(0,50)),maxLength:50,className:"text-sm"}),r.jsx(Yt,{placeholder:"Write a short review (optional, max 280 characters)...",value:i,onChange:N=>c(N.target.value.slice(0,280)),maxLength:280,rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[i.length,"/280"]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(y,{size:"sm",onClick:L,disabled:!j||g,className:"bg-primary",children:[r.jsx(qt,{className:"w-4 h-4 mr-1"})," ",g?"Submitting...":"Submit Review"]}),r.jsxs(y,{size:"sm",onClick:E,disabled:!j,variant:"outline",children:[r.jsx(ue,{className:"w-4 h-4 mr-1"})," X / Twitter"]}),r.jsxs(y,{size:"sm",onClick:_,disabled:!j,variant:"outline",children:[r.jsx(me,{className:"w-4 h-4 mr-1"})," Facebook"]}),r.jsxs(y,{size:"sm",onClick:X,disabled:!j,variant:"outline",children:[r.jsx(ce,{className:"w-4 h-4 mr-1"})," Instagram"]}),r.jsxs(y,{size:"sm",onClick:ee,disabled:!j,variant:"outline",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-2.88 2.5 2.89 2.89 0 0 1 0-5.78 2.92 2.92 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 3 15.57 6.33 6.33 0 0 0 9.37 22a6.33 6.33 0 0 0 6.33-6.33V9.18a8.16 8.16 0 0 0 3.89.98V6.69Z"})}),"TikTok"]}),r.jsxs(y,{size:"sm",onClick:q,disabled:!j,variant:"outline",children:[r.jsx(Lt,{className:"w-4 h-4 mr-1"})," LinkedIn"]}),r.jsxs(y,{size:"sm",onClick:Q,disabled:!j,variant:"outline",children:[u?r.jsx(he,{className:"w-4 h-4 mr-1"}):r.jsx(re,{className:"w-4 h-4 mr-1"}),u?"Copied!":"Copy"]})]})]})]})}function zr(){const{user:e,subscription:t,signOut:a,refreshSubscription:n}=Ne(),{openCustomerPortal:s,loading:i}=At(),[c,d]=l.useState([]),[h,u]=l.useState(!0),[x,b]=l.useState("all"),[v,g]=l.useState("all"),[f,w]=l.useState(1),[j,L]=l.useState(!1),E=12,_=mt();if(l.useEffect(()=>{if(!e){_("/auth?signup=true");return}q()},[e,_]),l.useEffect(()=>{new URLSearchParams(window.location.search).get("session_id")&&n().then(()=>C.success("Subscription updated!")).catch(G=>{console.error("Failed to refresh subscription after checkout:",G),C.error("Could not verify subscription yet. Please try again.")}).finally(()=>{_("/dashboard",{replace:!0})})},[n,_]),!e)return null;const q=async()=>{try{const{data:o,error:m}=await P.from("cards").select("id, title, image_url, text_content, theme, created_at, is_anonymous, recipient_phone, sms_sent_at, sms_status").eq("user_id",e.id).order("created_at",{ascending:!1});if(m)throw m;d(o||[])}catch(o){console.error("Error loading cards:",o),C.error("Failed to load cards")}finally{u(!1)}},ee=o=>o?`+****...${o.slice(-4)}`:"",X=o=>{if(!o)return null;switch(o.toLowerCase()){case"delivered":case"sent":return r.jsx(Ht,{className:"w-4 h-4 text-green-500"});case"failed":case"undelivered":return r.jsx(zt,{className:"w-4 h-4 text-red-500"});case"queued":case"sending":return r.jsx($t,{className:"w-4 h-4 text-yellow-500"});default:return r.jsx(It,{className:"w-4 h-4 text-blue-500"})}},Q=o=>o?o.charAt(0).toUpperCase()+o.slice(1):"",N=c.filter(o=>!(x==="anonymous"&&!o.is_anonymous||x==="normal"&&o.is_anonymous||v!=="all"&&(!o.sms_status||v==="sent"&&!["sent","queued","sending","delivered"].includes(o.sms_status.toLowerCase())||v==="failed"&&!["failed","undelivered"].includes(o.sms_status.toLowerCase())))),M=Math.ceil(N.length/E),I=(f-1)*E,V=N.slice(I,I+E);l.useEffect(()=>{w(1)},[x,v]);const st=!!(t!=null&&t.subscribed),it=async o=>{try{const{error:m}=await P.from("cards").delete().eq("id",o);if(m)throw m;C.success("Card deleted successfully"),q()}catch(m){console.error("Error deleting card:",m),C.error("Failed to delete card")}},ot=async o=>{try{const{data:m,error:G}=await P.from("cards").select("*").eq("id",o).single();if(G||!m)throw G||new Error("Card not found");const{error:oe}=await P.from("cards").insert({user_id:e.id,title:m.title?`${m.title} (Copy)`:"Untitled Card (Copy)",image_url:m.image_url,text_content:m.text_content,theme:m.theme,text_style:m.text_style,background_style:m.background_style,text_bold:m.text_bold,front_text_bold:m.front_text_bold,text_size:m.text_size,text_font:m.text_font,audio_url:m.audio_url,is_anonymous:m.is_anonymous,times_shared:0,times_downloaded:0,recipient_phone:null,sms_status:null,sms_sent_at:null});if(oe)throw oe;C.success("Card duplicated successfully"),q()}catch(m){console.error("Error duplicating card:",m),C.error("Failed to duplicate card")}};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-primary/5 to-accent/5",children:[r.jsx("header",{className:"border-b bg-white/80 backdrop-blur-sm sticky top-0 z-10",children:r.jsxs("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>_("/"),children:[r.jsx("img",{src:Ot,alt:"LionPost",className:"w-12 h-12 rounded-full border-2 border-primary"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-primary",children:"LionPost"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Unlimited digital greetings cards for every occasion"})]})]}),r.jsxs(y,{variant:"outline",onClick:a,children:[r.jsx(Bt,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]})}),r.jsxs("main",{className:"container mx-auto px-4 py-8",children:[r.jsx("div",{className:"mb-8",children:st?r.jsxs(y,{size:"lg",onClick:()=>_("/editor"),className:"w-full sm:w-auto",children:[r.jsx(Se,{className:"w-5 h-5 mr-2"}),"Create New Card"]}):r.jsxs(y,{size:"lg",onClick:()=>L(!0),variant:"outline",className:"w-full sm:w-auto opacity-60 cursor-pointer",children:[r.jsx(Et,{className:"w-5 h-5 mr-2"}),"Create New Card"]})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-4",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Your Cards"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("select",{value:x,onChange:o=>b(o.target.value),className:"px-3 py-2 rounded-md border border-input bg-background text-sm",children:[r.jsx("option",{value:"all",children:"All Cards"}),r.jsx("option",{value:"anonymous",children:"Anonymous Only"}),r.jsx("option",{value:"normal",children:"Normal Only"})]}),r.jsxs("select",{value:v,onChange:o=>g(o.target.value),className:"px-3 py-2 rounded-md border border-input bg-background text-sm",children:[r.jsx("option",{value:"all",children:"All SMS Status"}),r.jsx("option",{value:"sent",children:"Sent"}),r.jsx("option",{value:"failed",children:"Failed"})]})]})]}),h?r.jsx("p",{children:"Loading cards..."}):N.length===0?r.jsx(R,{children:r.jsxs(F,{className:"py-12 text-center",children:[r.jsx(fe,{className:"w-16 h-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:c.length===0?"No cards yet":"No cards match your filters"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:c.length===0?"Create your first card to get started!":"Try adjusting your filters"})]})}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map(o=>r.jsxs(R,{className:"cursor-pointer hover:shadow-lg transition-shadow relative group",onClick:()=>_(`/editor/${o.id}`),children:[r.jsxs(F,{className:"p-4",children:[o.image_url?r.jsx("div",{className:"aspect-video bg-muted rounded mb-2 overflow-hidden",children:r.jsx("img",{src:o.image_url,alt:o.title||"Card",className:"w-full h-full object-cover",loading:"lazy"})}):r.jsx("div",{className:"aspect-video rounded mb-2 overflow-hidden bg-gradient-to-br from-primary/20 to-accent/30 flex items-center justify-center p-4",children:o.text_content?r.jsxs("p",{className:"text-sm text-foreground/70 text-center line-clamp-4 italic",children:['"',o.text_content,'"']}):r.jsx(fe,{className:"w-10 h-10 text-muted-foreground/40"})}),r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsx("h3",{className:"font-semibold truncate flex-1",children:o.title||"Untitled Card"}),o.is_anonymous&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-2 py-1 rounded-full shrink-0",children:"Anonymous"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(o.created_at).toLocaleDateString()}),o.text_content&&r.jsx("p",{className:"text-sm mt-2 truncate",children:o.text_content}),o.sms_status&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[X(o.sms_status),r.jsx("span",{className:"font-medium",children:Q(o.sms_status)})]}),o.recipient_phone&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["To: ",ee(o.recipient_phone)]}),o.sms_sent_at&&r.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(o.sms_sent_at).toLocaleString()})]})]}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(y,{variant:"secondary",size:"icon",className:"h-8 w-8",onClick:m=>{m.stopPropagation(),ot(o.id)},title:"Duplicate card",children:r.jsx(re,{className:"w-4 h-4"})}),r.jsxs(na,{children:[r.jsx(sa,{asChild:!0,children:r.jsx(y,{variant:"destructive",size:"icon",className:"h-8 w-8",onClick:m=>m.stopPropagation(),children:r.jsx(_e,{className:"w-4 h-4"})})}),r.jsxs(Ve,{onClick:m=>m.stopPropagation(),children:[r.jsxs(Ge,{children:[r.jsx(Je,{children:"Delete Card"}),r.jsxs(Ze,{children:['Are you sure you want to delete "',o.title||"Untitled Card",'"? This action cannot be undone.']})]}),r.jsxs(Ue,{children:[r.jsx(et,{children:"Cancel"}),r.jsx(Ke,{onClick:m=>{m.stopPropagation(),it(o.id)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]},o.id))}),M>1&&r.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6",children:[r.jsx(y,{variant:"outline",size:"sm",onClick:()=>w(o=>Math.max(1,o-1)),disabled:f===1,children:"Previous"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",f," of ",M]}),r.jsx(y,{variant:"outline",size:"sm",onClick:()=>w(o=>Math.min(M,o+1)),disabled:f===M,children:"Next"})]})]})]}),r.jsx("div",{className:"mt-8",children:r.jsx(gr,{})}),r.jsx("div",{className:"mt-8",children:r.jsx(fr,{userId:e.id})}),r.jsxs(R,{className:"mt-4 border-2",children:[r.jsx(se,{children:r.jsxs(ie,{className:"flex items-center gap-2",children:[r.jsx(Wt,{className:"w-5 h-5"}),"Subscription Status"]})}),r.jsx(F,{children:t!=null&&t.subscribed?r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-lg font-semibold text-green-600",children:"Premium - Unlimited Cards"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Cards created: ",t.cardsCreated]}),t.subscriptionEnd&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Renews: ",new Date(t.subscriptionEnd).toLocaleDateString()]}),r.jsx(y,{variant:"outline",size:"sm",onClick:s,disabled:i,className:"w-full sm:w-auto mt-2",children:i?"Loading...":"Manage Subscription"})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-lg font-semibold",children:"No Active Subscription"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribe to create and share unlimited cards"})]}),r.jsx(y,{onClick:()=>L(!0),className:"w-full sm:w-auto",children:"Upgrade to Premium"})]})})]})]}),r.jsx(Pt,{open:j,onOpenChange:L,defaultYearly:!1})]})}export{zr as default};