@nexlylab/widget 1.32.14 → 1.32.16

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.14/chunks/ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js → 1.32.16/chunks/ClickToLoadEmbed-CVZbpoTT-CKUzZ7gL.js} +2 -2
  3. package/dist/runtime/{1.32.14/chunks/PanelInfoVideo-BKn3ucAb-BrU-Qlul.js → 1.32.16/chunks/PanelInfoVideo-BKq2v0QM-BrU-Qlul.js} +1 -1
  4. package/dist/runtime/{1.32.14/chunks/assistant-link-components-MZWf5ty7-C44wlQAi.js → 1.32.16/chunks/assistant-link-components-DkuhHIF9-CPkAMFv6.js} +2 -2
  5. package/dist/runtime/{1.32.14/chunks/assistant-link-policy-DWaWTnGr-Cc-yj-a-.js → 1.32.16/chunks/assistant-link-policy-CS93s-vA-Cc-yj-a-.js} +1 -1
  6. package/dist/runtime/{1.32.14/chunks/block-rating-DH7mp-_R-CoiP5C2K.js → 1.32.16/chunks/block-rating-DGpoz2o3-CoiP5C2K.js} +1 -1
  7. package/dist/runtime/{1.32.14/chunks/external-url-LRu_ntew-CJQjg_od.js → 1.32.16/chunks/external-url-BzUbjdMo-CJQjg_od.js} +1 -1
  8. package/dist/runtime/{1.32.14/chunks/index-C1WD1dlq-Dm9kbc85.js → 1.32.16/chunks/index-6HKNPucI-Dm9kbc85.js} +1 -1
  9. package/dist/runtime/{1.32.14/chunks/index-Bu9Gh6Nc-BfWdQCT7.js → 1.32.16/chunks/index-BCtNBIxP-CcsFQ7Dx.js} +2 -2
  10. package/dist/runtime/{1.32.14/chunks/index-BD-jPdzs-ZRnEJoQe.js → 1.32.16/chunks/index-BIMK2_g0-ZRnEJoQe.js} +1 -1
  11. package/dist/runtime/{1.32.14/chunks/index-BSoCdILD-D6wzHiS0.js → 1.32.16/chunks/index-BJClDxSC-D6wzHiS0.js} +1 -1
  12. package/dist/runtime/{1.32.14/chunks/index-CNJUK2bK-C0OfCXUx.js → 1.32.16/chunks/index-BLT1bBjC-6c5Ar61I.js} +2 -2
  13. package/dist/runtime/{1.32.14/chunks/index-C6_8JGpJ-BqZmEVev.js → 1.32.16/chunks/index-BW-8QNI--BqZmEVev.js} +1 -1
  14. package/dist/runtime/{1.32.14/chunks/index-C75hX_dj-VhJcCfAC.js → 1.32.16/chunks/index-BncytMlP-VhJcCfAC.js} +1 -1
  15. package/dist/runtime/{1.32.14/chunks/index-k-jZV_MQ-H31PHMqm.js → 1.32.16/chunks/index-BoVToqY3-H31PHMqm.js} +1 -1
  16. package/dist/runtime/{1.32.14/chunks/index-B8aKMeg5-BLxOZxZv.js → 1.32.16/chunks/index-C5MpFJwF-BLxOZxZv.js} +1 -1
  17. package/dist/runtime/{1.32.14/chunks/index-Dh0aThiP-Aqz1AnQ5.js → 1.32.16/chunks/index-CISMnUXx-Aqz1AnQ5.js} +1 -1
  18. package/dist/runtime/{1.32.14/chunks/index-Dkv5YXXW-pkywvGDF.js → 1.32.16/chunks/index-CIe60p_E-pkywvGDF.js} +1 -1
  19. package/dist/runtime/{1.32.14/chunks/index-1o6W5wiJ-I68tb-d3.js → 1.32.16/chunks/index-CIgDHLEK-I68tb-d3.js} +1 -1
  20. package/dist/runtime/{1.32.14/chunks/index-DP_6HfDM-DAdxCQyi.js → 1.32.16/chunks/index-CUGV3nk2-DAdxCQyi.js} +1 -1
  21. package/dist/runtime/{1.32.14/chunks/index-DO0-ht8E-DUgMllqN.js → 1.32.16/chunks/index-CbGT4d5Q-DUgMllqN.js} +1 -1
  22. package/dist/runtime/{1.32.14/chunks/index-DTVlG27U-DP0QKkgf.js → 1.32.16/chunks/index-Cdmdsj1E-DP0QKkgf.js} +1 -1
  23. package/dist/runtime/{1.32.14/chunks/index-D-ZhVFzi-A3rpkVmQ.js → 1.32.16/chunks/index-Cf4eQF9g-mnUzfS1e.js} +2 -2
  24. package/dist/runtime/{1.32.14/chunks/index-CMFQhtEe-BcW8HKb8.js → 1.32.16/chunks/index-ChL-bSAN-BcW8HKb8.js} +1 -1
  25. package/dist/runtime/{1.32.14/chunks/index-qpVhJY7A-Cgivx3vY.js → 1.32.16/chunks/index-Chn4ATvZ-CSI6_0RJ.js} +2 -2
  26. package/dist/runtime/{1.32.14/chunks/index-Dt6OpItC-R_xuAEQV.js → 1.32.16/chunks/index-Cmt7uZiE-R_xuAEQV.js} +1 -1
  27. package/dist/runtime/{1.32.14/chunks/index-Czz6Gyh_-C3bBvEcm.js → 1.32.16/chunks/index-CogJkGmU-C3bBvEcm.js} +1 -1
  28. package/dist/runtime/1.32.16/chunks/index-CsoMgZU8-C1BzRUwZ.js +2 -0
  29. package/dist/runtime/{1.32.14/chunks/index-D72orqXX-C_0Ll4qr.js → 1.32.16/chunks/index-Cxwd1OKy-C_0Ll4qr.js} +1 -1
  30. package/dist/runtime/{1.32.14/chunks/index-BylVnv7X-DBhSkJ7i.js → 1.32.16/chunks/index-D-uANagm-DBhSkJ7i.js} +1 -1
  31. package/dist/runtime/{1.32.14/chunks/index-DDEE3QfX-3B-eE3K7.js → 1.32.16/chunks/index-DG-KS4AB-3B-eE3K7.js} +1 -1
  32. package/dist/runtime/{1.32.14/chunks/index-V1EfdiK7-bdo5pwX-.js → 1.32.16/chunks/index-DHdp5nGO-bdo5pwX-.js} +1 -1
  33. package/dist/runtime/{1.32.14/chunks/index-hHQjRGar-TEMHje2B.js → 1.32.16/chunks/index-DL04XhIK-TEMHje2B.js} +1 -1
  34. package/dist/runtime/{1.32.14/chunks/index-IW3aNe-y-W1lJrIDD.js → 1.32.16/chunks/index-DNwWHPWp-W1lJrIDD.js} +1 -1
  35. package/dist/runtime/{1.32.14/chunks/index-D9grn5WJ-Dp5AxBD4.js → 1.32.16/chunks/index-DO5eKOOB-Dp5AxBD4.js} +1 -1
  36. package/dist/runtime/{1.32.14/chunks/index-B9ozeox8-oy07dUaV.js → 1.32.16/chunks/index-Dc8zecP4-oy07dUaV.js} +1 -1
  37. package/dist/runtime/{1.32.14/chunks/index-csHaX5dv-BpgnWlB8.js → 1.32.16/chunks/index-DchTua3m-BpgnWlB8.js} +1 -1
  38. package/dist/runtime/{1.32.14/chunks/index-CmYYEi7N-Dr1V6OGz.js → 1.32.16/chunks/index-DdI8qMqt-Dr1V6OGz.js} +1 -1
  39. package/dist/runtime/{1.32.14/chunks/index-DphwDFW6-C9wFr7fa.js → 1.32.16/chunks/index-Dfcx_9km-C9wFr7fa.js} +1 -1
  40. package/dist/runtime/{1.32.14/chunks/index-Gi-3UOyp-DuzPeEIz.js → 1.32.16/chunks/index-DhYv8bbj-DGasnsaZ.js} +2 -2
  41. package/dist/runtime/{1.32.14/chunks/index-CqV8rHvG-DS9JaGVN.js → 1.32.16/chunks/index-Dtiss_wT-CLkn_6EY.js} +2 -2
  42. package/dist/runtime/{1.32.14/chunks/index-uM4Y0lxc-Dsa9X9U7.js → 1.32.16/chunks/index-MAmLiP1_-Dsa9X9U7.js} +1 -1
  43. package/dist/runtime/{1.32.14/chunks/index-Chy2Zmo5-CiRb-0NX.js → 1.32.16/chunks/index-Or6sA2eF-CiRb-0NX.js} +1 -1
  44. package/dist/runtime/{1.32.14/chunks/index-DPNGQF5b-_M0CWPEY.js → 1.32.16/chunks/index-PSL_6OT1-_M0CWPEY.js} +1 -1
  45. package/dist/runtime/{1.32.14/chunks/index-B1ef1IlE-QeFj7CR9.js → 1.32.16/chunks/index-SgPuWMUv-QeFj7CR9.js} +1 -1
  46. package/dist/runtime/{1.32.14/chunks/index-CwbUW6dx-BLBDoJCM.js → 1.32.16/chunks/index-fotohjEP-BLBDoJCM.js} +1 -1
  47. package/dist/runtime/{1.32.14/chunks/index-BnKOhYKk-CkemNrch.js → 1.32.16/chunks/index-pQ7fPgLl-JdphAk2-.js} +2 -2
  48. package/dist/runtime/{1.32.14/chunks/index-BvlAsO4n-DbuSZfeK.js → 1.32.16/chunks/index-svAzoy0Y-DbuSZfeK.js} +1 -1
  49. package/dist/runtime/{1.32.14/chunks/index-DZKtK9hT-DQBGsPwB.js → 1.32.16/chunks/index-tAu73-sK-DQBGsPwB.js} +1 -1
  50. package/dist/runtime/1.32.16/nexly.js +61 -0
  51. package/dist/v1.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/runtime/1.32.14/chunks/index-BljIlfbh-D9I6jaso.js +0 -2
  54. package/dist/runtime/1.32.14/nexly.js +0 -61
  55. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js +0 -0
  56. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/_commonjsHelpers-C6fGbg64-BC8KDfbh.js +0 -0
  57. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/accent-legibility-BJF2VO5n-CDPQ7suO.js +0 -0
  58. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/allowed-elements-BXnLJV1S-C-_lr2zm.js +0 -0
  59. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/block-helpers-Cg_zAqG6-DnN2COvk.js +0 -0
  60. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index-BPDIV1BN-DINkyYvc.js +0 -0
  61. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index-BcsmWDTX-Dw9WA5Ac.js +0 -0
  62. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index-C262wwK4-DpyhuXqd.js +0 -0
  63. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index-DMQkz1bV-BuMYksln.js +0 -0
  64. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index-DZADUAKv-DPfvWVuj.js +0 -0
  65. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/index.modern-CioVZ357-BA5NTOmY.js +0 -0
  66. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js +0 -0
  67. /package/dist/runtime/{1.32.14 → 1.32.16}/chunks/use-deferred-rating-XlgCUwcY-DDVOwURi.js +0 -0
