1import{s as K,r as i,j as e}from"./vendor-CSpQeQFa.js";import{ap as Q,B as d}from"./entry-main-PLc9_a6q.js";import{u as W}from"./useConversations-D2UlDKEh.js";import{e as ee,f as se}from"./useCreatorInvites-CpbhF3lv.js";import{a as te,c as ae,B as re,g as ie,b as j}from"./CreditBalanceBreakdown-CVPOQZnI.js";import{A as ne}from"./perfConfigSelect-DHd8mvGs.js";import{B as _,T as y}from"./bookingIdentityPing-D51nG8yv.js";import{S as ce}from"./useBlogPostStats-BEEc1KeM.js";import{C as oe}from"./useSubmissions-gPqCzRk0.js";import{L as M,S as w}from"./BonusExpiryCountdown-DZAQV4Wx.js";import{b as L,T as m,c as $,U as le,f as k,g as de}from"./useCreditPurchaseRedirect-BG4b5Ixo.js";import{c as me,X as xe}from"./zerionWallet-YD6NMGW7-anviiTIZ.js";import{C as ue}from"./blog-editorial-defaults-GYihUdxa.js";import{C as pe}from"./collapsible-DPqEgDV7.js";import{C as x}from"./PendingApproval-BMg-Cjnx.js";import{F as v}from"./creatorTiers-7p452nw9.js";import{D as C}from"./prizeUtils-9swa3d5r.js";import{B as fe}from"./ItemListJsonLd-XI2IGsFB.js";import{C as P}from"./brandOutreachLogo-DX112xbb.js";import{P as ge}from"./canvasNodeAspect-CSXmIim1.js";import{Z as he}from"./useHasPostedContest-CYNRi2l4.js";import{S as be}from"./InviteRedirect-DyEuM7Le.js";import{F as Ne}from"./utils-D3pSZr0D.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const z=me("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function je(){const c=K(),[g,u]=i.useState(null),{notifications:I,isLoading:F,mutedTypes:n,markAsRead:h,deleteNotification:b}=Q(),r=i.useMemo(()=>te(I,"brand"),[I]),A=i.useMemo(()=>ae(r,"brand",n),[r,n]),U=i.useCallback(async()=>{const s=r.filter(t=>!t.read&&!n.has(t.type));await Promise.all(s.map(t=>h(t.id)))},[r,n,h]),{conversations:E,totalUnread:R}=W(),q=ee(),O=se(),[o,D]=i.useState(!1),[l,B]=i.useState("all"),Y=i.useCallback(async()=>{if(!(o||r.length===0)){D(!0);for(const s of r)await b(s.id);D(!1)}},[r,b,o]),p=[...r.map(s=>({id:s.id,type:s.type,title:s.title,message:s.message,read:s.read,created_at:s.created_at,data:s.data,source:"notification"})),...E.filter(s=>s.unread_count>0).map(s=>({id:`msg-${s.id}`,type:"direct_message",title:`New message from ${s.business_profile?.company_name||s.business_profile?.display_name||"Brand"}`,message:s.last_message?.message?.slice(0,100)+(s.last_message?.message?.length>100?"...":"")||"You have unread messages",read:!1,created_at:s.last_message_at||s.created_at,data:{conversationId:s.id,challengeId:s.challenge_id},source:"message"}))].sort((s,t)=>new Date(t.created_at).getTime()-new Date(s.created_at).getTime()),f=i.useMemo(()=>p.filter(s=>s.source==="notification"&&n.has(s.type)),[p,n]),S=i.useMemo(()=>l==="silenced"?f:p.filter(s=>s.source==="message"||!n.has(s.type)),[l,p,f,n]),Z=s=>{const t="h-4 w-4";switch(s){case"contest_update":return e.jsx(de,{className:`${t} text-blue-400`});case"new_submission":return e.jsx(v,{className:`${t} text-green-400`});case"winner_announced":return e.jsx(y,{className:`${t} text-yellow-400`});case"prize_won":return e.jsx(y,{className:`${t} text-yellow-400`});case"finalist_reward":return e.jsx(y,{className:`${t} text-yellow-400`});case"revision_request":return e.jsx(be,{className:`${t} text-orange-400`});case"payment_received":return e.jsx(C,{className:`${t} text-green-400`});case"credits_earned":return e.jsx(he,{className:`${t} text-electric-cyan`});case"credits_won":return e.jsx(C,{className:`${t} text-emerald-400`});case"direct_message":return e.jsx($,{className:`${t} text-purple-400`});case"ranking_change":return e.jsx(k,{className:`${t} text-cyan-400`});case"elo_tier_upgrade":return e.jsx(k,{className:`${t} text-amber-400`});case"tier_upgrade":return e.jsx(k,{className:`${t} text-amber-400`});case"rating_received":return e.jsx(w,{className:`${t} text-amber-400`});case"deadline_reminder":return e.jsx(P,{className:`${t} text-red-400`});case"submission_status":return e.jsx(v,{className:`${t} text-blue-400`});case"submission_accepted":return e.jsx(x,{className:`${t} text-emerald-400`});case"submission_rejected":return e.jsx(m,{className:`${t} text-red-400`});case"brand_interaction":return e.jsx(w,{className:`${t} text-yellow-400`});case"creator_invite":return e.jsx(le,{className:`${t} text-electric-cyan`});case"peer_feedback":return e.jsx($,{className:`${t} text-violet-400`});case"community_feedback":return e.jsx($,{className:`${t} text-violet-400`});case"generation_completed":return e.jsx(ge,{className:`${t} text-emerald-400`});case"generation_failed":return e.jsx(m,{className:`${t} text-red-400`});case"generation_expired":return e.jsx(P,{className:`${t} text-amber-400`});case"subscription_activated":return e.jsx(x,{className:`${t} text-emerald-400`});case"subscription_renewed":return e.jsx(x,{className:`${t} text-emerald-400`});case"subscription_resumed":return e.jsx(x,{className:`${t} text-green-400`});case"subscription_plan_changed":return e.jsx(w,{className:`${t} text-purple-400`});case"subscription_cancelled":return e.jsx(m,{className:`${t} text-amber-400`});case"subscription_expired":return e.jsx(m,{className:`${t} text-red-400`});case"subscription_payment_failed":return e.jsx(m,{className:`${t} text-red-400`});case"creator_hire_brief":case"creator_hire_accepted":case"creator_hire_declined":case"creator_hire_message":return e.jsx(fe,{className:`${t} text-[#c4a8f0]`});case"creator_hire_paid":case"creator_hire_paid_out":return e.jsx(C,{className:`${t} text-emerald-400`});case"creator_hire_delivered":return e.jsx(v,{className:`${t} text-violet-400`});case"creator_hire_approved":return e.jsx(x,{className:`${t} text-emerald-400`});default:return e.jsx(_,{className:`${t} text-muted-foreground`})}},G=async(s,t)=>{t.stopPropagation();const a=s.data;if(a){u(s.id);try{const J=await q.mutateAsync({notificationId:s.id,challengeId:a.challenge_id,businessId:a.business_id,businessName:a.business_name,challengeTitle:a.challenge_title});c(`/messages?conversation=${J.conversationId}`)}finally{u(null)}}},H=async(s,t)=>{t.stopPropagation();const a=s.data;if(a){u(s.id);try{await O.mutateAsync({notificationId:s.id,businessId:a.business_id,businessName:a.business_name,challengeTitle:a.challenge_title})}finally{u(null)}}},V=async s=>{const t=s.data;if(s.type==="creator_invite"&&!s.read&&t?.status==="pending")return;if(s.source==="notification"&&!s.read&&await h(s.id),s.source==="message"&&t?.conversationId){c(`/messages?conversation=${t.conversationId}`);return}const a=j({type:s.type,data:t??void 0},"brand");a&&c(a)},T=s=>{const t=s.data;return s.type==="creator_invite"&&!s.read&&t?.status==="pending"},N=A+R,X=()=>{const s=typeof window<"u"&&(window.history.state?.idx??0)>0;c(s?-1:"/company-dashboard")};return e.jsxs("div",{className:"min-h-dvh bg-background",children:[e.jsx("div",{className:"sticky top-0 z-40 bg-background/95 backdrop-blur-sm border-b border-border/50",children:e.jsxs("div",{className:"max-w-[2400px] mx-auto px-3 sm:px-4 py-3 sm:py-4 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("button",{onClick:X,className:"w-8 h-8 flex items-center justify-center rounded-full bg-muted/60 hover:bg-muted/60 border border-border/40 transition-colors shrink-0",children:e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[N>
60?e.jsx(re,{className:"h-5 w-5 text-electric-cyan shrink-0"}):e.jsx(_,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsx("h1",{className:"text-base sm:text-lg font-semibold text-foreground truncate",children:"Notifications"}),N>0&&e.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-electric-cyan bg-electric-cyan/10 px-1.5 sm:px-2 py-0.5 rounded-full shrink-0",children:N})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(d,{variant:"ghost",size:"icon",onClick:()=>c("/business/notification-settings"),className:"h-8 w-8 text-muted-foreground hover:text-foreground",title:"Notification settings",children:e.jsx(ce,{className:"h-4 w-4"})}),A>0&&e.jsxs(d,{variant:"ghost",size:"sm",onClick:U,className:"h-8 w-8 sm:w-auto p-0 sm:px-3 text-xs text-muted-foreground hover:text-foreground",title:"Mark all read","aria-label":"Mark all read",children:[e.jsx(oe,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Mark all read"})]}),r.length>0&&e.jsxs(d,{variant:"ghost",size:"sm",onClick:Y,disabled:o,className:"h-8 w-8 sm:w-auto p-0 sm:px-3 text-xs text-muted-foreground hover:text-red-400",title:o?"Deletingâ¦":"Delete all","aria-label":"Delete all",children:[o?e.jsx(M,{className:"h-3.5 w-3.5 sm:mr-1.5 animate-spin"}):e.jsx(L,{className:"h-3.5 w-3.5 sm:mr-1.5"}),e.jsx("span",{className:"hidden sm:inline",children:o?"Deletingâ¦":"Delete all"})]})]})]})}),f.length>0&&e.jsxs("div",{className:"max-w-[2400px] mx-auto px-3 sm:px-4 pt-2 flex gap-1",children:[e.jsx("button",{onClick:()=>B("all"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${l==="all"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:"All"}),e.jsxs("button",{onClick:()=>B("silenced"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors inline-flex items-center gap-1.5 ${l==="silenced"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(z,{className:"h-3 w-3"}),"Silenced (",f.length,")"]})]}),e.jsx("div",{className:"max-w-[2400px] mx-auto",children:F?e.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Loading notifications..."}):S.length===0?e.jsx("div",{className:"p-8 sm:p-12 text-center",children:l==="silenced"?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-12 w-12 text-text-subtle mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No silenced notifications"}),e.jsx("p",{className:"text-xs text-text-subtle mt-1",children:"Notifications you've muted in settings will appear here"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"h-12 w-12 text-text-subtle mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No notifications yet"}),e.jsx("p",{className:"text-xs text-text-subtle mt-1",children:"You'll see collab updates, contest activity, and more here"})]})}):e.jsx("div",{className:"divide-y divide-border/50",children:S.map(s=>e.jsx("div",{className:`px-3 sm:px-4 py-3 sm:py-4 hover:bg-card/50 cursor-pointer transition-colors ${l==="silenced"?"opacity-60":s.read?"":"bg-card/30"}`,onClick:()=>V(s),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`flex-shrink-0 mt-0.5 w-9 h-9 rounded-lg flex items-center justify-center ${s.read?"bg-muted/50":"bg-muted"}`,children:Z(s.type)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:`text-sm font-medium leading-tight ${s.read?"text-muted-foreground":"text-foreground"}`,children:s.title}),e.jsx("span",{className:"text-[10px] text-text-subtle whitespace-nowrap flex-shrink-0",children:Ne(new Date(s.created_at),{addSuffix:!0})})]}),e.jsx("p",{className:`text-xs mt-0.5 line-clamp-2 ${s.read,"text-muted-foreground"}`,children:s.message}),(()=>{const t=ie({type:s.type,data:s.data});if(!t.subtext&&!t.actionLabel)return null;const a=!!j({type:s.type,data:s.data},"brand");return e.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[t.subtext&&e.jsx("span",{className:`text-[11px] font-medium ${s.read?"text-text-subtle":"text-foreground"}`,children:t.subtext}),t.actionLabel&&a&&e.jsx("span",{className:"inline-flex items-center text-[10px] font-medium px-1.5 py-0.5 rounded border bg-muted/40 text-muted-foreground border-border",children:t.actionLabel})]})})(),T(s)&&e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx(d,{size:"sm",onClick:t=>G(s,t),disabled:g===s.id,className:"bg-electric-cyan text-foreground hover:bg-electric-cyan/90 text-xs h-7 px-3",children:g===s.id?e.jsx(M,{className:"h-3 w-3 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-3 w-3 mr-1"}),"Accept"]})}),e.jsxs(d,{size:"sm",variant:"outline",onClick:t=>H(s,t),disabled:g===s.id,className:"border-border text-muted-foreground hover:bg-muted text-xs h-7 px-3",children:[e.jsx(xe,{className:"h-3 w-3 mr-1"}),"Decline"]})]}),!s.read&&!T(s)&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-electric-cyan"}),e.jsx("span",{className:"text-[10px] text-electric-cyan/70",children:"Unread"})]})]}),s.source==="notification"&&e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!!j({type:s.type,data:s.data},"brand")&&e.jsx(pe,{className:"h-3.5 w-3.5 text-text-subtle"}),e.jsx("button",{onClick:t=>{t.stopPropagation(),b(s.id)},className:"p-1.5 text-text-subtle hover:text-muted-foreground transition-colors","aria-label":"Delete notification",children:e.jsx(L,{className:"h-3.5 w-3.5"})})]})]})},s.id))})})]})}const Ye=Object.freeze(Object.defineProperty({__proto__:null,default:je},Symbol.toStringTag,{value:"Module"}));
6export{z as B,Ye as a};
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.