PageSourceSearch

https://kanalpha-centrale-5659.taskade.app/chunks/PartnerSpaceEditor-QVJWW3O3.js

js kanalpha-centrale-5659.taskade.app collected 2026-10-03 15:02:00 UTC 80,921 bytes, 2 lines download raw bytes

1var __IMPORT_META_ENV={};var __PROCESS_ENV={NODE_ENV:"production"};
2import{b as Mt,c as Ye}from"/chunks/chunk-O56EA25Y.js";import{b as Je}from"/chunks/chunk-LB5JTLPI.js";import"/chunks/chunk-BVHB3ZJH.js";import{a as jt}from"/chunks/chunk-XSPJMM4G.js";import"/chunks/chunk-GM4KHSES.js";import"/chunks/chunk-UKLQ4P3Q.js";import"/chunks/chunk-E5GVA5DJ.js";import"/chunks/chunk-S6V4AELI.js";import{a as Ot,b as ze,c as le,d as Ft,g as Ut,i as Le,j as he,l as _t,n as Dt}from"/chunks/chunk-7WHMFDG5.js";import{c as De,h as Xe}from"/chunks/chunk-PX3NHEN5.js";import{b as Ge}from"/chunks/chunk-OEUVUJTW.js";import{b as me,s as ve}from"/chunks/chunk-CRBJ42QN.js";import"/chunks/chunk-OIOX2OT5.js";import"/chunks/chunk-QKICUY2S.js";import{a as ie}from"/chunks/chunk-ZPWTUCVH.js";import"/chunks/chunk-VO3OU22B.js";import"/chunks/chunk-DF7DADWT.js";import"/chunks/chunk-PVUXRWMP.js";import"/chunks/chunk-HJHZVTE7.js";import"/chunks/chunk-JDIYSNT2.js";import"/chunks/chunk-BHPEHDWW.js";import"/chunks/chunk-OBUH64IE.js";import{b as nt,c as it}from"/chunks/chunk-ZSQ2II6E.js";import{b as w}from"/chunks/chunk-DP67E3KD.js";import{a as ye,c as xe}from"/chunks/chunk-64B44DNV.js";import{a as be}from"/chunks/chunk-A6NSEO7N.js";import"/chunks/chunk-QK5GDHFF.js";import{a as M}from"/chunks/chunk-5LKAQM72.js";import"/chunks/chunk-YQIDYBH5.js";import{$ as ft,BB as Rt,Bp as kt,DB as Et,Ex as $e,Jj as Fe,Ju as St,Kf as Nt,Kv as ue,Lj as fe,Mj as ee,Ml as ke,Wm as Ct,Xw as qe,Zh as Oe,_p as te,cD as _e,cu as Ve,dC as Tt,hA as At,hf as Me,hn as wt,hp as He,lf as ht,mE as Pe,mf as Be,ot as Se,pE as It,rg as yt,ry as Lt,st as Ue,ya as vt,yw as Pt}from"/chunks/chunk-5XO7YT7G.js";import{a as bt}from"/chunks/chunk-7CSIBDHN.js";import"/chunks/chunk-B2UZA2US.js";import{A as mt,B as Ie,C as pt,D as gt,l as je,p as ct,q as ut,x as we,z as Te}from"/chunks/chunk-AWIV7FKJ.js";import"/chunks/chunk-YRV6X7ST.js";import{d as dt}from"/chunks/chunk-Q5GT4ESH.js";import{a as xt}from"/chunks/chunk-CL4HBHDB.js";import"/chunks/chunk-PE5MZRD7.js";import{a as st}from"/chunks/chunk-2F2XG2RD.js";import{C as F,g as j,h as R,r as de,t as lt,w as ce,y as Ce}from"/chunks/chunk-QLZURSYN.js";import"/chunks/chunk-WCEWIOOT.js";import{d as ne}from"/chunks/chunk-43M3N6VY.js";var h=ne(st());var A=ne(st());var s=ne(be());function Bt({value:t,onCommit:d,isPrice:n}){let[o,a]=(0,A.useState)(!1),[b,m]=(0,A.useState)(n?t.toFixed(2):String(t)),C=(0,A.useRef)(null),x=()=>{m(n?t.toFixed(2):String(t)),a(!0),setTimeout(()=>C.current?.select(),0)},S=()=>{a(!1);let u=parseFloat(b.replace(",","."));!isNaN(u)&&u>=0&&u!==t&&d(u)};return o?(0,s.jsx)("input",{ref:C,type:"number",min:0,step:n?.01:1,value:b,onChange:u=>m(u.target.value),onBlur:S,onKeyDown:u=>{u.key==="Enter"&&S(),u.key==="Escape"&&a(!1)},className:"w-full text-right text-[12px] bg-muted/50 border border-primary/30 rounded px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-primary/30"}):(0,s.jsx)("button",{onClick:x,title:"Modifier",className:"tabular-nums text-[12px] font-medium hover:text-foreground transition-colors text-right w-full",children:n?`${t.toFixed(2)} \u20AC`:t===0?(0,s.jsx)("span",{className:"text-red-400",children:"0"}):t})}var Ht={"st-actif":{label:"Actif",color:"#22c55e",icon:(0,s.jsx)(Nt,{className:"w-3 h-3"})},"st-brouillon":{label:"Brouillon",color:"#f59e0b",icon:(0,s.jsx)(yt,{className:"w-3 h-3"})},"st-archive":{label:"Archiv\xE9",color:"#64748b",icon:(0,s.jsx)(ft,{className:"w-3 h-3"})},"st-retire":{label:"Retir\xE9",color:"#ef4444",icon:(0,s.jsx)(fe,{className:"w-3 h-3"})}},Qe=["st-actif","st-brouillon","st-retire","st-archive"];function $t({product:t,channelKey:d,localOverride:n,savingStatus:o,savingPrice:a,savingStock:b,onStatusChange:m,onPriceCommit:C,onStockCommit:x}){let[S,u]=(0,A.useState)(!1),i=gt(t,d),g=n?.price??Ie(t,d).regular,f=n?.stock??we(t,d),T=n?.status??Te(t,d),y=Ht[T]??Ht["st-actif"],G=()=>{let q=Qe.indexOf(T);m(Qe[(q+1)%Qe.length])},U=f>0&&f<5;return(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 hover:bg-accent/20 transition-colors",children:[(0,s.jsx)("div",{className:"w-9 h-9 rounded-lg bg-muted/40 shrink-0 overflow-hidden flex items-center justify-center",children:t.image&&!S?(0,s.jsx)("img",{src:t.image,alt:"",className:"w-full h-full object-cover",onError:()=>u(!0)}
2):(0,s.jsx)(Se,{className:"w-4 h-4 text-muted-foreground/30"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-[12px] font-medium truncate",children:i}),t.sku&&(0,s.jsx)("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.sku})]}),(0,s.jsxs)("div",{className:"w-24 shrink-0 flex items-center justify-end gap-1",children:[a&&(0,s.jsx)(ue,{className:"w-3 h-3 animate-spin text-muted-foreground"}),(0,s.jsx)(Bt,{value:g,isPrice:!0,onCommit:C})]}),(0,s.jsxs)("div",{className:"w-20 shrink-0 flex items-center justify-end gap-1",children:[f===0&&(0,s.jsx)(Tt,{className:"w-2.5 h-2.5 text-red-400 shrink-0"}),b&&(0,s.jsx)(ue,{className:"w-3 h-3 animate-spin text-muted-foreground"}),(0,s.jsx)("div",{className:w("text-right",f===0?"text-red-400":U?"text-amber-400":"text-emerald-400"),children:(0,s.jsx)(Bt,{value:f,onCommit:x})})]}),(0,s.jsx)("div",{className:"w-28 shrink-0 flex justify-end",children:(0,s.jsxs)("button",{onClick:G,disabled:o,className:"flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold border hover:opacity-80 transition-opacity disabled:opacity-40",style:{background:`${y.color}18`,borderColor:`${y.color}33`,color:y.color},children:[o?(0,s.jsx)(ue,{className:"w-2.5 h-2.5 animate-spin"}):y.icon,y.label]})})]})}function We({channelKey:t,spaceName:d,products:n}){let[o,a]=(0,A.useState)([]),[b,m]=(0,A.useState)([]),[C,x]=(0,A.useState)(!0),[S,u]=(0,A.useState)(!0),[i,g]=(0,A.useState)(!1),[f,T]=(0,A.useState)(""),[y,G]=(0,A.useState)(null),[U,q]=(0,A.useState)(""),[B,$]=(0,A.useState)(null),[W,oe]=(0,A.useState)(null),[ae,Z]=(0,A.useState)(null),[N,I]=(0,A.useState)({}),r=(0,A.useCallback)(async()=>{u(!0);try{let[l,p]=await Promise.all([De(),Le(t)]);a(l.filter(L=>!L.folderType||L.folderType==="normal"||L.folderType==="price_group"||L.folderType==="pspace"&&L.pspaceChannelKey===t)),m(p?.folderIds??[]),x((p?.folderIdsMode??"all")==="all")}catch{M.error("Erreur chargement dossiers")}u(!1)},[t]);(0,A.useEffect)(()=>{r()},[r]);let v=(0,A.useCallback)(async(l,p)=>{g(!0);try{let L=await Le(t);if(!L){M.error("Config canal introuvable"),g(!1);return}await he({...L,folderIds:l,folderIdsMode:p}),m(l),x(p==="all"),M.success("Visibilite mise a jour")}catch{M.error("Erreur sauvegarde")}g(!1)},[t]),E=(0,A.useCallback)(l=>{let p;C?p=o.map(O=>O.id).filter(O=>O!==l):b.includes(l)?p=b.filter(L=>L!==l):p=[...b,l],v(p,"selected")},[b,C,o,v]),P=(0,A.useCallback)(async(l,p)=>{$(l.id);try{let L=mt(l,t,p);await ce(j.PRODUCTS,l.id,{[R.P_STATUS_CH]:L}),de(j.PRODUCTS),I(O=>({...O,[l.id]:{...O[l.id],status:p}}))}catch{M.error("Erreur mise \xE0 jour statut")}$(null)},[t]),X=(0,A.useCallback)(async(l,p)=>{if(p!==Ie(l,t).regular){oe(l.id);try{let L={...Ie(l,t),regular:p},O=pt(l,t,L);await ce(j.PRODUCTS,l.id,{[R.P_PRICE_CH]:O}),I(V=>({...V,[l.id]:{...V[l.id],price:p}})),M.success("Prix mis \xE0 jour")}catch{M.error("Erreur prix")}oe(null)}},[t]),K=(0,A.useCallback)(async(l,p)=>{if(p!==we(l,t)){Z(l.id);try{let L=ut(l.stockChannels,{});L[t]=p,await ce(j.PRODUCTS,l.id,{[R.P_STOCK_CH]:JSON.stringify(L)}),I(O=>({...O,[l.id]:{...O[l.id],stock:p}})),M.success("Stock mis \xE0 jour")}catch{M.error("Erreur stock")}Z(null)}},[t]),H=C,pe=(0,A.useMemo)(()=>o.filter(l=>!f||l.name.toLowerCase().includes(f.toLowerCase())||l.tag.includes(f.toLowerCase())),[o,f]),se=(0,A.useMemo)(()=>{let l={};return o.forEach(p=>{l[p.id]=n.filter(L=>Xe(L.tags||"",p.tag)).length}),l},[o,n]),Y=(0,A.useMemo)(()=>y?n.filter(l=>Xe(l.tags||"",y.tag)):[],[y,n]),k=(0,A.useMemo)(()=>Y.filter(l=>!U||l.name.toLowerCase().includes(U.toLowerCase())||(l.sku??"").toLowerCase().includes(U.toLowerCase())),[Y,U]);return S?(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)(te,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"flex h-full min-h-0",children:[(0,s.jsxs)("div",{className:"flex flex-col w-[280px] shrink-0 border-r border-border",children:[(0,s.jsxs)("div",{className:"px-3 py-2.5 border-b border-border bg-muted/10 flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(qe,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),(0,s.jsx)("input",{value:f,onChange:l=>T(l.target.value),placeholder:"Filtrer...",className:"w-full pl-7 pr-2 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-foreground
2/30"})]}),(0,s.jsx)("button",{onClick:r,disabled:S,className:"p-1.5 rounded-lg hover:bg-muted/50 text-muted-foreground disabled:opacity-40",title:"Rafraichir",children:(0,s.jsx)(ue,{className:`w-3.5 h-3.5 ${S?"animate-spin":""}`})}),i&&(0,s.jsx)(te,{className:"w-3.5 h-3.5 animate-spin text-primary shrink-0"})]}),(0,s.jsx)("div",{className:"px-3 pt-2.5 pb-1.5 shrink-0",children:(0,s.jsxs)("button",{onClick:()=>v([],"all"),className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg border text-xs transition-colors",H?"border-primary/40 bg-primary/8 text-primary font-medium":"border-border bg-muted/20 text-muted-foreground hover:bg-muted/40"),children:[(0,s.jsx)(ee,{className:"w-3.5 h-3.5 shrink-0"}),(0,s.jsx)("span",{className:"flex-1 text-left",children:"Tous les dossiers visibles"}),H&&(0,s.jsx)(ie,{className:"w-3 h-3 shrink-0"})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-3 pb-3 space-y-1",children:pe.length===0?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[(0,s.jsx)(ke,{className:"w-8 h-8 text-muted-foreground/20"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:f?"Aucun resultat":"Aucun dossier catalogue"}),!f&&(0,s.jsx)("p",{className:"text-[10px] text-muted-foreground/60 max-w-[180px]",children:"Creez des dossiers dans Catalogue pour les attribuer ici."})]}):pe.map(l=>{let p=H||b.includes(l.id),L=y?.id===l.id,O=se[l.id]??0,V=l.folderType==="pspace";return(0,s.jsxs)("div",{className:w("flex items-center gap-2 rounded-xl border transition-all",L?"border-primary/40 bg-primary/6":p&&V?"border-violet-500/30 bg-violet-500/5":p?"border-emerald-500/30 bg-emerald-500/5":"border-border/50 bg-card/40"),children:[(0,s.jsx)("button",{className:w("flex items-center justify-center w-11 self-stretch rounded-l-xl shrink-0 transition-colors border-r",p?V?"text-violet-500 hover:bg-violet-500/15 border-violet-500/20":"text-emerald-500 hover:bg-emerald-500/15 border-emerald-500/20":"text-muted-foreground/30 hover:text-muted-foreground hover:bg-muted/40 border-border/30"),title:p?"Masquer ce dossier":"Rendre visible",onClick:z=>{z.stopPropagation(),E(l.id)},children:i?(0,s.jsx)(te,{className:"w-3.5 h-3.5 animate-spin"}):p?(0,s.jsx)(ee,{className:"w-3.5 h-3.5"}):(0,s.jsx)(fe,{className:"w-3.5 h-3.5"})}),(0,s.jsxs)("button",{className:"flex items-center gap-2 flex-1 min-w-0 py-2 pr-2.5 text-left",onClick:()=>{G(L?null:l),q("")},children:[(0,s.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-sm shrink-0",style:{backgroundColor:l.color+"20",border:"1px solid "+l.color+"40"},children:l.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("p",{className:"text-xs font-semibold truncate",children:l.name}),V&&(0,s.jsx)("span",{className:"text-[9px] font-medium px-1 py-0.5 rounded bg-violet-500/15 text-violet-500 border border-violet-500/20 shrink-0",children:"canal"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,s.jsx)("span",{className:"text-[10px] font-mono",style:{color:l.color},children:l.tag}),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["\xB7 ",O," produit",O!==1?"s":""]})]})]}),(0,s.jsx)(ht,{className:w("w-3.5 h-3.5 shrink-0 transition-colors",L?"text-primary":"text-muted-foreground/30")})]})]},l.id)})}),(0,s.jsx)("div",{className:"px-3 py-2 border-t border-border bg-muted/10 shrink-0",children:(0,s.jsx)("p",{className:"text-[10px] text-muted-foreground text-center",children:H?"Tous les dossiers visibles pour les clients.":`${b.length} dossier${b.length>1?"s":""} visible${b.length>1?"s":""} - ${d}`})})]}),(0,s.jsx)("div",{className:"flex-1 min-w-0 flex flex-col",children:(0,s.jsx)(ye,{mode:"wait",children:y?(0,s.jsxs)(xe.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},transition:{duration:.12},className:"flex flex-col h-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border shrink-0 bg-muted/10",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-base shrink-0",style:{backgroundColor:y.color+"20",border:"1px solid "+y.color+"40"},children:y.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-semibold truncate",children:y.name}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,s.jsxs)("p",{className:"text-[10px] text-muted-foreground font-mono",children:[y.tag," \xB7 ",Y.length," produit",Y.length!==1?"s":""]}),Y.filter(l=>Te(l,t)==="st-actif").length>0&&(0,s.jsxs)("span",{className:"text-[10px] text-emerald-400",children:[Y.filter(l=>Te(l,t)==="st-actif").length," actifs"]}),Y.filter(l=>we(l,t)===0).length>0&&(0,s.jsxs)("span",{className:"text-[10px] text-red-400",children:[Y.filter(l=>we(l,t)===0).length," rupture"]})]})]}),y.folderType==="pspace"?(0,s.jsx)("span",{className:"flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full bg-violet-500/12 text-violet-500 border border-violet-500/20",children:"Dossier canal"}):H||b.includes(y.id)?(0,s.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full bg-emerald-500/12 text-emerald-500 border border-emerald-500/20",children:[(0,s.jsx)(ee,{className:"w-2.5 h-2.5"})," Visible"]}):(0,s.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full bg-muted text-muted-foreground border border-border",children:[(0,s.jsx)(fe,{className:"w-2.5 h-2.5"})," Masqu\xE9"]}
2)]}),(0,s.jsx)("div",{className:"px-4 py-2.5 border-b border-border/50 shrink-0",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(qe,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),(0,s.jsx)("input",{value:U,onChange:l=>q(l.target.value),placeholder:"Rechercher dans ce dossier...",className:"w-full pl-7 pr-3 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-foreground/30"})]})}),k.length>0&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b border-border/40 bg-muted/5 text-[10px] text-muted-foreground uppercase tracking-wide shrink-0",children:[(0,s.jsx)("div",{className:"w-9 shrink-0"}),(0,s.jsx)("div",{className:"flex-1",children:"Produit"}),(0,s.jsx)("div",{className:"w-24 text-right",children:"Prix canal"}),(0,s.jsx)("div",{className:"w-20 text-right",children:"Stock"}),(0,s.jsx)("div",{className:"w-28 text-right shrink-0",children:"Statut canal"})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:k.length===0?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[(0,s.jsx)(Se,{className:"w-10 h-10 text-muted-foreground/20"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:U?"Aucun resultat":"Aucun produit dans ce dossier"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground/60 max-w-xs",children:U?"Essayez un autre terme":"Ajoutez des produits a ce dossier depuis Catalogue Dossiers."})]}):(0,s.jsx)("div",{className:"divide-y divide-border/40",children:k.map(l=>(0,s.jsx)($t,{product:l,channelKey:t,localOverride:N[l.id],savingStatus:B===l.id,savingPrice:W===l.id,savingStock:ae===l.id,onStatusChange:p=>P(l,p),onPriceCommit:p=>X(l,p),onStockCommit:p=>K(l,p)},l.id))})})]},y.id):(0,s.jsxs)(xe.div,{initial:{opacity:0}
2,animate:{opacity:1},exit:{opacity:0},className:"flex flex-col items-center justify-center h-full gap-3 text-center p-8",children:[(0,s.jsx)(ke,{className:"w-12 h-12 text-muted-foreground/15"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Selectionnez un dossier"}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground/60 max-w-xs",children:"Cliquez sur un dossier pour voir ses produits et gerer sa visibilite."})]},"empty")})})]})}var c=ne(be());function _({label:t,children:d}){return(0,c.jsxs)("div",{className:"flex items-center gap-2 min-h-[28px]",children:[(0,c.jsx)("span",{className:"w-28 shrink-0 text-[10px] text-muted-foreground leading-tight",children:t}),(0,c.jsx)("div",{className:"flex-1",children:d})]})}function D({value:t,onChange:d,placeholder:n,mono:o}){return(0,c.jsx)("input",{value:t,onChange:a=>d(a.target.value),placeholder:n,className:`w-full px-2.5 py-1 rounded-lg border border-border bg-background text-[11px] outline-none focus:border-brand/40 ${o?"font-mono":""}`})}function Ae({value:t,onChange:d,label:n}){return(0,c.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer group",title:n,children:[(0,c.jsxs)("span",{className:"w-6 h-6 rounded-md border border-border overflow-hidden shrink-0 relative",children:[(0,c.jsx)("input",{type:"color",value:t,onChange:o=>d(o.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"}),(0,c.jsx)("span",{className:"absolute inset-0",style:{background:t}})]}),(0,c.jsx)("span",{className:"text-[10px] text-muted-foreground group-hover:text-foreground transition-colors",children:n}),(0,c.jsx)("input",{value:t,onChange:o=>d(o.target.value),className:"flex-1 px-2 py-0.5 rounded border border-border bg-background text-[10px] font-mono outline-none focus:border-brand/30"})]})}function Vt({checked:t,onChange:d,label:n}){return(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("span",{className:"text-[10px] text-muted-foreground",children:n}),(0,c.jsx)("button",{type:"button",onClick:()=>d(!t),className:`w-8 h-5 rounded-full relative transition-colors ${t?"bg-brand":"bg-accent/40"}`,children:(0,c.jsx)("span",{className:`w-3.5 h-3.5 rounded-full bg-white shadow absolute top-[3px] transition-all ${t?"left-[14px]":"left-[3px]"}`})})]})}function re({title:t,children:d}){return(0,c.jsxs)("div",{className:"space-y-2",children:[(0,c.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider pt-1",children:t}),(0,c.jsx)("div",{className:"space-y-1.5 bg-card/40 rounded-xl border border-border p-3",children:d})]})}function Ze({config:t,onChange:d}){let n={...ve,...t},o=(a,b)=>d({[a]:b});return(0,c.jsxs)("div",{className:"space-y-4 text-xs",children:[(0,c.jsx)("div",{className:"flex justify-end",children:(0,c.jsx)("button",{type:"button",onClick:()=>d({...ve}),className:"text-[10px] text-muted-foreground hover:text-foreground border border-border px-2.5 py-1 rounded-lg transition-colors",children:"\u21BA R\xE9initialiser"})}),(0,c.jsxs)(re,{title:"Barre sup\xE9rieure",children:[(0,c.jsx)(_,{label:"Badge gauche",children:(0,c.jsx)(D,{value:n.topbarBadge,onChange:a=>o("topbarBadge",a),placeholder:"Espace r\xE9serv\xE9\u2026"})}),(0,c.jsx)(_,{label:"Identit\xE9 droite",children:(0,c.jsx)(D,{value:n.topbarIdent,onChange:a=>o("topbarIdent",a),placeholder:"Maison \xB7 Ville \xB7 Est."})})]}),(0,c.jsxs)(re,{title:"H\xE9ros",children:[(0,c.jsx)(_,{label:"Ornement",children:(0,c.jsx)(D,{value:n.eyebrowOrnament,onChange:a=>o("eyebrowOrnament",a)})}),(0,c.jsx)(_,{label:"Nom marque",children:(0,c.jsx)(D,{value:n.brandName,onChange:a=>o("brandName",a),placeholder:"KANALPHA"})})]}),(0,c.jsxs)(re,{title:"Tagline",children:[(0,c.jsx)(_,{label:"Ligne 1",children:(0,c.jsx)(D,{value:n.tagline,onChange:a=>o("tagline",a)})}),(0,c.jsx)(_,{label:"Mot dor\xE9",children:(0,c.jsx)(D,{value:n.taglineHighlight,onChange:a=>o("taglineHighlight",a)})}),(0,c.jsx)(_,{label:"Suite",children:(0,c.jsx)(D,{value:n.taglineSuffix,onChange:a=>o("taglineSuffix",a)})})]}),(0,c.jsxs)(re,{title:"Sous-texte (s\xE9par\xE9s \u2726)",children:[(0,c.jsx)(_,{label:"Item 1",children:(0,c.jsx)(D,{value:n.subtext1,onChange:a=>o("subtext1",a)})}),(0,c.jsx)(_,{label:"Item 2",children:(0,c.jsx)(D,{value:n.subtext2,onChange:a=>o("subtext2",a)})}),(0,c.jsx)(_,{label:"Item 3",children:(0,c.jsx)(D,{value:n.subtext3,onChange:a=>o("subtext3",a)})})]}),(0,c.jsxs)(re,{title:"Boutons CTA",children:[(0,c.jsx)(_,{label:"Connexion",children:(0,c.jsx)(D,{value:n.loginBtnLabel,onChange:a=>o("loginBtnLabel",a)})}),(0,c.jsx)(_,{label:"Inscription",children:(0,c.jsx)(D,{value:n.signupBtnLabel,onChange:a=>o("signupBtnLabel",a)})})]}),(0,c.jsxs)(re,{title:"Badges meta",children:[(0,c.jsx)(_,{label:"Badge 1",children:(0,c.jsx)(D,{value:n.meta1,onChange:a=>o("meta1",a)})}),(0,c.jsx)(_,{label:"Badge 2",children:(0,c.jsx)(D,{value:n.meta2,onChange:a=>o("meta2",a)})}),(0,c.jsx)(_,{label:"Badge 3",children:(0,c.jsx)(D,{value:n.meta3,onChange:a=>o("meta3",a)})})]}),(0,c.jsxs)(re,{title:"Barre inf\xE9rieure",children:[(0,c.jsx)(_,{label:"Copyright",children:(0,c.jsx)(D,{value:n.footerLeft,onChange:a=>o("footerLeft",a)})}),(0,c.jsx)(_,{label:"Ornement",children:(0,c.jsx)(D,{value:n.footerOrnament,onChange:a=>o("footerOrnament",a)})}),(0,c.jsx)(_,{label:"Droite",children:(0,c.jsx)(D,{value:n.footerRight,onChange:a=>o("footerRight",a)})})]}),(0,c.jsxs)(re,{title:"Palette dor\xE9e",children:[(0,c.jsx)(Ae,{value:n.goldMain,onChange:a=>o("goldMain",a),label:"Or principal"}),(0,c.jsx)(Ae,{value:n.goldLight,onChange:a=>o("goldLight",a),label:"Or clair"}),(0,c.jsx)(Ae,{value:n.goldBright,onChange:a=>o("goldBright",a),label:"Or brillant"}),(0,c.jsx)(Ae,{value:n.goldDeep,onChange:a=>o("goldDeep",a),label:"Or profond"}),(0,c.jsx)(Ae,{value:n.bgBase,onChange:a=>o("bgBase",a),label:"Fond"})]}),(0,c.jsxs)(re,{title:"Options visuelles",children:[(0,c.jsx)(Vt,{checked:n.particlesEnabled,onChange:a=>o("particlesEnabled",a),label:"Paillettes anim\xE9es"}),(0,c.jsx)(Vt,{checked:n.geometryEnabled,onChange:a=>o("geometryEnabled",a),label:"G\xE9om\xE9tries SVG"})]})]})}var e=ne(be());
2function Re({title:t,icon:d,children:n,defaultOpen:o=!1}){let[a,b]=(0,h.useState)(o);return(0,e.jsxs)("div",{className:"border border-border rounded-xl overflow-hidden",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>b(m=>!m),className:"w-full flex items-center justify-between px-4 py-3 bg-card hover:bg-accent/5 transition-colors",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs font-semibold",children:[(0,e.jsx)(d,{className:"w-3.5 h-3.5 text-primary"}),t]}),a?(0,e.jsx)(Be,{className:"w-3.5 h-3.5 text-muted-foreground"}):(0,e.jsx)(Me,{className:"w-3.5 h-3.5 text-muted-foreground"})]}),a&&(0,e.jsx)("div",{className:"border-t border-border px-4 py-3 space-y-3 bg-card/50",children:n})]})}function Xt({cfg:t,allFolders:d,onChange:n}){let o={...Ot,...t.spaceStyle??{}},a=i=>n({spaceStyle:{...o,...i}}),b=o.folderOrder.filter(i=>d.some(g=>g.id===i)),m=d.filter(i=>!b.includes(i.id)),C=[...b.map(i=>d.find(g=>g.id===i)).filter(Boolean),...m],x=i=>{let g=C.map(T=>T.id),f=g.indexOf(i);f<=0||([g[f-1],g[f]]=[g[f],g[f-1]],a({folderOrder:g}))},S=i=>{let g=C.map(T=>T.id),f=g.indexOf(i);f<0||f>=g.length-1||([g[f],g[f+1]]=[g[f+1],g[f]],a({folderOrder:g}))},u=i=>{let g=o.hiddenFolderIds??[];a({hiddenFolderIds:g.includes(i)?g.filter(f=>f!==i):[...g,i]})};return(0,e.jsxs)("div",{className:"p-4 space-y-3 max-w-xl",children:[(0,e.jsxs)(Re,{title:"Th\xE8me de la boutique client",icon:Ue,defaultOpen:!0,children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-3",children:"Style visuel de l'espace que vos clients voient apr\xE8s connexion."}),(0,e.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{id:"default",label:"Standard",desc:"Interface sobre et adaptative"},{id:"velvet",label:"Velvet Noir",desc:"Fond sombre, accents dor\xE9s, premium"}].map(i=>(0,e.jsxs)("button",{type:"button",onClick:()=>a({theme:i.id}),className:w("p-3 rounded-xl border text-left transition-all",o.theme===i.id?"border-primary/40 bg-primary/5":"border-border bg-card/50 hover:bg-muted/30"),children:[(0,e.jsxs)("div",{className:w("w-full h-10 rounded-lg mb-2 border border-border/50 overflow-hidden flex",i.id==="velvet"?"bg-[#050403]":"bg-background"),children:[(0,e.jsx)("div",{className:w("w-8 h-full",i.id==="velvet"?"bg-[#0a0807] border-r border-[rgba(212,168,90,0.2)]":"bg-muted/40 border-r border-border")}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col justify-center px-2 gap-1",children:[(0,e.jsx)("div",{className:w("h-1.5 rounded-full w-3/4",i.id==="velvet"?"bg-[#d4a85a]/60":"bg-primary/30")}),(0,e.jsx)("div",{className:w("h-1 rounded-full w-1/2",i.id==="velvet"?"bg-white/10":"bg-muted")})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs font-medium",children:i.label}),o.theme===i.id&&(0,e.jsx)(ie,{size:11,className:"text-primary"})]}),(0,e.jsx)("p",{className:"text-[9px] text-muted-foreground mt-0.5",children:i.desc})]},i.id))})]}),(0,e.jsxs)(Re,{title:"Couleur accent",icon:Ue,children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-2",children:"Couleur principale des boutons, badges et \xE9l\xE9ments actifs."}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("label",{className:"w-9 h-9 rounded-lg border border-border overflow-hidden cursor-pointer shrink-0 relative",children:[(0,e.jsx)("input",{type:"color",value:o.accentColor,onChange:i=>a({accentColor:i.target.value}),className:"absolute inset-0 opacity-0 cursor-pointer"}),(0,e.jsx)("div",{className:"w-full h-full",style:{backgroundColor:o.accentColor}})]}),(0,e.jsx)("input",{value:o.accentColor,onChange:i=>a({accentColor:i.target.value}),className:"flex-1 px-3 py-1.5 rounded-lg border border-border bg-background text-xs font-mono outline-none focus:border-primary/40",placeholder:"#6366f1"}),(0,e.jsx)("div",{className:"flex gap-1",children:["#6366f1","#d4a85a","#10b981","#f59e0b","#ef4444","#8b5cf6"].map(i=>(0,e.jsx)("button",{type:"button",onClick:()=>a({accentColor:i}),className:"w-5 h-5 rounded-full border-2 transition-all shrink-0",style:{backgroundColor:i,borderColor:o.accentColor===i?"white":"transparent"}},i))})]})]}),(0,e.jsxs)(Re,{title:"Cartes produit",icon:He,children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-3",children:"Style des cartes dans la boutique client. Les changements sont visibles imm\xE9diatement en aper\xE7u."}),(0,e.jsx)("div",{className:"mb-4 flex gap-2 p-3 bg-muted/30 rounded-xl border border-border/40",children:["",""].map((i,g)=>(0,e.jsxs)("div",{className:"flex-1 bg-card overflow-hidden transition-all",style:{borderRadius:o.cardRadius==="sm"?"8px":o.cardRadius==="md"?"12px":o.cardRadius==="xl"?"24px":"16px",border:o.cardBorder==="none"?"1px solid transparent":o.cardBorder==="accent"?`1px solid ${o.accentColor}55`:o.cardBorder==="medium"?"1px solid var(--border)":"1px solid rgba(0,0,0,0.1)",boxShadow:o.cardShadow==="none"?"none":o.cardS
2hadow==="md"?"0 4px 16px rgba(0,0,0,.12)":"0 2px 8px rgba(0,0,0,.06)"},children:[(0,e.jsx)("div",{className:"h-10 bg-muted/40"}),(0,e.jsxs)("div",{className:"p-2 space-y-1",children:[(0,e.jsx)("div",{className:"h-1.5 w-3/4 bg-muted/60 rounded"}),(0,e.jsx)("div",{className:"h-1.5 w-1/2 bg-muted/40 rounded"}),(0,e.jsx)("div",{className:"h-4 rounded mt-1",style:{background:o.accentColor,opacity:.85}})]})]},g))}),(0,e.jsxs)("div",{className:"space-y-1.5 mb-3",children:[(0,e.jsx)("p",{className:"text-[10px] font-medium text-muted-foreground",children:"Bordures"}),(0,e.jsx)("div",{className:"grid grid-cols-4 gap-1.5",children:[["none","Aucune"],["subtle","Subtile"],["medium","Visible"],["accent","Accent"]].map(([i,g])=>(0,e.jsx)("button",{type:"button",onClick:()=>a({cardBorder:i}),className:`text-[9px] py-1.5 rounded-lg border transition-all ${o.cardBorder===i?"border-foreground/50 bg-foreground/5 font-semibold":"border-border/40 text-muted-foreground hover:border-border"}`,children:g},i))})]}),(0,e.jsxs)("div",{className:"space-y-1.5 mb-3",children:[(0,e.jsx)("p",{className:"text-[10px] font-medium text-muted-foreground",children:"Arrondi"}),(0,e.jsx)("div",{className:"grid grid-cols-4 gap-1.5",children:[["sm","Petit"],["md","Moyen"],["lg","Grand"],["xl","Max"]].map(([i,g])=>(0,e.jsx)("button",{type:"button",onClick:()=>a({cardRadius:i}),className:`text-[9px] py-1.5 rounded-lg border transition-all ${o.cardRadius===i?"border-foreground
2/50 bg-foreground/5 font-semibold":"border-border/40 text-muted-foreground hover:border-border"}`,children:g},i))})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("p",{className:"text-[10px] font-medium text-muted-foreground",children:"Ombre port\xE9e"}),(0,e.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:[["none","Aucune"],["sm","L\xE9g\xE8re"],["md","Prononc\xE9e"]].map(([i,g])=>(0,e.jsx)("button",{type:"button",onClick:()=>a({cardShadow:i}),className:`text-[9px] py-1.5 rounded-lg border transition-all ${o.cardShadow===i?"border-foreground/50 bg-foreground/5 font-semibold":"border-border/40 text-muted-foreground hover:border-border"}`,children:g},i))})]})]}),C.length>0&&(0,e.jsxs)(Re,{title:"Pr\xE9sentation du catalogue",icon:He,defaultOpen:!0,children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-3",children:"R\xE9organisez l'ordre des cat\xE9gories et masquez celles que vous ne souhaitez pas afficher c\xF4t\xE9 client."}),(0,e.jsx)("div",{className:"space-y-1",children:C.map((i,g)=>{let f=(o.hiddenFolderIds??[]).includes(i.id),T=g===0,y=g===C.length-1;return(0,e.jsxs)("div",{className:w("flex items-center gap-2 p-2 rounded-lg border transition-all",f?"bg-muted/20 border-border/40 opacity-50":"bg-card border-border"),children:[(0,e.jsx)(wt,{size:12,className:"text-muted-foreground shrink-0"}),(0,e.jsx)("span",{className:w("flex-1 text-xs truncate",f&&"line-through text-muted-foreground"),children:i.name||i.id}),(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,e.jsx)("button",{type:"button",disabled:T,onClick:()=>x(i.id),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-25 transition-colors",children:(0,e.jsx)(Be,{size:10})}),(0,e.jsx)("button",{type:"button",disabled:y,onClick:()=>S(i.id),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-25 transition-colors",children:(0,e.jsx)(Me,{size:10})}),(0,e.jsx)("button",{type:"button",onClick:()=>u(i.id),title:f?"Afficher":"Masquer",className:w("w-5 h-5 flex items-center justify-center rounded transition-colors",f?"text-primary hover:text-primary/70":"text-muted-foreground hover:text-foreground"),children:f?(0,e.jsx)(ee,{size:10}):(0,e.jsx)(fe,{size:10})})]})]},i.id)})}),(o.hiddenFolderIds??[]).length>0&&(0,e.jsxs)("p",{className:"text-[9px] text-muted-foreground mt-2",children:[(o.hiddenFolderIds??[]).length," cat\xE9gorie(s) masqu\xE9e(s) dans la boutique client."]})]}),(0,e.jsx)(zt,{shop:{...ze,...t.shopConfig??{}},onChange:i=>n({shopConfig:{...ze,...t.shopConfig??{},...i}})})]})}var Ke=[{saisie:"g",stored:"unit-g",label:"g",factor:1},{saisie:"kg",stored:"unit-g",label:"kg",factor:1e3},{saisie:"ml",stored:"unit-ml",label:"ml",factor:1},{saisie:"L",stored:"unit-ml",label:"L",factor:1e3},{saisie:"u",stored:"unit-u",label:"u",factor:1}];function zt({shop:t,onChange:d}){let[n,o]=(0,h.useState)(""),[a,b]=(0,h.useState)("g"),m=t.presetQties??[],C=t.presetUnit??"unit-g",x=()=>{let u=parseFloat(n);if(isNaN(u)||u<=0)return;let i=Ke.find(T=>T.saisie===a)??Ke[0],g=i.stored,f=Math.round(u*i.factor);m.includes(f)||d({presetQties:[...m,f].sort((T,y)=>T-y),presetUnit:g}),o("")},S=u=>d({presetQties:m.filter(i=>i!==u)});return(0,e.jsxs)(Re,{title:"Quantit\xE9s rapides catalogue",icon:It,defaultOpen:!0,children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"Boutons affich\xE9s sur chaque produit. Saisissez en g, kg, ml, L ou unit\xE9s. L'unit\xE9 du premier preset d\xE9finit l'unit\xE9 d'affichage c\xF4t\xE9 client."}),(0,e.jsx)("div",{className:"flex gap-1 flex-wrap mb-1",children:["unit-g","unit-ml","unit-u"].map(u=>{let i={"unit-g":"Poids (g/kg)","unit-ml":"Volume (ml/L)","unit-u":"Unit\xE9s"};return(0,e.jsx)("button",{type:"button",onClick:()=>d({presetUnit:u}),className:w("px-2.5 py-1 rounded-lg text-[10px] font-semibold border transition-all",C===u?"bg-primary/10 border-primary/40 text-primary":"bg-muted/30 border-border/40 text-muted-foreground hover:bg-muted"),children:i[u]},u)})}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] py-1",children:[m.map(u=>(0,e.jsxs)("span",{className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-muted text-xs font-medium border border-border/60",children:[ct(u,C),(0,e.jsx)("button",{type:"button",onClick:()=>S(u),className:"text-muted-foreground hover:text-destructive ml-0.5",children:(0,e.jsx)(Pe,{className:"w-2.5 h-2.5"})})]},u)),m.length===0&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground italic",children:"Aucun preset \u2014 bouton standard affich\xE9"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("input",{type:"number",value:n,onChange:u=>o(u.target.value),onKeyDown:u=>u.key==="Enter"&&x(),placeholder:"Quantit\xE9",className:"flex-1 px-3 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-primary/40"}),(0,e.jsx)("select",{value:a,onChange:u=>b(u.target.value),className:"px-2.5 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-primary/40",children:Ke.map(u=>(0,e.jsx)("option",{value:u.saisie,children:u.label},u.saisie))}),(0,e.jsxs)("button",{type:"button",onClick:x,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold",children:[(0,e.jsx)(St,{className:"w-3 h-3"})," Ajouter"]})]}),(0,e.jsx)("p",{className:"text-[9px] text-muted-foreground",children:"Ex : 100g + 500g + 1kg \u2192 stock\xE9s 100/500/1000, affich\xE9s 100 g / 500 g / 1 kg"})]})}function Q({children:t}){return(0,e.jsx)("label",{className:"block text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:t})}function Ee({value:t,onChange:d,placeholder:n,mono:o}){return(0,e.jsx)("input",{value:t,onChange:a=>d(a.target.value),placeholder:n,className:w("w-full px-3 py-2 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50 transition-colors",o&&"font-mono")})}function et({on:t,onChange:d,label:n,sub:o}){return(0,e.jsxs)("button",{type:"button",onClick:()=>d(!t),className:"flex items-start gap-3 text-left w-full py-2",children:[(0,e.jsx)("div",{className:"mt-0.5 shrink-0",children:t?(0,e.jsx)(Et,{className:"w-5 h-5 text-primary"}):(0,e.jsx)(Rt,{className:"w-5 h-5 text-muted-foreground"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:w("text-xs font-medium",t?"text-foreground":"text-muted-foreground"),children:n}),o&&(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:o})]})]})}function tt(t){try{return JSON.parse(t.value)?.label||t.key}catch{return t.key}}
2function Gt(){let{channelKey:t}=it(),d=nt(),n=xt(k=>k.user),o=bt(k=>k.products),[a,b]=(0,h.useState)("apercu"),[m,C]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),[u,i]=(0,h.useState)([]),[g,f]=(0,h.useState)(!0),[T,y]=(0,h.useState)(!1),[G,U]=(0,h.useState)(!1),[q,B]=(0,h.useState)(!1),[$,W]=(0,h.useState)(""),oe=(0,h.useRef)(null),[ae,Z]=(0,h.useState)(!1),[N,I]=(0,h.useState)([]),[r,v]=(0,h.useState)(!1),E=(0,h.useCallback)(async()=>{if(t){f(!0),Ut(),de(j.CONFIG);try{let[k,l,p]=await Promise.all([je.list("sales_channel"),Le(t),De()]),L=k.find(ge=>ge.key===t)??null;C(L);let O=l??Ft(t,tt(L??{key:t,value:"{}"})),V=O.adminUserId||String(n?.userId??""),z={...O,slug:le(O.slug),folderIds:O.folderIds??[],registerMode:O.registerMode??"open",allowedEmails:O.allowedEmails??"",adminNodeId:O.adminNodeId||(n?.nodeId??""),adminUserId:V,premiumHero:O.premiumHero?{...me,...O.premiumHero}:{...me}},Ne=z;try{let ge=await Ce(j.CONFIG),at="partner_landing_";if(ge.filter(J=>F(J,R.KEY).startsWith(at)&&F(J,R.KEY)!==`${at}${t}`).map(J=>{try{return JSON.parse(F(J,R.VALUE))}catch{return null}}).filter(Boolean).some(J=>J.active&&J.slug&&le(J.slug)===le(z.slug)&&J.adminUserId)){let J=le(t.replace(/^pspace_/,""));Ne={...z,slug:J},he(Ne).catch(()=>{})}}catch{}S(Ne),!O.adminUserId&&V&&!Ne.slug.startsWith("mp")&&he(Ne).catch(()=>{}),i(p.filter(ge=>ge.folderType==="pspace"&&ge.pspaceChannelKey===t))}catch{}f(!1)}},[t,n]);(0,h.useEffect)(()=>{E()},[E]),(0,h.useEffect)(()=>{a!=="apercu"||ae||!t||!n||(v(!0),Ce(j.ORDERS).then(k=>{let l=k.filter(p=>F(p,R.O_CHANNEL)===t).map(p=>({id:p.id,num:F(p,R.O_NUM),email:F(p,R.O_EMAIL),total:parseFloat(F(p,R.O_TOTAL)||"0"),status:F(p,R.O_STATUS),created:F(p,R.O_CREATED)})).sort((p,L)=>new Date(L.created).getTime()-new Date(p.created).getTime()).slice(0,15);I(l),Z(!0)}).catch(()=>{}).finally(()=>v(!1)))},[a,ae,t,n]);let P=k=>S(l=>l&&{...l,...k}),X=async()=>{if(x){y(!0);try{let k={...x,adminNodeId:n?.nodeId??x.adminNodeId,adminUserId:String(n?.userId??x.adminUserId)},l=le(k.slug);try{let p=await Ce(j.CONFIG),L="partner_landing_";if(p.filter(V=>{let z=F(V,R.KEY);return z.startsWith(L)&&z!==`${L}${t}`}).some(V=>{try{let z=JSON.parse(F(V,R.VALUE));return z.active&&z.slug&&le(z.slug)===l}catch{return!1}})){M.error(`Le lien "/partner/${l}" est d\xE9j\xE0 utilis\xE9 par un autre espace actif. Choisissez un slug diff\xE9rent.`),y(!1);return}}catch{}await he(k),Dt(k),S(k),M.success("Espace sauvegard\xE9")}catch{M.error("Erreur lors de la sauvegarde")}y(!1)}},K=(0,h.useCallback)(async()=>{let k=$.trim();if(!k||!m||k===tt(m)){B(!1);return}try{let l=(()=>{try{return JSON.parse(m.value)}catch{return{}}})(),p=JSON.stringify({...l,label:k});await je.update(m.id,{[R.CG_VAL]:p,[R.TEXT]:k}),C({...m,value:p}),M.success("Renomm\xE9")}catch{M.error("Erreur renommage")}B(!1)},[$,m]),H=m?tt(m):t??"\u2014",pe=m?.color??"#6366f1",se=x?Je(`/partner/${x.slug}`):"";if(g)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)(te,{className:"w-5 h-5 animate-spin text-muted-foreground"})});let Y=[{id:"apercu",icon:ee,label:"Aper\xE7u"},{id:"acces",icon:_e,label:"Acc\xE8s"},{id:"landing",icon:Ct,label:"Landing"},{id:"design",icon:Ue,label:"Design"},{id:"dossiers",icon:ke,label:"Dossiers"}];return(0,e.jsxs)("div",{className:"flex flex-col h-full min-h-0 bg-background",children:[(0,e.jsxs)("div",{className:"shrink-0 flex items-center gap-2 px-3 py-2.5 border-b border-border bg-card/60",children:[(0,e.jsx)("button",{onClick:()=>d("/dashboard/partner-space"),className:"p-1.5 rounded-lg hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:(0,e.jsx)(vt,{className:"w-4 h-4"})}),(0,e.jsx)("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center shrink-0",style:{background:`${pe}20`,border:`1px solid ${pe}40`},children:(0,e.jsx)(At,{className:"w-3 h-3",style:{color:pe}})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[q?(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{ref:oe,value:$,onChange:k=>W(k.target.value),onBlur:K,onKeyDown:k=>{k.key==="Enter"&&K(),k.key==="Escape"&&B(!1)},autoFocus:!0,className:"flex-1 px-2 py-0.5 rounded border border-primary/40 bg-background text-sm font-semibold outline-none"}),(0,e.jsx)("button",{onClick:K,children:(0,e.jsx)(ie,{className:"w-3 h-3 text-muted-foreground"})})]}):(0,e.jsxs)("div",{className:"flex items-center gap-1 group/name cursor-pointer",onClick:()=>{W(H),B(!0)},children:[(0,e.jsx)("h1",{className:"text-sm font-semibold truncate",children:H}),(0,e.jsx)(Ve,{className:"w-2.5 h-2.5 text-muted-foreground opacity-0 group-hover/name:opacity-60 transition-opacity shrink-0"})]}),x&&(0,e.jsxs)("div",{className:"flex items-center gap-1 mt-0.5",children:[(0,e.jsx)("span",{className:"text-[8px]",children:x.active?"\u{1F7E2}":"\u26AB"}),(0,e.jsx)("a",{href:se,target:"_blank",rel:"noopener noreferrer",className:"text-[9px] text-primary/70 font-mono hover:text-primary transition-colors underline underline-offset-2 truncate max-w-[140px]",title:se,children:se})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[x?.slug&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(se).catch(()=>{})},className:"p-1.5 rounded-lg hover:bg-muted transition-colors text-muted-foreground",title:"Copier le lien partenaire",children:(0,e.jsx)(Oe,{className:"w-3.5 h-3.5"})}),x?.slug&&(0,e.jsx)("button",{onClick:()=>window.open(se,"_blank"),className:"p-1.5 rounded-lg hover:bg-muted transition-colors text-muted-foreground",title:"Ouvrir la page partenaire",children:(0,e.jsx)(Fe,{className:"w-3.5 h-3.5"})}),x&&(0,e.jsxs)("button",{onClick:()=>U(!0),className:"flex items-center gap-1 px-2 py-1.5 rounded-lg border border-border text-[10px] text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)(ee,{className:"w-3 h-3"}),(0,e.jsx)("span",{className:"hidden sm:inline",children:"Aper\xE7u"})]}),(0,e.jsxs)("button",{onClick:X,disabled:T||!x,className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-primary text-primary-foreground text-[11px] font-medium hover:opacity-90 disabled:opacity-50",children:[T?(0,e.jsx)(te,{className:"w-3 h-3 animate-spin"}):(0,e.jsx)(Pt,{className:"w-3 h-3"})," Sauvegarder"]})]})]}),(0,e.jsx)("div",{className:"shrink-0 flex border-b border-border/50 px-2 bg-card/10 overflow-x-auto",children:Y.map(k=>(0,e.jsxs)("button",{onClick:()=>b(k.id),className:w("relative flex items-center gap-1.5 px-3 py-2.5 text-[11px] font-medium whitespace-nowrap transition-colors shrink-0",a===k.id?"text-foreground":"text-muted-foreground hover:text-foreground
2/70"),children:[(0,e.jsx)(k.icon,{className:"w-3.5 h-3.5"}),k.label,a===k.id&&(0,e.jsx)("span",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-foreground/60"})]},k.id))}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,e.jsx)(ye,{mode:"wait",initial:!1,children:(0,e.jsxs)(xe.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.1},className:"h-full overflow-y-auto",children:[a==="apercu"&&(0,e.jsx)(Yt,{cfg:x,channelKey:t,partnerOrders:N,loading:r,onRefresh:()=>{Z(!1),de(j.ORDERS)}}),a==="acces"&&x&&(0,e.jsx)(Wt,{cfg:x,onChange:P}),a==="landing"&&x&&(0,e.jsx)(Kt,{cfg:x,onChange:P,partnerUrl:se}),a==="design"&&x&&(0,e.jsx)(Xt,{cfg:x,allFolders:u,onChange:P}),a==="dossiers"&&t&&(0,e.jsx)(We,{channelKey:t,spaceName:H,folders:u,products:o,onFoldersChange:i})]},a)})}),(0,e.jsx)(ye,{children:G&&x&&(0,e.jsxs)(xe.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-50 flex flex-col bg-background",children:[(0,e.jsxs)("div",{className:"shrink-0 flex items-center gap-3 px-4 py-2.5 border-b border-border bg-card/80 backdrop-blur-sm",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-[11px] font-medium text-amber-400",children:[(0,e.jsx)(ee,{className:"w-3.5 h-3.5"})," MODE APER\xC7U CLIENT"]}),(0,e.jsx)("p",{className:"flex-1 text-[11px] text-muted-foreground",children:"Vue tel qu'un partenaire connect\xE9 le verrait."}),(0,e.jsxs)("button",{onClick:()=>U(!1),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)(Pe,{className:"w-3 h-3"})," Fermer"]})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,e.jsx)(Mt,{cfg:x,onLogout:()=>U(!1),isAdmin:!0})})]})})]})}var rt=8;function Jt({clients:t}){let[d,n]=(0,h.useState)(0),o=t.length,a=Math.ceil(o/rt),b=t.slice(d*rt,(d+1)*rt);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsxs)("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:["Clients partenaires ",(0,e.jsxs)("span",{className:"normal-case font-normal",children:["(",o,")"]})]}),a>1&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{disabled:d===0,onClick:()=>n(m=>m-1),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-xs",children:"\u2039"}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[d+1,"/",a]}),(0,e.jsx)("button",{disabled:d>=a-1,onClick:()=>n(m=>m+1),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-xs",children:"\u203A"})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border/30 rounded-xl border border-border overflow-hidden",children:b.map(m=>{let C=[m.firstName,m.lastName].filter(Boolean).join(" ")||m.email,x=C[0]?.toUpperCase()??"?",S=new Date(m.addedAt).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit"});return(0,e.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2 bg-card text-xs",children:[(0,e.jsx)("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center shrink-0 text-[10px] font-bold text-primary",children:x}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"font-medium truncate leading-tight",children:C}),(0,e.jsxs)("p",{className:"text-[10px] text-muted-foreground truncate",children:[m.email,m.company?` \xB7 ${m.company}`:""]})]}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/60 shrink-0 tabular-nums",children:S})]},m.id)})})]})}var ot=5;function Yt({cfg:t,channelKey:d,partnerOrders:n,loading:o,onRefresh:a}){let b=t?Je(`/partner/${t.slug}`):"",[m,C]=(0,h.useState)(!1),[x,S]=(0,h.useState)(0),u=()=>{b&&(navigator.clipboard.writeText(b).catch(()=>{}),C(!0),setTimeout(()=>C(!1),2e3))},i=t?.partnerClients??[],g=n.reduce((N,I)=>N+I.total,0),f=n.filter(N=>N.status==="pending").length,[T,y]=(0,h.useState)([]),[G,U]=(0,h.useState)(!1),[q,B]=(0,h.useState)(null),$=(0,h.useCallback)(async()=>
2{if(d){U(!0);try{let I=(await Ce(j.USERS)).filter(r=>F(r,R.STATUS)==="status-pending"&&F(r,R.PREP_CHANNELS)===d).map(r=>({id:r.id,pseudo:F(r,R.PSEUDO),email:F(r,R.EMAIL),createdAt:F(r,R.LAST_LOGIN)||""}));y(I)}catch{}U(!1)}},[d]);(0,h.useEffect)(()=>{$()},[$]);let W=async N=>{B(N);try{await ce(j.USERS,N,{[R.STATUS]:"status-active"}),de(j.USERS),y(I=>I.filter(r=>r.id!==N))}catch{}B(null)},oe=async N=>{B(N);try{await ce(j.USERS,N,{[R.STATUS]:"status-blocked"}),de(j.USERS),y(I=>I.filter(r=>r.id!==N))}catch{}B(null)},ae={pending:"En attente",processing:"En cours",completed:"Termin\xE9e",cancelled:"Annul\xE9e"},Z={pending:"text-amber-500",processing:"text-blue-500",completed:"text-green-500",cancelled:"text-red-400"};return(0,e.jsxs)("div",{className:"p-4 space-y-4 max-w-2xl mx-auto",children:[t&&(0,e.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-xl border border-border bg-card",children:[(0,e.jsx)("div",{className:w("w-2 h-2 rounded-full shrink-0",t.active?"bg-green-500":"bg-muted-foreground")}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-xs font-semibold",children:t.spaceName}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5",children:[(0,e.jsx)("input",{readOnly:!0,value:b,onFocus:N=>N.currentTarget.select(),className:"flex-1 min-w-0 px-2 py-1 rounded-lg border border-border bg-background/60 text-[10px] font-mono text-foreground outline-none focus:border-primary/50 cursor-text transition-colors"}),(0,e.jsx)("button",{onClick:u,title:"Copier le lien",className:w("flex items-center gap-1 px-2 py-1 rounded-lg border text-[10px] font-medium transition-all shrink-0",m?"border-green-500/40 bg-green-500/10 text-green-500":"border-border bg-card hover:bg-muted text-muted-foreground"),children:m?(0,e.jsx)(ie,{className:"w-3 h-3"}):(0,e.jsx)(Oe,{className:"w-3 h-3"})}),(0,e.jsx)("a",{href:b,target:"_blank",rel:"noopener noreferrer",title:"Ouvrir",className:"flex items-center px-2 py-1 rounded-lg border border-border bg-card hover:bg-muted text-muted-foreground transition-colors shrink-0",children:(0,e.jsx)(Fe,{className:"w-3 h-3"})})]})]}),(0,e.jsx)("span",{className:w("text-[10px] font-medium px-2 py-0.5 rounded-full border shrink-0",t.active?"bg-green-500/10 text-green-500 border-green-500/20":"bg-muted text-muted-foreground border-border"),children:t.active?"Actif":"Inactif"})]}),(0,e.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{label:"Clients",value:String(i.length),icon:_e},{label:"Commandes",value:o?"\u2026":String(n.length),icon:$e},{label:"En attente",value:o?"\u2026":String(f),icon:Se}].map(N=>(0,e.jsxs)("div",{className:"flex flex-col gap-1 p-3 rounded-xl border border-border bg-card",children:[(0,e.jsx)(N.icon,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,e.jsx)("p",{className:"text-xl font-bold",children:N.value}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground",children:N.label})]},N.label))}),n.length>0&&(0,e.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-xl border border-border bg-card",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"CA total"}),(0,e.jsxs)("p",{className:"text-sm font-bold",children:[g.toFixed(2)," \u20AC"]})]}),(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsxs)("button",{onClick:()=>{a(),$()},disabled:o||G,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:[(0,e.jsx)(ue,{className:w("w-3 h-3",(o||G)&&"animate-spin")})," Actualiser"]})}),t?.registerMode==="pending_approval"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide flex-1",children:"Demandes en attente"}),T.length>0&&(0,e.jsx)("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-full bg-amber-500/15 text-amber-500",children:T.length})]}),G?(0,e.jsx)("div",{className:"flex items-center justify-center py-5",children:(0,e.jsx)(te,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):T.length===0?(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground text-center py-4 rounded-xl border border-dashed border-border",children:"Aucune demande en attente"}):(0,e.jsx)("div",{className:"rounded-xl border border-amber-500/20 overflow-hidden divide-y divide-border/40 bg-amber-500/5",children:T.map(N=>{let I=q===N.id;return(0,e.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[(0,e.jsx)("div",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center shrink-0 text-[10px] font-bold text-muted-foreground",children:(N.pseudo||N.email||"?")[0].toUpperCase()}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-xs font-medium truncate",children:N.pseudo||N.email}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground truncate",children:N.email})]}),(0,e.jsxs)("div",{className:"flex gap-1 shrink-0",children:[(0,e.jsx)("button",{onClick:()=>W(N.id),disabled:I,className:"px-2 py-1 rounded-lg bg-green-500/15 text-green-600 text-[10px] font-semibold hover:bg-green-500/25 transition-colors disabled:opacity-50",children:I?"\u2026":"\u2713 Activer"}),(0,e.jsx)("button",{onClick:()=>oe(N.id),disabled:I,className:"px-2 py-1 rounded-lg bg-red-500/10 text-red-500 text-[10px] font-semibold hover:bg-red-500/20 transition-colors disabled:opacity-50",children:"\u2715"})]})]},N.id)})})]}),n.length>0&&(()=>{let N=Math.ceil(n.length/ot),I=Math.min(x,N-1),r=n.slice(I*ot,(I+1)*ot);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsxs)("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:["Commandes ",(0,e.jsxs)("span",{className:"normal-case font-normal",children:["(",n.length,")"]})]}),N>1&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{disabled:I===0,onClick:()=>S(v=>Math.max(0,v-1)),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-xs",children:"\u2039"}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[I+1,"/",N]}),(0,e.jsx)("button",{disabled:I>=N-1,onClick:()=>S(v=>Math.min(N-1,v+1)),className:"w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-xs",children:"\u203A"})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border/30 rounded-xl border border-border overflow-hidden",children:r.map(v=>(0,e.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 bg-card text-xs",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"font-mono font-medium leading-tight",children:v.num}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground truncate",children:v.email})]}),(0,e.jsx)("span",{className:w("text-[10px] font-medium shrink-0",Z[v.status]??"text-muted-foreground"),children:ae[v.status]??v.status}),(0,e.jsxs)("span",{className:"font-semibold tabular-nums shrink-0",children:[v.total.toFixed(2)," \u20AC"]})]},v.id))})]})})(),i.length>0&&(0,e.jsx)(Jt,{clients:i}),!o&&n.length===0&&i.length===0&&(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[(0,e.jsx)($e,{className:"w-10 h-10 text-muted-foreground
2/20"}),(0,e.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Aucune activit\xE9 pour l'instant"}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground/70",children:"Ajoutez des clients dans l'onglet Acc\xE8s pour commencer."})]})]})}var Qt=()=>({email:"",firstName:"",lastName:"",phone:"",company:""});function qt({initial:t,onSave:d,onCancel:n}){let[o,a]=(0,h.useState)({...Qt(),...t}),b=x=>S=>a(u=>({...u,[x]:S.target.value})),m="w-full px-2.5 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-primary/60 transition-colors placeholder:text-muted-foreground/50",C=o.email.trim().length>3&&o.email.includes("@");return(0,e.jsxs)("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3 space-y-2",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,e.jsx)("input",{value:o.firstName,onChange:b("firstName"),placeholder:"Pr\xE9nom",className:m}),(0,e.jsx)("input",{value:o.lastName,onChange:b("lastName"),placeholder:"Nom",className:m})]}),(0,e.jsx)("input",{value:o.email,onChange:b("email"),placeholder:"Email *",type:"email",className:m}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,e.jsx)("input",{value:o.phone,onChange:b("phone"),placeholder:"T\xE9l\xE9phone",className:m}),(0,e.jsx)("input",{value:o.company,onChange:b("company"),placeholder:"Entreprise",className:m})]}),(0,e.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,e.jsx)("button",{type:"button",onClick:()=>C&&d(o),disabled:!C,className:"flex-1 py-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-medium disabled:opacity-40 transition-opacity",children:"Enregistrer"}),(0,e.jsx)("button",{type:"button",onClick:n,className:"px-3 py-1.5 rounded-lg border border-border text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Annuler"})]})]})}function Wt({cfg:t,onChange:d}){let n=t.partnerClients??[],[o,a]=(0,h.useState)([]),[b,m]=(0,h.useState)(!1),[C,x]=(0,h.useState)(""),[S,u]=(0,h.useState)(!1),[i,g]=(0,h.useState)(!1),[f,T]=(0,h.useState)(null),[y,G]=(0,h.useState)(""),[U,q]=(0,h.useState)(0),B=8;(0,h.useEffect)(()=>{!S||b||lt(j.CONTACTS).then(r=>{let v=r.map(E=>({id:E.id,ownerId:F(E,R.C_OWNER),firstName:F(E,R.C_FIRST),lastName:F(E,R.C_LAST),email:F(E,R.C_EMAIL),phone:F(E,R.C_PHONE),company:F(E,R.C_COMPANY)}));a(dt(v).filter(E=>E.email)),m(!0)}).catch(()=>{})},[S,b]);let $=new Set(n.map(r=>r.email.toLowerCase())),W=o.filter(r=>{if($.has(r.email.toLowerCase()))return!1;if(!C)return!0;let E=C.toLowerCase();return[r.firstName,r.lastName,r.email,r.company].some(P=>P?.toLowerCase().includes(E))}),oe=r=>{let v={id:crypto.randomUUID(),addedAt:new Date().toISOString(),...r};d({partnerClients:[...n,v]}),g(!1)},ae=(r,v)=>{d({partnerClients:n.map(E=>E.id===r?{...E,...v}:E)}),T(null)},Z=r=>{d({partnerClients:n.filter(v=>v.id!==r)})},N=r=>{let v={id:crypto.randomUUID(),addedAt:new Date().toISOString(),firstName:r.firstName||"",lastName:r.lastName||"",email:r.email,phone:r.phone||"",company:r.company||""};d({partnerClients:[...n,v]})},I=n.filter(r=>{if(!y)return!0;let v=y.toLowerCase();return[r.firstName,r.lastName,r.email,r.company,r.phone].some(E=>E?.toLowerCase().includes(v))});return(0,e.jsxs)("div",{className:"p-4 space-y-5 max-w-lg mx-auto",children:[(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Acc\xE8s \xE0 l'espace"}),(0,e.jsxs)("div",{className:"rounded-xl border border-border overflow-hidden divide-y divide-border/50 bg-card",children:[(0,e.jsx)("div",{className:"px-3",children:(0,e.jsx)(et,{on:t.active,onChange:r=>d({active:r}),label:"Espace actif",sub:t.active?"La landing est accessible publiquement.":"Landing masqu\xE9e \u2014 personne ne peut acc\xE9der."})}),(0,e.jsx)("div",{className:"px-3",children:(0,e.jsx)(et,{on:t.allowLogin,onChange:r=>d({allowLogin:r}),label:"Autoriser la connexion",sub:"Les partenaires existants peuvent se connecter."})}),(0,e.jsx)("div",{className:"px-3",children:(0,e.jsx)(et,{on:t.allowRegister,onChange:r=>d({allowRegister:r}),label:"Autoriser l'inscription",sub:"Les visiteurs voient le bouton d'inscription."})})]})]}),t.allowRegister&&(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Mode d'acc\xE8s \xE0 l'inscription"}),(0,e.jsx)("div",{className:"flex flex-col gap-1.5",children:[{val:"open",icon:"\u{1F7E2}",label:"Acc\xE8s public",sub:"Tout visiteur peut cr\xE9er un compte et acc\xE9der imm\xE9diatement."},{val:"pending_approval",icon:"\u23F3",label:"Validation requise",sub:"Le compte est cr\xE9\xE9 mais bloqu\xE9 \u2014 vous activez manuellement depuis l'onglet Aper\xE7u."},{val:"partner_clients",icon:"\u{1F4CB}",label:"Liste de contacts",sub:"Seules les adresses de votre liste Clients partenaires peuvent s'inscrire."},{val:"closed",icon:"\u{1F512}",label:"Inscription ferm\xE9e",sub:"Le bouton est visible mais un message de contact s'affiche."}].map(({val:r,icon:v,label:E,sub:P})=>{let X=(t.registerMode??"open")===r;return(0,e.jsxs)("button",{type:"button",onClick:()=>d({registerMode:r}),className:w("flex items-start gap-3 px-3 py-3 rounded-xl border text-left transition-all",X?"border-primary bg-primary/8":"border-border hover:border-foreground
2/15 bg-card"),children:[(0,e.jsx)("span",{className:"text-base shrink-0 mt-px",children:v}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:w("text-xs font-semibold",X?"text-foreground":"text-muted-foreground"),children:E}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground/80 mt-0.5 leading-relaxed",children:P})]}),(0,e.jsx)("div",{className:w("w-3.5 h-3.5 rounded-full border-2 mt-0.5 shrink-0 transition-all",X?"border-primary bg-primary":"border-muted-foreground/30")})]},r)})}),t.registerMode==="partner_clients"&&(t.partnerClients?.length??0)===0&&(0,e.jsx)("p",{className:"mt-1.5 text-[10px] text-amber-500 px-1",children:"\u26A0 Aucun client partenaire dans la liste \u2014 personne ne pourra s'inscrire. Ajoutez des contacts ci-dessous."})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)("span",{className:"flex-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Clients partenaires"}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[n.length," client",n.length!==1?"s":""]}),(0,e.jsxs)("button",{type:"button",onClick:()=>{u(r=>!r),g(!1)},className:w("flex items-center gap-1 px-2 py-1 rounded-lg border text-[10px] transition-colors",S?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:text-foreground"),children:[(0,e.jsx)(_e,{className:"w-3 h-3"})," CRM"]}),(0,e.jsxs)("button",{type:"button",onClick:()=>{g(r=>!r),u(!1),T(null)},className:w("flex items-center gap-1 px-2 py-1 rounded-lg border text-[10px] font-medium transition-colors",i?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:text-foreground"),children:[(0,e.jsx)(Pe,{className:w("w-3 h-3 transition-transform",!i&&"rotate-45")})," ",i?"Annuler":"Ajouter"]})]}),S&&(0,e.jsxs)("div",{className:"rounded-xl border border-border bg-card overflow-hidden mb-2",children:[(0,e.jsx)("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border/40",children:(0,e.jsx)("input",{value:C,onChange:r=>x(r.target.value),placeholder:"Filtrer contacts CRM\u2026",className:"flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground"})}),(0,e.jsx)("div",{className:"max-h-44 overflow-y-auto divide-y divide-border/30",children:b?W.length===0?(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground text-center py-4",children:C?"Aucun r\xE9sultat":"Tous les contacts sont d\xE9j\xE0 ajout\xE9s"}):W.slice(0,40).map(r=>{let v=[r.firstName,r.lastName].filter(Boolean).join(" ")||r.email;return(0,e.jsxs)("button",{type:"button",onClick:()=>N(r),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-muted/40 transition-colors",children:[(0,e.jsx)("div",{className:"w-5 h-5 rounded-full bg-muted flex items-center justify-center shrink-0 text-[9px] font-bold",children:v[0]?.toUpperCase()}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-xs font-medium truncate",children:v}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:r.email})]}),r.company&&(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground truncate max-w-20",children:r.company}),(0,e.jsx)("span",{className:"text-[10px] text-primary shrink-0",children:"+ ajouter"})]},r.id)}):(0,e.jsx)("div",{className:"flex items-center justify-center py-5",children:(0,e.jsx)(te,{className:"w-4 h-4 animate-spin text-muted-foreground"})})})]}),i&&(0,e.jsx)("div",{className:"mb-2",children:(0,e.jsx)(qt,{onSave:oe,onCancel:()=>g(!1)})}),n.length>0&&(()=>{let r=Math.ceil(I.length/B),v=Math.min(U,Math.max(0,r-1)),E=I.slice(v*B,(v+1)*B);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)("input",{value:y,onChange:P=>{G(P.target.value),q(0)},placeholder:"Rechercher\u2026",className:"flex-1 px-2.5 py-1.5 rounded-lg border border-border bg-background text-xs outline-none focus:border-primary/60 transition-colors"}),r>1&&(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,e.jsx)("button",{disabled:v===0,onClick:()=>q(P=>P-1),className:"w-6 h-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-sm",children:"\u2039"}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums whitespace-nowrap",children:[v+1,"/",r]}),(0,e.jsx)("button",{disabled:v>=r-1,onClick:()=>q(P=>P+1),className:"w-6 h-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors text-sm",children:"\u203A"})]})]}),(0,e.jsx)("div",{className:"rounded-xl border border-border overflow-hidden divide-y divide-border/40",children:E.map(P=>
2{let X=[P.firstName,P.lastName].filter(Boolean).join(" ")||P.email,K=X[0]?.toUpperCase()??"?";return f===P.id?(0,e.jsx)("div",{className:"p-2",children:(0,e.jsx)(qt,{initial:P,onSave:H=>ae(P.id,H),onCancel:()=>T(null)})},P.id):(0,e.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2 bg-card group",children:[(0,e.jsx)("div",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center shrink-0 text-[10px] font-bold text-muted-foreground",children:K}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-xs font-medium truncate leading-tight",children:X}),(0,e.jsxs)("p",{className:"text-[10px] text-muted-foreground truncate",children:[P.email,P.phone?` \xB7 ${P.phone}`:"",P.company?` \xB7 ${P.company}`:""]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{T(P.id),g(!1)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(Ve,{className:"w-3 h-3"})}),(0,e.jsx)("button",{type:"button",onClick:()=>Z(P.id),className:"p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",children:(0,e.jsx)(Pe,{className:"w-3 h-3"})})]})]},P.id)})}),y&&I.length===0&&(0,e.jsxs)("p",{className:"text-[10px] text-muted-foreground text-center py-3",children:["Aucun r\xE9sultat pour \xAB ",y," \xBB"]})]})})(),n.length===0&&!i&&!S&&(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground text-center py-4 rounded-xl border border-dashed border-border",children:"Aucun client \u2014 ajoutez-en manuellement ou importez depuis le CRM"})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Groupe attribu\xE9 \xE0 l'inscription"}),(0,e.jsx)("div",{className:"flex flex-col gap-1.5",children:(t.groups??[]).map(r=>(0,e.jsxs)("button",{type:"button",onClick:()=>d({defaultGroupId:r.id}),className:w("flex items-center gap-3 px-3 py-2.5 rounded-xl border text-left transition-all",t.defaultGroupId===r.id?"border-primary bg-primary/10":"border-border hover:border-foreground
2/20 bg-card"),children:[(0,e.jsx)("div",{className:"w-3 h-3 rounded-full shrink-0",style:{background:r.color}}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-xs font-medium",children:r.label}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground",children:r.discountPct>0?`\u2212${r.discountPct}%`:"Pas de remise"})]}),t.defaultGroupId===r.id&&(0,e.jsx)(ie,{className:"w-3.5 h-3.5 text-primary"})]},r.id))})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Message de bienvenue"}),(0,e.jsx)("textarea",{value:t.welcomeMessage||"",onChange:r=>d({welcomeMessage:r.target.value}),rows:2,placeholder:"Bienvenue dans votre espace partenaire\u2026",className:"w-full px-3 py-2 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50 resize-none transition-colors"})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Affichage des stocks c\xF4t\xE9 partenaire"}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-2 -mt-1",children:"Ce que vos partenaires voient sur la disponibilit\xE9 des produits."}),(0,e.jsx)("div",{className:"space-y-1.5",children:[{val:"none",label:"Rien",desc:"Aucune info stock \u2014 les partenaires ne voient que le bouton Ajouter ou Indisponible"},{val:"status",label:"En stock / Bient\xF4t en rupture",desc:"Badge d'alerte discret sous le seuil d'alerte, sinon rien"},{val:"qty",label:"Quantit\xE9 exacte",desc:'La quantit\xE9 restante est visible (ex: "3 restants")'}].map(r=>(0,e.jsxs)("button",{type:"button",onClick:()=>d({shopConfig:{...t.shopConfig??{},stockDisplay:r.val}}),className:w("w-full flex items-start gap-3 px-3 py-2.5 rounded-xl border text-left transition-all",(t.shopConfig?.stockDisplay??"status")===r.val?"border-primary bg-primary/10":"border-border hover:border-foreground
2/20 bg-card"),children:[(0,e.jsx)("div",{className:w("w-3.5 h-3.5 rounded-full shrink-0 mt-0.5 border-2 transition-colors",(t.shopConfig?.stockDisplay??"status")===r.val?"border-primary bg-primary":"border-border")}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-xs font-medium",children:r.label}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground",children:r.desc})]})]},r.val))})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Devise"}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-2 -mt-1",children:"Utilis\xE9e pour l'affichage des prix dans le catalogue et les commandes."}),(0,e.jsx)("select",{value:t.shopConfig?.currency??"EUR",onChange:r=>d({shopConfig:{...t.shopConfig??{},currency:r.target.value}}),className:"w-full px-3 py-2 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50 transition-colors",children:_t.map(r=>(0,e.jsxs)("option",{value:r.code,children:[r.symbol," \u2014 ",r.label," (",r.code,")"]},r.code))})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Coordonn\xE9es bancaires (virement)"}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-2 -mt-1",children:"Ces informations s'affichent dans le panier et sur chaque commande pass\xE9e par vos partenaires."}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"Nom de la banque"}),(0,e.jsx)(Ee,{value:t.shopConfig?.bankName??"",onChange:r=>d({shopConfig:{...t.shopConfig??{},bankName:r}}),placeholder:"Ex: BNP Paribas"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"IBAN"}),(0,e.jsx)(Ee,{value:t.shopConfig?.bankIban??"",onChange:r=>d({shopConfig:{...t.shopConfig??{},bankIban:r}}),placeholder:"FR76 XXXX XXXX XXXX XXXX XXXX XXX",mono:!0})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"BIC / SWIFT"}),(0,e.jsx)(Ee,{value:t.shopConfig?.bankBic??"",onChange:r=>d({shopConfig:{...t.shopConfig??{},bankBic:r}}),placeholder:"BNPAFRPPXXX",mono:!0})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"Instructions de paiement"}),(0,e.jsx)("textarea",{value:t.shopConfig?.paymentInstructions??"",onChange:r=>d({shopConfig:{...t.shopConfig??{},paymentInstructions:r.target.value}}),rows:3,placeholder:"Veuillez effectuer votre virement sous 7 jours en indiquant le num\xE9ro de commande en r\xE9f\xE9rence.",className:"w-full px-3 py-2 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50 resize-none transition-colors font-sans"})]})]})]}),(0,e.jsxs)("section",{className:"space-y-3 border-t border-border/40 pt-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-base",children:"\u{1F4C5}"}),(0,e.jsx)("p",{className:"text-xs font-bold",children:"Mode R\xE9servations & Services"})]}),(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"Transforme le catalogue en boutique de prestations avec cr\xE9neaux horaires. Les produits service n'ont pas de stock \u2014 leur disponibilit\xE9 est g\xE9r\xE9e par les cr\xE9neaux."}),(0,e.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsx)("input",{type:"checkbox",checked:t.shopConfig?.serviceMode??!1,onChange:r=>d({shopConfig:{...t.shopConfig??{},serviceMode:r.target.checked}}),className:"sr-only"}),(0,e.jsx)("div",{className:`w-10 h-5 rounded-full transition-colors ${t.shopConfig?.serviceMode?"bg-primary":"bg-muted"}`,children:(0,e.jsx)("div",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${t.shopConfig?.serviceMode?"translate-x-5":""}`})})]}),(0,e.jsx)("span",{className:"text-xs font-medium",children:"Activer le mode service pour ce canal"})]}),t.shopConfig?.serviceMode&&(0,e.jsxs)("div",{className:"space-y-3 pl-3 border-l-2 border-primary/20",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"D\xE9lai minimum de r\xE9servation (heures)"}),(0,e.jsx)("input",{type:"number",min:0,max:72,value:t.shopConfig?.bookingLeadHours??2,onCh
2ange:r=>d({shopConfig:{...t.shopConfig??{},bookingLeadHours:parseInt(r.target.value)||2}}),className:"w-24 px-3 py-1.5 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50"}),(0,e.jsx)("p",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Le client doit r\xE9server au moins X heures avant le cr\xE9neau"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1.5",children:"Options de lieu propos\xE9es au client"}),(0,e.jsx)("div",{className:"flex gap-2",children:[["onsite","Sur place"],["home","\xC0 domicile"]].map(([r,v])=>{let E=t.shopConfig?.locationOptions??[],P=E.includes(r);return(0,e.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:P,onChange:X=>{let K=X.target.checked?[...E,r]:E.filter(H=>H!==r);d({shopConfig:{...t.shopConfig??{},locationOptions:K}})},className:"w-3.5 h-3.5 rounded border-border"}),(0,e.jsx)("span",{className:"text-xs",children:v})]},r)})}),(0,e.jsx)("p",{className:"text-[9px] text-muted-foreground mt-1",children:"Si une seule option \u2192 elle est automatiquement s\xE9lectionn\xE9e. Si deux \u2192 le client choisit."})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground mb-1",children:"Adresse du prestataire"}),(0,e.jsx)("input",{type:"text",value:t.shopConfig?.serviceAddress??"",onChange:r=>d({shopConfig:{...t.shopConfig??{},serviceAddress:r.target.value}}),placeholder:"12 rue de la Paix, 75001 Paris",className:"w-full px-3 py-2 rounded-xl border border-border bg-background text-xs outline-none focus:border-primary/50"}),(0,e.jsx)("p",{className:"text-[9px] text-muted-foreground mt-0.5",children:"R\xE9v\xE9l\xE9e au client uniquement quand la commande est confirm\xE9e (statut Re\xE7ue / Pay\xE9e)"})]})]})]})]})}var Zt=[{id:"premium",label:"Premium",emoji:"\u{1F525}",desc:"Hero plein \xE9cran, particules, presets color\xE9s",accent:"from-orange-500/20 to-amber-500/10 border-orange-500/30",preview:t=>(0,e.jsx)(Ge,{cfg:t.premiumHero??{...me},onLogin:t.allowLogin?()=>{}:void 0,onRegister:t.allowRegister?()=>{}:void 0})},{id:"velvet",label:"Velvet",emoji:"\u2728",desc:"Noir dor\xE9, paillettes canvas, g\xE9om\xE9tries SVG",accent:"from-yellow-500/20 to-amber-700/10 border-yellow-600/30",preview:t=>(0,e.jsx)(Ye,{cfg:{...ve,...t.velvetHero},onLogin:t.allowLogin?()=>{}:void 0,onRegister:t.allowRegister?()=>{}:void 0,preview:!0})}];function Kt({cfg:t,onChange:d,partnerUrl:n}){let[o,a]=(0,h.useState)(null),[b,m]=(0,h.useState)(!1),C=()=>{navigator.clipboard.writeText(n).catch(()=>{}),m(!0),setTimeout(()=>m(!1),2e3)},x=t.templateType??"premium",S={...ve,...t.velvetHero};if(o!==null){let u=o==="velvet";return(0,e.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,e.jsxs)("div",{className:"shrink-0 flex items-center gap-2 px-4 py-2.5 border-b border-border/40 bg-card/20",children:[(0,e.jsxs)("button",{onClick:()=>a(null),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)("span",{className:"text-base leading-none",children:"\u2190"})," Retour aux templates"]}),(0,e.jsx)("span",{className:"ml-2 text-[11px] font-medium text-foreground",children:u?"\u2728 Velvet":"\u{1F525} Premium"}),x===o&&(0,e.jsx)("span",{className:"ml-1 px-1.5 py-0.5 rounded text-[9px] font-medium bg-green-500/15 text-green-500 border border-green-500/20",children:"Actif"})]}),(0,e.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden divide-x divide-border",children:[(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-w-0",children:[(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Nom de l'espace"}),(0,e.jsx)(Ee,{value:t.spaceName,onChange:i=>d({spaceName:i}),placeholder:"ex: Espace Revendeurs"})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Slug URL"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:"/partner/"}),(0,e.jsx)(Ee,{value:t.slug,onChange:i=>d({slug:le(i)}),placeholder:"mon-espace",mono:!0})]})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)(Q,{children:"Contenu & design"}),u?(0,e.jsx)(Ze,{config:S,onChange:i=>d({velvetHero:{...S,...i}})}):(0,e.jsx)(jt,{config:t.premiumHero??{...me},onChange:i=>d({premiumHero:{...me,...i}})})]})]}),(0,e.jsx)("div",{className:"w-64 shrink-0 overflow-hidden relative bg-black",children:(0,e.jsx)("div",{className:"absolute inset-0 scale-[0.5] origin-top-left",style:{width:"200%",height:"200%"},children:u?(0,e.jsx)(Ye,{cfg:S,onLogin:t.allowLogin?()=>{}:void 0,onRegister:t.allowRegister?()=>{}:void 0,preview:!0}):(0,e.jsx)(Ge,{cfg:t.premiumHero??{...me},onLogin:t.allowLogin?()=>{}:void 0,onRegister:t.allowRegister?()=>{}:void 0})})})]})]})}return(0,e.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,e.jsxs)("div",{className:"shrink-0 px-4 py-3 border-b border-border/40 bg-card/20 space-y-2",children:[(0,e.jsxs)("p",{className:"text-[10px] text-muted-foreground font-medium flex items-center gap-1.5",children:[(0,e.jsx)(kt,{className:"w-3 h-3"}),"Lien public"]}),(0,e.jsxs)("div",{className:"flex items-stretch gap-2",children:[(0,e.jsx)("input",{readOnly:!0,value:n,onFocus:u=>u.currentTarget.select(),className:"flex-1 min-w-0 px-3 py-2 rounded-xl border border-border bg-background text-[11px] font-mono outline-none focus:border-primary/50 cursor-text transition-colors"}),(0,e.jsxs)("button",{onClick:C,title:"Copier",className:w("flex items-center gap-1.5 px-3 py-2 rounded-xl border text-[11px] font-medium transition-all shrink-0",b?"border-green-500/40 bg-green-500/10 text-green-500":"border-border bg-card hover:bg-muted text-muted-foreground"),children:[b?(0,e.jsx)(ie,{className:"w-3.5 h-3.5"}):(0,e.jsx)(Oe,{className:"w-3.5 h-3.5"}),b?"Copi\xE9 !":"Copier"]}),(0,e.jsxs)("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl border border-border bg-card hover:bg-muted text-muted-foreground text-[11px] font-medium transition-colors shrink-0",children:[(0,e.jsx)(Fe,{className:"w-3.5 h-3.5"}),"Ouvrir"]})]})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[(0,e.jsx)("p",{className:"text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:"Templates landing disponibles"}),Zt.map(u=>{let i=x===u.id;
2return(0,e.jsxs)("div",{className:w("rounded-xl border overflow-hidden transition-all",i?"border-primary/40 shadow-[0_0_0_1px_hsl(var(--primary)/0.15)]":"border-border hover:border-border/80"),children:[(0,e.jsxs)("div",{className:w("flex items-center justify-between px-3 py-2.5 bg-gradient-to-r",u.accent),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-sm",children:u.emoji}),(0,e.jsx)("span",{className:"text-[12px] font-semibold text-foreground",children:u.label}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground",children:u.desc})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[i&&(0,e.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full text-[9px] font-semibold bg-green-500/15 text-green-500 border border-green-500/25",children:[(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 inline-block"}),"Actif"]}),!i&&(0,e.jsx)("button",{onClick:()=>d({templateType:u.id}),className:"px-2.5 py-1 rounded-lg border border-border bg-card hover:bg-muted text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Activer"}),(0,e.jsxs)("button",{onClick:()=>a(u.id),className:"flex items-center gap-1 px-2.5 py-1 rounded-lg border border-border bg-card hover:bg-muted text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)(Lt,{className:"w-3 h-3"}),"\xC9diter"]})]})]}),(0,e.jsxs)("div",{className:"h-32 overflow-hidden relative bg-black",children:[(0,e.jsx)("div",{className:"absolute inset-0 scale-[0.33] origin-top-left pointer-events-none",style:{width:"303%",height:"303%"},children:u.preview(t)}),(0,e.jsx)("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-black/60 to-transparent pointer-events-none"})]})]},u.id)})]})]})}export{Gt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.