@tdacorp/hyle-sdk 0.8.1 → 0.11.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 (41) hide show
  1. package/README.md +82 -4
  2. package/bin/hyle-sdk-engage-keygen.mjs +3 -0
  3. package/dist/check-routes-bin.js +6 -1
  4. package/dist/{chunk-EBNIKRQH.js → chunk-N7ZQUAGM.js} +46 -2
  5. package/dist/chunk-R5EMI4HQ.js +61 -0
  6. package/dist/{chunk-LGW2KP4X.js → chunk-S3LT6G4M.js} +601 -77
  7. package/dist/{chunk-N4QYPO7S.js → chunk-S7PCCEHP.js} +3 -2
  8. package/dist/comments.cjs +1048 -0
  9. package/dist/comments.d.cts +152 -0
  10. package/dist/comments.d.ts +152 -0
  11. package/dist/comments.js +1025 -0
  12. package/dist/docs-enhance.cjs +97 -0
  13. package/dist/docs-enhance.d.cts +16 -0
  14. package/dist/docs-enhance.d.ts +16 -0
  15. package/dist/docs-enhance.js +73 -0
  16. package/dist/{types-DnPzhrFx.d.cts → embed-BC8Tlc6A.d.cts} +44 -3
  17. package/dist/{types-BoyBWF2F.d.ts → embed-CwSzvBUO.d.ts} +44 -3
  18. package/dist/engage-keygen-bin.js +67 -0
  19. package/dist/index.cjs +27 -1
  20. package/dist/index.d.cts +13 -3
  21. package/dist/index.d.ts +13 -3
  22. package/dist/index.js +5 -1
  23. package/dist/mermaid-diagram.js +9 -54
  24. package/dist/next.cjs +988 -66
  25. package/dist/next.d.cts +149 -6
  26. package/dist/next.d.ts +149 -6
  27. package/dist/next.js +391 -12
  28. package/dist/react.cjs +403 -75
  29. package/dist/react.d.cts +141 -33
  30. package/dist/react.d.ts +141 -33
  31. package/dist/react.js +7 -1
  32. package/dist/{resolve-36-Ng1H0.d.cts → resolve-BYL8jMg0.d.ts} +2 -2
  33. package/dist/{resolve-1rQntRBh.d.ts → resolve-Ra8-y2U-.d.cts} +2 -2
  34. package/dist/styles.css +149 -21
  35. package/dist/{types-CwBCPh6K.d.cts → types-C72FwzOd.d.cts} +71 -1
  36. package/dist/{types-CwBCPh6K.d.ts → types-C72FwzOd.d.ts} +71 -1
  37. package/dist/use-cache.cjs +9 -4
  38. package/dist/use-cache.d.cts +2 -2
  39. package/dist/use-cache.d.ts +2 -2
  40. package/dist/use-cache.js +5 -5
  41. package/package.json +4 -3
@@ -38,7 +38,19 @@ var SHAPES = {
38
38
  ] }),
39
39
  chev: /* @__PURE__ */ jsx("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
40
40
  "chev-down": /* @__PURE__ */ jsx("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
41
- "chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" })
41
+ "chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" }),
42
+ x: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" }),
43
+ heart: /* @__PURE__ */ jsx("path", { d: "M8 13.5S2.2 10 2.2 6.1A3 3 0 0 1 8 5a3 3 0 0 1 5.8 1.1C13.8 10 8 13.5 8 13.5z" }),
44
+ reply: /* @__PURE__ */ jsx("path", { d: "M6.5 3.5 2.5 7.5l4 4M2.5 7.5h6a5 5 0 0 1 5 5" }),
45
+ clock: /* @__PURE__ */ jsxs(Fragment, { children: [
46
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
47
+ /* @__PURE__ */ jsx("path", { d: "M8 4.5V8l2.3 1.5" })
48
+ ] }),
49
+ ban: /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
51
+ /* @__PURE__ */ jsx("path", { d: "m3.8 12.2 8.4-8.4" })
52
+ ] }),
53
+ refresh: /* @__PURE__ */ jsx("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
42
54
  };
