@astl/astrolabe 0.1.3 → 0.1.4

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 (102) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cdn/astrolabe-editor.js +3 -3
  3. package/dist/cdn/astrolabe-player.js +1 -1
  4. package/dist/cdn/astrolabe.js +1 -1
  5. package/dist/cdn/astrolabe.standalone.js +1084 -1075
  6. package/dist/cdn/chunks/{audio-B0LSIn5N.js → audio-Biof5aA3.js} +2 -2
  7. package/dist/cdn/chunks/{audio-B0LSIn5N.js.map → audio-Biof5aA3.js.map} +1 -1
  8. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js → block-styles-CCtSFM4j.js} +2 -2
  9. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js.map → block-styles-CCtSFM4j.js.map} +1 -1
  10. package/dist/cdn/chunks/{book-CHzDDaim.js → book-IFipARhv.js} +2 -2
  11. package/dist/cdn/chunks/{book-CHzDDaim.js.map → book-IFipARhv.js.map} +1 -1
  12. package/dist/cdn/chunks/{callout-QFLFLPc5.js → callout-CuajbbYY.js} +2 -2
  13. package/dist/cdn/chunks/{callout-QFLFLPc5.js.map → callout-CuajbbYY.js.map} +1 -1
  14. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js → categorise-Cm6kXLXw.js} +2 -2
  15. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js.map → categorise-Cm6kXLXw.js.map} +1 -1
  16. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js → chip-styles--gboWK2Z.js} +2 -2
  17. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js.map → chip-styles--gboWK2Z.js.map} +1 -1
  18. package/dist/cdn/chunks/{choice-CExBvqKj.js → choice-BSpB6LHl.js} +2 -2
  19. package/dist/cdn/chunks/{choice-CExBvqKj.js.map → choice-BSpB6LHl.js.map} +1 -1
  20. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js → color-control-1kkdM8ns.js} +2 -2
  21. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js.map → color-control-1kkdM8ns.js.map} +1 -1
  22. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js → crossword-BdOAEPcL.js} +2 -2
  23. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js.map → crossword-BdOAEPcL.js.map} +1 -1
  24. package/dist/cdn/chunks/{definitions-CNX90WtL.js → definitions-BybSa1mq.js} +2 -2
  25. package/dist/cdn/chunks/{definitions-CNX90WtL.js.map → definitions-BybSa1mq.js.map} +1 -1
  26. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js → directive-helpers-US6zRjJ1.js} +2 -2
  27. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js.map → directive-helpers-US6zRjJ1.js.map} +1 -1
  28. package/dist/cdn/chunks/{drop-vRXndjHu.js → drop-D4NQ0WK_.js} +2 -2
  29. package/dist/cdn/chunks/{drop-vRXndjHu.js.map → drop-D4NQ0WK_.js.map} +1 -1
  30. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js → flash-cards-D4ebb5m6.js} +2 -2
  31. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js.map → flash-cards-D4ebb5m6.js.map} +1 -1
  32. package/dist/cdn/chunks/{gap-lor-khst.js → gap-D-Sipuyu.js} +2 -2
  33. package/dist/cdn/chunks/{gap-lor-khst.js.map → gap-D-Sipuyu.js.map} +1 -1
  34. package/dist/cdn/chunks/{help-C-woafz5.js → help-CmCFuNXk.js} +2 -2
  35. package/dist/cdn/chunks/{help-C-woafz5.js.map → help-CmCFuNXk.js.map} +1 -1
  36. package/dist/cdn/chunks/{help-form-DhIyMziw.js → help-form-Di2NtKDp.js} +2 -2
  37. package/dist/cdn/chunks/{help-form-DhIyMziw.js.map → help-form-Di2NtKDp.js.map} +1 -1
  38. package/dist/cdn/chunks/{hotspot-oel1Eelo.js → hotspot-B3bvqVzf.js} +2 -2
  39. package/dist/cdn/chunks/{hotspot-oel1Eelo.js.map → hotspot-B3bvqVzf.js.map} +1 -1
  40. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js → image-drop-vLc2B7rF.js} +2 -2
  41. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js.map → image-drop-vLc2B7rF.js.map} +1 -1
  42. package/dist/cdn/chunks/{image-label-Dm5shQSh.js → image-label-DsKxQDTQ.js} +2 -2
  43. package/dist/cdn/chunks/{image-label-Dm5shQSh.js.map → image-label-DsKxQDTQ.js.map} +1 -1
  44. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js → inline-styles-CFNlb6f2.js} +2 -2
  45. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js.map → inline-styles-CFNlb6f2.js.map} +1 -1
  46. package/dist/cdn/chunks/{insert-menu-Cn2E54V9.js → insert-menu-DAQglwtG.js} +2 -2
  47. package/dist/cdn/chunks/{insert-menu-Cn2E54V9.js.map → insert-menu-DAQglwtG.js.map} +1 -1
  48. package/dist/cdn/chunks/{issue-list-CQKAW39i.js → issue-list-CzSmohtT.js} +2 -2
  49. package/dist/cdn/chunks/{issue-list-CQKAW39i.js.map → issue-list-CzSmohtT.js.map} +1 -1
  50. package/dist/cdn/chunks/{live-jdiyYln2.js → live-qnReIRtj.js} +2 -2
  51. package/dist/cdn/chunks/{live-jdiyYln2.js.map → live-qnReIRtj.js.map} +1 -1
  52. package/dist/cdn/chunks/{long-answer-CtzClLAx.js → long-answer-NSWJiK0z.js} +2 -2
  53. package/dist/cdn/chunks/{long-answer-CtzClLAx.js.map → long-answer-NSWJiK0z.js.map} +1 -1
  54. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js → mark-words-BKu-_uIl.js} +2 -2
  55. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js.map → mark-words-BKu-_uIl.js.map} +1 -1
  56. package/dist/cdn/chunks/{match-DKE_4o-x.js → match-BpnJGW_5.js} +21 -13
  57. package/dist/cdn/chunks/match-BpnJGW_5.js.map +1 -0
  58. package/dist/cdn/chunks/{memory-B6hSyHyz.js → memory-BgTHujsU.js} +2 -2
  59. package/dist/cdn/chunks/{memory-B6hSyHyz.js.map → memory-BgTHujsU.js.map} +1 -1
  60. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js → option-styles-B2sBX5Oz.js} +2 -2
  61. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js.map → option-styles-B2sBX5Oz.js.map} +1 -1
  62. package/dist/cdn/chunks/{order-BhG_6IC-.js → order-B9gqH5wm.js} +2 -2
  63. package/dist/cdn/chunks/{order-BhG_6IC-.js.map → order-B9gqH5wm.js.map} +1 -1
  64. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js → picture-view-Deodu_mb.js} +2 -2
  65. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js.map → picture-view-Deodu_mb.js.map} +1 -1
  66. package/dist/cdn/chunks/{repeat-CY2W2URZ.js → repeat-BDXokpxQ.js} +2 -2
  67. package/dist/cdn/chunks/{repeat-CY2W2URZ.js.map → repeat-BDXokpxQ.js.map} +1 -1
  68. package/dist/cdn/chunks/{runtime-DxAbpr3S.js → runtime-C25QK5B0.js} +3 -3
  69. package/dist/cdn/chunks/{runtime-DxAbpr3S.js.map → runtime-C25QK5B0.js.map} +1 -1
  70. package/dist/cdn/chunks/{scan-jWgPnVxA.js → scan-BVhxT2Hw.js} +2 -2
  71. package/dist/cdn/chunks/{scan-jWgPnVxA.js.map → scan-BVhxT2Hw.js.map} +1 -1
  72. package/dist/cdn/chunks/{select-DTA3dJzr.js → select-DPpKJwSg.js} +2 -2
  73. package/dist/cdn/chunks/{select-DTA3dJzr.js.map → select-DPpKJwSg.js.map} +1 -1
  74. package/dist/cdn/chunks/select-QZ35cyns.js +2 -0
  75. package/dist/cdn/chunks/select-QZ35cyns.js.map +1 -0
  76. package/dist/cdn/chunks/{source-view-BlJ2mRns.js → source-view-gqFlZzwR.js} +2 -2
  77. package/dist/cdn/chunks/{source-view-BlJ2mRns.js.map → source-view-gqFlZzwR.js.map} +1 -1
  78. package/dist/cdn/chunks/{style-form-D1C2sHzg.js → style-form-DuR0EEum.js} +2 -2
  79. package/dist/cdn/chunks/{style-form-D1C2sHzg.js.map → style-form-DuR0EEum.js.map} +1 -1
  80. package/dist/cdn/chunks/{style-popups-BobgX1WK.js → style-popups-Bcl5imdP.js} +2 -2
  81. package/dist/cdn/chunks/{style-popups-BobgX1WK.js.map → style-popups-Bcl5imdP.js.map} +1 -1
  82. package/dist/cdn/chunks/{style-rules-ChqPVgZn.js → style-rules-ozpLz2ec.js} +2 -2
  83. package/dist/cdn/chunks/{style-rules-ChqPVgZn.js.map → style-rules-ozpLz2ec.js.map} +1 -1
  84. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js → styled-bQqnDxBf.js} +2 -2
  85. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js.map → styled-bQqnDxBf.js.map} +1 -1
  86. package/dist/cdn/chunks/{styles-CXkkL_Qi.js → styles-DiY3VA_T.js} +5 -5
  87. package/dist/cdn/chunks/styles-DiY3VA_T.js.map +1 -0
  88. package/dist/cdn/chunks/surface-CIz1z2oY.js +1059 -0
  89. package/dist/cdn/chunks/surface-CIz1z2oY.js.map +1 -0
  90. package/dist/cdn/chunks/{true-false-DP3MO599.js → true-false-C-S6RmZY.js} +2 -2
  91. package/dist/cdn/chunks/{true-false-DP3MO599.js.map → true-false-C-S6RmZY.js.map} +1 -1
  92. package/dist/cdn/chunks/{video-j9MCH6Kw.js → video-Dae8Gguf.js} +2 -2
  93. package/dist/cdn/chunks/{video-j9MCH6Kw.js.map → video-Dae8Gguf.js.map} +1 -1
  94. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js → word-bank-CsIle0Ro.js} +2 -2
  95. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js.map → word-bank-CsIle0Ro.js.map} +1 -1
  96. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js → word-search-IOCwqo3y.js} +2 -2
  97. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js.map → word-search-IOCwqo3y.js.map} +1 -1
  98. package/package.json +9 -9
  99. package/dist/cdn/chunks/match-DKE_4o-x.js.map +0 -1
  100. package/dist/cdn/chunks/styles-CXkkL_Qi.js.map +0 -1
  101. package/dist/cdn/chunks/surface-BhmSAte0.js +0 -1058
  102. package/dist/cdn/chunks/surface-BhmSAte0.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"crossword-Cb-a3Tjj.js","names":["en","pl","LitElement","nothing","ifDefined","live","b","i$1","A","verdictIcon","AstlElement","o","i","squaresOf","en_default","crosswordManifest","pl_default","l","arrowDelta","RovingFocus","blockStyles","namespace","crosswordUiMessages","LETTER","other","d","said","el","img","CrosswordElement","element","#grid","#rows","#columns","#list","#words","#layoutNow","w","next","id","value","answers","letter","#upper","words","#slot","sq","#layout","first","ui","word","#activeWord","crossing","#crossing","#clueText","#keydown","#input","#focusin","#pointerdown","#click","rows","columns","#renderSquare","list","#renderClue","slot","ways","start","verdict","#squareVerdict","name","#squareName","active","index","#wordVerdict","solution","#wordSolution","refs","current","#goTo","event","placed","squares","r","c","through","ids","open","a","slots","k","square","feedback","own","letters","direction","#said","empty","#activate","steps","cell","#squareOf","#again","input","#set","typed","ch","#along","key","back","#arrow","across","down","way","crosswordElement"],"sources":["../../../../components/src/crossword/ui-messages.ts","../../../../components/src/crossword/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.crossword';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `crosswordMessages` would put the authoring strings into the element's chunk.\n */\nexport const crosswordUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type {\n Answers,\n ComponentManifest,\n GroupVerdict,\n MessageCatalog,\n SlotVerdict,\n Units,\n} from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { arrowDelta, RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { blockStyles } from '../block-styles.js';\nimport { type Direction, squaresOf } from './grid.js';\nimport { crosswordManifest } from './manifest.js';\nimport { crosswordUiMessages } from './ui-messages.js';\n\n/** A word of the view: its clue (the light-DOM child) and its squares, by index (row x columns + column). */\ninterface Word {\n readonly id: string;\n readonly el: HTMLElement;\n readonly number: number;\n readonly direction: Direction;\n readonly squares: readonly number[];\n}\n\ninterface Layout {\n readonly rows: number;\n readonly columns: number;\n /** In clue order: across, then down, by number. */\n readonly words: readonly Word[];\n /** The slot id of each open square. */\n readonly slots: ReadonlyMap<number, string>;\n readonly through: ReadonlyMap<number, Partial<Record<Direction, Word>>>;\n}\n\nconst LETTER = /^\\p{L}$/u;\nconst other = (d: Direction): Direction => (d === 'across' ? 'down' : 'across');\n/** What a clue says: its text, with the alt text of its pictures. */\nconst said = (el: Element): string =>\n [el.textContent ?? '', ...[...el.querySelectorAll('img')].map((img) => img.alt)]\n .join(' ')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/**\n * `<astl-crossword>`: a grid of squares, every open one an `<input>` (one `letter` slot, the view's `cells` in reading\n * order), and the clues, the light-DOM `<astl-crossword-word>` children (slotted manually, never moved).\n * - One tab stop in the grid (`RovingFocus`): a letter moves along the active word, the arrows to the nearest open\n * square (first turning where two words cross), Space turns, Tab and Enter go to the next clue (Shift back) and Tab\n * leaves at the ends. The clue list is one more tab stop; pressing a clue goes to its first empty square.\n * - The current clue shows above the grid and goes to the player's live region when it changes.\n * - Verdicts: per word (`feedback.groups`, scoring `word`), per square (`letter`), or for the grid (`whole`).\n */\nexport class CrosswordElement extends AstlElement {\n static override manifest: ComponentManifest = crosswordManifest;\n static override messages: readonly MessageCatalog[] = crosswordUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n letters: { state: true },\n direction: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // Squares of 32 to 44 px share the room of the field (a container); a grid wider than that scrolls in it, with a\n // cue (below). The floor is not the WCAG 2.5.8 minimum (24 px: squares touch, so its spacing exception cannot apply\n // and each square must reach it itself) but what a square must hold: its number at the smallest text size (14 px,\n // as all text young students read) above its letter, at least 14 px too, in a text entry at least 24 px tall. At\n // 32 px both fit, the letter on its own line under the number's, so they never meet; the letter grows with the\n // square and keeps that line. A 20-column grid now fits a 760 px player; a 30-column one scrolls there. The field\n // clips, so the grid's padding (the edge) is as wide as a focus ring reaches past a square, plus a border: squares\n // share borders, so the last column and row hang a border past their tracks. A square scrolled into view keeps\n // the same room by its input's scroll margin (the input sits a border inside its square, which draws the ring).\n css`\n .board {\n --astl-cw-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset) + var(--astl-outline-width));\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--astl-space-4);\n }\n .field {\n flex: 0 1 calc(var(--astl-cw-columns) * 2.75rem + 2 * var(--astl-cw-edge));\n min-inline-size: 0;\n max-inline-size: 100%;\n container-type: inline-size;\n }\n .grid {\n --astl-cw-cell: clamp(2rem, (100cqi - 2 * var(--astl-cw-edge)) / var(--astl-cw-columns), 2.75rem);\n display: grid;\n grid-template-columns: repeat(var(--astl-cw-columns), var(--astl-cw-cell));\n grid-auto-rows: var(--astl-cw-cell);\n inline-size: max-content;\n padding: var(--astl-cw-edge);\n }\n .cell {\n position: relative;\n box-sizing: border-box;\n margin-block-end: calc(-1 * var(--astl-outline-width));\n margin-inline-end: calc(-1 * var(--astl-outline-width));\n border: var(--astl-outline-width) solid var(--astl-outline);\n background: var(--astl-surface);\n }\n .cell[data-word] {\n background: var(--astl-selected-soft);\n box-shadow: inset 0 0 0 calc(var(--astl-selected-bar) / 2) var(--astl-selected);\n }\n .cell[data-verdict] {\n z-index: 1;\n }\n .cell:focus-within {\n z-index: 2;\n }\n .cell > input {\n box-sizing: border-box;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n padding: calc(var(--astl-size-small) + 1px) 0 0;\n border: 0;\n background: none;\n color: var(--astl-ink);\n font: inherit;\n font-size: min(var(--astl-cw-cell) * 0.5, var(--astl-cw-cell) - var(--astl-size-small) - 4px);\n font-weight: 600;\n line-height: 1;\n text-align: center;\n caret-color: transparent;\n cursor: pointer;\n scroll-margin: var(--astl-cw-edge);\n }\n .cell > input::selection {\n background: none;\n }\n .number,\n .cell > .astl-verdict {\n position: absolute;\n line-height: 1;\n pointer-events: none;\n }\n .number {\n inset-block-start: 1px;\n inset-inline-start: 2px;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n .cell > .astl-verdict {\n inset-block-start: 1px;\n inset-inline-end: 1px;\n font-size: min(0.875rem, var(--astl-cw-cell) * 0.4);\n }\n `,\n // A grid wider than its field scrolls sideways, and shows it: a shadow at each edge that has more to scroll to\n // (scroll shadows: covers that move with the content over shadows that stay with the field).\n css`\n .field {\n overflow-x: auto;\n background:\n linear-gradient(to right, var(--astl-surface) 40%, transparent) left / 2rem 100% no-repeat local,\n linear-gradient(to left, var(--astl-surface) 40%, transparent) right / 2rem 100% no-repeat local,\n radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n left / 0.75rem 100% no-repeat scroll,\n radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n right / 0.75rem 100% no-repeat scroll;\n scrollbar-color: var(--astl-outline) transparent;\n }\n `,\n // The current clue sits above the grid; in the list the current clue is marked like a picked item (a bar and a\n // weight where the theme has them, never colour alone), the crossing one with a quiet border.\n css`\n .current {\n margin-block: 0 var(--astl-space-3);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border-inline-start: var(--astl-focus-width) solid var(--astl-selected);\n border-radius: var(--astl-radius-m);\n background: var(--astl-selected-soft);\n font-weight: 600;\n }\n .clues {\n flex: 1 1 16rem;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n .title {\n margin: 0;\n font-weight: 600;\n }\n ol {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .entry {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n border: var(--astl-outline-width) solid transparent;\n border-radius: var(--astl-radius-m);\n }\n .entry[data-current] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .entry[data-current]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .entry[data-crossing] {\n border-color: var(--astl-outline);\n }\n .entry > button {\n flex: 1 1 12rem;\n display: flex;\n align-items: baseline;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-3);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n .entry .num {\n flex: none;\n min-inline-size: 1.5em;\n font-weight: 700;\n }\n .entry .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .entry .length {\n color: var(--astl-ink-muted);\n white-space: nowrap;\n }\n .entry > .astl-verdict {\n padding-inline-end: var(--astl-space-3);\n }\n .entry > .astl-solution {\n flex-basis: 100%;\n padding-inline: var(--astl-space-3);\n padding-block-end: var(--astl-space-2);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n blockStyles,\n ];\n\n /** Slot id to its letter. */\n declare protected letters: ReadonlyMap<string, string>;\n /** The direction of the active word where two words cross. */\n declare protected direction: Direction;\n #layout: Layout | null = null;\n /** The active word announced last, so moving inside it says nothing. */\n #said: string | null = null;\n /** A press on the square that already had the focus turns the direction. */\n #again = false;\n readonly #grid: RovingFocus;\n readonly #list: RovingFocus;\n\n constructor() {\n super();\n this.letters = new Map();\n this.direction = 'across';\n const element = this;\n this.#grid = new RovingFocus(this, {\n count: () => this.#rows * this.#columns,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`input[data-cell=\"${i}\"]`),\n axis: 'grid',\n get columns() {\n return element.#columns;\n },\n });\n this.#list = new RovingFocus(this, {\n count: () => this.#words.length,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`button[data-index=\"${i}\"]`),\n axis: 'block',\n });\n }\n\n get slotIds(): readonly string[] {\n return [...this.#layoutNow.slots.values()];\n }\n\n get groupIds(): readonly string[] {\n return this.#words.map((w) => w.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.letters);\n }\n\n /** One letter per slot, in capitals; anything else is not shown, so the slot stays empty. */\n setAnswers(answers: Answers): void {\n const next = new Map(this.letters);\n for (const id of this.slotIds) {\n const value = answers[id];\n if (value === undefined) continue;\n next.delete(id);\n const letter = this.#upper(value.trim().normalize('NFC'));\n if (LETTER.test(letter)) next.set(id, letter);\n }\n this.letters = next;\n }\n\n /** One unit per word, answered when every square of it holds a letter. */\n units(): Units {\n const words = this.#words;\n const full = words.filter((w) => w.squares.every((sq) => this.letters.has(this.#slot(sq))));\n return { answered: full.length, total: words.length };\n }\n\n protected override willUpdate(): void {\n // The view is read again once per render (a view is immutable, so this is cheap insurance, not a cache miss).\n this.#layout = null;\n // The tab stop starts on the first square of the first clue.\n const first = this.#words[0];\n if (first !== undefined && !this.#layoutNow.slots.has(this.#grid.active)) {\n this.#grid.focus(first.squares[0] ?? 0);\n this.direction = first.direction;\n }\n }\n\n protected override updated(): void {\n // Through the CSSOM, which a strict Content Security Policy allows (an inline style attribute it blocks).\n this.renderRoot\n .querySelector<HTMLElement>('.board')\n ?.style.setProperty('--astl-cw-columns', `${this.#columns}`);\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const { rows, columns, words } = this.#layoutNow;\n const word = this.#activeWord;\n const crossing = this.#crossing;\n return html`<fieldset part=\"crossword\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.hint')}</span>\n </legend>\n <p class=\"current\" part=\"current\" lang=${ui.lang} dir=${ui.dir}>${word === null ? nothing : this.#clueText(word)}</p>\n <div class=\"board\">\n <div class=\"field\">\n <div\n class=\"grid\"\n part=\"grid\"\n role=\"group\"\n aria-label=${this.t('ui.grid', { rows, columns })}\n aria-describedby=\"instructions\"\n @keydown=${this.#keydown}\n @input=${this.#input}\n @focusin=${this.#focusin}\n @pointerdown=${this.#pointerdown}\n @click=${this.#click}\n >\n ${Array.from({ length: rows * columns }, (_, i) => this.#renderSquare(i, word))}\n </div>\n </div>\n <div class=\"clues\" part=\"clues\" role=\"group\" aria-label=${this.t('ui.clues')} lang=${ui.lang} dir=${ui.dir}>\n ${(['across', 'down'] as const).map((d) => {\n const list = words.filter((w) => w.direction === d);\n return list.length === 0\n ? nothing\n : html`<p class=\"title\" id=\"title-${d}\">${this.t(`ui.${d}`)}</p>\n <ol role=\"list\" aria-labelledby=\"title-${d}\">\n ${list.map((w) => this.#renderClue(w, w === word, w === crossing))}\n </ol>`;\n })}\n </div>\n </div>\n <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n #renderSquare(i: number, active: Word | null): TemplateResult {\n const slot = this.#layoutNow.slots.get(i);\n if (slot === undefined) return html`<span aria-hidden=\"true\"></span>`;\n const ways = this.#layoutNow.through.get(i) ?? {};\n const word = ways[this.direction] ?? ways[other(this.direction)];\n const start = [ways.across, ways.down].find((w) => w?.squares[0] === i);\n const verdict = this.#squareVerdict(i);\n const name = word === undefined ? '' : this.#squareName(word, i);\n return html`<span\n class=\"cell astl-box astl-ring\"\n part=\"cell\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-word=${active?.squares.includes(i) ?? false}\n >\n ${start === undefined ? nothing : html`<span class=\"number\" part=\"number\" aria-hidden=\"true\">${start.number}</span>`}\n <input\n type=\"text\"\n data-cell=${i}\n tabindex=${this.#grid.tabIndex(i)}\n lang=${ifDefined(this.contentLang || undefined)}\n autocomplete=\"off\"\n autocapitalize=\"characters\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n enterkeyhint=\"next\"\n aria-label=${name}\n aria-invalid=${verdict === 'incorrect' ? 'true' : nothing}\n aria-describedby=${ifDefined(verdict === null ? undefined : `verdict-${i}`)}\n ?readonly=${this.disabled}\n .value=${live(this.letters.get(slot) ?? '')}\n />\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n </span>`;\n }\n\n #renderClue(word: Word, current: boolean, crossing: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const index = this.#words.indexOf(word);\n const verdict = this.#wordVerdict(word);\n const solution = this.#wordSolution(word);\n const refs = [\n verdict === null ? '' : `clue-verdict-${index}`,\n solution === null ? '' : `solution-${index}`,\n ];\n return html`<li\n class=\"entry astl-box astl-ring\"\n part=\"clue\"\n id=${word.id}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-current=${current}\n ?data-crossing=${crossing}\n >\n <button\n type=\"button\"\n data-index=${index}\n tabindex=${this.#list.tabIndex(index)}\n aria-current=${current ? 'true' : nothing}\n aria-describedby=${refs.filter(Boolean).join(' ') || nothing}\n @click=${() => this.#goTo(word)}\n @keydown=${(event: KeyboardEvent) => this.#list.keydown(event)}\n >\n <span class=\"num\">${word.number}</span>\n <span class=\"text\"\n ><span lang=${ifDefined(this.contentLang || undefined)}><slot data-word=${word.id}></slot></span>\n <span class=\"length\">${this.t('ui.length', { length: word.squares.length })}</span></span\n >\n ${crossing ? html`<span class=\"astl-vh\">, ${this.t('ui.crossing')}</span>` : nothing}\n </button>\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `clue-verdict-${index}` })}\n ${\n solution === null\n ? nothing\n : html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${index}\" lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(this.contentLang || undefined)}>${solution}</bdi>\n </p>`\n }\n </li>`;\n }\n\n // The layout\n\n get #rows(): number {\n return this.numberAttribute('rows') ?? 0;\n }\n\n get #columns(): number {\n return this.numberAttribute('columns') ?? 0;\n }\n\n get #words(): readonly Word[] {\n return this.#layoutNow.words;\n }\n\n /** Read from the view, once between two renders: the words and where they lie, the slot of each open square. */\n get #layoutNow(): Layout {\n if (this.#layout !== null) return this.#layout;\n const rows = this.#rows;\n const columns = this.#columns;\n const words = this.childElements('astl-crossword-word').map((el): Word => {\n const placed = {\n row: Number(el.getAttribute('row')),\n column: Number(el.getAttribute('column')),\n direction: el.getAttribute('direction') === 'down' ? ('down' as const) : ('across' as const),\n length: Number(el.getAttribute('length')),\n };\n const squares = squaresOf(placed)\n .filter(([r, c]) => r >= 0 && r < rows && c >= 0 && c < columns)\n .map(([r, c]) => r * columns + c);\n return {\n id: el.id,\n el,\n number: Number(el.getAttribute('number')),\n direction: placed.direction,\n squares,\n };\n });\n const through = new Map<number, Partial<Record<Direction, Word>>>();\n for (const w of words)\n for (const sq of w.squares) through.set(sq, { ...through.get(sq), [w.direction]: w });\n const ids = (this.getAttribute('cells') ?? '').split(' ').filter(Boolean);\n const open = [...through.keys()].sort((a, b) => a - b);\n const slots = new Map(open.flatMap((sq, k) => (ids[k] === undefined ? [] : [[sq, ids[k]] as const])));\n this.#layout = { rows, columns, words, slots, through };\n return this.#layout;\n }\n\n #slot(square: number): string {\n return this.#layoutNow.slots.get(square) ?? '';\n }\n\n /** The word the active square belongs to in the active direction, else its other one. */\n get #activeWord(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n return ways[this.direction] ?? ways[other(this.direction)] ?? null;\n }\n\n /** The other word through the active square, if two cross there. */\n get #crossing(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n const word = this.#activeWord;\n return word === null ? null : (ways[other(word.direction)] ?? null);\n }\n\n #clueText(word: Word): string {\n const { number, direction } = word;\n return this.t('ui.current', { number, direction, length: word.squares.length, clue: said(word.el) });\n }\n\n #squareName(word: Word, square: number): string {\n const { number, direction, squares } = word;\n return this.t('ui.cell', {\n number,\n direction,\n position: squares.indexOf(square) + 1,\n length: squares.length,\n });\n }\n\n #upper(value: string): string {\n try {\n return value.toLocaleUpperCase(this.contentLang || undefined);\n } catch {\n return value.toUpperCase();\n }\n }\n\n // Verdicts and solutions\n\n /**\n * A word's verdict after a check, until the next edit: its group's (scoring `word`); else, under the element's\n * verdict, \"no answer\" for a word without a letter and, with square verdicts (`letter`), right when every square is.\n */\n #wordVerdict(word: Word): GroupVerdict | null {\n const feedback = this.feedback;\n if (feedback === null) return null;\n const own = feedback.groups?.[word.id];\n if (own !== undefined) return own;\n if (feedback.group === null) return null;\n if (word.squares.every((sq) => !this.letters.has(this.#slot(sq)))) return 'empty';\n if (Object.keys(feedback.slots).length === 0) return null;\n return word.squares.every((sq) => feedback.slots[this.#slot(sq)] === 'correct') ? 'correct' : 'incorrect';\n }\n\n /**\n * A filled square's own verdict (`letter`); a word's verdict (`word`) shows at its clue only, so a wrong word never\n * marks its right letters, nor a crossing square, wrong.\n */\n #squareVerdict(square: number): SlotVerdict | null {\n const slot = this.#slot(square);\n if (!this.letters.has(slot)) return null;\n return this.slotVerdict(slot);\n }\n\n /** The correct word when the student's letters differ from it. */\n #wordSolution(word: Word): string | null {\n const solution = this.solution;\n if (solution === null) return null;\n const letters = word.squares.map((sq) => solution[this.#slot(sq)] ?? '');\n if (letters.every((l, k) => l === this.letters.get(this.#slot(word.squares[k] ?? -1)))) return null;\n return letters.join('');\n }\n\n // Moving and typing\n\n /** Makes `square` active, in `direction` when a word runs that way there, and says the clue when it changes. */\n #activate(square: number, direction: Direction = this.direction): void {\n const ways = this.#layoutNow.through.get(square) ?? {};\n this.direction = ways[direction] === undefined ? other(direction) : direction;\n this.#grid.focus(square);\n const word = this.#activeWord;\n if (word !== null && word.id !== this.#said) {\n this.#said = word.id;\n this.announce(this.#clueText(word));\n }\n }\n\n /** A word's first empty square, else its first (the focus follows when it is in the element). */\n #goTo(word: Word): void {\n const empty = word.squares.find((sq) => !this.letters.has(this.#slot(sq)));\n this.#activate(empty ?? word.squares[0] ?? 0, word.direction);\n }\n\n /** The square `steps` along the active word from the active one, or null past its ends. */\n #along(steps: number): number | null {\n const squares = this.#activeWord?.squares ?? [];\n return squares[squares.indexOf(this.#grid.active) + steps] ?? null;\n }\n\n #set(square: number, letter: string): void {\n const slot = this.#slot(square);\n if ((this.letters.get(slot) ?? '') === letter) return;\n const next = new Map(this.letters);\n if (letter === '') next.delete(slot);\n else next.set(slot, letter);\n this.letters = next;\n this.emitChange({ [slot]: letter });\n }\n\n #squareOf(event: Event): number | null {\n const cell = (event.target as HTMLElement).dataset.cell;\n return cell === undefined ? null : Number(cell);\n }\n\n #focusin(event: FocusEvent): void {\n const square = this.#squareOf(event);\n if (square === null) return;\n (event.target as HTMLInputElement).select();\n if (square !== this.#grid.active || this.#activeWord?.id !== this.#said) this.#activate(square);\n }\n\n #pointerdown(event: PointerEvent): void {\n const square = this.#squareOf(event);\n this.#again = square === this.#grid.active && this.shadowRoot?.activeElement === event.target;\n }\n\n /** Pressing the active square again turns to the other word there. */\n #click(event: MouseEvent): void {\n const square = this.#squareOf(event);\n if (square === null || !this.#again) return;\n this.#again = false;\n this.#activate(square, other(this.direction));\n }\n\n /** A letter fills the square and moves on along the word; other characters are ignored; deleting clears it. */\n #input(event: InputEvent): void {\n const square = this.#squareOf(event);\n if (square === null || this.disabled) return;\n const input = event.target as HTMLInputElement;\n if (event.inputType.startsWith('delete')) {\n this.#set(square, '');\n return;\n }\n const typed = [...(event.data ?? input.value).normalize('NFC')].reverse().find((ch) => LETTER.test(ch));\n if (typed !== undefined) this.#set(square, this.#upper(typed));\n input.value = this.letters.get(this.#slot(square)) ?? '';\n const next = typed === undefined ? null : this.#along(1);\n if (next !== null) this.#activate(next, this.#activeWord?.direction);\n }\n\n #keydown(event: KeyboardEvent): void {\n const square = this.#squareOf(event);\n if (square === null || event.altKey || event.ctrlKey || event.metaKey) return;\n const key = event.key;\n if (key === 'Tab' || key === 'Enter') {\n const word = this.#activeWord;\n const next = this.#words[(word === null ? -1 : this.#words.indexOf(word)) + (event.shiftKey ? -1 : 1)];\n // Tab past the first or the last clue leaves the grid.\n if (next === undefined && key === 'Tab') return;\n event.preventDefault();\n if (next !== undefined) this.#goTo(next);\n } else if (key === ' ') {\n event.preventDefault();\n this.#activate(square, other(this.direction));\n } else if (key === 'Backspace') {\n event.preventDefault();\n if (this.disabled) return;\n const back = this.#along(-1);\n if (this.letters.has(this.#slot(square)) || back === null) this.#set(square, '');\n else {\n this.#set(back, '');\n this.#activate(back, this.#activeWord?.direction);\n }\n } else this.#arrow(event, square);\n }\n\n /** An arrow: the first press turns where a word runs that way, else it moves to the nearest open square. */\n #arrow(event: KeyboardEvent, square: number): void {\n const across = arrowDelta(event, 'inline', this);\n const down = arrowDelta(event, 'block', this);\n if (across === 0 && down === 0) return;\n event.preventDefault();\n const way: Direction = across === 0 ? 'down' : 'across';\n const ways = this.#layoutNow.through.get(square) ?? {};\n if (way !== this.direction && ways[way] !== undefined) {\n this.#activate(square, way);\n return;\n }\n const { rows, columns, slots } = this.#layoutNow;\n let [r, c] = [Math.floor(square / columns), square % columns];\n for (;;) {\n r += down;\n c += across;\n if (r < 0 || r >= rows || c < 0 || c >= columns) return;\n if (slots.has(r * columns + c)) break;\n }\n this.#activate(r * columns + c, way);\n }\n}\n\nexport const crosswordElement: ElementRegistration = {\n manifest: crosswordManifest,\n element: CrosswordElement,\n messages: crossw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EAAM,EAAE,EAClB,KAAKX,GAAUW,EAAM,KAAK1D,IAAa,SAAS,EAEpD,MAAO,KAAK2D,GAAO9B,EAAOW,CAAM,CAClC,CAGA,GAAO,EAAsB,EAAsB,CACjD,IAAMoB,EAAS7F,EAAW8D,EAAO,SAAU,IAAI,EACzCgC,EAAO9F,EAAW8D,EAAO,QAAS,IAAI,EAC5C,GAAI+B,IAAW,GAAKC,IAAS,EAAG,OAChChC,EAAM,eAAe,EACrB,IAAMiC,EAAiBF,IAAW,EAAI,OAAS,SACzC7C,EAAO,KAAK9B,GAAW,QAAQ,IAAIuD,CAAM,GAAK,CAAC,EACrD,GAAIsB,IAAQ,KAAK,WAAa/C,EAAK+C,KAAS,IAAA,GAAW,CACrD,KAAKf,GAAUP,EAAQsB,CAAG,EAC1B,MACF,CACA,GAAM,CAAE,OAAM,UAAS,SAAU,KAAK7E,GAClC,CAAC+C,EAAGC,GAAK,CAAC,KAAK,MAAMO,EAAS9B,CAAO,EAAG8B,EAAS9B,CAAO,EAC5D,OAAS,CAGP,GAFA,GAAKmD,EACL,GAAKD,EACD5B,EAAI,GAAKA,GAAKvB,GAAQwB,EAAI,GAAKA,GAAKvB,EAAS,OACjD,GAAI4B,EAAM,IAAIN,EAAItB,EAAUuB,CAAC,EAAG,KAClC,CACA,KAAKc,GAAUf,EAAItB,EAAUuB,EAAG6B,CAAG,CACrC,CACF,EAEaC,EAAwC,CACnD,SAAUnG,EACV,QAASc,EACT,SAAUP,CACZ,E"}
