1import{j as e}from"./vendor-markdown-BcWX1uEp.js";import{r as i}from"./vendor-react-CvxdUEaJ.js";import{u as P,X as S,i as F,U as k,e as N,f as U}from"./index-BWurHp8h.js";import{L as A}from"./lock-C_I5rtaF.js";import{logAnalyticsEvent as D}from"./firebaseAnalytics-CAnRcUAm.js";import{C as v}from"./circle-alert-D4J143H5.js";import"./firebase-init-BzZZWMhi.js";import"./vendor-firebase-app-BoD0q7fW.js";import"./vendor-firebase-analytics-CVSn4EwJ.js";const L=({isOpen:j,onClose:x,onSuccess:g})=>{const[a,u]=i.useState(""),[r,s]=i.useState(""),[o,p]=i.useState(!1),[h,l]=i.useState(""),[f,n]=i.useState(""),{addPasswordToAccount:c,currentUser:t}=P();if(!j)return null;const w=async d=>{if(d.preventDefault(),l(""),n(""),!a||!r){l("Please enter password in both fields");return}if(a!==r){l("Passwords do not match");return}if(a.length<6){l("Password must be at least 6 characters");return}p(!0);try{await c(a),n("Password added successfully! You can now use the Firefox extension."),setTimeout(()=>{g&&g(),x()},2e3)}catch(b){console.error("Add password error:",b),l(b.message||"Failed to add password. Please try again.")}finally{p(!1)}},y=()=>{u(""),s(""),l(""),n(""),x()};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 relative",children:[e.jsx("button",{onClick:y,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600",disabled:o,children:e.jsx(S,{className:"w-5 h-5"})}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100",children:e.jsx(A,{className:"h-5 w-5 text-blue-600"})}),e.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Add Password"})]}),e.jsx("p",{className:"text-gray-600 ml-13",children:"Add a password to your Google account to use the Firefox extension."})]}),h&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded text-red-700 text-sm",children:h}),f&&e.jsx("div",{className:"mb-4 p-3 bg-green-50 border border-green-200 rounded text-green-700 text-sm",children:f}),e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:t?.email||"",disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50 text-gray-500 cursor-not-allowed"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:a,onChange:d=>u(d.target.value),placeholder:"Enter new password",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:o,required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700 mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:r,onChange:d=>s(d.target.value),placeholder:"Re-enter password",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:o,required:!0})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{type:"button",onClick:y,className:"flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",disabled:o,children:"Cancel"}),e.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",disabled:o,children:o?"Adding Password...":"Add Password"})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded text-sm text-blue-700",children:[e.jsx("strong",{children:"Note:"})," After adding a password, you'll be able to sign in with either Google or email/password."]})]})})},z=({onUpgrade:j,onManageBilling:x})=>{const[g,a]=i.useState(!1),u=i.useRef(!1),{currentUser:r,userStats:s,logout:o,getRemainingFreePages:p,isApproachingLimit:h,hasReachedFreeLimit:l,hasPasswordAuth:f}=P(),n=r&&s?p():0,c=r&&s?h():!1,t=r&&s?l():!1,w=r&&s?!f():!1;if(i.useEffect(()=>{!u.current&&s?.subscriptionStatus==="free"&&(t||c)&&(u.current=!0,D("upgrade_prompt_shown",{prompt_type:t?"limit_reached":"approaching_limit",pages_remaining:n,pages_processed:s?.pagesProcessed||0}))},[t,c,n,s]),!r||!s)return null;const d=(m=>m?(m.seconds?new Date(m.seconds*1e3):new Date(m)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null)(s.currentPeriodEnd),b=s.cancelAtPeriodEnd===!0,C=async()=>{try{await o()}catch(m){console.error("Failed to log out:",m)}};return e.jsxs("div",{className:"rounded-2xl border border-white/40 bg-white/95 p-5 shadow-xl backdrop-blur",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col gap-5 md:flex-row md:items-center md:gap-6",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-[#B85C4A] to-[#D97757] shadow-lg",children:e.jsx(F,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-base font-semibold text-gray-900",children:r.email}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",children:[s.subscriptionStatus==="free"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rounded-full bg-orange-50 px-2 py-0.5 font-medium text-orange-800",children:"Free plan"}),e.jsxs("span",{className:`font-semibold ${t?"text-red-600":c?"text-orange-600":"text-emerald-600"}`,children:[n," pages left"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"rounded-full bg-gradient-to-r from-amber-600 to-orange-500 px-3 py-0.5 text-xs font-semibold text-white",children:["Pro Plan (",s.billingCycle==="annual"?"Annual":"Monthly",")"]}),b&&d&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-orange-200",children:"|"}),e.jsxs("span",{className:"text-gray-600",children:["Access until:"," ",e.jsx("span",{className:"font-semibold text-gray-800",children:d})]}),e.jsx("span",{className:"rounded-full bg-amber-50 px-2 py-0.5 font-semibold text-amber-800 ring-1 ring-amber-200",children:"Set to cancel â won't renew"})]})]}),e.jsx("span",{className:"text-orange-200",children:"|"}),e.jsxs("span",{className:"text-gray-600",children:[e.jsx("span",{className:"font-semibold text-gray-800",children:s.pagesProcessed||0})," pages processed"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-3",children:[s.subscriptionStatus==="free"&&(c||t)&&e.jsxs(k,{onClick:j,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-gradient-to-r from-violet-500 to-purple-600 px-4 py-2 text-xs font-semibold text-white shadow-lg transition-all duration-200 hover:from-violet-600 hover:to-purple-700 hover:shadow-xl sm:w-auto",children:[e.jsx(N,{className:"h-4 w-4"}),e.jsx("span",{children:"Upgrade to Pro"})]}),s.subscriptionStatus==="pro"&&x&&e.jsxs("button",{onClick:x,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-[#B85C4A] hover:bg-[#A04A3A] px-3 py-2 text-xs font-medium text-white transition-colors duration-200 sm:w-auto",title:"Manage subscription and billing",children:[e.jsx(N,{className:"h-4 w-4"}),e.jsx("span",{children:"Manage Billing"})]}),e.jsxs("button",{onClick:C,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-orange-200 px-3 py-2 text-xs font-medium text-gray-600 transition-colors duration-200 hover:bg-orange-50 hover:text-gray-800 sm:w-auto",title:"Sign out",children:[e.jsx(U,{className:"h-4 w-4"}),e.jsx("span",{children:"Sign out"})]})]})]}),w&&e.jsx("div",{className:"rounded-xl border border-blue-200 bg-blue-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(A,{className:"h-4 w-4 text-blue-600 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-blue-800",children:"For Firefox Users"}),e.jsx("p",{className:"mt-1 text-xs text-blue-700",children:"If using the Firefox extension, need to add a password for extension login (Chrome users can ignore this)."})]}),e.jsx("button",{onClick:()=>a(!0),className:"rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white transition-colors hover:bg-blue-700",children:"Add Password"})]})}),s.subscriptionStatus==="free"&&e.jsxs("div",{className:"space-y-3",children:[t&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(v,{className:"h-4 w-4 text-red-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-red-800",children:"Page limit reached"}),e.jsx("p",{className:"mt-1 text-xs text-red-700",children:"You've used all 30 free automation pages. Upgrade to Pro for unlimited automation!"})]})]})}),!t&&c&&e.jsx("div",{className:"rounded-xl border border-orange-200 bg-orange-50 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(v,{className:"h-4 w-4 text-orange-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-orange-800",children:"Approaching page limit"}),e.jsxs("p",{className:"mt-1 text-xs text-orange-700",children:["You have ",n," automation pages remaining. Consider upgrading to Pro for unlimited access."]})]})]})})]})]}),e.jsx(L,{isOpen:g,onClose:()=>a(!1),onSuccess:()=>{console.log("Password added successfully!")}})]})};export{z as default};
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.