43
55
  function Icon({ name, className }) {
44
56
  return /* @__PURE__ */ jsx("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
@@ -217,14 +229,205 @@ function clean(node, depth, ctx2, budget) {
217
229
  const tagName = tag === "h1" ? "h2" : tag;
218
230
  return [{ type: "element", tagName, properties, children: VOID.has(tag) ? [] : children }];
219
231
  }
220
- function sanitizeHast(tree, title) {
232
+ function sanitizeHast(tree, title, description) {
221
233
  const raw = isObject(tree) && tree.type === "root" && Array.isArray(tree.children) ? tree.children : [];
222
- const first = raw.find((n) => isObject(n) && n.type === "element");
234
+ const elements = raw.filter((n) => isObject(n) && n.type === "element");
235
+ const [first] = elements;
223
236
  const skip = title !== void 0 && isObject(first) && first.tagName === "h1" && textOf(first).trim() === title.trim() ? first : void 0;
237
+ const lead = elements[skip ? 1 : 0];
238
+ const repeat = description && isObject(lead) && lead.tagName === "p" && textOf(lead).trim().startsWith(description.trim()) ? lead : void 0;
224
239
  const budget = { nodes: 0, text: 0 };
225
- return { type: "root", children: raw.filter((n) => n !== skip).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
240
+ return { type: "root", children: raw.filter((n) => n !== skip && n !== repeat).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
226
241
  }
227
242
 
243
+ // src/react/comments-labels.ts
244
+ var COMMENT_LABELS_EN = {
245
+ heading: "Comments",
246
+ countLabel: "{n} comments",
247
+ likeArticle: "Like this article",
248
+ likedArticle: "Liked",
249
+ likeArticleSignIn: "(sign in), ",
250
+ likeComment: "Like this comment, ",
251
+ likeCommentSignIn: "Sign in to like this comment, ",
252
+ signInTitle: "Sign in to join the discussion",
253
+ signInBody: "Anyone can read. To comment or like, sign in.",
254
+ signIn: "Sign in",
255
+ commentingAs: "Commenting as {name}",
256
+ write: "Write a comment",
257
+ placeholder: "Add to the discussion",
258
+ help: "Markdown: links, emphasis, code and quotes.",
259
+ chars: "{n} / {max}",
260
+ post: "Post comment",
261
+ posting: "Posting",
262
+ reply: "Reply",
263
+ replyTo: "Reply to {name}",
264
+ replyPlaceholder: "Write a reply",
265
+ cancel: "Cancel",
266
+ edit: "Edit",
267
+ editLeft: "({n} min left)",
268
+ save: "Save",
269
+ delete: "Delete",
270
+ deleteConfirm: "Delete this comment?",
271
+ keep: "Keep",
272
+ you: "You",
273
+ edited: "edited",
274
+ removed: "This comment was removed.",
275
+ removedByModerator: "This comment was removed by a moderator.",
276
+ removedByAuthor: "This comment was deleted by its author.",
277
+ depthEnd: "Replies end at this depth",
278
+ held: "Awaiting approval.",
279
+ heldBanner: "Thanks, your comment is awaiting approval",
280
+ heldBannerBody: "New commenters may be reviewed first. You will see it here, marked as pending, until a moderator approves it. Nobody else can see it yet.",
281
+ heldNote: "Only you can see this until a moderator approves it.",
282
+ heldLive: "Comment awaiting approval",
283
+ postedLive: "Comment posted",
284
+ deletedLive: "Comment deleted",
285
+ savedLive: "Comment saved",
286
+ empty: "No comments yet",
287
+ emptyBody: "Start the discussion. Comments may be reviewed before they appear.",
288
+ loading: "Loading comments",
289
+ loadError: "Comments could not be loaded",
290
+ loadErrorBody: "The article is fine. The comments service did not answer.",
291
+ retry: "Try again",
292
+ postError: "Your comment was not posted. We kept your text, so nothing is lost. Check your connection and try again.",
293
+ tooLong: "That comment is too long or empty. Comments are 1 to 4000 characters.",
294
+ editClosed: "Comments can be edited for ten minutes after posting. That time has passed.",
295
+ actionError: "That did not go through. Please try again.",
296
+ rateTitle: "You are commenting too quickly",
297
+ rateBody: "Please wait before posting again. Your draft is kept in the box below.",
298
+ rateWait: "You can post again in {n} seconds.",
299
+ bannedTitle: "You cannot comment right now",
300
+ bannedBody: "Commenting is not available for your account on this site. You can still read every comment. If you think this is a mistake, contact the site team.",
301
+ expired: "Your session ended. Sign in again to post. Your text is kept.",
302
+ more: "Load more comments",
303
+ truncated: "Showing the first 500 comments.",
304
+ justNow: "just now"
305
+ };
306
+ var COMMENT_LABELS_FR = {
307
+ heading: "Commentaires",
308
+ countLabel: "{n} commentaires",
309
+ likeArticle: "Aimer cet article",
310
+ likedArticle: "Aim\xE9",
311
+ likeArticleSignIn: "(connexion requise), ",
312
+ likeComment: "Aimer ce commentaire, ",
313
+ likeCommentSignIn: "Connectez-vous pour aimer ce commentaire, ",
314
+ signInTitle: "Connectez-vous pour participer \xE0 la discussion",
315
+ signInBody: "Tout le monde peut lire. Pour commenter ou aimer, connectez-vous.",
316
+ signIn: "Se connecter",
317
+ commentingAs: "Vous commentez en tant que {name}",
318
+ write: "\xC9crire un commentaire",
319
+ placeholder: "Participez \xE0 la discussion",
320
+ help: "Markdown : liens, emphase, code et citations.",
321
+ chars: "{n} / {max}",
322
+ post: "Publier le commentaire",
323
+ posting: "Publication",
324
+ reply: "R\xE9pondre",
325
+ replyTo: "R\xE9pondre \xE0 {name}",
326
+ replyPlaceholder: "\xC9crire une r\xE9ponse",
327
+ cancel: "Annuler",
328
+ edit: "Modifier",
329
+ editLeft: "({n} min restantes)",
330
+ save: "Enregistrer",
331
+ delete: "Supprimer",
332
+ deleteConfirm: "Supprimer ce commentaire ?",
333
+ keep: "Conserver",
334
+ you: "Vous",
335
+ edited: "modifi\xE9",
336
+ removed: "Ce commentaire a \xE9t\xE9 retir\xE9.",
337
+ removedByModerator: "Ce commentaire a \xE9t\xE9 retir\xE9 par un mod\xE9rateur.",
338
+ removedByAuthor: "Ce commentaire a \xE9t\xE9 supprim\xE9 par son auteur.",
339
+ depthEnd: "Les r\xE9ponses s'arr\xEAtent \xE0 ce niveau",
340
+ held: "En attente d'approbation.",
341
+ heldBanner: "Merci, votre commentaire est en attente d'approbation",
342
+ heldBannerBody: "Les nouveaux commentaires peuvent \xEAtre relus d'abord. Vous le voyez ici, marqu\xE9 en attente, jusqu'\xE0 son approbation par un mod\xE9rateur. Personne d'autre ne peut le voir.",
343
+ heldNote: "Vous seul le voyez tant qu'un mod\xE9rateur ne l'a pas approuv\xE9.",
344
+ heldLive: "Commentaire en attente d'approbation",
345
+ postedLive: "Commentaire publi\xE9",
346
+ deletedLive: "Commentaire supprim\xE9",
347
+ savedLive: "Commentaire enregistr\xE9",
348
+ empty: "Aucun commentaire pour l'instant",
349
+ emptyBody: "Lancez la discussion. Les commentaires peuvent \xEAtre relus avant d'appara\xEEtre.",
350
+ loading: "Chargement des commentaires",
351
+ loadError: "Les commentaires n'ont pas pu \xEAtre charg\xE9s",
352
+ loadErrorBody: "L'article est intact. Le service de commentaires n'a pas r\xE9pondu.",
353
+ retry: "R\xE9essayer",
354
+ postError: "Votre commentaire n'a pas \xE9t\xE9 publi\xE9. Votre texte est conserv\xE9. V\xE9rifiez votre connexion et r\xE9essayez.",
355
+ tooLong: "Ce commentaire est trop long ou vide. Un commentaire compte de 1 \xE0 4000 caract\xE8res.",
356
+ editClosed: "Un commentaire peut \xEAtre modifi\xE9 pendant dix minutes apr\xE8s sa publication. Ce d\xE9lai est \xE9coul\xE9.",
357
+ actionError: "L'action a \xE9chou\xE9. R\xE9essayez.",
358
+ rateTitle: "Vous commentez trop vite",
359
+ rateBody: "Patientez avant de publier \xE0 nouveau. Votre brouillon est conserv\xE9 dans la zone ci-dessous.",
360
+ rateWait: "Vous pourrez publier \xE0 nouveau dans {n} secondes.",
361
+ bannedTitle: "Vous ne pouvez pas commenter pour le moment",
362
+ bannedBody: "Les commentaires ne sont pas disponibles pour votre compte sur ce site. Vous pouvez toujours tout lire. Si vous pensez \xE0 une erreur, contactez l'\xE9quipe du site.",
363
+ expired: "Votre session a expir\xE9. Reconnectez-vous pour publier. Votre texte est conserv\xE9.",
364
+ more: "Charger plus de commentaires",
365
+ truncated: "Affichage des 500 premiers commentaires.",
366
+ justNow: "\xE0 l'instant"
367
+ };
368
+ var COMMENT_LABELS_ES = {
369
+ heading: "Comentarios",
370
+ countLabel: "{n} comentarios",
371
+ likeArticle: "Me gusta este art\xEDculo",
372
+ likedArticle: "Te gusta",
373
+ likeArticleSignIn: "(inicia sesi\xF3n), ",
374
+ likeComment: "Me gusta este comentario, ",
375
+ likeCommentSignIn: "Inicia sesi\xF3n para dar me gusta a este comentario, ",
376
+ signInTitle: "Inicia sesi\xF3n para unirte a la conversaci\xF3n",
377
+ signInBody: "Todos pueden leer. Para comentar o dar me gusta, inicia sesi\xF3n.",
378
+ signIn: "Iniciar sesi\xF3n",
379
+ commentingAs: "Comentando como {name}",
380
+ write: "Escribe un comentario",
381
+ placeholder: "A\xF1ade a la conversaci\xF3n",
382
+ help: "Markdown: enlaces, \xE9nfasis, c\xF3digo y citas.",
383
+ chars: "{n} / {max}",
384
+ post: "Publicar comentario",
385
+ posting: "Publicando",
386
+ reply: "Responder",
387
+ replyTo: "Responder a {name}",
388
+ replyPlaceholder: "Escribe una respuesta",
389
+ cancel: "Cancelar",
390
+ edit: "Editar",
391
+ editLeft: "(quedan {n} min)",
392
+ save: "Guardar",
393
+ delete: "Eliminar",
394
+ deleteConfirm: "\xBFEliminar este comentario?",
395
+ keep: "Conservar",
396
+ you: "T\xFA",
397
+ edited: "editado",
398
+ removed: "Este comentario fue eliminado.",
399
+ removedByModerator: "Un moderador elimin\xF3 este comentario.",
400
+ removedByAuthor: "Su autor elimin\xF3 este comentario.",
401
+ depthEnd: "Las respuestas terminan en este nivel",
402
+ held: "Pendiente de aprobaci\xF3n.",
403
+ heldBanner: "Gracias, tu comentario est\xE1 pendiente de aprobaci\xF3n",
404
+ heldBannerBody: "Los comentarios nuevos pueden revisarse primero. Lo ves aqu\xED, marcado como pendiente, hasta que un moderador lo apruebe. Nadie m\xE1s puede verlo todav\xEDa.",
405
+ heldNote: "Solo t\xFA lo ves hasta que un moderador lo apruebe.",
406
+ heldLive: "Comentario pendiente de aprobaci\xF3n",
407
+ postedLive: "Comentario publicado",
408
+ deletedLive: "Comentario eliminado",
409
+ savedLive: "Comentario guardado",
410
+ empty: "A\xFAn no hay comentarios",
411
+ emptyBody: "Empieza la conversaci\xF3n. Los comentarios pueden revisarse antes de aparecer.",
412
+ loading: "Cargando comentarios",
413
+ loadError: "No se pudieron cargar los comentarios",
414
+ loadErrorBody: "El art\xEDculo est\xE1 bien. El servicio de comentarios no respondi\xF3.",
415
+ retry: "Reintentar",
416
+ postError: "Tu comentario no se public\xF3. Hemos conservado tu texto. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
417
+ tooLong: "Ese comentario es demasiado largo o est\xE1 vac\xEDo. Los comentarios tienen de 1 a 4000 caracteres.",
418
+ editClosed: "Un comentario puede editarse durante diez minutos tras publicarlo. Ese tiempo ya pas\xF3.",
419
+ actionError: "No se pudo completar. Int\xE9ntalo de nuevo.",
420
+ rateTitle: "Est\xE1s comentando demasiado r\xE1pido",
421
+ rateBody: "Espera antes de publicar de nuevo. Tu borrador se conserva en el cuadro de abajo.",
422
+ rateWait: "Podr\xE1s publicar de nuevo en {n} segundos.",
423
+ bannedTitle: "No puedes comentar por ahora",
424
+ bannedBody: "Los comentarios no est\xE1n disponibles para tu cuenta en este sitio. A\xFAn puedes leerlos todos. Si crees que es un error, contacta con el equipo del sitio.",
425
+ expired: "Tu sesi\xF3n termin\xF3. Inicia sesi\xF3n de nuevo para publicar. Tu texto se conserva.",
426
+ more: "Cargar m\xE1s comentarios",
427
+ truncated: "Se muestran los primeros 500 comentarios.",
428
+ justNow: "ahora mismo"
429
+ };
430
+
228
431
  // src/react/viewer/labels.ts
229
432
  var VIEWER_LABELS_EN = {
230
433
  expand: "Expand diagram",
@@ -342,10 +545,14 @@ var en = {
342
545
  fallbackTitle: "Not translated into {language} yet.",
343
546
  fallbackBody: "You are reading the original.",
344
547
  older: "Older posts",
548
+ viewAll: "View all",
549
+ readAtSource: "Read at source",
345
550
  emptyTitle: "Nothing published here yet",
346
551
  emptyBody: "Documents published to this section will appear here, newest first.",
347
552
  docs: "Documentation",
348
553
  menu: "Menu",
554
+ closeMenu: "Close menu",
555
+ updated: "Last updated",
349
556
  nfKind: "404 \xB7 Not found",
350
557
  nfTitle: "This page does not exist",
351
558
  nfBody: "The address may be mistyped, or the document may have been unpublished or moved.",
@@ -360,7 +567,8 @@ var en = {
360
567
  unKind: "Unavailable",
361
568
  unTitle: "This page is temporarily unavailable",
362
569
  unBody: "The content could not be loaded. Please try again in a moment.",
363
- viewer: VIEWER_LABELS_EN
570
+ viewer: VIEWER_LABELS_EN,
571
+ comments: COMMENT_LABELS_EN
364
572
  };
365
573
  var fr = {
366
574
  toc: "Sur cette page",
@@ -383,10 +591,14 @@ var fr = {
383
591
  fallbackTitle: "Pas encore traduit en {language}.",
384
592
  fallbackBody: "Vous lisez l'original.",
385
593
  older: "Articles plus anciens",
594
+ viewAll: "Tout voir",
595
+ readAtSource: "Lire \xE0 la source",
386
596
  emptyTitle: "Rien n'est encore publi\xE9 ici",
387
597
  emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
388
598
  docs: "Documentation",
389
599
  menu: "Menu",
600
+ closeMenu: "Fermer le menu",
601
+ updated: "Derni\xE8re mise \xE0 jour",
390
602
  nfKind: "404 \xB7 Introuvable",
391
603
  nfTitle: "Cette page n'existe pas",
392
604
  nfBody: "L'adresse est peut-\xEAtre mal saisie, ou le document a \xE9t\xE9 d\xE9publi\xE9 ou d\xE9plac\xE9.",
@@ -401,7 +613,8 @@ var fr = {
401
613
  unKind: "Indisponible",
402
614
  unTitle: "Cette page est momentan\xE9ment indisponible",
403
615
  unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
404
- viewer: VIEWER_LABELS_FR
616
+ viewer: VIEWER_LABELS_FR,
617
+ comments: COMMENT_LABELS_FR
405
618
  };
406
619
  var es = {
407
620
  toc: "En esta p\xE1gina",
@@ -424,10 +637,14 @@ var es = {
424
637
  fallbackTitle: "A\xFAn no est\xE1 traducida al {language}.",
425
638
  fallbackBody: "Est\xE1s leyendo el original.",
426
639
  older: "Entradas anteriores",
640
+ viewAll: "Ver todo",
641
+ readAtSource: "Leer en la fuente",
427
642
  emptyTitle: "A\xFAn no hay nada publicado aqu\xED",
428
643
  emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
429
644
  docs: "Documentaci\xF3n",
430
645
  menu: "Men\xFA",
646
+ closeMenu: "Cerrar el men\xFA",
647
+ updated: "\xDAltima actualizaci\xF3n",
431
648
  nfKind: "404 \xB7 No encontrada",
432
649
  nfTitle: "Esta p\xE1gina no existe",
433
650
  nfBody: "Puede que la direcci\xF3n est\xE9 mal escrita, o que el documento se haya despublicado o movido.",
@@ -442,7 +659,8 @@ var es = {
442
659
  unKind: "No disponible",
443
660
  unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
444
661
  unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
445
- viewer: VIEWER_LABELS_ES
662
+ viewer: VIEWER_LABELS_ES,
663
+ comments: COMMENT_LABELS_ES
446
664
  };
447
665
  var TABLE = { en, fr, es };
448
666
  function stringsFor(locale) {
@@ -525,10 +743,10 @@ function buildComponents(c, s) {
525
743
  for (const key of overrides) if (c[key]) defaults[key] = c[key];
526
744
  return defaults;
527
745
  }
528
- function HastContent({ tree, title, components = {}, locale }) {
746
+ function HastContent({ tree, title, description, components = {}, locale }) {
529
747
  let root;
530
748
  try {
531
- root = sanitizeHast(tree, title);
749
+ root = sanitizeHast(tree, title, description);
532
750
  } catch (error) {
533
751
  if (!(error instanceof HastLimitError)) throw error;
534
752
  const s = stringsFor(locale);
@@ -554,6 +772,7 @@ function TrustedServerHtml({ html }) {
554
772
  import { MermaidDiagram as MermaidDiagram2 } from "./mermaid-diagram.js";
555
773
 
556
774
  // src/react/pages.tsx
775
+ import { Comments } from "./comments.js";
557
776
  import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
558
777
  function Slot({ name, slots, tag: Tag = "div", className }) {
559
778
  const fill = slots?.[name];
@@ -622,7 +841,7 @@ function Toc({ toc, c, aside }) {
622
841
  }
623
842
  function Body({ article, components, locale }) {
624
843
  const { content, publication } = article;
625
- return /* @__PURE__ */ jsx4("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ jsx4(HastContent, { tree: content.tree, title: publication.title, components: components ?? {}, locale }) : /* @__PURE__ */ jsx4(TrustedServerHtml, { html: content.html }) });
844
+ return /* @__PURE__ */ jsx4("div", { className: "hyle-body hyle-prose", lang: article.fallback ? void 0 : publication.locale, children: content.format === "hast" ? /* @__PURE__ */ jsx4(HastContent, { tree: content.tree, title: publication.title, description: publication.description, components: components ?? {}, locale }) : /* @__PURE__ */ jsx4(TrustedServerHtml, { html: content.html }) });
626
845
  }
627
846
  function Languages({ alternates, current, c }) {
628
847
  if (alternates.length < 2) return null;
@@ -635,7 +854,32 @@ function Languages({ alternates, current, c }) {
635
854
  }) })
636
855
  ] });
637
856
  }
638
- function ArticlePage({ article, ...base }) {
857
+ var BARE_HTTPS_ORIGIN = /^https:\/\/[^/]+$/;
858
+ function articleJsonLd(article, origin, c, author) {
859
+ const { publication: pub } = article;
860
+ const url = (path) => origin + encodeURI(c.href(path, pub.locale));
861
+ const graph = {
862
+ "@context": "https://schema.org",
863
+ "@graph": [
864
+ {
865
+ "@type": "BlogPosting",
866
+ headline: pub.title,
867
+ ...pub.description ? { description: pub.description } : {},
868
+ datePublished: pub.published_at,
869
+ ...pub.updated_at ? { dateModified: pub.updated_at } : {},
870
+ ...author ? { author: { "@type": "Person", name: author } } : {},
871
+ inLanguage: pub.locale,
872
+ mainEntityOfPage: url(pub.canonical_path)
873
+ },
874
+ {
875
+ "@type": "BreadcrumbList",
876
+ itemListElement: article.breadcrumbs.map((b, i) => ({ "@type": "ListItem", position: i + 1, name: b.title, item: url(b.canonical_path) }))
877
+ }
878
+ ]
879
+ };
880
+ return JSON.stringify(graph).replace(/</g, "\\u003c");
881
+ }
882
+ function ArticlePage({ article, engagement, origin, ...base }) {
639
883
  const { publication: pub } = article;
640
884
  const c = ctx(base, pub.locale);
641
885
  const { s } = c;
@@ -680,9 +924,11 @@ function ArticlePage({ article, ...base }) {
680
924
  ] }),
681
925
  toc.narrow,
682
926
  /* @__PURE__ */ jsx4(Body, { article, components: base.components, locale: c.locale }),
927
+ engagement ? /* @__PURE__ */ jsx4(Comments, { path: pub.canonical_path, endpoint: engagement.endpoint ?? "/api/hyle/engage", signInHref: engagement.signInHref, locale: c.locale, labels: s.comments }) : null,
683
928
  /* @__PURE__ */ jsx4(Pager, { prev: article.prev, next: article.next, c }),
684
929
  /* @__PURE__ */ jsx4(Slot, { name: "article.after", slots: base.slots, className: "hyle-after" }),
685
- toc.wide
930
+ toc.wide,
931
+ origin && BARE_HTTPS_ORIGIN.test(origin) ? /* @__PURE__ */ jsx4("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: articleJsonLd(article, origin, c, author) } }) : null
686
932
  ] }) });
687
933
  }
688
934
  function ListPage({ list, olderHref, description, ...base }) {
@@ -730,69 +976,6 @@ function ListPage({ list, olderHref, description, ...base }) {
730
976
  ] }) : null
731
977
  ] }) });
732
978
  }
