1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="edf96b3c-e262-3f4f-c369-a65c8abaaa79")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,222792,(e,t,n)=>{"use strict";let a;Object.defineProperty(n,"__esModule",{value:!0}),n.parseCookie=u,n.parse=u,n.stringifyCookie=function(e,t){let n=t?.encode||encodeURIComponent,a=[];for(let t of Object.keys(e)){let s=e[t];if(void 0===s)continue;if(!i.test(t))throw TypeError(`cookie name is invalid: ${t}`);let l=n(s);if(!r.test(l))throw TypeError(`cookie val is invalid: ${s}`);a.push(`${t}=${l}`)}return a.join("; ")},n.stringifySetCookie=m,n.serialize=m,n.parseSetCookie=function(e,t){let n=t?.decode||g,a=e.length,i=h(e,0,a),r=p(e,0,i),s=-1===r?{name:"",value:n(f(e,0,i))}:{name:f(e,0,r),value:n(f(e,r+1,i))},l=i+1;for(;l<a;){let t=h(e,l,a),n=p(e,l,t),i=-1===n?f(e,l,t):f(e,l,n),r=-1===n?void 0:f(e,n+1,t);switch(i.toLowerCase()){case"httponly":s.httpOnly=!0;break;case"secure":s.secure=!0;break;case"partitioned":s.partitioned=!0;break;case"domain":s.domain=r;break;case"path":s.path=r;break;case"max-age":r&&o.test(r)&&(s.maxAge=Number(r));break;case"expires":if(!r)break;let c=new Date(r);Number.isFinite(c.valueOf())&&(s.expires=c);break;case"priority":if(!r)break;let d=r.toLowerCase();("low"===d||"medium"===d||"high"===d)&&(s.priority=d);break;case"samesite":if(!r)break;let u=r.toLowerCase();("lax"===u||"strict"===u||"none"===u)&&(s.sameSite=u)}l=t+1}return s},n.stringifySetCookie=m,n.serialize=m;let i=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,r=/^[\u0021-\u003A\u003C-\u007E]*$/,s=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,l=/^[\u0020-\u003A\u003D-\u007E]*$/,o=/^-?\d+$/,c=Object.prototype.toString,d=((a=function(){}).prototype=Object.create(null),a);function u(e,t){let n=new d,a=e.length;if(a<2)return n;let i=t?.decode||g,r=0;do{let t=p(e,r,a);if(-1===t)break;let s=h(e,r,a);if(t>s){r=e.lastIndexOf(";",t-1)+1;continue}let l=f(e,r,t);void 0===n[l]&&(n[l]=i(f(e,t+1,s))),r=s+1}while(r<a)return n}function m(e,t,n){let a="object"==typeof e?e:{...n,name:e,value:String(t)},o=("object"==typeof t?t:n)?.encode||encodeURIComponent;if(!i.test(a.name))throw TypeError(`argument name is invalid: ${a.name}`);let d=a.value?o(a.value):"";if(!r.test(d))throw TypeError(`argument val is invalid: ${a.value}`);let u=a.name+"="+d;if(void 0!==a.maxAge){if(!Number.isInteger(a.maxAge))throw TypeError(`option maxAge is invalid: ${a.maxAge}`);u+="; Max-Age="+a.maxAge}if(a.domain){if(!s.test(a.domain))throw TypeError(`option domain is invalid: ${a.domain}`);u+="; Domain="+a.domain}if(a.path){if(!l.test(a.path))throw TypeError(`option path is invalid: ${a.path}`);u+="; Path="+a.path}if(a.expires){var m;if(m=a.expires,"[object Date]"!==c.call(m)||!Number.isFinite(a.expires.valueOf()))throw TypeError(`option expires is invali
2d: ${a.expires}`);u+="; Expires="+a.expires.toUTCString()}if(a.httpOnly&&(u+="; HttpOnly"),a.secure&&(u+="; Secure"),a.partitioned&&(u+="; Partitioned"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():void 0){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${a.priority}`)}if(a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${a.sameSite}`)}return u}function h(e,t,n){let a=e.indexOf(";",t);return -1===a?n:a}function p(e,t,n){let a=e.indexOf("=",t);return a<n?a:-1}function f(e,t,n){let a=t,i=n;do{let t=e.charCodeAt(a);if(32!==t&&9!==t)break}while(++a<i)for(;i>a;){let t=e.charCodeAt(i-1);if(32!==t&&9!==t)break;i--}return e.slice(a,i)}function g(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}},939764,516540,e=>{"use strict";var t=e.i(546711),n=e.i(218885),a=e.i(145373);function i(e){return`delphi_profile_add_knowledge_activations_v1_${e}`}function r(e){return"1"===e?1:2*("2"===e)}function s(e){return 0===e?1:2}function l(e,t){return e>t?e:t}function o(e){return 2===e}e.s(["addKnowledgeProfileActivationCookieName",0,i,"getAddKnowledgeProfileActionPresentation",0,function(e,t){return"mobile"===e||t?"icon":"labeled"},"isAddKnowledgeProfileActionReduced",0,o,"latestAddKnowledgeProfileActivationCount",0,l,"parseAddKnowledgeProfileActivationCount",0,r,"recordAddKnowledgeProfileActivation",0,s],516540);var c=e.i(222792);let d=new Set;function u(e){return d.add(e),()=>d.delete(e)}let m=(0,a.createContext)(null);e.s(["AddKnowledgeProgressiveReductionProvider",0,function(e){let h,p,f,g,x,b,v=(0,n.c)(16),{ownerUserId:y,initialActivationCount:w,children:j}=e;v[0]!==w||v[1]!==y?(h=()=>{var e;let t;return l(w,(e=document.cookie,t=i(y),r((0,c.parseCookie)(e)[t])))},v[0]=w,v[1]=y,v[2]=h):h=v[2];let S=h;v[3]!==w?(p=()=>w,v[3]=w,v[4]=p):p=v[4];let C=p,N=(0,a.useSyncExternalStore)(u,S,C);v[5]!==S||v[6]!==y?(f=()=>{var e;let t=s(S());
2document.cookie=(e="https:"===window.location.protocol,(0,c.stringifySetCookie)(i(y),String(t),{path:"/",maxAge:31536e3,sameSite:"lax",secure:e})),d.forEach(e=>e())},v[5]=S,v[6]=y,v[7]=f):f=v[7];let _=f;v[8]!==N?(g=o(N),v[8]=N,v[9]=g):g=v[9],v[10]!==_||v[11]!==g?(x={isReduced:g,recordActivation:_},v[10]=_,v[11]=g,v[12]=x):x=v[12];let k=x;return v[13]!==j||v[14]!==k?(b=(0,t.jsx)(m,{value:k,children:j}),v[13]=j,v[14]=k,v[15]=b):b=v[15],b},"useOptionalAddKnowledgeProgressiveReduction",0,function(){return(0,a.use)(m)}],939764)},469483,665251,911653,40485,319016,630042,424872,224432,916090,702047,945352,228309,239951,399177,e=>{"use strict";var t=e.i(546711),n=e.i(218885),a=e.i(145373),i=e.i(868810),r=e.i(299067);let s="delphi:auth-autoprompt-seen";function l(){try{return"1"===window.sessionStorage.getItem(s)}catch{return!0}}function o(){try{window.sessionStorage.setItem(s,"1")}catch{}}let c=/(^|\.)google\.(com|[a-z]{2,3}(\.[a-z]{2})?)$/;function d(){return null==globalThis.window?null:function(){try{if(!document.referrer)return!1;return c.test(new URL(document.referrer).hostname)}catch{return!1}}()}function u(e){let t,s,c=(0,n.c)(5),{callbackPath:d,mind:u}=e,m=(0,r.useAuthDialog)(),h=(0,a.useRef)(!1);return c[0]!==d||c[1]!==m||c[2]!==u?(t=()=>{if(!m||h.current||l())return;h.current=!0,o();let e=(0,i.getFlagVariant)("auth-autoprompt-copy",{devQueryParam:"auth-autoprompt-copy"});m.open({callbackPath:d,mind:u,source:"auto_prompt",copy:"control"===e?void 0:e})},s=[m,d,u],c[0]=d,c[1]=m,c[2]=u,c[3]=t,c[4]=s):(t=c[3],s=c[4]),(0,a.useEffect)(t,s),null}function m(e){let t,s,c,d,u,m=(0,n.c)(11),{callbackPath:h,mind:p}=e,f=(0,r.useAuthDialog)();m[0]===Symbol.for("react.memo_cache_sentinel")?(t={devQueryParam:"auth-autoprompt-timing"},m[0]=t):t=m[0];let g=(0,i.useFlagVariant)("auth-autoprompt-timing",t),x=(0,a.useRef)(!1);m[1]!==h||m[2]!==p?(s={callbackPath:h,mind:p},m[1]=h,m[2]=p,m[3]=s):s=m[3];let b=(0,a.useRef)(s);return m[4]!==h||m[5]!==p?(c=()=>{b.current={callbackPath:h,mind:p}},m[4]=h,m[5]=p,m[6]=c):c=m[6],(0,a.useEffect)(c),m[7]!==f||m[8]!==g?(d=()=>{if(!f||x.current||l())return;let e=()=>{x.current||l()||(x.current=!0,o(),f.open({...b.current,source:"auto_prompt"}))};if("delay"===g){let t=window.setTimeout(e,5e3);return()=>window.clearTimeout(t)}e()},u=[f,g],m[7]=f,m[8]=g,m[9]=d,m[10]=u):(d=m[9],u=m[10]),(0,a.useEffect)(d,u),null}e.s(["AutoSignInPrompt",0,function(e){let i,r=(0,n.c)(3),[s]=(0,a.useState)(d);return null===s?null:(r[0]!==s||r[1]!==e?(i=s?(0,t.jsx)(m,{...e}):(0,t.jsx)(u,{...e}),r[0]=s,r[1]=e,r[2]=i):i=r[2],i)}],469483);var h=e.i(591401),p=e.i(288136),f=e.i(632137),g=e.i(465473),x=e.i(445986);e.s(["ProfileScrollHeader",0,function(e){let a,i,r,s,l,o,c,d,u=(0,n.c)(20),{userId:m,name:b,image:v,onReturn:y,className:w,morph:j}=e,S=.35*!(0,p.useReducedMotion)();u[0]!==S?(a={type:"spring",duration:S,bounce:0},u[0]=S,u[1]=a):a=u[1];let C=a;return u[2]!==w?(i=(0,f.cn)("fixed top-1.5 left-1/2 z-50 -translate-x-1/2",w),u[2]=w,u[3]=i):i=u[3],u[4]===Symbol.for("react.memo_cache_sentinel")?(r={opacity:0,y:-16},s={opacity:1,y:0},l={opacity:0,y:-16},u[4]=r,u[5]=s,u[6]=l):(r=u[4],s=u[5],l=u[6]),u[7]!==j||u[8]!==b||u[9]!==y?(o=j?null:(0,t.jsxs)("button",{type:"button",onClick:y,"aria-label":`Back to the top of ${b}'s profile`,className:"group/my-mind flex cursor-pointer flex-col items-center border-0 bg-transparent p-0",children:[(0,t.jsx)("div",{className:"relative z-10",style:{width:g.MY_MIND_IMAGE_SIZE,height:g.MY_MIND_IMAGE_SIZE},children:(0,t.jsx)(x.MyMind.Image,{className:"transition-transform duration-150 ease-out group-hover/my-mind:scale-105 group-active/my-mind:scale-[0.98]"})}),(0,t.jsx)("div",{className:"relative z-0 -mt-0.5",children:(0,t.jsx)(x.MyMind.Pill,{children:(0,t.jsx)("div",{className:"flex items-center gap-1.5 px-3 py-1",children:(0,t.jsx)(x.MyMind.Name,{})})})})]}),u[7]=j,u[8]=b,u[9]=y,u[10]=o):o=u[10],u[11]!==v||u[12]!==b||u[13]!==o||u[14]!==m?(c=(0,t.jsx)(x.MyMind.Root,{userId:m,profileName:b,profileImageUrl:v,children:o}),u[11]=v,u[12]=b,u[13]=o,u[14]=m,u[15]=c):c=u[15],u[16]!==i||u[17]!==c||u[18]!==C?(d=(0,t.jsx)(h.motion.div,{className:i,initial:r,animate:s,exit:l,transition:C,children:c}),u[16]=i,u[17]=c,u[18]=C,u[19]=d):d=u[19],d}],665251);var b=e.i(112306);function v(){return null}function y(){}e.s(["useProfileIdentityPlacement",0,function(e){let t,i,r,s,l,o,c=(0,n.c)(11);c[0]!==e?(t=void 0===e?{}:e,c[0]=e,c[1]=t):t=c[1];let{enabled:d}=t,u=void 0===d||d,[m,h]=(0,a.useState)("hero");c[2]!==u?(i=e=>{if(!u)return y;let t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},r=()=>u?document.querySelector(b.PROFILE_SCROLL_VIEWPORT_SELECTOR):null,c[2]=u,c[3]=i,c[4]=r):(i=c[3],r=c[4]);let p=(0,a.useSyncExternalStore)(i,r,v);u||"hero"===m||h("hero"),c[5]!==u||c[6]!==p?(s=()=>
2{if(!u||!p)return;let e=null,t=null,n=()=>{let n=p.querySelector("[data-profile-identity]");if(n!==t){if(t=n,e?.disconnect(),e=null,!n)return void h("hero");(e=new IntersectionObserver(e=>{let[t]=e;h(t&&0===t.intersectionRatio?"compact":"hero")},{root:p,rootMargin:"-72px 0px 0px 0px",threshold:0})).observe(n)}};n();let a=new MutationObserver(n);return a.observe(p,{childList:!0,subtree:!0}),()=>{a.disconnect(),e?.disconnect()}},l=[u,p],c[5]=u,c[6]=p,c[7]=s,c[8]=l):(s=c[7],l=c[8]),(0,a.useEffect)(s,l);let f=u?m:"hero";return c[9]!==f?(o={placement:f},c[9]=f,c[10]=o):o=c[10],o}],911653);let w=(0,a.createContext)(null);e.s(["ChatContextProvider",0,function(e){let a,i=(0,n.c)(3),{value:r,children:s}=e;return i[0]!==s||i[1]!==r?(a=(0,t.jsx)(w,{value:r,children:s}),i[0]=s,i[1]=r,i[2]=a):a=i[2],a},"useChatContext",0,function(){let e=(0,a.use)(w);if(!e)throw Error("useChatContext must be used inside <ChatContextProvider>");return e}],40485);var j=e.i(184055),S=e.i(403773);let C={type:"spring",duration:.35,bounce:.15},N=["train","preview"],_={train:{label:"Train",description:"Test and improve your Delphi with help from our training agent",icon:S.KnowledgeIcon,activeBgClass:"bg-blue-9",activeTextClass:"text-white",cardClass:"border-0 bg-gradient-to-tr from-blue-9 to-blue-9/55 text-white",cardTextClass:"text-white"},preview:{label:"Preview",description:"Chat with your Delphi like a normal audience member",icon:S.EyeSolidIcon,activeBgClass:"bg-sand-9/15",activeTextClass:"text-fg-high",cardClass:"",cardTextClass:"text-fg-high"}};function k(e){let a,i,r,s,l,o,c,d,u,m,p,g=(0,n.c)(36),{value:x,isActive:b,pillLayoutId:v,transition:y,onSelect:w}=e,S=_[x],C=S.icon,N=S.label;g[0]!==S.activeTextClass||g[1]!==b?(a=(0,f.cn)("relative isolate inline-flex cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-[color,transform] duration-150 ease-out active:scale-[0.97]",b?S.activeTextClass:(0,f.cn)("text-fg-mid","hover:text-fg-high")),g[0]=S.activeTextClass,g[1]=b,g[2]=a):a=g[2],g[3]!==S.activeBgClass||g[4]!==b||g[5]!==v||g[6]!==y?(i=b?(0,t.jsx)(h.motion.span,{layoutId:`chat-mode-selector-pill-bg${v}`,transition:y,className:(0,f.cn)("absolute inset-0 -z-10 rounded-full",S.activeBgClass)}):null,g[3]=S.activeBgClass,g[4]=b,g[5]=v,g[6]=y,g[7]=i):i=g[7],g[8]!==C?(r=(0,t.jsx)(C,{className:"relative size-3.5 shrink-0"}),g[8]=C,g[9]=r):r=g[9];let k=b&&"hidden xs:block";return g[10]!==k?(s=(0,f.cn)("relative hidden sm:block",k),g[10]=k,g[11]=s):s=g[11],g[12]!==S.label||g[13]!==s?(l=(0,t.jsx)("span",{className:s,children:S.label}),g[12]=S.label,g[13]=s,g[14]=l):l=g[14],g[15]!==S.label||g[16]!==b||g[17]!==w||g[18]!==a||g[19]!==i||g[20]!==r||g[21]!==l?(o=(0,t.jsx)(j.HoverCardTrigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",role:"tab","aria-label":N,"aria-selected":b,onClick:w,className:a,children:[i,r,l]})}),g[15]=S.label,g[16]=b,g[17]=w,g[18]=a,g[19]=i,g[20]=r,g[21]=l,g[22]=o):o=g[22],g[23]!==S.cardClass?(c=(0,f.cn)("mt-1.5 mr-2 flex w-[307px] flex-col items-start gap-4 roun
2ded-3xl p-4",S.cardClass),g[23]=S.cardClass,g[24]=c):c=g[24],g[25]!==S.cardTextClass?(d=(0,f.cn)("text-base font-medium leading-normal tracking-[-0.32px]",S.cardTextClass),g[25]=S.cardTextClass,g[26]=d):d=g[26],g[27]!==S.description||g[28]!==d?(u=(0,t.jsx)("p",{className:d,children:S.description}),g[27]=S.description,g[28]=d,g[29]=u):u=g[29],g[30]!==u||g[31]!==c?(m=(0,t.jsx)(j.HoverCardContent,{side:"bottom",align:"center",sideOffset:8,onPointerDownOutside:I,className:c,children:u}),g[30]=u,g[31]=c,g[32]=m):m=g[32],g[33]!==m||g[34]!==o?(p=(0,t.jsxs)(j.HoverCard,{openDelay:150,closeDelay:100,children:[o,m]}),g[33]=m,g[34]=o,g[35]=p):p=g[35],p}function I(e){return e.preventDefault()}e.s(["ChatModeSelector",0,function(e){let i,r,s,l,o=(0,n.c)(12),{mode:c,onModeChange:d,className:u}=e,m=(0,a.useId)(),h=(0,p.useReducedMotion)();o[0]!==h?(i=h?{duration:0}:C,o[0]=h,o[1]=i):i=o[1];let g=i;return o[2]!==u?(r=(0,f.cn)("inline-flex items-center gap-1 rounded-full p-1","bg-sand-3 dark:bg-sand-1",u),o[2]=u,o[3]=r):r=o[3],o[4]!==c||o[5]!==d||o[6]!==m||o[7]!==g?(s=N.map(e=>(0,t.jsx)(k,{value:e,isActive:e===c,pillLayoutId:m,transition:g,onSelect:()=>{e!==c&&d(e)}},e)),o[4]=c,o[5]=d,o[6]=m,o[7]=g,o[8]=s):s=o[8],o[9]!==r||o[10]!==s?(l=(0,t.jsx)("div",{role:"tablist","aria-label":"Chat mode",className:r,children:s}),o[9]=r,o[10]=s,o[11]=l):l=o[11],l}],319016),e.s(["resolvePreviewThreadIdOnEnter",0,function(e){return e.previewMessageCount>0?e.createThreadId():e.currentPreviewThreadId}],630042);var P=e.i(981831);e.s(["NewChatButton",0,function(e){let a,i,r=(0,n.c)(3),{onClick:s}=e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(S.PenToSquareIcon,{className:"size-5"}),r[0]=a):a=r[0],r[1]!==s?(i=(0,t.jsx)(P.Button,{variant:"ghost",size:"icon","aria-label":"New conversation",onClick:s,children:a}),r[1]=s,r[2]=i):i=r[2],i}],424872),e.s(["chatBack",0,function(e){return e.toResults&&!e.profileSeen?e.toResults:e.toProfile}],224432);var E=e.i(676818),T=e.i(753015);e.s(["useSearchReturnBack",0,function(e){let t,i,r=(0,n.c)(5),s=(0,E.useRouter)();r[0]!==e?(t=()=>(0,T.readSearchReturn)(e),r[0]=e,r[1]=t):t=r[1];let[l]=(0,a.useState)(t);
2return r[2]!==s||r[3]!==l?(i=l?{href:l.href,label:(0,T.returnLabel)(l.href),onClick:()=>(0,T.returnToResults)(l.href,e=>s.push(e))}:null,r[2]=s,r[3]=l,r[4]=i):i=r[4],i}],916090);var A=e.i(563740);function R(){let e=(0,A.withoutSearchHandoff)(window.location.href);e!==window.location.href&&window.history.replaceState(null,"",e)}e.s(["useAdoptSearchHandoff",0,function(e){let t,i,r=(0,n.c)(3);r[0]!==e?(t=()=>{(0,A.adoptSearchHandoff)(e,window.location.href);let t=setTimeout(R,0);return()=>clearTimeout(t)},i=[e],r[0]=e,r[1]=t,r[2]=i):(t=r[1],i=r[2]),(0,a.useLayoutEffect)(t,i)}],702047);var M=e.i(835482),O=e.i(679893),D=e.i(164319),U=e.i(551259);let L={phase:"none"},z=()=>()=>{};function F(e){return e.answering?{...e,answering:!1}:e}function q(){return crypto.randomUUID()}function B(){return crypto.randomUUID()}function H(){return crypto.randomUUID()}function $(){return null}e.s(["useChatOpener",0,function(e){let t,i,r,s,l,o,c,d,u,m,h,p,f,g=(0,n.c)(43),{username:x,threadKey:b,enabled:v,messages:y,setMessages:w,status:j}=e,S=`${x} 3${b??"new"}`;g[0]!==x?(t=()=>(0,M.pendingSearchContextSnapshot)(x),g[0]=x,g[1]=t):t=g[1];let C=t,N=(0,a.useSyncExternalStore)(z,C,$);g[2]!==S?(i={identity:S,state:L,written:!1,answering:!1},g[2]=S,g[3]=i):i=g[3];let[_,k]=(0,a.useState)(i),[I,P]=(0,a.useState)(S),[E,T]=(0,a.useState)(H),[A,R]=(0,a.useState)(B),[V,G]=(0,a.useState)(q);if(g[4]!==A||g[5]!==S||g[6]!==y||g[7]!==E||g[8]!==I||g[9]!==V){let e;s=I===S?E:crypto.randomUUID(),r=I===S?A:crypto.randomUUID(),g[14]!==S||g[15]!==I||g[16]!==V?(e=I===S?V:crypto.randomUUID(),g[14]=S,g[15]=I,g[16]=V,g[17]=e):e=g[17],l=e,I!==S&&(P(S),T(s),R(r),G(l)),o=(0,U.threadInConversation)(y,{openerId:s,arrivalId:r}),g[4]=A,g[5]=S,g[6]=y,g[7]=E,g[8]=I,g[9]=V,g[10]=r,g[11]=s,g[12]=l,g[13]=o}else r=g[10],s=g[11],l=g[12],o=g[13];let Q=o,K=null===N?null:(0,M.peekPendingSearchContext)(x),W=(0,U.visibleChatOpenerState)({enabled:v&&!Q,written:_.written,storedIdentity:_.identity,identity:S,stored:_.state,context:K}),Y=(0,a.useRef)(w),X=(0,a.useRef)(y);g[18]!==y||g[19]!==w?(c=()=>{Y.current=w,X.current=y},d=[y,w],g[18]=y,g[19]=w,g[20]=c,g[21]=d):(c=g[20],d=g[21]),(0,a.useLayoutEffect)(c,d),g[22]!==v||g[23]!==S||g[24]!==r||g[25]!==s||g[26]!==l||g[27]!==x?(u=()=>{let e=()=>{Y.current(e=>(0,U.clearLiveSearchPerspective)((0,U.clearLiveSearchOpener)(e,s),l))};if(!v||void 0===globalThis.window)return e;let t=(0,M.peekPendingSearchContext)(x),n=null!==t&&"intro"===(0,D.searchArrivalShape)(t.intent),a=e=>{k({identity:S,state:e,written:!0,answering:n}),Y.current(n=>{let a=(0,U.threadInConversation)(n,{openerId:s,arrivalId:r}),i=t?(0,U.applySearchArrival)(n,{id:r,context:t,inConversation:a}):n,o=(0,U.applySearchPerspectiveArrival)(i,{id:l,text:t?.perspective??null});return(0,U.applySearchOpenerArrival)(o,{id:s,state:e,inConversation:a})})};if((0,U.threadInConversation)(X.current,{openerId:s,arrivalId:r})||!t||n)return a({phase:"none"}),e;let i=!1,o=(0,U.storedOpener)(t),c=(0,U.startSearchOpenerArrival)({source:o?{kind:"ready",opener:o}:{kind:"pending",request:(0,O.startOpenerRequest)(x,t)},onState:e=>{i||"greeting"!==e.phase&&"complete"!==e.phase||(i=!0,(0,M.rememberSearchOpener)(x,e.opener)),a(e)}});return()=>{c(),e()}},m=[v,S,r,s,l,x],g[22]=v,g[23]=S,g[24]=r,g[25]=s,g[26]=l,g[27]=x,g[28]=u,g[29]=m):(u=g[28],m=g[29]),(0,a.useLayoutEffect)(u,m);let Z=_.written&&_.identity===S,J=!Q&&Z&&("greeting"===W.phase||"complete"===W.phase),ee=null!==K&&"intro"===(0,D.searchArrivalShape)(K.intent),et=v&&Z&&K&&ee?{id:r,context:K}:null;g[30]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{k(F)},g[30]=h):h=g[30];let en=h;g[31]!==_.answering||g[32]!==v||g[33]!==Q||g[34]!==y||g[35]!==j||g[36]!==Z?(p=v&&Z&&_.answering&&"error"!==j&&!Q&&!(0,U.hasNonOpenerAssistant)(y),g[31]=_.answering,g[32]=v,g[33]=Q,g[34]=y,g[35]=j,g[36]=Z,g[37]=p):p=g[37];let ea=p,ei=!Q&&((0,U.searchOpenerTyping)(W)||ea);return g[38]!==en||g[39]!==J||g[40]!==et||g[41]!==ei?(f={typing:ei,openerShown:J,arrival:et,abandonArrivalAnswer:en},g[38]=en,g[39]=J,g[40]=et,g[41]=ei,g[42]=f):f=g[42],f}],945352);var V=e.i(194696);e.s(["useChatOutcome",0,function(e){let t,i,r,s,l,o,c,d,u,m,h,f,g=(0,n.c)(35),{setMessages:x,onRestore:b,onRelease:v,onAccept:y,onDiscard:w}=e,[j,S]=(0,a.useState)(null),[C,N]=(0,a.useState)(null),[_,k]=(0,a.useState)("idle"),I=(0,a.useRef)("idle"),P=(0,a.useRef)(null),E=(0,a.useRef)(null),T=(0,a.useRef)(!1),A=(0,a.useRef)(null),R=(0,p.useReducedMotion)();g[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{null!==A.current&&(clearTimeout(A.current),A.current=null)},g[0]=t):t=g[0];let M=t;g[1]===Symbol.for("react.memo_cache_sentinel")?(i=()=>M,r=[M],g[1]=i,g[2]=r):(i=g[1],r=g[2]),(0,a.useEffect)(i,r),g[3]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{let t=(0,V.nextChatOutcomeGatePhase)(I.current,e);return I.current=t,k(t),t},g[3]=s):s=g[3];let O=s;g[4]!==w?(l=(e,t)=>{w(),T.current=!1,E.current=e,P.current=t,O("sent"),N(null)},g[4]=w,g[5]=l):l=g[5];let D=l;g[6]!==y?(o=()=>{let e="accepted"===I.current;"accepted"!==O("accepted")||e||y()},g[6]=y,g[7]=o):o=g[7];let U=o;g[8]!==w||g[9]!==b||g[10]!==R||g[11]!==x?(c=e=>{w(),O("blocked");let t=P.current??[],n=(0,V.bouncedTextFromParts)(t);P.current=null,E.current=null,T.current=!0,M(),S(e.clientMessageId),A.current=setTimeout(()=>{x.current?.(t=>(0,V.dropUnacceptedTurn)(t,e.clientMessageId)),b(n,t),S(null),N({...e,text:n}),A.current=null},R?V.BLOCKED_TURN_BOUNCE_REDUCED_MS:V.BLOCKED_TURN_BOUNCE_MS)},g[8]=w,g[9]=b,g[10]=R,g[11]=x,g[12]=c):c=g[12];let L=c;g[13]!==w||g[14]!==b||g[15]!==x?(d=()=>
3{if(!(0,V.shouldRollbackPendingOutcomeError)(I.current))return!1;let e=E.current;if(null===e)return!1;let t=P.current??[],n=(0,V.bouncedTextFromParts)(t);return P.current=null,E.current=null,T.current=!0,w(),O("errored"),x.current?.(t=>(0,V.dropUnacceptedTurn)(t,e)),b(n,t),!0},g[13]=w,g[14]=b,g[15]=x,g[16]=d):d=g[16];let z=d;g[17]!==w||g[18]!==v?(u=()=>(O("finished"),P.current=null,E.current=null,T.current)?(T.current=!1,!0):(w(),v(),!1),g[17]=w,g[18]=v,g[19]=u):u=g[19];let F=u;g[20]!==w||g[21]!==v?(m=()=>{M(),O("cleared"),P.current=null,E.current=null,T.current=!1,w(),v(),S(null),N(null)},g[20]=w,g[21]=v,g[22]=m):m=g[22];let q=m;return g[23]!==_?(h=(0,V.isAssistantPendingEligible)(_),g[23]=_,g[24]=h):h=g[24],g[25]!==U||g[26]!==L||g[27]!==j||g[28]!==q||g[29]!==F||g[30]!==D||g[31]!==z||g[32]!==C||g[33]!==h?(f={assistantPendingEligible:h,bouncingClientMessageId:j,standingBlock:C,recordSent:D,accept:U,block:L,rollbackPendingError:z,consumeSuppressedFinish:F,clear:q},g[25]=U,g[26]=L,g[27]=j,g[28]=q,g[29]=F,g[30]=D,g[31]=z,g[32]=C,g[33]=h,g[34]=f):f=g[34],f}],228309),e.s(["answeredTurn",0,function(e){let t,n=e.messages.findIndex(t=>t.id===e.assistant.id);for(let a=(n<0?e.messages.length:n)-1;a>=0;a--)if(e.messages[a]?.role==="user"){t=e.messages[a];break}let a=e.assistant.parts.flatMap(e=>"text"===e.type?[e.text]:[]).join("").trim();return{turnId:t?t.metadata?.clientId??t.id:null,answered:e.completed&&a.length>0&&"Sorry, I'm having trouble responding right now."!==a}}],239951);var G=e.i(952961),Q=e.i(92553),K=e.i(167922),W=e.i(765918),Y=e.i(117741),X=e.i(398383),Z=e.i(593854),J=e.i(730684),ee=e.i(181241);function et(e){let a,i,r,s,l,o,c,d,u,m,h=(0,n.c)(26),{currentName:p,pendingNameChange:g,onClick:x,showVerifiedBadge:b,className:v,labelClassName:y}=e,w=void 0===b||b;h[0]!==g?(a=g?.trim(),h[0]=g,h[1]=a):a=h[1];let j=!!a;h[2]!==j||h[3]!==w?(i=w?(0,t.jsxs)("span",{className:(0,f.cn)("inline-flex items-center gap-1 text-xs font-normal",j?"text-warning":"text-success"),children:[(0,t.jsx)(S.ShieldCheckIcon,{className:"size-3.5 shrink-0"}),j?"Change requested":"Verified name"]}):null,h[2]=j,h[3]=w,h[4]=i):i=h[4];let C=i;h[5]!==v?(r=(0,f.cn)("flex flex-col gap-4",v),h[5]=v,h[6]=r):r=h[6],h[7]!==y?(s=(0,f.cn)("flex items-center gap-2",y),h[7]=y,h[8]=s):s=h[8],h[9]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)("span",{className:"text-sm font-medium text-fg-high",children:"Name"}),h[9]=l):l=h[9],h[10]!==C||h[11]!==j||h[12]!==g?(o=C&&(j?(0,t.jsxs)(ee.Tooltip,{delayDuration:100,children:[(0,t.jsx)(ee.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"inline-flex cursor-help",children:C})}),(0,t.jsxs)(ee.TooltipContent,{align:"start",side:"top",children:["Requested name: ",(0,t.jsx)("span",{className:"font-semibold",children:g})]})]}):C),h[10]=C,h[11]=j,h[12]=g,h[13]=o):o=h[13],h[14]!==s||h[15]!==o?(c=(0,t.jsxs)("div",{className:s,children:[l,o]}),h[14]=s,h[15]=o,h[16]=c):c=h[16];let N=p||"Full Name";return h[17]!==N?(d=(0,t.jsx)("div",{className:"flex h-10 w-full items-center rounded-xl border border-subtle bg-surface-secondary px-4 py-2.5 text-sm text-fg-mid",children:N}),h[17]=N,h[18]=d):d=h[18],h[19]!==x||h[20]!==d?(u=(0,t.jsx)("button",{type:"button",onClick:x,className:"text-left",children:d}),h[19]=x,h[20]=d,h[21]=u):u=h[21],h[22]!==u||h[23]!==r||h[24]!==c?(m=(0,t.jsxs)("div",{className:r,children:[c,u]}),h[22]=u,h[23]=r,h[24]=c,h[25]=m):m=h[25],m}let en=(0,X.default)(()=>e.A(683106).then(e=>({default:e.NameRequestModal})),{loadableGenerated:{modules:[274718]},ssr:!1});function ea(e){let i,r,s,l,o,c,d=(0,n.c)(20),{currentName:u,pendingNameChange:m,onNameUpdated:h,onNameRequested:p,onError:f,showVerifiedBadge:g,className:x,labelClassName:b}=e,v=void 0===g||g,y=(0,Y.useOwnerUserId)();d[0]!==y?(i=(0,J.getUsersMeNameChangeOptions)({query:y?{ownerUserId:y}:void 0}),d[0]=y,d[1]=i):i=d[1],d[2]!==i?(r={...i},d[2]=i,d[3]=r):r=d[3];let{data:w}=(0,Z.useQuery)(r),j=w?.data?.requestedName??null,S=m??j,[C,N]=(0,a.useState)(!1);d[4]===Symbol.for("react.memo_cache_sentinel")?(s=()=>N(!0),d[4]=s):s=d[4],d[5]!==x||d[6]!==u||d[7]!==S||d[8]!==b||d[9]!==v?(l=(0,t.jsx)(et,{currentName:u,pendingNameChange:S,onClick:s,showVerifiedBadge:v,className:x,labelClassName:b}),d[5]=x,d[6]=u,d[7]=S,d[8]=b,d[9]=v,d[10]=l):l=d[10];let _=S??u;
3return d[11]!==C||d[12]!==f||d[13]!==p||d[14]!==h||d[15]!==_?(o=(0,t.jsx)(en,{initialName:_,open:C,onOpenChange:N,onNameRequested:p,onNameUpdated:h,onError:f}),d[11]=C,d[12]=f,d[13]=p,d[14]=h,d[15]=_,d[16]=o):o=d[16],d[17]!==l||d[18]!==o?(c=(0,t.jsxs)("div",{children:[l,o]}),d[17]=l,d[18]=o,d[19]=c):c=d[19],c}var ei=e.i(697228),er=e.i(723142),es=e.i(187014),el=e.i(831543),eo=e.i(135462);function ec(e){let i,r,s,l,o,c,d,u,m,h,p,f,g,x,b,v,y,w,j,C,N,_=(0,n.c)(54),{username:k,chapterCount:I}=e,E=(0,Y.useOwnerUserId)(),T=(0,er.useQueryClient)();_[0]!==E?(i=E?{ownerUserId:E}:void 0,_[0]=E,_[1]=i):i=_[1];let A=i,[R,M]=(0,a.useState)(null);_[2]!==T||_[3]!==k?(r=()=>T.invalidateQueries({queryKey:(0,J.getUsersByUsernameQueryKey)({path:{username:k}})}),_[2]=T,_[3]=k,_[4]=r):r=_[4];let O=r;_[5]===Symbol.for("react.memo_cache_sentinel")?(s={...(0,J.postUsersMeChaptersGenerateMutation)()},_[5]=s):s=_[5];let D=(0,ei.useMutation)(s);_[6]===Symbol.for("react.memo_cache_sentinel")?(l={...(0,J.deleteUsersMeChaptersMutation)()},_[6]=l):l=_[6];let U=(0,ei.useMutation)(l);_[7]===Symbol.for("react.memo_cache_sentinel")?(o={...(0,J.postUsersMeLinkedinRefreshMutation)()},_[7]=o):o=_[7];let L=(0,ei.useMutation)(o);_[8]!==E?(c={kind:"owner",ownerUserId:E},_[8]=E,_[9]=c):c=_[9],_[10]!==O?(d=()=>{M(null),O(),es.toast.success("Chapters generated")},_[10]=O,_[11]=d):d=_[11],_[12]===Symbol.for("react.memo_cache_sentinel")?(u=e=>{M(null),es.toast.error(e.message||"Failed to generate chapters")},_[12]=u):u=_[12],_[13]!==R||_[14]!==c||_[15]!==d?(m={workflow:"chapter-generation",run:R,surface:c,onComplete:d,onError:u},_[13]=R,_[14]=c,_[15]=d,_[16]=m):m=_[16];let{busy:z}=(0,eo.useWorkflowStream)(m),F=D.isPending||z,q=F||U.isPending||L.isPending;_[17]!==D||_[18]!==A?(h=()=>{D.mutate({query:A},{onSuccess:e=>{let t=e.data.run;t?M(t):es.toast.error("Failed to generate chapters")},onError:eh})},_[17]=D,_[18]=A,_[19]=h):h=_[19];let B=h;_[20]!==O||_[21]!==U||_[22]!==A?(p=()=>{U.mutate({query:A},{onSuccess:async()=>{await O(),es.toast.success("Chapters removed")},onError:em})},_[20]=O,_[21]=U,_[22]=A,_[23]=p):p=_[23];let H=p;_[24]!==L||_[25]!==A?(f=()=>{L.mutate({query:A},{onSuccess:eu,onError:ed})},_[24]=L,_[25]=A,_[26]=f):f=_[26];let $=f;_[27]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsx)("p",{className:"text-sm font-medium text-fg-high",children:"Chapters"}),_[27]=g):g=_[27];let V=I>0?`${I} chapters on your profile, built from your LinkedIn history and your mind.`:"Build career chapters from your LinkedIn history and your mind.";_[28]!==V?(x=(0,t.jsxs)("div",{className:"space-y-0.5",children:[g,(0,t.jsx)("p",{className:"text-xs text-fg-mid",children:V})]}),_[28]=V,_[29]=x):x=_[29],_[30]!==q||_[31]!==I||_[32]!==H||_[33]!==U.isPending?(b=I>0?(0,t.jsx)(P.Button,{type:"button",variant:"ghost",size:"sm",disabled:q,onClick:H,children:U.isPending?"Removingâ¦":"Remove"}):null,_[30]=q,_[31]=I,_[32]=H,_[33]=U.isPending,_[34]=b):b=_[34],_[35]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)(S.RotateIcon,{className:"size-4"}),_[35]=v):v=_[35];let G=L.isPending?"Refreshingâ¦":"Refresh LinkedIn";_[36]!==q||_[37]!==$||_[38]!==L.isPending||_[39]!==G?(y=(0,t.jsxs)(P.Button,{type:"button",variant:"ghost",size:"sm",disabled:q,"aria-busy":L.isPending,onClick:$,children:[v,G]}),_[36]=q,_[37]=$,_[38]=L.isPending,_[39]=G,_[40]=y):y=_[40],_[41]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(S.SparklesIcon,{className:"size-4"}),_[41]=w):w=_[41];let Q=F?"Generatingâ¦":I>0?"Regenerate":"Generate Chapters";return _[42]!==q||_[43]!==F||_[44]!==B||_[45]!==Q?(j=(0,t.jsxs)(P.Button,{type:"button",variant:"ghost",size:"sm",disabled:q,"aria-busy":F,onClick:B,children:[w,Q]}),_[42]=q,_[43]=F,_[44]=B,_[45]=Q,_[46]=j):j=_[46],_[47]!==b||_[48]!==y||_[49]!==j?(C=(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[b,y,j]}),_[47]=b,_[48]=y,_[49]=j,_[50]=C):C=_[50],_[51]!==x||_[52]!==C?(N=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-2xl bg-surface-secondary p-4",children:[x,C]}),_[51]=x,_[52]=C,_[53]=N):N=_[53],N}function ed(e){let t=(0,el.parseVisibleError)(e);es.toast.error(t?.message??"Failed to refresh LinkedIn")}function eu(e){es.toast.success(e.data.experienceCount>0?`LinkedIn refreshed: ${e.data.experienceCount} roles captured`:"LinkedIn refreshed")}function em(e){let t=(0,el.parseVisibleError)(e);es.toast.error(t?.message??"Failed to remove chapters")}function eh(e){let t=(0,el.parseVisibleError)(e);es.toast.error(t?.message??"Failed to generate chapters")}var ep=e.i(559254);let ef="edit-profile-form",eg={type:"spring",duration:.4,bounce:.12};function ex(e){let a,i,r,s,l,o,c=(0,n.c)(15),{index:d,className:u,children:m}=e,g=(0,p.useReducedMotion)();c[0]!==g?(a=g?{duration:0}:eg,c[0]=g,c[1]=a):a=c[1],c[2]!==a?(i={layout:a},c[2]=a,c[3]=i):i=c[3],c[4]!==u?(r=(0,f.cn)("animate-in fade-in slide-in-from-bottom-4",u),c[4]=u,c[5]=r):r=c[5];let x=`${90*d}ms`;return c[6]!==x?(s={animationDelay:x,animationDuration:"550ms",animationTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",animationFillMode:"backwards"},c[6]=x,c[7]=s):s=c[7],c[8]!==m||c[9]!==r||c[10]!==s?(l=(0,t.jsx)("div",{className:r,style:s,children:m}),c[8]=m,c[9]=r,c[10]=s,c[11]=l):l=c[11],c[12]!==i||c[13]!==l?(o=(0,t.jsx)(h.motion.div,{layout:"position",transition:i,children:l}),c[12]=i,c[13]=l,c[14]=o):o=c[14],o}function eb(e){let a,i,r,s,l,o=(0,n.c)(11),{href:c,title:d,description:u}=e;return o[0]!==d?(a=(0,t.jsx)("p",{className:"text-sm font-medium text-fg-high",children:d}),o[0]=d,o[1]=a):a=o[1],o[2]!==u?(i=(0,t.jsx)("p",{className:"text-xs text-fg-mid",children:u}),o[2]=u,o[3]=i):i=o[3],o[4]!==a||o[5]!==i?(r=(0,t.jsxs)("div",{className:"space-y-0.5",children:[a,i]}),o[4]=a,o[5]=i,o[6]=r):r=o[6],o[7]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(S.ArrowUpRightIcon,{className:"size-4 text-fg-low transition-colors group-hover:text-fg-mid"}),o[7]=s):s=o[7],o[8]!==c||o[9]!==r?(l=(0,t.jsxs)(Q.default,{href:c,className:"group flex items-center justify-between gap-3 rounded-2xl bg-surface-secondary p-4 transition-colors hover:bg-sand-9/10",children:[r,s]}),o[8]=c,o[9]=r,o[10]=l):l=o[10],l}let ev=[],ey=[];e.s(["EDIT_PROFILE_FORM_ID",0,ef,"EditProfileForm",0,function(e){let a,i,r,s,l,o,c,d,u,m=(0,n.c)(43),{username:h,image:p,name:f,defaultName:g,initialName:x,defaultHeadline:b,defaultBio:v,defaultQuestions:y,defaultHighlights:w,defaultSocialLinks:j,defaultOrganizations:S,defaultProfileVideoEnabled:C,chaptersEnabled:N,chapterCount:_,nameOnly:k,initialFocus:I,onSuccess:P,onSavingChange:E}=e,T=void 0===j?ev:j,A=void 0===S?ey:S,R=void 0!==C&&C,M=void 0!==N&&N,O=void 0===_?0:_,D=void 0!==k&&k,U=(0,Y.useScopeBasePath)();m[0]!==g||m[1]!==D?(a=!D&&g.trim().length>0,m[0]=g,m[1]=D,m[2]=a):a=m[2];let L=a,z=p??"";if(m[3]!==T||m[4]!==I){let e;i="socials"===I?(e=T.at(-1))&&""===e.url.trim()?T:[...T,{platform:"",url:""}]:T,m[3]=T,m[4]=I,m[5]=i}else i=m[5];m[6]!==A?(r=A.length>0?A:[{name:"",customImage:"",logoSource:"none",role:""}],m[6]=A,m[7]=r):r=m[7],m[8]!==v||m[9]!==b||m[10]!==g||m[11]!==R||m[12]!==y||m[13]!==r||m[14]!==z||m[15]!==i?(s={name:g,headline:b,bio:v,image:z,questions:y,socialLinks:i,organizations:r,profileVideoEnabled:R},m[8]=v,m[9]=b,m[10]=g,m[11]=R,m[12]=y,m[13]=r,m[14]=z,m[15]=i,m[16]=s):s=m[16];let F=s;return m[17]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(ep.ProfileForm.AvatarField,{}),m[17]=l):l=m[17],m[18]!==g||m[19]!==I||m[20]!==D||m[21]!==L?(o=D?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(K.FieldGroup,{children:[(0,t.jsx)(ep.ProfileForm.NameField,{}),(0,t.jsx)(ep.ProfileForm.BioField,{hideHighlights:!0})]}),(0,t.jsx)(K.FieldGroup,{children:(0,t.jsx)(ep.ProfileForm.SocialLinksField,{autoFocusUrl:"socials"===I})})]}):(0,t.jsx)(ex,{index:0,children:(0,t.jsx)(K.FieldGroup,{children:L?(0,t.jsx)(ea,{currentName:g,className:"gap-3",labelClassName:"pl-4"}):(0,t.jsx)(ep.ProfileForm.NameField,{})})}),m[18]=g,m[19]=I,m[20]=D,m[21]=L,m[22]=o):o=m[22],m[23]!==U||m[24]!==O||m[25]!==M||m[26]!==I||m[27]!==D||m[28]!==h?(c=D?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ex,{index:1,children:(0,t.jsx)(K.FieldGroup,{className:"space-y-3",children:(0,t.jsx)(ep.ProfileForm.OrganizationsField,{})})}),(0,t.jsx)(ex,{index:2,children:(0,t.jsxs)(K.FieldGroup,{children:[(0,t.jsx)(ep.ProfileForm.HeadlineField,{}),(0,t.jsx)(ep.ProfileForm.BioField,{})]})}),(0,t.jsx)(ex,{index:3,children:(0,t.jsx)(K.FieldGroup,{className:"space-y-3",children:(0,t.jsx)(ep.ProfileForm.QuestionsField,{})})}),(0,t.jsx)(ex,{index:4,children:(0,t.jsx)(K.FieldGroup,{className:"space-y-3",children:(0,t.jsx)(ep.ProfileForm.SocialLinksField,{autoFocusUrl:"socials"===I})})}),(0,t.jsx)(ex,{index:5,children:(0,t.jsx)(W.Separator,{})}),(0,t.jsxs)(ex,{index:6,className:"flex flex-col gap-3",children:[(0,t.jsx)(ep.ProfileForm.ProfileVideoField,{}),M?(0,t.jsx)(ec,{username:h,chapterCount:O}):null,(0,t.jsx)(eb,{href:`${U}/settings/response`,title:"Response Settings",description:"Configure purpose, instructions, and conversational style"}),(0,t.jsx)(eb,{href:`${U}/settings/voice`,title:"Voice Settings",description:"Manage voice samples and configure speech settings"})]})]}),m[23]=U,m[24]=O,m[25]=M,m[26]=I,m[27]=D,m[28]=h,m[29]=c):c=m[29],m[30]!==o||m[31]!==c?(d=(0,t.jsxs)(G.LayoutGroup,{children:[l,o,c]}),m[30]=o,m[31]=c,m[32]=d):d=m[32],m[33]!==w||m[34]!==F||m[35]!==x||m[36]!==f||m[37]!==E||m[38]!==P||m[39]!==d||m[40]!==h||m[41]!==L?(u=(0,t.jsx)(ep.ProfileForm.Provider,{username:h,nameForAvatar:f,defaults:F,initialName:x,defaultHighlights:w,formId:ef,omitNameFromSave:L,onSuccess:P,onSavingChange:E,children:d}),m[33]=w,m[34]=F,m[35]=x,m[36]=f,m[37]=E,m[38]=P,m[39]=d,m[40]=h,m[41]=L,m[42]=u):u=m[42],u}
3],399177)},530861,e=>{"use strict";var t=e.i(546711),n=e.i(218885),a=e.i(144628),i=e.i(171353),r=e.i(558444),s=e.i(779882),l=e.i(952961),o=e.i(529326),c=e.i(288136),d=e.i(145373),u=e.i(687332),m=e.i(187014);e.i(735134);var h=e.i(693184),p=e.i(697228),f=e.i(593854),g=e.i(723142),x=e.i(730684),b=e.i(632137),v=e.i(280855),y=e.i(218351),w=e.i(664310),j=e.i(835751),S=e.i(430056),C=e.i(555815),N=e.i(438659),_=e.i(65880),k=e.i(538054),I=e.i(781962),P=e.i(676818),E=e.i(309271),T=e.i(314760),A=e.i(469483),R=e.i(864114),M=e.i(94214),O=e.i(773180),D=e.i(620655),U=e.i(95046),L=e.i(665251),z=e.i(112306),F=e.i(911653),q=e.i(40485),B=e.i(319016),H=e.i(630042),$=e.i(424872),V=e.i(953663),G=e.i(901693),Q=e.i(835482),K=e.i(668846),W=e.i(224432),Y=e.i(916090),X=e.i(702047),Z=e.i(945352),J=e.i(551259),ee=e.i(492515),et=e.i(228309),en=e.i(194696),ea=e.i(550145),ei=e.i(239951),er=e.i(591401),es=e.i(851913),el=e.i(981831),eo=e.i(403773),ec=e.i(18389),ed=e.i(992763),eu=e.i(119302),em=e.i(399177),eh=e.i(181241),ep=e.i(571758),ef=e.i(102653),eg=e.i(939764),ex=e.i(516540),eb=e.i(502144);let ev="transition-colors font-[450] text-base backdrop-blur-xs bg-sand-12/10 text-fg-mid hover:text-fg-high hover:bg-sand-12/15 active:bg-sand-12/15";function ey(e){let a,i,r,s,l,o,c,d=(0,n.c)(18),{presentation:u,recordActivation:m,className:h}=e,p="icon"===u;d[0]!==m?(a=()=>{m(),(0,ef.openAddToMind)("profile_add_knowledge_button")},d[0]=m,d[1]=a):a=d[1];let f=a,g=p?"icon-lg":"lg";d[2]!==h?(i=(0,b.cn)(ev,h),d[2]=h,d[3]=i):i=d[3];let x=p?"Add Knowledge":void 0,v=p?void 0:"inline-start";d[4]!==v?(r=(0,t.jsx)(ep.AddKnowledgeMark,{"data-icon":v,"aria-hidden":!0}),d[4]=v,d[5]=r):r=d[5];let y=p?null:"Add Knowledge";d[6]!==f||d[7]!==g||d[8]!==i||d[9]!==x||d[10]!==r||d[11]!==y?(s=(0,t.jsxs)(el.Button,{type:"button",variant:"subtle",size:g,className:i,"aria-label":x,"data-analytics-action":"add-knowledge-profile",onClick:f,children:[r,y]}),d[6]=f,d[7]=g,d[8]=i,d[9]=x,d[10]=r,d[11]=y,d[12]=s):s=d[12];let w=s;return p?(d[13]!==w?(l=(0,t.jsx)(eh.TooltipTrigger,{asChild:!0,children:w}),d[13]=w,d[14]=l):l=d[14],d[15]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(eh.TooltipContent,{children:"Add Knowledge"}),d[15]=o):o=d[15],d[16]!==l?(c=(0,t.jsxs)(eh.Tooltip,{children:[l,o]}),d[16]=l,d[17]=c):c=d[17],c):w}function ew(e){let a,i,r,s,l,o=(0,n.c)(13),{isReduced:c,recordActivation:d}=e;return o[0]!==c?(a=(0,ex.getAddKnowledgeProfileActionPresentation)("mobile",c),o[0]=c,o[1]=a):a=o[1],o[2]!==d||o[3]!==a?(i=(0,t.jsx)(ey,{presentation:a,recordActivation:d,className:"sm:hidden"}),o[2]=d,o[3]=a,o[4]=i):i=o[4],o[5]!==c?(r=(0,ex.getAddKnowledgeProfileActionPresentation)("desktop",c),o[5]=c,o[6]=r):r=o[6],o[7]!==d||o[8]!==r?(s=(0,t.jsx)(ey,{presentation:r,recordActivation:d,className:"hidden sm:inline-flex"}),o[7]=d,o[8]=r,o[9]=s):s=o[9],o[10]!==i||o[11]!==s?(l=(0,t.jsxs)(t.Fragment,{children:[i,s]}),o[10]=i,o[11]=s,o[12]=l):l=o[12],l}function ej(e){let a,i,r,l,o,c=(0,n.c)(27),{mode:u,canEdit:m,showShare:h,isSaving:p,username:f,displayName:g,headline:x,onboardingCompleted:y,ownerTwitterHandle:w,onShared:j,onShareClick:S,onEdit:C,onCancel:N,className:_}=e,k=void 0===h||h,I=void 0!==y&&y,[P,E]=(0,d.useState)(!1),T=(0,eg.useOptionalAddKnowledgeProgressiveReduction)(),A=null!==T;c[0]!==S?(a=()=>{S?.(),E(!0)},c[0]=S,c[1]=a):a=c[1];let R=a;return m||k||A?(c[2]!==_?(i=(0,b.cn)("pointer-events-none relative",_),c[2]=_,c[3]=i):i=c[3],c[4]!==A||c[5]!==T||c[6]!==m||c[7]!==p||c[8]!==u||c[9]!==N||c[10]!==C||c[11]!==R||c[12]!==k?(r=(0,t.jsx)(s.AnimatePresence,{initial:!1,mode:"wait",children:"editing"===u?(0,t.jsxs)(er.motion.div,{className:"relative flex items-center justify-end gap-3 rounded-full px-2 py-1.5",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},style:{originX:1,originY:.5},transition:{duration:.15,ease:"easeOut"},children:[(0,t.jsx)("div",{className:(0,b.cn)("absolute inset-0 rounded-full backdrop-blur-md",v.control.ghost)}),(0,t.jsx)(el.Button,{type:"button",variant:"subtle",size:"lg",className:(0,b.cn)(ev,"relative pointer-events-auto"),disabled:p,onClick:N,children:"Cancel"}),(0,t.jsx)(el.Button,{type:"submit",form:em.EDIT_PROFILE_FORM_ID,variant:"blue",size:"lg",className:"relative pointer-events-auto font-[450] text-base",disabled:p,children:p?"Savingâ¦":"Save"})]},"editing"):(0,t.jsxs)(er.motion.div,{className:"flex items-center justify-end gap-3 rounded-full px-2 py-1.5 pointer-events-auto",initial:{opacity:0,scale:.95}
3,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},style:{originX:1,originY:.5},transition:{duration:.15,ease:"easeOut"},children:[T?(0,t.jsx)(ew,{...T}):null,m&&A?(0,t.jsxs)(eh.Tooltip,{children:[(0,t.jsx)(eh.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(el.Button,{type:"button",variant:"subtle",size:"icon-lg",className:ev,"aria-label":"Edit profile",onMouseDown:eC,onClick:C,children:(0,t.jsx)(eo.PencilIcon,{"aria-hidden":!0})})}),(0,t.jsx)(eh.TooltipContent,{children:"Edit profile"})]}):m?(0,t.jsx)(el.Button,{type:"button",variant:"subtle",size:"lg",className:ev,onMouseDown:eS,onClick:C,children:"Edit"}):null,k&&A?(0,t.jsxs)(eh.Tooltip,{children:[(0,t.jsx)(eh.TooltipTrigger,{asChild:!0,children:(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-lg",className:ev,"aria-label":"Share profile","data-analytics-action":"profile-share",onClick:R,children:(0,t.jsx)(eo.ArrowUpFromSquareSolidIcon,{"aria-hidden":!0})})}),(0,t.jsx)(eh.TooltipContent,{children:"Share profile"})]}):k?(0,t.jsx)(el.Button,{variant:"subtle",size:"lg",className:ev,"data-analytics-action":"profile-share",onClick:R,children:"Share"}):null]},"viewing")}),c[4]=A,c[5]=T,c[6]=m,c[7]=p,c[8]=u,c[9]=N,c[10]=C,c[11]=R,c[12]=k,c[13]=r):r=c[13],c[14]!==m||c[15]!==g||c[16]!==x||c[17]!==j||c[18]!==I||c[19]!==w||c[20]!==P||c[21]!==f?(l=(0,t.jsx)(eb.ShareDialog,{open:P,onOpenChange:E,username:f,displayName:g,headline:x,isOwner:m,onboardingCompleted:I,ownerTwitterHandle:w,onShared:j}),c[14]=m,c[15]=g,c[16]=x,c[17]=j,c[18]=I,c[19]=w,c[20]=P,c[21]=f,c[22]=l):l=c[22],c[23]!==i||c[24]!==r||c[25]!==l?(o=(0,t.jsxs)("div",{className:i,children:[r,l]}),c[23]=i,c[24]=r,c[25]=l,c[26]=o):o=c[26],o):null}function eS(e){return e.preventDefault()}function eC(e){return e.preventDefault()}var eN=e.i(45174);let e_="(prefers-reduced-motion: reduce)";function ek(e){let t=window.matchMedia(e_);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function eI(){return window.matchMedia(e_).matches}function eP(){return!1}var eE=e.i(986438);function eT(e){let a,i,r,s,l,o,c,u,m=(0,n.c)(31),{image:h,name:p,username:f,videos:g,profileVideoEnabled:x,fallback:b}=e,v=void 0===b?"initials":b,y=(0,P.usePathname)()??"";m[0]!==y?(a=(0,eE.resolveSurfaceMode)(y),m[0]=y,m[1]=a):a=m[1];let w="chat"===a,j=(0,d.useRef)(null);m[2]!==g?(i=g.find(eR),m[2]=g,m[3]=i):i=m[3];let S=i,C=x&&!!S,{canPlay:N,onVideoEnded:_,onManualPlay:k}=function(e){let t,a,i,r,s,l,o=(0,n.c)(15),[c,u]=(0,d.useState)(!1),m=(0,d.useRef)(void 0),h=(0,d.useSyncExternalStore)(ek,eI,eP),p=function(){let e,t,a=(0,n.c)(2),[i,r]=(0,d.useState)(!0);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=document.createElement("video");e.muted=!0,e.playsInline=!0,e.src="data:video/mp4;base64,AAAAA";let t=e.play();void 0!==t&&t.then(()=>e.pause()).catch(e=>{"NotAllowedError"===e.name&&r(!1)})},t=[],a[0]=e,a[1]=t):(e=a[0],t=a[1]),(0,d.useEffect)(e,t),i}(),f=h||!p;o[0]!==f||o[1]!==e?(t=t=>{f||e||(clearTimeout(m.current),m.current=setTimeout(()=>u(!0),t))},o[0]=f,o[1]=e,o[2]=t):t=o[2];let g=t;(f||e)&&c&&u(!1),o[3]!==f||o[4]!==e||o[5]!==g?(a=()=>f||e?void clearTimeout(m.current):(g(5e3),()=>clearTimeout(m.current)),i=[f,e,g],o[3]=f,o[4]=e,o[5]=g,o[6]=a,o[7]=i):(a=o[6],i=o[7]),(0,d.useEffect)(a,i),o[8]!==g?(r=()=>{u(!1),g(6e4)},o[8]=g,o[9]=r):r=o[9];let x=r;o[10]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{clearTimeout(m.current),u(!0)},o[10]=s):s=o[10];let b=s;return o[11]!==f||o[12]!==c||o[13]!==x?(l={canPlay:c,onVideoEnded:x,onManualPlay:b,blocked:f},o[11]=f,o[12]=c,o[13]=x,o[14]=l):l=o[14],l}(w||!C),I=N&&C;m[4]!==I?(r=()=>{let e=j.current;e&&(I?(e.currentTime=0,e.play().catch(eA)):e.pause())},s=[I],m[4]=I,m[5]=r,m[6]=s):(r=m[5],s=m[6]),(0,d.useEffect)(r,s),m[7]!==I||m[8]!==k||m[9]!==_||m[10]!==S?(l=()=>{S&&(I?(j.current?.pause(),_()):k())},m[7]=I,m[8]=k,m[9]=_,m[10]=S,m[11]=l):l=m[11];let E=l;if(!S||!x){let e;return m[12]!==v||m[13]!==h||m[14]!==p||m[15]!==f?(e=(0,t.jsx)(eN.ProfileAvatar,{image:h,name:p,username:f,fallback:v}),m[12]=v,m[13]=h,m[14]=p,m[15]=f,m[16]=e):e=m[16],e}let T=I?"Pause profile video":"Play profile video";return m[17]!==v||m[18]!==h||m[19]!==p||m[20]!==f?(o=(0,t.jsx)(eN.ProfileAvatar,{image:h,name:p,username:f,fallback:v}),m[17]=v,m[18]=h,m[19]=p,m[20]=f,m[21]=o):o=m[21],m[22]!==I||m[23]!==_||m[24]!==S?(c=I?(0,t.jsx)("video",{ref:j,src:S.url,muted:!0,playsInl
3ine:!0,onEnded:_,className:"absolute inset-0 size-full object-cover"}):null,m[22]=I,m[23]=_,m[24]=S,m[25]=c):c=m[25],m[26]!==E||m[27]!==c||m[28]!==T||m[29]!==o?(u=(0,t.jsxs)("button",{type:"button",onClick:E,className:"avatar-squircle relative size-36 cursor-pointer overflow-hidden shadow-(--avatar-shadow) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring","aria-label":T,children:[o,c]}),m[26]=E,m[27]=c,m[28]=T,m[29]=o,m[30]=u):u=m[30],u}function eA(){}function eR(e){return"PROFILE"===e.type}let eM=(0,b.cn)("[box-shadow:0_-1px_1px_0_rgba(255,255,255,0.5)_inset,0_1px_1px_0_rgba(255,255,255,1)_inset,0_24.348px_24.348px_0_rgba(0,0,0,0.05),0_6.493px_6.493px_-3.246px_rgba(0,0,0,0.05),0_3.246px_3.246px_-1.623px_rgba(0,0,0,0.05),0_0.812px_0.812px_-0.406px_rgba(239,95,0,0.05),0_0_0_1px_rgba(0,0,0,0.05)] dark:[box-shadow:0_-1px_1px_0_rgba(255,255,255,0.1)_inset,0_1px_1px_0_rgba(255,255,255,0.15)_inset,0_24.348px_24.348px_0_rgba(0,0,0,0.05),0_6.493px_6.493px_-3.246px_rgba(0,0,0,0.05),0_3.246px_3.246px_-1.623px_rgba(0,0,0,0.05),0_0.812px_0.812px_-0.406px_rgba(239,95,0,0.05),0_0_0_1px_rgba(0,0,0,0.05)]");function eO(){let e,a=(0,n.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:(0,b.cn)("absolute inset-x-0 -left-10 -right-10 -top-10 z-0","h-[14rem] rounded-none md:rounded-[72px]","pointer-events-none","bg-gradient-to-b from-sand-3/60 via-30% to-transparent dark:from-sand-3")}),(0,t.jsx)("div",{className:(0,b.cn)("absolute inset-x-0 -left-10 -right-10 -top-10 z-0","h-[26rem] rounded-none md:rounded-[72px]","pointer-events-none",eM),style:{maskImage:"linear-gradient(to bottom, black 0%, transparent 300px)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 300px)"}})]}),a[0]=e):e=a[0],e}var eD=e.i(10243);function eU(e){return!!e&&/\w/.test(e)}let eL=[.32,.72,0,1];function ez(e){let a,i,r,l,o,u,m,h,p,f,g,x,y,w,j,S,C=(0,n.c)(44),{bio:N,highlights:_,activeHighlightId:k,toggleHighlight:I,onReadMore:P}=e,[E,T]=(0,d.useState)(!1),[A,R]=(0,d.useState)(null),[M,O]=(0,d.useState)(!1),D=(0,c.useReducedMotion)(),U=(0,d.useRef)(null);if(C[0]!==N||C[1]!==E?(a=()=>{if(!N)return;let e=U.current;if(!e)return;let t=()=>{let t=e.scrollHeight;O(t>338),E&&R(t)};t();let n=new ResizeObserver(t);n.observe(e);let a=!1;return document.fonts?.ready?.then(()=>{a||t()}),()=>{a=!0,n.disconnect()}},C[0]=N,C[1]=E,C[2]=a):a=C[2],C[3]!==N||C[4]!==_||C[5]!==E?(i=[N,_,E],C[3]=N,C[4]=_,C[5]=E,C[6]=i):i=C[6],(0,d.useEffect)(a,i),!N)return null;C[7]!==P?(r=()=>{P?.();let e=U.current;e&&R(e.scrollHeight),T(!0)},C[7]=P,C[8]=r):r=C[8];let L=r,z=E?A??9999:337;C[9]!==D?(l=D?{duration:0}:{duration:.4,ease:eL},C[9]=D,C[10]=l):l=C[10];let F=l;C[11]!==D?(o=D?{duration:0}:{duration:.25,ease:"easeOut"},C[11]=D,C[12]=o):o=C[12];let q=o;C[13]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)("h2",{className:"sr-only",children:"About"}),C[13]=u):u=C[13],C[14]!==z?(m={maxHeight:z},C[14]=z,C[15]=m):m=C[15],C[16]!==k||C[17]!==_||C[18]!==I?(h=e=>(function(e,n,a,i){if(0===n.length)return[e];let r=function(e,t){let n=[];for(let a of t){let t=a.word,i=e.toLowerCase(),r=t.toLowerCase(),s=0,l=i.indexOf(r,s);for(;-1!==l;){let o=l+t.length;(function(e,t,n){let a=e[t-1],i=e[n];return!eU(a)&&!eU(i)})(e,l,o)&&n.push({highlight:a,startIndex:l,endIndex:o}),s=l+1,l=i.indexOf(r,s)}}n.sort((e,t)=>e.startIndex!==t.startIndex?e.startIndex-t.startIndex:t.endIndex-e.startIndex-(e.endIndex-e.startIndex));let a=[],i=0;for(let e of n)e.startIndex>=i&&(a.push(e),i=e.endIndex);return a}(e,n);if(0===r.length)return[e];let s=[],l=0;for(let n of r){n.startIndex>l&&s.push(e.slice(l,n.startIndex));let r=e.slice(n.startIndex,n.endIndex),o=n.highlight.id===a,c=n.highlight.questions?.length??0;s.push((0,t.jsxs)("button",{type:"button",onClick:()=>i(n.highlight),className:(0,b.cn)("inline-flex cursor-pointer items-baseline gap-0 py-0 pl-1 pr-1.5 font-[470] leading-[1.4] transition-all duration-300 rounded-[10px] hover:text-sand-12",o?"text-sand-12":"bg-sand-10/10 hover:bg-sand-10/15 dark:bg-sand-10/20 dark:hover:bg-sand-10/25"),style:o?{backgroundColor:"oklch(var(--tangerine-9-oklch) / 0.12)"}:{marginLeft:"-4px",marginRight:"-4px"},children:[c>0&&(0,t.jsx)(eo.ConversationsSolidIcon,{className:(0,b.cn)("mr-0.5 inline-block h-5 translate-y-[3px] transition-all duration-[400ms] ease-in-out",o?"w-6 text-tangerine-9 opacity-100":"pointer-events-none w-0 opacity-0 text-fg-low"),"aria-hidden":!0}),r]},`${n.highlight.id}-${n.startIndex}`)),l=n.endIndex}return l<e.length&&s.push(e.slice(l)),s})(e,_,k,I),C[16]=k,C[17]=_,C[18]=I,C[19]=h):h=C[19],C[20]!==N||C[21]!==h?(p=(0,t.jsx)("div",{ref:U,className:"relative z-10 text-lg leading-normal text-fg-high",children:(0,t.jsx)(eD.ProfileBioParagraphs,{bio:N,paragraphClassName:"whitespace-pre-wrap pb-4 last:pb-0",renderParagraph:h})}),C[20]=N,C[21]=h,C[22]=p):p=C[22],C[23]===Symbol.for("react.memo_cache_sentinel")?(f=(0,b.cn)("pointer-events-none absolute inset-x-0 -bottom-0.5 z-10 h-20 bg-linear-to-t from-15% via-55%",v.gradient.primary),C[23]=f):f=C[23];let B=M&&!E?1:0;return C[24]!==B?(g={opacity:B},C[24]=B,C[25]=g):g=C[25],C[26]!==q||C[27]!==g?(x=(0,t.jsx)(er.motion.div,{"aria-hidden":!0,
3className:f,initial:!1,animate:g,transition:q}),C[26]=q,C[27]=g,C[28]=x):x=C[28],C[29]!==F||C[30]!==x||C[31]!==m||C[32]!==p?(y=(0,t.jsxs)(er.motion.div,{initial:!1,animate:m,transition:F,className:"relative overflow-hidden",children:[p,x]}),C[29]=F,C[30]=x,C[31]=m,C[32]=p,C[33]=y):y=C[33],C[34]!==q||C[35]!==L||C[36]!==E||C[37]!==M?(w=M&&!E?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(er.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:0}},transition:q,className:"absolute -ml-3 bottom-0 z-20",children:(0,t.jsx)(el.Button,{variant:"ghost",onClick:L,className:"hover:!bg-transparent active:!bg-transparent",children:"Read More"})})}):null,C[34]=q,C[35]=L,C[36]=E,C[37]=M,C[38]=w):w=C[38],C[39]!==w?(j=(0,t.jsx)(s.AnimatePresence,{initial:!1,mode:"popLayout",children:w}),C[39]=w,C[40]=j):j=C[40],C[41]!==y||C[42]!==j?(S=(0,t.jsxs)("section",{className:"relative pb-5",children:[u,y,j]}),C[41]=y,C[42]=j,C[43]=S):S=C[43],S}var eF=e.i(865960),eq=e.i(8651),eB=e.i(432245),eH=e.i(765918),e$=e.i(972262),eV=e.i(416201);let eG=[.19,1,.22,1],eQ=[.16,1,.3,1],eK={opacity:0,y:10,filter:"blur(6px)"},eW={opacity:1,y:0,filter:"blur(0px)"},eY={opacity:1};function eX(e){let a,i,r,s,l,o=(0,n.c)(13),{chapter:c,size:u}=e,[m,h]=(0,d.useState)(!1);o[0]!==c.logoUrl?(a=c.logoUrl?.trim(),o[0]=c.logoUrl,o[1]=a):a=o[1];let p=a;if(o[2]!==p||o[3]!==m?(i=p&&!m?(0,t.jsx)(eF.default,{src:p,alt:"",fill:!0,sizes:"48px",className:"object-cover",onError:()=>h(!0)}):null,o[2]=p,o[3]=m,o[4]=i):i=o[4],o[5]!==c){let e;e=c.organization?.trim()||c.title.trim(),r=e[0]?.toUpperCase()??"",o[5]=c,o[6]=r}else r=o[6];return o[7]!==r?(s=(0,t.jsx)(eB.AvatarFallback,{children:r}),o[7]=r,o[8]=s):s=o[8],o[9]!==u||o[10]!==i||o[11]!==s?(l=(0,t.jsxs)(eB.Avatar,{size:u,children:[i,s]}),o[9]=u,o[10]=i,o[11]=s,o[12]=l):l=o[12],l}function eZ(e){let t=(0,eE.subscribeToProfileUrlChange)(e);return window.addEventListener("hashchange",e),()=>{t(),window.removeEventListener("hashchange",e)}}function eJ(){return(0,eV.chapterIdFromHash)(window.location.hash)}function e0(e){let a,i,r,s,l,o,c,u,m,h,p,f=(0,n.c)(12),{chapters:g,onAsk:x,onChapterToggle:v,onEarlierToggle:y}=e,w=g.filter(e5),j=g.filter(e4),[S,C]=(0,d.useState)(w[0]?.id??null),[N,_]=(0,d.useState)(!1),[k,I]=(0,d.useState)(e3),P=(0,d.useSyncExternalStore)(eZ,eJ,e2),E=P&&w.some(e=>e.id===P)?P:null;if(E&&S!==E&&C(E),E&&!k.has(E)){let e=new Set(k);e.add(E),I(e)}if(f[0]!==E||f[1]!==S?(a=()=>{E&&S===E&&document.getElementById((0,eV.chapterElementId)(E))?.scrollIntoView({block:"start"})},i=[E,S],f[0]=E,f[1]=S,f[2]=a,f[3]=i):(a=f[2],i=f[3]),(0,d.useLayoutEffect)(a,i),0===w.length)return null;f[4]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{I(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},f[4]=r):r=f[4];let T=r;f[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("h2",{id:"chapters-section",className:"flex items-center gap-2 pb-4 text-xl font-semibold tracking-tight text-fg-high",children:[(0,t.jsx)(eo.BookOpenIcon,{className:"size-5 shrink-0"}),"Chapters"]}),f[5]=s):s=f[5];let A=w.map((e,n)=>(0,t.jsx)(e6,{chapter:e,isLast:n===w.length-1&&0===j.length,isOpen:S===e.id,alreadyRevealed:k.has(e.id),isHashTarget:E===e.id,onToggle:()=>{let t=S===e.id?null:e.id;C(t),v?.(e,n+1,t===e.id)},onRevealed:()=>T(e.id),onAsk:x},e.id)),R=j.length>0?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex gap-3.5",children:[(0,t.jsx)("div",{className:"flex w-12 shrink-0 justify-center",children:(0,t.jsx)(eH.Separator,{orientation:"vertical",className:(0,b.cn)(!N&&"[mask-image:linear-gradient(to_bottom,black,transparent)]")})}),(0,t.jsxs)("button",{type:"button",onClick:()=>{_(!N),y?.(!N)},"aria-expanded":N,className:"group flex min-w-0 flex-1 items-center justify-between gap-3 py-1 text-left",children:[(0,t.jsx)("span",{className:"text-sm text-fg-low transition-colors group-hover:text-fg-mid",children:(c=`${j.length} ${1===j.length?"role":"roles"}`,m=(u=j.flatMap(e=>e.span.match(/\d{4}/g)??[]).map(Number).sort((e,t)=>e-t)).at(0),h=u.at(-1),p=m?h&&h!==m?` \xb7 ${m} â ${h}`:` \xb7 ${m}
3`:"",`Earlier \xb7 ${c}${p}`)}),(0,t.jsx)(er.motion.span,{animate:{rotate:180*!!N},transition:{duration:.2,ease:"easeOut"},className:"shrink-0 text-fg-low transition-colors group-hover:text-fg-high",children:(0,t.jsx)(eo.ChevronDownIcon,{className:"size-4","aria-hidden":!0})})]})]}),(0,t.jsx)(eq.AnimateHeightContent,{isVisible:N,animateEntry:!0,children:(0,t.jsx)("div",{className:"flex flex-col",children:j.map(e1)})})]}):null;return f[6]!==A||f[7]!==R?(l=(0,t.jsxs)("div",{className:"flex flex-col",children:[A,R]}),f[6]=A,f[7]=R,f[8]=l):l=f[8],f[9]!==l||f[10]!==s?(o=(0,t.jsxs)("section",{className:"-mx-6 mb-8 rounded-[30px] bg-surface-secondary p-6 md:-mx-4","aria-labelledby":"chapters-section",children:[s,l]}),f[9]=l,f[10]=s,f[11]=o):o=f[11],o}function e1(e){return(0,t.jsxs)("div",{className:"flex gap-3.5",children:[(0,t.jsxs)("div",{className:"flex w-12 shrink-0 flex-col items-center self-stretch",children:[(0,t.jsx)(eH.Separator,{orientation:"vertical",className:"mx-auto h-3 flex-none"}),(0,t.jsx)(eX,{chapter:e,size:"4xl"})]}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center pt-3",children:(0,t.jsxs)("p",{className:"min-w-0 truncate text-sm",children:[(0,t.jsx)("span",{className:"text-fg-mid",children:e.title}),e.organization?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"px-1 text-fg-low",children:"·"}),(0,t.jsxs)("span",{className:"text-fg-low",children:[e.organization," · ",e.span]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"px-1 text-fg-low",children:"·"}),(0,t.jsx)("span",{className:"text-fg-low",children:e.span})]})]})})]},e.id)}function e2(){return null}function e3(){return new Set}function e4(e){return"EARLIER"===e.kind}function e5(e){return"CHAPTER"===e.kind}function e6(e){let a,i,r,s,l,o,u,m,h,p,f,g,x,v,y,w,j,S,C,N,_,k,I,P,E,T,A=(0,n.c)(81),{chapter:R,isLast:M,isOpen:O,alreadyRevealed:D,isHashTarget:U,onToggle:L,onRevealed:z,onAsk:F}=e,q=!0===(0,c.useReducedMotion)();A[0]!==D||A[1]!==U?(a=(0,eV.shouldSkipChapterReveal)({alreadyRevealed:D,isHashTarget:U}),A[0]=D,A[1]=U,A[2]=a):a=A[2];let B=a,[H,$]=(0,d.useState)(B);O?U&&!H&&$(!0):H!==B&&$(B);let V=O&&!q&&!H,G=function(e,t,n,a){let i=e+t,[r,s]=(0,d.useState)(0),l=(0,d.useRef)(a);return(0,d.useEffect)(()=>{l.current=a},[a]),n||0===r||s(0),(0,d.useEffect)(()=>{if(!n)return;if(0===i)return void l.current();let t=0,a=window.setTimeout(function n(){if(s(t+=1),t>=i)return void l.current();let r=t<e?550:t===e?1050:340;a=window.setTimeout(n,r)},150);return()=>window.clearTimeout(a)},[n,i,e]),r}(R.story.length,R.questions.length,V,z),Q=H?R.story.length+R.questions.length:G,K=q||H||Q>=R.story.length+R.questions.length,W=.8*!!V;A[3]!==W?(i={duration:W,ease:eG},A[3]=W,A[4]=i):i=A[4];let Y=i,X=.35*!!V;A[5]!==X?(r={duration:X,ease:eQ},A[5]=X,A[6]=r):r=A[6];let Z=r;A[7]!==R.id?(s=(0,eV.chapterElementId)(R.id),A[7]=R.id,A[8]=s):s=A[8],A[9]!==R?(l=(0,t.jsx)(eX,{chapter:R,size:"5xl"}),A[9]=R,A[10]=l):l=A[10],A[11]!==M?(o=M?null:(0,t.jsx)(eH.Separator,{orientation:"vertical",className:"mx-auto flex-1"}),A[11]=M,A[12]=o):o=A[12],A[13]!==l||A[14]!==o?(u=(0,t.jsxs)("div",{className:"flex w-12 shrink-0 flex-col items-center self-stretch",children:[l,o]}),A[13]=l,A[14]=o,A[15]=u):u=A[15];let J=!M&&"pb-5";A[16]!==J?(m=(0,b.cn)("min-w-0 flex-1",J),A[16]=J,A[17]=m):m=A[17],A[18]!==R.title?(h=(0,t.jsx)("span",{className:"text-base font-medium text-fg-high",children:R.title}),A[18]=R.title,A[19]=h):h=A[19],A[20]!==R.organization?(p=R.organization?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:R.organization}),(0,t.jsx)("span",{"aria-hidden":!0,className:"text-fg-low",children:"·"})]}):null,A[20]=R.organization,A[21]=p):p=A[21],A[22]!==R.isCurrent||A[23]!==R.span?(f=R.isCurrent?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-fg-low",children:[R.span," â",(0,t.jsxs)("span",{className:"flex items-center gap-1 font-medium text-brand-accent",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"size-1.5 rounded-full bg-brand-accent"}),"Now"]})]}):(0,t.jsx)("span",{className:"text-fg-low",children:R.span}
3),A[22]=R.isCurrent,A[23]=R.span,A[24]=f):f=A[24],A[25]!==p||A[26]!==f?(g=(0,t.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-sm text-fg-mid",children:[p,f]}),A[25]=p,A[26]=f,A[27]=g):g=A[27],A[28]!==h||A[29]!==g?(x=(0,t.jsxs)("span",{className:"flex min-w-0 flex-col",children:[h,g]}),A[28]=h,A[29]=g,A[30]=x):x=A[30];let ee=180*!!O;A[31]!==ee?(v={rotate:ee},A[31]=ee,A[32]=v):v=A[32],A[33]===Symbol.for("react.memo_cache_sentinel")?(y={duration:.2,ease:"easeOut"},A[33]=y):y=A[33],A[34]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(eo.ChevronDownIcon,{className:"size-4","aria-hidden":!0}),A[34]=w):w=A[34],A[35]!==v?(j=(0,t.jsx)(er.motion.span,{animate:v,transition:y,className:"mt-1 shrink-0 text-fg-low transition-colors group-hover:text-fg-high",children:w}),A[35]=v,A[36]=j):j=A[36],A[37]!==O||A[38]!==L||A[39]!==x||A[40]!==j?(S=(0,t.jsxs)("button",{type:"button",onClick:L,"aria-expanded":O,className:"group flex w-full items-start justify-between gap-3 text-left",children:[x,j]}),A[37]=O,A[38]=L,A[39]=x,A[40]=j,A[41]=S):S=A[41],A[42]!==R.gist?(C=(0,t.jsx)("p",{className:"mt-1.5 text-sm leading-relaxed text-fg-mid",children:R.gist}),A[42]=R.gist,A[43]=C):C=A[43];let et=!H&&!q,en=q?0:void 0,ea=O&&!K;if(A[44]!==R.id||A[45]!==R.story||A[46]!==q||A[47]!==Q||A[48]!==Y){let e;A[50]!==R.id||A[51]!==q||A[52]!==Q||A[53]!==Y?(e=(e,n)=>{let a=q||Q>n;return(0,t.jsx)(er.motion.p,{initial:!1,animate:q?eY:a?eW:eK,transition:Y,"aria-hidden":!a,className:"text-base leading-normal text-fg-high",children:e},`${R.id}-${n}`)},A[50]=R.id,A[51]=q,A[52]=Q,A[53]=Y,A[54]=e):e=A[54],N=R.story.map(e),A[44]=R.id,A[45]=R.story,A[46]=q,A[47]=Q,A[48]=Y,A[49]=N}else N=A[49];return A[55]!==R||A[56]!==F||A[57]!==Z||A[58]!==q||A[59]!==Q?(_=R.questions.map((e,n)=>{let a=q||Q>R.story.length+n;return(0,t.jsx)(er.motion.div,{initial:!1,animate:{opacity:+!!a,y:a||q?0:8},transition:Z,"aria-hidden":!a,inert:!a,className:"flex max-w-full",children:(0,t.jsx)(e$.SuggestedQuestionButton,{question:e,onQuestionSelect:e=>F(e,R,n+1),"aria-label":`Ask: ${e}`,className:"max-w-full shrink rounded-3xl px-4 py-2.5 text-left text-base whitespace-normal"})},e)}),A[55]=R,A[56]=F,A[57]=Z,A[58]=q,A[59]=Q,A[60]=_):_=A[60],A[61]!==_?(k=(0,t.jsx)("div",{className:"-mx-1 mt-0.5 flex flex-wrap gap-2",children:_}),A[61]=_,A[62]=k):k=A[62],A[63]!==ea||A[64]!==N||A[65]!==k?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 pt-2.5","aria-busy":ea,"aria-live":"off",children:[N,k]}),A[63]=ea,A[64]=N,A[65]=k,A[66]=I):I=A[66],A[67]!==O||A[68]!==et||A[69]!==en||A[70]!==I?(P=(0,t.jsx)(eq.AnimateHeightContent,{isVisible:O,animateEntry:et,duration:en,children:I}),A[67]=O,A[68]=et,A[69]=en,A[70]=I,A[71]=P):P=A[71],A[72]!==m||A[73]!==S||A[74]!==C||A[75]!==P?(E=(0,t.jsxs)("div",{className:m,children:[S,C,P]}),A[72]=m,A[73]=S,A[74]=C,A[75]=P,A[76]=E):E=A[76],A[77]!==E||A[78]!==s||A[79]!==u?(T=(0,t.jsxs)("div",{className:"flex gap-3.5",id:s,children:[u,E]}),A[77]=E,A[78]=s,A[79]=u,A[80]=T):T=A[80],T}function e7(e){return null}var e8=e.i(92553);function e9(){let e,a,i,r=(0,n.c)(3);r[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Date().getFullYear(),r[0]=e):e=r[0];let s=e;return r[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(e8.default,{href:"/terms","data-cursor-scale":!0,className:"transition-colors hover:text-fg-high",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),r[1]=a):a=r[1],r[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("footer",{className:"w-fit pt-[25px] text-left text-xs text-fg-low",children:(0,t.jsxs)("p",{children:["© ",s," Delphi ·"," ",a," · ",(0,t.jsx)(e8.default,{href:"/privacy","data-cursor-scale":!0,className:"transition-colors hover:text-fg-high",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})}),r[2]=i):i=r[2],i}var te=e.i(645361),tt=e.i(293120);function tn(e){let a,i,r,s,l,o,c,d,u,m=(0,n.c)(27),{headline:h,organization:p,isVerified:f,children:g}=e;if(m[0]!==h||m[1]!==f||m[2]!==p){c=Symbol.for("react.early_return_sentinel");e:{var x;let e,n,d=h?.trim()||null;m[10]!==p?(n=(0,tt.formatRoleLine)(p),m[10]=p,m[11]=n):n=m[11];let u=n;if(!d&&!u){c=null;break e}l="flex items-center gap-2 pb-0.5 text-base",m[12]!==f||m[13]!==p?(o=(0,t.jsx)(te.ProfileIdentityBadges,{organization:p,isVerified:f,variant:"headline"}),m[12]=f,m[13]=p,m[14]=o):o=m[14],a="min-w-0 truncate",m[15]!==u?(i=u?(0,t.jsx)("span",{className:"text-fg-mid",children:u}):null,m[15]=u,m[16]=i):i=m[16],r=u&&d?(0,t.jsx)("span",{className:"px-1 text-fg-low",children:"·"}):null,s=d?(0,t.jsx)("span",{className:u?"text-fg-low":"text-fg-mid",children:u?d:-1===(e=(x=d).indexOf(" · "))?x:(0,t.jsxs)(t.Fragment,{children:[x.slice(0,e),(0,t.jsx)("span",{className:"opacity-70",children:x.slice(e)})]})}):null}m[0]=h,m[1]=f,m[2]=p,m[3]=a,m[4]=i,m[5]=r,m[6]=s,m[7]=l,m[8]=o,m[9]=c}else a=m[3],i=m[4],r=m[5],s=m[6],l=m[7],o=m[8],c=m[9];return c!==Symbol.for("react.early_return_sentinel")?c:(m[17]!==a||m[18]!==i||m[19]!==r||m[20]!==s?(d=(0,t.jsxs)("p",{className:a,children:[i,r,s]}),m[17]=a,m[18]=i,m[19]=r,m[20]=s,m[21]=d):d=m[21],m[22]!==g||m[23]!==l||m[24]!==o||m[25]!==d?(u=(0,t.jsxs)("div",{className:l,children:[o,d,g]}),m[22]=g,m[23]=l,m[24]=o,m[25]=d,m[26]=u):u=m[26],u)}var ta=e.i(421061);let ti=(0,d.createContext)(null);function tr(e){let a,i,r,s,l=(0,n.c)(9),{children:o}=e,[c,u]=(0,d.useState)(null);l[0]!==c?.id?(a=e=>{c?.id===e.id?u(null):(u(e),window.matchMedia("(min-width: 650px)").matches&&requestAnimationFrame(ts))},l[0]=c?.id,l[1]=a):a=l[1],c?.id;let m=a;l[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{u(null)},l[2]=i):i=l[2];let h=i;return l[3]!==c||l[4]!==m?(r={activeHighlight:c,toggleHighlight:m,clearHighlight:h},l[3]=c,l[4]=m,l[5]=r):r=l[5],l[6]!==o||l[7]!==r?(s=(0,t.jsx)(ti.Provider,{value:r,children:o}),l[6]=o,l[7]=r,l[8]=s):s=l[8],s}function ts(){document.getElementById("questions-section")?.scrollIntoView({behavior:"smooth",block:"center"})}function tl(){let e,t,a=(0,n.c)(2),[i,r]=(0,d.useState)(!1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=window.matchMedia("(max-width: 649px)"),t=()=>r(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},t=[],a[0]=e,a[1]=t):(e=a[0],t=a[1]),(0,d.useEffect)(e,t),i}function to(e){let a,i,r,s,l,o,c,u,m,h,p=(0,n.c)(23),{activeHighlight:f,clearHighlight:g,sendHighlightToChat:x}=e,v=tl(),[y,w]=(0,d.useState)(f),j=null!==f&&f.questions.length>0,S=v&&j;S&&f!==y&&w(f);let C=S?f:y;p[0]!==g?(a=e=>{e||g()},p[0]=g,p[1]=a):a=p[1];let N=a;p[2]!==g||p[3]!==x?(i=(e,t)=>{g(),x(e,t)},p[2]=g,p[3]=x,p[4]=i):i=p[4];let _=i;p[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(eo.CommentIcon,{className:"size-5 shrink-0 text-sand-12","aria-hidden":!0}),p[5]=r):r=p[5];let k=C?.word;return p[6]!==k?(s=(0,t.jsxs)(ta.DrawerTitle,{className:"flex items-center gap-2 text-lg font-semibold",children:[r,(0,t.jsx)("span",{className:"capitalize",children:k})]}),p[6]=k,p[7]=s):s=p[7],p[8]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(ta.DrawerDescription,{className:"sr-only",children:"Suggested questions about this highlight. Choose one to start a chat."}),p[8]=l):l=p[8],p[9]!==s?(o=(0,t.jsxs)(ta.DrawerHeader,{className:"text-left",children:[s,l]}),p[9]=s,p[10]=o):o=p[10],p[11]!==C||p[12]!==_?(c=C?.questions.map((e,n)=>(0,t.jsx)(e$.SuggestedQuestionButton,{question:e,onQuestionSelect:e=>_(e,n+1),variant:"ghost",className:(0,b.cn)("rounded-[20px] bg-surface-secondary px-4 py-3 text-left text-sm text-fg-mid","hover:bg-sand-9/10","animate-in fade-in slide-in-from-bottom-2"),style:{animationDelay:`${(n+1)*60}ms`,animationDuration:"400ms",animationTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",animationFillMode:"backwards"},children:e},`${C.id}-${n}`)),p[11]=C,p[12]=_,p[13]=c):c=p[13],p[14]!==c?(u=(0,t.jsx)("div",{className:"flex flex-col gap-2 px-4 pb-2",children:c}),p[14]=c,p[15]=u):u=p[15],p[16]!==o||p[17]!==u?(m=(0,t.jsxs)(ta.DrawerContent,{className:"pb-8",children:[o,u]}),p[16]=o,p[17]=u,p[18]=m):m=p[18],p[19]!==N||p[20]!==S||p[21]!==m?(h=(0,t.jsx)(ta.Drawer,{open:S,onOpenChange:N,children:m}),p[19]=N,p[20]=S,p[21]=m,p[22]=h):h=p[22],h}var tc=e.i(734840);function td(){let e,a=(0,n.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(eh.TooltipProvider,{delayDuration:200,children:(0,t.jsxs)(eh.Tooltip,{children:[(0,t.jsx)(eh.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("span",{className:"ml-[0.2em] inline-flex",children:(0,t.jsx)(tc.VerifiedBadge,{className:"size-[0.5em]"})})}),(0,t.jsx)(eh.TooltipContent,{side:"bottom",className:"text-sm",children:"Profile Verified"})]})}),a[0]=e):e=a[0],e}function tu(e){let a,i,r,s,l,o,c=(0,n.c)(14),{name:d,verified:u,className:m}=e,h=void 0!==u&&u;c[0]!==d?(a=d.trim(),c[0]=d,c[1]=a):a=c[1];let p=a;
3return c[2]!==m?(i=(0,b.cn)("mt-6 min-w-0 w-full",m),c[2]=m,c[3]=i):i=c[3],c[4]!==p?(r=(0,t.jsx)("span",{className:"min-w-0 truncate pb-[0.25em] -mb-[0.25em]",title:p,children:p}),c[4]=p,c[5]=r):r=c[5],c[6]!==h?(s=h?(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(td,{})}):null,c[6]=h,c[7]=s):s=c[7],c[8]!==r||c[9]!==s?(l=(0,t.jsx)("h1",{className:"-ml-0.5 min-w-0 w-full pb-[0.12em] font-heading text-[clamp(36px,10vw,52px)] font-semibold leading-[1.1] tracking-tight text-fg-high",children:(0,t.jsxs)("span",{className:"inline-flex max-w-full items-center",children:[r,s]})}),c[8]=r,c[9]=s,c[10]=l):l=c[10],c[11]!==i||c[12]!==l?(o=(0,t.jsx)("div",{className:i,children:l}),c[11]=i,c[12]=l,c[13]=o):o=c[13],o}var tm=e.i(183144),th=e.i(117741),tp=e.i(831543);function tf(e){let a,i,r,s,l,o,u,m,h,f,v,y,w,j,S,C,N,_=(0,n.c)(38),{username:k,className:I,ref:P}=e,E=(0,g.useQueryClient)(),T=(0,th.useOwnerUserId)(),A=(0,c.useReducedMotion)(),[R,M]=(0,d.useState)(""),[O,D]=(0,d.useState)(!1),U=(0,d.useRef)(!1),L=O&&0===R.length;_[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,x.putUsersMeMutation)(),_[0]=a):a=_[0],_[1]!==E||_[2]!==k?(i=async()=>{await Promise.all([E.invalidateQueries({queryKey:(0,x.getUsersMeQueryKey)()}),E.invalidateQueries({queryKey:(0,x.getUsersByUsernameQueryKey)({path:{username:k}})})])},_[1]=E,_[2]=k,_[3]=i):i=_[3],_[4]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{U.current=!1},_[4]=r):r=_[4],_[5]!==i?(s={...a,onSuccess:i,onError:tg,onSettled:r},_[5]=i,_[6]=s):s=_[6];let{mutate:z,isPending:F}=(0,p.useMutation)(s);_[7]!==R||_[8]!==z||_[9]!==T?(l=()=>{let e=R.trim();return!e||U.current||(U.current=!0,z({query:T?{ownerUserId:T}:void 0,body:{name:e}})),e},_[7]=R,_[8]=z,_[9]=T,_[10]=l):l=_[10];let q=l;_[11]!==R?(o=()=>({draft:()=>R.trim()}),u=[R],_[11]=R,_[12]=o,_[13]=u):(o=_[12],u=_[13]),(0,d.useImperativeHandle)(P,o,u),_[14]!==I?(m=(0,b.cn)("flex min-w-0 w-full items-center",I),_[14]=I,_[15]=m):m=_[15];let B=L?A?"opacity-100":"animate-caret-blink duration-1000":"opacity-0";_[16]!==B?(h=(0,b.cn)("mb-[0.12em] inline-block h-[0.82em] w-0.5 shrink-0 self-center bg-fg-high","font-heading text-[clamp(36px,10vw,52px)] leading-none",B),_[16]=B,_[17]=h):h=_[17],_[18]!==h?(f=(0,t.jsx)("span",{"aria-hidden":!0,className:h}),_[18]=h,_[19]=f):f=_[19],_[20]===Symbol.for("react.memo_cache_sentinel")?(v=e=>M(e.target.value),_[20]=v):v=_[20],_[21]!==q?(y=e=>{"Enter"===e.key&&(e.preventDefault(),q())},_[21]=q,_[22]=y):y=_[22],_[23]===Symbol.for("react.memo_cache_sentinel")?(w=()=>D(!0),_[23]=w):w=_[23],_[24]!==q?(j=()=>{D(!1),q()},_[24]=q,_[25]=j):j=_[25];let H=L&&"caret-transparent placeholder:text-transparent";return _[26]!==H?(S=(0,b.cn)("min-w-0 flex-1 pb-[0.12em] font-heading text-[clamp(36px,10vw,52px)] font-semibold leading-[1.1] tracking-tight text-fg-high caret-fg-high placeholder:text-fg-low md:text-[clamp(36px,10vw,52px)]",H),_[26]=H,_[27]=S):S=_[27],_[28]!==R||_[29]!==F||_[30]!==y||_[31]!==j||_[32]!==S?(C=(0,t.jsx)(tm.Input,{variant:"unstyled",size:"none",value:R,onChange:v,onKeyDown:y,onFocus:w,onBlur:j,placeholder:"Your Name","aria-label":"Your name",autoComplete:"name",disabled:F,className:S}),_[28]=R,_[29]=F,_[30]=y,_[31]=j,_[32]=S,_[33]=C):C=_[33],_[34]!==f||_[35]!==C||_[36]!==m?(N=(0,t.jsxs)("div",{className:m,children:[f,C]}),_[34]=f,_[35]=C,_[36]=m,_[37]=N):N=_[37],N}function tg(e){m.toast.error((0,tp.parseVisibleError)(e)?.message??"Couldn't save your name.")}let tx=["novice","skilled","expert","master","sage","legendary","eternal"],tb={novice:"text-mind-novice",skilled:"text-mind-skilled",expert:"text-mind-expert",master:"text-mind-master",sage:"text-mind-sage",legendary:"text-mind-legendary",eternal:"text-mind-eternal"},tv=["var(--mind-novice)","var(--mind-skilled)","var(--mind-expert)","var(--mind-master)","var(--mind-sage)","var(--mind-legendary)"],ty=[{baseOrbitRadius:9,size:6,opacity:.5,startAngle:0,orbitDuration:12,hoverTransform:"translate(0.4px, -1px) scale(1.05)"},{baseOrbitRadius:9,size:4,opacity:.4,startAngle:180,orbitDuration:18,hoverTransform:"translate(0.2px, 1px) scale(1.05)"},{baseOrbitRadius:9,size:3,opacity:.2,startAngle:90,orbitDuration:15,hoverTransform:"translate(-0.8px, -0.8px) scale(1.07)"},{baseOrbitRadius:9,size:7,opacity:.3,startAngle:270,orbitDuration:20,hoverTransform:"translate(1px, 1px) scale(1.05)"},{baseOrbitRadius:5,size:3,opacity:.5,startAngle:45,orbitDuration:10,hoverTransform:"translate(-0.3px, 1px) scale(1.05)"},{baseOrbitRadius:6,size:5,opacity:.35,startAngle:315,orbitDuration:14,hoverTransform:"translate(0.8px, -1px) scale(1.06)"},{baseOrbitRadius:8,size:4,opacity:.45,startAngle:135,orbitDuration:16,hoverTransform:"translate(-1px, -0.8px) scale(1.06)"}];function tw(e){let t=1e4*Math.sin(e);return t-Math.floor(t)}function tj(e){let a,i,r,s,l,o=(0,n.c)(18),{tier:c,seed:d,className:u,style:m}=e,h=void 0===d?0:d,p=tx.indexOf(c)+1,f="eternal"===c;if(o[0]!==p||o[1]!==h){let e;o[3]!==h?(e=(e,t)=>{let n=1e3*h+100*t,a=1e3*h+100*t+50;return{...e,startAngle:Math.round(360*tw(n)*100)/100,orbitDuration:Math.round(e.orbitDuration*(.8+.4*tw(a))*100)/100}},o[3]=h,o[4]=e):e=o[4],a=ty.slice(0,p).map(e),o[0]=p,o[1]=h,o[2]=a}else a=o[2];let g=a,x=tb[c];if(o[5]!==u||o[6]!==x?(i=(0,b.cn)("mind-score-icon relative size-6",x,u),o[5]=u,o[6]=x,o[7]=i):i=o[7],o[8]!==f||o[9]!==g){let e;o[11]!==f?(e=(e,n)=>(0,t.jsx)("div",{className:"mind-leaf absolute",style:{left:"50%",top:"50%","--orbit-radius":`${e.baseOrbitRadius}px`,"--orbit-hover-radius":`${e.baseOrbitRadius+2}px`,"--start-angle":`${e.startAngle}deg`,"--orbit-duration":`${e.orbitDuration}s`},children:(0,t.jsx)("div",{className:"mind-orbit",children:(0,t.jsx)("div",{className:"mind-circle",style:{width:`${e.size}px`,height:`${e.size}px`,borderRadius:"50%",backgroundColor:f?tv[n%tv.length]:"currentColor",opacity:e.opacity,"--circle-hover-delta":e.hoverTransform}})})},n),o[11]=f,o[12]=e):e=o[12],r=g.map(e),o[8]=f,o[9]=g,o[10]=r}else r=o[10];return o[13]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)("div",{className:"mind-center absolute",style:{left:"50%",top:"50%",transform:"translate(-50%, -50%)"},children:(0,t.jsx)("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"currentColor"}})}),o[13]=s):s=o[13],o[14]!==m||o[15]!==i||o[16]!==r?(l=(0,t.jsxs)("div",{className:i,style:m,children:[r,s]}),o[14]=m,o[15]=i,o[16]=r,o[17]=l):l=o[17],l}var tS=e.i(564821);function tC(e){return e.data.score}function tN(e){return e.data.status}function t_(e){let a,i,r,s,l,o,c,d,u,m,h,p,g=(0,n.c)(30),{userId:b,username:v,cloneName:y}=e,w=function(e){let t,a,i=(0,n.c)(4);i[0]!==e?(t=(0,x.getMindByUserByUserIdScoreOptions)({path:{userId:e}}),i[0]=e,i[1]=t):t=i[1],i[2]!==t?(a={...t,select:tC,staleTime:3e5},i[2]=t,i[3]=a):a=i[3];let{data:r}=(0,f.useQuery)(a);return r??0}(b),j=function(e,t){let a,i,r=(0,n.c)(5);r[0]!==e?(a=(0,x.getMindByUserByUserIdVisualizationOptions)({path:{userId:e}}),r[0]=e,r[1]=a):a=r[1],r[2]!==t||r[3]!==a?(i={...a,enabled:t,select:tN,staleTime:3e5,retry:!1},r[2]=t,r[3]=a,r[4]=i):i=r[4];let{data:s}=(0,f.useQuery)(i);return s??null}(b,w>0);if(w<=0||"ok"!==j)return null;if(g[0]!==y||g[1]!==w||g[2]!==v){let e,n=(0,tS.getScoreLevel)(w);g[12]!==y?(e=y.split(" ")[0]??y,g[12]=y,g[13]=e):e=g[13];let m=e;d="flex shrink-0 items-center gap-3",g[14]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(eH.Separator,{orientation:"vertical",variant:"loud"}),g[14]=u):u=g[14],i=e8.default,l=`/${v}/visualize`,o="flex cursor-pointer items-center transition-opacity hover:opacity-80",c=`Visualize ${m}'s Mind`,a=tj,r="size-5",s=(0,tS.mindTierSlug)(n.key),g[0]=y,g[1]=w,g[2]=v,g[3]=a,g[4]=i,g[5]=r,g[6]=s,g[7]=l,g[8]=o,g[9]=c,g[10]=d,g[11]=u}else a=g[3],i=g[4],r=g[5],s=g[6],l=g[7],o=g[8],c=g[9],d=g[10],u=g[11];return g[15]!==a||g[16]!==w||g[17]!==r||g[18]!==s?(m=(0,t.jsx)(a,{className:r,tier:s,seed:w}),g[15]=a,g[16]=w,g[17]=r,g[18]=s,g[19]=m):m=g[19],g[20]!==i||g[21]!==l||g[22]!==o||g[23]!==c||g[24]!==m?(h=(0,t.jsx)(i,{href:l,className:o,"aria-label":c,children:m}),g[20]=i,g[21]=l,g[22]=o,g[23]=c,g[24]=m,g[25]=h):h=g[25],g[26]!==d||g[27]!==u||g[28]!==h?(p=(0,t.jsxs)("div",{className:d,children:[u,h]}),g[26]=d,g[27]=u,g[28]=h,g[29]=p):p=g[29],p}var tk=e.i(111541);function tI(e){let a,i,r,s,l=(0,n.c)(8),{children:o,open:c,onOpenChange:d}=e;return l[0]!==o?(a=(0,t.jsx)(tk.PopoverAnchor,{asChild:!0,children:o}),l[0]=o,l[1]=a):a=l[1],l[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(tk.PopoverArrow,{width:20,height:10,className:"fill-tangerine-9"}),l[2]=i):i=l[2],l[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)(tk.PopoverContent,{variant:"unstyled",side:"top",align:"start",sideOffset:12,collisionPadding:16,onOpenAutoFocus:tE,onCloseAutoFocus:tP,className:"pointer-events-none w-max min-w-[200px] max-w-[280px] rounded-[24px] bg-tangerine-9 p-2 pt-1.5 text-white shadow-none outline-hidden duration-100 dark:bg-tangerine-9",children:[i,(0,t.jsxs)(tk.PopoverHeader,{className:"gap-1 p-2",children:[(0,t.jsx)(tk.PopoverTitle,{className:"text-[17px] font-semibold text-white",children:"Set up your Delphi"}),(0,t.jsx)(tk.PopoverDescription,{className:"mb-0 text-[13px] leading-tight text-white",children:"Pick a question to start setting it up."})]})]}),l[3]=r):r=l[3],l[4]!==d||l[5]!==c||l[6]!==a?(s=(0,t.jsxs)(tk.Popover,{open:c,onOpenChange:d,children:[a,r]}),l[4]=d,l[5]=c,l[6]=a,l[7]=s):s=l[7],s}function tP(e){return e.preventDefault()}function tE(e){return e.preventDefault()}function tT(e){let a,i,r,s,l,o,c,u,m=(0,n.c)(18),{questions:h,activeHighlight:p,clearHighlight:f,onQuestionClick:g,guidedFirstRun:x,isRefreshing:v,refreshKey:y}=e,w=void 0!==v&&v,j=(0,d.useRef)(null),S=p?(0,e$.toSuggestedQuestionItems)(`highlight-${p.id}`,p.questions):(0,e$.toSuggestedQuestionItems)("profile",h),C=void 0!==x&&x&&!p&&S.length>0,[N,_]=(0,d.useState)(!1);!C&&N&&_(!1),m[0]!==C?(a=()=>
3{if(!C)return;let e=window.setTimeout(()=>{_(!0)},500);return()=>window.clearTimeout(e)},i=[C],m[0]=C,m[1]=a,m[2]=i):(a=m[1],i=m[2]),(0,d.useEffect)(a,i),m[3]!==g||m[4]!==C?(r=(e,t)=>{C&&_(!1),g(e,t)},m[3]=g,m[4]=C,m[5]=r):r=m[5];let k=r;if(m[6]!==C?(s=()=>{C&&j.current?.scrollIntoView({block:"center",inline:"nearest"})},l=[C],m[6]=C,m[7]=s,m[8]=l):(s=m[7],l=m[8]),(0,d.useEffect)(s,l),0===S.length)return null;m[9]!==p||m[10]!==f?(o=(0,t.jsx)("div",{className:"flex w-full items-center justify-between gap-2 pb-4",children:(0,t.jsx)("h2",{id:"questions-section",className:"text-xl font-semibold tracking-tight text-fg-high",children:p?(0,t.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 overflow-hidden tracking-tight transition-all duration-300",children:[(0,t.jsxs)("button",{type:"button",onClick:f,className:"inline-flex cursor-pointer items-center gap-2 opacity-40 transition-opacity duration-300 hover:opacity-100",children:[(0,t.jsx)(eo.ConversationsSolidIcon,{className:"size-5 shrink-0"}),"Ask me about"]}),(0,t.jsx)("span",{className:"opacity-40",children:"/"}),(0,t.jsx)("span",{className:"animate-in overflow-hidden text-ellipsis whitespace-nowrap duration-300 fade-in",children:p.word},p.word)]}):(0,t.jsxs)("span",{className:"inline-flex animate-in items-center gap-2 duration-300 fade-in",children:[(0,t.jsx)(eo.ConversationsSolidIcon,{className:"size-5 shrink-0"}),"Ask me about"]})})}),m[9]=p,m[10]=f,m[11]=o):o=m[11];let I=p?.id??`featured-${void 0===y?0:y}`,P=S.map((e,n)=>{let a=C&&0===n,i=(0,t.jsx)(e$.SuggestedQuestionButton,{ref:a?j:void 0,question:e.question,onQuestionSelect:e=>k(e,n+1),className:(0,b.cn)("max-w-full shrink rounded-3xl px-4 py-2.5 text-left text-base whitespace-normal","animate-in fade-in slide-in-from-bottom-4",a&&"guided-question-glow"),style:{animationDelay:`${(n+1)*80}ms`,animationDuration:"500ms",animationTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",animationFillMode:"backwards"},children:(0,t.jsx)("span",{className:w?"opacity-0":void 0,children:e.question})});return(0,t.jsx)("span",{className:(0,b.cn)("relative max-w-full shrink",w&&"question-loading-glow rounded-3xl"),children:a?(0,t.jsx)(tI,{open:N,onOpenChange:_,children:i}):i},e.id)});return m[12]!==I||m[13]!==P?(c=(0,t.jsx)("div",{className:"-ml-4 -mr-4 flex flex-row flex-wrap gap-2",children:P},I),m[12]=I,m[13]=P,m[14]=c):c=m[14],m[15]!==o||m[16]!==c?(u=(0,t.jsxs)("section",{className:"mb-8 rounded-[30px] bg-surface-secondary p-6 pb-2","aria-live":"polite","aria-labelledby":"questions-section",children:[o,c]}),m[15]=o,m[16]=c,m[17]=u):u=m[17],u}var tA=e.i(226159),tR=e.i(891089),tM=e.i(539964);function tO(e){let t={owner_user_id:e.ownerUserId,owner_username:e.ownerUsername};return e.ownerUserId&&(t.$groups={delphi:e.ownerUserId}),t}function tD(e){let a,i,r,s,l=(0,n.c)(15),{name:o,username:c,image:d,size:u,blur:m,requireImage:h,onImageError:p}=e;l[0]!==d?(a=d?.trim()||void 0,l[0]=d,l[1]=a):a=l[1];let f=a;return l[2]!==m||l[3]!==p||l[4]!==f?(i=f?(0,t.jsx)(eB.AvatarImage,{src:f,alt:"",className:(0,b.cn)(m&&"blur-[3px]"),onLoadingStatusChange:e=>{"error"===e&&p?.()}}):null,l[2]=m,l[3]=p,l[4]=f,l[5]=i):i=l[5],l[6]!==m||l[7]!==o||l[8]!==h||l[9]!==c?(r=h?null:(0,t.jsx)(eB.AvatarFallback,{className:(0,b.cn)(m&&"blur-[2px]"),children:(0,eN.profileInitials)(o,c??o)}),l[6]=m,l[7]=o,l[8]=h,l[9]=c,l[10]=r):r=l[10],l[11]!==u||l[12]!==i||l[13]!==r?(s=(0,t.jsxs)(eB.Avatar,{size:u,children:[i,r]}),l[11]=u,l[12]=i,l[13]=r,l[14]=s):s=l[14],s}var tU=e.i(468435),tL=e.i(685951),tz=e.i(689688),tF=e.i(988380);let tq="Someone";function tB(e,t,n,a){let i=a?.exclude,r=(function(e,t){let n=[],a=new Set;for(let i of e){if(n.length>=4)break;i.username&&i.username!==t&&(0,eN.hasRealProfileImage)(i.image)&&(a.has(i.username)||(a.add(i.username),n.push({username:i.username,name:i.name?.trim()||i.username,descriptor:i.headline?.trim()||"",image:i.image.trim(),verified:!0})))}return n})(e,n).filter(e=>!i?.has(e.username));if(r.length>=4)return r.slice(0,4);let s=new Set(r.map(e=>e.username));for(let e of i??[])s.add(e);let l=function(e,t,n){if(!e)return[];let a=n?.exclude,i=n?.limit??4,r=[],s=new Set;for(let n of e.faces){if(r.length>=i)break;!(!n.slug||n.slug===t||a?.has(n.slug))&&(0,eN.hasRealProfileImage)(n.imageUrl)&&(s.has(n.slug)||(s.add(n.slug),r.push({username:n.slug,name:n.name?.trim()||n.slug,descriptor:"",image:n.imageUrl.trim(),verified:!0})))}return r}(t,n,{exclude:s,limit:4-r.length});return[...r,...l]}let tH=new Set(["how","what","why","which","when","where","who","should","can","could","would","do","does","is","are"]),t$={growth:0,business:1,career:2,relationships:3,health:4,creativity:5,family:6}
3,tV={business:["founder","startup","venture","pitch","company","ceo","vc","business","entrepreneur","investor"],career:["career","job","hiring","manager","lawyer","attorney","court","recruiter"],growth:["college","school","success","travel"],health:["fitness","health","doctor","supplement","meditat"],relationships:["partner","marriage","friend","dating"],family:["child","parent","baby","family"],creativity:["writing","journal","dinner","paint","music"]},tG=new Set(["a","an","and","are","at","for","from","in","is","of","on","or","the","to","with"]);function tQ(e,t){let n=t?.trim();n&&e.push(n)}function tK(e,t){let n=t.get(e.username);return{...e,verified:!0,descriptor:n?.descriptor||e.descriptor}}let tW=(0,d.createContext)(null);function tY(e){return{...(0,x.getUsersByUsernameFamiliarFacesOptions)({path:{username:e}}),staleTime:216e5}}function tX(e){return{...(0,x.getUsersByUsernameOptions)({path:{username:e}})}}function tZ(e){return e.username}function tJ(e){return"slug"in e?[e.slug]:[]}function t0(e){return e.headline}function t1(e){return e.username?[e.username]:[]}function t2(e){let a,i=(0,n.c)(3),{ownerUsername:r,children:s}=e,l=function(e){let t,a,i,r=(0,n.c)(11),{catalog:s}=(0,tF.useAdviceCatalog)();r[0]!==e?(t=tY(e),r[0]=e,r[1]=t):t=r[1];let l=(0,f.useQuery)(t);r[2]!==e?(a=(0,x.getUsersByUsernameOptions)({path:{username:e}}),r[2]=e,r[3]=a):a=r[3];let o=(0,f.useQuery)(a),c=l.isPending?[]:l.data?.data??[],d=new Set(c.flatMap(t1)),u=o.data?.data?.profile,m=function(e,t){if(!e)return[];let n=t?.familiarUsernames??new Set,a=(t?.interest??"").toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>=3&&!tG.has(e)),i=e.categories.flatMap((e,t)=>e.questions.map((i,r)=>{var s;let l;return{question:i,categoryId:e.id,categoryIndex:t,ordinal:r,interrogative:function(e){if(e.includes("?"))return!0;let t=e.trim().toLowerCase().replace(/[\u2018\u2019]/g,"'").split(/\s+/)[0]?.replace(/^[^a-z]+|[^a-z']+$/g,"");return null!=t&&tH.has(t)}(i.text),familiar:i.faces.some(e=>n.has(e.slug)),interestHits:function(e,t){if(0===t.length)return 0;let n=e.toLowerCase();return t.reduce((e,t)=>e+ +!!n.includes(t),0)}(`${i.text} ${e.label}`,a)+(s=e.id,(l=tV[s])&&0!==a.length?a.reduce((e,t)=>l.includes(t)?e+1:t.length<4?e:e+ +!!l.some(e=>t.startsWith(e)||e.startsWith(t)),0):0)}}));return i.sort((e,t)=>{if(e.familiar!==t.familiar)return e.familiar?-1:1;if(e.interestHits!==t.interestHits)return t.interestHits-e.interestHits;if(e.interrogative!==t.interrogative)return e.interrogative?-1:1;if(!e.familiar&&0===e.interestHits){let n=(t$[e.categoryId]??4)-(t$[t.categoryId]??4);if(0!==n)return n}return e.ordinal!==t.ordinal?e.ordinal-t.ordinal:e.categoryIndex-t.categoryIndex}),i.slice(0,11).map(({question:e})=>{var t,a;let i;return t=e.text,a=e.faces,i=a.find(e=>n.has(e.slug))??a[0],i?.slug?{question:t,slug:i.slug}:{question:t,from:"Someone"}})}(s,{interest:function(e){let t=[];for(let n of(tQ(t,e.headline),tQ(t,e.bio),e.questions??[]))tQ(t,n);for(let n of e.organizations??[])tQ(t,n.role),tQ(t,n.name);for(let n of e.chapters??[])for(let e of(tQ(t,n.title),tQ(t,n.organization),n.questions??[]))tQ(t,e);for(let n of e.familiarHeadlines??[])tQ(t,n);return t.join(" ")}({headline:u?.headline,bio:u?.bio,questions:u?.questions,organizations:u?.organizations,chapters:u?.chapters,familiarHeadlines:c.map(t0)}),familiarUsernames:d}),h=tB(c,s,e),p=[...new Set([...m.flatMap(tJ),...h.map(tZ)])],g=(0,tL.useQueries)({queries:p.map(tX)}),b=function(e){let t=new Map;if(!e)return t;for(let n of e.categories)for(let e of n.questions)for(let n of e.faces)t.has(n.slug)||t.set(n.slug,{username:n.slug,name:n.name,descriptor:"",image:(0,eN.hasRealProfileImage)(n.imageUrl)?n.imageUrl.trim():"",verified:!1});return t}(s),v=new Set;for(let[e,t]of g.entries()){var y;let n=p[e];if(!n)continue;t.isError&&v.add(n);let a=t.data?.data;if(!a)continue;let i=a.profile;b.set(n,{username:(y={username:a.user.username,name:a.user.name,image:a.user.image,headline:i?.headline??null,roleLine:(0,tt.formatRoleLine)((0,tt.selectLatestOrganization)(i?.organizations??[])),verified:a.isVerified}).username,name:y.name?.trim()||y.username,descriptor:y.headline?.trim()||y.roleLine?.trim()||"",image:(0,eN.hasRealProfileImage)(y.image)?y.image.trim():"",verified:y.verified})}let w=m.map((e,t)=>(function(e,t,n,a){if(!("slug"in e))return{index:t,question:e.question,from:e.from,anonymous:!0};let i=n.get(e.slug);return i?.image?{index:t,question:e.question,from:tq,image:i.image,anonymous:!0}:(a.has(e.slug),{index:t,question:e.question,from:tq,anonymous:!0})})(e,t,b,v)),j=o.data?.data?.user?.id??null,S=w.filter(e=>e.image).slice(0,3),C=h.map(e=>tK(e,b));return r[4]!==w||r[5]!==e||r[6]!==b||r[7]!==j||r[8]!==S||r[9]!==C?(i={ownerUsername:e,ownerUserId:j,askedQuestions:w,askingAvatars:S,recommended:C,teaserProfiles:b},r[4]=w,r[5]=e,r[6]=b,r[7]=j,r[8]=S,r[9]=C,r[10]=i):i=r[10],i}(r);return i[0]!==s||i[1]!==l?(a=(0,t.jsx)(tW.Provider,{value:l,children:s}),i[0]=s,i[1]=l,i[2]=a):a=i[2],a}function t3(){let e=(0,d.useContext)(tW);if(!e)throw Error("useVisitorTeaserProfiles requires VisitorTeaserProfilesProvider");return e}let t4=[{icon:eo.FileLinesIcon,width:"w-3/5"}
3,{icon:eo.YoutubeIcon,width:"w-2/5"},{icon:eo.BookIcon,width:"w-1/2"}];function t5(e){let a,i,r,s=(0,n.c)(6),{children:l,onDismiss:o}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(eo.XmarkIcon,{className:"size-4"}),s[0]=a):a=s[0],s[1]!==o?(i=(0,t.jsx)(el.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Back to input",onClick:o,className:"absolute top-3 right-3 text-fg-mid",children:a}),s[1]=o,s[2]=i):i=s[2],s[3]!==l||s[4]!==i?(r=(0,t.jsxs)("div",{role:"status",className:"relative flex w-full flex-col items-center gap-4 px-6 py-8 text-center",children:[i,l]}),s[3]=l,s[4]=i,s[5]=r):r=s[5],r}function t6(e){let a,i,r=(0,n.c)(5),{href:s,onClick:l,children:o}=e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(eo.ArrowUpRightIcon,{className:"size-4"}),r[0]=a):a=r[0],r[1]!==o||r[2]!==s||r[3]!==l?(i=(0,t.jsx)(el.Button,{asChild:!0,variant:"ghost",size:"lg",className:"gap-1.5 text-base font-semibold text-fg-high hover:bg-transparent",children:(0,t.jsxs)(e8.default,{href:s,onClick:l,children:[o,a]})}),r[1]=o,r[2]=s,r[3]=l,r[4]=i):i=r[4],i}function t7(e){let a,i,r,s,l,o=(0,n.c)(11),{onDismiss:c}=e,d=t3(),{askingAvatars:u}=d;return o[0]!==u?(a=u.map(t8),o[0]=u,o[1]=a):a=o[1],o[2]!==a?(i=(0,t.jsx)("div",{className:"flex items-end gap-3",children:a}),o[2]=a,o[3]=i):i=o[3],o[4]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("p",{className:"text-lg text-fg-mid",children:"Claim to view what people are asking"}),o[4]=r):r=o[4],o[5]!==d?(s=(0,t.jsx)(t6,{href:"/onboarding",onClick:()=>{(0,tR.track)("profile:asking_teaser_click",{...tO(d),click_target:"claim_profile"})},children:"Claim your profile"}),o[5]=d,o[6]=s):s=o[6],o[7]!==c||o[8]!==i||o[9]!==s?(l=(0,t.jsxs)(t5,{onDismiss:c,children:[i,r,s]}),o[7]=c,o[8]=i,o[9]=s,o[10]=l):l=o[10],l}function t8(e,n){return(0,t.jsxs)("div",{className:(0,b.cn)("flex flex-col items-center gap-1.5",1===n&&"-translate-y-2"),children:[(0,t.jsx)("span",{className:"flex items-center gap-1 rounded-2xl bg-sand-9/10 px-3 py-2.5",children:[0,1,2].map(e=>(0,t.jsx)("span",{className:"size-1 rounded-full bg-fg-low motion-safe:animate-typing-dot-wave",style:{animationDelay:`${200*e-400*n}ms`}},e))}),(0,t.jsx)(tD,{name:e.from,image:e.image,size:1===n?"6xl":"5xl",blur:!0})]},e.index)}function t9(e){let a,i,r,s,l,o=(0,n.c)(13),{firstName:c,ownerImage:d,onDismiss:u}=e,m=t3(),h=d??void 0;return o[0]!==c||o[1]!==h?(a=(0,t.jsx)(tD,{name:c,image:h,size:"6xl"}),o[0]=c,o[1]=h,o[2]=a):a=o[2],o[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("div",{"aria-hidden":!0,className:"flex w-full flex-col gap-2.5",children:t4.map(ne)}),o[3]=i):i=o[3],o[4]!==c?(r=(0,t.jsxs)("p",{className:"text-lg text-fg-mid",children:["Explore ",c,"âs expertise"]}),o[4]=c,o[5]=r):r=o[5],o[6]!==m?(s=(0,t.jsx)(t6,{href:"/onboarding",onClick:()=>{(0,tR.track)("profile:explore_expertise_click",{...tO(m),click_target:"claim_profile"})},children:"Claim to explore"}),o[6]=m,o[7]=s):s=o[7],o[8]!==u||o[9]!==a||o[10]!==r||o[11]!==s?(l=(0,t.jsxs)(t5,{onDismiss:u,children:[a,i,r,s]}),o[8]=u,o[9]=a,o[10]=r,o[11]=s,o[12]=l):l=o[12],l}function ne(e){let{icon:n,width:a}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-sand-9/10",children:(0,t.jsx)(n,{className:"size-3.5 text-fg-mid"})}),(0,t.jsx)("span",{className:(0,b.cn)("h-2.5 rounded-full bg-sand-9/10",a)})]},a)}function nt(e){let a=(0,n.c)(6),{card:i,firstName:r,ownerImage:s,onDismiss:l,composer:o}=e;if(null===i)return o;switch(i.kind){case"asking":{let e;return a[0]!==l?(e=(0,t.jsx)(t7,{onDismiss:l}),a[0]=l,a[1]=e):e=a[1],e}case"explore":{let e;return a[2]!==r||a[3]!==l||a[4]!==s?(e=(0,t.jsx)(t9,{firstName:r,ownerImage:s,onDismiss:l}),a[2]=r,a[3]=l,a[4]=s,a[5]=e):e=a[5],e}default:return i}}let nn=(0,b.cn)("rounded-none border-none bg-transparent dark:bg-transparent backdrop-blur-none","[box-shadow:none] dark:[box-shadow:none]"),na={type:"spring",duration:.5,bounce:.05},ni={duration:.28,ease:[.23,1,.32,1],delay:.12},nr={duration:.24,ease:[.23,1,.32,1],delay:.3};function ns(e){let a,i,r,s,l,o,u,m,h,p,f,g,x,y,w,j,S,C,N,_,k,P=(0,n.c)(57),{displayName:E,ownerImage:T,preview:A}=e;if(P[0]!==E)a=E.trim().split(/\s+/)[0]||E,P[0]=E,P[1]=a;else a=P[1];let R=a,M=t3(),{actions:O,state:D}=(0,I.usePromptInput)();P[2]!==D.input?(i=D.input.trim(),P[2]=D.input,P[3]=i):i=P[3];let U=i.length>0,L=(0,c.useReducedMotion)()??!1,{card:z,setCard:F}=A,q=null!==z,B=(0,d.useRef)(null);P[4]!==F?(r=()=>F(null),P[4]=F,P[5]=r):r=P[5];let H=r,$=(0,d.useRef)(H);P[6]!==H?(s=()=>{$.current=H},P[6]=H,P[7]=s):s=P[7],(0,d.useEffect)(s);let[V,G]=(0,d.useState)(null),[Q,K]=(0,d.useState)(null);P[8]!==V?(l=()=>{if(!V)return;let e=new ResizeObserver(()=>K(V.offsetHeight));return e.observe(V),()=>e.disconnect()},o=[V],P[8]=V,P[9]=l,P[10]=o):(l=P[9],o=P[10]),(0,d.useEffect)(l,o);let[W,Y]=(0,d.useState)(z),[X,Z]=(0,d.useState)(!1);W!==z&&(Y(z),Z(!0)),P[11]!==q?(u=()=>{if(!q)return;let e=e=>{let t=B.current;t&&e.target instanceof Node&&(t.contains(e.target)||$.current())},t=e=>{"Escape"===e.key&&$.current()};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},m=[q],P[11]=q,P[12]=u,P[13]=m):(u=P[12],m=P[13]),(0,d.useEffect)(u,m);let J=Q??"auto",ee=q?"24rem":"47rem",et=q?28:32;
3P[14]!==ee||P[15]!==et||P[16]!==J?(h={height:J,maxWidth:ee,borderRadius:et},P[14]=ee,P[15]=et,P[16]=J,P[17]=h):h=P[17],P[18]!==L?(p=L?{duration:0}:na,P[18]=L,P[19]=p):p=P[19],P[20]!==q?(f=(0,b.cn)("relative mx-auto w-full overflow-hidden border","transition-[background-color,border-color,box-shadow,backdrop-filter] duration-[450ms] ease-out-quart",q?"border-subtle bg-surface-secondary":(0,b.cn)("border-loud bg-sand-1/60 backdrop-blur-md dark:bg-sand-4/70",v.chatChrome.promptContainerShadow)),P[20]=q,P[21]=f):f=P[21];let en=null===z?"composer":z.kind;P[22]!==X||P[23]!==L?(g=!!X&&!L&&{opacity:0,filter:"blur(2px)"},P[22]=X,P[23]=L,P[24]=g):g=P[24],P[25]===Symbol.for("react.memo_cache_sentinel")?(x={opacity:1,filter:"blur(0px)"},P[25]=x):x=P[25];let ea=q?ni:nr;P[26]!==O||P[27]!==M||P[28]!==F?(y=e=>{let{text:t}=e;t.trim()&&((0,tR.track)("profile:explore_expertise_click",{...tO(M),click_target:"submit"}),F({kind:"explore"}),O.clear())},P[26]=O,P[27]=M,P[28]=F,P[29]=y):y=P[29];let ei=`Explore ${R}'s expertise`,es=`Explore ${R}'s expertise`;P[30]!==ei||P[31]!==es?(w=(0,t.jsx)(tA.PromptInput.Textarea,{"aria-label":ei,placeholder:es}),P[30]=ei,P[31]=es,P[32]=w):w=P[32];let el=!U;return P[33]!==el?(j=(0,t.jsx)("div",{className:"relative flex h-12 min-w-12 items-center justify-center",children:(0,t.jsx)(tA.PromptInput.Submit,{className:"relative mr-0",disabled:el})}),P[33]=el,P[34]=j):j=P[34],P[35]!==w||P[36]!==j?(S=(0,t.jsxs)(tA.PromptInput.Actions,{children:[w,j]}),P[35]=w,P[36]=j,P[37]=S):S=P[37],P[38]!==y||P[39]!==S?(C=(0,t.jsx)(tM.ChatComposerFrame,{className:nn,onSubmit:y,children:S}),P[38]=y,P[39]=S,P[40]=C):C=P[40],P[41]!==z||P[42]!==H||P[43]!==R||P[44]!==T||P[45]!==C?(N=(0,t.jsx)(nt,{card:z,firstName:R,ownerImage:T,onDismiss:H,composer:C}),P[41]=z,P[42]=H,P[43]=R,P[44]=T,P[45]=C,P[46]=N):N=P[46],P[47]!==en||P[48]!==g||P[49]!==ea||P[50]!==N?(_=(0,t.jsx)("div",{ref:G,children:(0,t.jsx)(er.motion.div,{initial:g,animate:x,transition:ea,children:N},en)}),P[47]=en,P[48]=g,P[49]=ea,P[50]=N,P[51]=_):_=P[51],P[52]!==h||P[53]!==p||P[54]!==f||P[55]!==_?(k=(0,t.jsx)(er.motion.div,{ref:B,initial:!1,animate:h,transition:p,className:f,children:_}),P[52]=h,P[53]=p,P[54]=f,P[55]=_,P[56]=k):k=P[56],k}let nl={opacity:0,y:4},no={opacity:1,y:0},nc={type:"spring",duration:.35,bounce:0},nd={type:"spring",duration:.2,bounce:0};function nu(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"min-w-0 flex flex-col gap-0.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-fg-high",children:"Let's finish setting up."}),(0,t.jsx)("p",{className:"max-w-prose text-xs text-fg-mid",children:"Add a few details to turn this static page into a fully interactive Delphi profile."})]}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("div",{className:"mt-8 mb-10 flex flex-col gap-4 border-t border-subtle pt-8 sm:flex-row sm:items-start sm:justify-between sm:gap-6",children:[e,(0,t.jsx)(el.Button,{asChild:!0,variant:"brand",size:"lg",className:"w-full shrink-0 sm:w-auto",children:(0,t.jsx)(e8.default,{href:"/onboarding",children:"Unlock Your Full Profile"})})]}),i[1]=a):a=i[1],a}function nm(e){let a,i,r,l,o,d,u,m,h,p,f=(0,n.c)(25),{displayName:g,ownerImage:x,preview:v}=e,w=(0,c.useReducedMotion)();return f[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,b.cn)("pointer-events-none absolute inset-x-0 bottom-0 z-30","pb-[max(0.75rem,env(safe-area-inset-bottom))] max-lg:pb-20 lg:pb-0"),f[0]=a):a=f[0],f[1]!==w?(i=w?{opacity:0}:nl,f[1]=w,f[2]=i):i=f[2],f[3]!==w?(r=w?{opacity:1}:no,f[3]=w,f[4]=r):r=f[4],f[5]!==w?(l=w?{opacity:0}:nl,f[5]=w,f[6]=l):l=f[6],f[7]!==w?(o=w?{duration:0}:nd,f[7]=w,f[8]=o):o=f[8],f[9]!==l||f[10]!==o?(d={...l,transition:o},f[9]=l,f[10]=o,f[11]=d):d=f[11],f[12]!==w?(u=w?{duration:0}:nc,f[12]=w,f[13]=u):u=f[13],f[14]===Symbol.for("react.memo_cache_sentinel")?(m=(0,b.cn)("relative flex flex-col bg-transparent pb-4",`${T.PROFILE_COMPOSER_MAX_WIDTH_CLASS} px-4 md:px-0`),f[14]=m):m=f[14],f[15]!==g||f[16]!==x||f[17]!==v?(h=(0,t.jsx)(y.PageContainer,{className:m,children:(0,t.jsx)("div",{className:"pointer-events-auto pt-3",children:(0,t.jsx)(ns,{displayName:g,ownerImage:x,preview:v})})}),f[15]=g,f[16]=x,f[17]=v,f[18]=h):h=f[18],f[19]!==i||f[20]!==r||f[21]!==d||f[22]!==u||f[23]!==h?(p=(0,t.jsx)(s.AnimatePresence,{initial:!1,children:(0,t.jsx)(er.motion.div,{className:a,initial:i,animate:r,exit:d,transition:u,children:h},"visitor-teasers")}),f[19]=i,f[20]=r,f[21]=d,f[22]=u,f[23]=h,f[24]=p):p=f[24],p}var nh=e.i(533745),np=e.i(670102);function nf(e){let a,i,r,s=(0,n.c)(8),{headingId:l,children:o}=e;return s[0]!==l?(a=(0,t.jsx)("h2",{id:l,className:"pb-2 text-xl font-semibold tracking-tight text-fg-high",children:"People you may know"}),s[0]=l,s[1]=a):a=s[1],s[2]!==o?(i=(0,t.jsx)("div",{className:"-mx-2 flex flex-col gap-2",children:o}),s[2]=o,s[3]=i):i=s[3],s[4]!==l||s[5]!==a||s[6]!==i?(r=(0,t.jsxs)("section",{className:"mb-8 mt-8 -mx-6 rounded-[30px] bg-surface-secondary p-6 md:-mx-4","aria-labelledby":l,children:[a,i]}),s[4]=l,s[5]=a,s[6]=i,s[7]=r):r=s[7],r}function ng(){let e,a,i,r=(0,n.c)(4),s=(0,d.useId)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=Array.from({length:4},nx),a=(0,t.jsx)("span",{className:"sr-only",children:"Loading people you may know"}),r[0]=e,r[1]=a):(e=r[0],a=r[1]),r[2]!==s?(i=(0,t.jsxs)(nf,{headingId:s,children:[e,a]}),r[2]=s,r[3]=i):i=r[3],i}function nx(e,n){return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-3xl px-2 py-2","aria-hidden":!0,
3children:[(0,t.jsx)(np.Skeleton,{className:"size-10 shrink-0 rounded-[28%]"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col gap-1.5",children:[(0,t.jsx)(np.Skeleton,{className:"h-3.5 w-28"}),(0,t.jsx)(np.Skeleton,{className:"h-3 w-40"})]})]},n)}function nb(){let e,a,i=(0,n.c)(7),r=(0,d.useId)(),[s,l]=(0,d.useState)(nv),o=function(e=new Set){let{ownerUsername:t,teaserProfiles:n}=t3(),a=(0,f.useQuery)(tY(t)),i=(0,f.useQuery)((0,tz.adviceCatalogQueryOptions)());return a.isPending||i.isPending?{status:"loading"}:{status:"ready",people:tB(a.data?.data??[],i.data,t,{exclude:e}).map(e=>tK(e,n))}}(s);if("loading"===o.status){let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(ng,{}),i[0]=e):e=i[0],e}if(0===o.people.length)return null;if(i[1]!==o.people){let n;i[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>(0,t.jsx)(ny,{person:e,onImageError:()=>{l(t=>{if(t.has(e.username))return t;let n=new Set(t);return n.add(e.username),n})}},e.username),i[3]=n):n=i[3],e=o.people.map(n),i[1]=o.people,i[2]=e}else e=i[2];return i[4]!==r||i[5]!==e?(a=(0,t.jsx)(nf,{headingId:r,children:e}),i[4]=r,i[5]=e,i[6]=a):a=i[6],a}function nv(){return new Set}function ny(e){let a,i,r,s,l,o,c,d,u,m=(0,n.c)(26),{person:h,onImageError:p}=e,f=t3(),g=`/${h.username}`;return m[0]!==f||m[1]!==h.username?(a=()=>{(0,tR.track)("profile:people_you_may_know_click",{...tO(f),target_username:h.username})},m[0]=f,m[1]=h.username,m[2]=a):a=m[2],m[3]!==p||m[4]!==h.image||m[5]!==h.name||m[6]!==h.username?(i=(0,t.jsx)(tD,{name:h.name,username:h.username,image:h.image,size:"4xl",requireImage:!0,onImageError:p}),m[3]=p,m[4]=h.image,m[5]=h.name,m[6]=h.username,m[7]=i):i=m[7],m[8]!==h.name?(r=(0,t.jsx)("span",{className:"min-w-0 truncate text-sm font-medium text-fg-high",children:h.name}),m[8]=h.name,m[9]=r):r=m[9],m[10]!==h.verified?(s=h.verified?(0,t.jsx)(tc.VerifiedBadge,{className:"size-2.5 self-center"}):null,m[10]=h.verified,m[11]=s):s=m[11],m[12]!==r||m[13]!==s?(l=(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[r,s]}),m[12]=r,m[13]=s,m[14]=l):l=m[14],m[15]!==h.descriptor?(o=h.descriptor?(0,t.jsx)("span",{className:"block truncate text-xs font-normal text-fg-mid",children:h.descriptor}):null,m[15]=h.descriptor,m[16]=o):o=m[16],m[17]!==l||m[18]!==o?(c=(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[l,o]}),m[17]=l,m[18]=o,m[19]=c):c=m[19],m[20]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(eo.ChevronRightIcon,{className:"size-3.5 shrink-0 text-fg-low"}),m[20]=d):d=m[20],m[21]!==g||m[22]!==a||m[23]!==i||m[24]!==c?(u=(0,t.jsx)(el.Button,{asChild:!0,variant:"subtle",size:"none",shape:"none",className:"h-auto w-full justify-start gap-3 whitespace-normal rounded-3xl px-2 py-2 text-left",children:(0,t.jsxs)(e8.default,{href:g,onClick:a,children:[i,c,d]})}),m[21]=g,m[22]=a,m[23]=i,m[24]=c,m[25]=u):u=m[25],u}function nw(){let e,a=(0,n.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(nh.ErrorBoundary,{fallback:null,children:(0,t.jsx)(nb,{})}),a[0]=e):e=a[0],e}let nj={type:"spring",duration:.36,bounce:0},nS={maskImage:"linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 40px), transparent 100%), linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%)",maskComposite:"intersect",WebkitMaskComposite:"source-in",maskRepeat:"no-repeat",WebkitMaskRepeat:"no-repeat"},nC={background:"radial-gradient(120% 75% at 50% 50%, var(--surface-primary) 0%, color-mix(in srgb, var(--surface-primary) 55%, transparent) 48%, transparent 100%)"};function nN(e){return e<=1?[]:Array.from({length:e-1},(e,t)=>t+1)}function n_(e){let a,i,r,s,l,o,c=(0,n.c)(14),{row:d}=e;return c[0]!==d.from||c[1]!==d.image?(a=(0,t.jsx)(tD,{name:d.from,image:d.image,size:"4xl",blur:!0}),c[0]=d.from,c[1]=d.image,c[2]=a):a=c[2],c[3]!==d.from?(i=(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1",children:(0,t.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold text-fg-high",children:d.from})}),c[3]=d.from,c[4]=i):i=c[4],c[5]!==d.question?(r=(0,t.jsxs)("span",{className:"line-clamp-2 text-sm font-normal text-fg-mid sm:truncate sm:block",children:["â",d.question,"â"]}
3),c[5]=d.question,c[6]=r):r=c[6],c[7]!==i||c[8]!==r?(s=(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[i,r]}),c[7]=i,c[8]=r,c[9]=s):s=c[9],c[10]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)("span",{className:"shrink-0 self-center text-xs font-medium text-fg-low transition-colors group-hover/asker:text-fg-mid",children:"View"}),c[10]=l):l=c[10],c[11]!==a||c[12]!==s?(o=(0,t.jsxs)(t.Fragment,{children:[a,s,l]}),c[11]=a,c[12]=s,c[13]=o):o=c[13],o}function nk(e){let a,i,r=(0,n.c)(6),{headingId:s,children:l}=e;return r[0]!==s?(a=(0,t.jsx)("h2",{id:s,className:"pb-2 text-xl font-semibold tracking-tight text-fg-high",children:"See what everyone is asking"}),r[0]=s,r[1]=a):a=r[1],r[2]!==l||r[3]!==s||r[4]!==a?(i=(0,t.jsxs)("section",{className:"mb-8","aria-labelledby":s,children:[a,l]}),r[2]=l,r[3]=s,r[4]=a,r[5]=i):i=r[5],i}function nI(){let e,a,i,r,s=(0,n.c)(5),l=(0,d.useId)();return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(np.Skeleton,{className:"size-10 shrink-0 rounded-[28%]"}),s[0]=e):e=s[0],s[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"-mx-2 flex items-center gap-3 px-2 py-2","aria-hidden":!0,children:[e,(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,t.jsx)(np.Skeleton,{className:"h-3.5 w-28"}),(0,t.jsx)(np.Skeleton,{className:"h-3 w-full max-w-md"})]})]}),(0,t.jsx)("div",{className:"h-[248px] sm:h-[280px]","aria-hidden":!0})]}),i=(0,t.jsx)("span",{className:"sr-only",children:"Loading what everyone is asking"}),s[1]=a,s[2]=i):(a=s[1],i=s[2]),s[3]!==l?(r=(0,t.jsxs)(nk,{headingId:l,children:[a,i]}),s[3]=l,s[4]=r):r=s[4],r}function nP(e){let a,i,r,s,l,o,u,m,p,g,v,y,w,j=(0,n.c)(43),{onView:S,animateEntrance:C}=e,N=(0,d.useId)(),_=(0,c.useReducedMotion)(),k=t3(),I=function(){let e,t,a,i,r=(0,n.c)(8),{ownerUsername:s,askedQuestions:l}=t3();r[0]!==s?(e=tY(s),r[0]=s,r[1]=e):e=r[1];let o=(0,f.useQuery)(e);r[2]===Symbol.for("react.memo_cache_sentinel")?(t=(0,tz.adviceCatalogQueryOptions)(),r[2]=t):t=r[2];let c=(0,f.useQuery)(t);r[3]!==s?(a=(0,x.getUsersByUsernameOptions)({path:{username:s}}),r[3]=s,r[4]=a):a=r[4];let d=(0,f.useQuery)(a);if(o.isPending||c.isPending||d.isPending){let e;return r[5]===Symbol.for("react.memo_cache_sentinel")?(e={status:"loading"}
3,r[5]=e):e=r[5],e}return r[6]!==l?(i={status:"ready",questions:l},r[6]=l,r[7]=i):i=r[7],i}(),P=function(){let e,t=(0,n.c)(2),{ownerUsername:a}=t3();if(t[0]!==a)e=(0,tU.queryOptions)({queryKey:["profile","teaser-ask",a],queryFn:async()=>{let e,{data:t,error:n}=await (0,h.postUsersMeQuestionsGenerate)({query:{ownerUsername:a,source:"teaser"}});if(n||!t)return null;let i=t.data.questions[0]?.trim(),r=t.data.asker?.trim();return(e=i?.trim()??"").length>=10&&/[A-Za-z]/.test(e)&&e.endsWith("?")&&r?{question:i,from:r}:null},staleTime:18e5,retry:!1}),t[0]=a,t[1]=e;else e=t[1];return(0,f.useQuery)(e)}();if(j[0]!==I.questions||j[1]!==I.status||j[2]!==P.data){e:{if("ready"!==I.status){let e;j[4]===Symbol.for("react.memo_cache_sentinel")?(e=[],j[4]=e):e=j[4],a=e;break e}let e=P.data,t=I.questions.map(nA);if(!e){a=t;break e}let n=t.find(nT)??t[0];if(!n){a=t;break e}a=[{...n,question:e.question,from:e.from},...t.filter(t=>t!==n&&t.question!==e.question)]}j[0]=I.questions,j[1]=I.status,j[2]=P.data,j[3]=a}else a=j[3];let E=a,{stack:T,initialIndices:A,pause:R,resume:M}=function(e){let t,a,i,r,s,l,o,c=(0,n.c)(12);c[0]!==e?(t=nN(e).slice(0,6),c[0]=e,c[1]=t):t=c[1];let u=t,[m,h]=(0,d.useState)(u);c[2]!==u?(a=()=>new Set(u),c[2]=u,c[3]=a):a=c[3];let[p,f]=(0,d.useState)(a),[g,x]=(0,d.useState)(e),b=(0,d.useRef)(6),v=(0,d.useRef)(!1);return g!==e&&(x(e),h(u),f(new Set(u))),c[4]!==e?(i=()=>{b.current=6;let t=nN(e);if(t.length<=1)return;let n=null,a=()=>{null!=n&&(window.clearInterval(n),n=null)},i=()=>{"hidden"===document.visibilityState?a():null==n&&(n=window.setInterval(()=>{v.current||h(e=>{let n=new Set(e),a=t[0];for(let e=0;e<t.length;e++){let i=t[(b.current+e)%t.length];if(null!=i&&!n.has(i)){a=i,b.current=(b.current+e+1)%t.length;break}}return[a,...e.slice(0,5)]})},3e4))};return i(),document.addEventListener("visibilitychange",i),()=>{a(),document.removeEventListener("visibilitychange",i)}},r=[e],c[4]=e,c[5]=i,c[6]=r):(i=c[5],r=c[6]),(0,d.useEffect)(i,r),c[7]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{v.current=!0},l=()=>{v.current=!1},c[7]=s,c[8]=l):(s=c[7],l=c[8]),c[9]!==p||c[10]!==m?(o={stack:m,initialIndices:p,pause:s,resume:l},c[9]=p,c[10]=m,c[11]=o):o=c[11],o}(E.length),O=E[0];if("loading"===I.status||P.isPending){let e;return j[5]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(nI,{}),j[5]=e):e=j[5],e}if(!O)return null;j[6]!==S||j[7]!==k?(i=()=>{(0,tR.track)("profile:asking_teaser_click",{...tO(k),click_target:"featured_ask"}),S()},j[6]=S,j[7]=k,j[8]=i):i=j[8];let D=C&&"motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2 motion-safe:duration-300 motion-safe:ease-out";if(j[9]!==D?(r=(0,b.cn)("group/asker flex w-full items-center gap-3 whitespace-normal rounded-2xl px-2 py-2 text-left",D),j[9]=D,j[10]=r):r=j[10],j[11]!==O?(s=O?(0,t.jsx)(n_,{row:O}):null,j[11]=O,j[12]=s):s=j[12],j[13]!==i||j[14]!==r||j[15]!==s?(l=(0,t.jsx)("div",{className:"-mx-2",children:(0,t.jsx)(el.Button,{type:"button",variant:"ghost",size:"none",shape:"none",onPointerDown:nE,onClick:i,className:r,children:s})}),j[13]=i,j[14]=r,j[15]=s,j[16]=l):l=j[16],j[17]!==E||j[18]!==A||j[19]!==_||j[20]!==T){let e;j[22]!==E||j[23]!==A||j[24]!==_?(e=e=>{let n=E[e];return n?(0,t.jsx)(er.motion.div,{layout:!_&&"position",transition:{layout:nj},className:(0,b.cn)("flex items-start gap-3",!A.has(e)&&"motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-14 motion-safe:fill-mode-both motion-safe:duration-[360ms] motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)]"),children:(0,t.jsx)(n_,{row:n})},e):null},j[22]=E,j[23]=A,j[24]=_,j[25]=e):e=j[25],o=T.map(e),j[17]=E,j[18]=A,j[19]=_,j[20]=T,j[21]=o}else o=j[21];return j[26]!==o?(u=(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 flex select-none flex-col gap-4 overflow-hidden blur-[3px]",style:nS,children:o}),j[26]=o,j[27]=u):u=j[27],j[28]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:nC}),j[28]=m):m=j[28],j[29]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)("p",{className:"max-w-xs text-sm text-fg-mid",children:"Your Delphi could be answering every one of these for you."}),j[29]=p):p=j[29],j[30]!==k?(g=(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 px-4 text-center",children:[p,(0,t.jsx)(el.Button,{asChild:!0,variant:"brand",children:(0,t.jsx)(e8.default,{href:"/onboarding",onClick:()=>{(0,tR.track)("profile:asking_teaser_click",{...tO(k),click_target:"unlock_profile"})},children:"Unlock Your Full Profile"})})]}),j[30]=k,j[31]=g):g=j[31],j[32]!==R||j[33]!==M||j[34]!==g||j[35]!==u?(v=(0,t.jsxs)("div",{className:"relative h-[248px] overflow-hidden sm:h-[280px]",onPointerEnter:R,onPointerLeave:M,children:[u,m,g]}),j[32]=R,j[33]=M,j[34]=g,j[35]=u,j[36]=v):v=j[36],j[37]!==v||j[38]!==l?(y=(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[l,v]}
3),j[37]=v,j[38]=l,j[39]=y):y=j[39],j[40]!==N||j[41]!==y?(w=(0,t.jsx)(nk,{headingId:N,children:y}),j[40]=N,j[41]=y,j[42]=w):w=j[42],w}function nE(e){return e.stopPropagation()}function nT(e){return e.image}function nA(e){return{...e,verified:!1,anonymous:!0}}function nR(e){let a,i=(0,n.c)(3),{onView:r,animateEntrance:s}=e,l=void 0===s||s;return i[0]!==l||i[1]!==r?(a=(0,t.jsx)(nh.ErrorBoundary,{fallback:null,children:(0,t.jsx)(nP,{onView:r,animateEntrance:l})}),i[0]=l,i[1]=r,i[2]=a):a=i[2],a}var nM=e.i(627594);let nO="inline-flex size-8 cursor-pointer items-center justify-center rounded-2xl bg-sand-9/7 text-fg-mid transition-colors hover:bg-sand-9/10 hover:text-fg-high",nD=[{icon:eo.XTwitterIcon,label:"Add X"},{icon:eo.LinkedInIcon,label:"Add LinkedIn"},{icon:eo.InstagramIcon,label:"Add Instagram"},{icon:eo.PlusIcon,label:"Add a social link"}];function nU(e){let a,i,r,s,l,o,c=(0,n.c)(15),{displayName:d,onAdd:u}=e;c[0]!==d?(a=(0,nM.getDisplayName)(d),c[0]=d,c[1]=a):a=c[1];let m=a,h=!m&&"invisible";c[2]!==h?(i=(0,b.cn)("pb-4 text-md text-fg-mid",h),c[2]=h,c[3]=i):i=c[3];let p=!m,f=m?`Follow ${m} for more...`:"Follow for more...";return c[4]!==i||c[5]!==p||c[6]!==f?(r=(0,t.jsx)("h2",{className:i,"aria-hidden":p,children:f}),c[4]=i,c[5]=p,c[6]=f,c[7]=r):r=c[7],c[8]!==u?(s=nD.map(e=>{let n=e.icon;return(0,t.jsxs)("button",{type:"button",onMouseDown:nL,onClick:u,className:(0,b.cn)(nO,"border border-dashed border-subtle"),children:[(0,t.jsx)(n,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only",children:e.label})]},e.label)}),c[8]=u,c[9]=s):s=c[9],c[10]!==s?(l=(0,t.jsx)("div",{className:"-ml-1 flex flex-wrap gap-2",children:s}),c[10]=s,c[11]=l):l=c[11],c[12]!==r||c[13]!==l?(o=(0,t.jsxs)("div",{children:[r,l]}),c[12]=r,c[13]=l,c[14]=o):o=c[14],o}function nL(e){return e.preventDefault()}var nz=e.i(298636);function nF(e){let a,i,r,s,l,o,c,d,u=(0,n.c)(27),{links:m,displayName:h,onLinkClick:p,trailing:f}=e;if(0===m.length){let e;return u[0]!==f?(e=f?(0,t.jsx)("div",{className:"-ml-1",children:f}):null,u[0]=f,u[1]=e):e=u[1],e}if(u[2]!==h||u[3]!==m||u[4]!==p){let e,n,o=m.slice().sort(nq);u[10]!==h?(e=(0,nM.getDisplayName)(h),u[10]=h,u[11]=e):e=u[11];let c=e;u[12]!==c?(l=c?(0,t.jsxs)("h2",{className:"pb-4 text-md text-fg-mid",children:["Follow ",c," for more..."]}):null,u[12]=c,u[13]=l):l=u[13],a=eh.TooltipProvider,s=200,i="flex flex-wrap items-center gap-2 -ml-1",u[14]!==p?(n=(e,n)=>{let a=e.url.replace(/(%[0-9a-fA-F]{0,1})+$/,""),i=(0,nz.getSocialPlatformIcon)(e.platform),r=nz.SOCIAL_PLATFORM_LABELS[e.platform]??e.platform,s=function(e,n){try{let a=new URL(e);if("website"===n)return nH(a.hostname);if("linkedin"===n){let e,n,i,r=(e=a.pathname.replace(/\/+$/,"").match(nB),n=e?.[1]?.toLowerCase(),i=e?.[2]?.toLowerCase(),("in"===n||"company"===n||"school"===n)&&i?{kind:n,handle:i}:null);if(r)return(0,t.jsxs)("span",{children:[(0,t.jsxs)("span",{className:"opacity-50",children:["/",r.kind,"/"]}),r.handle]})}let i=a.pathname.replace(/^\/+|\/+$/g,"").split("/")[0];if(i)return i.startsWith("@")?i:`@${i}`;return nH(a.hostname)}catch{return e}}(a,e.platform);return(0,t.jsxs)(eh.Tooltip,{children:[(0,t.jsx)(eh.TooltipTrigger,{asChild:!0,children:(0,t.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:nO,onClick:()=>p?.(e,n+1),children:[(0,t.jsx)(i,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only",children:r})]})}),(0,t.jsx)(eh.TooltipContent,{side:"bottom",className:"text-sm",children:s})]},e.id)},u[14]=p,u[15]=n):n=u[15],r=o.map(n),u[2]=h,u[3]=m,u[4]=p,u[5]=a,u[6]=i,u[7]=r,u[8]=s,u[9]=l}else a=u[5],i=u[6],r=u[7],s=u[8],l=u[9];return u[16]!==i||u[17]!==r||u[18]!==f?(o=(0,t.jsxs)("div",{className:i,children:[r,f]}),u[16]=i,u[17]=r,u[18]=f,u[19]=o):o=u[19],u[20]!==a||u[21]!==s||u[22]!==o?(c=(0,t.jsx)(a,{delayDuration:s,children:o}),u[20]=a,u[21]=s,u[22]=o,u[23]=c):c=u[23],u[24]!==l||u[25]!==c?(d=(0,t.jsxs)("div",{children:[l,c]}),u[24]=l,u[25]=c,u[26]=d):d=u[26],d}function nq(e,t){return e.sortOrder-t.sortOrder}let nB=/^\/(in|company|school)\/([^/]+)/i;function nH(e){return e.replace(/^www\./,"")}var n$=e.i(413624),nV=e.i(404124);function nG(e){let a,i,r,s,l=(0,n.c)(11),{username:o,displayName:c,goToContent:d,onClick:u}=e;return l[0]!==o?(a=(0,n$.contentListPath)(o),l[0]=o,l[1]=a):a=l[1],l[2]!==d||l[3]!==u||l[4]!==o?(i=e=>{u?.(),(0,nV.isPlainClick)(e)&&(e.preventDefault(),d(o))},l[2]=d,l[3]=u,l[4]=o,l[5]=i):i=l[5],l[6]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(eo.ArrowRightIcon,{className:"size-3 motion-safe:transition-transform motion-safe:duration-150 group-hover/content-link:translate-x-0.5","aria-hidden":!0}),l[6]=r):r=l[6],l[7]!==c||l[8]!==a||l[9]!==i?(s=(0,t.jsxs)(e8.default,{href:a,onClick:i,className:"group/content-link inline-flex h-8 items-center gap-1 rounded-sm px-1 text-sm text-fg-mid transition-colors hover:text-fg-high focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sand-9/4
30",children:["See ",c,"'s content",r]}),l[7]=c,l[8]=a,l[9]=i,l[10]=s):s=l[10],s}var nQ=e.i(381455),nK=e.i(474047),nW=e.i(76281),nY=e.i(546579);let nX={name:"input",photo:"empty",socials:"ask",cta:!0,share:!1},nZ={name:"display",photo:"image",socials:"ask",cta:!0,share:!1},nJ={name:"display",photo:"image",socials:"links",cta:!0,share:!1},n0={name:"display",photo:"image",socials:"links",cta:!1,share:!0};function n1(e){return void 0!==e.chatEnabled?e.chatEnabled:!0===e.onboardingCompleted}let n2="This Delphi isn't available to talk right now",n3=!1,n4=new Set;function n5(e){return n4.add(e),()=>{n4.delete(e)}}function n6(){return n3}function n7(){return!1}function n8(){return(0,d.useSyncExternalStore)(n5,n6,n7)}function n9(e){if(n3!==e)for(let t of(n3=e,n4))t()}function ae(){n9(!1)}function at(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-8}var an=e.i(412870),aa=e.i(894134);function ai(e){e.preventDefault()}var ar=e.i(928041),as=e.i(710441),al=e.i(176068);let ao=["YOUTUBE","PODCAST","TWITTER","LINKEDIN","INSTAGRAM","WEBSITE","QA"],ac="profile-latest-track";function ad(e){let a,i,r,s,l,o,c,u,m,h,p,g,v,y,w,j,S,C,N,_,k,I,E,T,A,R,M,O,D,U,L,z,F,q,B,H,$,V,G=(0,n.c)(66),{username:Q,contentPagesEnabled:K,goToContent:W,goToContentItem:Y,onAsk:X}=e,Z=(0,d.useId)(),J=(0,d.useRef)(null);G[0]!==Q?(a=(0,x.getUsersByUsernameContentOptions)((0,al.profileLatestContentQuery)(Q)),G[0]=Q,G[1]=a):a=G[1],G[2]!==a?(i={...a},G[2]=a,G[3]=i):i=G[3];let{data:ee,isPending:et}=(0,f.useQuery)(i),en=(0,P.useSearchParams)();G[4]!==en?(r=!1,G[4]=en,G[5]=r):r=G[5];let ea=r;G[6]!==ea||G[7]!==Q?(s=ao.map(e=>({...(0,x.getUsersByUsernameContentOptions)({path:{username:Q},query:{limit:2,type:e,sortBy:"publishedAt",includeFacets:!1}}),enabled:ea})),G[6]=ea,G[7]=Q,G[8]=s):s=G[8],G[9]!==ea?(l=e=>({isPending:ea&&e.some(ah),items:e.flatMap(am)}),G[9]=ea,G[10]=l):l=G[10],G[11]!==s||G[12]!==l?(o={queries:s,combine:l},G[11]=s,G[12]=l,G[13]=o):o=G[13];let ei=(0,tL.useQueries)(o),er=ea?ei.isPending:et;G[14]!==ee?.data||G[15]!==ei||G[16]!==ea?(c=ea?ei.items:ee?.data??[],G[14]=ee?.data,G[15]=ei,G[16]=ea,G[17]=c):c=G[17];let es=c,ec=er||es.length>0,{ref:ed,canScrollLeft:eu,canScrollRight:em,scroll:eh,measure:ep}=(0,aa.useCarouselScrollArrows)(),ef=(U=(0,n.c)(7),L=".snap-start",z=(0,d.useRef)(null),F=(0,d.useRef)(!1),q=(0,d.useRef)(null),U[0]===Symbol.for("react.memo_cache_sentinel")?(A=e=>{"mouse"===e.pointerType&&0===e.button&&(F.current=!1,z.current={pointerId:e.pointerId,startX:e.clientX,startScrollLeft:e.currentTarget.scrollLeft,dragging:!1})},U[0]=A):A=U[0],B=A,U[1]===Symbol.for("react.memo_cache_sentinel")?(R=e=>{let t=z.current;if(!t||e.pointerId!==t.pointerId)return;let n=e.currentTarget;if(!t.dragging){if(6>Math.abs(e.clientX-t.startX))return;t.dragging=!0,t.startX=e.clientX,t.startScrollLeft=n.scrollLeft,F.current=!0,q.current?.(),q.current=null,n.setPointerCapture(t.pointerId),n.style.scrollSnapType="none",n.dataset.dragScrolling="",n.firstElementChild instanceof HTMLElement&&(n.firstElementChild.style.pointerEvents="none")}n.scrollLeft=t.startScrollLeft-(e.clientX-t.startX)},U[1]=R):R=U[1],H=R,U[2]!==L?(M=e=>{let t=z.current;if(!t||e.pointerId!==t.pointerId||(z.current=null,!t.dragging))return;let n=e.currentTarget;n.hasPointerCapture(t.pointerId)&&n.releasePointerCapture(t.pointerId),delete n.dataset.dragScrolling,n.firstElementChild instanceof HTMLElement&&(n.firstElementChild.style.pointerEvents=""),q.current=function(e,t){let n=()=>{e.style.scrollSnapType=""},a=e.scrollWidth-e.clientWidth,i=e.getBoundingClientRect().left,r=null;for(let n of e.querySelectorAll(t)){let t=Math.min(Math.max(e.scrollLeft+n.getBoundingClientRect().left-i,0),a);(null===r||Math.abs(t-e.scrollLeft)<Math.abs(r-e.scrollLeft))&&(r=t)}if(null===r||1>=Math.abs(r-e.scrollLeft))return n(),null;let s=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e.scrollTo({left:r,behavior:s?"auto":"smooth"});let l=!1,o=()=>{l||(l=!0,e.removeEventListener("scrollend",o),window.clearTimeout(c),n())},c=window.setTimeout(o,600);return e.addEventListener("scrollend",o,{once:!0}),()=>{l||(l=!0,e.removeEventListener("scrollend",o),window.clearTimeout(c))}}(n,L)},U[2]=L,U[3]=M):M=U[3],$=M,U[4]===Symbol.for("react.memo_cache_sentinel")?(O=e=>{F.current&&(F.current=!1,e.preventDefault(),e.stopPropagation())},U[4]=O):O=U[4],V=O,U[5]!==$?(D={onPointerDown:B,onPointerMove:H,onPointerUp:$,onPointerCancel:$,onClickCapture:V,onDragStart:ai},U[5]=$,U[6]=D):D=U[6],D);G[18]===Symbol.for("react.memo_cache_sentinel")?(u=e=>{let t=J.current;if(!t)return;let n=Array.from(t.querySelectorAll("[data-profile-content-card]")),a=document.activeElement,i=n.findIndex(e=>e===a);if(-1===i)return;let r=n["next"===e?i+1:i-1];r&&(r.focus(),r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"}))},G[18]=u):u=G[18];let eg=u;if(!ec)return null;G[19]!==Z?(m=(0,t.jsx)("h2",{id:Z,className:"text-lg font-medium tracking-tight text-fg-low",children:"Latest"}),G[19]=Z,G[20]=m):m=G[20];let ex=!eu;G[21]!==eh?(h=()=>eh("left"),G[21]=eh,G[22]=h):h=G[22],G[23]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(eo.ChevronLeftSolidIcon,{className:"size-3.5"}),G[23]=p):p=G[23],G[24]!==ex||G[25]!==h?(g=(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-sm","aria-label":"Scroll left","aria-controls":ac,disabled:ex,onClick:h,children:p}),G[24]=ex,G[25]=h,G[26]=g):g=G[26];let eb=!em;return G[27]!==eh?(v=()=>eh("right"),G[27]=eh,G[28]=v):v=G[28],G[29]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsx)(eo.ChevronRightSolidIcon,{className:"size-3.5"}),G[29]=y):y=G[29],G[30]!==eb||G[31]!==v?(w=(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-sm","aria-label":"Scroll right","aria-controls":ac,disabled:eb,onClick:v,children:y}),G[30]=eb,G[31]=v,G[32]=w):w=G[32],G[33]!==g||G[34]!==w?(j=(0,t.jsxs)("div",{className:"hidden items-center gap-1 sm:flex",children:[g,w]}),G[33]=g,G[34]=w,G[35]=j):j=G[35],G[36]!==j||G[37]!==m?(S=(0,t.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[m,j]}),G[36]=j,G[37]=m,G[38]=S):S=G[38],G[39]!==ed?(C=e=>{ed(e),J.current=e},G[39]=ed,G[40]=C):C=G[40],G[41]===Symbol.for("react.memo_cache_sentinel")?(N=(0,b.cn)("min-w-0 overflow-x-auto overscroll-x-contain","-mx-4 px-4 py-1","snap-x snap-mandatory scroll-px-4","[&[data-drag-scrolling]]:cursor-grabbing [&[data-drag-scrolling]]:select-none","[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"),G[41]=N):N=G[41],G[42]!==K||G[43]!==Y||G[44]!==er||G[45]!==es||G[46]!==ep||G[47]!==X||G[48]!==Q?(_=er?Array.from({length:5}).map(au):es.map(e=>(0,t.jsx)("div",{className:"shrink-0 snap-start",children:(0,t.jsx)(ar.ProfileContentCard,{item:e,onOpen:K?()=>Y(Q,e.id):void 0,onAsk:X,onFocusSibling:eg,onImageLoad:ep})},e.id)),G[42]=K,G[43]=Y,G[44]=er,G[45]=es,G[46]=ep,G[47]=X,G[48]=Q,G[49]=_):_=G[49],G[50]!==W||G[51]!==er||G[52]!==es||G[53]!==Q?(k=!er&&es.length>0?(0,t.jsx)(ap,{username:Q,goToContent:W}):null,G[50]=W,G[51]=er,G[52]=es,G[53]=Q,G[54]=k):k=G[54],G[55]!==_||G[56]!==k?(I=(0,t.jsxs)("div",{className:"flex w-max gap-3",children:[_,k]}),G[55]=_,G[56]=k,G[57]=I):I=G[57],G[58]!==ef||G[59]!==C||G[60]!==I?(E=(0,t.jsx)("div",{className:"relative min-w-0",children:(0,t.jsx)("div",{id:ac,ref:C,role:"region","aria-label":"Latest content",className:N,...ef,children:I})}
3),G[58]=ef,G[59]=C,G[60]=I,G[61]=E):E=G[61],G[62]!==Z||G[63]!==S||G[64]!==E?(T=(0,t.jsxs)("section",{"aria-labelledby":Z,children:[S,E]}),G[62]=Z,G[63]=S,G[64]=E,G[65]=T):T=G[65],T}function au(e,n){return(0,t.jsx)("div",{className:"shrink-0 snap-start",children:(0,t.jsx)(as.ProfileContentCardSkeleton,{})},n)}function am(e){return e.data?.data??[]}function ah(e){return e.isPending}function ap(e){let a,i,r,s,l,o,c=(0,n.c)(10),{username:d,goToContent:u}=e,m=`/${d}/content`;return c[0]!==u||c[1]!==d?(a=e=>{(0,nV.isPlainClick)(e)&&(e.preventDefault(),u(d))},c[0]=u,c[1]=d,c[2]=a):a=c[2],c[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,b.cn)("group/see-all flex shrink-0 snap-start flex-col items-center justify-center gap-3","border border-loud bg-surface-primary text-fg-mid","motion-safe:transition-[background-color,border-color,transform] motion-safe:duration-200 motion-safe:ease-out","hover:border-sand-8 hover:text-fg-high active:scale-[0.98]","focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-sand-9/50"),r={width:al.CARD_WIDTH_PX,height:al.CARD_HEIGHT_PX,borderRadius:al.CARD_RADIUS_PX},c[3]=i,c[4]=r):(i=c[3],r=c[4]),c[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-full bg-sand-3 motion-safe:transition-colors motion-safe:duration-200 group-hover/see-all:bg-sand-4",children:(0,t.jsx)(eo.ArrowRightIcon,{className:"size-4","aria-hidden":!0})}),l=(0,t.jsx)("span",{className:"text-sm font-medium",children:"See all content"}),c[5]=s,c[6]=l):(s=c[5],l=c[6]),c[7]!==m||c[8]!==a?(o=(0,t.jsxs)(e8.default,{href:m,onClick:a,onPointerDown:af,className:i,style:r,children:[s,l]}),c[7]=m,c[8]=a,c[9]=o):o=c[9],o}function af(e){return e.stopPropagation()}let ag={type:"spring",duration:.4,bounce:0},ax={type:"spring",duration:.36,bounce:0},ab={type:"spring",duration:.2,bounce:0},av={opacity:0,filter:"blur(3px)",scale:.99},ay={opacity:1,filter:"blur(0px)",scale:1};function aw(e){let a,i,r,l,o,u,m,h,p,f,g,x=(0,n.c)(28),{mode:b,children:v}=e,y=(0,c.useReducedMotion)()??!1,w=(0,d.useRef)(null),[j,S]=(0,d.useState)(null);x[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{let e=w.current;if(!e)return;let t=()=>{S(Math.ceil(e.getBoundingClientRect().height)+4)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},i=[],x[0]=a,x[1]=i):(a=x[0],i=x[1]),(0,d.useLayoutEffect)(a,i),x[2]!==y?(r=y?{opacity:0}:av,x[2]=y,x[3]=r):r=x[3];let C=r,N=j??"auto";return x[4]!==N?(l={height:N},x[4]=N,x[5]=l):l=x[5],x[6]!==y?(o=y?{duration:0}:ag,x[6]=y,x[7]=o):o=x[7],x[8]!==y?(u=y?{opacity:1}:ay,x[8]=y,x[9]=u):u=x[9],x[10]!==y?(m=y?{duration:0}:ab,x[10]=y,x[11]=m):m=x[11],x[12]!==C||x[13]!==m?(h={...C,transition:m},x[12]=C,x[13]=m,x[14]=h):h=x[14],x[15]!==y?(p=y?{duration:0}:ax,x[15]=y,x[16]=p):p=x[16],x[17]!==v||x[18]!==C||x[19]!==b||x[20]!==p||x[21]!==u||x[22]!==h?(f=(0,t.jsx)("div",{ref:w,className:"relative",children:(0,t.jsx)(s.AnimatePresence,{mode:"popLayout",initial:!1,children:(0,t.jsx)(er.motion.div,{className:"origin-top",initial:C,animate:u,exit:h,transition:p,children:v},b)})}),x[17]=v,x[18]=C,x[19]=b,x[20]=p,x[21]=u,x[22]=h,x[23]=f):f=x[23],x[24]!==f||x[25]!==l||x[26]!==o?(g=(0,t.jsx)(er.motion.div,{className:"overflow-x-visible overflow-y-clip",initial:!1,animate:l,transition:o,children:f}),x[24]=f,x[25]=l,x[26]=o,x[27]=g):g=x[27],g}function aj(e){var a,i,r;let s,l,o,c,u,m,h,p,g,v,w,j,S,C,N,_,k,E,T,A,R,O,D=(0,n.c)(273),{username:U,threadId:L,canEdit:F,visitorState:q,goToChat:B,goToProfile:H,goToContent:$,goToContentItem:V,surfaceMode:G,guidedFirstRun:Q,onGuidedProfileQuestion:W,onSendProfileQuestion:Y,questionsOverride:X}=e,Z=void 0!==Q&&Q,{actions:J}=(0,I.usePromptInput)();D[0]!==U?(s=(0,x.getUsersByUsernameOptions)({path:{username:U}}),D[0]=U,D[1]=s):s=D[1],D[2]!==s?(l={...s},D[2]=s,D[3]=l):l=D[3];let{data:ee,isPending:et,isError:en,error:ea}=(0,f.useQuery)(l),{activeHighlight:ei,toggleHighlight:eo,clearHighlight:eh}=function(){let e=(0,d.use)(ti);if(!e)throw Error("useProfileHighlight must be used within a ProfileHighlightProvider");return e}(),ep=tl();D[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,x.getUsersMeOptions)(),D[4]=o):o=D[4],D[5]!==F?(c={...o,enabled:F},D[5]=F,D[6]=c):c=D[6];let{data:ef}=(0,f.useQuery)(c),eg=(0,P.useSearchParams)();
3D[7]!==F||D[8]!==eg?(u=()=>F&&"1"===eg.get("edit"),D[7]=F,D[8]=eg,D[9]=u):u=D[9];let[ex,eb]=(0,d.useState)(u),[ev,ey]=(0,d.useState)(ex),[ew,eS]=(0,d.useState)(!1);ev!==ex&&(ey(ex),eS(!0));let[eC,eN]=(0,d.useState)(!1),[e_,ek]=(0,d.useState)(""),[eI,eP]=(0,d.useState)(),eE=(0,d.useRef)(null);a=ex&&F,(O=(0,n.c)(3))[0]!==a?(A=()=>(n9(a),ae),R=[a],O[0]=a,O[1]=A,O[2]=R):(A=O[1],R=O[2]),(0,d.useEffect)(A,R),D[10]===Symbol.for("react.memo_cache_sentinel")?(m=e=>{let t=eE.current?.draft()??"";t&&ek(t),eP(e),eb(!0)},D[10]=m):m=D[10];let eA=m;D[11]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{eb(!1),ek(""),eP(void 0)},D[11]=h):h=D[11];let eR=h,eM=ee?.data?.user?.id,eD=!!(F&&eM&&ef?.data?.user?.id===eM),eU=ee?.data?.onboardingCompleted===!1,eL=!!(eD&&eU),eF=ee?.data?.profile?.settings?.chatEnabled,eq=ee?.data?.onboardingCompleted;D[12]!==eq||D[13]!==eF?(p=n1({chatEnabled:eF,onboardingCompleted:eq}),D[12]=eq,D[13]=eF,D[14]=p):p=D[14];let eB=p,eH=eD&&ee?.data?.onboardingCompleted===!0||eB,e$="profile"===G&&!ex&&!eU&&eH;D[15]!==B||D[16]!==L||D[17]!==U?(g=()=>B(U,L),D[15]=B,D[16]=L,D[17]=U,D[18]=g):g=D[18],D[19]!==e$||D[20]!==g?(v={enabled:e$,onCommit:g},D[19]=e$,D[20]=g,D[21]=v):v=D[21];let{progress:eG}=function(e){let t,a,i,r,s,l,o,c=(0,n.c)(10),{enabled:u,onCommit:m}=e,[h,p]=(0,d.useState)(0),f=(0,d.useRef)(!1),g=(0,d.useRef)(0),x=(0,d.useRef)(!1),b=(0,d.useRef)(null),v=(0,d.useRef)(null),y=(0,d.useRef)(null),w=(0,d.useRef)(m);c[0]!==m?(t=()=>{w.current=m},a=[m],c[0]=m,c[1]=t,c[2]=a):(t=c[1],a=c[2]),(0,d.useEffect)(t,a),c[3]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{f.current=!1,g.current=0,x.current=!1,b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current),p(0)},c[3]=i):i=c[3];let j=i;c[4]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{x.current||(g.current=0,p(0))},c[4]=r):r=c[4];let S=r;return u||0===h||p(0),c[5]!==u?(s=()=>{if(!u){f.current=!1,g.current=0,x.current=!1,b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current);return}let e=()=>(y.current&&document.contains(y.current)||(y.current=document.querySelector(z.PROFILE_SCROLL_VIEWPORT_SELECTOR)),y.current),t=t=>{let n=e();if(!n)return;if(!at(n)){(f.current||g.current>0)&&j();return}if(t.deltaY<=0){g.current>0&&!x.current&&S();return}if(!f.current){b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{f.current=!0},450);return}v.current&&clearTimeout(v.current),g.current=Math.min(180,g.current+t.deltaY);let a=g.current/180;if(p(a),a>=1&&!x.current){x.current=!0,w.current();return}v.current=setTimeout(S,250)},n=0,a=!1,i=t=>{let i=e();if(!i)return;let r=t.touches[0];if(r){if(!i.contains(t.target)){a=!1;return}n=r.clientY,a=at(i),x.current=!1}},r=e=>{if(!a)return;let t=e.touches[0];if(!t)return;let i=(n-t.clientY)*1.5;if(i<=0){g.current=0,p(0);return}let r=Math.min(1,i/180);g.current=i,p(r),r>=1&&!x.current&&(x.current=!0,w.current())},s=()=>{x.current||S(),a=!1};return document.addEventListener("wheel",t,{passive:!0}),document.addEventListener("touchstart",i,{passive:!0}),document.addEventListener("touchmove",r,{passive:!0}),document.addEventListener("touchend",s,{passive:!0}),()=>{document.removeEventListener("wheel",t),document.removeEventListener("touchstart",i),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),b.current&&clearTimeout(b.current),v.current&&clearTimeout(v.current)}},l=[u,j,S],c[5]=u,c[6]=s,c[7]=l):(s=c[6],l=c[7]),(0,d.useEffect)(s,l),c[8]!==h?(o={progress:h},c[8]=h,c[9]=o):o=c[9],o}(v),eQ=(0,an.useRecordShare)(eM),eK=function(){let e,t=(0,n.c)(2),[a,i]=(0,d.useState)(null);return t[0]!==a?(e={card:a,setCard:i},t[0]=a,t[1]=e):e=t[1],e}(),eW=(0,M.useIsImpersonating)(),eY=(0,es.useFeatureFlag)("visitor-profile-teasers")?.enabled??!1,eX=(0,es.useFeatureFlag)("visitor-profile-people-you-may-know")?.enabled??!1,eZ=eW||eY,eJ=eW||eX;if(et){let e;return D[22]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-y-none","data-radix-scroll-area-viewport":"",children:(0,t.jsx)(y.PageContainer,{className:"flex max-w-2xl px-0 flex-1 flex-col items-center justify-center py-16",children:(0,t.jsx)(eu.Spinner,{className:"size-6 text-fg-mid"})})}),D[22]=e):e=D[22],e}if(en){let e,n,a;return D[23]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(ec.EmptyTitle,{children:"Profile unavailable"}),D[23]=e):e=D[23],D[24]!==ea?(n=(0,nY.parseMessage)(ea)??"This user could not be found or is private.",D[24]=ea,D[25]=n):n=D[25],D[26]!==n?(a=(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-y-none","data-radix-scroll-area-viewport":"",children:(0,t.jsx)(y.PageContainer,{className:"flex max-w-2xl px-0 flex-1 flex-col items-center justify-center py-16",children:(0,t.jsx)(ec.Empty,{className:"border-0",children:(0,t.jsxs)(ec.EmptyHeader,{children:[e,(0,t.jsx)(ec.EmptyDescription,{children:n})]})})})}),D[26]=n,D[27]=a):a=D[27],a}let e1=ee.data,{user:e2,profile:e3}=e1,e4=e1.isVerified??!1,e5=e1.onboardingCompleted,e6=L??null;D[28]!==e2.id?(w={delphi:e2.id},D[28]=e2.id,D[29]=w):w=D[29],D[30]!==eD||D[31]!==e6||D[32]!==w||D[33]!==e2.id||D[34]!==q?(j={owner_user_id:e2.id,is_owner:eD,visitor_state:q,thread_id:e6,$groups:w},D[30]=eD,D[31]=e6,D[32]=w,D[33]=e2.id,D[34]=q,D[35]=j):j=D[35];let e8=j,ta=eH&&!eU;D[36]!==e2.name||D[37]!==e2.username?(S=e2.name?.trim()||e2.username,D[36]=e2.name,D[37]=e2.username,D[38]=S):S=D[38];let tr=S;D[39]!==e3?.questions||D[40]!==X?(C=X&&X.length>0?X:(e3?.questions??[]).map(ak),D[39]=e3?.questions,D[40]=X,D[41]=C):C=D[41];let ts=C,tc=X&&X.length>0?"followup":"profile";D[42]!==e3?.highlights?(N=e3?.highlights??[],D[42]=e3?.highlights,D[43]=N):N=D[43];let td=N;D[44]!==e1.socialLinks?(_=e1.socialLinks??[],D[44]=e1.socialLinks,D[45]=_):_=D[45];let tm=_;D[46]!==e3?.headline||D[47]!==e3?.organizations?(k=(0,tt.selectLatestOrganization)(e3?.organizations??[]),E=!!e3?.headline?.trim()||!!k?.role?.trim(),D[46]=e3?.headline,D[47]=e3?.organizations,D[48]=k,D[49]=E):(k=D[48],E=D[49]);let th=E;if(D[50]!==ei||D[51]!==eZ||D[52]!==e1.chaptersEnabled||D[53]!==e1.contentLinkEnabled||D[54]!==e1.contentPagesEnabled||D[55]!==ta||D[56]!==F||D[57]!==eH||D[58]!==eh||D[59]!==tr||D[60]!==ew||D[61]!==eI||D[62]!==e_||D[63]!==B||D[64]!==$||D[65]!==V||D[66]!==H||D[67]!==Z||D[68]!==th||D[69]!==td||D[70]!==ex||D[71]!==ep||D[72]!==eC||D[73]!==e4||D[74]!==k||D[75]!==eU||D[76]!==W||D[77]!==Y||D[78]!==e5||D[79]!==eG||D[80]!==eK||D[81]!==eL||D[82]!==eJ||D[83]!==e3||D[84]!==e8||D[85]!==ts||D[86]!==tc||D[87]!==eQ||D[88]!==tm||D[89]!==G||D[90]!==J||D[91]!==L||D[92]!==eo||D[93]!==e2.id||D[94]!==e2.image||D[95]!==e2.name||D[96]!==e2.username||D[97]!==U||D[98]!==eU){let e,n,a,s,l,o,c,d,u,m,h,p,f,g,x,v,w,j,S,C,N,_=(i={name:e2.name,hasSocials:tm.length>0,onboardingCompleted:e5}).onboardingCompleted?n0:i.name?.trim()?i.hasSocials?nJ:nZ:nX,I=eL&&"empty"===_.ph
3oto&&!e2.image?"add":"initials";D[100]!==e3?.videos?(e=e3?.videos??[],D[100]=e3?.videos,D[101]=e):e=D[101];let P=e3?.settings?.profileVideoEnabled??!1;D[102]!==I||D[103]!==e||D[104]!==P||D[105]!==e2.image||D[106]!==e2.name||D[107]!==e2.username?(n=(0,t.jsx)(eT,{image:e2.image,name:e2.name,username:e2.username,videos:e,profileVideoEnabled:P,fallback:I}),D[102]=I,D[103]=e,D[104]=P,D[105]=e2.image,D[106]=e2.name,D[107]=e2.username,D[108]=n):n=D[108];let E=n,A=!eU;D[109]!==e4||D[110]!==A?(a=(0,nQ.showIdentityVerifiedBadge)({isVerified:e4,enabled:A}),D[109]=e4,D[110]=A,D[111]=a):a=D[111];let R=a,M="input"===_.name&&F?(0,t.jsx)(tf,{ref:eE,username:U,className:"mt-0"}):(0,t.jsx)(tu,{name:tr,verified:R,className:"mt-0"}),O="display"===_.name;D[112]!==e3?.settings?.profileVideoEnabled||D[113]!==e3?.videos?(s=(e3?.settings?.profileVideoEnabled??!1)&&(e3?.videos??[]).some(a_),D[112]=e3?.settings?.profileVideoEnabled,D[113]=e3?.videos,D[114]=s):s=D[114];let z=!!s,q=eL&&!z;D[115]!==I||D[116]!==E||D[117]!==q?(l=q?(0,t.jsx)(el.Button,{type:"button",variant:"ghost",size:"none","aria-label":"add"===I?"Add a profile photo":"Change profile photo",onMouseDown:aN,onClick:()=>eA(),children:E}):E,D[115]=I,D[116]=E,D[117]=q,D[118]=l):l=D[118];let Q=l;D[119]!==ta||D[120]!==B||D[121]!==H||D[122]!==Z||D[123]!==W||D[124]!==J||D[125]!==L||D[126]!==U?(o=async e=>{let t=e.trim();if(t&&ta){if(Z&&W){await W(t)||H(U);return}J.setInput(t),B(U,L,{firstOwner:Z}),requestAnimationFrame(aC)}},D[119]=ta,D[120]=B,D[121]=H,D[122]=Z,D[123]=W,D[124]=J,D[125]=L,D[126]=U,D[127]=o):o=D[127];let X=o;D[128]!==ta||D[129]!==B||D[130]!==Z||D[131]!==L||D[132]!==U?(c=(e,t,n)=>{let a=e.trim();a&&ta&&(!function(e,t,n,a,i=globalThis.window?.sessionStorage,r=Date.now()){(0,K.storePendingUserMessage)(e,[{type:"data-profileChapter",data:t},{type:"text",text:n}],i,r,{questionPosition:a})}(U,(0,eV.toProfileChapterContextPart)(U,t),a,n),B(U,L,{firstOwner:Z,prompt:a}))},D[128]=ta,D[129]=B,D[130]=Z,D[131]=L,D[132]=U,D[133]=c):c=D[133];let ee=c;D[134]!==ei?.id||D[135]!==e8||D[136]!==eo?(d=e=>{(0,tR.track)("profile:highlight_click",{...e8,highlight_id:e.id,highlight_word:e.word,highlight_action:ei?.id===e.id?"clear":"activate",question_count:e.questions.length}),eo(e)},D[134]=ei?.id,D[135]=e8,D[136]=eo,D[137]=d):d=D[137];let et=d;D[138]!==ei||D[139]!==ta||D[140]!==B||D[141]!==H||D[142]!==Z||D[143]!==W||D[144]!==Y||D[145]!==tc||D[146]!==L||D[147]!==U?(u=(e,t)=>{let n=e.trim();if(!n||!ta)return;let a={questionSource:(0,nK.profileListQuestionSource)(ei?"highlight":tc),questionPosition:t,highlightId:ei?.id??null};Z&&W?W(n).then(e=>{e||H(U)}):Y&&(B(U,L),Y(n,a))},D[138]=ei,D[139]=ta,D[140]=B,D[141]=H,D[142]=Z,D[143]=W,D[144]=Y,D[145]=tc,D[146]=L,D[147]=U,D[148]=u):u=D[148];let en=u,ea=ei?ei.questions.length:ts.length,es=ep&&null!==ei&&ei.questions.length>0,ec=ea>0&&!es&&!eU&&eH,{showPeopleYouMayKnow:eu,showOwnerActivateTeasers:ef}=(N=(r={peopleYouMayKnowEnabled:eJ,asksTeasersEnabled:eZ,visitorProfile:eU,ownerVisitorProfile:eL,namePresentation:_.name,guidedFirstRun:Z,isEditing:ex}).visitorProfile&&"display"===r.namePresentation&&!r.guidedFirstRun&&!r.isEditing,{showPeopleYouMayKnow:r.peopleYouMayKnowEnabled&&N,showOwnerActivateTeasers:r.asksTeasersEnabled&&N&&r.ownerVisitorProfile}),eg=eu||ef,eb="profile"===G;D[149]!==e3||D[150]!==e2.username?(m=e3?.disclaimer?(0,t.jsx)(e7,{disclaimer:e3.disclaimer,username:e2.username}):null,D[149]=e3,D[150]=e2.username,D[151]=m):m=D[151];let ev=ef?"pb-40 sm:pb-36":eH?"pb-20 sm:pb-36":"pb-10 sm:pb-16",ey=ex&&F?"px-4 sm:px-0":"px-0";D[152]!==ev||D[153]!==ey?(h=(0,b.cn)("relative max-w-2xl pt-26 lg:pt-34",ev,ey),D[152]=ev,D[153]=ey,D[154]=h):h=D[154],D[155]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(eO,{}),D[155]=p):p=D[155];let eS=_.share;D[156]!==tm?(f=function(e){let t=e.find(e=>"x"===e.platform);if(!t?.url)return null;try{let e=new URL(t.url.startsWith("http")?t.url:`https://${t.url}`).pathname.replace(/^\//,"").split("/")[0];return e?e.replace(/^@/,""):null}catch{return null}}(tm),D[156]=tm,D[157]=f):f=D[157],D[158]!==e8?(g=()=>(0,tR.track)("profile:share_click",e8),D[158]=e8,D[159]=g):g=D[159],D[160]===Symbol.for("react.memo_cache_sentinel")?(x=()=>eA(),D[160]=x):x=D[160];e:{let e,n,a,i,r,s,l,o,c,d,u,m,h,p,f,g,x=ex&&F,y=`edit-${e2.username}`,w=e2.image,j=e2.name,S=e2.name??"";D[161]!==S?(e=S.trim(),D[161]=S,D[162]=e):e=D[162];let C=e_||void 0,N=e3?.headline??"",I=e3?.bio??"";D[163]!==e3?.questions?(n=e3?.questions??[],D[163]=e3?.questions,D[164]=n):n=D[164],D[165]!==e3?.organizations?(a=e3?.organizations??[],D[165]=e3?.organizations,D[166]=a):a=D[166],D[167]!==a?(i=a.map(aS),D[167]=a,D[168]=i):i=D[168];let P=e3?.settings?.profileVideoEnabled??!1,T=e1.chaptersEnabled??!1,A=e3?.chapters?.length??0;D[169]!==eI||D[170]!==td||D[171]!==eL||D[172]!==tm||D[173]!==y||D[174]!==e||D[175]!==C||D[176]!==N||D[177]!==I||D[178]!==n||D[179]!==i||D[180]!==P||D[181]!==T||D[182]!==A||D[183]!==e2.image||D[184]!==e2.name||D[185]!==U?(r=(0,t.jsx)(em.EditProfileForm,{username:U,image:w,name:j,defaultName:e,initialName:C,defaultHeadline:N,defaultBio:I,defaultQuestions:n,defaultHighlights:td,defaultSocialLinks:tm,defaultOrganizations:i,defaultProfileVideoEnabled:P,chaptersEnabled:T,chapterCount:A,nameOnly:eL,initialFocus:eI,onSavingChange:eN,onSuccess:eR},y),D[169]=eI,D[170]=td,D[171]=eL,D[172]=tm,D[173]=y,D[174]=e,D[175]=C,D[176]=N,D[177]=I,D[178]=n,D[179]=i,D[180]=P,D[181]=T,D[182]=A,D[183]=e2.image,D[184]=e2.name,D[185]=U,D[186]=r):r=D[186];let L=r;D[187]!==tr||D[188]!==th||D[189]!==M||D[190]!==E||D[191]!==Q||D[192]!==k||D[193]!==eb||D[194]!==O||D[195]!==R||D[196]!==e2.id||D[197]!==e2.username?(s=(0,t.jsx)(t.Fragment,{children:eb?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{"data-profile-identity":"",children:[(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.image,transition:nW.PROFILE_TO_CHAT_MORPH.spring,className:"size-36",children:Q}
3),(0,t.jsxs)("div",{className:th?"mt-6 mb-3 min-w-0 w-full":"mt-6 mb-3 flex min-w-0 w-full flex-wrap items-center gap-3",children:[(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.pill,transition:nW.PROFILE_TO_CHAT_MORPH.pillSpring,className:"flex min-w-0 w-full items-center rounded-full",style:{backgroundColor:"transparent",padding:0,boxShadow:"none",width:"100%"},children:(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.name,transition:nW.PROFILE_TO_CHAT_MORPH.pillSpring,className:"min-w-0 w-full",style:{width:"100%"},children:M})}),O&&!th?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t_,{userId:e2.id,username:e2.username,cloneName:tr}),(0,t.jsx)(te.ProfileIdentityBadges,{organization:k,isVerified:R,variant:"inline",showVerifiedBadge:!1})]}):null]})]})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"size-36 opacity-0","aria-hidden":!0,children:E}),(0,t.jsxs)("div",{className:(0,b.cn)(th?"mt-6 mb-3 min-w-0 w-full":"mt-6 mb-3 flex min-w-0 w-full flex-wrap items-center gap-3","opacity-0"),"aria-hidden":!0,children:[(0,t.jsx)(tu,{name:tr,verified:R,className:"mt-0"}),O&&!th?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t_,{userId:e2.id,username:e2.username,cloneName:tr}),(0,t.jsx)(te.ProfileIdentityBadges,{organization:k,isVerified:R,variant:"inline",showVerifiedBadge:!1})]}):null]})]})}),D[187]=tr,D[188]=th,D[189]=M,D[190]=E,D[191]=Q,D[192]=k,D[193]=eb,D[194]=O,D[195]=R,D[196]=e2.id,D[197]=e2.username,D[198]=s):s=D[198];let z=s;D[199]!==e1.contentLinkEnabled||D[200]!==tr||D[201]!==$||D[202]!==e8||D[203]!==U?(l=e1.contentLinkEnabled?(0,t.jsx)(nG,{username:U,displayName:(0,nM.getDisplayName)(tr)??tr,goToContent:$,onClick:()=>(0,tR.track)("profile:content_link_click",e8)}):null,D[199]=e1.contentLinkEnabled,D[200]=tr,D[201]=$,D[202]=e8,D[203]=U,D[204]=l):l=D[204];let q=l;D[205]!==q||D[206]!==tr||D[207]!==Z||D[208]!==e8||D[209]!==tm?(o=Z?null:(0,t.jsx)(nF,{links:tm,displayName:tr,trailing:q,onLinkClick:(e,t)=>(0,tR.track)("profile:social_link_click",{...e8,link_platform:e.platform,link_url:e.url,link_position:t})}),D[205]=q,D[206]=tr,D[207]=Z,D[208]=e8,D[209]=tm,D[210]=o):o=D[210];let B=o,H=eL&&"ask"===_.socials?(0,t.jsx)(nU,{displayName:e2.name,onAdd:()=>eA("socials")}):B,G=e3?.headline??null;D[211]!==tr||D[212]!==th||D[213]!==O||D[214]!==e2.id||D[215]!==e2.username?(c=O&&th?(0,t.jsx)(t_,{userId:e2.id,username:e2.username,cloneName:tr}):null,D[211]=tr,D[212]=th,D[213]=O,D[214]=e2.id,D[215]=e2.username,D[216]=c):c=D[216],D[217]!==k||D[218]!==R||D[219]!==G||D[220]!==c?(d=(0,t.jsx)(tn,{headline:G,organization:k,isVerified:R,children:c}),D[217]=k,D[218]=R,D[219]=G,D[220]=c,D[221]=d):d=D[221],D[222]!==ei?.id||D[223]!==e1.contentPagesEnabled||D[224]!==$||D[225]!==V||D[226]!==et||D[227]!==td||D[228]!==e3||D[229]!==e8||D[230]!==X||D[231]!==U?(u=e3?.bio?(0,t.jsxs)("div",{className:"my-4 flex min-w-0 flex-col gap-2",children:[(0,t.jsx)(ez,{bio:e3.bio,highlights:td,activeHighlightId:ei?.id??null,toggleHighlight:et,onReadMore:()=>(0,tR.track)("profile:bio_read_more_click",e8)}),al.LATEST_CONTENT_USERNAMES.includes(U.toLowerCase())?(0,t.jsx)(ad,{username:U,contentPagesEnabled:e1.contentPagesEnabled??!1,goToContent:$,goToContentItem:V,onAsk:X},U):null]}):null,D[222]=ei?.id,D[223]=e1.contentPagesEnabled,D[224]=$,D[225]=V,D[226]=et,D[227]=td,D[228]=e3,D[229]=e8,D[230]=X,D[231]=U,D[232]=u):u=D[232];let K=eg?(0,t.jsxs)(t.Fragment,{children:[eu?(0,t.jsx)(nw,{}):null,ef?(0,t.jsx)("div",{className:eu?"mt-8":void 0,children:(0,t.jsx)(nR,{onView:()=>eK.setCard({kind:"asking"}),animateEntrance:!ew})}):null,H]}):(0,t.jsxs)(t.Fragment,{children:[Z?null:(0,t.jsx)(e0,{chapters:e3?.chapters??[],onAsk:ee,onChapterToggle:(e,t,n)=>(0,tR.track)("profile:chapter_card_click",{...e8,chapter_id:e.id,chapter_kind:"chapter",chapter_position:t,card_action:n?"expand":"collapse"}),onEarlierToggle:e=>(0,tR.track)("profile:chapter_card_click",{...e8,chapter_kind:"earlier",card_action:e?"expand":"collapse"})}),ec?(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(tT,{questions:ts,activeHighlight:ei,clearHighlight:eh,onQuestionClick:en,guidedFirstRun:Z})}):null,H]}),W=eL&&_.cta&&!ef?(0,t.jsx)(nu,{}):null;D[233]!==ei||D[234]!==en||D[235]!==eh?(m=(0,t.jsx)(to,{activeHighlight:ei,clearHighlight:eh,sendHighlightToChat:en}),D[233]=ei,D[234]=en,D[235]=eh,D[236]=m):m=D[236],D[237]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(e9,{}),D[237]=h):h=D[237],D[238]!==eH||D[239]!==eU||D[240]!==eG?(p=!eU&&eH?(0,t.jsx)(aI,{progress:eG}):null,D[238]=eH,D[239]=eU,D[240]=eG,D[241]=p):p=D[241],D[242]!==d||D[243]!==u||D[244]!==K||D[245]!==W||D[246]!==m||D[247]!==
3p?(f=(0,t.jsxs)(t.Fragment,{children:[d,u,K,W,m,h,p]}),D[242]=d,D[243]=u,D[244]=K,D[245]=W,D[246]=m,D[247]=p,D[248]=f):f=D[248];let Y=f;if(eL){let e,n,a=x?"edit":"view";D[249]!==L||D[250]!==x||D[251]!==Y||D[252]!==z?(e=x?L:(0,t.jsxs)(t.Fragment,{children:[z,Y]}),D[249]=L,D[250]=x,D[251]=Y,D[252]=z,D[253]=e):e=D[253],D[254]!==a||D[255]!==e?(n=(0,t.jsx)(aw,{mode:a,children:e}),D[254]=a,D[255]=e,D[256]=n):n=D[256],v=n;break e}D[257]!==L||D[258]!==x||D[259]!==Y||D[260]!==z?(g=x?L:(0,t.jsxs)(t.Fragment,{children:[z,Y]}),D[257]=L,D[258]=x,D[259]=Y,D[260]=z,D[261]=g):g=D[261],v=g}let ek=(0,t.jsxs)("div",{className:"relative z-10 px-5 md:px-0",children:[(0,t.jsx)(ej,{mode:ex&&F?"editing":"viewing",canEdit:F,showShare:eS,isSaving:eC,username:U,displayName:tr,headline:e3?.headline,onboardingCompleted:e5,ownerTwitterHandle:f,onShared:F?eQ:void 0,onShareClick:g,onEdit:x,onCancel:eR,className:ex&&F?"sticky top-26 sm:top-16 z-20 -mb-13 flex justify-end":"z-20 flex justify-end -mb-13"}),v]});D[262]!==ek?(w=(0,t.jsxs)("div",{className:"relative tracking-[-0.015em]",children:[p,ek]}),D[262]=ek,D[263]=w):w=D[263],D[264]!==h||D[265]!==w?(j=(0,t.jsx)(y.PageContainer,{className:h,children:w}),D[264]=h,D[265]=w,D[266]=j):j=D[266],D[267]!==m||D[268]!==j?(S=(0,t.jsxs)(ed.ScrollArea,{"data-profile-scroll-area":"",className:"flex min-h-0 flex-1 flex-col [&_[data-radix-scroll-area-viewport]]:overscroll-y-none",children:[m,j]}),D[267]=m,D[268]=j,D[269]=S):S=D[269];let eP=ef?(0,t.jsx)(nm,{displayName:tr,ownerImage:e2.image,preview:eK}):null;D[270]!==S||D[271]!==eP?(C=(0,t.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[S,eP]}),D[270]=S,D[271]=eP,D[272]=C):C=D[272];let eM=C;T=eg?(0,t.jsx)(t2,{ownerUsername:U,children:eM}):eM,D[50]=ei,D[51]=eZ,D[52]=e1.chaptersEnabled,D[53]=e1.contentLinkEnabled,D[54]=e1.contentPagesEnabled,D[55]=ta,D[56]=F,D[57]=eH,D[58]=eh,D[59]=tr,D[60]=ew,D[61]=eI,D[62]=e_,D[63]=B,D[64]=$,D[65]=V,D[66]=H,D[67]=Z,D[68]=th,D[69]=td,D[70]=ex,D[71]=ep,D[72]=eC,D[73]=e4,D[74]=k,D[75]=eU,D[76]=W,D[77]=Y,D[78]=e5,D[79]=eG,D[80]=eK,D[81]=eL,D[82]=eJ,D[83]=e3,D[84]=e8,D[85]=ts,D[86]=tc,D[87]=eQ,D[88]=tm,D[89]=G,D[90]=J,D[91]=L,D[92]=eo,D[93]=e2.id,D[94]=e2.image,D[95]=e2.name,D[96]=e2.username,D[97]=U,D[98]=eU,D[99]=T}else T=D[99];return T}function aS(e){return{name:e.name,customImage:e.customImage??"",logoSource:e.logoSource??"none",role:e.role??""}}function aC(){document.querySelector("[data-surface-prompt-form]")?.requestSubmit()}function aN(e){return e.preventDefault()}function a_(e){return"PROFILE"===e.type}function ak(e){return e.trim()}function aI(e){let a,i,r,s,l,o,c,d,u,m,h,p=(0,n.c)(19),{progress:f}=e;p[0]!==f?(a={opacity:f},p[0]=f,p[1]=a):a=p[1],p[2]===Symbol.for("react.memo_cache_sentinel")?(i={type:"spring",stiffness:380,damping:30},p[2]=i):i=p[2];let g=-(5*f);p[3]!==g?(r={y:g},p[3]=g,p[4]=r):r=p[4],p[5]===Symbol.for("react.memo_cache_sentinel")?(s={type:"spring",stiffness:380,damping:30},l=(0,t.jsx)(eo.ChevronUpIcon,{className:"size-4 text-fg-mid opacity-50"}),p[5]=s,p[6]=l):(s=p[5],l=p[6]),p[7]!==r?(o=(0,t.jsx)(er.motion.div,{animate:r,transition:s,children:l}),p[7]=r,p[8]=o):o=p[8];let x=-(11*f);return p[9]!==x?(c={y:x},p[9]=x,p[10]=c):c=p[10],p[11]===Symbol.for("react.memo_cache_sentinel")?(d={type:"spring",stiffness:380,damping:30},u=(0,t.jsx)(eo.ChevronUpIcon,{className:"size-4 text-fg-mid"}),p[11]=d,p[12]=u):(d=p[11],u=p[12]),p[13]!==c?(m=(0,t.jsx)(er.motion.div,{className:"-mt-1",animate:c,transition:d,children:u}),p[13]=c,p[14]=m):m=p[14],p[15]!==a||p[16]!==m||p[17]!==o?(h=(0,t.jsxs)(er.motion.div,{className:"mt-4 flex flex-col items-center pb-2",animate:a,transition:i,children:[o,m]}),p[15]=a,p[16]=m,p[17]=o,p[18]=h):h=p[18],h}function aP(e){let a,i=(0,n.c)(14),{username:r,threadId:s,canEdit:l,visitorState:o,goToChat:c,goToProfile:d,goToContent:u,goToContentItem:m,surfaceMode:h,guidedFirstRun:p,onGuidedProfileQuestion:f,onSendProfileQuestion:g,questionsOverride:x}=e,b=void 0!==p&&p;return i[0]!==l||i[1]!==c||i[2]!==u||i[3]!==m||i[4]!==d||i[5]!==b||i[6]!==f||i[7]!==g||i[8]!==x||i[9]!==h||i[10]!==s||i[11]!==r||i[12]!==o?(a=(0,t.jsx)(tr,{children:(0,t.jsx)(aj,{username:r,threadId:s,canEdit:l,visitorState:o,goToChat:c,goToProfile:d,goToContent:u,goToContentItem:m,surfaceMode:h,guidedFirstRun:b,onGuidedProfileQuestion:f,onSendProfileQuestion:g,questionsOverride:x})}),i[0]=l,i[1]=c,i[2]=u,i[3]=m,i[4]=d,i[5]=b,i[6]=f,i[7]=g,i[8]=x,i[9]=h,i[10]=s,i[11]=r,i[12]=o,i[13]=a):a=i[13],a}var aE=e.i(539214),aT=e.i(904831),aA=e.i(571740),aR=e.i(257142);function aM(e){let a,i,r,s,l,o,c,u,m,h,p,f,g,x=(0,n.c)(26),{inChat:b,pageContentId:v}=e,y=(0,aR.useContentAudioStore)(aF),w=(0,aR.useContentAudioStore)(az),j=(0,aR.useContentAudioStore)(aL),S=(0,aR.useContentAudioStore)(aU),C=(0,aR.useContentAudioStore)(aD),N=(0,aR.useContentAudioStore)(aO),_=(0,d.useRef)(null);return(x[0]!==N||x[1]!==b||x[2]!==v||x[3]!==y?(a=()=>{y&&!b&&y.contentId!==v&&N()},i=[y,b,v,N],x[0]=N,x[1]=b,x[2]=v,x[3]=y,x[4]=a,x[5]=i):(a=x[4],i=x[5]),(0,d.useEffect)(a,i),x[6]!==N?(r=()=>
3N,s=[N],x[6]=N,x[7]=r,x[8]=s):(r=x[7],s=x[8]),(0,d.useEffect)(r,s),x[9]!==C||x[10]!==y?(l=()=>{let e=_.current;if(!e||!y)return;let t=()=>C({playing:!0,started:!0}),n=()=>C({playing:!1}),a=()=>C({position:e.currentTime}),i=()=>{e.playbackRate=aR.useContentAudioStore.getState().rate,Number.isFinite(e.duration)&&e.duration>0&&C({duration:e.duration})};return e.addEventListener("play",t),e.addEventListener("pause",n),e.addEventListener("ended",n),e.addEventListener("timeupdate",a),e.addEventListener("loadedmetadata",i),e.addEventListener("durationchange",i),()=>{e.removeEventListener("play",t),e.removeEventListener("pause",n),e.removeEventListener("ended",n),e.removeEventListener("timeupdate",a),e.removeEventListener("loadedmetadata",i),e.removeEventListener("durationchange",i)}},o=[y,C],x[9]=C,x[10]=y,x[11]=l,x[12]=o):(l=x[11],o=x[12]),(0,d.useEffect)(l,o),x[13]!==w||x[14]!==C?(c=()=>{let e=_.current;e&&w&&(e.currentTime=w.seconds,w.play&&aq(e,C))},u=[w,C],x[13]=w,x[14]=C,x[15]=c,x[16]=u):(c=x[15],u=x[16]),(0,d.useEffect)(c,u),x[17]!==j||x[18]!==C?(h=()=>{let e=_.current;if(e&&j)switch(j.kind){case"play":aq(e,C);break;case"pause":e.pause();break;case"toggle":e.paused?aq(e,C):e.pause();break;case"skip":{let t=Number.isFinite(e.duration)?e.duration:1/0;e.currentTime=Math.min(Math.max(0,e.currentTime+j.delta),t),C({position:e.currentTime})}}},m=[j,C],x[17]=j,x[18]=C,x[19]=m,x[20]=h):(m=x[19],h=x[20]),(0,d.useEffect)(h,m),x[21]!==S?(p=()=>{let e=_.current;e&&(e.playbackRate=S)},f=[S],x[21]=S,x[22]=p,x[23]=f):(p=x[22],f=x[23]),(0,d.useEffect)(p,f),y)?(x[24]!==y.audioUrl?(g=(0,t.jsx)("audio",{ref:_,src:y.audioUrl,preload:"metadata"}),x[24]=y.audioUrl,x[25]=g):g=x[25],g):null}function aO(e){return e.clear}function aD(e){return e.setStatus}function aU(e){return e.rate}function aL(e){return e.command}function az(e){return e.seek}function aF(e){return e.track}function aq(e,t){e.play().catch(()=>t({playing:!1}))}var aB=e.i(349847),aH=e.i(142481),a$=e.i(338995),aV=e.i(639),aG=e.i(246657),aQ=e.i(251860);function aK(e){return null!==e&&""!==e}function aW(e){let a,i,r,s=(0,n.c)(7),{message:l,redirectUrl:o}=e;s[0]!==l?(a=l?.trim(),s[0]=l,s[1]=a):a=s[1];let c=a;return s[2]!==c||s[3]!==o?(i=c||(0,aQ.defaultLockMessage)(aK(o)),s[2]=c,s[3]=o,s[4]=i):i=s[4],s[5]!==i?(r=(0,t.jsx)("div",{className:"flex flex-col motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2",children:(0,t.jsx)("div",{className:"w-fit max-w-[90%] whitespace-pre-line rounded-[1.25rem] bg-sand-9/11 px-3 py-2 text-base font-[450] leading-relaxed text-fg-high sm:max-w-[80%]",children:i})}),s[5]=i,s[6]=r):r=s[6],r}function aY(e){var a,i;let r,s,l,o,c,d,u,m,h,p,f=(0,n.c)(44),{ownerDisplayName:g,ownerImageUrl:x,redirectUrl:b,variant:v,title:y,description:w,ctaLabel:j,onContinue:S,onDiscover:C}=e;if(f[0]!==w||f[1]!==g||f[2]!==x||f[3]!==b||f[4]!==y||f[5]!==v){let e,n,m,h,p;(r=aK(b),s="discover"===v,c="mx-auto flex w-full max-w-[42rem] flex-col items-center gap-2 rounded-3xl border border-subtle bg-surface-secondary px-5 py-6 text-center motion-safe:animate-in motion-safe:fade-in-0 sm:px-6 sm:py-7",f[13]!==g||f[14]!==x?(e=x?(0,t.jsx)(eB.AvatarImage,{src:x,alt:g,className:"object-cover"}):null,f[13]=g,f[14]=x,f[15]=e):e=f[15],f[16]!==g?(n=g.slice(0,1).toUpperCase(),f[16]=g,f[17]=n):n=f[17],f[18]!==n?(m=(0,t.jsx)(eB.AvatarFallback,{className:"text-lg",children:n}),f[18]=n,f[19]=m):m=f[19],f[20]!==e||f[21]!==m?(d=(0,t.jsxs)(eB.Avatar,{className:"mb-1 size-14 rounded-full",children:[e,m]}),f[20]=e,f[21]=m,f[22]=d):d=f[22],f[23]!==g||f[24]!==y)?(h=y?.trim()||(0,aQ.defaultLockTitle)(g),f[23]=g,f[24]=y,f[25]=h):h=f[25],f[26]!==h?(u=(0,t.jsx)("h3",{className:"text-balance text-base font-medium text-fg-high",children:h}),f[26]=h,f[27]=u):u=f[27],l="max-w-sm text-pretty text-sm text-fg-mid",a=r,i=s,o=(p=w?.trim())||(a?(0,aQ.defaultLockDescription)(!0):i?"Explore more people on Delphi in the meantime.":(0,aQ.defaultLockDescription)(!1)),f[0]=w,f[1]=g,f[2]=x,f[3]=b,f[4]=y,f[5]=v,f[6]=r,f[7]=s,f[8]=l,f[9]=o,f[10]=c,f[11]=d,f[12]=u}else r=f[6],s=f[7],l=f[8],o=f[9],c=f[10],d=f[11],u=f[12];return(f[28]!==l||f[29]!==o?(m=(0,t.jsx)("p",{className:l,children:o}),f[28]=l,f[29]=o,f[30]=m):m=f[30],f[31]!==j||f[32]!==r||f[33]!==S||f[34]!==C||f[35]!==g||f[36]!==s)?(h=r||s?(0,t.jsxs)("div",{className:"mt-2 flex w-full flex-col items-stretch gap-2 sm:w-auto
3sm:items-center",children:[r?(0,t.jsxs)(el.Button,{size:"lg",onClick:S,className:"w-full gap-1.5 sm:w-auto",children:[j?.trim()||(0,aQ.defaultLockCtaLabel)(g),(0,t.jsx)(eo.ArrowUpRightIcon,{"aria-hidden":!0,className:"size-4"})]}):null,s?(0,t.jsxs)(el.Button,{size:"lg",variant:r?"subtle":"solid",onClick:C,className:"w-full gap-1.5 sm:w-auto",children:[(0,t.jsx)(eo.DiscoverIcon,{"aria-hidden":!0,className:"size-4"}),"Discover other Delphis"]}):null]}):null,f[31]=j,f[32]=r,f[33]=S,f[34]=C,f[35]=g,f[36]=s,f[37]=h):h=f[37],f[38]!==c||f[39]!==d||f[40]!==u||f[41]!==m||f[42]!==h?(p=(0,t.jsxs)("div",{className:c,children:[d,u,m,h]}),f[38]=c,f[39]=d,f[40]=u,f[41]=m,f[42]=h,f[43]=p):p=f[43],p}var aX=e.i(868810),aZ=e.i(335047),aJ=e.i(107762),a0=e.i(604772);function a1(e,t){return"profile"===t?"profile"===e:"chat"===e||"content"===e}let a2=null!=globalThis.window?d.useLayoutEffect:d.useEffect,a3=(0,b.cn)("flex min-h-0 flex-1 flex-col overflow-hidden");function a4(e){let t,a,i=(0,n.c)(3),[r,s]=(0,d.useState)(0),l=(0,d.useRef)(e);return i[0]!==e?(t=()=>{if(e){l.current=!0;return}if(!l.current)return;let t=window.setTimeout(()=>s(a5),400);return()=>window.clearTimeout(t)},a=[e],i[0]=e,i[1]=t,i[2]=a):(t=i[1],a=i[2]),(0,d.useEffect)(t,a),r}function a5(e){return e+1}function a6(e){let a,i,r,l,o,c,u,m,h,p,f,g,x,v,y=(0,n.c)(34),{mode:w,profile:j,chat:S,content:C}=e,N="chat"===w?S:"content"===w?C:null,_="chat"===w?"chat-pane":"content-pane";y[0]!==w?(a=a1(w,"overlay"),y[0]=w,y[1]=a):a=y[1];let k=a;y[2]!==w?(i=a1(w,"profile"),y[2]=w,y[3]=i):i=y[3];let I=i,[P,E]=(0,d.useState)(0),T=(0,d.useRef)(!1);y[4]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{T.current&&E(a7),T.current=!0},l=[],y[4]=r,y[5]=l):(r=y[4],l=y[5]),a2(r,l);let A=a4(k),R=a4(I);y[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,b.cn)("relative",a3),y[6]=o):o=y[6];let M=!k&&"pointer-events-none";y[7]!==M?(c=(0,b.cn)("absolute inset-0 flex min-h-0 flex-col",M),y[7]=M,y[8]=c):c=y[8];let O=!k||void 0,D=`${P}-${A}`;y[9]!==_||y[10]!==N?(u=N?(0,t.jsx)(er.motion.div,{initial:nW.PROFILE_TO_CHAT_SLIDE.chat.initial,animate:nW.PROFILE_TO_CHAT_SLIDE.chat.animate,exit:{...nW.PROFILE_TO_CHAT_SLIDE.chat.exit,pointerEvents:"none"},transition:nW.PROFILE_TO_CHAT_SLIDE.spring,className:(0,b.cn)("relative z-10",a3),children:N},_):null,y[9]=_,y[10]=N,y[11]=u):u=y[11],y[12]!==u||y[13]!==D?(m=(0,t.jsx)(s.AnimatePresence,{mode:"popLayout",initial:!1,children:u},D),y[12]=u,y[13]=D,y[14]=m):m=y[14],y[15]!==m||y[16]!==c||y[17]!==O?(h=(0,t.jsx)("div",{className:c,inert:O,children:m}),y[15]=m,y[16]=c,y[17]=O,y[18]=h):h=y[18];let U=!I&&"pointer-events-none";y[19]!==U?(p=(0,b.cn)("absolute inset-0 flex min-h-0 flex-col",U),y[19]=U,y[20]=p):p=y[20];let L=!I||void 0;return y[21]!==j||y[22]!==I?(f=I?(0,t.jsx)(er.motion.div,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0,pointerEvents:"none"},transition:nW.PROFILE_TO_CHAT_MORPH.fade,className:a3,children:j},"profile-pane"):null,y[21]=j,y[22]=I,y[23]=f):f=y[23],y[24]!==R||y[25]!==f?(g=(0,t.jsx)(s.AnimatePresence,{mode:"popLayout",initial:!1,children:f},R),y[24]=R,y[25]=f,y[26]=g):g=y[26],y[27]!==p||y[28]!==L||y[29]!==g?(x=(0,t.jsx)("div",{className:p,inert:L,children:g}),y[27]=p,y[28]=L,y[29]=g,y[30]=x):x=y[30],y[31]!==h||y[32]!==x?(v=(0,t.jsxs)("div",{className:o,children:[h,x]}),y[31]=h,y[32]=x,y[33]=v):v=y[33],v}function a7(e){return e+1}let a8=["prompt","q","message"];function a9(e){for(let t of a8)e.searchParams.delete(t)}function ie(e){return"chapterQuestion"in e&&e.chapterQuestion?e.chapterQuestion:null}function it(e,t,a,i){let r,s,l=(0,n.c)(6);l[0]!==i||l[1]!==t||l[2]!==a||l[3]!==e?(r=()=>{if(null==globalThis.window)return;let n=function(e){let t=new URL(e.href,"https://delphi.local");if(e.consumePending){let n=(0,K.takePendingUserMessage)(e.username,e.storage,e.now);if(n)return a9(t),e.send(n.chapterQuestion?{parts:n.parts,chapterQuestion:n.chapterQuestion}:{parts:n.parts}),t.toString()}return e.initialPrompt&&a8.some(n=>t.searchParams.get(n)===e.initialPrompt)?(a9(t),e.send({text:e.initialPrompt}),t.toString()):e.href}({consumePending:i,username:e,initialPrompt:t,href:window.location.href,send:a,storage:window.sessionStorage});n!==window.location.href&&window.history.replaceState(null,"",n)},s=[i,t,a,e],l[0]=i,l[1]=t,l[2]=a,l[3]=e,l[4]=r,l[5]=s):(r=l[4],s=l[5]),(0,d.useEffect)(r,s)}function ia(e,t,a){let i,r,s=(0,n.c)(5),l=void 0===a||a;
3s[0]!==l||s[1]!==t||s[2]!==e?(i=()=>{if(null==globalThis.window)return;let n=function(e){let t=new URL(e.href,"https://delphi.local");if(!e.enabled||"1"!==t.searchParams.get("continue"))return e.href;t.searchParams.delete("continue");let n=(0,K.takePendingAuthMessage)(e.username,e.storage,e.now);return n&&e.send({parts:n.parts}),t.toString()}({enabled:l,username:e,href:window.location.href,send:t,storage:window.sessionStorage});n!==window.location.href&&window.history.replaceState(null,"",n)},r=[l,t,e],s[0]=l,s[1]=t,s[2]=e,s[3]=i,s[4]=r):(i=s[3],r=s[4]),(0,d.useEffect)(i,r)}function ii(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||e.isContentEditable}function ir(e){let t,a,i=(0,n.c)(11),{mode:r,username:s,threadId:l,goToChat:o,leaveChat:c,isStreaming:u,onStopStream:m,onToggleTTS:h,canChat:p}=e,f=void 0===p||p;i[0]!==f||i[1]!==o||i[2]!==u||i[3]!==c||i[4]!==r||i[5]!==m||i[6]!==h||i[7]!==l||i[8]!==s?(t=()=>{let e=function(e){if(!e.metaKey&&!e.ctrlKey&&!e.altKey){if("c"===e.key&&"profile"===r&&f){if(ii(e.target))return;e.preventDefault(),o(s,l??void 0)}else if("m"===e.key&&"chat"===r&&h){if(ii(e.target))return;e.preventDefault(),h()}else if("Escape"===e.key&&"chat"===r){if(null!==document.querySelector('[role="dialog"][data-state="open"],[role="alertdialog"][data-state="open"],[role="menu"][data-state="open"]'))return;e.preventDefault(),u?m?.():c()}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},a=[r,s,l,o,c,u,m,h,f],i[0]=f,i[1]=o,i[2]=u,i[3]=c,i[4]=r,i[5]=m,i[6]=h,i[7]=l,i[8]=s,i[9]=t,i[10]=a):(t=i[9],a=i[10]),(0,d.useEffect)(t,a)}var is=e.i(250005),il=e.i(950072),io=e.i(326903);function ic(){let e,t,a,i,r=(0,n.c)(10),s=(0,P.usePathname)();r[0]!==s?(e=()=>s??"",r[0]=s,r[1]=e):e=r[1];let l=(0,d.useSyncExternalStore)(eE.subscribeToProfileUrlChange,eE.getProfilePathname,e);r[2]!==l?(t=(0,eE.resolveSurfaceMode)(l),r[2]=l,r[3]=t):t=r[3];let o=t;
3r[4]!==o||r[5]!==l?(a="content"===o?(0,n$.resolveContentItemId)(l):null,r[4]=o,r[5]=l,r[6]=a):a=r[6];let c=a;return r[7]!==c||r[8]!==o?(i={mode:o,contentItemId:c,goToChat:ih,goToProfile:im,goToContent:iu,goToContentItem:id},r[7]=c,r[8]=o,r[9]=i):i=r[9],i}function id(e,t){(0,eE.shallowPush)((0,n$.contentItemPath)(e,t))}function iu(e,t){(0,eE.shallowPush)((0,n$.contentListPath)(e,t?.type))}function im(e){(0,eE.shallowPush)(`/${e}`)}function ih(e,t,n){(0,eE.shallowPush)((0,io.chatThreadPath)(e,t,{firstOwner:n?.firstOwner,prompt:n?.prompt}))}var ip=e.i(221757),ig=e.i(232677),ix=e.i(251624),ib=e.i(365383),iv=e.i(215571),iy=e.i(211547),iw=e.i(507540),ij=e.i(527302);function iS(e){let a,i,r,s,l,o,c,d,u=(0,n.c)(22),{open:m,onOpenChange:h,username:p,displayName:f,imageUrl:g}=e;return u[0]!==g?(a=g?(0,t.jsx)("img",{src:g,alt:"",className:"size-20 rounded-[24px] object-cover shadow-lg"}):(0,t.jsx)("span",{className:"grid size-20 place-items-center rounded-[24px] bg-sand-12",children:(0,t.jsx)(iy.Logo,{className:"size-10 text-sand-1","aria-hidden":!0})}),u[0]=g,u[1]=a):a=u[1],u[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(iv.DialogTitle,{className:"text-xl",children:"Continue the conversation"}),u[2]=i):i=u[2],u[3]!==f?(r=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[i,(0,t.jsxs)(iv.DialogDescription,{children:["Sign in to keep talking with ",f]})]}),u[3]=f,u[4]=r):r=u[4],u[5]!==a||u[6]!==r?(s=(0,t.jsxs)(iv.DialogHeader,{className:"items-center gap-4 pt-4 text-center sm:text-center",children:[a,r]}),u[5]=a,u[6]=r,u[7]=s):s=u[7],u[8]!==h?(l=()=>h(!1),u[8]=h,u[9]=l):l=u[9],u[10]!==f||u[11]!==g||u[12]!==l||u[13]!==p?(o=(0,t.jsx)(iC,{username:p,displayName:f,imageUrl:g,onHandOff:l}),u[10]=f,u[11]=g,u[12]=l,u[13]=p,u[14]=o):o=u[14],u[15]!==s||u[16]!==o?(c=(0,t.jsxs)(iv.DialogContent,{className:"sm:max-w-sm",children:[s,o]}),u[15]=s,u[16]=o,u[17]=c):c=u[17],u[18]!==h||u[19]!==m||u[20]!==c?(d=(0,t.jsx)(iv.Dialog,{open:m,onOpenChange:h,children:c}),u[18]=h,u[19]=m,u[20]=c,u[21]=d):d=u[21],d}function iC(e){let a,i,r,s,l,o=(0,n.c)(14),{username:c,displayName:d,imageUrl:u,onHandOff:m}=e;o[0]!==c?(a=(0,ij.callPath)(c),o[0]=c,o[1]=a):a=o[1],o[2]!==d||o[3]!==u?(i={name:d,avatarUrl:u},o[2]=d,o[3]=u,o[4]=i):i=o[4],o[5]!==a||o[6]!==i?(r={callbackPath:a,intent:"conversation",source:"call_gate",mind:i},o[5]=a,o[6]=i,o[7]=r):r=o[7];let h=(0,iw.useSignInGate)(r);return o[8]!==m||o[9]!==h?(s=e=>{h.onClick&&(h.onClick(e),e.defaultPrevented&&m())},o[8]=m,o[9]=h,o[10]=s):s=o[10],o[11]!==h.href||o[12]!==s?(l=(0,t.jsx)(el.Button,{variant:"brand",size:"lg",className:"mt-2 w-full",asChild:!0,children:(0,t.jsx)(e8.default,{href:h.href,onClick:s,children:"Sign In"})}),o[11]=h.href,o[12]=s,o[13]=l):l=o[13],l}var iN=e.i(760044),i_=e.i(79929);function ik(e){let a,i,r,s,l,o,c,d,u,m,h,p,f,g,x,b=(0,n.c)(44),{open:v,onOpenChange:y,displayName:w,ownerImageUrl:j,onContinueInChat:S,paywall:C,onUpgrade:N,variant:_,onDiscover:k}=e,I=C?.title??"You've reached your voice limit",P=C?.subtitle??`You've used your free voice time with ${w}. Continue below to keep talking.`,E=C?.redirectUrl,T=C?.buttonText??"Upgrade",A="discover"===(void 0===_?"control":_)&&!!k;b[0]!==y||b[1]!==N||b[2]!==E?(a=()=>{(y(!1),N)?N():E&&(0,i_.openVisitorPaywallRedirect)(E)},b[0]=y,b[1]=N,b[2]=E,b[3]=a):a=b[3];let R=a;return b[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(iN.DetachedSheet.Backdrop,{}),b[4]=i):i=b[4],b[5]!==w||b[6]!==j?(r=j?(0,t.jsx)(eB.AvatarImage,{src:j,alt:w,className:"object-cover"}):null,b[5]=w,b[6]=j,b[7]=r):r=b[7],b[8]!==w?(s=w.slice(0,1).toUpperCase(),b[8]=w,b[9]=s):s=b[9],b[10]!==s?(l=(0,t.jsx)(eB.AvatarFallback,{className:"text-xl",children:s}),b[10]=s,b[11]=l):l=b[11],b[12]!==r||b[13]!==l?(o=(0,t.jsxs)(eB.Avatar,{className:"size-16 rounded-full",children:[r,l]}),b[12]=r,b[13]=l,b[14]=o):o=b[14],b[15]!==I?(c=(0,t.jsx)(iN.DetachedSheet.Title,{children:I}),b[15]=I,b[16]=c):c=b[16],b[17]!==P?(d=(0,t.jsx)(iN.DetachedSheet.Description,{children:P}),b[17]=P,b[18]=d):d=b[18],b[19]!==c||b[20]!==d?(u=(0,t.jsxs)(iN.DetachedSheet.Header,{className:"items-center gap-1.5",children:[c,d]}),b[19]=c,b[20]=d,b[21]=u):u=b[21],b[22]!==u||b[23]!==o?(m=(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 px-6 pb-2 pt-7 text-center",children:[o,u]}),b[22]=u,b[23]=o,b[24]=m):m=b[24],b[25]!==k||b[26]!==A?(h=A?(0,t.jsxs)(iN.DetachedSheet.CancelButton,{type:"button",className:"gap-1.5",onClick:k,children:[(0,t.jsx)(eo.DiscoverIcon,{"aria-hidden":!0,
3className:"size-4"}),"Discover other Delphis"]}):null,b[25]=k,b[26]=A,b[27]=h):h=b[27],b[28]!==R||b[29]!==S||b[30]!==y||b[31]!==T||b[32]!==E?(p=E?(0,t.jsxs)(iN.DetachedSheet.SubmitButton,{type:"button",className:"gap-1.5",onClick:R,children:[T,(0,t.jsx)(eo.ArrowUpRightIcon,{"aria-hidden":!0,className:"size-4"})]}):(0,t.jsxs)(iN.DetachedSheet.SubmitButton,{type:"button",className:"gap-1.5",onClick:()=>{y(!1),S()},children:[(0,t.jsx)(eo.CommentDotsIcon,{"aria-hidden":!0,className:"size-4"}),"Continue in chat"]}),b[28]=R,b[29]=S,b[30]=y,b[31]=T,b[32]=E,b[33]=p):p=b[33],b[34]!==h||b[35]!==p?(f=(0,t.jsxs)(iN.DetachedSheet.Footer,{children:[h,p]}),b[34]=h,b[35]=p,b[36]=f):f=b[36],b[37]!==m||b[38]!==f?(g=(0,t.jsx)(iN.DetachedSheet.Portal,{children:(0,t.jsxs)(iN.DetachedSheet.View,{children:[i,(0,t.jsxs)(iN.DetachedSheet.Content,{className:"max-w-md",children:[m,f]})]})}),b[37]=m,b[38]=f,b[39]=g):g=b[39],b[40]!==y||b[41]!==v||b[42]!==g?(x=(0,t.jsx)(iN.DetachedSheet.Root,{presented:v,onPresentedChange:y,children:g}),b[40]=y,b[41]=v,b[42]=g,b[43]=x):x=b[43],x}var iI=e.i(525808),iP=e.i(174576);function iE(e){let t,a,i,r,s,l,o,c,u,m,h,p,f=(0,n.c)(40),{username:g,ownerUserId:x,initialCall:b,onQuotaBlocked:v}=e,y=(0,d.useRef)(v);f[0]!==v?(t=()=>{y.current=v},a=[v],f[0]=v,f[1]=t,f[2]=a):(t=f[1],a=f[2]),(0,d.useEffect)(t,a),f[3]!==v||f[4]!==x?(i={onQuotaBlocked:v,ownerUserId:x},f[3]=v,f[4]=x,f[5]=i):i=f[5];let w=(0,iP.useVoiceCall)(g,i);f[6]!==b||f[7]!==g||f[8]!==w.reset||f[9]!==w.startCall||f[10]!==w.status||f[11]!==w.threadId?(r={status:w.status,threadId:w.threadId,startCall:w.startCall,reset:w.reset,username:g,initialCall:b},f[6]=b,f[7]=g,f[8]=w.reset,f[9]=w.startCall,f[10]=w.status,f[11]=w.threadId,f[12]=r):r=f[12];let j=function(e){let t,a,i,r,s,l,o,c,u,m=(0,n.c)(31),{status:h,threadId:p,startCall:f,reset:g,username:x,initialCall:b}=e,v=(0,P.usePathname)();m[0]!==v?(t=()=>v??"",m[0]=v,m[1]=t):t=m[1];let y=(0,d.useSyncExternalStore)(eE.subscribeToProfileUrlChange,eE.getProfilePathname,t),[w,j]=(0,d.useState)(b),[S,C]=(0,d.useState)(null);m[2]!==f||m[3]!==p||m[4]!==x?(a=async()=>{(0,ij.isCallPath)(window.location.pathname,x)||(C(window.location.pathname),(0,eE.shallowPush)((0,ij.callPath)(x,p??void 0))),await f()},m[2]=f,m[3]=p,m[4]=x,m[5]=a):a=m[5];let N=a;m[6]!==S||m[7]!==g||m[8]!==x?(i=()=>{(0,ij.isCallPath)(window.location.pathname,x)&&(0,eE.shallowReplace)(S??`/${x}`),j(!1),g()},m[6]=S,m[7]=g,m[8]=x,m[9]=i):i=m[9];let _=i;m[10]!==y||m[11]!==p||m[12]!==x?(r=()=>{p&&(0,ij.isCallPath)(y,x)&&y!==(0,ij.callPath)(x,p)&&(0,eE.shallowReplace)((0,ij.callPath)(x,p))},s=[p,y,x],m[10]=y,m[11]=p,m[12]=x,m[13]=r,m[14]=s):(r=m[13],s=m[14]),(0,d.useEffect)(r,s),m[15]!==y||m[16]!==g||m[17]!==h||m[18]!==x?(l=()=>{"idle"===h||(0,ij.isCallPath)(y,x)||g()},o=[y,h,x,g],m[15]=y,m[16]=g,m[17]=h,m[18]=x,m[19]=l,m[20]=o):(l=m[19],o=m[20]),(0,d.useEffect)(l,o),w&&!(0,ij.isCallPath)(y,x)&&j(!1),m[21]!==w||m[22]!==y||m[23]!==h||m[24]!==x?(c="idle"!==h||w&&(0,ij.isCallPath)(y,x),m[21]=w,m[22]=y,m[23]=h,m[24]=x,m[25]=c):c=m[25];let k=c;return m[26]!==S||m[27]!==k||m[28]!==_||m[29]!==N?(u={startCall:N,reset:_,overlayOpen:k,originPath:S},m[26]=S,m[27]=k,m[28]=_,m[29]=N,m[30]=u):u=m[30],u}(r),S=(0,iI.useCallQuota)(g),C=S.data?.revoked===!0,N=S.isPending,_=S.data?.voice_seconds.remaining;if(f[13]!==C||f[14]!==_){var k;s=!(k={revoked:C,remaining:_}).revoked&&null!=k.remaining&&k.remaining<=0,f[13]=C,f[14]=_,f[15]=s}else s=f[15];let I=s,E=j.startCall,T=w.markAccessRevoked;f[16]!==C||f[17]!==I||f[18]!==N||f[19]!==E?(l=async()=>{if(!C&&!N){if(I)return void y.current?.();await E()}},f[16]=C,f[17]=I,f[18]=N,f[19]=E,f[20]=l):l=f[20];let A=l;f[21]!==j.reset||f[22]!==A||f[23]!==w?(o={...w,startCall:A,reset:j.reset},f[21]=j.reset,f[22]=A,f[23]=w,f[24]=o):o=f[24];let R=o,M=w.status,O=S.refetch;return f[25]!==M||f[26]!==O?(u=()=>{("ended"===M||"failed"===M)&&O()},c=[M,O],f[25]=M,f[26]=O,f[27]=c,f[28]=u):(c=f[27],u=f[28]),(0,d.useEffect)(u,c),f[29]!==C||f[30]!==b||f[31]!==T||f[32]!==N?(m=()=>{b&&!N&&C&&T()},h=[C,b,T,N],f[29]=C,f[30]=b,f[31]=T,f[32]=N,f[33]=m,f[34]=h):(m=f[33],h=f[34]),(0,d.useEffect)(m,h),f[35]!==C||f[36]!==R||f[37]!==j.originPath||f[38]!==j.overlayOpen?(p={call:R,callOverlayOpen:j.overlayOpen,callOriginPath:j.originPath,accessRevoked:C},f[35]=C,f[36]=R,f[37]=j.originPath,f[38]=j.overlayOpen,f[39]=p):p=f[39],p}var iT=e.i(693492),iA=e.i(59805),iR=e.i(94916),iM=e.i(122123),iO=e.i(358960),iD=e.i(667724),iU=e.i(196985);function iL(){let e,a,i,r,s=(0,n.c)(17),{threadId:l,api:o,apiRequestOptions:c,displayName:d,imageUrl:u,startedAt:m,endedAt:h,openShare:p,canShare:f,isSharing:g}=(0,iD.useVoiceCallContext)();if(!l)return null;s[0]!==h||s[1]!==m?(e=null!==m&&null!==h?(0,iM.formatElapsed)(Math.max(0,Math.floor((h-m)/1e3))):null,
3s[0]=h,s[1]=m,s[2]=e):e=s[2];let x=e,b=x?`Your call \xb7 ${x}`:"Your call";return s[3]!==f||s[4]!==g||s[5]!==p?(a=f?(0,t.jsx)(iO.ShareCallFooter,{onShare:p,isSharing:g}):null,s[3]=f,s[4]=g,s[5]=p,s[6]=a):a=s[6],s[7]!==o||s[8]!==c||s[9]!==l?(i=(0,t.jsx)(iU.VoiceCallTranscript,{threadId:l,api:o,requestOptions:c}),s[7]=o,s[8]=c,s[9]=l,s[10]=i):i=s[10],s[11]!==d||s[12]!==u||s[13]!==b||s[14]!==a||s[15]!==i?(r=(0,t.jsx)("div",{className:"flex h-full min-h-0 flex-1 flex-col pt-16",children:(0,t.jsx)(iR.CallArtifact,{displayName:d,imageUrl:u,subtitle:b,footer:a,children:i})}),s[11]=d,s[12]=u,s[13]=b,s[14]=a,s[15]=i,s[16]=r):r=s[16],r}var iz=e.i(345430),iF=e.i(589976),iq=e.i(932016);let iB=[.215,.61,.355,1];function iH(){let e,a,i,r,l=(0,n.c)(16),{status:o,failReason:d,ownerUsername:u,threadId:m,startCall:h,onChat:p,accessRevoked:f}=(0,iD.useVoiceCallContext)(),g=(0,c.useReducedMotion)(),x="connecting"===o||"active"===o,b=("ended"===o||"failed"===o)&&!f;l[0]!==d||l[1]!==o?(e="failed"===o&&!(0,iq.canRetryProfileCall)(d),l[0]=d,l[1]=o,l[2]=e):e=l[2];let v=e;l[3]!==p||l[4]!==u||l[5]!==m?(a=p??(()=>(0,eE.shallowPush)((0,io.endedCallChatHref)(u,m))),l[3]=p,l[4]=u,l[5]=m,l[6]=a):a=l[6];let y=a;return l[7]!==v||l[8]!==b||l[9]!==y||l[10]!==x||l[11]!==g||l[12]!==h?(i=x?(0,t.jsx)(er.motion.div,{initial:!g&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:g?{opacity:0}:{opacity:0,scale:.9,transition:{duration:.1}},transition:{duration:.18,ease:iB},children:(0,t.jsx)(i$,{})},"live-controls"):b?(0,t.jsx)(er.motion.div,{className:"w-full",initial:!g&&{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:g?{opacity:0}:{opacity:0,scale:.9},transition:{duration:.2,type:"spring",bounce:0},children:(0,t.jsx)(iF.ChatCallBar,{callDisabled:v,onChat:y,onCall:()=>void h()})},"closing-bar"):null,l[7]=v,l[8]=b,l[9]=y,l[10]=x,l[11]=g,l[12]=h,l[13]=i):i=l[13],l[14]!==i?(r=(0,t.jsx)("footer",{className:"grid h-40 shrink-0 place-items-center px-5 sm:h-52",children:(0,t.jsx)(s.AnimatePresence,{mode:"wait",children:i})}),l[14]=i,l[15]=r):r=l[15],r}function i$(){let e,a,i,r,s,l,o,c,d,u,m,h,p=(0,n.c)(24),{micMuted:f,toggleMic:g,endCall:x}=(0,iD.useVoiceCallContext)(),v=f?eo.MicrophoneSlashIcon:eo.MicrophoneIcon,y=f?"Unmute":"Mute";p[0]===Symbol.for("react.memo_cache_sentinel")?(e={scale:1.02},a={scale:.97},p[0]=e,p[1]=a):(e=p[0],a=p[1]);let w=f&&"bg-sand-12 text-sand-1 hover:bg-sand-12";p[2]!==w?(i=(0,b.cn)("size-16 rounded-full sm:size-20",w),p[2]=w,p[3]=i):i=p[3];let j=f?"Turn on microphone":"Turn off microphone";return p[4]!==v?(r=(0,t.jsx)(v,{className:"size-7 sm:size-8"}),p[4]=v,p[5]=r):r=p[5],p[6]!==i||p[7]!==j||p[8]!==r||p[9]!==g?(s=(0,t.jsx)(er.motion.div,{whileHover:e,whileTap:a,children:(0,t.jsx)(el.Button,{size:"none",variant:"subtle",className:i,onClick:g,"aria-label":j,children:r})}),p[6]=i,p[7]=j,p[8]=r,p[9]=g,p[10]=s):s=p[10],p[11]!==y||p[12]!==s?(l=(0,t.jsx)(iV,{label:y,children:s}),p[11]=y,p[12]=s,p[13]=l):l=p[13],p[14]===Symbol.for("react.memo_cache_sentinel")?(c={scale:1.02},o={scale:.97},p[14]=o,p[15]=c):(o=p[14],c=p[15]),p[16]!==x?(d=()=>void x(),p[16]=x,p[17]=d):d=p[17],p[18]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(eo.PhoneSolidIcon,{className:"size-7 rotate-[135deg] sm:size-8"}),p[18]=u):u=p[18],p[19]!==d?(m=(0,t.jsx)(iV,{label:"End",children:(0,t.jsx)(er.motion.div,{whileHover:c,whileTap:o,children:(0,t.jsx)(el.Button,{size:"none",variant:"destructive",className:"size-16 rounded-full sm:size-20",onClick:d,"aria-label":"End Call",children:u})})}),p[19]=d,p[20]=m):m=p[20],p[21]!==m||p[22]!==l?(h=(0,t.jsxs)("div",{className:"flex items-start gap-12 sm:gap-14",children:[l,m]}),p[21]=m,p[22]=l,p[23]=h):h=p[23],h}function iV(e){let a,i,r=(0,n.c)(5),{label:s,children:l}=e;return r[0]!==s?(a=(0,t.jsx)("span",{className:"text-sm font-medium text-fg-mid select-none",children:s}),r[0]=s,r[1]=a):a=r[1],r[2]!==l||r[3]!==a?(i=(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[l,a]}),r[2]=l,r[3]=a,r[4]=i):i=r[4],i}var iG=e.i(535824),iQ=e.i(951445),iK=e.i(259355);function iW(){let e,a,i,r,s=(0,n.c)(4);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e={opacity:0,y:20},a={opacity:1,y:0},i={opacity:0,y:20},s[0]=e,s[1]=a,s[2]=i):(e=s[0],a=s[1],i=s[2]),s[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)(er.motion.div,{initial:e,animate:a,exit:i,className:"flex flex-col items-center gap-5",children:[(0,t.jsxs)("div",{className:"mx-auto flex w-fit items-center justify-center gap-1 rounded-full bg-sand-3 px-4 py-2 text-sand-11 select-none",children:[(0,t.jsx)(eo.PhoneSlashSolidIcon,{className:"size-5 text-sand-9"}),(0,t.jsx)("p",{className:"mx-1 text-base font-medium",children:"Call Ended"})]}),(0,t.jsx)(iK.CallEndedDoors,{})]}),s[3]=r):r=s[3],r}var iY=e.i(400148),iX=e.i(740281),iZ=e.i(116591);function iJ(){let e,t=(0,n.c)(2),a=(0,iZ.useWebOrigin)();return t[0]!==a?(e=(0,iX.formatHttpUrlLabel)(a),t[0]=a,t[1]=e):e=t[1],e}function i0(e){let a,i,r,s,l,o=(0,n.c)(12),{children:c,label:d,number:u}=e;return o[0]!==u?(a=(0,t.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-brand-accent text-xs font-semibold text-white",children:u}),o[0]=u,o[1]=a):a=o[1],o[2]!==d?(i=(0,t.jsx)("span",{className:"truncate text-xs font-medium text-fg-high",children:d}),o[2]=d,o[3]=i):i=o[3],o[4]!==a||o[5]!==i?(r=(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[a,i]}),o[4]=a,o[5]=i,o[6]=r):r=o[6],o[7]!==c?(s=(0,t.jsx)("div",{className:"relative min-h-40 flex-1 overflow-hidden rounded-2xl border border-neutral-200 bg-neutral-100 text-neutral-950 sm:min-h-44",children:c}),o[7]=c,o[8]=s):s=o[8],o[9]!==r||o[10]!==s?(l=(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-2.5",children:[r,s]}),o[9]=r,o[10]=s,o[11]=l):l=o[11],l}function i1(e){let a,i=(0,n.c)(2),{children:r}=e;return i[0]!==r?(a=(0,t.jsx)("div",{className:"grid gap-5 sm:grid-cols-2 sm:gap-3",children:r}),i[0]=r,i[1]=a):a=i[1],a}function i2(e){let a,i,r,s,l,o,c=(0,n.c)(13),{mobile:d}=e,u=void 0!==d&&d,m=iJ();return c[0]!==u?(a=u?null:(0,t.jsxs)("div",{className:"mb-2 flex gap-1 px-1",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-red-400"}),(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-amber-400"}),(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-green-400"})]}),c[0]=u,c[1]=a):a=c[1],c[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("span",{className:"relative flex size-7 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--brand-accent)_10%,transparent)] text-brand-accent ring-2 ring-brand-accent",children:(0,t.jsx)(eo.MicrophoneSlashIcon,{className:"size-3.5"})}),c[2]=i):i=c[2],c[3]!==m?(r=(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium",children:[m,"/val/call"]}),c[3]=m,c[4]=r):r=c[4],c[5]!==u?(s=u?(0,t.jsx)(eo.EllipsisIcon,{className:"size-3.5 text-neutral-500"}):null,c[5]=u,c[6]=s):s=c[6],c[7]!==r||c[8]!==s?(l=(0,t.jsxs)("div",{className:"flex h-10 items-center gap-2 rounded-full bg-neutral-100 px-2.5",children:[i,r,s]}),c[7]=r,c[8]=s,c[9]=l):l=c[9],c[10]!==a||c[11]!==l?(o=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 roun
3ded-2xl bg-white p-2 shadow-md",children:[a,l]}),c[10]=a,c[11]=l,c[12]=o):o=c[12],o}function i3(e){let a,i,r,s,l,o,c=(0,n.c)(11),{compact:d}=e,u=void 0!==d&&d,m=iJ();return c[0]!==m?(a=(0,t.jsxs)("span",{className:"text-[11px] font-semibold",children:["Permissions for ",m]}),c[0]=m,c[1]=a):a=c[1],c[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(eo.LockIcon,{className:"size-3 text-neutral-500"}),c[2]=i):i=c[2],c[3]!==a?(r=(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b border-neutral-200 pb-2",children:[a,i]}),c[3]=a,c[4]=r):r=c[4],c[5]!==u?(s=u?null:(0,t.jsxs)("div",{className:"flex items-center justify-between px-1 py-1 text-[10px] text-neutral-500",children:[(0,t.jsx)("span",{children:"Camera"}),(0,t.jsx)("span",{children:"Ask"})]}),c[5]=u,c[6]=s):s=c[6],c[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-[color-mix(in_srgb,var(--brand-accent)_10%,transparent)] px-2 py-1.5 ring-2 ring-brand-accent",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-[10px] font-medium",children:[(0,t.jsx)(eo.MicrophoneIcon,{className:"size-3"})," Microphone"]}),(0,t.jsx)("span",{className:"rounded-full bg-brand-accent px-2 py-0.5 text-[9px] font-semibold text-white",children:"Allow"})]}),c[7]=l):l=c[7],c[8]!==r||c[9]!==s?(o=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 rounded-2xl bg-white p-3 shadow-lg",children:[r,s,l]}),c[8]=r,c[9]=s,c[10]=o):o=c[10],o}function i4(e){let a,i,r,s,l=(0,n.c)(10),{mobile:o}=e,c=void 0!==o&&o,d=c?"Tap the microphone":"Open site controls";return l[0]!==c?(a=(0,t.jsx)(i2,{mobile:c}),l[0]=c,l[1]=a):a=l[1],l[2]!==d||l[3]!==a?(i=(0,t.jsx)(i0,{number:1,label:d,children:a}),l[2]=d,l[3]=a,l[4]=i):i=l[4],l[5]!==c?(r=(0,t.jsx)(i0,{number:2,label:"Allow Microphone",children:(0,t.jsx)(i3,{compact:c})}),l[5]=c,l[6]=r):r=l[6],l[7]!==i||l[8]!==r?(s=(0,t.jsxs)(i1,{children:[i,r]}),l[7]=i,l[8]=r,l[9]=s):s=l[9],s}function i5(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i0,{number:1,label:"Open site permissions",children:(0,t.jsx)(ra,{})}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(i1,{children:[e,(0,t.jsx)(i0,{number:2,label:"Allow Microphone",children:(0,t.jsx)(i3,{compact:!0})})]}),i[1]=a):a=i[1],a}function i6(){let e,a=(0,n.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("span",{className:"flex size-6 shrink-0 flex-col justify-center gap-0.5 rounded-md border border-neutral-400 bg-white px-1.5",children:[(0,t.jsx)("span",{className:"h-px rounded-full bg-neutral-600"}),(0,t.jsx)("span",{className:"h-px w-2 rounded-full bg-neutral-600"})]}),a[0]=e):e=a[0],e}function i7(){let e,a,i,r,s,l,o,c,d,u,m=(0,n.c)(15),h=iJ();return m[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-red-400"}),(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-amber-400"}),(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-green-400"})]}),a=(0,t.jsx)("span",{className:"text-base text-neutral-500",children:"â¹"}),m[0]=e,m[1]=a):(e=m[0],a=m[1]),m[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("span",{className:"rounded-md ring-2 ring-brand-accent ring-offset-1 ring-offset-white",children:(0,t.jsx)(i6,{})}),m[2]=i):i=m[2],m[3]!==h?(r=(0,t.jsxs)("div",{className:"flex h-11 items-center gap-2 border-b border-neutral-300 px-2.5",children:[e,a,(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-xl border border-neutral-300 bg-white px-2 py-1 shadow-sm",children:[i,(0,t.jsxs)("span",{className:"truncate text-[10px] font-medium",children:[h,"/val/call"]})]})]}),m[3]=h,m[4]=r):r=m[4],m[5]!==h?(s=(0,t.jsx)("div",{className:"mb-1 rounded-lg bg-white px-2 py-1.5 font-semibold",children:h}),m[5]=h,m[6]=s):s=m[6],m[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)("div",{className:"px-2 py-1 text-neutral-600",children:"Hide Distracting Itemsâ¦"}),o=(0,t.jsx)("div",{className:"px-2 py-1 text-neutral-600",children:"Zoom
3   100%"}),c=(0,t.jsx)("div",{className:"mt-0.5 rounded-md px-2 py-1 font-medium ring-2 ring-brand-accent",children:"Website Settingsâ¦"}),m[7]=l,m[8]=o,m[9]=c):(l=m[7],o=m[8],c=m[9]),m[10]!==s?(d=(0,t.jsxs)("div",{className:"mx-auto my-2 w-[78%] rounded-xl border border-neutral-300 bg-neutral-100 p-1.5 text-[9px] shadow-md",children:[s,l,o,c]}),m[10]=s,m[11]=d):d=m[11],m[12]!==r||m[13]!==d?(u=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-neutral-300 bg-neutral-200 shadow-lg",children:[r,d]}),m[12]=r,m[13]=d,m[14]=u):u=m[14],u}function i8(){let e,a,i,r,s,l,o,c=(0,n.c)(9),d=iJ();return c[0]!==d?(e=(0,t.jsxs)("div",{className:"mb-2 text-center text-[11px] font-semibold",children:["When visiting ",d,":"]}),c[0]=d,c[1]=e):e=c[1],c[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("div",{className:"grid grid-cols-[1fr_auto] gap-x-3 gap-y-1 border-y border-neutral-300 py-2 text-[9px]",children:[(0,t.jsx)("span",{className:"text-right text-neutral-600",children:"Page Zoom:"}),(0,t.jsx)("span",{className:"font-medium",children:"100%"}),(0,t.jsx)("span",{className:"text-right text-neutral-600",children:"Auto-Play:"}),(0,t.jsx)("span",{className:"font-medium",children:"Stop Media with Sound"})]}),c[2]=a):a=c[2],c[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)("span",{className:"text-right text-neutral-600",children:"Camera:"}),r=(0,t.jsx)("span",{children:"Ask"}),s=(0,t.jsx)("span",{className:"text-right font-medium",children:"Microphone:"}),c[3]=i,c[4]=r,c[5]=s):(i=c[3],r=c[4],s=c[5]),c[6]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsxs)("div",{className:"mt-2 grid grid-cols-[1fr_auto] items-center gap-x-3 gap-y-1 text-[10px]",children:[i,r,s,(0,t.jsxs)("span",{className:"flex items-center gap-1 rounded-md px-2 py-0.5 font-semibold ring-2 ring-brand-accent",children:["Allow ",(0,t.jsx)(eo.ChevronDownIcon,{className:"size-2"})]})]}),c[6]=l):l=c[6],c[7]!==e?(o=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 rounded-2xl border border-neutral-300 bg-neutral-200 p-3 shadow-lg",children:[e,a,l]}),c[7]=e,c[8]=o):o=c[8],o}function i9(){let e,a,i,r,s,l,o,c,d=(0,n.c)(13),u=iJ();return d[0]!==u?(e=(0,t.jsx)("div",{className:"mb-1.5 text-center font-semibold",children:u}),d[0]=u,d[1]=e):e=d[1],d[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("div",{className:"flex items-center justify-between border-t border-neutral-200 pt-1.5 text-neutral-600",children:[(0,t.jsx)("span",{children:"Listen to Page"}),(0,t.jsx)("span",{children:"Show Reader"})]}),d[2]=a):a=d[2],d[3]!==e?(i=(0,t.jsxs)("div",{className:"mx-2 mt-2 rounded-xl bg-white px-3 py-1.5 text-[9px] shadow-sm",children:[e,a]}),d[3]=e,d[4]=i):i=d[4],d[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)("div",{className:"mx-2 mt-1.5 grid grid-cols-4 gap-1 text-center text-[9px]",children:[(0,t.jsx)("span",{className:"rounded-lg bg-neutral-100 py-1.5",children:"â£"}),(0,t.jsx)("span",{className:"rounded-lg bg-neutral-100 py-1.5",children:"A"}),(0,t.jsx)("span",{className:"rounded-lg bg-neutral-100 py-1 text-xs",children:"A"}),(0,t.jsx)("span",{className:"rounded-lg bg-neutral-100 py-1.5 font-bold ring-2 ring-brand-accent",children:"â¢â¢â¢"})]}),d[5]=r):r=d[5],d[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)("span",{className:"rounded-md ring-2 ring-brand-accent ring-offset-1 ring-offset-neutral-100",children:(0,t.jsx)(i6,{})}),d[6]=s):s=d[6],d[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(eo.LockIcon,{className:"size-2.5 text-neutral-500"}),d[7]=l):l=d[7],d[8]!==u?(o=(0,t.jsxs)("div",{className:"mt-1.5 flex h-9 items-center gap-2 border-t border-neutral-300 bg-neutral-100 px-2.5",children:[s,(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1 rounded-xl bg-white px-2 py-1.5 shadow-sm",children:[l,(0,t.jsx)("span",{className:"truncate text-[10px] font-medium",children:u})]})]}),d[8]=u,d[9]=o):o=d[9],d[10]!==i||d[11]!==o?(c=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-neutral-300 bg-neutral-200 shadow-lg",children:[i,r,o
3]}),d[10]=i,d[11]=o,d[12]=c):c=d[12],c}function re(){let e,a,i,r,s,l,o,c,d=(0,n.c)(11),u=iJ();return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between text-[10px]",children:[(0,t.jsx)("span",{className:"text-sky-600",children:"Edit"}),(0,t.jsx)("span",{className:"font-semibold",children:"Page Menu"}),(0,t.jsx)("span",{className:"text-sky-600",children:"Done"})]}),d[0]=e):e=d[0],d[1]!==u?(a=u.toUpperCase(),d[1]=u,d[2]=a):a=d[2],d[3]!==a?(i=(0,t.jsxs)("div",{className:"mb-1 px-1 text-[8px] font-medium tracking-wide text-neutral-500",children:["WEBSITE SETTINGS FOR ",a]}),d[3]=a,d[4]=i):i=d[4],d[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-neutral-200 py-1.5",children:[(0,t.jsx)("span",{children:"Request Desktop Website"}),(0,t.jsx)("span",{className:"text-neutral-500",children:"Off"})]}),d[5]=r):r=d[5],d[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-neutral-200 py-1.5",children:[(0,t.jsx)("span",{children:"Camera"}),(0,t.jsx)("span",{className:"text-neutral-500",children:"Ask"})]}),d[6]=s):s=d[6],d[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)("span",{children:"Microphone"}),d[7]=l):l=d[7],d[8]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("div",{className:"overflow-hidden rounded-xl bg-white px-2.5 text-[9px] shadow-sm",children:[r,s,(0,t.jsxs)("div",{className:"-mx-0.5 flex items-center justify-between rounded-md px-1 py-1.5 font-medium ring-2 ring-brand-accent",children:[l,(0,t.jsxs)("span",{className:"flex items-center gap-1",children:["Allow ",(0,t.jsx)(eo.ChevronDownIcon,{className:"size-2"})]})]})]}),d[8]=o):o=d[8],d[9]!==i?(c=(0,t.jsxs)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 rounded-2xl border border-neutral-300 bg-neutral-200 p-2.5 shadow-lg",children:[e,i,o]}),d[9]=i,d[10]=c):c=d[10],c}function rt(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i0,{number:1,label:"Open Website Settings",children:(0,t.jsx)(i7,{})}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(i1,{children:[e,(0,t.jsx)(i0,{number:2,label:"Allow Microphone",children:(0,t.jsx)(i8,{})})]}),i[1]=a):a=i[1],a}function rn(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i0,{number:1,label:"Open Page Menu, then More",children:(0,t.jsx)(i9,{})}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(i1,{children:[e,(0,t.jsx)(i0,{number:2,label:"Allow Microphone",children:(0,t.jsx)(re,{})})]}),i[1]=a):a=i[1],a}function ra(){let e,a,i=(0,n.c)(3),r=iJ();return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"relative flex size-7 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--brand-accent)_10%,transparent)] text-brand-accent ring-2 ring-brand-accent",children:(0,t.jsx)(eo.SlidersIcon,{className:"size-3.5"})}),i[0]=e):e=i[0],i[1]!==r?(a=(0,t.jsx)("div",{className:"absolute inset-x-3 top-1/2 -translate-y-1/2 rounded-2xl bg-white p-3 shadow-md",children:(0,t.jsxs)("div",{className:"flex h-10 items-center gap-2 rounded-full bg-neutral-100 px-2.5",children:[e,(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium",children:[r,"/val/call"]})]})}),i[1]=r,i[2]=a):a=i[2],a}function ri(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i0,{number:1,label:"Open site permissions",children:(0,t.jsx)(ra,{})}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(i1,{children:[e,(0,t.jsx)(i0,{number:2,label:"Allow Microphone",children:(0,t.jsx)(i3,{compact:!0})})]}),i[1]=a):a=i[1],a}function rr(e){let a=(0,n.c)(6),{guide:i}=e;switch(i){case"chromium_desktop":{let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i4,{}),a[0]=e):e=a[0],e}case"chromium_android":{let e;return a[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i5,{}),a[1]=e):e=a[1],e}case"chrome_ios":{let e;return a[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(i4,{mobile:!0}),a[2]=e):e=a[2],e}case"safari_desktop":{let e;return a[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(rt,{}),a[3]=e):e=a[3],e}case"safari_mobile":{let e;return a[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(rn,{}),a[4]=e):e=a[4],e}case"generic":{let e;return a[5]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(ri,{}),a[5]=e):e=a[5],e}}}let rs={chromium_desktop:{browserName:"Chrome",instructions:"In Chrome, select the blocked microphone beside the address, then set Microphone to Allow."},chromium_android:{browserName:"Chrome on Android",instructions:"In Chrome on Android, open site information beside the address, choose Permissions, then allow Microphone."},chrome_ios:{browserName:"Chrome on iPhone or iPad",instructions:"In Chrome on iPhone or iPad, select the microphone beside the address, then turn on Permissions."},safari_desktop:{browserName:"Safari",instructions:"In Safari, open the Page Menu beside the address, choose Website Settings, then set Microphone to Allow."},safari_mobile:{browserName:"Safari on iPhone or iPad",instructions:"In Safari on iPhone or iPad, open the Page Menu, choose More, then set Microphone to Allow."},generic:{browserName:"your browser",instructions:"Open the site permissions beside the address, allow Microphone, then return to Delphi."}};function rl(){let e,a,i,r,s,l,o,c,u,m,h,p=(0,n.c)(20),[f,g]=(0,d.useState)(null),x=rs[f??"generic"],b=null!==f;p[0]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{e||g(null)},p[0]=e):e=p[0],p[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("p",{className:"max-w-xs text-center text-sm text-balance text-fg-mid",children:[iY.microphonePermissionDetail.leading," ",(0,t.jsx)(iN.DetachedSheet.Trigger,{asChild:!0,children:(0,t.jsx)(el.Button,{type:"button",variant:"link",size:"none",onClick:()=>g(null==globalThis.navigator?"generic":function({userAgent:e,maxTouchPoints:t}){if(/CriOS/i.test(e))return"chrome_ios";let n=/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&t>1,a=/Version\/[\d.]+.*Safari/i.test(e);
3if(n)return a?"safari_mobile":"generic";let i=/Android|Mobile/i.test(e);return/Chrome|Chromium|CriOS|Edg|EdgA|OPR|SamsungBrowser/i.test(e)?i?"chromium_android":"chromium_desktop":a?"safari_desktop":"generic"}({userAgent:navigator.userAgent,maxTouchPoints:navigator.maxTouchPoints})),children:iY.microphonePermissionDetail.action})}),iY.microphonePermissionDetail.trailing]}),p[1]=a):a=p[1],p[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(iN.DetachedSheet.Backdrop,{}),p[2]=i):i=p[2],p[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(iN.DetachedSheet.Title,{children:"Allow Microphone Access"}),p[3]=r):r=p[3],p[4]!==x.browserName?(s=(0,t.jsxs)(iN.DetachedSheet.Header,{children:[r,(0,t.jsxs)(iN.DetachedSheet.Description,{children:["Follow the highlighted controls in ",x.browserName,", then press Call again."]})]}),p[4]=x.browserName,p[5]=s):s=p[5],p[6]!==x.instructions?(l=(0,t.jsx)("p",{className:"sr-only",children:x.instructions}),p[6]=x.instructions,p[7]=l):l=p[7];let v=f??"generic";return p[8]!==v?(o=(0,t.jsx)("div",{"aria-hidden":!0,children:(0,t.jsx)(rr,{guide:v})}),p[8]=v,p[9]=o):o=p[9],p[10]!==l||p[11]!==o?(c=(0,t.jsxs)("div",{className:"px-6",children:[l,o]}),p[10]=l,p[11]=o,p[12]=c):c=p[12],p[13]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(iN.DetachedSheet.Footer,{children:(0,t.jsxs)(iN.DetachedSheet.CancelButton,{type:"button",variant:"ghost",className:"gap-2",onClick:()=>g(null),children:[(0,t.jsx)(eo.ArrowLeftIcon,{className:"size-4 text-fg-mid"})," Back to call"]})}),p[13]=u):u=p[13],p[14]!==s||p[15]!==c?(m=(0,t.jsx)(iN.DetachedSheet.Portal,{children:(0,t.jsxs)(iN.DetachedSheet.View,{children:[i,(0,t.jsxs)(iN.DetachedSheet.Content,{size:"xl",panelClassName:"[&_[data-slot=scroll-area-viewport]]:max-h-[calc(100svh-4.25rem)]",children:[s,c,u]})]})}),p[14]=s,p[15]=c,p[16]=m):m=p[16],p[17]!==b||p[18]!==m?(h=(0,t.jsxs)(iN.DetachedSheet.Root,{presented:b,onPresentedChange:e,children:[a,m]}),p[17]=b,p[18]=m,p[19]=h):h=p[19],h}var ro=e.i(805987);function rc(){let e,a,i,r,s,l,o,c,d,u,m=(0,n.c)(26),{failReason:h,displayName:p,accessRevoked:f}=(0,iD.useVoiceCallContext)(),{paywall:g,showUpgrade:x,handleUpgrade:b}=(0,ro.useCallFailPaywall)();m[0]!==p||m[1]!==h?(e=(0,iY.failReasonContent)(h,p),m[0]=p,m[1]=h,m[2]=e):e=m[2];let{icon:v,title:y,detail:w}=e,j="quota_exceeded"===h&&x&&g?.subtitle?g.subtitle:w,S=f?"mx-auto flex w-fit items-center justify-center gap-1 rounded-full bg-sand-3 px-4 py-2 text-sand-11 select-none":"mx-auto flex w-fit items-center justify-center gap-1 rounded-full bg-red-3 px-4 py-2 text-red-11 select-none",C=f?"size-5 text-sand-9":"size-5 text-red-9";return m[3]===Symbol.for("react.memo_cache_sentinel")?(a={opacity:0,y:20},i={opacity:1,y:0},r={opacity:0,y:20},m[3]=a,m[4]=i,m[5]=r):(a=m[3],i=m[4],r=m[5]),m[6]!==v||m[7]!==C?(s=(0,t.jsx)(v,{className:C}),m[6]=v,m[7]=C,m[8]=s):s=m[8],m[9]!==y?(l=(0,t.jsx)("p",{className:"mx-1 text-base font-medium",children:y}),m[9]=y,m[10]=l):l=m[10],m[11]!==S||m[12]!==s||m[13]!==l?(o=(0,t.jsxs)("div",{className:S,children:[s,l]}),m[11]=S,m[12]=s,m[13]=l,m[14]=o):o=m[14],m[15]!==j||m[16]!==h?(c="mic_denied"===h?(0,t.jsx)(rl,{}):(0,t.jsx)("p",{className:"max-w-xs text-center text-sm text-balance text-fg-mid",children:j}),m[15]=j,m[16]=h,m[17]=c):c=m[17],m[18]!==b||m[19]!==g?.buttonText||m[20]!==x?(d=x?(0,t.jsx)(el.Button,{className:"mx-auto w-fit",variant:"solid",onClick:b,children:g?.buttonText??"Upgrade"}):null,m[18]=b,m[19]=g?.buttonText,m[20]=x,m[21]=d):d=m[21],m[22]!==o||m[23]!==c||m[24]!==d?(u=(0,t.jsxs)(er.motion.div,{initial:a,animate:i,exit:r,className:"flex flex-col items-center gap-4",children:[o,c,d]}),m[22]=o,m[23]=c,m[24]=d,m[25]=u):u=m[25],u}var rd=e.i(933485),ru=e.i(357601),rm=e.i(533003);function rh(){let e,a,i,r=(0,n.c)(11),{status:s,startedAt:l,endedAt:o,remainingVoiceSeconds:c}=(0,iD.useVoiceCallContext)(),d="active"===s;r[0]!==o||r[1]!==l||r[2]!==s?(e={status:s,startedAt:l,endedAt:o},r[0]=o,r[1]=l,r[2]=s,r[3]=e):e=r[3];let u=(0,rm.useCallElapsedSeconds)(e);return r[4]!==d||r[5]!==c||r[6]!==u||r[7]!==s?(a="connecting"===s?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-sm font-medium text-fg-mid",children:["Calling",(0,t.jsx)(rd.Dots,{})]}):"active"===s||"ended"===s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,b.cn)("text-sm font-medium tabular-nums","ended"===s?"text-fg-error":"text-fg-mid"),children:(0,iM.formatElapsed)(u)}),d&&null!==c?(0,t.jsx)(ru.CallCountdown,{}):null]}):null,r[4]=d,r[5]=c,r[6]=u,r[7]=s,r[8]=a):a=r[8],r[9]!==a?(i=(0,t.jsx)("div",{className:"flex h-6 items-center justify-center gap-3",children:a}),r[9]=a,r[10]=i):i=r[10],i}var rp=e.i(942729);let rf=/(?<=[.?!â¦])\s+/;var rg=e.i(952479),rg=rg,rx=e.i(571416),rx=rx,rb=e.i(454643),rv=e.i(368791),ry=e.i(332152);function rw(e){let t=rb.zGetMessageResponse.safeParse(e);return t.success&&Array.isArray(t.data.data)?t.data.data:null}function rj(e,t){let n=rb.zGetMessageResponse.safeParse(t);if(!n.success||!Array.isArray(n.data.data))return t;let a=rw(e)??[],i=n.data.data;return{...n.data,data:function(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t)n.set(e.id,e);return[...n.values()].sort((e,t)=>
3(t.metadata?.createdAt??"").localeCompare(e.metadata?.createdAt??"")||t.id.localeCompare(e.id))}(a,i)}}let rS="mind-thinking",rC={visitor:"group is-user flex w-full justify-end",mind:"group is-assistant flex w-full justify-start"},rN={visitor:(0,b.cn)(v.bubble.user.surface,v.bubble.user.shadow),mind:v.bubble.delphi.surface};function r_(){let e,a,i,r,l,o,u,m,h,p,g,v,y,w,j,S,C=(0,n.c)(42),{status:N}=(0,iD.useVoiceCallContext)(),_=function(){let e,t,a,i,r,s,l,o,c=(0,n.c)(21),u=(0,rg.aB)(),m=(0,iG.useAgent)();c[0]!==u.room?(e={room:u.room},c[0]=u.room,c[1]=e):e=c[1];let h=(0,rx.a0)(e),p=(0,ry.useDevCaptionSegments)(),{status:g,threadId:b,apiRequestOptions:v}=(0,iD.useVoiceCallContext)(),[y,w]=(0,d.useState)(!1);c[2]!==u.room?(t=()=>{let e=()=>w(!0);return u.room.on(rv.RoomEvent.Reconnected,e),()=>{u.room.off(rv.RoomEvent.Reconnected,e)}},a=[u.room],c[2]=u.room,c[3]=t,c[4]=a):(t=c[3],a=c[4]),(0,d.useEffect)(t,a);let j=y&&"active"===g&&null!==b&&null===p;c[5]!==v||c[6]!==b?(i=(0,x.getMessageOptions)({...v??{},query:{...v?.query,threadId:b??"",limit:50}}),c[5]=v,c[6]=b,c[7]=i):i=c[7];let S=!!j&&750;c[8]!==j||c[9]!==i||c[10]!==S?(r={...i,enabled:j,refetchInterval:S,structuralSharing:rj},c[8]=j,c[9]=i,c[10]=S,c[11]=r):r=c[11];let{data:C}=(0,f.useQuery)(r),[N,_]=(0,d.useState)(null);m.isConnected&&m.identity!==N&&_(m.identity),c[12]!==N||c[13]!==h?(s=function(e,t){let n=[];for(let a of e){let e=a.text.trim();e&&n.push({id:a.streamInfo.attributes?.["lk.segment_id"]??a.streamInfo.id,speaker:a.participantInfo.identity===t?"mind":"visitor",text:e})}return n}(h,N),c[12]=N,c[13]=h,c[14]=s):s=c[14];let k=s;e:{let e;if(!y){l=null;break e}if(c[15]!==C){let t=rw(C);e=null===t?null:[...t].reverse(),c[15]=C,c[16]=e}else e=c[16];l=e}let I=l;return c[17]!==p||c[18]!==k||c[19]!==I?(o=p??function(e,t){if(null===t)return e;let n=[];for(let e of t){let t=(0,rp.extractMessageText)(e);if(!t)continue;let a="assistant"===e.role?"mind":"user"===e.role?"visitor":null;a&&n.push({id:`message:${e.id}`,speaker:a,text:t})}let a=new Set(e.map((e,t)=>t));for(let t=n.length-1;t>=0;t--){let i=n[t];if(!i)continue;let r=i.text.trim().replaceAll(/\s+/g," ").toLowerCase();for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n||n.speaker!==i.speaker||!a.has(t))continue;let s=n.text.trim().replaceAll(/\s+/g," ").toLowerCase();if(s&&r.startsWith(s)){i.id=n.id,a.delete(t);break}}}return n}(k,I),c[17]=p,c[18]=k,c[19]=I,c[20]=o):o=c[20],o}(),k=(0,iG.useAgent)(),I=(0,iz.useDevCloneStatus)(),P=(0,c.useReducedMotion)();C[0]!==_?(e=function(e){let t=[];for(let n of e)for(let[e,a]of n.text.split(rf).filter(Boolean).entries())t.push({id:`${n.id}:${e}`,speaker:n.speaker,text:a,complete:!0});let n=t.at(-1);return n&&(n.complete=!1),t.slice(-3)}(_),C[0]=_,C[1]=e):e=C[1];let E=e;C[2]!==k||C[3]!==I?(a=I??(0,iQ.mapAgentState)(k.state),C[2]=k,C[3]=I,C[4]=a):a=C[4];let T="thinking"===a;C[5]!==E||C[6]!==T?(i=E.map(rP),T&&E.at(-1)?.speaker!=="mind"&&i.push({kind:"thinking",id:rS}),C[5]=E,C[6]=T,C[7]=i):i=C[7];let A=i;C[8]!==A?(r=A.map(rI),C[8]=A,C[9]=r):r=C[9];let R=r;C[10]!==A?(l=A.map(rk).join("\0"),C[10]=A,C[11]=l):l=C[11];let M=l;C[12]===Symbol.for("react.memo_cache_sentinel")?(o={pinnedId:null,start:0},C[12]=o):o=C[12];let[O,D]=(0,d.useState)(o),U=null==O.pinnedId?-1:R.indexOf(O.pinnedId),L=-1!==U?U:O.pinnedId===rS&&A.length>0?Math.min(O.start,A.length-1):0,z=A.slice(L),F=(0,d.useRef)(null);C[13]===Symbol.for("react.memo_cache_sentinel")?(u=new Map,C[13]=u):u=C[13];let q=(0,d.useRef)(u);if(C[14]!==A||C[15]!==R||C[16]!==O.pinnedId||C[17]!==O.start?(m=()=>{let e=F.current;if(!e||0===A.length)return;let t=e.clientWidth,n=()=>{let n=e.clientHeight;if(n<=0)return;let a=e.clientWidth,i=Number.parseFloat(getComputedStyle(e).rowGap||"0")||0,r=q.current;if(a!==t&&(t=a,r.clear(),null!=O.pinnedId||0!==O.start))return void D({pinnedId:null,start:0});let s=new Set(R);for(let e of r.keys())s.has(e)||r.delete(e);for(let t of A){let n=e.querySelector(`[data-caption-id="${CSS.escape(t.id)}"]`);n instanceof HTMLElement&&r.set(t.id,n.getBoundingClientRect().height)}let l=A.map(e=>r.get(e.id)??0),o=function(e){let t=function(e,t,n){if(0===e.length||t<=0)return 0;let a=0,i=0;for(let r=e.length-1;r>=0;r--){let s=a+(e[r]??0)+(i>0?n:0);if(i>0&&s>t)break;a=s,i+=1}return e.length-i}(e.heightsPx,e.capacityPx,e.gapPx),n=null==e.pinnedId?-1:e.ids.indexOf(e.pinnedId),a=0;if(-1!==n)a=n;else if(null!=e.pinnedId&&null!=e.ephemeralIds&&e.ephemeralIds.includes(e.pinnedId)){let t=e.ids.length-1;a=t<0?0:Math.min(e.previousStart??0,t)}let i=Math.max(t,a);return{start:i,pinnedId:e.ids[i]??null}}({ids:R,pinnedId:O.pinnedId,previousStart:O.start,heightsPx:l,capacityPx:n,gapPx:i,ephemeralIds:[rS]});D(e=>e.pinnedId===o.pinnedId&&e.start===o.start?e:{pinnedId:o.pinnedId,start:o.start})};n();let a=new ResizeObserver(n);return a.observe(e),()=>a.disconnect()},C[14]=A,C[15]=R,C[16]=O.pinnedId,C[17]=O.start,C[18]=m):m=C[18],C[19]!==A||C[20]!==R||C[21]!==M||C[22]!==O.pinnedId||C[23]!==O.start?(h=[A,R,M,O.pinnedId,O.start],C[
319]=A,C[20]=R,C[21]=M,C[22]=O.pinnedId,C[23]=O.start,C[24]=h):h=C[24],(0,d.useLayoutEffect)(m,h),"active"!==N||0===A.length)return null;let B=er.motion;C[25]===Symbol.for("react.memo_cache_sentinel")?(g={opacity:0},p={opacity:1},C[25]=p,C[26]=g):(p=C[25],g=C[26]),C[27]!==P?(v=P?{opacity:0}:{opacity:0,y:-8,transition:{duration:.22,ease:"easeIn"}},C[27]=P,C[28]=v):v=C[28],C[29]===Symbol.for("react.memo_cache_sentinel")?(y={duration:.18},C[29]=y):y=C[29];let H=s.AnimatePresence;C[30]!==P?(w=e=>{let n="text"===e.kind?e.chunk.speaker:"mind";return(0,t.jsx)(er.motion.div,{"data-caption-id":e.id,layout:"text"===e.kind&&!!e.chunk.complete&&"position",initial:P?{opacity:0}:{opacity:0,y:10},animate:{opacity:1,y:0},exit:P?{opacity:0}:{opacity:0,y:-12,transition:{duration:.2,ease:"easeIn"}},transition:{type:"spring",duration:.3,bounce:0},className:rC[n],children:(0,t.jsx)("div",{className:(0,b.cn)("max-w-[85%] rounded-3xl px-4 py-2.5 text-base leading-normal",rN[n]),children:"text"===e.kind?e.chunk.text:(0,t.jsx)("span",{className:"flex h-6 items-center text-fg-mid",children:(0,t.jsx)(rd.Dots,{})})})},e.id)},C[30]=P,C[31]=w):w=C[31];let $=z.map(w);return C[32]!==H||C[33]!==$?(j=(0,t.jsx)(H,{mode:"popLayout",initial:!1,children:$}),C[32]=H,C[33]=$,C[34]=j):j=C[34],C[35]!==p||C[36]!==v||C[37]!==y||C[38]!==j||C[39]!==B.div||C[40]!==g?(S=(0,t.jsx)(B.div,{ref:F,initial:g,animate:p,exit:v,transition:y,className:"mx-auto flex h-full w-full max-w-md flex-col justify-start gap-2",children:j}),C[35]=p,C[36]=v,C[37]=y,C[38]=j,C[39]=B.div,C[40]=g,C[41]=S):S=C[41],S}function rk(e){return"text"===e.kind?`${e.id} 4${e.chunk.text}`:e.id}function rI(e){return e.id}function rP(e){return{kind:"text",id:e.id,chunk:e}}var rE=e.i(107398),rT=e.i(317128),rA=e.i(393099);let rR="rounded-[30%] supports-[corner-shape:squircle]:rounded-[88px] [corner-shape:squircle]";function rM(e){let a,i,r,l,o,c,d=(0,n.c)(15),{mode:u,displayName:m,imageUrl:h}=e;d[0]!==u?(a=(0,t.jsx)(s.AnimatePresence,{mode:"wait",children:"listening"===u?(0,t.jsx)(rU,{},"listening"):"thinking"===u?(0,t.jsx)(rL,{},"thinking"):"speaking"===u?(0,t.jsx)(rz,{},"speaking"):(0,t.jsx)(rD,{mode:u},"idle")}),d[0]=u,d[1]=a):a=d[1];let p=h??void 0,f=`Profile image for ${m}`;return d[2]!==p||d[3]!==f?(i=(0,t.jsx)(eB.AvatarImage,{src:p,alt:f}),d[2]=p,d[3]=f,d[4]=i):i=d[4],d[5]!==m?(r=m.slice(0,1),d[5]=m,d[6]=r):r=d[6],d[7]!==r?(l=(0,t.jsx)(eB.AvatarFallback,{className:"text-4xl font-medium",children:r}),d[7]=r,d[8]=l):l=d[8],d[9]!==i||d[10]!==l?(o=(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.image,transition:nW.PROFILE_TO_CHAT_MORPH.spring,className:"relative size-full",children:(0,t.jsxs)(eB.Avatar,{shadow:!0,className:"delphi-call-clone-indicator-picture size-full",children:[i,l]})}),d[9]=i,d[10]=l,d[11]=o):o=d[11],d[12]!==a||d[13]!==o?(c=(0,t.jsxs)("div",{className:"delphi-call-clone-indicator-ring relative size-40 p-2 sm:size-48",children:[a,o]}),d[12]=a,d[13]=o,d[14]=c):c=d[14],c}let rO={initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},transition:{duration:.3}};function rD(e){let a,i,r=(0,n.c)(4),{mode:s}=e,l="failed"===s?"border-red-9/50":"ended"===s?"border-sand-5/60":"border-sand-6/65";return r[0]!==l?(a=(0,b.cn)("absolute inset-0 border-[6px]",rR,l),r[0]=l,r[1]=a):a=r[1],r[2]!==a?(i=(0,t.jsx)(er.motion.div,{...rO,className:a}),r[2]=a,r[3]=i):i=r[3],i}function rU(){let e,a,i=(0,n.c)(2);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,b.cn)("absolute inset-0 overflow-hidden",rR),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(er.motion.div,{...rO,className:e,children:[(0,t.jsx)(er.motion.div,{"aria-hidden":!0,className:"absolute -inset-1/2 bg-[conic-gradient(from_0deg,transparent_0deg,transparent_290deg,var(--brand-accent)_330deg,var(--brand-accent)_356deg,transparent_360deg)]",animate:{rotate:360},transition:{duration:5,ease:"linear",repeat:1/0}}),(0,t.jsx)("div",{className:(0,b.cn)("absolute inset-0 border-[6px] border-fg-low/25",rR)})]}),i[1]=a):a=i[1],a}function rL(){let e=(0,rA.useMotionValue)(0),n=rT.useMotionTemplate`conic-gradient(var(--brand-accent) ${e}deg, var(--brand-secondary, var(--color-tangerine-3)) ${e}deg)`;return(0,d.useEffect)(()=>{let t=(0,rE.animate)(e,360,{duration:1.6,ease:"easeInOut"});return()=>t.stop()},[e]),(0,t.jsx)(er.motion.div,{...rO,className:(0,b.cn)("absolute inset-0 overflow-hidden",rR),children:(0,t.jsx)(er.motion.div,{"aria-hidden":!0,
4className:"absolute inset-0",style:{background:n}})})}function rz(){let e,a,i,r=(0,n.c)(3);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(er.motion.div,{"aria-hidden":!0,className:(0,b.cn)("absolute -inset-2.5 bg-tangerine-9/15",rR),animate:{scale:[1,1.05,1],opacity:[.6,1,.6]},transition:{duration:1.2,ease:"easeInOut",repeat:1/0}}),r[0]=e):e=r[0],r[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(er.motion.div,{"aria-hidden":!0,className:(0,b.cn)("absolute -inset-1 bg-tangerine-9/30",rR),animate:{scale:[1,1.03,1]},transition:{duration:1.2,ease:"easeInOut",repeat:1/0,delay:.1}}),r[1]=a):a=r[1],r[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxs)(er.motion.div,{...rO,className:"absolute inset-0",children:[e,a,(0,t.jsx)("div",{"aria-hidden":!0,className:(0,b.cn)("absolute inset-0 bg-brand-accent",rR)})]}),r[2]=i):i=r[2],i}var rF=e.i(782151);function rq(){let e,a,i,r,l,o,c,d,u,m,h,p,f,g=(0,n.c)(33),{status:x,displayName:b,imageUrl:v}=(0,iD.useVoiceCallContext)(),y=(0,iG.useAgent)(),w=(0,iz.useDevCloneStatus)();if(g[0]!==y.state||g[1]!==w||g[2]!==x){let t=(0,iQ.resolveCallCloneStatus)({callStatus:x,liveCloneStatus:(0,iQ.mapAgentState)(y.state),devCloneStatus:w});e=(0,iQ.toPortraitMode)(x,t),g[0]=y.state,g[1]=w,g[2]=x,g[3]=e}else e=g[3];let j=e;return g[4]!==b||g[5]!==v||g[6]!==j?(a=(0,t.jsx)(rM,{mode:j,displayName:b,imageUrl:v}),g[4]=b,g[5]=v,g[6]=j,g[7]=a):a=g[7],g[8]===Symbol.for("react.memo_cache_sentinel")?(i={backgroundColor:"transparent",padding:0,boxShadow:"none"},g[8]=i):i=g[8],g[9]!==b?(r=(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.pill,transition:nW.PROFILE_TO_CHAT_MORPH.pillSpring,className:"inline-flex items-center rounded-full",style:i,children:(0,t.jsx)(er.motion.div,{layoutId:nW.PROFILE_TO_CHAT_MORPH.name,transition:nW.PROFILE_TO_CHAT_MORPH.pillSpring,children:(0,t.jsx)("h2",{className:"text-center font-heading text-3xl font-semibold tracking-tight text-fg-high sm:text-4xl",children:b})})}),g[9]=b,g[10]=r):r=g[10],g[11]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(rh,{}),g[11]=l):l=g[11],g[12]!==r?(o=(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[r,l]}),g[12]=r,g[13]=o):o=g[13],g[14]!==x?(c="idle"===x?(0,t.jsx)(rF.Idle,{},"idle"):null,g[14]=x,g[15]=c):c=g[15],g[16]!==x?(d="connecting"===x||"active"===x?(0,t.jsx)(r_,{},"captions"):null,g[16]=x,g[17]=d):d=g[17],g[18]!==x?(u="ended"===x?(0,t.jsx)(iW,{},"ended"):null,g[18]=x,g[19]=u):u=g[19],g[20]!==x?(m="failed"===x?(0,t.jsx)(rc,{},"failed"):null,g[20]=x,g[21]=m):m=g[21],g[22]!==c||g[23]!==d||g[24]!==u||g[25]!==m?(h=(0,t.jsx)("div",{role:"status",className:"h-44 w-full sm:h-48",children:(0,t.jsxs)(s.AnimatePresence,{mode:"wait",children:[c,d,u,m]})}),g[22]=c,g[23]=d,g[24]=u,g[25]=m,g[26]=h):h=g[26],g[27]!==h||g[28]!==o?(p=(0,t.jsxs)("div",{className:"flex w-full flex-col gap-5",children:[o,h]}),g[27]=h,g[28]=o,g[29]=p):p=g[29],g[30]!==a||g[31]!==p?(f=(0,t.jsxs)("div",{className:"flex w-full flex-col items-center justify-center gap-5 px-4",children:[a,p]}),g[30]=a,g[31]=p,g[32]=f):f=g[32],f}var rB=e.i(234895),rH=e.i(410494),r$=e.i(342116),rV=e.i(214406),rG=e.i(779921);let rQ=(0,d.forwardRef)(function(e,a){let i,r,s,l,o,c,d,u,m,h,p=(0,n.c)(35),{call:f,displayName:g,imageUrl:x,ownerUsername:b,api:v,canShare:y,voiceSettingsHref:w,paywallOverride:j,onSecondaryUpgrade:S,originPath:C,onChat:N}=e,_=void 0===x?null:x,k=void 0===y||y,I=void 0===w?null:w,P=void 0===j?null:j,E=void 0===C?null:C,T=(0,r$.useShareCallSheet)(b,f.threadId),A=T.openShare,R=T.isSharing;p[0]!==f.threadId||p[1]!==R||p[2]!==A?(i=()=>{f.threadId&&!R&&A()},p[0]=f.threadId,p[1]=R,p[2]=A,p[3]=i):i=p[3];let M=i;return p[4]===Symbol.for("react.memo_cache_sentinel")?(r={opacity:0},s={opacity:1},l={opacity:0},p[4]=r,p[5]=s,p[6]=l):(r=p[4],s=p[5],l=p[6]),p[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-sand-1/70 backdrop-blur-xl dark:bg-sand-4/70"}),p[7]=o):o=p[7],p[8]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(rG.VoiceCallNavSync,{}),p[8]=c):c=p[8],p[9]!==g||p[10]!==T.open||p[11]!==T.setOpen||p[12]!==T.shareUrl?(d=(0,t.jsx)(iz.CallDevTools,{children:(0,t.jsx)(rK,{displayName:g,shareOpen:T.open,setShareOpen:T.setOpen,shareUrl:T.shareUrl})}),p[9]=g,p[10]=T.open,p[11]=T.setOpen,p[12]=T.shareUrl,p[13]=d):d=p[13],p[14]!==v||p[15]!==f||p[16]!==k||p[17]!==g||p[18]!==_||p[19]!==R||p[20]!==N||p[21]!==S||p[22]!==M||p[23]!==E||p[24]!==b||p[25]!==P||p[26]!==d||p[27]!==I?(u=(0,t.jsxs)(iD.VoiceCallProvider,{call:f,displayName:g,imageUrl:_,ownerUsername:b,a
4pi:v,canShare:k,voiceSettingsHref:I,paywallOverride:P,onSecondaryUpgrade:S,originPath:E,onChat:N,openShare:M,isSharing:R,children:[c,d]}),p[14]=v,p[15]=f,p[16]=k,p[17]=g,p[18]=_,p[19]=R,p[20]=N,p[21]=S,p[22]=M,p[23]=E,p[24]=b,p[25]=P,p[26]=d,p[27]=I,p[28]=u):u=p[28],p[29]!==f.session||p[30]!==u?(m=(0,t.jsx)("div",{className:"relative z-10 flex min-h-0 flex-1 flex-col",children:(0,t.jsx)(iA.SessionProvider,{session:f.session,children:u})}),p[29]=f.session,p[30]=u,p[31]=m):m=p[31],p[32]!==a||p[33]!==m?(h=(0,t.jsxs)(er.motion.div,{ref:a,initial:r,animate:s,exit:l,transition:nW.PROFILE_TO_CHAT_MORPH.fade,className:"absolute inset-0 z-30 flex flex-col",children:[o,m]}),p[32]=a,p[33]=m,p[34]=h):h=p[34],h});function rK(e){let a,i,r,s,l,o=(0,n.c)(18),{displayName:c,shareOpen:d,setShareOpen:u,shareUrl:m}=e;(0,rV.useSubscribeAgentAudio)();let{status:h,threadId:p,transcriptOpen:f,openTranscript:g}=(0,iD.useVoiceCallContext)();o[0]!==h||o[1]!==p||o[2]!==f?(a=(0,iD.isTranscriptTakeover)(h,f,p),o[0]=h,o[1]=p,o[2]=f,o[3]=a):a=o[3];let x=a;return o[4]!==x?(i=x?(0,t.jsx)(iL,{}):(0,t.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,t.jsx)(rW,{}),(0,t.jsx)("div",{className:"grid min-h-0 flex-1 place-items-center px-6",children:(0,t.jsx)(rq,{})}),(0,t.jsx)(iT.RoomAudioRenderer,{}),(0,t.jsx)(iH,{})]}),o[4]=x,o[5]=i):i=o[5],o[6]!==g||o[7]!==u?(r=()=>{u(!1),g()},o[6]=g,o[7]=u,o[8]=r):r=o[8],o[9]!==c||o[10]!==u||o[11]!==d||o[12]!==m||o[13]!==r?(s=(0,t.jsx)(rH.ShareCallSheet,{open:d,onOpenChange:u,shareUrl:m,displayName:c,onPreview:r}),o[9]=c,o[10]=u,o[11]=d,o[12]=m,o[13]=r,o[14]=s):s=o[14],o[15]!==i||o[16]!==s?(l=(0,t.jsxs)(t.Fragment,{children:[i,s]}),o[15]=i,o[16]=s,o[17]=l):l=o[17],l}function rW(){let e,a=(0,n.c)(1);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("header",{className:"pointer-events-none sticky top-[calc(var(--impersonation-h,0px)+4rem)] z-40 select-none",children:(0,t.jsx)("nav",{className:"flex items-center justify-end bg-transparent px-5 py-2 sm:px-10 sm:py-4",children:(0,t.jsx)("div",{className:"pointer-events-auto flex min-h-10 items-center gap-4",children:(0,t.jsx)(rB.CallLanguageSelect,{})})})}),a[0]=e):e=a[0],e}var rY=e.i(309071);function rX(e){let a,i,r,s,l,o,c,d=(0,n.c)(18),{ownerDisplayName:u,ownerAvatarUrl:m,ownerUserId:h,visitorState:p,callbackPath:f}=e;d[0]!==m||d[1]!==u?(a={name:u,avatarUrl:m},d[0]=m,d[1]=u,d[2]=a):a=d[2],d[3]!==f||d[4]!==a?(i={callbackPath:f,intent:"conversation",source:"chat_cover",mind:a},d[3]=f,d[4]=a,d[5]=i):i=d[5];let g=(0,iw.useSignInGate)(i),x=g.href;return d[6]!==h||d[7]!==g||d[8]!==p?(r=e=>{(0,tR.track)("visitor:signin_cover_click",{owner_user_id:h,visitor_state:p}),g.onClick?.(e)},d[6]=h,d[7]=g,d[8]=p,d[9]=r):r=d[9],d[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,b.cn)(v.control.subtle,"flex w-full items-center gap-3 rounded-2xl border border-subtle px-4 py-3 text-sm"),d[10]=s):s=d[10],d[11]!==u?(l=(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:["Sign in to keep chatting with ",u]}),d[11]=u,d[12]=l):l=d[12],d[13]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 font-medium text-brand-accent",children:["Sign In",(0,t.jsx)(eo.ChevronRightIcon,{className:"size-3","aria-hidden":!0})]}),d[13]=o):o=d[13],d[14]!==g.href||d[15]!==r||d[16]!==l?(c=(0,t.jsx)("div",{className:"rounded-2xl bg-surface-primary motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1",children:(0,t.jsxs)(e8.default,{href:x,onClick:r,className:s,children:[l,o]})}),d[14]=g.href,d[15]=r,d[16]=l,d[17]=c):c=d[17],c}var rZ=e.i(304870),rJ=e.i(322177);function r0(e,t){try{let n=new URL(e);return n.searchParams.has("utm_source")||n.searchParams.set("utm_source","delphi"),n.searchParams.has("utm_medium")||n.searchParams.set("utm_medium",t),n.toString()}catch{return e}}var r1=e.i(531721);function r2(e){let a,i,r,s,l=(0,n.c)(11),{open:o,onOpenChange:c,onSuccess:d}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)(iv.DialogHeader,{className:"shrink-0 border-b border-subtle px-6 py-4",children:[(0,t.jsx)(iv.DialogTitle,{children:"Record a voice clone to call yourself"}),(0,t.jsx)(iv.DialogDescription,{children:"Your Delphi speaks in your voice on calls. Record a short sample to continue."})]}),l[0]=a):a=l[0],l[1]!==c||l[2]!==d||l[3]!==o?(i=o?(0,t.jsxs)(r1.VoiceRecorder.Provider,{embedInSheet:!0,showTrainNotice:!1,onSuccess:()=>{d?.(),c(!1)},children:[(0,t.jsx)(r1.VoiceRecorder.TrainingProgress,{}),(0,t.jsx)(r1.VoiceRecorder.Shell,{children:(0,t.jsxs)(r1.VoiceRecorder.Sections,{children:[(0,t.jsx)(r1.VoiceRecorder.Instructions,{}),(0,t.jsx)(r1.VoiceRecorder.RecordingStatus,{}),(0,t.jsx)(r1.VoiceRecorder.Actions,{}),(0,t.jsx)(r1.VoiceRecorder.UploadSeparator,{}),(0,t.jsx)(r1.VoiceRecorder.Upload,{}),(0,t.jsx)(r1.VoiceRecorder.BiometricConsent,{}),(0,t.jsx)(r1.VoiceRecorder.Review,{}),(0,t.jsx)(r1.VoiceRecorder.ReviewFooter,{})]})})]}):null,l[1]=c,l[2]=d,l[3]=o,l[4]=i):i=l[4],l[5]!==i?(r=(0,t.jsxs)(iv.DialogContent,{className:"max-h-[min(90dvh,720px)] gap-0 overflow-hidden p-0 sm:max-w-lg",children:[a,(0,t.jsx)("div",{className:"overflow-y-auto px-6 pt-4 pb-4",children:i})]}),l[5]=i,l[6]=r):r=l[6],l[7]!==c||l[8]!==o||l[9]!==r?(s=(0,t.jsx)(iv.Dialog,{open:o,onOpenChange:c,children:r}),l[7]=c,l[8]=o,l[9]=r,l[10]=s):s=l[10],s}var r3=e.i(518040);function r4(e){let t,a,i,r,s,l,o=(0,n.c)(22),{username:c,isOwner:u,startCall:m,accessRevoked:h,status:p}=e,b=(0,g.useQueryClient)(),[v,y]=(0,d.useState)(!1);o[0]!==p?(t=(0,r3.shouldIgnoreDialStart)(p,!1),o[0]=p,o[1]=t):t=o[1];let w=t;o[2]!==c?(a=(0,x.getVoiceCloneAvailabilityOptions)({query:{owner_username:c}}),o[2]=c,o[3]=a):a=o[3];let j=!!c;o[4]!==a||o[5]!==j?(i={...a,enabled:j},o[4]=a,o[5]=j,o[6]=i):i=o[6];let S=(0,f.useQuery)(i),C=S.isFetched,N=S.data?.data.available===!0,_=!u&&(!C||!N||void 0!==h&&h),k=u&&C&&!N;o[7]!==C||o[8]!==N||o[9]!==u||o[10]!==m?(r=()=>{if(u&&C&&!N)return void y(!0);if(u||C&&N){if(u&&!C){N&&m();return}N&&m()}},o[7]=C,o[8]=N,o[9]=u,o[10]=m,o[11]=r):r=o[11];let I=r;o[12]!==b||o[13]!==c?(s=()=>{y(!1),b.invalidateQueries((0,x.getVoiceCloneAvailabilityOptions)({query:{owner_username:c}}))},o[12]=b,o[13]=c,o[14]=s):s=o[14];let P=s;return o[15]!==w||o[16]!==k||o[17]!==_||o[18]!==I||o[19]!==P||o[20]!==v?(l={hideCall:_,callGrayscale:k,callBusy:w,onCall:I,trainDialogOpen:v,setTrainDialogOpen:y,onTrainSuccess:P},o[15]=w,o[16]=k,o[17]=_,o[18]=I,o[19]=P,o[20]=v,o[21]=l):l=o[21],l}let r5="discoverSigninGate",r6=new Set,r7=()=>()=>{};function r8(){return null}function r9(e,t){let n=window.location.origin;return`${n}
4${(0,io.chatSharePath)(e,t)}`}function se({open:e,onOpenChange:n,threadId:a,ownerUsername:i,ownerName:r,ownerImageUrl:s,ownerHeadline:l,kind:o,questionText:c,startMessageId:u,endMessageId:h,title:f}){let b=!!(u&&h),[v,y]=(0,d.useState)(null),w=(0,d.useRef)(!1);e||null===v||y(null);let j=(0,g.useQueryClient)(),{mutateAsync:S,isPending:C}=(0,p.useMutation)((0,x.postThreadShareMutation)()),N=(0,d.useCallback)(async()=>{if(v)return v;if(w.current||!a)return null;w.current=!0;try{let e=(await S({body:{threadId:a,...b&&{startMessageId:u,endMessageId:h}}})).data.token;return y(e),j.invalidateQueries({queryKey:(0,x.getThreadShareQueryKey)({query:{threadId:a}})}),e}catch(t){let e=(0,tp.parseVisibleError)(t);return m.toast.error(e?.message??"Couldn't create share link"),null}finally{w.current=!1}},[v,S,a,b,u,h,j]),_=async()=>{let e=await N();if(!e)return;let t=r9(i,e);await navigator.clipboard.writeText(t),(0,m.toast)("Link copied",{duration:1500})},k=async e=>{let t,n=await N();if(!n)return;let a=r9(i,n),s="qa"===o?`${c??"Q&A"} â answered by ${r} on Delphi`:`Conversation with ${r} on Delphi`;t="x"===e?`https://x.com/intent/tweet?url=${encodeURIComponent(a)}&text=${encodeURIComponent(s)}`:"linkedin"===e?`https://www.linkedin.com/feed/?shareActive=true&url=${encodeURIComponent(a)}&text=${encodeURIComponent(s)}`:`https://wa.me/?text=${encodeURIComponent(`${s} ${a}`)}`,window.open(t,"_blank","noopener,noreferrer")},I="qa"===o?c?.trim()??"Shared Q&A":f?.trim()??`Conversation with ${r}`;return(0,t.jsx)(iv.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(iv.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(iv.DialogHeader,{children:(0,t.jsx)(iv.DialogTitle,{children:"qa"===o?"Share this Q&A":"Share this conversation"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"rounded-xl bg-surface-secondary p-5",children:[(0,t.jsx)("p",{className:"mb-6 line-clamp-3 text-sm font-semibold leading-snug text-fg-high",children:I}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-subtle pt-4",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,t.jsx)(eB.Avatar,{size:"2xl",className:"shrink-0",children:s?(0,t.jsx)(eB.AvatarImage,{src:s,alt:r,className:"object-cover"}):(0,t.jsx)(eB.AvatarFallback,{children:r.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase()})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-xs font-medium text-fg-high",children:r}),l?(0,t.jsx)("p",{className:"truncate text-[10px] leading-tight text-fg-low",children:l.split(/\s*[·/]\s*/)[0]?.trim()??l}):null]})]}),(0,t.jsx)(iy.Logo,{variant:"combination",className:"h-3.5 shrink-0 text-fg-low"})]})]}),(0,t.jsx)(iv.DialogDescription,{className:"text-sm text-fg-mid",children:"qa"===o?"Anyone with this link can read this answer.":"Anyone with this link can read the conversation up to this point."}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-lg",onClick:()=>void _(),disabled:C,"aria-label":"Copy link",children:(0,t.jsx)(eo.LinkIcon,{className:"size-5"})}),(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-lg",onClick:()=>void k("x"),disabled:C,"aria-label":"Share on X",children:(0,t.jsx)(eo.XTwitterIcon,{className:"size-5"})}),(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-lg",onClick:()=>void k("linkedin"),disabled:C,"aria-label":"Share on LinkedIn",children:(0,t.jsx)(eo.LinkedInIcon,{className:"size-5"})}),(0,t.jsx)(el.Button,{variant:"subtle",size:"icon-lg",onClick:()=>void k("whatsapp"),disabled:C,"aria-label":"Share on WhatsApp",children:(0,t.jsx)(eo.WhatsappIcon,{className:"size-5"})})]})]})]})})}var st=e.i(548767),sn=e.i(844534);function sa(e){let t,a,i,r,s,l,o,c,u=(0,n.c)(30),{messages:m,isStreaming:h,isAutoPlayEnabled:p}=e,{isEnabled:f,toggleEnabled:g,playMessage:x,stop:b,isAvailable:v,isLoading:y,isPlaying:w}=(0,st.useTTSContext)(),j=(0,d.useRef)(x),S=(0,d.useRef)(b),C=(0,d.useRef)(w),N=(0,d.useRef)(v);u[0]!==v||u[1]!==w||u[2]!==x||u[3]!==b?(t=()=>{j.current=x,S.current=b,C.current=w,N.current=v},u[0]=v,u[1]=w,u[2]=x,u[3]=b,u[4]=t):t=u[4],(0,d.useEffect)(t),u[5]!==m?(a=m.at(-1),u[5]=m,u[6]=a):a=u[6];let _=a,k=_?.id,I=_?.role,P=_?.metadata?.agentSource;u[7]!==m?(i=()=>{let e=[...m].reverse().find(ss);return e?.id},u[7]=m,u[8]=i):i=u[8];let[E]=(0,d.useState)(i),T=(0,d.useRef)(E),A=(0,d.useRef)(h);return u[9]!==p||u[10]!==f||u[11]!==h||u[12]!==_||u[13]!==P||u[14]!==k||u[15]!==I?(r=()=>{let e=A.current&&!h;if(A.current=h,!e||!f||!p||!N.current||!_||!k||"assistant"!==I||"feedback"===P||k===T.current)return;let t=_.parts.filter(sr).map(si).join(" ").trim(),n=(0,sn.stripCitationMarkers)(t);n&&(T.current=k,j.current(k,n))}
4,s=[h,_,k,I,P,f,p],u[9]=p,u[10]=f,u[11]=h,u[12]=_,u[13]=P,u[14]=k,u[15]=I,u[16]=r,u[17]=s):(r=u[16],s=u[17]),(0,d.useEffect)(r,s),u[18]!==k||u[19]!==I?(l=()=>{k&&"user"===I&&C.current&&S.current()},o=[k,I],u[18]=k,u[19]=I,u[20]=l,u[21]=o):(l=u[20],o=u[21]),(0,d.useEffect)(l,o),u[22]!==v||u[23]!==f||u[24]!==y||u[25]!==w||u[26]!==x||u[27]!==b||u[28]!==g?(c={playMessage:x,stop:b,isAvailable:v,isLoading:y,isPlaying:w,isEnabled:f,toggleEnabled:g},u[22]=v,u[23]=f,u[24]=y,u[25]=w,u[26]=x,u[27]=b,u[28]=g,u[29]=c):c=u[29],c}function si(e){return"text"===e.type?e.text:""}function sr(e){return"text"===e.type}function ss(e){return"assistant"===e.role}var sl=e.i(619409);function so(e){let a,i,r,s,l,o,c=(0,n.c)(20),{isEnabled:d,isPlaying:u,isLoading:m,onToggle:h,showDivider:p}=e,f=void 0!==m&&m,g=void 0===p||p,x=sc,v=f?"Preparing voice":d?"Disable voice":"Enable voice";c[0]!==g?(a=g?(0,t.jsx)("div",{className:"h-4 w-px bg-sand-9/20",onPointerDown:x,onClick:x}):null,c[0]=g,c[1]=a):a=c[1],c[2]!==h?(i=e=>{x(e),h()},c[2]=h,c[3]=i):i=c[3];let y=f||void 0,w=d||f?"text-fg-high":"text-fg-mid hover:text-fg-high",j=u&&!f&&"animate-pulse";c[4]!==w||c[5]!==j?(r=(0,b.cn)("flex items-center justify-center rounded-full p-1 transition-colors","hover:bg-sand-9/10",w,j),c[4]=w,c[5]=j,c[6]=r):r=c[6];let S=f?"Preparing voiceâ¦":d?"Voice reading enabled":"Enable voice reading";return c[7]!==d||c[8]!==f?(s=f?(0,t.jsx)(sl.LoadingSpinnerIcon,{className:"size-4 animate-spin","aria-hidden":!0}):d?(0,t.jsx)(eo.VolumeHighIcon,{className:"size-4"}):(0,t.jsx)(eo.VolumeXmarkIcon,{className:"size-4"}),c[7]=d,c[8]=f,c[9]=s):s=c[9],c[10]!==v||c[11]!==s||c[12]!==i||c[13]!==y||c[14]!==r||c[15]!==S?(l=(0,t.jsx)("button",{type:"button",onPointerDown:x,onClick:i,"aria-busy":y,className:r,"aria-label":v,title:S,children:s}),c[10]=v,c[11]=s,c[12]=i,c[13]=y,c[14]=r,c[15]=S,c[16]=l):l=c[16],c[17]!==l||c[18]!==a?(o=(0,t.jsxs)(t.Fragment,{children:[a,l]}),c[17]=l,c[18]=a,c[19]=o):o=c[19],o}function sc(e){e.preventDefault(),e.stopPropagation()}let sd=[.165,.84,.44,1],su=[.645,.045,.355,1];function sm(e){return e?{duration:0}:{duration:.34,ease:su}}function sh(e,t=.22){return e?{duration:0}:{duration:t,ease:sd}}function sp(e){let a,i,r,l,o,d=(0,n.c)(17),{composer:u,guided:m,showGuided:h,shellExiting:p,onGuidedExitComplete:f}=e,g=void 0!==p&&p,x=(0,c.useReducedMotion)();d[0]!==x?(a=x?{initial:!1}:{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:12,scale:.985}},d[0]=x,d[1]=a):a=d[1];let b=a,v=null!==m&&h,y=g?.32:.28;d[2]!==y||d[3]!==x?(i=sh(x,y),d[2]=y,d[3]=x,d[4]=i):i=d[4];let w=i;return d[5]!==f||d[6]!==g?(r=()=>{g&&f?.()},d[5]=f,d[6]=g,d[7]=r):r=d[7],d[8]!==u||d[9]!==m||d[10]!==b||d[11]!==v||d[12]!==w?(l=v?(0,t.jsx)(er.motion.div,{className:"pointer-events-auto relative z-10 w-full",...b,transition:w,children:m},"guided-training"):(0,t.jsx)(er.motion.div,{className:"w-full",...b,transition:w,children:u},"composer"),d[8]=u,d[9]=m,d[10]=b,d[11]=v,d[12]=w,d[13]=l):l=d[13],d[14]!==r||d[15]!==l?(o=(0,t.jsx)(s.AnimatePresence,{mode:"wait",initial:!1,onExitComplete:r,children:l}),d[14]=r,d[15]=l,d[16]=o):o=d[16],o}var sf=e.i(130574),sg=e.i(480338),sx=e.i(721582),sb=e.i(470815);function sv(e){let a,i,r,s,l,o,u,m,h,p,f=(0,n.c)(47),{defaultSources:g,moreSources:x,hiddenViews:v,disabled:y,onSelect:w,getCustomClick:j,onLayoutChange:S,appearance:C}=e;f[0]!==v?(a=void 0===v?[]:v,f[0]=v,f[1]=a):a=f[1];let N=a,_=void 0===C?"default":C,[k,I]=(0,d.useState)(!1),P=(0,c.useReducedMotion)();f[2]!==P?(i=P?{duration:0}:{duration:.25,ease:"easeInOut"},f[2]=P,f[3]=i):i=f[3];let E=i,T="guided-training"===_;f[4]!==N?(r=new Set(N),f[4]=N,f[5]=r):r=f[5];let A=r;if(f[6]!==g||f[7]!==A){let e;f[9]!==A?(e=e=>!A.has(e.view),f[9]=A,f[10]=e):e=f[10],s=g.filter(e),f[6]=g,f[7]=A,f[8]=s}else s=f[8];let R=s;if(f[11]!==A||f[12]!==x){let e;f[14]!==A?(e=e=>!A.has(e.view),f[14]=A,f[15]=e):e=f[15],l=x.filter(e),f[11]=A,f[12]=x,f[13]=l}else l=f[13];let M=l;if(f[16]!==_||f[17]!==y||f[18]!==j||f[19]!==w||f[20]!==R){let e;f[22]!==_||f[23]!==y||f[24]!==j||f[25]!==w?(e=e=>(0,t.jsx)(sb.SourceLink,{view:e.view,label:e.label,icon:e.icon,disabled:y,appearance:_,onCustomClick:j?.(e.view),onSelect:w},e.view),f[22]=_,f[23]=y,f[24]=j,f[25]=w,f[26]=e):e=f[26],o=R.map(e),f[16]=_,f[17]=y,f[18]=j,f[19]=w,f[20]=R,f[21]=o}else o=f[21];return f[27]!==_||f[28]!==y||f[29]!==j||f[30]!==E||f[31]!==S||f[32]!==w||f[33]!==k||f[34]!==M?(u=M.length>0?(0,t.jsx)(eq.AnimateHeight,{className:"col-span-1 min-w-0 sm:col-span-2",children:(0,t.jsx)(eq.AnimateHeightContent,{isVisible:k,transition:E,className:(0,b.cn)(!k&&"pointer-events-none"),onAnimationComplete:()=>S?.(),children:(0,t.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:M.map(e=>(0,t.jsx)(sb.SourceLink,{view:e.view,label:e.label,icon:e.icon,disabled:y,appearance:_,onCustomClick:j?.(e.view),onSelect:w},e.view))})})}):null,f[27]=_,f[28]=y,f[29]=j,f[30]=E,f[31]=S,f[32]=w,f[33]=k,f[34]=M,f[35]=u):u=f[35],f[36]!==o||f[37]!==u?(m=(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[o,u]}),f[36]=o,f[37]=u,f[38]=m):m=f[38],f[39]!==y||f[40]!==T||f[41]!==k||f[42]!==M.length?(h=M.length>0?T?(0,t.jsxs)("button",{type:"button",onClick:()=>I(sw),disabled:y,className:"mt-3 flex w-fit items-center gap-1 rounded-lg px-2 py-1 text-sm text-fg-mid transition-colors hover:bg-sand-9/7 active:bg-sand-9/4","aria-expanded":k,children:[k?"Show less":"See more",k?(0,t.jsx)(eo.ChevronUpIcon,{className:"size-4"}):(0,t.jsx)(eo.ChevronDownIcon,{className:"size-4"})]}):(0,t.jsxs)(el.Button,{type:"button",variant:"ghost",size:"none",shape:"none",onClick:()=>I(sy),disabled:y,className:"mt-3 w-fit gap-1 rounded-lg py-1 text-sm text-fg-mid hover:bg-transparent hover:text-fg-mid active:bg-transparent","aria-expanded":k,children:[k?"Show less":"See more",k?(0,t.jsx)(eo.ChevronUpIcon,{"data-icon":"inl
4ine-end"}):(0,t.jsx)(eo.ChevronDownIcon,{"data-icon":"inline-end"})]}):null,f[39]=y,f[40]=T,f[41]=k,f[42]=M.length,f[43]=h):h=f[43],f[44]!==m||f[45]!==h?(p=(0,t.jsxs)("div",{children:[m,h]}),f[44]=m,f[45]=h,f[46]=p):p=f[46],p}function sy(e){return!e}function sw(e){return!e}function sj(e){let a,i,r,s=(0,n.c)(10),{disabled:l,hiddenViews:o,onSelect:c,onLayoutChange:d,className:u}=e;return s[0]!==u?(a=(0,b.cn)("mt-4 flex w-full flex-col",u),s[0]=u,s[1]=a):a=s[1],s[2]!==l||s[3]!==o||s[4]!==d||s[5]!==c?(i=(0,t.jsx)(sv,{defaultSources:sx.ADD_TO_MIND_GUIDED_TRAINING_DEFAULT_SOURCES,moreSources:sx.ADD_TO_MIND_GUIDED_TRAINING_MORE_SOURCES,hiddenViews:o,disabled:l,onSelect:c,onLayoutChange:d,appearance:"guided-training"}),s[2]=l,s[3]=o,s[4]=d,s[5]=c,s[6]=i):i=s[6],s[7]!==a||s[8]!==i?(r=(0,t.jsx)("div",{className:a,children:i}),s[7]=a,s[8]=i,s[9]=r):r=s[9],r}let sS="data-guided-step-height-clip",sC=(0,d.createContext)(null);function sN(e){let a,i,r,s,l=(0,n.c)(14),{stepId:o,direction:d,scrollable:u,children:m,ref:h}=e,p=(0,c.useReducedMotion)();l[0]!==p?(a=p?{initial:{opacity:0}
4,animate:{opacity:1},exit:{opacity:0}}:{initial:e=>({opacity:0,y:e>=0?6:-6}),animate:{opacity:1,y:0},exit:e=>({opacity:0,y:e>=0?-6:6})},l[0]=p,l[1]=a):a=l[1],l[2]!==p?(i=sm(p),l[2]=p,l[3]=i):i=l[3];let f=void 0!==u&&u&&"max-h-[calc(100dvh-10rem)] overflow-y-auto overscroll-contain";return l[4]!==f?(r=(0,b.cn)("relative w-full",f),l[4]=f,l[5]=r):r=l[5],l[6]!==m||l[7]!==d||l[8]!==h||l[9]!==o||l[10]!==a||l[11]!==i||l[12]!==r?(s=(0,t.jsx)(er.motion.div,{ref:h,"data-guided-step":o,variants:a,initial:"initial",animate:"animate",exit:"exit",custom:d,transition:i,className:r,children:m}),l[6]=m,l[7]=d,l[8]=h,l[9]=o,l[10]=a,l[11]=i,l[12]=r,l[13]=s):s=l[13],s}function s_(e){let a,i,r,l,o,u,m,h,p,f,g,x,v,y,w,j,S=(0,n.c)(44),{step:C,stepNavDirection:N,disabled:_,children:k}=e,I=(0,c.useReducedMotion)(),P=(0,d.useRef)(null),[E,T]=(0,d.useState)(C),[A,R]=(0,d.useState)(!1);S[0]!==C?(a=(0,sg.guidedTrainingStepFillsViewport)(C),S[0]=C,S[1]=a):a=S[1];let M=a;S[2]!==C?(i=(0,sg.guidedTrainingShellFitsContent)(C),S[2]=C,S[3]=i):i=S[3];let O=i,D=!O,{ref:U,height:L,remeasure:z}=function(e){let t,a,i,r,s,l=(0,n.c)(9),o=(0,d.useRef)(null),[c,u]=(0,d.useState)(null);l[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{e&&(o.current=e)},l[0]=t):t=l[0];let m=t;l[1]!==e?(a=()=>
4{let t=o.current;if(!t||!t.isConnected||t.dataset.guidedStep!==e)return;let n=function(e){let t=e.parentElement;for(;t;){if(t.hasAttribute(sS))return t;t=t.parentElement}return null}(t),a=n?.style.height??"";n&&(n.style.height="auto");let i=Math.ceil(Math.max(t.scrollHeight,t.getBoundingClientRect().height));n&&(n.style.height=a),u(e=>e===i?e:i)},l[1]=e,l[2]=a):a=l[2];let h=a,[p,f]=(0,d.useState)(e);return e!==p&&(f(e),u(null)),l[3]!==h?(i=()=>{let e=o.current;if(!e)return;let t=!1,n=()=>{t||h()};n();let a=requestAnimationFrame(()=>{n(),requestAnimationFrame(n)}),i=new ResizeObserver(()=>h());return i.observe(e),()=>{t=!0,cancelAnimationFrame(a),i.disconnect()}},r=[h],l[3]=h,l[4]=i,l[5]=r):(i=l[4],r=l[5]),(0,d.useLayoutEffect)(i,r),l[6]!==c||l[7]!==h?(s={ref:m,height:c,remeasure:h},l[6]=c,l[7]=h,l[8]=s):s=l[8],s}(C),[F,q]=(0,d.useState)(!1),[B,H]=(0,d.useState)(!1),$=null!==L,V=D&&!I&&$&&F&&!A;E!==C&&(R(N<0||(0,sg.guidedTrainingStepFillsViewport)(E)&&!(0,sg.guidedTrainingStepFillsViewport)(C)),T(C)),$&&!F&&q(!0),S[4]!==_||S[5]!==C?(r=()=>{if(_)return;let e=P.current;if(!e)return;let t=(e.querySelector(`[data-guided-step="${C}"]`)??e).querySelector('[data-guided-step-focus="true"], button:not([disabled]), [href], textarea:not([disabled]), input:not([disabled])');t?.focus({preventScroll:!0})},l=[_,C],S[4]=_,S[5]=C,S[6]=r,S[7]=l):(r=S[6],l=S[7]),(0,d.useLayoutEffect)(r,l);let G=!O&&"min-h-0 flex-1",Q=B?"overflow-hidden":O?"overflow-visible":M||!D?"min-h-0 overflow-y-auto":"overflow-y-auto";S[8]!==G||S[9]!==Q?(o=(0,b.cn)("flex w-full flex-col overscroll-contain pb-2",G,Q),S[8]=G,S[9]=Q,S[10]=o):o=S[10],S[11]!==D?(u=D?{[sS]:""}:{},S[11]=D,S[12]=u):u=S[12];let K=D?"overflow-hidden":"min-h-0";S[13]!==K?(m=(0,b.cn)("w-full",K),S[13]=K,S[14]=m):m=S[14];let W=D&&$?L:"auto";return S[15]!==W?(h={height:W},S[15]=W,S[16]=h):h=S[16],S[17]!==I||S[18]!==V?(p=V?sm(I):{duration:0},S[17]=I,S[18]=V,S[19]=p):p=S[19],S[20]===Symbol.for("react.memo_cache_sentinel")?(f=()=>H(!0),g=()=>{R(!1),H(!1)},S[20]=f,S[21]=g):(f=S[20],g=S[21]),S[22]!==k||S[23]!==N||S[24]!==M||S[25]!==U||S[26]!==C?(x=(0,t.jsx)(sN,{ref:U,stepId:C,direction:N,scrollable:M,children:k},C),S[22]=k,S[23]=N,S[24]=M,S[25]=U,S[26]=C,S[27]=x):x=S[27],S[28]!==N||S[29]!==z||S[30]!==x?(v=(0,t.jsx)("div",{className:"relative w-full",children:(0,t.jsx)(s.AnimatePresence,{mode:"popLayout",custom:N,onExitComplete:z,children:x})}),S[28]=N,S[29]=z,S[30]=x,S[31]=v):v=S[31],S[32]!==m||S[33]!==h||S[34]!==p||S[35]!==v||S[36]!==u?(y=(0,t.jsx)(er.motion.div,{...u,className:m,initial:!1,animate:h,transition:p,onAnimationStart:f,onAnimationComplete:g,children:v}),S[32]=m,S[33]=h,S[34]=p,S[35]=v,S[36]=u,S[37]=y):y=S[37],S[38]!==y||S[39]!==o?(w=(0,t.jsx)("div",{ref:P,className:o,children:y}),S[38]=y,S[39]=o,S[40]=w):w=S[40],S[41]!==z||S[42]!==w?(j=(0,t.jsx)(sC.Provider,{value:z,children:w}),S[41]=z,S[42]=w,S[43]=j):j=S[43],j}function sk(e){let a,i,r,s,l=(0,n.c)(13),{disabled:o,hiddenSources:c,onSelect:u,onSkip:m}=e;l[0]!==c?(a=void 0===c?[]:c,l[0]=c,l[1]=a):a=l[1];let h=a,p=(0,d.use)(sC)??void 0;return l[2]!==o||l[3]!==h||l[4]!==u||l[5]!==p?(i=(0,t.jsx)(sj,{disabled:o,hiddenViews:h,onSelect:u,onLayoutChange:p}),l[2]=o,l[3]=h,l[4]=u,l[5]=p,l[6]=i):i=l[6],l[7]!==o||l[8]!==m?(r=m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eH.Separator,{className:"mt-2"}),(0,t.jsx)("div",{className:"mt-4 flex items-center justify-end",children:(0,t.jsx)(el.Button,{type:"button",size:"lg",onClick:m,disabled:o,className:"min-w-28",children:sg.GUIDED_TRAINING_CONTENT_ADDED_ACTIONS.keepGoing})})]}):null,l[7]=o,l[8]=m,l[9]=r):r=l[9],l[10]!==i||l[11]!==r?(s=(0,t.jsxs)("div",{className:"flex w-full flex-col",children:[i,r]}),l[10]=i,l[11]=r,l[12]=s):s=l[12],s}let sI=(0,b.cn)("flex w-full flex-col gap-2 rounded-3xl border border-loud bg-surface-secondary p-2"),sP=(0,b.cn)("flex w-full flex-col gap-2 rounded-3xl border border-loud bg-surface-primary p-4 shadow-[0_12px_32px_rgba(0,0,0,0.10)]");function sE(e){let a,i,r=(0,n.c)(7),{options:s,disabled:l}=e;if(r[0]!==l||r[1]!==s){let e;r[3]!==l?(e=(e,n)=>(0,t.jsx)(el.Button,{type:"button",variant:"ghost",size:"none",shape:"none",disabled:l,onClick:e.onSelect,className:"h-12 w-full justify-start gap-3 rounded-xl px-4 text-left text-base font-normal text-fg-high transition-colors hover:bg-sand-9/7 focus-visible:bg-sand-9/7 active:bg-sand-9/10","data-guided-step-focus":0===n?"true":void 0,children:(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.label})},e.label),r[3]=l,r[4]=e):e=r[4],a=s.map(e),r[0]=l,r[1]=s,r[2]=a}else a=r[2];return r[5]!==a?(i=(0,t.jsx)("div",{className:"flex w-full flex-col",children:a}),r[5]=a,r[6]=i):i=r[6],i}var sT=e.i(58984);function sA(e){let a,i=(0,n.c)(8),{disabled:r,saveDisabled:l,committingScore:o,onRate:u}=e,m=(0,c.useReducedMotion)(),[h,p]=(0,d.useState)(""),f=h?Number(h):null,g=null!==o;return i[0]!==r||i[1]!==g||i[2]!==u||i[3]!==m||i[4]!==l||i[5]!==f||i[6]!==h?(a=(0,t.jsx)("div",{className:"flex w-full flex-col gap-6 px-2 pt-2 pb-2",children:(0,t.jsx)(s.AnimatePresence,{initial:!1,mode:"wait",children:g?(0,t.jsx)(er.motion.div,{initial:!m&&{opacity:0}
4,animate:{opacity:1},exit:m?void 0:{opacity:0},transition:sh(m),className:"px-2 py-3 text-center text-sm text-fg-mid","aria-live":"polite",children:"Saving your ratingâ¦"},"committing"):(0,t.jsxs)(er.motion.div,{initial:!m&&{opacity:0},animate:{opacity:1},exit:m?void 0:{opacity:0},transition:sh(m),className:"flex flex-col gap-6",children:[(0,t.jsx)(sT.RadioCardGroup,{value:h||void 0,onValueChange:e=>{e&&p(e)},disabled:r,className:"grid w-full grid-cols-1 gap-1 sm:grid-cols-5","aria-label":sg.GUIDED_TRAINING_COPY.rateTitle,children:sg.GUIDED_TRAINING_RATING_OPTIONS.map(e=>(0,t.jsx)(sT.RadioCard,{value:String(e.score),"aria-label":e.label,disabled:r,className:"h-20 min-h-0 w-full flex-col items-center justify-center rounded-xl border-loud bg-surface-primary px-2 py-3 text-center text-sm text-fg-mid whitespace-normal data-checked:border-blue-9 data-checked:bg-blue-9/8 data-checked:font-medium data-checked:text-fg-high data-checked:ring-3 data-checked:ring-blue-9/30",children:e.label},e.score))}),(0,t.jsx)("div",{className:"flex w-full justify-end px-2",children:(0,t.jsxs)(el.Button,{type:"button",variant:"blue",size:"lg",disabled:r||l||null===f,onClick:()=>{null!==f&&u(f)},children:[(0,t.jsx)(eo.CheckIcon,{"data-icon":"inline-start"}),"Save"]})})]},"rating-options")})}),i[0]=r,i[1]=g,i[2]=u,i[3]=m,i[4]=l,i[5]=f,i[6]=h,i[7]=a):a=i[7],a}function sR(e){let a,i,r=(0,n.c)(4),{onClick:s,disabled:l}=e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(eo.ArrowLeftIcon,{}),r[0]=a):a=r[0],r[1]!==l||r[2]!==s?(i=(0,t.jsx)(el.Button,{type:"button",variant:"ghost",size:"icon","aria-label":"Back",onClick:s,disabled:l,className:"shrink-0 text-fg-low",children:a}),r[1]=l,r[2]=s,r[3]=i):i=r[3],i}function sM(e){let a,i,r=(0,n.c)(13),{disabled:s,onExit:l}=e,[o,c]=(0,d.useState)(!1);if(o){let e,n,a,i,o;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("span",{className:"text-sm font-medium text-fg-low",children:"Are you sure?"}),r[0]=e):e=r[0],r[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!1),r[1]=n):n=r[1],r[2]!==s?(a=(0,t.jsx)(el.Button,{type:"button",size:"sm",variant:"subtle",onClick:n,disabled:s,children:"Resume"}),r[2]=s,r[3]=a):a=r[3],r[4]!==s||r[5]!==l?(i=(0,t.jsx)(el.Button,{type:"button",size:"sm",variant:"ghost",onClick:l,disabled:s,children:"Exit"}),r[4]=s,r[5]=l,r[6]=i):i=r[6],r[7]!==a||r[8]!==i?(o=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e,a,i]}),r[7]=a,r[8]=i,r[9]=o):o=r[9],o}return r[10]===Symbol.for("react.memo_cache_sentinel")?(a=()=>c(!0),r[10]=a):a=r[10],r[11]!==s?(i=(0,t.jsx)(el.Button,{type:"button",size:"none",variant:"ghost",shape:"none",onClick:a,disabled:s,className:"-ml-1 rounded-md px-1 py-0.5 text-xs leading-4 text-fg-low underline underline-offset-2 hover:bg-sand-9/7",children:"Don't set up my Delphi"}),r[11]=s,r[12]=i):i=r[12],i}function sO(e){let a,i,r,l=(0,n.c)(21),{stepKey:o,shellVariant:u,shellFitsContent:m,title:h,description:p,canGoBack:f,onBack:g,onDismiss:x,disabled:v,hidden:y,contentBusy:w,children:j}=e,S=void 0!==m&&m,C=(0,c.useReducedMotion)();l[0]!==C?(a=sm(C),l[0]=C,l[1]=a):a=l[1];let N=a,_="primary"===u,k=!!p,I=f&&!k,[P,E]=(0,d.useState)(!1);return l[2]!==f||l[3]!==I||l[4]!==j||l[5]!==w||l[6]!==p||l[7]!==v||l[8]!==y||l[9]!==_||l[10]!==g||l[11]!==x||l[12]!==P||l[13]!==C||l[14]!==S||l[15]!==o||l[16]!==N||l[17]!==h?(i=y?null:(0,t.jsxs)(er.motion.div,{className:(0,b.cn)("flex w-full flex-col items-center gap-1",P&&"overflow-hidden"),...C?{initial:!1,animate:{opacity:1},exit:{opacity:0,transition:{duration:0}},transition:{duration:0}}:{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0,transition:{duration:.38,ease:su,opacity:{duration:.28,ease:su,delay:.04}}},transition:{duration:.34,ease:sd}},onAnimationStart:()=>E(!0),onAnimationComplete:()=>E(!1),children:[(0,t.jsxs)("section",{className:(0,b.cn)(_?sP:sI,S?"h-fit flex-col overflow-visible":"max-h-[calc(100dvh-5.5rem)] min-h-0 flex-col overflow-hidden","transition-[padding,background-color,box-shadow] duration-300 ease-[cubic-bezier(0.645,0.045,0.355,1)] motion-reduce:transition-none"),"aria-busy":w,children:[(0,t.jsxs)("header",{className:(0,b.cn)(_?"flex w-full items-center gap-3":(0,b.cn)("flex w-full gap-2 pt-2 pb-1 pr-1",I?"items-center":"items-start",f?"pl-1":"pl-4")),children:[f?(0,t.jsx)(sR,{onClick:g,disabled:v}):null,(0,t.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,t.jsxs)("div",{"aria-hidden":!0,
4className:"invisible",children:[(0,t.jsx)("h2",{className:(0,b.cn)("m-0 text-lg leading-tight font-medium text-fg-high",!_&&"opacity-90"),children:h}),p?(0,t.jsx)("p",{className:"mt-1 text-sm leading-5 text-fg-mid",children:p}):null]}),(0,t.jsx)(s.AnimatePresence,{initial:!1,mode:"sync",children:(0,t.jsxs)(er.motion.div,{className:"absolute inset-0",initial:C?{opacity:0}:{opacity:0,y:5},animate:{opacity:1,y:0},exit:C?{opacity:0}:{opacity:0,y:-5},transition:N,children:[(0,t.jsx)("h2",{className:(0,b.cn)("m-0 text-lg leading-tight font-medium text-fg-high",!_&&"opacity-90"),children:h}),p?(0,t.jsx)("p",{className:"mt-1 text-sm leading-5 text-fg-mid",children:p}):null]},`${o}-${h}`)})]})]}),(0,t.jsx)(er.motion.div,{className:(0,b.cn)("flex w-full flex-col",S?"overflow-visible":"min-h-0 flex-1 overflow-hidden"),initial:!1,animate:{opacity:w?.72:1},transition:N,children:j})]}),(0,t.jsx)("div",{className:"flex w-full justify-end",children:(0,t.jsx)(sM,{disabled:v,onExit:x})})]},"guided-shell"),l[2]=f,l[3]=I,l[4]=j,l[5]=w,l[6]=p,l[7]=v,l[8]=y,l[9]=_,l[10]=g,l[11]=x,l[12]=P,l[13]=C,l[14]=S,l[15]=o,l[16]=N,l[17]=h,l[18]=i):i=l[18],l[19]!==i?(r=(0,t.jsx)("div",{className:"mx-auto flex w-full max-w-xl flex-col items-center","aria-live":"polite",children:(0,t.jsx)(s.AnimatePresence,{mode:"wait",children:i})}),l[19]=i,l[20]=r):r=l[20],r}var sD=e.i(943594),sU=e.i(167922),sL=e.i(636273),sz=e.i(817422);let sF=sz.z.object({answer:sz.z.string().trim().min(1,"Enter a response to continue.")});function sq(e){let a,i,r,s,l,o,c,d,u,h,f,g,v,y,w=(0,n.c)(40),{question:j,answerText:S,intent:C,disabled:N,onSubmitEditedAnswer:_,onSubmitFeedback:k,onUnknownStyleCustom:I}=e,P=(0,th.useOwnerUserId)();w[0]===Symbol.for("react.memo_cache_sentinel")?(a={...(0,x.postContentUploadMutation)(),onError:sH},w[0]=a):a=w[0];let{mutateAsync:E,isPending:T}=(0,p.useMutation)(a);w[1]!==E||w[2]!==_||w[3]!==P||w[4]!==j?(i=async e=>{let{data:t}=await E({headers:{"x-delphi-knowledge-submission-source":"guided_training_write_answer"},query:P?{ownerUserId:P}:void 0,body:{uploadSource:"TRAIN_MODE",items:[{type:"qa",question:j,answer:e}]}}),n=t.ids[0];n?_(e,n):m.toast.error("Couldn't save this answer.")},w[1]=E,w[2]=_,w[3]=P,w[4]=j,w[5]=i):i=w[5];let A=i;w[6]!==S||w[7]!==C?(r=(0,sg.guidedTrainingDefaultWriteAnswerText)(C,S),w[6]=S,w[7]=C,w[8]=r):r=w[8],w[9]!==r?(s={answer:r},w[9]=r,w[10]=s):s=w[10],w[11]===Symbol.for("react.memo_cache_sentinel")?(l={onChange:sF},w[11]=l):l=w[11],w[12]!==C||w[13]!==k||w[14]!==I||w[15]!==A?(o=async e=>{let{value:t}=e,n=t.answer.trim();"edit-answer"===C?await A(n):"feedback"===C?await k(n):await I(n)},w[12]=C,w[13]=k,w[14]=I,w[15]=A,w[16]=o):o=w[16],w[17]!==s||w[18]!==o?(c={defaultValues:s,validators:l,onSubmit:o},w[17]=s,w[18]=o,w[19]=c):c=w[19];let R=(0,sD.useForm)(c),M="feedback"===C?"Feedback":"Answer",O="feedback"===C?sg.GUIDED_TRAINING_COPY.feedbackPlaceholder:"Write the answer...",D=T||N;return w[20]!==R?(d=e=>{e.preventDefault(),R.handleSubmit()},w[20]=R,w[21]=d):d=w[21],w[22]!==M||w[23]!==D||w[24]!==O?(u=e=>{let n=e.state.meta.isTouched&&!e.state.meta.isValid;return(0,t.jsxs)(sU.Field,{"data-invalid":n,children:[(0,t.jsx)(sU.FieldLabel,{htmlFor:e.name,className:"sr-only",children:M}),(0,t.jsx)(sL.Textarea,{id:e.name,name:e.name,autoFocus:!0,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),placeholder:O,disabled:D,"aria-invalid":n,className:(0,b.cn)("max-h-[17.5rem] min-h-[8.75rem] overflow-y-auto rounded-2xl px-4 py-3.5 text-base leading-7","border-tangerine-9 ring-1 ring-tangerine-9 hover:border-tangerine-9 hover:ring-tangerine-9","focus-visible:border-tangerine-9 focus-visible:ring-[2px] focus-visible:ring-tangerine-9","placeholder:text-fg-mid")}),n?(0,t.jsx)(sU.FieldError,{errors:e.state.meta.errors}):null]})},w[22]=M,w[23]=D,w[24]=O,w[25]=u):u=w[25],w[26]!==R.Field||w[27]!==u?(h=(0,t.jsx)(sU.FieldGroup,{className:"gap-3",children:(0,t.jsx)(R.Field,{name:"answer",children:u})}),w[26]=R.Field,w[27]=u,w[28]=h):h=w[28],w[29]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(eH.Separator,{}),w[29]=f):f=w[29],w[30]!==T||w[31]!==D?(g=e=>{let[n,a]=e,i=T||a,r=n.trim().length>0;return(0,t.jsx)(el.Button,{type:"submit",size:"lg",disabled:!r||D||i,className:"min-w-24",children:i?"Saving...":"Save"})},w[30]=T,w[31]=D,w[32]=g):g=w[32],w[33]!==R.Subscribe||w[34]!==g?(v=(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(R.Subscribe,{selector:sB,children:g})}),w[33]=R.Subscribe,w[34]=g,w[35]=v):v=w[35],w[36]!==h||w[37]!==v||w[38]!==d?(y=(0,t.jsxs)("form",{onSubmit:d,className:"mt-4 flex w-full flex-col gap-4",children:[h,f,v]}),w[36]=h,w[37]=v,w[38]=d,w[39]=y):y=w[39],y}function sB(e){return[e.values.answer,e.isSubmitting]}function sH(e){m.toast.error((0,tp.parseVisibleError)(e)?.message??"Couldn't save this answer.")}function s$(e){let a,i,r,s,l,o,c,d,u,m,h,p,f,g,x,b=(0,n.c)(88),{step:v,stepNavDirection:y,writeIntent:w,committedRatingScore:j,hidden:S,stepTransitioning:C,unknownAnswerOptions:N,completedImprovementOptions:_,question:k,answerText:I,isHighMqs:P,ratingPending:E,disabled:T,canGoBack:A,onBack:R,onDismiss:M,onRate:O,onImprovementOption:D,onSubmitEditedAnswer:U,onSubmitFeedback:L,onOpenAddKnowledge:z,hiddenAddKnowledgeSources:F,onSkipAddKnowledge:q,onContentAddedContinue:B,onKnowledgeBoundaryQuestion:H,onUnknownStyleOption:$,onUnknownStyleWriteCustom:V,onUnknownStyleCustom:G}=e;b[0]!==F?(a=void 0===F?[]:F,b[0]=F,b[1]=a):a=b[1];let Q=a;b[2]!==P||b[3]!==v||b[4]!==w?(i=(0,sg.guidedTrainingShellMeta)(v,w,P),b[2]=P,b[3]=v,b[4]=w,b[5]=i):i=b[5];let K=i;if(b[6]!==_||b[7]!==D){let e,t;b[9]!==_?(e=e=>!_.has(e.id),b[9]=_,b[10]=e):e=b[10],b[11]!==D?(t=e=>({label:e.label,onSelect:()=>D(e.id)}),b[11]=D,b[12]=t):t=b[12],r=sg.GUIDED_TRAINING_IMPROVEMENT_OPTIONS.filter(e).map(t),b[6]=_,b[7]=D,b[8]=r}else r=b[8];let W=r,Y=K.stepKey;return b[13]!==v?(s=(0,sg.guidedTrainingShellVariantForStep)(v),b[13]=v,b[14]=s):s=b[14],b[15]!==v?(l=(0,sg.guidedTrainingShellFitsContent)(v),b[15]=v,b[16]=l):l=b[16],b[17]!==j||b[18]!==T||b[19]!==O||b[20]!==E||b[21]!==v||b[22]!==C?(o="response-rating"===v?(0,t.jsx)(sA,{disabled:T,saveDisabled:E,committingScore:C?
4j:null,onRate:O}):null,b[17]=j,b[18]=T,b[19]=O,b[20]=E,b[21]=v,b[22]=C,b[23]=o):o=b[23],b[24]!==T||b[25]!==W||b[26]!==v?(c="improvement-options"===v?(0,t.jsx)(sE,{disabled:T,options:W}):null,b[24]=T,b[25]=W,b[26]=v,b[27]=c):c=b[27],b[28]!==I||b[29]!==T||b[30]!==U||b[31]!==L||b[32]!==G||b[33]!==k||b[34]!==v||b[35]!==w?(d="write-answer"===v?(0,t.jsx)(sq,{question:k,answerText:I,intent:w,disabled:T,onSubmitEditedAnswer:U,onSubmitFeedback:L,onUnknownStyleCustom:G},w):null,b[28]=I,b[29]=T,b[30]=U,b[31]=L,b[32]=G,b[33]=k,b[34]=v,b[35]=w,b[36]=d):d=b[36],b[37]!==T||b[38]!==Q||b[39]!==z||b[40]!==q||b[41]!==v?(u="add-knowledge"===v?(0,t.jsx)(sk,{disabled:T,hiddenSources:Q,onSelect:z,onSkip:q}):null,b[37]=T,b[38]=Q,b[39]=z,b[40]=q,b[41]=v,b[42]=u):u=b[42],b[43]!==T||b[44]!==B||b[45]!==D||b[46]!==v?(m="source-training-intro"===v?(0,t.jsx)(sE,{disabled:T,options:[{label:sg.GUIDED_TRAINING_SOURCE_INTRO_ACTIONS.addKnowledge,onSelect:()=>D("upload")},{label:sg.GUIDED_TRAINING_SOURCE_INTRO_ACTIONS.showTrainingOptions,onSelect:B}]}):null,b[43]=T,b[44]=B,b[45]=D,b[46]=v,b[47]=m):m=b[47],b[48]!==T||b[49]!==B||b[50]!==D||b[51]!==v?(h="content-added"===v?(0,t.jsx)(sE,{disabled:T,options:[{label:sg.GUIDED_TRAINING_CONTENT_ADDED_ACTIONS.keepGoing,onSelect:B},{label:sg.GUIDED_TRAINING_CONTENT_ADDED_ACTIONS.addMoreContent,onSelect:()=>D("upload")}]}):null,b[48]=T,b[49]=B,b[50]=D,b[51]=v,b[52]=h):h=b[52],b[53]!==T||b[54]!==H||b[55]!==v?(p="knowledge-boundary"===v?(0,t.jsx)(sE,{disabled:T,options:sg.GUIDED_TRAINING_KNOWLEDGE_BOUNDARY_OPTIONS.map(e=>({label:e,onSelect:()=>H(e)}))}):null,b[53]=T,b[54]=H,b[55]=v,b[56]=p):p=b[56],b[57]!==T||b[58]!==$||b[59]!==V||b[60]!==v||b[61]!==N?(f="unknown-answer-style"===v?(0,t.jsx)(sE,{disabled:T,options:N.map(e=>({label:e,onSelect:()=>{e===sg.GUIDED_TRAINING_WRITE_OWN_ANSWER_OPTION?V():$(e)}}))}):null,b[57]=T,b[58]=$,b[59]=V,b[60]=v,b[61]=N,b[62]=f):f=b[62],b[63]!==T||b[64]!==v||b[65]!==y||b[66]!==d||b[67]!==u||b[68]!==m||b[69]!==h||b[70]!==p||b[71]!==f||b[72]!==o||b[73]!==c?(g=(0,t.jsxs)(s_,{step:v,stepNavDirection:y,disabled:T,children:[o,c,d,u,m,h,p,f]}),b[63]=T,b[64]=v,b[65]=y,b[66]=d,b[67]=u,b[68]=m,b[69]=h,b[70]=p,b[71]=f,b[72]=o,b[73]=c,b[74]=g):g=b[74],b[75]!==A||b[76]!==T||b[77]!==S||b[78]!==R||b[79]!==M||b[80]!==K.description||b[81]!==K.stepKey||b[82]!==K.title||b[83]!==C||b[84]!==g||b[85]!==s||b[86]!==l?(x=(0,t.jsx)(sO,{stepKey:Y,shellVariant:s,shellFitsContent:l,title:K.title,description:K.description,canGoBack:A,onBack:R,onDismiss:M,disabled:T,hidden:S,contentBusy:C,children:g}),b[75]=A,b[76]=T,b[77]=S,b[78]=R,b[79]=M,b[80]=K.description,b[81]=K.stepKey,b[82]=K.title,b[83]=C,b[84]=g,b[85]=s,b[86]=l,b[87]=x):x=b[87],x}var sV=e.i(991079);let sG=new Set(["website","podcast-series"]),sQ=new Set(sx.ADD_TO_MIND_ACCOUNT_SOURCES.filter(e=>!sG.has(e.view)).map(e=>e.view));function sK(e){return e.platform}function sW(e){return e.isOpen}function sY(e){return e.pendingSubmissions}function sX(e,t,n={}){return{id:crypto.randomUUID(),role:e,parts:[{type:"text",text:t}],metadata:{createdAt:new Date().toISOString(),...n}}}let sZ={kind:"idle"},sJ={addKnowledge:"source-training-intro",contentAdded:"improvement-options",knowledgeBoundary:"content-added"};function s0(e,t,n,a,i){if(t.transitioningRef.current)return;n.setStepNavDirection(i);let r=t.generationRef.current+1;t.generationRef.current=r,t.transitioningRef.current=!0,n.setStepTransitioning(!0),e(()=>{t.generationRef.current===r&&(n.setStep(a),e(()=>{t.generationRef.current===r&&(t.transitioningRef.current=!1,n.setStepTransitioning(!1))},sg.GUIDED_TRAINING_STEP_UNLOCK_MS))},sg.GUIDED_TRAINING_SELECTION_COMMIT_MS)}function s1(){return null!=globalThis.window}function s2(e,t){if(!s1())return t;try{return e()}catch{return t}}function s3(e,t){let n=(0,nY.parseRecord)(e),a=(0,nY.parseString)(n?.toolCallId);return n?.type==="tool-addQA"&&null!==a&&(void 0===t||a===t)}function s4(e,t){if(0===t.size)return e;let n=e;for(let a=0;a<e.length;a+=1){let i=e[a],r=i.parts;for(let e=0;e<i.parts.length;e+=1){let n=i.parts[e];if(!s3(n))continue;let a=t.get(n.toolCallId);if(!a)continue;let s=function(e,t){var n;return"output-available"===e.state&&(n=e.output,n?.status===t.status&&("dismissed"===t.status||"saved"===n.status&&n.question===t.question&&n.suggestedAnswer===t.suggestedAnswer&&n.uploadId===t.uploadId))?e:{...e,state:"output-available",output:t}}(n,a);s!==n&&(r===i.parts&&(r=[...i.parts]),r[e]=s)}r!==i.parts&&(n===e&&(n=[...e]),n[a]={...i,parts:r})}return n}function s5(e,t){let n=s4(e,t);if(n===e)return{messages:e,patches:[]};let a=[];for(let t=0;t<n.length;t+=1){let i=n[t];i!==e[t]&&a.push({messageId:i.id,parts:i.parts})}return{messages:n,patches:a}}var s6=e.i(318802);function s7(e){return"chat"===e||"content"===e}function s8(e,t){return"profile"===e||"chat"===e||"content"===e&&null!==t}function s9(e,t){let n=(0,tp.parseVisibleError)(e);if(n)return{title:n.message};let a=(0,nY.parseMessage)(e)??void 0;return{title:t,...a?{description:a}:void 0}}function le(e){return s9(e,"Couldn't send message")}function lt(e){return s9(e,"Couldn't upload file")}function ln(e){return globalThis.crypto?.randomUUID?.()??`${e}-${Math.random().toString(36).slice(2)}`}function la(e,t){return{id:t,role:"user",parts:(0,aV.surfaceSendParts)(e),metadata:e.metadata}}function li(e,t){let n=(0,nY.parseRecord)(e),a=(0,nY.parseString)(n?.type);return a?.startsWith("tool-")===!0&&(0,nY.parseString)(n?.toolCallId)===t}function lr(e){return e.setHidden}function ls(e,t){let a,i,r,s=(0,n.c)(7),[l,o]=(0,d.useState)(0),[c,u]=(0,d.useState)(0);return t||0===l&&0===c||(o(0),u(0)),s[0]!==t||s[1]!==e?(a=()=>
4{if(!t)return;let n=e.current;if(!n)return;let a=null,i=-1,r=-1,s=()=>{null===a&&(a=window.requestAnimationFrame(()=>{a=null;let e=Math.ceil(n.getBoundingClientRect().height),t=n.querySelector("[data-surface-suggestions-band]"),s=t?Math.ceil(t.getBoundingClientRect().height):0;(e!==i||s!==r)&&(i=e,r=s,o(e),u(s))}))};s();let l=new ResizeObserver(s);return l.observe(n),()=>{l.disconnect(),null!==a&&window.cancelAnimationFrame(a)}},i=[t,e],s[0]=t,s[1]=e,s[2]=a,s[3]=i):(a=s[2],i=s[3]),(0,d.useLayoutEffect)(a,i),s[4]!==l||s[5]!==c?(r={height:l,suggestionsBandHeight:c},s[4]=l,s[5]=c,s[6]=r):r=s[6],r}function ll(e){let{back:t}=e;return(0,C.useNavBack)(t),null}function lo(e,t,n){if(t&&!(e<=0))return e+n+16}function lc(e){return e.trim()}function ld(){(0,aZ.writeArrivalNetworkOnce)()}function lu(e,t,a){let i,r,s,l,o,c,d,u,h,b,v=(0,n.c)(25),y=(0,g.useQueryClient)(),w=e??"";v[0]!==w?(i=(0,x.getThreadShareOptions)({query:{threadId:w}}),v[0]=w,v[1]=i):i=v[1];let j=t&&!!e;v[2]!==i||v[3]!==j?(r={...i,enabled:j,staleTime:6e4},v[2]=i,v[3]=j,v[4]=r):r=v[4];let{data:S}=(0,f.useQuery)(r);if(v[5]!==S?.data||v[6]!==a){for(let e of(o=new Map,l=new Set,s=new Set,S?.data??[])){if("range"!==e.mode||!e.endMessageId||!e.startMessageId)continue;o.set(e.endMessageId,e.token);let t=a.findIndex(t=>t.id===e.endMessageId),n=t>0?a.slice(0,t).reverse().find(lh):void 0;n&&n.id===e.startMessageId?l.add(e.endMessageId):s.add(e.endMessageId)}v[5]=S?.data,v[6]=a,v[7]=s,v[8]=l,v[9]=o}else s=v[7],l=v[8],o=v[9];v[10]!==s||v[11]!==l||v[12]!==o?(c={tokenByEndId:o,qaSharedMessageIds:l,conversationSharedMessageIds:s},v[10]=s,v[11]=l,v[12]=o,v[13]=c):c=v[13];let{tokenByEndId:C,qaSharedMessageIds:N,conversationSharedMessageIds:_}=c;v[14]===Symbol.for("react.memo_cache_sentinel")?(d=(0,x.deleteThreadShareByTokenMutation)(),v[14]=d):d=v[14],v[15]!==y||v[16]!==e?(u={...d,onSuccess:()=>
4{e&&y.invalidateQueries({queryKey:(0,x.getThreadShareQueryKey)({query:{threadId:e}})}),(0,m.toast)("Share link removed",{duration:1500})},onError:lm},v[15]=y,v[16]=e,v[17]=u):u=v[17];let{mutate:k}=(0,p.useMutation)(u);v[18]!==k||v[19]!==C?(h=e=>{let t=C.get(e);t&&k({path:{token:t}})},v[18]=k,v[19]=C,v[20]=h):h=v[20];let I=h;return v[21]!==_||v[22]!==I||v[23]!==N?(b={qaSharedMessageIds:N,conversationSharedMessageIds:_,handleUnshareMessage:I},v[21]=_,v[22]=I,v[23]=N,v[24]=b):b=v[24],b}function lm(){return m.toast.error("Couldn't remove share link")}function lh(e){return"user"===e.role}function lp(e){let a,i,r,s,l=(0,n.c)(55),{api:o,ownerApi:c,username:u,pageOwnerUserId:m,threadId:h,initialMessages:p,emptyStateDescription:f,showCitations:g,initialPrompt:x,firstOwner:b,initialCall:v,canEdit:y,pageOwnerDisplay:w,pageOwnerImage:j,pageOwnerHeadline:S,suggestionTexts:C,visitorState:N,chatAvatars:_,onboardingCompleted:k,secondaryLimitRedirectUrl:I,secondaryLimitMessage:P,secondaryLimitTitle:E,secondaryLimitDescription:T,secondaryLimitCtaLabel:A,secondaryLimitDiscoverCtaEnabled:R,signinGate:M}=e,O=(0,q.useChatContext)(),{mode:D,goToProfile:U}=ic();if(l[0]!==U||l[1]!==D||l[2]!==k||l[3]!==u?(a=()=>{"chat"!==D||k||U(u)},i=[U,D,k,u],l[0]=U,l[1]=D,l[2]=k,l[3]=u,l[4]=a,l[5]=i):(a=l[4],i=l[5]),(0,d.useEffect)(a,i),"chat"===D&&!k)return null;if("self"===O.kind){let e,n;if(!_)throw Error("ProfileSurfaceChat: owner view requires chatAvatars");let a=f??null,i=x??null;return l[6]!==o||l[7]!==y||l[8]!==_||l[9]!==b||l[10]!==v||l[11]!==p||l[12]!==g||l[13]!==c||l[14]!==w||l[15]!==S||l[16]!==j||l[17]!==m||l[18]!==C||l[19]!==a||l[20]!==i||l[21]!==h||l[22]!==u||l[23]!==N?(e=(0,t.jsx)(lg,{api:o,ownerApi:c,username:u,pageOwnerUserId:m,threadId:h,initialMessages:p,emptyStateDescription:a,showCitations:g,initialPrompt:i,firstOwner:b,initialCall:v,canEdit:y,pageOwnerDisplay:w,pageOwnerImage:j,pageOwnerHeadline:S,suggestionTexts:C,visitorState:N,chatAvatars:_}),l[6]=o,l[7]=y,l[8]=_,l[9]=b,l[10]=v,l[11]=p,l[12]=g,l[13]=c,l[14]=w,l[15]=S,l[16]=j,l[17]=m,l[18]=C,l[19]=a,l[20]=i,l[21]=h,l[22]=u,l[23]=N,l[24]=e):e=l[24],l[25]!==e||l[26]!==u?(n=(0,t.jsx)(st.TTSProvider,{ownerUsername:u,children:e}),l[25]=e,l[26]=u,l[27]=n):n=l[27],n}let L=f??null,z=x??null;return l[28]!==o||l[29]!==y||l[30]!==v||l[31]!==p||l[32]!==g||l[33]!==k||l[34]!==w||l[35]!==S||l[36]!==j||l[37]!==m||l[38]!==A||l[39]!==T||l[40]!==R||l[41]!==P||l[42]!==I||l[43]!==E||l[44]!==M||l[45]!==C||l[46]!==L||l[47]!==z||l[48]!==h||l[49]!==u||l[50]!==N?(r=(0,t.jsx)(lf,{api:o,username:u,pageOwnerUserId:m,threadId:h,initialMessages:p,emptyStateDescription:L,showCitations:g,initialPrompt:z,initialCall:v,canEdit:y,pageOwnerDisplay:w,pageOwnerImage:j,pageOwnerHeadline:S,suggestionTexts:C,visitorState:N,canChat:k,secondaryLimitRedirectUrl:I,secondaryLimitMessage:P,secondaryLimitTitle:E,secondaryLimitDescription:T,secondaryLimitCtaLabel:A,secondaryLimitDiscoverCtaEnabled:R,signinGate:M}),l[28]=o,l[29]=y,l[30]=v,l[31]=p,l[32]=g,l[33]=k,l[34]=w,l[35]=S,l[36]=j,l[37]=m,l[38]=A,l[39]=T,l[40]=R,l[41]=P,l[42]=I,l[43]=E,l[44]=M,l[45]=C,l[46]=L,l[47]=z,l[48]=h,l[49]=u,l[50]=N,l[51]=r):r=l[51],l[52]!==r||l[53]!==u?(s=(0,t.jsx)(st.TTSProvider,{ownerUsername:u,children:r}),l[52]=r,l[53]=u,l[54]=s):s=l[54],s}function lf({api:e,username:l,pageOwnerUserId:o,threadId:u,initialMessages:g,emptyStateDescription:w,showCitations:C,initialPrompt:_,initialCall:U,canEdit:B,pageOwnerDisplay:H,pageOwnerImage:er,pageOwnerHeadline:es,suggestionTexts:el,visitorState:eo,canChat:ec,secondaryLimitRedirectUrl:ed,secondaryLimitMessage:eu,secondaryLimitTitle:em,secondaryLimitDescription:eh,secondaryLimitCtaLabel:ep,secondaryLimitDiscoverCtaEnabled:ef,signinGate:eg}){let ex,eb,ev,ey,ew,ej,eS,eC,eN,e_,ek,[eI]=(0,d.useState)(()=>u??globalThis.crypto?.randomUUID?.()??`thread-${Math.random().toString(36).slice(2)}`),[eP,eT]=(0,d.useState)(()=>eI),{mode:eA,contentItemId:eR,goToChat:eM,goToProfile:eO,goToContent:eD,goToContentItem:eU}=ic(),eL=(0,aH.useContentVideoStore)(e=>e.chatContext),{actions:ez}=(0,I.usePromptInput)(),eF=(0,q.useChatContext)(),{data:eq}=(0,f.useQuery)((0,x.getUsersByUsernameOptions)({path:{username:l}})),eB=eq?.data?.tryAskingEligible??!1,eH=eq?.data?.tryAskingMindsEnabled??!1,e$=n1({chatEnabled:eq?.data?.profile?.settings?.chatEnabled,onboardingCompleted:eq?.data?.onboardingCompleted}),eV="anon"!==eF.kind,eG="anon"===eF.kind,eQ="cover"===eg&&eG,eK=((ej=(0,n.c)(9))[0]!==l?(ex=()=>!!r6.has(l)||!!(0,a.isDiscoverHandoff)((0,a.currentHandoff)(l))&&(r6.add(l),!0),ej[0]=l,ej[1]=ex):ex=ej[1],eS=(0,d.useSyncExternalStore)(r7,ex,r8),ej[2]===Symbol.for("react.memo_cache_sentinel")?(eb={devQueryParam:r5},ej[2]=eb):eb=ej[2],eC=(0,aX.useFlagVariantWithoutExposure)("discover-signin-gate",eb),eN=eQ&&!0===eS,ej[3]!==eN?(ev=()=>{eN&&(0,aX.getFlagVariant)("discover-signin-gate",{devQueryParam:r5})},ey=[eN],ej[3]=eN,ej[4]=ev,ej[5]=ey):(ev=ej[4],ey=ej[5]),(0,d.useEffect)(ev,ey),e_=null!==eS,ek=eN&&"after-second"===eC?2:1,ej[
46]!==e_||ej[7]!==ek?(ew={resolved:e_,coverAfterAnswers:ek},ej[6]=e_,ej[7]=ek,ej[8]=ew):ew=ej[8],ew),eW=`profile:${o}`,eY=`${H}'s Delphi`,eX=(0,M.useImpersonationChatAllowed)(eW),eZ=(0,P.useRouter)(),[eJ,e0]=(0,d.useState)(null),[e1,e2]=(0,d.useState)(!1),[e3,e4]=(0,d.useState)(!1),[e5,e6]=(0,d.useState)(!1),[e7,e8]=(0,d.useState)(null),e9=(0,d.useRef)(null),[te,tt]=(0,d.useState)("control"),tn=(0,aX.useFlagVariant)("visitor-suggested-questions",{devQueryParam:"suggestQuestions"}),ta=(0,rJ.useCustomVisitorPaywall)(l),ti=ed?r0(ed,"voice"):null,tr=ti?{redirectUrl:ti,title:em?.trim()||"You've reached your voice limit",subtitle:eh?.trim()||`You've used your free voice time with ${H}. Continue below to keep talking.`,buttonText:ep?.trim()||`Continue with ${H}`}:null,ts=(0,d.useCallback)(e=>{e||e0(null)},[]),{call:tl,callOverlayOpen:to,callOriginPath:tc,accessRevoked:td}=iE({username:l,ownerUserId:o,initialCall:U&&e$,onQuotaBlocked:(0,d.useCallback)(()=>{eG?e0("call"):e2(!0)},[eG])}),tu=(0,eE.resolveCallUnderlayMode)(eA,{overlayOpen:to,originPath:tc}),{hideCall:tm,callGrayscale:th,callBusy:tf,onCall:tg}=r4({username:l,isOwner:!1,startCall:tl.startCall,accessRevoked:td,status:tl.status}),[tx,tb]=(0,d.useState)(!1);!function(e){let t,a,i=(0,n.c)(6),{mode:r,isPageOwner:s,callActive:l}=e,o=(0,O.useMyMindPillHiddenStore)(lr);i[0]!==l||i[1]!==s||i[2]!==r||i[3]!==o?(t=()=>(o(l||s7(r)||!s),()=>o(!1)),a=[r,s,l,o],i[0]=l,i[1]=s,i[2]=r,i[3]=o,i[4]=t,i[5]=a):(t=i[4],a=i[5]),(0,d.useLayoutEffect)(t,a)}({mode:eA,isPageOwner:!1,callActive:to});let tv=(0,d.useCallback)(e=>{let{title:t,description:n}=lt(e);m.toast.error(t,n?{description:n}:void 0)},[]),[ty,tw]=(0,d.useState)(()=>g),[tj,tS]=(0,d.useState)(()=>w??null),[tC,tN]=(0,d.useState)(C??!0),[t_,tk]=(0,d.useState)(eG),tI=(0,d.useRef)(null),tP=(0,d.useRef)(!1),tE=(0,d.useRef)(eG?null:eP),tT=(0,d.useRef)(eP),tA=(0,d.useRef)(null),tM=(0,d.useRef)(null),tO=(0,d.useRef)(!1),tD=(0,P.usePathname)(),{mutateAsync:tU}=(0,p.useMutation)((0,x.postChatBootstrapMutation)({baseUrl:e.endsWith("/chat")?e.slice(0,-5):e})),tL=(0,d.useCallback)(e=>{tE.current=e,tT.current=e,eT(e)},[]);(0,d.useEffect)(()=>{tT.current=eP},[eP]);let tz=(0,d.useMemo)(()=>new r.DefaultChatTransport({api:e,credentials:"include",prepareSendMessagesRequest:({messages:e,id:t,headers:n})=>{let i=tT.current??t;return{headers:(0,ig.appendChatRequestHeaders)(n,"public"),body:{id:i,message:e[e.length-1],messages:(0,ip.chatRequestHistory)(e),ownerUsername:l,attribution:(0,a.currentHandoff)(l),channel:"web"}}}}),[e,l]),tF=(0,d.useRef)(null),{begin:tq,setUserMessageId:tB,rendered:tH,finish:t$}=(0,ea.useChatResponseTelemetry)({ownerUserId:o,threadId:eP,surface:"delphi_app",isOwner:!1}),tV=(0,d.useRef)(null),[tG]=(0,d.useState)(a0.createDeferredCapture),[tQ]=(0,d.useState)(a0.createAnsweredTurnCapture),tK=(0,d.useCallback)((e,t)=>{ez.setInput(e),(0,s6.rearmPendingChatContent)(t,e),tV.current?.restoreAttachments()},[ez]),tW=(0,d.useCallback)(()=>{tV.current?.releaseAttachments()},[]),tY=(0,d.useCallback)(()=>{tV.current?.commitPendingQuestionSubmit(),tG.commit()},[tG]),tX=(0,d.useCallback)(()=>{tV.current?.discardPendingQuestionSubmit(),tG.discard()},[tG]),{assistantPendingEligible:tZ,bouncingClientMessageId:tJ,standingBlock:t0,recordSent:t1,accept:t2,block:t3,rollbackPendingError:t4,consumeSuppressedFinish:t5,clear:t6}=(0,et.useChatOutcome)({setMessages:tF,onRestore:tK,onRelease:tW,onAccept:tY,onDiscard:tX}),t7=(0,d.useCallback)(e=>{if(tb(!1),t4(),e instanceof Error&&e.message===n2||(0,tp.parseVisibleError)(e)?.message===n2)return;if((0,tp.parseVisibleError)(e)?.code==="quota_exceeded"){if(eG){e8(e9.current),e0("message");return}if(ed)return void e4(!0);if(ta)return void e6(!0)}let{title:t,description:n}=le(e);m.toast.error(t,n?{description:n}:void 0)},[eG,ta,t4,ed]),t8=(0,d.useCallback)(e=>{let t=(0,en.parseChatOutcomeSignal)(e);if(t?.type==="blocked")tb(!1),t3(t.block);else if(t?.type==="accepted"&&t2(),"data-typing"===e.type)tb(e.data.isTyping);else if("data-user-message-id"===e.type){let t=e.data.id;tB(t),tF.current?.(e=>(0,G.applyServerUserMessageId)(e,t))}},[t2,t3,tB]),t9=(0,d.useRef)(null),{handleStop:ne,onChatFinish:nt}=(0,ee.useChatCancel)({chatRef:t9,analytics:{owner_user_id:o,thread_id:eP,surface:"delphi_app",is_owner:!1}}),nn=(0,d.useCallback)(({message:e,messages:t,isAbort:n,isDisconnect:a,isError:i})=>{(tb(!1),t5())?tQ.discard():(tQ.settle((0,ei.answeredTurn)({messages:t,assistant:e,completed:!n&&!a&&!i})),t$({messages:t,assistantMessageId:e.id,isAbort:n,isDisconnect:a,isError:i}),nt(t,n,e=>tF.current?.(e)))},[tQ,t5,t$,nt]),{messages:na,sendMessage:ni,setMessages:nr,status:ns,stop:nl}=(0,i.useChat)({id:eI,messages:ty,transport:tz,onData:t8,onFinish:nn,onError:t7});(0,d.useEffect)(()=>{tF.current=nr},[nr]),(0,d.useEffect)(()=>{t9.current={stop:nl,status:ns}},[ns,nl]),(0,d.useEffect)(()=>{tH(na)},[na,tH]);let no=e3||e1,nc=(0,d.useRef)(!1);(0,d.useEffect)(()=>
4{if(no&&!nc.current){if(nc.current=!0,!1===ef)return void tt("control");tt((0,aX.getFlagVariant)("secondary-usage-lock-ui",{devQueryParam:"lockUi"}))}},[no,ef]);let nd=(0,d.useCallback)(e=>{(0,tR.track)("visitor:usage_limit_cta_click",{owner_user_id:o,surface:"delphi_app",cta_trigger:"signed_in_limit"}),ed&&((0,h.postPlatformRedirectClick)({body:{ownerUserId:o,medium:e}}).catch(()=>{}),(0,i_.openVisitorPaywallRedirect)(r0(ed,"voice"===e?"voice":"chat")))},[o,ed]),nu=(0,d.useCallback)(()=>nd("text"),[nd]),nm=(0,d.useCallback)(()=>nd("voice"),[nd]),nh=(0,d.useCallback)(()=>{(0,tR.track)("visitor:usage_limit_discover_click",{owner_user_id:o}),eZ.push("/discover")},[o,eZ]),np=(0,d.useRef)({bootstrapChat:tU,pathname:tD,threadId:u,username:l});(0,d.useEffect)(()=>{np.current={bootstrapChat:tU,pathname:tD,threadId:u,username:l}});let nf=(0,d.useCallback)(async()=>{if(!eG)return eP;if(tE.current)return tE.current;if(tI.current)return tI.current;let e=(async()=>{let{bootstrapChat:e,pathname:t,threadId:n,username:a}=np.current;tk(!0);try{let i=(await e({headers:(0,ig.appendChatRequestHeaders)(void 0,"public"),query:{ownerUsername:a,mode:"latest",channel:"web",...n?{threadId:n}:void 0}})).data,r=i.initialMessages||void 0;return tw(r),tF.current?.(e=>(0,J.preserveLiveSearchOpener)(e,r)),tS(i.emptyStateDescription??null),tN(i.showCitations),i.threadId&&(tE.current=i.threadId,tT.current=i.threadId,eT(i.threadId),n&&i.threadId!==n&&t===`/${a}/chat/${n}`&&(0,eE.shallowReplace)(`/${a}/chat/${i.threadId}`)),i.threadId}finally{tk(!1),tI.current=null}})();return tI.current=e,e},[eP,eG]);!e$&&t_&&tk(!1),(0,d.useEffect)(()=>{!e$||ec&&eG&&!tP.current&&(tP.current=!0,nf().catch(t7))},[nf,ec,eG,t7,e$]);let[ng,nx]=(0,d.useState)("chat"===eA);"chat"!==eA||ng||nx(!0);let nb=(0,J.hasSpokenUserMessage)(na);(0,X.useAdoptSearchHandoff)(l);let{typing:nv,openerShown:ny,arrival:nw,abandonArrivalAnswer:nj}=(0,Z.useChatOpener)({username:l,threadKey:u??null,enabled:ec&&e$&&eX&&ng,messages:na,setMessages:nr,status:ns}),nS=(0,d.useCallback)((e,t)=>{let n=(0,Q.takePendingSearchContext)(l),i=n&&!ny?{...n,opener:null}:n,r=()=>{let t="parts"in e&&e.parts&&0!==e.parts.length?e.parts:null;t&&(0,K.storePendingUserMessage)(l,t,void 0,Date.now(),ie(e)??void 0),i&&(0,Q.storePendingSearchContext)(l,i)};if(!e$||!ec||!eX)return r(),!1;tq();let s=(0,s6.consumePendingChatContent)((0,aV.surfaceSendText)(e))??(eR?eL:null),c=la(e,ln("message")),d=s?{...c,parts:(0,s6.withContentRef)(c.parts,s)}:c;if(t1(d.id,d.parts),"composer"!==t.kind){let n=(0,nK.questionSubmitListFields)(t,(0,aV.surfaceSendParts)(e)),i=(0,a.currentHandoff)(l),r="search_arrival"===n.questionSource,s=()=>{(0,tR.track)("visitor:question_submit",(0,nK.visitorQuestionSubmitProperties)({ownerUserId:o,threadId:tT.current,isOwner:!1,surface:"delphi_app",visitorState:eo,questionSource:n.questionSource,questionPosition:n.questionPosition,highlightId:n.highlightId,chapterId:n.chapterId,handoff:i,referrer:r?null:(0,aJ.takeChatReferrer)(l)}))};r?tQ.stage(d.id,s):tG.stage(s)}return eG&&(e9.current=d.parts.length>0?d.parts:null),(async function(){if(eG&&!await nf())throw Error("Could not start anonymous chat");let e=i?(0,Q.withSearchContext)(d.parts,i):d.parts;ni({...d,parts:e})})().catch(t=>{r(),s&&(0,s6.setPendingChatContent)(s,(0,aV.surfaceSendText)(e)),t7(t)}),!0},[tQ,tq,nf,tG,eR,eL,ec,eX,eG,t7,ny,o,t1,ni,l,e$,eo]),nC=(0,d.useCallback)(e=>{nS(e,{kind:"composer"})},[nS]),nN=(0,d.useCallback)(e=>{nS(e,{kind:"initial_prompt",chapterQuestion:ie(e)})},[nS]),n_=(0,d.useCallback)(e=>{nS(e,{kind:"signin_continuation"})},[nS]),nk=(0,d.useCallback)((e,t)=>{nS({text:e},{kind:"profile_question",...t})||ez.setInput(e)},[nS,ez]),nI=(0,d.useCallback)(e=>{let t=e.trim();e$&&t?(ez.setInput(t),eX&&(tO.current=!0),eM(l,eP)):(0,s6.clearPendingChatContent)()},[eP,eX,eM,ez,l,e$]),nP=(0,d.useCallback)(()=>{!e$||eX&&(nl(),t6(),(async()=>{try{let e=(await tU({headers:(0,ig.appendChatRequestHeaders)(void 0,"public"),query:{ownerUsername:l,mode:"new",channel:"web"}})).data,t=e.threadId;if(!t)throw Error("No chat thread returned");let n=e.initialMessages||void 0;tw(n),nr(n??[]),tS(e.emptyStateDescription??null),tN(e.showCitations),tA.current=null,tM.current=null,tL(t),eM(l)}catch(e){t7(e)}})())},[tL,tU,eX,t6,eM,t7,nr,nl,l,e$]);(0,d.useEffect)(()=>{"chat"===eA&&tO.current&&(tO.current=!1,document.querySelector("[data-surface-prompt-form]")?.requestSubmit())},[eA]);let nE=(0,J.hasNonOpenerAssistant)(na);(0,d.useEffect)(()=>{nE&&tD===`/${l}/chat`&&(0,eE.shallowReplace)(`/${l}/chat/${eP}`)},[eP,nE,l,tD]);let nT=(0,d.useCallback)(e=>{let t=(0,aV.surfaceSendText)(e);t&&ez.setInput(t)},[ez]),nA=!(eX&&eG&&t_),nR=nA?_:null,nM=eX&&nA&&"chat"===eA;ia(l,eX?n_:nT,nM),it(l,nR,eX?nN:nT,nM);
4let nO=null!==nw&&nM&&ec&&e$&&"ready"===ns,nD=nw?.id??null,nU=null!==nD&&na.some(e=>e.id===nD);(0,d.useEffect)(()=>{if(!nO||null===nD||tA.current===nD)return;let e=(0,Q.takePendingSearchContext)(l);if(!e)return;tA.current=nD,tq();let t=(0,a.currentHandoff)(l);tQ.stage(nD,()=>{(0,tR.track)("visitor:question_submit",(0,nK.visitorQuestionSubmitProperties)({ownerUserId:o,threadId:tT.current,isOwner:!1,surface:"delphi_app",visitorState:eo,questionSource:"search_arrival",questionPosition:null,highlightId:null,chapterId:null,handoff:t,referrer:null}))});let n=[{type:"data-searchContext",data:e}];eG&&(e9.current=n);let i={role:"user",parts:n,metadata:{messageKind:J.SEARCH_ARRIVAL_MESSAGE_KIND,createdAt:new Date().toISOString()}},r=(0,J.messagesAfterArrival)(na,nD);tM.current=r.length>0?{arrivalId:nD,following:r}:null;let s=nU?ni({...i,messageId:nD}).catch(()=>ni({...i,id:nD})):ni({...i,id:nD});r.length>0&&nr(e=>(0,J.restoreMessagesAfterArrival)(e,nD,r)),s.catch(t=>{tQ.discard(),(0,Q.storePendingSearchContext)(l,e),nj(),t7(t)})},[nj,tQ,tq,eG,t7,na,o,nD,nU,nO,ni,nr,l,eo]),(0,d.useEffect)(()=>{let e=tM.current;e&&e.arrivalId===nD&&(0,J.restoreMessagesAfterArrival)(na,e.arrivalId,e.following)!==na&&nr(t=>(0,J.restoreMessagesAfterArrival)(t,e.arrivalId,e.following))},[na,nD,nr]);let nL=na.at(-1),nz=(0,d.useMemo)(()=>(0,aG.resolveLatestFollowups)(tn,na),[tn,na]),nF="streaming"===ns&&nL?.role==="assistant",nq="submitted"===ns||"streaming"===ns,nB=(nv||nq)&&!nb?[]:nz.length>0?nz:el,nH=eQ&&(0,J.answeredSpokenMessages)(na)>=eK.coverAfterAnswers&&!nq,n$=sa({messages:na,isStreaming:nF,isAutoPlayEnabled:"chat"===eA}),nV=(0,d.useCallback)(()=>{eO(l)},[eO,l]),nG="content"===eA?eR:null,nQ="chat"===eA,nW=(0,a$.useContentAudioPillPlayer)(nQ,nG,e=>eU(l,e)),nY=(0,aA.useContentBylineStore)(e=>e.inView),nX=to||"chat"!==eA&&("content"!==eA||null==nW&&nY)?null:(0,t.jsx)(D.ChatHeaderMindPill,{userId:o,name:H,image:er,onClick:nV,player:nW??void 0,entrance:"content"===eA?"drop":"morph",trailingAction:"chat"===eA&&n$.isAvailable?(0,t.jsx)(so,{isEnabled:n$.isEnabled,isPlaying:n$.isPlaying,isLoading:n$.isLoading,onToggle:n$.toggleEnabled,showDivider:!1}):null},"chat-header-mind-pill"),nZ=(0,d.useMemo)(()=>eG&&(to||"profile"===eA||"chat"===eA)?(0,t.jsx)(j.NavAuthButtons,{signupHref:`/onboarding?source=${encodeURIComponent(l)}`,hideSignupOnMobile:!0,source:"profile_nav",mind:{name:H,avatarUrl:er}}):to?null:"chat"===eA&&eV&&eX&&e$?(0,t.jsx)($.NewChatButton,{onClick:nP}):null,[eA,eV,eX,l,to,eG,nP,e$,H,er]),nJ=(0,Y.useSearchReturnBack)(l),[n0,n3]=(0,d.useState)("profile"===eA);"profile"!==eA||n0||n3(!0);let n4=(0,d.useMemo)(()=>({href:(0,io.profilePath)(l),label:"Back to profile",onClick:()=>eO(l)}),[l,eO]),n5=(0,d.useMemo)(()=>(0,W.chatBack)({profileSeen:n0,toResults:nJ,toProfile:n4}),[n0,nJ,n4]),n6=(0,d.useMemo)(()=>"chat"!==eA||to?s7(eA)&&!to?n4:nJ:n5,[eA,to,n5,n4,nJ]);(0,k.useNavRightSlot)(nZ),(0,N.useNavHidden)(s7(eA));let{isScrolled:n7}=(0,is.useProfileScrollDirection)({enabled:"profile"===eA,onScrolledChange:S.setMobileBarHidden});(0,d.useEffect)(()=>("profile"!==eA&&(0,S.setMobileBarHidden)(!1),()=>(0,S.setMobileBarHidden)(!1)),[eA]);let n9=(0,S.useMobileBarHiddenValue)(),ae=n8(),at=(0,c.useReducedMotion)(),{placement:an}=(0,F.useProfileIdentityPlacement)({enabled:"profile"===eA&&!ae&&!to}),aa=(0,d.useCallback)(()=>{document.querySelector(z.PROFILE_SCROLL_VIEWPORT_SELECTOR)?.scrollTo({top:0,behavior:at?"auto":"smooth"})},[at]),ai="anon"!==eF.kind,ar=(0,d.useRef)(null),as=ls(ar,"chat"===eA&&!to),al=lo(as.height,"chat"===eA&&!to,8),ao=lo(as.height-as.suggestionsBandHeight,"chat"===eA&&!to,8),[ac,ad]=(0,d.useState)(!1),[au,am]=(0,d.useState)(null),ah=(0,d.useCallback)(e=>{let t=na[0],n=e?na.find(t=>t.id===e):na[na.length-1];am(t&&n&&t.id!==n.id?{startMessageId:t.id,endMessageId:n.id}:null),ad(!0)},[na]),ap="anon"!==eF.kind,{qaSharedMessageIds:af,conversationSharedMessageIds:ag,handleUnshareMessage:ax}=lu(eP,ap,na),[ab,av]=(0,d.useState)(null),ay=(0,d.useCallback)(e=>{let t=na.findIndex(t=>t.id===e);if(-1===t)return;let n=na[t],a=na.slice(0,t).reverse().find(e=>"user"===e.role);a&&av({questionText:a.parts.filter(e=>"text"===e.type).map(e=>e.text).join("\n").trim()||null,startMessageId:a.id,endMessageId:n.id})},[na]),[aw,aj]=(0,d.useState)(!0),aS=(0,aH.useContentVideoStore)(e=>e.askSuggestions),aC=null!==eR&&aS.length>0,aN=aC?aS:el,{mutateAsync:a_}=(0,p.useMutation)({...(0,x.postUsersMeQuestionsGenerateMutation)()}),ak=(0,d.useCallback)(async()=>(await a_({query:{ownerUsername:l}})).data.questions,[a_,l]);ir({mode:eA,username:l,threadId:eP,goToChat:eM,leaveChat:(0,d.useCallback)(()=>n5.onClick?.(),[n5]),isStreaming:nF,onStopStream:ne,onToggleTTS:n$.isAvailable?n$.toggleEnabled:void 0,canChat:ec&&e$});let aI=(0,t.jsx)(aV.SurfaceInput,{readUrlApi:e,username:l,threadId:eP,attachmentThreadI
4d:eP,attachmentMode:"visitor",onAttachmentThreadId:tL,onAttachmentError:tv,attachmentsDisabledReason:eG?R.SIGN_IN_TO_UPLOAD_MESSAGE:void 0,mode:eA,profileDisplayName:H,placeholder:eR?`Ask ${H} about this ${(0,aB.contentNoun)(eL?.type??"")}â¦`:void 0,suggestionTexts:aC?aS:nB,profileSuggestions:aN,visitorSuggestedQuestionsVariant:tn,canGenerateSuggestions:!eG,onGenerateSuggestions:eG?void 0:ak,chatStatus:ns,onStop:ne,onCall:tg,hideCall:tm,callGrayscale:th,callDisabled:nH,callBusy:tf,disabled:t_||"message"===eJ||e3||nH,locked:e3,goToChat:eM,sendMessage:nC,blockedTurn:{standing:t0,composerRef:tV},showMobileCompactBar:!1,showTosNotice:"anon"===eF.kind&&!na.some(e=>"user"===e.role),isAtBottom:aw,questionAnalytics:{ownerUserId:o,isOwner:!1,visitorState:eo,surface:"delphi_app"}}),aR="chat"===eA&&eP?(0,io.chatThreadPath)(l,eP):`/${l}`,aO=nH?(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full flex-col gap-2",children:[(0,t.jsx)(rX,{ownerDisplayName:H,ownerAvatarUrl:er,ownerUserId:o,visitorState:eo,callbackPath:aR}),aI]}):e3?(0,t.jsx)("div",{className:"pointer-events-auto",children:(0,t.jsx)(aY,{ownerDisplayName:H,ownerImageUrl:er,redirectUrl:ed,variant:te,title:em,description:eh,ctaLabel:ep,onContinue:nu,onDiscover:nh})}):aI,aD=e3?(0,t.jsx)(aW,{message:eu,redirectUrl:ed}):null;return(0,t.jsxs)(ib.CitationsDrawerProvider,{children:[to?null:(0,t.jsx)(ll,{back:n6}),(0,t.jsx)(s.AnimatePresence,{initial:!1,children:nX}),"profile"===eA?(0,t.jsx)(s.AnimatePresence,{initial:!1,children:"compact"===an?(0,t.jsx)(L.ProfileScrollHeader,{userId:o,name:H,image:er,onReturn:aa,morph:!1},"profile-scroll-header"):null}):null,(0,t.jsxs)("div",{className:(0,b.cn)("relative flex flex-col pt-[var(--nav-banner-h,0px)]",E.VISIBLE_VIEWPORT_HEIGHT_CLASS),children:[(0,t.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:to,children:(0,t.jsx)(a6,{mode:tu,profile:(0,t.jsx)(aP,{username:l,threadId:eP,canEdit:B,visitorState:eo,goToChat:eM,goToProfile:eO,goToContent:eD,goToContentItem:eU,surfaceMode:tu,questionsOverride:nz.length>0?nz:void 0,onSendProfileQuestion:nk}),chat:(0,t.jsx)(V.ChatPaneWithCitations,{messages:na,isTyping:nv||tZ&&tx,responseInProgress:tZ&&nq,bouncingClientMessageId:tJ,pageOwnerDisplay:H,emptyStateDescription:tj,api:e,showCitations:tC,tryAskingEligible:eB,tryAskingMindsEnabled:eH,onShareConversation:ap?ah:void 0,onShareMessage:ap?ay:void 0,onUnshareMessage:ap?ax:void 0,onUnshareConversation:ap?ax:void 0,sharedMessageIds:af,conversationSharedMessageIds:ag,bottomInset:al,scrollButtonInset:ao,onScrollStateChange:aj,footerSlot:aD}),content:eR?(0,t.jsx)(aT.ProfileContentItemPane,{username:l,contentId:eR,analytics:{isOwner:!1,visitorState:eo,threadId:eP},onAsk:nI,goToProfile:eO,goToContent:eD,goToContentItem:eU}):(0,t.jsx)(aE.ProfileContentPane,{username:l,goToProfile:eO,goToContentItem:eU,onAsk:nI})})}),(0,t.jsx)(aM,{inChat:nQ,pageContentId:nG}),(0,t.jsx)(s.AnimatePresence,{children:to?(0,t.jsx)(rQ,{call:tl,displayName:H,imageUrl:er,ownerUsername:l,api:e,originPath:tc,canShare:!eG,voiceSettingsHref:B?`/@/${l}/settings/voice`:null,paywallOverride:tr,onSecondaryUpgrade:tr?nm:void 0,onChat:()=>eM(l,eP)},"call-overlay"):null})]}),!to&&!ae&&ec&&e$&&s8(eA,eR)?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:(0,b.cn)("pointer-events-none absolute inset-x-0 bottom-0 z-30","profile"===eA&&["transition-[padding-bottom] duration-250 ease-[cubic-bezier(0.23,1,0.32,1)]",ai?n9?"pb-0":"pb-20":"pb-[max(0.75rem,env(safe-area-inset-bottom))]","lg:pb-0"]),children:[(0,t.jsxs)(y.PageContainer,{className:(0,b.cn)("relative flex flex-col bg-transparent pb-4","profile"===eA?`${T.PROFILE_COMPOSER_MAX_WIDTH_CLASS} px-4 md:px-0`:"max-w-[47rem] px-4 md:px-0","profile"===eA&&"max-sm:hidden"),children:[eR?(0,t.jsx)("span",{"aria-hidden":!0,className:(0,b.cn)("absolute inset-x-0 -top-12 bottom-0 -z-10 bg-gradient-to-t",v.gradient.primary)}):null,(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)("div",{ref:ar,"data-content-composer":!0,children:(0,t.jsx)(M.ImpersonationChatGate,{targetKey:eW,targetLabel:eY,children:aO})})})]}),"profile"===eA?(0,t.jsx)("div",{className:"pointer-events-none flex justify-center px-4 pb-[max(0.5rem,env(safe-area-inset-bottom))] sm:hidden",children:(0,t.jsx)("div",{className:"pointer-events-auto",children:(0,t.jsx)(aV.ProfileCompactBar,{hideCall:tm,callGrayscale:th,callBusy:tf,chatDisabled:t_,isScrolled:n7,onCall:tg,onChat:()=>eM(l,eP)})})}):null]})}):null,"chat"!==eA||to?null:(0,t.jsx)(ix.CitationsDrawer,{})]}),(0,t.jsx)(se,{open:ac,onOpenChange:ad,threadId:ac?eP:null,ownerUsername:l,ownerName:H,ownerImageUrl:er,ownerHeadline:es,kind:"conversation",startMessageId:au?.startMessageId,endMessageId:au?.endMessageId}),ab?(0,t.jsx)(se,{open:!!ab,onOpenChange:e=>{e||av(null)},threadId:eP,ownerUsername:l,ownerName:H,ownerImageUrl:er,ownerHeadline:es,kind:"qa",questionText:ab.questionText,startMessageId:ab.startMessageId,endMessageId:ab.endMessageId}):null,(0,t.jsx)(iS,{open:"call"===eJ,onOpenChange:ts,username:l,displayName:H,imageUrl:er}),(0,t.jsx)(ik,{open:e1,onOpenChange:e2,displayName:H,ownerImageUrl:er,onContinueInChat:()=>eM(l,eP),paywall:tr??ta,variant:tr?te:"control",onUpgrade:tr?nm:void 0,onDiscover:nh}),(0,t.jsx)(rZ.VisitorQuotaLimitDialog,{open:e5,onOpenChange:e6,ownerDisplayName:H,ownerImageUrl:er,paywall:ta}),(0,t.jsx)(rY.MessageAuthGateOverlay,{open:"message"===eJ,username:l,displayName:H,avatarUrl:er,threadId:eP,pendingParts:e7}),eG&&"profile"===eA&&!to&&"cover"===eg&&eK.resolved&&1===eK.coverAfterAnswers?(0,t.jsx)(A.AutoSignInPrompt,{callbackPath:`/${l}`,mind:{name:H,avatarUrl:er}}):null]})}function lg({api:e,ownerApi:l,username:o,pageOwnerUserId:c,threadId:h,initialMessages:g,emptyStateDescription:j,showCitations:C,initialPrompt:A,firstOwner:R,initialCall:U,canEdit:L,pageOwnerDisplay:z,pageOwnerImage:F,pageOwnerHeadline:q,suggestionTexts:Q,visitorState:K,chatAvatars:W}){let[X,Z]=(0,d.useState)("train"),{data:J}=(0,f.useQuery)((0,x.getUsersByUsernameOptions)({path:{username:o}})),ei=J?.data?.tryAskingEligible??!1,er=J?.data?.tryAskingMindsEnabled??!1,[es,el]=(0,d.useState)(()=>h??ln("thread")),[eo,ec]=(0,d.useState)(()=>ln("thread")),[ed,eu]=(0,d.useState)(!1),[em,eh]=(0,d.useState)(!1),ep=(0,aX.useFlagVariantWithoutExposure)("visitor-suggested-questions",{devQueryParam:"suggestQuestions"}),ef="train"===X?"control":ep,[eg,ex]=(0,d.useState)(()=>new Map),eb=(0,d.useRef)(new Map),ev=(0,d.useRef)(new Set),ey=(0,d.useRef)([]),ew=(0,d.useRef)(null),ej=(0,d.useRef)(null),eS=(0,d.useRef)(null),eC=(0,d.useRef)(null),{begin:eN,setUserMessageId:e_,rendered:ek,finish:eI}=(0,ea.useChatResponseTelemetry)({ownerUserId:c,threadId:es,surface:"delphi_app",isOwner:!0}),{begin:eP,setUserMessageId:eT,rendered:eA,finish:eR}=(0,ea.useChatResponseTelemetry)({ownerUserId:c,threadId:eo,surface:"delphi_app",isOwner:!0}),{handleStop:eM,onChatFinish:eO}=(0,ee.useChatCancel)({chatRef:eC,analytics:{owner_user_id:c,thread_id:"train"===X?es:eo,surface:"delphi_app",is_owner:!0}}),eD=(0,d.useCallback)(e=>{eb.current=e,ex(e)},[]),eU=(0,d.useRef)(null),eL=(0,d.useRef)(!1),{mode:ez,contentItemId:eF,goToChat:eq,goToProfile:eB,goToContent:eH,goToContentItem:e$}=ic(),eV=(0,aH.useContentVideoStore)(e=>e.chatContext),{actions:eG}=(0,I.usePromptInput)(),eQ=(0,d.useRef)(null),eK=(0,d.useCallback)((e,t)=>{eG.setInput(e),(0,s6.rearmPendingChatContent)(t,e),eQ.current?.restoreAttachments()},[eG]),eW=(0,d.useCallback)(()=>{eQ.current?.releaseAttachments()},[]),[eY]=(0,d.useState)(a0.createDeferredCapture),eX=(0,d.useCallback)(()=>{eQ.current?.commitPendingQuestionSubmit(),eY.commit()},[eY]),eZ=(0,d.useCallback)(()=>{eQ.current?.discardPendingQuestionSubmit(),eY.discard()},[eY]),{assistantPendingEligible:eJ,bouncingClientMessageId:e0,standingBlock:e1,recordSent:e2,accept:e3,block:e4,rollbackPendingError:e5,consumeSuppressedFinish:e6,clear:e7}=(0,et.useChatOutcome)({setMessages:ej,onRestore:eK,onRelease:eW,onAccept:eX,onDiscard:eZ}),e8=`profile:${c}`,e9=`${z}
4's Delphi`,te=(0,M.useImpersonationChatAllowed)(e8),tt=function(){let e,t,a=(0,n.c)(2),[i,r]=(0,d.useState)(null);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=window.matchMedia("(min-width: 1024px)"),t=()=>r(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},t=[],a[0]=e,a[1]=t):(e=a[0],t=a[1]),(0,d.useEffect)(e,t),i}(),tn=function(e){let t,a,i,r,s,l,o=(0,n.c)(13);if(o[0]!==e){let n;n=`guided-training-in-flight:${e}`,t={read:()=>s2(()=>"1"===window.sessionStorage.getItem(n),!1),mark:()=>s2(()=>{window.sessionStorage.setItem(n,"1")},void 0),clear:()=>s2(()=>{window.sessionStorage.removeItem(n)},void 0)},o[0]=e,o[1]=t}else t=o[1];let c=t,[u,m]=(0,d.useState)(!1);o[2]!==c?(a=()=>{!function({isReload:e,hasRestoreParams:t,marker:n}){e||t||n.read()&&n.clear()}({isReload:function(){if(!s1())return!1;try{let e=window.performance.getEntriesByType("navigation")[0];return e?.type==="reload"}catch{return!1}}(),hasRestoreParams:!!s1()&&new URLSearchParams(window.location.search).has("add-to-mind"),marker:c}),m(c.read())},i=[c],o[2]=c,o[3]=a,o[4]=i):(a=o[3],i=o[4]),(0,d.useLayoutEffect)(a,i),o[5]!==c?(r=()=>{c.mark(),m(!0)},o[5]=c,o[6]=r):r=o[6];let h=r;o[7]!==c?(s=()=>{c.clear(),m(!1)},o[7]=c,o[8]=s):s=o[8];let p=s;return o[9]!==p||o[10]!==u||o[11]!==h?(l={inFlight:u,mark:h,clear:p},o[9]=p,o[10]=u,o[11]=h,o[12]=l):l=o[12],l}(o),ta=(tn.inFlight,!1),{data:ti}=(0,f.useQuery)({...(0,x.getMindByUserByUserIdScoreOptions)({path:{userId:c}}),enabled:ta,staleTime:3e5}),tr=ti?.data.score??null,[ts,tl]=(0,d.useState)(!1),{call:to,callOverlayOpen:tc,callOriginPath:td}=iE({username:o,ownerUserId:c,initialCall:U,onQuotaBlocked:(0,d.useCallback)(()=>{tl(!0)},[])}),tu=(0,eE.resolveCallUnderlayMode)(ez,{overlayOpen:tc,originPath:td}),{hideCall:tm,callGrayscale:th,callBusy:tf,onCall:tg,trainDialogOpen:tx,setTrainDialogOpen:tb,onTrainSuccess:tv}=r4({username:o,isOwner:!0,startCall:to.startCall,status:to.status}),ty=(0,d.useCallback)(e=>{eu(!1),eU.current?.(),eU.current=null;let{title:t,description:n}=le(e);m.toast.error(t,n?{description:n}:void 0)},[]),tw=(0,d.useCallback)(e=>{eh(!1),e5();let{title:t,description:n}=le(e);m.toast.error(t,n?{description:n}:void 0)},[e5]),tj=(0,d.useCallback)(e=>{let{title:t,description:n}=lt(e);m.toast.error(t,n?{description:n}:void 0)},[]),{mutateAsync:tS}=(0,p.useMutation)({...(0,x.postUsersMeQuestionsGenerateMutation)()}),tC=(0,d.useCallback)(async()=>(await tS({query:{ownerUsername:o}})).data.questions,[tS,o]),tN=(0,d.useCallback)(e=>{"data-typing"===e.type?eu(e.data.isTyping):"data-user-message-id"===e.type&&(e_(e.data.id),ew.current?.(t=>(0,G.applyServerUserMessageId)(t,e.data.id)))},[e_]),t_=(0,d.useCallback)(e=>{let t=(0,en.parseChatOutcomeSignal)(e);t?.type==="blocked"?(eh(!1),e4(t.block)):(t?.type==="accepted"&&e3(),"data-typing"===e.type?eh(e.data.isTyping):"data-user-message-id"===e.type&&(eT(e.data.id),ej.current?.(t=>(0,G.applyServerUserMessageId)(t,e.data.id))))},[e3,e4,eT]),tk=(0,d.useCallback)(({message:e,messages:t,isAbort:n,isDisconnect:a,isError:i})=>{eu(!1),eI({messages:t,assistantMessageId:e.id,isAbort:n,isDisconnect:a,isError:i}),eU.current=null,ey.current=eO(t,n,e=>ew.current?.(e)),eS.current?.().catch(()=>{})},[eI,eO]),tI=(0,d.useCallback)(({message:e,messages:t,isAbort:n,isDisconnect:a,isError:i})=>{eh(!1),e6()||(eR({messages:t,assistantMessageId:e.id,isAbort:n,isDisconnect:a,isError:i}),eO(t,n,e=>ej.current?.(e)))},[e6,eR,eO]),tP=(0,d.useMemo)(()=>new r.DefaultChatTransport({api:l,credentials:"include",prepareSendMessagesRequest:({messages:e,id:t,headers:n})=>({headers:(0,ig.appendChatRequestHeaders)(n,"owner"),body:{id:t,message:e[e.length-1],messages:(0,ip.chatRequestHistory)(e),ownerUsername:o,channel:"web"}})}),[l,o]),tE=(0,d.useMemo)(()=>new r.DefaultChatTransport({api:e,credentials:"include",prepareSendMessagesRequest:({messages:e,id:t,headers:n})=>({headers:(0,ig.appendChatRequestHeaders)(n,"public"),body:{id:t,message:e[e.length-1],messages:(0,ip.chatRequestHistory)(e),ownerUsername:o,channel:"web"}})}),[e,o]),tT=void 0!==h&&es===h?g:void 0,{messages:tA,sendMessage:tM,status:tO,stop:tD,setMessages:tU}=(0,i.useChat)({id:es,messages:tT,transport:tP,onData:tN,onFinish:tk,onError:ty});(0,d.useEffect)(()=>{ew.current=tU},[tU]);let{messages:tL,sendMessage:tz,status:tF,stop:tq,setMessages:tB}
4=(0,i.useChat)({id:eo,transport:tE,onData:t_,onFinish:tI,onError:tw});(0,d.useEffect)(()=>{ej.current=tB},[tB]),(0,d.useEffect)(()=>{ek(tA)},[ek,tA]),(0,d.useEffect)(()=>{eA(tL)},[tL,eA]);let tH=(0,d.useCallback)(e=>{eP();let t=la(e,ln("message"));return e2(t.id,t.parts),tz(t)},[eP,e2,tz]);(0,d.useLayoutEffect)(()=>{ey.current=tA},[tA]);let t$=(0,d.useCallback)(e=>{if("preview"===e){tD();let e=(0,H.resolvePreviewThreadIdOnEnter)({currentPreviewThreadId:eo,previewMessageCount:tL.length,createThreadId:()=>ln("thread")});e!==eo&&ec(e)}else tq(),e7();Z(e)},[e7,tL.length,eo,tq,tD]),tV=(0,d.useCallback)(()=>{te&&(tD(),tq(),e7(),Z("train"),el(ln("thread")),ec(ln("thread")),eq(o))},[te,e7,tq,tD,eq,o]),{mutate:tG,mutateAsync:tQ}=(0,p.useMutation)({...(0,x.patchMessageByIdPartsMutation)(),onError:e=>{let t=(0,tp.parseVisibleError)(e);m.toast.error(t?.message??"Couldn't sync your last change. Refresh to see the latest state.")}}),tK=(0,d.useCallback)(async e=>{await Promise.all(e.map(({messageId:e,parts:t})=>tQ({path:{id:e},query:{ownerUserId:c},body:{parts:t}})))},[c,tQ]),tW=(0,d.useCallback)(async()=>{let e=eb.current;if(0===e.size)return;let t=ey.current,n=s5(t,e);n.messages!==t&&(await tK(n.patches),ey.current=n.messages,tU(n.messages))},[tK,tU]);(0,d.useLayoutEffect)(()=>{eS.current=tW},[tW]),(0,d.useEffect)(()=>{ev.current.clear(),eb.current.size>0&&eD(new Map)},[es,eD]);let tY=(0,d.useCallback)((e,t)=>{let n=new Map(eb.current);n.set(e,t);let a=s5(ey.current,n);eD(n),tK(a.patches).catch(()=>{})},[tK,eD]),tX=(0,d.useCallback)((e,t,n,a)=>{tY(e,{status:"saved",question:t,suggestedAnswer:n,uploadId:a})},[tY]),tZ=(0,d.useCallback)((e,t)=>{t?ev.current.add(e):ev.current.delete(e)},[]),tJ=(0,d.useCallback)(e=>{tY(e,{status:"dismissed"})},[tY]),t0=(0,d.useCallback)((e,t,n)=>{let a=null;if(tU(i=>i.map(i=>{if(!i.parts.some(t=>li(t,e)))return i;let r=i.parts.map(a=>{if(li(a,e)){let e=(0,nY.parseRecord)(a.input)??{},i=(0,nY.parseRecord)(a.output)??void 0;return{...a,input:{...e,condition:t,instruction:n},output:i?{...i,condition:t,instruction:n}:i}}return a});return a={messageId:i.id,parts:r},{...i,parts:r}})),a){let{messageId:e,parts:t}=a;tG({path:{id:e},query:{ownerUserId:c},body:{parts:t}})}},[c,tU,tG]),t1=(0,d.useCallback)(async()=>{if(ev.current.size>0)throw m.toast.error("Wait for Q&A to finish saving before sending."),Error("Add QA save in progress");let e=ey.current,t=eb.current,n=function(e,t){let n=new Map(t),a=!1;for(let r of e)for(let e of r.parts)if(s3(e)&&!t.has(e.toolCallId)){var i;i=e.output,i?.status!=="saved"&&i?.status!=="dismissed"&&(n.set(e.toolCallId,{status:"dismissed"}),a=!0)}let r=a?n:t;return{...s5(e,r),outputs:r}}(e,t);n.outputs!==t&&eD(n.outputs),await tK(n.patches),n.messages!==e&&(ey.current=n.messages,tU(n.messages))},[tK,eD,tU]),t2=(0,d.useCallback)(async(...e)=>{if(!te)return!1;try{return await t1(),eN(),tM(...e),!0}catch{return!1}},[eN,te,tM,t1]),t3=(0,d.useCallback)((e,t)=>t2({text:e,metadata:{feedbackEntrypoint:t}}),[t2]),t4=tA.at(-1),t5="streaming"===tO&&t4?.role==="assistant",t6=(0,d.useCallback)(()=>{let e=new URL(window.location.href);e.searchParams.has("firstOwner")&&(e.searchParams.delete("firstOwner"),(0,eE.shallowReplace)(`${e.pathname}${e.search}${e.hash}`))},[]);(0,d.useEffect)(()=>{R&&!1===tt&&t6()},[t6,R,tt]);let t7=function({username:e,ownerUserId:a,firstOwner:i,mode:r,ownerChatMode:s,messages:l,setMessages:o,isTyping:c,assistantStreamActive:m,mindScore:h=null,onComplete:p,markGuidedTrainingInFlight:g,clearGuidedTrainingInFlight:b}){let v=(0,d.useRef)(new Set),y=(0,d.useCallback)(()=>{for(let e of v.current)window.clearTimeout(e);v.current.clear()},[]);(0,d.useEffect)(()=>y,[y]);let w=(0,d.useCallback)((e,t)=>{let n=window.setTimeout(()=>{v.current.delete(n),e()},t);return v.current.add(n),n},[]),j=(0,d.useCallback)(e=>new Promise(t=>{w(t,e)}),[w]),[S,C]=(0,d.useState)("response-rating"),[N,_]=(0,d.useState)(!1),[k,I]=(0,d.useState)(1),[P,E]=(0,d.useState)(null),T=(0,d.useRef)(!1),A=(0,d.useRef)(0),R=(0,d.useCallback)(()=>{A.current+=1,T.current=!1,_(!1)},[]),M=(0,d.useCallback)(()=>{R(),C("response-rating"),I(1)},[R]),O=(0,d.useCallback)(e=>{"response-rating"===e&&E(null),s0(w,{transitioningRef:T,generationRef:A},{setStepNavDirection:I,setStepTransitioning:_,setStep:C},e,-1)},[w]),D=(0,d.useCallback)(e=>{I(1),R(),C(e)},[R]),U=(0,d.useCallback)(e=>{s0(w,{transitioningRef:T,generationRef:A},{setStepNavDirection:I,setStepTransitioning:_,setStep:C},e,1)},[w]),[L,z]=(0,d.useState)(0),F=(0,d.useCallback)(()=>{z(0)},[]),q=(0,d.useCallback)((e,t="feedback")=>{let n=function(e="feedback"){return sX("assistant","",{agentSource:e,guidedTrainingTyping:!0})}(t);return z(e=>e+1),o(e=>[...e,n]),new Promise(t=>{w(()=>{o(t=>t.map(t=>
4t.id!==n.id?t:{...t,parts:[{type:"text",text:e}],metadata:{...t.metadata,guidedTrainingTyping:!1}})),z(e=>Math.max(0,e-1)),t()},sg.GUIDED_TRAINING_ASSISTANT_FIRST_TOKEN_DELAY_MS)})},[w,o]),B=(0,d.useRef)(q);(0,d.useEffect)(()=>{B.current=q},[q]);let H=(0,d.useRef)(j);(0,d.useEffect)(()=>{H.current=j},[j]);let $=(0,d.useCallback)(async(e,t)=>{let n=e.map(e=>e.trim()).filter(Boolean);if(0!==n.length){z(e=>e+1);try{for(let e=0;e<n.length;e+=1)await B.current(n[e]),e<n.length-1&&await H.current(sg.GUIDED_TRAINING_ASSISTANT_MESSAGE_GAP_MS)}finally{t?.(),z(e=>Math.max(0,e-1))}}},[]),[V,G]=(0,d.useState)(sZ),[Q,K]=(0,d.useState)("edit-answer"),[W,Y]=(0,d.useState)(null),[X,Z]=(0,d.useState)(()=>(0,sg.getGuidedTrainingUnknownAnswerOptions)()),[J,ee]=(0,d.useState)(()=>new Set),[et,en]=(0,d.useState)(sJ),[ea,ei]=(0,d.useState)(null),er=(0,sf.useAddToMindStore)(e=>e.isOpen),es=(0,sf.useAddToMindStore)(e=>e.submissionEpoch),el=(0,sf.useAddToMindStore)(e=>e.close),eo=null===h,ec=!eo&&h>=sg.GUIDED_TRAINING_MQS_THRESHOLD,ed="active"===V.kind?{question:V.question,answerText:V.answerText}:null,eu=(0,d.useCallback)(()=>{G(sZ),M(),K("edit-answer"),Y(null),Z((0,sg.getGuidedTrainingUnknownAnswerOptions)()),ee(new Set),en(sJ),F(),E(null),ei(null)},[F,M]),[em,eh]=(0,d.useState)(!1),[ep,ef]=(0,d.useState)(!1),eg=(0,d.useCallback)(()=>{y(),R(),ef(!0)},[R,y]),ex=(0,d.useCallback)(()=>{y(),eh(!0),ef(!1),eu(),b?.(),p?.()},[y,b,p,eu]),eb=(0,d.useCallback)(()=>{eh(!1)},[]),[ev,ey]=(0,d.useState)(e);e!==ev&&(ey(e),eb(),G(sZ),C("response-rating"),I(1),_(!1),K("edit-answer"),Y(null),Z((0,sg.getGuidedTrainingUnknownAnswerOptions)()),ee(new Set),en(sJ),z(0),E(null),ei(null)),(0,d.useLayoutEffect)(()=>{A.current+=1,T.current=!1},[ev]);let ew=i&&!em,ej=function(e){let t,a,i,r,s=(0,n.c)(11),{ownerUserId:l,enabled:o}=e,c=(0,sf.useAddToMindStore)(sY),d=(0,sf.useAddToMindStore)(sW),u=o||d;s[0]!==l?(t=l?{ownerUserId:l}:void 0,s[0]=l,s[1]=t):t=s[1];let m=t;s[2]!==m?(a=(0,x.getContentFeedOptions)({query:m}),s[2]=m,s[3]=a):a=s[3];let h=u&&!!l;s[4]!==a||s[5]!==h?(i={...a,enabled:h,staleTime:0},s[4]=a,s[5]=h,s[6]=i):i=s[6];let{data:p}=(0,f.useQuery)(i);p?.data;e:{let e;if(!u){let e;s[7]===Symbol.for("react.memo_cache_sentinel")?(e=[],s[7]=e):e=s[7],r=e;break e}s[8]!==p?.data||s[9]!==c?(e=function({feeds:e,pendingPlatforms:t}){let n=new Set;for(let t of e){let e=(0,sV.addToMindViewForFeed)(t);e&&sQ.has(e)&&n.add(e)}for(let e of t){let t=function(e){let t=sQ.has(e)?e:(0,sx.addToMindViewForAccountPlatform)(e);return t&&sQ.has(t)?t:void 0}(e);t&&n.add(t)}return[...n]}({feeds:p?.data??[],pendingPlatforms:c.map(sK)}),s[8]=p?.data,s[9]=c,s[10]=e):e=s[10],r=e}return r}({ownerUserId:a,enabled:ew}),eS=ew&&"train"===s,eC=eS&&null!==ed,eN=L>0,e_=!ep&&!er,ek=e_||er,eI=ep||N||c||m||L>0,eP=(0,d.useCallback)(e=>{(0,u.flushSync)(()=>{o(t=>[...t,sX("user",e)])})},[o]),eE=(0,d.useCallback)(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})},[]),eT=(0,d.useCallback)((e,t)=>{eP(e),eE(t)},[eP,eE]);(0,d.useEffect)(()=>{if(!eS||"pending"!==V.kind||c||m)return;let e=function(e,t){let n=-1;for(let a=e.length-1;a>=0;a--){let i=e[a];if("user"===i.role&&(0,rp.extractMessageText)(i)===t){n=a;break}}if(-1===n)return null;for(let a=e.length-1;a>n;a--){let n=e[a];if("assistant"!==n.role||n.metadata?.guidedTrainingTyping)continue;let i=(0,rp.extractMessageText)(n);if(i)return{answerText:i,question:t}}return null}(l,V.question);e&&(G({kind:"active",...e}),M(),K("edit-answer"))},[m,eS,V,c,l,M]);let eA=(0,d.useCallback)(e=>{let t=e.trim();return!t||!eS||"idle"!==V.kind||c||m?null:(g?.(),Z((0,sg.getGuidedTrainingUnknownAnswerOptions)()),G({kind:"pending",question:t}),()=>{G(e=>"pending"===e.kind&&e.question===t?sZ:e)})},[m,eS,V.kind,c,g]),eR=(0,d.useCallback)(e=>{if(eI||!ed)return;let t=sg.GUIDED_TRAINING_RATING_OPTIONS.find(t=>t.score===e);t&&eT(t.message,()=>{(E(e),e>=4)?q(sg.GUIDED_TRAINING_COPY.highRating).then(()=>{en(e=>({...e,addKnowledge:ec?"source-training-intro":"response-rating"})),D(ec?"source-training-intro":"add-knowledge")}):(en(e=>({...e,addKnowledge:"improvement-options"})),U("improvement-options"))})},[eT,eI,ec,D,q,ed,U]),eM=(0,d.useCallback)(e=>{let t=new Set(J);t.add(e),ee(t);let n=sg.GUIDED_TRAINING_IMPROVEMENT_OPTIONS.filter(e=>!t.has(e.id)),a=1===t.size||0===n.length?"content-added":"improvement-options";"content-added"===a&&en(e=>({...e,contentAdded:"source-training-intro"===S?"source-training-intro":"improvement-options",knowledgeBoundary:"content-added"})),D(a)},[J,D,S]),eO=(0,d.useCallback)(()=>{eM("upload")},[eM]),eD=(0,d.useCallback)(e=>{g?.();let t=sf.useAddToMindStore.getState();ei(t.submissionEpoch),t.goToView(e),t.open({submissionSource:"guided_training_add_knowledge"})},[g]);(0,d.useEffect)(()=>
4{if(null!==ea&&!(es<=ea)){if(el(),ei(null),"content-added"===et.addKnowledge)return void D("content-added");eO()}},[et.addKnowledge,ea,es,el,eO,D]);let eU=(0,d.useCallback)(()=>{g?.(),sf.useAddToMindStore.getState().openRestored("home",{submissionSource:"guided_training_add_knowledge"})},[g]),eL=(0,d.useCallback)(e=>{if(!eI){if("upload"===e){en(e=>({...e,addKnowledge:"source-training-intro"===S||"content-added"===S?S:"improvement-options"})),U("add-knowledge");return}K(e),U("write-answer")}},[eI,S,U]),ez=(0,d.useCallback)((e,t)=>{ed&&!eI&&eT(`When someone asks me "${ed.question}" answer this "${e}"`,()=>{o(n=>[...n,function({question:e,answer:t,uploadId:n}){let a=crypto.randomUUID();return{id:crypto.randomUUID(),role:"assistant",metadata:{createdAt:new Date().toISOString(),agentSource:"feedback"},parts:[{type:"tool-addQA",toolCallId:a,state:"output-available",input:{question:e,topic:e,suggestedAnswer:t,reason:"Guided training answer correction"},output:{status:"saved",question:e,suggestedAnswer:t,uploadId:n}}]}}({question:ed.question,answer:e,uploadId:t})]),q(sg.GUIDED_TRAINING_COPY.editSaved).then(()=>{eM("edit-answer")})})},[eT,eM,eI,q,ed,o]),eF=(0,d.useCallback)(async e=>{let t=e.trim();t&&ed&&!eI&&eT(`I didn't like this answer. ${t}`,()=>{q(sg.GUIDED_TRAINING_COPY.feedbackSaved).then(()=>{eM("feedback")})})},[eT,eM,eI,q,ed]),eq=(0,d.useCallback)(()=>{U("knowledge-boundary")},[U]),eB=(0,d.useCallback)(e=>{eI||eT(e,()=>{Y(e),q(sg.GUIDED_TRAINING_COPY.noAnswer,"delphi").then(()=>{U("unknown-answer-style")})})},[eT,eI,q,U]),eH=(0,d.useCallback)(async e=>{let t=e.trim();if(!t||eI)return;let n=t.replace(/^"+|"+$/g,"");eT(`When my Delphi doesn't know an answer, it should reply with something like "${n}"`,()=>{$([sg.GUIDED_TRAINING_COPY.saved,sg.GUIDED_TRAINING_COPY.keepChatting],eg)})},[eT,eg,eI,$]),e$=(0,d.useCallback)(()=>{eI||eT(sg.GUIDED_TRAINING_COPY.nextPromptQuestion,()=>{q(sg.GUIDED_TRAINING_COPY.nextPromptResponse)})},[eT,eI,q]),eV=(0,d.useCallback)(()=>{eI||(K("unknown-answer-style"),U("write-answer"))},[eI,U]),eG=(0,d.useCallback)(()=>{if(!eI){if("improvement-options"===S||"source-training-intro"===S)return void O("response-rating");if("write-answer"===S)return void O("unknown-answer-style"===Q?"unknown-answer-style":"improvement-options");if("add-knowledge"===S)return void O(et.addKnowledge);if("content-added"===S)return void O(et.contentAdded);if("knowledge-boundary"===S)return void O(et.knowledgeBoundary);"unknown-answer-style"===S&&O("knowledge-boundary")}},[et,O,eI,S,Q]),eQ=(0,d.useMemo)(()=>eC&&ed?(0,t.jsx)("div",{className:"relative z-10",children:(0,t.jsx)(s$,{step:S,stepNavDirection:k,writeIntent:Q,committedRatingScore:P,hidden:eN,stepTransitioning:N,unknownAnswerOptions:X,completedImprovementOptions:J,question:"unknown-answer-style"===Q?W??ed.question:ed.question,answerText:ed.answerText,isHighMqs:ec,ratingPending:eo,disabled:N,canGoBack:"response-rating"!==S&&"content-added"!==S&&"knowledge-boundary"!==S&&"unknown-answer-style"!==S,onBack:eG,onDismiss:eg,onRate:eR,onImprovementOption:eL,onSubmitEditedAnswer:ez,onSubmitFeedback:eF,onOpenAddKnowledge:eD,hiddenAddKnowledgeSources:ej,onSkipAddKnowledge:"improvement-options"!==et.addKnowledge?eq:void 0,onContentAddedContinue:eq,onKnowledgeBoundaryQuestion:eB,onUnknownStyleOption:eH,onUnknownStyleWriteCustom:eV,onUnknownStyleCustom:eH})}):null,[et.addKnowledge,P,eg,eH,J,eq,eG,ez,eF,eL,eB,eR,eV,ec,ej,eD,eo,ed,eN,eC,S,k,N,W,X,Q]);return(0,d.useMemo)(()=>({consumeOwnerMessage:eA,askNextTrainingActions:e$,openPostFlowKnowledge:eU,inputReplacement:eQ,showGuidedCard:e_,inputSlotShowGuided:ek,addToMindOpen:er,shellDismissPending:ep,finalizeShellDismiss:ex,isActive:eC,shouldShowProfilePrompt:ew&&"profile"===r&&"idle"===V.kind,shouldSuppressNavigation:ew}),[e$,eA,ex,ew,eQ,eC,r,eU,V.kind,er,ek,ep,e_])}({username:o,ownerUserId:c,firstOwner:ta,mode:ez,ownerChatMode:X,messages:tA,setMessages:tU,isTyping:ed,assistantStreamActive:t5,mindScore:tr,onComplete:t6,markGuidedTrainingInFlight:tn.mark,clearGuidedTrainingInFlight:tn.clear}),t8=t7.consumeOwnerMessage,{mutateAsync:t9}=(0,p.useMutation)((0,x.postChatBootstrapMutation)()),ne=(0,d.useRef)(null),nt=(0,d.useRef)(null),nn=(0,d.useCallback)(()=>(ne.current||(ne.current=(async()=>{tD(),Z("train");try{let e=(await t9({query:{ownerUsername:o,mode:"new",channel:"web"}})).data.threadId;if(!e)throw Error("No guided training thread returned");return(0,u.flushSync)(()=>{el(e)}),tn.mark(),e}catch{return ne.current=null,m.toast.error("Couldn't start guided training. Try again."),null}})()),ne.current),[tn,t9,tD,o]),na=(0,d.useCallback)(async e=>{let t=e.trim();if(!t)return!1;if(!te)return Z("train"),eG.setInput(t),eq(o,es),!0;let n=await nn();return!!n&&(eq(o,n,{firstOwner:!0}),nt.current={question:t,threadId:n},!0)},[es,nn,te,eq,eG,o]);(0,d.useEffect)(()=>{!ta||"profile"!==ez||te&&nn()},[nn,te,ta,ez]);let ni=(0,d.useCallback)((...e)=>{te&&(async()=>{let t=function(e){let t=(0,nY.parseRecord)(e);if(!t)return null;let n=(0,nY.parseString)(t.text)?.trim();if(n)return n;if(!Array.isArray(t.parts))return null;let a=[];for(let e of t.parts){let t=(0,nY.parseRecord)(e);if("text"!==(0,nY.parseString)(t?.type))continue;let n=(0,nY.parseString)(t?.text)?.trim();n&&a.push(n)}return a.join("\n")||null}(e[0]);if(await t1(),t){let e=t8(t);e&&(eU.current=e)}eN(),tM(...e)}
4)().catch(()=>{})},[eN,te,t8,tM,t1]),nr=(0,d.useCallback)((e,t)=>{if(!te)return void eG.setInput(e);if("train"===X)return void ni({text:e});let n=(0,nK.questionSubmitListFields)({kind:"profile_question",...t},[{type:"text",text:e}]),i=(0,a.currentHandoff)(o);(0,a0.stageQuestionSubmitAfterTurnRecorded)(()=>{tH({text:e})},eY,()=>{(0,tR.track)("visitor:question_submit",(0,nK.visitorQuestionSubmitProperties)({ownerUserId:c,threadId:eo,isOwner:!0,surface:"delphi_app",visitorState:K,questionSource:n.questionSource,questionPosition:n.questionPosition,highlightId:n.highlightId,chapterId:n.chapterId,handoff:i,referrer:(0,aJ.takeChatReferrer)(o)}))})},[te,ni,X,c,eY,eo,tH,eG,o,K]);(0,d.useEffect)(()=>{let e=nt.current;e&&te&&"chat"===ez&&"train"===X&&es===e.threadId&&(nt.current=null,ni({text:e.question}))},[es,te,ni,ez,X]);let ns=(0,d.useCallback)(e=>{let t=(0,aV.surfaceSendText)(e);t&&eG.setInput(t)},[eG]),nl=te&&"chat"===ez;ia(o,te?ni:ns,nl),it(o,A,te?ni:ns,nl);let no=(0,d.useMemo)(()=>s4(tA,eg),[eg,tA]),nc="train"===X?no:tL,nd="train"===X?tO:tF;(0,d.useEffect)(()=>{eC.current={stop:"train"===X?tD:tq,status:nd}},[X,nd,tq,tD]);let nu="train"===X?ni:tH,nm="train"===X?ed:em,nh=(0,P.usePathname)(),np=tA.some(e=>"assistant"===e.role);(0,d.useEffect)(()=>{"train"===X&&np&&nh===`/${o}/chat`&&(0,eE.shallowReplace)(`/${o}/chat/${es}`)},[es,np,o,nh,X]);let nf=nc.at(-1),ng="streaming"===nd&&nf?.role==="assistant",nx="submitted"===nd||"streaming"===nd,nb=(0,d.useMemo)(()=>(0,aG.resolveLatestFollowups)(ef,nc),[ef,nc]),nv=nb.length>0?nb:Q,[ny,nw]=(0,d.useState)(!1),nj="train"===X?es:eo,[nS,nC]=(0,d.useState)(null),nN=(0,d.useCallback)(e=>{let t=nc[0],n=e?nc.find(t=>t.id===e):nc[nc.length-1];nC(t&&n&&t.id!==n.id?{startMessageId:t.id,endMessageId:n.id}:null),nw(!0)},[nc]),{qaSharedMessageIds:n_,conversationSharedMessageIds:nk,handleUnshareMessage:nI}=lu(nj,!0,nc),[nP,nE]=(0,d.useState)(null),nT=(0,d.useCallback)(e=>{let t=nc.findIndex(t=>t.id===e);if(-1===t)return;let n=nc[t],a=nc.slice(0,t).reverse().find(e=>"user"===e.role);a&&nE({questionText:a.parts.filter(e=>"text"===e.type).map(e=>e.text).join("\n").trim()||null,startMessageId:a.id,endMessageId:n.id})},[nc]),nA=t7.shouldSuppressNavigation,[nR,nM]=(0,d.useState)(!0),nO=(0,aH.useContentVideoStore)(e=>e.askSuggestions),nD=null!==eF&&nO.length>0,nU=nD?nO:Q,nL=(0,O.useMyMindPillHiddenStore)(e=>e.setHidden),nz=(0,d.useCallback)(e=>!nm&&!ng&&(te?(nu({text:e,metadata:{delphiEntrypoint:"ask_again"}}),!0):(eG.setInput(e),!1)),[ng,te,nm,nu,eG]),nF=sa({messages:nc,isStreaming:ng,isAutoPlayEnabled:"chat"===ez&&"preview"===X}),nq=!tc&&("content"===ez||"chat"===ez&&!nA);(0,d.useLayoutEffect)(()=>(nL(tc||nq),()=>nL(!1)),[tc,nq,nL]);let nB=(0,_.useNavRestoreClass)(),nH=(0,O.useNotificationsDrawerStore)(e=>e.available),n$=(0,O.useNotificationsDrawerStore)(e=>e.open),nV=(0,O.useNotificationsDrawerStore)(e=>e.setOpen),nG=(0,O.useNotificationsDrawerStore)(e=>e.setOwnerIdentity),nQ=(0,d.useCallback)(()=>{nV(!0)},[nV]),nW=(0,d.useRef)(!1);(0,d.useEffect)(()=>{let e=nW.current;(nW.current=nq,nq)?nG({userId:c,name:z,image:F}):e&&(nG(null),nV(!1))},[nq,c,z,F,nG,nV]),(0,d.useEffect)(()=>()=>{nG(null),nV(!1)},[nG,nV]);let nX="content"===ez?eF:null,nZ="chat"===ez,nJ=(0,a$.useContentAudioPillPlayer)(nZ,nX,e=>e$(o,e)),n0=(0,aA.useContentBylineStore)(e=>e.inView),n1=nq&&("content"!==ez||null!=nJ||!n0)?(0,t.jsx)(D.ChatHeaderMindPill,{className:nB,userId:c,name:z,image:F,showStatusEvents:"chat"===ez&&"train"===X,onClick:nH?nQ:void 0,showUnreadBadge:nH,dialogOpen:n$,player:nJ??void 0,entrance:"content"===ez?"drop":"morph",trailingAction:"chat"===ez&&nF.isAvailable?(0,t.jsx)(so,{isEnabled:nF.isEnabled,isPlaying:nF.isPlaying,isLoading:nF.isLoading,onToggle:nF.toggleEnabled,showDivider:!1}):null},"chat-header-mind-pill"):null,n2=(0,f.useQuery)({...(0,x.getMindMeOptions)()}),n3=n2.isSuccess&&!n2.data?.data,n4=J?.data?.onboardingCompleted===!1,n5=n3||n4,n6=(0,d.useMemo)(()=>"chat"!==ez||tc||nA?"profile"===ez&&n5?(0,t.jsx)(w.CreateYourDelphiNavButton,{}):null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.ChatModeSelector,{mode:X,onModeChange:t$}),te?(0,t.jsx)($.NewChatButton,{onClick:tV}):null]}),[ez,X,t$,tV,te,tc,nA,n5]),n7=(0,Y.useSearchReturnBack)(o),n9=(0,d.useMemo)(()=>nq?{href:(0,io.profilePath)(o),label:"Back to profile",onClick:()=>eB(o)}:n7,[nq,o,eB,n7]);(0,k.useNavRightSlot)(n6),(0,N.useNavHidden)(nq),(0,_.useNavSuppressed)(nA);let{isScrolled:ae}=(0,is.useProfileScrollDirection)({enabled:"profile"===ez,onScrolledChange:S.setMobileBarHidden});(0,d.useEffect)(()=>("profile"!==ez&&(0,S.setMobileBarHidden)(!1),()=>(0,S.setMobileBarHidden)(!1)),[ez]),(0,d.useEffect)(()=>{"chat"===ez&&eL.current&&(eL.current=!1,document.querySelector("[data-surface-prompt-form]")?.requestSubmit())},[ez]);let at=(0,S.useMobileBarHiddenValue)(),an=n8(),aa=(0,d.useRef)(null),ai=ls(aa,"chat"===ez&&!tc),ar=(0,d.useCallback)(()=>eB(o),[eB,o]);ir({mode:ez,username:o,threadId:es,goToChat:eq,leaveChat:ar,isStreaming:ng,onStopStream:eM,onToggleTTS:nF.isAvailable?nF.toggleEnabled:void 0,canChat:!n5});let as="train"===X?t7.inputReplacement:null,al=null!==as,ao=t7.shellDismissPending,ac=al||ao,ad=al&&t7.showGuidedCard&&!ao,au="train"===X?14:8,am=lo(ai.height,"chat"===ez&&!tc,au),{bottomInset:ah}=function(e){let t,a=(0,n.c)(5),{measuredHeight:i,guidedShellVisible:r,guidedShellMounted:s,guidedShellExiting:l,guidedShellOverlayOpen:o,enabled:c}=e,u=void 0===c||c,[m,h]=(0,d.useState)(0),p=u&&s?r&&i>0?Math.max(m,i):m:0;if(p!==m&&h(p),!u){let e;return a[0]!==i?(e={bottomInset:i,bottomInsetHeld:!1},a[0]=i,a[1]=e):e=a[1],e}let f=s&&!r&&(l||void 0!==o&&o)&&p>0,g=r?i:f?p:i;return a[2]!==g||a[3]!==f?(t={bottomInset:g,bottomInsetHeld:f},a[2]=g,a[3]=f,a[4]=t):t=a[4],t}({measuredHeight:am??0,guidedShellVisible:ad,guidedShellMounted:al,guidedShellExiting:ao,guidedShellOverlayOpen:ac&&t7.addToMindOpen,enabled:ac}),ap=ac?ah:am,af=ac?ah:lo(ai.height-ai.suggestionsBandHeight,"chat"===ez&&!tc,au),ag=(0,d.useCallback)(e=>
4{if(!te)return void(0,s6.clearPendingChatContent)();let t=(0,s6.consumePendingChatContent)((0,aV.surfaceSendText)(e))??(eF?eV:null);nu(t?{parts:(0,s6.withContentRef)((0,aV.surfaceSendParts)(e),t)}:e)},[te,eF,eV,nu]),ax=(0,d.useCallback)(e=>{let t=e.trim();t?(eG.setInput(t),te&&(eL.current=!0),eq(o,es)):(0,s6.clearPendingChatContent)()},[es,te,eq,eG,o]),ab=(0,t.jsx)(aV.SurfaceInput,{readUrlApi:l,username:o,threadId:es,attachmentThreadId:es,attachmentMode:"owner_train",onAttachmentThreadId:el,onAttachmentError:tj,mode:ez,profileDisplayName:z,placeholder:eF?`Ask ${z} about this ${(0,aB.contentNoun)(eV?.type??"")}â¦`:void 0,suggestionTexts:Q,visitorSuggestedQuestionsVariant:"control",canGenerateSuggestions:!0,onGenerateSuggestions:tC,chatStatus:nd,onStop:eM,onCall:tg,hideCall:tm,callGrayscale:th,callBusy:tf,goToChat:eq,sendMessage:ag,showMobileCompactBar:!1}),av="train"===X?(0,t.jsx)(sp,{composer:ab,guided:as,showGuided:t7.inputSlotShowGuided,shellExiting:ao,onGuidedExitComplete:t7.finalizeShellDismiss}):(0,t.jsx)(aV.SurfaceInput,{readUrlApi:e,username:o,threadId:eo,attachmentThreadId:eo,attachmentMode:"visitor",onAttachmentThreadId:ec,onAttachmentError:tj,mode:ez,profileDisplayName:z,placeholder:eF?`Ask ${z} about this ${(0,aB.contentNoun)(eV?.type??"")}â¦`:void 0,suggestionTexts:nD?nO:nv,profileSuggestions:nU,visitorSuggestedQuestionsVariant:ef,canGenerateSuggestions:!0,onGenerateSuggestions:tC,chatStatus:nd,onStop:eM,onCall:tg,hideCall:tm,callGrayscale:th,callBusy:tf,goToChat:eq,sendMessage:ag,blockedTurn:{standing:e1,composerRef:eQ},showMobileCompactBar:!1,isAtBottom:nR,questionAnalytics:{ownerUserId:c,isOwner:!0,visitorState:K,surface:"delphi_app"}});return(0,t.jsxs)(ib.CitationsDrawerProvider,{children:[tc?null:(0,t.jsx)(ll,{back:n9}),(0,t.jsx)(s.AnimatePresence,{initial:!1,children:n1}),(0,t.jsxs)("div",{className:(0,b.cn)("relative flex flex-col",E.VISIBLE_VIEWPORT_HEIGHT_CLASS),children:[(0,t.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden motion-reduce:transition-none",inert:tc,children:(0,t.jsx)(a6,{mode:tu,profile:(0,t.jsx)(aP,{username:o,threadId:es,canEdit:L,visitorState:K,goToChat:eq,goToProfile:eB,goToContent:eH,goToContentItem:e$,surfaceMode:tu,guidedFirstRun:t7.shouldShowProfilePrompt,onGuidedProfileQuestion:na,questionsOverride:nb.length>0?nb:void 0,onSendProfileQuestion:nr}),chat:(0,t.jsx)(V.ChatPaneWithCitations,{messages:nc,isTyping:("train"===X||!!eJ)&&nm,responseInProgress:("train"===X||eJ)&&nx,bouncingClientMessageId:"preview"===X?e0:null,pageOwnerDisplay:z,emptyStateDescription:j??null,api:"train"===X?l:e,chatAvatars:"train"===X?W:void 0,isTrainMode:"train"===X,isPreviewMode:"preview"===X,tryAskingEligible:ei,tryAskingMindsEnabled:er,trainModeIntroOwnerSlug:o,trainModeIntroConversationId:es,onAddQASave:"train"===X?tX:void 0,onAddQASavePendingChange:"train"===X?tZ:void 0,onAddQADismiss:"train"===X?tJ:void 0,onAskAgain:"train"===X?nz:void 0,onInstructionInlineEdit:"train"===X?t0:void 0,onSendFeedback:"train"===X?t3:void 0,onShareConversation:"train"===X?void 0:nN,onShareMessage:"train"===X?void 0:nT,onUnshareMessage:"train"===X?void 0:nI,onUnshareConversation:"train"===X?void 0:nI,sharedMessageIds:n_,conversationSharedMessageIds:nk,onGuidedTrainingMoreActions:t7.askNextTrainingActions,onGuidedTrainingAddKnowledge:t7.openPostFlowKnowledge,bottomInset:ap,scrollButtonInset:af,onScrollStateChange:nM,suppressFeedbackHint:t7.isActive,suppressGuidedTrainingCitations:"train"===X&&ta,showCitations:C??!0}),content:eF?(0,t.jsx)(aT.ProfileContentItemPane,{username:o,contentId:eF,analytics:{isOwner:!0,visitorState:K,threadId:es},onAsk:ax,goToProfile:eB,goToContent:eH,goToContentItem:e$}):(0,t.jsx)(aE.ProfileContentPane,{username:o,goToProfile:eB,goToContentItem:e$,onAsk:ax})})}),(0,t.jsx)(aM,{inChat:nZ,pageContentId:nX}),(0,t.jsx)(s.AnimatePresence,{children:tc?(0,t.jsx)(rQ,{call:to,displayName:z,imageUrl:F,ownerUsername:o,api:e,originPath:td,voiceSettingsHref:"/~/settings/voice",onChat:()=>eq(o,es)},"call-overlay"):null})]}),!tc&&!an&&!n5&&s8(ez,eF)?(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:(0,b.cn)("pointer-events-none absolute inset-x-0 bottom-0 z-30","profile"===ez&&!t7.shouldSuppressNavigation&&["transition-[padding-bottom] duration-250 ease-[
4cubic-bezier(0.23,1,0.32,1)]",at?"pb-0":"pb-20","lg:pb-0"]),children:[(0,t.jsxs)(y.PageContainer,{className:(0,b.cn)("relative flex flex-col bg-transparent pb-4","profile"===ez?`${T.PROFILE_COMPOSER_MAX_WIDTH_CLASS} px-4 md:px-0`:"max-w-[47rem] px-4 md:px-0","profile"===ez&&"max-sm:hidden"),children:[eF?(0,t.jsx)("span",{"aria-hidden":!0,className:(0,b.cn)("absolute inset-x-0 -top-12 bottom-0 -z-10 bg-gradient-to-t",v.gradient.primary)}):null,(0,t.jsx)("div",{className:"train"===X?"pt-3.5":"pt-3",children:(0,t.jsx)("div",{ref:aa,"data-content-composer":!0,children:(0,t.jsx)(M.ImpersonationChatGate,{targetKey:e8,targetLabel:e9,children:av})})})]}),"profile"===ez?(0,t.jsx)("div",{className:"pointer-events-none flex justify-center px-4 pb-[max(0.5rem,env(safe-area-inset-bottom))] sm:hidden",children:(0,t.jsx)("div",{className:"pointer-events-auto",children:(0,t.jsx)(aV.ProfileCompactBar,{hideCall:tm,callGrayscale:th,callBusy:tf,isScrolled:ae,onCall:tg,onChat:()=>eq(o,es)})})}):null]})}):null,"chat"!==ez||tc?null:(0,t.jsx)(ix.CitationsDrawer,{})]}),(0,t.jsx)(r2,{open:tx,onOpenChange:tb,onSuccess:tv}),(0,t.jsx)(se,{open:ny,onOpenChange:nw,threadId:ny?nj:null,ownerUsername:o,ownerName:z,ownerImageUrl:F,ownerHeadline:q,kind:"conversation",startMessageId:nS?.startMessageId,endMessageId:nS?.endMessageId}),nP?(0,t.jsx)(se,{open:!!nP,onOpenChange:e=>{e||nE(null)},threadId:nj,ownerUsername:o,ownerName:z,ownerImageUrl:F,ownerHeadline:q,kind:"qa",questionText:nP.questionText,startMessageId:nP.startMessageId,endMessageId:nP.endMessageId}):null,(0,t.jsx)(ik,{open:ts,onOpenChange:tl,displayName:z,onContinueInChat:()=>eq(o,es)})]})}e.s(["ProfileSurface",0,function(e){var a,i;let r,s,c,u,m,h,p,g,v,y,w,j,S,C=(0,n.c)(74),{username:N,viewer:_,api:k,ownerApi:P,canEditProfile:T,threadId:A,initialMessages:R,emptyStateDescription:M,showCitations:O,initialPrompt:D,firstOwner:L,initialCall:z,secondaryLimitRedirectUrl:F,secondaryLimitMessage:B,secondaryLimitTitle:H,secondaryLimitDescription:$,secondaryLimitCtaLabel:V,secondaryLimitDiscoverCtaEnabled:G,signinGate:Q}=e,K=void 0!==L&&L,W=void 0!==z&&z,Y=void 0===Q?"none":Q,{mode:X,contentItemId:Z,goToChat:J,goToProfile:ee,goToContent:et,goToContentItem:en}=ic();C[0]!==k||C[1]!==P?(r=function({api:e,ownerApi:t}){return{visitorApi:e,ownerApi:t??`${e}/owner`}}({api:k,ownerApi:P}),C[0]=k,C[1]=P,C[2]=r):r=C[2];let{visitorApi:ea,ownerApi:ei}=r;C[3]!==N?(s=(0,x.getUsersByUsernameOptions)({path:{username:N}}),C[3]=N,C[4]=s):s=C[4],C[5]!==s?(c={...s},C[5]=s,C[6]=c):c=C[6];let er=(0,f.useQuery)(c),es=er.data?.data;C[7]!==es||C[8]!==N||C[9]!==_?(u=null!==_&&(es?(a=es.user.id,null!==_&&_.id===a):_.username===N),C[7]=es,C[8]=N,C[9]=_,C[10]=u):u=C[10];let el=u,eo=es?.user.id??null,ec=W?"call":X,ed=W?null:Z,eu=null!==_,em=_?.hasDelphi??!1;C[11]!==el||C[12]!==ec||C[13]!==ed||C[14]!==eu||C[15]!==em||C[16]!==eo?(m={ownerUserId:eo,mode:ec,contentId:ed,isOwner:el,isAuthenticated:eu,hasDelphi:em,surface:"delphi_app"},C[11]=el,C[12]=ec,C[13]=ed,C[14]=eu,C[15]=em,C[16]=eo,C[17]=m):m=C[17],(0,il.useVisitorPageView)(m);let eh=null!==_,ep=_?.hasDelphi??!1;C[18]!==eh||C[19]!==ep?(h=(0,il.profileVisitorState)(eh,ep),C[18]=eh,C[19]=ep,C[20]=h):h=C[20];let ef=h;C[21]===Symbol.for("react.memo_cache_sentinel")?(p=[],C[21]=p):p=C[21],(0,d.useEffect)(ld,p);let eg=el||void 0!==T&&T;C[22]!==es?.user.name||C[23]!==es?.user.username||C[24]!==N?(g=es?.user.name?.trim()||es?.user.username||N,C[22]=es?.user.name,C[23]=es?.user.username,C[24]=N,C[25]=g):g=C[25];let ex=g,eb=es?.user.image??null,ev=es?.profile?.headline??null;es?.profile?.questions,C[26]!==es?.profile?.questions?(v=(es?.profile?.questions??[]).map(lc).filter(Boolean),C[26]=es?.profile?.questions,C[27]=v):v=C[27];let ey=v;if(!es){let e,n;if("chat"===X){let e;return C[28]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(U.ChatSkeleton,{}),C[28]=e):e=C[28],e}C[29]===Symbol.for("react.memo_cache_sentinel")?(e=(0,b.cn)("flex flex-col",E.VISIBLE_VIEWPORT_HEIGHT_CLASS),C[29]=e):e=C[29];let a=A??void 0;return C[30]!==eg||C[31]!==J||C[32]!==et||C[33]!==en||C[34]!==ee||C[35]!==X||C[36]!==a||C[37]!==N||C[38]!==ef?(n=(0,t.jsx)(I.PromptInputProvider,{initialInput:"",children:(0,t.jsx)("div",{className:e,children:(0,t.jsx)(aP,{username:N,threadId:a,canEdit:eg,visitorState:ef,goToChat:J,goToProfile:ee,goToContent:et,goToContentItem:en,surfaceMode:X})})}),C[30]=eg,C[31]=J,C[32]=et,C[33]=en,C[34]=ee,C[35]=X,C[36]=a,C[37]=N,C[38]=ef,C[39]=n):n=C[39],n}
4if(C[40]!==es.user||C[41]!==_){let e={id:(i=es.user).id,username:i.username,name:i.name,image:i.image};w="self"===(y=null===_?{kind:"anon",user:e}:_.id===e.id?{kind:"self",user:e}:{kind:"other",user:e,viewer:_}).kind?{mind:{imageUrl:e.image,label:e.name?.trim()||e.username},participant:{imageUrl:_?.image??null,label:_?.name?.trim()??_?.username??"Guest"}}:void 0,C[40]=es.user,C[41]=_,C[42]=y,C[43]=w}else y=C[42],w=C[43];let ew=w,ej=A??void 0,eS=R??void 0,eC=M??null,eN=D??null,e_=F??null,ek=B??null,eI=H??null,eP=$??null,eE=V??null,eT=G??null;return C[44]!==es.onboardingCompleted||C[45]!==es.user.id||C[46]!==eg||C[47]!==ew||C[48]!==K||C[49]!==W||C[50]!==O||C[51]!==ei||C[52]!==ex||C[53]!==ev||C[54]!==eb||C[55]!==Y||C[56]!==ey||C[57]!==ej||C[58]!==eS||C[59]!==eC||C[60]!==eN||C[61]!==e_||C[62]!==ek||C[63]!==eI||C[64]!==eP||C[65]!==eE||C[66]!==eT||C[67]!==N||C[68]!==ea||C[69]!==ef?(j=(0,t.jsx)(I.PromptInputProvider,{initialInput:"",children:(0,t.jsx)(o.MotionConfig,{reducedMotion:"user",children:(0,t.jsx)(l.LayoutGroup,{id:"my-mind-pill-morph",children:(0,t.jsx)(lp,{api:ea,ownerApi:ei,username:N,pageOwnerUserId:es.user.id,threadId:ej,initialMessages:eS,emptyStateDescription:eC,showCitations:O,initialPrompt:eN,firstOwner:K,initialCall:W,canEdit:eg,pageOwnerDisplay:ex,pageOwnerImage:eb,pageOwnerHeadline:ev,suggestionTexts:ey,visitorState:ef,chatAvatars:ew,onboardingCompleted:es.onboardingCompleted,secondaryLimitRedirectUrl:e_,secondaryLimitMessage:ek,secondaryLimitTitle:eI,secondaryLimitDescription:eP,secondaryLimitCtaLabel:eE,secondaryLimitDiscoverCtaEnabled:eT,signinGate:Y})})})}),C[44]=es.onboardingCompleted,C[45]=es.user.id,C[46]=eg,C[47]=ew,C[48]=K,C[49]=W,C[50]=O,C[51]=ei,C[52]=ex,C[53]=ev,C[54]=eb,C[55]=Y,C[56]=ey,C[57]=ej,C[58]=eS,C[59]=eC,C[60]=eN,C[61]=e_,C[62]=ek,C[63]=eI,C[64]=eP,C[65]=eE,C[66]=eT,C[67]=N,C[68]=ea,C[69]=ef,C[70]=j):j=C[70],C[71]!==y||C[72]!==j?(S=(0,t.jsx)(q.ChatContextProvider,{value:y,children:j}),C[71]=y,C[72]=j,C[73]=S):S=C[73],S}],530861)}]); 5 6//# debugId=edf96b3c-e262-3f4f-c369-a65c8abaaa79
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.