1import{e as f,g,h as y,i as k,k as b,r as d,j as e,I as C,l as w,m as S}from"./index-BSI0KOiD.js";function I(){const{data:m,isLoading:x}=f(),i=g("chants.create"),n=y(),v=g("chants.import"),t=k(),a=b(),[j,p]=d.useState(!1),[c,h]=d.useState(""),[o,u]=d.useState(""),N=s=>{s.preventDefault(),c.trim()!==""&&n.mutate({title:c.trim(),...o!==""?{copyFrom:o}:{}},{onSuccess:()=>{p(!1),h(""),u("")}})};return e.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 py-8 sm:px-6",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"page-eyebrow",children:"Editor"}),e.jsx("h1",{className:"page-title",children:"Chants"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-[var(--color-ink-mute)]",children:"Marked recitation texts â holdings, svaras, anusvÄra and visarga, in every script. The text lives here; a Library page points at it."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"btn-ghost cursor-pointer",children:[e.jsx("input",{type:"file",accept:".docx",className:"sr-only",onChange:s=>{var l;const r=(l=s.target.files)==null?void 0:l[0];s.target.value="",r!==void 0&&t.mutate({file:r})}}),t.isPending?"Readingâ¦":"Import Word"]}),e.jsxs("label",{className:"btn-ghost cursor-pointer",children:[e.jsx("input",{type:"file",accept:".vuchant,application/vnd.vedaunion.chant+zip",className:"sr-only",onChange:s=>{var l;const r=(l=s.target.files)==null?void 0:l[0];s.target.value="",r!==void 0&&a.mutate(r)}}),a.isPending?"Openingâ¦":"Open .vuchant"]})]}),i&&e.jsxs("button",{type:"button",className:"btn-primary",onClick:()=>p(s=>!s),children:[e.jsx(C,{name:"plus",className:"mr-1.5"}),"New chant"]})]})]}),j&&i&&e.jsxs("form",{onSubmit:N,className:"veda-panel mt-6 grid gap-4 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"grid gap-1.5 text-sm",children:[e.jsx("span",{className:"font-grotesk text-[var(--color-ink-soft)]",children:"Title"}),e.jsx("input",{className:"input",value:c,onChange:s=>h(s.target.value),placeholder:"e.g. NÄrÄyaá¹a SÅ«ktam",autoFocus:!0})]}),e.jsxs("label",{className:"grid gap-1.5 text-sm",children:[e.jsx("span",{className:"font-grotesk text-[var(--color-ink-soft)]",children:"Start from an existing chant"}),e.jsxs("select",{className:"input",value:o,onChange:s=>u(s.target.value),children:[e.jsx("option",{value:"",children:"Empty document"}),w.map(s=>e.jsx("option",{value:s.slug,children:s.title},s.slug))]})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("p",{className:"mb-3 text-xs text-[var(--color-ink-mute)]",children:"Copying gives you a real, fully-marked document to work from. The original is never modified."}),e.jsx("button",{type:"submit",className:"btn-primary",disabled:n.isPending,children:n.isPending?"Creatingâ¦":"Create"}),n.isError&&e.jsx("span",{className:"ml-3 text-sm text-[var(--color-danger)]",children:n.error instanceof Error?n.error.message:"Could not create."})]})]}),a.isError&&e.jsx("p",{className:"veda-banner mt-6 text-sm text-[var(--color-danger)]",children:a.error instanceof Error?a.error.message:"Could not open that package."}),a.isSuccess&&e.jsxs("div",{className:"veda-panel mt-6 p-4 text-sm",children:[e.jsxs("p",{className:"font-grotesk text-[var(--color-ink-soft)]",children:["Opened ",e.jsx("strong",{children:a.data.chant.title})," â ",a.data.chant.sectionCount," ","sections, ",a.data.chant.verses," verses, ",a.data.chant.syllables," syllables",a.data.assets>0?`, ${a.data.assets} assets`:"","."]}),a.data.manifest!==void 0&&e.jsxs("p",{className:"mt-1 text-xs text-[var(--color-ink-mute)]",children:["made by engine ",a.data.manifest.engine," · document hash verified"]})]}),t.isError&&e.jsx("p",{className:"veda-banner mt-6 text-sm text-[var(--color-danger)]",children:t.error instanceof Error?t.error.message:"Import failed."}),t.isSuccess&&t.data.report!==void 0&&e.jsxs("div",{className:"veda-panel mt-6 p-4 text-sm",children:[e.jsxs("p",{className:"font-grotesk text-[var(--color-ink-soft)]",children:["Imported ",e.jsx("strong",{children:t.data.chant.title})," â"," ",t.data.report.structure.sections," sections,"," ",t.data.report.structure.verses," verses,"," ",t.data.report.structure.syllables," syllables from"," ",t.data.report.structure.runs," runs."]}),e.jsxs("p",{className:"mt-1 text-xs text-[var(--color-ink-mute)]",children:["marks read:"," ",Object.entries(t.data.report.marks).map(([s,r])=>`${s} ${r}`).join(" · ")]}),t.data.report.unresolved.length>0&&e.jsxs("p",{className:"mt-2 text-xs text-[var(--color-ink-mute)]",children:[t.data.report.unresolved.length," item(s) need a decision â nothing was guessed. The marks were transcribed from your styles, never re-derived."]})]}),e.jsxs("div",{className:"mt-8 grid gap-3",children:[x&&e.jsx("p",{className:"text-sm text-[var(--color-ink-mute)]",children:"Loadingâ¦"}),!x&&(m??[]).length===0&&e.jsxs("div",{className:"veda-empty",children:[e.jsx("p",{children:"No chant documents yet."}),i&&e.jsx("p",{className:"mt-1 text-sm",children:"Create one, or copy a shipped chant to start."})]}),(m??[]).map(s=>e.jsxs(S,{to:`/dashboard/chants/${s.slug}`,className:"veda-card flex flex-wrap items-center gap-x-6 gap-y-2 p-4 transition hover:shadow-[var(--shadow-md)]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate font-display text-lg",children:s.title}),e.jsx("span",{className:"chip",children:s.status}),!s.canEdit&&e.jsx("span",{className:"chip",children:"read only"})]}),s.subtitle!==null&&e.jsx("p",{className:"truncate text-sm text-[var(--color-ink-mute)]",children:s.subtitle}),s.source!==null&&e.jsx("p",{className:"truncate text-xs text-[var(--color-ink-light)]",children:s.source})]}),e.jsxs("dl",{className:"flex shrink-0 gap-5 font-grotesk text-xs text-[var(--color-ink-mute)]",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"sr-only",children:"Sections"}),e.jsxs("dd",{children:[e.jsx("strong",{className:"text-[var(--color-ink)]",children:s.sectionCount})," sections"]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"sr-only",children:"Verses"}),e.jsxs("dd",{children:[e.jsx("strong",{className:"text-[var(--color-ink)]",children:s.verses})," verses"]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"sr-only",children:"Syllables"}),e.jsxs("dd",{children:[e.jsx("strong",{className:"text-[var(--color-ink)]",children:s.syllables})," syllables"]})]})]})]},s.id))]})]})}export{I as default}; 2//# sourceMappingURL=ChantsList-BKhFVlXA.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.