733
- function DocsTree({ article, c }) {
734
- const { Link, s } = c;
735
- const current = /* @__PURE__ */ jsxs4("li", { children: [
736
- /* @__PURE__ */ jsx4(Link, { href: c.href(article.publication.canonical_path), "aria-current": "page", children: article.publication.title }),
737
- article.children.length > 0 ? /* @__PURE__ */ jsx4("ul", { children: article.children.map((ch) => /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsx4(Link, { href: c.href(ch.canonical_path), children: ch.title }) }, ch.canonical_path)) }) : null
738
- ] });
739
- const nested = article.ancestors.reduceRight(
740
- (inner, a) => /* @__PURE__ */ jsxs4("li", { children: [
741
- /* @__PURE__ */ jsx4(Link, { href: c.href(a.canonical_path), children: a.title }),
742
- /* @__PURE__ */ jsx4("ul", { children: inner })
743
- ] }, a.canonical_path),
744
- current
745
- );
746
- return /* @__PURE__ */ jsx4("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ jsx4("ul", { children: nested }) });
747
- }
748
- function DocsPage({ article, ...base }) {
749
- const { publication: pub } = article;
750
- const c = ctx(base, pub.locale);
751
- const { Link, s } = c;
752
- const toc = Toc({ toc: article.toc, c });
753
- const siteName = article.breadcrumbs[0]?.title ?? "";
754
- const version = /* @__PURE__ */ jsx4(Slot, { name: "docs.version", slots: base.slots, tag: "span" });
755
- const side = /* @__PURE__ */ jsxs4(Fragment4, { children: [
756
- /* @__PURE__ */ jsxs4("div", { className: "hyle-side-head", children: [
757
- /* @__PURE__ */ jsx4("b", { children: siteName }),
758
- version
759
- ] }),
760
- /* @__PURE__ */ jsx4(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
761
- /* @__PURE__ */ jsx4(DocsTree, { article, c }),
762
- /* @__PURE__ */ jsx4(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
763
- ] });
764
- const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
765
- return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("div", { className: "hyle-docs", lang: c.locale, children: [
766
- /* @__PURE__ */ jsxs4("details", { className: "hyle-nav-m", children: [
767
- /* @__PURE__ */ jsxs4("summary", { children: [
768
- /* @__PURE__ */ jsx4(Icon, { name: "file" }),
769
- s.menu,
770
- /* @__PURE__ */ jsx4("span", { className: "cur", children: pub.title }),
771
- /* @__PURE__ */ jsx4(Icon, { name: "chev-down", className: "hyle-chev" })
772
- ] }),
773
- /* @__PURE__ */ jsx4("div", { children: side })
774
- ] }),
775
- /* @__PURE__ */ jsx4("aside", { className: "hyle-nav-d", "aria-label": s.docs, children: side }),
776
- /* @__PURE__ */ jsxs4("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
777
- notTranslated ? /* @__PURE__ */ jsxs4("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
778
- /* @__PURE__ */ jsx4(Icon, { name: "alert" }),
779
- /* @__PURE__ */ jsxs4("div", { children: [
780
- /* @__PURE__ */ jsx4("b", { children: notTranslated }),
781
- " ",
782
- s.fallbackBody
783
- ] })
784
- ] }) : null,
785
- /* @__PURE__ */ jsx4("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ jsx4("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ jsx4("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ jsx4(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
786
- /* @__PURE__ */ jsx4("h1", { className: "hyle-title", children: pub.title }),
787
- pub.description ? /* @__PURE__ */ jsx4("p", { className: "hyle-desc", children: pub.description }) : null,
788
- toc.narrow,
789
- /* @__PURE__ */ jsx4(Body, { article, components: base.components, locale: c.locale }),
790
- /* @__PURE__ */ jsx4(Pager, { prev: article.prev, next: article.next, c }),
791
- /* @__PURE__ */ jsx4(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" })
792
- ] }),
793
- toc.wide
794
- ] }) });
795
- }
796
979
  function NotFound({ path, homeHref = "/", ...base }) {
797
980
  const c = ctx(base, "en");
798
981
  const { Link, s } = c;
@@ -842,6 +1025,341 @@ function Redirecting({ from, to, ...base }) {
842
1025
  ] }) });
