@nexlylab/widget 1.32.14

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 (66) hide show
  1. package/README.md +66 -0
  2. package/dist/INSTALL.txt +3 -0
  3. package/dist/runtime/1.32.14/chunks/ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js +2 -0
  4. package/dist/runtime/1.32.14/chunks/PanelInfoVideo-BKn3ucAb-BrU-Qlul.js +3 -0
  5. package/dist/runtime/1.32.14/chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js +3 -0
  6. package/dist/runtime/1.32.14/chunks/_commonjsHelpers-C6fGbg64-BC8KDfbh.js +2 -0
  7. package/dist/runtime/1.32.14/chunks/accent-legibility-BJF2VO5n-CDPQ7suO.js +2 -0
  8. package/dist/runtime/1.32.14/chunks/allowed-elements-BXnLJV1S-C-_lr2zm.js +28 -0
  9. package/dist/runtime/1.32.14/chunks/assistant-link-components-MZWf5ty7-C44wlQAi.js +2 -0
  10. package/dist/runtime/1.32.14/chunks/assistant-link-policy-DWaWTnGr-Cc-yj-a-.js +2 -0
  11. package/dist/runtime/1.32.14/chunks/block-helpers-Cg_zAqG6-DnN2COvk.js +2 -0
  12. package/dist/runtime/1.32.14/chunks/block-rating-DH7mp-_R-CoiP5C2K.js +2 -0
  13. package/dist/runtime/1.32.14/chunks/external-url-LRu_ntew-CJQjg_od.js +2 -0
  14. package/dist/runtime/1.32.14/chunks/index-1o6W5wiJ-I68tb-d3.js +2 -0
  15. package/dist/runtime/1.32.14/chunks/index-B1ef1IlE-QeFj7CR9.js +2 -0
  16. package/dist/runtime/1.32.14/chunks/index-B8aKMeg5-BLxOZxZv.js +2 -0
  17. package/dist/runtime/1.32.14/chunks/index-B9ozeox8-oy07dUaV.js +6 -0
  18. package/dist/runtime/1.32.14/chunks/index-BD-jPdzs-ZRnEJoQe.js +2 -0
  19. package/dist/runtime/1.32.14/chunks/index-BPDIV1BN-DINkyYvc.js +2 -0
  20. package/dist/runtime/1.32.14/chunks/index-BSoCdILD-D6wzHiS0.js +2 -0
  21. package/dist/runtime/1.32.14/chunks/index-BcsmWDTX-Dw9WA5Ac.js +2 -0
  22. package/dist/runtime/1.32.14/chunks/index-BljIlfbh-D9I6jaso.js +2 -0
  23. package/dist/runtime/1.32.14/chunks/index-BnKOhYKk-CkemNrch.js +4 -0
  24. package/dist/runtime/1.32.14/chunks/index-Bu9Gh6Nc-BfWdQCT7.js +2 -0
  25. package/dist/runtime/1.32.14/chunks/index-BvlAsO4n-DbuSZfeK.js +2 -0
  26. package/dist/runtime/1.32.14/chunks/index-BylVnv7X-DBhSkJ7i.js +2 -0
  27. package/dist/runtime/1.32.14/chunks/index-C1WD1dlq-Dm9kbc85.js +2 -0
  28. package/dist/runtime/1.32.14/chunks/index-C262wwK4-DpyhuXqd.js +2 -0
  29. package/dist/runtime/1.32.14/chunks/index-C6_8JGpJ-BqZmEVev.js +2 -0
  30. package/dist/runtime/1.32.14/chunks/index-C75hX_dj-VhJcCfAC.js +2 -0
  31. package/dist/runtime/1.32.14/chunks/index-CMFQhtEe-BcW8HKb8.js +2 -0
  32. package/dist/runtime/1.32.14/chunks/index-CNJUK2bK-C0OfCXUx.js +50 -0
  33. package/dist/runtime/1.32.14/chunks/index-Chy2Zmo5-CiRb-0NX.js +2 -0
  34. package/dist/runtime/1.32.14/chunks/index-CmYYEi7N-Dr1V6OGz.js +2 -0
  35. package/dist/runtime/1.32.14/chunks/index-CqV8rHvG-DS9JaGVN.js +2 -0
  36. package/dist/runtime/1.32.14/chunks/index-CwbUW6dx-BLBDoJCM.js +2 -0
  37. package/dist/runtime/1.32.14/chunks/index-Czz6Gyh_-C3bBvEcm.js +2 -0
  38. package/dist/runtime/1.32.14/chunks/index-D-ZhVFzi-A3rpkVmQ.js +6 -0
  39. package/dist/runtime/1.32.14/chunks/index-D72orqXX-C_0Ll4qr.js +2 -0
  40. package/dist/runtime/1.32.14/chunks/index-D9grn5WJ-Dp5AxBD4.js +2 -0
  41. package/dist/runtime/1.32.14/chunks/index-DDEE3QfX-3B-eE3K7.js +2 -0
  42. package/dist/runtime/1.32.14/chunks/index-DMQkz1bV-BuMYksln.js +272 -0
  43. package/dist/runtime/1.32.14/chunks/index-DO0-ht8E-DUgMllqN.js +2 -0
  44. package/dist/runtime/1.32.14/chunks/index-DPNGQF5b-_M0CWPEY.js +2 -0
  45. package/dist/runtime/1.32.14/chunks/index-DP_6HfDM-DAdxCQyi.js +2 -0
  46. package/dist/runtime/1.32.14/chunks/index-DTVlG27U-DP0QKkgf.js +2 -0
  47. package/dist/runtime/1.32.14/chunks/index-DZADUAKv-DPfvWVuj.js +2 -0
  48. package/dist/runtime/1.32.14/chunks/index-DZKtK9hT-DQBGsPwB.js +2 -0
  49. package/dist/runtime/1.32.14/chunks/index-Dh0aThiP-Aqz1AnQ5.js +2 -0
  50. package/dist/runtime/1.32.14/chunks/index-Dkv5YXXW-pkywvGDF.js +2 -0
  51. package/dist/runtime/1.32.14/chunks/index-DphwDFW6-C9wFr7fa.js +2 -0
  52. package/dist/runtime/1.32.14/chunks/index-Dt6OpItC-R_xuAEQV.js +2 -0
  53. package/dist/runtime/1.32.14/chunks/index-Gi-3UOyp-DuzPeEIz.js +2 -0
  54. package/dist/runtime/1.32.14/chunks/index-IW3aNe-y-W1lJrIDD.js +2 -0
  55. package/dist/runtime/1.32.14/chunks/index-V1EfdiK7-bdo5pwX-.js +4 -0
  56. package/dist/runtime/1.32.14/chunks/index-csHaX5dv-BpgnWlB8.js +2 -0
  57. package/dist/runtime/1.32.14/chunks/index-hHQjRGar-TEMHje2B.js +2 -0
  58. package/dist/runtime/1.32.14/chunks/index-k-jZV_MQ-H31PHMqm.js +2 -0
  59. package/dist/runtime/1.32.14/chunks/index-qpVhJY7A-Cgivx3vY.js +4 -0
  60. package/dist/runtime/1.32.14/chunks/index-uM4Y0lxc-Dsa9X9U7.js +2 -0
  61. package/dist/runtime/1.32.14/chunks/index.modern-CioVZ357-BA5NTOmY.js +6 -0
  62. package/dist/runtime/1.32.14/chunks/inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js +2 -0
  63. package/dist/runtime/1.32.14/chunks/use-deferred-rating-XlgCUwcY-DDVOwURi.js +2 -0
  64. package/dist/runtime/1.32.14/nexly.js +61 -0
  65. package/dist/v1.js +6 -0
  66. package/package.json +36 -0