@@ -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-DH7mp-_R-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-CDdotCS8-W2yBrg7b.js";import{p as Ps}from"./external-url-LRu_ntew-CJQjg_od.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-DWaWTnGr-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-Gi-3UOyp-DuzPeEIz.js.map
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,2 +1,2 @@
1
- import{r as h,j as e,Q as g,o as M}from"../nexly.js";import{C as L}from"./block-rating-DH7mp-_R-CoiP5C2K.js";const A={slug:"social-insights",name:"Social Insights",version:"1.0.0",category:"data",requiredService:"social-insights",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},proMode:{type:"boolean",default:!1},maxEvents:{type:"number",default:2},showCrmPlan:{type:"boolean",default:!0},showConversationTips:{type:"boolean",default:!1}}},defaultConfig:{readAloudEnabled:!1,proMode:!1,maxEvents:2,showCrmPlan:!0,showConversationTips:!1},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!0},dataContract:{serviceSlug:"social-insights",inputSchema:{type:"object",properties:{eventIntelligence:{type:"object",properties:{scoredEvents:{type:"array",items:{type:"object",properties:{eventName:{type:"string"},conversionScore:{type:"number"}}}},recommendedEvent:{type:"object",properties:{eventName:{type:"string"},missionGoal:{type:"string"}}}}},eventMissionBrief:{type:"object",properties:{conversationOpeners:{type:"array",items:{type:"string"}},qualificationQuestions:{type:"array",items:{type:"string"}},positioningStatement:{type:"string"}}},crmExecutionPlan:{type:"object",properties:{leadPipelineStructure:{type:"string"},recommendedDailyOutreachVolume:{type:"number"},messageTemplates:{type:"object",properties:{firstContact:{type:"string"},followup48h:{type:"string"}}}}},weeklySocialStrategy:{type:"object",properties:{mainObjectiveThisWeek:{type:"string"},numericTarget:{type:"string"}}}}},previewDataOverride:{eventIntelligence:{scoredEvents:[{eventName:"Seoul Tech & Crypto Meetup",category:"Networking",conversionScore:92,whyRelevant:"High density of crypto-curious professionals matching your target profile.",targetProfile:"Tech professionals aged 28–42",priorityLevel:"high"},{eventName:"Gangnam Business Luncheon",category:"Business Networking",conversionScore:74,whyRelevant:"Established entrepreneurs with disposable income open to investment opportunities.",targetProfile:"SME owners and executives",priorityLevel:"medium"},{eventName:"Online MLM Success Webinar",category:"Industry",conversionScore:61,whyRelevant:"Pre-qualified audience already interested in network marketing.",targetProfile:"MLM beginners and career changers",priorityLevel:"medium"}],recommendedEvent:{eventName:"Seoul Tech & Crypto Meetup",missionGoal:"Connect with 5 warm prospects and set 2 follow-up calls",contactsTarget:5,followupTarget:2}},eventMissionBrief:{conversationOpeners:["What brings you to the crypto/tech space?","Have you been following the recent Bitcoin surge?"],qualificationQuestions:["Are you currently looking for passive income opportunities?","What's your experience with network marketing?"],positioningStatement:"I help people build financial freedom through crypto-backed network marketing.",whatNotToSay:["Don't mention specific income figures in the first meeting."]},crmExecutionPlan:{leadPipelineStructure:"Prospect → First Contact → Follow-up (48h) → Meeting → Close",recommendedDailyOutreachVolume:8,followupIntervalsHours:48,messageTemplates:{firstContact:"Hi [Name], great meeting you at the Seoul meetup! I'd love to share something exciting with you — when's a good time for a 15-min call?",followup48h:"Hi [Name], just following up on my message. I have some insights about [topic we discussed] that I think you'll find valuable.",postEventMessage:"Thanks for connecting at [event]! Let me know if you're open to exploring what I mentioned."}},weeklySocialStrategy:{mainObjectiveThisWeek:"Qualify 10 new prospects from event pipeline",numericTarget:"10 new prospects, 3 follow-up calls",structureAlignmentGoal:"Focus on right leg to balance binary structure",riskMitigationFocus:"Avoid cap waste by ensuring team volume is distributed evenly"}}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"proMode",type:"toggle",label:"Pro mode (full strategy details)",default:!1,group:"Display"},{id:"maxEvents",type:"range",label:"Max events shown",default:2,min:1,max:5,step:1,group:"Display"},{id:"showCrmPlan",type:"toggle",label:"Show CRM outreach plan",default:!0,group:"Display"},{id:"showConversationTips",type:"toggle",label:"Show conversation tips (pro)",default:!1,group:"Display"}],events:{emits:[{name:"social:eventSelected",description:"User selected an event to attend"},{name:"social:templateCopied",description:"User copied a message template"},{name:"chat:draft",description:"Seed the chat composer with a draft message + quick-reply chips"}],listens:[{name:"social:refresh",description:"Force refresh social insights"}]},supportedPlacements:["main","sidebar"]},j={high:0,medium:1,low:2};function v({text:s,prefix:a,onCopy:l,t:o}){const[t,d]=h.useState(!1),p=h.useRef(null),u=h.useCallback(()=>{l(s),d(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>d(!1),1200)},[l,s]);return h.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),e.jsxs("div",{className:`es-si__copyable${t?" es-si__copyable--copied":""}`,onClick:u,role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),u())},"aria-label":o(t?"social_insights.copied":"social_insights.tap_to_copy"),title:o("social_insights.tap_to_copy"),children:[a&&e.jsx("span",{className:"es-si__copyable-prefix",children:a}),e.jsx("span",{className:"es-si__copyable-text",children:s})]})}function P({total:s,high:a,medium:l,t:o}){return e.jsxs("div",{className:"es-si__stats",children:[e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n",children:s}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_events")})]}),e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n es-si__stat-n--high",children:a}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_high")})]}),e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n es-si__stat-n--medium",children:l}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_medium")})]})]})}function I({card:s,selected:a,onSelect:l,t:o}){return e.jsxs("div",{className:`es-si__row${a?" es-si__row--active":""}`,onClick:l,role:"button",tabIndex:0,"aria-pressed":a,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),l())},children:[e.jsx("span",{className:`es-si__dot es-si__dot--${s.priorityLevel}`,role:"img","aria-label":o(`social_insights.priority_${s.priorityLevel}`)}),e.jsxs("div",{className:"es-si__row-body",children:[e.jsx("div",{className:"es-si__row-name",children:s.eventName}),e.jsx("div",{className:"es-si__row-why",children:s.whyThisEventMatters})]}),e.jsx("span",{className:"es-si__row-go","aria-hidden":"true",children:o("social_insights.focus_cta")})]})}function D({card:s,onCopy:a,onTalkToGaio:l,hasChatView:o,t}){const d=s.conversationOpeners?.[0];return e.jsxs("div",{className:"es-si__focus",children:[e.jsxs("div",{className:"es-si__focus-tag",children:[e.jsx("span",{"aria-hidden":"true",children:"★"})," ",t("social_insights.focus_play")," ·"," ",e.jsx("span",{className:"es-si__focus-cat",children:s.category})]}),e.jsx("div",{className:"es-si__focus-name",children:s.eventName}),e.jsx("div",{className:"es-si__focus-profile",children:s.targetProfile}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"👁"})," ",t("social_insights.spot_them")]}),e.jsx("div",{className:"es-si__detail-text es-si__detail-text--muted",children:s.howToSpotThem}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"💬"})," ",t("social_insights.best_opener")]}),e.jsx(v,{text:d,onCopy:a,t})]}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"🌉"})," ",t("social_insights.bridge")]}),e.jsx(v,{text:s.bridgeLine,onCopy:a,t}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"📩"})," ",t("social_insights.followup_48h")]}),e.jsx(v,{text:s.followUp48h,onCopy:a,t}),e.jsxs("div",{className:"es-si__focus-warn",children:[e.jsx("div",{className:"es-si__detail-label es-si__detail-label--warn",children:t("social_insights.do_not_say")}),e.jsx("div",{className:"es-si__detail-text",children:s.doNotSay})]}),o&&e.jsx("div",{className:"es-si__gaio-row",children:e.jsxs("button",{type:"button",className:"es-si__gaio-link","aria-label":t("social_insights.gaio.aria",{event:s.eventName}),onClick:()=>l(s),children:[e.jsx("span",{"aria-hidden":"true",children:"💬"})," ",t("social_insights.talk_to_gaio")]})})]})}function F({data:s,actions:a,metadata:l,i18n:o,baseUrl:t,externalContext:d,auth:p,previewMode:u}){const i=o?.t??(n=>n),_=s,b=s.promptLogId,w=d?.apiKey??"",N=d?.hasChatView===!0,[y,k]=h.useState(0),C=h.useCallback(n=>{navigator.clipboard?.writeText(n).catch(()=>{}),a.emit("social:templateCopied",{text:n})},[a]),S=h.useCallback(n=>{const c=n.eventName;a.emit("chat:draft",{message:i("social_insights.gaio_draft",{event:c,why:n.whyThisEventMatters}),autoSend:!1,quickChips:[{label:i("social_insights.gaio.chip.plan"),message:i("social_insights.gaio.chip.plan_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.opener"),message:i("social_insights.gaio.chip.opener_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.target"),message:i("social_insights.gaio.chip.target_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.other"),message:"",autoSend:!1}]})},[a,i]);if(!_.events&&!s.error)return e.jsx(g,{blockType:"social-insights",children:e.jsx("div",{className:"es-block__body",children:e.jsx("div",{className:"es-si__loading",children:l?.dataQuality==="none"?i("social_insights.sign_in_prompt"):i("social_insights.gathering_events")})})});if(s.error)return e.jsx(g,{blockType:"social-insights",error:M(s.error)});const r=[..._.events??[]].sort((n,c)=>j[n.priorityLevel]-j[c.priorityLevel]),m=_.quietWeek,T=r.filter(n=>n.priorityLevel==="high").length,E=r.filter(n=>n.priorityLevel==="medium").length,x=y<r.length?y:0,f=r[x];return e.jsx(g,{blockType:"social-insights",children:e.jsxs("div",{className:"es-block__body",children:[e.jsx(L,{promptLogId:b,baseUrl:t,apiKey:w,jwt:p?.jwt,previewMode:u,t:i}),r.length>0&&e.jsx(P,{total:r.length,high:T,medium:E,t:i}),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-si__section-head",children:[e.jsx("span",{className:"es-si__section-title",children:i("social_insights.ranked_events")}),e.jsx("span",{className:"es-si__section-hint",children:i("social_insights.tap_to_focus")})]}),e.jsx("div",{className:"es-si__list",role:"list","aria-label":i("social_insights.ranked_events"),children:r.map((n,c)=>e.jsx(I,{card:n,selected:c===x,onSelect:()=>k(c),t:i},`${n.eventName}-${c}`))}),f&&e.jsx(D,{card:f,onCopy:C,onTalkToGaio:S,hasChatView:N,t:i})]}),r.length===0&&m&&e.jsxs("div",{className:"es-si__quiet-week",children:[e.jsx("div",{className:"es-si__quiet-week-headline",children:m.headline}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.downline_focus")}),e.jsx("div",{className:"es-si__detail-text",children:m.downlineActivationTarget})]}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.warm_network_action")}),e.jsx("div",{className:"es-si__detail-text",children:m.warmNetworkAction})]}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.online_conversation")}),e.jsx("div",{className:"es-si__detail-text",children:m.onlineConversationPrompt})]})]}),_.complianceNote&&(r.length>0||m)&&e.jsxs("div",{className:"es-si__compliance",role:"note",children:[e.jsx("span",{className:"es-si__compliance-icon","aria-hidden":"true",children:"⚠"}),e.jsxs("span",{className:"es-si__compliance-text",children:[e.jsxs("span",{className:"es-si__compliance-label",children:[i("social_insights.compliance_label"),":"]})," ",_.complianceNote]})]})]})})}export{F as Component,A as manifest};
2
- //# sourceMappingURL=index-CqV8rHvG-DS9JaGVN.js.map
1
+ import{r as h,j as e,Q as g,o as M}from"../nexly.js";import{C as L}from"./block-rating-DGpoz2o3-CoiP5C2K.js";const A={slug:"social-insights",name:"Social Insights",version:"1.0.0",category:"data",requiredService:"social-insights",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},proMode:{type:"boolean",default:!1},maxEvents:{type:"number",default:2},showCrmPlan:{type:"boolean",default:!0},showConversationTips:{type:"boolean",default:!1}}},defaultConfig:{readAloudEnabled:!1,proMode:!1,maxEvents:2,showCrmPlan:!0,showConversationTips:!1},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!0},dataContract:{serviceSlug:"social-insights",inputSchema:{type:"object",properties:{eventIntelligence:{type:"object",properties:{scoredEvents:{type:"array",items:{type:"object",properties:{eventName:{type:"string"},conversionScore:{type:"number"}}}},recommendedEvent:{type:"object",properties:{eventName:{type:"string"},missionGoal:{type:"string"}}}}},eventMissionBrief:{type:"object",properties:{conversationOpeners:{type:"array",items:{type:"string"}},qualificationQuestions:{type:"array",items:{type:"string"}},positioningStatement:{type:"string"}}},crmExecutionPlan:{type:"object",properties:{leadPipelineStructure:{type:"string"},recommendedDailyOutreachVolume:{type:"number"},messageTemplates:{type:"object",properties:{firstContact:{type:"string"},followup48h:{type:"string"}}}}},weeklySocialStrategy:{type:"object",properties:{mainObjectiveThisWeek:{type:"string"},numericTarget:{type:"string"}}}}},previewDataOverride:{eventIntelligence:{scoredEvents:[{eventName:"Seoul Tech & Crypto Meetup",category:"Networking",conversionScore:92,whyRelevant:"High density of crypto-curious professionals matching your target profile.",targetProfile:"Tech professionals aged 28–42",priorityLevel:"high"},{eventName:"Gangnam Business Luncheon",category:"Business Networking",conversionScore:74,whyRelevant:"Established entrepreneurs with disposable income open to investment opportunities.",targetProfile:"SME owners and executives",priorityLevel:"medium"},{eventName:"Online MLM Success Webinar",category:"Industry",conversionScore:61,whyRelevant:"Pre-qualified audience already interested in network marketing.",targetProfile:"MLM beginners and career changers",priorityLevel:"medium"}],recommendedEvent:{eventName:"Seoul Tech & Crypto Meetup",missionGoal:"Connect with 5 warm prospects and set 2 follow-up calls",contactsTarget:5,followupTarget:2}},eventMissionBrief:{conversationOpeners:["What brings you to the crypto/tech space?","Have you been following the recent Bitcoin surge?"],qualificationQuestions:["Are you currently looking for passive income opportunities?","What's your experience with network marketing?"],positioningStatement:"I help people build financial freedom through crypto-backed network marketing.",whatNotToSay:["Don't mention specific income figures in the first meeting."]},crmExecutionPlan:{leadPipelineStructure:"Prospect → First Contact → Follow-up (48h) → Meeting → Close",recommendedDailyOutreachVolume:8,followupIntervalsHours:48,messageTemplates:{firstContact:"Hi [Name], great meeting you at the Seoul meetup! I'd love to share something exciting with you — when's a good time for a 15-min call?",followup48h:"Hi [Name], just following up on my message. I have some insights about [topic we discussed] that I think you'll find valuable.",postEventMessage:"Thanks for connecting at [event]! Let me know if you're open to exploring what I mentioned."}},weeklySocialStrategy:{mainObjectiveThisWeek:"Qualify 10 new prospects from event pipeline",numericTarget:"10 new prospects, 3 follow-up calls",structureAlignmentGoal:"Focus on right leg to balance binary structure",riskMitigationFocus:"Avoid cap waste by ensuring team volume is distributed evenly"}}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"proMode",type:"toggle",label:"Pro mode (full strategy details)",default:!1,group:"Display"},{id:"maxEvents",type:"range",label:"Max events shown",default:2,min:1,max:5,step:1,group:"Display"},{id:"showCrmPlan",type:"toggle",label:"Show CRM outreach plan",default:!0,group:"Display"},{id:"showConversationTips",type:"toggle",label:"Show conversation tips (pro)",default:!1,group:"Display"}],events:{emits:[{name:"social:eventSelected",description:"User selected an event to attend"},{name:"social:templateCopied",description:"User copied a message template"},{name:"chat:draft",description:"Seed the chat composer with a draft message + quick-reply chips"}],listens:[{name:"social:refresh",description:"Force refresh social insights"}]},supportedPlacements:["main","sidebar"]},j={high:0,medium:1,low:2};function v({text:s,prefix:a,onCopy:l,t:o}){const[t,d]=h.useState(!1),p=h.useRef(null),u=h.useCallback(()=>{l(s),d(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>d(!1),1200)},[l,s]);return h.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),e.jsxs("div",{className:`es-si__copyable${t?" es-si__copyable--copied":""}`,onClick:u,role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),u())},"aria-label":o(t?"social_insights.copied":"social_insights.tap_to_copy"),title:o("social_insights.tap_to_copy"),children:[a&&e.jsx("span",{className:"es-si__copyable-prefix",children:a}),e.jsx("span",{className:"es-si__copyable-text",children:s})]})}function P({total:s,high:a,medium:l,t:o}){return e.jsxs("div",{className:"es-si__stats",children:[e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n",children:s}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_events")})]}),e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n es-si__stat-n--high",children:a}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_high")})]}),e.jsxs("div",{className:"es-si__stat",children:[e.jsx("div",{className:"es-si__stat-n es-si__stat-n--medium",children:l}),e.jsx("div",{className:"es-si__stat-l",children:o("social_insights.stat_medium")})]})]})}function I({card:s,selected:a,onSelect:l,t:o}){return e.jsxs("div",{className:`es-si__row${a?" es-si__row--active":""}`,onClick:l,role:"button",tabIndex:0,"aria-pressed":a,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),l())},children:[e.jsx("span",{className:`es-si__dot es-si__dot--${s.priorityLevel}`,role:"img","aria-label":o(`social_insights.priority_${s.priorityLevel}`)}),e.jsxs("div",{className:"es-si__row-body",children:[e.jsx("div",{className:"es-si__row-name",children:s.eventName}),e.jsx("div",{className:"es-si__row-why",children:s.whyThisEventMatters})]}),e.jsx("span",{className:"es-si__row-go","aria-hidden":"true",children:o("social_insights.focus_cta")})]})}function D({card:s,onCopy:a,onTalkToGaio:l,hasChatView:o,t}){const d=s.conversationOpeners?.[0];return e.jsxs("div",{className:"es-si__focus",children:[e.jsxs("div",{className:"es-si__focus-tag",children:[e.jsx("span",{"aria-hidden":"true",children:"★"})," ",t("social_insights.focus_play")," ·"," ",e.jsx("span",{className:"es-si__focus-cat",children:s.category})]}),e.jsx("div",{className:"es-si__focus-name",children:s.eventName}),e.jsx("div",{className:"es-si__focus-profile",children:s.targetProfile}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"👁"})," ",t("social_insights.spot_them")]}),e.jsx("div",{className:"es-si__detail-text es-si__detail-text--muted",children:s.howToSpotThem}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"💬"})," ",t("social_insights.best_opener")]}),e.jsx(v,{text:d,onCopy:a,t})]}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"🌉"})," ",t("social_insights.bridge")]}),e.jsx(v,{text:s.bridgeLine,onCopy:a,t}),e.jsxs("div",{className:"es-si__detail-label",children:[e.jsx("span",{"aria-hidden":"true",children:"📩"})," ",t("social_insights.followup_48h")]}),e.jsx(v,{text:s.followUp48h,onCopy:a,t}),e.jsxs("div",{className:"es-si__focus-warn",children:[e.jsx("div",{className:"es-si__detail-label es-si__detail-label--warn",children:t("social_insights.do_not_say")}),e.jsx("div",{className:"es-si__detail-text",children:s.doNotSay})]}),o&&e.jsx("div",{className:"es-si__gaio-row",children:e.jsxs("button",{type:"button",className:"es-si__gaio-link","aria-label":t("social_insights.gaio.aria",{event:s.eventName}),onClick:()=>l(s),children:[e.jsx("span",{"aria-hidden":"true",children:"💬"})," ",t("social_insights.talk_to_gaio")]})})]})}function F({data:s,actions:a,metadata:l,i18n:o,baseUrl:t,externalContext:d,auth:p,previewMode:u}){const i=o?.t??(n=>n),_=s,b=s.promptLogId,w=d?.apiKey??"",N=d?.hasChatView===!0,[y,k]=h.useState(0),C=h.useCallback(n=>{navigator.clipboard?.writeText(n).catch(()=>{}),a.emit("social:templateCopied",{text:n})},[a]),S=h.useCallback(n=>{const c=n.eventName;a.emit("chat:draft",{message:i("social_insights.gaio_draft",{event:c,why:n.whyThisEventMatters}),autoSend:!1,quickChips:[{label:i("social_insights.gaio.chip.plan"),message:i("social_insights.gaio.chip.plan_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.opener"),message:i("social_insights.gaio.chip.opener_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.target"),message:i("social_insights.gaio.chip.target_msg",{event:c}),autoSend:!0},{label:i("social_insights.gaio.chip.other"),message:"",autoSend:!1}]})},[a,i]);if(!_.events&&!s.error)return e.jsx(g,{blockType:"social-insights",children:e.jsx("div",{className:"es-block__body",children:e.jsx("div",{className:"es-si__loading",children:l?.dataQuality==="none"?i("social_insights.sign_in_prompt"):i("social_insights.gathering_events")})})});if(s.error)return e.jsx(g,{blockType:"social-insights",error:M(s.error)});const r=[..._.events??[]].sort((n,c)=>j[n.priorityLevel]-j[c.priorityLevel]),m=_.quietWeek,T=r.filter(n=>n.priorityLevel==="high").length,E=r.filter(n=>n.priorityLevel==="medium").length,x=y<r.length?y:0,f=r[x];return e.jsx(g,{blockType:"social-insights",children:e.jsxs("div",{className:"es-block__body",children:[e.jsx(L,{promptLogId:b,baseUrl:t,apiKey:w,jwt:p?.jwt,previewMode:u,t:i}),r.length>0&&e.jsx(P,{total:r.length,high:T,medium:E,t:i}),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-si__section-head",children:[e.jsx("span",{className:"es-si__section-title",children:i("social_insights.ranked_events")}),e.jsx("span",{className:"es-si__section-hint",children:i("social_insights.tap_to_focus")})]}),e.jsx("div",{className:"es-si__list",role:"list","aria-label":i("social_insights.ranked_events"),children:r.map((n,c)=>e.jsx(I,{card:n,selected:c===x,onSelect:()=>k(c),t:i},`${n.eventName}-${c}`))}),f&&e.jsx(D,{card:f,onCopy:C,onTalkToGaio:S,hasChatView:N,t:i})]}),r.length===0&&m&&e.jsxs("div",{className:"es-si__quiet-week",children:[e.jsx("div",{className:"es-si__quiet-week-headline",children:m.headline}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.downline_focus")}),e.jsx("div",{className:"es-si__detail-text",children:m.downlineActivationTarget})]}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.warm_network_action")}),e.jsx("div",{className:"es-si__detail-text",children:m.warmNetworkAction})]}),e.jsxs("div",{className:"es-si__detail-section",children:[e.jsx("div",{className:"es-si__detail-label",children:i("social_insights.online_conversation")}),e.jsx("div",{className:"es-si__detail-text",children:m.onlineConversationPrompt})]})]}),_.complianceNote&&(r.length>0||m)&&e.jsxs("div",{className:"es-si__compliance",role:"note",children:[e.jsx("span",{className:"es-si__compliance-icon","aria-hidden":"true",children:"⚠"}),e.jsxs("span",{className:"es-si__compliance-text",children:[e.jsxs("span",{className:"es-si__compliance-label",children:[i("social_insights.compliance_label"),":"]})," ",_.complianceNote]})]})]})})}export{F as Component,A as manifest};
2
+ //# sourceMappingURL=index-Dtiss_wT-CLkn_6EY.js.map
@@ -1,2 +1,2 @@
1
1
  import{j as e,H as N,r as d}from"../nexly.js";const f={"--ai-bg":"#141414","--ai-bg-elevated":"#1F1F1F","--ai-bg-card":"#1F1F1F","--ai-bg-input":"#141414","--ai-bg-footer":"#141414","--ai-fg":"#F5F5F5","--ai-fg-secondary":"#D1D5DB","--ai-muted":"#9CA3AF","--ai-muted-dim":"#6B7280","--ai-border":"#2a2a2a","--ai-border-subtle":"#1e1e1e","--ai-accent":"#FFCC00","--ai-accent-fg":"#1A1A1A","--ai-accent-hover":"#E6B800","--ai-accent-subtle":"rgba(255, 204, 0, 0.12)","--ai-accent-on-subtle":"#FFCC00","--ai-accent-on-subtle-strong":"#FFCC00","--ai-accent-border":"#75600C","--ai-user-bubble":"#FFCC00","--ai-user-bubble-fg":"#1A1A1A","--ai-assistant-bubble":"#1F1F1F","--ai-assistant-bubble-fg":"#F5F5F5","--ai-shadow":"0 20px 60px -15px rgba(0, 0, 0, 0.7)","--ai-scrollbar":"#FFCC00","--ai-success":"#22C55E","--ai-warning":"#EAB308","--ai-error":"#F87171","--ai-info":"#38BDF8","--es-color-surface":"#141414","--es-color-surface-elevated":"#1F1F1F","--es-color-surface-hover":"#2E2E2E","--es-color-on-surface":"#F5F5F5","--es-color-on-surface-muted":"#9CA3AF","--es-color-primary":"#FFCC00","--es-color-on-primary":"#1A1A1A","--es-color-primary-muted":"rgba(255, 204, 0, 0.12)","--es-color-primary-on-muted":"#FFCC00","--es-color-border":"#2a2a2a","--es-color-control-border":"#6B7280","--es-color-error":"#F87171","--es-color-success":"#22C55E","--es-color-on-success":"#1A1A1A","--es-color-warning":"#EAB308","--es-color-interactive":"#FFE066"},S={"--ai-bg":"#FFFFFF","--ai-bg-elevated":"#FAFAFA","--ai-bg-card":"#F2F2F2","--ai-bg-input":"#F2F2F2","--ai-bg-footer":"#FFFFFF","--ai-fg":"#1A1A1A","--ai-fg-secondary":"#4B4B4F","--ai-muted":"#67696E","--ai-muted-dim":"#9CA3AF","--ai-border":"#E5E5E5","--ai-border-subtle":"#EFEFEF","--ai-accent":"#856900","--ai-accent-fg":"#FFFFFF","--ai-accent-hover":"#6B5400","--ai-accent-subtle":"rgba(125, 98, 0, 0.10)","--ai-accent-on-subtle":"#7D6200","--ai-accent-on-subtle-strong":"#765D00","--ai-accent-border":"#A8944A","--ai-user-bubble":"#856900","--ai-user-bubble-fg":"#FFFFFF","--ai-assistant-bubble":"#F2F2F2","--ai-assistant-bubble-fg":"#1A1A1A","--ai-shadow":"0 20px 60px -15px rgba(0, 0, 0, 0.12)","--ai-scrollbar":"#D1D5DB","--ai-success":"#00672B","--ai-warning":"#9C5300","--ai-error":"#AD2C26","--ai-info":"#03669D","--es-color-surface":"#FFFFFF","--es-color-surface-elevated":"#F2F2F2","--es-color-surface-hover":"#EAEAEA","--es-color-on-surface":"#1A1A1A","--es-color-on-surface-muted":"#67696E","--es-color-primary":"#856900","--es-color-on-primary":"#FFFFFF","--es-color-primary-muted":"rgba(118, 93, 0, 0.10)","--es-color-primary-on-muted":"#765D00","--es-color-border":"#E5E5E5","--es-color-control-border":"#6B7280","--es-color-error":"#AD2C26","--es-color-success":"#00672B","--es-color-on-success":"#FFFFFF","--es-color-interactive":"#92400E"},O={slug:"ambient-signal-black",name:"Signal Black",version:"0.1.0",slots:["header","main","footer"],cssVariables:f,structure:{header:{id:"header",label:"Header",accepts:!0},main:{id:"main",label:"Main Content",accepts:!0},footer:{id:"footer",label:"Footer",accepts:!0}},defaultViews:[],requiredServices:["chat-bot"],description:"Bold monochrome theme with a #FFCC00 signal-gold accent, built for the AmbientSystem SupportChat widget.",author:"E-Commerce Studio",packageName:"@ecommerce-studio/theme-ambient-signal-black",options:[{id:"colorScheme",type:"select",label:"Appearance mode",default:"auto",group:"Appearance",options:[{label:"Auto (match visitor)",value:"auto"},{label:"Light",value:"light"},{label:"Dark",value:"dark"}]}],supports:{customCss:!1,customJs:!1,darkMode:!0,rtl:!1,views:!1}},D=105,j=82,x="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGkAAABSCAYAAABXP/pUAAACiklEQVR42u2c23GDQAxFtyc3oGrShupINWogPTn+sCcewmMxSKtdzp3RX2CcPVxJaIFSUEvJM+wZ90coy+KzyLoQsnLcC8o00AlQdGWBl8LeoK0di4sOwtkL5pNAieHgog+lQXBe6XDtAkEzskBAUxfNuRclAUTHlzDF0VAMBIiGIjkgXNSwDuEiXDSesgIy0Py1vXecRKo7EgKivA0DKa+DegSkjiBdvi5J+dtBtcSpD63AMyDRAQJp4ogtV1jZfnikBSwbEcqZtUUXZmeRsHQ0OJ5XszYCpcA5tmARoIDzoaskaPbXrYuyzNo0ABTuOXn4qVd3UeZJtTgNaw1APosp5YLbFNkBXd5N1gkgbzcByMlNw6c87RDQ1E1Dp7xeAV0GUs+ApvVDR4V0B1JuSAqkOkhfADptMV0g3R7xs7HRBaT6WZt5nPcd0vQPhFq0G5LLfdISJO+prA4EyX3i8FUB6e6QDkd0kTqddxekM4GN5qLiCP9jSEfS4SipTiJcdBaktSdrRoXkuTNbPCHVpkPpHJQ4Nguza/btBKm2ndeOgNnM/xHyAEoEpNr6lRmYzmQDi1qbaEi19SsLsDn3aPDF2wxSdmC2kKItGlB5AvpJllbWfrQ4QrMS/1ZF1e1LNkh7W/p3aLbz3C8osnH+5q+23J5teA+vJu6dcshM1B5nDRuo3Xq/UjNBtBNniVJiX8EMf4xYSp6XhK38/+TzNFr/TikJlQlitla+G/U+IrrU52dGBDXk9+qU1AYo4JwMSoEDrKgNTmA1AiMgaTNc3UplgEkyzjGgtJty1DiP+pJAQAISAhKQ6OJaNxBHtkas1H1VEh2Aw01t4ukEWxKd1x5AIYQQQgihhvoFxm18xEWNaMwAAAAASUVORK5CYII=",M=j/D,_=.62;function C({size:a=64,className:o,registerEl:s}){const c=a*_,n=c*M;return e.jsx("div",{className:o,"aria-hidden":"true","data-bird":"badge",style:{position:"relative",width:a,height:a,borderRadius:"9999px",background:"var(--ai-accent, #FFCC00)",color:"var(--ai-accent-fg, #1A1A1A)",display:"flex",alignItems:"center",justifyContent:"center",overflow:"visible"},children:e.jsxs("div",{ref:s,"data-bird":"root",style:{position:"relative",width:c,height:n,transformOrigin:"50% 50%"},children:[e.jsx("div",{"data-bird":"glow",style:{position:"absolute",inset:"-35%",borderRadius:"9999px",background:"radial-gradient(closest-side, currentColor, transparent 72%)",opacity:0,filter:"blur(6px)",pointerEvents:"none"}}),e.jsx("div",{"data-bird":"mark",style:{position:"relative",width:"100%",height:"100%",backgroundColor:"currentColor",WebkitMaskImage:`url("${x}")`,maskImage:`url("${x}")`,WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center",WebkitMaskSize:"contain",maskSize:"contain"}})]})})}const I=3200,R=2.5,z=4200,J=3,Q=Math.PI/3,P=5200,A=.12,V=.34;function p(a,o){const s=a.querySelector('[data-bird="glow"]');s&&(s.style.opacity=o.toFixed(3))}function X(a){const o=d.useRef(new Set),s=d.useRef(0),c=d.useCallback(n=>{const i=o.current;if(n)i.add(n);else for(const t of i)t.isConnected||i.delete(t)},[]);return d.useEffect(()=>{if(!a)return;if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches){for(const t of o.current)t.style.transform="",p(t,A);return}const n=performance.now();function i(t){const r=t-n,h=Math.sin(r/I*Math.PI*2)*R,F=Math.sin(r/z*Math.PI*2+Q)*J,u=(Math.sin(r/P*Math.PI*2)+1)/2,l=A+(V-A)*u;for(const b of o.current)b.style.transform=`translateY(${h.toFixed(2)}px) rotate(${F.toFixed(2)}deg)`,p(b,l);s.current=requestAnimationFrame(i)}return s.current=requestAnimationFrame(i),()=>{cancelAnimationFrame(s.current);for(const t of o.current)t.style.transform="",p(t,0)}},[a]),{registerEl:c}}function T({brandName:a="AMBIENT",position:o="bottom-right",initialOpen:s=!1,children:c,cssVariables:n,t:i,colorScheme:t,builderMode:r=!1,owlIdleLife:h=!1,onOpenChange:F}){const u=N(t),[l,b]=d.useState(s||r),k=X(h),B=()=>b(g=>{const m=!g;return F?.(m),m}),w=()=>{b(!1),F?.(!1)},E=o==="bottom-left",v=d.useMemo(()=>{const g=Object.fromEntries(Object.entries(n??{}).filter(([m,y])=>f[m]!==y));return{...u==="light"?S:f,...g,...r?{width:"100%",height:"100%"}:{}}},[n,u,r]);return e.jsxs("div",{className:["ambient-shell",`ambient-shell--${u}`].join(" "),style:v,children:[!r&&e.jsx("button",{type:"button",className:["ambient-shell__button",E&&"ambient-shell__button--left",l&&"ambient-shell__button--hidden"].filter(Boolean).join(" "),onClick:B,"aria-label":i?.("floating.open_widget")??"Open chat widget",tabIndex:l?-1:0,"aria-hidden":l,children:e.jsx(C,{size:64,registerEl:k.registerEl})}),e.jsxs("div",{className:["ambient-shell__panel",E&&!r&&"ambient-shell__panel--left",(l||r)&&"ambient-shell__panel--open"].filter(Boolean).join(" "),role:"dialog","aria-label":i?.("chat.widget_aria")??"Chat widget","aria-hidden":r?!1:!l,children:[e.jsxs("header",{className:"ambient-shell__header",children:[e.jsxs("div",{className:"ambient-shell__header-brand",children:[e.jsx(C,{size:40,registerEl:k.registerEl}),e.jsxs("div",{className:"ambient-shell__header-info",children:[e.jsx("h1",{className:"ambient-shell__brand-name",children:a}),e.jsx("p",{className:"ambient-shell__brand-tagline",children:i?.("header.brand_tagline_support")??"Support"})]})]}),!r&&e.jsx("button",{type:"button",className:"ambient-shell__header-btn",onClick:w,"aria-label":i?.("header.close_widget")??"Close widget",children:e.jsx(U,{size:20})})]}),e.jsx("main",{className:"ambient-shell__content",style:{containerName:"es-slot",containerType:"inline-size"},children:c})]})]})}function U({size:a=20}){return e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}export{C as BirdIcon,T as ThemeShell,f as darkVariables,S as lightVariables,O as manifest,X as useBirdAnimation};
2
- //# sourceMappingURL=index-uM4Y0lxc-Dsa9X9U7.js.map
2
+ //# sourceMappingURL=index-MAmLiP1_-Dsa9X9U7.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as p,j as e,Q as r}from"../nexly.js";const N={slug:"event-list",name:"Event List",version:"1.0.0",category:"content",requiredService:"event-scraper",configSchema:{properties:{maxEvents:{type:"number",default:20},freeOnly:{type:"boolean",default:!1}}},defaultConfig:{maxEvents:20,freeOnly:!1},dataContract:{serviceSlug:"event-scraper",inputSchema:{type:"object",properties:{events:{type:"array",items:{type:"object",properties:{id:{type:"string"},title:{type:"string"},date:{type:"string"},location:{type:"string"},price:{type:"number"},isFree:{type:"boolean"},url:{type:"string"},imageUrl:{type:"string"}}}},total:{type:"number"}},required:["events"]},previewDataOverride:{events:[{id:"evt-1",title:"Tech Startup Networking Night",date:"2026-04-10T18:00:00Z",location:"Seoul, Gangnam-gu",price:0,isFree:!0,url:"https://onoffmix.com/event/1",imageUrl:""},{id:"evt-2",title:"AI & Machine Learning Summit",date:"2026-04-15T09:00:00Z",location:"Seoul, Mapo-gu",price:25e3,isFree:!1,url:"https://onoffmix.com/event/2",imageUrl:""},{id:"evt-3",title:"Web3 Developer Workshop",date:"2026-04-20T14:00:00Z",location:"Seoul, Songpa-gu",price:0,isFree:!0,url:"https://onoffmix.com/event/3",imageUrl:""}],total:3}},fields:[{id:"maxEvents",type:"range",label:"Max events to show",default:20,min:1,max:100,step:1,group:"Content"},{id:"freeOnly",type:"toggle",label:"Show free events only",default:!1,group:"Filters"}],events:{emits:[{name:"events:eventSelected",description:"User clicked on an event"},{name:"events:filterChanged",description:"User changed the event filter"}],listens:[{name:"events:refresh",description:"Reload events from scraper"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main"]};function j(l,s){const n=new Date(l);return isNaN(n.getTime())?l:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function c(){return e.jsxs("li",{className:"es-evlist__skeleton","aria-hidden":"true",children:[e.jsx("div",{className:"es-evlist__skeleton-line es-evlist__skeleton-line--title"}),e.jsx("div",{className:"es-evlist__skeleton-line es-evlist__skeleton-line--meta"}),e.jsx("div",{className:"es-evlist__skeleton-line es-evlist__skeleton-line--short"})]})}function k({data:l,actions:s,i18n:n}){const i=n?.t??(t=>t),_=n?.currentLanguage??"en",d=l.events??[],u=l.loading===!0,h=l.error,[g,x]=p.useState(null);p.useEffect(()=>{const t=s.on("events:markerHighlight",o=>{x(o?.id??null)});return()=>t()},[s]);const y=t=>{t&&s.emit("events:hover",{id:t})},f=()=>{s.emit("events:hover",{id:null})},v=t=>{t.id&&s.emit("events:eventSelected",{id:t.id,event:t})};return u?e.jsx(r,{blockType:"event-list",children:e.jsx("div",{className:"es-block__body",children:e.jsxs("ul",{className:"es-evlist__items","aria-label":i("event_list.loading"),"aria-busy":"true",children:[e.jsx(c,{}),e.jsx(c,{}),e.jsx(c,{})]})})}):h?e.jsx(r,{blockType:"event-list",children:e.jsx("div",{className:"es-block__body",children:e.jsxs("div",{className:"es-evlist__error",role:"alert",children:[e.jsx("span",{className:"es-evlist__error-icon","aria-hidden":"true",children:"⚠"}),e.jsx("span",{children:i("event_list.error")}),e.jsx("button",{type:"button",className:"es-evlist__retry",onClick:()=>s.refresh(),children:i("event_list.retry")})]})})}):d.length===0?e.jsx(r,{blockType:"event-list",children:e.jsx("div",{className:"es-block__body",children:e.jsxs("div",{className:"es-evlist__empty",children:[e.jsx("span",{className:"es-evlist__empty-icon","aria-hidden":"true",children:"📅"}),e.jsx("span",{className:"es-evlist__empty-text",children:i("event_list.empty")})]})})}):e.jsx(r,{blockType:"event-list",children:e.jsx("div",{className:"es-block__body",children:e.jsx("ul",{className:"es-evlist__items",role:"list","aria-label":i("event_list.aria_list_label"),children:d.map((t,o)=>{const m=t.id!=null&&t.id===g;return e.jsx("li",{className:`es-evlist__item${m?" es-evlist__item--highlighted":""}`,onMouseEnter:()=>y(t.id),onMouseLeave:f,onClick:()=>v(t),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),v(t))},tabIndex:0,role:"button","aria-pressed":m,children:e.jsxs("div",{className:"es-evlist__item-content",children:[e.jsxs("div",{className:"es-evlist__header",children:[e.jsx("span",{className:"es-evlist__title",children:t.title}),t.isFree&&e.jsx("span",{className:"es-evlist__badge es-evlist__badge--free",children:i("event_list.free")})]}),e.jsxs("div",{className:"es-evlist__meta",children:[t.date&&e.jsxs("span",{className:"es-evlist__date","aria-label":t.date,children:[e.jsx("span",{className:"es-evlist__meta-icon","aria-hidden":"true",children:"🗓"}),j(t.date,_)]}),t.location&&e.jsxs("span",{className:"es-evlist__location",children:[e.jsx("span",{className:"es-evlist__meta-icon","aria-hidden":"true",children:"📍"}),t.location]})]}),t.url&&e.jsxs("a",{href:t.url,className:"es-evlist__cta",target:"_blank",rel:"noopener noreferrer","aria-label":`${i("event_list.view_details")}: ${t.title}`,onClick:a=>a.stopPropagation(),children:[i("event_list.view_details")," →"]})]})},t.id??o)})})})})}export{k as Component,N as manifest};
2
- //# sourceMappingURL=index-Chy2Zmo5-CiRb-0NX.js.map
2
+ //# sourceMappingURL=index-Or6sA2eF-CiRb-0NX.js.map