843
1026
  }
844
1027
 
1028
+ // src/react/index.ts
1029
+ import { Comments as Comments2 } from "./comments.js";
1030
+
1031
+ // src/react/comments-api.ts
1032
+ var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1033
+ var count = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? Math.trunc(v) : 0;
1034
+ function toComment(raw) {
1035
+ if (!isObject2(raw) || typeof raw.id !== "string" || typeof raw.created_at !== "string") return void 0;
1036
+ const depth = typeof raw.depth === "number" ? Math.min(4, Math.max(1, Math.trunc(raw.depth))) : 1;
1037
+ const author = isObject2(raw.author) && typeof raw.author.name === "string" ? raw.author.name : void 0;
1038
+ const name = typeof raw.author_name === "string" ? raw.author_name : author;
1039
+ const body = isObject2(raw.body) && raw.body.format === "hast" ? { format: "hast", tree: raw.body.tree } : null;
1040
+ const removed = raw.removed === true || body === null;
1041
+ return {
1042
+ id: raw.id,
1043
+ parent_id: typeof raw.parent_id === "string" ? raw.parent_id : null,
1044
+ depth,
1045
+ author_name: name ?? null,
1046
+ created_at: raw.created_at,
1047
+ edited_at: typeof raw.edited_at === "string" ? raw.edited_at : null,
1048
+ like_count: count(raw.like_count),
1049
+ removed,
1050
+ ...removed && (raw.removed_by === "moderator" || raw.removed_by === "author") ? { removed_by: raw.removed_by } : {},
1051
+ body,
1052
+ // Viewer members exist only on a live comment of a viewer-aware listing; a tombstone never carries them.
1053
+ ...!removed && typeof raw.mine === "boolean" ? { mine: raw.mine, liked_by_me: raw.liked_by_me === true, can_edit_until: typeof raw.can_edit_until === "string" ? raw.can_edit_until : null } : {}
1054
+ };
1055
+ }
1056
+ function toHeld(raw) {
1057
+ if (!isObject2(raw) || typeof raw.id !== "string" || typeof raw.created_at !== "string" || !isObject2(raw.body) || raw.body.format !== "hast") return void 0;
1058
+ const author = isObject2(raw.author) && typeof raw.author.name === "string" ? raw.author.name : null;
1059
+ return {
1060
+ id: raw.id,
1061
+ parent_id: typeof raw.parent_id === "string" ? raw.parent_id : null,
1062
+ depth: typeof raw.depth === "number" ? Math.min(4, Math.max(1, Math.trunc(raw.depth))) : 1,
1063
+ author_name: author,
1064
+ created_at: raw.created_at,
1065
+ edited_at: typeof raw.edited_at === "string" ? raw.edited_at : null,
1066
+ can_edit_until: typeof raw.can_edit_until === "string" ? raw.can_edit_until : null,
1067
+ body: { format: "hast", tree: raw.body.tree }
1068
+ };
1069
+ }
1070
+ function parseListing(data) {
1071
+ if (!isObject2(data) || data.kind !== "comments" || !Array.isArray(data.comments)) return void 0;
1072
+ const comments = data.comments.map(toComment).filter((c) => c !== void 0);
1073
+ const viewer = Array.isArray(data.mine_held) ? { liked_by_me: data.liked_by_me === true, mine_held: data.mine_held.slice(0, 5).map(toHeld).filter((h) => h !== void 0) } : {};
1074
+ return { cp: 1, kind: "comments", publication_id: String(data.publication_id ?? ""), comment_count: count(data.comment_count), like_count: count(data.like_count), truncated: data.truncated === true, comments, ...viewer };
1075
+ }
1076
+ var untilMs = (iso) => {
1077
+ const t = iso ? Date.parse(iso) : NaN;
1078
+ return Number.isFinite(t) ? t : void 0;
1079
+ };
1080
+ function buildThread(listing, localHeld) {
1081
+ const byId = /* @__PURE__ */ new Map();
1082
+ const roots = [];
1083
+ const place = (node, parentId) => {
1084
+ const parent = parentId ? byId.get(parentId) : void 0;
1085
+ (parent ? parent.kids : roots).push(node);
1086
+ };
1087
+ for (const c of listing.comments) {
1088
+ if (byId.has(c.id)) continue;
1089
+ const removed = c.removed;
1090
+ const node = {
1091
+ id: c.id,
1092
+ depth: c.depth,
1093
+ status: removed ? "removed" : "visible",
1094
+ removedBy: removed ? c.removed_by : void 0,
1095
+ mine: !removed && c.mine === true,
1096
+ canEditUntil: untilMs(c.can_edit_until),
1097
+ likedByMe: !removed && c.liked_by_me === true,
1098
+ name: removed ? null : c.author_name ?? null,
1099
+ createdAt: c.created_at,
1100
+ editedAt: c.edited_at,
1101
+ likes: c.like_count,
1102
+ tree: c.body?.tree,
1103
+ text: void 0,
1104
+ kids: []
1105
+ };
1106
+ place(node, c.parent_id === c.id ? null : c.parent_id);
1107
+ byId.set(c.id, node);
1108
+ }
1109
+ const mine = [];
1110
+ const addHeld = (node, parentId, oldestFirst) => {
1111
+ const parent = parentId ? byId.get(parentId) : void 0;
1112
+ if (parent) parent.kids.push(node);
1113
+ else if (oldestFirst) mine.unshift(node);
1114
+ else mine.push(node);
1115
+ };
1116
+ const heldIds = /* @__PURE__ */ new Set();
1117
+ for (const h of listing.mine_held ?? []) {
1118
+ heldIds.add(h.id);
1119
+ const parent = h.parent_id ? byId.get(h.parent_id) : void 0;
1120
+ addHeld({ id: h.id, depth: Math.min(4, (parent?.depth ?? h.depth - 1) + 1), status: "held", removedBy: void 0, mine: true, canEditUntil: untilMs(h.can_edit_until), likedByMe: false, name: h.author_name, createdAt: h.created_at, editedAt: h.edited_at, likes: 0, tree: h.body?.tree, text: void 0, kids: [] }, h.parent_id, true);
1121
+ }
1122
+ if (listing.mine_held === void 0) {
1123
+ for (const h of localHeld) {
1124
+ if (byId.has(h.id) || heldIds.has(h.id)) continue;
1125
+ const parent = h.parentId ? byId.get(h.parentId) : void 0;
1126
+ addHeld({ id: h.id, depth: Math.min(4, (parent?.depth ?? 0) + 1), status: "held", removedBy: void 0, mine: true, canEditUntil: void 0, likedByMe: false, name: h.name, createdAt: h.createdAt, editedAt: null, likes: 0, tree: void 0, text: h.text, kids: [] }, h.parentId, false);
1127
+ }
1128
+ }
1129
+ return [...mine, ...roots];
1130
+ }
1131
+
1132
+ // src/react/comments-body.tsx
1133
+ import { toJsxRuntime as toJsxRuntime2 } from "hast-util-to-jsx-runtime";
1134
+ import { Fragment as Fragment5 } from "react";
1135
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1136
+ import { jsx as jsx6 } from "react/jsx-runtime";
1137
+ var ALLOWED = /* @__PURE__ */ new Set(["p", "a", "em", "strong", "del", "code", "pre", "blockquote", "ul", "ol", "li", "br"]);
1138
+ var LINK_REL = "nofollow ugc noopener noreferrer";
1139
+ function narrow(node) {
1140
+ if (node.type === "text") return [node];
1141
+ if (node.type !== "element") return [];
1142
+ const children = node.children.flatMap(narrow);
1143
+ if (!ALLOWED.has(node.tagName)) return children;
1144
+ if (node.tagName === "a") {
1145
+ const href = node.properties.href;
1146
+ if (!isSafeUrl(href, "href")) return children;
1147
+ return [{ type: "element", tagName: "a", properties: { href: String(href), rel: LINK_REL.split(" ") }, children }];
1148
+ }
1149
+ return [{ type: "element", tagName: node.tagName, properties: {}, children: node.tagName === "br" ? [] : children }];
1150
+ }
1151
+ function CommentBody({ tree }) {
1152
+ let children;
1153
+ try {
1154
+ children = sanitizeHast(tree).children.flatMap((n) => narrow(n));
1155
+ } catch (error) {
1156
+ if (error instanceof HastLimitError) return null;
1157
+ throw error;
1158
+ }
1159
+ return /* @__PURE__ */ jsx6("div", { className: "hyle-cm-body", children: toJsxRuntime2({ type: "root", children }, { Fragment: Fragment5, jsx: jsx5, jsxs: jsxs5, elementAttributeNameCase: "react", stylePropertyNameCase: "dom" }) });
1160
+ }
1161
+
1162
+ // src/react/embed.tsx
1163
+ import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1164
+ function HyleListView({ items, layout = "list", title, headingLevel = 2, moreHref, ...base }) {
1165
+ const c = ctx(base, "en");
1166
+ const { s, Link } = c;
1167
+ const Row = base.slots?.["list.item"];
1168
+ const Heading = `h${headingLevel}`;
1169
+ const safe = items.filter((item) => item.canonical_path.startsWith("/"));
1170
+ if (safe.length === 0) return base.slots?.["list.empty"] ? /* @__PURE__ */ jsx7("div", { className: "hyle hyle-embed", "data-layout": layout, children: /* @__PURE__ */ jsx7(Slot, { name: "list.empty", slots: base.slots }) }) : null;
1171
+ return /* @__PURE__ */ jsxs6("div", { className: "hyle hyle-embed", "data-layout": layout, lang: c.locale, children: [
1172
+ title ? /* @__PURE__ */ jsx7(Heading, { className: "hyle-title", children: title }) : null,
1173
+ /* @__PURE__ */ jsx7("ul", { className: "hyle-items", children: safe.map((item) => /* @__PURE__ */ jsx7("li", { children: Row ? /* @__PURE__ */ jsx7(Row, { item, href: c.href(item.canonical_path), locale: c.locale }) : /* @__PURE__ */ jsxs6(Link, { className: "hyle-item", href: c.href(item.canonical_path), children: [
1174
+ /* @__PURE__ */ jsx7("time", { dateTime: item.published_at, title: item.published_at, children: formatDate(item.published_at, c.locale) }),
1175
+ /* @__PURE__ */ jsxs6("div", { children: [
1176
+ /* @__PURE__ */ jsx7("span", { className: "t", children: item.title }),
1177
+ item.description ? /* @__PURE__ */ jsx7("p", { children: item.description }) : null
1178
+ ] })
1179
+ ] }) }, item.canonical_path)) }),
1180
+ moreHref ? /* @__PURE__ */ jsx7("a", { className: "hyle-more", href: moreHref, children: s.viewAll }) : null
1181
+ ] });
1182
+ }
1183
+ function HyleArticleView({ article, headingLevel = 2, ...base }) {
1184
+ const { publication: pub } = article;
1185
+ const c = ctx(base, pub.locale);
1186
+ const Heading = `h${headingLevel}`;
1187
+ return /* @__PURE__ */ jsx7("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs6("article", { lang: c.locale, children: [
1188
+ /* @__PURE__ */ jsxs6("header", { className: "hyle-head", children: [
1189
+ /* @__PURE__ */ jsx7(Heading, { className: "hyle-title", children: pub.title }),
1190
+ pub.description ? /* @__PURE__ */ jsx7("p", { className: "hyle-desc", children: pub.description }) : null,
1191
+ /* @__PURE__ */ jsx7("div", { className: "hyle-meta", children: /* @__PURE__ */ jsx7("span", { children: /* @__PURE__ */ jsx7("time", { dateTime: pub.published_at, title: pub.published_at, children: formatDate(pub.published_at, c.locale) }) }) })
1192
+ ] }),
1193
+ /* @__PURE__ */ jsx7(Body, { article, components: base.components, locale: c.locale }),
1194
+ pub.canonical_path.startsWith("/") ? /* @__PURE__ */ jsxs6("a", { className: "hyle-more", href: c.href(pub.canonical_path, pub.locale), rel: "bookmark", children: [
1195
+ c.s.readAtSource,
1196
+ /* @__PURE__ */ jsxs6("span", { className: "hyle-sr", children: [
1197
+ ": ",
1198
+ pub.title
1199
+ ] })
1200
+ ] }) : null
1201
+ ] }) });
1202
+ }
1203
+ var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((w) => [...w][0] ?? "").join("").toUpperCase() || "?";
1204
+ function StaticThread({ nodes, locale, s, level = 1 }) {
1205
+ return /* @__PURE__ */ jsx7("ol", { className: "hyle-cm-list", role: "list", children: nodes.map((node) => {
1206
+ const kids = node.kids.length > 0 && level < 32 ? /* @__PURE__ */ jsx7(StaticThread, { nodes: node.kids, locale, s, level: level + 1 }) : null;
1207
+ if (node.status === "removed") {
1208
+ const why = node.removedBy === "moderator" ? s.removedByModerator : node.removedBy === "author" ? s.removedByAuthor : s.removed;
1209
+ return /* @__PURE__ */ jsxs6("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "removed", "data-removed-by": node.removedBy, children: [
1210
+ /* @__PURE__ */ jsxs6("article", { "aria-label": why, children: [
1211
+ /* @__PURE__ */ jsx7("span", { className: "hyle-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx7(Icon, { name: "ban" }) }),
1212
+ /* @__PURE__ */ jsx7("div", { className: "hyle-cm-main", children: /* @__PURE__ */ jsx7("div", { className: "hyle-cm-body", children: /* @__PURE__ */ jsx7("p", { children: why }) }) })
1213
+ ] }),
1214
+ kids
1215
+ ] }, node.id);
1216
+ }
1217
+ return /* @__PURE__ */ jsxs6("li", { className: "hyle-cm", "data-depth": node.depth, "data-status": "visible", children: [
1218
+ /* @__PURE__ */ jsxs6("article", { children: [
1219
+ /* @__PURE__ */ jsx7("span", { className: "hyle-avatar", "aria-hidden": "true", children: initials(node.name ?? "") }),
1220
+ /* @__PURE__ */ jsxs6("div", { className: "hyle-cm-main", children: [
1221
+ /* @__PURE__ */ jsxs6("div", { className: "hyle-cm-by", children: [
1222
+ /* @__PURE__ */ jsx7("b", { children: node.name }),
1223
+ /* @__PURE__ */ jsxs6("span", { children: [
1224
+ /* @__PURE__ */ jsx7("time", { dateTime: node.createdAt, title: node.createdAt, children: formatDate(node.createdAt, locale) }),
1225
+ node.editedAt ? /* @__PURE__ */ jsxs6(Fragment6, { children: [
1226
+ " ",
1227
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: "\xB7" }),
1228
+ " ",
1229
+ /* @__PURE__ */ jsx7("span", { children: s.edited })
1230
+ ] }) : null
1231
+ ] })
1232
+ ] }),
1233
+ /* @__PURE__ */ jsx7(CommentBody, { tree: node.tree })
1234
+ ] })
1235
+ ] }),
1236
+ kids
1237
+ ] }, node.id);
1238
+ }) });
1239
+ }
1240
+ function HyleCommentsView({ listing, locale }) {
1241
+ const thread = buildThread(listing, []);
1242
+ if (thread.length === 0) return null;
1243
+ const s = stringsFor(locale).comments;
1244
+ return /* @__PURE__ */ jsx7("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsxs6("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", lang: locale, children: [
1245
+ /* @__PURE__ */ jsx7("div", { className: "hyle-cm-head", children: /* @__PURE__ */ jsxs6("h2", { children: [
1246
+ s.heading,
1247
+ " ",
1248
+ /* @__PURE__ */ jsx7("span", { className: "hyle-cm-count", "aria-label": s.countLabel.replace("{n}", String(listing.comment_count)), children: listing.comment_count })
1249
+ ] }) }),
1250
+ /* @__PURE__ */ jsx7(StaticThread, { nodes: thread, locale, s }),
1251
+ listing.truncated ? /* @__PURE__ */ jsx7("p", { className: "hyle-cm-note", children: s.truncated }) : null
1252
+ ] }) });
1253
+ }
1254
+ function HyleCommentsFallback({ locale }) {
1255
+ const s = stringsFor(locale).comments;
1256
+ return /* @__PURE__ */ jsx7("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ jsx7("section", { className: "hyle-comments", "aria-label": s.heading, "data-slot-component": "Comments", children: /* @__PURE__ */ jsxs6("div", { role: "status", "aria-live": "polite", "aria-busy": "true", children: [
1257
+ /* @__PURE__ */ jsx7("span", { className: "hyle-sr", children: s.loading }),
1258
+ /* @__PURE__ */ jsx7("div", { "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs6("div", { className: "hyle-cm-sk", children: [
1259
+ /* @__PURE__ */ jsx7("span", { className: "hyle-sk c" }),
1260
+ /* @__PURE__ */ jsxs6("div", { children: [
1261
+ /* @__PURE__ */ jsx7("span", { className: "hyle-sk l", style: { width: 120 } }),
1262
+ /* @__PURE__ */ jsx7("span", { className: "hyle-sk l", style: { width: "100%" } }),
1263
+ /* @__PURE__ */ jsx7("span", { className: "hyle-sk l", style: { width: "72%" } })
1264
+ ] })
1265
+ ] }, i)) })
1266
+ ] }) }) });
1267
+ }
1268
+
1269
+ // src/react/docs.tsx
1270
+ import { DocsEnhance } from "./docs-enhance.js";
1271
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1272
+ var ROOT_ID = "hyle-docs";
1273
+ var NAV_ID = "hyle-docs-nav";
1274
+ function navTreeOf(article) {
1275
+ if (article.nav && !article.nav.truncated && article.nav.items.length > 0) return article.nav.items;
1276
+ const { publication: pub } = article;
1277
+ const here = {
1278
+ slug: pub.slug,
1279
+ title: pub.title,
1280
+ canonical_path: pub.canonical_path,
1281
+ children: article.children.map((child) => ({ ...child, children: [] }))
1282
+ };
1283
+ return [article.ancestors.reduceRight((inner, a) => ({ ...a, children: [inner] }), here)];
1284
+ }
1285
+ function pathTo(nodes, path) {
1286
+ for (const node of nodes) {
1287
+ if (node.canonical_path === path) return [node.canonical_path];
1288
+ const below = pathTo(node.children, path);
1289
+ if (below.length > 0) return [node.canonical_path, ...below];
1290
+ }
1291
+ return [];
1292
+ }
1293
+ function Branch({ nodes, current, onPath, c }) {
1294
+ const { Link } = c;
1295
+ return /* @__PURE__ */ jsx8("ul", { children: nodes.map((node) => {
1296
+ const link = /* @__PURE__ */ jsx8(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
1297
+ if (node.children.length === 0) return /* @__PURE__ */ jsx8("li", { children: link }, node.canonical_path);
1298
+ return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs7("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
1299
+ /* @__PURE__ */ jsxs7("summary", { children: [
1300
+ /* @__PURE__ */ jsx8(Icon, { name: "chev" }),
1301
+ link
1302
+ ] }),
1303
+ /* @__PURE__ */ jsx8(Branch, { nodes: node.children, current, onPath, c })
1304
+ ] }) }, node.canonical_path);
1305
+ }) });
1306
+ }
1307
+ function DocsPage({ article, ...base }) {
1308
+ const { publication: pub } = article;
1309
+ const c = ctx(base, pub.locale);
1310
+ const { Link, s } = c;
1311
+ const toc = Toc({ toc: article.toc, c });
1312
+ const tree = navTreeOf(article);
1313
+ const onPath = new Set(pathTo(tree, pub.canonical_path));
1314
+ const siteName = article.breadcrumbs[0]?.title ?? "";
1315
+ const headingIds = article.toc.filter((t) => t.depth === 2 || t.depth === 3).map((t) => scopeId(t.id));
1316
+ const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
1317
+ return /* @__PURE__ */ jsx8(Shell, { children: /* @__PURE__ */ jsxs7("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
1318
+ /* @__PURE__ */ jsx8(DocsEnhance, { headingIds, rootId: ROOT_ID }),
1319
+ /* @__PURE__ */ jsxs7("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
1320
+ /* @__PURE__ */ jsx8(Icon, { name: "file" }),
1321
+ s.menu,
1322
+ /* @__PURE__ */ jsx8("span", { className: "cur", children: pub.title }),
1323
+ /* @__PURE__ */ jsx8(Icon, { name: "chev-down", className: "hyle-chev" })
1324
+ ] }),
1325
+ /* @__PURE__ */ jsxs7("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
1326
+ /* @__PURE__ */ jsxs7("div", { className: "hyle-side-head", children: [
1327
+ /* @__PURE__ */ jsx8("b", { children: siteName }),
1328
+ /* @__PURE__ */ jsx8(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
1329
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ jsx8(Icon, { name: "x" }) })
1330
+ ] }),
1331
+ /* @__PURE__ */ jsx8(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
1332
+ /* @__PURE__ */ jsx8("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ jsx8(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
1333
+ /* @__PURE__ */ jsx8(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
1334
+ ] }),
1335
+ /* @__PURE__ */ jsxs7("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
1336
+ notTranslated ? /* @__PURE__ */ jsxs7("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
1337
+ /* @__PURE__ */ jsx8(Icon, { name: "alert" }),
1338
+ /* @__PURE__ */ jsxs7("div", { children: [
1339
+ /* @__PURE__ */ jsx8("b", { children: notTranslated }),
1340
+ " ",
1341
+ s.fallbackBody
1342
+ ] })
1343
+ ] }) : null,
1344
+ /* @__PURE__ */ jsx8("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ jsx8("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ jsx8("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ jsx8(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
1345
+ /* @__PURE__ */ jsx8("h1", { className: "hyle-title", children: pub.title }),
1346
+ pub.description ? /* @__PURE__ */ jsx8("p", { className: "hyle-desc", children: pub.description }) : null,
1347
+ /* @__PURE__ */ jsxs7("p", { className: "hyle-updated", children: [
1348
+ /* @__PURE__ */ jsx8(Icon, { name: "calendar" }),
1349
+ s.updated,
1350
+ " ",
1351
+ /* @__PURE__ */ jsx8("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
1352
+ ] }),
1353
+ toc.narrow,
1354
+ /* @__PURE__ */ jsx8(Body, { article, components: base.components, locale: c.locale }),
1355
+ /* @__PURE__ */ jsx8(Pager, { prev: article.prev, next: article.next, c }),
1356
+ /* @__PURE__ */ jsx8(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
1357
+ /* @__PURE__ */ jsx8("span", { className: "hyle-docs-end", "aria-hidden": "true" })
1358
+ ] }),
1359
+ toc.wide
1360
+ ] }) });
1361
+ }
1362
+
845
1363
  export {
846
1364
  HastLimitError,
847
1365
  scopeId,
@@ -852,9 +1370,15 @@ export {
852
1370
  TrustedServerHtml,
853
1371
  ArticlePage,
854
1372
  ListPage,
855
- DocsPage,
856
1373
  NotFound,
857
1374
  Unavailable,
858
1375
  Redirecting,
859
- MermaidDiagram2 as MermaidDiagram
1376
+ parseListing,
1377
+ HyleListView,
1378
+ HyleArticleView,
1379
+ HyleCommentsView,
1380
+ HyleCommentsFallback,
1381
+ DocsPage,
1382
+ MermaidDiagram2 as MermaidDiagram,
1383
+ Comments2 as Comments
860
1384
  };