PageSourceSearch

https://socialloop.ai/_next/static/chunks/4322.7d1d3881314266cb.js

js socialloop.ai collected 2026-10-05 12:46:41 UTC 35,520 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4322],{84322:(e,t,s)=>{s.r(t),s.d(t,{default:()=>k});var a=s(95155),n=s(12115),l=s(39390),i=s(14585),r=s(37401),c=s(82146),o=s(13038),d=s(96080),m=s(33583),u=s(12711),p=s(8683),x=s(12180),h=s(42810),g=s(27896);let j=["bg-emerald-500/30 text-emerald-200","bg-weaveBlue/30 text-weaveBlue","bg-orange-500/30 text-orange-200","bg-weavePink/30 text-weavePink","bg-yellow-500/30 text-yellow-200","bg-purple-500/30 text-purple-200","bg-cyan-500/30 text-cyan-200","bg-rose-500/30 text-rose-200"];function v(e){let{name:t,photoURL:s,size:n="sm"}=e,l={xs:"w-4 h-4 text-[8px]",sm:"w-5 h-5 text-[9px]",md:"w-6 h-6 text-[10px]",lg:"w-8 h-8 text-xs"}[n];return s?(0,a.jsx)("img",{src:s,alt:t,className:"".concat(l," rounded-full object-cover flex-shrink-0")}):(0,a.jsx)("div",{className:"".concat(l," ").concat(function(e){let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)|0;return j[Math.abs(t)%j.length]}(t)," rounded-full flex items-center justify-center font-medium flex-shrink-0"),title:t,children:function(e){let t=e.trim().split(/\s+/).filter(Boolean);return 0===t.length?"?":1===t.length?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}(t)})}function b(e){let{members:t,size:s="sm",max:n=4}=e,l=t.slice(0,n),i=t.length-l.length;return(0,a.jsxs)("div",{className:"flex items-center -space-x-1.5",children:[l.map((e,t)=>(0,a.jsx)("div",{className:"ring-1 ring-surface-raised rounded-full",children:(0,a.jsx)(v,{name:e.name,photoURL:e.photoURL,size:s})},t)),i>0&&(0,a.jsxs)("div",{className:"".concat({xs:"w-4 h-4 text-[8px]",sm:"w-5 h-5 text-[9px]",md:"w-6 h-6 text-[10px]",lg:"w-8 h-8 text-xs"}[s]," bg-white/10 text-t3 rounded-full ring-1 ring-surface-raised flex items-center justify-center font-medium"),children:["+",i]})]})}let N={admin_finance:"bg-emerald-500/15 text-positive-ink border-emerald-500/30",build_strike:"bg-orange-500/15 text-orange-300 border-orange-500/30",hospitality_operations:"bg-weavePink/15 text-weavePink border-weavePink/30",creative_design:"bg-weaveBlue/15 text-weaveBlue border-weaveBlue/30",technical_production:"bg-yellow-500/15 text-attention-ink border-yellow-500/30"};function y(e){return null==e?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e/100)}function f(e){return{id:e.id,name:e.name,category:e.category}}function w(e,t){var s,a,n,i,r,c,o,d,m,u,p,x,h,g,j,v,b;return{id:e,eventId:null!=(s=t.eventId)?s:"",producerId:null!=(a=t.producerId)?a:"",name:null!=(n=t.name)?n:"",description:null!=(i=t.description)?i:void 0,category:null!=(r=t.category)?r:"admin_finance",lead:null!=(c=t.lead)?c:void 0,support:Array.isArray(t.support)?t.support:[],teamId:null!=(o=t.teamId)?o:void 0,teamName:null!=(d=t.teamName)?d:void 0,projectCount:null!=(m=t.projectCount)?m:0,taskCount:null!=(u=t.taskCount)?u:0,receiptCount:null!=(p=t.receiptCount)?p:0,isActive:!1!==t.isActive,isPinned:null!=(x=t.isPinned)&&x,tags:null!=(h=t.tags)?h:[],notes:null!=(g=t.notes)?g:void 0,createdAt:null!=(j=t.createdAt)?j:l.Timestamp.now(),updatedAt:null!=(v=t.updatedAt)?v:l.Timestamp.now(),createdBy:null!=(b=t.createdBy)?b:""}}function k(){let{user:e}=(0,r.Y)(),{eventId:t}=(0,c._)(),[s,n]=(0,m.W)("role","");return t?e?s?(0,a.jsx)(I,{roleId:s,eventId:t,onBack:()=>n("")}):(0,a.jsx)(C,{eventId:t,producerId:e.uid,onOpen:n}):(0,a.jsx)(u.y$,{}):(0,a.jsx)(u.pp,{icon:(0,a.jsx)(p.K6,{className:"w-6 h-6 text-t3"}),heading:"Select an event",description:"Roles scope to a specific event. Pick an event from the selector above."})}function C(e){var t;let{eventId:s,producerId:c,onOpen:d}=e,{user:m,notify:g}
1=(0,r.Y)(),[j,v]=(0,n.useState)(!1),[b,y]=(0,n.useState)(null),[f,k]=(0,n.useState)(null),[C,I]=(0,n.useState)(""),[S,P]=(0,n.useState)("all"),A="events/".concat(s,"/roles"),{data:T,loading:D}=(0,o.$)(A,[],w),B=(0,n.useMemo)(()=>T.filter(e=>{if("all"!==S&&e.category!==S)return!1;if(C.trim()){var t;let s=C.trim().toLowerCase();if(!e.name.toLowerCase().includes(s)&&!(null!=(t=e.description)?t:"").toLowerCase().includes(s))return!1}return!0}),[T,S,C]),U=(0,n.useMemo)(()=>[...B].sort((e,t)=>e.isPinned!==t.isPinned?e.isPinned?-1:1:e.category!==t.category?e.category.localeCompare(t.category):e.name.localeCompare(t.name)),[B]),$=(0,n.useMemo)(()=>{let e={all:T.length};for(let s of T){var t;e[s.category]=(null!=(t=e[s.category])?t:0)+1}return e},[T]),_=(0,n.useCallback)(async e=>{if(m)try{await (0,l.addDoc)((0,l.collection)(i.db,A),{...z(e),eventId:s,producerId:c,isActive:!0,projectCount:0,taskCount:0,receiptCount:0,createdAt:(0,l.serverTimestamp)(),updatedAt:(0,l.serverTimestamp)(),createdBy:m.uid}),g({type:"success",message:'Role "'.concat(e.name,'" created')}),v(!1)}catch(e){(0,x.WL)("createRole",g)(e)}},[m,s,c,A,g]),M=(0,n.useCallback)(async(e,t)=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,A,e.id),{...z(t),updatedAt:(0,l.serverTimestamp)()}),g({type:"success",message:"Role updated"}),y(null)}catch(e){(0,x.WL)("updateRole",g)(e)}},[A,g]),W=(0,n.useCallback)(async e=>{try{await (0,l.deleteDoc)((0,l.doc)(i.db,A,e.id)),g({type:"success",message:'Deleted "'.concat(e.name,'"')}),k(null)}catch(e){(0,x.WL)("deleteRole",g)(e)}},[A,g]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"studio-title",children:"Roles"}),(0,a.jsx)("p",{className:"studio-caption mt-0.5",children:"Named responsibility positions held by team members. Roles connect Members to the specific work (Projects, Tasks, Vendors) they're accountable for."})]}),(0,a.jsx)(u.$n,{onClick:()=>v(!0),icon:(0,a.jsx)(p.c1,{className:"w-4 h-4"}),children:"New Role"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)(u.pd,{value:C,onChange:e=>I(e.target.value),placeholder:"Search roles...",className:"max-w-xs"}),(0,a.jsxs)("div",{className:"studio-caption ml-auto",children:[U.length," ",1===U.length?"role":"roles"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(L,{label:"All",count:null!=(t=$.all)?t:0,active:"all"===S,onClick:()=>P("all")}),Object.keys(h.y).map(e=>{var t;return(0,a.jsx)(L,{label:h.y[e],count:null!=(t=$[e])?t:0,active:S===e,onClick:()=>P(e),colorClass:N[e]},e)})]}),D?(0,a.jsx)(u.y$,{}):0===U.length&&0===T.length?(0,a.jsx)(u.pp,{icon:(0,a.jsx)(p.K6,{className:"w-6 h-6 text-t3"}),heading:"No roles yet",description:"Roles connect your team to the work they're accountable for. Create your first one — e.g., 'Power Lead', 'Hospitality Lead', 'Build Coordinator'.",action:{label:"Create Role",onClick:()=>v(!0)}}):0===U.length?(0,a.jsx)(u.pp,{icon:(0,a.jsx)(p.K6,{className:"w-6 h-6 text-t3"}),heading:"No roles match",description:"Try a different filter or search."}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:U.map(e=>(0,a.jsx)(R,{role:e,onOpen:()=>d(e.id),onEdit:()=>y(e),onDelete:()=>k(e)},e.id))}),j&&(0,a.jsx)(E,{mode:"create",onSubmit:_,onClose:()=>v(!1)}),b&&(0,a.jsx)(E,{mode:"edit",initial:b,onSubmit:e=>M(b,e),onClose:()=>y(null)}),f&&(0,a.jsx)(u.TM,{open:!0,title:"Delete this role?",message:'"'.concat(f.name,'" will be removed. Any Projects or Tasks linked to it will keep working but lose the link.'),confirmLabel:"Delete role",confirmVariant:"danger",onConfirm:()=>W(f),onCancel:()=>k(null)})]})}function L(e){let{label:t,count:s,active:n,onClick:l,colorClass:i}=e;return(0,a.jsxs)("button",{onClick:l,className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs transition border ".concat(n?i||"bg-brand text-surface-base font-medium border-brand":"bg-white/[0.04] text-t2 border-white/[0.06] hover:bg-white/[0.08]"),children:[(0,a.jsx)("span",{children:t}),(0,a.jsx)("span",{className:"text-[10px] opacity-60",children:s})]})}function R(e){var t,s,n,l,i,r;let{role:c,onOpen:o,onEdit:d,onDelete:m}=e;return(0,a.jsxs)(u.Zp,{onClick:o,className:"p-3 space-y-2 hover:border-white/20 cursor-pointer transition-colors [content-visibility:auto] [contain-intrinsic-size:auto_200px]",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:c.name}),c.description&&(0,a.jsx)("p",{className:"studio-caption mt-1 line-clamp-2",children:c.description})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},className:"p-1 rounded hover:bg-white/[0.08] text-t3 hover:text-t1","aria-label":"Edit",children:(0,a.jsx)(p.R2,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),m()},className:"p-1 rounded hover:bg-white/[0.08] text-t3 hover:text-negative-ink","aria-label":"Delete",children:(0,a.jsx)(p.uc,{className:"w-3.5 h-3.5"})})]})]}
1),(0,a.jsx)("div",{children:(0,a.jsx)(u.Ex,{className:"".concat(N[c.category]," text-[10px] px-1.5 py-0"),children:h.y[c.category]})}),(0,a.jsxs)("div",{className:"studio-caption space-y-1.5 pt-1 border-t border-white/[0.04]",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-t3",children:"Lead"}),c.lead?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-t1",children:[(0,a.jsx)(v,{name:c.lead.name,photoURL:c.lead.photoURL,size:"sm"}),(0,a.jsx)("span",{children:c.lead.name})]}):(0,a.jsx)("span",{className:"text-t1",children:"—"})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-t3",children:"Support"}),0===c.support.length?(0,a.jsx)("span",{className:"text-t1",children:"—"}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-t1",children:[(0,a.jsx)(b,{members:c.support,size:"sm",max:4}),(0,a.jsx)("span",{className:"studio-caption",children:1===c.support.length?c.support[0].name:"".concat(c.support.length," members")})]})]}),(null!=(t=c.projectCount)?t:0)>0||(null!=(s=c.taskCount)?s:0)>0||(null!=(n=c.receiptCount)?n:0)>0?(0,a.jsxs)("div",{className:"studio-micro flex gap-3 pt-1",children:[(null!=(l=c.projectCount)?l:0)>0&&(0,a.jsxs)("span",{children:[c.projectCount," project",1===c.projectCount?"":"s"]}),(null!=(i=c.taskCount)?i:0)>0&&(0,a.jsxs)("span",{children:[c.taskCount," task",1===c.taskCount?"":"s"]}),(null!=(r=c.receiptCount)?r:0)>0&&(0,a.jsxs)("span",{children:[c.receiptCount," receipt",1===c.receiptCount?"":"s"]})]}):null,c.teamName&&(0,a.jsxs)("div",{className:"studio-micro pt-1 border-t border-white/[0.04]",children:["Team: ",(0,a.jsx)("span",{className:"text-t1",children:c.teamName})]})]})]})}function I(e){let{roleId:t,eventId:s,onBack:c}=e,{notify:o}
1=(0,r.Y)(),[m,g]=(0,n.useState)("overview"),[j,v]=(0,n.useState)(!1),[b,y]=(0,n.useState)(!1),f="events/".concat(s,"/roles"),{data:k,loading:C}=(0,d.L)("".concat(f,"/").concat(t),w);if(C&&!k)return(0,a.jsx)(u.y$,{});if(!k)return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(u.$n,{variant:"ghost",onClick:c,children:[(0,a.jsx)(p.YJ,{className:"w-4 h-4 mr-1"})," Back to Roles"]}),(0,a.jsx)(u.pp,{heading:"Role not found",description:"It may have been deleted. Go back and pick another."})]});let L=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(f,"/").concat(k.id)),{...z(e),updatedAt:(0,l.serverTimestamp)()}),v(!1)}catch(e){(0,x.WL)("update role",o)(e)}},R=async()=>{try{await (0,l.deleteDoc)((0,l.doc)(i.db,"".concat(f,"/").concat(k.id))),c()}catch(e){(0,x.WL)("delete role",o)(e)}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(u.$n,{variant:"ghost",onClick:c,children:[(0,a.jsx)(p.YJ,{className:"w-4 h-4 mr-1"})," Back to Roles"]}),(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("h1",{className:"studio-display truncate",children:k.name}),(0,a.jsx)(u.Ex,{className:"".concat(N[k.category]," text-[10px]"),children:h.y[k.category]}),k.teamName&&(0,a.jsxs)("span",{className:"studio-caption",children:["\xb7 Team ",k.teamName]})]}),k.description&&(0,a.jsx)("p",{className:"studio-caption mt-0.5",children:k.description})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,a.jsxs)(u.$n,{variant:"secondary",onClick:()=>v(!0),children:[(0,a.jsx)(p.R2,{className:"w-4 h-4 mr-1"})," Edit"]}),(0,a.jsx)(u.$n,{variant:"ghost",onClick:()=>y(!0),children:(0,a.jsx)(p.uc,{className:"w-4 h-4 mr-1 text-negative-ink"})})]})]}),(0,a.jsx)(u.tU,{tabs:[{value:"overview",label:"Overview"},{value:"projects",label:"Projects",count:k.projectCount},{value:"tasks",label:"Tasks",count:k.taskCount},{value:"receipts",label:"Receipts",count:k.receiptCount},{value:"vendors",label:"Vendors"},{value:"inventory",label:"Inventory"},{value:"schedule",label:"Schedule"},{value:"discussion",label:"Discussion"}],value:m,onChange:e=>g(e)}),"overview"===m&&(0,a.jsx)(S,{role:k}),"projects"===m&&(0,a.jsx)(P,{role:k,eventId:s}),"tasks"===m&&(0,a.jsx)(T,{role:k,eventId:s}),"receipts"===m&&(0,a.jsx)(D,{role:k,eventId:s}),"vendors"===m&&(0,a.jsx)(B,{role:k,eventId:s}),"inventory"===m&&(0,a.jsx)(U,{role:k,eventId:s}),"schedule"===m&&(0,a.jsx)($,{role:k,eventId:s}),"discussion"===m&&(0,a.jsx)(u.Zp,{className:"p-4",children:(0,a.jsx)(u.pr,{parentPath:"".concat(f,"/").concat(k.id)})}),j&&(0,a.jsx)(E,{mode:"edit",initial:k,onSubmit:L,onClose:()=>v(!1)}),b&&(0,a.jsx)(u.TM,{open:!0,title:"Delete role?",message:'"'.concat(k.name,'" will be removed. Linked Projects, Tasks, Receipts, Vendors, Inventory and Schedule items keep their data but lose the role reference.'),confirmLabel:"Delete",confirmVariant:"danger",onConfirm:R,onCancel:()=>y(!1)})]})}function S(e){var t,s,n;let{role:l}=e;return(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,a.jsxs)(u.Zp,{className:"p-4 space-y-2 md:col-span-2",children:[(0,a.jsx)("h3",{className:"studio-label",children:"Accountability"}),(0,a.jsxs)("div",{className:"studio-body space-y-1",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-t3",children:"Lead"}),l.lead?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-t1",children:[(0,a.jsx)(v,{name:l.lead.name,photoURL:l.lead.photoURL,size:"sm"}),(0,a.jsx)("span",{children:l.lead.name})]}):(0,a.jsx)("span",{className:"text-t1",children:"—"})]}),(0,a.jsxs)("div",{className:"flex justify-between items-start gap-2",children:[(0,a.jsx)("span",{className:"text-t3 shrink-0",children:"Support"}),0===l.support.length?(0,a.jsx)("span",{className:"text-t1",children:"—"}):(0,a.jsx)("div",{className:"flex flex-col gap-1 items-end",children:l.support.map((e,t)=>{var s;return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-t1",children:[(0,a.jsx)(v,{name:e.name,photoURL:e.ph
1otoURL,size:"sm"}),(0,a.jsx)("span",{children:e.name})]},null!=(s=e.id)?s:t)})})]}),l.teamName&&(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Team"}),(0,a.jsx)("span",{className:"text-t1",children:l.teamName})]})]}),l.description&&(0,a.jsxs)("div",{className:"pt-3 border-t border-white/[0.04]",children:[(0,a.jsx)("h3",{className:"studio-label mb-1",children:"Description"}),(0,a.jsx)("p",{className:"studio-body-strong whitespace-pre-wrap",children:l.description})]}),l.tags&&l.tags.length>0&&(0,a.jsxs)("div",{className:"pt-3 border-t border-white/[0.04]",children:[(0,a.jsx)("h3",{className:"studio-label mb-1",children:"Tags"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:l.tags.map((e,t)=>(0,a.jsx)(u.Ex,{className:"bg-white/[0.04] text-t2 border-white/[0.08] text-[10px]",children:e},t))})]}),l.notes&&(0,a.jsxs)("div",{className:"pt-3 border-t border-white/[0.04]",children:[(0,a.jsx)("h3",{className:"studio-label mb-1",children:"Notes"}),(0,a.jsx)("p",{className:"studio-body-strong whitespace-pre-wrap",children:l.notes})]})]}),(0,a.jsxs)(u.Zp,{className:"p-4 space-y-2",children:[(0,a.jsx)("h3",{className:"studio-label",children:"Rollups"}),(0,a.jsxs)("div",{className:"studio-body space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Projects"}),(0,a.jsx)("span",{className:"text-t1 font-medium",children:null!=(t=l.projectCount)?t:0})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Tasks"}),(0,a.jsx)("span",{className:"text-t1 font-medium",children:null!=(s=l.taskCount)?s:0})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Receipts"}),(0,a.jsx)("span",{className:"text-t1 font-medium",children:null!=(n=l.receiptCount)?n:0})]})]})]})]})}function P(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/projects"),{data:m,loading:p}=(0,o.$)(d,[],(e,t)=>({id:e,...t})),h=(0,n.useMemo)(()=>m.filter(e=>Array.isArray(e.roles)&&e.roles.some(e=>(null==e?void 0:e.id)===t.id)),[m,t.id]),j=(0,n.useMemo)(()=>new Set(h.map(e=>e.id)),[h]),v=async e=>{try{let s=(0,l.doc)(i.db,"".concat(d,"/").concat(e)),a=await (0,l.getDoc)(s);if(!a.exists())return;let n=Array.isArray(a.data().roles)?a.data().roles:[];if(n.some(e=>(null==e?void 0:e.id)===t.id))return;let r=[...n,f(t)];await (0,l.updateDoc)(s,{roles:r,updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link role to project",c)(e)}},b=(0,a.jsx)(g.LinkExistingButton,{label:"Link a project",title:"Link an existing project to this role",collectionPath:d,excludeIds:Array.from(j),getLabel:e=>e.name||"(unnamed)",getSubtitle:e=>{var t;return null!=(t=e.category)?t:null},onLink:v,multi:!0});return p?(0,a.jsx)(u.y$,{}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Projects this role works on",count:h.length,action:b}),0===h.length?(0,a.jsx)(u.pp,{heading:"No projects linked yet",description:"Use “Link a project” above to attach the projects this role is accountable for."}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:h.map(e=>(0,a.jsxs)(u.Zp,{className:"p-3 space-y-1",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:e.name}),e.category&&(0,a.jsx)("p",{className:"studio-micro capitalize",children:String(e.category).replaceAll("_"," ")})]},e.id))})]})}let A={not_started:"bg-white/[0.06] text-t2 border-white/[0.10]",in_progress:"bg-weaveBlue/15 text-weaveBlue border-weaveBlue/30",blocked:"bg-orange-500/15 text-orange-300 border-orange-500/30",done:"bg-emerald-500/15 text-positive-ink border-emerald-500/30",cancelled:"bg-red-500/15 text-negative-ink border-red-500/30"};function T(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/tasks"),m=(0,n.useMemo)(()=>[(0,l.where)("role.id","==",t.id)],[t.id]),{data:p,loading:h}=(0,o.$)(d,m,(e,t)=>({id:e,...t})),j=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(d,"/").concat(e)),{role:f(t),updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link task to role",c)(e)}},v=(0,a.jsx)(g.LinkExistingButton,{label:"Link a task",title:"Link an existing task to this role",collectionPath:d,excludeIds:p.map(e=>e.id),getLabel:e=>e.title||"(unnamed)",getSubtitle:e=>{var t;return null!=(t=e.status)?t:null},onLink:j,hint:"Tasks store a single role; linking overwrites any prior role on the task."});return h?(0,a.jsx)(u.y$,{}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Tasks owned by this role",count:p.length,action:v}),0===p.length?(0,a.jsx)(u.pp,{heading:"No tasks linked yet",description:"Use “Link a task” above, or create new ones in the Tasks tab."}):(0,a.jsx)("div",{className:"border border-white/[0.06] rounded-lg overflow-hidden",children:p.map(e=>{var t,s;return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-3 hover:bg-white/[0.02] border-b border-white/[0.04] last:border-b-0",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"studio-body-strong truncate",children:e.title}),(0,a.jsxs)("div",{className:"studio-micro flex flex-wrap items-center gap-x-2",children:[e.priority&&(0,a.jsx)("span",{className:"capitalize",children:String(e.priority)}),(null==(t=e.designated)?void 0:t.name)&&(0,a.jsxs)("span",{children:["\xb7 ",e.designated.name]}),e.targetDate&&(0,a.jsxs)("span",{children:["\xb7 ",(0,g.formatDate)(e.targetDate)]})]})]}
1),e.status&&(0,a.jsx)(u.Ex,{className:"".concat(null!=(s=A[e.status])?s:A.not_started," text-[10px] capitalize"),children:String(e.status).replaceAll("_"," ")})]},e.id)})})]})}function D(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/receipts"),m=(0,n.useMemo)(()=>[(0,l.where)("roleResponsible.id","==",t.id)],[t.id]),{data:p,loading:h}=(0,o.$)(d,m,(e,t)=>({id:e,...t})),j=(0,n.useMemo)(()=>{let e=0,t=0;for(let n of p){var s,a;e+=null!=(s=n.costCents)?s:0,t+=null!=(a=n.paidCents)?a:0}return{cost:e,paid:t,remaining:e-t}},[p]),v=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(d,"/").concat(e)),{roleResponsible:f(t),updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link receipt to role",c)(e)}},b=(0,a.jsx)(g.LinkExistingButton,{label:"Link a receipt",title:"Link an existing receipt to this role",collectionPath:d,excludeIds:p.map(e=>e.id),getLabel:e=>e.item||"(unnamed)",getSubtitle:e=>e.costCents?y(e.costCents):null,onLink:v,hint:"Create new receipts in the Receipts tab and pick this role at write-time."});return h?(0,a.jsx)(u.y$,{}):0===p.length?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Receipts this role is accountable for",action:b}),(0,a.jsx)(u.pp,{heading:"No receipts logged yet",description:"Use “Link a receipt” above, or create new ones in the Receipts tab."})]}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(g.PanelHeader,{heading:"Receipts this role is accountable for",count:p.length,action:b}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)(u.Zp,{className:"p-3",children:[(0,a.jsx)("div",{className:"studio-label",children:"Total Cost"}),(0,a.jsx)("div",{className:"text-lg text-t1 font-semibold",children:y(j.cost)})]}),(0,a.jsxs)(u.Zp,{className:"p-3",children:[(0,a.jsx)("div",{className:"studio-label",children:"Paid"}),(0,a.jsx)("div",{className:"text-lg text-positive-ink font-semibold",children:y(j.paid)})]}),(0,a.jsxs)(u.Zp,{className:"p-3",children:[(0,a.jsx)("div",{className:"studio-label",children:"Remaining"}),(0,a.jsx)("div",{className:"text-lg font-semibold ".concat(j.remaining>0?"text-orange-300":"text-t2"),children:y(j.remaining)})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:p.map(e=>(0,a.jsxs)(u.Zp,{className:"p-3 space-y-1.5",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:e.item}),(0,a.jsxs)("div",{className:"studio-caption flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Cost"}),(0,a.jsx)("span",{className:"text-t1",children:y(e.costCents)})]}),null!=e.paidCents&&e.paidCents>0&&(0,a.jsxs)("div",{className:"studio-caption flex justify-between",children:[(0,a.jsx)("span",{className:"text-t3",children:"Paid"}),(0,a.jsx)("span",{className:"text-positive-ink",children:y(e.paidCents)})]})]},e.id))})]})}function B(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/vendors"),m=(0,n.useMemo)(()=>[(0,l.where)("roleResponsible.id","==",t.id)],[t.id]),{data:p,loading:h}=(0,o.$)(d,m,(e,t)=>({id:e,...t})),j=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(d,"/").concat(e)),{roleResponsible:f(t),updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link vendor to role",c)(e)}},v=(0,a.jsx)(g.LinkExistingButton,{label:"Link a vendor",title:"Link an existing vendor to this role",collectionPath:d,excludeIds:p.map(e=>e.id),getLabel:e=>e.name||"(unnamed)",getSubtitle:e=>{var t;return null!=(t=e.service)?t:null},onLink:j,hint:"Vendors store a single accountable role; linking overwrites any prior."});return h?(0,a.jsx)(u.y$,{}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Vendors this role is accountable for",count:p.length,action:v}),0===p.length?(0,a.jsx)(u.pp,{heading:"No vendors linked yet",description:"Use “Link a vendor” above to attach the vendors this role manages."}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:p.map(e=>(0,a.jsxs)(u.Zp,{className:"p-3 space-y-1",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:e.name}),e.service&&(0,a.jsx)("p",{className:"studio-caption truncate",children:e.service}),e.status&&(0,a.jsx)("p",{className:"studio-micro capitalize",children:String(e.status).replaceAll("_"," ")})]},e.id))})]})}function U(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/inventory"),m=(0,n.useMemo)(()=>[(0,l.where)("roleResponsible.id","==",t.id)],[t.id]),{data:p,loading:h}=(0,o.$)(d,m,(e,t)=>({id:e,...t})),j=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(d,"/").concat(e)),{roleResponsible:f(t),updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link inventory to role",c)(e)}},v=(0,a.jsx)(g.LinkExistingButton,{label:"Link an inventory item",title:"Link an existing inventory item to this role",collectionPath:d,excludeIds:p.map(e=>e.id),getLabel:e=>e.name||"(unnamed)",getSubtitle:e=>{var t;return null!=(t=e.category)?t:null},onLink:j,hint:"Inventory items store a single accountable role; linking overwrites any prior."});return h?(0,a.jsx)(u.y$,{}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Inventory this role is accountable for",count:p.length,action:v}),0===p.length?(0,a.jsx)(u.pp,{heading:"No inventory linked yet",description:"Use “Link an inventory item” above to attach inventory this role manages."}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:p.map(e=>(0,a.jsxs)(u.Zp,{className:"p-3 space-y-1",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:e.name}),e.category&&(0,a.jsx)("p",{className:"studio-micro capitalize",children:String(e.category).replaceAll("_"," ")}),null!=e.quantity&&(0,a.jsxs)("p",{className:"studio-caption",children:["Qty: ",(0,a.jsx)("span",{className:"text-t2 tabular-nums",children:e.quantity})]})]},e.id))})]})}function $(e){let{role:t,eventId:s}=e,{notify:c}=(0,r.Y)(),d="events/".concat(s,"/scheduleItems"),m=(0,n.useMemo)(()=>[(0,l.where)("roleResponsible.id","==",t.id)],[t.id]),{data:p,loading:h}=(0,o.$)(d,m,(e,t)=>({id:e,...t})),j=async e=>{try{await (0,l.updateDoc)((0,l.doc)(i.db,"".concat(d,"/").concat(e)),{roleResponsible:f(t),updatedAt:(0,l.serverTimestamp)()})}catch(e){(0,x.WL)("link schedule item to role",c)(e)}},v=(0,a.jsx)(g.LinkExistingButton,{label:"Link a schedule item",title:"Link an existing schedule item to this role",collectionPath:d,excludeIds:p.map(e=>e.id),getLabel:e=>e.title||"(untitled)",getSubtitle:e=>{var t;return null!=(t=e.category)?t:null},onLink:j,hint:"Schedule items store a single accountable role; linking overwrites any prior."});if(h)return(0,a.jsx)(u.y$,{});let b=[...p].sort((e,t)=>
1{var s,a,n,l,i,r;return(null!=(i=null==(a=e.startTime)||null==(s=a.toMillis)?void 0:s.call(a))?i:0)-(null!=(r=null==(l=t.startTime)||null==(n=l.toMillis)?void 0:n.call(l))?r:0)});return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(g.PanelHeader,{heading:"Schedule items this role owns",count:p.length,action:v}),0===b.length?(0,a.jsx)(u.pp,{heading:"No schedule items linked yet",description:"Use “Link a schedule item” above to attach run-of-show items this role owns."}):(0,a.jsx)("div",{className:"space-y-2",children:b.map(e=>(0,a.jsxs)(u.Zp,{className:"p-3 flex items-start gap-3",children:[(0,a.jsx)("div",{className:"studio-caption w-28 shrink-0",children:e.startTime?(0,g.formatDate)(e.startTime):"—"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"studio-body-strong truncate",children:e.title}),(0,a.jsxs)("div",{className:"studio-caption flex items-center gap-2",children:[e.status&&(0,a.jsx)("span",{className:"capitalize",children:String(e.status).replaceAll("_"," ")}),e.category&&(0,a.jsxs)("span",{children:["\xb7 ",e.category]})]})]})]},e.id))})]})}let _={name:"",description:"",category:"admin_finance",lead:null,support:[],teamId:void 0,teamName:void 0,notes:"",tagsInput:""};function z(e){var t,s,a;let n=e.tagsInput.split(",").map(e=>e.trim()).filter(e=>e.length>0);return{name:e.name,description:e.description||null,category:e.category,lead:null!=(t=e.lead)?t:null,support:e.support,teamId:null!=(s=e.teamId)?s:null,teamName:null!=(a=e.teamName)?a:null,notes:e.notes||null,tags:n}}function E(e){var t,s,l,i,r;let{mode:o,initial:d,onSubmit:m,onClose:x}
1=e,[j,v]=(0,n.useState)(d?{name:d.name,description:null!=(s=d.description)?s:"",category:d.category,lead:null!=(l=d.lead)?l:null,support:d.support,teamId:d.teamId,teamName:d.teamName,notes:null!=(i=d.notes)?i:"",tagsInput:(null!=(r=d.tags)?r:[]).join(", ")}:_),[b,N]=(0,n.useState)(!1),y=function(){let{eventData:e}=(0,c._)();return(0,n.useMemo)(()=>{let t=[];return(null==e?void 0:e.organizerId)&&e.organizerName&&t.push({id:e.organizerId,name:e.organizerName,role:"Host"}),(null==e?void 0:e.staff)&&Object.entries(e.staff).forEach(s=>{var a;let[n,l]=s;n!==e.organizerId&&t.push({id:n,name:null!=(a=l.name)?a:n,role:l.role})}),t},[e])}(),{eventId:f}=(0,c._)(),w=(e,t)=>{v(s=>({...s,[e]:t}))},k=async()=>{if(j.name.trim()){N(!0);try{await m(j)}finally{N(!1)}}};return(0,a.jsx)(u.aF,{open:!0,onClose:x,size:"lg",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsx)("h2",{className:"studio-subtitle",children:"create"===o?"New Role":"Edit Role"}),(0,a.jsx)("button",{onClick:x,className:"text-t3 hover:text-t1 p-1","aria-label":"Close",children:(0,a.jsx)(p.fK,{className:"w-5 h-5"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Name *"}),(0,a.jsx)(u.pd,{value:j.name,onChange:e=>w("name",e.target.value),placeholder:"e.g. Power Lead, Hospitality Lead, Build Coordinator",autoFocus:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Description"}),(0,a.jsx)("textarea",{value:j.description,onChange:e=>w("description",e.target.value),placeholder:"What does this role own? What's the scope of responsibility?",rows:3,className:"w-full bg-card border border-card rounded-md px-3 py-2 text-sm text-t1 placeholder:text-t3/60 resize-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Category"}),(0,a.jsx)("select",{value:j.category,onChange:e=>w("category",e.target.value),className:"w-full bg-card border border-card rounded-md px-3 py-2 text-sm text-t1",children:Object.keys(h.y).map(e=>(0,a.jsx)("option",{value:e,children:h.y[e]},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Lead"}),(0,a.jsx)(M,{members:y,value:j.lead,onChange:e=>w("lead",e),placeholder:"Pick the primary accountable member"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"studio-caption block mb-1",children:["Support members (",j.support.length,")"]}),(0,a.jsx)(W,{members:y,value:j.support,onChange:e=>w("support",e),excludeIds:(null==(t=j.lead)?void 0:t.id)?[j.lead.id]:[]})]}),f&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Team (which crew owns this role)"}),(0,a.jsx)(g.TeamSinglePicker,{eventId:f,value:j.teamId,onChange:(e,t)=>
1{w("teamId",null!=e?e:void 0),w("teamName",null!=t?t:void 0)}})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Tags (comma-separated)"}),(0,a.jsx)(u.pd,{value:j.tagsInput,onChange:e=>w("tagsInput",e.target.value),placeholder:"critical, build-week, vendor-facing"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"studio-caption block mb-1",children:"Notes"}),(0,a.jsx)("textarea",{value:j.notes,onChange:e=>w("notes",e.target.value),placeholder:"Additional context, expectations, references",rows:3,className:"w-full bg-card border border-card rounded-md px-3 py-2 text-sm text-t1 placeholder:text-t3/60 resize-none"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-3 border-t border-white/[0.04]",children:[(0,a.jsx)(u.$n,{variant:"ghost",onClick:x,children:"Cancel"}),(0,a.jsx)(u.$n,{onClick:k,disabled:!j.name.trim()||b,children:b?"Saving…":"create"===o?"Create Role":"Save Changes"})]})]})})}function M(e){var t,s;let{members:n,value:l,onChange:i,placeholder:r}=e;return 0===n.length?(0,a.jsx)(u.pd,{value:null!=(t=null==l?void 0:l.name)?t:"",onChange:e=>i(e.target.value?{name:e.target.value}:null),placeholder:r}):(0,a.jsxs)("select",{value:null!=(s=null==l?void 0:l.id)?s:"",onChange:e=>{var t;let s=e.target.value;if(!s)return void i(null);let a=n.find(e=>e.id===s);a&&i({id:a.id,name:a.name,photoURL:null!=(t=a.photoURL)?t:null})},className:"w-full bg-card border border-card rounded-md px-3 py-2 text-sm text-t1",children:[(0,a.jsx)("option",{value:"",children:"— none —"}),n.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.name,e.role?" \xb7 ".concat(e.role):""]},e.id))]})}function W(e){let{members:t,value:s,onChange:l,excludeIds:i}=e,[r,c]=(0,n.useState)(!1),o=(0,n.useRef)(null),d=new Set(null!=i?i:[]),m=new Set(s.filter(e=>e.id).map(e=>e.id));(0,n.useEffect)(()=>{if(!r)return;let e=e=>{o.current&&!o.current.contains(e.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]);let x=t.filter(e=>!d.has(e.id)&&!m.has(e.id));return(0,a.jsxs)("div",{className:"space-y-2",ref:o,children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px]",children:[s.map((e,t)=>{var n;return(0,a.jsxs)(u.Ex,{className:"bg-white/10 text-t2 text-xs flex items-center gap-1",children:[e.name,(0,a.jsx)("button",{onClick:()=>l(s.filter((e,s)=>s!==t)),className:"hover:text-negative-ink","aria-label":"Remove",children:(0,a.jsx)(p.fK,{className:"w-3 h-3"})})]},null!=(n=e.id)?n:t)}),0===s.length&&(0,a.jsx)("span",{className:"studio-caption italic",children:"No support members yet"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>c(!r),className:"w-full text-left bg-card border border-card rounded-md px-3 py-2 text-sm text-t2 hover:bg-white/[0.06] flex items-center justify-between",disabled:0===x.length,children:[0===x.length?"All available members added":"+ Add support member",x.length>0&&(0,a.jsx)(p.D3,{className:"w-4 h-4 opacity-60"})]}),r&&x.length>0&&(0,a.jsx)("div",{className:"absolute z-20 mt-1 left-0 right-0 bg-card border border-card rounded-md shadow-lg max-h-60 overflow-y-auto py-1",children:x.map(e=>(0,a.jsxs)("button",{onClick:()=>{var t;l([...s,{id:e.id,name:e.name,photoURL:null!=(t=e.photoURL)?t:null}]),c(!1)},className:"w-full text-left px-3 py-1.5 text-sm text-t2 hover:bg-white/[0.04]",children:[e.name,e.role&&(0,a.jsxs)("span",{className:"text-t3 text-xs ml-2",children:["\xb7 ",e.role]})]},e.id))})]})]})}}}]);

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.