PageSourceSearch

https://rastyle.co.ke/static/js/1405.d547be86.chunk.js

js rastyle.co.ke collected 2026-10-08 04:26:06 UTC 56,198 bytes, 3 lines download raw bytes

1/*! For license information please see 1405.d547be86.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkfrontend||=[]).push([[1405],{61405(e,t,a){a.r(t),a.d(t,{default:()=>se});var r=a(49198),s=a(73145),i=a(45753),l=a(10218),o=a(30924),n=a(17146),d=a(47422),c=a(80361),m=a(24165),u=a(47978),p=a(11971),x=a(90407),h=a(89643),b=a(66331),g=a(19933),v=a(54424),f=a(25998),j=a(54235);const y=(0,j.A)("percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);var w=a(94183),N=a(43535),k=a(34199),_=a(44279),C=a(80366),A=a(21439),S=a(9667),R=a(99520),$=a(12465),P=a(1007),B=a(66703),z=a(66638),M=a(90886),T=a(85399),q=a(85582);const D="https://rastyle.co.ke",I=[{id:"deejay",label:"Deejay"},{id:"artist",label:"Artist"},{id:"mc",label:"MC"},{id:"producer",label:"Producer"},{id:"photographer",label:"Photographer"},{id:"videographer",label:"Videographer"},{id:"designer",label:"Designer"},{id:"promoter",label:"Promoter"},{id:"influencer",label:"Influencer"},{id:"podcaster",label:"Podcaster"},{id:"radio_host",label:"Radio Host"},{id:"blogger",label:"Blogger / Editor"},{id:"curator",label:"Curator"},{id:"event_host",label:"Event Host"},{id:"radio_station",label:"Radio Station"},{id:"record_label",label:"Record Label"},{id:"venue",label:"Venue"}],L=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],U=e=>(Array.isArray(e)?e:String(e||"").split(",")).map(e=>String(e).trim()).filter(Boolean).join(", "),E=e=>{var t,a,s,i,l,o,n,d,c,m,u,p,x,h,b,v;let{creator:f,token:j,onSaved:y}=e;const[k,E]=(0,r.useState)(f.roles||f.tags||[]),[F,O]=(0,r.useState)(f.display_name||""),[V,W]=(0,r.useState)(f.country||""),[H,K]=(0,r.useState)(f.city||""),[G,J]=(0,r.useState)(f.phone||""),[Y,Q]=(0,r.useState)(f.primary_role||(null===(t=f.roles)||void 0===t?void 0:t[0])||(null===(a=f.tags)||void 0===a?void 0:a[0])||""),[X,Z]=(0,r.useState)((f.aliases||[]).join(", ")),[ee,te]=(0,r.useState)(f.tagline||""),[ae,re]=(0,r.useState)(f.years_active||""),[se,ie]=(0,r.useState)(f.booking_rate_kes||""),[le,oe]=(0,r.useState)(f.whatsapp_booking||""),[ne,de]=(0,r.useState)(f.hometown||""),[ce,me]=(0,r.useState)(f.residencies||[]),[ue,pe]=(0,r.useState)(f.signature_tracks||[]),[xe,he]=(0,r.useState)(U(f.genres)),[be,ge]=(0,r.useState)(U(f.languages)),[ve,fe]=(0,r.useState)(f.bio||""),[je,ye]=(0,r.useState)(f.profile_image||""),[we,Ne]=(0,r.useState)(f.cover_image||""),[ke,_e]=(0,r.useState)(f.image_sources||{}),[Ce,Ae]=(0,r.useState)(f.image_variants||{}),[Se,Re]=(0,r.useState)(""),[$e,Pe]=(0,r.useState)(""),[Be,ze]=(0,r.useState)({profile:null,cover:null}),[Me,Te]=(0,r.useState)(f.website||""),[qe,De]=(0,r.useState)(f.radio_stream_url||""),[Ie,Le]=(0,r.useState)(f.shopify_store_url||""),[Ue,Ee]=(0,r.useState)((null===(s=f.venue_info)||void 0===s?void 0:s.venue_type)||""),[Fe,Oe]=(0,r.useState)((null===(i=f.venue_info)||void 0===i?void 0:i.address)||""),[Ve,We]=(0,r.useState)(null!==(l=null===(o=f.venue_info)||void 0===o?void 0:o.capacity)&&void 0!==l?l:""),[He,Ke]=(0,r.useState)({instagram:(null===(n=f.socials)||void 0===n?void 0:n.instagram)||"",facebook:(null===(d=f.socials)||void 0===d?void 0:d.facebook)||"",twitter:(null===(c=f.socials)||void 0===c?void 0:c.twitter)||"",youtube_channel:(null===(m=f.socials)||void 0===m?void 0:m.youtube_channel)||"",spotify_artist_id:(null===(u=f.socials)||void 0===u?void 0:u.spotify_artist_id)||"",hearthis_username:(null===(p=f.socials)||void 0===p?void 0:p.hearthis_username)||"",soundcloud:(null===(x=f.socials)||void 0===x?void 0:x.soundcloud)||"",tiktok:(null===(h=f.socials)||void 0===h?void 0:h.tiktok)||""}),[Ge,Je]=(0,r.useState)(!1),Ye=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t){Re(e);try{const r=new FormData;r.append("file",t),a.sourceFile&&r.append("source_file",a.sourceFile);const s=await w.A.post(`${D}/api/admin/creators/${f.creator_id}/media?kind=${encodeURIComponent(e)}`,r,{headers:{Authorization:`Bearer ${j}`}});"cover"===e?Ne(s.data.url):ye(s.data.url),_e(t=>({...t,[e]:s.data.source_url})),Ae(t=>{var a;return{...t,[e]:(null===(a=s.data.media)||void 0===a?void 0:a.variants)||{}}}),N.oR.success(("cover"===e?"Cover":"Profile")+" image cropped and saved")}catch(i){var r,s;N.oR.error((null===(r=i.response)||void 0===r||null===(s=r.data)||void 0===s?void 0:s.detail)||i.message||"Image upload failed")}finally{Re("")}}},Qe=(e,t,a)=>me(r=>r.map((r,s)=>s===e?{...r,[t]:a}:r)),Xe=(e,t,a)=>pe(r=>r.map((r,s)=>s===e?{...r,[t]:a}:r));return(0,q.jsxs)("div",{className:"border-t border-white/10 pt-6 space-y-5","data-testid":"creator-profile-editor",children:[(0,q.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,q.jsxs)("h4",{className:"font-heading font-bold text-base flex items-center gap-2",children:[(0,q.jsx)(_.A,{className:"w-4 h-4 text-primary"})," Canonical Creator Profile"]}),(0,q.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-zinc-500 font-mono",children:"Public on /creator/:slug"})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Display Name"}),(0,q.jsx)("input",{value:F,onChange:e=>O(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-display-name"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Phone"}),(0,q.jsx)("input",{value:G,onChange:e=>J(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-phone"})]})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 block",children:"Creator Roles"}),(0,q.jsx)("div",{className:"flex flex-wrap gap-1.5",children:I.map(e=>(0,q.jsx)("button",{type:"button",onClick:()=>{return t=e.id,void E(e=>{const a=e.includes(t)?e.filter(e=>e!==t):[...e,t];return a.length&&!a.includes(Y)&&Q(a[0]),a});var t},className:"px-2.5 py-1 text-xs rounded-sm border transition-colors "+(k.includes(e.id)?"bg-primary text-black border-primary font-bold":"bg-white/5 border-white/10 text-zinc-400 hover:border-white/30"),"data-testid":`tag-toggle-${e.id}`,children:e.label},e.id))})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Primary Role"}),(0,q.jsx)("select",{value:Y,onChange:e=>Q(e.target.value),disabled:0===k.length,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-primary-role",children:(k.length?I.filter(e=>k.includes(e.id)):I).map(e=>(0,q.jsx)("option",{value:e.id,children:e.label},e.id))})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Aliases (comma-separated)"}),(0,q.jsx)("input",{value:X,onChange:e=>Z(e.target.value),placeholder:"Former stage name, alternate spelling",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-aliases"})]})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Tagline"}),(0,q.jsx)("input",{value:ee,onChange:e=>te(e.target.value),placeholder:"Sound system selector. One Love.",maxLength:140,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm focus:outline-none focus:border-primary/60","data-testid":"profile-tagline"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Artist Bio"}),(0,q.jsx)("textarea",{value:ve,onChange:e=>fe(e.target.value),placeholder:"Biography, creative journey, influences and current work\u2026",rows:5,maxLength:4e3,className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm focus:outline-none focus:border-primary/60 resize-y","data-testid":"profile-bio"})]}),(0,q.jsxs)("div",{className:"space-y-4 rounded-xl border border-primary/20 bg-primary/[0.04] p-4","data-testid":"admin-creator-image-studio",children:[(0,q.jsxs)("div",{children:[(0,q.jsxs)("h5",{className:"flex items-center gap-2 text-sm font-bold",children:[(0,q.jsx)(C.A,{className:"h-4 w-4 text-primary"})," Creator image studio"]}),(0,q.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Upload, select, crop, recrop or reposition profile and cover images. The full source is kept for future edits."})]}),(0,q.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,q.jsx)(M.Ay,{kind:"profile",label:"Profile image",value:je,recropSourceUrl:ke.profile||(null===(b=Ce.profile)||void 0===b?void 0:b.original)||je,selectedSource:Be.profile,uploading:"profile"===Se,onFileChange:(e,t,a)=>t?N.oR.error(t):Ye("profile",e,a),onOpenLibrary:()=>Pe("profile"),onClear:()=>ye(""),testIdPrefix:"admin-creator"}),(0,q.jsx)(M.Ay,{kind:"cover",label:"Cover image",value:we,recropSourceUrl:ke.cover||(null===(v=Ce.cover)||void 0===v?void 0:v.original)||we,selectedSource:Be.cover,uploading:"cover"===Se,onFileChange:(e,t,a)=>t?N.oR.error(t):Ye("cover",e,a),onOpenLibrary:()=>Pe("cover"),onClear:()=>Ne(""),testIdPrefix:"admin-creator"})]}),(0,q.jsxs)("details",{className:"rounded border border-white/10 p-3",children:[(0,q.jsx)("summary",{className:"cursor-pointer text-xs font-bold text-muted-foreground",children:"Advanced: use existing image URLs"}),(0,q.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,q.jsxs)("label",{className:"text-xs text-muted-foreground",children:["Profile image URL",(0,q.jsx)("input",{value:je,onChange:e=>ye(e.target.value),className:"mt-1 w-full rounded-sm border border-white/10 bg-white/5 px-3 py-2 text-sm text-white","data-testid":"profile-image"})]}),(0,q.jsxs)("label",{className:"text-xs text-muted-foreground",children:["Cover image URL",(0,q.jsx)("input",{value:we,onChange:e=>Ne(e.target.value),className:"mt-1 w-full rounded-sm border border-white/10 bg-white/5 px-3 py-2 text-sm text-white","data-testid":"profile-cover"})]})]})]})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Country"}),(0,q.jsx)("input",{value:V,onChange:e=>W(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-country"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"City"}),(0,q.jsx)("input",{value:H,onChange:e=>K(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-city"})]}),(0,q.jsxs)("div",{children:[(0,q.jsxs)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block flex items-center gap-1",children:[(0,q.jsx)(A.A,{className:"w-3 h-3"})," Hometown"]}),(0,q.jsx)("input",{value:ne,onChange:e=>de(e.target.value),placeholder:"Nairobi",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-hometown"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Years Active"}),(0,q.jsx)("input",{type:"number",min:"0",max:"60",value:ae,onChange:e=>re(e.target.value),placeholder:"5",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-years"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Booking Rate (KES)"}),(0,q.jsx)("input",{type:"number",min:"0",value:se,onChange:e=>ie(e.target.value),placeholder:"25000",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-rate"})]})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsxs)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block flex items-center gap-1",children:[(0,q.jsx)(S.A,{className:"w-3 h-3"})," WhatsApp Booking (E.164)"]}),(0,q.jsx)("input",{value:le,onChange:e=>oe(e.target.value),placeholder:"254712345678",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm font-mono","data-testid":"profile-whatsapp"})]}),(0,q.jsxs)("div",{children:[(0,q.jsxs)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block flex items-center gap-1",children:[(0,q.jsx)(R.A,{className:"w-3 h-3"})," Genres (comma-separated)"]}),(0,q.jsx)("input",{value:xe,onChange:e=>he(e.target.value),placeholder:"Roots Reggae, Dancehall, Afrobeats",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-genres"})]})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Languages (comma-separated)"}),(0,q.jsx)("input",{value:be,onChange:e=>ge(e.target.value),placeholder:"Swahili, English",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-languages"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Website"}),(0,q.jsx)("input",{value:Me,onChange:e=>Te(e.target.value),placeholder:"https://\u2026",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm","data-testid":"profile-website"})]})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 block",children:"Social Profiles"}),(0,q.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-2",children:Object.entries(He).map(e=>
2{let[t,a]=e;return(0,q.jsx)("input",{value:a,onChange:e=>Ke(a=>({...a,[t]:e.target.value})),placeholder:t.replace("_"," "),"aria-label":t.replace("_"," "),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"},t)})})]}),(0,q.jsxs)("div",{className:"grid sm:grid-cols-2 gap-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Radio Stream URL"}),(0,q.jsx)("input",{value:qe,onChange:e=>De(e.target.value),placeholder:"https://\u2026",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Store URL"}),(0,q.jsx)("input",{value:Ie,onChange:e=>Le(e.target.value),placeholder:"https://\u2026",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"})]})]}),k.includes("venue")&&(0,q.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3 rounded border border-white/10 p-3",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Venue Type"}),(0,q.jsx)("input",{value:Ue,onChange:e=>Ee(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Address"}),(0,q.jsx)("input",{value:Fe,onChange:e=>Oe(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground mb-1 block",children:"Capacity"}),(0,q.jsx)("input",{type:"number",min:"0",value:Ve,onChange:e=>We(e.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-sm text-sm"})]})]}),(0,q.jsxs)("div",{children:[(0,q.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,q.jsxs)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground flex items-center gap-1",children:[(0,q.jsx)($.A,{className:"w-3 h-3"})," Residencies"]}),(0,q.jsxs)("button",{type:"button",onClick:()=>me(e=>[...e,{venue_name:"",day_of_week:"Friday",time:"21:00",recurring:!0}]),className:"inline-flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-primary hover:text-primary/80","data-testid":"add-residency",children:[(0,q.jsx)(P.A,{className:"w-3 h-3"})," Add"]})]}),(0,q.jsxs)("div",{className:"space-y-2",children:[0===ce.length&&(0,q.jsx)("p",{className:"text-xs text-zinc-500 italic",children:"No residencies yet."}),ce.map((e,t)=>(0,q.jsxs)("div",{className:"grid grid-cols-12 gap-2 items-center",children:[(0,q.jsx)("input",{value:e.venue_name,onChange:e=>Qe(t,"venue_name",e.target.value),placeholder:"Venue name",className:"col-span-5 px-2 py-1.5 bg-white/5 border border-white/10 rounded-sm text-xs"}),(0,q.jsx)("select",{value:e.day_of_week,onChange:e=>Qe(t,"day_of_week",e.target.value),className:"col-span-3 px-2 py-1.5 bg-white/5 border border-white/10 rounded-sm text-xs",children:L.map(e=>(0,q.jsx)("option",{value:e,children:e},e))}),(0,q.jsx)("input",{type:"time",value:e.time,onChange:e=>Qe(t,"time",e.target.value),className:"col-span-3 px-2 py-1.5 bg-white/5 border border-white/10 rounded-sm text-xs font-mono"}),(0,q.jsx)("button",{type:"button",onClick:()=>(e=>me(t=>t.filter((t,a)=>a!==e)))(t),className:"col-span-1 p-1.5 hover:bg-red-500/10 text-red-400 rounded-sm transition-colors",children:(0,q.jsx)(B.A,{className:"w-3.5 h-3.5"})})]},t))]})]}),(0,q.jsxs)("div",{children:[(0,q.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,q.jsx)("label",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature Tracks"}),(0,q.jsxs)("button",{type:"button",onClick:()=>pe(e=>[...e,{title:"",link:""}]),className:"inline-flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-primary hover:text-primary/80","data-testid":"add-track",children:[(0,q.jsx)(P.A,{className:"w-3 h-3"})," Add"]})]}),(0,q.jsxs)("div",{className:"space-y-2",children:[0===ue.length&&(0,q.jsx)("p",{className:"text-xs text-zinc-500 italic",children:"No signature tracks yet."}),ue.map((e,t)=>(0,q.jsxs)("div",{className:"grid grid-cols-12 gap-2 items-center",children:[(0,q.jsx)("input",{value:e.title,onChange:e=>Xe(t,"title",e.target.value),placeholder:"Track title",className:"col-span-5 px-2 py-1.5 bg-white/5 border border-white/10 rounded-sm text-xs"}),(0,q.jsx)("input",{value:e.link,onChange:e=>Xe(t,"link",e.target.value),placeholder:"https://hearthis.at/\u2026",className:"col-span-6 px-2 py-1.5 bg-white/5 border border-white/10 rounded-sm text-xs"}),(0,q.jsx)("button",{type:"button",onClick:()=>(e=>pe(t=>t.filter((t,a)=>a!==e)))(t),className:"col-span-1 p-1.5 hover:bg-red-500/10 text-red-400 rounded-sm transition-colors",children:(0,q.jsx)(B.A,{className:"w-3.5 h-3.5"})})]},t))]})]}),(0,q.jsx)("div",{className:"flex justify-end pt-2",children:(0,q.jsxs)("button",{type:"button",onClick:async()=>
2{if(Y&&k.includes(Y)){Je(!0);try{const e={display_name:F,tags:k,roles:k,primary_role:Y,aliases:X.split(",").map(e=>e.trim()).filter(Boolean),tagline:ee,hometown:ne,whatsapp_booking:le,residencies:ce.filter(e=>{var t;return null===(t=e.venue_name)||void 0===t?void 0:t.trim()}),signature_tracks:ue.filter(e=>{var t;return null===(t=e.title)||void 0===t?void 0:t.trim()}),genres:xe.split(",").map(e=>e.trim()).filter(Boolean),languages:be.split(",").map(e=>e.trim()).filter(Boolean),bio:ve,profile_image:je,cover_image:we,website:Me,country:V,city:H,phone:G,radio_stream_url:qe,shopify_store_url:Ie,venue_info:{venue_type:Ue,address:Fe,...""===Ve?{}:{capacity:Number(Ve)}},socials:He};""!==ae&&(e.years_active=Number(ae)),""!==se&&(e.booking_rate_kes=Number(se)),await w.A.patch(`${D}/api/admin/creators/${f.creator_id}/profile`,e,{headers:{Authorization:`Bearer ${j}`}}),N.oR.success("Directory profile saved"),y&&y()}catch(a){var e,t;N.oR.error((null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Save failed")}finally{Je(!1)}}else N.oR.error("Choose one selected category as the primary creator category")},disabled:Ge,className:"inline-flex items-center gap-2 px-4 py-2 bg-primary text-black font-bold rounded-sm hover:opacity-90 transition-opacity disabled:opacity-60 text-sm","data-testid":"save-profile-btn",children:[Ge?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):(0,q.jsx)(z.A,{className:"w-4 h-4"}),"Save Directory Profile"]})}),$e&&(0,q.jsx)("div",{className:"fixed inset-0 z-[95] overflow-auto bg-black/85 p-4 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":"Select creator image",children:(0,q.jsxs)("div",{className:"mx-auto max-w-6xl rounded-xl border border-white/15 bg-zinc-950 p-4 sm:p-6",children:[(0,q.jsxs)("div",{className:"mb-5 flex items-start justify-between gap-4",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("p",{className:"text-xs font-bold uppercase tracking-[0.2em] text-primary",children:"Admin media storage"}),(0,q.jsx)("h3",{className:"mt-1 text-xl font-black",children:"Choose a source to crop"})]}),(0,q.jsx)("button",{type:"button",onClick:()=>Pe(""),className:"rounded-full border border-white/15 p-2","aria-label":"Close media library",children:(0,q.jsx)(B.A,{className:"h-5 w-5"})})]}),(0,q.jsx)(T.A,{adminToken:j,selectionMode:!0,onSelect:e=>{var t;const a=$e,r=e.source_url||(null===(t=e.variants)||void 0===t?void 0:t.original)||e.url;ze(t=>({...t,[a]:{id:e.id,name:e.original_name,url:r,selectionId:Date.now()}})),Pe("")}})]})})]})};var F=a(8548);const O=(0,j.A)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var V=a(49406);const W="https://rastyle.co.ke",H=e=>{let{token:t,onChanged:a}=e;const[s,i]=(0,r.useState)(null),[l,o]=(0,r.useState)(!0),[n,d]=(0,r.useState)(""),[c,m]=(0,r.useState)({}),u=(0,r.useMemo)(()=>({Authorization:`Bearer ${t}`}),[t]),x=(0,r.useCallback)(async()=>{o(!0);try{const e=await w.A.get(`${W}/api/admin/creator-identities/audit`,{headers:u});i(e.data),m(t=>{var a;const r={...t};return((null===(a=e.data)||void 0===a?void 0:a.duplicate_groups)||[]).forEach(e=>{var t,a;r[e.key]||(r[e.key]=null===(t=e.creators)||void 0===t||null===(a=t[0])||void 0===a?void 0:a.creator_id)}),r})}catch(a){var e,t;N.oR.error((null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Could not audit creator identities")}finally{o(!1)}},[u]);(0,r.useEffect)(()=>{x()},[x]);if(l&&!s)return(0,q.jsxs)("section",{className:"border border-white/10 bg-card rounded-sm p-5 flex items-center gap-3",role:"status",children:[(0,q.jsx)(g.A,{className:"w-5 h-5 animate-spin text-primary"}),"Auditing Creator identity\u2026"]});if(!s)return null;const h=0===s.missing_roles&&0===s.missing_slug&&0===s.duplicate_group_count;return(0,q.jsxs)("section",{className:"border border-white/10 bg-card rounded-sm p-5 space-y-4","data-testid":"creator-identity-audit",children:[(0,q.jsxs)("div",{className:"flex flex-wrap items-start gap-3",children:[(0,q.jsx)("div",{className:"w-10 h-10 rounded-sm flex items-center justify-center "+(h?"bg-emerald-500/15 text-emerald-400":"bg-amber-500/15 text-amber-400"),children:h?(0,q.jsx)(p.A,{className:"w-5 h-5"}):(0,q.jsx)(F.A,{className:"w-5 h-5"})}),(0,q.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,q.jsx)("h3",{className:"font-heading font-bold",children:"Canonical Creator Identity"}),(0,q.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"One profile and Creator ID across artists, deejays, records, events, follows and discovery."})]}),(0,q.jsx)("button",{type:"button",onClick:x,disabled:l||Boolean(n),className:"p-2 border border-white/10 rounded-sm hover:bg-white/5 disabled:opacity-50","aria-label":"Refresh Creator identity audit",children:(0,q.jsx)(b.A,{className:"w-4 h-4 "+(l?"animate-spin":"")})})]}),(0,q.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-5 ga
2p-2 text-center",children:[["Canonical",s.canonical_creators],["Linked",s.linked_creators],["Missing roles",s.missing_roles],["Missing slugs",s.missing_slug],["Duplicate groups",s.duplicate_group_count]].map(e=>{let[t,a]=e;return(0,q.jsxs)("div",{className:"border border-white/5 bg-black/20 rounded-sm p-3",children:[(0,q.jsx)("p",{className:"font-bold text-lg",children:a||0}),(0,q.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:t})]},t)})}),(0,q.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,q.jsx)("button",{type:"button",onClick:async()=>{d("preview");try{const e=await w.A.post(`${W}/api/admin/creator-identities/backfill`,{apply:!1,limit:5e3},{headers:u});N.oR.success(`${e.data.eligible||0} creator profiles are eligible for safe normalization`)}catch(a){var e,t;N.oR.error((null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Normalization preview failed")}finally{d("")}},disabled:Boolean(n),className:"px-3 py-2 border border-white/10 rounded-sm text-xs font-bold hover:bg-white/5 disabled:opacity-50",children:"preview"===n?"Checking\u2026":"Preview normalization"}),(0,q.jsx)("button",{type:"button",onClick:async()=>{if(window.confirm("Normalize missing Creator identity fields? Existing profiles and IDs will be preserved.")){d("backfill");try{const e=await w.A.post(`${W}/api/admin/creator-identities/backfill`,{apply:!0,limit:5e3},{headers:u});N.oR.success(`Normalized ${e.data.updated||0} creator profiles`),await x(),null===a||void 0===a||a()}catch(r){var e,t;N.oR.error((null===(e=r.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Creator normalization failed")}finally{d("")}}},disabled:Boolean(n),className:"px-3 py-2 bg-primary text-black rounded-sm text-xs font-bold disabled:opacity-50",children:"backfill"===n?"Normalizing\u2026":"Normalize missing fields"})]}),(s.duplicate_groups||[]).length>0?(0,q.jsxs)("div",{className:"space-y-3",children:[(0,q.jsx)("p",{className:"text-xs font-bold uppercase tracking-wider text-amber-300",children:"High-confidence duplicate candidates"}),s.duplicate_groups.map(e=>(0,q.jsxs)("article",{className:"border border-amber-500/20 bg-amber-500/[0.04] rounded-sm p-3",children:[(0,q.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[(0,q.jsx)("p",{className:"font-semibold flex-1",children:e.creators.map(e=>e.display_name).join(" / ")}),(0,q.jsx)("span",{className:"text-[10px] text-zinc-500 uppercase",children:e.reasons.join(" \xb7 ")})]}),(0,q.jsx)("div",{className:"space-y-1.5",children:e.creators.map(t=>(0,q.jsxs)("label",{className:"flex items-center gap-2 text-xs p-2 rounded-sm hover:bg-white/5",children:[(0,q.jsx)("input",{type:"radio",name:`canonical-${e.key}`,value:t.creator_id,checked:c[e.key]===t.creator_id,onChange:()=>m(a=>({...a,[e.key]:t.creator_id}))}),(0,q.jsx)("span",{className:"font-medium",children:t.display_name}),(0,q.jsx)("span",{className:"text-zinc-500 font-mono",children:t.creator_id}),(0,q.jsx)("span",{className:"text-zinc-500",children:t.roles.join(", ")})]},t.creator_id))}),(0,q.jsxs)("button",{type:"button",onClick:()=>(async e=>{const t=c[e.key],r=e.creator_ids.filter(e=>e!==t);if(t&&0!==r.length&&window.confirm(`Use ${t} as the canonical profile and link ${r.length} duplicate record(s)? No records will be deleted.`)){d(`link:${e.key}`);try{await w.A.post(`${W}/api/admin/creator-identities/${encodeURIComponent(t)}/link`,{linked_creator_ids:r},{headers:u}),N.oR.success("Creator identities linked without deleting source records"),await x(),null===a||void 0===a||a()}catch(l){var s,i;N.oR.error((null===(s=l.response)||void 0===s||null===(i=s.data)||void 0===i?void 0:i.detail)||"Could not link creator identities")}finally{d("")}}})(e),disabled:Boolean(n),className:"mt-2 inline-flex items-center gap-2 px-3 py-2 bg-amber-500 text-black rounded-sm text-xs font-bold disabled:opacity-50",children:[n===`link:${e.key}`?(0,q.jsx)(g.A,{className:"w-3.5 h-3.5 animate-spin"}):(0,q.jsx)(O,{className:"w-3.5 h-3.5"}),"Link to selected canonical profile"]})]},e.key))]}):(0,q.jsxs)("div",{className:"flex items-center gap-2 text-sm text-emerald-400",children:[(0,q.jsx)(V.A,{className:"w-4 h-4"})," No high-confidence duplicate profiles detected."]})]})};var K=a(33287);const G="https://rastyle.co.ke",J={dj:{name:"DJ / Selector",color:"bg-green-500"}
2,artist:{name:"Artist / Vocalist",color:"bg-amber-500"},producer:{name:"Producer",color:"bg-yellow-500"},event_organizer:{name:"Event Organizer",color:"bg-pink-500"},service_provider:{name:"Service Provider",color:"bg-cyan-500"},radio_station:{name:"Radio Station",color:"bg-red-500"},record_label:{name:"Record Label",color:"bg-purple-500"}},Y={pending:{label:"Pending",color:"bg-yellow-500/20 text-yellow-500",icon:s.A},approved:{label:"Approved",color:"bg-green-500/20 text-green-500",icon:i.A},rejected:{label:"Rejected",color:"bg-red-500/20 text-red-500",icon:l.A},suspended:{label:"Suspended",color:"bg-gray-500/20 text-gray-500",icon:o.A},banned:{label:"Banned",color:"bg-red-950 text-red-300",icon:n.A},deleted:{label:"Deleted",color:"bg-gray-800 text-gray-300",icon:d.A}},Q={active:{label:"Active",color:"bg-green-500/20 text-green-400"},warned:{label:"Warned",color:"bg-amber-500/20 text-amber-400"},restricted:{label:"Restricted",color:"bg-orange-500/20 text-orange-400"},suspended:{label:"Suspended",color:"bg-gray-500/20 text-gray-300"},banned:{label:"Banned",color:"bg-red-500/20 text-red-400"},deleted:{label:"Deleted",color:"bg-gray-800 text-gray-300"},pending:{label:"Pending",color:"bg-yellow-500/20 text-yellow-400"},rejected:{label:"Rejected",color:"bg-red-500/20 text-red-400"}},X=[{value:"warn",label:"Issue warning"},{value:"restrict",label:"Restrict features"},{value:"suspend",label:"Suspend account"},{value:"ban",label:"Ban account"},{value:"restore",label:"Restore full access"},{value:"delete",label:"Delete account"}],Z=[["profile_edit","Profile editing"],["event_management","Event management"],["social_connections","Social connections"],["publishing","Publishing"],["payouts","Payouts"],["storefront","Storefront"]],ee=e=>{var t;return Boolean(null===(t=e.approval_readiness)||void 0===t?void 0:t.approval_ready)},te=e=>{let{creator:t}=e;const a=t.approval_readiness;if(!a)return null;const r=a.provider_links||{};return(0,q.jsxs)("section",{className:"rounded-xl border border-primary/25 bg-primary/[0.06] p-4","data-testid":"creator-verification-summary",children:[(0,q.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("p",{className:"text-xs font-black uppercase tracking-[0.18em] text-primary",children:"Minimum approval requirements"}),(0,q.jsxs)("h4",{className:"mt-1 font-bold",children:[a.completed_count,"/",a.required_count," required items complete"]})]}),(0,q.jsx)("span",{className:"rounded-full px-3 py-1 text-xs font-black "+(a.approval_ready?"bg-green-500/15 text-green-400":"bg-amber-500/15 text-amber-300"),children:a.approval_ready?"READY FOR REVIEW":"NEEDS INFORMATION"})]}),(0,q.jsxs)("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[a.required_items.map(e=>(0,q.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/25 px-3 py-2 text-sm",children:[(0,q.jsx)("span",{className:e.complete?"text-green-400":"text-amber-300",children:e.complete?"\u2713":"\u25cb"})," ",e.label," \u2014 Required"]},e.key)),Object.entries(r).map(e=>{var t;let[r,s]=e;return(0,q.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/25 px-3 py-2 text-sm",children:["hearthis"===r?"HearThis.at":r," \u2014 ",null!==(t=a.qualifying_links)&&void 0!==t&&t[r]?(0,q.jsxs)("a",{href:a.qualifying_links[r],target:"_blank",rel:"noopener noreferrer",className:"text-green-400 underline",children:["Review link ",(0,q.jsx)(c.A,{className:"inline h-3 w-3"})]}):s?(0,q.jsx)("span",{className:"text-amber-300",children:"Invalid provider URL"}):(0,q.jsx)("span",{className:"text-muted-foreground",children:"Optional / not supplied"})]},r)})]}),(0,q.jsxs)("p",{className:"mt-3 text-sm text-muted-foreground",children:["Biography: ",t.bio?"Provided":"Recommended"," \xb7 Profile completeness is separate from approval readiness."]}),"basic_submitted"===t.approval_submission_status&&(0,q.jsx)("p",{className:"mt-2 text-sm text-amber-300",children:"Creator has not submitted the completed profile for review."})]})},ae={none:{name:"Unverified",icon:m.A,color:"text-red-500"},basic:{name:"Basic",icon:u.A,color:"text-yellow-500"},verified:{name:"Verified",icon:i.A,color:"text-blue-500"},identity:{name:"Trusted",icon:p.A,color:"text-blue-500"},trusted:{name:"Trusted",icon:p.A,color:"text-green-500"},full:{name:"Partner",icon:x.A,color:"text-green-500"},partner:{name:"Partner",icon:x.A,color:"text-primary"}},re=function(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Something went wrong";const r=null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.data,s=null===r||void 0===r?void 0:r.detail;if("string"===typeof s)return s;if(Array.isArray(s)){const e=s.map(e=>"string"===typeof e?e:e&&"object"===typeof e?e.msg||e.message:null).filter(
2Boolean);if(e.length)return e.join(", ")}return s&&"object"===typeof s?s.message||a:"string"===typeof(null===r||void 0===r?void 0:r.message)?r.message:"string"===typeof(null===e||void 0===e?void 0:e.message)?e.message:a},se=e=>{var t,a,s;let{token:o}=e;const[n,d]=(0,r.useState)([]),[m,u]=(0,r.useState)(!0),[p,x]=(0,r.useState)("all"),[j,_]=(0,r.useState)(""),[C,A]=(0,r.useState)(null),[S,R]=(0,r.useState)(!1),[$,P]=(0,r.useState)(0),[B,z]=(0,r.useState)(null),[M,T]=(0,r.useState)(""),[D,I]=(0,r.useState)(""),[L,U]=(0,r.useState)("warn"),[F,O]=(0,r.useState)(""),[V,W]=(0,r.useState)([]),se=(0,r.useMemo)(()=>({Authorization:`Bearer ${o}`}),[o]),ie=(0,r.useCallback)(async()=>{u(!0);try{var e,t;const a={limit:100};"all"!==p&&(a.status=p);const r=await w.A.get(`${G}/api/admin/creators`,{params:a,headers:se});d(Array.isArray(null===(e=r.data)||void 0===e?void 0:e.creators)?r.data.creators:[]),P(Number(null===(t=r.data)||void 0===t?void 0:t.pending_count)||0)}catch(r){var a;console.error("Failed to fetch creators:",(null===r||void 0===r||null===(a=r.response)||void 0===a?void 0:a.data)||r),N.oR.error(re(r,"Failed to fetch creators"))}finally{u(!1)}},[se,p]);(0,r.useEffect)(()=>{ie()},[ie]);const le=async e=>{let{actionKey:t,request:a,successMessage:r,closeModal:s=!0}=e;z(t);try{var i;const e=await a();return N.oR.success((null===e||void 0===e||null===(i=e.data)||void 0===i?void 0:i.message)||r),await ie(),s&&R(!1),e}catch(n){var l,o;return console.error(`${t} failed:`,{status:null===n||void 0===n||null===(l=n.response)||void 0===l?void 0:l.status,data:null===n||void 0===n||null===(o=n.response)||void 0===o?void 0:o.data,message:null===n||void 0===n?void 0:n.message}),N.oR.error(re(n,r.replace(/successfully|granted/gi,"failed"))),null}finally{z(null)}},oe=async e=>{e?await le({actionKey:`approve:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/approve`,"",{headers:{...se,"Content-Type":"application/json"},transformRequest:[()=>JSON.stringify("")]}),successMessage:"Creator approved successfully"}):N.oR.error("Creator ID is missing")},ne=(0,r.useMemo)(()=>{const e=j.trim().toLowerCase();return e?n.filter(t=>[t.display_name,t.slug,t.creator_type,t.country,...(0,K.gx)(t)].some(t=>String(t||"").toLowerCase().includes(e))):n},[n,j]),de=()=>{B||(R(!1),A(null),I(""),O(""),W([]))};return(0,q.jsxs)("div",{className:"space-y-6",children:[(0,q.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,q.jsxs)("div",{className:"bg-card rounded-sm border border-white/10 p-4",children:[(0,q.jsx)("p",{className:"text-sm text-muted-foreground",children:"Total Creators"}),(0,q.jsx)("p",{className:"text-2xl font-bold",children:n.length})]}),(0,q.jsxs)("div",{className:"bg-yellow-500/10 border border-yellow-500/30 rounded-sm p-4",children:[(0,q.jsx)("p",{className:"text-sm text-yellow-500",children:"Pending Review"}),(0,q.jsx)("p",{className:"text-2xl font-bold text-yellow-500",children:$})]}),(0,q.jsxs)("div",{className:"bg-green-500/10 border border-green-500/30 rounded-sm p-4",children:[(0,q.jsx)("p",{className:"text-sm text-green-500",children:"Approved"}),(0,q.jsx)("p",{className:"text-2xl font-bold text-green-500",children:n.filter(e=>"approved"===e.status).length})]}),(0,q.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-sm p-4",children:[(0,q.jsx)("p",{className:"text-sm text-red-500",children:"Rejected"}),(0,q.jsx)("p",{className:"text-2xl font-bold text-red-500",children:n.filter(e=>"rejected"===e.status).length})]})]}),(0,q.jsx)(H,{token:o,onChanged:ie}),(0,q.jsxs)("div",{className:"flex gap-4 flex-wrap",children:[(0,q.jsxs)("div",{className:"relative flex-1 min-w-[220px]",children:[(0,q.jsx)(h.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,q.jsx)("input",{type:"search",value:j,onChange:e=>_(e.target.value),placeholder:"Search creators...",className:"w-full pl-10 pr-4 py-2 bg-white/5 border border-white/10 rounded-sm focus:border-primary focus:outline-none"})]}),(0,q.jsx)("div",{className:"flex gap-2 overflow-x-auto",children:["all","pending","approved","suspended","banned","deleted","rejected"].map(e=>(0,q.jsxs)("button",{type:"button",onClick:()=>x(e),className:"px-4 py-2 rounded-sm font-medium capitalize transition-colors "+(p===e?"bg-primary text-primary-foreground":"bg-white/5 hover:bg-white/10"),children:[e,"pending"===e&&$>0&&(0,q.jsx)("span",{className:"ml-2 px-2 py-0.5 bg-yellow-500 text-black text-xs rounded-full",children:$})]},e))}),(0,q.jsx)("button",{type:"button",onClick:ie,disabled:m,className:"px-4 py-2 bg-white/5 rounded-sm hover:bg-white/10 transition-colors disabled:opacity-50","aria-label":"Refresh creators",children:(0,q.jsx)(b.A,{className:"w-4 h-4 "+(m?"animate-spin":"")})})]}),m?(0,q.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,q.jsx)(g.A,{className:"w-8 h-8 animate-spin text-primary"})}):ne.length>0?(0,q.jsx)("div",{className:"bg-card rounded-sm border border-white/10 overflow-x-auto",children:(0,q.jsxs)("table",{className:"w-full min-w-[900px]",children:[(0,q.jsx)("thead",{children:(0,q.jsxs)("tr",{className:"border-b border-white/10 bg-white/5",children:[(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Creator"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Type"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Country"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Status"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Verification"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Commission"}),(0,q.jsx)("th",{className:"text-left p-4 font-semibold",children:"Actions"})]})}),(0,q.jsx)("tbody",{children:ne.map(e=>
2{const t=(0,k.jM)(e.country),a=Y[e.status]||Y.pending,r=Q[e.account_state]||Q.pending,s=a.icon,l=ae[e.verification_level]||ae.none,o=l.icon,n=B===`approve:${e.creator_id}`;return(0,q.jsxs)("tr",{className:"border-b border-white/5 hover:bg-white/5",children:[(0,q.jsx)("td",{className:"p-4",children:(0,q.jsxs)("div",{className:"flex items-center gap-3",children:[(0,q.jsx)("div",{className:"w-10 h-10 bg-primary/20 rounded-sm flex items-center justify-center",children:(0,q.jsx)(v.A,{className:"w-5 h-5 text-primary"})}),(0,q.jsxs)("div",{children:[(0,q.jsx)("p",{className:"font-semibold",children:e.display_name||"Unnamed creator"}),(0,q.jsxs)("p",{className:"text-sm text-muted-foreground",children:["@",e.slug||"no-slug"]})]})]})}),(0,q.jsx)("td",{className:"p-4",children:(0,q.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,K.gx)(e).map(e=>{var t;return(0,q.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${(null===(t=J["deejay"===e?"dj":e])||void 0===t?void 0:t.color)||"bg-gray-500"} text-white`,children:(0,K.H)(e)},e)})})}),(0,q.jsx)("td",{className:"p-4",children:t?(0,q.jsxs)("span",{className:"flex items-center gap-2",children:[(0,q.jsx)("span",{className:"text-lg",children:t.flag}),(0,q.jsx)("span",{className:"text-sm",children:t.code})]}):(0,q.jsx)("span",{className:"text-sm text-muted-foreground",children:"\u2014"})}),(0,q.jsxs)("td",{className:"p-4",children:[(0,q.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium ${a.color}`,children:[(0,q.jsx)(s,{className:"w-3 h-3"}),"provisional"===e.approval_status?"Provisionally approved":a.label]}),e.account_state&&"active"!==e.account_state&&e.account_state!==e.status&&(0,q.jsx)("span",{className:`ml-2 inline-flex px-2 py-1 rounded text-xs font-medium ${r.color}`,children:r.label})]}),(0,q.jsx)("td",{className:"p-4",children:(0,q.jsxs)("span",{className:`inline-flex items-center gap-1 ${l.color}`,children:[(0,q.jsx)(o,{className:"w-4 h-4"}),(0,q.jsx)("span",{className:"text-sm",children:l.name})]})}),(0,q.jsxs)("td",{className:"p-4 text-sm",children:[(100*(e.commission_rate||0)).toFixed(0),"%",null!=e.commission_override&&(0,q.jsx)("span",{className:"ml-1 text-xs text-primary",children:"(custom)"})]}),(0,q.jsx)("td",{className:"p-4",children:(0,q.jsxs)("div",{className:"flex gap-2",children:[(0,q.jsx)("button",{type:"button",onClick:()=>(e=>{A(e),T((100*(e.commission_rate||0)).toFixed(0)),I(""),U("warn"),O(""),W(e.feature_restrictions||[]),R(!0)})(e),className:"p-2 bg-white/5 rounded hover:bg-white/10 transition-colors",title:"View details",children:(0,q.jsx)(f.A,{className:"w-4 h-4"})}),"pending"===e.status&&(0,q.jsx)("button",{type:"button",onClick:()=>oe(e.creator_id),disabled:Boolean(B)||!ee(e),className:"p-2 bg-green-500/20 text-green-500 rounded hover:bg-green-500/30 transition-colors disabled:opacity-50",title:ee(e)?"Approve":"Open creator details to review missing verification information",children:n?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):(0,q.jsx)(i.A,{className:"w-4 h-4"})})]})})]},e.creator_id)})})]})}):(0,q.jsxs)("div",{className:"bg-card rounded-sm border border-white/10 p-12 text-center",children:[(0,q.jsx)(v.A,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),(0,q.jsx)("p",{className:"text-muted-foreground",children:"No creators found"})]}),S&&C&&(0,q.jsx)("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onMouseDown:e=>{e.target===e.currentTarget&&de()},children:(0,q.jsxs)("div",{className:"bg-card rounded-sm border border-white/10 w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[(0,q.jsxs)("div",{className:"p-6 border-b border-white/10 flex items-center justify-between",children:[(0,q.jsx)("h2",{className:"text-xl font-bold",children:"Creator Details"}),(0,q.jsx)("button",{type:"button",onClick:de,disabled:Boolean(B),className:"text-muted-foreground hover:text-foreground disabled:opacity-50","aria-label":"Close creator details",children:"\u2715"})]}),(0,q.jsxs)("div",{className:"p-6 space-y-6",children:[(0,q.jsxs)("div",{className:"flex items-start gap-4",children:[(0,q.jsx)("div",{className:"w-16 h-16 overflow-hidden bg-primary/20 rounded-sm flex items-center justify-center",children:C.profile_image?(0,q.jsx)("img",{src:C.profile_image,alt:`${C.display_name||"Creator"} profile`,className:"h-full w-full object-cover object-top"}):(0,q.jsx)(v.A,{className:"w-8 h-8 text-primary"})}),(0,q.jsxs)("div",{className:"flex-1",children:[(0,q.jsx)("h3",{className:"text-xl font-bold",children:C.display_name||"Unnamed creator"}),(0,q.jsxs)("p",{className:"text-muted-foreground",children:["@",C.slug||"no-slug"]}),(0,q.jsxs)("div",{className:"flex flex-wrap gap-2 mt-2",children:[(0,K.gx)(C).map(e=>{var t;return(0,q.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${(null===(t=J["deejay"===e?"dj":e])||void 0===t?void 0:t.color)||"bg-gray-500"} text-white`,children:(0,K.H)(e)},e)}),(0,q.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${(Y[C.status]||Y.pen
2ding).color}`,children:(Y[C.status]||Y.pending).label}),(0,q.jsx)("span",{className:`px-2 py-1 rounded text-xs font-medium ${(Q[C.account_state]||Q.pending).color}`,children:(Q[C.account_state]||Q.pending).label})]})]})]}),(0,q.jsx)(te,{creator:C}),C.bio&&(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Bio"}),(0,q.jsx)("p",{className:"text-muted-foreground text-sm",children:C.bio})]}),(0,q.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Country"}),(0,q.jsxs)("p",{className:"text-muted-foreground",children:[null===(t=(0,k.jM)(C.country))||void 0===t?void 0:t.flag," ",(null===(a=(0,k.jM)(C.country))||void 0===a?void 0:a.name)||"Not provided"]})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Phone"}),(0,q.jsx)("p",{className:"text-muted-foreground",children:C.phone||"Not provided"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Website"}),C.website?(0,q.jsxs)("a",{href:C.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline inline-flex items-center gap-1 break-all",children:[C.website," ",(0,q.jsx)(c.A,{className:"w-3 h-3"})]}):(0,q.jsx)("p",{className:"text-muted-foreground",children:"Not provided"})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Applied"}),(0,q.jsx)("p",{className:"text-muted-foreground",children:C.created_at?new Date(C.created_at).toLocaleDateString():"Unknown"})]})]}),C.socials&&Object.values(C.socials).some(Boolean)&&(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Social Links"}),(0,q.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(C.socials).map(e=>{let[t,a]=e;if(!a)return null;const r=String(a).startsWith("http")?a:`https://${t}.com/${String(a).replace(/^@/,"")}`;return(0,q.jsxs)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-1 bg-white/5 rounded text-sm hover:bg-white/10 transition-colors inline-flex items-center gap-1",children:[t," ",(0,q.jsx)(c.A,{className:"w-3 h-3"})]},t)})})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Commission Rate"}),(0,q.jsxs)("div",{className:"flex gap-2",children:[(0,q.jsxs)("div",{className:"relative flex-1",children:[(0,q.jsx)(y,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,q.jsx)("input",{type:"number",value:M,onChange:e=>T(e.target.value),min:"0",max:"50",step:"0.5",className:"w-full pl-10 pr-4 py-2 bg-white/5 border border-white/10 rounded-sm focus:border-primary focus:outline-none"})]}),(0,q.jsx)("button",{type:"button",onClick:()=>(async e=>{const t=Number(M),a=t/100;if(!Number.isFinite(t)||t<0||t>50)return void N.oR.error("Commission rate must be between 0% and 50%");await le({actionKey:`commission:${e}`,request:()=>w.A.put(`${G}/api/admin/creators/${encodeURIComponent(e)}/commission`,a,{headers:{...se,"Content-Type":"application/json"}}),successMessage:`Commission rate set to ${t}%`,closeModal:!1})&&A(e=>e?{...e,commission_rate:a,commission_override:a}:e)})(C.creator_id),disabled:Boolean(B),className:"px-4 py-2 bg-primary text-primary-foreground rounded-sm font-semibold hover:bg-primary/90 transition-colors disabled:opacity-50",children:B===`commission:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):"Set Rate"})]})]}),(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold mb-2",children:"Verification Level"}),(0,q.jsxs)("div",{className:"flex flex-wrap gap-2",children:[!["identity","trusted","full","partner"].includes(C.verification_level)&&(0,q.jsx)("button",{type:"button",onClick:()=>(async e=>{await le({actionKey:`identity:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/verify-identity`,{},{headers:se}),successMessage:"Trusted verification granted"})})(C.creator_id),disabled:Boolean(B),className:"px-4 py-2 bg-blue-500/20 text-blue-500 rounded-sm font-medium hover:bg-blue-500/30 transition-colors disabled:opacity-50",children:B===`identity:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):"Grant Trusted Verification"}),!["full","partner"].includes(C.verification_level)&&(0,q.jsx)("button",{type:"button",onClick:()=>(async e=>{await le({actionKey:`full:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/verify-full`,{},{headers:se}),successMessage:"Partner verification granted"})})(C.creator_id),disabled:Boolean(B),className:"px-4 py-2 bg-green-500/20 text-green-500 rounded-sm font-medium hover:bg-green-500/30 transition-colors disabled:opacity-50",children:B===`full:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):"Grant Partner Verification"})]})]}
2),"pending"!==C.status&&(0,q.jsxs)("div",{className:"border-t border-white/10 pt-6 space-y-4","data-testid":"creator-moderation-controls",children:[(0,q.jsxs)("div",{children:[(0,q.jsx)("h4",{className:"font-semibold",children:"Account moderation"}),(0,q.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Warn, limit individual tools, suspend, ban, restore, or soft-delete this account. Every action is recorded."})]}),C.moderation_notice&&(0,q.jsxs)("div",{className:"rounded border border-amber-500/30 bg-amber-500/10 p-3 text-sm text-amber-200",children:["Current notice: ",C.moderation_notice]}),(0,q.jsx)("select",{value:L,onChange:e=>U(e.target.value),className:"w-full px-4 py-3 bg-background border border-white/10 rounded-sm focus:border-primary focus:outline-none",children:X.map(e=>(0,q.jsx)("option",{value:e.value,children:e.label},e.value))}),"restrict"===L&&(0,q.jsx)("div",{className:"grid sm:grid-cols-2 gap-2 rounded border border-white/10 p-3",children:Z.map(e=>{let[t,a]=e;return(0,q.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,q.jsx)("input",{type:"checkbox",checked:V.includes(t),onChange:e=>W(a=>e.target.checked?[...new Set([...a,t])]:a.filter(e=>e!==t))}),a]},t)})}),(0,q.jsx)("textarea",{value:F,onChange:e=>O(e.target.value),rows:3,placeholder:"Reason shown to the creator and saved in the audit history",className:"w-full px-4 py-3 bg-white/5 border border-white/10 rounded-sm focus:border-primary focus:outline-none resize-y"}),(0,q.jsx)("button",{type:"button",onClick:()=>(async e=>{var t;const a=F.trim();if(!a)return void N.oR.error("Add a reason so the creator and moderation history are clear");if("restrict"===L&&0===V.length)return void N.oR.error("Select at least one feature to restrict");if(["ban","delete"].includes(L)&&!window.confirm(`Confirm ${L} for this creator?`))return;const r=await le({actionKey:`moderation:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/moderation`,{action:L,reason:a,features:"restrict"===L?V:[]},{headers:se}),successMessage:`Creator ${L} action applied`,closeModal:!1});null!==r&&void 0!==r&&null!==(t=r.data)&&void 0!==t&&t.creator&&(A(r.data.creator),O(""),W(r.data.creator.feature_restrictions||[]))})(C.creator_id),disabled:Boolean(B)||!F.trim(),className:"w-full px-4 py-3 rounded-sm font-semibold transition-colors disabled:opacity-50 "+(["ban","delete"].includes(L)?"bg-red-500/20 text-red-400 border border-red-500/30 hover:bg-red-500/30":"bg-primary text-primary-foreground hover:bg-primary/90"),children:B===`moderation:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin mx-auto"}):null===(s=X.find(e=>e.value===L))||void 0===s?void 0:s.label})]}),"approved"===C.status&&(0,q.jsx)(E,{creator:C,token:o,onSaved:ie}),"pending"===C.status&&(0,q.jsxs)("div",{className:"border-t border-white/10 pt-6 space-y-4",children:[(0,q.jsx)("h4",{className:"font-semibold",children:"Application Actions"}),"provisional"===C.approval_status&&(0,q.jsxs)("p",{className:"text-amber-300",children:["Provisionally approved: ",C.moderation_notice]}),(0,q.jsxs)("label",{className:"block text-sm",children:["Remaining details / comment to creator",(0,q.jsx)("textarea",{value:F,onChange:e=>O(e.target.value),maxLength:1e3,rows:3,className:"mt-2 w-full rounded border border-white/20 bg-black/30 p-3",placeholder:"Please supply your photo and remaining creator links\u2026"})]}),(0,q.jsx)("button",{type:"button",onClick:()=>(async e=>{var t,a,r,s;const i=F.trim();if(!i)return;const l=await le({actionKey:`provisional:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/provisional-approval`,{comment:i},{headers:se}),successMessage:"Creator provisionally approved"});!l||null!==(t=l.data)&&void 0!==t&&null!==(a=t.whatsapp)&&void 0!==a&&a.queued||N.oR.warning("Approval saved. WhatsApp was not queued: "+((null===(r=l.data)||void 0===r||null===(s=r.whatsapp)||void 0===s?void 0:s.reason)||"Check Communications HQ"))})(C.creator_id),disabled:Boolean(B)||!F.trim(),className:"w-full rounded bg-amber-500 px-4 py-3 font-semibold text-black disabled:opacity-50",children:"Provisionally approve & request details via WhatsApp"}),(0,q.jsx)("p",{className:"text-sm text-muted-foreground",children:"The creator can finish their profile while final approval is pending. Comments are queued to their opted-in WhatsApp number."}),(0,q.jsxs)("button",{type:"button",onClick:()=>oe(C.creator_id),disabled:Boolean(B)||!ee(C)||"basic_submitted"===C.approval_submission_status,className:"w-full px-4 py-3 bg-green-500 text-white rounded-sm font-semibold hover:bg-green-600 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[B===`approve:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):(0,q.jsx)(i.A,{className:"w-4 h-4"}),"Approve Application"]}
2),!ee(C)&&(0,q.jsx)("p",{className:"rounded-lg border border-amber-500/25 bg-amber-500/10 p-3 text-sm text-amber-200",children:"Approval needs a profile photo for every creator; DJs and artists also need one valid Spotify, HearThis.at or YouTube link."}),(0,q.jsxs)("div",{children:[(0,q.jsx)("textarea",{value:D,onChange:e=>I(e.target.value),placeholder:"Reason for rejection (required)...",rows:3,className:"w-full px-4 py-3 bg-white/5 border border-white/10 rounded-sm focus:border-red-500 focus:outline-none resize-none"}),(0,q.jsxs)("button",{type:"button",onClick:()=>(async e=>{const t=D.trim();if(!t)return void N.oR.error("Please provide a reason for rejection");await le({actionKey:`reject:${e}`,request:()=>w.A.post(`${G}/api/admin/creators/${encodeURIComponent(e)}/reject`,t,{headers:{...se,"Content-Type":"application/json"}}),successMessage:"Creator application rejected"})&&I("")})(C.creator_id),disabled:Boolean(B)||!D.trim(),className:"w-full mt-2 px-4 py-3 bg-red-500/20 text-red-500 border border-red-500/30 rounded-sm font-semibold hover:bg-red-500/30 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[B===`reject:${C.creator_id}`?(0,q.jsx)(g.A,{className:"w-4 h-4 animate-spin"}):(0,q.jsx)(l.A,{className:"w-4 h-4"}),"Reject Application"]})]})]})]})]})})]})}},17146(e,t,a){const r=(0,a(54235).A)("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);a.d(t,["A",0,r])},9667(e,t,a){const r=(0,a(54235).A)("phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);a.d(t,["A",0,r])}}]);
3//# sourceMappingURL=1405.d547be86.chunk.js.map

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.