1import{r as o,j as u}from"./react-CiToEmDU.js";import{a as ae,f as O,b as ue,bn as fe}from"./index-BYjFgc3L.js";import{O as C}from"./OnboardingStep-BHc4FI2w.js";import{u as me,O as q,a as de}from"./useOnboardingCornerPosition-DcLQTDsx.js";import{u as pe,O as be}from"./OnboardingSurveyDrawer-lgNAKFNk.js";import{t as v}from"./TrackMixpanel-C5L6PEAt.js";import"./utils-D0PJbLwx.js";import"./media-CVQTa9EZ.js";import"./analytics-BXHdaAVG.js";import"./ResourceNode-OBIHQGrc.js";import"./tiptap-nRqHaR__.js";import"./faPencil-i7LcEqDF.js";import"./index-VeBbZI0v.js";import"./faArrowRight-4u0hryvz.js";import"./ui-RDrFZQ6P.js";import"./faXmark-B7G55HuF.js";import"./faListCheck-DLKcNtcQ.js";import"./faScaleBalanced-D5aakmWf.js";import"./faClipboardCheck-S11E7M81.js";import"./faHouse-U1l3zx8N.js";import"./default-COrDvlHP.js";import"./ContentModalCloseButton-Bpq97Y4C.js";import"./contentModalCloseButton-BwZ_2Bxs.js";import"./OnboardingHeroMedia-TiQY7Ja3.js";import"./CoboltLauncher-CbQFsgoE.js";import"./module-xE8hoDfr.js";(function(){try{var s=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};s.SENTRY_RELEASE={id:"e15ff996bbe7105fef2b7e48186cc5ea2cf1c022"};var i=new s.Error().stack;i&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[i]="5b93fb76-48df-4a95-9563-1abc8b86cf72",s._sentryDebugIdIdentifier="sentry-dbid-5b93fb76-48df-4a95-9563-1abc8b86cf72")}catch{}})();function d(s){return`sutra_onboarding_min_${s}`}function Te(){var N;const s=ae(),i=O(e=>e.space),n=O(e=>e.user),w=O(e=>e.colors),j=O(e=>e.announcementVisibility),K=ue(),Y=pe(),t=(i==null?void 0:i.top_space_slug)||(i==null?void 0:i.slug),p=K.pathname.indexOf("/space/")>=0,[f,M]=o.useState([]),[$,G]=o.useState(""),[H,J]=o.useState(""),[Q,X]=o.useState(null),[z,y]=o.useState(!1),[B,V]=o.useState(!1),[D,x]=o.useState(!1),[Z,R]=o.useState(!1),[k,I]=o.useState(!1),[W,E]=o.useState(!1),L=o.useRef(!1),U=o.useRef(!1),c=o.useRef(null);o.useEffect(()=>{if(!t||!(n!=null&&n.id)||!p){(!(n!=null&&n.id)||c.current!==t)&&y(!1);return}c.current!==t&&(L.current=!1,U.current=!1,x(!1),R(!1),c.current=null,I(!1),E(!1),V(localStorage.getItem(d(t))==="1"),C.onFetchMember(t,e=>{y(!!(e!=null&&e.visible)),M((e==null?void 0:e.steps)||[]),G((e==null?void 0:e.title)||""),J((e==null?void 0:e.subtitle)||""),X((e==null?void 0:e.accent_color)||null)},()=>y(!1)))},[t,n==null?void 0:n.id,p,(N=i==null?void 0:i.permissions)==null?void 0:N.is_member]);const A=Z&&c.current===t,b=!!(n!=null&&n.id&&p&&z&&D&&A),r=!!(n!=null&&n.id&&p&&z&&(!D||A)),ee=r&&!D&&!j,g=me({visible:r,slotId:"onboarding"}),F=f.length,te=f.filter(e=>e.completed_at).length,m=F>0&&te===F,P=Q||(w==null?void 0:w.primary_button_background_color)||void 0;if(o.useEffect(()=>{r&&!L.current&&(L.current=!0,v("Onboarding Checklist Viewed",{space_slug:t}))},[r,t]),o.useEffect(()=>{m||E(!1)},[m]),o.useEffect(()=>{!r||k||W||m&&I(!0)},[r,m,k,W]),!r)return null;const _=e=>{V(e),t&&(e?localStorage.setItem(d(t),"1"):localStorage.removeItem(d(t)))},oe=()=>{if(j){s(fe()),_(!1);return}_(!B)},h=(e,l)=>{M(S=>S.map(a=>a.public_id===e?{...a,completed_at:l}:a))},T=e=>{var S;if(e.completed_at)return;h(e.public_id,new Date().toISOString()),v("Onboarding Step Completed",{space_slug:t,step_type:(S=e.destination)==null?void 0:S.type,completion_mode:e.completion_mode}),f.every(a=>a.public_id===e.public_id||a.completed_at)&&!U.current&&(U.current=!0,v("Onboarding Completed",{space_slug:t})),C.onComplete(t,e.public_id,void 0,()=>{h(e.public_id,null)})},ne=e=>{e.completed_at&&(h(e.public_id,null),C.onUncomplete(t,e.public_id,void 0,()=>{h(e.public_id,new Date().toISOString())}))},ie=e=>{e.completion_mode==="auto"&&T(e),Y(e)},se=(e,l)=>{l.stopPropagation(),e.completed_at?ne(e):T(e)},re=e=>{e==null||e.stopPropagation(),t&&localStorage.removeItem(d(t));const l=!m;c.current=l?t:null,R(l),x(!0),v("Onboarding Dismissed",{space_slug:t}),C.onDismiss(t)},le=e=>{e==null||e.stopPropagation(),c.current=null,R(!1),x(!1),_(!1)},ce=e=>{e==null||e.stopPropagation(),E(!0),I(!1),t&&localStorage.removeItem(d(t))};return u.jsxs(u.Fragment,{children:[u.jsx(q,{minimized:!0,accent:P,steps:f,bottomOffset:g.launcherBottomOffset,rightOffset:g.launcherRightOffset,launcherLabel:b?"Undo":void 0,launcherAriaLabel:b?"Undo checklist dism
1issal":void 0,hideLauncherCount:b,onExpand:b?le:oe}),ee&&!B&&u.jsx(q,{spaceName:i==null?void 0:i.name,title:$,subtitle:H,accent:P,steps:f,celebrating:k,bottomOffset:g.expandedBottomOffset,rightOffset:g.expandedRightOffset,onMinimize:()=>_(!0),onDismiss:re,onReviewList:ce,onRowClick:ie,onCheckbox:se}),u.jsx(be,{}),u.jsx(de,{closeButtonColor:P})]})}export{Te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.