@@ -0,0 +1,2 @@
1
+ import{r as i,j as e,Q as m}from"../nexly.js";const f={slug:"faq",name:"FAQ",version:"1.0.0",category:"content",requiredService:"knowledge-search",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},limit:{type:"number",default:10}}},defaultConfig:{readAloudEnabled:!1,limit:10},dataContract:{serviceSlug:"knowledge-search",inputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{question:{type:"string"},answer:{type:"string"},category:{type:"string"}}}},total:{type:"number"}},required:["items"]},previewDataOverride:{items:[{question:"What is your return policy?",answer:"We accept returns within 30 days of purchase.",category:"Returns"},{question:"How long does shipping take?",answer:"Standard shipping takes 3-5 business days.",category:"Shipping"},{question:"Do you offer international shipping?",answer:"Yes, we ship to over 50 countries worldwide.",category:"Shipping"},{question:"How do I track my order?",answer:"You will receive a tracking link via email once your order ships.",category:"Orders"},{question:"Can I change or cancel my order?",answer:"Orders can be modified or cancelled within 1 hour of placement.",category:"Orders"}],total:5}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"limit",type:"range",label:"Number of FAQs",default:10,min:1,max:50,step:1,group:"Content"}],events:{emits:[{name:"faq:itemExpanded",description:"User expanded a FAQ item"},{name:"faq:itemCollapsed",description:"User collapsed a FAQ item"}],listens:[{name:"faq:refresh",description:"Reload FAQ content from service"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function g({data:n,config:o,i18n:l}){const d=l?.t??(a=>a),t=n.items??o.items??[],[r,c]=i.useState(null),p=i.useCallback(a=>{c(s=>s===a?null:a)},[]);return e.jsx(m,{blockType:"faq",children:e.jsxs("div",{className:"es-block__body",children:[t.length===0&&e.jsx("div",{className:"es-block__empty",children:d("faq.empty")}),t.map((a,s)=>e.jsxs("div",{className:"es-faq__item",children:[e.jsxs("button",{className:"es-faq__question",onClick:()=>p(s),type:"button",children:[e.jsx("span",{children:a.question}),e.jsx("span",{className:"es-faq__chevron",children:r===s?"▲":"▼"})]}),r===s&&e.jsx("div",{className:"es-faq__answer",children:a.answer})]},s))]})})}export{g as Component,f as manifest};
2
+ //# sourceMappingURL=index-DO0-ht8E-DUgMllqN.js.map
@@ -0,0 +1,2 @@
1
+ import{r as h,j as e,Q as m,o as j}from"../nexly.js";const C={slug:"recruitment-pipeline",name:"Recruitment Pipeline",version:"1.0.0",category:"interactive",requiredService:"recruitment-pipeline",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"recruitment-pipeline",inputSchema:{type:"object",properties:{stageCounts:{type:"object",properties:{contacted:{type:"number"},interested:{type:"number"},pending:{type:"number"},active:{type:"number"}}},topFollowUpToday:{type:"object",properties:{id:{type:"string"},name:{type:"string"},stage:{type:"string"},notes:{type:"string"},lastContactDate:{type:"string"}}},topFollowUpMessage:{type:"string"},prospects:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"},contactInfo:{type:"string"},stage:{type:"string"},notes:{type:"string"},lastContactDate:{type:"string"},aiFollowupMessage:{type:"string"}}}},mode:{type:"string",enum:["basic","pro"]}}},previewDataOverride:{mode:"pro",stageCounts:{contacted:3,interested:5,pending:2,active:4},topFollowUpToday:{id:"preview-1",name:"Piotr Nowak",stage:"interested",notes:"Met at networking event, interested in health products",lastContactDate:new Date(Date.now()-5*864e5).toISOString().slice(0,10)},topFollowUpMessage:"Hi Piotr! I was thinking about you — I'd love to share how our latest health product has been helping people in similar situations. Can we hop on a 10-minute call this week?",prospects:[{id:"preview-1",name:"Piotr Nowak",stage:"interested",notes:"Met at networking event",lastContactDate:new Date(Date.now()-5*864e5).toISOString().slice(0,10)},{id:"preview-2",name:"Anna Kowalska",stage:"pending",notes:"Waiting for reply after product demo",lastContactDate:new Date(Date.now()-2*864e5).toISOString().slice(0,10)},{id:"preview-3",name:"Maria Wiśniewska",stage:"contacted",lastContactDate:new Date(Date.now()-8*864e5).toISOString().slice(0,10)},{id:"preview-4",name:"Tomasz Wójcik",stage:"active",lastContactDate:new Date().toISOString().slice(0,10)}]}},fields:[{id:"mode",type:"select",label:"Display mode",default:"basic",options:[{label:"Basic — funnel summary + top follow-up + AI script",value:"basic"},{label:"Pro — full prospect list with Kanban + AI panel",value:"pro"}],group:"Display"}],events:{emits:[{name:"rp:prospectAdded",description:"User added a new prospect"},{name:"rp:stageChanged",description:"User moved a prospect to a new stage"},{name:"rp:followUpCopied",description:"User copied the AI follow-up message"}],listens:[{name:"rp:refresh",description:"Force refresh recruitment pipeline data"}]}},o={contacted:"recruitment.stage.contacted",interested:"recruitment.stage.interested",pending:"recruitment.stage.pending",active:"recruitment.stage.active"},p={contacted:"es-rp__stage--contacted",interested:"es-rp__stage--interested",pending:"es-rp__stage--pending",active:"es-rp__stage--active"};function D({data:n,config:y,actions:f,metadata:w,i18n:b}){const s=b?.t??(t=>t),v=y.mode??n.mode??"basic",i=n.stageCounts??{contacted:0,interested:0,pending:0,active:0},a=n.topFollowUpToday,c=n.topFollowUpMessage,l=n.prospects??[],[_,u]=h.useState("idle"),[r,g]=h.useState(null);if(i.contacted+i.interested+i.pending+i.active===0&&!a&&!n.error)return e.jsx(m,{blockType:"recruitment-pipeline",children:e.jsxs("div",{className:"es-block__body es-rp__body",children:[e.jsx("div",{className:"es-rp__funnel",role:"list","aria-label":s("recruitment.pipeline_stages_aria"),children:["contacted","interested","pending","active"].map(t=>e.jsxs("div",{role:"listitem",className:`es-rp__funnel-stage ${p[t]??""} es-rp__stage--empty`,children:[e.jsx("span",{className:"es-rp__funnel-count",children:"0"}),e.jsx("span",{className:"es-rp__funnel-label",children:s(o[t])})]},t))}),e.jsx("p",{style:{fontSize:13,color:"var(--es-color-on-surface-muted, #4B5563)",margin:"8px 0 0",textAlign:"center"},children:w?.dataQuality==="none"?s("recruitment.signin_prompt"):s("recruitment.empty_pipeline")})]})});if(n.error)return e.jsx(m,{blockType:"recruitment-pipeline",error:j(n.error)});async function x(){const t=c??"";if(t)try{await navigator.clipboard.writeText(t),u("copied"),f.emit("rp:followUpCopied",{prospectId:a?.id}),setTimeout(()=>u("idle"),2e3)}catch{}}const d=r?l.filter(t=>t.stage===r):l;return e.jsx(m,{blockType:"recruitment-pipeline",children:e.jsxs("div",{className:"es-block__body es-rp__body",children:[e.jsx("div",{className:"es-rp__funnel",role:"list","aria-label":s("recruitment.pipeline_stages_aria"),children:["contacted","interested","pending","active"].map(t=>e.jsxs("button",{role:"listitem",className:`es-rp__funnel-stage ${p[t]??""} ${r===t?"es-rp__funnel-stage--active":""}`,onClick:()=>g(r===t?null:t),"aria-pressed":r===t,"aria-label":s("recruitment.stage_count_aria",{stage:s(o[t]),count:i[t]}),children:[e.jsx("span",{className:"es-rp__funnel-count",children:i[t]}),e.jsx("span",{className:"es-rp__funnel-label",children:s(o[t])})]},t))}),a&&e.jsxs("div",{className:"es-rp__followup-card",children:[e.jsxs("div",{className:"es-rp__followup-eyebrow",children:["📅 ",s("recruitment.follow_up_today")]}),e.jsx("div",{className:"es-rp__followup-name",children:a.name}),e.jsxs("div",{className:"es-rp__followup-meta",children:[e.jsx("span",{className:`es-rp__badge ${p[a.stage]??""}`,children:s(o[a.stage])}),a.lastContactDate&&e.jsx("span",{className:"es-rp__followup-date",children:s("recruitment.last_contact",{date:a.lastContactDate})})]}),a.notes&&e.jsx("div",{className:"es-rp__followup-notes",children:a.notes}),c&&e.jsxs("div",{className:"es-rp__followup-message",children:[e.jsxs("div",{className:"es-rp__followup-message-header",children:[e.jsxs("span",{className:"es-rp__ai-label",children:["✨ ",s("recruitment.ai_followup_script")]}),e.jsx("button",{className:`es-rp__copy-btn${_==="copied"?" es-rp__copy-btn--copied":""}`,onClick:x,"aria-label":s("recruitment.copy_followup_aria"),title:s("common.copy_to_clipboard"),children:_==="copied"?"✓":"⎘"})]}),e.jsx("p",{className:"es-rp__followup-message-text",children:c})]})]}),v==="pro"&&e.jsxs("div",{className:"es-rp__prospect-list",children:[e.jsxs("div",{className:"es-rp__prospect-list-header",children:[e.jsx("span",{className:"es-rp__section-title",children:r?s("recruitment.stage_filtered",{stage:s(o[r]),count:d.length}):s("recruitment.all_prospects",{count:l.length})}),r&&e.jsx("button",{className:"es-rp__clear-filter",onClick:()=>g(null),children:s("recruitment.clear_filter")})]}),d.length===0?e.jsx("p",{className:"es-rp__empty",children:s("recruitment.empty_stage")}):e.jsx("ul",{className:"es-rp__prospects","aria-label":s("recruitment.prospects_list_aria"),children:d.map(t=>e.jsxs("li",{className:"es-rp__prospect-item",children:[e.jsxs("div",{className:"es-rp__prospect-header",children:[e.jsx("span",{className:"es-rp__prospect-name",children:t.name}),e.jsx("span",{className:`es-rp__badge ${p[t.stage]??""}`,children:s(o[t.stage])})]}),t.contactInfo&&e.jsx("span",{className:"es-rp__prospect-contact",children:t.contactInfo}),t.notes&&e.jsx("p",{className:"es-rp__prospect-notes",children:t.notes}),t.lastContactDate&&e.jsx("span",{className:"es-rp__prospect-date",children:s("recruitment.last_contact",{date:t.lastContactDate})})]},t.id))})]})]})})}export{D as Component,C as manifest};
2
+ //# sourceMappingURL=index-DPNGQF5b-_M0CWPEY.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,Q as u}from"../nexly.js";const y={slug:"demo-shipping-returns",name:"DEMO — Contact details",version:"0.1.0",category:"content",configSchema:{properties:{rows:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"string"},note:{type:"string"}},required:["label","value"]},default:[]}}},defaultConfig:{rows:[]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function _(t){return Array.isArray(t)?t.flatMap(s=>{if(typeof s!="object"||s===null)return[];const n=s,d=typeof n.label=="string"?n.label.trim():"",a=typeof n.value=="string"?n.value.trim():"";if(!d||!a)return[];const c=typeof n.note=="string"?n.note.trim():"";return[{label:d,value:a,...c?{note:c}:{}}]}):[]}function i(t){if(typeof t!="string")return null;const s=t.trim();return s.length>0?s:null}function x(t){const s=i(t);if(!s||/\s/.test(s))return null;const n=s.indexOf("@");return n>0&&n<s.length-1?s:null}function j(t){const s=i(t);return!s||!/[0-9]/.test(s)?null:s}function f(t){return t.split(/\s+/).filter(s=>/[\p{L}\p{N}]/u.test(s)).slice(0,2).map(s=>s[0].toUpperCase()).join("")}function v({data:t,config:s,i18n:n}){const d=n?.t??(o=>o),a=t?.rows?t:s??{},c=_(a.rows),m=i(a.company),p=i(a.tagline),r=x(a.email),l=j(a.phone),h=i(a.note);return!m&&!r&&!l&&c.length===0?e.jsx(u,{blockType:"demo-shipping-returns",children:e.jsx("div",{className:"es-block__body",children:e.jsx("div",{className:"es-block__empty",children:d("demoTerms.empty")})})}):e.jsx(u,{blockType:"demo-shipping-returns",children:e.jsxs("div",{className:"es-block__body es-democontact",children:[e.jsxs("div",{className:"es-democontact__card",children:[m&&e.jsxs("div",{className:"es-democontact__identity",children:[e.jsx("div",{className:"es-democontact__coin","aria-hidden":"true",children:f(m)}),e.jsxs("div",{className:"es-democontact__names",children:[e.jsx("p",{className:"es-democontact__company",children:m}),p&&e.jsx("p",{className:"es-democontact__tagline",children:p})]})]}),c.length>0&&e.jsx("dl",{className:"es-democontact__grid",children:c.map(o=>e.jsxs("div",{className:"es-democontact__cell",children:[e.jsx("dt",{className:"es-democontact__label",children:o.label}),e.jsx("dd",{className:"es-democontact__value",children:o.value}),o.note&&e.jsx("dd",{className:"es-democontact__note",children:o.note})]},o.label))}),(r||l)&&e.jsxs("div",{className:"es-democontact__actions",children:[r&&e.jsxs("a",{className:"es-democontact__action",href:`mailto:${r}`,children:[e.jsxs("svg",{className:"es-democontact__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"2.5",y:"4.5",width:"19",height:"15",rx:"2.5"}),e.jsx("path",{d:"M3 7l9 6 9-6"})]}),e.jsx("span",{className:"es-democontact__action-text",children:r})]}),l&&e.jsxs("a",{className:"es-democontact__action",href:`tel:${l.replace(/\s+/g,"")}`,children:[e.jsx("svg",{className:"es-democontact__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M6.5 3.5h3l1.5 4-2 1.5a11 11 0 006 6l1.5-2 4 1.5v3a2 2 0 01-2.2 2A17 17 0 014.5 5.7 2 2 0 016.5 3.5z"})}),e.jsx("span",{className:"es-democontact__action-text",children:l})]})]})]}),h&&e.jsxs("div",{className:"es-democontact__reassurance",children:[e.jsxs("svg",{className:"es-democontact__glyph",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 3l7.5 3v5.5c0 4.6-3.1 8.4-7.5 9.5-4.4-1.1-7.5-4.9-7.5-9.5V6z"}),e.jsx("path",{d:"M9 12.2l2.2 2.2 4-4.2"})]}),e.jsx("p",{className:"es-democontact__reassurance-text",children:h})]})]})})}export{v as Component,y as manifest};
2
+ //# sourceMappingURL=index-DP_6HfDM-DAdxCQyi.js.map
@@ -0,0 +1,2 @@
1
+ import{r as S,j as e,Q as _,o as C}from"../nexly.js";const D={slug:"new-member-onboarding-tracker",name:"New Member Onboarding Tracker",version:"1.0.0",category:"interactive",requiredService:"new-member-onboarding-tracker",configSchema:{properties:{mode:{type:"string",default:"basic"},showStreak:{type:"boolean",default:!0}}},defaultConfig:{mode:"basic",showStreak:!0},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"new-member-onboarding-tracker",inputSchema:{type:"object",properties:{steps:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},completed:{type:"boolean"},timeEstimate:{type:"string"}}}},completedCount:{type:"number"},totalCount:{type:"number"},daysSinceJoin:{type:"number"},aiMessage:{type:"string"},streak:{type:"number"},mode:{type:"string",enum:["basic","pro"]}}},previewDataOverride:{mode:"pro",daysSinceJoin:2,completedCount:2,totalCount:6,streak:3,aiMessage:"Great progress! Setting up your profile is key — it helps your upline and new contacts understand your focus area. Takes about 5 minutes.",steps:[{id:"1",label:"Watch welcome video",completed:!0,timeEstimate:"5 min"},{id:"2",label:"Complete your profile",completed:!0,timeEstimate:"10 min"},{id:"3",label:"Join the team chat group",completed:!1,timeEstimate:"2 min"},{id:"4",label:"Schedule your first 1-on-1 with upline",completed:!1,timeEstimate:"5 min"},{id:"5",label:"Place your first personal purchase",completed:!1,timeEstimate:"15 min"},{id:"6",label:"Share your first product post",completed:!1,timeEstimate:"10 min"}]}},fields:[{id:"mode",type:"select",label:"Display mode",default:"basic",options:[{label:"Basic — checklist + next action",value:"basic"},{label:"Pro — guided steps with AI coaching",value:"pro"}],group:"Display"},{id:"showStreak",type:"toggle",label:"Show streak counter (pro mode)",default:!0,group:"Display"}],events:{emits:[{name:"nmot:stepFocused",description:"User focused a step in pro mode"},{name:"nmot:stepCompleted",description:"User marked a step as done"}],listens:[{name:"nmot:refresh",description:"Force refresh onboarding step data"}]}};function J({data:t,config:b,actions:d,metadata:u,i18n:f}){const a=f?.t??(s=>s),o=b.mode??t.mode??"basic",v=b.showStreak??!0,n=t.steps??[],m=t.completedCount??n.filter(s=>s.completed).length,i=t.totalCount??n.length,g=t.daysSinceJoin??0,h=t.aiMessage,x=t.streak??0,[y,j]=S.useState(()=>n.find(s=>!s.completed)?.id??null);if(n.length===0&&!t.error)return e.jsx(_,{blockType:"new-member-onboarding-tracker",children:e.jsxs("div",{className:"es-block__body es-nmot__body",children:[e.jsx("div",{className:"es-nmot__header",children:e.jsx("div",{className:"es-nmot__day-badge",children:a("onboarding.day_badge",{n:1})})}),e.jsxs("div",{className:"es-nmot__progress-wrap",children:[e.jsxs("div",{className:"es-nmot__progress-label",children:[e.jsx("span",{children:u?.dataQuality==="none"?a("onboarding.signin_prompt"):a("onboarding.getting_started")}),e.jsx("span",{children:"0/0"})]}),e.jsx("div",{className:"es-nmot__progress-bar",role:"progressbar","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:"es-nmot__progress-fill",style:{width:"0%"}})})]}),e.jsx("p",{style:{fontSize:13,color:"var(--es-color-on-surface-muted, #4B5563)",margin:"8px 0 0"},children:u?.dataQuality==="none"?a("onboarding.signin_steps_hint"):a("onboarding.empty")})]})});if(t.error)return e.jsx(_,{blockType:"new-member-onboarding-tracker",error:C(t.error)});const c=i>0?Math.round(m/i*100):0,l=m>=i;n.find(s=>s.id===y);function N(s){o==="pro"&&(j(s.id),d.emit("nmot:stepFocused",{stepId:s.id}))}function k(s){d.call("completeStep",{stepId:s}).catch(()=>{}),d.emit("nmot:stepCompleted",{stepId:s});const p=n.find(r=>!r.completed&&r.id!==s);j(p?.id??null)}return e.jsx(_,{blockType:"new-member-onboarding-tracker",children:e.jsxs("div",{className:"es-block__body es-nmot__body",children:[e.jsxs("div",{className:"es-nmot__header",children:[e.jsx("div",{className:"es-nmot__day-badge",children:a("onboarding.day_badge",{n:g+1})}),o==="pro"&&v&&x>0&&e.jsxs("div",{className:"es-nmot__streak",children:[e.jsx("span",{className:"es-nmot__streak-icon","aria-hidden":"true",children:"🔥"}),e.jsx("span",{className:"es-nmot__streak-count",children:x}),e.jsx("span",{className:"es-nmot__streak-label",children:a("onboarding.day_streak")})]})]}),e.jsxs("div",{className:"es-nmot__progress-wrap",children:[e.jsxs("div",{className:"es-nmot__progress-label",children:[e.jsx("span",{children:a(l?"onboarding.complete":"onboarding.getting_started")}),e.jsxs("span",{children:[m,"/",i]})]}),e.jsx("div",{className:"es-nmot__progress-bar",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a("onboarding.progress_aria",{percent:c}),children:e.jsx("div",{className:`es-nmot__progress-fill${l?" es-nmot__progress-fill--done":""}`,style:{width:`${c}%`}})})]}),e.jsx("ul",{className:"es-nmot__steps",role:"list",children:n.map((s,p)=>{const r=o==="pro"&&s.id===y,w=["es-nmot__step",s.completed?"es-nmot__step--done":"",r?"es-nmot__step--active":""].filter(Boolean).join(" ");return e.jsxs("li",{className:w,children:[e.jsxs("button",{className:"es-nmot__step-row",onClick:()=>N(s),"aria-current":r?"step":void 0,disabled:o==="basic",children:[e.jsx("span",{className:"es-nmot__step-check","aria-hidden":"true",children:s.completed?"✓":e.jsx("span",{className:"es-nmot__step-num",children:p+1})}),e.jsx("span",{className:"es-nmot__step-label",children:s.label}),s.timeEstimate&&e.jsx("span",{className:"es-nmot__step-time",children:s.timeEstimate})]}),o==="pro"&&r&&!s.completed&&e.jsxs("div",{className:"es-nmot__step-detail",children:[h&&e.jsxs("div",{className:"es-nmot__ai-message",children:[e.jsx("span",{className:"es-nmot__ai-label",children:a("onboarding.ai_coach_label")}),e.jsx("p",{className:"es-nmot__ai-text",children:h})]}),e.jsx("button",{className:"es-nmot__complete-btn",onClick:()=>k(s.id),children:a("onboarding.mark_done")})]})]},s.id)})}),o==="basic"&&!l&&e.jsxs("div",{className:"es-nmot__next-prompt",children:[e.jsx("span",{className:"es-nmot__next-label",children:a("onboarding.next_up")}),e.jsx("span",{className:"es-nmot__next-text",children:n.find(s=>!s.completed)?.label??a("onboarding.all_steps_complete")})]}),l&&e.jsxs("div",{className:"es-nmot__done-banner",children:[e.jsx("span",{className:"es-nmot__done-icon","aria-hidden":"true",children:"🎉"}),e.jsx("span",{children:a("onboarding.done_banner",{n:g+1})})]})]})})}export{J as Component,D as manifest};
2
+ //# sourceMappingURL=index-DTVlG27U-DP0QKkgf.js.map
@@ -0,0 +1,2 @@
1
+ import{j as l}from"../nexly.js";const d={slug:"block-labels-preview",name:"Block Labels Preview",version:"1.0.0",category:"layout",configSchema:{properties:{showIcons:{type:"boolean",default:!0},labelPrefix:{type:"string",default:""}}},defaultConfig:{showIcons:!0,labelPrefix:""},sizing:{minWidth:200,preferredHeight:"auto",scrollable:!1},dataContract:{serviceSlug:null,inputSchema:{type:"object",properties:{activeBlocks:{type:"array",items:{type:"object",properties:{slug:{type:"string"},label:{type:"string"},slot:{type:"string"}}}}}},previewDataOverride:{activeBlocks:[{slug:"chat",label:"AI Chat",slot:"main"},{slug:"knowledge-search",label:"Knowledge Search",slot:"main"},{slug:"market-sentiment",label:"Market Sentiment",slot:"header"}]}},fields:[{id:"showIcons",type:"toggle",label:"Show block icons",default:!0,group:"Display"},{id:"labelPrefix",type:"text",label:"Label prefix",default:"",group:"Display"}],events:{emits:[{name:"labels:blockSelected",description:"User clicked a block label"}],listens:[]},supportedPlacements:["sidebar","header"]};function u({data:a,config:s,actions:o,i18n:i}){const r=i?.t??(e=>e),t=a.activeBlocks??[],c=s.showIcons!==!1,n=s.labelPrefix??"",b=e=>{o.emit("labels:blockSelected",{slug:e.slug,slot:e.slot})};return t.length===0?l.jsx("div",{className:"es-block es-block-labels-preview",children:l.jsx("div",{className:"es-block-labels-preview__empty",children:r("blocks.empty")})}):l.jsx("div",{className:"es-block es-block-labels-preview",children:t.map(e=>l.jsxs("button",{className:"es-block-labels-preview__label",onClick:()=>b(e),type:"button",children:[c&&l.jsx("span",{className:"es-block-labels-preview__icon",children:"⬡"}),l.jsxs("span",{children:[n,e.label]}),l.jsx("span",{className:"es-block-labels-preview__slot",children:e.slot})]},`${e.slug}-${e.slot}`))})}export{u as Component,d as manifest};
2
+ //# sourceMappingURL=index-DZADUAKv-DPfvWVuj.js.map
@@ -0,0 +1,2 @@
1
+ import{r as p,j as e,Q as N}from"../nexly.js";import{S as k,I,L as M,$ as T,j as L,_ as E,k as z,m as D}from"./index.modern-CioVZ357-BA5NTOmY.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";const R={slug:"event-map",name:"Event Map",version:"1.0.0",category:"interactive",requiredService:"event-scraper",configSchema:{properties:{zoom:{type:"number",default:12},showFilters:{type:"boolean",default:!0}}},defaultConfig:{zoom:12,showFilters:!0},dataContract:{serviceSlug:"event-scraper",inputSchema:{type:"object",properties:{events:{type:"array",items:{type:"object",properties:{id:{type:"string"},title:{type:"string"},date:{type:"string"},lat:{type:"number"},lng:{type:"number"},isFree:{type:"boolean"}}}},centerLat:{type:"number"},centerLng:{type:"number"}},required:["events"]},previewDataOverride:{events:[{id:"evt-1",title:"Tech Startup Networking Night",date:"2026-04-10T18:00:00Z",lat:37.4979,lng:127.0276,isFree:!0},{id:"evt-2",title:"AI & Machine Learning Summit",date:"2026-04-15T09:00:00Z",lat:37.5563,lng:126.9177,isFree:!1},{id:"evt-3",title:"Web3 Developer Workshop",date:"2026-04-20T14:00:00Z",lat:37.5145,lng:127.1059,isFree:!0}],centerLat:37.5665,centerLng:126.978}},fields:[{id:"zoom",type:"range",label:"Default zoom level",default:12,min:8,max:18,step:1,group:"Map"},{id:"showFilters",type:"toggle",label:"Show filter controls",default:!0,group:"Display"}],events:{emits:[{name:"eventMap:markerClicked",description:"User clicked on an event map marker"},{name:"eventMap:viewChanged",description:"Map viewport moved or zoomed"}],listens:[{name:"events:refresh",description:"Reload events and re-render markers"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function A(s,n){const d=new Date(s);return Number.isNaN(d.getTime())?s:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(d)}function W({events:s,selectedId:n,onSelect:d,useAdvanced:v,onPrimaryInk:r,onSuccessInk:g}){const c=T();return p.useEffect(()=>{if(!c||!n)return;const t=s.find(o=>o.id===n);t&&c.panTo({lat:t.lat,lng:t.lng})},[c,n,s]),v?e.jsx(e.Fragment,{children:s.map((t,o)=>{const u=t.id!=null&&t.id===n;return e.jsx(L,{position:{lat:t.lat,lng:t.lng},title:t.title,onClick:()=>d(t.id??null),children:e.jsx(E,{background:u?"var(--es-color-interactive, #2563EB)":t.isFree?"var(--es-color-success, #00672B)":"var(--es-color-primary, #2563EB)",borderColor:z,glyphColor:!u&&t.isFree?g:r,scale:u?1.25:1})},t.id??o)})}):e.jsx(e.Fragment,{children:s.map((t,o)=>e.jsx(D,{position:{lat:t.lat,lng:t.lng},title:t.title,onClick:()=>d(t.id??null)},t.id??o))})}const Z={id:"__builder_placeholder__",title:"Sample event location",lat:37.5665,lng:126.978};function q({data:s,actions:n,i18n:d,builderMode:v}){const r=d?.t??(a=>a),g=d?.currentLanguage??s.language??"en",[c,t]=p.useState(null),o=p.useRef(null),u=k(o,"--es-color-on-primary","#ffffff"),S=k(o,"--es-color-on-success","#ffffff"),b=s.events??[],j=s.googleMapsApiKey,y=s.googleMapsMapId??void 0,C=!!y,m=b.length,i=p.useMemo(()=>b.filter(a=>typeof a.lat=="number"&&typeof a.lng=="number"),[b]),l=c!=null?i.find(a=>a.id===c)??null:null,x=p.useCallback(a=>{if(t(a),a){const f=i.find(h=>h.id===a);f&&n.emit("events:eventSelected",{id:a,event:f}),n.emit("events:markerHighlight",{id:a})}else n.emit("events:markerHighlight",{id:null})},[n,i]);if(p.useEffect(()=>{const a=n.on("events:hover",f=>{const h=f?.id??null;h!=null&&i.some(w=>w.id===h)&&t(h)});return()=>a()},[n,i]),!j)return e.jsx(N,{blockType:"event-map",children:e.jsx("div",{className:"es-block__body",children:e.jsxs("div",{className:"es-map-placeholder",children:[e.jsx("div",{className:"es-map-placeholder__icon","aria-hidden":"true",children:"🗺"}),e.jsx("div",{className:"es-map-placeholder__message",children:r("event_map.no_key_message")}),m>0&&e.jsx("div",{className:"es-map-placeholder__count",children:r("event_map.events_available",{count:m})}),e.jsx("div",{className:"es-map-placeholder__hint",children:r("event_map.use_event_list_hint")})]})})});const _=v&&i.length===0?[Z]:i,F=_.length>0?{lat:_[0].lat,lng:_[0].lng}:{lat:37.5665,lng:126.978};return e.jsx(N,{blockType:"event-map",children:e.jsxs("div",{className:"es-block__body es-block__body--map",ref:o,children:[e.jsx(I,{apiKey:j,language:g,children:e.jsx(M,{className:"es-eventmap__canvas",defaultCenter:F,defaultZoom:_.length>0?12:10,mapTypeControl:!1,fullscreenControl:!1,streetViewControl:!1,...y?{mapId:y}:{},children:e.jsx(W,{events:_,selectedId:c,onSelect:x,useAdvanced:C,onPrimaryInk:u,onSuccessInk:S})})}),!v&&m>0&&i.length===0&&e.jsxs("div",{className:"es-eventmap__no-coords-overlay",role:"note",children:[e.jsx("div",{className:"es-eventmap__no-coords-overlay__icon","aria-hidden":"true",children:"📍"}),e.jsx("div",{className:"es-eventmap__no-coords-overlay__message",children:r("event_map.no_coords_notice")}),e.jsx("div",{className:"es-eventmap__no-coords-overlay__count",children:r("event_map.events_no_coords",{count:m})})]}),!v&&i.length>0&&m>i.length&&e.jsxs("div",{className:"es-eventmap__no-coords-badge",role:"note",children:[e.jsx("span",{className:"es-eventmap__no-coords-badge__icon","aria-hidden":"true",children:"📍"}),e.jsx("span",{className:"es-eventmap__no-coords-badge__text",children:r("event_map.partial_no_coords_badge",{count:m-i.length})})]}),l&&e.jsxs("div",{className:"es-eventmap__detail",role:"dialog","aria-label":l.title,children:[e.jsx("button",{type:"button",className:"es-eventmap__detail-close",onClick:()=>x(null),"aria-label":r("event_map.close_details"),children:"×"}),e.jsxs("div",{className:"es-eventmap__detail-header",children:[e.jsx("h3",{className:"es-eventmap__detail-title",children:l.title}),l.isFree&&e.jsx("span",{className:"es-eventmap__detail-badge",children:r("event_list.free")})]}),e.jsxs("div",{className:"es-eventmap__detail-meta",children:[l.date&&e.jsxs("span",{className:"es-eventmap__detail-meta-item",children:[e.jsx("span",{"aria-hidden":"true",children:"🗓"}),A(l.date,g)]}),(l.address||l.location)&&e.jsxs("span",{className:"es-eventmap__detail-meta-item",children:[e.jsx("span",{"aria-hidden":"true",children:"📍"}),l.address||l.location]})]}),l.url&&e.jsxs("a",{href:l.url,className:"es-eventmap__detail-cta",target:"_blank",rel:"noopener noreferrer",children:[r("event_list.view_details")," →"]})]})]})})}export{q as Component,R as manifest};
2
+ //# sourceMappingURL=index-DZKtK9hT-DQBGsPwB.js.map
@@ -0,0 +1,2 @@
1
+ import{a as w,r as t,j as e,Q as k}from"../nexly.js";const S={slug:"qa",name:"AI Q&A",version:"1.0.0",category:"interactive",requiredService:"ai-orchestrator",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},placeholder:{type:"string",default:""},maxQuestionsPerSession:{type:"number",default:5},responseLanguage:{type:"string",default:"en"}}},defaultConfig:{readAloudEnabled:!1,placeholder:"",maxQuestionsPerSession:5,responseLanguage:"en"},dataContract:{serviceSlug:"ai-orchestrator",inputSchema:{type:"object",properties:{answer:{type:"string",description:"AI answer to the user question"},question:{type:"string",description:"The question that was asked"}},required:["answer"]},previewDataOverride:{answer:"This product is made from 100% organic cotton and is machine washable. It comes in sizes XS-XXL.",question:"What materials is this made from?"}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"placeholder",type:"localized-text",label:"Input placeholder",default:"",placeholder:'Leave empty to use translated default (e.g. "Ask a question about this product...")',group:"Content"},{id:"maxQuestionsPerSession",type:"range",label:"Max questions per session",default:5,min:1,max:20,step:1,group:"Behavior"},{id:"responseLanguage",type:"select",label:"Response language",default:"en",options:[{label:"English",value:"en"},{label:"Korean",value:"ko"},{label:"Spanish",value:"es"},{label:"French",value:"fr"},{label:"German",value:"de"}],group:"Behavior"}],events:{emits:[{name:"qa:questionAsked",description:"User submitted a question"},{name:"qa:answerReceived",description:"AI answer received"}],listens:[{name:"qa:clear",description:"Clear Q&A history"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"]};function A({config:u,actions:h,i18n:m}){const s=m?.t??(a=>a),f=m?.currentLanguage??"en",x=w(u.placeholder,f,{t:s,fallbackKey:"qa.input_placeholder",enDefault:"Ask a question about this product..."}),i=u.maxQuestionsPerSession??5,[d,_]=t.useState(""),[o,v]=t.useState([]),[n,g]=t.useState(!1),[q,c]=t.useState(null),b=t.useRef(null),r=o.length>=i,p=t.useCallback(async()=>{const a=d.trim();if(!(!a||n||r)){g(!0),c(null);try{const l=await h.call("ask",{question:a,language:u.responseLanguage??"en"});l?.error?c(l.error):l?.answer?(v(j=>[...j,{question:a,answer:l.answer}]),_(""),setTimeout(()=>{b.current?.scrollIntoView({behavior:"smooth"})},50)):c(s("qa.error_no_answer"))}catch{c(s("qa.error_generic"))}finally{g(!1)}}},[d,n,r,h,u.responseLanguage]),y=t.useCallback(a=>{a.key==="Enter"&&(a.preventDefault(),p())},[p]);return e.jsxs(k,{blockType:"qa",children:[e.jsxs("div",{className:"es-block__body",children:[o.length===0&&!n&&e.jsx("div",{className:"es-block__empty es-qa__empty",children:s("qa.empty_state")}),o.length>0&&e.jsxs("div",{className:"es-qa__history",children:[o.map((a,l)=>e.jsxs("div",{className:"es-qa__entry",children:[e.jsxs("div",{className:"es-qa__question",children:[e.jsx("span",{className:"es-qa__question-label","aria-hidden":"true",children:"Q"}),e.jsx("span",{className:"es-qa__question-text",children:a.question})]}),e.jsxs("div",{className:"es-qa__answer",children:[e.jsx("span",{className:"es-qa__answer-label","aria-hidden":"true",children:"A"}),e.jsx("span",{className:"es-qa__answer-text",children:a.answer})]})]},l)),e.jsx("div",{ref:b})]}),q&&e.jsx("div",{className:"es-qa__error",role:"alert",children:q}),r&&e.jsx("div",{className:"es-qa__limit-notice",children:s("qa.limit_reached",{count:i})})]}),e.jsxs("div",{className:"es-block__footer",children:[e.jsxs("div",{className:"es-qa__input-row",children:[e.jsx("input",{className:"es-qa__input",type:"text",value:d,onChange:a=>_(a.target.value),onKeyDown:y,placeholder:r?s("qa.limit_reached",{count:i}):x,disabled:n||r,"aria-label":s("qa.input_aria_label")}),e.jsx("button",{className:"es-qa__btn",onClick:p,disabled:!d.trim()||n||r,type:"button","aria-label":s("qa.submit_aria_label"),children:s(n?"qa.loading":"qa.ask_button")})]}),i>0&&e.jsx("div",{className:"es-qa__counter",children:s("qa.counter",{used:o.length,max:i})})]})]})}export{A as Component,S as manifest};
2
+ //# sourceMappingURL=index-Dh0aThiP-Aqz1AnQ5.js.map
@@ -0,0 +1,2 @@
1
+ import{r as d,j as e,Q as n}from"../nexly.js";const M={slug:"presentation-trainer",name:"Presentation Training",version:"1.0.0",category:"interactive",requiredService:"presentation-training",configSchema:{properties:{timeWarningPercent:{type:"number",default:20},showHints:{type:"boolean",default:!0}}},defaultConfig:{timeWarningPercent:20,showHints:!0},dataContract:{serviceSlug:"presentation-training",inputSchema:{type:"object",properties:{scenarios:{type:"array",description:"Live scenarios in the learner’s language, in author order"},remainingToday:{type:"number",description:"Sessions the learner may still start today"},dailyLimit:{type:"number",description:"Configured sessions per user per day"},productBudgetSpent:{type:"boolean",description:"True when the product’s monthly audio budget is exhausted"}}}},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main"]},T={state:"idle",errorKey:null,turns:[],elapsedSec:0,maxSessionSec:0,hint:null,report:null,gradeErrorKey:null};function f(p){return p.trim().split(/\s+/).filter(Boolean).slice(0,2).map(o=>o[0]?.toUpperCase()??"").join("")||"—"}function $(p){const o=Math.floor(p/60),x=p%60;return`${o}:${String(x).padStart(2,"0")}`}function E({data:p,config:o,actions:x,i18n:N}){const t=N?.t??(s=>s),r=x?.externalContext?.trainer,m=p??{},g=d.useMemo(()=>m.scenarios??[],[m.scenarios]),h=m.remainingToday??0,y=m.dailyLimit??0,[u,_]=d.useState(null),[k,l]=d.useState(!1),[a,S]=d.useState(r?.get()??T);d.useEffect(()=>r?.subscribe(S),[r]),d.useEffect(()=>()=>r?.stop(),[r]);const i=g.find(s=>s.id===u)??null,b=a.state==="connecting"||a.state==="speaking"||a.state==="listening",C=Math.max(30,Math.min(60,Math.round(a.maxSessionSec*(o.timeWarningPercent??20)/100))),w=Math.max(0,a.maxSessionSec-a.elapsedSec),v=b&&a.maxSessionSec>0&&w<=C,j=d.useCallback(()=>{u&&r?.start(u)},[u,r]);if(m.productBudgetSpent)return e.jsx(n,{blockType:"presentation-trainer",children:e.jsx("div",{className:"es-pt","data-testid":"pt-budget-spent",children:e.jsx("p",{className:"es-pt__notice es-pt__notice--warn",children:t("training.product_budget_spent")})})});if(g.length===0)return e.jsx(n,{blockType:"presentation-trainer",children:e.jsx("div",{className:"es-pt","data-testid":"pt-empty",children:e.jsx("p",{className:"es-pt__empty",children:t("training.no_scenarios")})})});if(i&&(a.state==="grading"||a.report||a.gradeErrorKey)){if(a.state==="grading")return e.jsx(n,{blockType:"presentation-trainer",children:e.jsx("div",{className:"es-pt","data-testid":"pt-grading",children:e.jsx("p",{className:"es-pt__muted",children:t("training.grading")})})});if(!a.report)return e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-grade-failed",children:[e.jsx("p",{className:"es-pt__notice es-pt__notice--warn",children:t(`training.grade_${a.gradeErrorKey??"grader_failed"}`)}),e.jsx("button",{type:"button",className:"es-pt__cta es-pt__cta--ghost",onClick:()=>{l(!1),_(null)},children:t("training.back_to_list")})]})});const s=a.report;return e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-report",children:[e.jsxs("div",{className:"es-pt__score",children:[e.jsxs("span",{className:`es-pt__score-value${s.passed?"":" es-pt__score-value--fail"}`,"data-testid":"pt-score",children:[s.totalScore,"%"]}),e.jsx("span",{className:"es-pt__muted",children:s.passed?t("training.passed",{threshold:s.passThreshold}):t("training.not_passed",{threshold:s.passThreshold})})]}),s.feedback&&e.jsxs("div",{className:"es-pt__feedback","data-testid":"pt-feedback",children:[e.jsx("span",{className:"es-pt__turn-who",children:t("training.to_improve")}),s.feedback.headline,s.feedback.quote&&e.jsx("q",{className:"es-pt__quote",children:s.feedback.quote})]}),e.jsx("div",{className:"es-pt__criteria",children:s.criteria.map(c=>e.jsxs("div",{className:"es-pt__criterion",children:[e.jsxs("div",{className:"es-pt__criterion-row",children:[e.jsx("span",{className:"es-pt__criterion-label",children:c.label}),e.jsxs("span",{className:"es-pt__criterion-score",children:[c.score,"/4"]})]}),e.jsx("p",{className:"es-pt__muted",children:c.rationale}),c.quote&&e.jsx("q",{className:"es-pt__quote",children:c.quote})]},c.key))}),s.delivery&&e.jsxs("div",{className:"es-pt__delivery","data-testid":"pt-delivery",children:[e.jsx("span",{className:"es-pt__turn-who",children:t("training.how_you_spoke")}),e.jsxs("div",{className:"es-pt__delivery-grid",children:[e.jsxs("div",{children:[e.jsx("span",{children:t("training.longest_monologue")}),e.jsxs("b",{children:[s.delivery.longestMonologueSec,"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{children:t("training.talk_share")}),e.jsxs("b",{children:[s.delivery.talkSharePercent,"%"]})]}),e.jsxs("div",{children:[e.jsx("span",{children:t("training.response_delay")}),e.jsxs("b",{children:[s.delivery.medianResponseDelaySec,"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{children:t("training.exchanges")}),e.jsx("b",{children:s.delivery.exchanges})]}),e.jsxs("div",{children:[e.jsx("span",{children:t(`training.rate_${s.delivery.rateUnit}`)}),e.jsx("b",{children:s.delivery.rate})]})]})]}),e.jsx("button",{type:"button",className:"es-pt__cta",onClick:j,"data-testid":"pt-retry",children:t("training.try_again")}),e.jsx("button",{type:"button",className:"es-pt__cta es-pt__cta--ghost",onClick:()=>{l(!1),_(null)},children:t("training.back_to_list")})]})})}if(i&&(b||a.state==="ending"||a.state==="error"||a.state==="closed"))return a.state==="error"?e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-error",children:[e.jsx("p",{className:"es-pt__notice es-pt__notice--bad",children:t(`training.error_${a.errorKey??"generic"}`)}),e.jsx("button",{type:"button",className:"es-pt__cta",onClick:j,children:t("training.try_again")}),e.jsx("button",{type:"button",className:"es-pt__cta es-pt__cta--ghost",onClick:()=>{l(!1),_(null)},children:t("training.back_to_list")})]})}):e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-conversation",children:[e.jsxs("div",{className:"es-pt__strip",children:[e.jsx("div",{className:`es-pt__avatar${a.state==="speaking"?" es-pt__avatar--speaking":""}`,"aria-hidden":"true",children:f(i.personaName)}),e.jsxs("div",{className:"es-pt__strip-meta",children:[e.jsx("div",{className:"es-pt__strip-name",children:i.personaName}),e.jsxs("div",{className:"es-pt__strip-state",children:[a.state==="connecting"&&t("training.state_connecting"),a.state==="speaking"&&t("training.state_speaking"),a.state==="listening"&&t("training.state_listening"),a.state==="ending"&&t("training.state_ending"),a.state==="closed"&&t("training.state_closed")]})]})]}),e.jsx("div",{className:"es-pt__transcript","data-testid":"pt-transcript","aria-live":"polite",children:a.turns.length===0?e.jsx("p",{className:"es-pt__muted",children:t("training.transcript_empty")}):a.turns.map((s,c)=>e.jsxs("div",{className:`es-pt__turn es-pt__turn--${s.role}${s.final?"":" es-pt__turn--live"}`,children:[e.jsx("span",{className:"es-pt__turn-who",children:s.role==="persona"?i.personaName:t("training.you")}),s.text]},c))}),o.showHints!==!1&&a.hint&&e.jsx("p",{className:"es-pt__hint","data-testid":"pt-hint",children:a.hint}),v&&!a.hint&&e.jsx("p",{className:"es-pt__hint","data-testid":"pt-time-warning",children:t("training.time_almost_up")}),e.jsxs("div",{className:"es-pt__controls",children:[e.jsx("span",{className:`es-pt__timer${v?" es-pt__timer--warn":""}`,"data-testid":"pt-timer",children:$(a.elapsedSec)}),a.state==="closed"?e.jsx("button",{type:"button",className:"es-pt__cta es-pt__cta--ghost",onClick:()=>{l(!1),_(null)},children:t("training.back_to_list")}):e.jsx("button",{type:"button",className:"es-pt__end",onClick:()=>r?.stop(),children:t("training.end_conversation")})]})]})});if(i&&k)return e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-history",children:[e.jsxs("div",{className:"es-pt__strip",children:[e.jsx("button",{type:"button",className:"es-pt__back",onClick:()=>l(!1),"aria-label":t("training.back"),children:"←"}),e.jsxs("div",{className:"es-pt__strip-meta",children:[e.jsx("div",{className:"es-pt__strip-name",children:t("training.your_attempts")}),e.jsx("div",{className:"es-pt__strip-state",children:i.title})]})]}),i.history.length===0?e.jsx("p",{className:"es-pt__muted",children:t("training.no_attempts_yet")}):e.jsx("ul",{className:"es-pt__attempts",children:i.history.map(s=>e.jsxs("li",{className:"es-pt__attempt",children:[e.jsx("span",{className:"es-pt__attempt-date",children:new Intl.DateTimeFormat(N?.currentLanguage??"en",{day:"numeric",month:"short"}).format(new Date(s.at))}),e.jsx("span",{className:"es-pt__attempt-score",children:s.score===null?t("training.not_scored"):`${s.score}%`}),s.status!=="completed"&&e.jsx("span",{className:"es-pt__pill",children:t(`training.status_${s.status}`)})]},s.sessionId))})]})});if(i){const s=h<=0;return e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-brief",children:[e.jsxs("div",{className:"es-pt__strip",children:[e.jsx("button",{type:"button",className:"es-pt__back",onClick:()=>{l(!1),_(null)},"aria-label":t("training.back_to_list"),children:"←"}),e.jsx("div",{className:"es-pt__avatar","aria-hidden":"true",children:f(i.personaName)}),e.jsxs("div",{className:"es-pt__strip-meta",children:[e.jsx("div",{className:"es-pt__strip-name",children:i.personaName}),e.jsx("div",{className:"es-pt__strip-state",children:i.title})]}),e.jsxs("div",{className:"es-pt__strip-right",children:[e.jsx("span",{className:`es-pt__pill es-pt__pill--${i.difficulty}`,children:t(`training.difficulty_${i.difficulty}`)}),e.jsx("span",{className:"es-pt__strip-time",children:t("training.minutes",{count:Math.round(i.maxDurationSec/60)})})]})]}),e.jsx("div",{className:"es-pt__situation",children:i.situation}),e.jsx("p",{className:"es-pt__muted",children:t("training.sessions_left",{count:h,total:y})}),s?e.jsx("p",{className:"es-pt__notice es-pt__notice--warn",children:t("training.daily_limit_reached")}):e.jsx("button",{type:"button",className:"es-pt__cta",onClick:j,"data-testid":"pt-start",children:t("training.start_conversation")}),i.attempts>0&&e.jsx("button",{type:"button",className:"es-pt__cta es-pt__cta--ghost",onClick:()=>l(!0),"data-testid":"pt-history-open",children:t("training.see_attempts",{count:i.attempts})})]})})}return e.jsx(n,{blockType:"presentation-trainer",children:e.jsxs("div",{className:"es-pt","data-testid":"pt-list",children:[e.jsxs("div",{className:"es-pt__quota",children:[e.jsx("span",{children:t("training.sessions_today")}),e.jsx("b",{children:t("training.sessions_left_short",{count:h,total:y})})]}),g.map(s=>e.jsxs("button",{type:"button",className:"es-pt__scenario",onClick:()=>_(s.id),disabled:h<=0,children:[e.jsxs("span",{className:"es-pt__scenario-row",children:[e.jsx("span",{className:"es-pt__scenario-title",children:s.title}),e.jsx("span",{className:`es-pt__pill es-pt__pill--${s.difficulty}`,children:t(`training.difficulty_${s.difficulty}`)})]}),e.jsxs("span",{className:"es-pt__scenario-meta",children:[t("training.minutes",{count:Math.round(s.maxDurationSec/60)}),s.attempts>0&&e.jsxs(e.Fragment,{children:[" · ",t("training.best_score",{score:s.bestScore??0})," · ",t("training.last_score",{score:s.lastScore??0})," · ",t("training.attempts",{count:s.attempts})]}),s.attempts===0&&e.jsxs(e.Fragment,{children:[" · ",t("training.not_attempted")]})]})]},s.id)),h<=0&&e.jsx("p",{className:"es-pt__notice es-pt__notice--warn",children:t("training.daily_limit_reached")})]})})}export{E as Component,M as manifest};
2
+ //# sourceMappingURL=index-Dkv5YXXW-pkywvGDF.js.map
@@ -0,0 +1,2 @@
1
+ import{r as j,j as e,Q as _,o as w}from"../nexly.js";import{m as x}from"./block-helpers-Cg_zAqG6-DnN2COvk.js";const C={slug:"team-health",name:"Team Health Monitor",version:"1.0.0",category:"interactive",requiredService:"team-health",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic",readAloudEnabled:!1},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"team-health",inputSchema:{type:"object",properties:{summary:{type:"object",properties:{healthy:{type:"number"},at_risk:{type:"number"},critical:{type:"number"},total:{type:"number"}}},topAtRiskMember:{type:"object",properties:{userId:{type:"string"},userName:{type:"string"},rank:{type:"string"},healthStatus:{type:"string"},healthScore:{type:"number"},riskSignals:{type:"array",items:{type:"string"}}}},reactivationTip:{type:"string"},members:{type:"array",items:{type:"object",properties:{userId:{type:"string"},userName:{type:"string"},rank:{type:"string"},healthStatus:{type:"string"},healthScore:{type:"number"},riskSignals:{type:"array",items:{type:"string"}},teamSales:{type:"number"},personalPurchase:{type:"number"}}}},mode:{type:"string",enum:["basic","pro"]}}},previewDataOverride:{mode:"pro",summary:{healthy:4,at_risk:3,critical:1,total:8},topAtRiskMember:{userId:"preview-1",userName:"Anna Kowalska",rank:"Manager",healthStatus:"critical",healthScore:25,riskSignals:["No personal purchase","No team sales","No team built"],teamSales:0,personalPurchase:0},reactivationTip:"Check in with Anna personally — ask how she's doing with the products first before talking business. A caring message goes a long way.",members:[{userId:"preview-1",userName:"Anna Kowalska",rank:"Manager",healthStatus:"critical",healthScore:25,riskSignals:["No purchase","No sales"]},{userId:"preview-2",userName:"Piotr Nowak",rank:"Senior Manager",healthStatus:"at_risk",healthScore:55,riskSignals:["No team built"]},{userId:"preview-3",userName:"Maria Wiśniewska",rank:"Manager",healthStatus:"healthy",healthScore:85,riskSignals:[]}]}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"mode",type:"select",label:"Display mode",default:"basic",options:[{label:"Basic — traffic-light summary + top alert + AI tip",value:"basic"},{label:"Pro — full member list with health scores",value:"pro"}],group:"Display"}],events:{emits:[{name:"th:memberSelected",description:"User tapped on a team member"},{name:"th:tipCopied",description:"User copied the reactivation tip"}],listens:[{name:"th:refresh",description:"Force refresh team health data"}]}},i={healthy:"team_health.status.healthy",at_risk:"team_health.status.at_risk",critical:"team_health.status.critical"},c={healthy:"🟢",at_risk:"🟡",critical:"🔴"};function T({data:l,config:N,actions:m,metadata:k,i18n:S}){const t=S?.t??(a=>a),v=N.mode??l.mode??"basic",o=l.summary??{healthy:0,at_risk:0,critical:0,total:0},s=l.topAtRiskMember,n=l.reactivationTip,d=l.members??[],[p,u]=j.useState("idle"),[r,b]=j.useState(null);if(!o.total&&!l.error)return e.jsx(_,{blockType:"team-health",children:e.jsxs("div",{className:"es-block__body es-th__body",children:[e.jsx("div",{className:"es-th__traffic-light",role:"list","aria-label":t("team_health.summary_aria"),children:["critical","at_risk","healthy"].map(a=>e.jsxs("div",{role:"listitem",className:`es-th__tl-cell es-th__tl-cell--${a.replace("_","-")} es-th__tl-cell--empty`,children:[e.jsx("span",{className:"es-th__tl-emoji","aria-hidden":"true",children:c[a]}),e.jsx("span",{className:"es-th__tl-count",children:"0"}),e.jsx("span",{className:"es-th__tl-label",children:t(i[a])})]},a))}),e.jsx("p",{style:{fontSize:13,color:"var(--es-color-on-surface-muted, #4B5563)",margin:"8px 0 0",textAlign:"center"},children:k?.dataQuality==="none"?t("team_health.signin_prompt"):t("team_health.empty")})]})});if(l.error)return e.jsx(_,{blockType:"team-health",error:w(l.error)});async function f(){if(n)try{await navigator.clipboard.writeText(n),u("copied"),m.emit("th:tipCopied",{}),setTimeout(()=>u("idle"),2e3)}catch{}}const y=r?d.filter(a=>a.healthStatus===r):d,g=[...y].sort((a,h)=>a.healthScore-h.healthScore);return e.jsx(_,{blockType:"team-health",children:e.jsxs("div",{className:"es-block__body es-th__body",children:[e.jsx("div",{className:"es-th__traffic-light",role:"list","aria-label":t("team_health.summary_aria"),children:["critical","at_risk","healthy"].map(a=>e.jsxs("button",{role:"listitem",className:`es-th__tl-cell es-th__tl-cell--${a.replace("_","-")} ${r===a?"es-th__tl-cell--active":""}`,onClick:()=>b(r===a?null:a),"aria-pressed":r===a,"aria-label":t("team_health.status_count_aria",{status:t(i[a]),count:o[a]}),children:[e.jsx("span",{className:"es-th__tl-emoji","aria-hidden":"true",children:c[a]}),e.jsx("span",{className:"es-th__tl-count",children:o[a]}),e.jsx("span",{className:"es-th__tl-label",children:t(i[a])})]},a))}),s&&e.jsxs("div",{className:"es-th__alert-card",children:[e.jsxs("div",{className:"es-th__alert-eyebrow",children:[e.jsx("span",{"aria-hidden":"true",children:c[s.healthStatus]})," ",t("team_health.needs_attention")]}),e.jsx("div",{className:"es-th__alert-name",children:s.userName}),e.jsxs("div",{className:"es-th__alert-meta",children:[e.jsx("span",{className:`es-th__badge es-th__badge--${s.healthStatus.replace("_","-")}`,children:t(i[s.healthStatus])}),e.jsx("span",{className:"es-th__rank",children:x(s.rank,t)})]}),s.riskSignals.length>0&&e.jsx("ul",{className:"es-th__risk-signals","aria-label":t("team_health.risk_signals_aria"),children:s.riskSignals.map(a=>e.jsxs("li",{className:"es-th__risk-signal",children:[e.jsx("span",{"aria-hidden":"true",children:"⚠"})," ",a]},a))}),e.jsx("div",{className:"es-th__health-bar-wrap","aria-label":t("team_health.health_score_aria",{score:s.healthScore}),children:e.jsx("div",{className:"es-th__health-bar",style:{width:`${s.healthScore}%`}})}),n&&e.jsxs("div",{className:"es-th__tip",children:[e.jsxs("div",{className:"es-th__tip-header",children:[e.jsxs("span",{className:"es-th__ai-label",children:[e.jsx("span",{"aria-hidden":"true",children:"✨"})," ",t("team_health.ai_tip_label")]}),e.jsx("button",{className:`es-th__copy-btn${p==="copied"?" es-th__copy-btn--copied":""}`,onClick:f,"aria-label":t("team_health.copy_tip_aria"),title:t("common.copy_to_clipboard"),children:p==="copied"?"✓":"⎘"})]}),e.jsx("p",{className:"es-th__tip-text",children:n})]})]}),v==="pro"&&e.jsxs("div",{className:"es-th__member-list",children:[e.jsxs("div",{className:"es-th__member-list-header",children:[e.jsx("span",{className:"es-th__section-title",children:r?t("team_health.status_filtered",{status:t(i[r]),count:y.length}):t("team_health.all_members",{count:d.length})}),r&&e.jsx("button",{className:"es-th__clear-filter",onClick:()=>b(null),children:t("team_health.clear_filter")})]}),g.length===0?e.jsx("p",{className:"es-th__empty",children:t("team_health.empty_status")}):e.jsx("ul",{className:"es-th__members","aria-label":t("team_health.members_aria"),children:g.map(a=>e.jsxs("li",{className:"es-th__member-item",onClick:()=>m.emit("th:memberSelected",{userId:a.userId}),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),m.emit("th:memberSelected",{userId:a.userId}))},tabIndex:0,role:"button",children:[e.jsxs("div",{className:"es-th__member-header",children:[e.jsx("span",{className:"es-th__member-emoji","aria-hidden":"true",children:c[a.healthStatus]}),e.jsx("span",{className:"es-th__member-name",children:a.userName}),e.jsxs("span",{className:"es-th__member-score",children:[a.healthScore,"%"]})]}),e.jsxs("div",{className:"es-th__member-meta",children:[e.jsx("span",{className:`es-th__badge es-th__badge--${a.healthStatus.replace("_","-")}`,children:t(i[a.healthStatus])}),e.jsx("span",{className:"es-th__rank",children:x(a.rank,t)})]}),e.jsx("div",{className:"es-th__health-bar-wrap",children:e.jsx("div",{className:"es-th__health-bar",style:{width:`${a.healthScore}%`}})}),a.riskSignals.length>0&&e.jsx("p",{className:"es-th__member-signals",children:a.riskSignals.join(" · ")})]},a.userId))})]})]})})}export{T as Component,C as manifest};
2
+ //# sourceMappingURL=index-DphwDFW6-C9wFr7fa.js.map
@@ -0,0 +1,2 @@
1
+ import{r as t,j as e,Q as N}from"../nexly.js";const S={slug:"chat-session-nav",name:"Chat Session Navigator",version:"1.0.0",category:"interactive",configSchema:{},defaultConfig:{},sizing:{minWidth:200,preferredHeight:"fill",scrollable:!0},supportedPlacements:["sidebar","main"],events:{emits:[{name:"chat:select-session",description:"User selected a past chat session"}]}};function E(a,i){const d=Date.now()-new Date(a).getTime(),o=Math.floor(d/6e4);if(o<1)return i("time.just_now");if(o<60)return i("time.minutes_ago",{count:o});const c=Math.floor(o/60);return c<24?i("time.hours_ago",{count:c}):i("time.days_ago",{count:Math.floor(c/24)})}function H({actions:a,baseUrl:i,productId:d,i18n:o,auth:c,sessionId:v}){const n=o?.t??(s=>s),f=c?.jwt,[p,l]=t.useState(!1),[x,w]=t.useState([]),[h,b]=t.useState(!1),[j,g]=t.useState(null),[u,_]=t.useState(v??null);t.useEffect(()=>{_(v??null)},[v]);const m=t.useCallback(async()=>{b(!0),g(null);try{const s=await fetch(`${i}/api/chat/sessions?productId=${encodeURIComponent(d||"")}`,{headers:{...f?{Authorization:`Bearer ${f}`}:{}},credentials:"include"});if(!s.ok)throw new Error(`HTTP ${s.status}`);const r=await s.json();if(!r.success)throw new Error("Invalid response");w(r.data?.sessions??[])}catch{g(n("chat_session_nav.load_error"))}finally{b(!1)}},[i,f,d,n]);t.useEffect(()=>a.on("chat:session",s=>{const{sessionId:r}=s;r&&_(r),p&&m()}),[a,m,p]),t.useEffect(()=>a.on("chat:showHistory",()=>{l(!0),m()}),[a,m]),t.useEffect(()=>a.on("chat:clearHistory",()=>{l(!1)}),[a]);const y=t.useCallback(s=>{s!==u&&(_(s),a.emit("chat:select-session",{sessionId:s}),l(!1))},[a,u]),k=t.useCallback(()=>{a.emit("chat:clearHistory",void 0),_(null),l(!1)},[a]),C=t.useCallback(()=>{l(!1)},[]);return p?e.jsxs(N,{blockType:"chat-session-nav",children:[e.jsxs("div",{className:"es-csn__header",children:[e.jsx("span",{className:"es-csn__header-title",children:n("chat_session_nav.title")}),e.jsxs("div",{className:"es-csn__header-actions",children:[e.jsx("button",{type:"button",className:"es-csn__action-btn","aria-label":n("chat_session_nav.new_session"),title:n("chat_session_nav.new_session"),onClick:k,children:e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 5H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})]})}),e.jsx("button",{type:"button",className:"es-csn__close-btn","aria-label":n("chat_session_nav.close"),onClick:C,children:"✕"})]})]}),e.jsx("div",{className:"es-block__body",children:e.jsxs("div",{className:"es-csn__list",role:"list","aria-label":n("chat_session_nav.list_aria"),children:[h&&e.jsx("div",{className:"es-csn__loading",role:"status",children:n("chat_session_nav.loading")}),j&&!h&&e.jsx("div",{className:"es-csn__error",role:"alert",children:j}),!h&&!j&&x.length===0&&e.jsx("div",{className:"es-csn__empty",children:n("chat_session_nav.empty")}),!h&&x.map(s=>e.jsxs("button",{role:"listitem",type:"button",className:`es-csn__item${s.id===u?" es-csn__item--active":""}`,onClick:()=>y(s.id),"aria-current":s.id===u?"true":void 0,children:[e.jsx("div",{className:"es-csn__item-preview",children:s.lastUserMessage??n("chat_session_nav.no_preview")}),e.jsxs("div",{className:"es-csn__item-meta",children:[e.jsx("span",{children:E(s.updatedAt,n)}),s.messageCount>0&&e.jsx("span",{children:n("chat_session_nav.message_count",{count:s.messageCount})})]})]},s.id))]})})]}):null}export{H as Component,S as manifest};
2
+ //# sourceMappingURL=index-Dt6OpItC-R_xuAEQV.js.map
@@ -0,0 +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
@@ -0,0 +1,2 @@
1
+ import{r as q,j as e,Q as m,o as w}from"../nexly.js";import{m as l}from"./block-helpers-Cg_zAqG6-DnN2COvk.js";const M={slug:"rank-advancement-roadmap",name:"Rank Advancement Roadmap",version:"1.0.0",category:"data",requiredService:"rank-advancement-roadmap",configSchema:{properties:{mode:{type:"string",default:"basic"},showAiTip:{type:"boolean",default:!0}}},defaultConfig:{mode:"basic",showAiTip:!0},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"rank-advancement-roadmap",inputSchema:{type:"object",properties:{currentRank:{type:"string"},nextRank:{type:"string"},progressPercent:{type:"number"},rankTree:{type:"array",items:{type:"object",properties:{rank:{type:"string"},requirements:{type:"array",items:{type:"string"}},achieved:{type:"boolean"}}}},aiTip:{type:"string"},mode:{type:"string",enum:["basic","pro"]}}},previewDataOverride:{currentRank:"Silver",nextRank:"Gold",progressPercent:62,mode:"pro",aiTip:"You're 38% away from Gold. Focus on recruiting 2 active distributors to your right leg — that's your fastest path to the next milestone.",rankTree:[{rank:"G-Miner",requirements:["Personal purchase: 50 pts"],achieved:!0},{rank:"Miner",requirements:["Personal purchase: 100 pts","Team volume: 500 pts"],achieved:!0},{rank:"Developer",requirements:["Personal purchase: 200 pts","Team volume: 1,500 pts"],achieved:!0},{rank:"Team Leader",requirements:["Personal purchase: 300 pts","Team volume: 5,000 pts","2 Developers in team"],achieved:!0},{rank:"Manager",requirements:["Personal purchase: 400 pts","Team volume: 15,000 pts","2 Team Leaders"],achieved:!1},{rank:"Senior Manager",requirements:["Personal purchase: 500 pts","Team volume: 40,000 pts","3 Managers"],achieved:!1},{rank:"Vice President",requirements:["Personal purchase: 600 pts","Team volume: 100,000 pts","4 Senior Managers"],achieved:!1},{rank:"President",requirements:["Personal purchase: 700 pts","Team volume: 250,000 pts","5 Vice Presidents"],achieved:!1}]}},fields:[{id:"mode",type:"select",label:"Display mode",default:"basic",options:[{label:"Basic — current rank + progress",value:"basic"},{label:"Pro — full rank tree",value:"pro"}],group:"Display"},{id:"showAiTip",type:"toggle",label:"Show AI coaching tip (pro mode)",default:!0,group:"Display"}],events:{emits:[{name:"rar:rankExpanded",description:"User expanded a rank in the accordion"}],listens:[{name:"rar:refresh",description:"Force refresh rank data"}]}};function k(s,o,d){return Math.min(Math.max(s,o),d)}function D({data:s,config:o,actions:d,metadata:v,i18n:x}){const r=x?.t??(a=>a),_=o.mode??s.mode??"basic",g=o.showAiTip??!0,p=s.currentRank,t=s.nextRank,b=k(s.progressPercent??0,0,100),u=s.rankTree??[],h=s.aiTip,[j,y]=q.useState(new Set);if(!p&&!s.error)return e.jsx(m,{blockType:"rank-advancement-roadmap",children:e.jsx("div",{className:"es-block__body es-rar__body",children:e.jsxs("div",{className:"es-rar__current-card",children:[e.jsx("div",{className:"es-rar__section-label",children:r("rank_roadmap.current_rank")}),e.jsx("div",{className:"es-rar__rank-row",children:e.jsx("span",{className:"es-rar__rank-name",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:"—"})}),e.jsxs("div",{className:"es-rar__progress-label",children:[e.jsx("span",{children:v?.dataQuality==="none"?r("rank_roadmap.signin_prompt"):r("rank_roadmap.loading")}),e.jsx("span",{children:"0%"})]}),e.jsx("div",{className:"es-rar__progress-bar",children:e.jsx("div",{className:"es-rar__progress-fill",style:{width:"0%"}})})]})})});if(s.error)return e.jsx(m,{blockType:"rank-advancement-roadmap",error:w(s.error)});function f(a){y(c=>{const n=new Set(c);return n.has(a)?n.delete(a):(n.add(a),d.emit("rar:rankExpanded",{rank:a})),n})}const i=k(b,0,100);return e.jsx(m,{blockType:"rank-advancement-roadmap",children:e.jsxs("div",{className:"es-block__body es-rar__body",children:[e.jsxs("div",{className:"es-rar__current-card",children:[e.jsx("div",{className:"es-rar__section-label",children:r("rank_roadmap.current_rank")}),e.jsxs("div",{className:"es-rar__rank-row",children:[e.jsx("span",{className:"es-rar__rank-name",children:l(p??"",r)}),e.jsxs("span",{className:"es-rar__rank-badge",children:[i,"%"]})]}),e.jsxs("div",{className:"es-rar__progress-label",children:[e.jsx("span",{children:r("rank_roadmap.progress_to",{rank:t?l(t,r):r("rank_roadmap.next_rank_fallback")})}),e.jsxs("span",{children:[i,"%"]})]}),e.jsx("div",{className:"es-rar__progress-bar",children:e.jsx("div",{className:"es-rar__progress-fill",style:{width:`${i}%`},role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r("rank_roadmap.progress_aria",{percent:i,rank:t?l(t,r):r("rank_roadmap.next_rank_fallback")})})}),t&&e.jsx("div",{className:"es-rar__next-rank-hint",children:r("rank_roadmap.next_label",{rank:l(t,r)})})]}),g&&_==="pro"&&e.jsxs("div",{className:`es-rar__ai-tip${h?"":" es-rar__ai-tip--loading"}`,children:[e.jsx("div",{className:"es-rar__ai-tip-label",children:r("rank_roadmap.ai_tip_label")}),e.jsx("div",{className:"es-rar__ai-tip-text",children:h??r("rank_roadmap.analyzing")})]}),_==="pro"&&u.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"es-rar__tree-label",children:r("rank_roadmap.tree_label")}),e.jsx("ul",{className:"es-rar__tree",role:"list",children:u.map(a=>{const c=a.rank===p,n=j.has(a.rank),N=["es-rar__tree-item",a.achieved?"es-rar__tree-item--achieved":"",c?"es-rar__tree-item--current":""].filter(Boolean).join(" ");return e.jsxs("li",{className:N,children:[e.jsxs("button",{className:"es-rar__tree-header",onClick:()=>f(a.rank),"aria-expanded":n,"aria-controls":`rar-reqs-${a.rank}`,children:[e.jsx("span",{className:"es-rar__tree-status-icon","aria-hidden":"true",children:a.achieved?"✓":c?"▶":"○"}),e.jsx("span",{className:"es-rar__tree-rank-name",children:l(a.rank,r)}),e.jsx("span",{className:`es-rar__tree-chevron${n?" es-rar__tree-chevron--open":""}`,"aria-hidden":"true",children:"▾"})]}),n&&e.jsx("ul",{id:`rar-reqs-${a.rank}`,className:"es-rar__tree-requirements",role:"list",children:a.requirements.map((T,P)=>e.jsx("li",{className:"es-rar__tree-req",children:T},P))})]},a.rank)})})]})]})})}export{D as Component,M as manifest};
2
+ //# sourceMappingURL=index-IW3aNe-y-W1lJrIDD.js.map
@@ -0,0 +1,4 @@
1
+ import{j as e,Q as m}from"../nexly.js";const h={slug:"crypto-ticker",name:"Crypto Ticker",version:"2.0.0",category:"data",requiredService:"crypto-intel",configSchema:{properties:{showFearGreed:{type:"boolean",default:!0},showNews:{type:"boolean",default:!0},newsLimit:{type:"number",default:5},showBtcPrice:{type:"boolean",default:!0}}},defaultConfig:{showFearGreed:!0,showNews:!0,newsLimit:5,showBtcPrice:!0},dataContract:{serviceSlug:"crypto-intel",inputSchema:{type:"object",properties:{fearGreedIndex:{type:"number"},fearGreedLabel:{type:"string"},btcPrice:{type:"number"},btcChange24h:{type:"number"},news:{type:"array",items:{type:"object",properties:{title:{type:"string"},source:{type:"string"}}}},summary:{type:"string"}},required:["summary"]},previewDataOverride:{fearGreedIndex:65,fearGreedLabel:"Greed",btcPrice:67420.5,btcChange24h:2.34,news:[{title:"Bitcoin hits new monthly high amid institutional buying",source:"CoinDesk"},{title:"Ethereum staking reaches record 32M ETH",source:"The Block"},{title:"SEC approves spot Solana ETF applications",source:"Bloomberg"}],summary:`Market Sentiment: 65 (Greed)
2
+
3
+ BTC: $67,420 | 24h: +2.34%`}},fields:[{id:"showFearGreed",type:"toggle",label:"Show Fear & Greed",default:!0,group:"Display"},{id:"showNews",type:"toggle",label:"Show news feed",default:!0,group:"Display"},{id:"newsLimit",type:"range",label:"Max news items",default:5,min:1,max:15,step:1,group:"Display"},{id:"showBtcPrice",type:"toggle",label:"Show BTC price",default:!0,group:"Display"}],events:{emits:[{name:"ticker:coinSelected",description:"User clicked on a coin entry"}],listens:[{name:"market:refresh",description:"Force refresh market data"}]},sizing:{minWidth:200,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function g({data:r,config:s,i18n:o}){const a=o?.t??(t=>t),l=s.showFearGreed??!0,p=s.showNews??!0,d=s.newsLimit??5,i=r.fearGreedIndex,n=r.fearGreedLabel,c=(r.news??[]).slice(0,d);return e.jsx(m,{blockType:"crypto-ticker",children:e.jsxs("div",{className:"es-block__body",children:[l&&i!=null&&e.jsxs("div",{className:"es-crypto__gauge",children:[e.jsx("div",{className:"es-crypto__gauge-label",children:a("crypto_ticker.fear_greed_label")}),e.jsx("div",{className:"es-crypto__gauge-value",children:i}),n&&e.jsx("div",{className:"es-crypto__gauge-sentiment",children:n})]}),p&&c.length>0&&e.jsxs("div",{className:"es-crypto__news",children:[e.jsx("div",{className:"es-crypto__news-title",children:a("crypto_ticker.news_title")}),e.jsx("ul",{className:"es-crypto__news-list",children:c.map((t,u)=>e.jsxs("li",{className:"es-crypto__news-item",children:[e.jsx("span",{children:t.title}),t.source&&e.jsx("span",{className:"es-crypto__news-source",children:t.source})]},u))})]}),!i&&c.length===0&&e.jsx("div",{className:"es-block__empty",children:a("crypto_ticker.empty")})]})})}export{g as Component,h as manifest};
4
+ //# sourceMappingURL=index-V1EfdiK7-bdo5pwX-.js.map
@@ -0,0 +1,2 @@
1
+ import{r as i,a as j,j as e,Q as m}from"../nexly.js";const E={slug:"auth-register",name:"User Registration",version:"1.0.0",category:"interactive",requiredService:"",configSchema:{properties:{showName:{type:"boolean",default:!0},showEmail:{type:"boolean",default:!0},requireEmail:{type:"boolean",default:!1},showExternalId:{type:"boolean",default:!1},submitLabel:{type:"string",default:""}}},defaultConfig:{showName:!0,showEmail:!0,requireEmail:!1,showExternalId:!1,submitLabel:""},dataContract:{serviceSlug:"chat-bot",inputSchema:{type:"object",properties:{authenticated:{type:"boolean"}}},previewDataOverride:{authenticated:!1}},fields:[{id:"showName",type:"toggle",label:"Show name field",default:!0,group:"Form Fields"},{id:"showEmail",type:"toggle",label:"Show email field",default:!0,group:"Form Fields"},{id:"requireEmail",type:"toggle",label:"Require email",default:!1,group:"Form Fields"},{id:"showExternalId",type:"toggle",label:"Show external ID field",default:!1,group:"Form Fields"},{id:"submitLabel",type:"localized-text",label:"Submit button label",default:"",placeholder:'Leave empty to use translated default (e.g. "Register")',group:"Content"}],events:{emits:[{name:"auth:registered",description:"User successfully completed registration"},{name:"auth:registrationFailed",description:"Registration form submission failed"}],listens:[{name:"auth:reset",description:"Reset the registration form"}]},supportedPlacements:["main"],sizing:{minWidth:280,preferredHeight:"auto",scrollable:!1}};function k({config:o,actions:g,i18n:c}){const r=c?.t??(t=>t),b=c?.currentLanguage??"en",[f,h]=i.useState(""),[n,y]=i.useState(""),[s,p]=i.useState(!1),[a,l]=i.useState(null),v=o.showName??!0,x=o.showEmail??!0,d=o.requireEmail??!1,S=j(o.submitLabel,b,{t:r,fallbackKey:"auth.register.submit",enDefault:"Register"});async function w(t){t.preventDefault(),p(!0),l(null);try{const u=await g.call("register",{name:f||void 0,email:n||void 0});u?.error?l({success:!1,error:u.error}):l({success:!0,apiKey:u?.apiKey})}catch{l({success:!1,error:r("auth.register.error_failed")})}finally{p(!1)}}return a?.success?e.jsx(m,{blockType:"auth-register",children:e.jsxs("div",{className:"es-block__body",style:{padding:24,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:14,color:"var(--es-color-success, #00672B)",marginBottom:8},children:r("auth.register.success")}),a.apiKey&&e.jsxs("div",{style:{fontSize:11,color:"var(--es-color-on-surface-muted, #4B5563)",background:"var(--es-color-surface-elevated, #f5f5f5)",padding:"8px 12px",borderRadius:6,fontFamily:"monospace",wordBreak:"break-all"},children:[r("auth.register.api_key_prompt"),e.jsx("br",{}),e.jsx("span",{style:{color:"var(--es-color-interactive, #2563EB)"},children:a.apiKey})]})]})}):e.jsx(m,{blockType:"auth-register",children:e.jsx("div",{className:"es-block__body",style:{padding:16},children:e.jsxs("form",{onSubmit:w,children:[v&&e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--es-color-on-surface-muted, #4B5563)",marginBottom:4},children:r("auth.register.name_label")}),e.jsx("input",{type:"text",value:f,onChange:t=>h(t.target.value),placeholder:r("auth.register.name_placeholder"),style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid var(--es-color-control-border, #6B7280)",background:"var(--es-color-surface-elevated, #f5f5f5)",color:"var(--es-color-on-surface, #1a1a1a)",fontSize:14,outline:"none",boxSizing:"border-box"}})]}),x&&e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("label",{style:{display:"block",fontSize:12,color:"var(--es-color-on-surface-muted, #4B5563)",marginBottom:4},children:[r("auth.email_label"),d&&" *"]}),e.jsx("input",{type:"email",value:n,onChange:t=>y(t.target.value),placeholder:r("auth.email_placeholder"),required:d,style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid var(--es-color-control-border, #6B7280)",background:"var(--es-color-surface-elevated, #f5f5f5)",color:"var(--es-color-on-surface, #1a1a1a)",fontSize:14,outline:"none",boxSizing:"border-box"}})]}),a?.error&&e.jsx("div",{style:{fontSize:12,color:"var(--es-color-error, #AD2C26)",marginBottom:8},children:a.error}),e.jsx("button",{type:"submit",disabled:s||d&&!n,style:{width:"100%",padding:"10px 16px",borderRadius:6,border:"none",background:s?"var(--es-color-on-surface-muted, #4B5563)":"var(--es-color-primary, #2563EB)",color:"var(--es-color-on-primary, #ffffff)",fontSize:14,fontWeight:600,cursor:s?"wait":"pointer"},children:s?r("auth.register.submitting"):S})]})})})}export{k as Component,E as manifest};
2
+ //# sourceMappingURL=index-csHaX5dv-BpgnWlB8.js.map
@@ -0,0 +1,2 @@
1
+ import{r as o,j as e,Q as u}from"../nexly.js";const x=[{value:"post",labelKey:"social_content.type.post"},{value:"story",labelKey:"social_content.type.story"},{value:"dm",labelKey:"social_content.type.dm"},{value:"event_promo",labelKey:"social_content.type.event_promo"}],g=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"kakao",label:"KakaoTalk"},{value:"line",label:"LINE"},{value:"generic",labelKey:"social_content.platform.generic"}],G=[{value:"professional",labelKey:"social_content.tone.professional"},{value:"casual",labelKey:"social_content.tone.casual"},{value:"energetic",labelKey:"social_content.tone.energetic"},{value:"empathetic",labelKey:"social_content.tone.empathetic"}];function j(t,d){const n=g.find(m=>m.value===d);return n?.labelKey?t(n.labelKey):n?.label??d}function Q({data:t,config:d,actions:n,metadata:m,i18n:_}){const s=_?.t??(c=>c),N=d.mode??t.mode??"basic",f=t.content,k=t.contentType??"post",C=t.platform??"generic",K=t.tone??"professional",S=t.characterCount,[a,T]=o.useState(f??""),[i,w]=o.useState(k),[r,$]=o.useState(C),[p,q]=o.useState(K),[h,v]=o.useState("idle"),[l,b]=o.useState(!1),B=()=>{a&&(navigator.clipboard.writeText(a).catch(()=>{}),v("copied"),n?.emit?.("sc:contentCopied",{content:a,contentType:i,platform:r}),setTimeout(()=>v("idle"),2e3))},y=o.useCallback(async()=>{if(!(l||!n?.request)){b(!0);try{const c=await n.request("sc:regenerate",{contentType:i,platform:r,tone:p});c?.content&&(T(c.content),n?.emit?.("sc:contentGenerated",{contentType:i,platform:r,tone:p}))}finally{b(!1)}}},[l,n,i,r,p]),E=c=>{w(c),n?.emit?.("sc:typeChanged",{contentType:c})};return!a&&!t.error&&!l?e.jsx(u,{blockType:"social-content",children:e.jsxs("div",{className:"sc-block",children:[e.jsxs("div",{className:"sc-content-card",children:[e.jsxs("div",{className:"sc-content-header",children:[e.jsxs("div",{className:"sc-content-meta",children:[e.jsx("span",{className:"sc-meta-badge",children:s("social_content.type.post")}),e.jsx("span",{className:"sc-meta-badge",style:{background:"var(--es-color-success-soft, rgba(0, 103, 43, 0.15))",color:"var(--es-color-success, #00672B)"},children:s("social_content.platform.generic")})]}),e.jsxs("button",{className:"sc-btn sc-btn--primary",onClick:y,disabled:l,children:["↺ ",s("social_content.generate_content")]})]}),e.jsx("div",{className:"sc-content-body",style:{color:"var(--es-color-on-surface-muted, #4B5563)",fontStyle:"italic"},children:e.jsx("p",{className:"sc-content-text",children:m?.dataQuality==="none"?s("social_content.signin_prompt"):s("social_content.empty_cta_hint")})})]}),e.jsxs("div",{className:"sc-compliance-notice",children:[e.jsx("span",{className:"sc-compliance-icon",children:"🛡️"}),e.jsx("span",{children:s("social_content.compliance_notice_short")})]})]})}):t.error?e.jsx(u,{blockType:"social-content",children:e.jsx("p",{style:{color:"var(--es-color-error, #AD2C26)",fontSize:13},children:s("social_content.load_error")})}):e.jsx(u,{blockType:"social-content",children:e.jsxs("div",{className:"sc-block",children:[N==="pro"&&e.jsxs("div",{className:"sc-selectors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.content_type_label")}),e.jsx("div",{className:"sc-selector-row",children:x.map(c=>e.jsx("button",{className:`sc-chip${i===c.value?" sc-chip--active":""}`,onClick:()=>E(c.value),children:s(c.labelKey)},c.value))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.platform_label")}),e.jsx("div",{className:"sc-selector-row",children:g.map(c=>e.jsx("button",{className:`sc-chip${r===c.value?" sc-chip--active":""}`,onClick:()=>$(c.value),children:j(s,c.value)},c.value))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sc-selector-label",children:s("social_content.tone_label")}),e.jsx("div",{className:"sc-selector-row",children:G.map(c=>e.jsx("button",{className:`sc-chip${p===c.value?" sc-chip--active":""}`,onClick:()=>q(c.value),children:s(c.labelKey)},c.value))})]})]}),e.jsxs("div",{className:"sc-content-card",children:[e.jsxs("div",{className:"sc-content-header",children:[e.jsxs("div",{className:"sc-content-meta",children:[e.jsx("span",{className:"sc-meta-badge",children:s(x.find(c=>c.value===i)?.labelKey??"social_content.type.post")}),e.jsx("span",{className:"sc-meta-badge",style:{background:"var(--es-color-success-soft, rgba(0, 103, 43, 0.15))",color:"var(--es-color-success, #00672B)"},children:j(s,r)}),S!==void 0&&e.jsx("span",{className:"sc-char-count",children:s("social_content.char_count",{count:a.length})})]}),e.jsxs("div",{className:"sc-actions",children:[e.jsx("button",{className:`sc-btn${h==="copied"?" sc-btn--copied":""}`,onClick:B,disabled:!a,children:h==="copied"?`✓ ${s("common.copied")}`:s("common.copy")}),e.jsx("button",{className:"sc-btn sc-btn--primary",onClick:y,disabled:l,children:l?"...":`↺ ${s("social_content.regenerate")}`})]})]}),l?e.jsxs("div",{className:"sc-generating",children:[e.jsx("div",{className:"sc-spinner"}),s("social_content.generating")]}):e.jsx("div",{className:"sc-content-body",children:e.jsx("p",{className:"sc-content-text",children:a})})]}),e.jsxs("div",{className:"sc-compliance-notice",children:[e.jsx("span",{className:"sc-compliance-icon",children:"🛡️"}),e.jsx("span",{children:s("social_content.compliance_notice_full")})]})]})})}const z={slug:"social-content",name:"Social Content Generator",version:"1.0.0",category:"interactive",requiredService:"social-content",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:280,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"social-content",inputSchema:{type:"object",properties:{content:{type:"string"},contentType:{type:"string"},platform:{type:"string"},tone:{type:"string"},mode:{type:"string"},characterCount:{type:"number"}},required:["content","mode"]}},events:{emits:[{name:"sc:contentCopied",description:"User copied generated content"},{name:"sc:contentGenerated",description:"New content was generated (after regenerate)"},{name:"sc:typeChanged",description:"User changed content type in pro mode"}]}};export{Q as Component,Q as SocialContentBlock,z as manifest};
2
+ //# sourceMappingURL=index-hHQjRGar-TEMHje2B.js.map
@@ -0,0 +1,2 @@
1
+ import{j as e,Q as p}from"../nexly.js";const y={slug:"widget-settings",name:"Widget Settings",version:"1.0.0",category:"content",configSchema:{},defaultConfig:{},dataContract:{serviceSlug:null,inputSchema:{type:"object",properties:{}}},fields:[],sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main"],events:{emits:[{name:"preferences:set",description:"Sets theme ({ theme }) or language ({ language }) preference via WidgetShell."},{name:"auth:logout",description:"Signs the user out."}]}},g=[{value:"en",flag:"🇬🇧",labelKey:"languages.en"},{value:"ko",flag:"🇰🇷",labelKey:"languages.ko"},{value:"ja",flag:"🇯🇵",labelKey:"languages.ja"},{value:"es",flag:"🇪🇸",labelKey:"languages.es"},{value:"zh",flag:"🇨🇳",labelKey:"languages.zh"},{value:"id",flag:"🇮🇩",labelKey:"languages.id"},{value:"vi",flag:"🇻🇳",labelKey:"languages.vi"},{value:"pl",flag:"🇵🇱",labelKey:"languages.pl"}],b=[{value:"light",labelKey:"settings.theme_light"},{value:"dark",labelKey:"settings.theme_dark"},{value:"system",labelKey:"settings.theme_auto"}];function j(l){return l.split(" ").map(t=>t[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}function w(l){if(!Array.isArray(l))return g;const t=new Set(l.filter(i=>typeof i=="string")),r=g.filter(i=>t.has(i.value));return r.length>0?r:g}function N({i18n:l,auth:t,preferences:r,actions:i,readOnly:o,config:m}){const a=l?.t??(s=>s),d=l?.isLoadingTranslations??!1,f=l?.translationError??!1,h=l?.retryTranslations;if(!t?.isAuthenticated||!t.user)return e.jsx(p,{blockType:"widget-settings",children:e.jsx("div",{className:"es-widget__profile",children:e.jsx("div",{className:"es-widget__profile-empty",children:e.jsx("p",{children:a("profile.not_logged_in")})})})});const{user:n}=t,_=l?.currentLanguage??r?.language??"en",c=w(m?.enabledLocales),v=c.length>1,u=r?.theme??"system";return e.jsx(p,{blockType:"widget-settings",children:e.jsxs("div",{className:"es-widget__profile",children:[e.jsxs("div",{className:"es-widget__profile-card",children:[e.jsx("div",{className:"es-widget__profile-avatar",children:e.jsx("div",{className:"es-widget__profile-avatar-inner",children:n.name?e.jsx("span",{className:"es-widget__profile-avatar-initials",children:j(n.name)}):null})}),e.jsxs("div",{className:"es-widget__profile-info",children:[n.name&&e.jsx("h3",{className:"es-widget__profile-name",children:n.name}),n.email&&e.jsx("p",{className:"es-widget__profile-email",children:n.email})]})]}),e.jsxs("div",{className:"es-widget__profile-settings",children:[v&&e.jsxs("div",{className:"es-widget__profile-setting-row",children:[e.jsx("label",{htmlFor:"es-lang-select",className:"es-widget__profile-setting-label",children:a("profile.language_label")}),e.jsxs("div",{className:"es-widget__profile-lang-control",children:[e.jsx("select",{id:"es-lang-select",className:"es-widget__profile-lang-select",value:_,disabled:d||o===!0,onChange:s=>i.emit("preferences:set",{language:s.target.value}),children:c.map(s=>e.jsxs("option",{value:s.value,children:[s.flag," ",a(s.labelKey)]},s.value))}),d&&e.jsx("span",{className:"es-widget__profile-lang-spinner",role:"status","aria-label":a("settings.language_loading")})]})]}),f&&e.jsxs("div",{className:"es-widget__profile-lang-error",role:"alert",children:[e.jsx("span",{children:a("settings.language_error")}),e.jsx("button",{type:"button",className:"es-widget__profile-lang-retry",onClick:()=>h?.(),children:a("settings.language_retry")})]}),e.jsxs("div",{className:"es-widget__profile-setting-row",children:[e.jsx("span",{className:"es-widget__profile-setting-label",children:a("settings.theme_label")}),e.jsx("div",{className:"es-widget__profile-theme-switcher",role:"group","aria-label":a("settings.theme_label"),children:b.map(s=>e.jsx("button",{type:"button",className:`es-widget__profile-theme-btn${u===s.value?" es-widget__profile-theme-btn--active":""}`,"aria-pressed":u===s.value,disabled:o===!0,onClick:()=>i.emit("preferences:set",{theme:s.value==="system"?null:s.value}),children:e.jsx("span",{children:a(s.labelKey)})},s.value))})]})]})]})})}export{N as Component,y as manifest};
2
+ //# sourceMappingURL=index-k-jZV_MQ-H31PHMqm.js.map
@@ -0,0 +1,4 @@
1
+ import{r as o,b as T,j as e,Q}from"../nexly.js";import{x as oe,s as me,c as de,a as ue}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{p as he,c as _e}from"./external-url-LRu_ntew-CJQjg_od.js";import{f as pe}from"./assistant-link-components-MZWf5ty7-C44wlQAi.js";import{C as ge}from"./block-rating-DH7mp-_R-CoiP5C2K.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-DWaWTnGr-Cc-yj-a-.js";const Te={slug:"market-insights",name:"Market Insights",version:"2.3.0",category:"data",requiredService:"crypto-intel",configSchema:{properties:{proMode:{type:"boolean",default:!1},showFearGreed:{type:"boolean",default:!0},showNews:{type:"boolean",default:!0},showBtcPrice:{type:"boolean",default:!0},newsLimit:{type:"number",default:5},confirmExternalLinks:{type:"boolean",default:!0}}},defaultConfig:{proMode:!1,showFearGreed:!0,showNews:!0,showBtcPrice:!0,newsLimit:5,confirmExternalLinks:!0},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},dataContract:{serviceSlug:"crypto-intel",inputSchema:{type:"object",properties:{fearGreedIndex:{type:"number"},fearGreedLabel:{type:"string"},btcPrice:{type:"number"},btcChange24h:{type:"number"},dominance:{type:"number"},news:{type:"array",items:{type:"object",properties:{title:{type:"string"},source:{type:"string"},publishedAt:{type:"string"},url:{type:"string"},tagline:{type:"string"},articleSummary:{type:"string"}}}},summary:{type:"string"}},required:["summary"]},previewDataOverride:{fearGreedIndex:72,fearGreedLabel:"Greed",btcPrice:68900,btcChange24h:3.15,dominance:54.2,news:[{title:"Bitcoin surges past $68K on strong ETF inflows",source:"CoinDesk",publishedAt:"2026-04-03T08:00:00Z",url:"https://example.com/news/btc-surges"},{title:"Ethereum developers confirm next upgrade timeline",source:"The Block",publishedAt:"2026-04-03T06:30:00Z",url:"https://example.com/news/eth-upgrade"},{title:"DeFi total value locked hits new all-time high",source:"DeFiLlama",publishedAt:"2026-04-02T22:00:00Z",url:"https://example.com/news/defi-tvl"},{title:"South Korea advances crypto regulation framework",source:"Decrypt",publishedAt:"2026-04-02T18:00:00Z",url:"https://example.com/news/sk-crypto"},{title:"MicroStrategy adds 1,000 BTC to corporate treasury",source:"Bloomberg",publishedAt:"2026-04-02T14:00:00Z",url:"https://example.com/news/mstr-btc"}],summary:`Market Sentiment: 72 (Greed)
2
+
3
+ BTC: $68,900 | 24h: +3.15% | Dominance: 54.2%`}},fields:[{id:"proMode",type:"toggle",label:"Pro mode (full analysis with context)",default:!1,group:"Display"},{id:"showFearGreed",type:"toggle",label:"Show Fear & Greed index",default:!0,group:"Display"},{id:"showBtcPrice",type:"toggle",label:"Show BTC price",default:!0,group:"Display"},{id:"showNews",type:"toggle",label:"Show news feed",default:!0,group:"Display"},{id:"newsLimit",type:"range",label:"Max news items",default:5,min:1,max:15,step:1,group:"Display"},{id:"confirmExternalLinks",type:"toggle",label:"Confirm before opening external news links",default:!0,group:"Display"}],events:{emits:[{name:"market:newsClicked",description:"User clicked on a news headline"},{name:"market:sentimentViewed",description:"Fear & Greed index was viewed"},{name:"chat:draft",description:"Seed the chat composer with a draft message + quick-reply chips"}],listens:[{name:"market:refresh",description:"Force refresh market data"}]},supportedPlacements:["main","sidebar"]},xe=1e4,D={price:null,change24h:null,ts:null,live:!1};function ye({baseUrl:a,apiKey:n,enabled:l=!0,intervalMs:c=xe}){const[_,d]=o.useState(D),x=o.useRef(a),S=o.useRef(n);return x.current=a,S.current=n,o.useEffect(()=>{if(!l){d(D);return}let t=!1;const M=async()=>{if(typeof document<"u"&&document.hidden||typeof fetch!="function")return;const k=S.current,[$,y]=await T(fetch(`${x.current}/api/widget/market/btc-price`,{headers:k?{"X-API-Key":k}:void 0}));if(t)return;if(y||!$.ok){d(u=>u.live?D:u);return}const[g,b]=await T($.json());if(!t){if(b||g?.price==null){d(u=>u.live?D:u);return}d({price:g.price,change24h:g.change24h??null,ts:g.ts??null,live:!0})}};M();const v=setInterval(()=>{M()},c);return()=>{t=!0,clearInterval(v)}},[l,c]),_}function W(a){return _e(a)}function R(a){return he(a)}const be="var(--es-color-warning, #9C5300)";function we(a){return a<=25?"var(--es-color-error, #AD2C26)":a<=55?be:"var(--es-color-success, #00672B)"}function fe(a){return a==null?"--":`$${a.toLocaleString("en-US",{maximumFractionDigits:0})}`}function ve(a){if(a==null)return{text:"--",positive:!0};const n=a>=0;return{text:`${n?"+":""}${a.toFixed(1)}%`,positive:n}}function H(a){return a==null?"--":a>=1e12?`$${(a/1e12).toFixed(2)}T`:a>=1e9?`$${(a/1e9).toFixed(1)}B`:a>=1e6?`$${(a/1e6).toFixed(0)}M`:`$${a.toLocaleString()}`}function ke(a){if(!a)return"";const n=Date.now()-new Date(a).getTime(),l=Math.floor(n/6e4);if(l<60)return`${l}m`;const c=Math.floor(l/60);return c<24?`${c}h`:`${Math.floor(c/24)}d`}function je(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function Ge({data:a,config:n,i18n:l,actions:c,baseUrl:_,externalContext:d,auth:x,previewMode:S}){const t=l?.t??(s=>s),M=a.promptLogId,v=n.proMode??!1,k=n.showFearGreed??!0,$=v&&(n.showNews??!0),y=n.showBtcPrice??!0,g=n.confirmExternalLinks??!0,[b,u]=o.useState(null),X=n.newsLimit??5,j=d?.apiKey??"",J=d?.hasChatView===!0,[G,Y]=o.useState(()=>new Set),[B,L]=o.useState(()=>new Map),w=a.fearGreedIndex,ee=a.fearGreedLabel,P=(a.news??[]).slice(0,X),Z=a.btcPrice,se=a.btcChange24h,A=a.btcVolume,E=a.btcMarketCap,I=a.dominance,K=a.aiSummary,q=w!=null?we(w):void 0,F=ye({baseUrl:_,apiKey:j,enabled:y}),U=F.live&&F.price!=null,V=U?F.price:Z,ae=U?F.change24h:se,O=ve(ae),N=a._errors??[],te=w!=null||Z!=null||P.length>0,ie=typeof K=="string"&&K.trim().length>0,z=o.useCallback(async(s,i)=>{L(C=>{const p=new Map(C);return p.set(s,{status:"loading"}),p});const[m,h]=await T(fetch(`${_}/api/widget/crypto-intel/article-summary`,{method:"POST",headers:{"Content-Type":"application/json",...j?{"X-API-Key":j}:{}},body:JSON.stringify({title:i.title,url:i.url,source:i.source,publishedAt:i.publishedAt,tagline:i.tagline})})),r=()=>L(C=>{const p=new Map(C);return p.set(s,{status:"error"}),p});if(h||!m.ok)return r();const[f,ce]=await T(m.json());if(ce||!f?.summary)return r();L(C=>{const p=new Map(C);return p.set(s,{status:"ready",text:f.summary}),p})},[j,_]),re=o.useCallback((s,i)=>{if(Y(h=>{const r=new Set(h);return r.has(s)?(r.delete(s),r):(r.add(s),r)}),G.has(s)||B.has(s))return;const m=i.articleSummary?.trim();if(m){L(h=>{const r=new Map(h);return r.set(s,{status:"ready",text:m}),r});return}z(s,i)},[G,B,z]),ne=o.useCallback(s=>{c.emit("chat:draft",{message:t("market_insights.gaio_draft",{title:s.title,source:s.source??"",url:s.url??""}),autoSend:!1,quickChips:[{label:t("market_insights.chip.analyze"),message:t("market_insights.chip.analyze_msg",{url:s.url??""}),autoSend:!0},{label:t("market_insights.chip.summarize"),message:t("market_insights.chip.summarize_msg",{url:s.url??""}),autoSend:!0},{label:t("market_insights.chip.conclusions"),message:t("market_insights.chip.conclusions_msg",{url:s.url??""}),autoSend:!0},{label:t("market_insights.chip.other"),message:"",autoSend:!1}]})},[c,t]),le=o.useCallback(s=>{const i=R(s.url);if(!i)return;if(g){u({url:i,source:s.source||W(i)});return}const m=window.open(i,"_blank","noopener,noreferrer");m&&(m.opener=null)},[g]);return te?e.jsxs(Q,{blockType:"market-insights",children:[e.jsxs("div",{className:"es-block__body",children:[e.jsx(ge,{promptLogId:M,baseUrl:_,apiKey:j,jwt:x?.jwt,previewMode:S,t}),(y||k)&&e.jsxs("div",{className:"es-mi__header",children:[y&&V!=null&&e.jsxs("div",{className:"es-mi__card es-mi__card--btc",children:[e.jsx("span",{className:"es-mi__icon","aria-hidden":"true",children:"B"}),e.jsxs("div",{className:"es-mi__card-label",children:[t("market_insights.bitcoin_label"),U&&e.jsxs("span",{className:"es-mi__live",title:t("market_insights.live_aria"),children:[e.jsx("span",{className:"es-mi__live-dot","aria-hidden":"true"}),t("market_insights.live")]})]}),e.jsx("div",{className:"es-mi__card-value",children:fe(V)}),e.jsx("div",{className:`es-mi__delta ${O.positive?"es-mi__delta--up":"es-mi__delta--down"}`,children:O.text})]}),k&&w!=null&&e.jsxs("div",{className:"es-mi__card es-mi__card--fg",children:[e.jsx("span",{className:"es-mi__icon","aria-hidden":"true",children:"FG"}),e.jsx("div",{className:"es-mi__card-label",children:"Fear & Greed"}),e.jsx("div",{className:"es-mi__card-value es-mi__card-value--fg",style:{color:q},children:w}),e.jsx("div",{className:"es-mi__card-tag",style:{color:q},children:ee}),e.jsx("div",{className:"es-mi__card-bar",children:e.jsx("div",{className:"es-mi__card-bar-fill",style:{width:`${w}%`}})})]})]}),v&&y&&(A!=null||E!=null||I!=null)&&e.jsxs("div",{className:"es-mi__stats",children:[A!=null&&e.jsxs("div",{className:"es-mi__stat",children:[e.jsx("span",{className:"es-mi__stat-label",children:t("market_insights.vol_24h")}),e.jsx("span",{className:"es-mi__stat-value",children:H(A)})]}),E!=null&&e.jsxs("div",{className:"es-mi__stat",children:[e.jsx("span",{className:"es-mi__stat-label",children:t("market_insights.market_cap")}),e.jsx("span",{className:"es-mi__stat-value",children:H(E)})]}),I!=null&&e.jsxs("div",{className:"es-mi__stat",children:[e.jsx("span",{className:"es-mi__stat-label",children:t("market_insights.btc_dominance")}),e.jsxs("span",{className:"es-mi__stat-value",children:[I,"%"]})]})]}),v&&ie&&e.jsxs("div",{className:"es-mi__summary",children:[e.jsx("div",{className:"es-mi__summary-eyebrow",children:t("market_insights.summary_eyebrow")}),e.jsx("div",{className:"es-mi__summary-body es-mi__summary-markdown",children:e.jsx(oe,{remarkPlugins:[...de],allowedElements:[...me],transformLinkUri:s=>ue(s)??"",components:{...pe()},children:K})})]}),$&&P.length>0&&e.jsxs("div",{className:"es-mi__news",children:[e.jsx("div",{className:"es-mi__news-header",children:t("market_insights.news_header")}),e.jsx("ul",{className:"es-mi__news-list",children:P.map((s,i)=>{const m=R(s.url)!==null,h=G.has(i),r=B.get(i),f=r?.status==="loading";return e.jsxs("li",{className:"es-mi__news-item",children:[e.jsx("span",{className:"es-mi__news-stripe","aria-hidden":"true"}),e.jsxs("div",{className:"es-mi__news-body",children:[e.jsx("span",{className:"es-mi__news-title",children:s.title}),e.jsxs("div",{className:"es-mi__news-meta",children:[s.source&&e.jsx("span",{className:"es-mi__news-source",children:s.source}),s.publishedAt&&e.jsx("span",{className:"es-mi__news-time",children:ke(s.publishedAt)})]}),s.tagline&&s.tagline.trim().length>0&&e.jsx("div",{className:"es-mi__news-tagline",children:s.tagline}),e.jsxs("div",{className:"es-mi__news-actions",role:"group","aria-label":t("market_insights.actions_aria"),children:[e.jsxs("button",{type:"button",className:"es-mi__news-btn","aria-expanded":h,"aria-busy":f,disabled:f,onClick:()=>re(i,s),children:[t(f?"market_insights.summary_loading":h?"market_insights.hide":"market_insights.read_more"),e.jsx("span",{className:"es-mi__news-btn-caret","aria-hidden":"true",children:"▾"})]}),J&&e.jsx("button",{type:"button",className:"es-mi__news-btn es-mi__news-btn--gaio",onClick:()=>ne(s),children:t("market_insights.talk_to_gaio")}),m&&e.jsxs("button",{type:"button",className:"es-mi__news-btn",onClick:()=>le(s),children:[t("market_insights.open_link"),e.jsx(je,{})]})]}),e.jsx("div",{className:`es-mi__news-summary${h?" es-mi__news-summary--open":""}${r?.status==="error"?" es-mi__news-summary--error":""}`,children:e.jsx("div",{className:"es-mi__news-summary-inner",children:e.jsxs("div",{className:"es-mi__news-summary-panel",children:[r?.status==="loading"&&e.jsxs("div",{className:"es-mi__news-skeleton","aria-label":t("market_insights.summary_loading"),children:[e.jsx("span",{className:"es-mi__news-skeleton-line"}),e.jsx("span",{className:"es-mi__news-skeleton-line"}),e.jsx("span",{className:"es-mi__news-skeleton-line"})]}),r?.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"es-mi__news-summary-eyebrow",children:t("market_insights.summary_eyebrow")}),e.jsx("div",{className:"es-mi__news-summary-body",children:r.text})]}),r?.status==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"es-mi__news-summary-error-text",children:t("market_insights.summary_error")}),e.jsx("button",{type:"button",className:"es-mi__news-retry",onClick:()=>{z(i,s)},children:t("market_insights.summary_retry")})]})]})})})]})]},i)})})]})]}),b&&e.jsx(Ne,{url:b.url,source:b.source,t,onCancel:()=>u(null),onContinue:()=>{const s=window.open(b.url,"_blank","noopener,noreferrer");s&&(s.opener=null),u(null)}})]}):e.jsx(Q,{blockType:"market-insights",children:e.jsxs("div",{className:"es-block__body",children:[e.jsx("div",{className:"es-block__empty",children:N.length>0?`Data sources unavailable (${N.length} error${N.length>1?"s":""})`:"No market data available"}),N.length>0&&e.jsx("ul",{className:"es-mi__errors",children:N.map((s,i)=>e.jsx("li",{className:"es-mi__error-item",children:s},i))})]})})}function Ne({url:a,source:n,t:l,onCancel:c,onContinue:_}){const d=W(a);return e.jsx("div",{className:"es-mi__leave-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"es-mi-leave-title",onClick:c,children:e.jsxs("div",{className:"es-mi__leave-card",onClick:x=>x.stopPropagation(),children:[e.jsx("div",{className:"es-mi__leave-icon","aria-hidden":"true",children:e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),e.jsx("h2",{id:"es-mi-leave-title",className:"es-mi__leave-title",children:l("market_insights.external_link.title")}),e.jsx("p",{className:"es-mi__leave-body",children:l("market_insights.external_link.body")}),e.jsxs("div",{className:"es-mi__leave-source",title:a,children:[e.jsx("span",{className:"es-mi__leave-source-label",children:n}),e.jsx("span",{className:"es-mi__leave-source-host",children:d})]}),e.jsxs("div",{className:"es-mi__leave-actions",children:[e.jsx("button",{type:"button",className:"es-mi__leave-btn es-mi__leave-btn--cancel",onClick:c,children:l("market_insights.external_link.cancel")}),e.jsx("button",{type:"button",className:"es-mi__leave-btn es-mi__leave-btn--primary",onClick:_,autoFocus:!0,children:l("market_insights.external_link.continue")})]})]})})}export{Ge as Component,Te as manifest};
4
+ //# sourceMappingURL=index-qpVhJY7A-Cgivx3vY.js.map