@kanorio/elements 1.1.0 → 1.2.0

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 (198) hide show
  1. package/README.md +4 -1
  2. package/dist/AudioPlayer-DKUAB5KE.js +2 -0
  3. package/dist/AudioPlayer-S7YF7A2E.js +2 -0
  4. package/dist/CustomerAccountPanel-DJKV7LT4.js +2 -0
  5. package/dist/CustomerAccountPanel-RWEHWBJY.js +2 -0
  6. package/dist/FormAddressField-C6VN7J6I.js +2 -0
  7. package/dist/FormAddressField-QR7ZCH77.js +2 -0
  8. package/dist/FormChoiceDropdown-SJXD26CC.js +2 -0
  9. package/dist/FormChoiceDropdown-U3NIOOHG.js +2 -0
  10. package/dist/FormFileField-LZDCXI2Z.js +2 -0
  11. package/dist/FormFileField-ONL4Q55V.js +2 -0
  12. package/dist/FormTaxIdField-K34MDUPW.js +2 -0
  13. package/dist/FormTaxIdField-XMK5WRQO.js +2 -0
  14. package/dist/KanorioAccount-EN3TM67X.js +2 -0
  15. package/dist/KanorioAccount-XGVSGVYN.js +2 -0
  16. package/dist/KanorioAnalytics-NEKTFQEE.js +2 -0
  17. package/dist/KanorioAnalytics-UMCUWQM7.js +2 -0
  18. package/dist/KanorioCurriculum-3QSCOHK7.js +2 -0
  19. package/dist/KanorioCurriculum-RUIGZ5X7.js +2 -0
  20. package/dist/KanorioForm-GUA5GEJY.js +2 -0
  21. package/dist/KanorioForm-KXV7D2TU.js +2 -0
  22. package/dist/KanorioLightbox-M72HNQQX.js +2 -0
  23. package/dist/KanorioLightbox-TQ3Q73TD.js +2 -0
  24. package/dist/KanorioLogin-5XFN3YEE.js +2 -0
  25. package/dist/KanorioLogin-AJHHVQGV.js +2 -0
  26. package/dist/KanorioMedia-ADKUDH5C.js +2 -0
  27. package/dist/KanorioMedia-DLBSXCKA.js +2 -0
  28. package/dist/KanorioReviews-42FZSXTI.js +2 -0
  29. package/dist/KanorioReviews-7LD5WKFG.js +2 -0
  30. package/dist/KanorioUnit-NWBX5DEI.js +2 -0
  31. package/dist/KanorioUnit-SIM3344J.js +2 -0
  32. package/dist/MediaPlayer-F43FPK4E.js +2 -0
  33. package/dist/MediaPlayer-JHFZFOOG.js +2 -0
  34. package/dist/{PDFViewerFull-KMUVT2BL.js → PDFViewerFull-CB44M7GW.js} +3 -3
  35. package/dist/{PDFViewerFull-FBLYNUDX.js → PDFViewerFull-INVHZL4V.js} +2 -2
  36. package/dist/VideoPlayer-FWZF4DQK.js +2 -0
  37. package/dist/VideoPlayer-LNS7XJ4C.js +2 -0
  38. package/dist/account.d.ts +165 -0
  39. package/dist/account.js +2 -0
  40. package/dist/analytics.d.ts +44 -0
  41. package/dist/analytics.js +2 -0
  42. package/dist/bot-protection.d.ts +297 -0
  43. package/dist/bot-protection.js +2 -0
  44. package/dist/chunk-2E6RCDAA.js +2 -0
  45. package/dist/chunk-2FSD3N7F.js +6 -0
  46. package/dist/chunk-2J5XQK4H.js +2 -0
  47. package/dist/chunk-2LOQXVFI.js +2 -0
  48. package/dist/chunk-2ONAW3CA.js +2 -0
  49. package/dist/chunk-33AQQY6T.js +69 -0
  50. package/dist/chunk-36YEGBKK.js +2 -0
  51. package/dist/chunk-4BBERZ6T.js +2 -0
  52. package/dist/chunk-4BEKWYEW.js +2 -0
  53. package/dist/chunk-4DPSNQEI.js +2 -0
  54. package/dist/chunk-4KA3HSRQ.js +2 -0
  55. package/dist/chunk-4MOCTNN7.js +2 -0
  56. package/dist/chunk-5AUWUK5R.js +2 -0
  57. package/dist/chunk-5G3PQI25.js +2 -0
  58. package/dist/chunk-5HWAL7VK.js +2 -0
  59. package/dist/chunk-63XJWMJG.js +2 -0
  60. package/dist/chunk-66XN5RR4.js +2 -0
  61. package/dist/chunk-6RZBXZFP.js +2 -0
  62. package/dist/chunk-763LNERD.js +2 -0
  63. package/dist/chunk-7XWBVRXP.js +15 -0
  64. package/dist/chunk-A4DPHHAP.js +42 -0
  65. package/dist/chunk-AF46NLXK.js +2 -0
  66. package/dist/chunk-AFNEGNVJ.js +2 -0
  67. package/dist/chunk-AQ6F6MIJ.js +2 -0
  68. package/dist/chunk-ARU5PTJV.js +2 -0
  69. package/dist/chunk-B7KLKVIM.js +2 -0
  70. package/dist/chunk-BGVTMWPN.js +2 -0
  71. package/dist/chunk-BKNL7ZCI.js +2 -0
  72. package/dist/chunk-BU7KUHZK.js +8 -0
  73. package/dist/chunk-C7HUM2EN.js +2 -0
  74. package/dist/chunk-CU2JJTXI.js +2 -0
  75. package/dist/{chunk-5U2SZE3H.js → chunk-CUQUEGX2.js} +2 -2
  76. package/dist/chunk-D7K3YCBR.js +2 -0
  77. package/dist/chunk-DLJDYXKL.js +2 -0
  78. package/dist/chunk-DTBRUBPG.js +2 -0
  79. package/dist/chunk-E77WGXYW.js +2 -0
  80. package/dist/chunk-EE4S6NRV.js +3 -0
  81. package/dist/chunk-ET57PWXC.js +2 -0
  82. package/dist/chunk-EZMTUAQX.js +2 -0
  83. package/dist/chunk-FFAWYDLJ.js +2 -0
  84. package/dist/chunk-FQCA2VGY.js +2 -0
  85. package/dist/chunk-FSY5GB5E.js +3 -0
  86. package/dist/chunk-G4U6BFZY.js +2 -0
  87. package/dist/chunk-GJY6AQIS.js +2 -0
  88. package/dist/chunk-GMW7AUSG.js +2 -0
  89. package/dist/chunk-GZCED6V3.js +2 -0
  90. package/dist/chunk-H2XQYT62.js +2 -0
  91. package/dist/chunk-H7VP4BYY.js +2 -0
  92. package/dist/chunk-HFYLTH5B.js +2 -0
  93. package/dist/chunk-IAXVJLJ3.js +2 -0
  94. package/dist/chunk-IXDKZO42.js +2 -0
  95. package/dist/chunk-J37D44SX.js +2 -0
  96. package/dist/chunk-JH5D6YJX.js +2 -0
  97. package/dist/chunk-JREL5347.js +2 -0
  98. package/dist/chunk-K2XZKV3Q.js +2 -0
  99. package/dist/chunk-K4VRRKYJ.js +2 -0
  100. package/dist/chunk-KBKDMTYF.js +2 -0
  101. package/dist/chunk-KDNGDR64.js +2 -0
  102. package/dist/chunk-KNNN5V3T.js +2 -0
  103. package/dist/chunk-LWKCGUHS.js +2 -0
  104. package/dist/chunk-LWRWKZBC.js +2 -0
  105. package/dist/chunk-LXNMHQFN.js +2 -0
  106. package/dist/chunk-MC63CLSM.js +2 -0
  107. package/dist/chunk-MIQK3T3Y.js +2 -0
  108. package/dist/chunk-MQ7PBFUM.js +4 -0
  109. package/dist/chunk-MWPRTK32.js +2 -0
  110. package/dist/chunk-MXGMJAWS.js +2 -0
  111. package/dist/chunk-N4BGAMWD.js +2 -0
  112. package/dist/chunk-N5PIQM4L.js +3 -0
  113. package/dist/chunk-NBDRYQZV.js +2 -0
  114. package/dist/chunk-NGRNPVON.js +2 -0
  115. package/dist/chunk-NSY72ZYX.js +15 -0
  116. package/dist/chunk-O2SYHUQF.js +2 -0
  117. package/dist/chunk-OIKRLEW6.js +2 -0
  118. package/dist/chunk-OTK4YNSG.js +2 -0
  119. package/dist/chunk-OU4IOHLN.js +15 -0
  120. package/dist/chunk-PR2NRUEI.js +2 -0
  121. package/dist/chunk-QGR3QAQB.js +3 -0
  122. package/dist/chunk-QOQQCCID.js +2 -0
  123. package/dist/chunk-RG5JA44V.js +2 -0
  124. package/dist/chunk-RKEHHJDU.js +2 -0
  125. package/dist/chunk-S2NFWI7C.js +69 -0
  126. package/dist/chunk-S7FE2XRA.js +2 -0
  127. package/dist/chunk-SUXTLVTX.js +2 -0
  128. package/dist/chunk-SVWEVSYJ.js +2 -0
  129. package/dist/chunk-TEUQV3AT.js +2 -0
  130. package/dist/chunk-U7H3W23Q.js +2 -0
  131. package/dist/chunk-U7KVGD47.js +2 -0
  132. package/dist/chunk-UIHBR4NU.js +3 -0
  133. package/dist/chunk-UM74DXPE.js +2 -0
  134. package/dist/chunk-VKSYPXNL.js +2 -0
  135. package/dist/chunk-VUTODQFX.js +2 -0
  136. package/dist/chunk-VYSRVTYI.js +2 -0
  137. package/dist/chunk-W32ZFOPN.js +2 -0
  138. package/dist/chunk-W63RJF6Q.js +2 -0
  139. package/dist/chunk-WM5S3YN5.js +2 -0
  140. package/dist/chunk-WP7UEAIB.js +2 -0
  141. package/dist/chunk-WXIUWMFR.js +2 -0
  142. package/dist/chunk-Z4A5NQWJ.js +2 -0
  143. package/dist/chunk-Z4OV6QHI.js +2 -0
  144. package/dist/curriculum.d.ts +20 -0
  145. package/dist/curriculum.js +2 -0
  146. package/dist/deliverables-BDS7WMBC.js +99 -0
  147. package/dist/deliverables-C5RD2ASE.js +131 -0
  148. package/dist/elements.css +1 -1
  149. package/dist/events-CJeBru-H.d.ts +11 -0
  150. package/dist/form.d.ts +775 -0
  151. package/dist/form.js +2 -0
  152. package/dist/forms-answers-address-7P6EVFY5.js +2 -0
  153. package/dist/forms-answers-address-IQV2Y56H.js +2 -0
  154. package/dist/forms-answers-phone-2VZ46OME.js +2 -0
  155. package/dist/forms-answers-phone-5PUB5WKD.js +2 -0
  156. package/dist/forms-answers-tax-id-D4GOUC6N.js +2 -0
  157. package/dist/forms-answers-tax-id-WJD7K3PG.js +2 -0
  158. package/dist/index.d.ts +17 -3045
  159. package/dist/index.js +1 -1
  160. package/dist/kanorio-elements.js +9 -73
  161. package/dist/lightbox-DEvsB5dB.d.ts +100 -0
  162. package/dist/lightbox.d.ts +5 -0
  163. package/dist/lightbox.js +2 -0
  164. package/dist/login.d.ts +14 -0
  165. package/dist/login.js +2 -0
  166. package/dist/media.d.ts +85 -0
  167. package/dist/media.js +2 -0
  168. package/dist/phone-input-Q5AV6KSW.js +2 -0
  169. package/dist/phone-input-T6QX2TDS.js +2 -0
  170. package/dist/provider-CMLzyAjJ.d.ts +1277 -0
  171. package/dist/provider.d.ts +4 -0
  172. package/dist/provider.js +2 -0
  173. package/dist/reviews.d.ts +42 -0
  174. package/dist/reviews.js +2 -0
  175. package/dist/unit.d.ts +118 -0
  176. package/dist/unit.js +2 -0
  177. package/dist/{vidstack-BmcqUMKx-XYI2YLUH.js → vidstack-BmcqUMKx-FXVV4FRB.js} +2 -2
  178. package/dist/{vidstack-GkTzay8D-PBE5ZIYA.js → vidstack-GkTzay8D-53C3FRCO.js} +2 -2
  179. package/dist/web-components.d.ts +13 -1
  180. package/dist/web-components.js +1 -1
  181. package/dist/wire-ofSodpi1.d.ts +176 -0
  182. package/package.json +46 -2
  183. package/dist/MediaPlayer-7IBSXL7Q.js +0 -2
  184. package/dist/MediaPlayer-HTXF4T2V.js +0 -2
  185. package/dist/chunk-2UVUNYL6.js +0 -2
  186. package/dist/chunk-3OGF7I4H.js +0 -2
  187. package/dist/chunk-5AWUTOK7.js +0 -2
  188. package/dist/chunk-DTDUK36B.js +0 -8
  189. package/dist/chunk-JZXJO62T.js +0 -15
  190. package/dist/chunk-LLHBSWTL.js +0 -2
  191. package/dist/chunk-NOCGHD2O.js +0 -2
  192. package/dist/chunk-S4ZA2INU.js +0 -415
  193. package/dist/chunk-TLBIYET7.js +0 -404
  194. package/dist/chunk-TLRFFLH4.js +0 -94
  195. package/dist/chunk-U3U5KVR6.js +0 -2
  196. package/dist/chunk-UBMXRFSK.js +0 -4
  197. package/dist/deliverables-FBCRGMTB.js +0 -93
  198. package/dist/deliverables-FMKPDHJH.js +0 -92
