PageSourceSearch

https://sharedchat.ai/static/js/417.4febc7d6.chunk.js

js sharedchat.ai collected 2026-10-05 12:40:04 UTC 26,210 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfunctions_core=self.webpackChunkfunctions_core||[]).push([[417],{4417(e,t,s){s.r(t),s.d(t,{default:()=>I});var n=s(7051),a=s(5043),l=s(7899),r=s(5475),i=s(3216),d=s(7812),o=s(6792),c=s(3416),m=s(6284),u=s(1231),x=s(4704),p=s(579);const h={paddingLeft:"calc(1rem + env(safe-area-inset-left, 0px))",paddingRight:"calc(1rem + env(safe-area-inset-right, 0px))",paddingTop:"calc(1rem + env(safe-area-inset-top, 0px))",paddingBottom:"calc(1rem + env(safe-area-inset-bottom, 0px))"},b=["Spam","Harassment","Inappropriate content","Other"];let g=null,y=null;function f(e){let{label:t}=e;return(0,p.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,p.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin shrink-0"}),t]})}function j(e){let{busy:t,busyLabel:s,done:n,doneLabel:a,disabled:l,className:r,onClick:i,children:d}=e;return(0,p.jsx)("button",{type:"button",disabled:l||t||n,className:r,onClick:i,children:t?(0,p.jsx)(f,{label:s}):n?a:d})}function N(e){let{toast:t}=e;return null!==t&&void 0!==t&&t.text?(0,p.jsx)("div",{className:"fixed left-1/2 -translate-x-1/2 z-[70] px-4 py-2.5 rounded-lg text-sm text-white shadow-lg max-w-[90vw] text-center ".concat(t.error?"bg-red-700":"bg-gray-900"),style:{bottom:"calc(1rem + env(safe-area-inset-bottom, 0px))"},children:t.text}):null}function v(e){let{person:t}=e;const s=(0,m.j)(t);return s?(0,p.jsx)("div",{className:"text-xs text-gray-500 truncate",children:s}):null}function k(e){var t;let{person:s,children:n,onOpen:a,request:l=!1}=e;const r=(s.name||"?").slice(0,1).toUpperCase(),i=(0,p.jsxs)(p.Fragment,{children:[s.photoURL?(0,p.jsx)("img",{src:s.photoURL,alt:"",className:"w-10 h-10 rounded-full object-cover shrink-0"}):(0,p.jsx)("div",{className:"w-10 h-10 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-sm font-medium shrink-0",children:r}),(0,p.jsxs)("div",{className:"min-w-0 flex-1 text-left",children:[(0,p.jsxs)("div",{className:"font-medium truncate flex items-center gap-2",children:[(0,p.jsx)("span",{className:"truncate",children:s.name||"Unknown"}),s.isPartner&&(0,p.jsx)("span",{className:"text-[10px] uppercase tracking-wide rounded-full bg-purple-100 text-purple-800 px-2 py-0.5 shrink-0",children:"Partner"}),!s.isPartner&&s.relLabel&&(0,p.jsx)("span",{className:"text-[10px] rounded-full bg-gray-100 text-gray-700 px-2 py-0.5 shrink-0",children:s.relLabel})]}),(0,p.jsx)(v,{person:s}),l&&(0,p.jsx)("div",{className:"text-xs text-blue-600 mt-0.5",children:"Tap to see who it is"}),!l&&!s.isPartner&&!((null===(t=s.picks)||void 0===t?void 0:t.types)||[]).length&&s.pairId&&(0,p.jsx)("button",{type:"button",className:"text-xs text-gray-500 text-left mt-0.5 underline",onClick:e=>{e.stopPropagation(),null===a||void 0===a||a()},children:"Pick what you do together to get ideas"})]})]});return(0,p.jsxs)("li",{className:"flex items-center gap-3 py-3 border-b border-gray-100 dark:border-gray-700 last:border-0",children:[a?(0,p.jsx)("button",{type:"button",onClick:a,className:"flex items-center gap-3 min-w-0 flex-1",children:i}):i,n]})}function w(e){let{person:t}=e;const s=(t.name||"?").slice(0,1).toUpperCase();return(0,p.jsxs)("div",{className:"flex items-start gap-3 rounded-xl border bg-white dark:bg-gray-900 dark:border-gray-700 p-3 mb-3",children:[t.photoURL?(0,p.jsx)("img",{src:t.photoURL,alt:"",className:"w-10 h-10 rounded-full object-cover shrink-0"}):(0,p.jsx)("div",{className:"w-10 h-10 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-sm font-medium shrink-0",children:s}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"font-medium truncate",children:t.name||"Unknown"}),(0,p.jsx)("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"wants to add you as a friend"}),(0,p.jsx)(v,{person:t})]})]})}function C(e){let{person:t,busyKey:s,onAccept:n,onHide:a,onClose:l}=e;if(!t)return null;const r=(t.name||"?").slice(0,1).toUpperCase();return(0,p.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-end sm:items-center justify-center",onClick:l,children:(0,p.jsxs)("div",{className:"bg-white dark:bg-gray-900 w-full sm:max-w-md rounded-t-2xl sm:rounded-2xl p-5 shadow-xl",style:{paddingBottom:"calc(1.25rem + env(safe-area-inset-bottom, 0px))"},onClick:e=>e.stopPropagation(),role:"dialog","aria-label":"Friend request",children:[(0,p.jsxs)("div",{className:"flex flex-col items-center text-center gap-2",children:[t.photoURL?(0,p.jsx)("img",{src:t.photoURL,alt:"",className:"w-20 h-20 rounded-full object-cover"}):(0,p.jsx)("div",{className:"w-20 h-20 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-2xl font-medium",children:r}),(0,p.jsx)("div",{className:"text-lg font-semibold",children:t.name||"Someone"}),t.email?(0,p.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300 break-all",children:t.email}):null,(0,p.jsx)("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"wants to add you as a friend"}),(0,p.jsx)(v,{person:t})]}),(0,p.jsxs)("div",{className:"mt-5 flex gap-2",children:[(0,p.jsx)(j,{busy:s==="accept-".concat(t.pairId),busyLabel:"Accepting\u2026",className:"flex-1 rounded-lg bg-blue-600 text-white py-2.5 font-medium disabled:opacity-50",onClick:n,children:"Accept"}),(0,p.jsx)(j,{busy:s==="hide-".concat(t.pairId),busyLabel:"Saving\u2026",className:"flex-1 rounded-lg border py-2.5 disabled:opacity-50",onClick:a,children:"Not now"})]}),(0,p.jsx)("button",{type:"button",className:"mt-3 w-full text-sm text-gray-500 py-2",onClick:l,children:"Close"})]})})}function P(e){let{title:t,actions:s,onClose:n}=e;return t?(0,p.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-end sm:items-center justify-center",onClick:n,children:(0,p.jsxs)("div",{className:"bg-white dark:bg-gray-900 w-full sm:max-w-md rounded-t-2xl sm:rounded-2xl p-4 shadow-xl",style:{paddingBottom:"calc(1rem + env(safe-area-inset-bottom, 0px))"},onClick:e=>e.stopPropagation(),children:[(0,p.jsx)("h3",{className:"text-lg font-semibold mb-1",children:t}),(0,p.jsxs)("div",{className:"space-y-1 mt-3",children:[s.map(e=>(0,p.jsxs)("button",{type:"button",onClick:e.onClick,className:"w-full text-left px-3 py-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 ".concat(e.destructive?"text-red-600":""),children:[(0,p.jsx)("div",{className:"font-medium",children:e.label}),e.hint&&(0,p.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:e.hint})]},e.label)),(0,p.jsx)("button",{type:"button",onClick:n,className:"w-full mt-2 py-3 rounded-lg border text-center font-medium",children:"Cancel"})]})]})}):null}function S(e,t){return"functions/resource-exhausted"===((null===e||void 0===e?void 0:e.code)||"")?"Too many tries today. Wait a bit and try again.":t}function I(){const e=(0,i.zy)().pathname.startsWith("/plans/people"),t=(0,i.Zp)(),{plansBeta:s,loadingPlansBeta:m}=(0,c.a3)(),[f,I]=(0,a.useState)(()=>g),[L,R]=(0,a.useState)(!g),[F,U]=(0,a.useState)(""),[A,q]=(0,a.useState)(null),[B,O]=(0,a.useState)(()=>new Set),[E,Y]=(0,a.useState)(null),[W,z]=(0,a.useState)(!1),[H,M]=(0,a.useState)(()=>y||[]),[_,D]=(0,a.useState)(!1),[K,Z]=(0,a.useState)(""),[G,J]=(0,a.useState)(null),[Q,V]=(0,a.useState)(""),[X,$]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(""),[se,ne]=(0,a.useState)(""),[ae,le]=(0,a.useState)(null),[re,ie]=(0,a.useState)(null),de=(0,l.Ej)(),[oe,ce]=(0,a.useState)(null),[me,ue]=(0,a.useState)(b[0]),[xe,pe]=(0,a.useState)(""),[he,be]=(0,a.useState)(null);(0,a.useEffect)(()=>
1{if(null===E||void 0===E||!E.text)return;const e=setTimeout(()=>Y(null),3e3);return()=>clearTimeout(e)},[E]);const ge=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||U("");try{const e=await(0,o.jn)("listPeople");g=e,I(e);const t=(e.incoming||[]).length+(e.partnerIncoming?1:0);window.dispatchEvent(new CustomEvent("peopleUpdated",{detail:{incoming:t}}))}catch(t){console.error("[PeoplePage] listPeople",t),e||(U((null===t||void 0===t?void 0:t.message)||"Could not load people"),g||I(null))}},[]),ye=(0,a.useCallback)(async()=>{if(g)return I(g),R(!1),void ge(!0);R(!0),U("");try{const[,e]=await Promise.all([(0,o.jn)("getPlansAccess"),(0,o.jn)("listPeople")]);g=e,I(e);const t=(e.incoming||[]).length+(e.partnerIncoming?1:0);window.dispatchEvent(new CustomEvent("peopleUpdated",{detail:{incoming:t}}))}catch(e){console.error("[PeoplePage] loadInitial",e),U((null===e||void 0===e?void 0:e.message)||"Could not load people"),I(null)}finally{R(!1)}},[ge]);(0,a.useEffect)(()=>{s&&ye()},[s,ye]);const fe=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||D(!0);try{const e=await(0,o.jn)("listSuggestedPeople"),t=(null===e||void 0===e?void 0:e.people)||[];y=t,M(t)}catch(t){console.error("[PeoplePage] listSuggestedPeople",t),e||M([])}finally{e||D(!1)}},[]);(0,a.useEffect)(()=>{W&&s&&(null!==y?(M(y),D(!1),fe(!0)):fe(!1))},[W,s,fe]);const je=async function(e,t){let{successToast:s,errorFallback:n,refresh:a=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!A){q(e);try{var l;await t(),s&&Y({text:s}),a&&await ge(!0),null===de||void 0===de||null===(l=de.refreshCounts)||void 0===l||l.call(de)}catch(r){console.error("[PeoplePage]",e,r),Y({text:S(r,n),error:!0})}finally{q(null)}}},Ne=async e=>{await je("turn-on",async()=>{await(0,o.jn)("setPlansEnabled",{enabled:!0,emailPref:e}),be("home")},{successToast:"Plans is on",refresh:!0})},ve=(0,a.useMemo)(()=>((null===f||void 0===f?void 0:f.blocked)||[]).length,[f]);if(m)return(0,p.jsx)("div",{className:"min-h-[70vh] flex flex-col items-center justify-center",style:h,children:(0,p.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"})});if(!s)return(0,p.jsx)(i.C5,{to:"/home",replace:!0});if(L&&!f&&!F)return(0,p.jsxs)("div",{className:"min-h-[70vh] flex flex-col items-center justify-center gap-3",style:h,children:[(0,p.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"}),(0,p.jsx)("p",{className:"text-sm text-gray-600",children:"Loading people\u2026"})]});if(F&&!f)return(0,p.jsxs)("div",{className:"max-w-xl mx-auto p-6",style:h,children:[(0,p.jsx)("p",{className:"text-red-600 mb-4",children:F}),(0,p.jsx)("button",{type:"button",onClick:ye,className:"rounded-lg bg-gray-900 text-white px-4 py-2 text-sm",children:"Retry"})]});if(null===f||void 0===f||!f.enabled){const e=(null===f||void 0===f?void 0:f.incoming)||[];return(0,p.jsxs)("div",{className:"max-w-xl mx-auto",style:h,children:[(0,p.jsx)("button",{type:"button",className:"text-sm text-blue-600 mb-4",onClick:()=>t(-1),children:"\u2039 Back"}),(0,p.jsx)("h1",{className:"text-2xl font-semibold mb-3",children:"Turn on Plans"}),(0,p.jsxs)("p",{className:"text-sm text-gray-600 dark:text-gray-400 space-y-2 mb-6",children:[(0,p.jsx)("span",{className:"block",children:"Plan outings and events with friends who accept you back."}),(0,p.jsx)("span",{className:"block",children:"Your friend list stays private \u2014 nobody sees who you added."}),(0,p.jsx)("span",{className:"block",children:"You can turn Plans off anytime in this screen."})]}),e.length>0&&(0,p.jsxs)("div",{className:"mb-6",children:[(0,p.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"Friend requests"}),e.map(e=>(0,p.jsx)(w,{person:e},e.pairId))]}),(0,p.jsxs)("fieldset",{className:"mb-6",children:[(0,p.jsx)("legend",{className:"text-sm font-medium mb-2",children:"Plan emails"}),(0,p.jsx)(T,{onTurnOn:Ne,turningOn:"turn-on"===A})]}),(0,p.jsx)("button",{type:"button",onClick:()=>t("/home"),className:"text-sm text-gray-600 underline",children:"Not now"}),(0,p.jsx)(N,{toast:E})]})}if("home"===he)return(0,p.jsxs)("div",{className:"max-w-xl mx-auto pb-8",style:h,children:[(0,p.jsx)("h1",{className:"text-2xl font-semibold mb-2",children:"Where do you usually go out?"}),(0,p.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"We use your home area to suggest places near you. You can skip and add it later."}),(0,p.jsx)(u.A,{home:f.home,homeAreaMissing:!1!==f.homeAreaMissing,hideBanner:!0,onSaved:()=>be("addFriend")}),(0,p.jsx)("button",{type:"button",className:"mt-4 text-sm text-gray-600 underline",onClick:()=>be("addFriend"),children:"Skip for now"}),(0,p.jsx)(N,{toast:E})]});if("addFriend"===he)return(0,p.jsxs)("div",{className:"max-w-xl mx-auto pb-8",style:h,children:[(0,p.jsx)("h1",{className:"text-2xl font-semibold mb-2",children:"Add a friend"}),(0,p.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"Plans work best with at least one friend who accepts you back."}),(0,p.jsx)("button",{type:"button",className:"w-full rounded-lg bg-blue-600 text-white px-4 py-3 text-sm font-medium mb-3",onClick:()=>{be(null),z(!0)},children:"Add a friend"}),(0,p.jsx)("button",{type:"button",className:"text-sm text-gray-600 underline",onClick:()=>be(null),children:"Skip for now"}),(0,p.jsx)(N,{toast:E})]});const ke=(f.friends||[]).map(e=>(0,n.A)((0,n.A)({},e),{},{isPartner:f.partnerUid&&e.uid===f.partnerUid}));return(0,p.jsxs)("div",{className:"max-w-xl mx-auto pb-8",style:h,children:[!e&&(0,p.jsx)("button",{type:"button",className:"text-sm text-blue-600 mb-2",onClick:()=>t("/home"),children:"\u2039 Back"}),!e&&(0,p.jsx)("h1",{className:"text-2xl font-semibold mb-1",children:"People"}),(0,p.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 ".concat(e?"mb-4 mt-1":"mb-6"),children:"Only friends you both accept. Nobody sees your list."}),((f.incoming||[]).length>0||f.partnerIncoming)&&(0,p.jsxs)("section",{className:"mb-6",children:[(0,p.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"Requests"}),(0,p.jsxs)("ul",{className:"rounded-xl border bg-white dark:bg-gray-900 dark:border-gray-700 px-3",children:[f.partnerIncoming&&(0,p.jsxs)("li",{className:"flex items-start gap-3 py-3 border-b border-gray-100 dark:border-gray-700",children:[f.partnerIncoming.photoURL?(0,p.jsx)("img",{src:f.partnerIncoming.photoURL,alt:"",className:"w-10 h-10 rounded-full object-cover shrink-0"}):(0,p.jsx)("div",{className:"w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center text-sm font-medium shrink-0",children:(f.partnerIncoming.name||"?").slice(0,1).toUpperCase()}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"font-medium truncate",children:f.partnerIncoming.name||"Someone"}),f.partnerIncoming.email?(0,p.jsx)("div",{className:"text-xs text-gray-500 break-all",children:f.partnerIncoming.email}):null,(0,p.jsx)("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Wants to link as your partner. You'll get double-date ideas with other couples."})]}),(0,p.jsxs)("div",{className:"flex flex-col gap-2 shrink-0",children:[(0,p.jsx)(j,{busy:"accept-partner"===A,busyLabel:"Linking\u2026",className:"text-sm rounded-lg bg-blue-600 text-white px-3 py-1.5 disabled:opacity-50",onClick:()=>je("accept-partner",()=>(0,o.jn)("respondPartner",{accept:!0}),{successToast:"You're linked with ".concat(f.partnerIncoming.name||"them")}),children:"Accept"}),(0,p.jsx)(j,{busy:"hide-partner"===A,busyLabel:"Saving\u2026",className:"text-sm rounded-lg border px-3 py-1.5 disabled:opacity-50",onClick:()=>je("hide-partner",()=>(0,o.jn)("respondPartner",{accept:!1}),{successToast:"Request hidden"}),children:"Not now"})]})]}),f.incoming.map(e=>(0,p.jsx)(k,{person:e,request:!0,onOpen:()=>ie(e),children:(0,p.jsx)("div",{className:"flex gap-2 shrink-0",children:(0,p.jsx)(j,{busy:A==="accept-".concat(e.pairId),busyLabel:"Accepting\u2026",className:"text-sm rounded-lg bg-blue-600 text-white px-3 py-1.5 disabled:opacity-50",onClick:()=>je("accept-".concat(e.pairId),()=>(0,o.jn)("respondFriendRequest",{pairId:e.pairId,accept:!0}),{successToast:"You're now friends with ".concat(e.name||"them")}),children:"Accept"})})},e.pairId))]})]}),(0,p.jsxs)("section",{className:"mb-6",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,p.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500",children:"Friends"}),(0,p.jsx)("button",{type:"button",onClick:()=>z(!0),className:"text-sm text-blue-600 font-medium",children:"+ Add"})]}),(0,p.jsxs)("ul",{className:"rounded-xl border bg-white dark:bg-gray-900 dark:border-gray-700 px-3",children:[0===(f.friends||[]).length&&(0,p.jsx)("li",{className:"py-4 text-sm text-gray-500 text-center",children:"No friends yet"}),ke.map(e=>(0,p.jsx)(k,{person:e,onOpen:()=>t("/plans/people/".concat(e.pairId)),children:(0,p.jsx)("button",{type:"button",className:"text-sm text-gray-500 shrink-0",onClick:()=>le(e),children:"\xb7\xb7\xb7"})},e.uid))]})]}),(f.outgoing||[]).length>0&&(0,p.jsxs)("section",{className:"mb-6",children:[(0,p.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"Invites you sent"}),(0,p.jsx)("ul",{className:"rounded-xl border bg-white dark:bg-gray-900 dark:border-gray-700 px-3",children:f.outgoing.map(e=>(0,p.jsx)(k,{person:e,children:(0,p.jsx)(j,{busy:A==="cancel-".concat(e.pairId),busyLabel:"Cancelling\u2026",className:"text-sm rounded-lg border px-3 py-1.5 shrink-0 disabled:opacity-50",onClick:()=>je("cancel-".concat(e.pairId),()=>(0,o.jn)("cancelFriendRequest",{pairId:e.pairId}),{successToast:"Invite cancelled",refresh:!0}),children:"Cancel"})},e.pairId))})]}),(0,p.jsx)("footer",{className:"text-center pt-4",children:(0,p.jsxs)(r.N_,{to:"/plans/people/blocked",className:"text-sm text-blue-600",children:["Blocked (",ve,")"]})}),W&&(0,p.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-end sm:items-center justify-center",onClick:()=>z(!1),children:(0,p.jsxs)("div",{className:"bg-white dark:bg-gray-900 w-full sm:max-w-md max-h-[85vh] overflow-y-auto rounded-t-2xl sm:rounded-2xl p-4 shadow-xl",style:{paddingBottom:"calc(12rem + env(safe-area-inset-bottom, 0px))"},onClick:e=>e.stopPropagation(),children:[(0,p.jsx)("h3",{className:"text-lg font-semibold",children:"Add a friend"}),(0,p.jsx)("p",{className:"text-xs text-gray-500 mt-1 mb-4",children:"Anyone you add has to accept."}),(0,p.jsx)("h4",{className:"text-sm font-medium mb-2",children:"From your chats"}),_&&0===H.length?(0,p.jsxs)("p",{className:"text-sm text-gray-500 mb-4 inline-flex items-center gap-2",children:[(0,p.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-gray-400 border-t-transparent roun
1ded-full animate-spin"}),"Loading\u2026"]}):(0,p.jsxs)("ul",{className:"mb-6 border rounded-lg divide-y max-h-48 overflow-y-auto",children:[0===H.length&&(0,p.jsx)("li",{className:"p-3 text-sm text-gray-500",children:"No suggestions right now"}),H.map(e=>(0,p.jsxs)("li",{className:"flex items-center justify-between gap-2 p-2",children:[(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"text-sm truncate",children:e.name||"Unknown"}),(0,p.jsx)(v,{person:e})]}),(0,p.jsx)(j,{busy:A==="send-".concat(e.uid),busyLabel:"Sending\u2026",done:B.has(e.uid),doneLabel:"Sent \u2713",className:"text-sm text-blue-600 shrink-0 disabled:opacity-50",onClick:()=>je("send-".concat(e.uid),async()=>{await(0,o.jn)("sendFriendRequest",{toUid:e.uid,source:"chat"}),O(t=>new Set(t).add(e.uid))},{successToast:"Request sent"}),children:"Add"})]},e.uid))]}),(0,p.jsx)("h4",{className:"text-sm font-medium mb-2",children:"Find by email"}),(0,p.jsxs)("div",{className:"flex gap-2 mb-2",children:[(0,p.jsx)("input",{type:"email",value:K,onChange:e=>{Z(e.target.value),V(""),J(null),$(!1),te(""),ne("")},className:"flex-1 border rounded-lg px-3 py-2 text-sm",placeholder:"exact email"}),(0,p.jsx)(j,{busy:"find-email"===A,busyLabel:"Finding\u2026",disabled:!K.trim(),className:"rounded-lg bg-gray-900 text-white px-3 py-2 text-sm disabled:opacity-50",onClick:async()=>{if(!A){q("find-email"),V("");try{const e=await(0,o.jn)("findPersonByEmail",{email:K.trim()});J((null===e||void 0===e?void 0:e.person)||null),$(!(null!==e&&void 0!==e&&e.person))}catch(e){Y({text:S(e,"Couldn't look up that email. Try again."),error:!0})}finally{q(null)}}},children:"Find"})]}),Q&&(0,p.jsx)("p",{className:"text-sm text-red-600 mb-2",children:Q}),X&&(0,p.jsxs)("div",{className:"border rounded-lg p-3 mb-4 bg-sky-50 dark:bg-gray-800 dark:border-gray-700",children:[(0,p.jsxs)("p",{className:"text-sm",children:[(0,p.jsx)("span",{className:"font-medium",children:K.trim()})," isn't on SharedChat yet."]}),ee?(0,p.jsx)("p",{className:"text-sm text-gray-700 dark:text-gray-300 mt-1",children:ee}):(0,p.jsx)(j,{busy:"invite-email"===A,busyLabel:"Sending invite\u2026",className:"mt-2 text-sm font-medium text-blue-600 disabled:opacity-50",onClick:async()=>{if(!A){q("invite-email");try{const e=await(0,o.jn)("createFriendInvite",{email:K.trim()});te(null!==e&&void 0!==e&&e.emailed?"Invite sent \u2713 They'll get a friend request from you when they join.":null!==e&&void 0!==e&&e.alreadyInvited?"You already invited them this week.":null!==e&&void 0!==e&&e.emailFailed?"We couldn't send the email right now. Copy your link below and text it instead.":null!==e&&void 0!==e&&e.exists?"They just joined. Tap Find again.":"Invite saved.")}catch(e){te(S(e,"Couldn't send the invite. Try again."))}finally{q(null)}}},children:"Send them an invite"})]}),se&&!G&&(0,p.jsxs)("p",{className:"text-sm text-emerald-700 dark:text-emerald-400 mb-4",children:["Request sent to ",se," \u2713"]}),G&&(0,p.jsxs)("div",{className:"flex items-center justify-between gap-2 border rounded-lg p-2 mb-4",children:[(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"text-sm truncate",children:G.name||"Unknown"}),(0,p.jsx)(v,{person:(0,n.A)((0,n.A)({},G),{},{addSource:"email",sharedCount:0})})]}),(0,p.jsx)(j,{busy:A==="send-email-".concat(G.uid),busyLabel:"Sending\u2026",done:B.has(G.uid),doneLabel:"Sent \u2713",className:"text-sm text-blue-600 shrink-0 disabled:opacity-50",onClick:()=>je("send-email-".concat(G.uid),async()=>{await(0,o.jn)("sendFriendRequest",{toUid:G.uid,source:"email"}),O(e=>new Set(e).add(G.uid)),ne(G.name||"them"),J(null),Z("")},{successToast:"Request sent"}),children:"Add"})]}),(0,p.jsx)("div",{className:"border-t dark:border-gray-700 pt-4 mb-4",children:(0,p.jsx)(x.m,{})}),(0,p.jsx)("button",{type:"button",onClick:()=>z(!1),className:"w-full py-2 border rounded-lg text-sm font-medium",children:"Done"})]})}),(0,p.jsx)(C,{person:re,busyKey:A,onClose:()=>ie(null),onAccept:()=>je("accept-".concat(re.pairId),()=>(0,o.jn)("respondFriendRequest",{pairId:re.pairId,accept:!0}),{successToast:"You're now friends with ".concat(re.name||"them")}).then(()=>ie(null)),onHide:()=>je("hide-".concat(re.pairId),()=>(0,o.jn)("respondFriendRequest",{pairId:re.pairId,accept:!1}),{successToast:"Request hidden"}).then(()=>ie(null))}),ae&&(0,p.jsx)(P,{title:ae.name||"Friend",onClose:()=>le(null),actions:[{label:"Remove friend",hint:"They will not be notified. You can send a new request later.",onClick:()=>{const e=ae;le(null),je("remove-".concat(e.uid),()=>(0,o.jn)("removeFriend",{uid:e.uid}),{successToast:"Removed"})}},{label:"Block",hint:"They cannot contact you or send requests. They are not told.",destructive:!0,onClick:async()=>{const e=ae;le(null);await(0,d.s)({title:"Block ".concat(e.name||"this person","?"),body:"They won't be told.",confirmLabel:"Block",tone:"danger"})&&je("block-".concat(e.uid),()=>(0,o.jn)("blockUser",{uid:e.uid}),{successToast:"Blocked"})}},{label:"Report",hint:"Our team will review. They will not be notified.",onClick:()=>{ce(ae),le(null)}}]}),oe&&(0,p.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",onClick:()=>ce(null),children:(0,p.jsxs)("div",{className:"bg-white dark:bg-gray-900 rounded-xl p-4 w-full max-w-md",onClick:e=>e.stopPropagation(),children:[(0,p.jsxs)("h3",{className:"font-semibold mb-3",children:["Report ",oe.name||"user"]}),(0,p.jsx)("select",{value:me,onChange:e=>ue(e.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm mb-3",children:b.map(e=>(0,p.jsx)("option",{value:e,children:e},e))}),(0,p.jsx)("textarea",{value:xe,onChange:e=>pe(e.target.value.slice(0,1e3)),rows:3,className:"w-full border rounded-lg px-3 py-2 text-sm mb-3",placeholder:"Details (optional)"}),(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,p.jsx)("button",{type:"button",onClick:()=>ce(null),className:"px-4 py-2 border rounded-lg text-sm",children:"Cancel"}),(0,p.jsx)(j,{busy:A==="report-".concat(oe.uid),busyLabel:"Reporting\u2026",className:"px-4 py-2 rounded-lg bg-red-600 text-white text-sm disabled:opacity-50",onClick:()=>{const e=oe;ce(null),je("report-".concat(e.uid),async()=>{await(0,o.jn)("reportUser",{uid:e.uid,reason:me,details:xe}),pe("")},{successToast:"Report sent \u2014 thank you"})},children:"Submit"})]})]})}),(0,p.jsx)(N,{toast:E})]})}function T(e){let{onTurnOn:t,turningOn:s}=e;const[n,l]=(0,a.useState)("perPlan");return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("label",{className:"flex items-center gap-2 mb-2 text-sm",children:[(0,p.jsx)("input",{type:"radio",name:"emailPref",checked:"none"===n,onChange:()=>l("none")}),"None"]}),(0,p.jsxs)("label",{className:"flex items-center gap-2 mb-2 text-sm",children:[(0,p.jsx)("input",{type:"radio",name:"emailPref",checked:"perPlan"===n,onChange:()=>l("perPlan")}),"One per plan"]}),(0,p.jsxs)("label",{className:"flex items-center gap-2 mb-4 text-sm",children:[(0,p.jsx)("input",{type:"radio",name:"emailPref",checked:"weekly"===n,onChange:()=>l("weekly")}),"Weekly recap"]}),(0,p.jsx)(j,{busy:s,busyLabel:"Turning on\u2026",onClick:()=>t(n),className:"w-full rounded-lg bg-blue-600 text-white py-3 font-medium disabled:opacity-50 mb-2",children:"Turn on Plans"})]})}},6284(e,t,s){function n(e){var t;const s=null!==(t=null===e||void 0===e?void 0:e.sharedCount)&&void 0!==t?t:0;if(s>0){const t=e.sampleThreadTitle?' \xb7 e.g. "'.concat(e.sampleThreadTitle,'"'):"";return 1===s?"In 1 chat".concat(t):"In ".concat(s," of your chats").concat(t)}return"email"===(null===e||void 0===e?void 0:e.addSource)?"Found by email":null}s.d(t,{j:()=>n})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.