PageSourceSearch

https://antiq.ai/_next/static/chunks/2cca77e901af7690.js?dpl=dpl_5bhKodiSDxSFTRz3ygE5CSvbFR88

js antiq.ai collected 2026-10-03 02:07:33 UTC 62,139 bytes, 7 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95936,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return s}});let l=e.r(690482);function s({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new l.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},253254,(e,t,r)=>{"use strict";function l(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return l}})},680883,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return o}});let l=e.r(681099),s=e.r(372280),n=e.r(611268),i=e.r(253254),a=e.r(205051);function o({moduleIds:e}){if("u">typeof window)return null;let t=n.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let l=t.reactLoadableManifest;for(let t of e){if(!l[t])continue;let e=l[t].files;r.push(...e)}}if(0===r.length)return null;let o=(0,a.getDeploymentIdQueryOrEmptyString)();return(0,l.jsx)(l.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,i.encodeURIPath)(e)}${o}`;return e.endsWith(".css")?(0,l.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},419525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return c}});let l=e.r(681099),s=e.r(514499),n=e.r(95936),i=e.r(680883);function a(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},c=function(e){let t={...o,...e},r=(0,s.lazy)(()=>t.loader().then(a)),c=t.loading;function d(e){let a=c?(0,l.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?s.Suspense:s.Fragment,u=t.ssr?(0,l.jsxs)(l.Fragment,{children:["u"<typeof window?(0,l.jsx)(i.PreloadChunks,{moduleIds:t.modules}):null,(0,l.jsx)(r,{...e})]}):(0,l.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,l.jsx)(r,{...e})});return(0,l.jsx)(d,{...o?{fallback:a}:{},children:u})}return d.displayName="LoadableComponent",d}},485869,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let l=e.r(555682)._(e.r(419525));function s(e,t){let r={};"function"==typeof e&&(r.loader=e);let s={...r,...t};return(0,l.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},152385,226195,464371,830337,932561,e=>{"use strict";e.i(524062);var t=e.i(681099),r=e.i(514499),l=e.i(49958),s=e.i(972299),n=e.i(304986),i=e.i(658932),a=e.i(388369);let o=(0,a.default)("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);var c=e.i(997269),d=e.i(476553),u=e.i(10991);function m(e=[]){return Array.isArray(e)?e.join(","):""}function x(e=[],t={}){return Array.isArray(e)&&0!==e.length?t&&0!==Object.keys(t).length?e.map((e,r)=>{let l=t[`level${r+1}`];return l?`${l} ${e}`:e.toString()}):e.map(e=>e.toString()):[]}e.s(["createUnitDisplayArray",()=>x,"formatUnitNumbers",()=>m],226195);var p=e.i(392885),f=e.i(57883),h=e.i(371651);let g={1:"1st",2:"2nd",3:"3rd",IMPERSONAL:"Impersonal",NOUN:"Noun",PROPN:"Proper Noun",VERB:"Verb",AUX:"Auxiliary Verb",ADJ:"Adjective",ADV:"Adverb",ADP:"Adposition",DET:"Determiner",PRON:"Pronoun",NUM:"Numeral",SCONJ:"Subordinating Conjunction",CCONJ:"Co-ordinating Conjunction",PART:"Particle",INTJ:"Interjection",PUNCT:"Punctuation",SYM:"Symbol",X:"Other",ABL:"Ablative",ACC:"Accusative",DAT:"Dative",GEN:"Genitive",LOC:"Locative",NOM:"Nominative",VOC:"Vocative",F:"Feminine",M:"Masculine",N:"Neuter",COMMON:"Common",PL:"Plural",SG:"Singular",DUAL:"Dual",COLLECTIVE:"Collective",IMPF:"Imperative",IND:"Indicative",INF:"Infinitive",SUB:"Subjunctive",FUT:"Future",FUTPERF:"Future Perfect",PERF:"Perfect",PLUP:"Pluperfect",PRES:"Present",CONV:"Converb",FIN:"Finite",GER:"Gerund/Gerundive",PART:"Participle",SUP:"Supine",ACT:"Active",PASS:"Passive",MIDDLE:"Middle",DEPONENT:"Deponent",Cmp:"Comparative",Sup:"Superlative",Pos:"Positive",ABSOLUTE:"Absolute",adv_particles:"Adverbs & Particles",connectors:"Connectors",descriptors:"Descriptors",nouns_pronouns:"Nouns & Pronouns",other:"Other",prepositions:"Prepositions",verbs:"Verbs",concord:"Concordance",forwarded:"Forwarded",low:"Low confidence",lp_trust:"LatinParse trusted",morpheus_trust:"Morpheus trusted",lp:"LatinParse","lp+morpheus":"LatinParse + Morpheus",morpheus:"Morpheus",multiple:"Multiple sources",none:"No source"},b=e=>g[e]??e,w=e=>{if(!e||0===Object.keys(e).length)return null;let t=[],{gender:r,number:l,case:s,person:n,tense:i,mood:a,voice:o,degree:c,verbForm:d}=e,u=e=>{if(null==e)return;let r="string"==typeof e?e:String(e);r&&t.push(r.toLowerCase())};return n&&"NA"!==n&&u(`${b(n)} person`),l&&"NA"!==l&&u(b(l)),i&&"NA"!==i&&u("IMPF"===i?"Imperfect":b(i)),o&&"NA"!==o&&u(b(o)),a&&"NA"!==a&&"IND"!==a&&u(b(a)),d&&"NA"!==d&&"FIN"!==d&&u(b(d)),s&&"NA"!==s&&u(b(s)),r&&"NA"!==r&&u(b(r)),c&&"Pos"!==c&&"NA"!==c&&u(b(c)),t.length>0?t.join(" · "):null};e.s(["human",0,b,"naturalMorphology",0,w],464371),e.i(924856);var j=e.i(506393);let k=null,y=null;function v(){N()}async function N(){return k||y||(y=fetch("/data/lemma-clusters.json").then(e=>e.json()).then(e=>k={dictKeyIndex:e.dictKeyIndex||{}
1,clusters:e.clusters||{}}).catch(()=>(y=null,{dictKeyIndex:{},clusters:{}})))}function C(e,t){let[l,s]=(0,r.useState)({clusterId:null,sampleParadigm:null,genderedParadigms:null}),n=t?(0,j.participleClusterId)(t.partOfSpeech,t.feats,t.surface):null;return(0,r.useEffect)(()=>{if(!e)return void s({clusterId:null,sampleParadigm:null,genderedParadigms:null});let t=!1;return N().then(r=>{if(t)return;let l=Object.hasOwn(r.dictKeyIndex,e)?r.dictKeyIndex[e]:null,i=(0,j.resolveEffectiveClusterId)("string"==typeof l?l:null,n),a=i?r.clusters[i]:null;s({clusterId:i,sampleParadigm:a?.sampleParadigm||null,genderedParadigms:a?.genderedParadigms||null})}),()=>{t=!0}},[e,n]),l}e.s(["prefetchClusterData",()=>v,"useWordCluster",()=>C],830337);let S={principalParts:null,paradigm:null},P=new Map;var A=e.i(222861),I=e.i(903495);let O={nouns_pronouns:"noun",NOUN:"noun",PROPN:"noun",PRON:"noun",verbs:"verb",VERB:"verb",AUX:"verb",descriptors:"adjective",ADJ:"adjective",DET:"adjective"},R=["case","number"],M=["tense","voice","mood"],$=["case","number"];function E(e,t){let r,l;if(!t||"object"!=typeof t)return null;let s=O[e]??null;if(!s)return null;switch(s){case"noun":r=R,l="NOUN";break;case"verb":r=M,l="VERB";break;case"adjective":r=$,l="ADJ";break;default:return null}let n=[l];for(let e of r){let r=t[e];r&&"NA"!==r&&"Unknown"!==r&&""!==r&&n.push(r)}return n.length<2?null:n.join("_")}var L=e.i(458661);let B=["NOM","GEN","DAT","ACC","ABL","VOC"],T={NOM:"Nom.",GEN:"Gen.",DAT:"Dat.",ACC:"Acc.",ABL:"Abl.",VOC:"Voc."};function _(e){if(!e)return null;let t=e.toLowerCase()[0];return"m"===t?"M":"f"===t?"F":"n"===t?"N":null}let F={noun:"Noun",verb:"Verb",adj:"Adjective",pron:"Pronoun"};function U({clusterId:e,modelForms:l}){let s=(0,I.useReaderStore)(e=>e.skillAccuracy),n=(0,j.getClusterBadgeMeta)(e),i=r.default.useMemo(()=>(0,j.getClusterRollup)(s,e),[s,e]);if(!n)return null;let a=(0,j.isRollupReady)(i),o=i.total>0?i.correct/i.total:0;return(0,t.jsxs)("div",{className:"flex items-center gap-3 pb-3 mb-3 border-b border-inkwell/[0.08]",children:[(0,t.jsx)(L.default,{kind:n.kind,glyph:n.glyph,correct:i.correct,total:i.total}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-[10px] uppercase tracking-[0.18em] text-inkwell/45 font-semibold",children:F[n.kind]}),(0,t.jsxs)("div",{className:"text-[13px] font-medium text-inkwell/85 mt-0.5 leading-tight",children:[n.name,n.qualifier&&(0,t.jsxs)("span",{className:"text-inkwell/50 font-normal ml-1.5",children:["· ",n.qualifier]})]}),l&&(0,t.jsx)("div",{className:"font-serif italic text-[12px] text-inkwell/55 mt-0.5 truncate",children:l})]}),i.total>0&&(0,t.jsxs)("div",{className:"text-right tabular-nums shrink-0",children:[a&&(0,t.jsxs)("div",{className:`text-base font-semibold leading-none ${o>=.8?"text-emerald":o>=.5?"text-marigold":"text-coral"}`,children:[Math.round(100*o),"%"]}),(0,t.jsxs)("div",{className:"text-[10px] text-inkwell/45 tracking-wide mt-1",children:[i.correct," of ",i.total]})]})]})}function D({clusterId:e,sampleParadigm:r,genderedParadigms:l=null,grammar:s,principalParts:n,scrollRef:i}){let a=!(!e||e.endsWith("_unclassified"))&&(e.startsWith("N_")||e.startsWith("A_")||e.startsWith("PRON_"))&&r&&Object.keys(r).length>0,o=n&&e?.startsWith("V_")&&!e.endsWith("_unclassified");return a||o?(0,t.jsxs)("div",{ref:i,className:"mt-4 pt-4 border-t border-inkwell/5",children:[o&&(0,t.jsx)(q,{principalParts:n,clusterId:e}),a&&(0,t.jsx)(z,{sampleParadigm:r,genderedParadigms:l,grammar:s,clusterId:e})]}):null}let W={PRES:"Pres.",IMPF:"Impf.",FUT:"Fut.",PERF:"Perf.",PLUP:"Plup.",FUTPERF:"Fut.Pf.",ACT:"Act.",PASS:"Pass.",IND:"Ind.",SUB:"Subj.",IMP:"Imp.",INF:"Inf."};function q({principalParts:e,clusterId:l}){let s,n,i,a,o=(i=(n=(s=e.split(";")[0].trim()).match(/^([^(]+)/))?n[1].replace(/\s+[mfn]\b/g,"").trim():"",(a=s.match(/\(([^)]+)\)/))?[i,...a[1].split(",").map(e=>e.replace(/present\s+infinitive/i,"").replace(/perfect\s+active/i,"").replace(/future\s+active\s+participle/i,"").replace(/supine/i,"").replace(/genitive\s+plural/i,"").replace(/genitive/i,"").replace(/nominative\s+plural/i,"").replace(/feminine/i,"").trim()).filter(
1Boolean)].filter(Boolean).join(", "):i||e),c=(0,I.useReaderStore)(e=>e.skillAccuracy),d=r.default.useMemo(()=>{let e=l?(0,j.enrichSkillWithCluster)("VERB_X",l).split("_")[0]:null,t=new Set,r=[];for(let[l,s]of Object.entries(c)){if(s.total<1)continue;let n=null;if(e&&l.startsWith(e+"_")?n=l.slice(e.length+1).split("_"):l.startsWith("VERB_")&&(n=l.slice(5).split("_")),!n)continue;let i=n.join("_");if(t.has(i))continue;t.add(i);let a=n.map(e=>W[e]||e).join(" ");r.push({key:l,label:a,correct:s.correct,total:s.total})}return r},[c,l]);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(U,{clusterId:l,modelForms:o}),d.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1",children:d.map(e=>{let r=Math.round(e.correct/e.total*100),l=r>=80?"#6B8F71":r>=50?"#D97706":"#C1674A";return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-inkwell/[0.06] bg-inkwell/[0.01]",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:l}}),(0,t.jsx)("span",{className:"text-[11px] text-inkwell/50 font-sans",children:e.label}),(0,t.jsxs)("span",{className:"text-[11px] font-medium",style:{color:l},children:[r,"%"]})]},e.key)})})]})}function z({sampleParadigm:e,genderedParadigms:l,grammar:s,clusterId:n}){let i=(0,I.useReaderStore)(e=>e.skillAccuracy),a=(n?.startsWith("A_")||n?.startsWith("PRON_"))??!1,o=a&&!!l,c=!!l&&B.every(e=>l.M[`${e}_SG`]===l.F[`${e}_SG`]&&l.M[`${e}_PL`]===l.F[`${e}_PL`]),d=_(s?.gender)??"M",u=c&&"F"===d?"M":d,[m,x]=r.default.useState(u);r.default.useEffect(()=>{x(u)},[n,e]);let p=o&&l?l[m]:e,f=(e,t)=>{let r=`${a?"ADJ":"NOUN"}_${e}_${t}`;return i[(0,j.enrichSkillWithCluster)(r,n)]||i[r]||null},h=(e,t)=>{let r=p[`${e}_${t}`];return void 0!==r&&"-"!==r},g=B.filter(e=>h(e,"SG")||h(e,"PL"));if(0===g.length)return null;let b=_(s?.gender),w=e=>!!function(e,t){if(!t)return!1;let r=e.split("_");if(r.length<2)return!1;let[l,s]=r,n=t.case?.toUpperCase(),i=t.number?.toUpperCase();return n===l&&i===s}(e,s)&&(!o||null===b||b===m),k=p.NOM_SG,y=p.GEN_SG,v=o&&l?c?`${l.M.NOM_SG}, ${l.N.NOM_SG}`:`${l.M.NOM_SG}, ${l.F.NOM_SG}, ${l.N.NOM_SG}`:k&&y?`${k}, ${y}`:null;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(U,{clusterId:n,modelForms:v}),o&&(0,t.jsx)(G,{selected:m,onChange:x,hideF:c}),(0,t.jsxs)("table",{className:"w-full text-sm border-collapse",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-inkwell/10",children:[(0,t.jsx)("th",{className:"text-left text-[11px] text-inkwell/40 font-normal pr-3 pb-1.5 w-12"}),(0,t.jsx)("th",{className:"text-left text-[11px] text-inkwell/40 font-normal pb-1.5 tracking-wide",children:"Sg."}),(0,t.jsx)("th",{className:"text-left text-[11px] text-inkwell/40 font-normal pb-1.5 tracking-wide",children:"Pl."})]})}),(0,t.jsx)("tbody",{children:g.map(e=>(0,t.jsxs)("tr",{className:"border-b border-inkwell/5 last:border-0",children:[(0,t.jsx)("td",{className:"text-[11px] text-inkwell/40 pr-3 py-1 font-medium",children:T[e]}),(0,t.jsx)(K,{value:p[`${e}_SG`],highlighted:w(`${e}_SG`),accuracy:f(e,"SG")}),(0,t.jsx)(K,{value:p[`${e}_PL`],highlighted:w(`${e}_PL`),accuracy:f(e,"PL")})]},e))})]})]})}let V={M:"M.",F:"F.",N:"N."};function G({selected:e,onChange:r,hideF:l}){return(0,t.jsx)("div",{role:"radiogroup","aria-label":"Gender",className:"inline-flex items-center gap-0.5 rounded border border-inkwell/10 bg-inkwell/[0.02] p-0.5",children:(l?["M","N"]:["M","F","N"]).map(s=>{let n=s===e;return(0,t.jsx)("button",{type:"button",role:"radio","aria-checked":n,onClick:()=>r(s),className:`px-2 py-0.5 text-[11px] font-sans rounded transition-colors ${n?"bg-inkwell/[0.06] text-inkwell/80 font-medium":"text-inkwell/40 hover:text-inkwell/60"}`,children:l&&"M"===s?"M./F.":V[s]},s)})})}function K({value:e,highlighted:r,accuracy:l}){if(!e||"-"===e)return(0,t.jsx)("td",{className:"py-1 text-inkwell/20",children:"—"});let s=l&&l.total>=1,n=s?Math.round(l.correct/l.total*100):null;if(s){let l=n>=80?"text-sage":n>=50?"text-amber-600":"text-coral";return(0,t.jsx)("td",{className:`py-1 rounded-sm px-1.5 ${r?"ring-1 ring-marigold/50":""}`,style:{backgroundColor:n>=80?"rgba(107,143,113,0.12)":n>=50?"rgba(217,119,6,0.10)":"rgba(193,103,74,0.10)"},children:(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-1",children:[(0,t.jsx)("span",{className:`font-serif ${r?"text-inkwell/90 font-medium":"text-inkwell/60"}`,children:e}),(0,t.jsxs)("span",{className:`text-[10px] font-sans font-medium ${l}`,children:[n,"%"]})]})})}return(0,t.jsx)("td",{className:`py-1 font-serif ${r?"text-inkwell/90 font-medium bg-marigold/20 rounded-sm px-1 -mx-1":"text-inkwell/60"}`,children:e})}var J=e.i(451780);let X=["#E8A020","#6B8F71","#C1674A","#4A6FA5","#E8A020","#6B8F71"];function Q(){return(0,t.jsx)("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:Array.from({length:6}).map((e,r)=>{let l=r/6*Math.PI*2,s=22*Math.cos(l),n=22*Math.sin(l);return(0,t.jsx)(f.m.span,{initial:{x:0,y:0,opacity:0,scale:.4},animate:{x:s,y:n,opacity:[0,1,0],scale:[.4,1,.6]},transition:{duration:.7,ease:"easeOut",delay:.015*r},className:"absolute block rounded-full",style:{width:3.5,height:3.5,backgroundColor:X[r%X.length]}},r)})})}
1function Y({clusterId:e,scrollTargetRef:l}){let s=(0,I.useReaderStore)(e=>e.skillAccuracy),n=(0,I.useReaderStore)(e=>e.pendingMasteryCelebration),i=(0,I.useReaderStore)(e=>e.consumeMasteryCelebration),a=(0,j.getClusterBadgeMeta)(e),o=r.default.useMemo(()=>(0,j.getClusterRollup)(s,e),[s,e]),[c,d]=r.default.useState(!1),u=r.default.useRef(null);return(r.default.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),r.default.useEffect(()=>{e&&n===e&&(i(),d(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,d(!1)},700))},[n,e,i]),a)?(0,t.jsxs)(f.m.button,{type:"button",onClick:()=>{l.current?.scrollIntoView({behavior:"smooth",block:"center"})},animate:c?{scale:[1,1.06,1],y:[0,-2,0]}:{scale:1,y:0},transition:{duration:.45,ease:"easeOut"},className:"relative inline-flex items-center gap-1.5 pl-0.5 pr-2 py-0.5 rounded-full border border-inkwell/[0.08] bg-inkwell/[0.025] hover:bg-inkwell/[0.05] hover:border-inkwell/15 transition-colors cursor-pointer","aria-label":`Scroll to ${a.name} paradigm`,children:[(0,t.jsxs)("span",{className:"relative inline-flex",children:[(0,t.jsx)(L.default,{kind:a.kind,glyph:a.glyph,correct:o.correct,total:o.total,size:"sm"}),(0,t.jsx)(J.AnimatePresence,{children:c&&(0,t.jsx)(Q,{},"burst")})]}),(0,t.jsx)("span",{className:"text-xs font-medium text-inkwell/75",children:a.name})]}):null}function H({partOfSpeech:e,grammar:r,clusterId:l}){let s=(0,I.useReaderStore)(e=>e.skillAccuracy);if(!r||!e)return null;let n=E(e,r);if(!n)return null;let i=s[(0,j.enrichSkillWithCluster)(n,l)]||s[n];if(!i||i.total<3)return null;let a=Math.round(i.correct/i.total*100),o=i.confusions,c=null;if(o){let e=Object.entries(o).sort(([,e],[,t])=>t-e);e.length>0&&e[0][1]>=2&&(c=e[0][0])}return(0,t.jsxs)("p",{className:"text-xs text-inkwell/40 mt-2",children:[(0,t.jsxs)("span",{className:`font-medium ${a>=80?"text-emerald-600/70":a>=50?"text-amber-600/70":"text-coral/70"}`,children:[i.correct,"/",i.total]}),c&&(0,t.jsxs)("span",{children:[" — often answered ",(0,t.jsx)("span",{className:"italic",children:c})]})]})}var Z=e.i(378504),ee=e.i(451424),et=e.i(398794);e.i(671272);var er=e.i(91549);let el={case:{prompt:e=>`What case is *${e}* in?`,getDistractors:e=>en(["NOM","ACC","GEN","DAT","ABL","VOC","LOC"].filter(t=>t!==e)).slice(0,3)},gender:{prompt:e=>`What gender is *${e}*?`,getDistractors:e=>en(["M","F","N","COMMON"].filter(t=>t!==e)).slice(0,3)},number:{prompt:e=>`Is *${e}* singular or plural?`,getDistractors:e=>["SG","PL"].filter(t=>t!==e)},tense:{prompt:e=>`What tense is the verb *${e}*?`,getDistractors:e=>en(["PRES","IMPF","FUT","PERF","PLUP","FUTPERF"].filter(t=>t!==e)).slice(0,3)},mood:{prompt:e=>`What mood is *${e}* in?`,getDistractors:e=>en(["IND","SUB","IMPF","INF"].filter(t=>t!==e)).slice(0,3)},voice:{prompt:e=>`Is *${e}* active or passive?`,getDistractors:e=>["ACT","PASS"].filter(t=>t!==e)},person:{prompt:e=>`What person is *${e}*?`,getDistractors:e=>en(["1","2","3","IMPERSONAL"].filter(t=>t!==e)).slice(0,3)},degree:{prompt:e=>`What degree is the adjective *${e}*?`,getDistractors:e=>en(["Pos","Cmp","Sup","ABSOLUTE"].filter(t=>t!==e)).slice(0,3)}},es=["case","tense","mood","voice","gender","number","person","degree"];function en(e){let t=[...e];for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t}function ei(e){if(!e||"object"!=typeof e)return null;for(let t of es){let r=e[t];if(!r||"NA"===r||"Unknown"===r||""===r||null==r)continue;let l=el[t];if(l){let e=l.getDistractors(r);if(e&&e.length>0)return{feature:t,template:l}}}return null}var ea=e.i(180941),eo=e.i(919035);let ec=(0,e.i(485869).default)(()=>e.A(612221),{loadableGenerated:{modules:[199220]},ssr:!1}),ed=new Set;function eu({surface:e,lemma:l,partOfSpeech:s,grammar:n,morphSummary:i,definition:a,dictKey:o,headerButtons:c,footerButtons:d,tokenLocation:u,onSaveToCollection:m,BasicWordInfo:x,wordImage:h,clusterId:g,sampleParadigm:w,principalParts:k,headerExtras:y,definitionExtras:v,bottomExtras:N}){if(!x)return console.error("SocraticWordInfo → BasicWordInfo component is required"),null;let S=(0,I.useReaderStore)(e=>e.socraticQuestioningEnabled),P=(0,I.useReaderStore)(e=>e.setSocraticQuestioningEnabled),R=(0,I.useReaderStore)(e=>e.recordSkillAttempt),M=(0,I.useReaderStore)(e=>e.queueMasteryCelebration),{clusterId:$}=C(o??a?.key??null,{partOfSpeech:s,feats:n,surface:e}),[L,B]=(0,r.useState)(null),[T,_]=(0,r.useState)(0),[F,U]=(0,r.useState)(!1),[D,W]=(0,r.useState)("question"),[q,z]=(0,r.useState)(null),V=`${e}-${l}
1-${u?.workId}-${u?.unitPath}-${u?.leafIdx}`,G=q===V,[K,X]=(0,r.useState)(null),[Q,H]=(0,r.useState)(0),[ee,et]=(0,r.useState)(null),er=(0,r.useRef)(0),eu=(0,r.useRef)(!1),ex=(0,r.useRef)(null),[ep,ef]=(0,r.useState)(0),[eh,eg]=(0,r.useState)({width:0,height:0}),eb=(0,r.useRef)(null),ew=(0,r.useRef)(e);(0,r.useEffect)(()=>{ew.current=e},[e]),(0,r.useEffect)(()=>{let e=()=>{eg({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,r.useEffect)(()=>{if(ep>0){let e=setTimeout(()=>{let e=setInterval(()=>{ef(t=>{let r=t-40;return r<=0?(clearInterval(e),0):r})},200);return()=>{clearInterval(e)}},2e3);return()=>clearTimeout(e)}},[ep]),(0,r.useEffect)(()=>{let t=I.useReaderStore.getState().interactiveTourActive;if(!S&&!t||!e)return;let r=!0;if(!ed.has(V))return W("question"),B(null),_(0),X(null),H(0),et(null),null!=eb.current&&(clearTimeout(eb.current),eb.current=null),ed.add(V),(async()=>{r&&U(!0);try{let t=Date.now();for(;r&&!I.useReaderStore.getState()._skillAccuracyHydrated&&Date.now()-t<500;)await new Promise(e=>setTimeout(e,25));let l=I.useReaderStore.getState(),i=l.skillAccuracy,a=l.interactiveTourActive;eu.current=a;let o=function(e,t,r,l,s={}){let{type:n="mcq",sequence:i=!1,skillAccuracy:a=null,clusterId:o=null,forceQuestion:c=!1}=s;return i?function(e,t,r,l,s,n,i=!1){if(!l||0===Object.keys(l).length)return{kind:"skip",reason:"No grammar object provided"};let a=Object.entries(l).filter(([e,t])=>t&&"NA"!==t&&"Unknown"!==t&&""!==t&&null!=t&&es.includes(e));if(0===a.length)return{kind:"skip",reason:"No meaningful grammar features found"};if(!i&&s&&Object.keys(s).length>0){let e=function(e,t,r,l){if(!l)return .3;let s=E(t,e);if(!s)return .3;let n=l[r?(0,j.enrichSkillWithCluster)(s,r):s]||l[s];
1if(!n||0===n.total)return .3;let i=n.correct/n.total;return i>=.8&&n.total>=5?0:i>=.8?.15:i>=.6?.4:.7}(l,r,n,s);if(e<=0)return{kind:"skip",reason:"mastered"};if(Math.random()>e)return{kind:"skip",reason:"throttled"}}let o=a.length>=2&&.4>Math.random()?2:1,c=[...es];if(s&&Object.keys(s).length>0){let e=e=>{let t=l[e];if(!t||"NA"===t)return 1;let i=E(r,l);if(i&&n){let e=s[(0,j.enrichSkillWithCluster)(i,n)];if(e&&e.total>0)return e.correct/e.total}let a="nouns_pronouns"===r||"NOUN"===r||"PROPN"===r||"PRON"===r?"NOUN":"verbs"===r||"VERB"===r||"AUX"===r?"VERB":"ADJ",o=Object.entries(s).filter(([e])=>e.startsWith(a)&&e.includes(t));if(0===o.length)return .5;let c=o.reduce((e,[,t])=>e+t.correct,0),d=o.reduce((e,[,t])=>e+t.total,0);return 0===d?.5:c/d};c.sort((t,r)=>{let l=e(t)-e(r);return Math.abs(l)>.01?l:es.indexOf(t)-es.indexOf(r)})}let d=[],u=new Set;for(let t of c){if(d.length>=o)break;let r=l[t];if(!r||"NA"===r||"Unknown"===r||""===r||null==r||u.has(t))continue;let s=el[t];if(s){let l=s.getDistractors(r);if(l&&l.length>0){let n=en([r,...l]),i=n.indexOf(r),a=n.map(e=>b(e));d.push({kind:"mcq",prompt:s.prompt(e),choices:a,correct:i,feature:t,correctValue:b(r)}),u.add(t)}}}return 0===d.length?{kind:"skip",reason:"No valid questions could be generated"}:{kind:"sequence",questions:d,totalQuestions:d.length}}(e,0,r,l,a,o,c):l&&0!==Object.keys(l).length?0===Object.entries(l).filter(([e,t])=>t&&"NA"!==t&&"Unknown"!==t&&""!==t&&null!=t&&es.includes(e)).length?{kind:"skip",reason:"No meaningful grammar features found"}:"blank"===n?function(e,t,r,l){if(!l||0===Object.keys(l).length)return{kind:"skip",reason:"No grammar features available for blank question"};let s=ei(l);if(!s)return{kind:"skip",reason:"No valid features found for blank question"};let{feature:n}=s,i=l[n];return{kind:"blank",prompt:`What ${n} is "${e}"? (Give the grammatical term)`,answer:b(i),feature:n,correctValue:b(i)}}(e,0,0,l):function(e,t,r,l){if(!l||0===Object.keys(l).length)return{kind:"skip",reason:"No grammar features available"};let s=ei(l);if(!s)return{kind:"skip",reason:"No valid features found for questioning"};let{feature:n,template:i}=s,a=l[n],o=i.getDistractors(a),c=en([a,...o]),d=c.indexOf(a),u=c.map(e=>b(e));return{kind:"mcq",prompt:i.prompt(e),choices:u,correct:d,feature:n,correctValue:b(a)}}(e,0,0,l):{kind:"skip",reason:"No grammar object provided"}}(e,0,s,n,{sequence:!0,skillAccuracy:i,clusterId:$,forceQuestion:a});o&&"skip"===o.kind?(r&&B(null),a&&(0,ea.emitTourAction)("quiz-answer")):(await new Promise(e=>setTimeout(e,300)),r&&ew.current===e&&(B(o),_(0)))}catch(e){console.error("Error generating automatic question:",e),r&&B(null)}finally{r&&(U(!1),z(V)),ed.delete(V)}})(),()=>{r=!1,ed.delete(V),null!=eb.current&&(clearTimeout(eb.current),eb.current=null)}},[e,l,s,n,u?.workId,u?.unitPath,u?.leafIdx,S]),(0,r.useEffect)(()=>{"question"===D&&(er.current=Date.now())},[T,D]);let ej=async t=>{if(!L||!L.questions||null==t)return;let r=L.questions[T],i=t===r.correct;X(t),W("answered"),i&&H(e=>e+1);let a=function(e,t,r,l,s){if(!e||!t)return null;let n=function(e,t,r,l){let s=E(r,l);if(s)return s;let n=O[r];return n&&t&&"NA"!==t?`${"noun"===n?"NOUN":"verb"===n?"VERB":"ADJ"}_${t}`:null}(0,t,r,l);return n?(0,j.enrichSkillWithCluster)(n,s):null}(r.feature,r.correctValue,s,n,$);a&&R(a,i,r.choices?.[t],r.correctValue),i&&$&&M($),(0,p.track)("teacher_question_answered",{surface:e,success:i,timeMs:Math.max(0,Date.now()-(er.current||Date.now())),questionIndex:T,totalQuestions:L.questions.length});try{let o=Math.max(0,Date.now()-(er.current||Date.now())),c={surface:e,lemma:l,partOfSpeech:s,grammar:n,question:r,questionIndex:T,totalQuestions:L.questions.length,userAnswer:r.choices?.[t],isCorrect:i,skillId:a||void 0,tokenLocation:u,generateFollowUp:!1,sessionId:ee||void 0,timeSpent:o};fetch("/api/tutor-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then(e=>e.ok?e.json():null).then(e=>{e?.sessionId&&et(t=>t||e.sessionId)}).catch(e=>{console.warn("Failed to store tutor session:",e)})}catch(e){console.warn("Error preparing session data:",e)}},ek=I.useReaderStore.getState().interactiveTourActive;if(!S&&!ek||"revealed"===D&&G||!F&&!L&&G)return(0,t.jsx)(x,{surface:e,lemma:l,partOfSpeech:s,grammar:n,morphSummary:i,definition:a,headerButtons:c,footerButtons:d,onSaveToCollection:m,tokenLocation:u,wordImage:h,clusterId:g,sampleParadigm:w,principalParts:k,headerExtras:y,definitionExtras:v,bottom
1Extras:N});let ey=L?.questions?.[T]||null;return(0,t.jsxs)(t.Fragment,{children:[ep>0&&(0,t.jsx)(ec,{width:eh.width,height:eh.height,recycle:!1,numberOfPieces:ep,gravity:.25,initialVelocityY:8,tweenDuration:4e3,colors:["#F4A261","#E9C46A","#E76F51","#2A9D8F","#264653","#F72585","#B5179E","#7209B7"],confettiSource:{x:0,y:0,w:eh.width,h:0}}),(0,t.jsxs)("div",{children:[($||c)&&(0,t.jsxs)("div",{className:"px-4 pt-3 pb-1 sm:px-5 sm:pt-4 flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:$&&(0,t.jsx)(Y,{clusterId:$,scrollTargetRef:ex})}),c&&(0,t.jsx)("div",{className:"flex items-center gap-2 flex-shrink-0",children:c})]}),(0,t.jsx)("div",{className:"px-4 py-2 sm:px-5 sm:py-3",children:(0,t.jsxs)(J.AnimatePresence,{mode:"wait",initial:!1,children:[(!L||!G)&&(0,t.jsx)(f.m.div,{...(0,A.fade)(),className:"flex justify-center items-center h-24 sm:h-32",children:(0,t.jsx)(Z.default,{size:"lg",className:"opacity-60"})},"load"),ey&&G&&(0,t.jsx)(f.m.div,{...(0,A.fadeUp)(),className:"space-y-3 sm:space-y-6",children:(0,t.jsx)(em,{question:ey,selected:K,handleSubmit:ej,phase:D,onContinue:()=>{if(null!=eb.current){clearTimeout(eb.current),eb.current=null,ef(0),W("revealed");return}((0,ea.emitTourAction)("quiz-answer"),K!==L.questions[T].correct)?W("revealed"):T<L.questions.length-1&&!eu.current?(_(T+1),W("question"),X(null)):((0,p.track)("socratic_quiz_complete",{surface:e,success:!0,questionsCount:L.questions.length}),ef(400),eb.current=setTimeout(()=>{eb.current=null,W("revealed")},3500))},questionIndex:T,totalQuestions:L.questions.length,surface:e,onDisable:()=>{P(!1)},tourCompleted:"done"===localStorage.getItem(eo.INTERACTIVE_TOUR_LS_KEY)})},`card-${T}`)]})})]})]})}function em({question:e,selected:l,handleSubmit:s,phase:n,onContinue:i,questionIndex:a,totalQuestions:o,surface:c,onDisable:d,tourCompleted:m}){var x;let[p,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if("function"!=typeof window.matchMedia)return void h(!1);let e=window.matchMedia("(max-width: 639px)");h(e.matches);let t=e=>h(e.matches);return"function"==typeof e.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):"function"==typeof e.addListener?(e.addListener(t),()=>e.removeListener(t)):void 0},[]);let[g,b]=(0,r.useState)(!1),w="answered"===n&&l!==e.correct,j=(0,r.useRef)(i);(0,r.useEffect)(()=>{j.current=i},[i]);let k=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if("answered"===n&&(!w||g))return k.current=setTimeout(()=>{k.current=null,j.current()},1200),()=>{null!=k.current&&(clearTimeout(k.current),k.current=null)}},[n,w,g]),(0,r.useEffect)(()=>{b(!1)},[a]),(0,t.jsx)(f.m.div,{...(0,A.fadeUp)(),className:"space-y-3",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)(f.m.div,{className:"pb-1.5 sm:pb-3",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between mb-1.5 sm:mb-2.5 text-xs text-inkwell/35 tracking-wider font-light",children:[(0,t.jsxs)(f.m.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3},children:[a+1," of ",o]},`progress-${a}`),(0,t.jsx)("div",{className:"flex-1 mx-3 h-px bg-gradient-to-r from-inkwell/5 via-inkwell/8 to-inkwell/5 self-center relative overflow-hidden",children:(0,t.jsx)(f.m.div,{className:"absolute inset-0 h-full bg-gradient-to-r from-transparent via-marigold/20 to-transparent",initial:{x:"-100%"},animate:{x:"100%"},transition:{duration:1.5,ease:"easeInOut",delay:.2}})}),(0,t.jsxs)(f.m.span,{className:"text-inkwell/40",initial:{opacity:0,x:10},animate:{opacity:1,x:0},transition:{duration:.3},children:[Math.round((a+1)/o*100),"%"]},`percentage-${a}`)]}),(0,t.jsx)(f.m.p,{className:"text-sm sm:text-base font-sans text-inkwell/85 leading-snug sm:leading-relaxed font-light",initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.2,duration:.4},children:"string"!=typeof(x=e.prompt)?x:x.split(/\*([^*]+)\*/g).map((e,r)=>r%2==1?(0,t.jsx)("em",{className:"font-serif italic text-inkwell/95",children:e},r):(0,t.jsx)("span",{children:e},r))})]}),(0,t.jsx)("div",{className:"space-y-2.5 sm:space-y-2",children:e.choices.map((r,i)=>{let a,o,c,d,m=i===l,x=i===e.correct,h="answered"===n,j=[{solid:"bg-marigold",badgeBg:"#E8A020",hoverBg:"group-hover:bg-marigold/8",borderBottom:"#C4820A"},{solid:"bg-slateBlue",badgeBg:"#4A6FA5",hoverBg:"group-hover:bg-slateBlue/6",borderBottom:"#3A5A88"},{solid:"bg-terracotta",badgeBg:"#C1674A",hoverBg:"group-hover:bg-terracotta/6",borderBottom:"#9E4F35"},{solid:"bg-sage",badgeBg:"#6B8F71",hoverBg:"group-hover:bg-sage/6",borderBottom:"#52735A"}],k=j[i%j.length],y={},v={};h?x?(o="text-white",v={backgroundColor:"#6B8F71"},c=p?"text-inkwell/85 font-normal":"text-inkwell/85 font-light",d=(0,t.jsx)(u.Check,{size:15,className:"text-sage",strokeWidth:2.5}),a=p?"border-2 border-sage/50 bg-sage/10 shadow-sm rounded-xl":"border border-sage/40 bg-sage/8 border-l-4 shadow-sm rounded-sm",y=p?{borderBottomWidth:"4px",borderBottomColor:"#52735A"}:{borderLeftColor:"#6B8F71"}):m?(o="text-white",v={backgroundColor:"#C1674A"},c="text-inkwell/50",d=(0,t.jsx)(er.X,{size:15,className:"text-coral",strokeWidth:2.5}),a=p?"border-2 border-coral/50 bg-coral/10 shadow-sm rounded-xl":"border border-coral/40 bg-coral/8 border-l-4 shadow-sm rounded-sm",y=p?{borderBottomWidth:"4px",borderBottomColor:"#9E4F35"}:{borderLeftColor:"#C1674A"}):(o="text-inkwell/20",v={backgroundColor:"rgba(0,0,0,0.04)"},c="text-inkwell/20",d=null,a=p?"border-2 border-inkwell/8 bg-white/40 rounded-xl opacity-50":"border border-inkwell/6 bg-white/40 border-l-4 rounded-sm opacity-50",y=p?{}:{borderLeftColor:"rgba(0,0,0,0.06)"}):m?(o="text-white",v={backgroundColor:k.badgeBg},c=p?"text-inkwell/90 font-normal":"text-inkwell/90 font-light",d=(0,t.jsx)(u.Check,{size:14,className:"text-inkwell/30",strokeWidth:2.5}),a=p?`border-2 bg-inkwell/3 shadow-sm rounded-xl ${k.hoverBg}`:`border border-inkwell/15 border-l-4 bg-inkwell/3 shadow-sm rounded-sm ${k.hoverBg}`,y=p?{borderColor:k.badgeBg,borderBottomWidth:"4px",borderBottomColor:k.borderBottom}:{borderLeftColor:k.badgeBg}):(o="text-white opacity-80 group-hover:opacity-100 transition-opacity duration-150",v={backgroundColor:k.badgeBg},d=null,p?(a="border-2 border-inkwell/12 bg-white rounded-xl transition-colors",y={borderBottomWidth:"4px",borderBottomColor:k.badgeBg+"40"},c="text-inkwell/70"):(a=`border border-inkwell/10 border-l-4 bg-white rounded-sm ${k.hoverBg} group-hover:border-inkwell/20 transition-colors`,y={borderLeftColor:k.badgeBg+"55"},c="text-inkwell/60 group-hover:text-inkwell/85"));let N=!h||h&&x&&w&&!g;return(0,t.jsxs)(f.m.button,{type:"button",onClick:N?h?()=>b(!0):()=>s(i):void 0,disabled:!N,className:`group w-full flex items-center ${p?"gap-2.5 px-3 py-2.5":"gap-2.5 p-2.5"} transition-all duration-200 ${a}`,style:y,initial:"question"===n&&null===l&&{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:"question"===n&&null===l?.3+.06*i:0,duration:.25,ease:"easeOut"},whileHover:N?{scale:1.02}:{},whileTap:N?{scale:.96}:{},children:[(0,t.jsx)(f.m.div,{className:`${p?"w-7 h-7 rounded-lg text-xs font-semibold":"w-6 h-6 rounded-sm text-[11px] font-medium"} flex items-center justify-center transition-all duration-150 ${o}`,style:v,animate:m&&!h?{scale:[1,1.15,1]}:{},transition:{duration:.3,ease:"easeOut"},children:String.fromCharCode(65+i)}),(0,t.jsx)("span",{className:`flex-1 text-left tracking-wide ${p?"text-[15px] leading-snug font-normal":"text-sm leading-relaxed font-light"} transition-colors duration-150 ${c}`,children:r}),(0,t.jsx)(f.m.div,{className:`${p?"w-5":"w-4"} flex items-center justify-center transition-all duration-150`,initial:{scale:0,opacity:0},animate:d?{scale:1,opacity:1}:{scale:0,opacity:0},transition:{duration:.3,ease:"backOut"},children:d})]},i)})}),w&&!g&&"answered"===n&&(0,t.jsx)(f.m.p,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{delay:.4,duration:.3},className:"text-center text-xs text-inkwell/40 font-light tracking-wide",children:"Tap the correct answer to continue"}),"answered"===n&&!w&&(0,t.jsx)(f.m.div,{className:"flex justify-center pt-1",initial:{opacity:0,y:4}
1,animate:{opacity:1,y:0},transition:{delay:.25,duration:.25},children:(0,t.jsxs)("button",{type:"button",onClick:()=>{null!=k.current&&(clearTimeout(k.current),k.current=null),i()},className:"flex items-center gap-1.5 px-3 py-1.5 text-xs sm:text-sm text-inkwell/55 hover:text-inkwell/85 font-light tracking-wide rounded-md hover:bg-inkwell/5 transition-colors duration-200",children:[(0,t.jsx)("span",{children:"Continue"}),(0,t.jsx)(et.ArrowRight,{size:12,strokeWidth:1.75})]})}),"question"===n&&m&&0===a&&(0,t.jsx)("div",{className:"flex justify-center mt-1 sm:mt-2",children:(0,t.jsxs)("button",{onClick:d,className:"text-xs text-inkwell/35 hover:text-inkwell/60 transition-colors duration-200 flex items-center gap-1 px-2 py-0.5 rounded hover:bg-inkwell/5",children:[(0,t.jsx)(er.X,{size:10}),(0,t.jsx)("span",{children:"Disable Think First"})]})})]})})}var ex=e.i(951635),ep=e.i(16537);let ef=(0,a.default)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),eh=[{id:"morphology",icon:ex.AlertTriangle,title:"Wrong morphological analysis",description:"The grammatical analysis (part of speech, case, number, etc.) is incorrect",color:"coral",allowComments:!0},{id:"definition",icon:ep.BookOpen,title:"Wrong/insufficient definition",description:"The dictionary definition is incorrect or incomplete",color:"marigold",allowComments:!0},{id:"other",icon:ef,title:"Other issue",description:"Something else is wrong (please specify)",color:"azureBlue",allowComments:!0,requiresComment:!0}];function eg({isOpen:e,onClose:l,onSubmit:s,surface:n,lemma:i}){let[a,c]=(0,r.useState)(null),[d,u]=(0,r.useState)(""),[m,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),g=eh.find(e=>e.id===a),b=async()=>{if(!a)return;h(!0);let e=g.title;d.trim()&&(e+=`: ${d.trim()}`);try{await s(e),l(),c(null),u(""),x(!1)}catch(e){console.error("Failed to submit feedback:",e)}finally{h(!1)}},w=a&&(!g?.requiresComment||d.trim().length>0);return(0,t.jsx)(J.AnimatePresence,{children:e&&(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 md:p-8",children:[(0,t.jsx)(f.m.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-inkwell/40 backdrop-blur-sm",onClick:l}),(0,t.jsxs)(f.m.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative bg-parchment border border-inkwell/20 rounded-sm shadow-xl  w-full max-w-sm sm:max-w-md lg:max-w-lg  max-h-[85vh] sm:max-h-[90vh]  flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 sm:p-6 border-b border-inkwell/10 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"p-1.5 sm:p-2 bg-coral/10 rounded-sm flex-shrink-0",children:(0,t.jsx)(o,{size:16,className:"text-coral sm:w-5 sm:h-5"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h2",{className:"text-base sm:text-lg font-logo tracking-wide text-inkwell truncate",children:"Report Issue"}),(0,t.jsxs)("p",{className:"text-xs sm:text-sm text-darkgray font-serif truncate",children:[(0,t.jsx)("span",{className:"font-medium",children:n})," (",i,")"]})]})]}),(0,t.jsx)("button",{onClick:l,className:"p-1.5 sm:p-2 hover:bg-inkwell/5 rounded-sm transition-colors flex-shrink-0 ml-2",children:(0,t.jsx)(er.X,{size:18,className:"text-inkwell/60 sm:w-5 sm:h-5"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:(0,t.jsxs)("div",{className:"p-4 sm:p-6 space-y-4",children:[(0,t.jsx)("p",{className:"text-xs sm:text-sm text-inkwell/70 mb-3 sm:mb-4 font-serif",children:"What's the issue with this word?"}),(0,t.jsx)("div",{className:"space-y-2 sm:space-y-3",children:eh.map(e=>{let r=e.icon,l=a===e.id;return(0,t.jsx)("button",{onClick:()=>c(e.id),className:`
2                        w-full p-3 sm:p-4 rounded-sm border transition-all text-left
3                        ${l?`border-${e.color} bg-${e.color}/5`:"border-inkwell/15 hover:border-inkwell/25 hover:bg-inkwell/5"}
4                      `,children:(0,t.jsxs)("div",{className:"flex items-start gap-2 sm:gap-3",children:[(0,t.jsx)(r,{size:18,className:`flex-shrink-0 mt-0.5 sm:w-5 sm:h-5 ${l?`text-${e.color}`:"text-inkwell/60"}`}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:`font-medium font-serif text-sm sm:text-base ${l?`text-${e.color}`:"text-inkwell"}`,children:e.title}),(0,t.jsx)("div",{className:"text-xs sm:text-sm text-inkwell/60 mt-1 font-sans leading-relaxed",children:e.description})]})]})},e.id)})}),a&&g?.allowComments&&(0,t.jsxs)(f.m.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-3 sm:mt-4 space-y-2 sm:space-y-3",children:[!g.requiresComment&&!m&&(0,t.jsx)("button",{onClick:()=>x(!0),className:"text-xs sm:text-sm text-azureBlue hover:text-azureBlue/80 font-serif",children:"+ Add optional details"}),(m||g.requiresComment)&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-inkwell mb-2 font-serif",children:g.requiresComment?"Please describe:":"Additional details (optional):"}),(0,t.jsx)("textarea",{value:d,onChange:e=>u(e.target.value.slice(0,200)),placeholder:"Provide more context...",className:"w-full p-2.5 sm:p-3 border border-inkwell/20 rounded-sm resize-none  focus:ring-2 focus:ring-azureBlue/20 focus:border-azureBlue  bg-white font-serif text-xs sm:text-sm",rows:3,maxLength:200}),(0,t.jsxs)("div",{className:"text-xs text-inkwell/50 mt-1 text-right font-sans",children:[d.length,"/200 characters"]})]})]})]})}),(0,t.jsxs)("div",{className:"flex flex-col-reverse sm:flex-row items-stretch sm:items-center justify-end gap-2 sm:gap-3 p-4 sm:p-6 border-t border-inkwell/10 bg-parchment/50 flex-shrink-0",children:[(0,t.jsx)("button",{onClick:l,className:"w-full sm:w-auto px-3 sm:px-4 py-2 text-sm text-inkwell/70 hover:bg-inkwell/5 rounded-sm transition-colors font-serif",children:"Cancel"}),(0,t.jsx)("button",{onClick:b,disabled:!w||p,className:`
5                  w-full sm:w-auto px-3 sm:px-4 py-2 rounded-sm font-medium transition-all font-serif text-sm
6                  ${w&&!p?"bg-coral text-white hover:bg-coral/90 shadow-sm":"bg-inkwell/20 text-inkwell/40 cursor-not-allowed"}
7                `,children:p?"Submitting...":"Report Issue"})]})]})]})})}var eb=e.i(7971),ew=e.i(307575);let ej=eb.default,ek=({children:e})=>(0,t.jsx)("h3",{className:"text-xs uppercase tracking-widest text-darkgray/80 mb-4",children:e}),ey=()=>{let{status:e}=(0,l.useSession)(),r=(0,I.useReaderStore)(e=>e.sessionWordClickCount);if(r<3)return null;let s=encodeURIComponent(window.location.pathname+window.location.search),n=new URLSearchParams;"authenticated"!==e&&n.set("demo","true"),s&&n.set("returnTo",s);let i=n.toString(),a=`/practice/session${i?`?${i}`:""}`;return(0,t.jsx)("div",{className:"pt-4 mt-4 border-t border-inkwell/5",children:(0,t.jsxs)(ew.default,{href:a,className:"flex items-center gap-2 text-sm text-inkwell/40 hover:text-inkwell/60 transition-colors group",children:[(0,t.jsx)(c.Dumbbell,{size:18,className:"text-marigold group-hover:text-marigold/80 flex-shrink-0"}),(0,t.jsxs)("span",{children:[r," words looked up this session — ",(0,t.jsx)("span",{className:"text-marigold group-hover:text-marigold/80",children:"take a quick practice break"}),"? You'll pick up right where you left off."]})]})})},ev=({surface:e,lemma:l,workId:s,unitNumbers:n,granularUnitPath:i,leafIdx:a,onReport:c})=>{let[d,u]=(0,r.useState)(!1),[x,p]=(0,r.useState)(!1),{success:f,error:g}=(0,h.useToast)(),b=async t=>{try{await c?.({workId:s,unitPath:i||m(n),leafIdx:a,surface:e,lemma:l,feedback:t,ts:Date.now()}),u(!0),f(h.TOAST_MESSAGES.flagged)}catch(e){throw g(h.TOAST_MESSAGES.flagError),e}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>p(!0),disabled:d,className:`p-1.5 rounded transition-colors ${d?"text-marigold/60 cursor-default":"text-inkwell/30 hover:text-coral"}`,title:d?"Reported":"Report issue",children:(0,t.jsx)(o,{size:12,className:d?"fill-current":""})}),(0,t.jsx)(eg,{isOpen:x,onClose:()=>p(!1),onSubmit:b,surface:e,lemma:l})]})},eN=({dictKey:e})=>{let{status:r}=(0,l.useSession)(),s=(0,I.useReaderStore)(t=>!!e&&!!t.userDeckMap[e]);return"authenticated"===r&&e&&s?(0,t.jsxs)(f.m.span,{className:"flex items-center gap-1 rounded-full border border-emerald/15 bg-emerald/[0.06] px-2 py-0.5 text-xs font-medium text-emerald whitespace-nowrap",initial:{opacity:0,scale:.9}
7,animate:{opacity:1,scale:1},transition:{duration:.2},children:[(0,t.jsx)(u.Check,{size:11,className:"flex-shrink-0"}),"Saved"]}):null},eC=({lemma:e,dictKey:r,surface:l,workId:s,unitNumbers:n,granularUnitPath:i,leafIdx:a,onReport:o,wordLookup:c})=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(eN,{dictKey:r}),(0,t.jsx)(ev,{surface:l,lemma:e,workId:s,unitNumbers:n,granularUnitPath:i,leafIdx:a,onReport:o})]}),eS=({definition:e,lemma:r,illustrationStatus:l,illustrationToneStyles:s,hasImage:n,handleScrollToImage:a})=>{var o;if(!e)return(0,t.jsxs)("div",{className:"py-4 px-6 bg-amber-50/30 border-l-2 border-amber-200 rounded-sm flex items-start gap-4",children:[(0,t.jsx)(i.AlertCircle,{size:18,className:"text-amber-500 mt-0.5 flex-shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-amber-700 text-sm",children:"No dictionary entry found"}),(0,t.jsx)("p",{className:"mt-1 text-amber-600/80 text-sm",children:"Our dictionary may not have an entry for this word. We made a note of it to fix it soon."})]})]});let{brief:c,meanings:d=[],phrases:u=[]}=e;return(0,t.jsxs)("div",{className:"space-y-6",children:[d.length>0&&(0,t.jsxs)("div",{className:"space-y-6 mt-1",children:[e.word&&(0,t.jsxs)("div",{className:"flex items-baseline gap-3 flex-wrap",children:[(0,t.jsx)("h4",{className:"text-2xl font-sans text-inkwell/90 tracking-wide",children:(o=e.word)?o.replace(/\^/g,""):o}),l&&(0,t.jsxs)("button",{type:"button",onClick:a,disabled:!n,className:`inline-flex items-center gap-1.5 text-xs transition-colors ${n?"text-inkwell/50 hover:text-inkwell/80":"pending"===l.tone?"text-inkwell/40":"text-inkwell/30 cursor-default"}`,children:[(0,t.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${s[l.tone].dot}`}),(0,t.jsx)("span",{className:n?"underline-offset-4 hover:underline":"",children:n?"view illustration":l.label.toLowerCase()})]})]}),c&&(0,t.jsx)("p",{className:"text-base text-inkwell/90 leading-relaxed bg-marigold/30 font-serif pl-4 border-l border-transparent",children:c}),d.map((e,r)=>(0,t.jsxs)(f.m.div,{...(0,A.slideIn)("bottom",.05*r),className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,t.jsx)("span",{className:"font-serif text-inkwell/30 text-sm",children:r+1}),(0,t.jsx)("p",{className:"text-base text-inkwell/80 font-serif leading-relaxed",children:e.def})]}),e.example?.lat&&(0,t.jsxs)("div",{className:"ml-8 pl-4 border-l-2 border-goldenrod/90 space-y-2 my-3",children:[(0,t.jsx)("p",{className:"text-sm text-inkwell/80 font-sans",children:e.example.lat}),e.example.eng&&(0,t.jsx)("p",{className:"text-xs text-inkwell/60 font-sans",children:e.example.eng})]})]},r))]}),u.length>0&&(0,t.jsxs)("div",{className:"pt-4 mt-2",children:[(0,t.jsx)(ek,{children:"Phrases & Expressions"}),(0,t.jsx)("ul",{className:"space-y-4 mt-4 pl-2",children:u.map((e,r)=>(0,t.jsxs)("li",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-sm text-inkwell/90 font-sans",children:e.lat}),(0,t.jsxs)("span",{className:"text-xs text-inkwell/60 font-sans pl-2",children:["— ",e.eng]})]},r))})]})]})},eP=({error:e,wordLookup:r})=>{let l=r?.message||e||"An error occurred while looking up the word.",s=l.toLowerCase().includes("network")||l.toLowerCase().includes("connection"),a=l.includes("don't know what this is");return(0,t.jsx)("div",{className:"flex flex-col items-center justify-center h-full px-8 py-12",children:(0,t.jsxs)(f.m.div,{className:"max-w-md w-full flex flex-col items-center text-center",...(0,A.fadeUp)(),children:[(0,t.jsx)(f.m.div,{className:`w-20 h-20 rounded-full flex items-center justify-center shadow-lg mb-6 ${a?"bg-gradient-to-br from-amber-100 to-amber-50":s?"bg-gradient-to-br from-red-100 to-red-50":"bg-gradient-to-br from-terracotta/20 to-marigold/20"}`,...(0,A.pulse)(),children:a?(0,t.jsx)(i.AlertCircle,{size:32,className:"text-amber-500"}):s?(0,t.jsx)(n.Info,{size:32,className:"text-red-500"}):(0,t.jsx)(i.AlertCircle,{size:32,className:"text-terracotta"})}),(0,t.jsx)(f.m.h2,{className:"text-xl font-sans tracking-tight text-inkwell mb-3",...(0,A.slideIn)("bottom",.1),children:a?"Lexicon Gap":s?"Connection Lost":"Analysis Failed"}),(0,t.jsx)(f.m.p,{className:"text-sm text-inkwell/60 mb-8 leading-relaxed",...(0,A.slideIn)("bottom",.2),children:a?"This word 
7isn't in our Latin dictionary yet. Even comprehensive lexicons can't capture every variant from two millennia of Latin writing.":s?"Unable to reach our morphological analysis service. Check your connection and try again.":"Our word analysis encountered an unexpected issue. This sometimes happens with proper nouns. We made a note of it to fix it."}),a&&(0,t.jsxs)(f.m.div,{className:"w-full space-y-3 mb-8",...(0,A.slideIn)("bottom",.3),children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 text-left px-4 py-3 bg-white border border-amber-200/50 rounded-lg",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-400 mt-2 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm text-inkwell/70",children:"Could be a proper name (person, place, or deity)"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3 text-left px-4 py-3 bg-white border border-amber-200/50 rounded-lg",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-400 mt-2 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm text-inkwell/70",children:"May be Medieval or post-Classical Latin"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3 text-left px-4 py-3 bg-white border border-amber-200/50 rounded-lg",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-400 mt-2 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm text-inkwell/70",children:"Might be a rare inflection or manuscript variant"})]})]}),s&&(0,t.jsx)(f.m.div,{className:"w-full mb-8",...(0,A.slideIn)("bottom",.3),children:(0,t.jsx)("div",{className:"px-5 py-4 bg-red-50/50 border border-red-200/50 rounded-lg",children:(0,t.jsx)("p",{className:"text-sm text-red-700 text-center",children:"Reconnect and select the word again to continue your analysis."})})}),!a&&!s&&(0,t.jsx)(f.m.div,{className:"w-full mb-8",...(0,A.slideIn)("bottom",.3),children:(0,t.jsx)("div",{className:"px-5 py-4 bg-terracotta/5 border border-terracotta/20 rounded-lg",children:(0,t.jsx)("p",{className:"text-sm text-terracotta/80 text-center",children:"Try a neighboring word, or refresh to reset the parser."})})}),(0,t.jsx)(f.m.p,{className:"text-xs text-inkwell/40 tracking-wide",...(0,A.slideIn)("bottom",.4),children:a?"Every reader encounters unknown vocabulary — it's part of the journey":"Our tools are constantly improving to serve Latin scholars better"})]})})},eA=({icon:e,title:r,description:l})=>(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full py-16 px-8 text-center",children:[e,(0,t.jsx)("p",{className:"text-xl text-darkgray mt-4 font-sans",children:r}),(0,t.jsx)("p",{className:"text-lg text-darkgray/80 mt-2 font-light max-w-xs",children:l})]}),eI=({dictionaryKey:e})=>{let r=(0,I.useReaderStore)(t=>e&&t.userLookupCounts[e]||0);if(!e||r<3)return null;let l=r>=5?`You've looked this up ${r} times — try the flashcard to lock it in.`:`Looked up ${r} times. It'll stick soon!`;return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md bg-amber-50 border border-amber-200/50 text-amber-800 text-xs font-sans mt-2",children:[(0,t.jsx)(c.Dumbbell,{size:14,className:"shrink-0 text-amber-600"}),(0,t.jsx)("span",{children:l})]})},eO=({surface:e,lemma:l,partOfSpeech:n,grammar:i,morphSummary:a,definition:o,dictKey:c,headerButtons:d=null,footerButtons:u=null,tokenLocation:m,wordImage:x,clusterId:p=null,sampleParadigm:h=null,genderedParadigms:g=null,principalParts:w=null,headerExtras:j=null,definitionExtras:k=null,bottomExtras:y=null})=>{let[v,N]=(0,r.useState)(!1),C=(0,r.useRef)(null),S=(0,r.useRef)(null);(0,r.useEffect)(()=>{N(!1)},[e,x?.imageUrl]),(0,r.useEffect)(()=>{let e=C.current;e&&e.complete&&e.naturalWidth>0&&N(!0)},[x?.imageUrl]);let P=x?.forSurface&&x.forSurface!==e?null:x,I=P?.imageUrl,O=P?.shouldVisualize&&!P?.imageUrl&&!P?.error,R=P&&(!1===P.shouldVisualize||P.error),M=P?.caption||(P?.reason?`Why this image: ${P.reason}`:`Illustration for ${e}`),$=M?`**Illustration** \xb7 _${M}_`:"",E=M||`Illustration for ${e}`,L=(0,r.useRef)(null),B=(0,r.useMemo)(()=>I?{label:"Illustration ready",badgeLabel:"Ready",tone:"ready"}:O?{label:"Illustration generating",badgeLabel:"Generating",tone:"pending"}:R?{label:"Illustration unavailable",badgeLabel:"Unavailable",tone:"muted"}:null,[I,O,R]),T={ready:{dot:"bg-inkwell/60",text:"text-inkwell/70"},pending:{dot:"bg-marigold/70",text:"text-inkwell/60"},muted:{dot:"bg-inkwell/25",text:"text-inkwell/45"}},_=!!B,F=R?"relative overflow-hidden rounded-lg border border-dashed border-inkwell/15 bg-inkwell/5":"relative overflow-hidden rounded-lg border border-inkwell/10 bg-gradient-to-br from-amber-50 via-white to-amber-100 shadow-sm",U=(0,r.useCallback)(()=>{L.current&&L.current.scrollIntoView({behavior:"smooth",block:"center"})},[]);return(0,t.jsxs)(f.m.div,{className:"px-5 pt-0 pb-6 md:px-8 md:pb-8 md:pt-0 font-light text-inkwell space-y-3 max-w-2xl mx-auto",initial:{opacity:0}
7,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[(0,t.jsxs)(f.m.div,{...(0,A.fade)(),className:"pb-2 space-y-3 pt-2",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-2 sm:gap-4",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)("h1",{className:"text-2xl sm:text-3xl font-sans tracking-tight text-inkwell/90 truncate",children:e})}),d]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[(0,t.jsx)("p",{className:"text-sm text-inkwell/70",children:p?a||b(n)||"Unknown part of speech":[b(n),a].filter(Boolean).join(" · ")}),(0,t.jsx)(Y,{clusterId:p,scrollTargetRef:S}),l&&l!==e&&!o?.word&&(0,t.jsxs)("span",{className:"text-sm text-inkwell/50 italic",children:["(",l.replace(/\d+$/,""),")"]})]}),j]}),(0,t.jsx)(f.m.div,{...(0,A.slideIn)("bottom",.12),className:"pb-6",children:(0,t.jsxs)("div",{className:"space-y-5 mt-0",children:[(0,t.jsx)(eS,{definition:o,lemma:l,illustrationStatus:B,illustrationToneStyles:T,hasImage:I,handleScrollToImage:U}),(0,t.jsx)(D,{clusterId:p,sampleParadigm:h,genderedParadigms:g,grammar:i,principalParts:w,scrollRef:S}),k,_&&(0,t.jsx)("figure",{className:"space-y-2",ref:L,children:(0,t.jsxs)("div",{className:"relative w-full max-w-xl",children:[(0,t.jsxs)("div",{className:F,style:{aspectRatio:"1 / 1"},children:[I?(0,t.jsx)(f.m.div,{className:"relative w-full h-full",initial:{opacity:0}
7,animate:{opacity:+!!v},transition:{duration:.4},children:(0,t.jsx)(s.default,{ref:C,src:P.imageUrl,alt:E,fill:!0,sizes:"(max-width: 768px) 90vw, 576px",quality:80,priority:!0,className:"object-contain",onLoad:()=>N(!0),unoptimized:!1})}):(0,t.jsxs)("div",{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-inkwell/50 ${O?"animate-pulse":""}`,children:[(0,t.jsx)("div",{className:`h-6 w-6 rounded-full border border-current border-t-transparent opacity-50 ${O?"animate-spin":""}`}),(0,t.jsx)("p",{className:"text-[12px] tracking-wide",children:O?"Generating illustration…":"No illustration available"})]}),B&&(0,t.jsxs)("div",{className:`absolute left-3 top-3 inline-flex items-center gap-2 rounded-full bg-white/80 backdrop-blur-sm px-3 py-1 text-[11px] shadow-sm ${T[B.tone].text}`,children:[(0,t.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${T[B.tone].dot}`}),(0,t.jsx)("span",{className:"font-medium",children:B.badgeLabel})]})]}),I&&$&&(0,t.jsx)("figcaption",{className:"pt-2",children:(0,t.jsx)(ee.default,{children:$})})]})})]})}),u&&(0,t.jsx)(f.m.div,{...A.fadeUp(.2),className:"mt-6 flex justify-end",children:u}),y]})};function eR(){let e=(0,I.useReaderStore)(e=>
7e.activeFlashcardReview),r=(0,I.useReaderStore)(e=>e.setActiveTab);return e?(0,t.jsx)("div",{className:"px-5 pt-2 sm:px-8",children:(0,t.jsxs)("button",{type:"button",onClick:()=>r("Review"),className:"inline-flex items-center gap-1.5 text-xs text-inkwell/40 hover:text-inkwell/70 transition-colors",children:[(0,t.jsx)(d.ArrowLeft,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:"Back to review"})]})}):null}function eM({wordLookup:e,isLoading:l,error:s,setSidebarOpen:i}){let a=(0,I.useReaderStore)(e=>e.clickedWord);return((0,r.useEffect)(()=>{document.querySelectorAll("[data-sidebar-scroll]").forEach(e=>{e.scrollTop=0})},[a]),l)?(0,t.jsxs)("div",{className:"h-full w-full flex flex-col",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 pt-3 pl-3 sm:pt-4 sm:pl-4 bg-gradient-to-b from-white/95 to-transparent pb-2 hidden sm:block",children:(0,t.jsx)(ej,{onClick:()=>i(!1),color:"marigold",size:"sm",className:"opacity-30 hover:opacity-100 transition-opacity","aria-label":"Close word info"})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 w-full flex items-center justify-center",children:(0,t.jsx)(Z.default,{size:"lg",color:"marigold",text:"Loading",className:"opacity-60"})},"loading")]}):s||e?.error?(0,t.jsxs)("div",{className:"h-full flex flex-col",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 pt-3 pl-3 sm:pt-4 sm:pl-4 bg-gradient-to-b from-white/95 to-transparent pb-2 hidden sm:block",children:(0,t.jsx)(ej,{onClick:()=>i(!1),color:"marigold",size:"sm",className:"opacity-30 hover:opacity-100 transition-opacity","aria-label":"Close word info"})}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eP,{error:s,wordLookup:e})})]}):e&&0!==Object.keys(e).length?(0,t.jsxs)("div",{className:"min-h-full",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 pt-3 pl-3 sm:pt-4 sm:pl-4 bg-gradient-to-b from-white/95 to-transparent pb-2 hidden sm:block",children:(0,t.jsx)(ej,{onClick:()=>i(!1),color:"marigold",size:"sm",className:"opacity-30 hover:opacity-100 transition-opacity","aria-label":"Close word info"})}),(0,t.jsx)(eR,{}),(0,t.jsx)(e$,{wordLookup:e})]}):(0,t.jsxs)("div",{className:"h-full flex flex-col",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 pt-3 pl-3 sm:pt-4 sm:pl-4 bg-gradient-to-b from-white/95 to-transparent pb-2 hidden sm:block",children:(0,t.jsx)(ej,{onClick:()=>i(!1),color:"marigold",size:"sm",className:"opacity-30 hover:opacity-100 transition-opacity","aria-label":"Close word info"})}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eA,{icon:(0,t.jsx)(n.Info,{size:50,className:"text-amber-500/60"}),title:"No word information available",description:"Select a word from the text to view its details."})})]})}function e$({wordLookup:e}){let l=(0,I.useReaderStore)(e=>e.workId),s=(0,I.useReaderStore)(e=>e.currentUnitNumbers),n=(0,I.useReaderStore)(e=>e.clickedWord),i=(0,I.useReaderStore)(e=>e.socraticQuestioningEnabled),a=(0,I.useReaderStore)(e=>e.interactiveTourActive),o=(0,I.useReaderStore)(e=>e.glossMode),c=(0,I.useReaderStore)(e=>e.wordImage),d=[];e.lemmaCandidates&&Array.isArray(e.lemmaCandidates)&&e.lemmaCandidates.length>0?d=e.lemmaCandidates:e.analyses&&Array.isArray(e.analyses)&&e.analyses.length>0?d=e.analyses:e.lemma&&(d=[{lemma:e.lemma,pos:e.partOfSpeech||"Unknown",feats:e.grammar||{}}]);let u=d[0]||{},m=u.lemma||e.lemma||"Unknown",x=u.pos||e.partOfSpeech||"Unknown",f=(0,r.useMemo)(()=>{if(u.feats&&"object"==typeof u.feats)return u.feats;let t={};return(["person","number","tense","mood","voice","gender","case","degree"].forEach(e=>{u[e]&&(t[e]=u[e])}),Object.keys(t).length>0)?t:e.grammar||{}},[u,e.grammar]),h=w(f),g=(0,r.useMemo)(()=>{if(!e.definitions||!Array.isArray(e.definitions)||0===e.definitions.length)return null;if(1===e.definitions.length)return e.definitions[0];let t=m.replace(/\d+$/,"").toLowerCase();return e.definitions.find(e=>!!(e.key===m||e.key&&"string"==typeof e.key&&e.key.startsWith(t))||!!e.normalized&&e.normalized.toLowerCase()===t)||e.definitions[0]},[e.definitions,m]),b=async({workId:e,unitPath:t,leafIdx:r,surface:l,lemma:s,feedback:n,ts:i})=>{(0,p.track)("flag-word",{workId:e,unitPath:t,leafIdx:r,surface:l,lemma:s,ts:i});let a=await fetch("/api/flag-word",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workId:e,unitPath:t,leafIdx:r,surface:l,lemma:s,feedback:n,ts:i})});if(!a.ok)throw Error("Failed to flag word");return a.json()},{clusterId:j,sampleParadigm:k,genderedParadigms:y}=C(e.dictKey??g?.key??null,{partOfSpeech:x,feats:f,surface:e.surface}),{principalParts:v,paradigm:N}=function(e){let[t,l]=(0,r.useState)(S);return(0,r.useEffect)(()=>
7{if(!e)return void l(S);let t=e.toLowerCase(),r=!1;return(function(e){let t=P.get(e);if(t)return t;let r=fetch(`/api/wiktionary?lemma=${encodeURIComponent(e)}`).then(async e=>{if(!e.ok)return S;let t=await e.json();return{principalParts:t.principalParts??null,paradigm:t.paradigm??null}}).catch(()=>(P.delete(e),S));return P.set(e,r),r})(t).then(e=>{r||l(e)}),()=>{r=!0}},[e]),t}(e.dictKey||g?.key||m),A=(0,r.useMemo)(()=>m&&"Unknown"!==m?m.replace(/\d+$/,""):g?.key?g.key:g?.lemma?g.lemma:null,[m,g]),O=(0,t.jsx)(eC,{lemma:m,dictKey:e?.dictKey,surface:e.surface,workId:l,unitNumbers:s,granularUnitPath:e?.unitPath,leafIdx:n?.leafIdx,onReport:b,wordLookup:e}),R={surface:e.surface,lemma:m,partOfSpeech:x,grammar:f,morphSummary:h,definition:g,dictKey:e.dictKey,headerButtons:O,footerButtons:null,tokenLocation:{workId:e.workId,unitPath:e.unitPath,leafIdx:e.leafIdx},wordImage:c,clusterId:j,sampleParadigm:N||k,genderedParadigms:y,principalParts:v,headerExtras:(0,t.jsx)(eI,{dictionaryKey:A}),definitionExtras:(0,t.jsx)(H,{partOfSpeech:x,grammar:f,clusterId:j}),bottomExtras:(0,t.jsx)(ey,{})};return(i||a)&&!o?(0,t.jsx)(eu,{...R,BasicWordInfo:eO}):(0,t.jsx)(eO,{...R})}function eE({noFloat:e=!1,compact:r=!1}){return(0,t.jsxs)("div",{role:"note",className:`relative inline-block -rotate-[2deg] ${e?"":"motion-safe:animate-marginalia-float"}`,children:[(0,t.jsxs)("div",{className:`relative ${r?"px-5 py-1":"px-7 py-2"}`,children:[(0,t.jsxs)("svg",{"aria-hidden":!0,viewBox:"0 0 220 70",preserveAspectRatio:"none",className:"absolute inset-0 w-full h-full text-marigold pointer-events-none",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M 18 36 C 22 12, 92 8, 112 10 C 182 12, 210 22, 200 40 C 192 58, 130 64, 88 58 C 32 52, 14 48, 18 36 Z",strokeWidth:"2.2"}),(0,t.jsx)("path",{d:"M 26 40 C 34 20, 94 14, 110 16 C 174 18, 204 28, 194 40 C 186 54, 128 58, 92 54 C 40 50, 20 46, 26 40",strokeWidth:"1.4",opacity:"0.5"})]}),(0,t.jsx)("span",{className:`relative font-logo italic ${r?"text-sm md:text-base":"text-base md:text-lg"} text-marigold whitespace-nowrap`,children:"click any word!"})]}),(0,t.jsxs)("svg",{"aria-hidden":!0,viewBox:"0 0 80 64",className:`absolute left-1/2 -translate-x-[28%] top-full -mt-1 ${r?"w-10 h-8":"w-14 h-12"} text-marigold`,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M 22 4 C 40 14, 58 10, 50 30 C 45 46, 32 48, 38 60"}),(0,t.jsx)("path",{d:"M 30 53 L 38 61 L 46 51"})]})]})}e.s(["WordDisplayPanel",0,eO,"default",()=>
7eM],152385),e.s(["ClickAnyWordMarginalia",()=>eE],932561)}]);

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.