1import{j as e}from"./vendor-tanstack-_NmhRw_9.js";import{r as a,u as G}from"./vendor-react-CrIuOpVI.js";import{s as C,au as S,aV as K,bl as v,bm as $,bn as V,bo as q}from"./index-DjaHTvW6.js";import{u as J,C as P}from"./CopyBlock-DvThwIIv.js";import{M as U}from"./MCPConnectBanner-DlcILbhu.js";import{G as Q}from"./GuidesConnectAIBanner-BEyU-zlj.js";import{G as X}from"./landingPieces-OIgj6RMN.js";import{u as Z,C as T,i as B}from"./useCaptcha-DBzc44n1.js";import"./index-udQ19Zbk.js";import"./lightbulb-fuB61zGE.js";function ee(){const[r,t]=a.useState(0),[o]=a.useState(null),[i,n]=a.useState(!0);return a.useEffect(()=>{async function l(){const d=await C.from("pearls").select("*",{count:"exact",head:!0});!d.error&&d.count!==null&&t(d.count),n(!1)}l()},[]),{count:r,loading:i,percentileRank:o}}const z="wr-harvest-banner-dismissed",w=5;function te({forceShow:r}={}){const{count:t,loading:o}=ee(),{bySlug:i,loading:n}=J(),l=G(),[d,c]=a.useState(()=>localStorage.getItem(z)==="true"),[b,m]=a.useState(!1);a.useEffect(()=>{t>=w&&!d&&m(!0)},[t,d]);function u(){localStorage.setItem(z,"true"),c(!0)}if(!r&&(o||n||d))return null;if(b)return e.jsx("div",{className:"glass rounded-xl p-5 mb-6 border border-green-500/30 bg-green-500/5 shadow-[0_0_20px_rgba(34,197,94,0.08)]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-base font-semibold text-text-high",children:[t," Pearls and counting!"]}),e.jsxs("p",{className:"text-sm text-text-muted mt-1",children:["You're building real knowledge. Your extraction prompts are always available on the"," ",e.jsx("button",{onClick:()=>l("/settings"),className:"text-primary-400 hover:text-primary-300 underline",children:"Prompts page"}),"."]})]}),e.jsx("button",{onClick:u,className:"text-text-subtle hover:text-text-muted text-sm px-3 py-1",children:"Got it"})]})});const s=i("extract-decisions"),g=i("extract-projects");return e.jsxs("div",{className:"glass rounded-xl p-5 mb-6 border border-primary-500/25 bg-primary-500/[0.04] shadow-[0_0_24px_rgba(107,127,255,0.1)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-text-high",children:"Grow Your Knowledge Base"}),e.jsxs("p",{className:"text-sm text-text-muted mt-1",children:["You have ",t," of ",w," Pearls. Extract more from your previous AI to make Wisdom Recall smarter."]})]}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:w}).map((p,x)=>e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${x<t?"bg-primary-500":"bg-[var(--overlay-medium)]"}`},x))})]}),e.jsxs("div",{className:"space-y-4 mt-4",children:[s&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-base mb-2",children:s.name}),e.jsx(P,{text:s.content})]}),g&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-base mb-2",children:g.name}),e.jsx(P,{text:g.content})]})]}),e.jsx("div",{className:"mt-4 text-right",children:e.jsx("button",{onClick:()=>l("/settings"),className:"text-sm text-primary-400 hover:text-primary-300 font-medium",children:"See All Prompts"})})]})}const re="wr_onboarding_state_v2",D="wr_onboarding_dismissed",ne=4;function se({forceShow:r}={}){const t=G(),[o,i]=a.useState(!1);if(a.useEffect(()=>{try{if(localStorage.getItem(D)==="1")return;const d=localStorage.getItem(re);if(!d)return;const c=JSON.parse(d);c!=null&&c.step&&c.step<ne&&(i(!0),S("resume_banner_shown",{step:c.step}))}catch{}},[]),!r&&!o)return null;const n=()=>{S("resume_banner_clicked",{}),t("/onboarding")},l=()=>{S("resume_banner_dismissed",{});try{localStorage.setItem(D,"1")}catch{}i(!1)};return e.jsxs("div",{className:"mb-4 rounded-xl px-4 py-3 flex items-center justify-between gap-3 bg-[var(--overlay-subtle)] border border-[var(--border-subtle)]",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-[rgba(var(--color-interactive-rgb),0.15)] border border-[rgba(var(--color-interactive-rgb),0.3)] flex-shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-interactive)",
1strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-high",children:"Pick up where you left off"}),e.jsx("div",{className:"text-xs text-text-muted truncate",children:"Finish onboarding to get the most out of Wisdom Recall."})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:n,className:"text-sm font-medium px-3 py-1.5 rounded-full bg-[var(--color-interactive)] text-white hover:brightness-90 transition-all",children:"Continue"}),e.jsx("button",{onClick:l,className:"text-text-muted hover:text-text-high transition-colors","aria-label":"Dismiss",title:"Dismiss",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}const W="wr-share-v2-banner-dismissed";function oe({returnTo:r,message:t="Save this Pearl to use it with AI",forceShow:o}={}){const[i,n]=a.useState(!1),[l,d]=a.useState(!1),[c,b]=a.useState(""),[m,u]=a.useState(null),[s,g]=a.useState(!1),[p,x]=a.useState(null),{captchaToken:j,resetCaptcha:E,captchaProps:O}=Z();if(a.useEffect(()=>{try{sessionStorage.getItem(W)==="1"&&n(!0)}catch{}},[]),!o&&i)return null;const R=r??(typeof window<"u"?window.location.pathname+window.location.search:"/"),A=`${typeof window<"u"?`${window.location.origin}/auth/callback`:""}?next=${encodeURIComponent(R)}`;function I(){try{localStorage.setItem("auth_return_to",R)}catch{}}function Y(){try{sessionStorage.setItem(W,"1")}catch{}n(!0)}async function F(){x(null),u("google"),I();try{const{error:h}=await C.auth.signInWithOAuth({provider:"google",options:{redirectTo:A,captchaToken:j??void 0}});if(h)throw h}catch(h){E(),x(B(h)?T:h instanceof Error?h.message:"Could not start Google sign-in."),u(null)}}async function H(h){h.preventDefault();const _=c.trim();if(!_){x("Enter your email.");return}x(null),u("email"),I();try{const{error:f}=await C.auth.signInWithOtp({email:_,options:{emailRedirectTo:A,captchaToken:j??void 0}});if(f)throw f;g(!0),u(null)}catch(f){E(),x(B(f)?T:f instanceof Error?f.message:"Could not send magic link."),u(null)}}return e.jsxs("div",{role:"region","aria-label":"Save this Pearl",className:"glass",style:{position:"sticky",top:0,zIndex:40,width:"100%",borderRadius:0,borderLeft:"none",borderRight:"none",borderTop:"none",padding:"10px 16px",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsx("span",{"data-ph-mask":!0,style:{fontSize:"0.9rem",fontWeight:500,color:"var(--color-text-high)",flex:"1 1 240px",minWidth:0},children:s?`Magic link sent to ${c}. Check your inbox.`:t}),!s&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx(K,{siteKey:"0x4AAAAAADuO8c5B48ifu49P",...O}),e.jsxs("button",{type:"button",className:"slv2-google-btn",onClick:F,disabled:m!==null||!j,style:{padding:"6px 12px",fontSize:"0.85rem"},children:[e.jsx("span",{className:"slv2-google-chip","aria-hidden":"true",children:e.jsx(X,{size:11})}),m==="google"?"Connectingâ¦":"Continue with Google"]}),l?e.jsxs("form",{onSubmit:H,style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("input",{"data-ph-mask":!0,type:"email",required:!0,autoFocus:!0,placeholder:"[email protected]",value:c,onChange:h=>b(h.target.value),disabled:m==="email",autoComplete:"email",style:{padding:"6px 10px",borderRadius:6,border:"1px solid var(--border-light)",background:"var(--color-surface)",color:"var(--color-text-high)",fontSize:"0.85rem",minWidth:200}}),e.jsx("button",{type:"submit",disabled:m==="email"||!j,style:{padding:"6px 12px",borderRadius:6,border:"1px solid var(--border-light)",background:"transparent",color:"var(--color-text-high)",fontSize:"0.85rem",fontWeight:600,cursor:m==="email"?"wait":"pointer"},children:m==="email"?"Sendingâ¦":"Send"})]}):e.jsx("button",{type:"button",onClick:()=>d(!0),style:{background:"transparent",border:"1px solid var(--border-light)",color:"var(--color-text-high)",fontSize:"0.85rem",fontWeight:500,padding:"6px 12px",borderRadius:8,cursor:"pointer"},children:"Email magic link"})]}),e.jsx("button",{type:"button",onClick:Y,"aria-label":"Dismiss",title:"Dismiss",style:{background:"transparent",border:"none",color:"var(--color-text-muted)",cursor:"pointer",padding:4,marginLeft:4,fontSize:"1.1rem",lineHeight:1},children:"Ã"}),p&&e.jsx("p",{role:"alert",style:{margin:0,width:"100%",fontSize:"0.78rem",color:"var(--color-danger)"},children:p})]})}const y=[{id:"lifecycle-past-due",label:"Lifecycle â past_due",where:"shell",component:v,extraProps:{forceStatus:"past_due"},notes:"Frozen â payment failed and Smart Retries in flight or exhausted."},{id:"lifecycle-unpaid",label:"Lifecycle â unpaid",where:"shell",component:v,extraProps:{forceStatus:"unpaid"},notes:"Frozen â Stripe gave up retrying; sub alive but billing paused."},{id:"lifecycle-incomplete",label:"Lifecycle â incomplete",where:"shell",component:v,extraProps:{forceStatus:"incomplete"},notes:"Checkout collected card but first payment did not finish (e.g. 3DS dropped)."},{id:"lifecycle-incomplete-expired",label:"Lifecycle â incomplete_expired",where:"shell",component:v,extraProps:{forceStatus:"incomplete_expired"},notes:"Incomplete + 23h passed; Stripe marked the subscription dead."},{id:"lifecycle-canceled",label:"Lifecycle â canceled",where:"shell",component:v,extraProps:{forceStatus:"canceled"},notes:"Sub ended. Temporary banner â will be removed once Free-Reader tier ships."},{id:"cap-exceeded",label:"Cap Exceeded",where:"shell",component:$,notes:"Monthly AI budget hit; lives in app shell above sidebar."}
1,{id:"deletion-pending",label:"Deletion Pending",where:"shell",component:V,notes:"Account scheduled for deletion; 30-day grace window."},{id:"mcp-connect",label:"MCP Connect",where:"dashboard",component:U,notes:"Dashboard nudge for users with no AI connection yet."},{id:"guides-connect-ai",label:"Guides v2 â Connect AI",where:"dashboard",component:Q,notes:"Top-of-page CTA on /guides. Constant until user has an AI connection â no dismiss."},{id:"harvest",label:"Harvest",where:"dashboard",component:te,notes:"Grow-your-knowledge-base prompt; reaches celebration at 5 pearls."},{id:"onboarding-resume",label:"Onboarding Resume",where:"dashboard",component:se,notes:"Resume incomplete onboarding flow; localStorage gated."},{id:"share-signin",label:"Share Sign-In",where:"share",component:oe,extraProps:{returnTo:"/share/example-pearl-id",message:"Save this Pearl to use it with AI"},notes:"Sticky banner on the share-v2 landing page."}];function ae({dashboardBanners:r}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading",style:{fontSize:"1.5rem",fontWeight:600,color:"var(--color-text-high)",margin:0},children:"Good morning, Dylan"}),e.jsx("p",{style:{fontSize:"0.875rem",color:"var(--color-text-muted)",marginTop:4},children:"Mock dashboard for banner preview. No live data."})]}),e.jsx("button",{type:"button",disabled:!0,className:"font-heading",style:{background:"var(--color-interactive)",color:"var(--brand-accent-on)",border:"none",borderRadius:8,padding:"8px 16px",fontSize:"0.875rem",fontWeight:600,cursor:"not-allowed",opacity:.85},children:"+ Create New Pearl"})]}),r,e.jsx("div",{className:"mb-6",style:{background:"var(--glass-bg)",border:"1px solid var(--glass-border)",borderRadius:12,padding:"14px 16px"},children:e.jsxs("div",{className:"flex items-center justify-between",style:{color:"var(--color-text-base)"},children:[e.jsx("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Setup score: 3 / 5"}),e.jsx("span",{style:{fontSize:"0.75rem",color:"var(--color-text-muted)"},children:"Expand"})]})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16,marginBottom:24},children:[e.jsx(L,{label:"Total Pearls",value:"42"}),e.jsx(L,{label:"This Week",value:"7"})]}),e.jsx(k,{title:"Activity",height:120}),e.jsx(k,{title:"Pearl Map",height:200}),e.jsx(k,{title:"Connected AIs",height:100})]})}function L({label:r,value:t}){return e.jsxs("div",{style:{background:"var(--glass-bg)",border:"1px solid var(--glass-border)",borderRadius:12,padding:16},children:[e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--color-text-muted)",textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),e.jsx("div",{className:"font-heading",style:{fontSize:"1.75rem",fontWeight:600,color:"var(--color-text-high)",marginTop:4},children:t})]})}function k({title:r,height:t}){return e.jsxs("div",{className:"mb-6",style:{background:"var(--glass-bg)",border:"1px solid var(--glass-border)",borderRadius:12,padding:16},children:[e.jsx("div",{style:{fontSize:"0.8125rem",fontWeight:500,color:"var(--color-text-base)",marginBottom:8},children:r}),e.jsx("div",{style:{height:t,borderRadius:8,background:"repeating-linear-gradient(45deg, var(--overlay-subtle) 0 6px, transparent 6px 12px)",opacity:.5}})]})}function ie({enabled:r,onToggle:t,onAllOn:o,onAllOff:i}){return e.jsxs("div",{className:"mb-6",style:{background:"var(--glass-bg)",border:"1px solid var(--glass-border)",borderRadius:12,padding:16},children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-heading",style:{fontSize:"0.875rem",fontWeight:600,color:"var(--color-text-high)"},children:"Banners Lab"}),e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--color-text-muted)",marginTop:2},children:"Toggle banners on/off. Each renders at its real mount slot."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:o,className:"font-heading",style:M,children:"All on"}),e.jsx("button",{type:"button",onClick:i,className:"font-heading",style:M,children:"All off"})]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:y.map(n=>{const l=r.has(n.id);return e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",style:{padding:8,borderRadius:8,background:l?"var(--overlay-soft, rgba(255,255,255,0.04))":"transparent",border:"1px solid",borderColor:l?"var(--glass-border)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:l,onChange:()=>t(n.id),style:{marginTop:3,accentColor:"var(--color-interactive)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:"0.8125rem",color:"var(--color-text-high)"},children:[e.jsx("span",{style:{fontWeight:500},children:n.label}),e.jsx("span",{style:{fontSize:"0.6875rem",color:"var(--color-text-muted)",padding:"1px 6px",borderRadius:4,background:"var(--overlay-soft, rgba(255,255,255,0.04))",border:"1px solid var(--border-subtle)",textTransform:"uppercase",letterSpacing:"0.04em"},children:n.where})]}),n.notes&&e.jsx("div",{style:{fontSize:"0.6875rem",color:"var(--color-text-muted)",marginTop:2},children:n.notes})]})]},n.id)})})]})}const M={fontSize:"0.6875rem",fontWeight:600,padding:"4px 10px",borderRadius:6,background:"transparent",border:"1px solid var(--border-medium)",color:"var(--color-text-base)",cursor:"pointer",textTransform:"uppercase",letterSpacing:"0.04em"};function N(r,t){return r.filter(o=>t.has(o.id)).map(o=>{const i=o.component,n={forceShow:!0,...o.extraProps??{}};return e.jsx(i,{...n},o.id)})}function ve(){const[r,t]=a.useState(()=>new Set),o=s=>{t(g=>{const p=new Set(g);return p.has(s)?p.delete(s):p.add(s),p})},i=()=>t(new Set(y.map(s=>s.id))),n=()=>t(new Set),l=y.filter(s=>s.where==="shell"),d=y.filter(s=>
1s.where==="dashboard"),c=y.filter(s=>s.where==="share"),b=N(l,r),m=N(d,r),u=N(c,r);return e.jsxs(q,{mockMode:!0,children:[b.length>0&&e.jsx("div",{className:"-mx-4 md:-mx-8 -mt-4 md:-mt-8 mb-6",children:b}),e.jsx(ie,{enabled:r,onToggle:o,onAllOn:i,onAllOff:n}),e.jsx(ae,{dashboardBanners:e.jsx(e.Fragment,{children:m})}),u.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsx("div",{className:"mb-3 font-heading",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--color-text-muted)"},children:"Share landing preview"}),e.jsxs("div",{style:{border:"1px dashed var(--border-medium)",borderRadius:12,overflow:"hidden"},children:[u,e.jsx("div",{style:{padding:32,color:"var(--color-text-muted)",fontSize:"0.875rem"},children:"(Mock share landing page body would render below the sticky banner.)"})]})]})]})}export{ve 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.