Files
plume/.next/static/chunks/df6079c3e636ac5a.js
2026-02-28 08:42:15 +01:00

1 line
13 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44026,e=>{"use strict";let t=(0,e.i(78445).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],44026)},78445,e=>{"use strict";var t=e.i(59760);let a=(...e)=>e.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim(),r=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,t.forwardRef)(({color:e="currentColor",size:r=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:d,iconNode:c,...n},u)=>(0,t.createElement)("svg",{ref:u,...i,width:r,height:r,stroke:e,strokeWidth:o?24*Number(s)/Number(r):s,className:a("lucide",l),...!d&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(n)&&{"aria-hidden":"true"},...n},[...c.map(([e,a])=>(0,t.createElement)(e,a)),...Array.isArray(d)?d:[d]])),o=(e,i)=>{let o=(0,t.forwardRef)(({className:o,...l},d)=>(0,t.createElement)(s,{ref:d,iconNode:i,className:a(`lucide-${r(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...l}));return o.displayName=r(e),o};e.s(["default",()=>o],78445)},12856,(e,t,a)=>{t.exports=e.r(96479)},62746,e=>{"use strict";let t=(0,e.i(78445).default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",()=>t],62746)},46202,e=>{"use strict";let t=(0,e.i(78445).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",()=>t],46202)},59111,e=>{"use strict";let t=(0,e.i(78445).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],59111)},46553,e=>{"use strict";let t=(0,e.i(78445).default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",()=>t],46553)},50147,e=>{"use strict";let t=(0,e.i(78445).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>t],50147)},98867,e=>{"use strict";let t=(0,e.i(78445).default)("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);e.s(["Layout",()=>t],98867)},74080,97794,e=>{"use strict";var t=e.i(78445);let a=(0,t.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",()=>a],74080);let r=(0,t.default)("mouse-pointer-click",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);e.s(["MousePointerClick",()=>r],97794)},36268,e=>{"use strict";let t=(0,e.i(78445).default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);e.s(["Lightbulb",()=>t],36268)},12155,12100,e=>{"use strict";var t=e.i(78445);let a=(0,t.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);e.s(["Globe",()=>a],12155);let r=(0,t.default)("git-graph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);e.s(["GitGraph",()=>r],12100)},33907,e=>{"use strict";var t,a=((t={}).CHARACTER="Personnage",t.LOCATION="Lieu",t.OBJECT="Objet",t.NOTE="Note",t);e.s(["EntityType",()=>a])},22508,e=>{"use strict";let t=(0,e.i(78445).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],22508)},24224,e=>{"use strict";var t=e.i(30064),a=e.i(59760);let r=(0,a.createContext)(null);function i({value:e,children:a}){return(0,t.jsx)(r.Provider,{value:e,children:a})}function s(){let e=(0,a.useContext)(r);if(!e)throw Error("useProjectContext must be used within ProjectProvider");return e}e.s(["ProjectProvider",()=>i,"useProjectContext",()=>s])},4917,e=>{"use strict";let t=(0,e.i(78445).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",()=>t],4917)},30914,e=>{"use strict";let t=(0,e.i(78445).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",()=>t],30914)},15536,e=>{"use strict";let t=(0,e.i(78445).default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);e.s(["MessageCircle",()=>t],15536)},43331,e=>{"use strict";let t=(0,e.i(78445).default)("book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);e.s(["Book",()=>t],43331)},71143,e=>{"use strict";var t=e.i(33907);let a={[t.EntityType.CHARACTER]:"👤",[t.EntityType.LOCATION]:"🏰",[t.EntityType.OBJECT]:"🗝️",[t.EntityType.NOTE]:"📝"},r={[t.EntityType.CHARACTER]:"bg-blue-100 text-blue-800 border-blue-200",[t.EntityType.LOCATION]:"bg-green-100 text-green-800 border-green-200",[t.EntityType.OBJECT]:"bg-amber-100 text-amber-800 border-amber-200",[t.EntityType.NOTE]:"bg-gray-100 text-gray-800 border-gray-200"};e.s(["ARCHETYPES",0,["Le Héros","L'Ombre / Le Méchant","Le Mentor","Le Gardien du Seuil","Le Shapeshifter (Changeforme)","Le Trickster (Farceur)","L'Allié","L'Élu","Le Rebelle","Le Séducteur","Le Sage","Le Guerrier","L'Innocent"],"DEFAULT_AUTHOR",0,"Auteur Inconnu","DEFAULT_BOOK_TITLE",0,"Nouveau Roman","ENTITY_COLORS",0,r,"ENTITY_ICONS",0,a,"EYE_COLORS",0,["Marron","Bleu","Vert","Noisette","Gris","Noir","Vairons","Ambre"],"GENRES",0,["Fantasy","Science-Fiction","Thriller / Polar","Romance","Historique","Horreur","Aventure","Contemporain","Jeunesse / Young Adult","Dystopie"],"HAIR_COLORS",0,["Brun","Noir","Blond","Roux","Auburn","Gris","Blanc","Châtain","Chauve","Teinture (Bleu/Rose/Etc)"],"INITIAL_CHAPTER",0,{id:"chap-1",title:"Chapitre 1",content:"<p>Il était une fois...</p>",summary:"Début de l'histoire."},"POV_OPTIONS",0,["1ère personne (Je)","3ème personne (Limitée au protagoniste)","3ème personne (Omnisciente)","Multi-points de vue (Alterné)"],"TENSE_OPTIONS",0,["Passé (Passé simple / Imparfait)","Présent de narration"],"TONES",0,["Sombre & Sérieux","Léger & Humoristique","Épique & Grandiose","Mélancolique","Mystérieux","Optimiste","Cynique","Romantique"]])},8011,30103,86180,e=>{"use strict";var t=e.i(59760),a=e.i(4301),r=e.i(71143);e.s(["useProjects",0,e=>{let[i,s]=(0,t.useState)([]),[o,l]=(0,t.useState)(null),[d,c]=(0,t.useState)(!1);(0,t.useEffect)(()=>{e?(async()=>{c(!0);try{let e=(await a.default.projects.list()||[]).map(e=>({id:e.id,title:e.title,author:e.author,lastModified:new Date(e.updatedAt).getTime(),chapters:Array.from({length:e._count?.chapters||0},(e,t)=>({id:`placeholder-${t}`,title:"",content:""})),entities:Array.from({length:e._count?.entities||0},(e,t)=>({id:`placeholder-${t}`,type:"character",name:"",description:""})),ideas:[],settings:e.settings||void 0}));s(e)}catch(e){console.error("Failed to load projects",e)}finally{c(!1)}})():s([])},[e]),(0,t.useEffect)(()=>{o&&(async()=>{try{let e=await a.default.projects.get(o),t={id:e.id,title:e.title,author:e.author,lastModified:new Date(e.updatedAt).getTime(),settings:e.settings||void 0,styleGuide:e.styleGuide||void 0,chapters:(e.chapters||[]).map(e=>({id:e.id,title:e.title,content:e.content,summary:e.summary})),entities:(e.entities||[]).map(e=>({id:e.id,type:e.type,name:e.name,description:e.description,details:e.details,storyContext:e.storyContext,attributes:e.attributes,customValues:e.customValues})),ideas:(e.ideas||[]).map(e=>({id:e.id,title:e.title,description:e.description,status:e.status,category:e.category,createdAt:new Date(e.createdAt).getTime()})),workflow:{nodes:(e.plotNodes||[]).map(e=>({id:e.id,x:e.x,y:e.y,title:e.title,description:e.description,color:e.color,type:e.type})),connections:(e.plotConnections||[]).map(e=>({id:e.id,source:e.source,target:e.target}))}};s(e=>e.map(e=>e.id===o?t:e))}catch(e){console.error("Failed to load project details",e)}})()},[o]);let n=async(e,t)=>{try{let r=await a.default.chapters.create({projectId:e,title:t.title||"New Chapter",content:t.content||"",summary:t.summary||void 0});return s(t=>t.map(t=>t.id!==e?t:{...t,chapters:[...t.chapters,{id:r.id,title:r.title,content:r.content,summary:r.summary}]})),r.id}catch(e){return console.error("Failed to add chapter",e),null}};return{projects:i,currentProjectId:o,setCurrentProjectId:l,createProject:async()=>{if(e)try{let t=await a.default.projects.create({title:r.DEFAULT_BOOK_TITLE,author:e.name||r.DEFAULT_AUTHOR,settings:{genre:"Fantasy",targetAudience:"Adult",tone:"Epic"}}),i={id:t.id,title:t.title,author:t.author,lastModified:Date.now(),chapters:[],entities:[],ideas:[],settings:t.settings};return s(e=>[...e,i]),await n(t.id,r.INITIAL_CHAPTER),t.id}catch(e){throw console.error("Failed to create project",e),e}},updateProject:async(e,t)=>{s(a=>a.map(a=>a.id===e?{...a,...t}:a));try{let r={};void 0!==t.title&&(r.title=t.title),void 0!==t.author&&(r.author=t.author),void 0!==t.settings&&(r.settings=t.settings),void 0!==t.styleGuide&&(r.styleGuide=t.styleGuide),Object.keys(r).length>0&&await a.default.projects.update(e,r),t.workflow&&await a.default.projects.syncWorkflow(e,{nodes:t.workflow.nodes||[],connections:t.workflow.connections||[]})}catch(e){console.error("Failed to update project",e)}},addChapter:n,updateChapter:async(e,t,r)=>{s(a=>a.map(a=>a.id!==e?a:{...a,chapters:a.chapters.map(e=>e.id===t?{...e,...r}:e)}));try{await a.default.chapters.update(t,r)}catch(e){console.error("Failed to update chapter",e)}},createEntity:async(e,t,r)=>{try{let i=await a.default.entities.create({projectId:e,type:t,name:r?.name||`Nouveau ${t}`,description:r?.description||"",details:r?.details||"",attributes:r?.attributes||void 0,customValues:r?.customValues||void 0});return s(t=>t.map(t=>t.id!==e?t:{...t,entities:[...t.entities,{id:i.id,type:i.type,name:i.name,description:i.description,details:i.details,attributes:i.attributes,customValues:i.customValues||{}}]})),i.id}catch(e){throw console.error("Failed to create entity",e),e}},updateEntity:async(e,t,r)=>{s(a=>a.map(a=>a.id!==e?a:{...a,entities:a.entities.map(e=>e.id===t?{...e,...r}:e)}));try{await a.default.entities.update(t,r)}catch(e){console.error("Failed to update entity",e)}},deleteEntity:async(e,t)=>{s(a=>a.map(a=>a.id!==e?a:{...a,entities:a.entities.filter(e=>e.id!==t)}));try{await a.default.entities.delete(t)}catch(e){console.error("Failed to delete entity",e)}},deleteProject:async e=>{try{await a.default.projects.delete(e),s(t=>t.filter(t=>t.id!==e)),o===e&&l(null)}catch(e){console.error("Failed to delete project",e)}}}}],8011);var i=e.i(78445);let s=(0,i.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>s],30103);let o=(0,i.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["LogOut",()=>o],86180)}]);