@@ -1,93 +0,0 @@
1
- import{a as xr,b as vr,c as Tr,d as Cr,e as Sr}from"./chunk-UBMXRFSK.js";import"./chunk-DXTWCLOM.js";import"./chunk-V4OWPVBD.js";import{B as Or,D as Mr,E as Lr,F as we,G as Br,H as zr,I as qr,J as v,K as Zn,a as Rr,b as ie,i as Ve,j as Ke,k as He,l as Re,m as Pr,n as Er,o as Ir,p as _r,q as yt,r as Dr,s as Pe,t as Qe,u as ae,v as le,w as Ur}from"./chunk-TLRFFLH4.js";import{b as kr,k as wr,z as Nr}from"./chunk-5AWUTOK7.js";import{r as ht,y as Ar}from"./chunk-JZXJO62T.js";import{Aa as ft,Ae as fr,Cb as ur,Ee as br,Fd as mr,Gd as gr,Ha as ve,Ja as lr,Kb as Fe,Na as cr,Oa as dr,Pc as bt,Tc as pr,a as w,hg as hr,l as sr,ng as c,oe as $e,pg as yr,q as qe,vb as ke,wa as or,za as xe}from"./chunk-S4ZA2INU.js";import{a as ye}from"./chunk-6LGTFWQS.js";import{c as h}from"./chunk-CDG7S4P5.js";var u=h(ye());var Z=h(ye());var x=h(w()),Ne="border-[var(--site-border,rgba(0,0,0,0.1))]",ei="bg-[var(--site-surface,#ffffff)]",J="text-[var(--site-fg-muted,#71717a)]",ce="text-[var(--site-fg,#18181b)]",Ge="inline-flex min-h-9 items-center rounded-full border px-3 text-xs";function ti(t,r){return t.replace(/\{(\w+)\}/g,(e,i)=>String(r[i]??""))}function ri(t){let r=Math.max(0,Math.floor(t)),e=Math.floor(r/3600),i=Math.floor(r%3600/60),l=r%60,s=e>0?String(i).padStart(2,"0"):String(i);return`${e>0?`${e}:`:""}${s}:${String(l).padStart(2,"0")}`}function ni(t,r){try{return new Intl.DisplayNames([r],{type:"language"}).of(t)??t}catch{return t}}function Fr(t,r){let e=0,i=t.length-1,l=-1;for(;e<=i;){let s=e+i>>1;t[s].s<=r?(l=s,e=s+1):i=s-1}return l}function ii(t,r){if(!r)return t;let e=t.toLowerCase(),i=r.toLowerCase(),l=[],s=0;for(;;){let d=e.indexOf(i,s);if(d===-1)break;d>s&&l.push(t.slice(s,d)),l.push((0,x.jsx)("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-inherit dark:bg-yellow-500/40",children:t.slice(d,d+i.length)},d)),s=d+i.length}return s<t.length&&l.push(t.slice(s)),l}function $r({labels:t,open:r,onToggle:e,status:i,data:l,activeIndex:s,onSeek:d,onLocaleChange:m,onRetry:C,uiLocale:S,fileName:B,className:te}){let[ue,M]=(0,Z.useState)(""),[z,pe]=(0,Z.useState)(!0),q=(0,Z.useRef)(null),K=ue.trim(),N=(0,Z.useMemo)(()=>{if(!l||!K)return null;let g=K.toLowerCase();return l.segments.map((y,R)=>y.t.toLowerCase().includes(g)?R:-1).filter(y=>y>=0)},[l,K]),j=N??(l?l.segments.map((g,y)=>y):[]);(0,Z.useEffect)(()=>{if(!r||!z||N||s<0)return;let g=q.current,y=g?.querySelector(`[data-index="${s}"]`);if(!g||!y)return;let R=y.offsetTop-g.offsetTop,I=R+y.offsetHeight;(R<g.scrollTop||I>g.scrollTop+g.clientHeight)&&g.scrollTo({top:Math.max(0,R-g.clientHeight/3),behavior:"smooth"})},[s,r,z,N]);let f=()=>{if(!l)return;let g=new Blob([l.segments.map(I=>I.t).join(`
2
- `)],{type:"text/plain;charset=utf-8"}),y=URL.createObjectURL(g),R=document.createElement("a");R.href=y,R.download=`${B||"transcript"}.${l.locale}.txt`,document.body.appendChild(R),R.click(),R.remove(),setTimeout(()=>URL.revokeObjectURL(y),1e3)},F=g=>{let y=ni(g.locale,S);return g.edited?y:g.source==="ai"?ht(S,y,t.transcriptAutoGenerated):g.source==="translation"?ht(S,y,t.transcriptAutoTranslated):y};return(0,x.jsxs)("section",{className:c("rounded-[var(--site-radius-card,0.75rem)] border",Ne,ei,te),"aria-label":t.transcript,"data-kanorio-transcript":!0,children:[(0,x.jsxs)("button",{type:"button",onClick:()=>e(!r),"aria-expanded":r,className:c("flex min-h-12 w-full items-center gap-2 px-3 text-left text-sm font-semibold",ce),children:[(0,x.jsx)(Fe,{className:c("h-4 w-4 shrink-0",J),"aria-hidden":"true"}),(0,x.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.transcript}),(0,x.jsx)("span",{className:c("text-xs font-normal",J),children:r?t.transcriptHide:t.transcriptShow}),(0,x.jsx)(xe,{className:c("h-4 w-4 shrink-0 transition-transform",J,r&&"rotate-180"),"aria-hidden":"true"})]}),r&&(0,x.jsx)("div",{className:c("border-t",Ne),children:i==="loading"||i==="idle"?(0,x.jsx)("div",{className:"space-y-2 p-3","aria-busy":"true",children:[0,1,2].map(g=>(0,x.jsx)("div",{className:"h-4 animate-pulse rounded bg-black/5 dark:bg-white/10",style:{width:`${80-g*15}%`}},g))}):i==="error"||!l?(0,x.jsxs)("div",{role:"alert",className:c("flex flex-col items-center gap-2 p-6 text-center text-sm",J),children:[(0,x.jsx)("p",{children:t.loadError}),(0,x.jsxs)("button",{type:"button",onClick:C,className:c(Ge,Ne,ce),children:[(0,x.jsx)($e,{className:"mr-1 h-3.5 w-3.5","aria-hidden":"true"})," ",t.retry]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"flex flex-wrap items-center gap-2 p-3",children:[(0,x.jsxs)("label",{className:"relative min-w-40 flex-1",children:[(0,x.jsx)(fr,{className:c("pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",J),"aria-hidden":"true"}),(0,x.jsx)(Ve,{type:"search",value:ue,onChange:g=>M(g.target.value),placeholder:t.transcriptSearch,"aria-label":t.transcriptSearch,className:"h-10 pl-9"})]}),(0,x.jsx)("button",{type:"button",onClick:()=>pe(g=>!g),"aria-pressed":z,className:c(Ge,Ne,z?ce:J,z&&"bg-black/5 dark:bg-white/10"),children:t.transcriptFollow}),(0,x.jsxs)("button",{type:"button",onClick:f,className:c(Ge,Ne,ce),children:[(0,x.jsx)(ke,{className:"mr-1 h-3.5 w-3.5","aria-hidden":"true"})," ",t.transcriptDownload]})]}),l.tracks.length>1&&(0,x.jsx)("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-3",role:"group","aria-label":t.transcriptLanguage,children:l.tracks.map(g=>(0,x.jsx)("button",{type:"button",onClick:()=>m(g.locale),"aria-pressed":g.locale===l.locale,lang:g.locale,className:c(Ge,Ne,g.locale===l.locale?c(ce,"bg-black/5 dark:bg-white/10"):J),children:F(g)},g.locale))}),N&&(0,x.jsx)("p",{className:c("px-3 pb-2 text-xs",J),role:"status",children:N.length>0?ti(t.transcriptMatches,{count:N.length}):t.transcriptNoResults}),(0,x.jsx)("ol",{ref:q,className:"max-h-80 overflow-y-auto px-2 pb-2",lang:l.locale,children:j.map(g=>{let y=l.segments[g],R=g===s;return(0,x.jsx)("li",{"data-index":g,children:(0,x.jsxs)("button",{type:"button",onClick:()=>d(y.s),"aria-current":R?"true":void 0,className:c("flex w-full gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 py-1.5 text-left text-sm hover:bg-black/5 dark:hover:bg-white/10",R?c(ce,"bg-black/5 font-medium dark:bg-white/10"):ce),children:[(0,x.jsx)("span",{className:c("w-11 shrink-0 pt-0.5 font-mono text-xs tabular-nums",J),children:ri(y.s)}),(0,x.jsx)("span",{className:"min-w-0 flex-1 leading-relaxed",children:ii(y.t,K)})]})},g)})})]})})]})}function Vr(t){return t.width<768?"mobile":t.coarsePointer&&t.width<1024?"tablet":"desktop"}var un=h(ye());var Gr=h(ye());var xt=h(ye());var A=h(w());function ai(t){if(!t)return{};let r=Pr(t),e={};if(r.style)for(let l of r.style.split(";")){let s=l.indexOf(":");if(s===-1)continue;let d=l.slice(0,s).trim().replace(/-([a-z])/g,(C,S)=>S.toUpperCase()),m=l.slice(s+1).trim();d&&m&&(e[d]=m)}let i;return e.backgroundColor&&!e.color&&(e.color=e.backgroundColor.includes("--highlight-")?"var(--highlight-fg, inherit)":"var(--site-base-fg, inherit)",i="[&_a]:text-inherit"),{className:[r.className,i].filter(Boolean).join(" ")||void 0,style:r.style?e:void 0}}function Te(t,r,e={}){return(t??[]).map((i,l)=>{let s=`${r}-${l}`,d=()=>Te(i.children,s,e);if(i.type==="text")return(0,A.jsx)(xt.default.Fragment,{children:i.value},s);if(i.type==="strong")return(0,A.jsx)("strong",{children:d()},s);if(i.type==="emphasis")return(0,A.jsx)("em",{children:d()},s);if(i.type==="delete")return(0,A.jsx)("del",{children:d()},s);if(i.type==="underline")return(0,A.jsx)("u",{children:d()},s);if(i.type==="inlineCode")return(0,A.jsx)("code",{className:"bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-100 rounded px-1.5 py-0.5 font-mono text-sm",children:i.value},s);if(i.type==="inlineStyle"){let m=ai(i.params);return(0,A.jsx)("span",{className:m.className,style:m.style,children:d()},s)}if(i.type==="break")return(0,A.jsx)("br",{},s);if(i.type==="link"){if(e.link)return e.link(i,s,d());let m=i.url??"";return Ke(m)?(0,A.jsx)("a",{href:m,...He(m)?{target:"_blank",rel:"noopener noreferrer"}:{},className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] underline font-medium hover:opacity-80 break-words",children:d()},s):(0,A.jsx)("span",{children:d()},s)}return i.type==="image"?e.image?e.image(i,s):null:i.children?(0,A.jsx)(xt.default.Fragment,{children:d()},s):null})}function Kr(t,r,e){let i=t.children??[],[l,...s]=i;return l?.type==="paragraph"?(0,A.jsxs)("li",{children:[Te(l.children,r),s.length>0&&e(s)]},r):(0,A.jsx)("li",{children:e(i)},r)}function Ye(t){return(t??[]).map((r,e)=>{let i=`b-${e}`;return r.type==="paragraph"?(0,A.jsx)("p",{className:"break-words",children:Te(r.children,i)},i):r.type==="list"&&r.ordered?(0,A.jsx)("ol",{className:"list-decimal list-outside pl-6 space-y-1 break-words",children:(r.children??[]).map((l,s)=>Kr(l,`${i}-${s}`,Ye))},i):r.type==="list"?(0,A.jsx)("ul",{className:"list-disc list-outside pl-6 space-y-1 break-words",children:(r.children??[]).map((l,s)=>Kr(l,`${i}-${s}`,Ye))},i):r.type==="blockquote"?(0,A.jsx)("blockquote",{className:"border-l-4 border-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] pl-4 italic text-[var(--site-fg-muted,#71717a)]",children:Ye(r.children)},i):r.type==="code"?(0,A.jsx)("pre",{className:"bg-zinc-100 dark:bg-zinc-800 rounded-[var(--site-radius-lg,0.5rem)] p-4 font-mono text-sm leading-6 overflow-x-auto whitespace-pre-wrap text-zinc-700 dark:text-zinc-300",children:(0,A.jsx)("code",{children:r.value})},i):null})}function Hr({content:t,profile:r,className:e,blockClassName:i="space-y-2"}){if(!t)return null;let l=Re(Pe(t,r).tree,r);if(r==="inline"){let s=l.tree.children?.[0];return(0,A.jsx)(A.Fragment,{children:Te(s?.children,"i")})}return l.tree.children?.length?(0,A.jsx)("div",{className:c("site-body-text break-words min-w-0",i,e),children:Ye(l.tree.children)}):null}var k=h(w());function Yr(t){return t?t.type==="text"?t.value??"":(t.children??[]).map(Yr).join(""):""}var si={link(t,r,e){let i=t.url??"";return Ke(i)?(0,k.jsx)("a",{href:i,className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] underline font-medium hover:opacity-80",...He(i)?{target:"_blank",rel:"noopener noreferrer"}:{},children:e},r):(0,k.jsx)("span",{className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] font-medium",children:e},r)},image(t,r){let e=t.data?.hProperties?.["data-size"],i=t.data?.hProperties?.["data-align"],l={size:Er(e)?e:yt.size,align:Ir(i)?i:yt.align};return(0,k.jsx)(Qe,{src:t.url??"",responsive:!0,explicitAlt:t.alt??void 0,altType:"article-image",title:t.title??void 0,className:`block rounded-[var(--site-radius-media)] my-5 h-auto ${Dr(l)}`},r)}};function se(t,r){return Te(t,r,si)}function oi(t,r){let e=t.children??[],[i,...l]=e;return(0,k.jsxs)("table",{children:[i&&(0,k.jsx)("thead",{children:(0,k.jsx)("tr",{children:(i.children??[]).map((s,d)=>(0,k.jsx)("th",{children:se(s.children,`${r}-h-${d}`)},d))})}),(0,k.jsx)("tbody",{children:l.map((s,d)=>(0,k.jsx)("tr",{children:(s.children??[]).map((m,C)=>(0,k.jsx)("td",{children:se(m.children,`${r}-${d}-${C}`)},C))},d))})]},r)}function Qr(t,r,e){return t.map((i,l)=>{let s=`${r}-${l}`,d=typeof i.checked=="boolean",m=(i.children??[]).flatMap(S=>S.type==="paragraph"?S.children??[]:[]),C=(i.children??[]).filter(S=>S.type!=="paragraph");return d?(0,k.jsxs)("li",{className:"flex items-start gap-2",children:[(0,k.jsx)("span",{role:"checkbox","aria-checked":i.checked??!1,"aria-disabled":"true",className:"mt-1.5 inline-block size-4 shrink-0 rounded-sm border text-center text-xs leading-4 "+Mr,children:i.checked?"\u2713":""}),(0,k.jsx)("span",{children:se(m,s)})]},s):(0,k.jsxs)("li",{children:[se(m,s),C.length>0&&vt(C,e)]},s)})}function vt(t,r){return(t??[]).map((e,i)=>{let l=`a-${i}`;if(e.type==="paragraph")return(0,k.jsx)("p",{className:`${ae.body} mb-4 ${le}`,children:se(e.children,l)},l);if(e.type==="heading"){let s=e.depth===1?2:e.depth??2,d=r(Yr(e)),m=`h${s}`,C=`h${s}`,S=s<=3?`${ae[C]} ${s===2?"mt-8 mb-4":"mt-6 mb-3"} text-[var(--site-fg,#18181b)] scroll-mt-24`:`${ae[C]} mt-5 mb-2 text-[var(--site-fg,#18181b)]`;return(0,k.jsx)(m,{id:d,className:S,children:se(e.children,l)},l)}if(e.type==="list"&&e.ordered)return(0,k.jsx)("ol",{className:`list-decimal list-outside pl-6 space-y-2 my-5 ${ae.body} ${le}`,children:Qr(e.children??[],l,r)},l);if(e.type==="list"){let s=(e.children??[]).some(d=>typeof d.checked=="boolean");return(0,k.jsx)("ul",{className:s?`list-none pl-0 space-y-2 my-5 ${ae.body} ${le}`:`list-disc list-outside pl-6 space-y-2 my-5 ${ae.body} ${le}`,children:Qr(e.children??[],l,r)},l)}return e.type==="blockquote"?(0,k.jsx)("blockquote",{className:`border-l-4 border-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] pl-4 italic ${ae.body} text-[var(--site-fg-muted,#71717a)] my-5`,children:vt(e.children,r)},l):e.type==="code"?(0,k.jsx)("pre",{className:"bg-zinc-100 dark:bg-zinc-800 rounded-[var(--site-radius-lg)] p-4 font-mono text-sm leading-6 my-5 overflow-x-auto whitespace-pre-wrap text-zinc-700 dark:text-zinc-300",children:(0,k.jsx)("code",{children:e.value})},l):e.type==="thematicBreak"?(0,k.jsx)("hr",{className:"my-6 border-[var(--site-border,#e4e4e7)]"},l):e.type==="table"?oi(e,l):e.type==="image"||e.type==="link"?(0,k.jsx)(Gr.default.Fragment,{children:se([e],l)},l):null})}function jr({content:t}){let e=Re(Pe(t,"article").tree,"article").tree.children?.find(i=>i.type==="paragraph");return(0,k.jsx)(k.Fragment,{children:se(e?.children,"ai")})}function Ee(t,r){let e=Re(Pe(t,"article").tree,"article");return e.tree.children?.length?(0,k.jsx)(k.Fragment,{children:vt(e.tree.children,r)}):null}function je({content:t,assignId:r}){return(0,k.jsx)(k.Fragment,{children:Ee(t,r)})}var Ie={container:"site-card-scope rounded-[var(--site-radius-card)] bg-zinc-100 dark:bg-zinc-800 p-8 shadow-lg text-center",content:"text-zinc-700 dark:text-zinc-200 leading-relaxed [&_p]:my-1.5 [&_strong]:text-zinc-900 dark:[&_strong]:text-zinc-50 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:text-left [&_ul]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:text-left [&_ol]:my-2 [&_a]:text-[var(--brand-text,var(--brand-color))] [&_a]:underline",contentSpacing:"mb-6",button:"inline-flex items-center justify-center gap-2 rounded-[var(--site-radius-button)] bg-[var(--brand-color)] px-6 @vp-md/article:px-8 py-3 min-h-[44px] text-base font-bold text-[var(--brand-foreground)] shadow-md transition-all duration-200 hover:scale-[1.02] hover:shadow-lg active:scale-[0.98]"};var Ae=h(w());function Xr({config:t,presets:r}){let e,i;if(t.type==="preset"){let m=t.slug?r?.[t.slug]:void 0;m&&(e=m.label,i=m.href)}else e=t.buttonText,i=t.href;let l=!!t.content?.trim(),s=!!(e&&i);if(!l&&!s)return null;let d=i?/^https?:\/\//.test(i):!1;return(0,Ae.jsxs)("div",{className:Ie.container,children:[l&&(0,Ae.jsx)("div",{className:`${Ie.content}${s?` ${Ie.contentSpacing}`:""}`,children:(0,Ae.jsx)(je,{content:t.content,assignId:we()})}),s&&i&&(0,Ae.jsx)("a",{href:i,className:Ie.button,"data-cta-track":"","data-cta-button-name":e,"data-cta-element-id":"blog-article-cta",...d?{target:"_blank",rel:"noopener noreferrer"}:{},children:e})]})}var $=h(w());function Wr({config:t}){if(t.items.length===0)return null;let r=we();return(0,$.jsxs)("section",{className:"my-6 space-y-4",children:[t.title&&(0,$.jsx)("h2",{className:"text-2xl font-bold text-[var(--site-fg,#18181b)] mb-2",children:t.title}),t.items.map((e,i)=>(0,$.jsxs)("div",{className:"my-4",children:[(0,$.jsxs)("div",{className:"flex items-start gap-2 text-[var(--site-fg,#18181b)]",children:[(0,$.jsx)("span",{className:"shrink-0 mt-0.5 w-5 h-5 rounded bg-emerald-100 dark:bg-emerald-900/40 flex items-center justify-center text-emerald-700 dark:text-emerald-300 text-[10px] font-bold",children:"Q"}),(0,$.jsx)("span",{className:"flex-1 min-w-0",children:(0,$.jsx)(jr,{content:e.question})})]}),(0,$.jsxs)("div",{className:"mt-1 flex items-start gap-2",children:[(0,$.jsx)("span",{className:"shrink-0 mt-0.5 w-5 h-5 rounded bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center text-blue-700 dark:text-blue-300 text-[10px] font-bold",children:"A"}),(0,$.jsx)("div",{className:"flex-1 min-w-0 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:(0,$.jsx)(je,{content:e.answer,assignId:r})})]})]},i))]})}var oe=h(w());function Jr({url:t,embedType:r}){let{ui:e}=yr(),i=ie({url:t});if(Br(t))return(0,oe.jsx)("div",{className:"my-6 not-prose",children:(0,oe.jsx)(xr,{src:t,hlsSrc:i?.hls,thumbnails:i?.thumbnails,streamingPartial:i?.streamingPartial,captions:i?.captions,chapters:i?.chapters,storageKey:t,poster:i?.cover})});let l=zr(t,r);return l?(0,oe.jsx)("div",{className:"my-6 rounded-[var(--site-radius-media)] overflow-hidden",children:(0,oe.jsx)("div",{className:"aspect-video bg-zinc-900",children:(0,oe.jsx)("iframe",{src:l,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy"})})}):(0,oe.jsx)("div",{className:"my-6 p-4 rounded-[var(--site-radius-media)] border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50",children:(0,oe.jsx)("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:kr(e.embedLoadFailed,{url:t})})})}var kt=h(w());function Zr({src:t,title:r}){let e=r||t.split("/").pop()?.replace(/\.[^.]+$/,"")||"",i=ie({url:t});return(0,kt.jsx)("div",{className:"my-6 not-prose",children:(0,kt.jsx)(vr,{src:t,title:e,storageKey:t,coverImage:i?.cover,captions:i?.captions,chapters:i?.chapters})})}var wt=h(w());function Nt(t,r,e,i){if(!r)return"";let l=`${t??""}/api/public/sites/${encodeURIComponent(r)}/assets/${encodeURIComponent(e)}/download`;return i?`${l}?name=${encodeURIComponent(i)}`:l}function en({assetId:t,name:r,size:e,mimeType:i,apiBase:l,websiteId:s}){let d=ie({assetId:t}),m=wr(r,d);return(0,wt.jsx)("div",{className:"my-6 not-prose",children:(0,wt.jsx)(Cr,{name:m,size:d?.size??e,mimeType:d?.mime??i,href:Nt(l,s,t,m)})})}var Tt=h(w());function tn({src:t,title:r,pageCount:e,thumbnailUrl:i,assetId:l,display:s,apiBase:d,websiteId:m}){let C=ie({url:t,assetId:l}),{protection:S}=Nr(),B=r||t.split("/").pop()?.replace(/\.[^.]+$/,"")||void 0,te=l&&Nt(d,m,l,B)||t;return(0,Tt.jsx)("div",{className:"my-6 not-prose",children:(0,Tt.jsx)(Tr,{src:t,thumbnailUrl:C?.cover??i,thumbnailAlt:B,fileName:B,pageCount:C?.pages??e,allowDownload:S.allowDownload,downloadUrl:te,variant:s==="card"?"card":"preview"})})}var an=h(ye());var nn=h(w());function rn({content:t}){return(0,nn.jsx)(Hr,{content:t,profile:"inline"})}var ee=h(w());function sn({title:t,children:r,defaultOpen:e=!0}){let[i,l]=(0,an.useState)(e);return(0,ee.jsxs)("div",{className:"toggle-block my-4",children:[(0,ee.jsxs)("button",{type:"button",onClick:()=>l(!i),className:"flex items-start gap-1 w-full text-left",children:[(0,ee.jsx)("span",{className:"shrink-0 mt-1 p-0.5 rounded transition-colors "+Or,children:(0,ee.jsx)(xe,{className:`w-4 h-4 ${Ur} transition-transform ${i?"":"-rotate-90"}`})}),(0,ee.jsx)("span",{className:"flex-1 min-w-0 "+le,children:(0,ee.jsx)(rn,{content:t})})]}),i&&(0,ee.jsx)("div",{className:"pl-6 [&>*:last-child]:mb-0",children:r})]})}var At=h(w());function on({config:t}){return t.items.length===0?null:(0,At.jsx)("div",{className:`my-5 grid items-start gap-3 ${_r[t.cols]}`,"data-gallery-cols":t.cols,children:t.items.map((r,e)=>(0,At.jsx)(Qe,{src:r.src,responsive:!0,sizes:`(min-width: 1024px) ${Math.round(60/t.cols)}vw, (min-width: 640px) ${Math.round(100/t.cols)}vw, 100vw`,alt:r.alt,className:"block h-auto w-full rounded-[var(--site-radius-media)]"},`${r.src}-${e}`))})}var Xe=h(w()),ln={info:"var(--brand-color, #2563eb)",tip:"#16a34a",warning:"#d97706",danger:"#dc2626"};function cn({tone:t,title:r,children:e}){let i={borderRadius:"var(--site-radius-card, 12px)",borderLeft:`4px solid ${ln[t]}`,background:"var(--site-card-bg, color-mix(in srgb, currentColor 6%, transparent))"};return(0,Xe.jsxs)("aside",{className:"callout-block site-card-scope my-6 px-5 py-4 [&>*:last-child]:mb-0","data-callout-tone":t,style:i,children:[r&&(0,Xe.jsx)("p",{className:"mb-1.5 font-semibold",style:{color:ln[t]},children:r}),e]})}var U=h(w());function li(t){let r=[];for(let e of t){let i=r[r.length-1];e.type==="faq"&&i&&i.type==="faq"?r[r.length-1]={type:"faq",config:{title:i.config.title,items:[...i.config.items,...e.config.items]}}:r.push(e)}return r}var dn=`
3
- --highlight-yellow: rgb(113, 63, 18);
4
- --highlight-green: rgb(20, 83, 45);
5
- --highlight-blue: rgb(30, 58, 138);
6
- --highlight-pink: rgb(131, 24, 67);
7
- --highlight-orange: rgb(124, 45, 18);
8
- --highlight-purple: rgb(76, 29, 149);
9
- --highlight-fg: rgb(250, 250, 250);
10
- `,ci=`
11
- .article-body {
12
- --highlight-yellow: rgb(254, 249, 195);
13
- --highlight-green: rgb(187, 247, 208);
14
- --highlight-blue: rgb(191, 219, 254);
15
- --highlight-pink: rgb(251, 207, 232);
16
- --highlight-orange: rgb(254, 215, 170);
17
- --highlight-purple: rgb(221, 214, 254);
18
- --highlight-fg: rgb(24, 24, 27);
19
- }
20
- /* Dark set by hand (account theme) and sites fixed to dark */
21
- .dark .article-body,
22
- html:has(.site-renderer-root[data-color-scheme="dark"]) .article-body {
23
- ${dn}
24
- }
25
- /* Sites fixed to light: force the light variables over an outer html.dark */
26
- html:has(.site-renderer-root[data-color-scheme="light"]) .article-body {
27
- --highlight-yellow: rgb(254, 249, 195);
28
- --highlight-green: rgb(187, 247, 208);
29
- --highlight-blue: rgb(191, 219, 254);
30
- --highlight-pink: rgb(251, 207, 232);
31
- --highlight-orange: rgb(254, 215, 170);
32
- --highlight-purple: rgb(221, 214, 254);
33
- --highlight-fg: rgb(24, 24, 27);
34
- }
35
- @media (prefers-color-scheme: dark) {
36
- /* Follow the system setting, except on sites fixed to light */
37
- html.system:not(:has(.site-renderer-root[data-color-scheme="light"])) .article-body {
38
- ${dn}
39
- }
40
- }
41
- `,di=`
42
- .article-body table {
43
- border-collapse: separate;
44
- border-spacing: 0;
45
- width: 100%;
46
- table-layout: auto;
47
- margin: 1.5rem 0;
48
- border: 1px solid var(--site-border, rgb(228 228 231));
49
- border-radius: var(--site-radius-xl, 12px);
50
- overflow: hidden;
51
- }
52
- .article-body thead, .article-body tbody tr { border: 0; }
53
- .article-body th, .article-body td {
54
- border-right: 1px solid var(--site-border, rgb(228 228 231));
55
- border-bottom: 1px solid var(--site-border, rgb(228 228 231));
56
- padding: 0.5rem 0.75rem;
57
- text-align: left;
58
- vertical-align: top;
59
- min-width: 4rem;
60
- font-size: 0.95rem;
61
- line-height: 1.6;
62
- }
63
- /* Header tint is mixed from the surrounding text colour and the cell text is inherited: a fixed light background would not follow
64
- the section surface (white links on light grey on a brand surface) or a system-level dark mode. */
65
- .article-body th {
66
- font-weight: inherit;
67
- background: color-mix(in srgb, var(--site-fg, rgb(24 24 27)) 6%, transparent);
68
- }
69
- .article-body th:last-child, .article-body td:last-child { border-right: 0; }
70
- .article-body tr:last-child td, .article-body tr:last-child th { border-bottom: 0; }
71
- /* The four corner cells carry the radius themselves, so the background cannot spill where overflow:hidden on a table is unreliable.
72
- Top corners match th/td; bottom corners match td only, so a thead row is not rounded by mistake. */
73
- .article-body tr:first-child th:first-child, .article-body tr:first-child td:first-child { border-top-left-radius: calc(var(--site-radius-xl, 12px) - 1px); }
74
- .article-body tr:first-child th:last-child, .article-body tr:first-child td:last-child { border-top-right-radius: calc(var(--site-radius-xl, 12px) - 1px); }
75
- .article-body tr:last-child td:first-child { border-bottom-left-radius: calc(var(--site-radius-xl, 12px) - 1px); }
76
- .article-body tr:last-child td:last-child { border-bottom-right-radius: calc(var(--site-radius-xl, 12px) - 1px); }
77
- /* An empty cell keeps one line of height (same as the editor's empty paragraph; the row does not collapse) */
78
- .article-body th:empty::after, .article-body td:empty::after {
79
- content: "\\00a0";
80
- }
81
- /* <code> inside a code block gets its background from <pre>; drop the inline-code styles it would repeat */
82
- .article-body pre code {
83
- background: transparent;
84
- padding: 0;
85
- border-radius: 0;
86
- font-size: inherit;
87
- }
88
- /* An empty code block keeps one line of height */
89
- .article-body pre:empty::after, .article-body pre code:empty::after {
90
- content: "\\00a0";
91
- }
92
- `;function pn({content:t,ctaPresets:r,apiBase:e,websiteId:i}){let l=li(Lr(t)),s=we();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("style",{dangerouslySetInnerHTML:{__html:`${ci}${di}`}}),(0,U.jsx)("div",{className:"article-body max-w-none [&>*:first-child]:mt-0 [&>*:first-child>*:first-child]:mt-0",children:l.map((d,m)=>d.type==="cta"?(0,U.jsx)(Xr,{config:d.config,presets:r},m):d.type==="faq"?(0,U.jsx)(Wr,{config:d.config},m):d.type==="embed"?(0,U.jsx)(Jr,{url:d.config.url,embedType:d.config.embedType},m):d.type==="audio"?(0,U.jsx)(Zr,{src:d.config.src,title:d.config.title},m):d.type==="pdf"?(0,U.jsx)(tn,{src:d.config.src,title:d.config.title,pageCount:d.config.pageCount,thumbnailUrl:d.config.thumbnailUrl,assetId:d.config.assetId,display:d.config.display,apiBase:e,websiteId:i},m):d.type==="file"?(0,U.jsx)(en,{assetId:d.config.assetId,name:d.config.name,size:d.config.size,mimeType:d.config.mimeType,apiBase:e,websiteId:i},m):d.type==="gallery"?(0,U.jsx)(on,{config:d.config},m):d.type==="toggle"?(0,U.jsx)(sn,{title:d.config.title,children:Ee(d.config.content,s)},m):d.type==="callout"?(0,U.jsx)(cn,{tone:d.config.tone,title:d.config.title,children:Ee(d.config.content,s)},m):(0,U.jsx)(un.Fragment,{children:Ee(d.value,s)},m))})]})}var ui=["youtube","vimeo","loom"],Qa=v.object({provider:v.enum(ui),id:v.string().trim().min(1).max(128)}),pi=v.object({enabled:v.boolean().default(!1),title:v.string().trim().max(120).nullable().default(null),signatureName:v.string().trim().max(80).nullable().default(null),signatureTitle:v.string().trim().max(80).nullable().default(null),signatureAssetId:v.string().trim().min(1).nullable().default(null),showLogo:v.boolean().default(!0),note:v.string().trim().max(160).nullable().default(null),backgroundAssetId:v.string().trim().min(1).nullable().default(null),backgroundOverlay:v.boolean().default(!1)}),mi={enabled:!1,title:null,signatureName:null,signatureTitle:null,signatureAssetId:null,showLogo:!0,note:null,backgroundAssetId:null,backgroundOverlay:!1};var gi=v.discriminatedUnion("type",[v.object({type:v.literal("all_units")}),v.object({type:v.literal("percent"),percent:v.number().int().min(1).max(100)}),v.object({type:v.literal("quiz_passed"),unitId:v.string().trim().min(1)})]),fi=v.object({completionRule:gi.default({type:"all_units"}),certificate:pi.default(mi),comments:v.object({enabled:v.boolean().default(!1),threaded:v.boolean().default(!0),requireReview:v.boolean().default(!0),reactions:v.boolean().default(!1)}).default({enabled:!1,threaded:!0,requireReview:!0,reactions:!1}),requireSequential:v.boolean().default(!1),mediaCompletionPercent:v.number().int().min(50).max(100).multipleOf(5).default(90)}),Ga=fi.parse({});var Ya=512*1024;var ja=v.string().trim().min(1).max(80).regex(/^[a-z0-9][a-z0-9-]*$/,"Feature keys may only contain lowercase letters, digits and hyphens");function Ct(t){let r=new Map,e=null;for(let i of t.leaves){let l=i.countsTowardCompletion!==!1;e&&l&&!i.isPreview&&r.set(i.id,e),!(e||!l||t.completedUnitIds.has(i.id))&&(t.requireSequential||i.isPrerequisite)&&(e=i.id)}return r}function St(t){let r=new Map;for(let d of t){let m=r.get(d.parentId)??[];m.push(d),r.set(d.parentId,m)}let e=d=>[...d].sort((m,C)=>m.order-C.order),i=e(r.get(null)??[]),l=[],s=[];for(let d of i){let m=r.get(d.id);m&&m.length>0?l.push({chapter:d,units:e(m)}):d.kind!=="chapter"?s.push(d):l.push({chapter:d,units:[]})}return s.length>0&&l.unshift({chapter:null,units:s}),l}function bi(t){return St(t).flatMap(r=>r.units)}function Rt(t){let r=bi(t);return r.find(e=>e.access.granted&&e.progress!=="completed")??r.find(e=>e.access.granted)??null}var n=h(w()),mn="kanorio:autoplay-next",gn="kanorio:transcript-open";function hi(t){let r=(t??[]).flatMap(e=>e.kind==="captions"&&e.locale?[{locale:e.locale,url:e.url,source:e.source??"ai",edited:e.edited??!1}]:[]);return r.length>0?r:void 0}function O(t,r){return t.replace(/\{(\w+)\}/g,(e,i)=>String(r[i]??""))}function yi(t,r,e){try{return new Intl.DateTimeFormat(r??void 0,{dateStyle:"medium",timeStyle:"short",timeZone:e??void 0}).format(new Date(t))}catch{return t}}function xi(t,r,e){try{return new Intl.DateTimeFormat(r??void 0,{dateStyle:"medium",timeZone:e??void 0}).format(new Date(t))}catch{return t}}function vi(t,r){let e=/^\s*#\s+(.+?)\s*(?:\n|$)/.exec(t);return e&&r&&e[1].trim()===r.trim()?t.slice(e[0].length):t}var de="bg-[var(--site-surface,#ffffff)]",L="border-[var(--site-border,rgba(0,0,0,0.1))]",D="text-[var(--site-fg-muted,#71717a)]",Y="text-[var(--site-fg,#18181b)]",G=`inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[var(--site-radius-button,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.15))] px-3.5 text-sm ${Y} disabled:opacity-40`,fn="inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[var(--site-radius-button,0.5rem)] px-4 text-sm font-medium text-[var(--brand-foreground,#ffffff)] disabled:opacity-40",_e=`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--site-radius-button,0.5rem)] ${D} hover:bg-black/5 dark:hover:bg-white/10`;function De(t){let r=encodeURIComponent(t.id);switch(t.provider){case"youtube":return`https://www.youtube-nocookie.com/embed/${r}`;case"vimeo":return`https://player.vimeo.com/video/${r}`;case"loom":return`https://www.loom.com/embed/${r}`;default:return null}}var ki=2e4,wi=2.5,Pt=class{sessionId;runStart=null;lastTime=0;rate=1;pending=[];seekTargets=[];stallStartedAt=null;stallCount=0;stallMs=0;startupMs=null;startupSent=!1;playRequestedAt=null;rendition=null;renditionSent=null;duration=0;constructor(){this.sessionId=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`s_${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}get position(){return this.lastTime}closeRun(){this.runStart!==null&&this.lastTime-this.runStart>=.2&&this.pending.push([this.runStart,this.lastTime,this.rate]),this.runStart=null}timeUpdate(r,e){e>0&&(this.duration=e),this.runStart===null?this.runStart=r:Math.abs(r-this.lastTime)>wi&&(this.closeRun(),this.runStart=r),this.lastTime=r}event(r){switch(r.type){case"play":this.playRequestedAt===null&&this.startupMs===null&&(this.playRequestedAt=Date.now());break;case"started":this.playRequestedAt!==null&&this.startupMs===null&&(this.startupMs=Date.now()-this.playRequestedAt);break;case"pause":case"ended":this.closeRun(),this.lastTime=r.time;break;case"seeked":this.closeRun(),this.seekTargets.push(Math.floor(r.time)),this.lastTime=r.time,this.runStart=null;break;case"ratechange":this.closeRun(),this.rate=r.rate>0?r.rate:1;break;case"waiting":this.stallStartedAt===null&&(this.stallStartedAt=Date.now());break;case"playing":if(this.stallStartedAt!==null){let e=Date.now()-this.stallStartedAt;this.stallStartedAt=null,(this.startupMs!==null||this.playRequestedAt===null)&&(this.stallCount+=1,this.stallMs+=e)}break;case"quality":r.height&&(this.rendition=this.rendition===null?r.height:Math.min(this.rendition,r.height));break}}flush(r){r?this.closeRun():this.runStart!==null&&this.lastTime-this.runStart>=.2&&(this.pending.push([this.runStart,this.lastTime,this.rate]),this.runStart=this.lastTime);let e=this.stallCount>0||this.startupMs!==null&&!this.startupSent||this.rendition!==null&&this.rendition!==this.renditionSent;if(this.pending.length===0&&this.seekTargets.length===0&&!e)return null;let i={sessionId:this.sessionId,segments:this.pending,positionSeconds:this.lastTime,...this.duration>0?{durationSeconds:this.duration}:{},...this.seekTargets.length?{seekTargets:this.seekTargets}:{},...this.stallCount>0?{stallCount:this.stallCount,stallMs:this.stallMs}:{},...this.startupMs!==null&&!this.startupSent?{startupMs:this.startupMs}:{},...this.rendition!==null&&this.rendition!==this.renditionSent?{rendition:this.rendition}:{},device:Vr({width:typeof window<"u"?window.innerWidth:1280,coarsePointer:typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1})};return this.pending=[],this.seekTargets=[],this.stallCount=0,this.stallMs=0,this.startupMs!==null&&(this.startupSent=!0),this.rendition!==null&&(this.renditionSent=this.rendition),i}};function Ni({tree:t,client:r,labels:e,locale:i,timeZone:l,initialUnitId:s,onUnitChange:d,layout:m="embedded",backHref:C,backLabel:S,className:B,captionLocale:te,onCaptionChange:ue}){let M=m==="page",z=M?"header":"div",pe=M?"main":"div",q=M?"aside":"div",K=M?"nav":"div",N=t.structure==="DOWNLOAD",j=(0,u.useMemo)(()=>St(t.units),[t.units]),f=(0,u.useMemo)(()=>j.flatMap(a=>a.units),[j]),[F,g]=(0,u.useState)(()=>Object.fromEntries(t.units.map(a=>[a.id,a.progress]))),[y,R]=(0,u.useState)(t.progress),[I,Ue]=(0,u.useState)(()=>((s?t.units.find(p=>p.id===s):null)??Rt(t.units))?.id??null),o=f.find(a=>a.id===I)??null,H=o?f.findIndex(a=>a.id===o.id):-1,[P]=(0,u.useState)(()=>t.units.some(a=>a.progress!=="not_started")?Rt(t.units)?.id??null:null),[Q,Oe]=(0,u.useState)(!0),[We,Ce]=(0,u.useState)(!1),[bn,Et]=(0,u.useState)(()=>new Set),[It,hn]=(0,u.useState)(!1),[yn,xn]=(0,u.useState)(0),[Je,_t]=(0,u.useState)(null),[vn,Ze]=(0,u.useState)(!1),et=(0,u.useMemo)(()=>new Set(Object.entries(F).filter(([,a])=>a==="completed").map(([a])=>a)),[F]),tt=(0,u.useMemo)(()=>Ct({leaves:f.map(a=>({id:a.id,isPreview:a.isPreview,countsTowardCompletion:a.countsTowardCompletion,isPrerequisite:a.isPrerequisite})),completedUnitIds:et,requireSequential:!!t.settings?.requireSequential}),[f,et,t.settings?.requireSequential]),X=(0,u.useCallback)(a=>a.access.granted||a.access.reason==="prerequisite"&&!tt.has(a.id),[tt]),kn=a=>f.find(p=>p.id===(tt.get(a.id)??a.access.lockedByUnitId))?.title||"",[E,Dt]=(0,u.useState)(null),[Ut,rt]=(0,u.useState)(null),[wn,nt]=(0,u.useState)(!1),[Nn,Ot]=(0,u.useState)(!1);(0,u.useEffect)(()=>{try{Ot(window.localStorage.getItem(gn)==="1")}catch{}},[]);let Tn=a=>{Ot(a);try{window.localStorage.setItem(gn,a?"1":"0")}catch{}},[Mt,Lt]=(0,u.useState)(null),[me,Me]=(0,u.useState)({unitId:"",status:"loading",data:null}),[An,Cn]=(0,u.useState)(0),[Sn,Bt]=(0,u.useState)(-1),[Rn,Pn]=(0,u.useState)(null),zt=(0,u.useRef)([]);zt.current=me.status==="ready"&&me.data&&me.unitId===I?me.data.segments:[];let it=!!(o&&(o.kind==="video"||o.kind==="audio")&&E&&r.getTranscript);(0,u.useEffect)(()=>{if(!it||!o||!r.getTranscript)return;let a=!1,p=o.id;Me({unitId:p,status:"loading",data:null}),Bt(-1);let b=Mt??te??i??null;return r.getTranscript(p,b).then(_=>{a||(_.ok?Me({unitId:p,status:"ready",data:_}):Me({unitId:p,status:_.code==="NO_TRANSCRIPT"||_.code==="NO_FILE"?"unavailable":"error",data:null}))}).catch(()=>{a||Me({unitId:p,status:"error",data:null})}),()=>{a=!0}},[it,o?.id,Mt,An]);let ge=o&&me.unitId===o.id?me:null,En=it&&ge!==null&&(ge.status==="ready"||ge.status==="error");(0,u.useEffect)(()=>Lt(null),[I]);let[qt,at]=(0,u.useState)({}),[In,st]=(0,u.useState)(null),[_n,Ft]=(0,u.useState)(!1);(0,u.useEffect)(()=>{at({}),st(null)},[I]);let[fe,$t]=(0,u.useState)(!1);(0,u.useEffect)(()=>{try{$t(window.localStorage.getItem(mn)==="1")}catch{}},[]);let Dn=a=>{$t(a);try{window.localStorage.setItem(mn,a?"1":"0")}catch{}},[Vt,Un]=(0,u.useState)(t.certificate??null),[Kt,Ht]=(0,u.useState)(!1),Qt=async()=>{Ht(!0);try{let a=await r.getCertificate(t.id);a.ok&&(Un(p=>({enabled:!0,serial:a.certificate.serial,issuedAt:a.certificate.issuedAt,...p?{}:{}})),window.open(a.certificate.url,"_blank","noopener,noreferrer"))}finally{Ht(!1)}},ot=(0,u.useRef)(0),Le=(0,u.useRef)(null),lt=(0,u.useRef)(null),be=(0,u.useCallback)(a=>((lt.current!==a||!Le.current)&&(Le.current=new Pt,lt.current=a),Le.current),[]),Se=(0,u.useCallback)(a=>{Ue(a),Ce(!1),d?.(a)},[d]);(0,u.useEffect)(()=>{let a=o?.parentId;a&&Et(p=>{if(!p.has(a))return p;let b=new Set(p);return b.delete(a),b})},[o?.parentId,I]);let Gt=(0,u.useRef)(!!t.progress?.completed),[On,Yt]=(0,u.useState)(!1);(0,u.useEffect)(()=>{let a=!!y?.completed;a&&!Gt.current&&Yt(!0),Gt.current=a},[y?.completed]),(0,u.useEffect)(()=>{if(Dt(null),rt(null),Ze(!1),nt(!1),!o||!X(o)||!o.hasFile)return;let a=!1;return nt(!0),r.openUnit(o.id,"read").then(p=>{a||(p.ok?Dt(p):rt(p.code))}).catch(()=>{a||rt("NETWORK")}).finally(()=>{a||nt(!1)}),()=>{a=!0}},[o,r,X,yn]);let he=(0,u.useCallback)(async(a,p,b)=>{if(!N)try{let _=await r.reportProgress({unitId:a,reports:[p],...b?.lite?{lite:!0}:{}});_.ok&&(g(ne=>({...ne,[a]:_.unit})),_.deliverable&&R({percent:_.deliverable.percent,completed:_.deliverable.completed,completedAt:_.deliverable.completedAt??null}))}catch{}},[r,N]),re=(0,u.useCallback)((a,p)=>{let b=Le.current;if(!b||lt.current!==a)return;let _=b.flush(p!=="heartbeat");_&&(ot.current=Date.now(),he(a,_,{lite:p==="heartbeat"}))},[he]),Mn=(0,u.useCallback)((a,p)=>{if(!o)return;be(o.id).timeUpdate(a,p);let b=zt.current;if(b.length>0){let ne=Fr(b,a);Bt(ze=>ze===ne?ze:ne)}Date.now()-ot.current<ki||re(o.id,"heartbeat")},[o,be,re]),Ln=(0,u.useCallback)(a=>{o&&(be(o.id).event(a),(a.type==="pause"||a.type==="seeked")&&re(o.id,"event"))},[o,be,re]),Bn=(0,u.useCallback)(()=>{if(!o)return;let a=be(o.id),p=a.flush(!0)??{sessionId:a.sessionId,positionSeconds:a.position,...a.duration>0?{durationSeconds:a.duration}:{}};if(ot.current=Date.now(),he(o.id,{...p,completed:!0}),fe){let b=f[H+1];b&&X(b)&&window.setTimeout(()=>Se(b.id),800)}},[o,be,he,fe,f,H,X,Se]),zn=async()=>{if(o){Ft(!0);try{let a=await r.submitQuiz({unitId:o.id,answers:qt});a.ok&&(st(a),g(p=>({...p,[o.id]:a.unit})),R({percent:a.deliverable.percent,completed:a.deliverable.completed,completedAt:a.deliverable.completedAt??null}))}finally{Ft(!1)}}},qn=!!o&&(o.kind==="video"||o.kind==="audio"||!!(E?.mimeType&&(E.mimeType.startsWith("video/")||E.mimeType.startsWith("audio/")))),ct=o?F[o.id]??o.progress:"not_started",Fn=!!o&&!N&&X(o)&&!qn&&ct!=="completed";(0,u.useEffect)(()=>{if(!o)return;let a=o.id,p=()=>re(a,"final"),b=()=>{document.visibilityState==="hidden"&&re(a,"event")};return window.addEventListener("pagehide",p),document.addEventListener("visibilitychange",b),()=>{window.removeEventListener("pagehide",p),document.removeEventListener("visibilitychange",b),re(a,"final")}},[o,re]),(0,u.useEffect)(()=>{!o||N||!X(o)||o.kind==="video"||o.kind==="audio"||(F[o.id]??o.progress)==="not_started"&&he(o.id,{opened:!0})},[o?.id,N]);let $n=a=>{if(N||(F[a.id]??a.progress)==="completed")return;let b=typeof a.lastPosition=="number"?a.lastPosition:a.positionSeconds;return b>5?b:void 0},dt=a=>{let p=f[H+a];p&&X(p)&&Se(p.id)},jt=async a=>{let p=await r.openUnit(a,"download");p.ok&&window.open(p.url,"_blank","noopener,noreferrer")},Vn=()=>{o&&jt(o.id)},Kn=async(a,p)=>{if(Je)return;_t(p),Ze(!1);let b=await r.openUnit(a,"download",{attachmentId:p}).catch(()=>({ok:!1,code:"NETWORK"}));_t(null),b.ok?window.open(b.url,"_blank","noopener,noreferrer"):Ze(!0)},V=H>=0?f[H+1]??null:null,Xt=H>0?f[H-1]:null,ut=Fn&&o?.kind!=="quiz",Hn=()=>!V||!o?!1:V.access.granted?!0:V.access.reason!=="prerequisite"?!1:!Ct({leaves:f.map(p=>({id:p.id,isPreview:p.isPreview,countsTowardCompletion:p.countsTowardCompletion,isPrerequisite:p.isPrerequisite})),completedUnitIds:new Set([...et,o.id]),requireSequential:!!t.settings?.requireSequential}).has(V.id),[Wt,Jt]=(0,u.useState)(!1),Qn=async()=>{if(!(!o||Wt)){Jt(!0);try{let a=Hn();await he(o.id,{completed:!0}),V&&a&&Se(V.id)}finally{Jt(!1)}}},Zt=!!(V&&X(V)),Gn=!!(V&&!Zt&&!ut&&ct!=="completed"&&V.access.reason==="prerequisite"),Be=ut?{label:V?e.completeAndContinue:e.markComplete,onClick:()=>{Qn()},disabled:Wt,icon:!0}:{label:e.nextUnit,onClick:()=>dt(1),disabled:!Zt,icon:!1},Yn=ut||!!V,jn=a=>a.duration?O(e.minutes,{count:Math.max(1,Math.round(a.duration/60))}):a.pageCount?O(e.pages,{count:a.pageCount}):null,Xn=a=>Et(p=>{let b=new Set(p);return b.has(a)?b.delete(a):b.add(a),b}),er=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:c("shrink-0 border-b px-4 py-2",L),children:[(0,n.jsxs)("div",{className:"flex min-h-10 items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[t.authors&&t.authors.length>0&&(0,n.jsx)(qr,{authors:t.authors,className:"mb-1.5"}),(0,n.jsxs)("p",{className:c("text-xs",D),children:[O(e.unitsCount,{count:f.length}),y&&!N?` \xB7 ${O(e.progress,{percent:y.percent})}`:""]})]}),!N&&f.length>1&&(0,n.jsx)("button",{type:"button",onClick:()=>hn(a=>!a),"aria-expanded":It,"aria-label":e.settings,title:e.settings,className:c(_e,"-mr-2"),children:(0,n.jsx)(br,{className:"h-4 w-4","aria-hidden":"true"})})]}),It&&(0,n.jsxs)("button",{type:"button",role:"switch","aria-checked":fe,onClick:()=>Dn(!fe),className:c("flex min-h-10 w-full items-center justify-between gap-3 text-left text-sm",Y),children:[e.autoplayNext,(0,n.jsx)("span",{"aria-hidden":!0,className:c("relative inline-flex h-5 w-9 shrink-0 rounded-full transition",fe?"bg-[var(--brand-color,#18181b)]":"bg-black/20 dark:bg-white/25"),children:(0,n.jsx)("span",{className:c("absolute top-0.5 h-4 w-4 rounded-full bg-white transition",fe?"left-[18px]":"left-0.5")})})]}),Vt?.enabled&&y?.completed&&(0,n.jsxs)("button",{type:"button",onClick:()=>{Qt()},disabled:Kt,className:c(G,"my-2 w-full"),children:[(0,n.jsx)(qe,{className:"h-4 w-4","aria-hidden":"true"})," ",e.certificateDownload]})]}),(0,n.jsxs)(K,{role:M?void 0:"navigation","aria-label":e.outline,className:"min-h-0 flex-1 overflow-y-auto p-2",children:[f.length===0&&(0,n.jsx)("p",{className:c("p-3 text-sm",D),children:e.noUnits}),j.map((a,p)=>{let b=a.chapter?.id??null,_=b?bn.has(b):!1,ne=a.units.filter(T=>T.countsTowardCompletion!==!1),ze=ne.filter(T=>(F[T.id]??T.progress)==="completed").length;return(0,n.jsxs)("div",{className:"mb-1",children:[a.chapter&&(0,n.jsxs)("button",{type:"button",onClick:()=>Xn(a.chapter.id),"aria-expanded":!_,className:c("flex w-full items-start gap-2 rounded-lg px-2 py-2 text-left text-sm font-semibold hover:bg-black/[0.03] dark:hover:bg-white/[0.06]",Y),children:[(0,n.jsx)(xe,{className:c("mt-0.5 h-4 w-4 shrink-0 transition-transform",D,_&&"-rotate-90"),"aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1",children:a.chapter.title}),!N&&ne.length>0&&(0,n.jsxs)("span",{className:c("shrink-0 text-xs font-normal tabular-nums",D),children:[ze,"/",ne.length]})]}),!_&&(0,n.jsx)("ul",{className:"space-y-0.5",children:a.units.map(T=>{let mt=F[T.id]??T.progress,nr=T.id===I,W=!X(T),gt=N&&!W&&T.allowDownload&&T.hasFile,Jn=jn(T),ir=W&&T.access.reason==="not_released"&&T.access.availableAt?O(e.unlocksAt,{date:yi(T.access.availableAt,i,l)}):W&&T.access.reason==="prerequisite"?O(e.lockedBy,{title:kn(T)}):W?e.locked:null,ar=[T.countsTowardCompletion===!1&&!N?e.optional:null,T.isPreview&&!W?e.preview:null,Jn].filter(Boolean);return(0,n.jsxs)("li",{className:c(gt&&"flex items-start gap-1"),children:[(0,n.jsxs)("button",{type:"button",disabled:W,"aria-current":nr?"true":void 0,onClick:()=>Se(T.id),className:c("flex w-full items-start gap-2.5 rounded-lg px-2 py-2 text-left text-sm transition",nr?"bg-black/5 font-medium dark:bg-white/10":"hover:bg-black/[0.03] dark:hover:bg-white/[0.06]",W&&"cursor-not-allowed opacity-60",gt&&"min-w-0 flex-1"),children:[(0,n.jsx)("span",{className:c("mt-0.5 shrink-0",D),children:W?(0,n.jsx)(pr,{className:"h-4 w-4"}):N?(0,n.jsx)(Fe,{className:"h-4 w-4"}):mt==="completed"?(0,n.jsx)(ve,{className:"h-4 w-4 text-emerald-600"}):mt==="in-progress"?(0,n.jsx)(lr,{className:"h-4 w-4"}):(0,n.jsx)(dr,{className:"h-4 w-4"})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:c("line-clamp-2",Y),children:T.title||T.kind}),ar.length>0&&(0,n.jsx)("span",{className:c("block text-xs",D),children:ar.join(" \xB7 ")}),ir&&(0,n.jsx)("span",{className:c("block text-xs",D),children:ir}),T.id===P&&!W&&mt!=="completed"&&(0,n.jsx)("span",{className:"block text-xs font-normal text-[var(--site-accent-text,var(--brand-color,#18181b))]",children:e.lastViewed})]})]}),gt&&(0,n.jsx)("button",{type:"button",onClick:()=>{jt(T.id)},"aria-label":`${e.download}: ${T.title||T.kind}`,title:e.download,className:c(_e,"mt-0.5 h-9 w-9"),children:(0,n.jsx)(ke,{className:"h-4 w-4"})})]},T.id)})})]},b??`loose-${p}`)})]})]}),tr=!!o&&(o.kind==="video"||o.kind==="audio"||!!(o.embed&&De(o.embed))),rr=o?(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:c("text-lg font-bold sm:text-xl",Y),children:o.title||o.kind}),o.description&&(0,n.jsx)("p",{className:c("mt-1 text-sm",D),children:o.description})]}):null,Wn=o?o.embed&&De(o.embed)?(0,n.jsx)("div",{className:"aspect-video w-full overflow-hidden rounded-[var(--site-radius-media,0.75rem)] bg-black",children:(0,n.jsx)("iframe",{title:o.title??o.kind,src:De(o.embed),className:"h-full w-full",allow:"accelerometer; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):o.kind==="quiz"?(0,n.jsx)(Ai,{body:o.body,summary:o.quiz??null,answers:qt,result:In,busy:_n,labels:e,onAnswer:(a,p)=>at(b=>({...b,[a]:p})),onSubmit:()=>{zn()},onRetry:()=>{at({}),st(null)}}):o.kind==="text"?(0,n.jsx)(Rr,{facts:o.body?.mediaFacts,children:(0,n.jsx)("div",{className:"max-w-none",children:(0,n.jsx)(pn,{content:vi(typeof o.body?.markdown=="string"?o.body.markdown:"",o.title)})})}):wn?(0,n.jsx)("div",{className:"aspect-video w-full animate-pulse rounded-[var(--site-radius-media,0.75rem)] bg-black/5 dark:bg-white/10"}):Ut&&Ut!=="NO_FILE"?(0,n.jsxs)("div",{role:"alert",className:c("flex flex-col items-center gap-3 rounded-[var(--site-radius-media,0.75rem)] border border-dashed px-4 py-10 text-center text-sm",L,D),children:[(0,n.jsx)("p",{children:e.loadError}),(0,n.jsxs)("button",{type:"button",onClick:()=>xn(a=>a+1),className:G,children:[(0,n.jsx)($e,{className:"h-4 w-4","aria-hidden":"true"})," ",e.retry]})]}):E?(0,n.jsx)(Sr,{src:E.url,hlsSrc:E.renditions?.find(a=>a.kind==="hls")?.url,thumbnails:E.thumbnails??E.renditions?.find(a=>a.kind==="thumbnails")?.url,streamingPartial:E.streaming==="partial",captions:hi(E.renditions),captionLocale:te,onCaptionChange:ue,thumbnailUrl:E.poster??void 0,mimeType:E.mimeType??"application/octet-stream",title:E.title??o.title??void 0,fileName:E.fileName,pageCount:o.pageCount??void 0,storageKey:`unit:${o.id}`,startTime:$n(o),seekTo:Rn,chapters:E.renditions?.find(a=>a.kind==="chapters")?.url,allowDownload:E.allowDownload,downloadUrl:E.allowDownload?E.url:void 0,onTimeUpdate:Mn,onComplete:Bn,onPlaybackEvent:Ln},o.id):(0,n.jsx)("div",{className:c("rounded-[var(--site-radius-media,0.75rem)] border border-dashed px-4 py-10 text-center text-sm",L,D),children:e.unitEmpty}):null,pt=Yn?(0,n.jsxs)("button",{type:"button",onClick:Be.onClick,disabled:Be.disabled,className:c(fn,"min-w-0"),style:{backgroundColor:"var(--brand-color,#18181b)"},children:[Be.icon&&(0,n.jsx)(ve,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"truncate",children:Be.label})]}):null;return(0,n.jsxs)("div",{className:c("flex flex-col",M?"h-dvh bg-[var(--site-surface-muted,#f4f4f5)]":c("overflow-hidden rounded-[var(--site-radius-card,1rem)] border",L,de),B),children:[(0,n.jsxs)(z,{className:c("flex h-14 shrink-0 items-center gap-1 border-b px-2 sm:px-3",L,de),children:[C&&(0,n.jsx)("a",{href:C,"aria-label":S,title:S,className:_e,children:(0,n.jsx)(sr,{className:"h-5 w-5","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",onClick:()=>Oe(a=>!a),"aria-expanded":Q,"aria-label":Q?e.hideOutline:e.showOutline,title:Q?e.hideOutline:e.showOutline,className:c(_e,"hidden lg:inline-flex"),children:(0,n.jsx)(mr,{className:"h-5 w-5","aria-hidden":"true"})}),(0,n.jsx)("p",{className:c("min-w-0 flex-1 truncate px-1 text-sm font-semibold sm:text-base",Y),children:t.title}),y&&!N&&(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2 pr-1","aria-label":O(e.progress,{percent:y.percent}),children:[(0,n.jsx)("div",{className:"hidden h-1.5 w-24 overflow-hidden rounded-full bg-black/5 sm:block dark:bg-white/10",children:(0,n.jsx)("div",{className:"h-full rounded-full",style:{width:`${y.percent}%`,backgroundColor:"var(--brand-color,#18181b)"}})}),(0,n.jsxs)("span",{className:c("text-xs tabular-nums",D),children:[y.percent,"%"]})]})]}),(0,n.jsxs)("div",{className:c("flex min-h-0 flex-1",!M&&"lg:max-h-[80vh]"),children:[Q&&(0,n.jsx)(q,{className:c("hidden w-80 shrink-0 flex-col border-r lg:flex",L,de),children:er}),(0,n.jsx)(pe,{className:"min-w-0 flex-1 overflow-y-auto",children:(0,n.jsx)("div",{className:c("mx-auto w-full max-w-4xl px-4 py-5 sm:px-6 lg:py-8",M&&"pb-24 lg:pb-8"),children:o?(0,n.jsxs)("div",{className:"space-y-4",children:[On&&(0,n.jsxs)("div",{className:c("flex flex-col items-center gap-3 rounded-[var(--site-radius-card,1rem)] border p-6 text-center",L,de),role:"status",children:[(0,n.jsx)("span",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{backgroundColor:"var(--brand-color,#18181b)",color:"var(--brand-foreground,#ffffff)"},children:(0,n.jsx)(qe,{className:"h-6 w-6","aria-hidden":"true"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:c("text-lg font-bold",Y),children:e.courseCompletedTitle}),y?.completedAt&&(0,n.jsx)("p",{className:c("mt-1 text-sm",D),children:O(e.courseCompletedOn,{date:xi(y.completedAt,i,l)})})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[Vt?.enabled&&(0,n.jsxs)("button",{type:"button",onClick:()=>{Qt()},disabled:Kt,className:fn,style:{backgroundColor:"var(--brand-color,#18181b)"},children:[(0,n.jsx)(qe,{className:"h-4 w-4","aria-hidden":"true"})," ",e.certificateDownload]}),C&&S&&(0,n.jsx)("a",{href:C,className:G,children:S}),(0,n.jsx)("button",{type:"button",onClick:()=>Yt(!1),className:G,children:e.keepBrowsing})]})]}),!tr&&rr,Wn,tr&&rr,En&&o&&ge&&(0,n.jsx)($r,{labels:e,open:Nn,onToggle:Tn,status:ge.status==="ready"?"ready":"error",data:ge.data,activeIndex:Sn,onSeek:a=>Pn({time:a,nonce:Date.now()}),onLocaleChange:a=>Lt(a),onRetry:()=>Cn(a=>a+1),uiLocale:i??"en",fileName:o.title||E?.fileName||"transcript"}),o.attachments&&o.attachments.length>0&&(0,n.jsxs)("div",{role:"group","aria-label":e.attachments,children:[(0,n.jsx)("h3",{className:c("mb-2 text-sm font-semibold",Y),children:e.attachments}),(0,n.jsx)("ul",{className:c("divide-y rounded-[var(--site-radius-card,0.75rem)] border",L,de),children:o.attachments.map(a=>(0,n.jsxs)("li",{className:c("flex min-h-14 items-center gap-3 px-3 py-2",L),children:[(0,n.jsx)(gr,{className:c("h-4 w-4 shrink-0",D),"aria-hidden":"true"}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:c("block break-words text-sm font-medium",Y),children:a.fileName}),a.bytes!=null&&(0,n.jsx)("span",{className:c("block text-xs",D),children:Ar(a.bytes,{locale:i??"en"})})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>{Kn(o.id,a.id)},disabled:Je!==null,"aria-label":O(e.downloadFile,{name:a.fileName}),className:c(G,"shrink-0"),children:[(0,n.jsx)(ke,{className:c("h-4 w-4",Je===a.id&&"animate-pulse"),"aria-hidden":"true"})," ",(0,n.jsx)("span",{className:"hidden sm:inline",children:e.download})]})]},a.id))}),vn&&(0,n.jsx)("p",{role:"alert",className:"mt-2 text-sm text-red-600 dark:text-red-400",children:e.loadError})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[o.allowDownload&&o.hasFile&&(0,n.jsxs)("button",{type:"button",onClick:Vn,className:G,children:[(0,n.jsx)(ke,{className:"h-4 w-4","aria-hidden":"true"})," ",e.download]}),o.embed&&De(o.embed)&&(0,n.jsxs)("a",{href:De(o.embed).replace("/embed/","/watch?v="),target:"_blank",rel:"noopener noreferrer",className:c("inline-flex min-h-11 items-center gap-1.5 text-sm underline underline-offset-4",D),children:[(0,n.jsx)(ur,{className:"h-4 w-4","aria-hidden":"true"})," ",e.open]}),!N&&ct==="completed"&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,n.jsx)(ve,{className:"h-4 w-4","aria-hidden":"true"})," ",e.completed]})]}),(0,n.jsxs)("div",{className:c("items-center justify-between gap-3 border-t pt-4",L,M?"hidden lg:flex":"flex"),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>dt(-1),disabled:!Xt,className:G,children:[(0,n.jsx)(ft,{className:"h-4 w-4","aria-hidden":"true"})," ",e.previousUnit]}),(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[Gn&&(0,n.jsx)("span",{className:c("text-xs",D),children:e.completeToContinue}),pt]})]})]}):(0,n.jsx)("div",{className:c("rounded-[var(--site-radius-card,1rem)] border border-dashed p-10 text-center text-sm",L,D),children:e.noUnits})})})]}),M?(0,n.jsxs)("div",{className:c("fixed inset-x-0 bottom-0 z-30 flex items-center gap-2 border-t px-3 pt-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))] lg:hidden",L,de),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>Ce(!0),"aria-haspopup":"dialog","aria-expanded":We,className:c(G,"shrink-0"),children:[(0,n.jsx)(bt,{className:"h-4 w-4","aria-hidden":"true"})," ",e.outline]}),(0,n.jsx)("button",{type:"button",onClick:()=>dt(-1),disabled:!Xt,"aria-label":e.previousUnit,title:e.previousUnit,className:c(G,"shrink-0 px-3"),children:(0,n.jsx)(ft,{className:"h-4 w-4","aria-hidden":"true"})}),pt?(0,n.jsx)("div",{className:"flex min-w-0 flex-1 justify-end [&>button]:w-full",children:pt}):(0,n.jsx)("div",{className:"flex-1"})]}):(0,n.jsx)("div",{className:c("flex border-t p-2 lg:hidden",L),children:(0,n.jsxs)("button",{type:"button",onClick:()=>Ce(!0),"aria-haspopup":"dialog","aria-expanded":We,className:c(G,"w-full"),children:[(0,n.jsx)(bt,{className:"h-4 w-4","aria-hidden":"true"})," ",e.outline]})}),We&&(0,n.jsxs)("div",{className:"fixed inset-0 z-40 lg:hidden",role:"dialog","aria-modal":"true","aria-label":e.outline,children:[(0,n.jsx)("button",{type:"button","aria-label":e.closeOutline,onClick:()=>Ce(!1),className:"absolute inset-0 bg-black/40"}),(0,n.jsxs)("div",{className:c("absolute inset-x-0 bottom-0 flex max-h-[85dvh] flex-col rounded-t-2xl pb-[env(safe-area-inset-bottom)]",de),children:[(0,n.jsxs)("div",{className:c("flex shrink-0 items-center justify-between gap-2 border-b px-4 py-2",L),children:[(0,n.jsx)("p",{className:c("min-w-0 truncate text-sm font-semibold",Y),children:e.outline}),(0,n.jsx)("button",{type:"button",onClick:()=>Ce(!1),"aria-label":e.closeOutline,title:e.closeOutline,className:_e,children:(0,n.jsx)(hr,{className:"h-5 w-5","aria-hidden":"true"})})]}),er]})]})]})}function Ti(t,r){let e=new Set(t);return e.has(r)?e.delete(r):e.add(r),[...e]}function Ai({body:t,summary:r,answers:e,result:i,busy:l,labels:s,onAnswer:d,onSubmit:m,onRetry:C}){let S=t?.questions??[];if(!t||S.length===0)return(0,n.jsx)("p",{className:"text-sm text-[var(--site-fg-muted,#71717a)]",children:s.quizNotReady});let B=(t.settings.mode??r?.mode??"graded")==="practice",te=i?.reveal?new Map(i.reveal.questions.map(f=>[f.id,f])):null,ue=S.every(f=>(e[f.id]??[]).some(F=>F.trim().length>0)),M=B||r?.maxAttempts==null?null:Math.max(0,r.maxAttempts-r.attemptsUsed-(i?1:0)),z=!B&&!i&&!!r?.passed,pe=!B&&!i&&!z&&M===0,q="text-[var(--site-fg-muted,#71717a)]",K="border-[var(--site-border,rgba(0,0,0,0.12))]",N="text-[var(--site-fg,#18181b)]",j="min-h-10 rounded-[var(--site-radius-button,0.5rem)] px-3.5 text-sm font-medium text-[var(--brand-foreground,#ffffff)] disabled:opacity-40";return(0,n.jsxs)("div",{className:"space-y-5",children:[B?(0,n.jsx)("p",{className:c("text-xs",q),children:s.quizPracticeHint}):(0,n.jsxs)("p",{className:c("text-xs",q),children:[O(s.quizPassingScore,{percent:t.settings.passingPercent}),M!==null&&!z&&!i?.passed?` \xB7 ${O(s.quizAttemptsLeft,{count:M})}`:""]}),z&&(0,n.jsxs)("p",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,n.jsx)(ve,{className:"h-4 w-4"})," ",s.quizPassed,r?.bestScore!=null?` \xB7 ${O(s.quizScore,{score:r.bestScore})}`:""]}),(0,n.jsx)("ol",{className:"space-y-4",children:S.map((f,F)=>{let g=f.type==="multiple",y=f.type==="short_text"||f.type==="numeric",R=new Set(e[f.id]??[]),I=te?.get(f.id),Ue=I?new Set(I.correctOptionIds):null,o=i?i.perQuestion[f.id]??null:null,H=!!i||l||z||pe;return(0,n.jsxs)("li",{className:c("rounded-[var(--site-radius-media,0.75rem)] border p-4",K),children:[(0,n.jsxs)("p",{className:c("flex items-start gap-2 text-sm font-medium",N),children:[o===!0?(0,n.jsx)(ve,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400","aria-label":s.quizCorrectMark}):o===!1?(0,n.jsx)(cr,{className:"mt-0.5 h-4 w-4 shrink-0 text-red-600 dark:text-red-400","aria-label":s.quizWrongMark}):null,(0,n.jsxs)("span",{children:[F+1,". ",f.prompt,g?(0,n.jsx)("span",{className:c("ml-2 text-xs font-normal",q),children:s.quizSelectAll}):null]})]}),f.image?(0,n.jsx)("img",{src:f.image.url,alt:f.image.alt??"",width:f.image.width??void 0,height:f.image.height??void 0,loading:"lazy",className:"mt-3 max-h-80 w-auto max-w-full rounded-[var(--site-radius-media,0.75rem)]"}):null,y?(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)(Ve,{type:"text",inputMode:f.type==="numeric"?"decimal":void 0,value:e[f.id]?.[0]??"",disabled:H,maxLength:500,placeholder:f.type==="numeric"?s.quizNumericPlaceholder:s.quizTextPlaceholder,"aria-label":f.prompt,onChange:P=>d(f.id,P.target.value?[P.target.value]:[]),className:c("rounded-lg bg-transparent disabled:cursor-default disabled:opacity-100",K,N,o===!0&&"bg-emerald-50 dark:bg-emerald-950/30",o===!1&&"bg-red-50 dark:bg-red-950/30")}),I&&I.acceptedAnswers&&I.acceptedAnswers.length>0?(0,n.jsx)("p",{className:c("mt-2 text-xs",q),children:O(s.quizAcceptedAnswers,{answers:I.acceptedAnswers.join(" / ")})}):null]}):(0,n.jsx)("ul",{role:g?"group":"radiogroup","aria-label":f.prompt,className:c("mt-3",f.options.some(P=>P.image)?"grid grid-cols-2 gap-2 sm:grid-cols-3":"space-y-2"),children:f.options.map(P=>{let Q=R.has(P.id),Oe=Ue?Ue.has(P.id):null;return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",role:g?"checkbox":"radio","aria-checked":Q,disabled:H,onClick:()=>d(f.id,g?Ti(R,P.id):[P.id]),className:c("w-full rounded-lg border text-left text-sm disabled:cursor-default",P.image?"flex h-full flex-col gap-2 p-2":"flex items-start gap-2 px-3 py-2",K,N,Q&&"border-[var(--brand-color,#18181b)]",Oe===!0&&"bg-emerald-50 dark:bg-emerald-950/30",Oe===!1&&Q&&"bg-red-50 dark:bg-red-950/30"),children:[P.image?(0,n.jsx)("img",{src:P.image.url,alt:P.image.alt??"",width:P.image.width??void 0,height:P.image.height??void 0,loading:"lazy",className:"block max-h-48 w-full rounded-md object-contain"}):null,(0,n.jsxs)("span",{className:c("flex items-start gap-2",P.image?"px-1 pb-1":"contents"),children:[(0,n.jsx)("span",{"aria-hidden":!0,className:c("mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center border",g?"rounded":"rounded-full",Q?"border-[var(--brand-color,#18181b)] bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]":"border-[var(--site-border,rgba(0,0,0,0.3))]"),children:Q?(0,n.jsx)(or,{className:"h-3 w-3"}):null}),(0,n.jsx)("span",{className:"min-w-0",children:P.text})]})]})},P.id)})}),I?.explanation?(0,n.jsx)("p",{className:c("mt-2 text-xs",q),children:I.explanation}):null]},f.id)})}),i?(0,n.jsx)("div",{className:c("rounded-[var(--site-radius-media,0.75rem)] border p-4 text-sm",K),children:B?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:c("font-medium",N),children:O(s.quizCorrectCount,{correct:i.correct,total:i.total})}),(0,n.jsx)("button",{type:"button",onClick:C,className:c("mt-3",j),style:{backgroundColor:"var(--brand-color,#18181b)"},children:s.quizPracticeAgain})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:c("font-medium",i.passed?"text-emerald-600 dark:text-emerald-400":N),children:[O(s.quizScore,{score:i.score})," \xB7 ",i.passed?s.quizPassed:O(s.quizFailed,{percent:t.settings.passingPercent}),(0,n.jsx)("span",{className:c("ml-2 text-xs font-normal",q),children:O(s.quizCorrectCount,{correct:i.correct,total:i.total})})]}),!i.passed&&(i.canRetry?(0,n.jsx)("button",{type:"button",onClick:C,className:c("mt-3",j),style:{backgroundColor:"var(--brand-color,#18181b)"},children:s.quizRetry}):(0,n.jsx)("p",{className:c("mt-2 text-xs",q),children:s.quizNoAttempts}))]})}):pe?(0,n.jsx)("p",{className:c("text-sm",q),children:s.quizNoAttempts}):z?null:(0,n.jsx)("button",{type:"button",onClick:m,disabled:!ue||l,className:j,style:{backgroundColor:"var(--brand-color,#18181b)"},children:s.quizSubmit})]})}export{Ni as DeliverablePlayer,Zn as deliverablePlayerLabels};
93
- //# sourceMappingURL=deliverables-FBCRGMTB.js.map
@@ -1,92 +0,0 @@
1
- import{AudioPlayer,FileDownloadCard,MediaPlayer,PDFViewer,VideoPlayer}from"./chunk-5U2SZE3H.js";import"./chunk-ZDU7A7WZ.js";import"./chunk-F5NEDREL.js";import{ARTICLE_CONTENT_STYLES,AuthorList,DEFAULT_IMAGE_LAYOUT,GALLERY_COLS_CLASS,Input,MediaFactsProvider,SiteImage,TONE_BG_TINT_STRONG_HOVER,TONE_BORDER_STRONG,TONE_TEXT_BODY,TONE_TEXT_SUBTLE,applyProfile,buildInlineStyle,createHeadingIdAssigner,deliverablePlayerLabels,getEmbedUrl,imageLayoutClassName,isAllowedArticleMarkdownHref,isExternalArticleMarkdownHref,isHostedVideoUrl,isImageAlign,isImageSize,parseArticleSegments,parseMarkdown,useMediaFacts}from"./chunk-2UVUNYL6.js";import{displayFileName,fillLabel,useMediaProtection}from"./chunk-LLHBSWTL.js";import{formatFileSize,formatParenthetical}from"./chunk-U3U5KVR6.js";import{ArrowLeft,Award,Check,ChevronDown,ChevronLeft,Circle,CircleCheck,CirclePlay,CircleX,Download,ExternalLink,FileText,List,Lock,PanelLeft,Paperclip,RotateCw,Search,Settings2,X,cn,useSiteLabels}from"./chunk-TLBIYET7.js";import"./chunk-3ZTUZPSD.js";import{useCallback,useEffect as useEffect2,useMemo as useMemo2,useRef as useRef2,useState as useState3}from"react";import{useEffect,useMemo,useRef,useState}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";var BORDER="border-[var(--site-border,rgba(0,0,0,0.1))]";var SURFACE="bg-[var(--site-surface,#ffffff)]";var MUTED="text-[var(--site-fg-muted,#71717a)]";var FG="text-[var(--site-fg,#18181b)]";var CHIP="inline-flex min-h-9 items-center rounded-full border px-3 text-xs";function fill(template,values){return template.replace(/\{(\w+)\}/g,(_m,key)=>String(values[key]??""))}function formatTime(seconds){const total=Math.max(0,Math.floor(seconds));const h=Math.floor(total/3600);const m=Math.floor(total%3600/60);const s=total%60;const mm=h>0?String(m).padStart(2,"0"):String(m);return`${h>0?`${h}:`:""}${mm}:${String(s).padStart(2,"0")}`}function languageName(locale,uiLocale){try{return new Intl.DisplayNames([uiLocale],{type:"language"}).of(locale)??locale}catch{return locale}}function activeSegmentIndex(segments,time){let lo=0;let hi=segments.length-1;let hit=-1;while(lo<=hi){const mid=lo+hi>>1;if(segments[mid].s<=time){hit=mid;lo=mid+1}else hi=mid-1}return hit}function highlight(text,query){if(!query)return text;const lower=text.toLowerCase();const needle=query.toLowerCase();const parts=[];let from=0;for(;;){const at=lower.indexOf(needle,from);if(at===-1)break;if(at>from)parts.push(text.slice(from,at));parts.push(jsx("mark",{className:"rounded-sm bg-yellow-200 px-0.5 text-inherit dark:bg-yellow-500/40",children:text.slice(at,at+needle.length)},at));from=at+needle.length}if(from<text.length)parts.push(text.slice(from));return parts}function TranscriptPanel({labels,open,onToggle,status,data,activeIndex,onSeek,onLocaleChange,onRetry,uiLocale,fileName,className}){const[query,setQuery]=useState("");const[follow,setFollow]=useState(true);const listRef=useRef(null);const trimmed=query.trim();const matches=useMemo(()=>{if(!data||!trimmed)return null;const needle=trimmed.toLowerCase();return data.segments.map((seg,index)=>seg.t.toLowerCase().includes(needle)?index:-1).filter(i=>i>=0)},[data,trimmed]);const visible=matches??(data?data.segments.map((_seg,index)=>index):[]);useEffect(()=>{if(!open||!follow||matches||activeIndex<0)return;const list=listRef.current;const row=list?.querySelector(`[data-index="${activeIndex}"]`);if(!list||!row)return;const top=row.offsetTop-list.offsetTop;const bottom=top+row.offsetHeight;if(top<list.scrollTop||bottom>list.scrollTop+list.clientHeight)list.scrollTo({top:Math.max(0,top-list.clientHeight/3),behavior:"smooth"})},[activeIndex,open,follow,matches]);const download=()=>{if(!data)return;const blob=new Blob([data.segments.map(seg=>seg.t).join("\n")],{type:"text/plain;charset=utf-8"});const url=URL.createObjectURL(blob);const a=document.createElement("a");a.href=url;a.download=`${fileName||"transcript"}.${data.locale}.txt`;document.body.appendChild(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(url),1e3)};const trackLabel=track=>{const name=languageName(track.locale,uiLocale);if(track.edited)return name;if(track.source==="ai")return formatParenthetical(uiLocale,name,labels.transcriptAutoGenerated);if(track.source==="translation")return formatParenthetical(uiLocale,name,labels.transcriptAutoTranslated);return name};return jsxs("section",{className:cn("rounded-[var(--site-radius-card,0.75rem)] border",BORDER,SURFACE,className),"aria-label":labels.transcript,"data-kanorio-transcript":true,children:[jsxs("button",{type:"button",onClick:()=>onToggle(!open),"aria-expanded":open,className:cn("flex min-h-12 w-full items-center gap-2 px-3 text-left text-sm font-semibold",FG),children:[jsx(FileText,{className:cn("h-4 w-4 shrink-0",MUTED),"aria-hidden":"true"}),jsx("span",{className:"min-w-0 flex-1 truncate",children:labels.transcript}),jsx("span",{className:cn("text-xs font-normal",MUTED),children:open?labels.transcriptHide:labels.transcriptShow}),jsx(ChevronDown,{className:cn("h-4 w-4 shrink-0 transition-transform",MUTED,open&&"rotate-180"),"aria-hidden":"true"})]}),open&&jsx("div",{className:cn("border-t",BORDER),children:status==="loading"||status==="idle"?jsx("div",{className:"space-y-2 p-3","aria-busy":"true",children:[0,1,2].map(i=>jsx("div",{className:"h-4 animate-pulse rounded bg-black/5 dark:bg-white/10",style:{width:`${80-i*15}%`}},i))}):status==="error"||!data?jsxs("div",{role:"alert",className:cn("flex flex-col items-center gap-2 p-6 text-center text-sm",MUTED),children:[jsx("p",{children:labels.loadError}),jsxs("button",{type:"button",onClick:onRetry,className:cn(CHIP,BORDER,FG),children:[jsx(RotateCw,{className:"mr-1 h-3.5 w-3.5","aria-hidden":"true"})," ",labels.retry]})]}):jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-wrap items-center gap-2 p-3",children:[jsxs("label",{className:"relative min-w-40 flex-1",children:[jsx(Search,{className:cn("pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",MUTED),"aria-hidden":"true"}),jsx(Input,{type:"search",value:query,onChange:e=>setQuery(e.target.value),placeholder:labels.transcriptSearch,"aria-label":labels.transcriptSearch,className:"h-10 pl-9"})]}),jsx("button",{type:"button",onClick:()=>setFollow(v=>!v),"aria-pressed":follow,className:cn(CHIP,BORDER,follow?FG:MUTED,follow&&"bg-black/5 dark:bg-white/10"),children:labels.transcriptFollow}),jsxs("button",{type:"button",onClick:download,className:cn(CHIP,BORDER,FG),children:[jsx(Download,{className:"mr-1 h-3.5 w-3.5","aria-hidden":"true"})," ",labels.transcriptDownload]})]}),data.tracks.length>1&&jsx("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-3",role:"group","aria-label":labels.transcriptLanguage,children:data.tracks.map(track=>jsx("button",{type:"button",onClick:()=>onLocaleChange(track.locale),"aria-pressed":track.locale===data.locale,lang:track.locale,className:cn(CHIP,BORDER,track.locale===data.locale?cn(FG,"bg-black/5 dark:bg-white/10"):MUTED),children:trackLabel(track)},track.locale))}),matches&&jsx("p",{className:cn("px-3 pb-2 text-xs",MUTED),role:"status",children:matches.length>0?fill(labels.transcriptMatches,{count:matches.length}):labels.transcriptNoResults}),jsx("ol",{ref:listRef,className:"max-h-80 overflow-y-auto px-2 pb-2",lang:data.locale,children:visible.map(index=>{const seg=data.segments[index];const active=index===activeIndex;return jsx("li",{"data-index":index,children:jsxs("button",{type:"button",onClick:()=>onSeek(seg.s),"aria-current":active?"true":void 0,className:cn("flex w-full gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 py-1.5 text-left text-sm hover:bg-black/5 dark:hover:bg-white/10",active?cn(FG,"bg-black/5 font-medium dark:bg-white/10"):FG),children:[jsx("span",{className:cn("w-11 shrink-0 pt-0.5 font-mono text-xs tabular-nums",MUTED),children:formatTime(seg.s)}),jsx("span",{className:"min-w-0 flex-1 leading-relaxed",children:highlight(seg.t,trimmed)})]})},index)})})]})})]})}function classifyDevice(input){if(input.width<768)return"mobile";if(input.coarsePointer&&input.width<1024)return"tablet";return"desktop"}import{Fragment as Fragment4}from"react";import React2 from"react";import React from"react";import{Fragment as Fragment2,jsx as jsx2,jsxs as jsxs2}from"react/jsx-runtime";function styleOf(params){if(!params)return{};const built=buildInlineStyle(params);const style={};if(built.style){for(const decl of built.style.split(";")){const idx=decl.indexOf(":");if(idx===-1)continue;const prop=decl.slice(0,idx).trim().replace(/-([a-z])/g,(_,c)=>c.toUpperCase());const value=decl.slice(idx+1).trim();if(prop&&value)style[prop]=value}}let markClass;if(style.backgroundColor&&!style.color){style.color=style.backgroundColor.includes("--highlight-")?"var(--highlight-fg, inherit)":"var(--site-base-fg, inherit)";markClass="[&_a]:text-inherit"}return{className:[built.className,markClass].filter(Boolean).join(" ")||void 0,style:built.style?style:void 0}}function renderPhrasing(nodes,keyPrefix,overrides={}){return(nodes??[]).map((node,index)=>{const key=`${keyPrefix}-${index}`;const inner=()=>renderPhrasing(node.children,key,overrides);if(node.type==="text")return jsx2(React.Fragment,{children:node.value},key);if(node.type==="strong")return jsx2("strong",{children:inner()},key);if(node.type==="emphasis")return jsx2("em",{children:inner()},key);if(node.type==="delete")return jsx2("del",{children:inner()},key);if(node.type==="underline")return jsx2("u",{children:inner()},key);if(node.type==="inlineCode"){return jsx2("code",{className:"bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-100 rounded px-1.5 py-0.5 font-mono text-sm",children:node.value},key)}if(node.type==="inlineStyle"){const styled=styleOf(node.params);return jsx2("span",{className:styled.className,style:styled.style,children:inner()},key)}if(node.type==="break")return jsx2("br",{},key);if(node.type==="link"){if(overrides.link)return overrides.link(node,key,inner());const url=node.url??"";if(!isAllowedArticleMarkdownHref(url))return jsx2("span",{children:inner()},key);return jsx2("a",{href:url,...isExternalArticleMarkdownHref(url)?{target:"_blank",rel:"noopener noreferrer"}:{},className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] underline font-medium hover:opacity-80 break-words",children:inner()},key)}if(node.type==="image")return overrides.image?overrides.image(node,key):null;if(node.children)return jsx2(React.Fragment,{children:inner()},key);return null})}function renderListItem(item,key,renderBlocks){const children=item.children??[];const[first,...rest]=children;if(first?.type==="paragraph"){return jsxs2("li",{children:[renderPhrasing(first.children,key),rest.length>0&&renderBlocks(rest)]},key)}return jsx2("li",{children:renderBlocks(children)},key)}function renderBodyBlocks(nodes){return(nodes??[]).map((node,index)=>{const key=`b-${index}`;if(node.type==="paragraph"){return jsx2("p",{className:"break-words",children:renderPhrasing(node.children,key)},key)}if(node.type==="list"&&node.ordered){return jsx2("ol",{className:"list-decimal list-outside pl-6 space-y-1 break-words",children:(node.children??[]).map((item,itemIndex)=>renderListItem(item,`${key}-${itemIndex}`,renderBodyBlocks))},key)}if(node.type==="list"){return jsx2("ul",{className:"list-disc list-outside pl-6 space-y-1 break-words",children:(node.children??[]).map((item,itemIndex)=>renderListItem(item,`${key}-${itemIndex}`,renderBodyBlocks))},key)}if(node.type==="blockquote"){return jsx2("blockquote",{className:"border-l-4 border-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] pl-4 italic text-[var(--site-fg-muted,#71717a)]",children:renderBodyBlocks(node.children)},key)}if(node.type==="code"){return jsx2("pre",{className:"bg-zinc-100 dark:bg-zinc-800 rounded-[var(--site-radius-lg,0.5rem)] p-4 font-mono text-sm leading-6 overflow-x-auto whitespace-pre-wrap text-zinc-700 dark:text-zinc-300",children:jsx2("code",{children:node.value})},key)}return null})}function RichTextView({content,profile,className,blockClassName="space-y-2"}){if(!content)return null;const applied=applyProfile(parseMarkdown(content,profile).tree,profile);if(profile==="inline"){const paragraph=applied.tree.children?.[0];return jsx2(Fragment2,{children:renderPhrasing(paragraph?.children,"i")})}if(!applied.tree.children?.length)return null;return jsx2("div",{className:cn("site-body-text break-words min-w-0",blockClassName,className),children:renderBodyBlocks(applied.tree.children)})}import{Fragment as Fragment3,jsx as jsx3,jsxs as jsxs3}from"react/jsx-runtime";function plainTextOf(node){if(!node)return"";if(node.type==="text")return node.value??"";return(node.children??[]).map(plainTextOf).join("")}var ARTICLE_OVERRIDES={link(node,key,children){const href=node.url??"";if(!isAllowedArticleMarkdownHref(href)){return jsx3("span",{className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] font-medium",children},key)}return jsx3("a",{href,className:"text-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] underline font-medium hover:opacity-80",...isExternalArticleMarkdownHref(href)?{target:"_blank",rel:"noopener noreferrer"}:{},children},key)},image(node,key){const rawSize=node.data?.hProperties?.["data-size"];const rawAlign=node.data?.hProperties?.["data-align"];const layout={size:isImageSize(rawSize)?rawSize:DEFAULT_IMAGE_LAYOUT.size,align:isImageAlign(rawAlign)?rawAlign:DEFAULT_IMAGE_LAYOUT.align};return jsx3(SiteImage,{src:node.url??"",responsive:true,explicitAlt:node.alt??void 0,altType:"article-image",title:node.title??void 0,className:`block rounded-[var(--site-radius-media)] my-5 h-auto ${imageLayoutClassName(layout)}`},key)}};function renderArticlePhrasing(nodes,keyPrefix){return renderPhrasing(nodes,keyPrefix,ARTICLE_OVERRIDES)}function renderTable(node,key){const rows=node.children??[];const[headerRow,...bodyRows]=rows;return jsxs3("table",{children:[headerRow&&jsx3("thead",{children:jsx3("tr",{children:(headerRow.children??[]).map((cell,cellIndex)=>jsx3("th",{children:renderArticlePhrasing(cell.children,`${key}-h-${cellIndex}`)},cellIndex))})}),jsx3("tbody",{children:bodyRows.map((row,rowIndex)=>jsx3("tr",{children:(row.children??[]).map((cell,cellIndex)=>jsx3("td",{children:renderArticlePhrasing(cell.children,`${key}-${rowIndex}-${cellIndex}`)},cellIndex))},rowIndex))})]},key)}function renderListItems(items,keyPrefix,assignId){return items.map((item,index)=>{const key=`${keyPrefix}-${index}`;const isTask=typeof item.checked==="boolean";const contentNodes=(item.children??[]).flatMap(child=>child.type==="paragraph"?child.children??[]:[]);const blockChildren=(item.children??[]).filter(child=>child.type!=="paragraph");if(isTask){return jsxs3("li",{className:"flex items-start gap-2",children:[jsx3("span",{role:"checkbox","aria-checked":item.checked??false,"aria-disabled":"true",className:"mt-1.5 inline-block size-4 shrink-0 rounded-sm border text-center text-xs leading-4 "+TONE_BORDER_STRONG,children:item.checked?"\u2713":""}),jsx3("span",{children:renderArticlePhrasing(contentNodes,key)})]},key)}return jsxs3("li",{children:[renderArticlePhrasing(contentNodes,key),blockChildren.length>0&&renderArticleBlocks(blockChildren,assignId)]},key)})}function renderArticleBlocks(nodes,assignId){return(nodes??[]).map((node,index)=>{const key=`a-${index}`;if(node.type==="paragraph"){return jsx3("p",{className:`${ARTICLE_CONTENT_STYLES.body} mb-4 ${TONE_TEXT_BODY}`,children:renderArticlePhrasing(node.children,key)},key)}if(node.type==="heading"){const level=node.depth===1?2:node.depth??2;const id=assignId(plainTextOf(node));const Tag=`h${level}`;const styleKey=`h${level}`;const className=level<=3?`${ARTICLE_CONTENT_STYLES[styleKey]} ${level===2?"mt-8 mb-4":"mt-6 mb-3"} text-[var(--site-fg,#18181b)] scroll-mt-24`:`${ARTICLE_CONTENT_STYLES[styleKey]} mt-5 mb-2 text-[var(--site-fg,#18181b)]`;return jsx3(Tag,{id,className,children:renderArticlePhrasing(node.children,key)},key)}if(node.type==="list"&&node.ordered){return jsx3("ol",{className:`list-decimal list-outside pl-6 space-y-2 my-5 ${ARTICLE_CONTENT_STYLES.body} ${TONE_TEXT_BODY}`,children:renderListItems(node.children??[],key,assignId)},key)}if(node.type==="list"){const hasTask=(node.children??[]).some(item=>typeof item.checked==="boolean");return jsx3("ul",{className:hasTask?`list-none pl-0 space-y-2 my-5 ${ARTICLE_CONTENT_STYLES.body} ${TONE_TEXT_BODY}`:`list-disc list-outside pl-6 space-y-2 my-5 ${ARTICLE_CONTENT_STYLES.body} ${TONE_TEXT_BODY}`,children:renderListItems(node.children??[],key,assignId)},key)}if(node.type==="blockquote"){return jsx3("blockquote",{className:`border-l-4 border-[var(--site-accent-text,var(--brand-text,var(--brand-color)))] pl-4 italic ${ARTICLE_CONTENT_STYLES.body} text-[var(--site-fg-muted,#71717a)] my-5`,children:renderArticleBlocks(node.children,assignId)},key)}if(node.type==="code"){return jsx3("pre",{className:"bg-zinc-100 dark:bg-zinc-800 rounded-[var(--site-radius-lg)] p-4 font-mono text-sm leading-6 my-5 overflow-x-auto whitespace-pre-wrap text-zinc-700 dark:text-zinc-300",children:jsx3("code",{children:node.value})},key)}if(node.type==="thematicBreak"){return jsx3("hr",{className:"my-6 border-[var(--site-border,#e4e4e7)]"},key)}if(node.type==="table")return renderTable(node,key);if(node.type==="image"||node.type==="link"){return jsx3(React2.Fragment,{children:renderArticlePhrasing([node],key)},key)}return null})}function ArticleInlineRichText({content}){const applied=applyProfile(parseMarkdown(content,"article").tree,"article");const paragraph=applied.tree.children?.find(node=>node.type==="paragraph");return jsx3(Fragment3,{children:renderArticlePhrasing(paragraph?.children,"ai")})}function renderArticleRichText(content,assignId){const applied=applyProfile(parseMarkdown(content,"article").tree,"article");if(!applied.tree.children?.length)return null;return jsx3(Fragment3,{children:renderArticleBlocks(applied.tree.children,assignId)})}function ArticleRichText({content,assignId}){return jsx3(Fragment3,{children:renderArticleRichText(content,assignId)})}var ctaStyles={container:"site-card-scope rounded-[var(--site-radius-card)] bg-zinc-100 dark:bg-zinc-800 p-8 shadow-lg text-center",content:"text-zinc-700 dark:text-zinc-200 leading-relaxed [&_p]:my-1.5 [&_strong]:text-zinc-900 dark:[&_strong]:text-zinc-50 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:text-left [&_ul]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:text-left [&_ol]:my-2 [&_a]:text-[var(--brand-text,var(--brand-color))] [&_a]:underline",contentSpacing:"mb-6",button:"inline-flex items-center justify-center gap-2 rounded-[var(--site-radius-button)] bg-[var(--brand-color)] px-6 @vp-md/article:px-8 py-3 min-h-[44px] text-base font-bold text-[var(--brand-foreground)] shadow-md transition-all duration-200 hover:scale-[1.02] hover:shadow-lg active:scale-[0.98]"};import{jsx as jsx4,jsxs as jsxs4}from"react/jsx-runtime";function UserCtaShortcodeBlock({config,presets}){let buttonText;let href;if(config.type==="preset"){const preset=config.slug?presets?.[config.slug]:void 0;if(preset){buttonText=preset.label;href=preset.href}}else{buttonText=config.buttonText;href=config.href}const hasContent=Boolean(config.content?.trim());const hasButton=Boolean(buttonText&&href);if(!hasContent&&!hasButton)return null;const isExternal=href?/^https?:\/\//.test(href):false;return jsxs4("div",{className:ctaStyles.container,children:[hasContent&&jsx4("div",{className:`${ctaStyles.content}${hasButton?` ${ctaStyles.contentSpacing}`:""}`,children:jsx4(ArticleRichText,{content:config.content,assignId:createHeadingIdAssigner()})}),hasButton&&href&&jsx4("a",{href,className:ctaStyles.button,"data-cta-track":"","data-cta-button-name":buttonText,"data-cta-element-id":"blog-article-cta",...isExternal?{target:"_blank",rel:"noopener noreferrer"}:{},children:buttonText})]})}import{jsx as jsx5,jsxs as jsxs5}from"react/jsx-runtime";function UserFaqShortcodeBlock({config}){if(config.items.length===0)return null;const assignId=createHeadingIdAssigner();return jsxs5("section",{className:"my-6 space-y-4",children:[config.title&&jsx5("h2",{className:"text-2xl font-bold text-[var(--site-fg,#18181b)] mb-2",children:config.title}),config.items.map((item,i)=>jsxs5("div",{className:"my-4",children:[jsxs5("div",{className:"flex items-start gap-2 text-[var(--site-fg,#18181b)]",children:[jsx5("span",{className:"shrink-0 mt-0.5 w-5 h-5 rounded bg-emerald-100 dark:bg-emerald-900/40 flex items-center justify-center text-emerald-700 dark:text-emerald-300 text-[10px] font-bold",children:"Q"}),jsx5("span",{className:"flex-1 min-w-0",children:jsx5(ArticleInlineRichText,{content:item.question})})]}),jsxs5("div",{className:"mt-1 flex items-start gap-2",children:[jsx5("span",{className:"shrink-0 mt-0.5 w-5 h-5 rounded bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center text-blue-700 dark:text-blue-300 text-[10px] font-bold",children:"A"}),jsx5("div",{className:"flex-1 min-w-0 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:jsx5(ArticleRichText,{content:item.answer,assignId})})]})]},i))]})}import{jsx as jsx6}from"react/jsx-runtime";function EmbedBlock({url,embedType}){const{ui}=useSiteLabels();const facts=useMediaFacts({url});if(isHostedVideoUrl(url)){return jsx6("div",{className:"my-6 not-prose",children:jsx6(VideoPlayer,{src:url,hlsSrc:facts?.hls,thumbnails:facts?.thumbnails,streamingPartial:facts?.streamingPartial,captions:facts?.captions,chapters:facts?.chapters,storageKey:url,poster:facts?.cover})})}const embedUrl=getEmbedUrl(url,embedType);if(!embedUrl){return jsx6("div",{className:"my-6 p-4 rounded-[var(--site-radius-media)] border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50",children:jsx6("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:fillLabel(ui.embedLoadFailed,{url})})})}return jsx6("div",{className:"my-6 rounded-[var(--site-radius-media)] overflow-hidden",children:jsx6("div",{className:"aspect-video bg-zinc-900",children:jsx6("iframe",{src:embedUrl,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:true,loading:"lazy"})})})}import{jsx as jsx7}from"react/jsx-runtime";function AudioBlock({src,title}){const displayTitle=title||src.split("/").pop()?.replace(/\.[^.]+$/,"")||"";const facts=useMediaFacts({url:src});return jsx7("div",{className:"my-6 not-prose",children:jsx7(AudioPlayer,{src,title:displayTitle,storageKey:src,coverImage:facts?.cover,captions:facts?.captions,chapters:facts?.chapters})})}import{jsx as jsx8}from"react/jsx-runtime";function fileAttachmentDownloadUrl(apiBase,websiteId,assetId,name){if(!websiteId)return"";const base=`${apiBase??""}/api/public/sites/${encodeURIComponent(websiteId)}/assets/${encodeURIComponent(assetId)}/download`;return name?`${base}?name=${encodeURIComponent(name)}`:base}function FileAttachmentBlock({assetId,name,size,mimeType,apiBase,websiteId}){const facts=useMediaFacts({assetId});const shownName=displayFileName(name,facts);return jsx8("div",{className:"my-6 not-prose",children:jsx8(FileDownloadCard,{name:shownName,size:facts?.size??size,mimeType:facts?.mime??mimeType,href:fileAttachmentDownloadUrl(apiBase,websiteId,assetId,shownName)})})}import{jsx as jsx9}from"react/jsx-runtime";function PdfBlock({src,title,pageCount,thumbnailUrl,assetId,display,apiBase,websiteId}){const facts=useMediaFacts({url:src,assetId});const{protection}=useMediaProtection();const fileName=title||src.split("/").pop()?.replace(/\.[^.]+$/,"")||void 0;const downloadUrl=assetId&&fileAttachmentDownloadUrl(apiBase,websiteId,assetId,fileName)||src;return jsx9("div",{className:"my-6 not-prose",children:jsx9(PDFViewer,{src,thumbnailUrl:facts?.cover??thumbnailUrl,thumbnailAlt:fileName,fileName,pageCount:facts?.pages??pageCount,allowDownload:protection.allowDownload,downloadUrl,variant:display==="card"?"card":"preview"})})}import{useState as useState2}from"react";import{jsx as jsx10}from"react/jsx-runtime";function InlineRichText({content}){return jsx10(RichTextView,{content,profile:"inline"})}import{jsx as jsx11,jsxs as jsxs6}from"react/jsx-runtime";function ToggleBlock({title,children,defaultOpen=true}){const[isOpen,setIsOpen]=useState2(defaultOpen);return jsxs6("div",{className:"toggle-block my-4",children:[jsxs6("button",{type:"button",onClick:()=>setIsOpen(!isOpen),className:"flex items-start gap-1 w-full text-left",children:[jsx11("span",{className:"shrink-0 mt-1 p-0.5 rounded transition-colors "+TONE_BG_TINT_STRONG_HOVER,children:jsx11(ChevronDown,{className:`w-4 h-4 ${TONE_TEXT_SUBTLE} transition-transform ${isOpen?"":"-rotate-90"}`})}),jsx11("span",{className:"flex-1 min-w-0 "+TONE_TEXT_BODY,children:jsx11(InlineRichText,{content:title})})]}),isOpen&&jsx11("div",{className:"pl-6 [&>*:last-child]:mb-0",children})]})}import{jsx as jsx12}from"react/jsx-runtime";function GalleryBlock({config}){if(config.items.length===0)return null;return jsx12("div",{className:`my-5 grid items-start gap-3 ${GALLERY_COLS_CLASS[config.cols]}`,"data-gallery-cols":config.cols,children:config.items.map((item,i)=>jsx12(SiteImage,{src:item.src,responsive:true,sizes:`(min-width: 1024px) ${Math.round(60/config.cols)}vw, (min-width: 640px) ${Math.round(100/config.cols)}vw, 100vw`,alt:item.alt,className:"block h-auto w-full rounded-[var(--site-radius-media)]"},`${item.src}-${i}`))})}import{jsx as jsx13,jsxs as jsxs7}from"react/jsx-runtime";var TONE_COLOR={info:"var(--brand-color, #2563eb)",tip:"#16a34a",warning:"#d97706",danger:"#dc2626"};function CalloutBlock({tone,title,children}){const style={borderRadius:"var(--site-radius-card, 12px)",borderLeft:`4px solid ${TONE_COLOR[tone]}`,background:"var(--site-card-bg, color-mix(in srgb, currentColor 6%, transparent))"};return jsxs7("aside",{className:"callout-block site-card-scope my-6 px-5 py-4 [&>*:last-child]:mb-0","data-callout-tone":tone,style,children:[title&&jsx13("p",{className:"mb-1.5 font-semibold",style:{color:TONE_COLOR[tone]},children:title}),children]})}import{Fragment as Fragment5,jsx as jsx14,jsxs as jsxs8}from"react/jsx-runtime";function coalesceFaqSegments(segments){const out=[];for(const segment of segments){const prev=out[out.length-1];if(segment.type==="faq"&&prev&&prev.type==="faq"){out[out.length-1]={type:"faq",config:{title:prev.config.title,items:[...prev.config.items,...segment.config.items]}}}else{out.push(segment)}}return out}var HIGHLIGHT_DARK_VARS=`
2
- --highlight-yellow: rgb(113, 63, 18);
3
- --highlight-green: rgb(20, 83, 45);
4
- --highlight-blue: rgb(30, 58, 138);
5
- --highlight-pink: rgb(131, 24, 67);
6
- --highlight-orange: rgb(124, 45, 18);
7
- --highlight-purple: rgb(76, 29, 149);
8
- --highlight-fg: rgb(250, 250, 250);
9
- `;var ARTICLE_HIGHLIGHT_CSS=`
10
- .article-body {
11
- --highlight-yellow: rgb(254, 249, 195);
12
- --highlight-green: rgb(187, 247, 208);
13
- --highlight-blue: rgb(191, 219, 254);
14
- --highlight-pink: rgb(251, 207, 232);
15
- --highlight-orange: rgb(254, 215, 170);
16
- --highlight-purple: rgb(221, 214, 254);
17
- --highlight-fg: rgb(24, 24, 27);
18
- }
19
- /* Dark set by hand (account theme) and sites fixed to dark */
20
- .dark .article-body,
21
- html:has(.site-renderer-root[data-color-scheme="dark"]) .article-body {
22
- ${HIGHLIGHT_DARK_VARS}
23
- }
24
- /* Sites fixed to light: force the light variables over an outer html.dark */
25
- html:has(.site-renderer-root[data-color-scheme="light"]) .article-body {
26
- --highlight-yellow: rgb(254, 249, 195);
27
- --highlight-green: rgb(187, 247, 208);
28
- --highlight-blue: rgb(191, 219, 254);
29
- --highlight-pink: rgb(251, 207, 232);
30
- --highlight-orange: rgb(254, 215, 170);
31
- --highlight-purple: rgb(221, 214, 254);
32
- --highlight-fg: rgb(24, 24, 27);
33
- }
34
- @media (prefers-color-scheme: dark) {
35
- /* Follow the system setting, except on sites fixed to light */
36
- html.system:not(:has(.site-renderer-root[data-color-scheme="light"])) .article-body {
37
- ${HIGHLIGHT_DARK_VARS}
38
- }
39
- }
40
- `;var ARTICLE_TABLE_CSS=`
41
- .article-body table {
42
- border-collapse: separate;
43
- border-spacing: 0;
44
- width: 100%;
45
- table-layout: auto;
46
- margin: 1.5rem 0;
47
- border: 1px solid var(--site-border, rgb(228 228 231));
48
- border-radius: var(--site-radius-xl, 12px);
49
- overflow: hidden;
50
- }
51
- .article-body thead, .article-body tbody tr { border: 0; }
52
- .article-body th, .article-body td {
53
- border-right: 1px solid var(--site-border, rgb(228 228 231));
54
- border-bottom: 1px solid var(--site-border, rgb(228 228 231));
55
- padding: 0.5rem 0.75rem;
56
- text-align: left;
57
- vertical-align: top;
58
- min-width: 4rem;
59
- font-size: 0.95rem;
60
- line-height: 1.6;
61
- }
62
- /* Header tint is mixed from the surrounding text colour and the cell text is inherited: a fixed light background would not follow
63
- the section surface (white links on light grey on a brand surface) or a system-level dark mode. */
64
- .article-body th {
65
- font-weight: inherit;
66
- background: color-mix(in srgb, var(--site-fg, rgb(24 24 27)) 6%, transparent);
67
- }
68
- .article-body th:last-child, .article-body td:last-child { border-right: 0; }
69
- .article-body tr:last-child td, .article-body tr:last-child th { border-bottom: 0; }
70
- /* The four corner cells carry the radius themselves, so the background cannot spill where overflow:hidden on a table is unreliable.
71
- Top corners match th/td; bottom corners match td only, so a thead row is not rounded by mistake. */
72
- .article-body tr:first-child th:first-child, .article-body tr:first-child td:first-child { border-top-left-radius: calc(var(--site-radius-xl, 12px) - 1px); }
73
- .article-body tr:first-child th:last-child, .article-body tr:first-child td:last-child { border-top-right-radius: calc(var(--site-radius-xl, 12px) - 1px); }
74
- .article-body tr:last-child td:first-child { border-bottom-left-radius: calc(var(--site-radius-xl, 12px) - 1px); }
75
- .article-body tr:last-child td:last-child { border-bottom-right-radius: calc(var(--site-radius-xl, 12px) - 1px); }
76
- /* An empty cell keeps one line of height (same as the editor's empty paragraph; the row does not collapse) */
77
- .article-body th:empty::after, .article-body td:empty::after {
78
- content: "\\00a0";
79
- }
80
- /* <code> inside a code block gets its background from <pre>; drop the inline-code styles it would repeat */
81
- .article-body pre code {
82
- background: transparent;
83
- padding: 0;
84
- border-radius: 0;
85
- font-size: inherit;
86
- }
87
- /* An empty code block keeps one line of height */
88
- .article-body pre:empty::after, .article-body pre code:empty::after {
89
- content: "\\00a0";
90
- }
91
- `;function ArticleMarkdown({content,ctaPresets,apiBase,websiteId}){const segments=coalesceFaqSegments(parseArticleSegments(content));const assignId=createHeadingIdAssigner();return jsxs8(Fragment5,{children:[jsx14("style",{dangerouslySetInnerHTML:{__html:`${ARTICLE_HIGHLIGHT_CSS}${ARTICLE_TABLE_CSS}`}}),jsx14("div",{className:"article-body max-w-none [&>*:first-child]:mt-0 [&>*:first-child>*:first-child]:mt-0",children:segments.map((segment,i)=>{if(segment.type==="cta"){return jsx14(UserCtaShortcodeBlock,{config:segment.config,presets:ctaPresets},i)}if(segment.type==="faq"){return jsx14(UserFaqShortcodeBlock,{config:segment.config},i)}if(segment.type==="embed"){return jsx14(EmbedBlock,{url:segment.config.url,embedType:segment.config.embedType},i)}if(segment.type==="audio"){return jsx14(AudioBlock,{src:segment.config.src,title:segment.config.title},i)}if(segment.type==="pdf"){return jsx14(PdfBlock,{src:segment.config.src,title:segment.config.title,pageCount:segment.config.pageCount,thumbnailUrl:segment.config.thumbnailUrl,assetId:segment.config.assetId,display:segment.config.display,apiBase,websiteId},i)}if(segment.type==="file"){return jsx14(FileAttachmentBlock,{assetId:segment.config.assetId,name:segment.config.name,size:segment.config.size,mimeType:segment.config.mimeType,apiBase,websiteId},i)}if(segment.type==="gallery"){return jsx14(GalleryBlock,{config:segment.config},i)}if(segment.type==="toggle"){return jsx14(ToggleBlock,{title:segment.config.title,children:renderArticleRichText(segment.config.content,assignId)},i)}if(segment.type==="callout"){return jsx14(CalloutBlock,{tone:segment.config.tone,title:segment.config.title,children:renderArticleRichText(segment.config.content,assignId)},i)}return jsx14(Fragment4,{children:renderArticleRichText(segment.value,assignId)},i)})})]})}import{z}from"zod";var DELIVERABLE_EMBED_PROVIDERS=["youtube","vimeo","loom"];var deliverableEmbedSchema=z.object({provider:z.enum(DELIVERABLE_EMBED_PROVIDERS),id:z.string().trim().min(1).max(128)});var certificateSettingsSchema=z.object({enabled:z.boolean().default(false),title:z.string().trim().max(120).nullable().default(null),signatureName:z.string().trim().max(80).nullable().default(null),signatureTitle:z.string().trim().max(80).nullable().default(null),signatureAssetId:z.string().trim().min(1).nullable().default(null),showLogo:z.boolean().default(true),note:z.string().trim().max(160).nullable().default(null),backgroundAssetId:z.string().trim().min(1).nullable().default(null),backgroundOverlay:z.boolean().default(false)});var DEFAULT_CERTIFICATE_SETTINGS={enabled:false,title:null,signatureName:null,signatureTitle:null,signatureAssetId:null,showLogo:true,note:null,backgroundAssetId:null,backgroundOverlay:false};var completionRuleSchema=z.discriminatedUnion("type",[z.object({type:z.literal("all_units")}),z.object({type:z.literal("percent"),percent:z.number().int().min(1).max(100)}),z.object({type:z.literal("quiz_passed"),unitId:z.string().trim().min(1)})]);var deliverableSettingsSchema=z.object({completionRule:completionRuleSchema.default({type:"all_units"}),certificate:certificateSettingsSchema.default(DEFAULT_CERTIFICATE_SETTINGS),comments:z.object({enabled:z.boolean().default(false),threaded:z.boolean().default(true),requireReview:z.boolean().default(true),reactions:z.boolean().default(false)}).default({enabled:false,threaded:true,requireReview:true,reactions:false}),requireSequential:z.boolean().default(false),mediaCompletionPercent:z.number().int().min(50).max(100).multipleOf(5).default(90)});var DEFAULT_DELIVERABLE_SETTINGS=deliverableSettingsSchema.parse({});var DELIVERABLE_UNIT_BODY_MAX_BYTES=512*1024;var featureKeySchema=z.string().trim().min(1).max(80).regex(/^[a-z0-9][a-z0-9-]*$/,"Feature keys may only contain lowercase letters, digits and hyphens");function computeSequenceLocks(input){const locks=new Map;let gate=null;for(const leaf of input.leaves){const counts=leaf.countsTowardCompletion!==false;if(gate&&counts&&!leaf.isPreview)locks.set(leaf.id,gate);if(gate||!counts||input.completedUnitIds.has(leaf.id))continue;if(input.requireSequential||leaf.isPrerequisite)gate=leaf.id}return locks}function groupUnits(units){const byParent=new Map;for(const u of units){const list=byParent.get(u.parentId)??[];list.push(u);byParent.set(u.parentId,list)}const sort=list=>[...list].sort((a,b)=>a.order-b.order);const top=sort(byParent.get(null)??[]);const groups=[];const loose=[];for(const t of top){const children=byParent.get(t.id);if(children&&children.length>0)groups.push({chapter:t,units:sort(children)});else if(t.kind!=="chapter")loose.push(t);else groups.push({chapter:t,units:[]})}if(loose.length>0)groups.unshift({chapter:null,units:loose});return groups}function orderedLeafUnits(units){return groupUnits(units).flatMap(g=>g.units)}function pickResumeUnit(units){const leaves=orderedLeafUnits(units);return leaves.find(u=>u.access.granted&&u.progress!=="completed")??leaves.find(u=>u.access.granted)??null}import{Fragment as Fragment6,jsx as jsx15,jsxs as jsxs9}from"react/jsx-runtime";var AUTOPLAY_STORAGE_KEY="kanorio:autoplay-next";var TRANSCRIPT_STORAGE_KEY="kanorio:transcript-open";function captionTracksOf(renditions){const tracks=(renditions??[]).flatMap(r=>r.kind==="captions"&&r.locale?[{locale:r.locale,url:r.url,source:r.source??"ai",edited:r.edited??false}]:[]);return tracks.length>0?tracks:void 0}function fill2(template,vars){return template.replace(/\{(\w+)\}/g,(_,k)=>String(vars[k]??""))}function formatDateTime(iso,locale,timeZone){try{return new Intl.DateTimeFormat(locale??void 0,{dateStyle:"medium",timeStyle:"short",timeZone:timeZone??void 0}).format(new Date(iso))}catch{return iso}}function formatDate(iso,locale,timeZone){try{return new Intl.DateTimeFormat(locale??void 0,{dateStyle:"medium",timeZone:timeZone??void 0}).format(new Date(iso))}catch{return iso}}function stripLeadingTitle(markdown,title){const match=/^\s*#\s+(.+?)\s*(?:\n|$)/.exec(markdown);if(match&&title&&match[1].trim()===title.trim())return markdown.slice(match[0].length);return markdown}var SURFACE2="bg-[var(--site-surface,#ffffff)]";var BORDER2="border-[var(--site-border,rgba(0,0,0,0.1))]";var MUTED2="text-[var(--site-fg-muted,#71717a)]";var FG2="text-[var(--site-fg,#18181b)]";var SECONDARY_BUTTON=`inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[var(--site-radius-button,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.15))] px-3.5 text-sm ${FG2} disabled:opacity-40`;var PRIMARY_BUTTON="inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[var(--site-radius-button,0.5rem)] px-4 text-sm font-medium text-[var(--brand-foreground,#ffffff)] disabled:opacity-40";var ICON_BUTTON=`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--site-radius-button,0.5rem)] ${MUTED2} hover:bg-black/5 dark:hover:bg-white/10`;function embedSrc(embed){const id=encodeURIComponent(embed.id);switch(embed.provider){case"youtube":return`https://www.youtube-nocookie.com/embed/${id}`;case"vimeo":return`https://player.vimeo.com/video/${id}`;case"loom":return`https://www.loom.com/embed/${id}`;default:return null}}var REPORT_INTERVAL_MS=2e4;var RUN_BREAK_SECONDS=2.5;var PlaybackTracker=class{sessionId;runStart=null;lastTime=0;rate=1;pending=[];seekTargets=[];stallStartedAt=null;stallCount=0;stallMs=0;startupMs=null;startupSent=false;playRequestedAt=null;rendition=null;renditionSent=null;duration=0;constructor(){this.sessionId=typeof crypto!=="undefined"&&"randomUUID"in crypto?crypto.randomUUID():`s_${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}get position(){return this.lastTime}closeRun(){if(this.runStart!==null&&this.lastTime-this.runStart>=.2)this.pending.push([this.runStart,this.lastTime,this.rate]);this.runStart=null}timeUpdate(time,duration){if(duration>0)this.duration=duration;if(this.runStart===null){this.runStart=time}else if(Math.abs(time-this.lastTime)>RUN_BREAK_SECONDS){this.closeRun();this.runStart=time}this.lastTime=time}event(e){switch(e.type){case"play":if(this.playRequestedAt===null&&this.startupMs===null)this.playRequestedAt=Date.now();break;case"started":if(this.playRequestedAt!==null&&this.startupMs===null)this.startupMs=Date.now()-this.playRequestedAt;break;case"pause":case"ended":this.closeRun();this.lastTime=e.time;break;case"seeked":this.closeRun();this.seekTargets.push(Math.floor(e.time));this.lastTime=e.time;this.runStart=null;break;case"ratechange":this.closeRun();this.rate=e.rate>0?e.rate:1;break;case"waiting":if(this.stallStartedAt===null)this.stallStartedAt=Date.now();break;case"playing":if(this.stallStartedAt!==null){const ms=Date.now()-this.stallStartedAt;this.stallStartedAt=null;if(this.startupMs!==null||this.playRequestedAt===null){this.stallCount+=1;this.stallMs+=ms}}break;case"quality":if(e.height)this.rendition=this.rendition===null?e.height:Math.min(this.rendition,e.height);break}}flush(final){if(final)this.closeRun();else if(this.runStart!==null&&this.lastTime-this.runStart>=.2){this.pending.push([this.runStart,this.lastTime,this.rate]);this.runStart=this.lastTime}const hasStats=this.stallCount>0||this.startupMs!==null&&!this.startupSent||this.rendition!==null&&this.rendition!==this.renditionSent;if(this.pending.length===0&&this.seekTargets.length===0&&!hasStats)return null;const item={sessionId:this.sessionId,segments:this.pending,positionSeconds:this.lastTime,...this.duration>0?{durationSeconds:this.duration}:{},...this.seekTargets.length?{seekTargets:this.seekTargets}:{},...this.stallCount>0?{stallCount:this.stallCount,stallMs:this.stallMs}:{},...this.startupMs!==null&&!this.startupSent?{startupMs:this.startupMs}:{},...this.rendition!==null&&this.rendition!==this.renditionSent?{rendition:this.rendition}:{},device:classifyDevice({width:typeof window!=="undefined"?window.innerWidth:1280,coarsePointer:typeof window!=="undefined"&&typeof window.matchMedia==="function"?window.matchMedia("(pointer: coarse)").matches:false})};this.pending=[];this.seekTargets=[];this.stallCount=0;this.stallMs=0;if(this.startupMs!==null)this.startupSent=true;if(this.rendition!==null)this.renditionSent=this.rendition;return item}};function DeliverablePlayer({tree,client,labels,locale,timeZone,initialUnitId,onUnitChange,layout="embedded",backHref,backLabel,className,captionLocale,onCaptionChange}){const page=layout==="page";const HeaderTag=page?"header":"div";const MainTag=page?"main":"div";const AsideTag=page?"aside":"div";const NavTag=page?"nav":"div";const isDownloadPack=tree.structure==="DOWNLOAD";const groups=useMemo2(()=>groupUnits(tree.units),[tree.units]);const leaves=useMemo2(()=>groups.flatMap(g=>g.units),[groups]);const[progressByUnit,setProgressByUnit]=useState3(()=>Object.fromEntries(tree.units.map(u=>[u.id,u.progress])));const[deliverableProgress,setDeliverableProgress]=useState3(tree.progress);const[currentId,setCurrentId]=useState3(()=>{const requested=initialUnitId?tree.units.find(u=>u.id===initialUnitId):null;return(requested??pickResumeUnit(tree.units))?.id??null});const current=leaves.find(u=>u.id===currentId)??null;const currentIndex=current?leaves.findIndex(u=>u.id===current.id):-1;const[resumeId]=useState3(()=>tree.units.some(u=>u.progress!=="not_started")?pickResumeUnit(tree.units)?.id??null:null);const[sidebarOpen,setSidebarOpen]=useState3(true);const[drawerOpen,setDrawerOpen]=useState3(false);const[collapsedChapters,setCollapsedChapters]=useState3(()=>new Set);const[settingsOpen,setSettingsOpen]=useState3(false);const[retryTick,setRetryTick]=useState3(0);const[attachmentBusy,setAttachmentBusy]=useState3(null);const[attachmentFailed,setAttachmentFailed]=useState3(false);const completedIds=useMemo2(()=>new Set(Object.entries(progressByUnit).filter(([,status])=>status==="completed").map(([id])=>id)),[progressByUnit]);const locks=useMemo2(()=>computeSequenceLocks({leaves:leaves.map(u=>({id:u.id,isPreview:u.isPreview,countsTowardCompletion:u.countsTowardCompletion,isPrerequisite:u.isPrerequisite})),completedUnitIds:completedIds,requireSequential:Boolean(tree.settings?.requireSequential)}),[leaves,completedIds,tree.settings?.requireSequential]);const isGranted=useCallback(u=>u.access.granted||u.access.reason==="prerequisite"&&!locks.has(u.id),[locks]);const lockedByTitle=u=>leaves.find(x=>x.id===(locks.get(u.id)??u.access.lockedByUnitId))?.title||"";const[opened,setOpened]=useState3(null);const[openError,setOpenError]=useState3(null);const[loading,setLoading]=useState3(false);const[transcriptOpen,setTranscriptOpen]=useState3(false);useEffect2(()=>{try{setTranscriptOpen(window.localStorage.getItem(TRANSCRIPT_STORAGE_KEY)==="1")}catch{}},[]);const toggleTranscript=next2=>{setTranscriptOpen(next2);try{window.localStorage.setItem(TRANSCRIPT_STORAGE_KEY,next2?"1":"0")}catch{}};const[transcriptLocale,setTranscriptLocale]=useState3(null);const[transcript,setTranscript]=useState3({unitId:"",status:"loading",data:null});const[transcriptTick,setTranscriptTick]=useState3(0);const[activeSegment,setActiveSegment]=useState3(-1);const[seekTo,setSeekTo]=useState3(null);const transcriptSegmentsRef=useRef2([]);transcriptSegmentsRef.current=transcript.status==="ready"&&transcript.data&&transcript.unitId===currentId?transcript.data.segments:[];const transcriptAvailable=Boolean(current&&(current.kind==="video"||current.kind==="audio")&&opened&&client.getTranscript);useEffect2(()=>{if(!transcriptAvailable||!current||!client.getTranscript)return;let cancelled=false;const unitId=current.id;setTranscript({unitId,status:"loading",data:null});setActiveSegment(-1);const wanted=transcriptLocale??captionLocale??locale??null;client.getTranscript(unitId,wanted).then(res=>{if(cancelled)return;if(res.ok)setTranscript({unitId,status:"ready",data:res});else setTranscript({unitId,status:res.code==="NO_TRANSCRIPT"||res.code==="NO_FILE"?"unavailable":"error",data:null})}).catch(()=>{if(!cancelled)setTranscript({unitId,status:"error",data:null})});return()=>{cancelled=true}},[transcriptAvailable,current?.id,transcriptLocale,transcriptTick]);const transcriptForCurrent=current&&transcript.unitId===current.id?transcript:null;const showTranscriptPanel=transcriptAvailable&&transcriptForCurrent!==null&&(transcriptForCurrent.status==="ready"||transcriptForCurrent.status==="error");useEffect2(()=>setTranscriptLocale(null),[currentId]);const[quizAnswers,setQuizAnswers]=useState3({});const[quizResult,setQuizResult]=useState3(null);const[quizBusy,setQuizBusy]=useState3(false);useEffect2(()=>{setQuizAnswers({});setQuizResult(null)},[currentId]);const[autoplayNext,setAutoplayNext]=useState3(false);useEffect2(()=>{try{setAutoplayNext(window.localStorage.getItem(AUTOPLAY_STORAGE_KEY)==="1")}catch{}},[]);const toggleAutoplay=next2=>{setAutoplayNext(next2);try{window.localStorage.setItem(AUTOPLAY_STORAGE_KEY,next2?"1":"0")}catch{}};const[certificate,setCertificate]=useState3(tree.certificate??null);const[certificateBusy,setCertificateBusy]=useState3(false);const downloadCertificate=async()=>{setCertificateBusy(true);try{const res=await client.getCertificate(tree.id);if(res.ok){setCertificate(prev=>({enabled:true,serial:res.certificate.serial,issuedAt:res.certificate.issuedAt,...prev?{}:{}}));window.open(res.certificate.url,"_blank","noopener,noreferrer")}}finally{setCertificateBusy(false)}};const lastReportAt=useRef2(0);const trackerRef=useRef2(null);const trackerUnitRef=useRef2(null);const trackerFor=useCallback(unitId=>{if(trackerUnitRef.current!==unitId||!trackerRef.current){trackerRef.current=new PlaybackTracker;trackerUnitRef.current=unitId}return trackerRef.current},[]);const select=useCallback(id=>{setCurrentId(id);setDrawerOpen(false);onUnitChange?.(id)},[onUnitChange]);useEffect2(()=>{const chapterId=current?.parentId;if(!chapterId)return;setCollapsedChapters(prev=>{if(!prev.has(chapterId))return prev;const next2=new Set(prev);next2.delete(chapterId);return next2})},[current?.parentId,currentId]);const wasCompleted=useRef2(Boolean(tree.progress?.completed));const[justCompleted,setJustCompleted]=useState3(false);useEffect2(()=>{const completed=Boolean(deliverableProgress?.completed);if(completed&&!wasCompleted.current)setJustCompleted(true);wasCompleted.current=completed},[deliverableProgress?.completed]);useEffect2(()=>{setOpened(null);setOpenError(null);setAttachmentFailed(false);setLoading(false);if(!current||!isGranted(current))return;if(!current.hasFile)return;let cancelled=false;setLoading(true);client.openUnit(current.id,"read").then(res=>{if(cancelled)return;if(res.ok)setOpened(res);else setOpenError(res.code)}).catch(()=>{if(!cancelled)setOpenError("NETWORK")}).finally(()=>{if(!cancelled)setLoading(false)});return()=>{cancelled=true}},[current,client,isGranted,retryTick]);const report=useCallback(async(unitId,input,options)=>{if(isDownloadPack)return;try{const res=await client.reportProgress({unitId,reports:[input],...options?.lite?{lite:true}:{}});if(res.ok){setProgressByUnit(prev=>({...prev,[unitId]:res.unit}));if(res.deliverable)setDeliverableProgress({percent:res.deliverable.percent,completed:res.deliverable.completed,completedAt:res.deliverable.completedAt??null})}}catch{}},[client,isDownloadPack]);const flushTracker=useCallback((unitId,mode)=>{const tracker=trackerRef.current;if(!tracker||trackerUnitRef.current!==unitId)return;const item=tracker.flush(mode!=="heartbeat");if(!item)return;lastReportAt.current=Date.now();void report(unitId,item,{lite:mode==="heartbeat"})},[report]);const handleTimeUpdate=useCallback((currentTime,duration)=>{if(!current)return;trackerFor(current.id).timeUpdate(currentTime,duration);const segments=transcriptSegmentsRef.current;if(segments.length>0){const index=activeSegmentIndex(segments,currentTime);setActiveSegment(prev=>prev===index?prev:index)}const now=Date.now();if(now-lastReportAt.current<REPORT_INTERVAL_MS)return;flushTracker(current.id,"heartbeat")},[current,trackerFor,flushTracker]);const handlePlaybackEvent=useCallback(event=>{if(!current)return;trackerFor(current.id).event(event);if(event.type==="pause"||event.type==="seeked")flushTracker(current.id,"event")},[current,trackerFor,flushTracker]);const handleComplete=useCallback(()=>{if(!current)return;const tracker=trackerFor(current.id);const item=tracker.flush(true)??{sessionId:tracker.sessionId,positionSeconds:tracker.position,...tracker.duration>0?{durationSeconds:tracker.duration}:{}};lastReportAt.current=Date.now();void report(current.id,{...item,completed:true});if(autoplayNext){const next2=leaves[currentIndex+1];if(next2&&isGranted(next2))window.setTimeout(()=>select(next2.id),800)}},[current,trackerFor,report,autoplayNext,leaves,currentIndex,isGranted,select]);const submitQuiz=async()=>{if(!current)return;setQuizBusy(true);try{const res=await client.submitQuiz({unitId:current.id,answers:quizAnswers});if(res.ok){setQuizResult(res);setProgressByUnit(prev=>({...prev,[current.id]:res.unit}));setDeliverableProgress({percent:res.deliverable.percent,completed:res.deliverable.completed,completedAt:res.deliverable.completedAt??null})}}finally{setQuizBusy(false)}};const autoTracked=!!current&&(current.kind==="video"||current.kind==="audio"||Boolean(opened?.mimeType&&(opened.mimeType.startsWith("video/")||opened.mimeType.startsWith("audio/"))));const currentStatus=current?progressByUnit[current.id]??current.progress:"not_started";const canMarkComplete=!!current&&!isDownloadPack&&isGranted(current)&&!autoTracked&&currentStatus!=="completed";useEffect2(()=>{if(!current)return;const unitId=current.id;const onHide=()=>flushTracker(unitId,"final");const onVisibility=()=>{if(document.visibilityState==="hidden")flushTracker(unitId,"event")};window.addEventListener("pagehide",onHide);document.addEventListener("visibilitychange",onVisibility);return()=>{window.removeEventListener("pagehide",onHide);document.removeEventListener("visibilitychange",onVisibility);flushTracker(unitId,"final")}},[current,flushTracker]);useEffect2(()=>{if(!current||isDownloadPack||!isGranted(current))return;if(current.kind==="video"||current.kind==="audio")return;if((progressByUnit[current.id]??current.progress)!=="not_started")return;void report(current.id,{opened:true})},[current?.id,isDownloadPack]);const resumeAt=unit=>{if(isDownloadPack)return void 0;const status=progressByUnit[unit.id]??unit.progress;if(status==="completed")return void 0;const at=typeof unit.lastPosition==="number"?unit.lastPosition:unit.positionSeconds;return at>5?at:void 0};const goto=delta=>{const next2=leaves[currentIndex+delta];if(next2&&isGranted(next2))select(next2.id)};const downloadUnit=async unitId=>{const res=await client.openUnit(unitId,"download");if(res.ok)window.open(res.url,"_blank","noopener,noreferrer")};const handleDownload=()=>{if(current)void downloadUnit(current.id)};const downloadAttachment=async(unitId,attachmentId)=>{if(attachmentBusy)return;setAttachmentBusy(attachmentId);setAttachmentFailed(false);const res=await client.openUnit(unitId,"download",{attachmentId}).catch(()=>({ok:false,code:"NETWORK"}));setAttachmentBusy(null);if(res.ok)window.open(res.url,"_blank","noopener,noreferrer");else setAttachmentFailed(true)};const next=currentIndex>=0?leaves[currentIndex+1]??null:null;const previous=currentIndex>0?leaves[currentIndex-1]:null;const manualComplete=canMarkComplete&&current?.kind!=="quiz";const nextOpensAfterComplete=()=>{if(!next||!current)return false;if(next.access.granted)return true;if(next.access.reason!=="prerequisite")return false;const after=computeSequenceLocks({leaves:leaves.map(u=>({id:u.id,isPreview:u.isPreview,countsTowardCompletion:u.countsTowardCompletion,isPrerequisite:u.isPrerequisite})),completedUnitIds:new Set([...completedIds,current.id]),requireSequential:Boolean(tree.settings?.requireSequential)});return!after.has(next.id)};const[advancing,setAdvancing]=useState3(false);const completeAndContinue=async()=>{if(!current||advancing)return;setAdvancing(true);try{const opens=nextOpensAfterComplete();await report(current.id,{completed:true});if(next&&opens)select(next.id)}finally{setAdvancing(false)}};const nextReady=Boolean(next&&isGranted(next));const blockedByCurrent=Boolean(next&&!nextReady&&!manualComplete&&currentStatus!=="completed"&&next.access.reason==="prerequisite");const primaryAction=manualComplete?{label:next?labels.completeAndContinue:labels.markComplete,onClick:()=>void completeAndContinue(),disabled:advancing,icon:true}:{label:labels.nextUnit,onClick:()=>goto(1),disabled:!nextReady,icon:false};const showPrimary=manualComplete||Boolean(next);const unitMeta=u=>u.duration?fill2(labels.minutes,{count:Math.max(1,Math.round(u.duration/60))}):u.pageCount?fill2(labels.pages,{count:u.pageCount}):null;const toggleChapter=chapterId=>setCollapsedChapters(prev=>{const nextSet=new Set(prev);if(nextSet.has(chapterId))nextSet.delete(chapterId);else nextSet.add(chapterId);return nextSet});const outline=jsxs9(Fragment6,{children:[jsxs9("div",{className:cn("shrink-0 border-b px-4 py-2",BORDER2),children:[jsxs9("div",{className:"flex min-h-10 items-center justify-between gap-2",children:[jsxs9("div",{className:"min-w-0",children:[tree.authors&&tree.authors.length>0&&jsx15(AuthorList,{authors:tree.authors,className:"mb-1.5"}),jsxs9("p",{className:cn("text-xs",MUTED2),children:[fill2(labels.unitsCount,{count:leaves.length}),deliverableProgress&&!isDownloadPack?` \xB7 ${fill2(labels.progress,{percent:deliverableProgress.percent})}`:""]})]}),!isDownloadPack&&leaves.length>1&&jsx15("button",{type:"button",onClick:()=>setSettingsOpen(open=>!open),"aria-expanded":settingsOpen,"aria-label":labels.settings,title:labels.settings,className:cn(ICON_BUTTON,"-mr-2"),children:jsx15(Settings2,{className:"h-4 w-4","aria-hidden":"true"})})]}),settingsOpen&&jsxs9("button",{type:"button",role:"switch","aria-checked":autoplayNext,onClick:()=>toggleAutoplay(!autoplayNext),className:cn("flex min-h-10 w-full items-center justify-between gap-3 text-left text-sm",FG2),children:[labels.autoplayNext,jsx15("span",{"aria-hidden":true,className:cn("relative inline-flex h-5 w-9 shrink-0 rounded-full transition",autoplayNext?"bg-[var(--brand-color,#18181b)]":"bg-black/20 dark:bg-white/25"),children:jsx15("span",{className:cn("absolute top-0.5 h-4 w-4 rounded-full bg-white transition",autoplayNext?"left-[18px]":"left-0.5")})})]}),certificate?.enabled&&deliverableProgress?.completed&&jsxs9("button",{type:"button",onClick:()=>void downloadCertificate(),disabled:certificateBusy,className:cn(SECONDARY_BUTTON,"my-2 w-full"),children:[jsx15(Award,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.certificateDownload]})]}),jsxs9(NavTag,{role:page?void 0:"navigation","aria-label":labels.outline,className:"min-h-0 flex-1 overflow-y-auto p-2",children:[leaves.length===0&&jsx15("p",{className:cn("p-3 text-sm",MUTED2),children:labels.noUnits}),groups.map((g,gi)=>{const chapterId=g.chapter?.id??null;const collapsed=chapterId?collapsedChapters.has(chapterId):false;const counted=g.units.filter(u=>u.countsTowardCompletion!==false);const done=counted.filter(u=>(progressByUnit[u.id]??u.progress)==="completed").length;return jsxs9("div",{className:"mb-1",children:[g.chapter&&jsxs9("button",{type:"button",onClick:()=>toggleChapter(g.chapter.id),"aria-expanded":!collapsed,className:cn("flex w-full items-start gap-2 rounded-lg px-2 py-2 text-left text-sm font-semibold hover:bg-black/[0.03] dark:hover:bg-white/[0.06]",FG2),children:[jsx15(ChevronDown,{className:cn("mt-0.5 h-4 w-4 shrink-0 transition-transform",MUTED2,collapsed&&"-rotate-90"),"aria-hidden":"true"}),jsx15("span",{className:"min-w-0 flex-1",children:g.chapter.title}),!isDownloadPack&&counted.length>0&&jsxs9("span",{className:cn("shrink-0 text-xs font-normal tabular-nums",MUTED2),children:[done,"/",counted.length]})]}),!collapsed&&jsx15("ul",{className:"space-y-0.5",children:g.units.map(u=>{const status=progressByUnit[u.id]??u.progress;const active=u.id===currentId;const locked=!isGranted(u);const rowDownload=isDownloadPack&&!locked&&u.allowDownload&&u.hasFile;const meta=unitMeta(u);const lockText=locked&&u.access.reason==="not_released"&&u.access.availableAt?fill2(labels.unlocksAt,{date:formatDateTime(u.access.availableAt,locale,timeZone)}):locked&&u.access.reason==="prerequisite"?fill2(labels.lockedBy,{title:lockedByTitle(u)}):locked?labels.locked:null;const tags=[u.countsTowardCompletion===false&&!isDownloadPack?labels.optional:null,u.isPreview&&!locked?labels.preview:null,meta].filter(Boolean);return jsxs9("li",{className:cn(rowDownload&&"flex items-start gap-1"),children:[jsxs9("button",{type:"button",disabled:locked,"aria-current":active?"true":void 0,onClick:()=>select(u.id),className:cn("flex w-full items-start gap-2.5 rounded-lg px-2 py-2 text-left text-sm transition",active?"bg-black/5 font-medium dark:bg-white/10":"hover:bg-black/[0.03] dark:hover:bg-white/[0.06]",locked&&"cursor-not-allowed opacity-60",rowDownload&&"min-w-0 flex-1"),children:[jsx15("span",{className:cn("mt-0.5 shrink-0",MUTED2),children:locked?jsx15(Lock,{className:"h-4 w-4"}):isDownloadPack?jsx15(FileText,{className:"h-4 w-4"}):status==="completed"?jsx15(CircleCheck,{className:"h-4 w-4 text-emerald-600"}):status==="in-progress"?jsx15(CirclePlay,{className:"h-4 w-4"}):jsx15(Circle,{className:"h-4 w-4"})}),jsxs9("span",{className:"min-w-0 flex-1",children:[jsx15("span",{className:cn("line-clamp-2",FG2),children:u.title||u.kind}),tags.length>0&&jsx15("span",{className:cn("block text-xs",MUTED2),children:tags.join(" \xB7 ")}),lockText&&jsx15("span",{className:cn("block text-xs",MUTED2),children:lockText}),u.id===resumeId&&!locked&&status!=="completed"&&jsx15("span",{className:"block text-xs font-normal text-[var(--site-accent-text,var(--brand-color,#18181b))]",children:labels.lastViewed})]})]}),rowDownload&&jsx15("button",{type:"button",onClick:()=>void downloadUnit(u.id),"aria-label":`${labels.download}: ${u.title||u.kind}`,title:labels.download,className:cn(ICON_BUTTON,"mt-0.5 h-9 w-9"),children:jsx15(Download,{className:"h-4 w-4"})})]},u.id)})})]},chapterId??`loose-${gi}`)})]})]});const mediaFirst=!!current&&(current.kind==="video"||current.kind==="audio"||Boolean(current.embed&&embedSrc(current.embed)));const heading=current?jsxs9("div",{children:[jsx15("h2",{className:cn("text-lg font-bold sm:text-xl",FG2),children:current.title||current.kind}),current.description&&jsx15("p",{className:cn("mt-1 text-sm",MUTED2),children:current.description})]}):null;const unitBody=!current?null:current.embed&&embedSrc(current.embed)?jsx15("div",{className:"aspect-video w-full overflow-hidden rounded-[var(--site-radius-media,0.75rem)] bg-black",children:jsx15("iframe",{title:current.title??current.kind,src:embedSrc(current.embed),className:"h-full w-full",allow:"accelerometer; autoplay; encrypted-media; picture-in-picture",allowFullScreen:true})}):current.kind==="quiz"?jsx15(QuizView,{body:current.body,summary:current.quiz??null,answers:quizAnswers,result:quizResult,busy:quizBusy,labels,onAnswer:(questionId,optionIds)=>setQuizAnswers(prev=>({...prev,[questionId]:optionIds})),onSubmit:()=>void submitQuiz(),onRetry:()=>{setQuizAnswers({});setQuizResult(null)}}):current.kind==="text"?jsx15(MediaFactsProvider,{facts:current.body?.mediaFacts,children:jsx15("div",{className:"max-w-none",children:jsx15(ArticleMarkdown,{content:stripLeadingTitle(typeof current.body?.markdown==="string"?current.body.markdown:"",current.title)})})}):loading?jsx15("div",{className:"aspect-video w-full animate-pulse rounded-[var(--site-radius-media,0.75rem)] bg-black/5 dark:bg-white/10"}):openError&&openError!=="NO_FILE"?jsxs9("div",{role:"alert",className:cn("flex flex-col items-center gap-3 rounded-[var(--site-radius-media,0.75rem)] border border-dashed px-4 py-10 text-center text-sm",BORDER2,MUTED2),children:[jsx15("p",{children:labels.loadError}),jsxs9("button",{type:"button",onClick:()=>setRetryTick(tick=>tick+1),className:SECONDARY_BUTTON,children:[jsx15(RotateCw,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.retry]})]}):opened?jsx15(MediaPlayer,{src:opened.url,hlsSrc:opened.renditions?.find(r=>r.kind==="hls")?.url,thumbnails:opened.thumbnails??opened.renditions?.find(r=>r.kind==="thumbnails")?.url,streamingPartial:opened.streaming==="partial",captions:captionTracksOf(opened.renditions),captionLocale,onCaptionChange,thumbnailUrl:opened.poster??void 0,mimeType:opened.mimeType??"application/octet-stream",title:opened.title??current.title??void 0,fileName:opened.fileName,pageCount:current.pageCount??void 0,storageKey:`unit:${current.id}`,startTime:resumeAt(current),seekTo,chapters:opened.renditions?.find(r=>r.kind==="chapters")?.url,allowDownload:opened.allowDownload,downloadUrl:opened.allowDownload?opened.url:void 0,onTimeUpdate:handleTimeUpdate,onComplete:handleComplete,onPlaybackEvent:handlePlaybackEvent},current.id):jsx15("div",{className:cn("rounded-[var(--site-radius-media,0.75rem)] border border-dashed px-4 py-10 text-center text-sm",BORDER2,MUTED2),children:labels.unitEmpty});const primaryButton=showPrimary?jsxs9("button",{type:"button",onClick:primaryAction.onClick,disabled:primaryAction.disabled,className:cn(PRIMARY_BUTTON,"min-w-0"),style:{backgroundColor:"var(--brand-color,#18181b)"},children:[primaryAction.icon&&jsx15(CircleCheck,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),jsx15("span",{className:"truncate",children:primaryAction.label})]}):null;return jsxs9("div",{className:cn("flex flex-col",page?"h-dvh bg-[var(--site-surface-muted,#f4f4f5)]":cn("overflow-hidden rounded-[var(--site-radius-card,1rem)] border",BORDER2,SURFACE2),className),children:[jsxs9(HeaderTag,{className:cn("flex h-14 shrink-0 items-center gap-1 border-b px-2 sm:px-3",BORDER2,SURFACE2),children:[backHref&&jsx15("a",{href:backHref,"aria-label":backLabel,title:backLabel,className:ICON_BUTTON,children:jsx15(ArrowLeft,{className:"h-5 w-5","aria-hidden":"true"})}),jsx15("button",{type:"button",onClick:()=>setSidebarOpen(open=>!open),"aria-expanded":sidebarOpen,"aria-label":sidebarOpen?labels.hideOutline:labels.showOutline,title:sidebarOpen?labels.hideOutline:labels.showOutline,className:cn(ICON_BUTTON,"hidden lg:inline-flex"),children:jsx15(PanelLeft,{className:"h-5 w-5","aria-hidden":"true"})}),jsx15("p",{className:cn("min-w-0 flex-1 truncate px-1 text-sm font-semibold sm:text-base",FG2),children:tree.title}),deliverableProgress&&!isDownloadPack&&jsxs9("div",{className:"flex shrink-0 items-center gap-2 pr-1","aria-label":fill2(labels.progress,{percent:deliverableProgress.percent}),children:[jsx15("div",{className:"hidden h-1.5 w-24 overflow-hidden rounded-full bg-black/5 sm:block dark:bg-white/10",children:jsx15("div",{className:"h-full rounded-full",style:{width:`${deliverableProgress.percent}%`,backgroundColor:"var(--brand-color,#18181b)"}})}),jsxs9("span",{className:cn("text-xs tabular-nums",MUTED2),children:[deliverableProgress.percent,"%"]})]})]}),jsxs9("div",{className:cn("flex min-h-0 flex-1",!page&&"lg:max-h-[80vh]"),children:[sidebarOpen&&jsx15(AsideTag,{className:cn("hidden w-80 shrink-0 flex-col border-r lg:flex",BORDER2,SURFACE2),children:outline}),jsx15(MainTag,{className:"min-w-0 flex-1 overflow-y-auto",children:jsx15("div",{className:cn("mx-auto w-full max-w-4xl px-4 py-5 sm:px-6 lg:py-8",page&&"pb-24 lg:pb-8"),children:!current?jsx15("div",{className:cn("rounded-[var(--site-radius-card,1rem)] border border-dashed p-10 text-center text-sm",BORDER2,MUTED2),children:labels.noUnits}):jsxs9("div",{className:"space-y-4",children:[justCompleted&&jsxs9("div",{className:cn("flex flex-col items-center gap-3 rounded-[var(--site-radius-card,1rem)] border p-6 text-center",BORDER2,SURFACE2),role:"status",children:[jsx15("span",{className:"flex h-12 w-12 items-center justify-center rounded-full",style:{backgroundColor:"var(--brand-color,#18181b)",color:"var(--brand-foreground,#ffffff)"},children:jsx15(Award,{className:"h-6 w-6","aria-hidden":"true"})}),jsxs9("div",{children:[jsx15("p",{className:cn("text-lg font-bold",FG2),children:labels.courseCompletedTitle}),deliverableProgress?.completedAt&&jsx15("p",{className:cn("mt-1 text-sm",MUTED2),children:fill2(labels.courseCompletedOn,{date:formatDate(deliverableProgress.completedAt,locale,timeZone)})})]}),jsxs9("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[certificate?.enabled&&jsxs9("button",{type:"button",onClick:()=>void downloadCertificate(),disabled:certificateBusy,className:PRIMARY_BUTTON,style:{backgroundColor:"var(--brand-color,#18181b)"},children:[jsx15(Award,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.certificateDownload]}),backHref&&backLabel&&jsx15("a",{href:backHref,className:SECONDARY_BUTTON,children:backLabel}),jsx15("button",{type:"button",onClick:()=>setJustCompleted(false),className:SECONDARY_BUTTON,children:labels.keepBrowsing})]})]}),!mediaFirst&&heading,unitBody,mediaFirst&&heading,showTranscriptPanel&&current&&transcriptForCurrent&&jsx15(TranscriptPanel,{labels,open:transcriptOpen,onToggle:toggleTranscript,status:transcriptForCurrent.status==="ready"?"ready":"error",data:transcriptForCurrent.data,activeIndex:activeSegment,onSeek:time=>setSeekTo({time,nonce:Date.now()}),onLocaleChange:next2=>setTranscriptLocale(next2),onRetry:()=>setTranscriptTick(tick=>tick+1),uiLocale:locale??"en",fileName:current.title||opened?.fileName||"transcript"}),current.attachments&&current.attachments.length>0&&jsxs9("div",{role:"group","aria-label":labels.attachments,children:[jsx15("h3",{className:cn("mb-2 text-sm font-semibold",FG2),children:labels.attachments}),jsx15("ul",{className:cn("divide-y rounded-[var(--site-radius-card,0.75rem)] border",BORDER2,SURFACE2),children:current.attachments.map(file=>jsxs9("li",{className:cn("flex min-h-14 items-center gap-3 px-3 py-2",BORDER2),children:[jsx15(Paperclip,{className:cn("h-4 w-4 shrink-0",MUTED2),"aria-hidden":"true"}),jsxs9("span",{className:"min-w-0 flex-1",children:[jsx15("span",{className:cn("block break-words text-sm font-medium",FG2),children:file.fileName}),file.bytes!=null&&jsx15("span",{className:cn("block text-xs",MUTED2),children:formatFileSize(file.bytes,{locale:locale??"en"})})]}),jsxs9("button",{type:"button",onClick:()=>void downloadAttachment(current.id,file.id),disabled:attachmentBusy!==null,"aria-label":fill2(labels.downloadFile,{name:file.fileName}),className:cn(SECONDARY_BUTTON,"shrink-0"),children:[jsx15(Download,{className:cn("h-4 w-4",attachmentBusy===file.id&&"animate-pulse"),"aria-hidden":"true"})," ",jsx15("span",{className:"hidden sm:inline",children:labels.download})]})]},file.id))}),attachmentFailed&&jsx15("p",{role:"alert",className:"mt-2 text-sm text-red-600 dark:text-red-400",children:labels.loadError})]}),jsxs9("div",{className:"flex flex-wrap items-center gap-2",children:[current.allowDownload&&current.hasFile&&jsxs9("button",{type:"button",onClick:handleDownload,className:SECONDARY_BUTTON,children:[jsx15(Download,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.download]}),current.embed&&embedSrc(current.embed)&&jsxs9("a",{href:embedSrc(current.embed).replace("/embed/","/watch?v="),target:"_blank",rel:"noopener noreferrer",className:cn("inline-flex min-h-11 items-center gap-1.5 text-sm underline underline-offset-4",MUTED2),children:[jsx15(ExternalLink,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.open]}),!isDownloadPack&&currentStatus==="completed"&&jsxs9("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400",children:[jsx15(CircleCheck,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.completed]})]}),jsxs9("div",{className:cn("items-center justify-between gap-3 border-t pt-4",BORDER2,page?"hidden lg:flex":"flex"),children:[jsxs9("button",{type:"button",onClick:()=>goto(-1),disabled:!previous,className:SECONDARY_BUTTON,children:[jsx15(ChevronLeft,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.previousUnit]}),jsxs9("div",{className:"flex min-w-0 items-center gap-3",children:[blockedByCurrent&&jsx15("span",{className:cn("text-xs",MUTED2),children:labels.completeToContinue}),primaryButton]})]})]})})})]}),page?jsxs9("div",{className:cn("fixed inset-x-0 bottom-0 z-30 flex items-center gap-2 border-t px-3 pt-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))] lg:hidden",BORDER2,SURFACE2),children:[jsxs9("button",{type:"button",onClick:()=>setDrawerOpen(true),"aria-haspopup":"dialog","aria-expanded":drawerOpen,className:cn(SECONDARY_BUTTON,"shrink-0"),children:[jsx15(List,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.outline]}),jsx15("button",{type:"button",onClick:()=>goto(-1),disabled:!previous,"aria-label":labels.previousUnit,title:labels.previousUnit,className:cn(SECONDARY_BUTTON,"shrink-0 px-3"),children:jsx15(ChevronLeft,{className:"h-4 w-4","aria-hidden":"true"})}),primaryButton?jsx15("div",{className:"flex min-w-0 flex-1 justify-end [&>button]:w-full",children:primaryButton}):jsx15("div",{className:"flex-1"})]}):jsx15("div",{className:cn("flex border-t p-2 lg:hidden",BORDER2),children:jsxs9("button",{type:"button",onClick:()=>setDrawerOpen(true),"aria-haspopup":"dialog","aria-expanded":drawerOpen,className:cn(SECONDARY_BUTTON,"w-full"),children:[jsx15(List,{className:"h-4 w-4","aria-hidden":"true"})," ",labels.outline]})}),drawerOpen&&jsxs9("div",{className:"fixed inset-0 z-40 lg:hidden",role:"dialog","aria-modal":"true","aria-label":labels.outline,children:[jsx15("button",{type:"button","aria-label":labels.closeOutline,onClick:()=>setDrawerOpen(false),className:"absolute inset-0 bg-black/40"}),jsxs9("div",{className:cn("absolute inset-x-0 bottom-0 flex max-h-[85dvh] flex-col rounded-t-2xl pb-[env(safe-area-inset-bottom)]",SURFACE2),children:[jsxs9("div",{className:cn("flex shrink-0 items-center justify-between gap-2 border-b px-4 py-2",BORDER2),children:[jsx15("p",{className:cn("min-w-0 truncate text-sm font-semibold",FG2),children:labels.outline}),jsx15("button",{type:"button",onClick:()=>setDrawerOpen(false),"aria-label":labels.closeOutline,title:labels.closeOutline,className:ICON_BUTTON,children:jsx15(X,{className:"h-5 w-5","aria-hidden":"true"})})]}),outline]})]})]})}function toggleOption(chosen,optionId){const next=new Set(chosen);if(next.has(optionId))next.delete(optionId);else next.add(optionId);return[...next]}function QuizView({body,summary,answers,result,busy,labels,onAnswer,onSubmit,onRetry}){const questions=body?.questions??[];if(!body||questions.length===0)return jsx15("p",{className:"text-sm text-[var(--site-fg-muted,#71717a)]",children:labels.quizNotReady});const practice=(body.settings.mode??summary?.mode??"graded")==="practice";const revealed=result?.reveal?new Map(result.reveal.questions.map(q=>[q.id,q])):null;const allAnswered=questions.every(q=>(answers[q.id]??[]).some(v=>v.trim().length>0));const attemptsLeft=practice||summary?.maxAttempts==null?null:Math.max(0,summary.maxAttempts-summary.attemptsUsed-(result?1:0));const alreadyPassed=!practice&&!result&&Boolean(summary?.passed);const outOfAttempts=!practice&&!result&&!alreadyPassed&&attemptsLeft===0;const muted="text-[var(--site-fg-muted,#71717a)]";const border="border-[var(--site-border,rgba(0,0,0,0.12))]";const fg="text-[var(--site-fg,#18181b)]";const primaryButton="min-h-10 rounded-[var(--site-radius-button,0.5rem)] px-3.5 text-sm font-medium text-[var(--brand-foreground,#ffffff)] disabled:opacity-40";return jsxs9("div",{className:"space-y-5",children:[practice?jsx15("p",{className:cn("text-xs",muted),children:labels.quizPracticeHint}):jsxs9("p",{className:cn("text-xs",muted),children:[fill2(labels.quizPassingScore,{percent:body.settings.passingPercent}),attemptsLeft!==null&&!alreadyPassed&&!result?.passed?` \xB7 ${fill2(labels.quizAttemptsLeft,{count:attemptsLeft})}`:""]}),alreadyPassed&&jsxs9("p",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400",children:[jsx15(CircleCheck,{className:"h-4 w-4"})," ",labels.quizPassed,summary?.bestScore!=null?` \xB7 ${fill2(labels.quizScore,{score:summary.bestScore})}`:""]}),jsx15("ol",{className:"space-y-4",children:questions.map((q,index)=>{const multiple=q.type==="multiple";const isText=q.type==="short_text"||q.type==="numeric";const chosen=new Set(answers[q.id]??[]);const reveal=revealed?.get(q.id);const correctSet=reveal?new Set(reveal.correctOptionIds):null;const outcome=result?result.perQuestion[q.id]??null:null;const locked=Boolean(result)||busy||alreadyPassed||outOfAttempts;return jsxs9("li",{className:cn("rounded-[var(--site-radius-media,0.75rem)] border p-4",border),children:[jsxs9("p",{className:cn("flex items-start gap-2 text-sm font-medium",fg),children:[outcome===true?jsx15(CircleCheck,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400","aria-label":labels.quizCorrectMark}):outcome===false?jsx15(CircleX,{className:"mt-0.5 h-4 w-4 shrink-0 text-red-600 dark:text-red-400","aria-label":labels.quizWrongMark}):null,jsxs9("span",{children:[index+1,". ",q.prompt,multiple?jsx15("span",{className:cn("ml-2 text-xs font-normal",muted),children:labels.quizSelectAll}):null]})]}),q.image?jsx15("img",{src:q.image.url,alt:q.image.alt??"",width:q.image.width??void 0,height:q.image.height??void 0,loading:"lazy",className:"mt-3 max-h-80 w-auto max-w-full rounded-[var(--site-radius-media,0.75rem)]"}):null,isText?jsxs9("div",{className:"mt-3",children:[jsx15(Input,{type:"text",inputMode:q.type==="numeric"?"decimal":void 0,value:answers[q.id]?.[0]??"",disabled:locked,maxLength:500,placeholder:q.type==="numeric"?labels.quizNumericPlaceholder:labels.quizTextPlaceholder,"aria-label":q.prompt,onChange:event=>onAnswer(q.id,event.target.value?[event.target.value]:[]),className:cn("rounded-lg bg-transparent disabled:cursor-default disabled:opacity-100",border,fg,outcome===true&&"bg-emerald-50 dark:bg-emerald-950/30",outcome===false&&"bg-red-50 dark:bg-red-950/30")}),reveal&&reveal.acceptedAnswers&&reveal.acceptedAnswers.length>0?jsx15("p",{className:cn("mt-2 text-xs",muted),children:fill2(labels.quizAcceptedAnswers,{answers:reveal.acceptedAnswers.join(" / ")})}):null]}):jsx15("ul",{role:multiple?"group":"radiogroup","aria-label":q.prompt,className:cn("mt-3",q.options.some(o=>o.image)?"grid grid-cols-2 gap-2 sm:grid-cols-3":"space-y-2"),children:q.options.map(option=>{const checked=chosen.has(option.id);const isCorrect=correctSet?correctSet.has(option.id):null;return jsx15("li",{children:jsxs9("button",{type:"button",role:multiple?"checkbox":"radio","aria-checked":checked,disabled:locked,onClick:()=>onAnswer(q.id,multiple?toggleOption(chosen,option.id):[option.id]),className:cn("w-full rounded-lg border text-left text-sm disabled:cursor-default",option.image?"flex h-full flex-col gap-2 p-2":"flex items-start gap-2 px-3 py-2",border,fg,checked&&"border-[var(--brand-color,#18181b)]",isCorrect===true&&"bg-emerald-50 dark:bg-emerald-950/30",isCorrect===false&&checked&&"bg-red-50 dark:bg-red-950/30"),children:[option.image?jsx15("img",{src:option.image.url,alt:option.image.alt??"",width:option.image.width??void 0,height:option.image.height??void 0,loading:"lazy",className:"block max-h-48 w-full rounded-md object-contain"}):null,jsxs9("span",{className:cn("flex items-start gap-2",option.image?"px-1 pb-1":"contents"),children:[jsx15("span",{"aria-hidden":true,className:cn("mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center border",multiple?"rounded":"rounded-full",checked?"border-[var(--brand-color,#18181b)] bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]":"border-[var(--site-border,rgba(0,0,0,0.3))]"),children:checked?jsx15(Check,{className:"h-3 w-3"}):null}),jsx15("span",{className:"min-w-0",children:option.text})]})]})},option.id)})}),reveal?.explanation?jsx15("p",{className:cn("mt-2 text-xs",muted),children:reveal.explanation}):null]},q.id)})}),result?jsx15("div",{className:cn("rounded-[var(--site-radius-media,0.75rem)] border p-4 text-sm",border),children:practice?jsxs9(Fragment6,{children:[jsx15("p",{className:cn("font-medium",fg),children:fill2(labels.quizCorrectCount,{correct:result.correct,total:result.total})}),jsx15("button",{type:"button",onClick:onRetry,className:cn("mt-3",primaryButton),style:{backgroundColor:"var(--brand-color,#18181b)"},children:labels.quizPracticeAgain})]}):jsxs9(Fragment6,{children:[jsxs9("p",{className:cn("font-medium",result.passed?"text-emerald-600 dark:text-emerald-400":fg),children:[fill2(labels.quizScore,{score:result.score})," \xB7 ",result.passed?labels.quizPassed:fill2(labels.quizFailed,{percent:body.settings.passingPercent}),jsx15("span",{className:cn("ml-2 text-xs font-normal",muted),children:fill2(labels.quizCorrectCount,{correct:result.correct,total:result.total})})]}),!result.passed&&(result.canRetry?jsx15("button",{type:"button",onClick:onRetry,className:cn("mt-3",primaryButton),style:{backgroundColor:"var(--brand-color,#18181b)"},children:labels.quizRetry}):jsx15("p",{className:cn("mt-2 text-xs",muted),children:labels.quizNoAttempts}))]})}):outOfAttempts?jsx15("p",{className:cn("text-sm",muted),children:labels.quizNoAttempts}):alreadyPassed?null:jsx15("button",{type:"button",onClick:onSubmit,disabled:!allAnswered||busy,className:primaryButton,style:{backgroundColor:"var(--brand-color,#18181b)"},children:labels.quizSubmit})]})}export{DeliverablePlayer,deliverablePlayerLabels};
92
- //# sourceMappingURL=deliverables-FMKPDHJH.js.map