1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54879,e=>{"use strict";let t=(0,e.i(78445).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",()=>t],54879)},96922,e=>{"use strict";let t=(0,e.i(78445).default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);e.s(["List",()=>t],96922)},52724,e=>{"use strict";var t=e.i(30064),s=e.i(59760),a=e.i(33907),l=e.i(22508),i=e.i(4917),r=e.i(54879),n=e.i(59111),o=e.i(46202),d=e.i(50147),c=e.i(78445);let x=(0,c.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),u=(0,c.default)("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);var p=e.i(46553),m=e.i(98867),h=e.i(96922),b=e.i(71143);let g={age:30,height:175,hair:"Brun",eyes:"Marron",archetype:"Le Héros",role:"support",personality:{spectrumIntrovertExtravert:50,spectrumEmotionalRational:50,spectrumChaoticLawful:50},physicalQuirk:"",behavioralQuirk:""},f=({entities:e,onCreate:c,onUpdate:f,onDelete:v,templates:j,onUpdateTemplates:y,initialSelectedId:N})=>{let C,[k,w]=(0,s.useState)(null),[T,E]=(0,s.useState)(null),[A,R]=(0,s.useState)("entities"),[M,S]=(0,s.useState)(a.EntityType.CHARACTER);(0,s.useEffect)(()=>{if(N){let t=e.find(e=>e.id===N);t&&(I(t),R("entities"))}},[N,e]);let z=(0,s.useMemo)(()=>{let t=e.filter(e=>e.type===a.EntityType.CHARACTER&&e.attributes?.archetype).map(e=>e.attributes.archetype);return Array.from(new Set([...b.ARCHETYPES,...t])).sort()},[e]),I=e=>{let t={...e};e.type!==a.EntityType.CHARACTER||e.attributes||(t.attributes={...g}),e.customValues||(t.customValues={}),E(t),w(e.id)},L=async()=>{if(T&&T.name){if("NEW"===k){let{id:e,...t}=T;await c(t)}else f(T.id,T);w(null),E(null)}},O=(e,t)=>{T&&T.attributes&&E({...T,attributes:{...T.attributes,[e]:t}})},H=(e,t)=>{T&&T.attributes&&E({...T,attributes:{...T.attributes,personality:{...T.attributes.personality,[e]:t}}})},P=(e,t)=>{T&&E({...T,customValues:{...T.customValues,[e]:t}})},V=(e,t,s)=>{y(j.map(a=>a.entityType!==e?a:{...a,fields:a.fields.map(e=>e.id===t?{...e,...s}:e)}))},q=t=>e.filter(e=>e.type===t);if("templates"===A){let e;return(0,t.jsxs)("div",{className:"flex h-full gap-6 p-6 bg-[#eef2ff]",children:[(0,t.jsx)("div",{className:"w-1/3 opacity-50 pointer-events-none filter blur-[1px]",children:(0,t.jsxs)("div",{className:"bg-white rounded-lg p-6 shadow-sm border border-slate-200",children:[(0,t.jsx)("h3",{className:"font-bold text-slate-700 mb-4",children:"Aperçu Fiches"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"h-10 bg-indigo-50 rounded"}),(0,t.jsx)("div",{className:"h-10 bg-indigo-50 rounded"}),(0,t.jsx)("div",{className:"h-10 bg-indigo-50 rounded"})]})]})}),(e=j.find(e=>e.entityType===M)||{entityType:M,fields:[]},(0,t.jsxs)("div",{className:"flex-1 bg-white rounded-xl shadow-lg border border-slate-200 p-8 overflow-y-auto",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"text-2xl font-bold text-slate-800 flex items-center gap-2",children:[(0,t.jsx)(m.Layout,{size:24,className:"text-indigo-600"})," Éditeur de Modèles"]}),(0,t.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Configurez les champs personnalisés pour chaque type de fiche."})]}),(0,t.jsx)("button",{onClick:()=>R("entities"),className:"p-2 text-slate-500 hover:bg-slate-100 rounded-full",children:(0,t.jsx)(n.X,{size:20})})]}),(0,t.jsx)("div",{className:"flex gap-2 mb-8 border-b border-slate-200 pb-1",children:Object.values(a.EntityType).map(e=>(0,t.jsx)("button",{onClick:()=>S(e),className:`px-4 py-2 text-sm font-medium rounded-t-lg transition-colors ${M===e?"bg-indigo-50 text-indigo-700 border-b-2 border-indigo-600":"text-slate-500 hover:text-slate-800 hover:bg-slate-50"}`,children:e},e))}),(0,t.jsxs)("div",{className:"space-y-4",children:[e.fields.map((e,s)=>(0,t.jsxs)("div",{className:"bg-[#eef2ff] border border-indigo-100 rounded-lg p-4 flex gap-4 items-start group",children:[(0,t.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Nom du champ"}),(0,t.jsx)("input",{type:"text",value:e.label,onChange:t=>V(M,e.id,{label:t.target.value}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Type"}),(0,t.jsxs)("select",{value:e.type,onChange:t=>V(M,e.id,{type:t.target.value}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm",children:[(0,t.jsx)("option",{value:"text",children:"Texte court"}),(0,t.jsx)("option",{value:"textarea",children:"Texte long"}),(0,t.jsx)("option",{value:"number",children:"Nombre"}),(0,t.jsx)("option",{value:"boolean",children:"Case à cocher"}),(0,t.jsx)("option",{value:"select",children:"Liste déroulante"})]})]}),"select"===e.type&&(0,t.jsxs)("div",{className:"col-span-2",children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Options (séparées par des virgules)"}),(0,t.jsx)("input",{type:"text",value:e.options?.join(",")||"",onChange:t=>V(M,e.id,{options:t.target.value.split(",").map(e=>e.trim())}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm",placeholder:"Option A, Option B, Option C"})]})]}),(0,t.jsx)("button",{onClick:()=>{var t;return t=e.id,void y(j.map(e=>e.entityType!==M?e:{...e,fields:e.fields.filter(e=>e.id!==t)}))},className:"p-2 text-slate-400 hover:text-red-600 hover:bg-red-50 rounded mt-5",children:(0,t.jsx)(i.Trash2,{size:16})})]},e.id)),(0,t.jsxs)("button",{onClick:()=>{let e,t;return e={id:`field-${Date.now()}`,label:"Nouveau Champ",type:"text",placeholder:""},void(!(t=j.map(t=>t.entityType===M?{...t,fields:[...t.fields,e]}:t)).some(e=>e.entityType===M)&&t.push({entityType:M,fields:[e]}),y(t))},className:"w-full py-3 border-2 border-dashed border-slate-300 rounded-lg text-slate-500 hover:border-indigo-400 hover:text-indigo-600 hover:bg-indigo-50 transition-all flex items-center justify-center gap-2",children:[(0,t.jsx)(l.Plus,{size:20})," Ajouter un champ"]})]})]}))]})}return(0,t.jsxs)("div",{className:"flex h-full gap-6 p-6 bg-[#eef2ff]",children:[(0,t.jsxs)("div",{className:"w-1/3 flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center px-1",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-slate-700",children:"Explorateur"}),(0,t.jsxs)("button",{onClick:()=>R("templates"),className:"flex items-center gap-1.5 px-3 py-1.5 bg-indigo-100 text-indigo-700 hover:bg-indigo-200 rounded text-xs font-medium transition-colors",title:"Gérer les modèles de fiches",children:[(0,t.jsx)(p.Settings,{size:14})," Modèles"]})]}),(0,t.jsx)("div",{className:"space-y-6 overflow-y-auto pr-2 pb-4 flex-1",children:Object.values(a.EntityType).map(e=>(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 overflow-hidden",children:[(0,t.jsxs)("div",{className:"bg-indigo-50 p-3 border-b border-indigo-100 flex justify-between items-center",children:[(0,t.jsxs)("h3",{className:"font-semibold text-slate-700 flex items-center gap-2",children:[(0,t.jsx)("span",{children:b.ENTITY_ICONS[e]})," ",e,"s"]}),(0,t.jsx)("button",{onClick:()=>{E({id:Date.now().toString(),type:e,name:"",description:"",details:"",storyContext:"",attributes:e===a.EntityType.CHARACTER?{...g}:void 0,customValues:{}}),w("NEW")},className:"p-1 hover:bg-indigo-100 rounded text-indigo-600 transition-colors",children:(0,t.jsx)(l.Plus,{size:16})})]}),(0,t.jsxs)("div",{className:"divide-y divide-slate-100",children:[0===q(e).length&&(0,t.jsx)("p",{className:"p-4 text-sm text-slate-400 italic text-center",children:"Aucun élément"}),q(e).map(e=>(0,t.jsxs)("div",{onClick:()=>I(e),className:`p-3 cursor-pointer hover:bg-blue-50 transition-colors flex justify-between group ${k===e.id?"bg-blue-50 border-l-4 border-blue-500":""}`,children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium text-slate-800",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-slate-500 truncate",children:e.description})]}),(0,t.jsx)("button",{onClick:t=>{var s;t.stopPropagation(),s=e.id,confirm("Supprimer cet élément ?")&&(v(s),k===s&&(w(null),E(null)))},className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 transition-opacity",children:(0,t.jsx)(i.Trash2,{size:14})})]},e.id))]})]},e))})]}),(0,t.jsx)("div",{className:"flex-1 bg-white rounded-xl shadow-lg border border-slate-200 p-8 overflow-y-auto",children:k&&T?(0,t.jsxs)("div",{className:"space-y-6 animate-in fade-in duration-200",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("span",{className:`inline-block px-2 py-1 rounded text-xs font-bold uppercase tracking-wider ${b.ENTITY_COLORS[T.type]}`,children:T.type}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-slate-800",children:T.type===a.EntityType.CHARACTER?"Fiche Personnage":"Édition de la fiche"})]}),(0,t.jsx)("div",{className:"flex gap-2",children:(0,t.jsx)("button",{onClick:()=>w(null),className:"p-2 text-slate-500 hover:bg-slate-100 rounded-full",children:(0,t.jsx)(n.X,{size:20})})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Nom"}),(0,t.jsx)("input",{type:"text",value:T.name,onChange:e=>E({...T,name:e.target.value}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded focus:ring-2 focus:ring-blue-500 outline-none font-serif text-lg",placeholder:"Ex: Gandalf le Gris"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Description Courte (pour l'IA)"}),(0,t.jsx)("textarea",{value:T.description,onChange:e=>E({...T,description:e.target.value}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded focus:ring-2 focus:ring-blue-500 outline-none text-sm h-20",placeholder:"Un magicien puissant qui guide la communauté..."})]}),T.type===a.EntityType.CHARACTER&&(()=>{if(!T?.attributes)return null;let e=T.attributes;return(0,t.jsxs)("div",{className:"space-y-8 border-t border-slate-100 pt-6 mt-4",children:[(0,t.jsxs)("div",{className:"bg-[#eef2ff] p-4 rounded-lg border border-indigo-100",children:[(0,t.jsxs)("h3",{className:"text-sm font-bold text-slate-700 uppercase mb-4 flex items-center gap-2",children:[(0,t.jsx)(d.User,{size:16})," Identité Narrative"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-2",children:"Archétype"}),(0,t.jsx)("input",{type:"text",list:"archetype-suggestions",value:e.archetype,onChange:e=>O("archetype",e.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-blue-500",placeholder:"Ex: Le Héros, Le Sage..."}),(0,t.jsx)("datalist",{id:"archetype-suggestions",children:z.map(e=>(0,t.jsx)("option",{value:e},e))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-2",children:"Rôle dans l'histoire"}),(0,t.jsx)("div",{className:"flex gap-2 flex-wrap",children:[{val:"protagonist",label:"Protagoniste"},{val:"antagonist",label:"Antagoniste"},{val:"support",label:"Secondaire"},{val:"extra",label:"Figurant"}].map(s=>(0,t.jsxs)("label",{className:`cursor-pointer px-3 py-1.5 rounded text-xs border transition-colors ${e.role===s.val?"bg-indigo-100 border-indigo-300 text-indigo-700 font-bold":"bg-[#eef2ff] border-slate-200 text-slate-600 hover:bg-slate-100"}`,children:[(0,t.jsx)("input",{type:"radio",name:"role",value:s.val,checked:e.role===s.val,onChange:()=>O("role",s.val),className:"hidden"}),s.label]},s.val))})]})]})]}),(0,t.jsxs)("div",{className:"bg-[#eef2ff] p-4 rounded-lg border border-indigo-100",children:[(0,t.jsxs)("h3",{className:"text-sm font-bold text-slate-700 uppercase mb-4 flex items-center gap-2",children:[(0,t.jsx)(u,{size:16})," Apparence Physique"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex justify-between text-xs mb-1",children:(0,t.jsx)("label",{className:"font-semibold text-slate-600",children:"Âge (ans)"})}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("input",{type:"range",min:"1",max:"100",value:Math.min(e.age,100),onChange:e=>O("age",parseInt(e.target.value)),className:"flex-1 h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),(0,t.jsx)("input",{type:"number",value:e.age,onChange:e=>O("age",parseInt(e.target.value)),className:"w-20 p-1 text-right text-sm border border-slate-300 rounded font-mono text-indigo-700 bg-[#eef2ff] focus:border-indigo-500 outline-none"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex justify-between text-xs mb-1",children:(0,t.jsx)("label",{className:"font-semibold text-slate-600",children:"Taille (cm)"})}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("input",{type:"range",min:"50",max:"250",value:Math.min(e.height,250),onChange:e=>O("height",parseInt(e.target.value)),className:"flex-1 h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),(0,t.jsx)("input",{type:"number",value:e.height,onChange:e=>O("height",parseInt(e.target.value)),className:"w-20 p-1 text-right text-sm border border-slate-300 rounded font-mono text-indigo-700 bg-[#eef2ff] focus:border-indigo-500 outline-none"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Cheveux"}),(0,t.jsx)("select",{value:e.hair,onChange:e=>O("hair",e.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm",children:b.HAIR_COLORS.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Yeux"}),(0,t.jsx)("select",{value:e.eyes,onChange:e=>O("eyes",e.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm",children:b.EYE_COLORS.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Signe distinctif"}),(0,t.jsx)("input",{type:"text",value:e.physicalQuirk,onChange:e=>O("physicalQuirk",e.target.value),placeholder:"Cicatrice, tatouage...",className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-indigo-400"})]})]})]})]}),(0,t.jsxs)("div",{className:"bg-[#eef2ff] p-4 rounded-lg border border-indigo-100",children:[(0,t.jsxs)("h3",{className:"text-sm font-bold text-slate-700 uppercase mb-4 flex items-center gap-2",children:[(0,t.jsx)(x,{size:16})," Psychologie & Comportement"]}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4 px-2",children:[(0,t.jsxs)("div",{className:"relative pt-1",children:[(0,t.jsxs)("div",{className:"flex justify-between text-[10px] uppercase font-bold text-slate-500 mb-1",children:[(0,t.jsx)("span",{children:"Introverti"}),(0,t.jsx)("span",{children:"Extraverti"})]}),(0,t.jsx)("input",{type:"range",min:"0",max:"100",value:e.personality.spectrumIntrovertExtravert,onChange:e=>H("spectrumIntrovertExtravert",parseInt(e.target.value)),className:"w-full h-2 bg-gradient-to-r from-slate-300 via-indigo-200 to-slate-300 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]}),(0,t.jsxs)("div",{className:"relative pt-1",children:[(0,t.jsxs)("div",{className:"flex justify-between text-[10px] uppercase font-bold text-slate-500 mb-1",children:[(0,t.jsx)("span",{children:"Émotionnel"}),(0,t.jsx)("span",{children:"Rationnel"})]}),(0,t.jsx)("input",{type:"range",min:"0",max:"100",value:e.personality.spectrumEmotionalRational,onChange:e=>H("spectrumEmotionalRational",parseInt(e.target.value)),className:"w-full h-2 bg-gradient-to-r from-red-200 via-purple-200 to-blue-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]}),(0,t.jsxs)("div",{className:"relative pt-1",children:[(0,t.jsxs)("div",{className:"flex justify-between text-[10px] uppercase font-bold text-slate-500 mb-1",children:[(0,t.jsx)("span",{children:"Chaotique"}),(0,t.jsx)("span",{children:"Loyal"})]}),(0,t.jsx)("input",{type:"range",min:"0",max:"100",value:e.personality.spectrumChaoticLawful,onChange:e=>H("spectrumChaoticLawful",parseInt(e.target.value)),className:"w-full h-2 bg-gradient-to-r from-orange-200 via-yellow-100 to-green-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]})]}),(0,t.jsxs)("div",{className:"border-t border-slate-200 pt-4",children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:"Toc ou habitude comportementale"}),(0,t.jsx)("input",{type:"text",value:e.behavioralQuirk,onChange:e=>O("behavioralQuirk",e.target.value),placeholder:"Joue avec sa bague, bégaie quand il ment...",className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-indigo-400"})]})]})]})]})})(),(C=j.find(e=>e.entityType===T?.type))&&0!==C.fields.length?(0,t.jsxs)("div",{className:"bg-[#eef2ff] p-4 rounded-lg border border-indigo-100 mt-6",children:[(0,t.jsxs)("h3",{className:"text-sm font-bold text-slate-700 uppercase mb-4 flex items-center gap-2",children:[(0,t.jsx)(h.List,{size:16})," Champs Personnalisés"]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4",children:C.fields.map(e=>{let s=T?.customValues?.[e.id]??"";return(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-semibold text-slate-500 mb-1",children:e.label}),"textarea"===e.type?(0,t.jsx)("textarea",{value:s,onChange:t=>P(e.id,t.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-indigo-400",placeholder:e.placeholder}):"select"===e.type?(0,t.jsxs)("select",{value:s,onChange:t=>P(e.id,t.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-indigo-400",children:[(0,t.jsx)("option",{value:"",children:"Sélectionner..."}),e.options?.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}):"boolean"===e.type?(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!!s,onChange:t=>P(e.id,t.target.checked),className:"w-4 h-4 text-indigo-600 rounded border-slate-300 focus:ring-indigo-500"}),(0,t.jsx)("span",{className:"text-sm text-slate-700",children:"Activé / Oui"})]}):(0,t.jsx)("input",{type:"number"===e.type?"number":"text",value:s,onChange:t=>P(e.id,t.target.value),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded text-sm outline-none focus:border-indigo-400",placeholder:e.placeholder})]},e.id)})})]}):null,(0,t.jsxs)("div",{className:"mt-6 border-t border-slate-100 pt-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-indigo-700 mb-1 flex items-center gap-2",children:[(0,t.jsx)(o.Sparkles,{size:14})," Contexte Narratif (Auto-généré)"]}),(0,t.jsx)("textarea",{value:T.storyContext||"",onChange:e=>E({...T,storyContext:e.target.value}),className:"w-full p-2 border border-indigo-200 bg-indigo-50 rounded focus:ring-2 focus:ring-blue-500 outline-none text-sm h-24 italic text-slate-600",placeholder:"Les événements vécus par ce personnage apparaîtront ici..."})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Notes & Biographie Complète"}),(0,t.jsx)("textarea",{value:T.details,onChange:e=>E({...T,details:e.target.value}),className:"w-full p-2 bg-[#eef2ff] border border-slate-300 rounded focus:ring-2 focus:ring-blue-500 outline-none h-48 font-serif",placeholder:"Histoire détaillée, secrets, origines..."})]})]}),(0,t.jsx)("div",{className:"pt-4 flex justify-end",children:(0,t.jsxs)("button",{onClick:L,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg flex items-center gap-2 transition-colors shadow-md",children:[(0,t.jsx)(r.Save,{size:18}),"Enregistrer la fiche"]})})]})]}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-slate-400",children:[(0,t.jsx)("div",{className:"text-6xl mb-4 opacity-20",children:"🌍"}),(0,t.jsx)("p",{className:"text-lg",children:"Sélectionnez ou créez une fiche pour commencer."}),(0,t.jsx)("p",{className:"text-sm",children:"Ces informations aideront l'IA à rester cohérente."})]})})]})};var v=e.i(18404),j=e.i(8011),y=e.i(12856);function N(e){let{project:s,updateProject:a}=e,l=(0,y.useParams)();(0,y.useRouter)();let i=l.id,{user:r}=(0,v.useAuthContext)(),{createEntity:n,updateEntity:o,deleteEntity:d}=(0,j.useProjects)(r);return s?(0,t.jsx)(f,{entities:s.entities||[],onCreate:async e=>await n(i,e.type,e),onUpdate:(e,t)=>o(i,e,t),onDelete:e=>d(i,e),templates:s.templates||[],onUpdateTemplates:e=>a?.({templates:e}),initialSelectedId:null}):null}e.s(["default",()=>N],52724)}]); |