1import{aV as U,aT as le,c as H,aL as S,aQ as ne,O as w,j as e,g$ as J,o as ie,bQ as R,z as he,p as ge,f$ as ue,H as O,q as pe,bl as be,bv as P,ij as q,bt as Q,A as K,jC as D,Q as je,bM as ye,cn as X,c1 as Z,P as V,y as W,bI as fe,km as Ne,c4 as ve,h as we}from"./index.DpMbmDRM.js";import{e as ee,r as m,h as ke,m as Ce,i as oe,j as T,N as Se}from"./vendor.DRWrrDqG.js";import{r as ce,C as de}from"./ChildrensBookBuilder.CTrEd___.js";import{i as Ae}from"./immer.CBzIxoqi.js";import{c as Be,d as G,e as Y,o as Te}from"./yup.B_LxnEM2.js";import{v as te}from"./v4.C6aID195.js";import{c as Ie}from"./react.Yu_zsz7h.js";import{u as Pe}from"./index.esm.piHz4NLV.js";import{S as Ee}from"./share-2.DeX1JQ9V.js";import{D as ae}from"./download.B78paIRD.js";import"./antd.qZt8WDgQ.js";import"./jspdf.es.min.DgWMmjYm.js";/** 2 * @license lucide-react v0.477.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Fe=[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]],_e=U("BookOpenCheck",Fe);/** 7 * @license lucide-react v0.477.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ge=[["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"}]],Re=U("Lightbulb",Ge);/** 12 * @license lucide-react v0.477.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const $e=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Me=U("WandSparkles",$e);/** 17 * @license lucide-react v0.477.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Le=[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]],ze=U("Waypoints",Le);function qe(r){return le({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M254.443 49.593c-9.011.085-18 1.243-25.056 3.412-7.057 2.17-11.811 5.395-13.676 8.17-7.133 10.617-9.076 19.519-8.1 27.63.977 8.11 5.102 15.92 12.159 23.443 9.846 10.495 25.39 19.81 42.857 26.955-7.836-14.753-11.888-28.818-10.357-42.717 1.826-16.589 11.956-31.077 29.351-43.768-.63-.174-1.186-.377-1.85-.533-7.244-1.703-16.316-2.676-25.328-2.592zm37.79 17.461c-14.638 10.454-20.887 20.609-22.075 31.4-1.474 13.394 5.377 30.64 20.887 52.175l14.023 19.468c12.6-8.667 25.012-12.72 36.782-12.959a54.52 54.52 0 0 1 5.888.2c15.544 1.368 29.047 8.774 41.418 17.423l-10.312 14.752c-11.223-7.846-21.99-13.307-32.684-14.248-10.693-.94-22.044 2.044-36.463 13.838l-11.394-13.932a102.983 102.983 0 0 1 5.824-4.43l-22.74-6.167c-28.693-7.783-56.841-20.93-74.742-40.012-8.951-9.54-15.368-20.858-16.903-33.607-.569-4.726-.43-9.582.42-14.502C121.752 105.216 73 177.51 73 262.775c0 110.751 82.246 199.637 183 199.637s183-88.886 183-199.637c0-97.123-63.252-177.427-146.768-195.72zM170.15 157.138c13.872.282 28.637 5.837 43.547 18.033l-11.394 13.932c-14.419-11.794-25.77-14.779-36.463-13.838-10.693.941-21.46 6.402-32.684 14.248l-10.312-14.752c12.371-8.649 25.874-16.055 41.418-17.424a54.52 54.52 0 0 1 5.888-.199zm-2.15 40c26.955 0 49 22.045 49 49s-22.045 48.998-49 48.998c-26.386 0-48.053-21.125-48.957-47.3a32.955 32.955 0 0 1 0-3.395c.904-26.175 22.571-47.303 48.957-47.303zm176 0c26.955 0 49 22.045 49 49s-22.045 48.998-49 48.998c-26.386 0-48.053-21.125-48.957-47.3a32.955 32.955 0 0 1 0-3.395c.904-26.175 22.571-47.303 48.957-47.303zm-176 17.998c-1.378 0-2.73.097-4.059.268C176.22 220.226 185 232.224 185 246.138c0 13.914-8.78 25.9
211-21.059 30.733 1.329.17 2.681.267 4.059.267 17.228 0 31-13.772 31-31s-13.772-31.002-31-31.002zm176 0c-1.378 0-2.73.097-4.059.268C352.22 220.226 361 232.224 361 246.138c0 13.914-8.78 25.91-21.059 30.733 1.329.17 2.681.267 4.059.267 17.228 0 31-13.772 31-31s-13.772-31.002-31-31.002zm-284.746 3.006c-14.197 2.45-23.466 7.41-29.065 13.145-7.967 8.162-9.918 18.531-7.39 30.328 3.681 17.18 18.154 35.225 36.076 43.775A235.517 235.517 0 0 1 55 262.775c0-15.287 1.47-30.215 4.254-44.633zm393.492 0A235.355 235.355 0 0 1 457 262.775c0 14.575-1.339 28.823-3.875 42.615 17.922-8.55 32.395-26.595 36.076-43.775 2.528-11.797.577-22.166-7.39-30.328-5.599-5.735-14.868-10.695-29.065-13.145zM152 231.136c-8.391 0-15 6.61-15 15.002 0 3.263 1.008 6.248 2.723 8.688l23.545-18.65c-2.732-3.099-6.734-5.04-11.268-5.04zm176 0c-8.391 0-15 6.61-15 15.002 0 3.263 1.008 6.248 2.723 8.688l23.545-18.65c-2.732-3.099-6.734-5.04-11.268-5.04zm-98.41 49.95c8 6.34 13.916 10.984 18.228 13.718 4.313 2.735 6.56 3.356 8.182 3.356 1.623 0 3.87-.621 8.182-3.356 4.312-2.734 10.228-7.378 18.228-13.718l11.18 14.103c-8 6.34-14.084 11.208-19.772 14.815-5.687 3.606-11.44 6.154-17.818 6.154-6.377 0-12.13-2.548-17.818-6.154-5.688-3.607-11.772-8.474-19.772-14.815zm-82.393 51.1h217.606l-4.336 12.046s-8.333 23.283-25.164 46.664C318.472 414.277 292.167 439.09 256 439.09c-36.167 0-62.472-24.812-79.303-48.193-16.83-23.38-25.164-46.664-25.164-46.664zM218 350.137v32h32v-32z"},child:[]}]})(r)}function De(r){return le({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M196.73 35.23c-8.132.878-16.3 1.936-24.515 3.172C192.968 50.21 212.045 66.795 224 96c-24.896-22.512-44.232-39.5-75.795-53.512-8.808 1.676-17.69 3.562-26.656 5.64 22.69 10.745 49.02
216 26.094 75.114 51.306-57.456-25.454-81.792-31.066-120.23-39.4C64.33 63.598 52.03 67.5 39.5 71.743c54.813 3.532 103.127 19.644 187.346 47.717l2.015.673 1.503 1.504c5.794 5.793 15.356 9.254 25.203 9.353-2.725-39.43-18.787-67.802-58.836-95.76zm118.54 0c-40.05 27.958-56.11 56.33-58.836 95.76 9.847-.1 19.41-3.56 25.203-9.353l1.502-1.504 2.014-.672C369.374 91.39 417.687 75.277 472.5 71.745c-12.53-4.243-24.83-8.145-36.934-11.71-38.438 8.334-62.774 13.946-120.23 39.4 26.088-25.212 52.424-40.56 75.115-51.307-8.964-2.077-17.847-3.963-26.655-5.64-31.563 14.014-50.9 31-75.795 53.513 11.954-29.205 31.032-45.79 51.785-57.598-8.216-1.236-16.383-2.294-24.515-3.172zM25 89.287v301.758c44.68.19 106.01 16.813 190 44.498v-301.04C128.034 105.534 81.67 90.71 25 89.288zm462 0c-56.67 1.423-103.034 16.246-190 45.217v301.05c84.317-27.698 143.413-42.5 190-44.2V89.287zm-254 55.195v200.325c15.47 3.1 30.71 3.292 46 .097V144.482c-7.227 3.058-15.14 4.518-23 4.518-7.86 0-15.773-1.46-23-4.518zm0 218.627v13.933c15.296 3.488 30.512 3.284 46-.1V363.22c-15.37 2.728-30.764 2.543-46-.11zm46 32.185c-15.226 2.856-30.633 3.058-46 .125v48.838c3.222 3.24 5.775 5.876 8.365 7.56 3.283 2.136 6.77 3.49 14.274 3.19l.18-.008h.18c11.61 0 15.954-4.04 23-10.836v-48.87z"},child:[]}]})(r)}class Ve{async getDashboard(){try{const t=await H("/api/v1/book-writer/dashboard");if(t.code!==200)throw new Error(`HTTP ${t.code}: Request failed`);return t.data}catch(t){throw console.error("Dashboard fetch failed:",t),new Error(t.message||"Failed to load dashboard")}}async createProject(t){try{const s=await S("/api/v1/book-writer/projects",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data.project}catch(s){throw console.error("Project creation failed:",s),new Error(s.message||"Failed to create project")}}async getProject(t){try{const s=await H(`/api/v1/book-writer/projects/${t}`);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data.project}catch(s){throw console.error("Project fetch failed:",s),new Error(s.message||"Failed to fetch project")}}async updateProject(t,s){try{const a=await ne(`/api/v1/book-writer/projects/${t}`,s);if(a.code!==200)throw new Error(`HTTP ${a.code}: Request failed`);return a.data.project}catch(a){throw console.error("Project update failed:",a),new Error(a.message||"Failed to update project")}}async listProjects(t){try{const s=new URLSearchParams;t!=null&&t.project_type&&s.append("project_type",t.project_type),t!=null&&t.status&&s.append("status",t.status),t!=null&&t.limit&&s.append("limit",t.limit.toString());const a=`/api/v1/book-writer/projects${s.toString()?"?"+s.toString():""}`,l=await H(a);if(l.code!==200)throw new Error(`HTTP ${l.code}: Request failed`);return l.data.projects}catch(s){throw console.error("Projects list failed:",s),new Error(s.message||"Failed to list projects")}}async generateCountingBook(t){try{const s=await S("/api/v1/counting-book/generate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Counting book generation failed:",s),new Error(s.message||"Failed to generate counting book")}}async validateCountingBook(t){try{const s=await S("/api/v1/counting-book/validate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Counting book validation failed:",s),new Error(s.message||"Failed to validate counting book")}}async generateBilingualBook(t){try{const s=await S("/api/v1/bilingual-book/generate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Bilingual book generation failed:",s),new Error(s.message||"Failed to generate bilingual book")}}async translatePage(t){try{const s=await S("/api/v1/bilingual-book/translate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Page translation failed:",s),new Error(s.message||"Failed to translate page")}}async generateChapterBook(t){try{const s=await S("/api/v1/chapter-book/generate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Chapter book generation failed:",s),new Error(s.message||"Failed to generate chapter book")}}async analyzeReadingLevel(t){try{const s=await S("/api/v1/chapter-book/analyze-reading-level",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Reading level analysis failed:",s),new Error(s.message||"Failed to analyze reading level")}}async generateChoiceBook(t){try{const s=await S("/api/v1/choice-book/generate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Choice book generation failed:",s),new Error(s.message||"Failed to generate choice book")}}async validateChoiceGraph(t){try{const s=await S("/api/v1/choice-book/validate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Choice book validation failed:",s),new Error(s.message||"Failed to validate choice book")}}async generateActivityBook(t){try{const s=await S("/api/v1/activity-book/generate",t);if(s.code!==200)throw new Error(`HTTP ${s.code}: Request failed`);return s.data}catch(s){throw console.error("Activity book generation failed:",s),new Error(s.message||"Failed to generate activity book")}}}const We=new Ve,Oe=()=>{const r=ee(),[t,s]=m.useState(null),[a,l]=m.useState([]),[i,n]=m.useState([]),[o,x]=m.useState(!0);m.useEffect(()=>{g()},[]);const g=async()=>{try{x(!0);const c=await We.getDashboard();s(c.stats),l(c.recent_projects||[]),n(c.recent_books||[])}catch(c){w.error(c.message||"Failed to load dashboard")}finally{x(!1)}},j=c=>{r(`/book-writer/${c}`)},d=c=>new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return o?e.jsx("div",{className:"flex items-center justify-center h-screen",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600"})}):e.jsxs("div",{className:"min-h-screen bg-gray-50 p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Book Writer Dashboard"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Create and manage your book projects"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 border border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Projects"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-2",children:(t==null?void 0:t.total_projects)||0})]}),e.jsx("div",{className:"w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center",children:e.jsx(J,{className:"w-6 h-6 text-indigo-600"})})]}),e.jsxs("div",{className:"mt-4 flex items-center text-sm text-green-600",children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:"Active"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 border border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Total Books"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-2",children:(t==null?void 0:t.total_books)||0})]}),e.jsx("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 text-purple-600"})})]}),e.jsxs("div",{className:"mt-4 flex items-center text-sm text-gray-500",children:[e.jsx(he,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:"Published"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 border border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Characters"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-2",children:(t==null?void 0:t.total_characters)||0})]}),e.jsx("div",{className:"w-12 h-12 bg-pink-100 rounded-lg flex items-center justify-center",children:e.jsx(ge,{className:"w-6 h-6 text-pink-600"})})]}),e.jsx("div",{className:"mt-4 flex items-center text-sm text-gray-500",children:e.jsx("span",{children:"In library"})})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 border border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-600",children:"Series"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900 mt-2",children:(t==null?void 0:t.total_series)||0})]}),e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:e.jsx(ue,{className:"w-6 h-6 text-green-600"})})]}),e.jsx("div",{className:"mt-4 flex items-center text-sm text-gray-500",children:e.jsx("span",{children:"Multi-book"})})]})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-4",children:"Start a New Project"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("button",{onClick:()=>j("picture-book"),className:"bg-white rounded-lg shadow-sm p-6 border-2 border-gray-200 hover:border-indigo-500 hover:shadow-md transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-500 to-pink-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(De,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Picture Book"}),e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Ages 3-8 ⢠Illustrated stories"}),e.jsxs("div",{className:"flex items-center text-sm text-indigo-600 font-medium group-hover:gap-2 transition-all",children:[e.jsx("span",{children:"Create"}),e.jsx(O,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),t&&t.projects_by_type["picture-book"]>0&&e.jsxs("div",{className:"mt-3 text-xs text-gray-500",children:[t.projects_by_type["picture-book"]," existing projects"]})]}),e.jsxs("button",{onClick:()=>j("board-book"),className:"bg-white rounded-lg shadow-sm p-6 border-2 border-gray-200 hover:border-indigo-500 hover:shadow-md transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-cyan-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(qe,{className:"w-6 h-6 text-white"})}),e.jsxs("h3",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:["Board Book",e.jsx("span",{className:"px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded",children:"New"})]}),e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Ages 0-3 ⢠Touch & feel"}),e.jsxs("div",{className:"flex items-center text-sm text-indigo-600 font-medium group-hover:gap-2 transition-all",children:[e.jsx("span",{children:"Create"}),e.jsx(O,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsxs("button",{onClick:()=>j("early-reader"),className:"bg-white rounded-lg shadow-sm p-6 border-2 border-gray-200 hover:border-indigo-500 hover:shadow-md transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-green-500 to-emerald-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(pe,{className:"w-6 h-6 text-white"})}),e.jsxs("h3",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:["Early Reader",e.jsx("span",{className:"px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded",children:"New"})]}),e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Ages 4-8 ⢠First chapters"}),e.jsxs("div",{className:"flex items-center text-sm text-indigo-600 font-medium group-hover:gap-2 transition-all",children:[e.jsx("span",{children:"Create"}),e.jsx(O,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsxs("button",{onClick:()=>j("chapter-book"),className:"bg-white rounded-lg shadow-sm p-6 border-2 border-gray-200 hover:border-indigo-500 hover:shadow-md transition-all text-left group",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-orange-500 to-red-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsxs("h3",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:["Chapter Book",e.jsx("span",{className:"px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded",children:"New"})]}),e.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Ages 6-9 ⢠Full stories"}),e.jsxs("div",{className:"flex items-center text-sm text-indigo-600 font-medium group-hover:gap-2 transition-all",children:[e.jsx("span",{children:"Create"}),e.jsx(O,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-4",children:"Recent Projects"}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:a.length===0?e.jsxs("div",{className:"p-8 text-center text-gray-500",children:[e.jsx(J,{className:"w-12 h-12 mx-auto mb-3 text-gray-400"}),e.jsx("p",{children:"No projects yet. Start creating!"})]}):e.jsx("div",{className:"divide-y divide-gray-200",children:a.map(c=>e.jsx("div",{className:"p-4 hover:bg-gray-50 cursor-pointer transition",onClick:()=>r(`/book-writer/${c.project_type}/${c.project_id}`),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded-lg flex items-center justify-center",children:e.jsx(J,{className:"w-6 h-6 text-gray-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium text-gray-900 truncate",children:c.project_name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-xs text-gray-500",children:c.project_type.replace("-"," ")}),e.jsx("span",{className:"text-xs text-gray-400",children:"â¢"}),e.jsx("span",{className:"text-xs text-gray-500",children:d(c.updated_at)})]})]}),e.jsx("div",{className:`px-2 py-1 text-xs font-medium rounded ${c.status==="completed"?"bg-green-100 text-green-700":c.status==="in-progress"?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"}`,children:c.status})]})},c.project_id))})})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 mb-4",children:"Recent Books"}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:i.length===0?e.jsxs("div",{className:"p-8 text-center text-gray-500",children:[e.jsx(R,{className:"w-12 h-12 mx-auto mb-3 text-gray-400"}),e.jsx("p",{children:"No books created yet"})]}):e.jsx("div",{className:"divide-y divide-gray-200",children:i.map(c=>e.jsx("div",{className:"p-4 hover:bg-gray-50 cursor-pointer transition",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-purple-500 to-pink-500 rounded-lg flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium text-gray-900 truncate",children:c.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:["Ages ",c.age_group]}),e.jsx("span",{className:"text-xs text-gray-400",children:"â¢"}),e.jsx("span",{className:"text-xs text-gray-500",children:d(c.created_at)})]})]})]})},c.book_id))})})]})]})]})},He=({rhymeScheme:r,meterType:t,autoValidate:s=!1,initialText:a=""})=>{const[l,i]=m.useState(a),[n,o]=m.useState(null),[x,g]=m.useState(!1);m.useEffect(()=>{if(s&&l.trim()){const h=setTimeout(()=>{j()},1e3);return()=>clearTimeout(h)}},[l,r,t,s]);const j=async()=>
21{if(!l.trim()){w.error("Please enter some text to validate");return}g(!0);try{const h=await ce.validateRhymeAndMeter({text:l,rhyme_scheme:r!=="FREE"?r:void 0,meter_type:t!=="free-verse"?t:void 0});o(h)}catch(h){w.error(h.message||"Validation failed")}finally{g(!1)}},d=h=>h>=90?"text-green-600":h>=75?"text-blue-600":h>=60?"text-yellow-600":"text-red-600",c=h=>h>=90?"bg-green-100 border-green-300":h>=75?"bg-blue-100 border-blue-300":h>=60?"bg-yellow-100 border-yellow-300":"bg-red-100 border-red-300",f=h=>h==="Excellent"?e.jsx(P,{className:"text-green-600"}):h==="Good"?e.jsx(P,{className:"text-blue-600"}):h==="Fair"?e.jsx(Q,{className:"text-yellow-600"}):e.jsx(q,{className:"text-red-600"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Enter Text to Validate"}),e.jsx("textarea",{value:l,onChange:h=>i(h.target.value),placeholder:`Enter your rhyming text here... 22Each line should be on a new line.`,className:"w-full h-32 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none text-sm"}),e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[l.split(` 23`).filter(h=>h.trim()).length," lines ⢠",l.split(" ").filter(h=>h).length," words"]})]}),!s&&e.jsx("button",{onClick:j,disabled:x||!l.trim(),className:"w-full flex items-center justify-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:bg-gray-400 transition",children:x?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{}),e.jsx("span",{children:"Validate Rhyme & Meter"})]})}),n&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:`rounded-lg p-4 border-2 ${c(n.overall_score)}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[f(n.quality_grade),e.jsx("span",{className:"font-semibold text-gray-900",children:n.quality_grade})]}),e.jsxs("div",{className:`text-2xl font-bold ${d(n.overall_score)}`,children:[n.overall_score,"%"]})]}),e.jsxs("div",{className:"text-sm text-gray-600",children:[n.line_count," lines ⢠",n.total_syllables," total syllables"]})]}),n.rhyme_validation&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h4",{className:"font-semibold text-gray-900",children:["Rhyme Scheme: ",n.rhyme_validation.scheme]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.rhyme_validation.valid?e.jsx(P,{className:"text-green-600"}):e.jsx(q,{className:"text-red-600"}),e.jsxs("span",{className:`font-bold ${d(n.rhyme_validation.score)}`,children:[n.rhyme_validation.score,"%"]})]})]}),n.rhyme_validation.matches.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-sm font-medium text-gray-700 mb-1",children:"Rhyming Pairs:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.rhyme_validation.matches.map(([h,u],b)=>e.jsxs("div",{className:"px-2 py-1 bg-green-100 text-green-700 rounded text-xs",children:["Lines ",h+1," & ",u+1," â"]},b))})]}),n.rhyme_validation.issues.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-700 mb-1",children:"Issues:"}),e.jsx("ul",{className:"space-y-1",children:n.rhyme_validation.issues.map((h,u)=>e.jsxs("li",{className:"text-xs text-red-600 flex items-start gap-1",children:[e.jsx(q,{className:"mt-0.5 flex-shrink-0"}),e.jsx("span",{children:h})]},u))})]})]}),n.meter_validation.length>0&&e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-3",children:"Meter Analysis"}),e.jsx("div",{className:"space-y-2",children:n.meter_validation.map((h,u)=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"text-sm font-medium text-gray-900",children:["Line ",u+1]}),e.jsxs("div",{className:"text-xs text-gray-600",children:[h.syllable_count," syllables",h.expected_syllables&&h.syllable_count!==h.expected_syllables&&e.jsxs("span",{className:"text-red-600 ml-1",children:["(expected ",h.expected_syllables,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[h.valid?e.jsx(P,{className:"text-green-600"}):e.jsx(q,{className:"text-red-600"}),e.jsxs("span",{className:`font-bold text-sm ${d(h.score)}`,children:[h.score,"%"]})]})]},u))})]})]})]})},Ue=({meterType:r})=>{const[t,s]=m.useState(""),[a,l]=m.useState(null),[i,n]=m.useState([]),[o,x]=m.useState(!1),[g,j]=m.useState(null),d=()=>r==="iambic-tetrameter"||r==="trochaic-tetrameter"?8:r==="anapestic-tetrameter"?12:r==="iambic-trimeter"?6:null,c=async()=>
23{if(!t.trim()){w.error("Please enter a word to find rhymes");return}x(!0);try{const u=await ce.getRhymingSuggestions({word:t,syllable_count:a||void 0,limit:50});n(u.suggestions),u.suggestions.length===0?w(`No rhymes found for "${t}"`,{icon:"â¹ï¸"}):w.success(`Found ${u.suggestions.length} rhymes!`)}catch(u){w.error(u.message||"Failed to find rhymes"),n([])}finally{x(!1)}},f=u=>{navigator.clipboard.writeText(u),j(u),w.success(`Copied "${u}"`),setTimeout(()=>{j(null)},2e3)},h=i.reduce((u,b)=>{const k=b.syllables;return u[k]||(u[k]=[]),u[k].push(b),u},{});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Find Rhyming Words"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:u=>s(u.target.value),onKeyPress:u=>u.key==="Enter"&&c(),placeholder:"Enter a word...",className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-cyan-500 focus:border-transparent"}),e.jsx("button",{onClick:c,disabled:o,className:"px-4 py-2 bg-cyan-600 hover:bg-cyan-700 text-white rounded-lg disabled:bg-gray-400 transition flex items-center gap-2",children:o?e.jsx(K,{className:"animate-pulse"}):e.jsx(K,{})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm text-gray-700",children:"Filter by syllables:"}),e.jsx("div",{className:"flex gap-2",children:[null,1,2,3,4,5].map(u=>e.jsx("button",{onClick:()=>l(u),className:`px-3 py-1 rounded text-sm font-medium transition ${a===u?"bg-cyan-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:u===null?"All":u},u||"all"))})]}),d()&&e.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(D,{className:"text-blue-600 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"font-medium text-blue-900",children:["Current meter expects ",d()," syllables per line"]}),e.jsxs("div",{className:"text-blue-700 text-xs mt-1",children:["Words with ",d()," syllables will be highlighted"]})]})]})}),i.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("h4",{className:"text-sm font-semibold text-gray-900",children:['Rhymes for "',t,'" (',i.length," found)"]})}),e.jsx("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:Object.keys(h).sort((u,b)=>Number(u)-Number(b)).map(u=>{const b=h[Number(u)],A=d()===Number(u);return e.jsxs("div",{className:`rounded-lg p-3 ${A?"bg-green-50 border-2 border-green-300":"bg-gray-50 border border-gray-200"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("div",{className:`text-xs font-semibold ${A?"text-green-700":"text-gray-600"}`,children:[u," SYLLABLE",Number(u)!==1?"S":""]}),A&&e.jsx("div",{className:"px-2 py-0.5 bg-green-600 text-white text-xs rounded-full",children:"Perfect Match"}),e.jsxs("div",{className:"text-xs text-gray-500",children:["(",b.length," word",b.length!==1?"s":"",")"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map((v,N)=>e.jsx("button",{onClick:()=>f(v.word),className:`group px-3 py-1.5 rounded-lg border-2 transition ${g===v.word?"bg-green-100 border-green-500 text-green-700":A?"bg-white border-green-300 hover:border-green-500 text-gray-900":"bg-white border-gray-300 hover:border-gray-500 text-gray-900"}`,children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-sm font-medium",children:v.word}),g===v.word?e.jsx(je,{className:"w-3 h-3"}):e.jsx(ye,{className:"w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity"})]})},N))})]},u)})})]}),i.length===0&&!o&&t&&e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(D,{className:"w-12 h-12 mx-auto mb-3 text-gray-400"}),e.jsx("p",{className:"text-sm",children:"No rhymes found. Try a different word!"})]}),i.length===0&&!t&&e.jsxs("div",{className:"text-center py-8 text-gray-400",children:[e.jsx(K,{className:"w-12 h-12 mx-auto mb-3"}),e.jsx("p",{className:"text-sm",children:"Enter a word to find rhymes"}),e.jsx("p",{className:"text-xs mt-2",children:"Click any suggestion to copy it"})]})]})},Qe=()=>{var x,g,j;const[r,t]=m.useState({scheme:"AABB",meter:"iambic-tetrameter",autoValidate:!0}),[s,a]=m.useState(!1),[l,i]=m.useState(!1),n=[{value:"AABB",label:"AABB - Couplets",description:"Lines rhyme in pairs (most common)"},{value:"ABAB",label:"ABAB - Alternating",description:"1st & 3rd rhyme, 2nd & 4th rhyme"},{value:"ABCB",label:"ABCB - Simple Four",description:"Only 2nd & 4th lines rhyme"},{value:"AAAA",label:"AAAA - Monorhyme",description:"All lines rhyme (simple books)"},{value:"FREE",label:"Free Verse",description:"No specific rhyme scheme"}],o=[{value:"iambic-tetrameter",label:"Iambic Tetrameter",description:"da-DUM da-DUM da-DUM da-DUM",syllables:"8 syllables per line"},{value:"anapestic-tetrameter",label:"Anapestic Tetrameter",description:"da-da-DUM da-da-DUM (Dr. Seuss style)",
23syllables:"12 syllables per line"},{value:"trochaic-tetrameter",label:"Trochaic Tetrameter",description:"DUM-da DUM-da DUM-da DUM-da",syllables:"8 syllables per line"},{value:"free-verse",label:"Free Verse",description:"No specific meter",syllables:"Any length"}];return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-cyan-500 text-white px-8 py-6 shadow-lg",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(D,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Rhyming Story Builder"}),e.jsx("p",{className:"text-blue-100 text-sm",children:"Professional rhyme and meter control"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-blue-100 mb-2",children:"Rhyme Scheme"}),e.jsx("select",{value:r.scheme,onChange:d=>t({...r,scheme:d.target.value}),className:"w-full px-4 py-2 rounded-lg bg-white text-gray-900 border-0 focus:ring-2 focus:ring-blue-300",children:n.map(d=>e.jsxs("option",{value:d.value,children:[d.label," - ",d.description]},d.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-blue-100 mb-2",children:"Meter Pattern"}),e.jsx("select",{value:r.meter,onChange:d=>t({...r,meter:d.target.value}),className:"w-full px-4 py-2 rounded-lg bg-white text-gray-900 border-0 focus:ring-2 focus:ring-blue-300",children:o.map(d=>e.jsxs("option",{value:d.value,children:[d.label," - ",d.syllables]},d.value))})]})]}),e.jsxs("div",{className:"mt-4 flex items-start gap-3 bg-blue-600 bg-opacity-50 rounded-lg p-3",children:[e.jsx(P,{className:"w-5 h-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"font-medium mb-1",children:[(x=n.find(d=>d.value===r.scheme))==null?void 0:x.label," + ",(g=o.find(d=>d.value===r.meter))==null?void 0:g.label]}),e.jsx("div",{className:"text-blue-100 text-xs",children:(j=o.find(d=>d.value===r.meter))==null?void 0:j.description})]})]})]})}),e.jsx("div",{className:"bg-white border-b border-gray-200 px-8 py-4",children:e.jsxs("div",{className:"max-w-7xl mx-auto flex items-center gap-3",children:[e.jsx("button",{onClick:()=>a(!s),className:`px-4 py-2 rounded-lg font-medium transition ${s?"bg-blue-100 text-blue-700 border-2 border-blue-500":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-4 h-4"}),e.jsx("span",{children:"Rhyme Validator"})]})}),e.jsx("button",{onClick:()=>i(!l),className:`px-4 py-2 rounded-lg font-medium transition ${l?"bg-cyan-100 text-cyan-700 border-2 border-cyan-500":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),e.jsx("span",{children:"Word Suggester"})]})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"autoValidate",checked:r.autoValidate,onChange:d=>t({...r,autoValidate:d.target.checked}),className:"w-4 h-4 text-blue-600 rounded"}),e.jsx("label",{htmlFor:"autoValidate",className:"text-sm text-gray-700",children:"Auto-validate while typing"})]})]})}),e.jsx("div",{className:"max-w-7xl mx-auto px-8 py-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-6",children:e.jsx(de,{rhymeScheme:r.scheme,meterType:r.meter})})}),e.jsxs("div",{className:"space-y-6",children:[s&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border-2 border-blue-200",children:[e.jsx("div",{className:"bg-blue-50 px-4 py-3 border-b border-blue-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5 text-blue-600"}),e.jsx("h3",{className:"font-semibold text-gray-900",children:"Rhyme Validator"})]})}),e.jsx("div",{className:"p-4",children:e.jsx(He,{rhymeScheme:r.scheme,meterType:r.meter,autoValidate:r.autoValidate})})]}),l&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border-2 border-cyan-200",children:[e.jsx("div",{className:"bg-cyan-50 px-4 py-3 border-b border-cyan-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5 text-cyan-600"}),e.jsx("h3",{className:"font-semibold text-gray-900",children:"Word Suggester"})]})}),e.jsx("div",{className:"p-4",children:e.jsx(Ue,{meterType:r.meter})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 rounded-lg shadow-sm p-4",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4 text-purple-600"}),e.jsx("span",{children:"Rhyming Tips"})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-700",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-purple-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Start with the rhyme scheme - it guides your structure"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-purple-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Count syllables carefully - meter creates rhythm"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-purple-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Use the word suggester to find perfect rhymes"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-purple-400 rounded-full mt-1.5"}),e.jsx("span",{children:"AABB (couplets) is easiest for beginners"})]})]})]}),e.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Example (AABB + Iambic)"}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-gray-700",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 font-bold",children:"A"}),e.jsx("span",{children:"The cat in hat came back one day (8)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 font-bold",children:"A"}),e.jsx("span",{children:"He hopped and jumped and ran away (8)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 font-bold",children:"B"}),e.jsx("span",{children:"His tail was long, his nose was round (8)"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 font-bold",children:"B"}),e.jsx("span",{children:"He made a funny squeaking sound (8)"})]})]})]})]})]})})]})},Je=()=>{var a;ee();const[r,t]=m.useState(null),s=[{id:"prose",title:"Prose Story",description:"Traditional narrative picture books with engaging storytelling",icon:e.jsx(R,{className:"w-8 h-8"}),color:"from-purple-500 to-pink-500",features:["Character development","Story arcs","Emotional themes"]},{id:"rhyming",title:"Rhyming Story",description:"Poetry and rhyme with meter control and syllable counting",icon:e.jsx(D,{className:"w-8 h-8"}),color:"from-blue-500 to-cyan-500",badge:"New",features:["Rhyme schemes (AABB, ABAB)","Meter validation","Syllable control"]}
23,{id:"educational",title:"Educational Book",description:"Learning-focused books with clear objectives and activities",icon:e.jsx(X,{className:"w-8 h-8"}),color:"from-green-500 to-emerald-500",badge:"New",features:["Learning objectives","Discussion questions","Extension activities"]}];return r?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 px-8 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("button",{onClick:()=>t(null),className:"text-sm text-gray-600 hover:text-gray-900 mb-1",children:"â Back to workflows"}),e.jsx("h2",{className:"text-xl font-bold text-gray-900",children:(a=s.find(l=>l.id===r))==null?void 0:a.title})]})})}),e.jsxs("div",{children:[r==="prose"&&e.jsx("div",{className:"p-8",children:e.jsx(de,{})}),r==="rhyming"&&e.jsx(Qe,{}),r==="educational"&&e.jsxs("div",{className:"bg-white rounded-lg p-12 text-center",children:[e.jsx(X,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Educational Workflow"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Learning-focused book creation coming soon! This will include:"}),e.jsxs("ul",{className:"text-left max-w-md mx-auto space-y-2",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-2"}),e.jsx("span",{className:"text-gray-700",children:"Define learning objectives and outcomes"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-2"}),e.jsx("span",{className:"text-gray-700",children:"Age-appropriate vocabulary building"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-2"}),e.jsx("span",{className:"text-gray-700",children:"Discussion questions and activities"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-2"}),e.jsx("span",{className:"text-gray-700",children:"STEM, social-emotional, and cultural learning"})]})]})]})]})]}):e.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Picture Book Studio"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Choose your storytelling approach"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:s.map(l=>e.jsxs("button",{onClick:()=>t(l.id),className:"bg-white rounded-xl shadow-sm border-2 border-gray-200 hover:border-indigo-500 hover:shadow-lg transition-all text-left p-6 group",children:[e.jsx("div",{className:`w-16 h-16 bg-gradient-to-br ${l.color} rounded-lg flex items-center justify-center mb-4 text-white`,children:l.icon}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:l.title}),l.badge&&e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 text-green-700 rounded",children:l.badge})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:l.description}),e.jsx("div",{className:"space-y-1",children:l.features.map((i,n)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full"}),e.jsx("span",{children:i})]},n))}),e.jsx("div",{className:"mt-4 flex items-center text-indigo-600 font-medium opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("span",{children:"Start Creating â"})})]},l.id))}),e.jsxs("div",{className:"mt-12 bg-indigo-50 rounded-lg p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Picture Books (Ages 3-8)"}),e.jsx("p",{className:"text-gray-700",children:"Picture books combine engaging narratives with beautiful illustrations. They typically have 24-32 pages with 15-30 words per page for early readers. Perfect for bedtime stories, classroom reading, and building early literacy skills."})]})]})})},Ke=({pages:r,countingRange:t,countingPattern:s,theme:a})=>{const[l,i]=m.useState(null),[n,o]=m.useState(!1);m.useEffect(()=>{x()},[r,t,s]);const x=async()=>{o(!0);try{const g=localStorage.getItem("token"),j=await fetch("/api/v1/counting-book/validate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({pages:r,counting_range:t,counting_pattern:s,theme:a})});if(j.ok){const d=await j.json();i(d)}}catch(g){console.error("Validation error:",g)}finally{o(!1)}};return n?e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-green-500"}),e.jsx("span",{className:"text-gray-600",children:"Validating counting book..."})]})}):l?e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border-2 border-green-200",children:[e.jsx("div",{className:"bg-green-50 px-4 py-3 border-b border-green-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5 text-green-600"}),e.jsx("h3",{className:"font-semibold text-gray-900",children:"Counting Validator"})]})}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:`p-4 rounded-lg mb-4 ${l.score>=80?"bg-green-50 border border-green-200":l.score>=60?"bg-yellow-50 border border-yellow-200":"bg-red-50 border border-red-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Quality Score"}),e.jsxs("span",{className:"text-2xl font-bold",children:[l.score.toFixed(0),"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:`h-2 rounded-full ${l.score>=80?"bg-green-500":l.score>=60?"bg-yellow-500":"bg-red-500"}`,style:{width:`${l.score}%`}})})]}),l.issues.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h4",{className:"font-medium text-gray-900 mb-2 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 text-red-500"}),e.jsxs("span",{children:["Issues Found (",l.issues.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[l.issues.slice(0,5).map((g,j)=>e.jsx("div",{className:"text-sm text-red-700 bg-red-50 rounded px-3 py-2",children:g}
23,j)),l.issues.length>5&&e.jsxs("div",{className:"text-sm text-gray-500 italic",children:["+ ",l.issues.length-5," more issues"]})]})]}),l.suggestions.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h4",{className:"font-medium text-gray-900 mb-2 flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{children:"Suggestions"})]}),e.jsx("div",{className:"space-y-2",children:l.suggestions.slice(0,5).map((g,j)=>e.jsx("div",{className:"text-sm text-blue-700 bg-blue-50 rounded px-3 py-2",children:g},j))})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:"Page Validation"}),e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:l.page_validations.map((g,j)=>e.jsxs("div",{className:`text-sm rounded px-3 py-2 ${g.valid?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("span",{className:"font-medium",children:["Page ",j+1," - Number ",g.expected_number]}),g.valid?e.jsx(P,{className:"w-4 h-4 text-green-600"}):e.jsx(q,{className:"w-4 h-4 text-red-600"})]}),!g.valid&&g.issues.length>0&&e.jsx("div",{className:"text-xs text-red-600 mt-1",children:g.issues[0]})]},j))})]})]})]}):null},Ye=()=>{const[r,t]=m.useState(""),[s,a]=m.useState("1-10"),[l,i]=m.useState("0-3"),[n,o]=m.useState("colorful"),[x,g]=m.useState(""),[j,d]=m.useState(!1),[c,f]=m.useState(null),[h,u]=m.useState(!1),b=[{value:"1-10",label:"1 to 10",description:"Perfect for toddlers & preschoolers",pages:10},{value:"1-20",label:"1 to 20",description:"Great for kindergarten readiness",pages:20},{value:"1-100",label:"1 to 100",description:"Advanced counting for early readers",pages:100}],k=[{value:"animals",label:"ð¾ Animals",example:"lions, elephants, bears"},{value:"toys",label:"𧸠Toys",example:"blocks, dolls, cars"},{value:"fruits",label:"ð Fruits",example:"apples, bananas, oranges"},{value:"vehicles",label:"ð Vehicles",example:"cars, trucks, buses"},{value:"ocean",label:"ð Ocean Life",example:"fish, dolphins, starfish"},{value:"space",label:"ð Space",example:"stars, planets, rockets"},{value:"garden",label:"ð» Garden",example:"flowers, butterflies, bees"},{value:"custom",label:"⨠Custom",example:"Enter your own theme"}],A=async()=>{if(!r||r==="custom"&&!x){w.error("Please select a theme or enter custom instructions");return}d(!0);try{const v=localStorage.getItem("token"),N=await fetch("/api/v1/counting-book/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({theme:r==="custom"?x:r,counting_range:s,counting_pattern:"sequential",age_group:l,illustration_style:n,custom_instructions:x})});if(!N.ok)throw new Error("Failed to generate counting book");const C=await N.json();f(C),w.success("Counting book generated successfully!"),u(!0)}catch(v){console.error("Error generating counting book:",v),w.error(v.message||"Failed to generate counting book")}finally{d(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-gradient-to-r from-green-500 to-emerald-500 text-white px-8 py-6 shadow-lg",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(Z,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Sequential Counting Book"}),e.jsx("p",{className:"text-green-100 text-sm",children:"Count by ones: 1, 2, 3, 4, 5..."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-green-100 mb-2",children:"Counting Range"}),e.jsx("select",{value:s,onChange:v=>a(v.target.value),className:"w-full px-4 py-2 rounded-lg bg-white text-gray-900 border-0 focus:ring-2 focus:ring-green-300",children:b.map(v=>e.jsxs("option",{value:v.value,children:[v.label," - ",v.description," (",v.pages," pages)"]},v.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-green-100 mb-2",children:"Age Group"}
23),e.jsxs("select",{value:l,onChange:v=>i(v.target.value),className:"w-full px-4 py-2 rounded-lg bg-white text-gray-900 border-0 focus:ring-2 focus:ring-green-300",children:[e.jsx("option",{value:"0-3",children:"Toddlers (0-3 years)"}),e.jsx("option",{value:"4-7",children:"Early Readers (4-7 years)"}),e.jsx("option",{value:"8-12",children:"Middle Grade (8-12 years)"})]})]})]})]})}),e.jsx("div",{className:"max-w-7xl mx-auto px-8 py-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Choose a Theme"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:k.map(v=>e.jsxs("button",{onClick:()=>t(v.value),className:`p-4 rounded-lg border-2 transition-all text-center ${r===v.value?"border-green-500 bg-green-50":"border-gray-200 hover:border-green-300"}`,children:[e.jsx("div",{className:"text-2xl mb-1",children:v.label.split(" ")[0]}),e.jsx("div",{className:"text-sm font-medium text-gray-900",children:v.label.split(" ").slice(1).join(" ")}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:v.example})]},v.value))}),r==="custom"&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Custom Theme"}),e.jsx("input",{type:"text",value:x,onChange:v=>g(v.target.value),placeholder:"e.g., dinosaurs, musical instruments, sports equipment",className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500"})]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-6",children:e.jsx("button",{onClick:A,disabled:j||!r,className:"w-full bg-gradient-to-r from-green-500 to-emerald-500 text-white px-6 py-4 rounded-lg font-semibold hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-3",children:j?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Generating Counting Book..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-5 h-5"}),e.jsx("span",{children:"Generate Counting Book"})]})})}),c&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:c.title}),e.jsx("p",{className:"text-gray-600 text-sm mb-4",children:c.summary}),c.validation&&e.jsxs("div",{className:`p-4 rounded-lg mb-4 ${c.validation.score>=80?"bg-green-50 border border-green-200":"bg-yellow-50 border border-yellow-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Quality Score"}),e.jsxs("span",{className:"text-2xl font-bold",children:[c.validation.score.toFixed(0),"%"]})]}),c.validation.issues.length>0&&e.jsxs("div",{className:"mt-2 text-sm text-gray-700",children:[e.jsx("strong",{children:"Issues:"}),e.jsx("ul",{className:"list-disc ml-4 mt-1",children:c.validation.issues.slice(0,3).map((v,N)=>e.jsx("li",{children:v},N))})]})]}),e.jsx("div",{className:"space-y-4 max-h-96 overflow-y-auto",children:c.pages.map(v=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"font-semibold text-green-600",children:["Page ",v.page_number]}),e.jsx("span",{className:"text-2xl font-bold text-green-600",children:v.page_number})]}),e.jsx("p",{className:"text-gray-700 text-sm",children:v.text}),v.illustration_prompt&&e.jsx("p",{className:"text-gray-500 text-xs mt-2",children:e.jsxs("em",{children:["Illustration: ",v.illustration_prompt]})})]},v.page_number))})]})]}),e.jsxs("div",{className:"space-y-6",children:[c&&e.jsxs("button",{onClick:()=>u(!h),className:"w-full px-4 py-2 bg-green-100 text-green-700 rounded-lg font-medium hover:bg-green-200 transition",children:[h?"Hide":"Show"," Validator"]}),h&&c&&e.jsx(Ke,{pages:c.pages,countingRange:s,countingPattern:"sequential",theme:r}),e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-cyan-50 rounded-lg p-4",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"ð¡ Counting Tips"}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-700",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Start with 1-10 for youngest learners"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Use familiar objects to build confidence"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Encourage pointing and counting aloud"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Include both numerals and number words"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-4 border-2 border-green-200",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Example Page (Number 3)"}),e.jsxs("div",{className:"bg-green-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-gray-800 font-medium mb-2",children:"3 - Three"}),e.jsx("p",{className:"text-sm text-gray-700",children:"Three little ducks swim in the pond. Count them: 1, 2, 3!"}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:e.jsx("em",{children:"Illustration: Exactly three yellow ducklings arranged in a clear row"})})]})]})]})]})})]})},Xe=()=>{const[r,t]=m.useState(""),[s,a]=m.useState("skip-2"),[l,i]=m.useState("1-20"),[n,o]=m.useState(!1),[x,g]=m.useState(null),j=[{value:"skip-2",label:"Count by 2s",description:"2, 4, 6, 8, 10...",example:"Pairs of items",color:"bg-purple-500",difficulty:"Beginner"},{value:"skip-5",label:"Count by 5s",description:"5, 10, 15, 20, 25...",example:"Groups of five",color:"bg-pink-500",difficulty:"Intermediate"},{value:"skip-10",label:"Count by 10s",description:"10, 20, 30, 40, 50...",example:"Groups of ten",color:"bg-indigo-500",difficulty:"Advanced"}],d=[{value:"shoes",label:"ð Shoes (Pairs)",best:"skip-2"},{value:"fingers",label:"â Hands (Fingers)",best:"skip-5"},{value:"coins",label:"ð° Coins (Pennies)",best:"skip-5"},{value:"toes",label:"𦶠Feet (Toes)",best:"skip-10"},{value:"stars",label:"â Stars",best:"any"},{value:"flowers",label:"ð¸ Flowers",best:"any"}],c=async()=>
23{if(!r){w.error("Please select a theme");return}o(!0);try{const f=localStorage.getItem("token"),h=await fetch("/api/v1/counting-book/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({theme:r,counting_range:l,counting_pattern:s,age_group:"4-7",illustration_style:"colorful",custom_instructions:`Emphasize skip counting patterns. Show items in clear groups for ${s}.`})});if(!h.ok)throw new Error("Failed to generate skip counting book");const u=await h.json();g(u),w.success("Skip counting book generated!")}catch(f){console.error("Error:",f),w.error(f.message||"Failed to generate book")}finally{o(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-pink-500 text-white px-8 py-6 shadow-lg",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(ie,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Skip Counting Book"}),e.jsx("p",{className:"text-purple-100 text-sm",children:"Master patterns: 2s, 5s, 10s"})]})]})})}),e.jsxs("div",{className:"max-w-7xl mx-auto px-8 py-6",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Choose Skip Pattern"}),e.jsx("div",{className:"space-y-3",children:j.map(f=>e.jsx("button",{onClick:()=>a(f.value),className:`w-full p-4 rounded-lg border-2 transition-all text-left ${s===f.value?"border-purple-500 bg-purple-50":"border-gray-200 hover:border-purple-300"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-900",children:f.label}),e.jsx("div",{className:"text-sm text-gray-600",children:f.description}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:f.example})]}),e.jsx("div",{className:"flex flex-col items-end gap-1",children:e.jsx("span",{className:`px-2 py-1 text-xs rounded text-white ${f.color}`,children:f.difficulty})})]})},f.value))}),e.jsxs("div",{className:"mt-6",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Counting Range"}),e.jsxs("select",{value:l,onChange:f=>i(f.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500",children:[e.jsx("option",{value:"1-20",children:"1 to 20 (Beginner)"}),e.jsx("option",{value:"1-100",children:"1 to 100 (Advanced)"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Choose Theme"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:d.map(f=>e.jsxs("button",{onClick:()=>t(f.value),className:`p-4 rounded-lg border-2 transition-all ${r===f.value?"border-purple-500 bg-purple-50":"border-gray-200 hover:border-purple-300"}`,children:[e.jsx("div",{className:"text-2xl mb-1",children:f.label.split(" ")[0]}),e.jsx("div",{className:"text-sm font-medium text-gray-900",children:f.label.split(" ").slice(1).join(" ")}),f.best!=="any"&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Best for ",f.best]})]},f.value))}),e.jsx("button",{onClick:c,disabled:n||!r,className:"w-full mt-6 bg-gradient-to-r from-purple-500 to-pink-500 text-white px-6 py-4 rounded-lg font-semibold hover:shadow-lg transition-all disabled:opacity-50 flex items-center justify-center gap-3",children:n?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Generating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-5 h-5"}),e.jsx("span",{children:"Generate Skip Counting Book"})]})})]}),x&&e.jsxs("div",{className:"lg:col-span-2 bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:x.title}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:x.pages.slice(0,9).map(f=>e.jsxs("div",{className:"border border-purple-200 rounded-lg p-4 bg-purple-50",children:[e.jsx("div",{className:"text-3xl font-bold text-purple-600 mb-2",children:f.page_number}),e.jsx("p",{className:"text-sm text-gray-700",children:f.text})]},f.page_number))})]})]}),e.jsxs("div",{className:"mt-6 bg-gradient-to-br from-yellow-50 to-orange-50 rounded-lg p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-3",children:"ð Why Skip Counting Matters"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm text-gray-700",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Multiplication Prep:"}),e.jsx("p",{className:"mt-1",children:"Skip counting by 2s, 5s, and 10s builds the foundation for understanding multiplication tables."})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Pattern Recognition:"}),e.jsx("p",{className:"mt-1",children:"Children learn to identify and predict number patterns, a critical math skill."})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Mental Math:"}),e.jsx("p",{className:"mt-1",children:"Skip counting improves mental calculation abilities and number sense."})]})]})]})]})]})},Ze=()=>{const[r,t]=m.useState(null),s=[{id:"sequential",title:"Sequential Counting",description:"Count by ones: 1, 2, 3, 4, 5... Perfect for early learners!",icon:e.jsx(Z,{className:"w-8 h-8"}),color:"from-green-500 to-emerald-500",ageGroup:"0-3 years",features:["Numbers 1-10, 1-20, or 1-100","Visual counting","Number word learning"]},{id:"skip-counting",title:"Skip Counting",description:"Count by twos, fives, or tens. Great for multiplication readiness!",icon:e.jsx(Z,{className:"w-8 h-8"}),color:"from-purple-500 to-pink-500",badge:"Advanced",ageGroup:"4-7 years",features:["Count by 2s, 5s, 10s","Pattern recognition","Pre-multiplication skills"]}];return r?e.jsxs("div",{children:[e.jsx("div",{className:"bg-white border-b border-gray-200 px-8 py-4",children:e.jsx("button",{onClick:()=>t(null),className:"text-gray-600 hover:text-gray-900 font-medium",children:"â Back to Workflow Selection"})}),r==="sequential"&&e.jsx(Ye,{}),r==="skip-counting"&&e.jsx(Xe,{})]}):e.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Counting Book Studio"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Create engaging counting books for early learners"})]}),e.jsx("div",{className:"bg-blue-50 border-l-4 border-blue-500 rounded-lg p-4 mb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Q,{className:"w-5 h-5 text-blue-600 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-blue-900 mb-1",children:"Why Counting Books?"}),e.jsx("p",{className:"text-sm text-blue-800",children:"Counting books teach number sequences, quantity recognition, and one-to-one correspondence. They're essential for early math development and help children understand that numbers represent quantities."})]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:s.map(a=>e.jsxs("button",{onClick:()=>t(a.id),className:"bg-white rounded-xl shadow-sm border-2 border-gray-200 hover:border-green-500 hover:shadow-lg transition-all text-left p-6 group",children:[e.jsx("div",{className:`w-16 h-16 bg-gradient-to-br ${a.color} rounded-lg flex items-center justify-center mb-4 text-white`,children:a.icon}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:a.title}),a.badge&&e.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-purple-100 text-purple-700 rounded",children:a.badge})]}),e.jsx("p",{className:"text-gray-600 text-sm mb-4",children:a.description}),e.jsx("div",{className:"flex items-center gap-2 mb-4",children:e.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-700 rounded",children:a.ageGroup})}),e.jsx("ul",{className:"space-y-2",children:a.features.map((l,i)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx(P,{className:"w-4 h-4 text-green-500 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:l})]},i))})]},a.id))}),e.jsxs("div",{className:"mt-8 bg-gradient-to-br from-yellow-50 to-orange-50 rounded-lg p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-3",children:"ð Teaching Tips"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm text-gray-700",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"For Sequential Counting (1-10):"}),e.jsxs("ul",{className:"list-disc ml-4 mt-1 space-y-1",children:[e.jsx("li",{children:"Start with familiar objects (toys, animals, fruits)"}),e.jsx("li",{children:"Use both numerals and number words"}),e.jsx("li",{children:"Encourage pointing and counting aloud"})]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"For Skip Counting:"}),e.jsxs("ul",{className:"list-disc ml-4 mt-1 space-y-1",children:[e.jsx("li",{children:"Begin with counting by 2s (easiest pattern)"}),e.jsx("li",{children:"Use visual groupings (pairs, groups of 5)"}),e.jsx("li",{children:"Builds foundation for multiplication"})]})]})]})]})]})})},es=()=>{const[r,t]=m.useState(""),[s,a]=m.useState("en"),[l,i]=m.useState("es"),[n,o]=m.useState("side-by-side"),[x,g]=m.useState(!0),[j,d]=m.useState("4-7"),[c,f]=m.useState(12),[h,u]=m.useState(!1),[b,k]=m.useState(null),A=[{code:"en",name:"English",flag:"ðºð¸",popular:!0},{code:"es",name:"Spanish",flag:"ðªð¸",popular:!0},{code:"fr",name:"French",flag:"ð«ð·",popular:!0},{code:"de",name:"German",flag:"ð©ðª",popular:!1},{code:"it",name:"Italian",flag:"ð®ð¹",popular:!1},{code:"pt",name:"Portuguese",flag:"ðµð¹",popular:!0},{code:"zh",name:"Chinese",flag:"ð¨ð³",popular:!0},{code:"ja",name:"Japanese",flag:"ð¯ðµ",popular:!1},{code:"ko",name:"Korean",flag:"ð°ð·",popular:!1},{code:"ar",name:"Arabic",flag:"ð¸ð¦",popular:!0}],v=[{value:"side-by-side",label:"Side by Side",description:"Both languages on the same page",icon:"ð",best:"Best for comparing languages"},{value:"alternating-pages",label:"Alternating Pages",description:"Language A, then Language B",icon:"ð",best:"Best for focused reading"}
23,{value:"mixed",label:"Mixed",description:"Text in both languages together",icon:"ð",best:"Best for immersion"}],N=async()=>{if(!r||!l){w.error("Please enter a theme and select secondary language");return}if(s===l){w.error("Primary and secondary languages must be different");return}u(!0);try{const p=localStorage.getItem("token"),E=await fetch("/api/v1/bilingual-book/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({theme:r,primary_language:s,secondary_language:l,age_group:j,num_pages:c,bilingual_layout:n,cultural_adaptation:x})});if(!E.ok)throw new Error("Failed to generate bilingual book");const M=await E.json();k(M),w.success(`Bilingual book generated! Avg quality: ${M.translation_quality.average_score.toFixed(0)}%`)}catch(p){console.error("Error:",p),w.error(p.message||"Failed to generate bilingual book")}finally{u(!1)}},C=p=>{var E;return((E=A.find(M=>M.code===p))==null?void 0:E.name)||p},B=p=>{var E;return((E=A.find(M=>M.code===p))==null?void 0:E.flag)||"ð"};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-purple-500 text-white px-8 py-6 shadow-lg",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(fe,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Bilingual Book Studio"}),e.jsx("p",{className:"text-indigo-100 text-sm",children:"Create books in two languages with AI translation"})]})]})})}),e.jsxs("div",{className:"max-w-7xl mx-auto px-8 py-6",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Language Selection"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Primary Language"}),e.jsx("select",{value:s,onChange:p=>a(p.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500",children:A.map(p=>e.jsxs("option",{value:p.code,children:[p.flag," ",p.name," ",p.popular&&"â"]},p.code))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Secondary Language"}),e.jsx("select",{value:l,onChange:p=>i(p.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500",children:A.filter(p=>p.code!==s).map(p=>e.jsxs("option",{value:p.code,children:[p.flag," ",p.name," ",p.popular&&"â"]},p.code))})]}),e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 rounded-lg",children:[e.jsx("p",{className:"text-sm text-blue-800 font-medium mb-2",children:"Popular Language Pairs:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:()=>{a("en"),i("es")},className:"text-xs px-3 py-1 bg-white rounded-full hover:bg-blue-100 transition",children:"English-Spanish ðºð¸ðªð¸"}),e.jsx("button",{onClick:()=>{a("en"),i("fr")},className:"text-xs px-3 py-1 bg-white rounded-full hover:bg-blue-100 transition",children:"English-French ðºð¸ð«ð·"}),e.jsx("button",{onClick:()=>{a("en"),i("zh")},className:"text-xs px-3 py-1 bg-white rounded-full hover:bg-blue-100 transition",children:"English-Chinese ðºð¸ð¨ð³"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Bilingual Layout"}),e.jsx("div",{className:"space-y-3",children:v.map(p=>e.jsxs("button",{onClick:()=>o(p.value),className:`w-full p-4 rounded-lg border-2 transition-all text-left ${n===p.value?"border-indigo-500 bg-indigo-50":"border-gray-200 hover:border-indigo-300"}`,children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:p.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-900",children:p.label}),e.jsx("div",{className:"text-sm text-gray-600",children:p.description})]})]})}),e.jsx("div",{className:"text-xs text-indigo-600 mt-2",children:p.best})]},p.value))})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Book Settings"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Theme"}),e.jsx("input",{type:"text",value:r,onChange:p=>t(p.target.value),placeholder:"e.g., friendship, animals, adventure",className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Age Group"}),e.jsxs("select",{value:j,onChange:p=>d(p.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"0-3",children:"0-3 years"}),e.jsx("option",{value:"4-7",children:"4-7 years"}),e.jsx("option",{value:"8-12",children:"8-12 years"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Pages"}),e.jsx("input",{type:"number",value:c,onChange:p=>f(parseInt(p.target.value)),min:8,max:24,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",id:"culturalAdaptation",checked:x,onChange:p=>g(p.target.checked),className:"w-4 h-4 text-indigo-600 rounded"}),e.jsxs("label",{htmlFor:"culturalAdaptation",className:"text-sm text-gray-700",children:["Adapt cultural references for ",C(l)," speakers"]})]})]}),e.jsx("button",{onClick:N,disabled:h||!r,className:"w-full mt-6 bg-gradient-to-r from-indigo-500 to-purple-500 text-white px-6 py-4 rounded-lg font-semibold hover:shadow-lg transition-all disabled:opacity-50 flex items-center justify-center gap-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Generating & Translating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-5 h-5"}),e.jsx("span",{children:"Generate Bilingual Book"})]})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-3",children:"Selected Languages"}),e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl mb-2",children:B(s)}),e.jsx("div",{className:"text-sm font-medium text-gray-900",children:C(s)})]}),e.jsx("div",{className:"text-2xl text-gray-400",children:"â"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl mb-2",children:B(l)}),e.jsx("div",{className:"text-sm font-medium text-gray-900",children:C(l)})]})]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 rounded-lg p-4",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(P,{className:"w-5 h-5 text-green-600"}),e.jsx("span",{children:"Benefits of Bilingual Books"})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-700",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Develops bilingual language skills early"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Builds cultural awareness and appreciation"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Helps maintain heritage languages"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full mt-1.5"}),e.jsx("span",{children:"Perfect for multilingual families"})]})]})]}),b&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-3",children:"Translation Quality"}),e.jsxs("div",{className:`p-4 rounded-lg ${b.translation_quality.average_score>=80?"bg-green-50 border border-green-200":"bg-yellow-50 border border-yellow-200"}`,children:[e.jsxs("div",{className:"text-3xl font-bold text-center mb-2",children:[b.translation_quality.average_score.toFixed(0),"%"]}),e.jsx("div",{className:"text-sm text-center text-gray-700",children:"Average Quality Score"}),b.translation_quality.issues.length>0&&e.jsxs("div",{className:"mt-3 text-xs text-gray-600",children:[e.jsx("strong",{children:"Issues:"}),e.jsx("ul",{className:"list-disc ml-4 mt-1",children:b.translation_quality.issues.slice(0,3).map((p,E)=>e.jsx("li",{children:p},E))})]})]})]})]})]}),b&&e.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:b.title}),e.jsx("div",{className:"space-y-4",children:b.pages.slice(0,5).map(p=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"font-medium text-gray-900 mb-3",children:["Page ",p.page_number]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs font-medium text-gray-500 mb-1 flex items-center gap-1",children:[B(s)," ",C(s)]}),e.jsx("p",{className:"text-sm text-gray-700",children:p.primary_text})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs font-medium text-gray-500 mb-1 flex items-center gap-1",children:[B(l)," ",C(l)]}),e.jsx("p",{className:"text-sm text-gray-700",children:p.secondary_text})]})]}
23),p.quality_score&&e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Quality: ",p.quality_score.toFixed(0),"%"]})]},p.page_number))})]})]})]})},ss=()=>{var d;const[r,t]=m.useState(""),[s,a]=m.useState("8-12"),[l,i]=m.useState(3),[n,o]=m.useState(!1),[x,g]=m.useState(null),j=async()=>{if(!r){w.error("Please enter a theme");return}o(!0);try{const c=localStorage.getItem("token"),f=await fetch("/api/v1/choice-book/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify({theme:r,age_group:s,num_endings:l})});if(!f.ok)throw new Error("Failed to generate");const h=await f.json();g(h),w.success(`Generated with ${h.validation.graph_metrics.total_nodes} nodes!`)}catch(c){w.error(c.message)}finally{o(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("div",{className:"bg-gradient-to-r from-orange-500 to-red-500 text-white rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ne,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Interactive Choice Book"}),e.jsx("p",{className:"text-orange-100 text-sm",children:'"Choose Your Adventure" style stories'})]})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-6 mb-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Theme"}),e.jsx("input",{type:"text",value:r,onChange:c=>t(c.target.value),placeholder:"e.g., space adventure, mystery detective, magical forest",className:"w-full px-4 py-2 border border-gray-300 rounded-lg"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Age Group"}),e.jsxs("select",{value:s,onChange:c=>a(c.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg",children:[e.jsx("option",{value:"4-7",children:"4-7 years"}),e.jsx("option",{value:"8-12",children:"8-12 years"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Number of Endings"}),e.jsx("input",{type:"number",value:l,onChange:c=>i(parseInt(c.target.value)),min:2,max:5,className:"w-full px-4 py-2 border border-gray-300 rounded-lg"})]})]}),e.jsx("button",{onClick:j,disabled:n,className:"w-full bg-gradient-to-r from-orange-500 to-red-500 text-white px-6 py-3 rounded-lg font-semibold hover:shadow-lg transition disabled:opacity-50 flex items-center justify-center gap-3",children:n?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Generating Story Graph..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-5 h-5"}),e.jsx("span",{children:"Generate Interactive Story"})]})})]})}),x&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:x.title}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-blue-50 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:x.validation.graph_metrics.total_nodes}),e.jsx("div",{className:"text-sm text-gray-600",children:"Story Nodes"})]}),e.jsxs("div",{className:"bg-green-50 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:x.validation.graph_metrics.ending_nodes}),e.jsx("div",{className:"text-sm text-gray-600",children:"Endings"})]}),e.jsxs("div",{className:"bg-purple-50 rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600",children:[x.validation.score.toFixed(0),"%"]}),e.jsx("div",{className:"text-sm text-gray-600",children:"Quality"})]})]}),e.jsx("div",{className:"space-y-3",children:(d=x.nodes)==null?void 0:d.slice(0,5).map(c=>{var f;return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"font-medium text-gray-900 mb-2",children:[c.node_id," ",c.is_ending&&"ð"]}),e.jsx("p",{className:"text-sm text-gray-700 mb-2",children:c.text}),((f=c.choices)==null?void 0:f.length)>0&&e.jsx("div",{className:"space-y-1",children:c.choices.map((h,u)=>e.jsxs("div",{className:"text-xs text-blue-600",children:["â ",h.text," (leads to: ",h.leads_to,")"]},u))})]},c.node_id)})})]})]})})},ts=()=>{var u;const[r,t]=m.useState(""),[s,a]=m.useState("4-7"),[l,i]=m.useState(12),[n,o]=m.useState(["word-search","maze","coloring"]),[x,g]=m.useState(!1),[j,d]=m.useState(null),c=[{value:"word-search",label:"Word Search ð",description:"Find hidden words"},{value:"maze",label:"Maze ð",description:"Navigate paths"},{value:"coloring",label:"Coloring ð¨",description:"Color pictures"},{value:"counting",label:"Counting ð¢",description:"Count objects"}],f=b=>{n.includes(b)?o(n.filter(k=>k!==b)):o([...n,b])},h=async()=>
23{if(!r||n.length===0){w.error("Please enter theme and select activities");return}g(!0);try{const b=localStorage.getItem("token"),k=await fetch("/api/v1/activity-book/generate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({theme:r,age_group:s,num_pages:l,activity_types:n})});if(!k.ok)throw new Error("Failed to generate");const A=await k.json();d(A),w.success("Activity book generated!")}catch(b){w.error(b.message)}finally{g(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("div",{className:"bg-gradient-to-r from-yellow-500 to-orange-500 text-white rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ve,{className:"w-8 h-8"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Activity Book Studio"}),e.jsx("p",{className:"text-yellow-100 text-sm",children:"Educational puzzles and activities"})]})]})}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-6 mb-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Theme"}),e.jsx("input",{type:"text",value:r,onChange:b=>t(b.target.value),placeholder:"e.g., animals, space, ocean",className:"w-full px-4 py-2 border border-gray-300 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:"Activity Types"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:c.map(b=>e.jsxs("button",{onClick:()=>f(b.value),className:`p-4 rounded-lg border-2 transition text-left ${n.includes(b.value)?"border-yellow-500 bg-yellow-50":"border-gray-200 hover:border-yellow-300"}`,children:[e.jsx("div",{className:"font-medium text-gray-900",children:b.label}),e.jsx("div",{className:"text-sm text-gray-600",children:b.description})]},b.value))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Age Group"}),e.jsxs("select",{value:s,onChange:b=>a(b.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg",children:[e.jsx("option",{value:"4-7",children:"4-7 years"}),e.jsx("option",{value:"8-12",children:"8-12 years"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Pages"}),e.jsx("input",{type:"number",value:l,onChange:b=>i(parseInt(b.target.value)),min:8,max:24,className:"w-full px-4 py-2 border border-gray-300 rounded-lg"})]})]}),e.jsx("button",{onClick:h,disabled:x,className:"w-full bg-gradient-to-r from-yellow-500 to-orange-500 text-white px-6 py-3 rounded-lg font-semibold hover:shadow-lg transition disabled:opacity-50 flex items-center justify-center gap-3",children:x?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Generating Activities..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-5 h-5"}),e.jsx("span",{children:"Generate Activity Book"})]})})]})}),j&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:j.title}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:(u=j.pages)==null?void 0:u.map(b=>{var k;return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"font-medium text-gray-900 mb-2",children:["Page ",b.page_number,": ",b.type]}),b.type==="word_search"&&e.jsxs("div",{className:"text-sm text-gray-600",children:["Find: ",(k=b.words_to_find)==null?void 0:k.join(", ")]}),b.type==="maze"&&e.jsxs("div",{className:"text-sm text-gray-600",children:["Difficulty: ",b.difficulty]}),b.type==="coloring"&&e.jsxs("div",{className:"text-sm text-gray-600",children:["Theme: ",b.theme]})]},b.page_number)})})]})]})})},F=(r,t)=>{const s=(r==null?void 0:r.data)??{};return typeof(r==null?void 0:r.data)=="string"?r.data:typeof s.message=="string"?s.message:typeof s.error=="string"?s.error:t};class as{async generateSetupIdeas(t){const s=await S("/api/v1/chapter-book/setup/ideas",t);if(s.code!==200)throw new Error(F(s,"Unable to generate setup ideas"));return s.data}async generateStoryBlueprint(t){const s=await S("/api/v1/chapter-book/story-architecture",t);if(s.code!==200)throw new Error(F(s,"Unable to generate story blueprint"));return s.data}async regenerateChapterSection(t,s){const a=await ne(`/api/v1/chapter-book/chapter
23s/${t}/sections`,s);if(a.code!==200)throw new Error(F(a,"Unable to regenerate chapter section"));return a.data}async generateChapterScenes(t,s){const a=await S(`/api/v1/chapter-book/chapters/${t}/scenes`,s);if(a.code!==200)throw new Error(F(a,"Unable to generate scene ideas"));return a.data}async requestSceneDraft(t,s,a){const l=await S(`/api/v1/chapter-book/chapters/${t}/scenes/${s}/draft`,a);if(l.code!==200)throw new Error(F(l,"Unable to generate scene draft"));return l.data}async analyzeContinuity(t){const s=await S("/api/v1/chapter-book/continuity/analyze",t);if(s.code!==200)throw new Error(F(s,"Unable to analyze continuity"));return s.data}async analyzeStyle(t){const s=await S("/api/v1/chapter-book/style/analyze",t);if(s.code!==200)throw new Error(F(s,"Unable to analyze style"));return s.data}async runEditingAction(t,s){const a=await S(`/api/v1/chapter-book/chapters/${t}/edit`,s);if(a.code!==200)throw new Error(F(a,"Unable to run editing action"));return a.data}async exportManuscript(t){const s=await S("/api/v1/chapter-book/export",t);if(s.code!==200)throw new Error(F(s,"Unable to export manuscript"));return s.data}async fetchVersionHistory(t){const s=await H(`/api/v1/chapter-book/projects/${t}/history`);if(s.code!==200)throw new Error(F(s,"Unable to load version history"));return s.data}}const _=new as,rs=r=>({...r,scenes:[],prompts:[],draft:void 0,continuityNotes:[],isLocked:!1,completion:{outlineReady:!0,scenesGenerated:!1,draftComplete:!1}}),ls=(r,t)=>{const s=new Map(r.map(a=>[a.id,a]));return t.forEach(a=>{s.set(a.id,a)}),Array.from(s.values())},se=r=>r?Math.round(r/150*10)/10:0,ns=r=>{const t={};return r.forEach(s=>{s.subplotTags.forEach(a=>{const[l,i,n]=a.split("::");l==="character"&&i&&(t[i]||(t[i]={characterId:i,name:n??"Unknown",mentions:0,perspectiveChapters:0}),t[i].mentions+=1,s.goal.toLowerCase().includes((n==null?void 0:n.toLowerCase())??"")&&(t[i].perspectiveChapters+=1))})}),Object.values(t).sort((s,a)=>a.mentions-s.mentions)},L=(r,t=0)=>{const s=r.reduce((i,n)=>i+(n.wordCountTarget??0),0),a=r.filter(i=>i.completion.draftComplete).length,l=r.length?Math.round(s/r.length):0;return{totalWords:s,targetWords:t||s,totalChapters:r.length,completedChapters:a,readingMinutes:se(s),averageChapterLength:l,characterFocus:ns(r),subplotCoverage:[]}},is=(r,t)=>{const s=new Map(r.map(a=>[a.id,a]));return t.forEach(a=>{s.set(a.id,a)}),Array.from(s.values()).sort((a,l)=>l.generatedAt>a.generatedAt?1:-1)},me=Be({title:G().max(120).optional(),genre:G().required("Select a genre"),tone:G().required("Choose a tone"),targetAgeRange:G().oneOf(["6-7","7-8","8-9"]).required("Age range is required"),goalType:G().oneOf(["word-count","chapters"]).required(),goalValue:Y().min(8).max(3e4).required("Provide a goal"),chapterCount:Y().min(8).max(20).optional(),wordCountGoal:Y().min(8e3).max(4e4).optional(),theme:G().max(200).optional(),setting:G().max(200).optional(),inspiration:G().max(400).optional()}),os=async r=>me.validate(r,{abortEarly:!1}),cs={setup:{form:{title:"",genre:"",tone:"playful",targetAgeRange:"7-8",goalType:"chapters",goalValue:10,chapterCount:10,wordCountGoal:18e3,setting:"",inspiration:""},promptsHistory:[],aiSuggestions:{premises:[],summary:void 0,structures:[]}
23,selectedPremiseId:void 0,selectedStructureId:void 0},blueprint:{arcs:[],chapters:[],conflict:void 0,characters:[],subplots:[],generatedAt:void 0},chapters:{},continuity:{timeline:[],alerts:[],plotThreads:[],lastAnalyzedAt:void 0},editing:{styleReports:[],pending:{}},metrics:{totalWords:0,targetWords:0,totalChapters:0,completedChapters:0,readingMinutes:0,averageChapterLength:0,characterFocus:[],subplotCoverage:[]},activeChapterId:void 0,isLoading:!1,error:void 0},z=async(r,t)=>{r(s=>{s.isLoading=!0,s.error=void 0});try{const s=await t();return r(a=>{a.isLoading=!1}),s}catch(s){throw r(a=>{a.isLoading=!1,a.error=s.message||"Something went wrong"}),s}},y=Ie()(Ae((r,t)=>({...cs,setActiveChapter:s=>{r(a=>{a.activeChapterId=s})},updateSetupForm:s=>{r(a=>{a.setup.form={...a.setup.form,...s}})},requestSetupIdeas:async s=>{await os(s),await z(r,async()=>{const a=await _.generateSetupIdeas(s);r(l=>{var i,n;l.setup.form=s,l.setup.aiSuggestions={premises:a.premises,summary:a.workingSummary,structures:a.structures},l.setup.promptsHistory=[...l.setup.promptsHistory,...a.prompts],l.setup.selectedPremiseId=(i=a.premises[0])==null?void 0:i.id,l.setup.selectedStru
23ctureId=(n=a.structures[0])==null?void 0:n.id})})},selectPremise:s=>{r(a=>{a.setup.selectedPremiseId=s})},selectStructure:s=>{r(a=>{a.setup.selectedStructureId=s})},generateBlueprint:async({regenerate:s}={})=>{const{setup:a}=t();if(!a.selectedPremiseId||!a.selectedStructureId)throw new Error("Select a premise and structure before generating the blueprint");const l={premiseId:a.selectedPremiseId,structureId:a.selectedStructureId,goalType:a.form.goalType,goalValue:a.form.goalType==="word-count"?a.form.wordCountGoal??a.form.goalValue:a.form.goalValue,targetAgeRange:a.form.targetAgeRange};await z(r,async()=>{const i=await _.generateStoryBlueprint(l);r(n=>{var x;n.blueprint={arcs:i.arcs,chapters:i.chapters,conflict:i.conflict,characters:i.characters,subplots:i.subplots,generatedAt:new Date().toISOString()};const o={};i.chapters.forEach(g=>{const j=rs(g);o[j.id]=j}),n.chapters=s?{...n.chapters,...o}:o,n.activeChapterId=(x=i.chapters[0])==null?void 0:x.id,n.continuity.plotThreads=i.plotThreads,n.metrics=L(Object.values(n.chapters),a.form.wordCountGoal??0)})})},updateChapterDetail:(s,a)=>{r(l=>{const i=l.chapters[s];i&&(l.chapters[s]={...i,...a,completion:{...i.completion,...a.completion}},l.metrics=L(Object.values(l.chapters),l.setup.form.wordCountGoal??0))})},regenerateChapterSection:async(s,a)=>{await z(r,async()=>{const l=await _.regenerateChapterSection(s,a);r(i=>{const n=l.chapter;i.chapters[s]={...i.chapters[s],...n},i.metrics=L(Object.values(i.chapters),i.setup.form.wordCountGoal??0)})})},generateChapterScenes:async(s,a)=>{await z(r,async()=>{const l=await _.generateChapterScenes(s,{context:a});r(i=>{const n=i.chapters[s];n&&(n.scenes=ls(n.scenes,l.scenes),n.completion.scenesGenerated=!0)})})},requestSceneDraft:async(s,a,l,i)=>{const n=te();r(o=>{o.editing.pending[n]={id:n,type:"scene-draft",status:"pending",prompt:i??"",model:"gpt-4.1-mini",temperature:.7,createdAt:new Date().toISOString(),metadata:{chapterId:s,sceneId:a,mode:l}}});try{const o=await _.requestSceneDraft(s,a,{mode:l,notes:i});r(x=>{const g=x.chapters[s];g&&(g.draft=o.draft,g.completion.draftComplete=!0,x.metrics=L(Object.values(x.chapters),x.setup.form.wordCountGoal??0),x.editing.pending[n]={...x.editing.pending[n],status:"success",completedAt:new Date().toISOString()})})}catch(o){throw r(x=>{x.editing.pending[n]={...x.editing.pending[n],status:"error",errorMessage:o.message,completedAt:new Date().toISOString()}}),o}},analyzeContinuity:async()=>{const s=Object.keys(t().chapters);s.length&&await z(r,async()=>{const a=await _.analyzeContinuity({chapterIds:s});r(l=>{l.continuity.timeline=a.timeline,l.continuity.alerts=a.alerts,l.continuity.plotThreads=a.plotThreads,l.continuity.lastAnalyzedAt=new Date().toISOString()})})},analyzeStyle:async s=>{await z(r,async()=>{const a=await _.analyzeStyle({chapterId:s});r(l=>{l.editing.styleReports=is(l.editing.styleReports,a.reports)})})},runEditingAction:async(s,a,l)=>{const i=te();r(n=>{n.editing.pending[i]={id:i,type:"editing",status:"pending",prompt:l??"",model:"gpt-4.1-mini",temperature:.6,createdAt:new Date().toISOString(),metadata:{chapterId:s,mode:a}}});try{const n=await _.runEditingAction(s,{mode:a,instruction:l});r(o=>{o.chapters[s]={...o.chapters[s],...n.chapter},o.metrics=L(Object.values(o.chapters),o.setup.form.wordCountGoal??0),o.editing.pending[i]={...o.editing.pending[i],status:"success",completedAt:new Date().toISOString()}})}catch(n){throw r(o=>{o.editing.pending[i]={...o.editing.pending[i],status:"error",errorMessage:n.message,completedAt:new Date().toISOString()}}),n}},recomputeMetrics:()=>{const{chapters:s,setup:a}=t();r(l=>{l.metrics=L(Object.values(s),a.form.wordCountGoal??0)})},resetError:()=>{r(s=>{s.error=void 0})}}))),ds=()=>{const r=y(t=>t.metrics);return e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Progress Overview"}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm text-slate-600",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Word count"}),e.jsx("p",{className:"text-xl font-semibold text-slate-900",children:r.totalWords.toLocaleStr
23ing()}),e.jsxs("p",{className:"text-xs text-slate-500",children:["Target ",r.targetWords.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Chapters complete"}),e.jsxs("p",{className:"text-xl font-semibold text-slate-900",children:[r.completedChapters,"/",r.totalChapters]}),e.jsxs("p",{className:"text-xs text-slate-500",children:["Avg length ",r.averageChapterLength," words"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Reading time"}),e.jsxs("p",{className:"text-xl font-semibold text-slate-900",children:[se(r.totalWords)," mins"]}),e.jsx("p",{className:"text-xs text-slate-500",children:"150 words per minute estimate"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:"Subplot coverage"}),r.subplotCoverage.length?e.jsx("ul",{className:"mt-1 space-y-1",children:r.subplotCoverage.map(t=>e.jsxs("li",{className:"text-xs text-slate-500",children:[t.title,": ",t.coverage," chapters (",t.status,")"]},t.subplotId))}):e.jsx("p",{className:"text-xs text-slate-500",children:"Tag chapters with subplots to track coverage."})]})]})]})},ms=()=>{const r=y(t=>t.metrics.characterFocus);return e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Character Spotlight"}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm text-slate-600",children:r.length?r.map(t=>e.jsxs("li",{className:"flex items-center justify-between",children:[e.jsx("span",{children:t.name}),e.jsxs("span",{className:"text-xs text-slate-400",children:[t.mentions," mentions · ",t.perspectiveChapters," POV chapters"]})]},t.characterId)):e.jsx("li",{className:"text-xs text-slate-500",children:"Assign subplot tags to track character visibility."})})]})},xs=()=>{const t=y(s=>s.editing.styleReports)[0];return e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Reading Level Meter"}),t?e.jsxs("div",{className:"mt-4",children:[e.jsxs("p",{className:"text-2xl font-semibold text-slate-900",children:["Grade ",t.gradeLevel.toFixed(1)]}),e.jsx("p",{className:"text-sm text-slate-500",children:"Target Grade 2â3"}),e.jsx("div",{className:"mt-3 h-2 w-full rounded-full bg-slate-100",children:e.jsx("div",{className:"h-2 rounded-full bg-gradient-to-r from-green-400 to-orange-500",style:{width:`${Math.min(100,t.gradeLevel/5*100)}%`}})}),e.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Lower than 2.0 may read too simply; above 3.5 may skew older."})]}):e.jsx("p",{className:"mt-2 text-sm text-slate-500",children:"Run style analysis to populate reading level."})]})};function hs(...r){return r.filter(Boolean).join(" ")}const I=({title:r,subtitle:t,action:s,className:a})=>e.jsxs("div",{className:hs("flex flex-col md:flex-row md:items-center md:justify-between gap-2 mb-4",a),children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:r}),t&&e.jsx("p",{className:"text-sm text-slate-500",children:t})]}),s&&e.jsx("div",{className:"flex-shrink-0",children:s})]}),gs=()=>{const r=y(s=>s.blueprint.arcs),t=y(s=>s.blueprint.conflict);return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Story Blueprint",subtitle:"Beginning, middle, and end arcs with stakes"}),t&&e.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4 text-sm text-slate-700",children:[e.jsxs("div",{className:"rounded-lg border border-orange-100 bg-orange-50 p-4",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-orange-500",children:"Central Conflict"}),e.jsx("p",{className:"mt-1 font-medium text-orange-700",children:t.centralConflict})]}),e.jsxs("div",{className:"rounded-lg border border-orange-100 bg-orange-50 p-4",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-orange-500",children:"Stakes"}),e.jsx("p",{className:"mt-1 font-medium text-orange-700",children:t.stakes})]}),e.jsxs("div",{className:"rounded-lg border border-orange-100 bg-orange-50 p-4",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-orange-500",children:"Resolution Approach"}),e.jsx("p",{className:"mt-1 font-medium text-orange-700",children:t.resolutionApproach})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:r.map(s=>e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs uppercase tracking-wide text-slate-400",children:s.act}),e.jsxs("span",{className:"text-xs text-slate-400",children:["Stakes: ",s.stakes]})]}),e.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:s.title}),e.jsx("p",{className:"mt-1 text-sm text-slate-600",children:s.focus}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm text-slate-600",children:s.beats.map(a=>e.jsxs("li",{className:"rounded-md bg-slate-50 p-2",children:[e.jsx("p",{className:"font-medium text-slate-800",children:a.title}),e.jsx("p",{className:"text-xs text-slate-500",children:a.summary})]},a.id))})]},s.id))})]})},us=({chapter:r,isActive:t,onSelect:s})=>e.jsxs("button",{type:"button",onClick:s,className:`w-full text-left border rounded-lg p-4 transition-colors ${t?"border-orange-500 bg-orange-50 shadow-sm":"border-slate-200 bg-white hover:border-orange-300"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xs font-medium uppercase tracking-wide text-slate-500",children:["Chapter ",r.order]}),e.jsxs("span",{className:"text-xs text-slate-400",children:[r.wordCountTarget," words"]})]}),e.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-1",children:r.title}),e.jsx("p",{className:"text-sm text-slate-600 line-clamp-3",children:r.summary})]}),ps=()=>{const r=y(a=>a.blueprint.chapters),t=y(a=>a.activeChapterId),s=y(a=>
23a.setActiveChapter);return r.length?e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Chapter Outline",subtitle:"8â12 proposed chapters with goals, conflicts, and resolutions"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:r.slice().sort((a,l)=>a.order-l.order).map(a=>e.jsx(us,{chapter:a,isActive:t===a.id,onSelect:()=>s(a.id)},a.id))})]}):null},bs=({character:r})=>e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:r.name}),e.jsx("p",{className:"text-xs uppercase tracking-wide text-orange-500",children:r.role})]}),e.jsxs("span",{className:"text-xs text-slate-400",children:["Age ",r.age]})]}),e.jsx("p",{className:"mt-3 text-sm text-slate-600",children:r.personalityTraits.join(", ")}),e.jsxs("div",{className:"mt-3 space-y-1 text-sm text-slate-600",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Motivation:"})," ",r.motivations]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Flaw:"})," ",r.flaws]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Growth:"})," ",r.growthPlan]})]}),e.jsxs("p",{className:"mt-3 text-xs text-slate-500",children:["Appears in chapters: ",r.chaptersInvolved.join(", ")]})]}),js=({character:r})=>{const t=[...r.chaptersInvolved].sort((s,a)=>s-a);return e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Growth Timeline"}),e.jsx("div",{className:"mt-3 space-y-3",children:t.map(s=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 h-2 w-2 rounded-full bg-orange-500"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-medium uppercase tracking-wide text-slate-500",children:["Chapter ",s]}),e.jsxs("p",{className:"text-sm text-slate-600",children:[r.growthPlan," â focus on relationship dynamics and motivation check-in."]})]})]},s))})]})},ys=({character:r})=>r.relationships.length?e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Relationship Map"}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm text-slate-600",children:r.relationships.map(t=>e.jsxs("li",{className:"rounded-md border border-slate-100 p-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-slate-700",children:t.characterId}),e.jsx("span",{className:"text-xs uppercase tracking-wide text-orange-500",children:t.intensity})]}),e.jsx("p",{className:"text-xs text-slate-500",children:t.description})]},t.characterId))})]}):null,$=()=>{const r=y(N=>N.isLoading),t=y(N=>N.error),s=y(N=>N.resetError),a=y(N=>N.requestSetupIdeas),l=y(N=>N.generateBlueprint),i=y(N=>N.generateChapterScenes),n=y(N=>N.regenerateChapterSection),o=y(N=>N.requestSceneDraft),x=y(N=>N.analyzeContinuity),g=y(N=>N.analyzeStyle),j=y(N=>N.runEditingAction),d=m.useCallback(async(N,C)=>{try{const B=await N();return C&&w.success(C),B}catch(B){throw console.error(B),w.error(B.message||"AI request failed"),B}},[]),c=m.useCallback(async N=>(s(),d(()=>a(N),"Generated chapter book ideas")),[a,s,d]),f=m.useCallback(async N=>(s(),d(()=>l(N),N!=null&&N.regenerate?"Blueprint updated":"Blueprint ready")),[l,s,d]),h=m.useCallback(async(N,C)=>(s(),d(()=>i(N,C),"Scene ideas refreshed")),[i,s,d]),u=m.useCallback(async(N,C)=>(s(),d(()=>n(N,C),"Chapter section updated")),[n,s,d]),b=m.useCallback(async(N,C,B,p)=>(s(),d(()=>o(N,C,B,p),"Draft generated")),[o,s,d]),k=m.useCallback(async()=>(s(),d(()=>x(),"Continuity check complete")),[x,s,d]),A=m.useCallback(async N=>(s(),d(()=>g(N),"Style analysis complete")),[g,s,d]),v=m.useCallback(async(N,C,B)=>(s(),d(()=>j(N,C,B),"Editing pass applied")),[j,s,d]);return{isLoading:r,error:t,requestSetupIdeas:c,generateBlueprint:f,regenerateChapterSection:u,generateChapterScenes:h,requestSceneDraft:b,analyzeContinuity:k,analyzeStyle:A,runEditingAction:v}},fs=()=>{const r=y(n=>n.activeChapterId),t=y(n=>r?n.chapters[r]:void 0),s=y(n=>n.updateChapterDetail),{regenerateChapterSection:a}=$();if(!t)return e.jsx("div",{className:"rounded-lg border border-dashed border-slate-200 p-6 text-center text-sm text-slate-500",children:"Select a chapter from the outline to plan details."});const l=n=>o=>{s(t.id,{[n]:o.target.value})},i=async n=>{await a(t.id,{focus:n})};return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:`Chapter ${t.order}: ${t.title}`,subtitle:"Refine chapter goals, conflict, resolution, and cliffhanger"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Chapter Summary"}),e.jsx("textarea",{className:"mt-1 h-32 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",value:t.summary,onChange:l("summary")}
23),e.jsx("button",{type:"button",className:"mt-2 text-xs font-semibold text-orange-600 hover:text-orange-700",onClick:()=>i("summary"),children:"Regenerate summary with AI"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Goal"}),e.jsx("textarea",{className:"mt-1 h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",value:t.goal,onChange:l("goal")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Conflict"}),e.jsx("textarea",{className:"mt-1 h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",value:t.conflict,onChange:l("conflict")}),e.jsx("button",{type:"button",className:"mt-2 text-xs font-semibold text-orange-600 hover:text-orange-700",onClick:()=>i("conflict"),children:"Strengthen conflict with AI"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Resolution & Cliffhanger"}),e.jsx("textarea",{className:"mt-1 h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",value:t.resolution,onChange:l("resolution")}),e.jsx("textarea",{className:"mt-2 h-20 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",value:t.cliffhanger,onChange:l("cliffhanger")}),e.jsxs("div",{className:"mt-2 flex gap-2 text-xs",children:[e.jsx("button",{type:"button",className:"font-semibold text-orange-600 hover:text-orange-700",onClick:()=>i("resolution"),children:"Improve resolution"}),e.jsx("button",{type:"button",className:"font-semibold text-orange-600 hover:text-orange-700",onClick:()=>i("cliffhanger"),children:"Sharpen cliffhanger"})]})]})]})]}),e.jsxs("div",{className:"mt-6 rounded-lg border border-slate-100 bg-slate-50 p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Continuity Notes"}),t.continuityNotes.length?e.jsx("ul",{className:"mt-3 space-y-2 text-sm text-slate-600",children:t.continuityNotes.map(n=>e.jsxs("li",{className:"rounded-md bg-white p-2 shadow-sm",children:[e.jsxs("span",{className:"font-medium text-slate-700",children:[n.type,":"]})," ",n.note]},n.id))}):e.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"AI will surface continuity notes after running the continuity assistant."})]})]})},Ns=()=>{const r=y(d=>d.activeChapterId),t=y(d=>r?d.chapters[r]:void 0),{regenerateChapterSection:s,generateChapterScenes:a}=$(),[l,i]=m.useState("summary"),[n,o]=m.useState(""),[x,g]=m.useState("");if(!t)return null;const j=async d=>{d.preventDefault(),n.trim()&&(await s(t.id,{focus:l,instruction:n}),o(""))};return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"AI Collaboration",subtitle:"Give targeted instructions to adjust the chapter"}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Focus area"}),["summary","conflict","resolution","cliffhanger"].map(d=>e.jsx("button",{type:"button",onClick:()=>i(d),className:`rounded-full border px-3 py-1 text-xs font-semibold capitalize transition ${l===d?"border-orange-500 bg-orange-100 text-orange-700":"border-slate-200 text-slate-600"}`,children:d},d))]}),e.jsx("textarea",{value:n,onChange:d=>o(d.target.value),placeholder:"E.g., add a friendship subplot in this chapter",className:"h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",className:"rounded-md bg-orange-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-orange-400 focus:ring-offset-2",children:"Apply Instruction"})})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Scene context for AI"}),e.jsx("textarea",{value:x,onChange:d=>g(d.target.value),placeholder:"Share beats or emotional tone to influence scene ideas",className:"mt-2 h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsx("button",{type:"button",onClick:()=>a(t.id,x),className:"rounded-md border border-orange-200 bg-orange-50 px-4 py-2 text-sm font-semibold text-orange-700 hover:bg-orange-100",children:"Generate Scene Ideas"})})]})]})},vs=()=>{const r=y(a=>a.activeChapterId),t=y(a=>r?a.chapters[r]:void 0);if(!t)return null;const s=t.subplotTags.filter(a=>a.startsWith("subplot::"));return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Cliffhanger Ideas",subtitle:"Keep readers turning the page"}),e.jsx("ul",{className:"space-y-2 text-sm text-slate-600",children:s.length?s.map(a=>{const[,l,i]=a.split("::"),n=i||"Subplot twist";return e.jsxs("li",{className:"rounded-md border border-slate-100 bg-slate-50 p-3",children:[e.jsx("p",{className:"font-medium text-slate-800",children:n}),e.jsxs("p",{className:"text-xs text-slate-500",children:['Hint at subplot "',n,'" reaching a twist in the next chapter.']})]},l)}):e.jsx("li",{className:"rounded-md border border-dashed border-slate-200 p-3 text-xs text-slate-500",children:"Add subplot tags to unlock tailored cliffhanger prompts."})})]})},ws={info:"border-slate-200 bg-slate-50 text-slate-600",warning:"border-yellow-200 bg-yellow-50 text-yellow-700",critical:"border-red-200 bg-red-50 text-red-700"},ks=()=>{const r=y(a=>a.continuity.alerts),t=y(a=>a.continuity.lastAnalyzedAt),{analyzeContinuity:s}=$();return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Continuity Assistant",subt
23itle:t?`Last checked ${new Date(t).toLocaleString()}`:"Run assistant to surface timeline issues",action:e.jsx("button",{type:"button",onClick:()=>s(),className:"rounded-md bg-orange-600 px-3 py-1 text-xs font-semibold text-white hover:bg-orange-700",children:"Run Continuity Check"})}),e.jsx("div",{className:"space-y-3",children:r.length?r.map(a=>e.jsxs("div",{className:`rounded-lg border p-3 text-sm ${ws[a.severity]}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-medium",children:a.message}),a.chapterId&&e.jsxs("span",{className:"text-xs uppercase tracking-wide",children:["Chapter ",a.chapterId]})]}),e.jsxs("p",{className:"mt-1 text-xs",children:["Suggested fix: ",a.suggestion]})]},a.id)):e.jsx("p",{className:"text-sm text-slate-500",children:"No continuity issues detected yet."})})]})},xe=()=>{const r=y(n=>n.continuity.timeline),t=y(n=>n.continuity.alerts),s=y(n=>n.continuity.plotThreads),a=m.useMemo(()=>{const n=r.reduce((o,x)=>{const g=x.day||"Unscheduled";return o[g]||(o[g]=[]),o[g].push(x),o},{});return Object.entries(n).map(([o,x])=>({day:o,beats:x.sort((g,j)=>g.timeOfDay.localeCompare(j.timeOfDay))}))},[r]),l=m.useMemo(()=>t.filter(n=>n.severity!=="info"),[t]),i=m.useMemo(()=>s.map(n=>({id:n.id,name:n.name,coverage:n.chapters.length,peak:n.peakChapter,status:n.resolutionChapter?"resolved":"active"})),[s]);return{groupedTimeline:a,criticalAlerts:l,subplotHeatmap:i}},Cs=()=>{const r=y(s=>s.continuity.plotThreads),{subplotHeatmap:t}=xe();return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Plot & Subplot Tracker",subtitle:"Monitor emotional arcs and recurring beats"}),r.length?e.jsxs("div",{className:"space-y-3",children:[r.map(s=>e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-slate-800",children:s.name}),e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:s.type})]}),e.jsxs("span",{className:"text-xs text-slate-500",children:["Chapters: ",s.chapters.join(", ")]})]}),e.jsx("p",{className:"mt-2 text-sm text-slate-600",children:s.description})]},s.id)),e.jsx("div",{className:"rounded-lg border border-dashed border-orange-200 p-4 text-xs text-orange-700",children:t.length?e.jsx("ul",{className:"space-y-1",children:t.map(s=>e.jsxs("li",{children:[s.name,": ",s.coverage," chapter touchpoints · status ",s.status]},s.id))}):e.jsx("p",{children:"Link chapters to subplots to view coverage insights."})})]}):e.jsx("p",{className:"text-sm text-slate-500",children:"Generate blueprint to visualize plot threads."})]})},Ss=({beat:r})=>e.jsxs("div",{className:"rounded-full border border-slate-200 bg-white px-4 py-2 text-xs shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-orange-600",children:r.chapterTitle}),e.jsx("span",{className:"text-slate-500",children:r.timeOfDay}),e.jsx("span",{className:"text-slate-400",children:r.location})]}),e.jsx("p",{className:"mt-1 text-slate-600",children:r.summary})]}),As=()=>{const r=y(l=>l.activeChapterId),t=y(l=>r?l.chapters[r]:void 0),{generateChapterScenes:s,requestSceneDraft:a}=$();return t?e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Scene Ideas",subtitle:"Goal, conflict, turning point, and emotional beat",action:e.jsx("button",{type:"button",onClick:()=>s(t.id),className:"rounded-md border border-orange-200 bg-orange-50 px-3 py-1 text-xs font-semibold text-orange-700 hover:bg-orange-100",children:"Regenerate scenes"})}),t.scenes.length?e.jsx("div",{className:"space-y-3",children:t.scenes.map(l=>e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-semibold text-slate-800",children:l.title}),e.jsxs("div",{className:"flex gap-2 text-xs text-slate-500",children:[e.jsxs("span",{children:["Goal: ",l.goal]}),e.jsxs("span",{children:["Conflict: ",l.conflict]})]})]}),e.jsxs("p",{className:"mt-2 text-sm text-slate-600",children:["Turning point: ",l.turningPoint]}),e.jsxs("p",{className:"mt-1 text-xs text-slate-500",children:["Tone: ",l.emotionalTone," · Ending beat: ",l.endingBeat]}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md bg-orange-600 px-3 py-1 text-xs font-semibold text-white hover:bg-orange-700",onClick:()=>
23a(t.id,l.id,"full-prose"),children:"Expand to Draft"}),e.jsx("button",{type:"button",className:"rounded-md border border-slate-200 px-3 py-1 text-xs font-semibold text-slate-600 hover:border-orange-300",onClick:()=>a(t.id,l.id,"dialogue-sketch"),children:"Dialogue Sketch"})]})]},l.id))}):e.jsx("p",{className:"text-sm text-slate-500",children:"Generate scene ideas to break the chapter into actionable beats."})]}):null},Bs=()=>{const r=y(i=>i.activeChapterId),t=y(i=>r?i.chapters[r]:void 0),{requestSceneDraft:s}=$(),[a,l]=m.useState("");return t?e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Draft Workspace",subtitle:"Expand scene cards into prose or dialogue"}),t.draft?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-4 text-sm text-slate-700 whitespace-pre-wrap",children:t.draft.content}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-slate-500",children:[e.jsxs("span",{children:["Mode: ",t.draft.mode==="full-prose"?"Full prose":"Dialogue sketch"]}),e.jsxs("span",{children:["Estimated words: ",t.draft.estimatedWords]}),e.jsxs("span",{children:["Reading time: ",t.draft.readingMinutes," mins"]})]})]}):e.jsx("p",{className:"text-sm text-slate-500",children:"Generate a draft from the scene list to begin prose exploration."}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsx("textarea",{value:a,onChange:i=>l(i.target.value),placeholder:"Add notes or tone guidance for the draft",className:"h-24 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.scenes.map(i=>e.jsxs("button",{type:"button",onClick:()=>s(t.id,i.id,"full-prose",a),className:"rounded-md bg-orange-600 px-3 py-1 text-xs font-semibold text-white hover:bg-orange-700",children:["Draft ",i.title]},i.id))})]})]}):null},Ts=[{mode:"tone",label:"Tone polish",description:"Adjust to friendlier, funnier, or suspenseful tone"},{mode:"condense",label:"Condense",description:"Summarize or tighten the section"},{mode:"expand",label:"Expand",description:"Add detail and sensory description"},{mode:"consistency",label:"Consistency",description:"Check characters, places, and objects"},{mode:"alternate-ending",label:"Alt ending",description:"Generate alternate chapter endings"},{mode:"bridge-scene",label:"Bridge scene",description:"Create transitions between chapters"}],Is=()=>{const r=y(i=>i.activeChapterId),[t,s]=m.useState(""),{runEditingAction:a}=$();if(!r)return null;const l=async i=>{await a(r,i,t),s("")};return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"AI Editing Toolkit"}),e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Choose an editing mode and optionally provide instructions to guide the AI revision."}),e.jsx("textarea",{value:t,onChange:i=>s(i.target.value),placeholder:"Optional: e.g., make Anjali braver by Chapter 6",className:"mt-3 h-20 w-full rounded-md border border-slate-200 px-3 py-2 text-sm shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"}),e.jsx("div",{className:"mt-4 grid grid-cols-2 md:grid-cols-3 gap-3",children:Ts.map(i=>e.jsxs("button",{type:"button",onClick:()=>l(i.mode),className:"rounded-lg border border-slate-200 bg-slate-50 p-3 text-left text-sm font-semibold text-slate-700 hover:border-orange-300",children:[e.jsx("p",{children:i.label}),e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:i.description})]},i.mode))})]})},Ps=()=>{const r=y(a=>a.editing.styleReports),t=y(a=>a.analyzeStyle),s=y(a=>a.activeChapterId);return e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Reading-Level Guidance",subtitle:"Ensure Grade 2â3 readability and age-appropriate tone",action:e.jsx("button",{type:"button",onClick:()=>t(s),className:"rounded-md bg-orange-600 px-3 py-1 text-xs font-semibold text-white hover:bg-orange-700",children:"Analyze Current Chapter"})}),e.jsx("div",{className:"space-y-3",children:r.length?r.map(a=>e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4 text-sm text-slate-700",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-semibold text-slate-800",children:["Grade level: ",a.gradeLevel.toFixed(1)," · Score: ",a.readabilityScore.toFixed(1)]}),a.chapterId&&e.jsxs("span",{className:"text-xs text-slate-400",children:["Chapter ",a.chapterId]})]}),e.jsx("p",{className:"mt-2 text-sm text-slate-600",children:a.summary}),e.jsx("ul",{className:"mt-3 space-y-1 text-xs text-slate-500",children:a.flaggedItems.map(l
23=>e.jsxs("li",{children:[e.jsxs("span",{className:"font-medium text-slate-600",children:[l.category,":"]})," ",l.message," â ",l.suggestion]},l.id))})]},a.id)):e.jsx("p",{className:"text-sm text-slate-500",children:"Run the reading-level analysis to receive feedback."})})]})},Es=["Adventure","Fantasy","Mystery","Friendship","School","Science Fiction"],Fs=["Playful","Heartfelt","Suspenseful","Humorous","Inspirational"],_s=({onSubmit:r,isLoading:t})=>{const s=y(c=>c.setup.form),a=y(c=>c.updateSetupForm),{register:l,handleSubmit:i,watch:n,formState:{errors:o}}=Pe({defaultValues:s,resolver:Te(me)});m.useEffect(()=>{const c=n(f=>{a(f)});return()=>c.unsubscribe()},[n,a]);const x=n("goalValue"),g=n("goalType"),j=n("wordCountGoal"),d=g==="word-count"?x:j??0;return m.useEffect(()=>{g==="word-count"&&j&&a({goalValue:j??0})},[g,j,a]),e.jsxs("form",{onSubmit:i(r),className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Working Title"}),e.jsx("input",{type:"text",...l("title"),placeholder:"Optional title",className:"mt-1 w-full rounded-md border border-slate-200 px-3 py-2 shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"}),o.title&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:o.title.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Genre / Theme"}),e.jsxs("select",{...l("genre"),className:"mt-1 w-full rounded-md border border-slate-200 px-3 py-2 shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200",children:[e.jsx("option",{value:"",children:"Select a genre"}),Es.map(c=>e.jsx("option",{value:c.toLowerCase(),children:c},c))]}),o.genre&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:o.genre.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Tone"}),e.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:Fs.map(c=>{const f=c.toLowerCase();return e.jsxs("label",{className:"flex items-center justify-between rounded-md border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:border-orange-300",children:[e.jsx("span",{children:c}),e.jsx("input",{type:"radio",value:f,...l("tone"),className:"text-orange-500 focus:ring-orange-400"})]},c)})}),o.tone&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:o.tone.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Target Age Range"}),e.jsx("div",{className:"mt-2 flex gap-2",children:["6-7","7-8","8-9"].map(c=>e.jsxs("label",{className:"flex-1 cursor-pointer rounded-md border border-slate-200 px-3 py-2 text-center text-sm font-medium text-slate-600 hover:border-orange-300",children:[e.jsx("input",{type:"radio",value:c,...l("targetAgeRange"),className:"sr-only"}),c," years"]},c))}),o.targetAgeRange&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:o.targetAgeRange.message})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Goal Type"}),e.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"flex flex-col rounded-lg border border-slate-200 p-3 hover:border-orange-300",children:[e.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Chapter Count"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Ideal for episodic adventures"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"radio",value:"chapters",...l("goalType"),className:"text-orange-500 focus:ring-orange-400"}),e.jsx("input",{type:"number",min:8,max:20,...l("goalValue",{valueAsNumber:!0}),className:"w-24 rounded border border-slate-200 px-2 py-1 text-sm"})]})]}),e.jsxs("label",{className:"flex flex-col rounded-lg border border-slate-200 p-3 hover:border-orange-300",children:[e.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Word Count"}),e.jsx("span",{className:"text-xs text-slate-500",children:"Match publisher expectations"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"radio",value:"word-count",...l("goalType"),className:"text-orange-500 focus:ring-orange-400"}),e.jsx("input",{type:"number",min:1e4,max:3e4,...l("wordCountGoal",{valueAsNumber:!0}),className:"w-28 rounded border border-slate-200 px-2 py-1 text-sm"})]})]})]}),o.goalValue&&e.jsx("p",{className:"mt-1 text-sm text-red-500",children:o.goalValue.message})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Primary Setting"}),e.jsx("input",{type:"text",...l("setting"),placeholder:"E.g., coastal town, space academy",className:"mt-1 w-full rounded-md border border-slate-200 px-3 py-2 shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"Inspirations & Themes"}),e.jsx("textarea",{rows:4,...l("inspiration"),placeholder:"Share comparable stories, themes, or teaching goals",className:"mt-1 w-full rounded-md border border-slate-200 px-3 py-2 shadow-sm focus:border-orange-400 focus:ring-2 focus:ring-orange-200"})]}),e.jsxs("div",{className:"rounded-lg border border-orange-100 bg-orange-50 p-4 text-sm text-orange-700",children:[e.jsx("p",{className:"font-medium",children:"AI planning insight"}),e.jsxs("p",{className:"mt-1 text-orange-600",children:["Estimated total words: ",e.jsx("strong",{children:d??0})," â approx."," ",e.jsxs("strong",{children:[se(d??0)," minutes"]})," reading time"]}),e.jsx("p",{className:"mt-1 text-xs text-orange-600",children:"AI will balance chapters, pacing, and subplots for middle-grade readers."})]}),e.jsx("button",{type:"submit",disabled:t,className:"inline-flex w-full items-center justify-center rounded-md bg-gradient-to-r from-orange-500 to-pink-500 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:from-orange-600 hover:to-pink-600 focus:outline-none focus:ring-2 focus:ring-orange-400 focus:ring-offset-2 disabled:opacity-50",children:t?"Generating...":"Generate AI Blueprint"})]})]})},Gs=({onGenerateBlueprint:r,isLoading:t})=>{const s=y(o=>o.setup.aiSuggestions),a=y(o=>o.selectPremise),l=y(o=>o.selectStructure),i=y(o=>o.setup.selectedPremiseId),n=y(o=>
23o.setup.selectedStructureId);return s.premises.length?e.jsxs("div",{className:"space-y-8",children:[e.jsxs("section",{children:[e.jsx(I,{title:"AI Premise Suggestions",subtitle:"Choose the concept that excites you most"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:s.premises.map(o=>{const x=o.id===i;return e.jsxs("button",{type:"button",onClick:()=>a(o.id),className:`flex flex-col rounded-xl border p-4 text-left shadow-sm transition ${x?"border-orange-500 bg-orange-50":"border-slate-200 bg-white hover:border-orange-300"}`,children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-orange-500",children:"Premise"}),e.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:o.title}),e.jsx("p",{className:"mt-2 text-sm text-slate-600 line-clamp-4",children:o.summary}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-slate-500",children:[e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1",children:o.genre}),e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1",children:o.tone}),e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1",children:o.structure})]})]},o.id)})})]}),e.jsxs("section",{children:[e.jsx(I,{title:"Suggested Story Structures",subtitle:"Match your pacing preference"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:s.structures.map(o=>{const x=o.id===n;return e.jsxs("button",{type:"button",onClick:()=>l(o.id),className:`flex h-full flex-col rounded-xl border p-4 text-left shadow-sm transition ${x?"border-orange-500 bg-orange-50":"border-slate-200 bg-white hover:border-orange-300"}`,children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-orange-500",children:"Structure"}),e.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:o.name}),e.jsx("p",{className:"mt-2 text-sm text-slate-600 line-clamp-5",children:o.description}),e.jsxs("div",{className:"mt-3 text-xs text-slate-500",children:["Recommended chapters: ",o.recommendedChapters]})]},o.id)})})]}),s.summary&&e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx(I,{title:"Working Summary",subtitle:"AI baseline to refine"}),e.jsx("p",{className:"text-sm leading-relaxed text-slate-600 whitespace-pre-wrap",children:s.summary})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:()=>r({regenerate:!1}),disabled:t,className:"inline-flex items-center rounded-md bg-orange-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-orange-700 focus:outline-none focus:ring-2 focus:ring-orange-400 focus:ring-offset-2 disabled:opacity-50",children:t?"Building Blueprint...":"Generate Story Blueprint"})})]}):e.jsx("div",{className:"rounded-lg border border-dashed border-slate-200 p-6 text-center text-sm text-slate-500",children:"Provide book details to receive AI-generated premises and structures."})},re=[{id:"setup",label:"Setup",description:"Idea intake and AI premise suggestions",icon:e.jsx(Re,{className:"h-4 w-4"}),to:"setup"},{id:"blueprint",label:"Blueprint",description:"Story arcs, chapter outline, characters",icon:e.jsx(ze,{className:"h-4 w-4"}),to:"blueprint"},{id:"chapters",label:"Chapters",description:"Planner, prompts, scenes, drafts",icon:e.jsx(_e,{className:"h-4 w-4"}),to:"chapters"},{id:"continuity",label:"Continuity",description:"Timeline, plot threads, alerts",icon:e.jsx(Ee,{className:"h-4 w-4"}),to:"continuity"},{id:"style",label:"Style & Editing",description:"Reading level, tone, AI editing",icon:e.jsx(Me,{className:"h-4 w-4"}),to:"style"}],Rs=()=>{const{requestSetupIdeas:r,generateBlueprint:t}=$(),s=y(a=>a.isLoading);return e.jsxs("div",{className:"space-y-8",children:[e.jsx(_s,{onSubmit:r,isLoading:s}),e.jsx(Gs,{onGenerateBlueprint:t,isLoading:s})]})},$s=()=>{const r=y(t=>t.blueprint.characters);return e.jsxs("div",{className:"space-y-8",children:[e.jsx(gs,{}),e.jsx(ps,{}),r.length>0&&e.jsx("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:r.map(t=>e.jsxs("div",{className:"space-y-3",children:[e.jsx(bs,{character:t}),e.jsx(js,{character:t}),e.jsx(ys,{character:t})]},t.id))})]})},Ms=()=>e.jsxs("div",{className:"space-y-8",children:[e.jsx(fs,{}),e.jsx(Ns,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(As,{}),e.jsx(Bs,{})]}),e.jsx(vs,{})]}),Ls=()=>{const{groupedTimeline:r}=xe();return e.jsxs("div",{className:"space-y-8",children:[e.jsx(ks,{}),e.jsx(Cs,{}),e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Timeline"}),e.jsx("div",{className:"mt-4 space-y-4",children:r.map(t=>e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-400",children:t.day}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.beats.map(s=>e.jsx(Ss,{beat:s},s.id))})]},t.day))})]})]})},zs=()=>e.jsxs("div",{className:"space-y-8",children:[e.jsx(Ps,{}),e.jsx(Is,{})]}),qs=()=>{var t;const r=ke();return e.jsxs("div",{className:"space-y-6",children:[e.jsx("nav",{className:"flex flex-wrap gap-3",children:re.map(s=>e.jsxs(Ce,{to:s.to,className:({isActive:a})=>`flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition ${a?"border-orange-500 bg-orange-50 text-orange-700":"border-slate-200 text-slate-600 hover:border-orange-300"}`,children:[s.icon,e.jsx("span",{children:s.label})]},s.id))}),e.jsx("p",{className:"text-sm text-slate-500",children:((t=re.find(s=>
23r.pathname.endsWith(s.to)))==null?void 0:t.description)||"Navigate the studio workflow."}),e.jsxs(oe,{children:[e.jsx(T,{index:!0,element:e.jsx(Se,{to:"setup",replace:!0})}),e.jsx(T,{path:"setup",element:e.jsx(Rs,{})}),e.jsx(T,{path:"blueprint",element:e.jsx($s,{})}),e.jsx(T,{path:"chapters",element:e.jsx(Ms,{})}),e.jsx(T,{path:"continuity",element:e.jsx(Ls,{})}),e.jsx(T,{path:"style",element:e.jsx(zs,{})})]})]})},Ds=()=>{const r=y(n=>n.error),[t,s]=m.useState(!1),[a,l]=m.useState(!0),i=async n=>{try{s(!0);const o=await _.exportManuscript({format:n,includeNotes:a});w.success(`Export ready: ${o.format.toUpperCase()}`),window.open(o.downloadUrl,"_blank")}catch(o){w.error(o.message||"Export failed")}finally{s(!1)}};return e.jsx("div",{className:"min-h-screen bg-slate-50 p-6",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-6 lg:flex-row",children:[e.jsxs("div",{className:"flex-1 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Chapter Book Studio"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"AI-assisted workspace for crafting middle-grade chapter books (ages 6â9)."}),r&&e.jsx("div",{className:"mt-3 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:r})]}),e.jsx(qs,{})]}),e.jsxs("aside",{className:"w-full space-y-4 lg:w-80",children:[e.jsx(ds,{}),e.jsx(xs,{}),e.jsx(ms,{}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-800",children:"Export & Sharing"}),e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:"Download the manuscript with optional AI development notes."}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-slate-500",children:[e.jsx("input",{id:"include-notes",type:"checkbox",checked:a,onChange:n=>l(n.target.checked),className:"h-4 w-4 rounded border-slate-300 text-orange-600 focus:ring-orange-400"}),e.jsx("label",{htmlFor:"include-notes",children:"Include AI development notes appendix"})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[e.jsxs("button",{type:"button",disabled:t,onClick:()=>i("docx"),className:"inline-flex items-center justify-center gap-2 rounded-md bg-orange-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-orange-700 disabled:opacity-50",children:[e.jsx(ae,{className:"h-4 w-4"})," DOCX Export"]}),e.jsxs("button",{type:"button",disabled:t,onClick:()=>i("pdf"),className:"inline-flex items-center justify-center gap-2 rounded-md border border-slate-200 px-4 py-2 text-sm font-semibold text-slate-700 hover:border-orange-300 disabled:opacity-50",children:[e.jsx(ae,{className:"h-4 w-4"})," PDF Export"]})]})]})]})]})})},Vs=()=>{const r=ee(),t=[{type:"ebook",title:"eBook / Lead Magnet",description:"Comprehensive guides and educational content (10-50 pages)",icon:e.jsx(R,{className:"w-8 h-8"}),color:"from-blue-500 to-cyan-500",useCases:["Lead generation","Product guides","How-to guides","Industry reports"]},{type:"whitepaper",title:"White Paper",description:"In-depth research and thought leadership (6-12 pages)",icon:e.jsx(we,{className:"w-8 h-8"}),color:"from-purple-500 to-pink-500",useCases:["Research findings","Technical analysis","Industry insights","Best practices"]},{type:"case_study",title:"Case Study",description:"Customer success stories with metrics and outcomes",icon:e.jsx(X,{className:"w-8 h-8"}),color:"from-green-500 to-emerald-500",useCases:["Customer wins","ROI demonstrations","Implementation stories","Testimonials"]}],s=a=>{r(`/content-management/create?type=${a}&workflow=professional`)};return e.jsxs("div",{className:"min-h-screen bg-gray-50 p-8",children:[e.jsxs("div",{className:"max-w-6xl mx-auto mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-500 rounded-lg flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Professional Content Studio"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Create B2B eBooks, white papers, and case studies"})]})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Powered by Your Business Assets"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 text-sm text-gray-700",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-1.5"}),e.jsx("span",{children:"Auto-applies your brand colors, logo, and fonts"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-1.5"}),e.jsx("span",{children:"Access all uploaded images and documents"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-1.5"}),e.jsx("span",{children:"Professional templates ready to use"})]})]})]})]}),e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Choose Content Type"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:t.map(a=>e.jsxs("button",{onClick:()=>s(a.type),className:"bg-white rounded-xl shadow-sm border-2 border-gray-200 hover:border-indigo-500 hover:shadow-lg transition-all text-left p-6 group",children:[e.jsx("div",{className:`w-16 h-16 bg-gradient-to-br ${a.color} rounded-lg flex items-center justify-center mb-4 text-white`,children:a.icon}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:a.title}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:a.description}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-gray-500 uppercase",children:"Best For:"}),a.useCases.map((l,i)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx("div",{className:"w-1 h-1 bg-gray-400 rounded-full mt-1.5"}),e.jsx("span",{children:l})]},i))]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200 flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-indigo-600 group-hover:text-indigo-700",children:["Create ",a.title.split("/")[0].trim()]}),e.jsx("svg",{className:"w-5 h-5 text-indigo-600 group-hover:translate-x-1 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]},a.type))}),e.jsxs("div",{className:"mt-8 bg-white rounded-lg shadow-sm p-6",children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-4",children:"Why Professional Content Matters"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-3xl font-bold text-blue-600 mb-1",children:"71%"}),e.jsx("p",{className:"text-sm text-gray-600",children:"of B2B buyers use white papers in purchasing decisions"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"50%"}),e.jsx("p",{className:"text-sm text-gray-600",children:"of decision-makers prefer case studies over other content types"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-3xl font-bold text-purple-600 mb-1",children:"67%"}),e.jsx("p",{className:"text-sm text-gray-600",children:"of marketers say guides are the most converting content format"})]})]})]})]})]})},tt=()=>e.jsx("div",{className:"min-h-screen bg-gray-50",children:e.jsx("div",{className:"w-full",children:e.jsxs(oe,{children:[e.jsx(T,{path:"/",element:e.jsx(Oe,{})}),e.jsx(T,{path:"/picture-book/*",element:e.jsx(Je,{})}),e.jsx(T,{path:"/counting-book/*",element:e.jsx(Ze,{})}),e.jsx(T,{path:"/bilingual-book/*",element:e.jsx(es,{})}),e.jsx(T,{path:"/choice-book/*",element:e.jsx(ss,{})}),e.jsx(T,{path:"/activity-book/*",element:e.jsx(ts,{})}),e.jsx(T,{path:"/chapter-book/*",element:e.jsx(Ds,{})}),e.jsx(T,{path:"/professional-ebook/*",element:e.jsx(Vs,{})})]})})});export{tt as BookWriter,tt 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.