@nexlylab/widget 1.32.16 → 1.32.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/INSTALL.txt +1 -1
  2. package/dist/runtime/{1.32.16/chunks/ClickToLoadEmbed-CVZbpoTT-CKUzZ7gL.js → 1.32.18/chunks/ClickToLoadEmbed-BLIUFZOn-BwY-LAJ8.js} +2 -2
  3. package/dist/runtime/{1.32.16/chunks/PanelInfoVideo-BKq2v0QM-BrU-Qlul.js → 1.32.18/chunks/PanelInfoVideo-BNVzih9J-BrU-Qlul.js} +1 -1
  4. package/dist/runtime/{1.32.16/chunks/assistant-link-components-DkuhHIF9-CPkAMFv6.js → 1.32.18/chunks/assistant-link-components-DUrLEPUB-DKaQavIJ.js} +2 -2
  5. package/dist/runtime/{1.32.16/chunks/assistant-link-policy-CS93s-vA-Cc-yj-a-.js → 1.32.18/chunks/assistant-link-policy-DHB-k1Aa-Cc-yj-a-.js} +1 -1
  6. package/dist/runtime/{1.32.16/chunks/block-rating-DGpoz2o3-CoiP5C2K.js → 1.32.18/chunks/block-rating-D7hR2gTc-CoiP5C2K.js} +1 -1
  7. package/dist/runtime/{1.32.16/chunks/external-url-BzUbjdMo-CJQjg_od.js → 1.32.18/chunks/external-url-qbs1SznX-CJQjg_od.js} +1 -1
  8. package/dist/runtime/{1.32.16/chunks/index-svAzoy0Y-DbuSZfeK.js → 1.32.18/chunks/index--xfG4CIn-DbuSZfeK.js} +1 -1
  9. package/dist/runtime/{1.32.16/chunks/index-CUGV3nk2-DAdxCQyi.js → 1.32.18/chunks/index-7N5M1HdS-DAdxCQyi.js} +1 -1
  10. package/dist/runtime/{1.32.16/chunks/index-SgPuWMUv-QeFj7CR9.js → 1.32.18/chunks/index-99heIIoH-QeFj7CR9.js} +1 -1
  11. package/dist/runtime/{1.32.16/chunks/index-Chn4ATvZ-CSI6_0RJ.js → 1.32.18/chunks/index-B3DeMFo7-BbdAbuAw.js} +2 -2
  12. package/dist/runtime/{1.32.16/chunks/index-fotohjEP-BLBDoJCM.js → 1.32.18/chunks/index-BIGVEl9--CSQQTbsg.js} +2 -2
  13. package/dist/runtime/{1.32.16/chunks/index-Dc8zecP4-oy07dUaV.js → 1.32.18/chunks/index-BKZyJMr2-oy07dUaV.js} +1 -1
  14. package/dist/runtime/{1.32.16/chunks/index-Dtiss_wT-CLkn_6EY.js → 1.32.18/chunks/index-BKrM_uoq-CABL-0v-.js} +2 -2
  15. package/dist/runtime/{1.32.16/chunks/index-MAmLiP1_-Dsa9X9U7.js → 1.32.18/chunks/index-BX6ig9BJ-Dsa9X9U7.js} +1 -1
  16. package/dist/runtime/{1.32.16/chunks/index-Cdmdsj1E-DP0QKkgf.js → 1.32.18/chunks/index-BZO9Qaiw-DP0QKkgf.js} +1 -1
  17. package/dist/runtime/{1.32.16/chunks/index-DchTua3m-BpgnWlB8.js → 1.32.18/chunks/index-BauMKr5c-BpgnWlB8.js} +1 -1
  18. package/dist/runtime/{1.32.16/chunks/index-CsoMgZU8-C1BzRUwZ.js → 1.32.18/chunks/index-Bf_npmqm-C1BzRUwZ.js} +1 -1
  19. package/dist/runtime/{1.32.16/chunks/index-Or6sA2eF-CiRb-0NX.js → 1.32.18/chunks/index-BtkNePSj-CiRb-0NX.js} +1 -1
  20. package/dist/runtime/{1.32.16/chunks/index-BIMK2_g0-ZRnEJoQe.js → 1.32.18/chunks/index-C1Fa-E3e-ZRnEJoQe.js} +1 -1
  21. package/dist/runtime/{1.32.16/chunks/index-CbGT4d5Q-DUgMllqN.js → 1.32.18/chunks/index-C5RVj6y1-DUgMllqN.js} +1 -1
  22. package/dist/runtime/{1.32.16/chunks/index-BLT1bBjC-6c5Ar61I.js → 1.32.18/chunks/index-CCEWGjHV-BTsOZg4v.js} +2 -2
  23. package/dist/runtime/{1.32.16/chunks/index-ChL-bSAN-BcW8HKb8.js → 1.32.18/chunks/index-CF37rhgu-BcW8HKb8.js} +1 -1
  24. package/dist/runtime/{1.32.16/chunks/index-tAu73-sK-DQBGsPwB.js → 1.32.18/chunks/index-COTfVuju-DQBGsPwB.js} +1 -1
  25. package/dist/runtime/{1.32.16/chunks/index-BJClDxSC-D6wzHiS0.js → 1.32.18/chunks/index-COfQIa8G-D6wzHiS0.js} +1 -1
  26. package/dist/runtime/{1.32.16/chunks/index-BW-8QNI--BqZmEVev.js → 1.32.18/chunks/index-CSRoJRaW-CoI3p0S7.js} +2 -2
  27. package/dist/runtime/{1.32.16/chunks/index-Dfcx_9km-C9wFr7fa.js → 1.32.18/chunks/index-CV2tGt-4-C9wFr7fa.js} +1 -1
  28. package/dist/runtime/{1.32.16/chunks/index-C5MpFJwF-BLxOZxZv.js → 1.32.18/chunks/index-CYeJYTiB-BLxOZxZv.js} +1 -1
  29. package/dist/runtime/{1.32.16/chunks/index-DL04XhIK-TEMHje2B.js → 1.32.18/chunks/index-CZ-JrY2X-TEMHje2B.js} +1 -1
  30. package/dist/runtime/{1.32.16/chunks/index-DhYv8bbj-DGasnsaZ.js → 1.32.18/chunks/index-Cd1-jHFp-Za3SKEQp.js} +2 -2
  31. package/dist/runtime/{1.32.16/chunks/index-CogJkGmU-C3bBvEcm.js → 1.32.18/chunks/index-Ce9TuEzb-C3bBvEcm.js} +1 -1
  32. package/dist/runtime/{1.32.16/chunks/index-DG-KS4AB-3B-eE3K7.js → 1.32.18/chunks/index-D1YmJ3gf-3B-eE3K7.js} +1 -1
  33. package/dist/runtime/{1.32.16/chunks/index-DO5eKOOB-Dp5AxBD4.js → 1.32.18/chunks/index-D96sEJQ6-Dp5AxBD4.js} +1 -1
  34. package/dist/runtime/{1.32.16/chunks/index-D-uANagm-DBhSkJ7i.js → 1.32.18/chunks/index-DAICBUgn-DBhSkJ7i.js} +1 -1
  35. package/dist/runtime/{1.32.16/chunks/index-BncytMlP-VhJcCfAC.js → 1.32.18/chunks/index-DATkkw3P-VhJcCfAC.js} +1 -1
  36. package/dist/runtime/{1.32.16/chunks/index-CIe60p_E-pkywvGDF.js → 1.32.18/chunks/index-DaW9uf4--pkywvGDF.js} +1 -1
  37. package/dist/runtime/{1.32.16/chunks/index-BoVToqY3-H31PHMqm.js → 1.32.18/chunks/index-DiZcd1hz-H31PHMqm.js} +1 -1
  38. package/dist/runtime/{1.32.16/chunks/index-PSL_6OT1-_M0CWPEY.js → 1.32.18/chunks/index-DuPFNKhZ-_M0CWPEY.js} +1 -1
  39. package/dist/runtime/{1.32.16/chunks/index-DdI8qMqt-Dr1V6OGz.js → 1.32.18/chunks/index-Dw7QeZq3-Dr1V6OGz.js} +1 -1
  40. package/dist/runtime/{1.32.16/chunks/index-pQ7fPgLl-JdphAk2-.js → 1.32.18/chunks/index-E59S8-Gw-CovGUxIZ.js} +2 -2
  41. package/dist/runtime/{1.32.16/chunks/index-DHdp5nGO-bdo5pwX-.js → 1.32.18/chunks/index-OcrS6o5Y-bdo5pwX-.js} +1 -1
  42. package/dist/runtime/{1.32.16/chunks/index-BCtNBIxP-CcsFQ7Dx.js → 1.32.18/chunks/index-PxSB6BA6-DFxY6dqO.js} +2 -2
  43. package/dist/runtime/{1.32.16/chunks/index-DNwWHPWp-W1lJrIDD.js → 1.32.18/chunks/index-cCAzBYyN-W1lJrIDD.js} +1 -1
  44. package/dist/runtime/{1.32.16/chunks/index-6HKNPucI-Dm9kbc85.js → 1.32.18/chunks/index-kAGaGinD-Dm9kbc85.js} +1 -1
  45. package/dist/runtime/{1.32.16/chunks/index-CISMnUXx-Aqz1AnQ5.js → 1.32.18/chunks/index-l8Oxwea3-Aqz1AnQ5.js} +1 -1
  46. package/dist/runtime/{1.32.16/chunks/index-Cmt7uZiE-R_xuAEQV.js → 1.32.18/chunks/index-oxM4Cgtc-R_xuAEQV.js} +1 -1
  47. package/dist/runtime/{1.32.16/chunks/index-Cxwd1OKy-C_0Ll4qr.js → 1.32.18/chunks/index-qN6oEHVu-C_0Ll4qr.js} +1 -1
  48. package/dist/runtime/{1.32.16/chunks/index-CIgDHLEK-I68tb-d3.js → 1.32.18/chunks/index-rblri-2U-I68tb-d3.js} +1 -1
  49. package/dist/runtime/1.32.18/chunks/index-xx1GG5d1-CW29F9vY.js +6 -0
  50. package/dist/runtime/1.32.18/nexly.js +61 -0
  51. package/dist/v1.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/runtime/1.32.16/chunks/index-Cf4eQF9g-mnUzfS1e.js +0 -6
  54. package/dist/runtime/1.32.16/nexly.js +0 -61
  55. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js +0 -0
  56. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/_commonjsHelpers-C6fGbg64-BC8KDfbh.js +0 -0
  57. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/accent-legibility-BJF2VO5n-CDPQ7suO.js +0 -0
  58. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/allowed-elements-BXnLJV1S-C-_lr2zm.js +0 -0
  59. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/block-helpers-Cg_zAqG6-DnN2COvk.js +0 -0
  60. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index-BPDIV1BN-DINkyYvc.js +0 -0
  61. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index-BcsmWDTX-Dw9WA5Ac.js +0 -0
  62. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index-C262wwK4-DpyhuXqd.js +0 -0
  63. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index-DMQkz1bV-BuMYksln.js +0 -0
  64. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index-DZADUAKv-DPfvWVuj.js +0 -0
  65. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/index.modern-CioVZ357-BA5NTOmY.js +0 -0
  66. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js +0 -0
  67. /package/dist/runtime/{1.32.16 → 1.32.18}/chunks/use-deferred-rating-XlgCUwcY-DDVOwURi.js +0 -0