1
+ {"version":3,"file":"crossword-BdOAEPcL.js","names":["en","pl","LitElement","nothing","ifDefined","live","b","i$1","A","verdictIcon","AstlElement","o","i","squaresOf","en_default","crosswordManifest","pl_default","l","arrowDelta","RovingFocus","blockStyles","namespace","crosswordUiMessages","LETTER","other","d","said","el","img","CrosswordElement","element","#grid","#rows","#columns","#list","#words","#layoutNow","w","next","id","value","answers","letter","#upper","words","#slot","sq","#layout","first","ui","word","#activeWord","crossing","#crossing","#clueText","#keydown","#input","#focusin","#pointerdown","#click","rows","columns","#renderSquare","list","#renderClue","slot","ways","start","verdict","#squareVerdict","name","#squareName","active","index","#wordVerdict","solution","#wordSolution","refs","current","#goTo","event","placed","squares","r","c","through","ids","open","a","slots","k","square","feedback","own","letters","direction","#said","empty","#activate","steps","cell","#squareOf","#again","input","#set","typed","ch","#along","key","back","#arrow","across","down","way","crosswordElement"],"sources":["../../../../components/src/crossword/ui-messages.ts","../../../../components/src/crossword/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.crossword';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `crosswordMessages` would put the authoring strings into the element's chunk.\n */\nexport const crosswordUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type {\n Answers,\n ComponentManifest,\n GroupVerdict,\n MessageCatalog,\n SlotVerdict,\n Units,\n} from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { arrowDelta, RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { blockStyles } from '../block-styles.js';\nimport { type Direction, squaresOf } from './grid.js';\nimport { crosswordManifest } from './manifest.js';\nimport { crosswordUiMessages } from './ui-messages.js';\n\n/** A word of the view: its clue (the light-DOM child) and its squares, by index (row x columns + column). */\ninterface Word {\n readonly id: string;\n readonly el: HTMLElement;\n readonly number: number;\n readonly direction: Direction;\n readonly squares: readonly number[];\n}\n\ninterface Layout {\n readonly rows: number;\n readonly columns: number;\n /** In clue order: across, then down, by number. */\n readonly words: readonly Word[];\n /** The slot id of each open square. */\n readonly slots: ReadonlyMap<number, string>;\n readonly through: ReadonlyMap<number, Partial<Record<Direction, Word>>>;\n}\n\nconst LETTER = /^\\p{L}$/u;\nconst other = (d: Direction): Direction => (d === 'across' ? 'down' : 'across');\n/** What a clue says: its text, with the alt text of its pictures. */\nconst said = (el: Element): string =>\n [el.textContent ?? '', ...[...el.querySelectorAll('img')].map((img) => img.alt)]\n .join(' ')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/**\n * `<astl-crossword>`: a grid of squares, every open one an `<input>` (one `letter` slot, the view's `cells` in reading\n * order), and the clues, the light-DOM `<astl-crossword-word>` children (slotted manually, never moved).\n * - One tab stop in the grid (`RovingFocus`): a letter moves along the active word, the arrows to the nearest open\n * square (first turning where two words cross), Space turns, Tab and Enter go to the next clue (Shift back) and Tab\n * leaves at the ends. The clue list is one more tab stop; pressing a clue goes to its first empty square.\n * - The current clue shows above the grid and goes to the player's live region when it changes.\n * - Verdicts: per word (`feedback.groups`, scoring `word`), per square (`letter`), or for the grid (`whole`).\n */\nexport class CrosswordElement extends AstlElement {\n static override manifest: ComponentManifest = crosswordManifest;\n static override messages: readonly MessageCatalog[] = crosswordUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n letters: { state: true },\n direction: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // Squares of 32 to 44 px share the room of the field (a container); a grid wider than that scrolls in it, with a\n // cue (below). The floor is not the WCAG 2.5.8 minimum (24 px: squares touch, so its spacing exception cannot apply\n // and each square must reach it itself) but what a square must hold: its number at the smallest text size (14 px,\n // as all text young students read) above its letter, at least 14 px too, in a text entry at least 24 px tall. At\n // 32 px both fit, the letter on its own line under the number's, so they never meet; the letter grows with the\n // square and keeps that line. A 20-column grid now fits a 760 px player; a 30-column one scrolls there. The field\n // clips, so the grid's padding (the edge) is as wide as a focus ring reaches past a square, plus a border: squares\n // share borders, so the last column and row hang a border past their tracks. A square scrolled into view keeps\n // the same room by its input's scroll margin (the input sits a border inside its square, which draws the ring).\n css`\n .board {\n --astl-cw-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset) + var(--astl-outline-width));\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--astl-space-4);\n }\n .field {\n flex: 0 1 calc(var(--astl-cw-columns) * 2.75rem + 2 * var(--astl-cw-edge));\n min-inline-size: 0;\n max-inline-size: 100%;\n container-type: inline-size;\n }\n .grid {\n --astl-cw-cell: clamp(2rem, (100cqi - 2 * var(--astl-cw-edge)) / var(--astl-cw-columns), 2.75rem);\n display: grid;\n grid-template-columns: repeat(var(--astl-cw-columns), var(--astl-cw-cell));\n grid-auto-rows: var(--astl-cw-cell);\n inline-size: max-content;\n padding: var(--astl-cw-edge);\n }\n .cell {\n position: relative;\n box-sizing: border-box;\n margin-block-end: calc(-1 * var(--astl-outline-width));\n margin-inline-end: calc(-1 * var(--astl-outline-width));\n border: var(--astl-outline-width) solid var(--astl-outline);\n background: var(--astl-surface);\n }\n .cell[data-word] {\n background: var(--astl-selected-soft);\n box-shadow: inset 0 0 0 calc(var(--astl-selected-bar) / 2) var(--astl-selected);\n }\n .cell[data-verdict] {\n z-index: 1;\n }\n .cell:focus-within {\n z-index: 2;\n }\n .cell > input {\n box-sizing: border-box;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n padding: calc(var(--astl-size-small) + 1px) 0 0;\n border: 0;\n background: none;\n color: var(--astl-ink);\n font: inherit;\n font-size: min(var(--astl-cw-cell) * 0.5, var(--astl-cw-cell) - var(--astl-size-small) - 4px);\n font-weight: 600;\n line-height: 1;\n text-align: center;\n caret-color: transparent;\n cursor: pointer;\n scroll-margin: var(--astl-cw-edge);\n }\n .cell > input::selection {\n background: none;\n }\n .number,\n .cell > .astl-verdict {\n position: absolute;\n line-height: 1;\n pointer-events: none;\n }\n .number {\n inset-block-start: 1px;\n inset-inline-start: 2px;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n .cell > .astl-verdict {\n inset-block-start: 1px;\n inset-inline-end: 1px;\n font-size: min(0.875rem, var(--astl-cw-cell) * 0.4);\n }\n `,\n // A grid wider than its field scrolls sideways, and shows it: a shadow at each edge that has more to scroll to\n // (scroll shadows: covers that move with the content over shadows that stay with the field).\n css`\n .field {\n overflow-x: auto;\n background:\n linear-gradient(to right, var(--astl-surface) 40%, transparent) left / 2rem 100% no-repeat local,\n linear-gradient(to left, var(--astl-surface) 40%, transparent) right / 2rem 100% no-repeat local,\n radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n left / 0.75rem 100% no-repeat scroll,\n radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n right / 0.75rem 100% no-repeat scroll;\n scrollbar-color: var(--astl-outline) transparent;\n }\n `,\n // The current clue sits above the grid; in the list the current clue is marked like a picked item (a bar and a\n // weight where the theme has them, never colour alone), the crossing one with a quiet border.\n css`\n .current {\n margin-block: 0 var(--astl-space-3);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border-inline-start: var(--astl-focus-width) solid var(--astl-selected);\n border-radius: var(--astl-radius-m);\n background: var(--astl-selected-soft);\n font-weight: 600;\n }\n .clues {\n flex: 1 1 16rem;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n .title {\n margin: 0;\n font-weight: 600;\n }\n ol {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .entry {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n border: var(--astl-outline-width) solid transparent;\n border-radius: var(--astl-radius-m);\n }\n .entry[data-current] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .entry[data-current]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .entry[data-crossing] {\n border-color: var(--astl-outline);\n }\n .entry > button {\n flex: 1 1 12rem;\n display: flex;\n align-items: baseline;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-3);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n .entry .num {\n flex: none;\n min-inline-size: 1.5em;\n font-weight: 700;\n }\n .entry .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .entry .length {\n color: var(--astl-ink-muted);\n white-space: nowrap;\n }\n .entry > .astl-verdict {\n padding-inline-end: var(--astl-space-3);\n }\n .entry > .astl-solution {\n flex-basis: 100%;\n padding-inline: var(--astl-space-3);\n padding-block-end: var(--astl-space-2);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n blockStyles,\n ];\n\n /** Slot id to its letter. */\n declare protected letters: ReadonlyMap<string, string>;\n /** The direction of the active word where two words cross. */\n declare protected direction: Direction;\n #layout: Layout | null = null;\n /** The active word announced last, so moving inside it says nothing. */\n #said: string | null = null;\n /** A press on the square that already had the focus turns the direction. */\n #again = false;\n readonly #grid: RovingFocus;\n readonly #list: RovingFocus;\n\n constructor() {\n super();\n this.letters = new Map();\n this.direction = 'across';\n const element = this;\n this.#grid = new RovingFocus(this, {\n count: () => this.#rows * this.#columns,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`input[data-cell=\"${i}\"]`),\n axis: 'grid',\n get columns() {\n return element.#columns;\n },\n });\n this.#list = new RovingFocus(this, {\n count: () => this.#words.length,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`button[data-index=\"${i}\"]`),\n axis: 'block',\n });\n }\n\n get slotIds(): readonly string[] {\n return [...this.#layoutNow.slots.values()];\n }\n\n get groupIds(): readonly string[] {\n return this.#words.map((w) => w.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.letters);\n }\n\n /** One letter per slot, in capitals; anything else is not shown, so the slot stays empty. */\n setAnswers(answers: Answers): void {\n const next = new Map(this.letters);\n for (const id of this.slotIds) {\n const value = answers[id];\n if (value === undefined) continue;\n next.delete(id);\n const letter = this.#upper(value.trim().normalize('NFC'));\n if (LETTER.test(letter)) next.set(id, letter);\n }\n this.letters = next;\n }\n\n /** One unit per word, answered when every square of it holds a letter. */\n units(): Units {\n const words = this.#words;\n const full = words.filter((w) => w.squares.every((sq) => this.letters.has(this.#slot(sq))));\n return { answered: full.length, total: words.length };\n }\n\n protected override willUpdate(): void {\n // The view is read again once per render (a view is immutable, so this is cheap insurance, not a cache miss).\n this.#layout = null;\n // The tab stop starts on the first square of the first clue.\n const first = this.#words[0];\n if (first !== undefined && !this.#layoutNow.slots.has(this.#grid.active)) {\n this.#grid.focus(first.squares[0] ?? 0);\n this.direction = first.direction;\n }\n }\n\n protected override updated(): void {\n // Through the CSSOM, which a strict Content Security Policy allows (an inline style attribute it blocks).\n this.renderRoot\n .querySelector<HTMLElement>('.board')\n ?.style.setProperty('--astl-cw-columns', `${this.#columns}`);\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const { rows, columns, words } = this.#layoutNow;\n const word = this.#activeWord;\n const crossing = this.#crossing;\n return html`<fieldset part=\"crossword\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.hint')}</span>\n </legend>\n <p class=\"current\" part=\"current\" lang=${ui.lang} dir=${ui.dir}>${word === null ? nothing : this.#clueText(word)}</p>\n <div class=\"board\">\n <div class=\"field\">\n <div\n class=\"grid\"\n part=\"grid\"\n role=\"group\"\n aria-label=${this.t('ui.grid', { rows, columns })}\n aria-describedby=\"instructions\"\n @keydown=${this.#keydown}\n @input=${this.#input}\n @focusin=${this.#focusin}\n @pointerdown=${this.#pointerdown}\n @click=${this.#click}\n >\n ${Array.from({ length: rows * columns }, (_, i) => this.#renderSquare(i, word))}\n </div>\n </div>\n <div class=\"clues\" part=\"clues\" role=\"group\" aria-label=${this.t('ui.clues')} lang=${ui.lang} dir=${ui.dir}>\n ${(['across', 'down'] as const).map((d) => {\n const list = words.filter((w) => w.direction === d);\n return list.length === 0\n ? nothing\n : html`<p class=\"title\" id=\"title-${d}\">${this.t(`ui.${d}`)}</p>\n <ol role=\"list\" aria-labelledby=\"title-${d}\">\n ${list.map((w) => this.#renderClue(w, w === word, w === crossing))}\n </ol>`;\n })}\n </div>\n </div>\n <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n #renderSquare(i: number, active: Word | null): TemplateResult {\n const slot = this.#layoutNow.slots.get(i);\n if (slot === undefined) return html`<span aria-hidden=\"true\"></span>`;\n const ways = this.#layoutNow.through.get(i) ?? {};\n const word = ways[this.direction] ?? ways[other(this.direction)];\n const start = [ways.across, ways.down].find((w) => w?.squares[0] === i);\n const verdict = this.#squareVerdict(i);\n const name = word === undefined ? '' : this.#squareName(word, i);\n return html`<span\n class=\"cell astl-box astl-ring\"\n part=\"cell\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-word=${active?.squares.includes(i) ?? false}\n >\n ${start === undefined ? nothing : html`<span class=\"number\" part=\"number\" aria-hidden=\"true\">${start.number}</span>`}\n <input\n type=\"text\"\n data-cell=${i}\n tabindex=${this.#grid.tabIndex(i)}\n lang=${ifDefined(this.contentLang || undefined)}\n autocomplete=\"off\"\n autocapitalize=\"characters\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n enterkeyhint=\"next\"\n aria-label=${name}\n aria-invalid=${verdict === 'incorrect' ? 'true' : nothing}\n aria-describedby=${ifDefined(verdict === null ? undefined : `verdict-${i}`)}\n ?readonly=${this.disabled}\n .value=${live(this.letters.get(slot) ?? '')}\n />\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n </span>`;\n }\n\n #renderClue(word: Word, current: boolean, crossing: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const index = this.#words.indexOf(word);\n const verdict = this.#wordVerdict(word);\n const solution = this.#wordSolution(word);\n const refs = [\n verdict === null ? '' : `clue-verdict-${index}`,\n solution === null ? '' : `solution-${index}`,\n ];\n return html`<li\n class=\"entry astl-box astl-ring\"\n part=\"clue\"\n id=${word.id}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-current=${current}\n ?data-crossing=${crossing}\n >\n <button\n type=\"button\"\n data-index=${index}\n tabindex=${this.#list.tabIndex(index)}\n aria-current=${current ? 'true' : nothing}\n aria-describedby=${refs.filter(Boolean).join(' ') || nothing}\n @click=${() => this.#goTo(word)}\n @keydown=${(event: KeyboardEvent) => this.#list.keydown(event)}\n >\n <span class=\"num\">${word.number}</span>\n <span class=\"text\"\n ><span lang=${ifDefined(this.contentLang || undefined)}><slot data-word=${word.id}></slot></span>\n <span class=\"length\">${this.t('ui.length', { length: word.squares.length })}</span></span\n >\n ${crossing ? html`<span class=\"astl-vh\">, ${this.t('ui.crossing')}</span>` : nothing}\n </button>\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `clue-verdict-${index}` })}\n ${\n solution === null\n ? nothing\n : html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${index}\" lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(this.contentLang || undefined)}>${solution}</bdi>\n </p>`\n }\n </li>`;\n }\n\n // The layout\n\n get #rows(): number {\n return this.numberAttribute('rows') ?? 0;\n }\n\n get #columns(): number {\n return this.numberAttribute('columns') ?? 0;\n }\n\n get #words(): readonly Word[] {\n return this.#layoutNow.words;\n }\n\n /** Read from the view, once between two renders: the words and where they lie, the slot of each open square. */\n get #layoutNow(): Layout {\n if (this.#layout !== null) return this.#layout;\n const rows = this.#rows;\n const columns = this.#columns;\n const words = this.childElements('astl-crossword-word').map((el): Word => {\n const placed = {\n row: Number(el.getAttribute('row')),\n column: Number(el.getAttribute('column')),\n direction: el.getAttribute('direction') === 'down' ? ('down' as const) : ('across' as const),\n length: Number(el.getAttribute('length')),\n };\n const squares = squaresOf(placed)\n .filter(([r, c]) => r >= 0 && r < rows && c >= 0 && c < columns)\n .map(([r, c]) => r * columns + c);\n return {\n id: el.id,\n el,\n number: Number(el.getAttribute('number')),\n direction: placed.direction,\n squares,\n };\n });\n const through = new Map<number, Partial<Record<Direction, Word>>>();\n for (const w of words)\n for (const sq of w.squares) through.set(sq, { ...through.get(sq), [w.direction]: w });\n const ids = (this.getAttribute('cells') ?? '').split(' ').filter(Boolean);\n const open = [...through.keys()].sort((a, b) => a - b);\n const slots = new Map(open.flatMap((sq, k) => (ids[k] === undefined ? [] : [[sq, ids[k]] as const])));\n this.#layout = { rows, columns, words, slots, through };\n return this.#layout;\n }\n\n #slot(square: number): string {\n return this.#layoutNow.slots.get(square) ?? '';\n }\n\n /** The word the active square belongs to in the active direction, else its other one. */\n get #activeWord(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n return ways[this.direction] ?? ways[other(this.direction)] ?? null;\n }\n\n /** The other word through the active square, if two cross there. */\n get #crossing(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n const word = this.#activeWord;\n return word === null ? null : (ways[other(word.direction)] ?? null);\n }\n\n #clueText(word: Word): string {\n const { number, direction } = word;\n return this.t('ui.current', { number, direction, length: word.squares.length, clue: said(word.el) });\n }\n\n #squareName(word: Word, square: number): string {\n const { number, direction, squares } = word;\n return this.t('ui.cell', {\n number,\n direction,\n position: squares.indexOf(square) + 1,\n length: squares.length,\n });\n }\n\n #upper(value: string): string {\n try {\n return value.toLocaleUpperCase(this.contentLang || undefined);\n } catch {\n return value.toUpperCase();\n }\n }\n\n // Verdicts and solutions\n\n /**\n * A word's verdict after a check, until the next edit: its group's (scoring `word`); else, under the element's\n * verdict, \"no answer\" for a word without a letter and, with square verdicts (`letter`), right when every square is.\n */\n #wordVerdict(word: Word): GroupVerdict | null {\n const feedback = this.feedback;\n if (feedback === null) return null;\n const own = feedback.groups?.[word.id];\n if (own !== undefined) return own;\n if (feedback.group === null) return null;\n if (word.squares.every((sq) => !this.letters.has(this.#slot(sq)))) return 'empty';\n if (Object.keys(feedback.slots).length === 0) return null;\n return word.squares.every((sq) => feedback.slots[this.#slot(sq)] === 'correct') ? 'correct' : 'incorrect';\n }\n\n /**\n * A filled square's own verdict (`letter`); a word's verdict (`word`) shows at its clue only, so a wrong word never\n * marks its right letters, nor a crossing square, wrong.\n */\n #squareVerdict(square: number): SlotVerdict | null {\n const slot = this.#slot(square);\n if (!this.letters.has(slot)) return null;\n return this.slotVerdict(slot);\n }\n\n /** The correct word when the student's letters differ from it. */\n #wordSolution(word: Word): string | null {\n const solution = this.solution;\n if (solution === null) return null;\n const letters = word.squares.map((sq) => solution[this.#slot(sq)] ?? '');\n if (letters.every((l, k) => l === this.letters.get(this.#slot(word.squares[k] ?? -1)))) return null;\n return letters.join('');\n }\n\n // Moving and typing\n\n /** Makes `square` active, in `direction` when a word runs that way there, and says the clue when it changes. */\n #activate(square: number, direction: Direction = this.direction): void {\n const ways = this.#layoutNow.through.get(square) ?? {};\n this.direction = ways[direction] === undefined ? other(direction) : direction;\n this.#grid.focus(square);\n const word = this.#activeWord;\n if (word !== null && word.id !== this.#said) {\n this.#said = word.id;\n this.announce(this.#clueText(word));\n }\n }\n\n /** A word's first empty square, else its first (the focus follows when it is in the element). */\n #goTo(word: Word): void {\n const empty = word.squares.find((sq) => !this.letters.has(this.#slot(sq)));\n this.#activate(empty ?? word.squares[0] ?? 0, word.direction);\n }\n\n /** The square `steps` along the active word from the active one, or null past its ends. */\n #along(steps: number): number | null {\n const squares = this.#activeWord?.squares ?? [];\n return squares[squares.indexOf(this.#grid.active) + steps] ?? null;\n }\n\n #set(square: number, letter: string): void {\n const slot = this.#slot(square);\n if ((this.letters.get(slot) ?? '') === letter) return;\n const next = new Map(this.letters);\n if (letter === '') next.delete(slot);\n else next.set(slot, letter);\n this.letters = next;\n this.emitChange({ [slot]: letter });\n }\n\n #squareOf(event: Event): number | null {\n const cell = (event.target as HTMLElement).dataset.cell;\n return cell === undefined ? null : Number(cell);\n }\n\n #focusin(event: FocusEvent): void {\n const square = this.#squareOf(event);\n if (square === null) return;\n (event.target as HTMLInputElement).select();\n if (square !== this.#grid.active || this.#activeWord?.id !== this.#said) this.#activate(square);\n }\n\n #pointerdown(event: PointerEvent): void {\n const square = this.#squareOf(event);\n this.#again = square === this.#grid.active && this.shadowRoot?.activeElement === event.target;\n }\n\n /** Pressing the active square again turns to the other word there. */\n #click(event: MouseEvent): void {\n const square = this.#squareOf(event);\n if (square === null || !this.#again) return;\n this.#again = false;\n this.#activate(square, other(this.direction));\n }\n\n /** A letter fills the square and moves on along the word; other characters are ignored; deleting clears it. */\n #input(event: InputEvent): void {\n const square = this.#squareOf(event);\n if (square === null || this.disabled) return;\n const input = event.target as HTMLInputElement;\n if (event.inputType.startsWith('delete')) {\n this.#set(square, '');\n return;\n }\n const typed = [...(event.data ?? input.value).normalize('NFC')].reverse().find((ch) => LETTER.test(ch));\n if (typed !== undefined) this.#set(square, this.#upper(typed));\n input.value = this.letters.get(this.#slot(square)) ?? '';\n const next = typed === undefined ? null : this.#along(1);\n if (next !== null) this.#activate(next, this.#activeWord?.direction);\n }\n\n #keydown(event: KeyboardEvent): void {\n const square = this.#squareOf(event);\n if (square === null || event.altKey || event.ctrlKey || event.metaKey) return;\n const key = event.key;\n if (key === 'Tab' || key === 'Enter') {\n const word = this.#activeWord;\n const next = this.#words[(word === null ? -1 : this.#words.indexOf(word)) + (event.shiftKey ? -1 : 1)];\n // Tab past the first or the last clue leaves the grid.\n if (next === undefined && key === 'Tab') return;\n event.preventDefault();\n if (next !== undefined) this.#goTo(next);\n } else if (key === ' ') {\n event.preventDefault();\n this.#activate(square, other(this.direction));\n } else if (key === 'Backspace') {\n event.preventDefault();\n if (this.disabled) return;\n const back = this.#along(-1);\n if (this.letters.has(this.#slot(square)) || back === null) this.#set(square, '');\n else {\n this.#set(back, '');\n this.#activate(back, this.#activeWord?.direction);\n }\n } else this.#arrow(event, square);\n }\n\n /** An arrow: the first press turns where a word runs that way, else it moves to the nearest open square. */\n #arrow(event: KeyboardEvent, square: number): void {\n const across = arrowDelta(event, 'inline', this);\n const down = arrowDelta(event, 'block', this);\n if (across === 0 && down === 0) return;\n event.preventDefault();\n const way: Direction = across === 0 ? 'down' : 'across';\n const ways = this.#layoutNow.through.get(square) ?? {};\n if (way !== this.direction && ways[way] !== undefined) {\n this.#activate(square, way);\n return;\n }\n const { rows, columns, slots } = this.#layoutNow;\n let [r, c] = [Math.floor(square / columns), square % columns];\n for (;;) {\n r += down;\n c += across;\n if (r < 0 || r >= rows || c < 0 || c >= columns) return;\n if (slots.has(r * columns + c)) break;\n }\n this.#activate(r * columns + c, way);\n }\n}\n\nexport const crosswordElement: ElementRegistration = {\n manifest: crosswordManifest,\n element: CrosswordElement,\n messages: crosswordUiMessages,\n};\n"],"mappings":"A,0UAIA,IAAMqB,EAAY,iBAMLC,EAAiD,CAC5D,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECgCMsB,EAAS,WACTC,EAAS,GAA6BC,IAAM,SAAW,OAAS,SAEhEC,EAAQ,GACZ,CAACC,EAAG,aAAe,GAAI,GAAG,CAAC,GAAGA,EAAG,iBAAiB,KAAK,CAAC,CAAC,CAAC,IAAK,GAAQC,EAAI,GAAG,CAAC,CAAC,CAC7E,KAAK,GAAG,CAAC,CACT,QAAQ,OAAQ,GAAG,CAAC,CACpB,KAAK,EAWGC,EAAb,cAAsCnB,CAAY,CAChD,OAAgB,SAA8BK,EAC9C,OAAgB,SAAsCO,EACtD,OAAgB,kBAAoC,CAClD,GAAGpB,EAAW,kBACd,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