@@ -1,2 +1,2 @@
1
1
  import{r as j,j as e,Q as _,o as w}from"../nexly.js";import{m as x}from"./block-helpers-Cg_zAqG6-DnN2COvk.js";const C={slug:"team-health",name:"Team Health Monitor",version:"1.0.0",category:"interactive",requiredService:"team-health",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic",readAloudEnabled:!1},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"team-health",inputSchema:{type:"object",properties:{summary:{type:"object",properties:{healthy:{type:"number"},at_risk:{type:"number"},critical:{type:"number"},total:{type:"number"}}},topAtRiskMember:{type:"object",properties:{userId:{type:"string"},userName:{type:"string"},rank:{type:"string"},healthStatus:{type:"string"},healthScore:{type:"number"},riskSignals:{type:"array",items:{type:"string"}}}},reactivationTip:{type:"string"},members:{type:"array",items:{type:"object",properties:{userId:{type:"string"},userName:{type:"string"},rank:{type:"string"},healthStatus:{type:"string"},healthScore:{type:"number"},riskSignals:{type:"array",items:{type:"string"}},teamSales:{type:"number"},personalPurchase:{type:"number"}}}},mode:{type:"string",enum:["basic","pro"]}}},previewDataOverride:{mode:"pro",summary:{healthy:4,at_risk:3,critical:1,total:8},topAtRiskMember:{userId:"preview-1",userName:"Anna Kowalska",rank:"Manager",healthStatus:"critical",healthScore:25,riskSignals:["No personal purchase","No team sales","No team built"],teamSales:0,personalPurchase:0},reactivationTip:"Check in with Anna personally — ask how she's doing with the products first before talking business. A caring message goes a long way.",members:[{userId:"preview-1",userName:"Anna Kowalska",rank:"Manager",healthStatus:"critical",healthScore:25,riskSignals:["No purchase","No sales"]},{userId:"preview-2",userName:"Piotr Nowak",rank:"Senior Manager",healthStatus:"at_risk",healthScore:55,riskSignals:["No team built"]},{userId:"preview-3",userName:"Maria Wiśniewska",rank:"Manager",healthStatus:"healthy",healthScore:85,riskSignals:[]}]}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"mode",type:"select",label:"Display mode",default:"basic",options:[{label:"Basic — traffic-light summary + top alert + AI tip",value:"basic"},{label:"Pro — full member list with health scores",value:"pro"}],group:"Display"}],events:{emits:[{name:"th:memberSelected",description:"User tapped on a team member"},{name:"th:tipCopied",description:"User copied the reactivation tip"}],listens:[{name:"th:refresh",description:"Force refresh team health data"}]}},i={healthy:"team_health.status.healthy",at_risk:"team_health.status.at_risk",critical:"team_health.status.critical"},c={healthy:"🟢",at_risk:"🟡",critical:"🔴"};function T({data:l,config:N,actions:m,metadata:k,i18n:S}){const t=S?.t??(a=>a),v=N.mode??l.mode??"basic",o=l.summary??{healthy:0,at_risk:0,critical:0,total:0},s=l.topAtRiskMember,n=l.reactivationTip,d=l.members??[],[p,u]=j.useState("idle"),[r,b]=j.useState(null);if(!o.total&&!l.error)return e.jsx(_,{blockType:"team-health",children:e.jsxs("div",{className:"es-block__body es-th__body",children:[e.jsx("div",{className:"es-th__traffic-light",role:"list","aria-label":t("team_health.summary_aria"),children:["critical","at_risk","healthy"].map(a=>e.jsxs("div",{role:"listitem",className:`es-th__tl-cell es-th__tl-cell--${a.replace("_","-")} es-th__tl-cell--empty`,children:[e.jsx("span",{className:"es-th__tl-emoji","aria-hidden":"true",children:c[a]}),e.jsx("span",{className:"es-th__tl-count",children:"0"}),e.jsx("span",{className:"es-th__tl-label",children:t(i[a])})]},a))}),e.jsx("p",{style:{fontSize:13,color:"var(--es-color-on-surface-muted, #4B5563)",margin:"8px 0 0",textAlign:"center"},children:k?.dataQuality==="none"?t("team_health.signin_prompt"):t("team_health.empty")})]})});if(l.error)return e.jsx(_,{blockType:"team-health",error:w(l.error)});async function f(){if(n)try{await navigator.clipboard.writeText(n),u("copied"),m.emit("th:tipCopied",{}),setTimeout(()=>u("idle"),2e3)}catch{}}const y=r?d.filter(a=>a.healthStatus===r):d,g=[...y].sort((a,h)=>a.healthScore-h.healthScore);return e.jsx(_,{blockType:"team-health",children:e.jsxs("div",{className:"es-block__body es-th__body",children:[e.jsx("div",{className:"es-th__traffic-light",role:"list","aria-label":t("team_health.summary_aria"),children:["critical","at_risk","healthy"].map(a=>e.jsxs("button",{role:"listitem",className:`es-th__tl-cell es-th__tl-cell--${a.replace("_","-")} ${r===a?"es-th__tl-cell--active":""}`,onClick:()=>b(r===a?null:a),"aria-pressed":r===a,"aria-label":t("team_health.status_count_aria",{status:t(i[a]),count:o[a]}),children:[e.jsx("span",{className:"es-th__tl-emoji","aria-hidden":"true",children:c[a]}),e.jsx("span",{className:"es-th__tl-count",children:o[a]}),e.jsx("span",{className:"es-th__tl-label",children:t(i[a])})]},a))}),s&&e.jsxs("div",{className:"es-th__alert-card",children:[e.jsxs("div",{className:"es-th__alert-eyebrow",children:[e.jsx("span",{"aria-hidden":"true",children:c[s.healthStatus]})," ",t("team_health.needs_attention")]}),e.jsx("div",{className:"es-th__alert-name",children:s.userName}),e.jsxs("div",{className:"es-th__alert-meta",children:[e.jsx("span",{className:`es-th__badge es-th__badge--${s.healthStatus.replace("_","-")}`,children:t(i[s.healthStatus])}),e.jsx("span",{className:"es-th__rank",children:x(s.rank,t)})]}),s.riskSignals.length>0&&e.jsx("ul",{className:"es-th__risk-signals","aria-label":t("team_health.risk_signals_aria"),children:s.riskSignals.map(a=>e.jsxs("li",{className:"es-th__risk-signal",children:[e.jsx("span",{"aria-hidden":"true",children:"⚠"})," ",a]},a))}),e.jsx("div",{className:"es-th__health-bar-wrap","aria-label":t("team_health.health_score_aria",{score:s.healthScore}),children:e.jsx("div",{className:"es-th__health-bar",style:{width:`${s.healthScore}%`}})}),n&&e.jsxs("div",{className:"es-th__tip",children:[e.jsxs("div",{className:"es-th__tip-header",children:[e.jsxs("span",{className:"es-th__ai-label",children:[e.jsx("span",{"aria-hidden":"true",children:"✨"})," ",t("team_health.ai_tip_label")]}),e.jsx("button",{className:`es-th__copy-btn${p==="copied"?" es-th__copy-btn--copied":""}`,onClick:f,"aria-label":t("team_health.copy_tip_aria"),title:t("common.copy_to_clipboard"),children:p==="copied"?"✓":"⎘"})]}),e.jsx("p",{className:"es-th__tip-text",children:n})]})]}),v==="pro"&&e.jsxs("div",{className:"es-th__member-list",children:[e.jsxs("div",{className:"es-th__member-list-header",children:[e.jsx("span",{className:"es-th__section-title",children:r?t("team_health.status_filtered",{status:t(i[r]),count:y.length}):t("team_health.all_members",{count:d.length})}),r&&e.jsx("button",{className:"es-th__clear-filter",onClick:()=>b(null),children:t("team_health.clear_filter")})]}),g.length===0?e.jsx("p",{className:"es-th__empty",children:t("team_health.empty_status")}):e.jsx("ul",{className:"es-th__members","aria-label":t("team_health.members_aria"),children:g.map(a=>e.jsxs("li",{className:"es-th__member-item",onClick:()=>m.emit("th:memberSelected",{userId:a.userId}),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),m.emit("th:memberSelected",{userId:a.userId}))},tabIndex:0,role:"button",children:[e.jsxs("div",{className:"es-th__member-header",children:[e.jsx("span",{className:"es-th__member-emoji","aria-hidden":"true",children:c[a.healthStatus]}),e.jsx("span",{className:"es-th__member-name",children:a.userName}),e.jsxs("span",{className:"es-th__member-score",children:[a.healthScore,"%"]})]}),e.jsxs("div",{className:"es-th__member-meta",children:[e.jsx("span",{className:`es-th__badge es-th__badge--${a.healthStatus.replace("_","-")}`,children:t(i[a.healthStatus])}),e.jsx("span",{className:"es-th__rank",children:x(a.rank,t)})]}),e.jsx("div",{className:"es-th__health-bar-wrap",children:e.jsx("div",{className:"es-th__health-bar",style:{width:`${a.healthScore}%`}})}),a.riskSignals.length>0&&e.jsx("p",{className:"es-th__member-signals",children:a.riskSignals.join(" · ")})]},a.userId))})]})]})})}export{T as Component,C as manifest};
2
- //# sourceMappingURL=index-Dfcx_9km-C9wFr7fa.js.map
2
+ //# sourceMappingURL=index-CV2tGt-4-C9wFr7fa.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as l,j as e,Q as d}from"../nexly.js";const b={slug:"demo-ticket-form",name:"DEMO — Report an issue",version:"0.1.0",category:"interactive",configSchema:{properties:{categories:{type:"array",items:{type:"string"},default:[]}}},defaultConfig:{categories:[]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main"]};function f(a){if(typeof a!="string")return null;const t=a.trim();if(!t||/\s/.test(t))return null;const s=t.indexOf("@");return s>0&&s<t.length-1?t:null}function g(a){return Array.isArray(a)?a.flatMap(t=>typeof t=="string"&&t.trim().length>0?[t.trim()]:[]):[]}function j({config:a,i18n:t}){const s=t?.t??(i=>i),o=g(a?.categories),n=f(a?.supportEmail),[m,u]=l.useState(o[0]??""),[c,r]=l.useState(""),[k,p]=l.useState(!1),h=c.trim().length>0,_=l.useCallback(()=>{c.trim().length!==0&&(p(!0),r(""))},[c]);return k?e.jsx(d,{blockType:"demo-ticket-form",children:e.jsx("div",{className:"es-block__body es-demoticket es-demoticket--done",children:e.jsxs("div",{className:"es-demoticket__done",children:[e.jsx("span",{className:"es-demoticket__done-mark","aria-hidden":"true",children:"✓"}),e.jsx("p",{className:"es-demoticket__done-text",children:n?s("demoTicket.sentTo",{email:n}):s("demoTicket.sent")})]})})}):e.jsx(d,{blockType:"demo-ticket-form",children:e.jsxs("div",{className:"es-block__body es-demoticket",children:[e.jsxs("div",{className:"es-demoticket__fields",children:[o.length>0&&e.jsxs("label",{className:"es-demoticket__field",children:[e.jsx("span",{className:"es-demoticket__label",children:s("demoTicket.category")}),e.jsx("select",{className:"es-demoticket__select",value:m,onChange:i=>u(i.target.value),children:o.map(i=>e.jsx("option",{value:i,children:i},i))})]}),e.jsxs("label",{className:"es-demoticket__field es-demoticket__field--grow",children:[e.jsx("span",{className:"es-demoticket__label",children:s("demoTicket.message")}),e.jsx("textarea",{className:"es-demoticket__textarea",value:c,onChange:i=>r(i.target.value),placeholder:s("demoTicket.placeholder")})]})]}),e.jsx("button",{type:"button",className:"es-demoticket__submit",onClick:_,disabled:!h,children:s("demoTicket.submit")})]})})}export{j as Component,b as manifest};
2
- //# sourceMappingURL=index-C5MpFJwF-BLxOZxZv.js.map
2
+ //# sourceMappingURL=index-CYeJYTiB-BLxOZxZv.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as o,j as e,Q as u}from"../nexly.js";const x=[{value:"post",labelKey:"social_content.type.post"},{value:"story",labelKey:"social_content.type.story"},{value:"dm",labelKey:"social_content.type.dm"},{value:"event_promo",labelKey:"social_content.type.event_promo"}],g=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"kakao",label:"KakaoTalk"},{value:"line",label:"LINE"},{value:"generic",labelKey:"social_content.platform.generic"}],G=[{value:"professional",labelKey:"social_content.tone.professional"},{value:"casual",labelKey:"social_content.tone.casual"},{value:"energetic",labelKey:"social_content.tone.energetic"},{value:"empathetic",labelKey:"social_content.tone.empathetic"}];function j(t,d){const n=g.find(m=>m.value===d);return n?.labelKey?t(n.labelKey):n?.label??d}function Q({data:t,config:d,actions:n,metadata:m,i18n:_}){const s=_?.t??(c=>c),N=d.mode??t.mode??"basic",f=t.content,k=t.contentType??"post",C=t.platform??"generic",K=t.tone??"professional",S=t.characterCount,[a,T]=o.useState(f??""),[i,w]=o.useState(k),[r,$]=o.useState(C),[p,q]=o.useState(K),[h,v]=o.useState("idle"),[l,b]=o.useState(!1),B=()=>{a&&(navigator.clipboard.writeText(a).catch(()=>{}),v("copied"),n?.emit?.("sc:contentCopied",{content:a,contentType:i,platform:r}),setTimeout(()=>v("idle"),2e3))},y=o.useCallback(async()=>{if(!(l||!n?.request)){b(!0);try{const c=await n.request("sc:regenerate",{contentType:i,platform:r,tone:p});c?.content&&(T(c.content),n?.emit?.("sc:contentGenerated",{contentType:i,platform:r,tone:p}))}finally{b(!1)}}},[l,n,i,r,p]),E=c=>{w(c),n?.emit?.("sc:typeChanged",{contentType:c})};return!a&&!t.error&&!l?e.jsx(u,{blockType:"social-content",children:e.jsxs("div",{className:"sc-block",children:[e.jsxs("div",{className:"sc-content-card",children:[e.jsxs("div",{className:"sc-content-header",children:[e.jsxs("div",{className:"sc-content-meta",children:[e.jsx("span",{className:"sc-meta-badge",children:s("social_content.type.post")}),e.jsx("span",{className:"sc-meta-badge",style:{background:"var(--es-color-success-soft, rgba(0, 103, 43, 0.15))",color:"var(--es-color-success, #00672B)"},children:s("social_content.platform.generic")})]}),e.jsxs("button",{className:"sc-btn sc-btn--primary",onClick:y,disabled:l,children:["↺ ",s("social_content.generate_content")]})]}),e.jsx("div",{className:"sc-content-body",style:{color:"var(--es-color-on-surface-muted, #4B5563)",fontStyle:"italic"},children:e.jsx("p",{className:"sc-content-text",children:m?.dataQuality==="none"?s("social_content.signin_prompt"):s("social_content.empty_cta_hint")})})]}),e.jsxs("div",{className:"sc-compliance-notice",children:[e.jsx("span",{className:"sc-compliance-icon",children:"🛡️"}),e.jsx("span",{children:s("social_content.compliance_notice_short")})]})]})}):t.error?e.jsx(u,{blockType:"social-content",children:e.jsx("p",{style:{color:"var(--es-color-error, #AD2C26)",fontSize:13},children:s("social_content.load_error")})}):e.jsx(u,{blockType:"social-content",children:e.jsxs("div",{className:"sc-block",children:[N==="pro"&&e.jsxs("div",{className:"sc-selectors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.content_type_label")}),e.jsx("div",{className:"sc-selector-row",children:x.map(c=>e.jsx("button",{className:`sc-chip${i===c.value?" sc-chip--active":""}`,onClick:()=>E(c.value),children:s(c.labelKey)},c.value))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.platform_label")}),e.jsx("div",{className:"sc-selector-row",children:g.map(c=>e.jsx("button",{className:`sc-chip${r===c.value?" sc-chip--active":""}`,onClick:()=>$(c.value),children:j(s,c.value)},c.value))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.tone_label")}),e.jsx("div",{className:"sc-selector-row",children:G.map(c=>e.jsx("button",{className:`sc-chip${p===c.value?" sc-chip--active":""}`,onClick:()=>q(c.value),children:s(c.labelKey)},c.value))})]})]}),e.jsxs("div",{className:"sc-content-card",children:[e.jsxs("div",{className:"sc-content-header",children:[e.jsxs("div",{className:"sc-content-meta",children:[e.jsx("span",{className:"sc-meta-badge",children:s(x.find(c=>c.value===i)?.labelKey??"social_content.type.post")}),e.jsx("span",{className:"sc-meta-badge",style:{background:"var(--es-color-success-soft, rgba(0, 103, 43, 0.15))",color:"var(--es-color-success, #00672B)"},children:j(s,r)}),S!==void 0&&e.jsx("span",{className:"sc-char-count",children:s("social_content.char_count",{count:a.length})})]}),e.jsxs("div",{className:"sc-actions",children:[e.jsx("button",{className:`sc-btn${h==="copied"?" sc-btn--copied":""}`,onClick:B,disabled:!a,children:h==="copied"?`✓ ${s("common.copied")}`:s("common.copy")}),e.jsx("button",{className:"sc-btn sc-btn--primary",onClick:y,disabled:l,children:l?"...":`↺ ${s("social_content.regenerate")}`})]})]}),l?e.jsxs("div",{className:"sc-generating",children:[e.jsx("div",{className:"sc-spinner"}),s("social_content.generating")]}):e.jsx("div",{className:"sc-content-body",children:e.jsx("p",{className:"sc-content-text",children:a})})]}),e.jsxs("div",{className:"sc-compliance-notice",children:[e.jsx("span",{className:"sc-compliance-icon",children:"🛡️"}),e.jsx("span",{children:s("social_content.compliance_notice_full")})]})]})})}const z={slug:"social-content",name:"Social Content Generator",version:"1.0.0",category:"interactive",requiredService:"social-content",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"social-content",inputSchema:{type:"object",properties:{content:{type:"string"},contentType:{type:"string"},platform:{type:"string"},tone:{type:"string"},mode:{type:"string"},characterCount:{type:"number"}},required:["content","mode"]}},events:{emits:[{name:"sc:contentCopied",description:"User copied generated content"},{name:"sc:contentGenerated",description:"New content was generated (after regenerate)"},{name:"sc:typeChanged",description:"User changed content type in pro mode"}]}};export{Q as Component,Q as SocialContentBlock,z as manifest};
2
- //# sourceMappingURL=index-DL04XhIK-TEMHje2B.js.map
2
+ //# sourceMappingURL=index-CZ-JrY2X-TEMHje2B.js.map
@@ -1,2 +1,2 @@
1
- import{j as e,r as g,a as As,Q as Ts,d as Ze,t as In,b as Ls,e as Ms}from"../nexly.js";import{C as $s}from"./block-rating-DGpoz2o3-CoiP5C2K.js";import{x as Rs,c as Us,s as Zn,a as Os}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{r as Bs}from"./inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js";import{X as Ds,F as Es}from"./ClickToLoadEmbed-CVZbpoTT-CKUzZ7gL.js";import{p as Ps}from"./external-url-BzUbjdMo-CJQjg_od.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-CS93s-vA-Cc-yj-a-.js";const Fs=/^[a-z0-9][a-z0-9-]*$/,Qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Le(n){if(!n)return null;const s=n.trim();if(!s)return null;if(s.startsWith("media:")){const l=s.slice(6);return Qs.test(l)?{kind:"media",mediaId:l}:null}const a=s.startsWith("icon:")?s.slice(5):s;return Fs.test(a)?{kind:"icon",slug:a}:null}const fn="media:",bn="youtube:",Ws=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Yn(n){if(!n)return null;const s=n.trim();if(s.startsWith(fn)){const a=s.slice(fn.length);return Ws.test(a)?{kind:"image",ref:`${fn}${a}`,mediaId:a}:null}if(s.startsWith(bn)){const a=s.slice(bn.length);return Es(a)?{kind:"youtube",ref:`${bn}${a}`,id:a}:null}return null}const xl={slug:"learning",name:"Learning",version:"1.0.0",category:"interactive",requiredService:"learning",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},title:{type:"string",default:""},showExplanations:{type:"boolean",default:!0},showBrowse:{type:"boolean",default:!0},showDashboard:{type:"boolean",default:!0},showProgress:{type:"boolean",default:!1},showNews:{type:"boolean",default:!0}}},defaultConfig:{readAloudEnabled:!1,title:"",showExplanations:!0,showBrowse:!0,showDashboard:!0,showProgress:!1,showNews:!0},dataContract:{serviceSlug:"learning",inputSchema:{type:"object",properties:{mode:{type:"string",description:"placement_quiz | section_quiz | checking_question | new_information | nothing"},quizId:{type:"string",description:"Set for placement_quiz / section_quiz"},questionId:{type:"string",description:"Set for checking_question"},lessonId:{type:"string",description:"Set for new_information / checking_question"},topicId:{type:"string",description:"Set for new_information / section_quiz"},reason:{type:"string",description:"Set for mode=nothing: no_curriculum | all_mastered | all_in_cooldown"}},required:["mode"]},previewDataOverride:{mode:"nothing",reason:"all_in_cooldown"}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"title",type:"localized-text",label:"Heading",default:"",placeholder:'Leave empty to use the translated default ("Learning")',group:"Content"},{id:"showExplanations",type:"toggle",label:"Show explanations after answering",default:!0,group:"Behavior"},{id:"showBrowse",type:"toggle",label:"Offer the browsing sections (Topics, Dashboard, Progress)",default:!0,group:"Sections"},{id:"showDashboard",type:"toggle",label:"Show the Dashboard section (streak, progress, what to pick up)",default:!0,group:"Sections"},{id:"showProgress",type:"toggle",label:"Show the Progress section (mastery by topic, quiz history)",default:!1,group:"Sections"},{id:"showNews",type:"toggle",label:"Show the News section (published feed items, with an unread badge)",default:!0,group:"Sections"}],events:{emits:[{name:"learning:answerSubmitted",description:"Learner answered a question"},{name:"learning:quizCompleted",description:"Learner finished a quiz attempt"},{name:"learning:lessonSkipped",description:"Learner declared a lesson already known"}],listens:[{name:"learning:reload",description:"Re-fetch the current assignment"}]},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main"]},Xn=g.createContext(null),Gs=({children:n})=>e.jsx("span",{className:"es-learning__md-link",children:n}),Js=({node:n,...s})=>e.jsx("div",{className:"es-learning__md-tablewrap",children:e.jsx("table",{...s})}),Vs=({node:n,type:s,checked:a,...l})=>s==="checkbox"?e.jsx("input",{...l,type:"checkbox",checked:!!a,disabled:!0,readOnly:!0}):null,Hs=()=>null,Ks=({src:n,alt:s})=>{const a=g.useContext(Xn);if(!a)return null;const{media:l,t:r}=a,t=Yn(typeof n=="string"?n:void 0),_=t?l[t.ref]:void 0,j=(s??"").trim();return _?_.kind==="image"?e.jsx("img",{className:"es-learning__media-img",src:_.url,alt:j||r("learning.media_image_alt"),loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx(Ds,{embed:{provider:_.provider,id:_.id},t:r,classPrefix:"es-learning",posterUrl:_.posterUrl},`${_.provider}:${_.id}`):e.jsx("span",{className:"es-learning__media-missing",children:j||r("learning.media_unavailable")})},Zs=({node:n,children:s,...a})=>{const l=n?.children;return l!==void 0&&l.length>0&&l.every(r=>r.type==="element"&&r.tagName==="img"||r.type==="text"&&!(r.value??"").trim())&&l.some(r=>r.type==="element")?e.jsx(e.Fragment,{children:s}):e.jsx("p",{...a,children:s})},es={...Bs,a:Gs,table:Js,input:Vs},Ys={...es,img:Hs},Xs={...es,img:Ks,p:Zs},ea=[...Zn],na=[...Zn,"img"],sa=n=>Os(n)??"",aa=()=>"",la=n=>Yn(n)?n:"";function ns(n,s,a,l){return e.jsx("div",{className:"es-learning__md",children:e.jsx(Rs,{remarkPlugins:[...Us],allowedElements:s,transformLinkUri:sa,transformImageUri:a,components:l,children:n})})}function zn({children:n}){return n?.trim()?ns(n,ea,aa,Ys):null}function ss({children:n,media:s,t:a}){const l=g.useMemo(()=>({media:s??{},t:a}),[s,a]);return n?.trim()?e.jsx(Xn.Provider,{value:l,children:ns(n,na,la,Xs)}):null}function se({graphicRef:n,graphicAlt:s,graphicUrl:a,variant:l,done:r}){const t=Le(n);if(!t)return null;const _=["es-learning__graphic",l?`es-learning__graphic--${l}`:"",r?"es-learning__graphic--done":""].filter(Boolean).join(" ");if(t.kind==="media")return a?e.jsx("div",{className:`${_} es-learning__graphic--image`,children:e.jsx("img",{src:a,alt:s??"",className:"es-learning__graphic-img",loading:"lazy","data-testid":"learning-graphic-image"})}):null;const j=Ze(t.slug);return j?e.jsx("div",{className:_,role:s?"img":"presentation","aria-label":s??void 0,"data-testid":"learning-graphic-icon",children:e.jsx(j,{size:40})}):null}function as(n,s){const a=Le(n);return a?a.kind==="media"?!!s:!!Ze(a.slug):!1}function ls(n,s){return Le(n)?.kind==="media"&&!!s}function is({topicTitle:n,onBackToTopic:s,t:a}){return s?e.jsxs("button",{type:"button",className:"es-learning__eyebrow es-learning__eyebrow--back",onClick:s,"aria-label":a("learning.back_to_topic",{topic:n}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),n]}):e.jsx("p",{className:"es-learning__eyebrow",children:n})}const Q=n=>({width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0});function ia({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m15.5 8.5-2 5.5-5.5 2 2-5.5z"})]})}function Qn({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5V12l3 2"})]})}function ta({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M8 4h8v4a4 4 0 0 1-8 0z"}),e.jsx("path",{d:"M8 5H5.5a2.5 2.5 0 0 0 2.5 4M16 5h2.5a2.5 2.5 0 0 1-2.5 4"}),e.jsx("path",{d:"M12 12v4M9 20h6M10 20a2 2 0 0 1 4 0"})]})}function ra({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M4 5h16M4 12h16M4 19h16"}),e.jsx("path",{d:"M7 5v7M12 12v7",opacity:"0.45"})]})}function oa({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 3v5h5"}),e.jsx("path",{d:"m9.5 12.5 5 5m0-5-5 5"})]})}function He({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M19 12H5m0 0 6-6m-6 6 6 6"})})}function fe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M5 12h14m0 0-6-6m6 6-6 6"})})}function oe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m5 13 4 4L19 7"})})}function Te({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function qn({size:n=16}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.3"}),e.jsx("path",{d:"M12 17h.01"})]})}function Wn({size:n=14}){return e.jsxs("svg",{...Q(n),children:[e.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]})}function Cn({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m9 6 6 6-6 6"})})}function ca({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 6.5C10.5 5 8.5 4.5 4 4.5v13c4.5 0 6.5.5 8 2 1.5-1.5 3.5-2 8-2v-13c-4.5 0-6.5.5-8 2Z"}),e.jsx("path",{d:"M12 6.5v13"})]})}function da({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})}function ua({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"m4 11 8-6 8 6"}),e.jsx("path",{d:"M6 10v9h12v-9"})]})}function ga({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M5 19V10M12 19V5M19 19v-6"})})}function _a({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M12 3c1 3-2 4-2 7a3 3 0 0 0 6 0c0-1.5-1-2-1-3.5 1.5 1 2.5 3 2.5 5A5.5 5.5 0 0 1 12 21a5.5 5.5 0 0 1-5-7.5C7.5 10 9 7 12 3Z"})})}function pa({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4 5h13v14H6a2 2 0 0 1-2-2Z"}),e.jsx("path",{d:"M17 8h3v9a2 2 0 0 1-2 2h-1"}),e.jsx("path",{d:"M7 9h7"}),e.jsx("path",{d:"M7 12.5h7"}),e.jsx("path",{d:"M7 16h4"})]})}function ts({size:n=14}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function rs({lesson:n,busy:s,onDone:a,doneLabel:l,doneGoesBack:r=!1,onBackToTopic:t,rating:_,readAloud:j,readAloudRef:o,t:x}){return e.jsxs("section",{className:"es-learning__lesson","aria-label":x("learning.lesson_aria"),children:[e.jsxs("div",{className:"es-learning__lesson-readable",ref:o,children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:t,t:x}),e.jsx("h4",{className:"es-learning__lesson-title",children:n.title}),e.jsx(se,{graphicRef:n.graphicRef,graphicAlt:n.graphicAlt,graphicUrl:n.graphicUrl}),e.jsx(ss,{media:n.media,t:x,children:n.body})]}),j&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:j}),_,e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:a,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),x("learning.loading")]}):e.jsxs(e.Fragment,{children:[r&&e.jsx(He,{}),l??x("learning.lesson_done"),!r&&e.jsx(fe,{})]})})]})}const os={owl:({size:n})=>e.jsx(Ms,{size:n})};function ha(n){return typeof n=="string"&&n in os?n:"none"}function Ne({name:n,size:s=56,className:a}){const l=n==="none"?void 0:os[n];return l?e.jsx("span",{className:["es-learning__mascot",a].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(l,{size:s})}):null}function Gn({lessonTitle:n,topicTitle:s,newTopic:a=!1,graphicRef:l,graphicAlt:r,graphicUrl:t,slideCount:_,mascot:j,busy:o,onStart:x,onBackToTopic:b,t:p}){const f=!!l,m=p(a?"learning.new_topic_title":"learning.new_lesson_title");return e.jsxs("section",{className:`es-learning__intro${f?" es-learning__intro--illustrated":""}${a?" es-learning__intro--topic":""}`,"aria-label":m,children:[f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-learning__intro-say",children:[e.jsx(Ne,{name:j,size:30}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx(se,{graphicRef:l,graphicAlt:r,graphicUrl:t})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{name:j,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx("p",{className:"es-learning__intro-lesson",children:a?s:n}),b&&!a?e.jsxs("button",{type:"button",className:"es-learning__intro-note es-learning__intro-note--back",onClick:b,"aria-label":p("learning.back_to_topic",{topic:s}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),s]}):e.jsx("p",{className:"es-learning__intro-note",children:a?n:s}),typeof _=="number"&&_>0&&e.jsx("p",{className:"es-learning__intro-meta",children:p("learning.slide_count",{total:_})}),e.jsx("div",{className:"es-learning__intro-foot",children:e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:x,disabled:o,children:[p(a?"learning.start_new_topic":"learning.start_lesson"),e.jsx(fe,{})]})})]})}function ma({topicTitle:n,topicComplete:s,mascot:a,busy:l,onStart:r,onSkip:t,t:_}){const j=g.useRef(null);g.useEffect(()=>{j.current?.focus({preventScroll:!0})},[]);const o=_(s?"learning.section_quiz_title_complete":"learning.section_quiz_title");return e.jsxs("section",{className:"es-learning__intro","aria-label":o,children:[e.jsx(Ne,{name:a,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:o}),e.jsx("p",{className:"es-learning__intro-lesson",children:n}),e.jsx("p",{className:"es-learning__intro-note",children:_("learning.section_quiz_note")}),e.jsxs("div",{className:"es-learning__intro-foot",children:[e.jsxs("button",{ref:j,type:"button",className:"es-learning__btn es-learning__btn--block",onClick:r,disabled:l,children:[_("learning.section_quiz_start"),e.jsx(fe,{})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost",onClick:t,disabled:l,children:_("learning.section_quiz_skip")})]})]})}function wn({quiz:n,isPlacement:s,eyebrow:a,topics:l,results:r,busy:t,mascot:_,onAnswer:j,onAnswerOpen:o,onFinish:x,onBackToLesson:b,onChooseTopic:p,onContinue:f,continueLabel:m,t:w}){const q=g.useMemo(()=>n.questions??(n.question?[n.question]:[]),[n.questions,n.question]),v=!!n.questions,[I,P]=g.useState(!s||n.answered>0),[T,K]=g.useState(n.answers??{}),[u,E]=g.useState(()=>new Set(n.answeredIds??[])),[G,Z]=g.useState({}),[be,F]=g.useState({}),[L,B]=g.useState(()=>{if(!n.questions)return 0;const k=new Set(n.answeredIds??Object.keys(n.answers??{})),A=n.questions.findIndex(he=>!k.has(he.questionId));return A===-1?Math.max(0,n.questions.length-1):A});if(r)return e.jsx(ja,{results:r,questions:q,mascot:_,onContinue:f,continueLabel:m,t:w});if(!I)return e.jsxs("section",{className:"es-learning__intro","aria-label":w("learning.placement_intro_title"),children:[_!=="none"?e.jsx(Ne,{name:_,size:64}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:e.jsx(ia,{size:32})}),e.jsx("h4",{className:"es-learning__intro-title",children:w("learning.placement_intro_title")}),e.jsx("p",{className:"es-learning__intro-body",children:w("learning.placement_intro_body",{total:n.total})}),e.jsx("p",{className:"es-learning__intro-note",children:w("learning.placement_intro_note")}),l.length>0&&p&&e.jsxs("div",{className:"es-learning__topics",children:[e.jsx("p",{className:"es-learning__hint",children:w("learning.choose_topic")}),e.jsx("div",{className:"es-learning__topic-list",children:l.map(k=>e.jsx("button",{type:"button",className:"es-learning__topic",onClick:()=>p(k.topicId),disabled:t,children:k.title},k.topicId))})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:()=>P(!0),disabled:t,children:w("learning.placement_start")})]});const J=q[L];if(!J)return e.jsx("p",{className:"es-learning__hint",children:w("learning.quiz_finished")});const _e=k=>T[k]!==void 0||u.has(k)||(G[k]??"").trim().length>0,Xe=q.filter(k=>_e(k.questionId)).length,ve=T[J.questionId],Y=J.options===null,V=L===q.length-1,ae=q.every(k=>_e(k.questionId)),we=Object.fromEntries(q.filter(k=>_e(k.questionId)).map(k=>[k.questionId,0])),U=J.questionId;function X(k){K(A=>({...A,[U]:k})),j(U,k)}async function pe(){const k=(G[U]??"").trim();return!Y||!k||!o||u.has(U)&&be[U]===k?!0:await o(U,k)?(E(A=>new Set(A).add(U)),F(A=>({...A,[U]:k})),!0):!1}async function H(){await pe()&&B(k=>Math.min(q.length-1,k+1))}async function ke(){await pe()&&x()}return e.jsxs("section",{className:"es-learning__quiz","aria-label":w("learning.quiz_aria"),children:[b&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:b,children:["← ",w("learning.back_to_lesson")]}),s&&e.jsx("p",{className:"es-learning__eyebrow",children:w("learning.placement_intro")}),e.jsx("h4",{className:"es-learning__lesson-title",children:a??n.title}),e.jsx(xa,{total:q.length,currentIndex:L,answeredIds:we,questions:q,answeredCount:Xe,onJump:v?B:void 0,t:w}),e.jsx("p",{className:"es-learning__prompt",children:J.prompt}),Y?e.jsxs("div",{className:"es-learning__open",children:[e.jsx("textarea",{className:"es-learning__textarea",value:G[U]??"",onChange:k=>Z(A=>({...A,[U]:k.target.value})),placeholder:w("learning.open_answer_placeholder"),"aria-label":w("learning.open_answer_aria"),rows:5,disabled:t}),e.jsx("p",{className:"es-learning__hint",children:w("learning.open_answer_hint")})]}):null,!Y&&e.jsx("div",{className:"es-learning__options",role:"radiogroup","aria-label":w("learning.options_aria"),children:(J.options??[]).map((k,A)=>e.jsxs("label",{className:`es-learning__option${ve===A?" es-learning__option--selected":""}`,children:[e.jsx("input",{type:"radio",name:`learning-option-${J.questionId}`,checked:ve===A,onChange:()=>X(A),disabled:t}),e.jsx("span",{className:"es-learning__option-letter",children:String.fromCharCode(65+A)}),e.jsx("span",{className:"es-learning__option-text",children:k})]},A))}),e.jsxs("footer",{className:"es-learning__actions",children:[v?e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>B(k=>Math.max(0,k-1)),disabled:t||L===0,children:[e.jsx(He,{}),w("learning.previous_question")]}):e.jsx("span",{}),V?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{ke()},disabled:t||!ae,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):w("learning.finish_quiz")}):e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{H()},disabled:t||!_e(U),children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):e.jsxs(e.Fragment,{children:[w("learning.next_question"),e.jsx(fe,{})]})})]})]})}function xa({total:n,currentIndex:s,answeredIds:a,questions:l,answeredCount:r,onJump:t,t:_}){return e.jsxs("div",{className:"es-learning__progress",children:[e.jsx("div",{className:"es-learning__track",children:l.map((j,o)=>{const x=["es-learning__seg",a[j.questionId]!==void 0?"es-learning__seg--done":"",o===s?"es-learning__seg--current":""].filter(Boolean).join(" ");return t?e.jsx("button",{type:"button",className:x,onClick:()=>t(o),"aria-label":_("learning.go_to_question",{n:o+1}),"aria-current":o===s?"step":void 0},j.questionId):e.jsx("span",{className:x},j.questionId)})}),e.jsxs("span",{className:"es-learning__progress-count",children:[r,"/",n]})]})}function ja({results:n,questions:s,mascot:a,onContinue:l,continueLabel:r,t}){const _=n.total>0?Math.round(n.correct/n.total*100):0,j=(o,x)=>s.find(b=>b.questionId===o)?.prompt??x;return e.jsxs("section",{className:"es-learning__results","aria-label":t("learning.results_aria"),children:[e.jsxs("div",{className:"es-learning__score",children:[e.jsx(Ne,{name:a,size:28,className:"es-learning__mascot--score"}),e.jsxs("span",{className:"es-learning__score-value",children:[n.correct,"/",n.total]}),e.jsx("div",{className:"es-learning__score-bar",style:{"--es-learning-score":`${_}`},role:"img","aria-label":t("learning.quiz_result",{correct:n.correct,total:n.total})})]}),typeof n.passed=="boolean"&&typeof n.passPercent=="number"&&e.jsx("p",{className:`es-learning__pass es-learning__pass--${n.passed?"yes":"no"}`,children:t(n.passed?"learning.section_quiz_passed":"learning.section_quiz_failed",{percent:n.passPercent})}),n.rows&&n.rows.length>0&&e.jsx("ol",{className:"es-learning__review",children:n.rows.map(o=>e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${o.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:o.verdict==="correct"?e.jsx(oe,{}):o.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:j(o.questionId,o.prompt)}),(()=>{const x=o.answerText??(o.selectedOptionIndex!==null?o.options?.[o.selectedOptionIndex]??null:null);return x?e.jsx("p",{className:"es-learning__review-answer",children:t("learning.your_answer",{answer:x})}):null})(),o.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:o.feedback}),o.verdict!=="correct"&&o.correctAnswer&&e.jsx("p",{className:"es-learning__review-correct",children:t("learning.correct_answer",{answer:o.correctAnswer})}),o.explanation&&e.jsx(zn,{children:o.explanation})]})]},o.questionId))}),l&&e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:l,children:[r??t("learning.continue"),e.jsx(fe,{})]})]})}function fa({prompt:n,lessonTitle:s,answer:a,feedback:l,busy:r,showExplanations:t,onChange:_,onSubmit:j,t:o}){return e.jsxs("section",{className:"es-learning__question","aria-label":o("learning.question_aria"),children:[e.jsx("p",{className:"es-learning__eyebrow",children:s}),e.jsx("p",{className:"es-learning__prompt",children:n}),l?e.jsx(ba,{feedback:l,showExplanations:t,t:o}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:"es-learning__textarea",rows:5,value:a,onChange:x=>_(x.target.value),placeholder:o("learning.open_answer_placeholder"),"aria-label":o("learning.open_answer_aria"),disabled:r}),e.jsx("footer",{className:"es-learning__actions es-learning__actions--end",children:e.jsx("button",{type:"button",className:"es-learning__btn",onClick:j,disabled:r||!a.trim(),children:o(r?"learning.checking":"learning.submit_answer")})})]})]})}function ba({feedback:n,showExplanations:s,t:a}){const l=n.verdict==="correct"?e.jsx(oe,{size:18}):n.verdict==="wrong"?e.jsx(Te,{size:18}):e.jsx(qn,{size:18}),r=n.verdict==="correct"?a("learning.verdict_correct"):n.verdict==="wrong"?a("learning.verdict_wrong"):a("learning.verdict_ungradeable");return e.jsxs("div",{className:`es-learning__feedback es-learning__feedback--${n.verdict}`,role:"status",children:[e.jsxs("p",{className:"es-learning__verdict",children:[e.jsx("span",{className:"es-learning__verdict-icon","aria-hidden":"true",children:l}),r]}),n.feedback&&e.jsx("p",{className:"es-learning__feedback-text",children:n.feedback}),s&&n.explanation&&e.jsx(zn,{children:n.explanation})]})}const wa={all_in_cooldown:e.jsx(Qn,{}),not_due_yet:e.jsx(Qn,{}),all_mastered:e.jsx(ta,{}),no_curriculum:e.jsx(ra,{}),unavailable:e.jsx(oa,{})},Na={all_in_cooldown:{title:"learning.empty_cooldown_title",body:"learning.empty_cooldown"},not_due_yet:{title:"learning.next_lesson_title",body:"learning.next_lesson_body"},all_mastered:{title:"learning.empty_all_mastered_title",body:"learning.empty_all_mastered"},no_curriculum:{title:"learning.empty_no_curriculum_title",body:"learning.empty_no_curriculum"},unavailable:{title:"learning.unavailable_title",body:"learning.unavailable"}},va=new Set(["all_in_cooldown","all_mastered","not_due_yet"]);function ka(n){const[s,a]=g.useState(()=>Date.now());if(g.useEffect(()=>{if(!n)return;const t=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(t)},[n]),!n)return null;const l=new Date(n).getTime();if(!Number.isFinite(l))return null;const r=Math.max(0,Math.ceil((l-s)/6e4));return{hours:Math.floor(r/60),minutes:r%60}}function kn({kind:n,mascot:s,nextDueAt:a,t:l}){const{title:r,body:t}=Na[n],_=s!=="none"&&va.has(n),j=ka(n==="not_due_yet"?a:void 0);return e.jsxs("div",{className:`es-learning__state es-learning__state--${n}`,role:"status",children:[_?e.jsx(Ne,{name:s}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:wa[n]}),e.jsx("p",{className:"es-learning__state-title",children:l(r)}),e.jsx("p",{className:"es-learning__state-body",children:l(t)}),j&&e.jsx("p",{className:"es-learning__countdown",children:j.hours>0?l("learning.next_lesson_in_hm",{hours:j.hours,minutes:j.minutes}):l("learning.next_lesson_in_m",{minutes:j.minutes})})]})}function cs({lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:t,onDone:_,doneLabel:j,doneGoesBack:o=!1,onBackToTopic:x,rating:b,readAloud:p,readAloudRef:f,t:m}){const w=n.slides??[],q=w.length,v=w[s];if(!v)return null;const I=v.check??null,P=l[v.id],T=!I||P!==void 0,K=s===q-1;return e.jsxs("section",{className:"es-learning__lesson","aria-label":m("learning.lesson_aria"),children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:x,t:m}),e.jsx("div",{className:"es-learning__slide-dots","aria-hidden":"true",children:w.map((u,E)=>e.jsx("span",{className:`es-learning__slide-dot${E<=s?" es-learning__slide-dot--on":""}`},u.id))}),e.jsx(se,{graphicRef:v.graphicRef??n.graphicRef,graphicAlt:v.graphicAlt??n.graphicAlt,graphicUrl:v.graphicUrl??n.graphicUrl}),e.jsxs("div",{className:"es-learning__lesson-readable",ref:f,children:[e.jsx("h4",{className:"es-learning__lesson-title",style:{fontSize:16},children:v.title}),e.jsx(ss,{media:n.media,t:m,children:v.body})]}),p&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:p}),I&&e.jsxs("div",{className:`es-learning__slide-check${T?P===I.correctIndex?" es-learning__slide-check--good":" es-learning__slide-check--bad":""}`,children:[e.jsx("p",{className:"es-learning__slide-check-prompt",children:I.prompt}),e.jsx("div",{className:"es-learning__slide-check-options",children:I.options.map((u,E)=>{const G=P===E,Z=E===I.correctIndex,be=["es-learning__slide-choice",T&&G&&Z?"es-learning__slide-choice--good":"",T&&G&&!Z?"es-learning__slide-choice--bad":"",T&&Z&&!G?"es-learning__slide-choice--reveal":""].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",className:be,disabled:T||t,onClick:()=>r(v.id,E),children:[T&&G&&e.jsx("span",{className:"es-learning__slide-choice-icon","aria-hidden":"true",children:Z?e.jsx(oe,{size:14}):e.jsx(Te,{size:14})}),e.jsx("span",{children:u})]},E)})}),T&&e.jsx("p",{className:`es-learning__slide-check-fb${P===I.correctIndex?" es-learning__slide-check-fb--good":" es-learning__slide-check-fb--bad"}`,children:P===I.correctIndex?I.feedbackCorrect:I.feedbackIncorrect})]}),e.jsxs("div",{className:"es-learning__deck-foot",children:[K&&T&&b,!T&&e.jsx("p",{className:"es-learning__hint",children:m("learning.slide_check_required")}),e.jsxs("footer",{className:"es-learning__actions es-learning__actions--captioned",children:[e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>a(s-1),disabled:t||s===0,children:[e.jsx(He,{}),m("learning.previous_question")]}),e.jsx("p",{className:"es-learning__slide-caption",children:m("learning.slide_caption",{n:s+1,total:q})}),K?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:_,disabled:t||!T,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),m("learning.loading")]}):e.jsxs(e.Fragment,{children:[o&&e.jsx(He,{}),j??m("learning.lesson_done"),!o&&e.jsx(fe,{})]})}):e.jsxs("button",{type:"button",className:"es-learning__btn",onClick:()=>a(s+1),disabled:t||!T,children:[m("learning.next_question"),e.jsx(fe,{})]})]})]})]})}function ya({rows:n,t:s}){const[a,l]=g.useState(!1);if(n.length===0)return e.jsx("p",{className:"es-learning__hint",children:s("learning.review_unavailable")});const r=n.filter(t=>t.verdict==="correct").length;return e.jsxs("div",{className:"es-learning__review-block",children:[e.jsxs("button",{type:"button",className:`es-learning__review-toggle${a?" es-learning__review-toggle--open":""}`,"aria-expanded":a,onClick:()=>l(t=>!t),children:[e.jsx("span",{className:"es-learning__review-heading",children:s("learning.your_answers")}),e.jsx("span",{className:"es-learning__review-score",children:s("learning.review_score",{correct:r,total:n.length})}),e.jsx("span",{className:"es-learning__review-chevron","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]}),a?e.jsx("ol",{className:"es-learning__review",children:n.map(t=>{const _=t.answerText??(t.selectedOptionIndex!==null?t.options?.[t.selectedOptionIndex]??null:null);return e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${t.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:t.verdict==="correct"?e.jsx(oe,{}):t.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:t.prompt}),t.options&&t.options.length>0?e.jsx("ul",{className:"es-learning__review-options",children:t.options.map((j,o)=>{const x=o===t.selectedOptionIndex,b=t.correctAnswer!==null&&j===t.correctAnswer;return e.jsxs("li",{className:`es-learning__review-option es-learning__review-option--${b?"correct":x?"picked":"plain"}`,children:[e.jsx("span",{className:"es-learning__review-option-mark","aria-hidden":"true",children:b?e.jsx(oe,{size:12}):x?e.jsx(Te,{size:12}):null}),e.jsx("span",{className:"es-learning__review-option-text",children:j}),(x||b)&&e.jsx("span",{className:"es-learning__review-option-tag",children:s(x?"learning.answer_tag_yours":"learning.answer_tag_correct")})]},o)})}):e.jsxs("div",{className:"es-learning__review-pair",children:[_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_yours")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--yours",children:_})]}),t.verdict!=="correct"&&t.correctAnswer&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_correct")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--correct",children:t.correctAnswer})]})]}),t.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:t.feedback}),t.explanation&&e.jsx(zn,{children:t.explanation})]})]},t.questionId)})}):null]})}function Jn({lesson:n,slideIndex:s,onSlideIndexChange:a,slideAnswers:l,onSlideAnswer:r,onBack:t,backLabel:_,showBackLink:j=!0,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,onFinish:f,finishLabel:m,review:w,t:q}){const v=(n.slides?.length??0)>0,I=f??t,P=f?m??_:_,T=!!o&&!f;return e.jsxs("div",{className:`es-learning__reader${w?" es-learning__reader--reviewed":""}`,children:[j&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,children:["← ",_]}),v?e.jsx(cs,{lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}):e.jsx(rs,{lesson:n,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}),w&&e.jsx(ya,{rows:w,t:q})]})}function Ia({graphicRef:n,graphicUrl:s,graphicAlt:a,done:l}){const r=Le(n);if(!r)return null;const t=l?" es-learning__lesson-thumb--done":"";if(r.kind==="media")return s?e.jsx("img",{src:s,alt:a??"",loading:"lazy",className:`es-learning__lesson-thumb es-learning__lesson-thumb--image${t}`,"data-testid":"lesson-thumb-image"}):null;const _=Ze(r.slug);return _?e.jsx("span",{className:`es-learning__lesson-thumb${t}`,"aria-hidden":"true","data-testid":"lesson-thumb-icon",children:e.jsx(_,{size:20})}):null}function Sn({iconRef:n,iconUrl:s}){const a=Le(n);if(!a)return null;if(a.kind==="media")return s?e.jsx("img",{src:s,alt:"","aria-hidden":"true",loading:"lazy",className:"es-learning__topic-icon es-learning__topic-icon--image","data-testid":"topic-icon-image"}):null;const l=Ze(a.slug);return l?e.jsx("span",{className:"es-learning__topic-icon","aria-hidden":"true","data-testid":"topic-icon",children:e.jsx(l,{size:16})}):null}function ds({topics:n,onOpen:s,t:a}){return n.length===0?e.jsx("p",{className:"es-learning__hint",children:a("learning.empty_no_curriculum")}):e.jsx("section",{className:"es-learning__topics-view","aria-label":a("learning.nav_topics"),children:e.jsx("ul",{className:"es-learning__topic-cards",children:n.map(l=>{const r=l.lessonCount>0?Math.round(l.doneCount/l.lessonCount*100):0,t=l.doneCount===l.lessonCount&&l.lessonCount>0,_=as(l.heroRef,l.heroUrl);return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__topic-card",onClick:()=>s(l.topicId),children:[e.jsx(se,{graphicRef:l.heroRef,graphicAlt:l.heroAlt,graphicUrl:l.heroUrl,done:t}),e.jsxs("span",{className:"es-learning__topic-card-head",children:[!_&&e.jsx(Sn,{iconRef:l.iconRef,iconUrl:l.iconUrl}),e.jsx("span",{className:"es-learning__topic-card-title",children:l.title}),t&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${r}%`}})}),e.jsx("span",{className:"es-learning__topic-card-meta",children:a("learning.topic_progress",{mastered:l.doneCount,total:l.lessonCount})})]})},l.topicId)})})})}const Ve=["basics","intermediate","advanced","expert"],za={basics:"learning.level_basics",intermediate:"learning.level_intermediate",advanced:"learning.level_advanced",expert:"learning.level_expert"};function qa({level:n,t:s}){const a=Ve.indexOf(n)+1,l=Ve.length;return e.jsx("span",{className:"es-learning__level-stars",role:"img","aria-label":s("learning.level_difficulty",{n:a,total:l}),"data-testid":"learning-level-stars",children:Ve.map((r,t)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__level-star${t<a?" es-learning__level-star--on":""}`,children:"★"},t))})}const Ke=n=>n.lessonCount>0&&n.doneCount===n.lessonCount;function Ca({tracks:n,untracked:s=[],currentTrackId:a,onOpenTrack:l,onOpenUntracked:r,t}){const _=n.filter(o=>o.topicCount>0);if(_.length===0&&s.length===0)return e.jsx("p",{className:"es-learning__hint",children:t("learning.empty_no_curriculum")});const j=s.filter(Ke).length;return e.jsxs("section",{className:"es-learning__tracks-view","aria-label":t("learning.tracks_heading"),children:[e.jsx("div",{className:"es-learning__infobar es-learning__infobar--intro",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[t("learning.tracks_intro"),_.length>1&&e.jsxs(e.Fragment,{children:[" ",e.jsx("strong",{children:t("learning.track_independent_hint")})]})]})}),e.jsxs("ul",{className:"es-learning__tracks",children:[_.map(o=>{const x=o.topicCount>0?Math.round(o.doneTopicCount/o.topicCount*100):0,b=as(o.heroRef,o.heroUrl),p=o.topicCount>0&&o.doneTopicCount===o.topicCount;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:`es-learning__track-card${o.trackId===a?" es-learning__track-card--current":""}`,onClick:()=>l(o.trackId),children:[e.jsx(se,{graphicRef:o.heroRef,graphicAlt:o.heroAlt,graphicUrl:o.heroUrl,done:p}),e.jsxs("span",{className:"es-learning__track-card-head",children:[!b&&e.jsx("span",{className:"es-learning__track-icon",children:e.jsx(Sn,{iconRef:o.iconRef,iconUrl:o.iconUrl})}),e.jsx("span",{className:"es-learning__track-card-title",children:o.title}),p&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),o.description&&e.jsx("span",{className:"es-learning__track-card-desc",children:o.description}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:o.doneTopicCount,total:o.topicCount})})]})},o.trackId)}),s.length>0&&e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__track-card",onClick:()=>r?.(),children:[e.jsx("span",{className:"es-learning__track-card-head",children:e.jsx("span",{className:"es-learning__track-card-title",children:t("learning.track_unassigned")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:j,total:s.length})})]})})]})]})}function Sa({track:n,currentTopicId:s,onOpenTopic:a,onBack:l,t:r}){const t=new Set(n.topics.filter(Ke).map(b=>b.topicId)),_=n.topics.find(b=>b.topicId===s),j=_?.unlocks??[],o=Ve.map(b=>({level:b,topics:n.topics.filter(p=>(p.level??"basics")===b)})).filter(b=>b.topics.length>0),x=n.topicCount>0?Math.round(n.doneTopicCount/n.topicCount*100):0;return e.jsxs("section",{className:"es-learning__roadmap-view","aria-label":n.title,children:[e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:l,children:["← ",r("learning.tracks_heading")]}),e.jsxs("div",{className:"es-learning__detail-head",children:[e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.track_progress",{done:n.doneTopicCount,total:n.topicCount})})]})]}),_&&j.length>0&&e.jsxs("div",{className:"es-learning__unlocks",children:[e.jsx("span",{className:"es-learning__unlocks-lead",children:r("learning.unlocks_lead",{topic:_.title})}),e.jsx("ul",{className:"es-learning__unlocks-list",children:j.map(b=>e.jsx("li",{children:b.title},b.topicId))})]}),e.jsx("div",{className:"es-learning__infobar es-learning__infobar--order",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[e.jsx("strong",{children:r("learning.roadmap_heading")})," — ",r("learning.roadmap_why")]})}),e.jsx("ul",{className:"es-learning__levels",children:o.map(b=>e.jsxs("li",{children:[e.jsxs("span",{className:"es-learning__level-head",children:[e.jsx("span",{className:"es-learning__level-name",children:r(za[b.level])}),e.jsx("span",{className:"es-learning__level-rule","aria-hidden":"true"}),e.jsx(qa,{level:b.level,t:r})]}),e.jsx("ul",{className:"es-learning__level-topics",children:b.topics.map(p=>{const f=p.prerequisites??[],m=f.some(I=>!t.has(I.topicId)),w=ls(p.heroRef,p.heroUrl),q=Ke(p),v=["es-learning__road-row",w?"es-learning__road-row--card":"",m?"es-learning__road-row--ahead":"",p.topicId===s?"es-learning__road-row--current":""].filter(Boolean).join(" ");return e.jsx("li",{children:e.jsxs("button",{type:"button",className:v,onClick:()=>a(p.topicId),children:[w?e.jsx(se,{graphicRef:p.heroRef,graphicAlt:p.heroAlt,graphicUrl:p.heroUrl,variant:"card",done:q}):e.jsx(Sn,{iconRef:p.iconRef,iconUrl:p.iconUrl}),e.jsxs("span",{className:"es-learning__road-body",children:[e.jsx("span",{className:"es-learning__road-title",children:p.title}),f.length>0&&e.jsx("span",{className:"es-learning__road-needs",children:r("learning.topic_after",{names:f.map(I=>I.title).join(", ")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:r("learning.topic_progress",{mastered:p.doneCount,total:p.lessonCount})})]}),q?e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})}):e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]})},p.topicId)})})]},b.level))})]})}const Aa={mastered:"learning.state_mastered",done:"learning.state_done",gap:"learning.state_in_progress",current:"learning.state_current",unseen:"learning.state_locked"},Ta=n=>n==="mastered"||n==="done",La="learning.state_available";function Ma({topic:n,onOpenLesson:s,onStartSectionQuiz:a,canPickAnyLesson:l=!1,backLabel:r,onBack:t,t:_}){const j=n.lessonCount>0?Math.round(n.doneCount/n.lessonCount*100):0;return e.jsxs("section",{className:"es-learning__topic-detail","aria-label":n.title,children:[r&&t&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,"aria-label":_("learning.back_to_track",{track:r}),children:["← ",r]}),e.jsxs("div",{className:"es-learning__detail-head",children:[!(r&&t)&&e.jsx("p",{className:"es-learning__eyebrow",children:_("learning.nav_topics")}),e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsx(se,{graphicRef:n.heroRef,graphicAlt:n.heroAlt,graphicUrl:n.heroUrl,variant:"hero",done:Ke(n)}),e.jsxs("div",{className:"es-learning__progress-block",children:[e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lessons_done")}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${j}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:_("learning.progress_count",{done:n.doneCount,total:n.lessonCount})})]})]})]}),n.hasSectionQuiz===!0&&a&&e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost es-learning__section-cta",onClick:a,children:_("learning.section_quiz_cta")}),e.jsxs("div",{className:"es-learning__list-block",children:[e.jsx("p",{className:"es-learning__list-divider",children:e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lesson_list")})}),e.jsx("ol",{className:"es-learning__lesson-list",children:n.lessons.map(o=>{const x=l||o.servedAt!==null||o.state==="mastered"||o.state==="done"||o.state==="current",b=x?"button":"div",p=ls(o.graphicRef,o.graphicUrl),f=x&&o.state==="unseen"?"available":o.state,m=_(x&&o.state==="unseen"?La:Aa[o.state]),w=o.servedAt===null&&o.state==="mastered",q=Ta(o.state);return p?e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-card es-learning__lesson-card--${o.state}${x?"":" es-learning__lesson-card--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(se,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,variant:"card",done:q}),e.jsx("span",{className:"es-learning__lesson-card-title",children:o.title}),(o.isMilestone||w)&&e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone&&_("learning.milestone"),w&&`${o.isMilestone?" · ":""}${_("learning.not_delivered")}`]}),e.jsxs("span",{className:"es-learning__lesson-card-foot",children:[e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m}),!x&&e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})]})},o.lessonId):e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-row es-learning__lesson-row--${o.state}${x?"":" es-learning__lesson-row--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(Ia,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,done:q}),e.jsxs("span",{className:"es-learning__lesson-row-body",children:[e.jsx("span",{className:"es-learning__lesson-row-title",children:o.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone?_("learning.milestone"):n.title,w&&` · ${_("learning.not_delivered")}`]}),e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m})]}),x?e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})}):e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})},o.lessonId)})})]})]})}function $a({view:n,browse:s,mascot:a,slidePositions:l,newsTile:r,onGoToday:t,onOpenLesson:_,onOpenTopic:j,t:o}){const x=s?.summary?.doneLessons??0,b=s?.summary?.totalLessons??0,p=b>0?Math.round(x/b*100):0,f=s?.streak??{currentStreak:0,longestStreak:0},m=(s?.topics??[]).flatMap(v=>(v.lessons??[]).map(I=>({topic:v,lesson:I}))).filter(({lesson:v})=>v.servedAt!==null&&!v.done).sort((v,I)=>(I.lesson.servedAt??"").localeCompare(v.lesson.servedAt??"")).slice(0,3),w=s?.summary?.attempts?.[0]??null,q=s?.topics??[];return e.jsxs("section",{className:"es-learning__dashboard","aria-label":o("learning.nav_dashboard"),children:[e.jsx(Oa,{view:n,mascot:a,onGoToday:t,t:o}),s&&e.jsxs("div",{className:"es-learning__stats-deck",children:[e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--ring",children:[e.jsxs("div",{className:"es-learning__ring",role:"img","aria-label":o("learning.dashboard_mastered_label",{pct:p}),style:{"--es-learning-ring":`${p}`},children:[e.jsx("span",{className:"es-learning__ring-value",children:p}),e.jsx("span",{className:"es-learning__ring-unit",children:"%"})]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_mastered")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[x,"/",b]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_lessons_done")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--streak",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[e.jsx(_a,{size:15}),f.currentStreak]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_streak")}),f.longestStreak>f.currentStreak&&e.jsx("span",{className:"es-learning__stats-sub",children:o("learning.dashboard_best_streak",{n:f.longestStreak})})]})]}),m.length>0&&_&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_inprogress_title")}),m.map(({topic:v,lesson:I})=>e.jsx(Ua,{topicTitle:v.title,lesson:I,position:l?.[I.lessonId],onOpen:()=>_(v.topicId,I),t:o},I.lessonId))]}),r,w&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_last_quiz")}),e.jsx("ul",{className:"es-learning__attempt-list",children:e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:w.title}),e.jsx(Ra,{correct:w.correct,total:w.total,t:o})]})})]}),j&&q.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.nav_topics")}),e.jsx(ds,{topics:q,onOpen:j,t:o})]})]})}function Ra({correct:n,total:s,t:a}){return s<=0?e.jsx("span",{className:"es-learning__attempt-score",children:a("learning.review_score",{correct:n,total:s})}):e.jsx("span",{className:"es-learning__attempt-segs",role:"img","aria-label":a("learning.attempt_score_a11y",{correct:n,total:s}),"data-testid":"learning-attempt-segments",children:Array.from({length:s},(l,r)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__attempt-seg es-learning__attempt-seg--${r<n?"good":"bad"}`},r))})}function Ua({topicTitle:n,lesson:s,position:a,onOpen:l,t:r}){const t=!!a&&a.total>0,_=a&&t?Math.round((a.index+1)/a.total*100):0;return e.jsxs("button",{type:"button",className:"es-learning__continue",onClick:l,children:[e.jsxs("span",{className:"es-learning__continue-row",children:[e.jsx(se,{graphicRef:s.graphicRef,graphicUrl:s.graphicUrl,graphicAlt:s.graphicAlt,variant:"continue"}),e.jsxs("span",{className:"es-learning__continue-body",children:[e.jsx("span",{className:"es-learning__continue-title",children:s.title}),e.jsx("span",{className:"es-learning__lesson-row-meta",children:n})]})]}),a&&t&&e.jsxs("span",{className:"es-learning__continue-bar",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${_}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.slide_caption",{n:a.index+1,total:a.total})})]})]})}function Oa({view:n,mascot:s,onGoToday:a,t:l}){if(!n)return null;if(n.mode==="new_information"){const r=n.lesson.slides?.length??0;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--hero",onClick:a,children:[e.jsx(se,{graphicRef:n.lesson.graphicRef,graphicUrl:n.lesson.graphicUrl,graphicAlt:n.lesson.graphicAlt,variant:"today"}),e.jsxs("span",{className:"es-learning__today-inner",children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:n.lesson.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[n.lesson.topicTitle,r>0&&` · ${l("learning.slide_count",{total:r})}`]})]})]})}if(n.mode==="checking_question"||n.mode==="lesson_quiz"||n.mode==="section_quiz"||n.mode==="placement_quiz"){const r=n.mode==="checking_question"?null:n.quiz;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--gold",onClick:a,children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:l("learning.dashboard_continue")}),r&&e.jsx("span",{className:"es-learning__lesson-row-meta",children:l("learning.quiz_progress",{answered:r.answered,total:r.total})})]})}return n.mode==="nothing"?e.jsx("div",{className:"es-learning__today-card",children:e.jsx(kn,{kind:n.reason,mascot:s,nextDueAt:n.nextDueAt,t:l})}):null}function Ba({browse:n,t:s}){const{topics:a,summary:l}=n;return e.jsxs("section",{className:"es-learning__progress-view","aria-label":s("learning.nav_progress"),children:[e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.progress_topics_title")}),e.jsx("p",{className:"es-learning__hint",children:s("learning.progress_overall",{mastered:l.doneLessons,total:l.totalLessons})})]}),e.jsx("ul",{className:"es-learning__by-topic",children:a.map(r=>{const t=r.lessonCount>0?Math.round(r.doneCount/r.lessonCount*100):0;return e.jsxs("li",{className:"es-learning__by-topic-row",children:[e.jsx("span",{className:"es-learning__by-topic-title",children:r.title}),e.jsxs("span",{className:"es-learning__by-topic-count",children:[r.doneCount,"/",r.lessonCount]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${t}%`}})})]},r.topicId)})}),l.attempts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.quiz_history")}),e.jsx("ul",{className:"es-learning__attempt-list",children:l.attempts.map(r=>e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:r.title}),e.jsxs("span",{className:"es-learning__attempt-score",children:[r.correct,"/",r.total]})]},r.attemptId??r.quizId))})]})]})}const Da="es-learning-place",Ea=10080*60*1e3;function us(n){return`${Da}:${n}`}function Vn(n,s){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="number"&&Number.isFinite(a[1])&&a[1]>=s))}const Pa=n=>n==="dashboard"||n==="today"||n==="topics"||n==="news"||n==="progress";function Fa(n,s){try{const a=localStorage.getItem(us(n));if(!a)return null;const l=JSON.parse(a);return!Pa(l.tab)||(l.ownerId??null)!==s||typeof l.savedAt!="number"||Date.now()-l.savedAt>Ea?null:{tab:l.tab,openTopicId:typeof l.openTopicId=="string"?l.openTopicId:null,readingLessonId:typeof l.readingLessonId=="string"?l.readingLessonId:null,slideIndex:Vn(l.slideIndex,0),slideTotals:Vn(l.slideTotals,1)}}catch{return null}}function Qa(n,s,a){try{const l={...a,ownerId:s,savedAt:Date.now()};localStorage.setItem(us(n),JSON.stringify(l))}catch{}}const Wa=".es-widget__content, .gaio-theme__content";function Ga(n){const s=n?.ownerDocument;if(!n||!s)return;let a=n;for(;a&&a!==s.body&&a!==s.documentElement;){if(a.scrollTop!==0&&(a.scrollTop=0),a.matches(Wa))return;a=a.parentElement}}const Ja="es-learning-rated";function gs(n){return`${Ja}:${n}`}function _s(n,s){const[a]=In(()=>{const l=localStorage.getItem(gs(n));if(!l)return null;const r=JSON.parse(l);return(r.ownerId??null)!==s||!Array.isArray(r.lessonIds)?null:new Set(r.lessonIds.filter(t=>typeof t=="string"))});return a??new Set}function Va(n,s,a){const l=_s(n,s);l.add(a);const r=[...l].slice(-500),t={ownerId:s,lessonIds:r};return In(()=>localStorage.setItem(gs(n),JSON.stringify(t))),new Set(r)}const Ha=["learning-load","learning-browse","learning-read-lesson","learning-lesson-review","learning-lesson-quiz","learning-news-load"],Ka=["learning-answer-quiz","learning-answer-quiz-open","learning-answer-open","learning-quiz-finish","learning-start-lesson","learning-complete-lesson"],Za=300*1e3,ps=new Set(Ha),Ye=new Map;let Ae;function hs(n){n!==Ae&&(Ye.clear(),Ae=n)}function Ya(n){return n?JSON.stringify(Object.keys(n).sort().map(s=>[s,String(n[s])])):""}function ms(n,s,a,l){return`${n}\0${s}\0${a}\0${Ya(l)}`}function re(n,s,a,l,r=Date.now()){if(hs(s),s===null||!ps.has(a))return null;const t=Ye.get(ms(n,s,a,l));return t?{data:t.data,stale:r-t.storedAt>=Za}:null}function ge(n,s,a,l,r,t=Date.now()){if(Ae===void 0)Ae=s;else if(s!==Ae)return;s===null||!ps.has(a)||Ye.set(ms(n,s,a,l),{data:r,storedAt:t})}function Hn(){Ye.clear()}function Xa(n){hs(n)}function el(n){return Ps(n)}function nl(n,s){if(!n)return null;const[a]=In(()=>{const l=new Date(n);return Number.isNaN(l.getTime())?null:new Intl.DateTimeFormat(s,{day:"numeric",month:"short"}).format(l)});return a??null}function sl(n,s){if(!n)return null;const a=n.split("-")[0]?.toLowerCase();return!a||a===s.split("-")[0]?.toLowerCase()?null:a.toUpperCase()}function yn({item:n,currentLanguage:s,onPick:a,t:l}){const r=nl(n.publishedAt,s),t=sl(n.language,s),_=n.sourceName??n.host;return e.jsx("button",{type:"button",className:`es-learning__news${n.read?" es-learning__news--read":""}`,onClick:()=>a(n),"data-testid":"learning-news-card",children:e.jsxs("span",{className:"es-learning__news-row",children:[e.jsx("span",{className:"es-learning__news-thumb",children:n.thumbnailUrl&&e.jsx("img",{src:n.thumbnailUrl,alt:"",loading:"lazy"})}),e.jsxs("span",{className:"es-learning__news-body",children:[e.jsx("span",{className:"es-learning__news-title",children:n.title}),e.jsxs("span",{className:"es-learning__news-meta",children:[_&&e.jsx("span",{children:_}),_&&r&&e.jsx("span",{"aria-hidden":"true",children:"·"}),r&&e.jsx("span",{children:r}),t&&e.jsx("span",{className:"es-learning__news-lang",children:t})]})]}),n.read?e.jsx("span",{className:"es-learning__news-done",role:"img","aria-label":l("learning.news_read"),children:e.jsx(oe,{size:13})}):e.jsx("span",{className:"es-learning__news-ext","aria-hidden":"true",children:e.jsx(ts,{size:14})})]})})}function al({item:n,currentLanguage:s,onPick:a,t:l}){return e.jsxs("div",{className:"es-learning__news-tile","data-testid":"learning-news-tile",children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_suggested_title")}),e.jsx(yn,{item:n,currentLanguage:s,onPick:a,t:l})]})}function ll({news:n,currentLanguage:s,onPick:a,t:l}){const r=n?.unread??[],t=n?.read??[];return r.length===0&&t.length===0?e.jsx("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:e.jsx("p",{className:"es-learning__news-empty",children:l("learning.news_empty")})}):e.jsxs("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:[r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_new_title")}),e.jsx("div",{className:"es-learning__news-list",children:r.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_read_title")}),e.jsx("div",{className:"es-learning__news-list",children:t.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]})]})}function il({item:n,onCancel:s,onConfirm:a,t:l}){const r=g.useRef(null);return g.useEffect(()=>{r.current?.focus()},[]),g.useEffect(()=>{const t=_=>{_.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),e.jsxs("div",{className:"es-learning__leave",role:"dialog","aria-modal":"true","aria-labelledby":"es-learning-leave-title","data-testid":"learning-news-leave",children:[e.jsx("div",{className:"es-learning__leave-scrim","aria-hidden":"true",onClick:s}),e.jsxs("div",{className:"es-learning__leave-card",children:[e.jsx("span",{className:"es-learning__leave-icon","aria-hidden":"true",children:e.jsx(ts,{size:22})}),e.jsx("p",{className:"es-learning__leave-title",id:"es-learning-leave-title",children:l("learning.news_leave_title")}),e.jsx("p",{className:"es-learning__leave-body",children:l("learning.news_leave_body")}),e.jsx("span",{className:"es-learning__leave-host",children:n.host}),e.jsxs("div",{className:"es-learning__leave-actions",children:[e.jsx("button",{type:"button",className:"es-learning__leave-btn es-learning__leave-btn--cancel",onClick:s,children:l("learning.news_leave_cancel")}),e.jsx("button",{ref:r,type:"button",className:"es-learning__leave-btn es-learning__leave-btn--go",onClick:a,children:l("learning.news_leave_confirm")})]})]})]})}function Kn(){const n=new Date,s=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${s}-${a}-${l}`}function tl(n){return!!n&&typeof n=="object"&&typeof n.error=="string"}async function R(n,s,a){const[l]=await Ls(n.call(s,a));return!l||tl(l)?null:l}const Nn="__untracked__";function vn(n){return!!n&&Array.isArray(n.unread)&&Array.isArray(n.read)}function rl(n,s,a){const l=n.unread.find(r=>r.id===s);return{suggested:n.suggested?.id===s?n.suggested.pinned?{...n.suggested,read:!0}:null:n.suggested,unread:n.unread.filter(r=>r.id!==s),read:l?[{...l,read:!0},...n.read]:n.read,unreadCount:a}}function jl(n){const s=n.auth?.user?.id??null;return e.jsx(ol,{...n},`${n.productId}\0${s??"signed-out"}`)}function ol({config:n,data:s,actions:a,i18n:l,builderMode:r,productId:t,auth:_,baseUrl:j,externalContext:o,previewMode:x,readOnly:b}){const p=l?.t??(i=>i),f=l?.currentLanguage??"en",m=_?.user?.id??null,w=As(n.title,f,{t:p,fallbackKey:"learning.title",enDefault:"Learning"}),q=n.showExplanations!==!1,v=ha(n.mascot),I=n.showBrowse!==!1,P=I&&n.showDashboard!==!1,T=I&&n.showProgress===!0,K=I&&n.showNews!==!1,[u,E]=g.useState(()=>r?null:re(t,m,"learning-load",{language:f})?.data??null),[G,Z]=g.useState(()=>!r&&re(t,m,"learning-load",{language:f})===null),[be,F]=g.useState(null),[L,B]=g.useState(!1),[J,_e]=g.useState(""),[Xe,ve]=g.useState(null),[Y,V]=g.useState(null),[ae,we]=g.useState(null),U=g.useRef(r?null:Fa(t,m)).current,[X,pe]=g.useState(U?.tab??"dashboard"),[H,ke]=g.useState(()=>{if(r||!K)return null;const i=re(t,m,"learning-news-load")?.data;return vn(i)?i:null}),k=g.useRef(null);k.current=H;const[A,he]=g.useState(null),[ce,Me]=g.useState(()=>U?.slideIndex??{}),[en,$e]=g.useState({}),[ye,xs]=g.useState(()=>U?.slideTotals??{}),[js]=g.useState(()=>r?new Set:_s(t,m)),[fs,bs]=g.useState(()=>new Set),Ie=g.useRef(null),Re=i=>{if(n?.readAloudEnabled!==!0)return null;const c=o?.renderReadAloud;return typeof c!="function"?null:c(`learning-lesson-${i}`,Ie)},nn=i=>r||js.has(i)||fs.has(i)?null:e.jsx($s,{compact:!0,blockSlug:"learning",subjectType:"learning_lesson",subjectId:i,promptKey:"block_rating.prompt_lesson",ariaKey:"block_rating.rate_lesson_aria",baseUrl:j,apiKey:o?.apiKey,jwt:_?.jwt,previewMode:x||b,settleInPlace:!0,onRated:()=>Va(t,m,i),onFeedbackCycleDone:()=>bs(c=>new Set(c).add(i)),t:p}),[sn,an]=g.useState(!1),[ws,Ns]=g.useState(!1),[Ue,ln]=g.useState(!1),[An,Tn]=g.useState(null),[vs,tn]=g.useState(!1),Ln=g.useRef(null),[le,me]=g.useState(U?.openTopicId??null),[xe,Oe]=g.useState(null),[W,de]=g.useState(null),[N,ze]=g.useState(()=>r?null:re(t,m,"learning-browse",{language:f})?.data??null),[rn,on]=g.useState(!1),[S,ee]=g.useState(null),[ks,Be]=g.useState(null),[M,De]=g.useState(null),[O,Ee]=g.useState(null),[ue,Mn]=g.useState(null),[cn,dn]=g.useState(!1),[$,un]=g.useState(null),ie=g.useRef(p);ie.current=p;const $n=g.useCallback((i,c)=>(Ka.includes(i)&&(Hn(),on(!0)),a.call(i,c)),[a]),C=g.useMemo(()=>({...a,call:$n}),[a,$n]),je=g.useCallback(async i=>{F(null),ve(null),V(null),we(null),_e("");const c={...i?{preferredTopicId:i}:{},language:f},d=re(t,m,"learning-load",c);if(d){if(E(d.data),Z(!1),!d.stale)return d.data;const y=await R(C,"learning-load",c);return y&&(ge(t,m,"learning-load",c,y),E(y)),y??d.data}Z(!0);const h=await R(C,"learning-load",c);return h?(ge(t,m,"learning-load",c,h),E(h)):F(ie.current("learning.error_load")),Z(!1),h},[C,f,m,t]);g.useEffect(()=>{if(r){const i=s?.mode??"nothing";E(i==="nothing"?{mode:"nothing",reason:s?.reason??"all_in_cooldown"}:{mode:"unavailable"});return}je()},[r,je,s?.mode,s?.reason]),g.useEffect(()=>{const i=a.on?.("learning:reload",()=>{Hn(),je()});return()=>i?.()},[a,je]),g.useEffect(()=>{if(r||!K)return;let i=!1;return(async()=>{const c=re(t,m,"learning-news-load");if(c&&(vn(c.data)&&ke(c.data),!c.stale))return;const d=await R(a,"learning-news-load");i||!d||(ge(t,m,"learning-news-load",void 0,d),vn(d)&&ke(d))})(),()=>{i=!0}},[a,r,m,t,K]);const ys=g.useCallback(()=>{const i=A;if(!i)return;he(null);const c=el(i.url);if(!c){F(ie.current("learning.news_error_open"));return}const d=window.open(c,"_blank","noopener,noreferrer");d&&(d.opener=null),(async()=>{const h=await R(a,"learning-news-open",{newsItemId:i.id});if(!h||typeof h.unreadCount!="number")return;const y=k.current;if(!y)return;const D=rl(y,i.id,h.unreadCount);ke(D),ge(t,m,"learning-news-load",void 0,D)})()},[a,A,m,t]);g.useEffect(()=>{Xa(m)},[m]),g.useEffect(()=>{if(X==="today"||r||N&&(M||W||$))return;const i={language:f},c=rn?null:re(t,m,"learning-browse",i);if(N&&!rn&&!(c&&c.stale)||(c&&ze(c.data),c&&!c.stale))return;let d=!1;return(async()=>{const h=await R(C,"learning-browse",i);d||!h||!Array.isArray(h.topics)||!h.summary||(ge(t,m,"learning-browse",i,h),ze(h),on(!1))})(),()=>{d=!0}},[X,N,rn,M,W,$,r,C,f,m,t]);const gn=g.useCallback(async(i,c,d)=>{const h=await R(C,"learning-answer-quiz",{quizId:i,questionId:c,selectedOptionIndex:d,language:f});if(!h){F(ie.current("learning.error_answer"));return}a.emit("learning:answerSubmitted",{questionId:c}),h.completed&&V(h.completed)},[a,C,f]),_n=g.useCallback(async(i,c,d)=>{B(!0);const h=await R(C,"learning-answer-quiz-open",{quizId:i,questionId:c,answer:d,language:f});return h?a.emit("learning:answerSubmitted",{questionId:c}):F(ie.current("learning.error_answer")),B(!1),!!h},[a,C,f]),pn=g.useCallback(async(i,c)=>{if(L)return;B(!0);const d=await R(C,"learning-quiz-finish",{quizId:i,language:f,activeDate:Kn()});if(d){if(V(d),a.emit("learning:quizCompleted",d),Mn(d.sectionQuiz??null),d.streak&&ze(h=>h&&{...h,streak:d.streak}),!c?.isSectionQuiz){const h=await R(C,"learning-load",{language:f});h?.mode&&we(h)}}else Y||F(ie.current("learning.error_answer"));B(!1)},[a,C,L,f,Y]),Rn=g.useCallback(async(i,c,d)=>{if(L)return!1;B(!0);const h=await R(C,"learning-section-quiz",{topicId:i,language:f});B(!1);const y=h?.quiz??null;return y?(V(null),dn(!1),un({quiz:y,topicTitle:h?.topicTitle||c,origin:d}),!0):!1},[L,C,f]),Is=g.useCallback(async i=>{const c=J.trim();if(!c||L)return;B(!0);const d=await R(C,"learning-answer-open",{questionId:i,answer:c,language:f});d?(a.emit("learning:answerSubmitted",{questionId:i,verdict:d.verdict}),ve(d)):F(ie.current("learning.error_answer")),B(!1)},[a,C,L,f,J]),Pe=g.useCallback(async i=>{B(!0);const c=await R(C,"learning-start-lesson",{lessonId:i});return B(!1),c?!0:(F(ie.current("learning.error_load")),!1)},[C]),hn=g.useCallback(async i=>{await Pe(i)&&ln(!0)},[Pe]),Fe=g.useCallback(async(i,c)=>{i?.mode==="new_information"&&i.isNew&&(c!==null&&i.lesson.topicId!==c?Tn(i.lesson.lessonId):await hn(i.lesson.lessonId)),tn(!1)},[hn]),Qe=g.useCallback(()=>{dn(!1),Mn(null),un(null),V(null),ln(!1),ae&&(E(ae),we(null),tn(!0),Fe(ae,Ln.current))},[Fe,ae]),We=g.useCallback(async i=>{const c=await R(C,"learning-complete-lesson",{lessonId:i,activeDate:Kn()});return c?.streak&&ze(d=>d&&{...d,streak:c.streak}),c},[C]),Un=g.useCallback(async(i,c)=>{ln(!1),tn(!0),Ln.current=c??null,i&&(await We(i),Me(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h}),$e(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h})),await Fe(await je(),c??null)},[Fe,je,We]),te=g.useCallback(async(i,c)=>{F(null),Ns(c?.fromQuiz===!0),de({...i}),Be(null);const d={lessonId:i.lessonId,language:f},h=re(t,m,"learning-read-lesson",d);if(h)ee(h.data),h.stale&&(async()=>{const y=await R(C,"learning-read-lesson",d);y&&(y.body||y.slides?.length)&&(ge(t,m,"learning-read-lesson",d,y),ee(y))})();else{ee(null);const y=await R(C,"learning-read-lesson",d);if(!y||!y.body&&!y.slides?.length){de(null),F(ie.current("learning.error_load"));return}ge(t,m,"learning-read-lesson",d,y),ee(y)}if(i.done){const y={lessonId:i.lessonId,language:f},D=re(t,m,"learning-lesson-review",y);if(D&&!D.stale)Be(D.data.rows??null);else{const Se=await R(C,"learning-lesson-review",y);Se?(ge(t,m,"learning-lesson-review",y,Se),Be(Se.rows??null)):Be(D?D.data.rows??null:null)}}},[C,f,m,t]),Ge=g.useCallback(async i=>{if(N?.canPickAnyLesson===!0&&i.servedAt===null&&!i.done){F(null),de(null),ee(null),Ee(i);return}await te(i)},[N?.canPickAnyLesson,te]),mn=g.useCallback(async i=>{await Pe(i.lessonId)&&(Ee(null),await te({...i,servedAt:new Date().toISOString()}))},[te,Pe]),zs=g.useCallback(async i=>{B(!0),await R(C,"learning-start-lesson",{lessonId:i}),await We(i);const c=await R(C,"learning-lesson-quiz",{lessonId:i,language:f});if(B(!1),c?.quiz){De({quiz:c.quiz,lessonId:c.lessonId??i,lessonTitle:c.lessonTitle??""}),de(null),ee(null);return}const d=N?.topics.flatMap(D=>(D.lessons??[]).map(Se=>({topicId:D.topicId,lesson:Se})))??[],h=d.findIndex(D=>D.lesson.lessonId===i),y=N?.canPickAnyLesson===!0&&h!==-1?d.slice(h+1).find(D=>!D.lesson.done)??null:null;if(de(null),ee(null),ze(null),!!y){if(y.topicId===d[h].topicId){await mn(y.lesson);return}Tn(y.lesson.lessonId),Ge(y.lesson)}},[C,f,N,Ge,We,mn]),On=g.useRef(U?.readingLessonId??null);g.useEffect(()=>{const i=On.current;if(!i||!N||r)return;On.current=null;const c=N.topics.flatMap(d=>d.lessons??[]).find(d=>d.lessonId===i);c&&te(c)},[N,r,te]),g.useEffect(()=>{r||Qa(t,m,{tab:X,openTopicId:le,readingLessonId:W?.lessonId??null,slideIndex:ce,slideTotals:ye})},[r,t,m,X,le,W,ce,ye]);const Bn=u?.mode==="new_information"?u.lesson:null;g.useEffect(()=>{const i=[];for(const c of[Bn,S]){const d=c?.slides?.length??0;c&&d>0&&i.push([c.lessonId,d])}i.length!==0&&xs(c=>{const d=i.filter(([h,y])=>c[h]!==y);return d.length>0?{...c,...Object.fromEntries(d)}:c})},[Bn,S]);const qs=g.useMemo(()=>{const i={};for(const[c,d]of Object.entries(ye))d<=0||(i[c]={index:Math.min(ce[c]??0,d-1),total:d});return i},[ye,ce]),qe=(N?.tracks?.length??0)>0,xn=g.useMemo(()=>O?N?.topics.find(i=>(i.lessons??[]).some(c=>c.lessonId===O.lessonId))??null:null,[N,O]),Ce=g.useMemo(()=>{if(!N||!qe)return[];const i=new Set(N.tracks.flatMap(c=>c.topics.map(d=>d.topicId)));return N.topics.filter(c=>!i.has(c.topicId))},[N,qe]),Je=g.useMemo(()=>!N||!xe?null:xe===Nn?{trackId:Nn,title:p("learning.track_unassigned"),topicCount:Ce.length,doneTopicCount:Ce.filter(i=>i.lessonCount>0&&i.doneCount===i.lessonCount).length,topics:Ce}:N.tracks?.find(i=>i.trackId===xe)??null,[N,xe,Ce,p]),Dn=i=>{if(N?.canPickAnyLesson!==!0)return null;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?null:c.slice(d+1).find(h=>!h.done)??null},Cs=i=>{if(!N)return!0;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?!0:c.slice(d+1).some(h=>!h.done)},jn=i=>Cs(i)?p("learning.finish_next_lesson"):p("learning.finish_lesson"),En=K&&H!==null&&(H.unread.length>0||H.read.length>0||H.suggested!==null),ne=G||vs,z=X==="dashboard"&&!P||X==="progress"&&!T||X==="news"&&!En?"today":X,Pn=g.useRef(null),Fn=S?.lessonId??(u?.mode==="new_information"?u.lesson.lessonId:null),Ss=[z,xe??"",le??"",O?.lessonId??"",W?.lessonId??"",sn?"quiz-lesson":"",M?.quiz.attemptId??M?.quiz.quizId??"",$?.quiz.attemptId??$?.quiz.quizId??"",cn?"section-intro":"",u?.mode??"",u?.mode==="new_information"?u.lesson.lessonId:"",u?.mode==="new_information"&&u.isNew&&!Ue?"arrival":"",u?.mode==="checking_question"?u.question.questionId:"",u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz"?u.quiz.attemptId??u.quiz.quizId:"",Y?"results":"",Fn?String(ce[Fn]??0):""].join("|");return g.useLayoutEffect(()=>{Ga(Pn.current)},[Ss]),e.jsxs(Ts,{blockType:"learning",children:[e.jsxs("header",{className:"es-learning__header",children:[e.jsx("span",{className:"es-learning__header-title",children:w}),I&&e.jsx("nav",{className:"es-learning__header-actions","aria-label":w,children:[...P?[["dashboard",ua]]:[],["today",ca],["topics",da],...En?[["news",pa]]:[],...T?[["progress",ga]]:[]].map(([i,c])=>{const d=i==="news"&&z!=="news"?H?.unreadCount??0:0,h=p(`learning.nav_${i}`);return e.jsxs("button",{type:"button",className:`es-learning__navbtn es-learning__navbtn--icon${i==="news"?" es-learning__navbtn--news":""}${z===i?" es-learning__navbtn--active":""}`,"aria-current":z===i?"page":void 0,"aria-label":d>0?p("learning.nav_news_unread",{n:d}):h,title:h,onClick:()=>{pe(i),me(null),Oe(null),de(null),ee(null),Ee(null),an(!1),De(null),V(null),we(null),he(null)},children:[e.jsx(c,{}),d>0&&e.jsx("span",{className:"es-learning__navbadge","aria-hidden":"true",children:d>99?"99+":d})]},i)})})]}),e.jsxs("div",{className:"es-block__body es-learning",ref:Pn,children:[be&&e.jsx("div",{className:"es-learning__error",role:"alert",children:be}),ne&&(z==="today"||z==="dashboard")&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="dashboard"&&!G&&e.jsx($a,{view:u,browse:N,mascot:v,slidePositions:qs,newsTile:K&&H?.suggested?e.jsx(al,{item:H.suggested,currentLanguage:f,onPick:he,t:p}):void 0,onGoToday:()=>pe("today"),onOpenLesson:(i,c)=>{pe("topics"),me(i),te(c)},onOpenTopic:i=>{pe("topics"),me(i)},t:p}),z==="news"&&e.jsx(ll,{news:H,currentLanguage:f,onPick:he,t:p}),z==="progress"&&N&&e.jsx(Ba,{browse:N,t:p}),(z==="topics"||z==="progress")&&!N&&!O&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&O&&e.jsx(Gn,{lessonTitle:O.title,topicTitle:xn?.title??"",newTopic:An===O.lessonId,graphicRef:O.graphicRef,graphicAlt:O.graphicAlt,graphicUrl:O.graphicUrl,slideCount:ye[O.lessonId]??0,mascot:v,busy:L,onStart:()=>{mn(O)},onBackToTopic:xn?()=>{Ee(null),me(xn.topicId)}:void 0,t:p}),z==="topics"&&N&&W&&!S&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&N&&W&&S&&e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),review:ks,backLabel:p("learning.back_to_topic",{topic:S.topicTitle}),showBackLink:!1,onBack:()=>{de(null),ee(null)},onBackToTopic:()=>{de(null),ee(null)},onFinish:N.canPickAnyLesson===!0&&!W.done?()=>{zs(S.lessonId)}:void 0,finishLabel:S.hasQuiz===!1?jn(S.lessonId):p("learning.finish_to_quiz"),rating:ws?null:nn(S.lessonId),t:p}),z==="topics"&&M&&e.jsx(wn,{quiz:M.quiz,isPlacement:!1,eyebrow:M.lessonTitle,topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn(M.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(M.quiz.quizId,i,c),onFinish:()=>{pn(M.quiz.quizId)},onBackToLesson:()=>{De(null),te({lessonId:M.lessonId,title:M.lessonTitle,isMilestone:!1,state:"gap",done:!1,servedAt:new Date().toISOString()},{fromQuiz:!0})},onContinue:()=>{const i=Dn(M.lessonId);V(null),De(null),i&&Ge(i)},continueLabel:Dn(M.lessonId)?p("learning.go_to_next_lesson"):p("learning.nav_topics"),t:p},M.quiz.attemptId??M.quiz.quizId),z==="topics"&&N&&!W&&!M&&!$&&!O&&le&&e.jsx(Ma,{topic:N.topics.find(i=>i.topicId===le)??N.topics[0],onOpenLesson:i=>{Ge(i)},onStartSectionQuiz:()=>{const i=N.topics.find(c=>c.topicId===le)??N.topics[0];(async()=>await Rn(i.topicId,i.title,"topics")||on(!0))()},canPickAnyLesson:N.canPickAnyLesson===!0,backLabel:Je?.title,onBack:Je?()=>me(null):void 0,t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&!xe&&e.jsx(Ca,{tracks:N.tracks,untracked:Ce,onOpenTrack:Oe,onOpenUntracked:()=>Oe(Nn),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&xe&&Je&&e.jsx(Sa,{track:Je,onOpenTopic:me,onBack:()=>Oe(null),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&!qe&&e.jsx(ds,{topics:N.topics,onOpen:me,t:p}),z==="today"&&!ne&&u?.mode==="nothing"&&e.jsx(kn,{kind:u.reason,mascot:v,nextDueAt:u.nextDueAt,t:p}),z==="today"&&!ne&&u?.mode==="unavailable"&&e.jsx(kn,{kind:"unavailable",mascot:v,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&u.isNew&&!Ue&&e.jsx(Gn,{lessonTitle:u.lesson.title,topicTitle:u.lesson.topicTitle,newTopic:An===u.lesson.lessonId,graphicRef:u.lesson.graphicRef,graphicAlt:u.lesson.graphicAlt,graphicUrl:u.lesson.graphicUrl,slideCount:u.lesson.slides?.length??0,mascot:v,busy:L,onStart:()=>{hn(u.lesson.lessonId)},t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&(!u.lesson.kind||u.lesson.kind==="info"||!u.lesson.slides?.length)&&e.jsx(rs,{lesson:u.lesson,busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&u.lesson.kind&&u.lesson.kind!=="info"&&!!u.lesson.slides?.length&&e.jsx(cs,{lesson:u.lesson,index:ce[u.lesson.lessonId]??0,onIndexChange:i=>Me(c=>({...c,[u.lesson.lessonId]:i})),answers:en[u.lesson.lessonId]??{},onAnswer:(i,c)=>$e(d=>({...d,[u.lesson.lessonId]:{...d[u.lesson.lessonId]??{},[i]:c}})),busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="checking_question"&&e.jsx(fa,{prompt:u.question.prompt,lessonTitle:u.lessonTitle,answer:J,feedback:Xe,busy:L,showExplanations:q,onChange:_e,onSubmit:()=>{Is(u.question.questionId)},t:p}),z==="today"&&!ne&&u?.mode==="lesson_quiz"&&sn&&(S?e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),backLabel:p("learning.back_to_quiz"),onBack:()=>an(!1),t:p}):e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")})),z==="today"&&!ne&&cn&&ue&&e.jsx(ma,{topicTitle:ue.topicTitle,topicComplete:ue.topicComplete,mascot:v,busy:L,onStart:()=>{(async()=>await Rn(ue.topicId,ue.topicTitle,"today")||Qe())()},onSkip:Qe,t:p}),$&&z===$.origin&&e.jsx(wn,{quiz:$.quiz,isPlacement:!1,eyebrow:$.topicTitle,topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn($.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n($.quiz.quizId,i,c),onFinish:()=>{pn($.quiz.quizId,{isSectionQuiz:!0})},onBackToLesson:void 0,onContinue:$.origin==="today"?Qe:()=>{un(null),V(null)},continueLabel:$.origin==="topics"?p("learning.nav_topics"):ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},$.quiz.attemptId??$.quiz.quizId),z==="today"&&!ne&&!sn&&!cn&&$?.origin!=="today"&&(u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz")&&e.jsx(wn,{quiz:u.quiz,isPlacement:u.mode==="placement_quiz",eyebrow:u.mode==="lesson_quiz"?u.lessonTitle:void 0,topics:u.mode==="placement_quiz"?u.topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn(u.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(u.quiz.quizId,i,c),onFinish:()=>{pn(u.quiz.quizId)},onBackToLesson:u.mode==="lesson_quiz"?()=>{an(!0),te({lessonId:u.lessonId,title:u.lessonTitle,isMilestone:!1,state:"current",done:!1,servedAt:null},{fromQuiz:!0})}:void 0,onChooseTopic:u.mode==="placement_quiz"?i=>{je(i)}:void 0,onContinue:ue||ae?()=>{if(ue){V(null),dn(!0);return}Qe()}:void 0,continueLabel:!ue&&ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},u.quiz.attemptId??u.quiz.quizId)]}),A&&e.jsx(il,{item:A,onCancel:()=>he(null),onConfirm:ys,t:p})]})}export{jl as Component,Gn as NewLessonIntro,ya as QuizReview,ma as SectionQuizIntro,xl as manifest};
2
- //# sourceMappingURL=index-DhYv8bbj-DGasnsaZ.js.map
1
+ import{j as e,r as g,a as As,Q as Ts,Y as Ye,t as In,b as Ls,d as Ms}from"../nexly.js";import{C as $s}from"./block-rating-D7hR2gTc-CoiP5C2K.js";import{x as Rs,c as Us,s as Yn,a as Os}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{r as Bs}from"./inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js";import{X as Ds,F as Es}from"./ClickToLoadEmbed-BLIUFZOn-BwY-LAJ8.js";import{p as Ps}from"./external-url-qbs1SznX-CJQjg_od.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-DHB-k1Aa-Cc-yj-a-.js";const Fs=/^[a-z0-9][a-z0-9-]*$/,Qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Le(n){if(!n)return null;const s=n.trim();if(!s)return null;if(s.startsWith("media:")){const l=s.slice(6);return Qs.test(l)?{kind:"media",mediaId:l}:null}const a=s.startsWith("icon:")?s.slice(5):s;return Fs.test(a)?{kind:"icon",slug:a}:null}const fn="media:",bn="youtube:",Ws=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Zn(n){if(!n)return null;const s=n.trim();if(s.startsWith(fn)){const a=s.slice(fn.length);return Ws.test(a)?{kind:"image",ref:`${fn}${a}`,mediaId:a}:null}if(s.startsWith(bn)){const a=s.slice(bn.length);return Es(a)?{kind:"youtube",ref:`${bn}${a}`,id:a}:null}return null}const xl={slug:"learning",name:"Learning",version:"1.0.0",category:"interactive",requiredService:"learning",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},title:{type:"string",default:""},showExplanations:{type:"boolean",default:!0},showBrowse:{type:"boolean",default:!0},showDashboard:{type:"boolean",default:!0},showProgress:{type:"boolean",default:!1},showNews:{type:"boolean",default:!0}}},defaultConfig:{readAloudEnabled:!1,title:"",showExplanations:!0,showBrowse:!0,showDashboard:!0,showProgress:!1,showNews:!0},dataContract:{serviceSlug:"learning",inputSchema:{type:"object",properties:{mode:{type:"string",description:"placement_quiz | section_quiz | checking_question | new_information | nothing"},quizId:{type:"string",description:"Set for placement_quiz / section_quiz"},questionId:{type:"string",description:"Set for checking_question"},lessonId:{type:"string",description:"Set for new_information / checking_question"},topicId:{type:"string",description:"Set for new_information / section_quiz"},reason:{type:"string",description:"Set for mode=nothing: no_curriculum | all_mastered | all_in_cooldown"}},required:["mode"]},previewDataOverride:{mode:"nothing",reason:"all_in_cooldown"}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"title",type:"localized-text",label:"Heading",default:"",placeholder:'Leave empty to use the translated default ("Learning")',group:"Content"},{id:"showExplanations",type:"toggle",label:"Show explanations after answering",default:!0,group:"Behavior"},{id:"showBrowse",type:"toggle",label:"Offer the browsing sections (Topics, Dashboard, Progress)",default:!0,group:"Sections"},{id:"showDashboard",type:"toggle",label:"Show the Dashboard section (streak, progress, what to pick up)",default:!0,group:"Sections"},{id:"showProgress",type:"toggle",label:"Show the Progress section (mastery by topic, quiz history)",default:!1,group:"Sections"},{id:"showNews",type:"toggle",label:"Show the News section (published feed items, with an unread badge)",default:!0,group:"Sections"}],events:{emits:[{name:"learning:answerSubmitted",description:"Learner answered a question"},{name:"learning:quizCompleted",description:"Learner finished a quiz attempt"},{name:"learning:lessonSkipped",description:"Learner declared a lesson already known"}],listens:[{name:"learning:reload",description:"Re-fetch the current assignment"}]},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main"]},Xn=g.createContext(null),Gs=({children:n})=>e.jsx("span",{className:"es-learning__md-link",children:n}),Js=({node:n,...s})=>e.jsx("div",{className:"es-learning__md-tablewrap",children:e.jsx("table",{...s})}),Vs=({node:n,type:s,checked:a,...l})=>s==="checkbox"?e.jsx("input",{...l,type:"checkbox",checked:!!a,disabled:!0,readOnly:!0}):null,Hs=()=>null,Ks=({src:n,alt:s})=>{const a=g.useContext(Xn);if(!a)return null;const{media:l,t:r}=a,t=Zn(typeof n=="string"?n:void 0),_=t?l[t.ref]:void 0,j=(s??"").trim();return _?_.kind==="image"?e.jsx("img",{className:"es-learning__media-img",src:_.url,alt:j||r("learning.media_image_alt"),loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx(Ds,{embed:{provider:_.provider,id:_.id},t:r,classPrefix:"es-learning",posterUrl:_.posterUrl},`${_.provider}:${_.id}`):e.jsx("span",{className:"es-learning__media-missing",children:j||r("learning.media_unavailable")})},Ys=({node:n,children:s,...a})=>{const l=n?.children;return l!==void 0&&l.length>0&&l.every(r=>r.type==="element"&&r.tagName==="img"||r.type==="text"&&!(r.value??"").trim())&&l.some(r=>r.type==="element")?e.jsx(e.Fragment,{children:s}):e.jsx("p",{...a,children:s})},es={...Bs,a:Gs,table:Js,input:Vs},Zs={...es,img:Hs},Xs={...es,img:Ks,p:Ys},ea=[...Yn],na=[...Yn,"img"],sa=n=>Os(n)??"",aa=()=>"",la=n=>Zn(n)?n:"";function ns(n,s,a,l){return e.jsx("div",{className:"es-learning__md",children:e.jsx(Rs,{remarkPlugins:[...Us],allowedElements:s,transformLinkUri:sa,transformImageUri:a,components:l,children:n})})}function zn({children:n}){return n?.trim()?ns(n,ea,aa,Zs):null}function ss({children:n,media:s,t:a}){const l=g.useMemo(()=>({media:s??{},t:a}),[s,a]);return n?.trim()?e.jsx(Xn.Provider,{value:l,children:ns(n,na,la,Xs)}):null}function se({graphicRef:n,graphicAlt:s,graphicUrl:a,variant:l,done:r}){const t=Le(n);if(!t)return null;const _=["es-learning__graphic",l?`es-learning__graphic--${l}`:"",r?"es-learning__graphic--done":""].filter(Boolean).join(" ");if(t.kind==="media")return a?e.jsx("div",{className:`${_} es-learning__graphic--image`,children:e.jsx("img",{src:a,alt:s??"",className:"es-learning__graphic-img",loading:"lazy","data-testid":"learning-graphic-image"})}):null;const j=Ye(t.slug);return j?e.jsx("div",{className:_,role:s?"img":"presentation","aria-label":s??void 0,"data-testid":"learning-graphic-icon",children:e.jsx(j,{size:40})}):null}function as(n,s){const a=Le(n);return a?a.kind==="media"?!!s:!!Ye(a.slug):!1}function ls(n,s){return Le(n)?.kind==="media"&&!!s}function is({topicTitle:n,onBackToTopic:s,t:a}){return s?e.jsxs("button",{type:"button",className:"es-learning__eyebrow es-learning__eyebrow--back",onClick:s,"aria-label":a("learning.back_to_topic",{topic:n}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),n]}):e.jsx("p",{className:"es-learning__eyebrow",children:n})}const Q=n=>({width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0});function ia({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m15.5 8.5-2 5.5-5.5 2 2-5.5z"})]})}function Qn({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5V12l3 2"})]})}function ta({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M8 4h8v4a4 4 0 0 1-8 0z"}),e.jsx("path",{d:"M8 5H5.5a2.5 2.5 0 0 0 2.5 4M16 5h2.5a2.5 2.5 0 0 1-2.5 4"}),e.jsx("path",{d:"M12 12v4M9 20h6M10 20a2 2 0 0 1 4 0"})]})}function ra({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M4 5h16M4 12h16M4 19h16"}),e.jsx("path",{d:"M7 5v7M12 12v7",opacity:"0.45"})]})}function oa({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 3v5h5"}),e.jsx("path",{d:"m9.5 12.5 5 5m0-5-5 5"})]})}function He({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M19 12H5m0 0 6-6m-6 6 6 6"})})}function fe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M5 12h14m0 0-6-6m6 6-6 6"})})}function oe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m5 13 4 4L19 7"})})}function Te({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function qn({size:n=16}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.3"}),e.jsx("path",{d:"M12 17h.01"})]})}function Wn({size:n=14}){return e.jsxs("svg",{...Q(n),children:[e.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]})}function Cn({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m9 6 6 6-6 6"})})}function ca({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 6.5C10.5 5 8.5 4.5 4 4.5v13c4.5 0 6.5.5 8 2 1.5-1.5 3.5-2 8-2v-13c-4.5 0-6.5.5-8 2Z"}),e.jsx("path",{d:"M12 6.5v13"})]})}function da({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})}function ua({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"m4 11 8-6 8 6"}),e.jsx("path",{d:"M6 10v9h12v-9"})]})}function ga({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M5 19V10M12 19V5M19 19v-6"})})}function _a({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M12 3c1 3-2 4-2 7a3 3 0 0 0 6 0c0-1.5-1-2-1-3.5 1.5 1 2.5 3 2.5 5A5.5 5.5 0 0 1 12 21a5.5 5.5 0 0 1-5-7.5C7.5 10 9 7 12 3Z"})})}function pa({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4 5h13v14H6a2 2 0 0 1-2-2Z"}),e.jsx("path",{d:"M17 8h3v9a2 2 0 0 1-2 2h-1"}),e.jsx("path",{d:"M7 9h7"}),e.jsx("path",{d:"M7 12.5h7"}),e.jsx("path",{d:"M7 16h4"})]})}function ts({size:n=14}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function rs({lesson:n,busy:s,onDone:a,doneLabel:l,doneGoesBack:r=!1,onBackToTopic:t,rating:_,readAloud:j,readAloudRef:o,t:x}){return e.jsxs("section",{className:"es-learning__lesson","aria-label":x("learning.lesson_aria"),children:[e.jsxs("div",{className:"es-learning__lesson-readable",ref:o,children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:t,t:x}),e.jsx("h4",{className:"es-learning__lesson-title",children:n.title}),e.jsx(se,{graphicRef:n.graphicRef,graphicAlt:n.graphicAlt,graphicUrl:n.graphicUrl}),e.jsx(ss,{media:n.media,t:x,children:n.body})]}),j&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:j}),_,e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:a,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),x("learning.loading")]}):e.jsxs(e.Fragment,{children:[r&&e.jsx(He,{}),l??x("learning.lesson_done"),!r&&e.jsx(fe,{})]})})]})}const os={owl:({size:n})=>e.jsx(Ms,{size:n})};function ha(n){return typeof n=="string"&&n in os?n:"none"}function Ne({name:n,size:s=56,className:a}){const l=n==="none"?void 0:os[n];return l?e.jsx("span",{className:["es-learning__mascot",a].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(l,{size:s})}):null}function Gn({lessonTitle:n,topicTitle:s,newTopic:a=!1,graphicRef:l,graphicAlt:r,graphicUrl:t,slideCount:_,mascot:j,busy:o,onStart:x,onBackToTopic:b,t:p}){const f=!!l,m=p(a?"learning.new_topic_title":"learning.new_lesson_title");return e.jsxs("section",{className:`es-learning__intro${f?" es-learning__intro--illustrated":""}${a?" es-learning__intro--topic":""}`,"aria-label":m,children:[f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-learning__intro-say",children:[e.jsx(Ne,{name:j,size:30}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx(se,{graphicRef:l,graphicAlt:r,graphicUrl:t})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{name:j,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx("p",{className:"es-learning__intro-lesson",children:a?s:n}),b&&!a?e.jsxs("button",{type:"button",className:"es-learning__intro-note es-learning__intro-note--back",onClick:b,"aria-label":p("learning.back_to_topic",{topic:s}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),s]}):e.jsx("p",{className:"es-learning__intro-note",children:a?n:s}),typeof _=="number"&&_>0&&e.jsx("p",{className:"es-learning__intro-meta",children:p("learning.slide_count",{total:_})}),e.jsx("div",{className:"es-learning__intro-foot",children:e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:x,disabled:o,children:[p(a?"learning.start_new_topic":"learning.start_lesson"),e.jsx(fe,{})]})})]})}function ma({topicTitle:n,topicComplete:s,mascot:a,busy:l,onStart:r,onSkip:t,t:_}){const j=g.useRef(null);g.useEffect(()=>{j.current?.focus({preventScroll:!0})},[]);const o=_(s?"learning.section_quiz_title_complete":"learning.section_quiz_title");return e.jsxs("section",{className:"es-learning__intro","aria-label":o,children:[e.jsx(Ne,{name:a,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:o}),e.jsx("p",{className:"es-learning__intro-lesson",children:n}),e.jsx("p",{className:"es-learning__intro-note",children:_("learning.section_quiz_note")}),e.jsxs("div",{className:"es-learning__intro-foot",children:[e.jsxs("button",{ref:j,type:"button",className:"es-learning__btn es-learning__btn--block",onClick:r,disabled:l,children:[_("learning.section_quiz_start"),e.jsx(fe,{})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost",onClick:t,disabled:l,children:_("learning.section_quiz_skip")})]})]})}function wn({quiz:n,isPlacement:s,eyebrow:a,topics:l,results:r,busy:t,mascot:_,onAnswer:j,onAnswerOpen:o,onFinish:x,onBackToLesson:b,onChooseTopic:p,onContinue:f,continueLabel:m,t:w}){const q=g.useMemo(()=>n.questions??(n.question?[n.question]:[]),[n.questions,n.question]),v=!!n.questions,[I,P]=g.useState(!s||n.answered>0),[T,K]=g.useState(n.answers??{}),[u,E]=g.useState(()=>new Set(n.answeredIds??[])),[G,Y]=g.useState({}),[be,F]=g.useState({}),[L,B]=g.useState(()=>{if(!n.questions)return 0;const k=new Set(n.answeredIds??Object.keys(n.answers??{})),A=n.questions.findIndex(he=>!k.has(he.questionId));return A===-1?Math.max(0,n.questions.length-1):A});if(r)return e.jsx(ja,{results:r,questions:q,mascot:_,onContinue:f,continueLabel:m,t:w});if(!I)return e.jsxs("section",{className:"es-learning__intro","aria-label":w("learning.placement_intro_title"),children:[_!=="none"?e.jsx(Ne,{name:_,size:64}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:e.jsx(ia,{size:32})}),e.jsx("h4",{className:"es-learning__intro-title",children:w("learning.placement_intro_title")}),e.jsx("p",{className:"es-learning__intro-body",children:w("learning.placement_intro_body",{total:n.total})}),e.jsx("p",{className:"es-learning__intro-note",children:w("learning.placement_intro_note")}),l.length>0&&p&&e.jsxs("div",{className:"es-learning__topics",children:[e.jsx("p",{className:"es-learning__hint",children:w("learning.choose_topic")}),e.jsx("div",{className:"es-learning__topic-list",children:l.map(k=>e.jsx("button",{type:"button",className:"es-learning__topic",onClick:()=>p(k.topicId),disabled:t,children:k.title},k.topicId))})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:()=>P(!0),disabled:t,children:w("learning.placement_start")})]});const J=q[L];if(!J)return e.jsx("p",{className:"es-learning__hint",children:w("learning.quiz_finished")});const _e=k=>T[k]!==void 0||u.has(k)||(G[k]??"").trim().length>0,Xe=q.filter(k=>_e(k.questionId)).length,ve=T[J.questionId],Z=J.options===null,V=L===q.length-1,ae=q.every(k=>_e(k.questionId)),we=Object.fromEntries(q.filter(k=>_e(k.questionId)).map(k=>[k.questionId,0])),U=J.questionId;function X(k){K(A=>({...A,[U]:k})),j(U,k)}async function pe(){const k=(G[U]??"").trim();return!Z||!k||!o||u.has(U)&&be[U]===k?!0:await o(U,k)?(E(A=>new Set(A).add(U)),F(A=>({...A,[U]:k})),!0):!1}async function H(){await pe()&&B(k=>Math.min(q.length-1,k+1))}async function ke(){await pe()&&x()}return e.jsxs("section",{className:"es-learning__quiz","aria-label":w("learning.quiz_aria"),children:[b&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:b,children:["← ",w("learning.back_to_lesson")]}),s&&e.jsx("p",{className:"es-learning__eyebrow",children:w("learning.placement_intro")}),e.jsx("h4",{className:"es-learning__lesson-title",children:a??n.title}),e.jsx(xa,{total:q.length,currentIndex:L,answeredIds:we,questions:q,answeredCount:Xe,onJump:v?B:void 0,t:w}),e.jsx("p",{className:"es-learning__prompt",children:J.prompt}),Z?e.jsxs("div",{className:"es-learning__open",children:[e.jsx("textarea",{className:"es-learning__textarea",value:G[U]??"",onChange:k=>Y(A=>({...A,[U]:k.target.value})),placeholder:w("learning.open_answer_placeholder"),"aria-label":w("learning.open_answer_aria"),rows:5,disabled:t}),e.jsx("p",{className:"es-learning__hint",children:w("learning.open_answer_hint")})]}):null,!Z&&e.jsx("div",{className:"es-learning__options",role:"radiogroup","aria-label":w("learning.options_aria"),children:(J.options??[]).map((k,A)=>e.jsxs("label",{className:`es-learning__option${ve===A?" es-learning__option--selected":""}`,children:[e.jsx("input",{type:"radio",name:`learning-option-${J.questionId}`,checked:ve===A,onChange:()=>X(A),disabled:t}),e.jsx("span",{className:"es-learning__option-letter",children:String.fromCharCode(65+A)}),e.jsx("span",{className:"es-learning__option-text",children:k})]},A))}),e.jsxs("footer",{className:"es-learning__actions",children:[v?e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>B(k=>Math.max(0,k-1)),disabled:t||L===0,children:[e.jsx(He,{}),w("learning.previous_question")]}):e.jsx("span",{}),V?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{ke()},disabled:t||!ae,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):w("learning.finish_quiz")}):e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{H()},disabled:t||!_e(U),children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):e.jsxs(e.Fragment,{children:[w("learning.next_question"),e.jsx(fe,{})]})})]})]})}function xa({total:n,currentIndex:s,answeredIds:a,questions:l,answeredCount:r,onJump:t,t:_}){return e.jsxs("div",{className:"es-learning__progress",children:[e.jsx("div",{className:"es-learning__track",children:l.map((j,o)=>{const x=["es-learning__seg",a[j.questionId]!==void 0?"es-learning__seg--done":"",o===s?"es-learning__seg--current":""].filter(Boolean).join(" ");return t?e.jsx("button",{type:"button",className:x,onClick:()=>t(o),"aria-label":_("learning.go_to_question",{n:o+1}),"aria-current":o===s?"step":void 0},j.questionId):e.jsx("span",{className:x},j.questionId)})}),e.jsxs("span",{className:"es-learning__progress-count",children:[r,"/",n]})]})}function ja({results:n,questions:s,mascot:a,onContinue:l,continueLabel:r,t}){const _=n.total>0?Math.round(n.correct/n.total*100):0,j=(o,x)=>s.find(b=>b.questionId===o)?.prompt??x;return e.jsxs("section",{className:"es-learning__results","aria-label":t("learning.results_aria"),children:[e.jsxs("div",{className:"es-learning__score",children:[e.jsx(Ne,{name:a,size:28,className:"es-learning__mascot--score"}),e.jsxs("span",{className:"es-learning__score-value",children:[n.correct,"/",n.total]}),e.jsx("div",{className:"es-learning__score-bar",style:{"--es-learning-score":`${_}`},role:"img","aria-label":t("learning.quiz_result",{correct:n.correct,total:n.total})})]}),typeof n.passed=="boolean"&&typeof n.passPercent=="number"&&e.jsx("p",{className:`es-learning__pass es-learning__pass--${n.passed?"yes":"no"}`,children:t(n.passed?"learning.section_quiz_passed":"learning.section_quiz_failed",{percent:n.passPercent})}),n.rows&&n.rows.length>0&&e.jsx("ol",{className:"es-learning__review",children:n.rows.map(o=>e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${o.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:o.verdict==="correct"?e.jsx(oe,{}):o.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:j(o.questionId,o.prompt)}),(()=>{const x=o.answerText??(o.selectedOptionIndex!==null?o.options?.[o.selectedOptionIndex]??null:null);return x?e.jsx("p",{className:"es-learning__review-answer",children:t("learning.your_answer",{answer:x})}):null})(),o.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:o.feedback}),o.verdict!=="correct"&&o.correctAnswer&&e.jsx("p",{className:"es-learning__review-correct",children:t("learning.correct_answer",{answer:o.correctAnswer})}),o.explanation&&e.jsx(zn,{children:o.explanation})]})]},o.questionId))}),l&&e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:l,children:[r??t("learning.continue"),e.jsx(fe,{})]})]})}function fa({prompt:n,lessonTitle:s,answer:a,feedback:l,busy:r,showExplanations:t,onChange:_,onSubmit:j,t:o}){return e.jsxs("section",{className:"es-learning__question","aria-label":o("learning.question_aria"),children:[e.jsx("p",{className:"es-learning__eyebrow",children:s}),e.jsx("p",{className:"es-learning__prompt",children:n}),l?e.jsx(ba,{feedback:l,showExplanations:t,t:o}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:"es-learning__textarea",rows:5,value:a,onChange:x=>_(x.target.value),placeholder:o("learning.open_answer_placeholder"),"aria-label":o("learning.open_answer_aria"),disabled:r}),e.jsx("footer",{className:"es-learning__actions es-learning__actions--end",children:e.jsx("button",{type:"button",className:"es-learning__btn",onClick:j,disabled:r||!a.trim(),children:o(r?"learning.checking":"learning.submit_answer")})})]})]})}function ba({feedback:n,showExplanations:s,t:a}){const l=n.verdict==="correct"?e.jsx(oe,{size:18}):n.verdict==="wrong"?e.jsx(Te,{size:18}):e.jsx(qn,{size:18}),r=n.verdict==="correct"?a("learning.verdict_correct"):n.verdict==="wrong"?a("learning.verdict_wrong"):a("learning.verdict_ungradeable");return e.jsxs("div",{className:`es-learning__feedback es-learning__feedback--${n.verdict}`,role:"status",children:[e.jsxs("p",{className:"es-learning__verdict",children:[e.jsx("span",{className:"es-learning__verdict-icon","aria-hidden":"true",children:l}),r]}),n.feedback&&e.jsx("p",{className:"es-learning__feedback-text",children:n.feedback}),s&&n.explanation&&e.jsx(zn,{children:n.explanation})]})}const wa={all_in_cooldown:e.jsx(Qn,{}),not_due_yet:e.jsx(Qn,{}),all_mastered:e.jsx(ta,{}),no_curriculum:e.jsx(ra,{}),unavailable:e.jsx(oa,{})},Na={all_in_cooldown:{title:"learning.empty_cooldown_title",body:"learning.empty_cooldown"},not_due_yet:{title:"learning.next_lesson_title",body:"learning.next_lesson_body"},all_mastered:{title:"learning.empty_all_mastered_title",body:"learning.empty_all_mastered"},no_curriculum:{title:"learning.empty_no_curriculum_title",body:"learning.empty_no_curriculum"},unavailable:{title:"learning.unavailable_title",body:"learning.unavailable"}},va=new Set(["all_in_cooldown","all_mastered","not_due_yet"]);function ka(n){const[s,a]=g.useState(()=>Date.now());if(g.useEffect(()=>{if(!n)return;const t=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(t)},[n]),!n)return null;const l=new Date(n).getTime();if(!Number.isFinite(l))return null;const r=Math.max(0,Math.ceil((l-s)/6e4));return{hours:Math.floor(r/60),minutes:r%60}}function kn({kind:n,mascot:s,nextDueAt:a,t:l}){const{title:r,body:t}=Na[n],_=s!=="none"&&va.has(n),j=ka(n==="not_due_yet"?a:void 0);return e.jsxs("div",{className:`es-learning__state es-learning__state--${n}`,role:"status",children:[_?e.jsx(Ne,{name:s}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:wa[n]}),e.jsx("p",{className:"es-learning__state-title",children:l(r)}),e.jsx("p",{className:"es-learning__state-body",children:l(t)}),j&&e.jsx("p",{className:"es-learning__countdown",children:j.hours>0?l("learning.next_lesson_in_hm",{hours:j.hours,minutes:j.minutes}):l("learning.next_lesson_in_m",{minutes:j.minutes})})]})}function cs({lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:t,onDone:_,doneLabel:j,doneGoesBack:o=!1,onBackToTopic:x,rating:b,readAloud:p,readAloudRef:f,t:m}){const w=n.slides??[],q=w.length,v=w[s];if(!v)return null;const I=v.check??null,P=l[v.id],T=!I||P!==void 0,K=s===q-1;return e.jsxs("section",{className:"es-learning__lesson","aria-label":m("learning.lesson_aria"),children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:x,t:m}),e.jsx("div",{className:"es-learning__slide-dots","aria-hidden":"true",children:w.map((u,E)=>e.jsx("span",{className:`es-learning__slide-dot${E<=s?" es-learning__slide-dot--on":""}`},u.id))}),e.jsx(se,{graphicRef:v.graphicRef??n.graphicRef,graphicAlt:v.graphicAlt??n.graphicAlt,graphicUrl:v.graphicUrl??n.graphicUrl}),e.jsxs("div",{className:"es-learning__lesson-readable",ref:f,children:[e.jsx("h4",{className:"es-learning__lesson-title",style:{fontSize:16},children:v.title}),e.jsx(ss,{media:n.media,t:m,children:v.body})]}),p&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:p}),I&&e.jsxs("div",{className:`es-learning__slide-check${T?P===I.correctIndex?" es-learning__slide-check--good":" es-learning__slide-check--bad":""}`,children:[e.jsx("p",{className:"es-learning__slide-check-prompt",children:I.prompt}),e.jsx("div",{className:"es-learning__slide-check-options",children:I.options.map((u,E)=>{const G=P===E,Y=E===I.correctIndex,be=["es-learning__slide-choice",T&&G&&Y?"es-learning__slide-choice--good":"",T&&G&&!Y?"es-learning__slide-choice--bad":"",T&&Y&&!G?"es-learning__slide-choice--reveal":""].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",className:be,disabled:T||t,onClick:()=>r(v.id,E),children:[T&&G&&e.jsx("span",{className:"es-learning__slide-choice-icon","aria-hidden":"true",children:Y?e.jsx(oe,{size:14}):e.jsx(Te,{size:14})}),e.jsx("span",{children:u})]},E)})}),T&&e.jsx("p",{className:`es-learning__slide-check-fb${P===I.correctIndex?" es-learning__slide-check-fb--good":" es-learning__slide-check-fb--bad"}`,children:P===I.correctIndex?I.feedbackCorrect:I.feedbackIncorrect})]}),e.jsxs("div",{className:"es-learning__deck-foot",children:[K&&T&&b,!T&&e.jsx("p",{className:"es-learning__hint",children:m("learning.slide_check_required")}),e.jsxs("footer",{className:"es-learning__actions es-learning__actions--captioned",children:[e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>a(s-1),disabled:t||s===0,children:[e.jsx(He,{}),m("learning.previous_question")]}),e.jsx("p",{className:"es-learning__slide-caption",children:m("learning.slide_caption",{n:s+1,total:q})}),K?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:_,disabled:t||!T,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),m("learning.loading")]}):e.jsxs(e.Fragment,{children:[o&&e.jsx(He,{}),j??m("learning.lesson_done"),!o&&e.jsx(fe,{})]})}):e.jsxs("button",{type:"button",className:"es-learning__btn",onClick:()=>a(s+1),disabled:t||!T,children:[m("learning.next_question"),e.jsx(fe,{})]})]})]})]})}function ya({rows:n,t:s}){const[a,l]=g.useState(!1);if(n.length===0)return e.jsx("p",{className:"es-learning__hint",children:s("learning.review_unavailable")});const r=n.filter(t=>t.verdict==="correct").length;return e.jsxs("div",{className:"es-learning__review-block",children:[e.jsxs("button",{type:"button",className:`es-learning__review-toggle${a?" es-learning__review-toggle--open":""}`,"aria-expanded":a,onClick:()=>l(t=>!t),children:[e.jsx("span",{className:"es-learning__review-heading",children:s("learning.your_answers")}),e.jsx("span",{className:"es-learning__review-score",children:s("learning.review_score",{correct:r,total:n.length})}),e.jsx("span",{className:"es-learning__review-chevron","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]}),a?e.jsx("ol",{className:"es-learning__review",children:n.map(t=>{const _=t.answerText??(t.selectedOptionIndex!==null?t.options?.[t.selectedOptionIndex]??null:null);return e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${t.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:t.verdict==="correct"?e.jsx(oe,{}):t.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:t.prompt}),t.options&&t.options.length>0?e.jsx("ul",{className:"es-learning__review-options",children:t.options.map((j,o)=>{const x=o===t.selectedOptionIndex,b=t.correctAnswer!==null&&j===t.correctAnswer;return e.jsxs("li",{className:`es-learning__review-option es-learning__review-option--${b?"correct":x?"picked":"plain"}`,children:[e.jsx("span",{className:"es-learning__review-option-mark","aria-hidden":"true",children:b?e.jsx(oe,{size:12}):x?e.jsx(Te,{size:12}):null}),e.jsx("span",{className:"es-learning__review-option-text",children:j}),(x||b)&&e.jsx("span",{className:"es-learning__review-option-tag",children:s(x?"learning.answer_tag_yours":"learning.answer_tag_correct")})]},o)})}):e.jsxs("div",{className:"es-learning__review-pair",children:[_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_yours")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--yours",children:_})]}),t.verdict!=="correct"&&t.correctAnswer&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_correct")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--correct",children:t.correctAnswer})]})]}),t.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:t.feedback}),t.explanation&&e.jsx(zn,{children:t.explanation})]})]},t.questionId)})}):null]})}function Jn({lesson:n,slideIndex:s,onSlideIndexChange:a,slideAnswers:l,onSlideAnswer:r,onBack:t,backLabel:_,showBackLink:j=!0,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,onFinish:f,finishLabel:m,review:w,t:q}){const v=(n.slides?.length??0)>0,I=f??t,P=f?m??_:_,T=!!o&&!f;return e.jsxs("div",{className:`es-learning__reader${w?" es-learning__reader--reviewed":""}`,children:[j&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,children:["← ",_]}),v?e.jsx(cs,{lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}):e.jsx(rs,{lesson:n,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}),w&&e.jsx(ya,{rows:w,t:q})]})}function Ia({graphicRef:n,graphicUrl:s,graphicAlt:a,done:l}){const r=Le(n);if(!r)return null;const t=l?" es-learning__lesson-thumb--done":"";if(r.kind==="media")return s?e.jsx("img",{src:s,alt:a??"",loading:"lazy",className:`es-learning__lesson-thumb es-learning__lesson-thumb--image${t}`,"data-testid":"lesson-thumb-image"}):null;const _=Ye(r.slug);return _?e.jsx("span",{className:`es-learning__lesson-thumb${t}`,"aria-hidden":"true","data-testid":"lesson-thumb-icon",children:e.jsx(_,{size:20})}):null}function Sn({iconRef:n,iconUrl:s}){const a=Le(n);if(!a)return null;if(a.kind==="media")return s?e.jsx("img",{src:s,alt:"","aria-hidden":"true",loading:"lazy",className:"es-learning__topic-icon es-learning__topic-icon--image","data-testid":"topic-icon-image"}):null;const l=Ye(a.slug);return l?e.jsx("span",{className:"es-learning__topic-icon","aria-hidden":"true","data-testid":"topic-icon",children:e.jsx(l,{size:16})}):null}function ds({topics:n,onOpen:s,t:a}){return n.length===0?e.jsx("p",{className:"es-learning__hint",children:a("learning.empty_no_curriculum")}):e.jsx("section",{className:"es-learning__topics-view","aria-label":a("learning.nav_topics"),children:e.jsx("ul",{className:"es-learning__topic-cards",children:n.map(l=>{const r=l.lessonCount>0?Math.round(l.doneCount/l.lessonCount*100):0,t=l.doneCount===l.lessonCount&&l.lessonCount>0,_=as(l.heroRef,l.heroUrl);return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__topic-card",onClick:()=>s(l.topicId),children:[e.jsx(se,{graphicRef:l.heroRef,graphicAlt:l.heroAlt,graphicUrl:l.heroUrl,done:t}),e.jsxs("span",{className:"es-learning__topic-card-head",children:[!_&&e.jsx(Sn,{iconRef:l.iconRef,iconUrl:l.iconUrl}),e.jsx("span",{className:"es-learning__topic-card-title",children:l.title}),t&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${r}%`}})}),e.jsx("span",{className:"es-learning__topic-card-meta",children:a("learning.topic_progress",{mastered:l.doneCount,total:l.lessonCount})})]})},l.topicId)})})})}const Ve=["basics","intermediate","advanced","expert"],za={basics:"learning.level_basics",intermediate:"learning.level_intermediate",advanced:"learning.level_advanced",expert:"learning.level_expert"};function qa({level:n,t:s}){const a=Ve.indexOf(n)+1,l=Ve.length;return e.jsx("span",{className:"es-learning__level-stars",role:"img","aria-label":s("learning.level_difficulty",{n:a,total:l}),"data-testid":"learning-level-stars",children:Ve.map((r,t)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__level-star${t<a?" es-learning__level-star--on":""}`,children:"★"},t))})}const Ke=n=>n.lessonCount>0&&n.doneCount===n.lessonCount;function Ca({tracks:n,untracked:s=[],currentTrackId:a,onOpenTrack:l,onOpenUntracked:r,t}){const _=n.filter(o=>o.topicCount>0);if(_.length===0&&s.length===0)return e.jsx("p",{className:"es-learning__hint",children:t("learning.empty_no_curriculum")});const j=s.filter(Ke).length;return e.jsxs("section",{className:"es-learning__tracks-view","aria-label":t("learning.tracks_heading"),children:[e.jsx("div",{className:"es-learning__infobar es-learning__infobar--intro",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[t("learning.tracks_intro"),_.length>1&&e.jsxs(e.Fragment,{children:[" ",e.jsx("strong",{children:t("learning.track_independent_hint")})]})]})}),e.jsxs("ul",{className:"es-learning__tracks",children:[_.map(o=>{const x=o.topicCount>0?Math.round(o.doneTopicCount/o.topicCount*100):0,b=as(o.heroRef,o.heroUrl),p=o.topicCount>0&&o.doneTopicCount===o.topicCount;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:`es-learning__track-card${o.trackId===a?" es-learning__track-card--current":""}`,onClick:()=>l(o.trackId),children:[e.jsx(se,{graphicRef:o.heroRef,graphicAlt:o.heroAlt,graphicUrl:o.heroUrl,done:p}),e.jsxs("span",{className:"es-learning__track-card-head",children:[!b&&e.jsx("span",{className:"es-learning__track-icon",children:e.jsx(Sn,{iconRef:o.iconRef,iconUrl:o.iconUrl})}),e.jsx("span",{className:"es-learning__track-card-title",children:o.title}),p&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),o.description&&e.jsx("span",{className:"es-learning__track-card-desc",children:o.description}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:o.doneTopicCount,total:o.topicCount})})]})},o.trackId)}),s.length>0&&e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__track-card",onClick:()=>r?.(),children:[e.jsx("span",{className:"es-learning__track-card-head",children:e.jsx("span",{className:"es-learning__track-card-title",children:t("learning.track_unassigned")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:j,total:s.length})})]})})]})]})}function Sa({track:n,currentTopicId:s,onOpenTopic:a,onBack:l,t:r}){const t=new Set(n.topics.filter(Ke).map(b=>b.topicId)),_=n.topics.find(b=>b.topicId===s),j=_?.unlocks??[],o=Ve.map(b=>({level:b,topics:n.topics.filter(p=>(p.level??"basics")===b)})).filter(b=>b.topics.length>0),x=n.topicCount>0?Math.round(n.doneTopicCount/n.topicCount*100):0;return e.jsxs("section",{className:"es-learning__roadmap-view","aria-label":n.title,children:[e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:l,children:["← ",r("learning.tracks_heading")]}),e.jsxs("div",{className:"es-learning__detail-head",children:[e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.track_progress",{done:n.doneTopicCount,total:n.topicCount})})]})]}),_&&j.length>0&&e.jsxs("div",{className:"es-learning__unlocks",children:[e.jsx("span",{className:"es-learning__unlocks-lead",children:r("learning.unlocks_lead",{topic:_.title})}),e.jsx("ul",{className:"es-learning__unlocks-list",children:j.map(b=>e.jsx("li",{children:b.title},b.topicId))})]}),e.jsx("div",{className:"es-learning__infobar es-learning__infobar--order",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[e.jsx("strong",{children:r("learning.roadmap_heading")})," — ",r("learning.roadmap_why")]})}),e.jsx("ul",{className:"es-learning__levels",children:o.map(b=>e.jsxs("li",{children:[e.jsxs("span",{className:"es-learning__level-head",children:[e.jsx("span",{className:"es-learning__level-name",children:r(za[b.level])}),e.jsx("span",{className:"es-learning__level-rule","aria-hidden":"true"}),e.jsx(qa,{level:b.level,t:r})]}),e.jsx("ul",{className:"es-learning__level-topics",children:b.topics.map(p=>{const f=p.prerequisites??[],m=f.some(I=>!t.has(I.topicId)),w=ls(p.heroRef,p.heroUrl),q=Ke(p),v=["es-learning__road-row",w?"es-learning__road-row--card":"",m?"es-learning__road-row--ahead":"",p.topicId===s?"es-learning__road-row--current":""].filter(Boolean).join(" ");return e.jsx("li",{children:e.jsxs("button",{type:"button",className:v,onClick:()=>a(p.topicId),children:[w?e.jsx(se,{graphicRef:p.heroRef,graphicAlt:p.heroAlt,graphicUrl:p.heroUrl,variant:"card",done:q}):e.jsx(Sn,{iconRef:p.iconRef,iconUrl:p.iconUrl}),e.jsxs("span",{className:"es-learning__road-body",children:[e.jsx("span",{className:"es-learning__road-title",children:p.title}),f.length>0&&e.jsx("span",{className:"es-learning__road-needs",children:r("learning.topic_after",{names:f.map(I=>I.title).join(", ")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:r("learning.topic_progress",{mastered:p.doneCount,total:p.lessonCount})})]}),q?e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})}):e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]})},p.topicId)})})]},b.level))})]})}const Aa={mastered:"learning.state_mastered",done:"learning.state_done",gap:"learning.state_in_progress",current:"learning.state_current",unseen:"learning.state_locked"},Ta=n=>n==="mastered"||n==="done",La="learning.state_available";function Ma({topic:n,onOpenLesson:s,onStartSectionQuiz:a,canPickAnyLesson:l=!1,backLabel:r,onBack:t,t:_}){const j=n.lessonCount>0?Math.round(n.doneCount/n.lessonCount*100):0;return e.jsxs("section",{className:"es-learning__topic-detail","aria-label":n.title,children:[r&&t&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,"aria-label":_("learning.back_to_track",{track:r}),children:["← ",r]}),e.jsxs("div",{className:"es-learning__detail-head",children:[!(r&&t)&&e.jsx("p",{className:"es-learning__eyebrow",children:_("learning.nav_topics")}),e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsx(se,{graphicRef:n.heroRef,graphicAlt:n.heroAlt,graphicUrl:n.heroUrl,variant:"hero",done:Ke(n)}),e.jsxs("div",{className:"es-learning__progress-block",children:[e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lessons_done")}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${j}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:_("learning.progress_count",{done:n.doneCount,total:n.lessonCount})})]})]})]}),n.hasSectionQuiz===!0&&a&&e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost es-learning__section-cta",onClick:a,children:_("learning.section_quiz_cta")}),e.jsxs("div",{className:"es-learning__list-block",children:[e.jsx("p",{className:"es-learning__list-divider",children:e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lesson_list")})}),e.jsx("ol",{className:"es-learning__lesson-list",children:n.lessons.map(o=>{const x=l||o.servedAt!==null||o.state==="mastered"||o.state==="done"||o.state==="current",b=x?"button":"div",p=ls(o.graphicRef,o.graphicUrl),f=x&&o.state==="unseen"?"available":o.state,m=_(x&&o.state==="unseen"?La:Aa[o.state]),w=o.servedAt===null&&o.state==="mastered",q=Ta(o.state);return p?e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-card es-learning__lesson-card--${o.state}${x?"":" es-learning__lesson-card--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(se,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,variant:"card",done:q}),e.jsx("span",{className:"es-learning__lesson-card-title",children:o.title}),(o.isMilestone||w)&&e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone&&_("learning.milestone"),w&&`${o.isMilestone?" · ":""}${_("learning.not_delivered")}`]}),e.jsxs("span",{className:"es-learning__lesson-card-foot",children:[e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m}),!x&&e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})]})},o.lessonId):e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-row es-learning__lesson-row--${o.state}${x?"":" es-learning__lesson-row--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(Ia,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,done:q}),e.jsxs("span",{className:"es-learning__lesson-row-body",children:[e.jsx("span",{className:"es-learning__lesson-row-title",children:o.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone?_("learning.milestone"):n.title,w&&` · ${_("learning.not_delivered")}`]}),e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m})]}),x?e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})}):e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})},o.lessonId)})})]})]})}function $a({view:n,browse:s,mascot:a,slidePositions:l,newsTile:r,onGoToday:t,onOpenLesson:_,onOpenTopic:j,t:o}){const x=s?.summary?.doneLessons??0,b=s?.summary?.totalLessons??0,p=b>0?Math.round(x/b*100):0,f=s?.streak??{currentStreak:0,longestStreak:0},m=(s?.topics??[]).flatMap(v=>(v.lessons??[]).map(I=>({topic:v,lesson:I}))).filter(({lesson:v})=>v.servedAt!==null&&!v.done).sort((v,I)=>(I.lesson.servedAt??"").localeCompare(v.lesson.servedAt??"")).slice(0,3),w=s?.summary?.attempts?.[0]??null,q=s?.topics??[];return e.jsxs("section",{className:"es-learning__dashboard","aria-label":o("learning.nav_dashboard"),children:[e.jsx(Oa,{view:n,mascot:a,onGoToday:t,t:o}),s&&e.jsxs("div",{className:"es-learning__stats-deck",children:[e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--ring",children:[e.jsxs("div",{className:"es-learning__ring",role:"img","aria-label":o("learning.dashboard_mastered_label",{pct:p}),style:{"--es-learning-ring":`${p}`},children:[e.jsx("span",{className:"es-learning__ring-value",children:p}),e.jsx("span",{className:"es-learning__ring-unit",children:"%"})]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_mastered")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[x,"/",b]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_lessons_done")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--streak",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[e.jsx(_a,{size:15}),f.currentStreak]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_streak")}),f.longestStreak>f.currentStreak&&e.jsx("span",{className:"es-learning__stats-sub",children:o("learning.dashboard_best_streak",{n:f.longestStreak})})]})]}),m.length>0&&_&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_inprogress_title")}),m.map(({topic:v,lesson:I})=>e.jsx(Ua,{topicTitle:v.title,lesson:I,position:l?.[I.lessonId],onOpen:()=>_(v.topicId,I),t:o},I.lessonId))]}),r,w&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_last_quiz")}),e.jsx("ul",{className:"es-learning__attempt-list",children:e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:w.title}),e.jsx(Ra,{correct:w.correct,total:w.total,t:o})]})})]}),j&&q.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.nav_topics")}),e.jsx(ds,{topics:q,onOpen:j,t:o})]})]})}function Ra({correct:n,total:s,t:a}){return s<=0?e.jsx("span",{className:"es-learning__attempt-score",children:a("learning.review_score",{correct:n,total:s})}):e.jsx("span",{className:"es-learning__attempt-segs",role:"img","aria-label":a("learning.attempt_score_a11y",{correct:n,total:s}),"data-testid":"learning-attempt-segments",children:Array.from({length:s},(l,r)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__attempt-seg es-learning__attempt-seg--${r<n?"good":"bad"}`},r))})}function Ua({topicTitle:n,lesson:s,position:a,onOpen:l,t:r}){const t=!!a&&a.total>0,_=a&&t?Math.round((a.index+1)/a.total*100):0;return e.jsxs("button",{type:"button",className:"es-learning__continue",onClick:l,children:[e.jsxs("span",{className:"es-learning__continue-row",children:[e.jsx(se,{graphicRef:s.graphicRef,graphicUrl:s.graphicUrl,graphicAlt:s.graphicAlt,variant:"continue"}),e.jsxs("span",{className:"es-learning__continue-body",children:[e.jsx("span",{className:"es-learning__continue-title",children:s.title}),e.jsx("span",{className:"es-learning__lesson-row-meta",children:n})]})]}),a&&t&&e.jsxs("span",{className:"es-learning__continue-bar",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${_}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.slide_caption",{n:a.index+1,total:a.total})})]})]})}function Oa({view:n,mascot:s,onGoToday:a,t:l}){if(!n)return null;if(n.mode==="new_information"){const r=n.lesson.slides?.length??0;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--hero",onClick:a,children:[e.jsx(se,{graphicRef:n.lesson.graphicRef,graphicUrl:n.lesson.graphicUrl,graphicAlt:n.lesson.graphicAlt,variant:"today"}),e.jsxs("span",{className:"es-learning__today-inner",children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:n.lesson.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[n.lesson.topicTitle,r>0&&` · ${l("learning.slide_count",{total:r})}`]})]})]})}if(n.mode==="checking_question"||n.mode==="lesson_quiz"||n.mode==="section_quiz"||n.mode==="placement_quiz"){const r=n.mode==="checking_question"?null:n.quiz;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--gold",onClick:a,children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:l("learning.dashboard_continue")}),r&&e.jsx("span",{className:"es-learning__lesson-row-meta",children:l("learning.quiz_progress",{answered:r.answered,total:r.total})})]})}return n.mode==="nothing"?e.jsx("div",{className:"es-learning__today-card",children:e.jsx(kn,{kind:n.reason,mascot:s,nextDueAt:n.nextDueAt,t:l})}):null}function Ba({browse:n,t:s}){const{topics:a,summary:l}=n;return e.jsxs("section",{className:"es-learning__progress-view","aria-label":s("learning.nav_progress"),children:[e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.progress_topics_title")}),e.jsx("p",{className:"es-learning__hint",children:s("learning.progress_overall",{mastered:l.doneLessons,total:l.totalLessons})})]}),e.jsx("ul",{className:"es-learning__by-topic",children:a.map(r=>{const t=r.lessonCount>0?Math.round(r.doneCount/r.lessonCount*100):0;return e.jsxs("li",{className:"es-learning__by-topic-row",children:[e.jsx("span",{className:"es-learning__by-topic-title",children:r.title}),e.jsxs("span",{className:"es-learning__by-topic-count",children:[r.doneCount,"/",r.lessonCount]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${t}%`}})})]},r.topicId)})}),l.attempts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.quiz_history")}),e.jsx("ul",{className:"es-learning__attempt-list",children:l.attempts.map(r=>e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:r.title}),e.jsxs("span",{className:"es-learning__attempt-score",children:[r.correct,"/",r.total]})]},r.attemptId??r.quizId))})]})]})}const Da="es-learning-place",Ea=10080*60*1e3;function us(n){return`${Da}:${n}`}function Vn(n,s){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="number"&&Number.isFinite(a[1])&&a[1]>=s))}const Pa=n=>n==="dashboard"||n==="today"||n==="topics"||n==="news"||n==="progress";function Fa(n,s){try{const a=localStorage.getItem(us(n));if(!a)return null;const l=JSON.parse(a);return!Pa(l.tab)||(l.ownerId??null)!==s||typeof l.savedAt!="number"||Date.now()-l.savedAt>Ea?null:{tab:l.tab,openTopicId:typeof l.openTopicId=="string"?l.openTopicId:null,readingLessonId:typeof l.readingLessonId=="string"?l.readingLessonId:null,slideIndex:Vn(l.slideIndex,0),slideTotals:Vn(l.slideTotals,1)}}catch{return null}}function Qa(n,s,a){try{const l={...a,ownerId:s,savedAt:Date.now()};localStorage.setItem(us(n),JSON.stringify(l))}catch{}}const Wa=".es-widget__content, .gaio-theme__content";function Ga(n){const s=n?.ownerDocument;if(!n||!s)return;let a=n;for(;a&&a!==s.body&&a!==s.documentElement;){if(a.scrollTop!==0&&(a.scrollTop=0),a.matches(Wa))return;a=a.parentElement}}const Ja="es-learning-rated";function gs(n){return`${Ja}:${n}`}function _s(n,s){const[a]=In(()=>{const l=localStorage.getItem(gs(n));if(!l)return null;const r=JSON.parse(l);return(r.ownerId??null)!==s||!Array.isArray(r.lessonIds)?null:new Set(r.lessonIds.filter(t=>typeof t=="string"))});return a??new Set}function Va(n,s,a){const l=_s(n,s);l.add(a);const r=[...l].slice(-500),t={ownerId:s,lessonIds:r};return In(()=>localStorage.setItem(gs(n),JSON.stringify(t))),new Set(r)}const Ha=["learning-load","learning-browse","learning-read-lesson","learning-lesson-review","learning-lesson-quiz","learning-news-load"],Ka=["learning-answer-quiz","learning-answer-quiz-open","learning-answer-open","learning-quiz-finish","learning-start-lesson","learning-complete-lesson"],Ya=300*1e3,ps=new Set(Ha),Ze=new Map;let Ae;function hs(n){n!==Ae&&(Ze.clear(),Ae=n)}function Za(n){return n?JSON.stringify(Object.keys(n).sort().map(s=>[s,String(n[s])])):""}function ms(n,s,a,l){return`${n}\0${s}\0${a}\0${Za(l)}`}function re(n,s,a,l,r=Date.now()){if(hs(s),s===null||!ps.has(a))return null;const t=Ze.get(ms(n,s,a,l));return t?{data:t.data,stale:r-t.storedAt>=Ya}:null}function ge(n,s,a,l,r,t=Date.now()){if(Ae===void 0)Ae=s;else if(s!==Ae)return;s===null||!ps.has(a)||Ze.set(ms(n,s,a,l),{data:r,storedAt:t})}function Hn(){Ze.clear()}function Xa(n){hs(n)}function el(n){return Ps(n)}function nl(n,s){if(!n)return null;const[a]=In(()=>{const l=new Date(n);return Number.isNaN(l.getTime())?null:new Intl.DateTimeFormat(s,{day:"numeric",month:"short"}).format(l)});return a??null}function sl(n,s){if(!n)return null;const a=n.split("-")[0]?.toLowerCase();return!a||a===s.split("-")[0]?.toLowerCase()?null:a.toUpperCase()}function yn({item:n,currentLanguage:s,onPick:a,t:l}){const r=nl(n.publishedAt,s),t=sl(n.language,s),_=n.sourceName??n.host;return e.jsx("button",{type:"button",className:`es-learning__news${n.read?" es-learning__news--read":""}`,onClick:()=>a(n),"data-testid":"learning-news-card",children:e.jsxs("span",{className:"es-learning__news-row",children:[e.jsx("span",{className:"es-learning__news-thumb",children:n.thumbnailUrl&&e.jsx("img",{src:n.thumbnailUrl,alt:"",loading:"lazy"})}),e.jsxs("span",{className:"es-learning__news-body",children:[e.jsx("span",{className:"es-learning__news-title",children:n.title}),e.jsxs("span",{className:"es-learning__news-meta",children:[_&&e.jsx("span",{children:_}),_&&r&&e.jsx("span",{"aria-hidden":"true",children:"·"}),r&&e.jsx("span",{children:r}),t&&e.jsx("span",{className:"es-learning__news-lang",children:t})]})]}),n.read?e.jsx("span",{className:"es-learning__news-done",role:"img","aria-label":l("learning.news_read"),children:e.jsx(oe,{size:13})}):e.jsx("span",{className:"es-learning__news-ext","aria-hidden":"true",children:e.jsx(ts,{size:14})})]})})}function al({item:n,currentLanguage:s,onPick:a,t:l}){return e.jsxs("div",{className:"es-learning__news-tile","data-testid":"learning-news-tile",children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_suggested_title")}),e.jsx(yn,{item:n,currentLanguage:s,onPick:a,t:l})]})}function ll({news:n,currentLanguage:s,onPick:a,t:l}){const r=n?.unread??[],t=n?.read??[];return r.length===0&&t.length===0?e.jsx("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:e.jsx("p",{className:"es-learning__news-empty",children:l("learning.news_empty")})}):e.jsxs("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:[r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_new_title")}),e.jsx("div",{className:"es-learning__news-list",children:r.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_read_title")}),e.jsx("div",{className:"es-learning__news-list",children:t.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]})]})}function il({item:n,onCancel:s,onConfirm:a,t:l}){const r=g.useRef(null);return g.useEffect(()=>{r.current?.focus()},[]),g.useEffect(()=>{const t=_=>{_.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),e.jsxs("div",{className:"es-learning__leave",role:"dialog","aria-modal":"true","aria-labelledby":"es-learning-leave-title","data-testid":"learning-news-leave",children:[e.jsx("div",{className:"es-learning__leave-scrim","aria-hidden":"true",onClick:s}),e.jsxs("div",{className:"es-learning__leave-card",children:[e.jsx("span",{className:"es-learning__leave-icon","aria-hidden":"true",children:e.jsx(ts,{size:22})}),e.jsx("p",{className:"es-learning__leave-title",id:"es-learning-leave-title",children:l("learning.news_leave_title")}),e.jsx("p",{className:"es-learning__leave-body",children:l("learning.news_leave_body")}),e.jsx("span",{className:"es-learning__leave-host",children:n.host}),e.jsxs("div",{className:"es-learning__leave-actions",children:[e.jsx("button",{type:"button",className:"es-learning__leave-btn es-learning__leave-btn--cancel",onClick:s,children:l("learning.news_leave_cancel")}),e.jsx("button",{ref:r,type:"button",className:"es-learning__leave-btn es-learning__leave-btn--go",onClick:a,children:l("learning.news_leave_confirm")})]})]})]})}function Kn(){const n=new Date,s=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${s}-${a}-${l}`}function tl(n){return!!n&&typeof n=="object"&&typeof n.error=="string"}async function R(n,s,a){const[l]=await Ls(n.call(s,a));return!l||tl(l)?null:l}const Nn="__untracked__";function vn(n){return!!n&&Array.isArray(n.unread)&&Array.isArray(n.read)}function rl(n,s,a){const l=n.unread.find(r=>r.id===s);return{suggested:n.suggested?.id===s?n.suggested.pinned?{...n.suggested,read:!0}:null:n.suggested,unread:n.unread.filter(r=>r.id!==s),read:l?[{...l,read:!0},...n.read]:n.read,unreadCount:a}}function jl(n){const s=n.auth?.user?.id??null;return e.jsx(ol,{...n},`${n.productId}\0${s??"signed-out"}`)}function ol({config:n,data:s,actions:a,i18n:l,builderMode:r,productId:t,auth:_,baseUrl:j,externalContext:o,previewMode:x,readOnly:b}){const p=l?.t??(i=>i),f=l?.currentLanguage??"en",m=_?.user?.id??null,w=As(n.title,f,{t:p,fallbackKey:"learning.title",enDefault:"Learning"}),q=n.showExplanations!==!1,v=ha(n.mascot),I=n.showBrowse!==!1,P=I&&n.showDashboard!==!1,T=I&&n.showProgress===!0,K=I&&n.showNews!==!1,[u,E]=g.useState(()=>r?null:re(t,m,"learning-load",{language:f})?.data??null),[G,Y]=g.useState(()=>!r&&re(t,m,"learning-load",{language:f})===null),[be,F]=g.useState(null),[L,B]=g.useState(!1),[J,_e]=g.useState(""),[Xe,ve]=g.useState(null),[Z,V]=g.useState(null),[ae,we]=g.useState(null),U=g.useRef(r?null:Fa(t,m)).current,[X,pe]=g.useState(U?.tab??"dashboard"),[H,ke]=g.useState(()=>{if(r||!K)return null;const i=re(t,m,"learning-news-load")?.data;return vn(i)?i:null}),k=g.useRef(null);k.current=H;const[A,he]=g.useState(null),[ce,Me]=g.useState(()=>U?.slideIndex??{}),[en,$e]=g.useState({}),[ye,xs]=g.useState(()=>U?.slideTotals??{}),[js]=g.useState(()=>r?new Set:_s(t,m)),[fs,bs]=g.useState(()=>new Set),Ie=g.useRef(null),Re=i=>{if(n?.readAloudEnabled!==!0)return null;const c=o?.renderReadAloud;return typeof c!="function"?null:c(`learning-lesson-${i}`,Ie)},nn=i=>r||js.has(i)||fs.has(i)?null:e.jsx($s,{compact:!0,blockSlug:"learning",subjectType:"learning_lesson",subjectId:i,promptKey:"block_rating.prompt_lesson",ariaKey:"block_rating.rate_lesson_aria",baseUrl:j,apiKey:o?.apiKey,jwt:_?.jwt,previewMode:x||b,settleInPlace:!0,onRated:()=>Va(t,m,i),onFeedbackCycleDone:()=>bs(c=>new Set(c).add(i)),t:p}),[sn,an]=g.useState(!1),[ws,Ns]=g.useState(!1),[Ue,ln]=g.useState(!1),[An,Tn]=g.useState(null),[vs,tn]=g.useState(!1),Ln=g.useRef(null),[le,me]=g.useState(U?.openTopicId??null),[xe,Oe]=g.useState(null),[W,de]=g.useState(null),[N,ze]=g.useState(()=>r?null:re(t,m,"learning-browse",{language:f})?.data??null),[rn,on]=g.useState(!1),[S,ee]=g.useState(null),[ks,Be]=g.useState(null),[M,De]=g.useState(null),[O,Ee]=g.useState(null),[ue,Mn]=g.useState(null),[cn,dn]=g.useState(!1),[$,un]=g.useState(null),ie=g.useRef(p);ie.current=p;const $n=g.useCallback((i,c)=>(Ka.includes(i)&&(Hn(),on(!0)),a.call(i,c)),[a]),C=g.useMemo(()=>({...a,call:$n}),[a,$n]),je=g.useCallback(async i=>{F(null),ve(null),V(null),we(null),_e("");const c={...i?{preferredTopicId:i}:{},language:f},d=re(t,m,"learning-load",c);if(d){if(E(d.data),Y(!1),!d.stale)return d.data;const y=await R(C,"learning-load",c);return y&&(ge(t,m,"learning-load",c,y),E(y)),y??d.data}Y(!0);const h=await R(C,"learning-load",c);return h?(ge(t,m,"learning-load",c,h),E(h)):F(ie.current("learning.error_load")),Y(!1),h},[C,f,m,t]);g.useEffect(()=>{if(r){const i=s?.mode??"nothing";E(i==="nothing"?{mode:"nothing",reason:s?.reason??"all_in_cooldown"}:{mode:"unavailable"});return}je()},[r,je,s?.mode,s?.reason]),g.useEffect(()=>{const i=a.on?.("learning:reload",()=>{Hn(),je()});return()=>i?.()},[a,je]),g.useEffect(()=>{if(r||!K)return;let i=!1;return(async()=>{const c=re(t,m,"learning-news-load");if(c&&(vn(c.data)&&ke(c.data),!c.stale))return;const d=await R(a,"learning-news-load");i||!d||(ge(t,m,"learning-news-load",void 0,d),vn(d)&&ke(d))})(),()=>{i=!0}},[a,r,m,t,K]);const ys=g.useCallback(()=>{const i=A;if(!i)return;he(null);const c=el(i.url);if(!c){F(ie.current("learning.news_error_open"));return}const d=window.open(c,"_blank","noopener,noreferrer");d&&(d.opener=null),(async()=>{const h=await R(a,"learning-news-open",{newsItemId:i.id});if(!h||typeof h.unreadCount!="number")return;const y=k.current;if(!y)return;const D=rl(y,i.id,h.unreadCount);ke(D),ge(t,m,"learning-news-load",void 0,D)})()},[a,A,m,t]);g.useEffect(()=>{Xa(m)},[m]),g.useEffect(()=>{if(X==="today"||r||N&&(M||W||$))return;const i={language:f},c=rn?null:re(t,m,"learning-browse",i);if(N&&!rn&&!(c&&c.stale)||(c&&ze(c.data),c&&!c.stale))return;let d=!1;return(async()=>{const h=await R(C,"learning-browse",i);d||!h||!Array.isArray(h.topics)||!h.summary||(ge(t,m,"learning-browse",i,h),ze(h),on(!1))})(),()=>{d=!0}},[X,N,rn,M,W,$,r,C,f,m,t]);const gn=g.useCallback(async(i,c,d)=>{const h=await R(C,"learning-answer-quiz",{quizId:i,questionId:c,selectedOptionIndex:d,language:f});if(!h){F(ie.current("learning.error_answer"));return}a.emit("learning:answerSubmitted",{questionId:c}),h.completed&&V(h.completed)},[a,C,f]),_n=g.useCallback(async(i,c,d)=>{B(!0);const h=await R(C,"learning-answer-quiz-open",{quizId:i,questionId:c,answer:d,language:f});return h?a.emit("learning:answerSubmitted",{questionId:c}):F(ie.current("learning.error_answer")),B(!1),!!h},[a,C,f]),pn=g.useCallback(async(i,c)=>{if(L)return;B(!0);const d=await R(C,"learning-quiz-finish",{quizId:i,language:f,activeDate:Kn()});if(d){if(V(d),a.emit("learning:quizCompleted",d),Mn(d.sectionQuiz??null),d.streak&&ze(h=>h&&{...h,streak:d.streak}),!c?.isSectionQuiz){const h=await R(C,"learning-load",{language:f});h?.mode&&we(h)}}else Z||F(ie.current("learning.error_answer"));B(!1)},[a,C,L,f,Z]),Rn=g.useCallback(async(i,c,d)=>{if(L)return!1;B(!0);const h=await R(C,"learning-section-quiz",{topicId:i,language:f});B(!1);const y=h?.quiz??null;return y?(V(null),dn(!1),un({quiz:y,topicTitle:h?.topicTitle||c,origin:d}),!0):!1},[L,C,f]),Is=g.useCallback(async i=>{const c=J.trim();if(!c||L)return;B(!0);const d=await R(C,"learning-answer-open",{questionId:i,answer:c,language:f});d?(a.emit("learning:answerSubmitted",{questionId:i,verdict:d.verdict}),ve(d)):F(ie.current("learning.error_answer")),B(!1)},[a,C,L,f,J]),Pe=g.useCallback(async i=>{B(!0);const c=await R(C,"learning-start-lesson",{lessonId:i});return B(!1),c?!0:(F(ie.current("learning.error_load")),!1)},[C]),hn=g.useCallback(async i=>{await Pe(i)&&ln(!0)},[Pe]),Fe=g.useCallback(async(i,c)=>{i?.mode==="new_information"&&i.isNew&&(c!==null&&i.lesson.topicId!==c?Tn(i.lesson.lessonId):await hn(i.lesson.lessonId)),tn(!1)},[hn]),Qe=g.useCallback(()=>{dn(!1),Mn(null),un(null),V(null),ln(!1),ae&&(E(ae),we(null),tn(!0),Fe(ae,Ln.current))},[Fe,ae]),We=g.useCallback(async i=>{const c=await R(C,"learning-complete-lesson",{lessonId:i,activeDate:Kn()});return c?.streak&&ze(d=>d&&{...d,streak:c.streak}),c},[C]),Un=g.useCallback(async(i,c)=>{ln(!1),tn(!0),Ln.current=c??null,i&&(await We(i),Me(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h}),$e(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h})),await Fe(await je(),c??null)},[Fe,je,We]),te=g.useCallback(async(i,c)=>{F(null),Ns(c?.fromQuiz===!0),de({...i}),Be(null);const d={lessonId:i.lessonId,language:f},h=re(t,m,"learning-read-lesson",d);if(h)ee(h.data),h.stale&&(async()=>{const y=await R(C,"learning-read-lesson",d);y&&(y.body||y.slides?.length)&&(ge(t,m,"learning-read-lesson",d,y),ee(y))})();else{ee(null);const y=await R(C,"learning-read-lesson",d);if(!y||!y.body&&!y.slides?.length){de(null),F(ie.current("learning.error_load"));return}ge(t,m,"learning-read-lesson",d,y),ee(y)}if(i.done){const y={lessonId:i.lessonId,language:f},D=re(t,m,"learning-lesson-review",y);if(D&&!D.stale)Be(D.data.rows??null);else{const Se=await R(C,"learning-lesson-review",y);Se?(ge(t,m,"learning-lesson-review",y,Se),Be(Se.rows??null)):Be(D?D.data.rows??null:null)}}},[C,f,m,t]),Ge=g.useCallback(async i=>{if(N?.canPickAnyLesson===!0&&i.servedAt===null&&!i.done){F(null),de(null),ee(null),Ee(i);return}await te(i)},[N?.canPickAnyLesson,te]),mn=g.useCallback(async i=>{await Pe(i.lessonId)&&(Ee(null),await te({...i,servedAt:new Date().toISOString()}))},[te,Pe]),zs=g.useCallback(async i=>{B(!0),await R(C,"learning-start-lesson",{lessonId:i}),await We(i);const c=await R(C,"learning-lesson-quiz",{lessonId:i,language:f});if(B(!1),c?.quiz){De({quiz:c.quiz,lessonId:c.lessonId??i,lessonTitle:c.lessonTitle??""}),de(null),ee(null);return}const d=N?.topics.flatMap(D=>(D.lessons??[]).map(Se=>({topicId:D.topicId,lesson:Se})))??[],h=d.findIndex(D=>D.lesson.lessonId===i),y=N?.canPickAnyLesson===!0&&h!==-1?d.slice(h+1).find(D=>!D.lesson.done)??null:null;if(de(null),ee(null),ze(null),!!y){if(y.topicId===d[h].topicId){await mn(y.lesson);return}Tn(y.lesson.lessonId),Ge(y.lesson)}},[C,f,N,Ge,We,mn]),On=g.useRef(U?.readingLessonId??null);g.useEffect(()=>{const i=On.current;if(!i||!N||r)return;On.current=null;const c=N.topics.flatMap(d=>d.lessons??[]).find(d=>d.lessonId===i);c&&te(c)},[N,r,te]),g.useEffect(()=>{r||Qa(t,m,{tab:X,openTopicId:le,readingLessonId:W?.lessonId??null,slideIndex:ce,slideTotals:ye})},[r,t,m,X,le,W,ce,ye]);const Bn=u?.mode==="new_information"?u.lesson:null;g.useEffect(()=>{const i=[];for(const c of[Bn,S]){const d=c?.slides?.length??0;c&&d>0&&i.push([c.lessonId,d])}i.length!==0&&xs(c=>{const d=i.filter(([h,y])=>c[h]!==y);return d.length>0?{...c,...Object.fromEntries(d)}:c})},[Bn,S]);const qs=g.useMemo(()=>{const i={};for(const[c,d]of Object.entries(ye))d<=0||(i[c]={index:Math.min(ce[c]??0,d-1),total:d});return i},[ye,ce]),qe=(N?.tracks?.length??0)>0,xn=g.useMemo(()=>O?N?.topics.find(i=>(i.lessons??[]).some(c=>c.lessonId===O.lessonId))??null:null,[N,O]),Ce=g.useMemo(()=>{if(!N||!qe)return[];const i=new Set(N.tracks.flatMap(c=>c.topics.map(d=>d.topicId)));return N.topics.filter(c=>!i.has(c.topicId))},[N,qe]),Je=g.useMemo(()=>!N||!xe?null:xe===Nn?{trackId:Nn,title:p("learning.track_unassigned"),topicCount:Ce.length,doneTopicCount:Ce.filter(i=>i.lessonCount>0&&i.doneCount===i.lessonCount).length,topics:Ce}:N.tracks?.find(i=>i.trackId===xe)??null,[N,xe,Ce,p]),Dn=i=>{if(N?.canPickAnyLesson!==!0)return null;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?null:c.slice(d+1).find(h=>!h.done)??null},Cs=i=>{if(!N)return!0;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?!0:c.slice(d+1).some(h=>!h.done)},jn=i=>Cs(i)?p("learning.finish_next_lesson"):p("learning.finish_lesson"),En=K&&H!==null&&(H.unread.length>0||H.read.length>0||H.suggested!==null),ne=G||vs,z=X==="dashboard"&&!P||X==="progress"&&!T||X==="news"&&!En?"today":X,Pn=g.useRef(null),Fn=S?.lessonId??(u?.mode==="new_information"?u.lesson.lessonId:null),Ss=[z,xe??"",le??"",O?.lessonId??"",W?.lessonId??"",sn?"quiz-lesson":"",M?.quiz.attemptId??M?.quiz.quizId??"",$?.quiz.attemptId??$?.quiz.quizId??"",cn?"section-intro":"",u?.mode??"",u?.mode==="new_information"?u.lesson.lessonId:"",u?.mode==="new_information"&&u.isNew&&!Ue?"arrival":"",u?.mode==="checking_question"?u.question.questionId:"",u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz"?u.quiz.attemptId??u.quiz.quizId:"",Z?"results":"",Fn?String(ce[Fn]??0):""].join("|");return g.useLayoutEffect(()=>{Ga(Pn.current)},[Ss]),e.jsxs(Ts,{blockType:"learning",children:[e.jsxs("header",{className:"es-learning__header",children:[e.jsx("span",{className:"es-learning__header-title",children:w}),I&&e.jsx("nav",{className:"es-learning__header-actions","aria-label":w,children:[...P?[["dashboard",ua]]:[],["today",ca],["topics",da],...En?[["news",pa]]:[],...T?[["progress",ga]]:[]].map(([i,c])=>{const d=i==="news"&&z!=="news"?H?.unreadCount??0:0,h=p(`learning.nav_${i}`);return e.jsxs("button",{type:"button",className:`es-learning__navbtn es-learning__navbtn--icon${i==="news"?" es-learning__navbtn--news":""}${z===i?" es-learning__navbtn--active":""}`,"aria-current":z===i?"page":void 0,"aria-label":d>0?p("learning.nav_news_unread",{n:d}):h,title:h,onClick:()=>{pe(i),me(null),Oe(null),de(null),ee(null),Ee(null),an(!1),De(null),V(null),we(null),he(null)},children:[e.jsx(c,{}),d>0&&e.jsx("span",{className:"es-learning__navbadge","aria-hidden":"true",children:d>99?"99+":d})]},i)})})]}),e.jsxs("div",{className:"es-block__body es-learning",ref:Pn,children:[be&&e.jsx("div",{className:"es-learning__error",role:"alert",children:be}),ne&&(z==="today"||z==="dashboard")&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="dashboard"&&!G&&e.jsx($a,{view:u,browse:N,mascot:v,slidePositions:qs,newsTile:K&&H?.suggested?e.jsx(al,{item:H.suggested,currentLanguage:f,onPick:he,t:p}):void 0,onGoToday:()=>pe("today"),onOpenLesson:(i,c)=>{pe("topics"),me(i),te(c)},onOpenTopic:i=>{pe("topics"),me(i)},t:p}),z==="news"&&e.jsx(ll,{news:H,currentLanguage:f,onPick:he,t:p}),z==="progress"&&N&&e.jsx(Ba,{browse:N,t:p}),(z==="topics"||z==="progress")&&!N&&!O&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&O&&e.jsx(Gn,{lessonTitle:O.title,topicTitle:xn?.title??"",newTopic:An===O.lessonId,graphicRef:O.graphicRef,graphicAlt:O.graphicAlt,graphicUrl:O.graphicUrl,slideCount:ye[O.lessonId]??0,mascot:v,busy:L,onStart:()=>{mn(O)},onBackToTopic:xn?()=>{Ee(null),me(xn.topicId)}:void 0,t:p}),z==="topics"&&N&&W&&!S&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&N&&W&&S&&e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),review:ks,backLabel:p("learning.back_to_topic",{topic:S.topicTitle}),showBackLink:!1,onBack:()=>{de(null),ee(null)},onBackToTopic:()=>{de(null),ee(null)},onFinish:N.canPickAnyLesson===!0&&!W.done?()=>{zs(S.lessonId)}:void 0,finishLabel:S.hasQuiz===!1?jn(S.lessonId):p("learning.finish_to_quiz"),rating:ws?null:nn(S.lessonId),t:p}),z==="topics"&&M&&e.jsx(wn,{quiz:M.quiz,isPlacement:!1,eyebrow:M.lessonTitle,topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn(M.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(M.quiz.quizId,i,c),onFinish:()=>{pn(M.quiz.quizId)},onBackToLesson:()=>{De(null),te({lessonId:M.lessonId,title:M.lessonTitle,isMilestone:!1,state:"gap",done:!1,servedAt:new Date().toISOString()},{fromQuiz:!0})},onContinue:()=>{const i=Dn(M.lessonId);V(null),De(null),i&&Ge(i)},continueLabel:Dn(M.lessonId)?p("learning.go_to_next_lesson"):p("learning.nav_topics"),t:p},M.quiz.attemptId??M.quiz.quizId),z==="topics"&&N&&!W&&!M&&!$&&!O&&le&&e.jsx(Ma,{topic:N.topics.find(i=>i.topicId===le)??N.topics[0],onOpenLesson:i=>{Ge(i)},onStartSectionQuiz:()=>{const i=N.topics.find(c=>c.topicId===le)??N.topics[0];(async()=>await Rn(i.topicId,i.title,"topics")||on(!0))()},canPickAnyLesson:N.canPickAnyLesson===!0,backLabel:Je?.title,onBack:Je?()=>me(null):void 0,t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&!xe&&e.jsx(Ca,{tracks:N.tracks,untracked:Ce,onOpenTrack:Oe,onOpenUntracked:()=>Oe(Nn),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&xe&&Je&&e.jsx(Sa,{track:Je,onOpenTopic:me,onBack:()=>Oe(null),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&!qe&&e.jsx(ds,{topics:N.topics,onOpen:me,t:p}),z==="today"&&!ne&&u?.mode==="nothing"&&e.jsx(kn,{kind:u.reason,mascot:v,nextDueAt:u.nextDueAt,t:p}),z==="today"&&!ne&&u?.mode==="unavailable"&&e.jsx(kn,{kind:"unavailable",mascot:v,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&u.isNew&&!Ue&&e.jsx(Gn,{lessonTitle:u.lesson.title,topicTitle:u.lesson.topicTitle,newTopic:An===u.lesson.lessonId,graphicRef:u.lesson.graphicRef,graphicAlt:u.lesson.graphicAlt,graphicUrl:u.lesson.graphicUrl,slideCount:u.lesson.slides?.length??0,mascot:v,busy:L,onStart:()=>{hn(u.lesson.lessonId)},t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&(!u.lesson.kind||u.lesson.kind==="info"||!u.lesson.slides?.length)&&e.jsx(rs,{lesson:u.lesson,busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&u.lesson.kind&&u.lesson.kind!=="info"&&!!u.lesson.slides?.length&&e.jsx(cs,{lesson:u.lesson,index:ce[u.lesson.lessonId]??0,onIndexChange:i=>Me(c=>({...c,[u.lesson.lessonId]:i})),answers:en[u.lesson.lessonId]??{},onAnswer:(i,c)=>$e(d=>({...d,[u.lesson.lessonId]:{...d[u.lesson.lessonId]??{},[i]:c}})),busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="checking_question"&&e.jsx(fa,{prompt:u.question.prompt,lessonTitle:u.lessonTitle,answer:J,feedback:Xe,busy:L,showExplanations:q,onChange:_e,onSubmit:()=>{Is(u.question.questionId)},t:p}),z==="today"&&!ne&&u?.mode==="lesson_quiz"&&sn&&(S?e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),backLabel:p("learning.back_to_quiz"),onBack:()=>an(!1),t:p}):e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")})),z==="today"&&!ne&&cn&&ue&&e.jsx(ma,{topicTitle:ue.topicTitle,topicComplete:ue.topicComplete,mascot:v,busy:L,onStart:()=>{(async()=>await Rn(ue.topicId,ue.topicTitle,"today")||Qe())()},onSkip:Qe,t:p}),$&&z===$.origin&&e.jsx(wn,{quiz:$.quiz,isPlacement:!1,eyebrow:$.topicTitle,topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn($.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n($.quiz.quizId,i,c),onFinish:()=>{pn($.quiz.quizId,{isSectionQuiz:!0})},onBackToLesson:void 0,onContinue:$.origin==="today"?Qe:()=>{un(null),V(null)},continueLabel:$.origin==="topics"?p("learning.nav_topics"):ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},$.quiz.attemptId??$.quiz.quizId),z==="today"&&!ne&&!sn&&!cn&&$?.origin!=="today"&&(u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz")&&e.jsx(wn,{quiz:u.quiz,isPlacement:u.mode==="placement_quiz",eyebrow:u.mode==="lesson_quiz"?u.lessonTitle:void 0,topics:u.mode==="placement_quiz"?u.topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn(u.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(u.quiz.quizId,i,c),onFinish:()=>{pn(u.quiz.quizId)},onBackToLesson:u.mode==="lesson_quiz"?()=>{an(!0),te({lessonId:u.lessonId,title:u.lessonTitle,isMilestone:!1,state:"current",done:!1,servedAt:null},{fromQuiz:!0})}:void 0,onChooseTopic:u.mode==="placement_quiz"?i=>{je(i)}:void 0,onContinue:ue||ae?()=>{if(ue){V(null),dn(!0);return}Qe()}:void 0,continueLabel:!ue&&ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},u.quiz.attemptId??u.quiz.quizId)]}),A&&e.jsx(il,{item:A,onCancel:()=>he(null),onConfirm:ys,t:p})]})}export{jl as Component,Gn as NewLessonIntro,ya as QuizReview,ma as SectionQuizIntro,xl as manifest};
2
+ //# sourceMappingURL=index-Cd1-jHFp-Za3SKEQp.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as p,j as e,Q as n}from"../nexly.js";const a=o=>`$${o.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`;function M({data:o,config:h,actions:l,metadata:x,i18n:j}){const s=j?.t??(i=>i),u=h.mode??o.mode??"basic",c=o.forecast,t=o.aiTip,[m,d]=p.useState("idle"),[N,b]=p.useState(!1);if(!c&&!o.error)return e.jsx(n,{blockType:"commission-forecast",children:e.jsx("div",{className:"cf-block",children:e.jsxs("div",{className:"cf-hero",children:[e.jsx("div",{className:"cf-hero-label",children:s("commission_forecast.estimated_commission")}),e.jsx("div",{className:"cf-hero-amount",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:"—"}),e.jsx("div",{className:"cf-hero-sub",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:x?.dataQuality==="none"?s("commission_forecast.signin_prompt"):s("commission_forecast.calculating")})]})})});if(o.error||!c)return e.jsx(n,{blockType:"commission-forecast",children:e.jsx("p",{style:{color:"var(--es-color-error, #AD2C26)",fontSize:13},children:s("commission_forecast.load_error")})});const r=c.deltaVsLastMonth,v=c.projectedMonthEnd>0?Math.min(100,Math.round(c.totalEstimated/c.projectedMonthEnd*100)):0,_=Math.round((c.scenarioOneMember-c.projectedMonthEnd)/Math.max(1,c.projectedMonthEnd)*100),g=()=>{t&&(navigator.clipboard.writeText(t).catch(()=>{}),d("copied"),l?.emit?.("cf:tipCopied",{tip:t}),setTimeout(()=>d("idle"),2e3))},f=()=>{b(!0),l?.emit?.("cf:scenarioViewed",{scenarioOneMember:c.scenarioOneMember})};return e.jsx(n,{blockType:"commission-forecast",children:e.jsxs("div",{className:"cf-block",children:[e.jsxs("div",{className:"cf-hero",children:[e.jsx("div",{className:"cf-hero-label",children:s("commission_forecast.estimated_commission")}),e.jsx("div",{className:"cf-hero-amount",children:a(c.totalEstimated)}),e.jsxs("div",{className:"cf-hero-sub",children:[e.jsxs("span",{children:[s("commission_forecast.projected_month_end_label")," ",e.jsx("strong",{children:a(c.projectedMonthEnd)})]}),r!==null&&e.jsxs("span",{className:`cf-delta-badge ${r>=0?"cf-delta--positive":"cf-delta--negative"}`,children:[r>=0?"↑":"↓"," ",a(Math.abs(r))," ",s("commission_forecast.vs_last_month")]})]})]}),e.jsxs("div",{className:"cf-forecast-row",children:[e.jsxs("div",{className:"cf-forecast-labels",children:[e.jsxs("span",{children:[s("commission_forecast.current_label")," ",a(c.totalEstimated)]}),e.jsxs("span",{children:[s("commission_forecast.target_label")," ",a(c.projectedMonthEnd)]})]}),e.jsx("div",{className:"cf-forecast-bar-track",children:e.jsx("div",{className:"cf-forecast-bar-fill",style:{width:`${v}%`}})}),e.jsx("div",{className:"cf-days-left",children:s("commission_forecast.days_left_run_rate",{days:c.daysLeft,rate:a(c.dailyRunRate)})})]}),e.jsxs("div",{className:"cf-scenario",onClick:f,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),f())},tabIndex:0,role:"button",children:[e.jsx("div",{className:"cf-scenario-label",children:s("commission_forecast.scenario_title")}),e.jsxs("div",{className:"cf-scenario-row",children:[e.jsx("span",{className:"cf-scenario-desc",children:s("commission_forecast.scenario_desc")}),e.jsx("span",{className:"cf-scenario-value",children:a(c.scenarioOneMember)})]}),e.jsx("div",{className:"cf-scenario-uplift",children:s("commission_forecast.uplift",{pct:_,amount:a(c.scenarioOneMember-c.projectedMonthEnd)})})]}),u==="pro"&&c.tiers.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cf-section-title",children:s("commission_forecast.by_tier",{count:c.tiers.length})}),e.jsx("div",{className:"cf-tier-list",children:c.tiers.map(i=>e.jsxs("div",{className:`cf-tier${i.status==="unreachable"?" cf-tier--unreachable":""}`,children:[e.jsxs("div",{className:"cf-tier-header",children:[e.jsx("span",{className:"cf-tier-engine",children:s("commission_forecast.engine_number",{id:i.engineId})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:`cf-tier-status cf-status--${i.status==="in progress"?"in-progress":"unreachable"}`,children:i.status==="in progress"?s("commission_forecast.status.in_progress"):s("commission_forecast.status.unreachable")}),e.jsx("span",{className:"cf-tier-amount",children:a(i.estimatedCommission)})]})]}),e.jsx("div",{className:"cf-tier-progress-track",children:e.jsx("div",{className:"cf-tier-progress-fill",style:{width:`${i.progressPct}%`}})}),e.jsxs("div",{className:"cf-tier-meta",children:[e.jsx("span",{children:s("commission_forecast.volume_label",{current:i.salesVolume.toLocaleString(),max:i.salesVolumeMax.toLocaleString()})}),e.jsx("span",{children:s("commission_forecast.points_label",{current:i.personalPoints,max:i.personalPointsMax})})]})]},i.engineId))})]}),t&&e.jsxs("div",{className:"cf-tip-box",children:[e.jsxs("div",{className:"cf-tip-header",children:[e.jsx("span",{className:"cf-tip-label",children:s("commission_forecast.ai_coach_label")}),e.jsx("button",{className:`cf-copy-btn${m==="copied"?" cf-copied":""}`,onClick:g,children:m==="copied"?`✓ ${s("common.copied")}`:s("common.copy")})]}),e.jsx("p",{className:"cf-tip-text",children:t})]})]})})}const k={slug:"commission-forecast",name:"Commission Forecast",version:"1.0.0",category:"data",requiredService:"commission-forecast",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"commission-forecast",inputSchema:{type:"object",properties:{forecast:{type:"object"},aiTip:{type:"string"},mode:{type:"string"}},required:["forecast","mode"]}},events:{emits:[{name:"cf:tipCopied",description:"User copied the AI commission tip"},{name:"cf:scenarioViewed",description:"User viewed the +1 member scenario projection"}]}};export{M as CommissionForecastBlock,M as Component,k as manifest};
2
- //# sourceMappingURL=index-CogJkGmU-C3bBvEcm.js.map
2
+ //# sourceMappingURL=index-Ce9TuEzb-C3bBvEcm.js.map
@@ -1,2 +1,2 @@
1
1
  import{j as e,Q as d}from"../nexly.js";const u={slug:"venue-list",name:"Venue List",version:"1.0.0",category:"content",requiredService:"venue-discovery",configSchema:{properties:{radiusKm:{type:"number",default:10},limit:{type:"number",default:10},hidden:{type:"boolean",default:!1}}},defaultConfig:{radiusKm:10,limit:10,hidden:!1},dataContract:{serviceSlug:"venue-discovery",inputSchema:{type:"object",properties:{venues:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},category:{type:"string"},address:{type:"string"},rating:{type:"number"},reviewCount:{type:"number"},distanceKm:{type:"number"},photoUrl:{type:"string"}}}},total:{type:"number"}},required:["venues"]},previewDataOverride:{venues:[{id:"v-1",name:"Blue Bottle Coffee",category:"cafe",address:"123 Teheran-ro, Gangnam-gu",rating:4.5,reviewCount:312,distanceKm:.3,photoUrl:""},{id:"v-2",name:"Coexartium Gallery",category:"gallery",address:"456 Samsung-dong, Gangnam-gu",rating:4.2,reviewCount:198,distanceKm:.8,photoUrl:""},{id:"v-3",name:"Oakwood Premier COEX",category:"hotel",address:"789 Bongeunsa-ro, Gangnam-gu",rating:4.7,reviewCount:567,distanceKm:1.1,photoUrl:""}],total:3}},fields:[{id:"radiusKm",type:"range",label:"Search radius (km)",default:10,min:1,max:50,step:1,group:"Search"},{id:"limit",type:"range",label:"Max venues to show",default:10,min:1,max:50,step:1,group:"Content"},{id:"hidden",type:"toggle",label:"Hidden (collect data only, render nothing)",default:!1,group:"Behavior"}],events:{emits:[{name:"venues:venueSelected",description:"User clicked on a venue in the list"},{name:"venues:radiusChanged",description:"User changed the search radius"}],listens:[{name:"venue:locationChanged",description:"Re-run venue search at new user location"},{name:"venues:refresh",description:"Reload venue list from discovery service"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function c({data:n,config:a,i18n:i}){const r=i?.t??(s=>s),t=n.venues??[];return a?.hidden===!0?null:e.jsx(d,{blockType:"venue-list",children:e.jsxs("div",{className:"es-block__body",children:[t.length===0&&e.jsx("div",{className:"es-block__empty",children:r("venue_list.empty")}),t.length>0&&e.jsx("ul",{className:"es-vlist__items",children:t.map((s,l)=>e.jsxs("li",{className:"es-vlist__item",children:[e.jsx("div",{className:"es-vlist__name",children:s.name}),e.jsxs("div",{className:"es-vlist__meta",children:[s.type&&e.jsx("span",{className:"es-vlist__type",children:s.type}),s.rating!=null&&e.jsxs("span",{className:"es-vlist__rating",children:["★"," ",s.rating.toFixed(1)]})]}),s.address&&e.jsx("div",{className:"es-vlist__address",children:s.address})]},l))})]})})}export{c as Component,u as manifest};
2
- //# sourceMappingURL=index-DG-KS4AB-3B-eE3K7.js.map
2
+ //# sourceMappingURL=index-D1YmJ3gf-3B-eE3K7.js.map
@@ -1,2 +1,2 @@
1
1
  import{j as e,Q as i}from"../nexly.js";const n={slug:"dashboard-overview",name:"Dashboard Overview",version:"1.0.0",category:"content",configSchema:{},defaultConfig:{},dataContract:{serviceSlug:null,inputSchema:{type:"object",properties:{}}},fields:[],sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main"]};function r({i18n:a}){const s=a?.t??(t=>t);return e.jsx(i,{blockType:"dashboard-overview",children:e.jsxs("div",{className:"es-widget__dash",children:[e.jsx("div",{className:"es-widget__panel-header",children:e.jsx("div",{className:"es-widget__panel-header-left",children:e.jsx("h2",{className:"es-widget__panel-header-title",children:s("dashboard.title")})})}),e.jsx("div",{className:"es-widget__dash-content",children:e.jsx("p",{className:"es-widget__dash-empty",children:s("dashboard.select_tab")})})]})})}export{r as Component,n as manifest};
2
- //# sourceMappingURL=index-DO5eKOOB-Dp5AxBD4.js.map
2
+ //# sourceMappingURL=index-D96sEJQ6-Dp5AxBD4.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as x,j as e,Q as p}from"../nexly.js";const _={network:"#e0e7ff",sales:"#dcfce7",social:"#fef3c7",personal:"#f3e8ff",team:"#ffedd5"},S={network:"#4338ca",sales:"#137136",social:"#9e4908",personal:"#7129eb",team:"#ab390b"},T={high:"var(--es-color-error, #AD2C26)",medium:"var(--es-color-warning, #9C5300)",low:"var(--es-color-success, #00672B)"},C={high:3,medium:2,low:1};function R({data:c,config:j,actions:h,metadata:g,i18n:b}){const t=b?.t??(a=>a),N=j.mode??c.mode??"basic",m=c.plan,o=c.aiInsight,[v,k]=x.useState(new Set),[r,u]=x.useState(0);if(!m&&!c.error)return e.jsx(p,{blockType:"weekly-rhythm-planner",children:e.jsxs("div",{className:"wrp-block",children:[e.jsxs("div",{className:"wrp-goal",children:[e.jsx("span",{className:"wrp-goal-icon",children:"🎯"}),e.jsx("span",{className:"wrp-goal-text",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:g?.dataQuality==="none"?t("weekly_planner.sign_in_prompt"):t("weekly_planner.preparing")})]}),e.jsxs("div",{className:"wrp-basic",children:[e.jsx("div",{className:"wrp-section-label",children:t("weekly_planner.todays_top_actions")}),[1,2,3].map(a=>e.jsxs("div",{className:"wrp-action",style:{opacity:.35},children:[e.jsx("div",{className:"wrp-action-check"}),e.jsx("div",{className:"wrp-action-body",children:e.jsx("span",{className:"wrp-action-title",style:{background:"var(--es-color-surface-elevated, #f5f5f5)",borderRadius:4,display:"block",height:14,width:`${50+a*20}%`}})})]},a))]})]})});if(c.error)return e.jsx(p,{blockType:"weekly-rhythm-planner",children:e.jsx("p",{style:{color:"var(--es-color-error, #AD2C26)",fontSize:13},children:t("weekly_planner.error_generate")})});const s=m,y=(a,i,d)=>{k(l=>{const n=new Set(l);return n.has(a)?n.delete(a):n.add(a),h?.emit?.("wrp:actionToggled",{id:a,title:d,dayIndex:i,checked:!l.has(a)}),n})},f=a=>{u(a),h?.emit?.("wrp:daySelected",{dayIndex:a,dayLabel:s.days[a]?.dayLabel})},w=(a,i)=>{const d=v.has(a.id);return e.jsxs("div",{className:`wrp-action${d?" wrp-action--done":""}`,onClick:()=>y(a.id,i,a.title),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),y(a.id,i,a.title))},tabIndex:0,role:"checkbox","aria-checked":d,children:[e.jsx("div",{className:"wrp-action-check",children:d?"✓":""}),e.jsxs("div",{className:"wrp-action-body",children:[e.jsx("span",{className:"wrp-action-title",children:a.title}),e.jsxs("div",{className:"wrp-action-meta",children:[a.time&&e.jsx("span",{className:"wrp-action-time",children:a.time}),e.jsx("span",{className:"wrp-cat-badge",style:{background:_[a.category],color:S[a.category]},children:a.category})]})]}),e.jsx("div",{className:"wrp-priority",role:"img","aria-label":a.priority,title:a.priority,children:Array.from({length:C[a.priority]},(l,n)=>e.jsx("span",{className:"wrp-priority-dot",style:{background:T[a.priority]}},n))})]},a.id)};return e.jsx(p,{blockType:"weekly-rhythm-planner",children:e.jsxs("div",{className:"wrp-block",children:[s.weeklyGoal&&e.jsxs("div",{className:"wrp-goal",children:[e.jsx("span",{className:"wrp-goal-icon",children:"🎯"}),e.jsx("span",{className:"wrp-goal-text",children:s.weeklyGoal})]}),N==="basic"?e.jsxs("div",{className:"wrp-basic",children:[e.jsx("div",{className:"wrp-section-label",children:t("weekly_planner.todays_top_actions")}),e.jsx("div",{className:"wrp-action-list",children:s.topThreeToday.map(a=>w(a,0))}),o&&e.jsxs("div",{className:"wrp-insight",children:[e.jsx("span",{className:"wrp-insight-icon",children:"💡"}),e.jsx("span",{children:o})]})]}):e.jsxs("div",{className:"wrp-pro",children:[e.jsx("div",{className:"wrp-day-tabs",children:s.days.map((a,i)=>e.jsxs("button",{className:`wrp-day-tab${r===i?" wrp-day-tab--active":""}`,onClick:()=>f(i),children:[e.jsx("span",{className:"wrp-tab-label",children:a.dayLabel.slice(0,3)}),e.jsx("span",{className:"wrp-tab-count",children:a.actions.length})]},a.date))}),s.days[r]&&e.jsxs("div",{className:"wrp-day-panel",children:[e.jsxs("div",{className:"wrp-day-header",children:[e.jsx("span",{className:"wrp-day-title",children:s.days[r].dayLabel}),e.jsx("span",{className:"wrp-day-date",children:s.days[r].date})]}),e.jsx("div",{className:"wrp-action-list",children:s.days[r].actions.map(a=>w(a,r))}),s.days[r].focusTip&&e.jsxs("div",{className:"wrp-focus-tip",children:[e.jsx("span",{children:"✨"}),e.jsx("span",{children:s.days[r].focusTip})]})]}),o&&e.jsxs("div",{className:"wrp-insight",children:[e.jsx("span",{className:"wrp-insight-icon",children:"💡"}),e.jsx("span",{children:o})]})]})]})})}const B={slug:"weekly-rhythm-planner",name:"Weekly Rhythm Planner",version:"1.0.0",category:"interactive",requiredService:"weekly-rhythm-planner",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"weekly-rhythm-planner",inputSchema:{type:"object",properties:{plan:{type:"object"},aiInsight:{type:"string"},mode:{type:"string"}},required:["plan","mode"]}},events:{emits:[{name:"wrp:actionToggled",description:"User toggled an action checkbox"},{name:"wrp:daySelected",description:"User selected a different day in pro mode"}]}};export{R as Component,R as WeeklyRhythmPlannerBlock,B as manifest};
2
- //# sourceMappingURL=index-D-uANagm-DBhSkJ7i.js.map
2
+ //# sourceMappingURL=index-DAICBUgn-DBhSkJ7i.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as c,j as e,Q as d}from"../nexly.js";const y={slug:"demo-faq",name:"DEMO — Questions",version:"0.1.0",category:"content",configSchema:{properties:{items:{type:"array",items:{type:"object",properties:{question:{type:"string"},answer:{type:"string"}},required:["question","answer"]},default:[]}}},defaultConfig:{items:[]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function f(o){return Array.isArray(o)?o.flatMap(a=>{if(typeof a!="object"||a===null)return[];const t=a,r=typeof t.question=="string"?t.question.trim():"",n=typeof t.answer=="string"?t.answer.trim():"";return!r||!n?[]:[{question:r,answer:n}]}):[]}function _({data:o,config:a,i18n:t}){const r=t?.t??(s=>s),n=f(o?.items??a?.items),[l,p]=c.useState(0),u=c.useCallback(s=>{p(i=>i===s?null:s)},[]);return n.length===0?e.jsx(d,{blockType:"demo-faq",children:e.jsx("div",{className:"es-block__body",children:e.jsx("div",{className:"es-block__empty",children:r("demoFaq.empty")})})}):e.jsx(d,{blockType:"demo-faq",children:e.jsx("div",{className:"es-block__body es-demofaq",children:n.map((s,i)=>{const m=l===i;return e.jsxs("div",{className:m?"es-demofaq__item es-demofaq__item--open":"es-demofaq__item",children:[e.jsxs("button",{type:"button",className:"es-demofaq__question",onClick:()=>u(i),"aria-expanded":m,children:[e.jsx("span",{children:s.question}),e.jsx("span",{className:"es-demofaq__chevron","aria-hidden":"true",children:m?"−":"+"})]}),m&&e.jsx("p",{className:"es-demofaq__answer",children:s.answer})]},i)})})})}export{_ as Component,y as manifest};
2
- //# sourceMappingURL=index-BncytMlP-VhJcCfAC.js.map
2
+ //# sourceMappingURL=index-DATkkw3P-VhJcCfAC.js.map